Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
0.30
-
None
Description
On creation operation for virtual host node having the same name as an existing virtual host node, the existing virtual host node store is shutdown as part of on create validation.
The stack trace below is generated on close of existing DERBY VHN after its shutdown due to validation checks:
java.sql.SQLException: Database '/tmp/qpid.work_dir-1426160975964/VirtualHostNodeTest.testCreateDuplicateVirtualHostNodeAndClose/config/VirtualHostNodeTest.testCreateDuplicateVirtualHostNodeAndClose' not found. at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection.handleDBNotFound(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source) at org.apache.derby.jdbc.InternalDriver.getNewEmbedConnection(Unknown Source) at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source) at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source) at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source) at java.sql.DriverManager.getConnection(DriverManager.java:571) at java.sql.DriverManager.getConnection(DriverManager.java:233) at org.apache.qpid.server.store.derby.DerbyUtils.shutdownDatabase(DerbyUtils.java:108) at org.apache.qpid.server.store.derby.DerbyConfigurationStore.closeConfigurationStore(DerbyConfigurationStore.java:107) at org.apache.qpid.server.virtualhostnode.AbstractVirtualHostNode.closeConfigurationStore(AbstractVirtualHostNode.java:287) at org.apache.qpid.server.virtualhostnode.AbstractVirtualHostNode.onClose(AbstractVirtualHostNode.java:242) at org.apache.qpid.server.model.AbstractConfiguredObject.close(AbstractConfiguredObject.java:506) at org.apache.qpid.server.store.derby.VirtualHostNodeTest.testCreateDuplicateVirtualHostNodeAndClose(VirtualHostNodeTest.java:87) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at junit.framework.TestCase.runTest(TestCase.java:176) at junit.framework.TestCase.runBare(TestCase.java:141) at junit.framework.TestResult$1.protect(TestResult.java:122) at junit.framework.TestResult.runProtected(TestResult.java:142) at junit.framework.TestResult.run(TestResult.java:125) at junit.framework.TestCase.run(TestCase.java:129) at org.apache.qpid.test.utils.QpidTestCase.run(QpidTestCase.java:148) at junit.framework.TestSuite.runTest(TestSuite.java:255) at junit.framework.TestSuite.run(TestSuite.java:250) at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84) at org.junit.runner.JUnitCore.run(JUnitCore.java:160) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) Caused by: ERROR XJ004: Database '/tmp/qpid.work_dir-1426160975964/VirtualHostNodeTest.testCreateDuplicateVirtualHostNodeAndClose/config/VirtualHostNodeTest.testCreateDuplicateVirtualHostNodeAndClose' not found. at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) at org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown Source) ... 42 more 2015-03-12 11:49:42,188 DEBUG [main] [TaskExecutorImpl] Stopping task executor 2015-03-12 11:49:42,190 DEBUG [main] [TaskExecutorImpl] Task executor is stopped 2015-03-12 11:49:42,196 INFO [main] [QpidTestCase] ========== tearDown VirtualHostNodeTest.testCreateDuplicateVirtualHostNodeAndClose ========== 2015-03-12 11:49:42,197 DEBUG [main] [QpidTestCase] reverting 1 test properties
here is a test code snippet
String nodeName = getTestName(); Map<String, Object> nodeData = new HashMap<>(); nodeData.put(VirtualHostNode.NAME, nodeName); nodeData.put(VirtualHostNode.TYPE, DerbyVirtualHostNodeImpl.VIRTUAL_HOST_NODE_TYPE); VirtualHostNode<?> virtualHostNode = (VirtualHostNode<?>)_broker.createChild(VirtualHostNode.class, nodeData); virtualHostNode.start(); try { _broker.createChild(VirtualHostNode.class, nodeData); } catch(Exception e) { assertEquals("Unexpected message", "Child of type " + virtualHostNode.getClass().getSimpleName() + " already exists with name of " + getTestName(), e.getMessage()); } virtualHostNode.close();