Skip to content

Commit

Permalink
Clean up after CypherTests
Browse files Browse the repository at this point in the history
  • Loading branch information
gartens committed Oct 10, 2024
1 parent cbf8055 commit 37eb448
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions dbms/src/test/java/org/polypheny/db/prisminterface/CypherTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() ) {
Expand Down Expand Up @@ -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() );
}
Expand All @@ -166,5 +179,4 @@ public void cypherRelationalTest() throws SQLException {
}
}


}

0 comments on commit 37eb448

Please sign in to comment.