Search in sources :

Example 1 with AbstractWireOperations

use of org.firebirdsql.gds.ng.wire.AbstractWireOperations in project jaybird by FirebirdSQL.

the class TestV10WireOperations method testProcessResponse_noException.

/**
 * Test if processResponse does not throw an exception if the response does
 * not contain an exception.
 */
@Test
public void testProcessResponse_noException() throws Exception {
    AbstractWireOperations wire = createDummyWireOperations();
    GenericResponse genericResponse = new GenericResponse(-1, -1, null, null);
    wire.processResponse(genericResponse);
}
Also used : AbstractWireOperations(org.firebirdsql.gds.ng.wire.AbstractWireOperations) GenericResponse(org.firebirdsql.gds.ng.wire.GenericResponse) Test(org.junit.Test)

Example 2 with AbstractWireOperations

use of org.firebirdsql.gds.ng.wire.AbstractWireOperations in project jaybird by FirebirdSQL.

the class TestV10WireOperations method testProcessResponseWarnings_exception.

/**
 * Test if no warning is registered with the callback if the response
 * contains an exception that is not a warning.
 */
@Test
public void testProcessResponseWarnings_exception() throws Exception {
    AbstractWireOperations wire = createDummyWireOperations();
    SQLException exception = new FbExceptionBuilder().exception(ISCConstants.isc_numeric_out_of_range).toSQLException();
    GenericResponse genericResponse = new GenericResponse(-1, -1, null, exception);
    wire.processResponseWarnings(genericResponse, null);
    List<SQLWarning> warnings = warningCallback.getWarnings();
    assertEquals("Expected no warnings to be registered", 0, warnings.size());
}
Also used : SQLWarning(java.sql.SQLWarning) AbstractWireOperations(org.firebirdsql.gds.ng.wire.AbstractWireOperations) SQLException(java.sql.SQLException) GenericResponse(org.firebirdsql.gds.ng.wire.GenericResponse) FbExceptionBuilder(org.firebirdsql.gds.ng.FbExceptionBuilder) Test(org.junit.Test)

Example 3 with AbstractWireOperations

use of org.firebirdsql.gds.ng.wire.AbstractWireOperations in project jaybird by FirebirdSQL.

the class TestV10WireOperations method testProcessResponseWarnings_warning.

/**
 * Test if a warning is registered with the callback if the response
 * contains an exception that is a warning.
 */
@Test
public void testProcessResponseWarnings_warning() throws Exception {
    AbstractWireOperations wire = createDummyWireOperations();
    SQLWarning warning = new FbExceptionBuilder().warning(ISCConstants.isc_numeric_out_of_range).toSQLException(SQLWarning.class);
    GenericResponse genericResponse = new GenericResponse(-1, -1, null, warning);
    wire.processResponseWarnings(genericResponse, null);
    List<SQLWarning> warnings = warningCallback.getWarnings();
    assertEquals("Unexpected warnings registered or no warnings registered", Collections.singletonList(warning), warnings);
}
Also used : SQLWarning(java.sql.SQLWarning) AbstractWireOperations(org.firebirdsql.gds.ng.wire.AbstractWireOperations) GenericResponse(org.firebirdsql.gds.ng.wire.GenericResponse) FbExceptionBuilder(org.firebirdsql.gds.ng.FbExceptionBuilder) Test(org.junit.Test)

Example 4 with AbstractWireOperations

use of org.firebirdsql.gds.ng.wire.AbstractWireOperations in project jaybird by FirebirdSQL.

the class TestV10WireOperations method testProcessResponseWarnings_noException.

/**
 * Test if no warning is registered with the callback if the response does
 * not contain an exception.
 */
@Test
public void testProcessResponseWarnings_noException() throws Exception {
    AbstractWireOperations wire = createDummyWireOperations();
    GenericResponse genericResponse = new GenericResponse(-1, -1, null, null);
    wire.processResponseWarnings(genericResponse, null);
    List<SQLWarning> warnings = warningCallback.getWarnings();
    assertEquals("Expected no warnings to be registered", 0, warnings.size());
}
Also used : SQLWarning(java.sql.SQLWarning) AbstractWireOperations(org.firebirdsql.gds.ng.wire.AbstractWireOperations) GenericResponse(org.firebirdsql.gds.ng.wire.GenericResponse) Test(org.junit.Test)

Example 5 with AbstractWireOperations

use of org.firebirdsql.gds.ng.wire.AbstractWireOperations in project jaybird by FirebirdSQL.

the class TestV10WireOperations method testProcessResponse_exception.

/**
 * Test if processResponse throws the exception in the response if the
 * exception is not a warning.
 */
@Test
public void testProcessResponse_exception() throws Exception {
    AbstractWireOperations wire = createDummyWireOperations();
    SQLException exception = new FbExceptionBuilder().exception(ISCConstants.isc_numeric_out_of_range).toSQLException();
    expectedException.expect(sameInstance(exception));
    GenericResponse genericResponse = new GenericResponse(-1, -1, null, exception);
    wire.processResponse(genericResponse);
}
Also used : AbstractWireOperations(org.firebirdsql.gds.ng.wire.AbstractWireOperations) SQLException(java.sql.SQLException) GenericResponse(org.firebirdsql.gds.ng.wire.GenericResponse) FbExceptionBuilder(org.firebirdsql.gds.ng.FbExceptionBuilder) Test(org.junit.Test)

Aggregations

AbstractWireOperations (org.firebirdsql.gds.ng.wire.AbstractWireOperations)6 GenericResponse (org.firebirdsql.gds.ng.wire.GenericResponse)6 Test (org.junit.Test)6 FbExceptionBuilder (org.firebirdsql.gds.ng.FbExceptionBuilder)4 SQLException (java.sql.SQLException)3 SQLWarning (java.sql.SQLWarning)3