So could the test use the TestConfiguration.singleUseDatabaseDecorator instead of the additional database decorator?
This would mean that you wouldn't need a reopenConnection() method, though I don't think the test does as it stands.
I'm not sure why the test can't just use openConnection(dbName) again.

Then going further, I wonder why the default database cannot be used? The single use databases are for when the test leaves the database in a state such that it cannot be re-used, does this test do that?

The assertGetIntEquals() probably needs some cleanup, if an exception is thrown no failure will be generated.
Can you use instead the existing:

Daniel John Debrunner
added a comment - 21/Mar/07 20:42 It looks like the test is just using a single database.
So could the test use the TestConfiguration.singleUseDatabaseDecorator instead of the additional database decorator?
This would mean that you wouldn't need a reopenConnection() method, though I don't think the test does as it stands.
I'm not sure why the test can't just use openConnection(dbName) again.
Then going further, I wonder why the default database cannot be used? The single use databases are for when the test leaves the database in a state such that it cannot be re-used, does this test do that?
The assertGetIntEquals() probably needs some cleanup, if an exception is thrown no failure will be generated.
Can you use instead the existing:
JDBC.assertSingleValueResultSet()
which I think is what you are trying to test for.

Thanks for the valuable comments, Dan, I made changes to the test so that it will use the default database . But when I did the drop table in the tear down method, I get the following error . Any gues what is going wrong here?

I commented that code in the tear down method and just did the drop table in each test.

There was 1 error:
1) testOnlyTransactionWasCommited(org.apache.derbyTesting.functionTests.tests.la
ng.ShutdownDatabaseTest)java.sql.SQLException: A network protocol error was enco
untered and the connection has been terminated: the requested command encountere
d an unarchitected and implementation-specific condition for which there was no
architected message
at org.apache.derby.client.am.SQLExceptionFactory.getSQLException(Unknow
n Source)
at org.apache.derby.client.am.SqlException.getSQLException(Unknown Sourc
e)
at org.apache.derby.client.am.Statement.execute(Unknown Source)
at org.apache.derbyTesting.functionTests.tests.lang.ShutdownDatabaseTest
.tearDown(ShutdownDatabaseTest.java:77)
at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:
80)
at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
at junit.extensions.TestSetup.run(TestSetup.java:23)
at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
at junit.extensions.TestSetup.run(TestSetup.java:23)
at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
at junit.extensions.TestSetup.run(TestSetup.java:23)
Caused by: org.apache.derby.client.am.DisconnectException: A network protocol er
ror was encountered and the connection has been terminated: the requested comman
d encountered an unarchitected and implementation-specific condition for which t
here was no architected message
at org.apache.derby.client.net.NetConnectionReply.parseCMDCHKRM(Unknown
Source)
at org.apache.derby.client.net.NetStatementReply.parseExecuteImmediateEr
ror(Unknown Source)
at org.apache.derby.client.net.NetStatementReply.parseEXCSQLIMMreply(Unk
nown Source)
at org.apache.derby.client.net.NetStatementReply.readExecuteImmediate(Un
known Source)
at org.apache.derby.client.net.StatementReply.readExecuteImmediate(Unkno
wn Source)
at org.apache.derby.client.net.NetStatement.readExecuteImmediate_(Unknow
n Source)
at org.apache.derby.client.am.Statement.readExecuteImmediate(Unknown Sou
rce)
at org.apache.derby.client.am.Statement.flowExecute(Unknown Source)
at org.apache.derby.client.am.Statement.executeX(Unknown Source)
... 27 more

Manjula Kutty
added a comment - 21/Mar/07 22:36 Thanks for the valuable comments, Dan, I made changes to the test so that it will use the default database . But when I did the drop table in the tear down method, I get the following error . Any gues what is going wrong here?
I commented that code in the tear down method and just did the drop table in each test.
There was 1 error:
1) testOnlyTransactionWasCommited(org.apache.derbyTesting.functionTests.tests.la
ng.ShutdownDatabaseTest)java.sql.SQLException: A network protocol error was enco
untered and the connection has been terminated: the requested command encountere
d an unarchitected and implementation-specific condition for which there was no
architected message
at org.apache.derby.client.am.SQLExceptionFactory.getSQLException(Unknow
n Source)
at org.apache.derby.client.am.SqlException.getSQLException(Unknown Sourc
e)
at org.apache.derby.client.am.Statement.execute(Unknown Source)
at org.apache.derbyTesting.functionTests.tests.lang.ShutdownDatabaseTest
.tearDown(ShutdownDatabaseTest.java:77)
at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:
80)
at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
at junit.extensions.TestSetup.run(TestSetup.java:23)
at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
at junit.extensions.TestSetup.run(TestSetup.java:23)
at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
at junit.extensions.TestSetup.run(TestSetup.java:23)
Caused by: org.apache.derby.client.am.DisconnectException: A network protocol er
ror was encountered and the connection has been terminated: the requested comman
d encountered an unarchitected and implementation-specific condition for which t
here was no architected message
at org.apache.derby.client.net.NetConnectionReply.parseCMDCHKRM(Unknown
Source)
at org.apache.derby.client.net.NetStatementReply.parseExecuteImmediateEr
ror(Unknown Source)
at org.apache.derby.client.net.NetStatementReply.parseEXCSQLIMMreply(Unk
nown Source)
at org.apache.derby.client.net.NetStatementReply.readExecuteImmediate(Un
known Source)
at org.apache.derby.client.net.StatementReply.readExecuteImmediate(Unkno
wn Source)
at org.apache.derby.client.net.NetStatement.readExecuteImmediate_(Unknow
n Source)
at org.apache.derby.client.am.Statement.readExecuteImmediate(Unknown Sou
rce)
at org.apache.derby.client.am.Statement.flowExecute(Unknown Source)
at org.apache.derby.client.am.Statement.executeX(Unknown Source)
... 27 more

I see those failures, I simplfied the test and continued to see those failures.
The main simplification was not using openConnection(), just continue to use the utility methods like createStatement() after a shutdown.
These use getConnection() which will open a new connection if the existing connection is closed.
This also means the connection will be closed automatically, while those opened via openConnection() need to be closed explicitly.

So i think the test has found a bug, shutting down the database causes some issues for the network server.
I'll commit my modified version but running only in embedded, can you enter a bug for the failure?

Daniel John Debrunner
added a comment - 22/Mar/07 00:06 I see those failures, I simplfied the test and continued to see those failures.
The main simplification was not using openConnection(), just continue to use the utility methods like createStatement() after a shutdown.
These use getConnection() which will open a new connection if the existing connection is closed.
This also means the connection will be closed automatically, while those opened via openConnection() need to be closed explicitly.
So i think the test has found a bug, shutting down the database causes some issues for the network server.
I'll commit my modified version but running only in embedded, can you enter a bug for the failure?