use of org.apache.qpid.server.store.jdbc.JDBCContainer in project qpid-broker-j by apache.
the class JDBCVirtualHostNodeTest method testDeleteAction.
@Test
public void testDeleteAction() {
_connectionURL = "jdbc:derby:memory:/" + getTestName();
Map<String, Object> attributes = new HashMap<>();
attributes.put(ConfiguredObject.NAME, getTestName());
attributes.put(ConfiguredObject.TYPE, JDBCVirtualHostNodeImpl.VIRTUAL_HOST_NODE_TYPE);
attributes.put("connectionUrl", _connectionURL + ";create=true");
Broker<?> broker = BrokerTestHelper.createBrokerMock();
final VirtualHostNode virtualHostNode = broker.getObjectFactory().create(VirtualHostNode.class, attributes, broker);
virtualHostNode.start();
AtomicBoolean deleted = new AtomicBoolean();
((JDBCContainer) virtualHostNode).addDeleteAction(object -> deleted.set(true));
virtualHostNode.delete();
assertEquals("Delete action was not invoked", true, deleted.get());
}
use of org.apache.qpid.server.store.jdbc.JDBCContainer in project qpid-broker-j by apache.
the class JDBCLinkStoreTest method createLinkStore.
@Override
protected LinkStore createLinkStore() {
final JDBCDetails details = mock(JDBCDetails.class);
when(details.getBlobType()).thenReturn("blob");
when(details.getTimestampType()).thenReturn("timestamp");
when(details.isUseBytesMethodsForBlob()).thenReturn(false);
JDBCContainer jdbcContainer = mock(JDBCContainer.class);
when(jdbcContainer.getJDBCDetails()).thenReturn(details);
when(jdbcContainer.getTableNamePrefix()).thenReturn("testTablePrefix");
when(jdbcContainer.getConnection()).thenAnswer(invocation -> DriverManager.getConnection(getUrl() + ";create=true"));
return new JDBCLinkStore(jdbcContainer);
}
use of org.apache.qpid.server.store.jdbc.JDBCContainer in project qpid-broker-j by apache.
the class JDBCVirtualHostTest method testDeleteAction.
@Test
public void testDeleteAction() {
_connectionURL = "jdbc:derby:memory:/" + getTestName();
Map<String, Object> attributes = new HashMap<>();
attributes.put(ConfiguredObject.NAME, getTestName());
attributes.put(ConfiguredObject.TYPE, JDBCVirtualHostImpl.VIRTUAL_HOST_TYPE);
attributes.put("connectionUrl", _connectionURL + ";create=true");
final VirtualHost vh = BrokerTestHelper.createVirtualHost(attributes, this);
AtomicBoolean deleted = new AtomicBoolean();
((JDBCContainer) vh).addDeleteAction(object -> deleted.set(true));
vh.delete();
assertEquals("Delete action was not invoked", true, deleted.get());
}
Aggregations