final boolean failoverOnInitialConnection = true;
final String groupId = "myGroupId";
final String name = "myFirstConnectionFactoryName";
final String jndi_binding1 = name + "Binding1";
final String jndi_binding2 = name + "Binding2";
final JMSFactoryType type = JMSFactoryType.CF;
final boolean ha = true;
final List connectors = Arrays.asList("in-vm1", "in-vm2");
ClientSession session = basicSetUp();
jmsServer.createConnectionFactory(name,
ha,
type,
connectors,
clientId,
clientFailureCheckPeriod,
connectionTTl,
callTimeout,
cacheLargeMessagesClient,
minLargeMessageSize,
compressLargeMessages,
consumerWindowSize,
consumerMaxRate,
confirmationWindowSize,
producerWindowSize,
producerMaxrate,
blockOnAcknowledge,
blockOnDurableSend,
blockOnNonDurableSend,
autoGroup,
preacknowledge,
loadBalancingPolicyClassName,
transactionBatchSize,
dupsOKBatchSize,
useGlobalPools,
scheduledThreadPoolMaxSize,
threadPoolMaxSize,
retryInterval,
retryIntervalMultiplier,
maxRetryInterval,
reconnectAttempts,
failoverOnInitialConnection,
groupId,
jndi_binding1,
jndi_binding2);
jmsServer.createConnectionFactory(
"mySecondConnectionFactoryName",
false,
JMSFactoryType.CF,
Arrays.asList("in-vm1", "in-vm2"),
"mySecondConnectionFactoryName1",
"mySecondConnectionFactoryName2");
session.close();
locator.close();
jmsServer.stop();
ByteArrayOutputStream xmlOutputStream = new ByteArrayOutputStream();
XmlDataExporter xmlDataExporter = new XmlDataExporter(xmlOutputStream, getBindingsDir(), getJournalDir(), getPageDir(), getLargeMessagesDir());
xmlDataExporter.writeXMLData();
System.out.print(new String(xmlOutputStream.toByteArray()));
clearData();
basicSetUp();
locator = createInVMNonHALocator();
factory = locator.createSessionFactory();
session = factory.createSession(false, true, true);
ByteArrayInputStream xmlInputStream = new ByteArrayInputStream(xmlOutputStream.toByteArray());
XmlDataImporter xmlDataImporter = new XmlDataImporter(xmlInputStream, session);
try
{
xmlDataImporter.processXml();
}
catch (Exception e)
{
Assert.fail();
}
ConnectionFactory cf1 = (ConnectionFactory) namingContext.lookup(jndi_binding1);
Assert.assertNotNull(cf1);
HornetQConnectionFactory hcf1 = (HornetQConnectionFactory) cf1;
Assert.assertEquals(ha, hcf1.isHA());
Assert.assertEquals(type.intValue(), hcf1.getFactoryType());
Assert.assertEquals(clientId, hcf1.getClientID());
Assert.assertEquals(clientFailureCheckPeriod, hcf1.getClientFailureCheckPeriod());
Assert.assertEquals(connectionTTl, hcf1.getConnectionTTL());
Assert.assertEquals(callTimeout, hcf1.getCallTimeout());
// Assert.assertEquals(callFailoverTimeout, hcf1.getCallFailoverTimeout()); // this value isn't currently persisted by org.hornetq.jms.server.config.impl.ConnectionFactoryConfigurationImpl.encode()