use of org.apache.activemq.artemis.api.core.JGroupsFileBroadcastEndpointFactory in project activemq-artemis by apache.
the class ConnectionFactorySerializationTest method testConnectionFactoryJgroupsFile.
@Test
public void testConnectionFactoryJgroupsFile() throws Exception {
createDiscoveryFactoryJGroupsFile();
cf = (ActiveMQConnectionFactory) namingContext.lookup("/MyConnectionFactory");
// apparently looking up the connection factory with the org.apache.activemq.artemis.jms.tests.tools.container.InVMInitialContextFactory
// is not enough to actually serialize it so we serialize it manually
byte[] x = serialize(cf);
ActiveMQConnectionFactory y = deserialize(x, ActiveMQConnectionFactory.class);
checkEquals(cf, y);
DiscoveryGroupConfiguration dgc = y.getDiscoveryGroupConfiguration();
Assert.assertEquals(dgc.getName(), "dg1");
Assert.assertEquals(dgc.getDiscoveryInitialWaitTimeout(), 5000);
Assert.assertEquals(dgc.getRefreshTimeout(), 5000);
Assert.assertTrue(dgc.getBroadcastEndpointFactory() instanceof JGroupsFileBroadcastEndpointFactory);
JGroupsFileBroadcastEndpointFactory befc = (JGroupsFileBroadcastEndpointFactory) dgc.getBroadcastEndpointFactory();
Assert.assertEquals("myChannel", befc.getChannelName());
Assert.assertEquals("/META-INF/myfile.xml", befc.getFile());
}
use of org.apache.activemq.artemis.api.core.JGroupsFileBroadcastEndpointFactory in project activemq-artemis by apache.
the class ConnectionFactoryWithJGroupsSerializationTest method setUp.
@Override
@Before
public void setUp() throws Exception {
try {
super.setUp();
PlainConfigurator configurator = new PlainConfigurator(jgroupsConfigString);
channel = new JChannel(configurator);
String channelName1 = "channel1";
String channelName2 = "channel2";
BroadcastEndpointFactory jgroupsBroadcastCfg1 = new ChannelBroadcastEndpointFactory(channel, channelName1);
BroadcastEndpointFactory jgroupsBroadcastCfg2 = new JGroupsFileBroadcastEndpointFactory().setChannelName(channelName2).setFile(jgroupsConfigString);
DiscoveryGroupConfiguration dcConfig1 = new DiscoveryGroupConfiguration().setName("dg1").setRefreshTimeout(5000).setDiscoveryInitialWaitTimeout(5000).setBroadcastEndpointFactory(jgroupsBroadcastCfg1);
DiscoveryGroupConfiguration dcConfig2 = new DiscoveryGroupConfiguration().setName("dg2").setRefreshTimeout(5000).setDiscoveryInitialWaitTimeout(5000).setBroadcastEndpointFactory(jgroupsBroadcastCfg2);
jmsServer.getActiveMQServer().getConfiguration().getDiscoveryGroupConfigurations().put(dcConfig1.getName(), dcConfig1);
jmsServer.getActiveMQServer().getConfiguration().getDiscoveryGroupConfigurations().put(dcConfig2.getName(), dcConfig2);
jmsServer.createConnectionFactory("ConnectionFactory1", false, JMSFactoryType.CF, dcConfig1.getName(), "/ConnectionFactory1");
jmsServer.createConnectionFactory("ConnectionFactory2", false, JMSFactoryType.CF, dcConfig2.getName(), "/ConnectionFactory2");
testQueue = createQueue("testQueueFor1389");
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
Aggregations