From 9d26b6915228c1acb200f6102da5f5f25d0108e2 Mon Sep 17 00:00:00 2001 From: Andres Taylor Date: Mon, 30 Jan 2017 10:09:41 +0100 Subject: [PATCH] Moved test from community server to enterprise server --- .../rest/transactional/CypherQueriesIT.java | 15 ---- enterprise/server-enterprise/pom.xml | 5 ++ .../neo4j/server/rest/CypherQueriesIT.java | 42 +++++++++++ .../EnterpriseVersionAndEditionServiceIT.java | 66 +---------------- .../server/rest/EnterpriseVersionIT.java | 74 +++++++++++++++++++ 5 files changed, 122 insertions(+), 80 deletions(-) create mode 100644 enterprise/server-enterprise/src/test/java/org/neo4j/server/rest/CypherQueriesIT.java create mode 100644 enterprise/server-enterprise/src/test/java/org/neo4j/server/rest/EnterpriseVersionIT.java diff --git a/community/server/src/test/java/org/neo4j/server/rest/transactional/CypherQueriesIT.java b/community/server/src/test/java/org/neo4j/server/rest/transactional/CypherQueriesIT.java index 60bedd2da08f3..ba1aac0a7cf3f 100644 --- a/community/server/src/test/java/org/neo4j/server/rest/transactional/CypherQueriesIT.java +++ b/community/server/src/test/java/org/neo4j/server/rest/transactional/CypherQueriesIT.java @@ -35,21 +35,6 @@ public class CypherQueriesIT extends AbstractRestFunctionalTestBase { - @Test - public void runningInCompiledRuntime() throws JsonParseException - { - // Document - ResponseEntity response = gen.get() - .expectedStatus( 200 ) - .payload( quotedJson( - "{ 'statements': [ { 'statement': 'CYPHER runtime=compiled MATCH (n) RETURN n' } ] }" ) ) - .post( getDataUri() + "transaction/commit" ); - - // Then - Map result = jsonToMap( response.entity() ); - assertNoErrors( result ); - } - @Test public void runningWithGeometryTypes() throws JsonParseException { diff --git a/enterprise/server-enterprise/pom.xml b/enterprise/server-enterprise/pom.xml index e3e45dea485b5..ccedb78a1967d 100644 --- a/enterprise/server-enterprise/pom.xml +++ b/enterprise/server-enterprise/pom.xml @@ -64,6 +64,11 @@ neo4j-server ${project.version} + + org.neo4j + neo4j-enterprise-cypher + ${project.version} + org.neo4j neo4j-enterprise diff --git a/enterprise/server-enterprise/src/test/java/org/neo4j/server/rest/CypherQueriesIT.java b/enterprise/server-enterprise/src/test/java/org/neo4j/server/rest/CypherQueriesIT.java new file mode 100644 index 0000000000000..a4250600bfd71 --- /dev/null +++ b/enterprise/server-enterprise/src/test/java/org/neo4j/server/rest/CypherQueriesIT.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2002-2017 "Neo Technology," + * Network Engine for Objects in Lund AB [http://neotechnology.com] + * + * This file is part of Neo4j. + * + * Neo4j is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package org.neo4j.server.rest; + +import org.junit.Test; +import org.neo4j.test.server.HTTP; + +import static org.junit.Assert.assertEquals; + +public class CypherQueriesIT extends EnterpriseVersionIT { + + @Test + public void runningInCompiledRuntime() throws Exception + { + // Given + String uri = functionalTestHelper.dataUri() + "transaction/commit"; + String payload = "{ 'statements': [ { 'statement': 'CYPHER runtime=compiled MATCH (n) RETURN n' } ] }"; + + // When + HTTP.Response res = HTTP.POST(uri, payload.replaceAll("'", "\"")); + + // Then + assertEquals( 200, res.status() ); + } +} diff --git a/enterprise/server-enterprise/src/test/java/org/neo4j/server/rest/EnterpriseVersionAndEditionServiceIT.java b/enterprise/server-enterprise/src/test/java/org/neo4j/server/rest/EnterpriseVersionAndEditionServiceIT.java index 8010eb2b234b7..9cc27a03e1bb3 100644 --- a/enterprise/server-enterprise/src/test/java/org/neo4j/server/rest/EnterpriseVersionAndEditionServiceIT.java +++ b/enterprise/server-enterprise/src/test/java/org/neo4j/server/rest/EnterpriseVersionAndEditionServiceIT.java @@ -19,85 +19,21 @@ */ package org.neo4j.server.rest; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.ClassRule; import org.junit.Test; -import org.junit.rules.TemporaryFolder; - -import java.util.concurrent.Callable; - import org.neo4j.kernel.internal.KernelData; -import org.neo4j.server.NeoServer; -import org.neo4j.server.enterprise.helpers.EnterpriseServerBuilder; -import org.neo4j.server.helpers.FunctionalTestHelper; import org.neo4j.server.rest.management.VersionAndEditionService; -import org.neo4j.test.server.ExclusiveServerTestBase; import org.neo4j.test.server.HTTP; -import org.neo4j.time.Clocks; -import org.neo4j.time.FakeClock; import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; -import static org.neo4j.test.rule.SuppressOutput.suppressAll; /* Note that when running this test from within an IDE, the version field will be an empty string. This is because the code that generates the version identifier is written by Maven as part of the build process(!). The tests will pass both in the IDE (where the empty string will be correctly compared). */ -public class EnterpriseVersionAndEditionServiceIT extends ExclusiveServerTestBase -{ - private static NeoServer server; - private static FunctionalTestHelper functionalTestHelper; - - @ClassRule - public static TemporaryFolder staticFolder = new TemporaryFolder(); - - private static FakeClock clock; - - @BeforeClass - public static void setupServer() throws Exception - { - clock = Clocks.fakeClock(); - server = EnterpriseServerBuilder.server() - .usingDataDir( staticFolder.getRoot().getAbsolutePath() ) - .withClock( clock ) - .build(); - - suppressAll().call( new Callable() - { - @Override - public Void call() throws Exception - { - server.start(); - return null; - } - } ); - functionalTestHelper = new FunctionalTestHelper( server ); - } - - @Before - public void setupTheDatabase() throws Exception - { - // do nothing, we don't care about the database contents here - } - - @AfterClass - public static void stopServer() throws Exception - { - suppressAll().call( new Callable() - { - @Override - public Void call() throws Exception - { - server.stop(); - return null; - } - } ); - } +public class EnterpriseVersionAndEditionServiceIT extends EnterpriseVersionIT { @Test public void shouldReportEnterpriseEdition() throws Exception diff --git a/enterprise/server-enterprise/src/test/java/org/neo4j/server/rest/EnterpriseVersionIT.java b/enterprise/server-enterprise/src/test/java/org/neo4j/server/rest/EnterpriseVersionIT.java new file mode 100644 index 0000000000000..8fac55ac6dfd9 --- /dev/null +++ b/enterprise/server-enterprise/src/test/java/org/neo4j/server/rest/EnterpriseVersionIT.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2002-2017 "Neo Technology," + * Network Engine for Objects in Lund AB [http://neotechnology.com] + * + * This file is part of Neo4j. + * + * Neo4j is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package org.neo4j.server.rest; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.rules.TemporaryFolder; +import org.neo4j.server.NeoServer; +import org.neo4j.server.enterprise.helpers.EnterpriseServerBuilder; +import org.neo4j.server.helpers.FunctionalTestHelper; +import org.neo4j.test.server.ExclusiveServerTestBase; +import org.neo4j.time.Clocks; +import org.neo4j.time.FakeClock; + +import java.util.concurrent.Callable; + +import static org.neo4j.test.rule.SuppressOutput.suppressAll; + +public abstract class EnterpriseVersionIT extends ExclusiveServerTestBase { + @ClassRule + public static TemporaryFolder staticFolder = new TemporaryFolder(); + protected static NeoServer server; + static FunctionalTestHelper functionalTestHelper; + + @BeforeClass + public static void setupServer() throws Exception + { + FakeClock clock = Clocks.fakeClock(); + server = EnterpriseServerBuilder.server() + .usingDataDir( staticFolder.getRoot().getAbsolutePath() ) + .withClock(clock) + .build(); + + suppressAll().call((Callable) () -> { + server.start(); + return null; + }); + functionalTestHelper = new FunctionalTestHelper( server ); + } + + @AfterClass + public static void stopServer() throws Exception + { + suppressAll().call((Callable) () -> { + server.stop(); + return null; + }); + } + + @Before + public void setupTheDatabase() throws Exception + { + // do nothing, we don't care about the database contents here + } +}