use of org.apache.activemq.artemis.ra.inflow.ActiveMQActivationSpec in project activemq-artemis by apache.
the class ResourceAdapterTest method testStartStop.
@Test
public void testStartStop() throws Exception {
ActiveMQResourceAdapter qResourceAdapter = new ActiveMQResourceAdapter();
qResourceAdapter.setConnectorClassName(INVM_CONNECTOR_FACTORY);
ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext();
qResourceAdapter.start(ctx);
ActiveMQActivationSpec spec = new ActiveMQActivationSpec();
spec.setResourceAdapter(qResourceAdapter);
spec.setUseJNDI(false);
spec.setDestinationType("javax.jms.Queue");
spec.setDestination(MDBQUEUE);
qResourceAdapter.setConnectorClassName(INVM_CONNECTOR_FACTORY);
CountDownLatch latch = new CountDownLatch(1);
DummyMessageEndpoint endpoint = new DummyMessageEndpoint(latch);
DummyMessageEndpointFactory endpointFactory = new DummyMessageEndpointFactory(endpoint, false);
qResourceAdapter.endpointActivation(endpointFactory, spec);
qResourceAdapter.stop();
assertTrue(endpoint.released);
}
use of org.apache.activemq.artemis.ra.inflow.ActiveMQActivationSpec in project activemq-artemis by apache.
the class ResourceAdapterTest method testResourceAdapterSetupReconnectAttemptDefault.
@Test
public void testResourceAdapterSetupReconnectAttemptDefault() throws Exception {
ActiveMQResourceAdapter qResourceAdapter = new ActiveMQResourceAdapter();
qResourceAdapter.setConnectorClassName(INVM_CONNECTOR_FACTORY);
qResourceAdapter.setConnectionParameters("server-id=0");
ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext();
qResourceAdapter.start(ctx);
ActiveMQActivationSpec spec = new ActiveMQActivationSpec();
spec.setResourceAdapter(qResourceAdapter);
spec.setUseJNDI(false);
spec.setDestinationType("javax.jms.Queue");
spec.setDestination(MDBQUEUE);
ActiveMQConnectionFactory fac = qResourceAdapter.getConnectionFactory(spec);
assertEquals(-1, fac.getReconnectAttempts());
qResourceAdapter.stop();
assertFalse(spec.isHasBeenUpdated());
}
use of org.apache.activemq.artemis.ra.inflow.ActiveMQActivationSpec in project activemq-artemis by apache.
the class ResourceAdapterTest method testResourceAdapterSetupNoHADefault.
@Test
public void testResourceAdapterSetupNoHADefault() throws Exception {
ActiveMQResourceAdapter qResourceAdapter = new ActiveMQResourceAdapter();
qResourceAdapter.setConnectorClassName(INVM_CONNECTOR_FACTORY);
qResourceAdapter.setConnectionParameters("server-id=0");
ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext();
qResourceAdapter.start(ctx);
ActiveMQActivationSpec spec = new ActiveMQActivationSpec();
spec.setResourceAdapter(qResourceAdapter);
spec.setUseJNDI(false);
spec.setDestinationType("javax.jms.Queue");
spec.setDestination(MDBQUEUE);
ActiveMQConnectionFactory fac = qResourceAdapter.getConnectionFactory(spec);
assertFalse(fac.isHA());
qResourceAdapter.stop();
assertFalse(spec.isHasBeenUpdated());
}
use of org.apache.activemq.artemis.ra.inflow.ActiveMQActivationSpec in project activemq-artemis by apache.
the class ResourceAdapterTest method testResourceAdapterSetupOverrideDiscovery.
@Test
public void testResourceAdapterSetupOverrideDiscovery() throws Exception {
ActiveMQResourceAdapter qResourceAdapter = new ActiveMQResourceAdapter();
qResourceAdapter.setDiscoveryAddress("231.7.7.7");
ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext();
qResourceAdapter.start(ctx);
ActiveMQActivationSpec spec = new ActiveMQActivationSpec();
spec.setResourceAdapter(qResourceAdapter);
spec.setUseJNDI(false);
spec.setDestinationType("javax.jms.Queue");
spec.setDestination(MDBQUEUE);
spec.setSetupAttempts(0);
spec.setDiscoveryAddress("231.6.6.6");
spec.setDiscoveryPort(1234);
spec.setDiscoveryInitialWaitTimeout(1L);
spec.setDiscoveryRefreshTimeout(1L);
ActiveMQConnectionFactory fac = qResourceAdapter.getConnectionFactory(spec);
DiscoveryGroupConfiguration dc = fac.getServerLocator().getDiscoveryGroupConfiguration();
UDPBroadcastEndpointFactory udpDg = (UDPBroadcastEndpointFactory) dc.getBroadcastEndpointFactory();
assertEquals(udpDg.getGroupAddress(), "231.6.6.6");
assertEquals(udpDg.getGroupPort(), 1234);
assertEquals(dc.getRefreshTimeout(), 1L);
assertEquals(dc.getDiscoveryInitialWaitTimeout(), 1L);
qResourceAdapter.stop();
}
use of org.apache.activemq.artemis.ra.inflow.ActiveMQActivationSpec in project activemq-artemis by apache.
the class ResourceAdapterTest method testResourceAdapterSetupHAOverride.
@Test
public void testResourceAdapterSetupHAOverride() throws Exception {
ActiveMQResourceAdapter qResourceAdapter = new ActiveMQResourceAdapter();
qResourceAdapter.setConnectorClassName(INVM_CONNECTOR_FACTORY);
qResourceAdapter.setConnectionParameters("server-id=0");
ActiveMQRATestBase.MyBootstrapContext ctx = new ActiveMQRATestBase.MyBootstrapContext();
qResourceAdapter.start(ctx);
ActiveMQActivationSpec spec = new ActiveMQActivationSpec();
spec.setResourceAdapter(qResourceAdapter);
spec.setUseJNDI(false);
spec.setDestinationType("javax.jms.Queue");
spec.setDestination(MDBQUEUE);
spec.setHA(true);
ActiveMQConnectionFactory fac = qResourceAdapter.getConnectionFactory(spec);
assertTrue(fac.isHA());
qResourceAdapter.stop();
assertTrue(spec.isHasBeenUpdated());
}
Aggregations