Skip to content

Commit

Permalink
fixes for v 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
conker84 committed May 30, 2019
1 parent 32912af commit e95febc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 89 deletions.
29 changes: 15 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
plugins {
id 'java'
id 'idea'
id 'com.github.johnrengelman.shadow' version '2.0.1'
id "org.asciidoctor.convert" version "1.5.3"
id 'com.github.johnrengelman.shadow' version '4.0.2'
id "org.asciidoctor.convert" version "1.5.9.2"
id "com.bmuschko.nexus" version "2.3.1"
id "me.champeau.gradle.jmh" version "0.4.4"
id "io.codearte.nexus-staging" version "0.9.0"
id "me.champeau.gradle.jmh" version "0.4.8"
id "io.codearte.nexus-staging" version "0.20.0"
}
asciidoctorj {
version = '1.5.6'
version = '1.6.1'
}
apply plugin: 'io.codearte.nexus-staging'

Expand Down Expand Up @@ -40,7 +40,6 @@ ext {
neo4jVersion = "3.4.12"
// instead we apply the override logic here
neo4jVersionEffective = project.hasProperty("neo4jVersionOverride") ? project.getProperty("neo4jVersionOverride") : neo4jVersion
testContainersVersion = '1.11.0'
}

repositories {
Expand Down Expand Up @@ -157,16 +156,18 @@ dependencies {
testCompile group: 'org.gradle', name: 'gradle-tooling-api', version: '4.3'

testCompile group: 'org.xmlunit', name: 'xmlunit-core', version: '2.2.1'
testCompile group: 'com.github.adejanovski', name: 'cassandra-jdbc-wrapper', version: '3.1.0'

// Test Containers
testCompile group: 'org.testcontainers', name: 'testcontainers', version: testContainersVersion
testCompile group: 'org.testcontainers', name: 'neo4j', version: testContainersVersion
testCompile group: 'org.testcontainers', name: 'elasticsearch', version: testContainersVersion
testCompile group: 'org.testcontainers', name: 'couchbase', version: testContainersVersion
testCompile group: 'org.testcontainers', name: 'mysql', version: testContainersVersion
testCompile group: 'org.testcontainers', name: 'postgresql', version: testContainersVersion
testCompile group: 'org.testcontainers', name: 'cassandra', version: testContainersVersion
testCompile group: 'org.testcontainers', name: 'testcontainers', version: '1.11.0'
testCompile group: 'org.testcontainers', name: 'neo4j', version: '1.11.0'
testCompile group: 'org.testcontainers', name: 'elasticsearch', version: '1.11.0'
testCompile group: 'org.testcontainers', name: 'couchbase', version: '1.11.0'
testCompile group: 'org.testcontainers', name: 'mysql', version: '1.11.0'
testCompile group: 'org.testcontainers', name: 'postgresql', version: '1.11.0'

testCompile group: 'com.github.adejanovski', name: 'cassandra-jdbc-wrapper', version: '3.1.0'
testCompile group: 'com.codahale.metrics', name: 'metrics-core', version: '3.0.2'
testCompile group: 'org.testcontainers', name: 'cassandra', version: '1.11.0'

testCompile group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-csv', version: '2.9.7'

Expand Down
73 changes: 0 additions & 73 deletions src/test/java/apoc/schema/SchemasTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -538,79 +538,6 @@ public void testDropCompoundIndexAndCreateCompoundIndexWhenUsingDropExisting() t
}
}

/*
This is only for 3.2+
*/
@Test
public void testDropNodeKeyConstraintAndCreateNodeKeyConstraintWhenUsingDropExisting() throws Exception {
db.execute("CREATE CONSTRAINT ON (f:Foo) ASSERT (f.bar,f.foo) IS NODE KEY").close();
testResult(db, "CALL apoc.schema.assert(null,{Foo:[['bar','foo']]})", (result) -> {
Map<String, Object> r = result.next();
assertEquals("Foo", r.get("label"));
assertEquals(expectedKeys("bar","foo"), r.get("keys"));
assertEquals(true, r.get("unique"));
assertEquals("DROPPED", r.get("action"));

r = result.next();
assertEquals("Foo", r.get("label"));
assertEquals(expectedKeys("bar", "foo"), r.get("keys"));
assertEquals(true, r.get("unique"));
assertEquals("CREATED", r.get("action"));
});
try (Transaction tx = db.beginTx()) {
List<ConstraintDefinition> constraints = Iterables.asList(db.schema().getConstraints());
assertEquals(1, constraints.size());
}
}

