package com.gentics.mesh.core.admin;

import static com.gentics.mesh.test.context.MeshTestHelper.call;
import static com.gentics.mesh.test.context.MeshTestHelper.expectResponseMessage;

import java.io.IOException;

import static com.gentics.mesh.test.TestSize.PROJECT;

import org.junit.Test;

import com.gentics.mesh.core.rest.common.GenericMessageResponse;
import com.gentics.mesh.graphdb.Tx;
import com.gentics.mesh.test.context.AbstractMeshTest;
import com.gentics.mesh.test.context.MeshTestSetting;

@MeshTestSetting(useElasticsearch = false, testSize = PROJECT, startServer = true, inMemoryDB = false)
public class AdminEndpointTest extends AbstractMeshTest {

	@Test
	public void testMigrationStatusWithNoMigrationRunning() {
		GenericMessageResponse message = call(() -> client().schemaMigrationStatus());
		expectResponseMessage(message, "migration_status_idle");
	}

	@Test
	public void testBackupRestore() throws IOException {
		try (Tx tx = db().tx()) {
			group().addRole(roles().get("admin"));
			tx.success();
		}
		GenericMessageResponse message = call(() -> client().invokeBackup());
		expectResponseMessage(message, "backup_finished");

		message = call(() -> client().invokeRestore());
		expectResponseMessage(message, "restore_finished");
	}

	@Test
	public void testExportImport() {
		try (Tx tx = db().tx()) {
			group().addRole(roles().get("admin"));
			tx.success();
		}
		GenericMessageResponse message = call(() -> client().invokeExport());
		expectResponseMessage(message, "export_finished");

		message = call(() -> client().invokeImport());
		expectResponseMessage(message, "import_finished");
	}

}

@@ -27,24 +27,78 @@
 ore.admin;%0A%0A
+import static com.gentics.mesh.test.TestSize.PROJECT;%0A
 import stati
@@ -273,55 +273,25 @@
 ort 
-static com.gentics.mesh.test.TestSize.PROJECT;%0A
+org.junit.Ignore;
 %0Aimp
@@ -1279,32 +1279,62 @@
 d%22);%0A%09%7D%0A%0A%09@Test%0A
+%09@Ignore(%22Endpoint disabled%22)%0A
 %09public void tes

Disable bogus endpoint test