Skip to content

Commit

Permalink
Fixes ExportCypherTest for token indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
zimmre committed May 7, 2021
1 parent 0683eea commit 8c5e328
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.neo4j.cypher.export.SubGraph;
import org.neo4j.graphdb.*;
import org.neo4j.graphdb.schema.IndexDefinition;
import org.neo4j.graphdb.schema.IndexType;
import org.neo4j.internal.helpers.collection.Iterables;

import java.io.PrintWriter;
Expand Down Expand Up @@ -230,6 +231,9 @@ private void exportSchema(PrintWriter out) {
private List<String> exportIndexes() {
return db.executeTransactionally("CALL db.indexes()", Collections.emptyMap(), result -> result.stream()
.map(map -> {
if ("LOOKUP".equals(map.get("type"))) {
return "";
}
List<String> props = (List<String>) map.get("properties");
List<String> tokenNames = (List<String>) map.get("labelsOrTypes");
String name = (String) map.get("name");
Expand Down Expand Up @@ -345,6 +349,12 @@ public void commit(PrintWriter out){

private void gatherUniqueConstraints() {
for (IndexDefinition indexDefinition : graph.getIndexes()) {
if (!indexDefinition.isNodeIndex()) {
continue;
}
if (indexDefinition.getIndexType() == IndexType.LOOKUP) {
continue;
}
Set<String> label = StreamSupport.stream(indexDefinition.getLabels().spliterator(), false)
.map(Label::name)
.collect(Collectors.toSet());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ public void exportMultiTokenIndex() {
});
}

@Ignore("It doesn't fail anymore because it skips not supported indexes")
@Test(expected = QueryExecutionException.class)
public void shouldFailExportMultiTokenIndexForRelationship() {
// given
Expand Down
1 change: 1 addition & 0 deletions core/src/test/java/apoc/schema/SchemasTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public void setUp() throws Exception {

@Test
public void testCreateIndex() throws Exception {
dropSchema();
testCall(db, "CALL apoc.schema.assert({Foo:['bar']},null)", (r) -> {
assertEquals("Foo", r.get("label"));
assertEquals("bar", r.get("key"));
Expand Down

0 comments on commit 8c5e328

Please sign in to comment.