Add test cases for HTTP server-level commands
@@ -5,6 +5,8 @@ import org.apache.http.HttpResponse;
import org.junit.Assert;
import org.junit.Test;
+import java.io.IOException;
+
public class HttpServerTest extends BaseHttpDatabaseTest {
@Test
public void testGetServer() throws Exception {
@@ -27,6 +29,22 @@ public class HttpServerTest extends BaseHttpDatabaseTest {
Assert.assertTrue(payload.containsField("connections"));
}
+ @Test
+ public void testCreateDatabase() throws IOException {
+ String dbName = getClass().getSimpleName()+"testCreateDatabase";
+ HttpResponse res =
+ setUserName("root")
+ .setUserPassword("root")
+ .post("servercommand")
+ .payload("{\"command\":\"create database "+dbName+" plocal\" }", CONTENT.JSON)
+ .getResponse();
+ System.out.println(res.getStatusLine().getReasonPhrase());
+ Assert.assertEquals(res.getStatusLine().getStatusCode(), 200);
+
+ Assert.assertTrue(getServer().getContext().exists(dbName));
+ getServer().getContext().drop(dbName);
+ }
+
@Override
protected String getDatabaseName() {
return "server";
