use of org.apache.activemq.store.jdbc.JDBCPersistenceAdapter in project activemq-artemis by apache.
the class JDBCPersistenceXBeanConfigTest method testConfiguredCorrectly.
public void testConfiguredCorrectly() throws Exception {
PersistenceAdapter persistenceAdapter = brokerService.getPersistenceAdapter();
assertNotNull(persistenceAdapter);
assertTrue(persistenceAdapter instanceof JDBCPersistenceAdapter);
JDBCPersistenceAdapter jpa = (JDBCPersistenceAdapter) persistenceAdapter;
assertEquals("BROKER1.", jpa.getStatements().getTablePrefix());
}
use of org.apache.activemq.store.jdbc.JDBCPersistenceAdapter in project activemq-artemis by apache.
the class JdbcDurableSubDupTest method startBroker.
@Before
public void startBroker() throws Exception {
exceptions.clear();
for (int i = 0; i < MAX_MESSAGES; i++) {
dupChecker[i] = 0;
}
broker = new BrokerService();
broker.setAdvisorySupport(false);
broker.setPersistenceAdapter(new JDBCPersistenceAdapter());
PolicyEntry policyEntry = new PolicyEntry();
policyEntry.setMaxAuditDepth(3000);
policyEntry.setMaxPageSize(150);
policyEntry.setPrioritizedMessages(true);
PolicyMap policyMap = new PolicyMap();
policyMap.setDefaultEntry(policyEntry);
broker.setDestinationPolicy(policyMap);
broker.addConnector("tcp://localhost:0");
broker.setDeleteAllMessagesOnStartup(true);
broker.start();
broker.waitUntilStarted();
url = broker.getTransportConnectors().get(0).getConnectUri().toString() + "?" + urlOptions;
}
use of org.apache.activemq.store.jdbc.JDBCPersistenceAdapter in project activemq-artemis by apache.
the class ConfigTest method testJdbcLockConfigOverride.
@Test
public void testJdbcLockConfigOverride() throws Exception {
JDBCPersistenceAdapter adapter = new JDBCPersistenceAdapter();
Mockery context = new Mockery();
final DataSource dataSource = context.mock(DataSource.class);
final Connection connection = context.mock(Connection.class);
final DatabaseMetaData metadata = context.mock(DatabaseMetaData.class);
final ResultSet result = context.mock(ResultSet.class);
adapter.setDataSource(dataSource);
adapter.setCreateTablesOnStartup(false);
context.checking(new Expectations() {
{
allowing(dataSource).getConnection();
will(returnValue(connection));
allowing(connection).getMetaData();
will(returnValue(metadata));
allowing(connection);
allowing(metadata).getDriverName();
will(returnValue("Microsoft_SQL_Server_2005_jdbc_driver"));
allowing(result).next();
will(returnValue(true));
}
});
adapter.start();
assertTrue("has the locker override", adapter.getLocker() instanceof TransactDatabaseLocker);
adapter.stop();
}
use of org.apache.activemq.store.jdbc.JDBCPersistenceAdapter in project activemq-artemis by apache.
the class JDBCConfigTest method testJdbcConfig.
/*
* This tests creating a jdbc persistence adapter using xbeans-spring
*/
@Test
public void testJdbcConfig() throws Exception {
File journalFile = new File(JOURNAL_ROOT + "testJDBCConfig/journal");
recursiveDelete(journalFile);
// Default
File derbyFile = new File(DERBY_ROOT + "testJDBCConfig/derbydb");
recursiveDelete(derbyFile);
BrokerService broker;
broker = createBroker(new FileSystemResource(CONF_ROOT + "jdbc-example.xml"));
try {
assertEquals("Broker Config Error (brokerName)", "brokerJdbcConfigTest", broker.getBrokerName());
PersistenceAdapter adapter = broker.getPersistenceAdapter();
assertTrue("Should have created a jdbc persistence adapter", adapter instanceof JDBCPersistenceAdapter);
assertEquals("JDBC Adapter Config Error (cleanupPeriod)", 60000, ((JDBCPersistenceAdapter) adapter).getCleanupPeriod());
assertTrue("Should have created an EmbeddedDataSource", ((JDBCPersistenceAdapter) adapter).getDataSource() instanceof EmbeddedDataSource);
assertTrue("Should have created a DefaultWireFormat", ((JDBCPersistenceAdapter) adapter).getWireFormat() instanceof ObjectStreamWireFormat);
LOG.info("Success");
} finally {
if (broker != null) {
broker.stop();
}
}
}
use of org.apache.activemq.store.jdbc.JDBCPersistenceAdapter in project activemq-artemis by apache.
the class StoreQueueCursorJDBCNoDuplicateTest method createBroker.
@Override
protected BrokerService createBroker() throws Exception {
BrokerService broker = super.createBroker();
PersistenceAdapter persistenceAdapter = new JDBCPersistenceAdapter();
broker.setPersistenceAdapter(persistenceAdapter);
return broker;
}
Aggregations