diff --git a/dbms/src/test/java/org/polypheny/db/prisminterface/CypherTest.java b/dbms/src/test/java/org/polypheny/db/prisminterface/CypherTest.java index b05ae36c68..a260bc3c46 100644 --- a/dbms/src/test/java/org/polypheny/db/prisminterface/CypherTest.java +++ b/dbms/src/test/java/org/polypheny/db/prisminterface/CypherTest.java @@ -25,6 +25,7 @@ import java.sql.SQLException; import java.util.Iterator; import java.util.List; +import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.polypheny.db.TestHelper.JdbcConnection; @@ -57,6 +58,18 @@ public static void setup() throws SQLException { } + @AfterAll + public static void teardown() throws SQLException { + try ( Connection connection = new JdbcConnection( true ).getConnection() ) { + if ( !connection.isWrapperFor( PolyConnection.class ) ) { + fail( "Driver must support unwrapping to PolyConnection" ); + } + PolyStatement polyStatement = connection.unwrap( PolyConnection.class ).createPolyStatement(); + polyStatement.execute( "public", "sql", "DROP NAMESPACE IF EXISTS cyphertest" ); + } + } + + @Test public void cypherSelectNodesTest() throws SQLException { try ( Connection connection = new JdbcConnection( true ).getConnection() ) { @@ -126,21 +139,21 @@ public void cypherSelectPathsTest() throws SQLException { assertTrue( elements.hasNext() ); PolyNode alice = elements.next().unwrap( PolyNode.class ); assertEquals( alice.getLabels(), List.of( "Person" ) ); - assertEquals( alice.get("name").asString(), "Alice"); + assertEquals( alice.get( "name" ).asString(), "Alice" ); PolyEdge knows = elements.next().unwrap( PolyEdge.class ); assertEquals( knows.getLabels(), List.of( "KNOWS" ) ); PolyNode bob = elements.next().unwrap( PolyNode.class ); assertEquals( bob.getLabels(), List.of( "Person" ) ); - assertEquals( bob.get("name").asString(), "Bob"); + assertEquals( bob.get( "name" ).asString(), "Bob" ); knows = elements.next().unwrap( PolyEdge.class ); assertEquals( knows.getLabels(), List.of( "KNOWS" ) ); PolyNode charlie = elements.next().unwrap( PolyNode.class ); assertEquals( charlie.getLabels(), List.of( "Person" ) ); - assertEquals( charlie.get("name").asString(), "Charlie"); + assertEquals( charlie.get( "name" ).asString(), "Charlie" ); assertFalse( elements.hasNext() ); } @@ -166,5 +179,4 @@ public void cypherRelationalTest() throws SQLException { } } - }