db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Manjula Kutty" <manjula.ku...@gmail.com>
Subject Question about creating additional dbs in the junit
Date Tue, 20 Mar 2007 00:58:16 GMT
Hi

I'm trying to convert lang/ShutdownDatabase.java test to junit. But that
particular test created different databases and verifies the shutdown in
different scenarios. I tried creating new database like this (please see the
code snippet)

*

public* *class* ShutdownDatabaseTest *extends* BaseJDBCTestCase {

/**

* Public constructor required for running test as standalone JUnit.

*/

*public* ShutdownDatabaseTest(String name) {

*super*(name);

}

*public* *static* Test suite() {

Test test;

test = TestConfiguration.*defaultSuite*(ShutdownDatabaseTest.*class*);

test = TestConfiguration.*additionalDatabaseDecorator*(test,
"testOnlyTransactionWasCommitedDB");

*return* test;

}
*

public* *void* testOnlyTransactionWasCommited() *throws* SQLException {

*final* String dbname = "testOnlyTransactionWasCommitedDB";

Connection conn = *null*;

conn = openConnection(dbname);

 assertShutdownOK(conn,dbname);

}
*

protected* *void* assertShutdownOK(Connection conn, String dbName)

*throws* SQLException {

//String url = TestConfiguration.getCurrent().getJDBCUrl(dbName)
+";shutdown=true";

*try* {

// DriverManager.getConnection(url);

conn = openConnection(dbName + ";shutdown=true");

*fail* ("expected a failed shutdown connection");

} *catch* (SQLException e) {

// expect 08006 on successful shutdown

*assertSQLState*("08006", e);

}

}
When I checked the the dbname created is singleUse/oneuse0. how can I create
the db with the name I want, Or am I doing something seriously wrong???
-- 
Thanks,
Manjula.

Mime
View raw message