Skip to content

Commit

Permalink
Remove unused import
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasHafner committed Aug 14, 2024
1 parent 6e940df commit 97b81a2
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions src/test/java/org/polypheny/jdbc/types/StreamingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.nio.ByteBuffer;
import java.sql.Connection;
import java.sql.SQLException;
Expand Down Expand Up @@ -98,7 +97,7 @@ public void simpleFileStreamingTest2() {

List<TypedValue> parameters = new ArrayList<>( 2 );
parameters.add( TypedValue.fromInteger( 1 ) );
parameters.add( TypedValue.fromBlob(new ByteArrayInputStream( expected )));
parameters.add( TypedValue.fromBlob( new ByteArrayInputStream( expected ) ) );
Result result = polyStatement.executePrepared( parameters );
result.unwrap( ScalarResult.class );

Expand All @@ -112,32 +111,33 @@ public void simpleFileStreamingTest2() {
}
}


@Test
public void simpleStringStreamingTest() {
try (Connection connection = TestHelper.getConnection()) {
if (!connection.isWrapperFor(PolyConnection.class)) {
fail("Driver must support unwrapping to PolyphenyConnection");
try ( Connection connection = TestHelper.getConnection() ) {
if ( !connection.isWrapperFor( PolyConnection.class ) ) {
fail( "Driver must support unwrapping to PolyphenyConnection" );
}
PolyStatement polyStatement = connection.unwrap(PolyConnection.class).createPolyStatement();
PolyStatement polyStatement = connection.unwrap( PolyConnection.class ).createPolyStatement();

polyStatement.execute("public", "sql", STRING_DROP_IF_STATEMENT);
polyStatement.execute("public", "sql", STRING_CREATE_STATEMENT);
polyStatement.execute( "public", "sql", STRING_DROP_IF_STATEMENT );
polyStatement.execute( "public", "sql", STRING_CREATE_STATEMENT );

polyStatement.prepare("public", "sql", STRING_INSERT_STATEMENT);
polyStatement.prepare( "public", "sql", STRING_INSERT_STATEMENT );
String expected = createTestStringData();

List<TypedValue> parameters = new ArrayList<>(2);
parameters.add(TypedValue.fromInteger(1));
parameters.add(TypedValue.fromString(expected));
Result result = polyStatement.executePrepared(parameters);
result.unwrap(ScalarResult.class);
List<TypedValue> parameters = new ArrayList<>( 2 );
parameters.add( TypedValue.fromInteger( 1 ) );
parameters.add( TypedValue.fromString( expected ) );
Result result = polyStatement.executePrepared( parameters );
result.unwrap( ScalarResult.class );

RelationalResult result2 = polyStatement.execute("public", "sql", STRING_QUERY).unwrap(RelationalResult.class);
String received = result2.iterator().next().get("data").asString();
RelationalResult result2 = polyStatement.execute( "public", "sql", STRING_QUERY ).unwrap( RelationalResult.class );
String received = result2.iterator().next().get( "data" ).asString();

Assertions.assertEquals(expected, received);
} catch ( SQLException e) {
throw new RuntimeException(e);
Assertions.assertEquals( expected, received );
} catch ( SQLException e ) {
throw new RuntimeException( e );
}
}

Expand Down Expand Up @@ -170,7 +170,8 @@ private static byte[] createTestData() {

private String createTestStringData() {
char[] data = new char[300 * 1024 * 1024];
Arrays.fill(data, 'A');
return new String(data);
Arrays.fill( data, 'A' );
return new String( data );
}

}

0 comments on commit 97b81a2

Please sign in to comment.