use of org.firebirdsql.management.FBManager in project jaybird by FirebirdSQL.
the class TestJnaDatabase method testBasicDetach.
@Test
public void testBasicDetach() throws Exception {
FBManager fbManager = createFBManager();
defaultDatabaseSetUp(fbManager);
try {
JnaDatabase db = factory.connect(connectionInfo);
try {
db.attach();
db.close();
assertFalse("Expected database not attached", db.isAttached());
} finally {
safelyClose(db);
}
} finally {
defaultDatabaseTearDown(fbManager);
}
}
use of org.firebirdsql.management.FBManager in project jaybird by FirebirdSQL.
the class TestJnaDatabase method doubleAttach.
@Test
public void doubleAttach() throws Exception {
expectedException.expect(SQLException.class);
expectedException.expectMessage(equalTo("Already attached to a database"));
FBManager fbManager = createFBManager();
defaultDatabaseSetUp(fbManager);
try (JnaDatabase db = factory.connect(connectionInfo)) {
db.attach();
// Second attach should throw exception
db.attach();
} finally {
defaultDatabaseTearDown(fbManager);
}
}
use of org.firebirdsql.management.FBManager in project jaybird by FirebirdSQL.
the class TestJnaDatabase method testDetach_openTransactions.
@Test
public void testDetach_openTransactions() throws Exception {
FBManager fbManager = createFBManager();
defaultDatabaseSetUp(fbManager);
try {
JnaDatabase db = factory.connect(connectionInfo);
FbTransaction transaction = null;
try {
db.attach();
// Starting an active transaction
transaction = getTransaction(db);
expectedException.expect(allOf(errorCodeEquals(ISCConstants.isc_open_trans), message(startsWith(getFbMessage(ISCConstants.isc_open_trans, "1")))));
db.close();
} finally {
if (transaction != null && transaction.getState() == TransactionState.ACTIVE) {
transaction.commit();
}
safelyClose(db);
}
} finally {
defaultDatabaseTearDown(fbManager);
}
}
use of org.firebirdsql.management.FBManager in project jaybird by FirebirdSQL.
the class TestJaybirdBlobBackupProblem method setUp.
@Before
public void setUp() throws Exception {
GDSType gdsType = FBTestProperties.getGdsType();
dbFactory = FBTestProperties.getFbDatabaseFactory();
try {
fbManager = new FBManager(gdsType);
fbManager.setServer("localhost");
fbManager.setPort(5066);
fbManager.start();
File dbFolder = temporaryFolder.newFolder("db");
mAbsoluteBackupPath = new File(dbFolder, "testES01344.fbk").getAbsolutePath();
mAbsoluteDatabasePath = new File(dbFolder, "testES01344.fdb").getAbsolutePath();
fbManager.createDatabase(mAbsoluteDatabasePath, "SYSDBA", "masterkey");
} catch (Exception e) {
log.warn("exception in setup: ", e);
}
}
use of org.firebirdsql.management.FBManager in project jaybird by FirebirdSQL.
the class TestSpecialEmbeddedServerUrls method testFBManagerWithRelativeDatabaseFile.
@Test
public void testFBManagerWithRelativeDatabaseFile() throws Exception {
FBManager testFBManager = new FBManager(gdsType);
testFBManager.setDropOnStop(true);
try {
testFBManager.start();
testFBManager.createDatabase(mRelativeDatabasePath, "SYSDBA", "masterkey");
} finally {
testFBManager.stop();
}
}
Aggregations