use of org.apache.activemq.artemis.ra.ConnectionFactoryProperties in project activemq-artemis by apache.
the class ResourceAdapterTest method testActivationDeserializationParameters.
@Test
public void testActivationDeserializationParameters() throws Exception {
ActiveMQServer server = createServer(false);
try {
server.start();
ActiveMQResourceAdapter ra = new ActiveMQResourceAdapter();
ra.setConnectorClassName(INVM_CONNECTOR_FACTORY);
ra.setUserName("userGlobal");
ra.setPassword("passwordGlobal");
ra.setDeserializationWhiteList("a.b.c.d.e");
ra.setDeserializationBlackList("f.g.h.i.j");
ra.start(new BootstrapContext());
ActiveMQConnectionFactory factory = ra.getDefaultActiveMQConnectionFactory();
assertEquals("a.b.c.d.e", factory.getDeserializationWhiteList());
assertEquals("f.g.h.i.j", factory.getDeserializationBlackList());
ConnectionFactoryProperties overrides = new ConnectionFactoryProperties();
overrides.setDeserializationWhiteList("k.l.m.n");
overrides.setDeserializationBlackList("o.p.q.r");
factory = ra.newConnectionFactory(overrides);
assertEquals("k.l.m.n", factory.getDeserializationWhiteList());
assertEquals("o.p.q.r", factory.getDeserializationBlackList());
ra.stop();
} finally {
server.stop();
}
}
use of org.apache.activemq.artemis.ra.ConnectionFactoryProperties in project activemq-artemis by apache.
the class ResourceAdapterTest method testCreateConnectionFactoryMultipleConnectorsOverrideAndParams.
@Test
public void testCreateConnectionFactoryMultipleConnectorsOverrideAndParams() {
ActiveMQResourceAdapter ra = new ActiveMQResourceAdapter();
ra.setConnectorClassName(NETTY_CONNECTOR_FACTORY + "," + INVM_CONNECTOR_FACTORY + "," + NETTY_CONNECTOR_FACTORY);
ra.setConnectionParameters("host=host1;port=61616, serverid=0, host=host2;port=61617");
ConnectionFactoryProperties overrideProperties = new ConnectionFactoryProperties();
ArrayList<String> value = new ArrayList<>();
value.add(INVM_CONNECTOR_FACTORY);
value.add(NETTY_CONNECTOR_FACTORY);
value.add(INVM_CONNECTOR_FACTORY);
overrideProperties.setParsedConnectorClassNames(value);
ArrayList<Map<String, Object>> connectionParameters = new ArrayList<>();
Map<String, Object> map1 = new HashMap<>();
map1.put("serverid", "0");
connectionParameters.add(map1);
Map<String, Object> map2 = new HashMap<>();
map2.put("host", "myhost");
map2.put("port", "61616");
connectionParameters.add(map2);
Map<String, Object> map3 = new HashMap<>();
map3.put("serverid", "1");
connectionParameters.add(map3);
overrideProperties.setParsedConnectionParameters(connectionParameters);
ActiveMQConnectionFactory factory = ra.getConnectionFactory(overrideProperties);
TransportConfiguration[] configurations = factory.getServerLocator().getStaticTransportConfigurations();
assertNotNull(configurations);
assertEquals(3, configurations.length);
assertEquals(INVM_CONNECTOR_FACTORY, configurations[0].getFactoryClassName());
assertEquals(1, configurations[0].getParams().size());
assertEquals("0", configurations[0].getParams().get("serverid"));
assertEquals(NETTY_CONNECTOR_FACTORY, configurations[1].getFactoryClassName());
assertEquals(2, configurations[1].getParams().size());
assertEquals("myhost", configurations[1].getParams().get("host"));
assertEquals("61616", configurations[1].getParams().get("port"));
assertEquals(INVM_CONNECTOR_FACTORY, configurations[2].getFactoryClassName());
assertEquals(1, configurations[2].getParams().size());
assertEquals("1", configurations[2].getParams().get("serverid"));
}
use of org.apache.activemq.artemis.ra.ConnectionFactoryProperties in project activemq-artemis by apache.
the class ResourceAdapterTest method testCreateConnectionFactoryMultipleConnectorsOverride.
@Test
public void testCreateConnectionFactoryMultipleConnectorsOverride() {
ActiveMQResourceAdapter ra = new ActiveMQResourceAdapter();
ra.setConnectorClassName(NETTY_CONNECTOR_FACTORY + "," + INVM_CONNECTOR_FACTORY + "," + NETTY_CONNECTOR_FACTORY);
ConnectionFactoryProperties overrideProperties = new ConnectionFactoryProperties();
ArrayList<String> value = new ArrayList<>();
value.add(INVM_CONNECTOR_FACTORY);
value.add(NETTY_CONNECTOR_FACTORY);
value.add(INVM_CONNECTOR_FACTORY);
overrideProperties.setParsedConnectorClassNames(value);
ActiveMQConnectionFactory factory = ra.getConnectionFactory(overrideProperties);
TransportConfiguration[] configurations = factory.getServerLocator().getStaticTransportConfigurations();
assertNotNull(configurations);
assertEquals(3, configurations.length);
assertEquals(INVM_CONNECTOR_FACTORY, configurations[0].getFactoryClassName());
assertEquals(1, configurations[0].getParams().size());
assertEquals(NETTY_CONNECTOR_FACTORY, configurations[1].getFactoryClassName());
assertEquals(2, configurations[1].getParams().size());
assertEquals(INVM_CONNECTOR_FACTORY, configurations[2].getFactoryClassName());
assertEquals(1, configurations[2].getParams().size());
}
Aggregations