/*
This is only for 3.2+
*/
@Test
public void testDropSchemaWithNodeKeyConstraintWhenUsingDropExisting() throws Exception {
db.execute("CREATE CONSTRAINT ON (f:Foo) ASSERT (f.foo, f.bar) IS NODE KEY").close();
testCall(db, "CALL apoc.schema.assert(null,null)", (r) -> {
assertEquals("Foo", r.get("label"));
assertEquals(expectedKeys("foo", "bar"), r.get("keys"));
assertEquals(true, r.get("unique"));
assertEquals("DROPPED", r.get("action"));
});
try (Transaction tx = db.beginTx()) {
List<ConstraintDefinition> constraints = Iterables.asList(db.schema().getConstraints());
assertEquals(0, constraints.size());
}
}

@Test
public void testDropConstraintExistsPropertyNode() throws Exception {
db.execute("CREATE CONSTRAINT ON (m:Movie) ASSERT exists(m.title)").close();
testCall(db, "CALL apoc.schema.assert({},{})", (r) -> {
assertEquals("Movie", r.get("label"));
assertEquals(expectedKeys("title"), r.get("keys"));
assertTrue("should be unique", (boolean) r.get("unique"));
assertEquals("DROPPED", r.get("action"));
});
try (Transaction tx = db.beginTx()) {
List<ConstraintDefinition> constraints = Iterables.asList(db.schema().getConstraints());
assertEquals(0, constraints.size());
}
}

@Test
public void testDropConstraintExistsPropertyRelationship() throws Exception {
db.execute("CREATE CONSTRAINT ON ()-[acted:Acted]->() ASSERT exists(acted.since)").close();
testCall(db, "CALL apoc.schema.assert({},{})", (r) -> {
assertEquals("Acted", r.get("label"));
assertEquals(expectedKeys("since"), r.get("keys"));
assertTrue("should be unique", (boolean) r.get("unique"));
assertEquals("DROPPED", r.get("action"));
});
try (Transaction tx = db.beginTx()) {
List<ConstraintDefinition> constraints = Iterables.asList(db.schema().getConstraints());
assertEquals(0, constraints.size());
}
}

private List<String> expectedKeys(String... keys){
return asList(keys);
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/apoc/util/TestContainerUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static TestcontainersCausalCluster createEnterpriseCluster(int numOfCoreI

public static Neo4jContainerExtension createEnterpriseDB(boolean withLogging) {
// We define the container with external volumes
Neo4jContainerExtension neo4jContainer = new Neo4jContainerExtension("neo4j:3.5.3-enterprise")
Neo4jContainerExtension neo4jContainer = new Neo4jContainerExtension("neo4j:3.4.12-enterprise")
.withPlugins(MountableFile.forHostPath("./target/tests/gradle-build/libs")) // map the apoc's artifact dir as the Neo4j's plugin dir
.withAdminPassword("apoc")
.withNeo4jConfig("apoc.export.file.enabled", "true")
Expand Down
3 changes: 2 additions & 1 deletion src/test/java/apoc/util/TestcontainersCausalCluster.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ private static Neo4jContainerExtension getNeo4jContainerExtension(WaitStrategy w
.withNetwork(network)
.withNetworkAliases(name)
.withoutDriver()
.withoutAuthentication()
.withNeo4jConfig("dbms.mode", instanceType.toString())
.withNeo4jConfig("dbms.connectors.default_listen_address", "0.0.0.0")
.withNeo4jConfig("dbms.connectors.default_advertised_address", name)
Expand All @@ -152,7 +153,7 @@ public TestcontainersCausalCluster(List<Neo4jContainerExtension> clusterMembers,
List<GenericContainer> sidecars) {
this.clusterMembers = clusterMembers;
this.sidecars = sidecars;
this.driver = GraphDatabase.driver(getURI(), AuthTokens.basic("neo4j", "apoc"));
this.driver = GraphDatabase.driver(getURI(), AuthTokens.none());
this.session = driver.session();
}

Expand Down

0 comments on commit e95febc

Please sign in to comment.