Search in sources :

Example 1 with WireDatabaseConnection

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

the class TestV10Transaction method createDatabase.

@Override
protected final FbDatabase createDatabase() throws SQLException {
    WireDatabaseConnection gdsConnection = new WireDatabaseConnection(connectionInfo, EncodingFactory.getPlatformDefault(), getProtocolCollection());
    gdsConnection.socketConnect();
    return gdsConnection.identify();
}
Also used : WireDatabaseConnection(org.firebirdsql.gds.ng.wire.WireDatabaseConnection)

Example 2 with WireDatabaseConnection

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

the class TestV12Database method checkCancelOperationSupported.

private void checkCancelOperationSupported(int kind, String kindName) throws Exception {
    FBManager fbManager = createFBManager();
    defaultDatabaseSetUp(fbManager);
    try (WireDatabaseConnection gdsConnection = createConnection()) {
        gdsConnection.socketConnect();
        try (FbWireDatabase db = gdsConnection.identify()) {
            assertEquals("Unexpected FbWireDatabase implementation", getExpectedDatabaseType(), db.getClass());
            db.attach();
            assertTrue("expected database attached", db.isAttached());
            db.cancelOperation(kind);
            assertTrue("Expected database still attached after " + kindName, db.isAttached());
            assertTrue("Expected connection still open after " + kindName, gdsConnection.isConnected());
        }
    } finally {
        defaultDatabaseTearDown(fbManager);
    }
}
Also used : WireDatabaseConnection(org.firebirdsql.gds.ng.wire.WireDatabaseConnection) FBManager(org.firebirdsql.management.FBManager) FbWireDatabase(org.firebirdsql.gds.ng.wire.FbWireDatabase)

Example 3 with WireDatabaseConnection

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

the class BaseTestV10Blob method createFbDatabase.

@Override
protected final FbDatabase createFbDatabase(FbConnectionProperties connectionInfo) throws SQLException {
    WireDatabaseConnection gdsConnection = new WireDatabaseConnection(connectionInfo, EncodingFactory.getPlatformDefault(), getProtocolCollection());
    gdsConnection.socketConnect();
    FbWireDatabase db = gdsConnection.identify();
    db.attach();
    return db;
}
Also used : WireDatabaseConnection(org.firebirdsql.gds.ng.wire.WireDatabaseConnection) FbWireDatabase(org.firebirdsql.gds.ng.wire.FbWireDatabase)

Example 4 with WireDatabaseConnection

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

the class TestV10Database method testBasicAttach.

/**
 * Tests if attaching to an existing database works.
 */
@Test
public void testBasicAttach() throws Exception {
    FBManager fbManager = createFBManager();
    defaultDatabaseSetUp(fbManager);
    try (WireDatabaseConnection gdsConnection = createConnection()) {
        gdsConnection.socketConnect();
        try (FbWireDatabase db = gdsConnection.identify()) {
            assertEquals("Unexpected FbWireDatabase implementation", getExpectedDatabaseType(), db.getClass());
            db.attach();
            System.out.println(db.getHandle());
            assertTrue("Expected isAttached() to return true", db.isAttached());
            assertNotNull("Expected version string to be not null", db.getServerVersion());
            assertNotEquals("Expected version should not be invalid", GDSServerVersion.INVALID_VERSION, db.getServerVersion());
        }
    } finally {
        defaultDatabaseTearDown(fbManager);
    }
}
Also used : WireDatabaseConnection(org.firebirdsql.gds.ng.wire.WireDatabaseConnection) FBManager(org.firebirdsql.management.FBManager) AbstractFbWireDatabase(org.firebirdsql.gds.ng.wire.AbstractFbWireDatabase) FbWireDatabase(org.firebirdsql.gds.ng.wire.FbWireDatabase) Test(org.junit.Test)

Example 5 with WireDatabaseConnection

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

the class TestV10Database method testBasicDetach.

@Test
public void testBasicDetach() throws Exception {
    FBManager fbManager = createFBManager();
    defaultDatabaseSetUp(fbManager);
    try (WireDatabaseConnection gdsConnection = createConnection()) {
        gdsConnection.socketConnect();
        FbWireDatabase db = gdsConnection.identify();
        try {
            assertEquals("Unexpected FbWireDatabase implementation", getExpectedDatabaseType(), db.getClass());
            db.attach();
            db.close();
            assertFalse("Expected database not attached", db.isAttached());
            assertFalse("Expected connection closed", gdsConnection.isConnected());
        } finally {
            safelyClose(db);
        }
    } finally {
        defaultDatabaseTearDown(fbManager);
    }
}
Also used : WireDatabaseConnection(org.firebirdsql.gds.ng.wire.WireDatabaseConnection) FBManager(org.firebirdsql.management.FBManager) AbstractFbWireDatabase(org.firebirdsql.gds.ng.wire.AbstractFbWireDatabase) FbWireDatabase(org.firebirdsql.gds.ng.wire.FbWireDatabase) Test(org.junit.Test)

Aggregations

WireDatabaseConnection (org.firebirdsql.gds.ng.wire.WireDatabaseConnection)15 FbWireDatabase (org.firebirdsql.gds.ng.wire.FbWireDatabase)13 AbstractFbWireDatabase (org.firebirdsql.gds.ng.wire.AbstractFbWireDatabase)11 Test (org.junit.Test)10 FBManager (org.firebirdsql.management.FBManager)9 File (java.io.File)2 SQLException (java.sql.SQLException)1 Ignore (org.junit.Ignore)1