Examples of JDBCPersistenceAdapter


Examples of org.apache.activemq.store.jdbc.JDBCPersistenceAdapter

    @Override
    protected BrokerService createBroker() throws Exception {
        BrokerService answer = super.createBroker();
        answer.setKeepDurableSubsActive(keepDurableSubsActive);
        answer.setPersistenceAdapter(new JDBCPersistenceAdapter());
        answer.setDeleteAllMessagesOnStartup(true);
        return answer;
    }
View Full Code Here

Examples of org.apache.activemq.store.jdbc.JDBCPersistenceAdapter

        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();
View Full Code Here

Examples of org.apache.activemq.store.jdbc.JDBCPersistenceAdapter

    @Override
    protected void configureBroker(BrokerService broker) throws Exception {
        super.configureBroker(broker);

        JDBCPersistenceAdapter jdbc = new JDBCPersistenceAdapter();
        jdbc.setDataSource(dataSource);
        broker.setPersistenceAdapter(jdbc);
    }
View Full Code Here

Examples of org.apache.activemq.store.jdbc.JDBCPersistenceAdapter

*
*/
public class JDBCDurableSubscriptionTest extends DurableSubscriptionTestSupport {

    protected PersistenceAdapter createPersistenceAdapter() throws IOException {
        JDBCPersistenceAdapter jdbc = new JDBCPersistenceAdapter();
        EmbeddedDataSource dataSource = new EmbeddedDataSource();
        dataSource.setDatabaseName("derbyDb");
        dataSource.setCreateDatabase("create");
        jdbc.setDataSource(dataSource);
        jdbc.setCleanupPeriod(1000); // set up small cleanup period
        return jdbc;
    }
View Full Code Here

Examples of org.apache.activemq.store.jdbc.JDBCPersistenceAdapter

        PersistenceAdapter persistenceAdapter = brokerService.getPersistenceAdapter();
        assertNotNull(persistenceAdapter);
        assertTrue(persistenceAdapter instanceof JDBCPersistenceAdapter);

        JDBCPersistenceAdapter jpa = (JDBCPersistenceAdapter)persistenceAdapter;
        assertEquals("BROKER1.", jpa.getStatements().getTablePrefix());

    }
View Full Code Here

Examples of org.apache.activemq.store.jdbc.JDBCPersistenceAdapter

    }

    @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();
    }
View Full Code Here

Examples of org.apache.activemq.store.jdbc.JDBCPersistenceAdapter

        adapter.stop();
    }

    public void testJdbcLockConfigDefault() 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("Some_Unknown_driver"));
            allowing(result).next();
            will(returnValue(true));
        }});

        adapter.start();
        assertEquals("has the default locker", adapter.getLocker().getClass(), DefaultDatabaseLocker.class);
        adapter.stop();
    }
View Full Code Here

Examples of org.apache.activemq.store.jdbc.JDBCPersistenceAdapter

    }

    private void createBroker(boolean deleteMessages) throws Exception {
        broker = new BrokerService();
        broker.setDeleteAllMessagesOnStartup(deleteMessages);
        broker.setPersistenceAdapter(new JDBCPersistenceAdapter());
        broker.setAdvisorySupport(false);
        broker.addConnector("tcp://0.0.0.0:0");
        broker.start();
        broker.waitUntilStarted();
        connectionUri = broker.getTransportConnectors().get(0).getPublishableConnectString();
View Full Code Here

Examples of org.apache.activemq.store.jdbc.JDBCPersistenceAdapter

        switch (choice) {
        case AMQ:
            adapter = new AMQPersistenceAdapter();
            break;
        case JDBC:
            adapter = new JDBCPersistenceAdapter();
            break;
        case KahaDB:
            adapter = new KahaDBPersistenceAdapter();
            break;
        case LevelDB:
View Full Code Here

Examples of org.apache.activemq.store.jdbc.JDBCPersistenceAdapter

        PersistenceAdapter persistenceAdapter = brokerService.getPersistenceAdapter();
        assertNotNull(persistenceAdapter);
        assertTrue(persistenceAdapter instanceof JDBCPersistenceAdapter);

        JDBCPersistenceAdapter jpa = (JDBCPersistenceAdapter)persistenceAdapter;
        assertEquals("BROKER1.", jpa.getStatements().getTablePrefix());

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.