Search in sources :

Example 1 with ObjectStreamWireFormat

use of org.apache.activemq.wireformat.ObjectStreamWireFormat 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();
        }
    }
}
Also used : JDBCPersistenceAdapter(org.apache.activemq.store.jdbc.JDBCPersistenceAdapter) FileSystemResource(org.springframework.core.io.FileSystemResource) EmbeddedDataSource(org.apache.derby.jdbc.EmbeddedDataSource) File(java.io.File) BrokerService(org.apache.activemq.broker.BrokerService) JDBCPersistenceAdapter(org.apache.activemq.store.jdbc.JDBCPersistenceAdapter) PersistenceAdapter(org.apache.activemq.store.PersistenceAdapter) ObjectStreamWireFormat(org.apache.activemq.wireformat.ObjectStreamWireFormat) Test(org.junit.Test)

Example 2 with ObjectStreamWireFormat

use of org.apache.activemq.wireformat.ObjectStreamWireFormat in project activemq-artemis by apache.

the class SslTransportTest method createTransportAndConsume.

private void createTransportAndConsume(boolean wantAuth, boolean needAuth) throws IOException {
    JMXPrincipal principal = new JMXPrincipal(certDistinguishedName);
    X509Certificate cert = new StubX509Certificate(principal);
    StubSSLSession sslSession = new StubSSLSession(cert);
    sslSocket = new StubSSLSocket(sslSession);
    sslSocket.setWantClientAuth(wantAuth);
    sslSocket.setNeedClientAuth(needAuth);
    SslTransport transport = new SslTransport(new ObjectStreamWireFormat(), sslSocket);
    stubListener = new StubTransportListener();
    transport.setTransportListener(stubListener);
    ConnectionInfo sentInfo = new ConnectionInfo();
    sentInfo.setUserName(username);
    sentInfo.setPassword(password);
    transport.doConsume(sentInfo);
}
Also used : JMXPrincipal(javax.management.remote.JMXPrincipal) ConnectionInfo(org.apache.activemq.command.ConnectionInfo) X509Certificate(java.security.cert.X509Certificate) StubTransportListener(org.apache.activemq.transport.StubTransportListener) ObjectStreamWireFormat(org.apache.activemq.wireformat.ObjectStreamWireFormat)

Aggregations

ObjectStreamWireFormat (org.apache.activemq.wireformat.ObjectStreamWireFormat)2 File (java.io.File)1 X509Certificate (java.security.cert.X509Certificate)1 JMXPrincipal (javax.management.remote.JMXPrincipal)1 BrokerService (org.apache.activemq.broker.BrokerService)1 ConnectionInfo (org.apache.activemq.command.ConnectionInfo)1 PersistenceAdapter (org.apache.activemq.store.PersistenceAdapter)1 JDBCPersistenceAdapter (org.apache.activemq.store.jdbc.JDBCPersistenceAdapter)1 StubTransportListener (org.apache.activemq.transport.StubTransportListener)1 EmbeddedDataSource (org.apache.derby.jdbc.EmbeddedDataSource)1 Test (org.junit.Test)1 FileSystemResource (org.springframework.core.io.FileSystemResource)1