org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration

Here are the examples of the java api class org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration taken from open source projects.

1. JGroupsServerLocatorSchema#internalNewURI()

View license
@Override
protected URI internalNewURI(ServerLocator bean) throws Exception {
    DiscoveryGroupConfiguration dgc = bean.getDiscoveryGroupConfiguration();
    BroadcastEndpointFactory endpoint = dgc.getBroadcastEndpointFactory();
    String auth;
    if (endpoint instanceof JGroupsFileBroadcastEndpointFactory) {
        auth = ((JGroupsFileBroadcastEndpointFactory) endpoint).getChannelName();
    } else if (endpoint instanceof JGroupsPropertiesBroadcastEndpointFactory) {
        auth = ((JGroupsPropertiesBroadcastEndpointFactory) endpoint).getChannelName();
    } else {
        throw new NotSerializableException(endpoint + "not serializable");
    }
    String query = BeanSupport.getData(null, bean, dgc, endpoint);
    dgc.setBroadcastEndpointFactory(endpoint);
    return new URI(SchemaConstants.JGROUPS, null, auth, -1, null, query, null);
}

2. ConnectionFactoryURITest#testJGroupsPropertiesURI()

View license
@Test
public void testJGroupsPropertiesURI() throws Exception {
    DiscoveryGroupConfiguration discoveryGroupConfiguration = new DiscoveryGroupConfiguration();
    JGroupsPropertiesBroadcastEndpointFactory endpointFactory = new JGroupsPropertiesBroadcastEndpointFactory().setChannelName("channel-name").setProperties("param=val,param2-val2");
    discoveryGroupConfiguration.setName("foo").setRefreshTimeout(12345).setDiscoveryInitialWaitTimeout(5678).setBroadcastEndpointFactory(endpointFactory);
    ActiveMQConnectionFactory connectionFactoryWithHA = ActiveMQJMSClient.createConnectionFactoryWithHA(discoveryGroupConfiguration, JMSFactoryType.CF);
    URI tcp = parser.createSchema("jgroups", connectionFactoryWithHA);
    ActiveMQConnectionFactory factory = parser.newObject(tcp, null);
    DiscoveryGroupConfiguration dgc = factory.getDiscoveryGroupConfiguration();
    Assert.assertNotNull(dgc);
    BroadcastEndpointFactory broadcastEndpointFactory = dgc.getBroadcastEndpointFactory();
    Assert.assertNotNull(broadcastEndpointFactory);
    Assert.assertTrue(broadcastEndpointFactory instanceof JGroupsPropertiesBroadcastEndpointFactory);
    Assert.assertEquals(dgc.getName(), "foo");
    Assert.assertEquals(dgc.getDiscoveryInitialWaitTimeout(), 5678);
    Assert.assertEquals(dgc.getRefreshTimeout(), 12345);
    JGroupsPropertiesBroadcastEndpointFactory propertiesBroadcastEndpointFactory = (JGroupsPropertiesBroadcastEndpointFactory) broadcastEndpointFactory;
    Assert.assertEquals(propertiesBroadcastEndpointFactory.getProperties(), "param=val,param2-val2");
    Assert.assertEquals(propertiesBroadcastEndpointFactory.getChannelName(), "channel-name");
    BeanUtilsBean bean = new BeanUtilsBean();
    checkEquals(bean, connectionFactoryWithHA, factory);
}

3. JGroupsSchema#internalNewURI()

Project: activemq-artemis
Source File: JGroupsSchema.java
View license
@Override
protected URI internalNewURI(ActiveMQConnectionFactory bean) throws Exception {
    DiscoveryGroupConfiguration dgc = bean.getDiscoveryGroupConfiguration();
    BroadcastEndpointFactory endpoint = dgc.getBroadcastEndpointFactory();
    String auth;
    if (endpoint instanceof JGroupsFileBroadcastEndpointFactory) {
        auth = ((JGroupsFileBroadcastEndpointFactory) endpoint).getChannelName();
    } else if (endpoint instanceof JGroupsPropertiesBroadcastEndpointFactory) {
        auth = ((JGroupsPropertiesBroadcastEndpointFactory) endpoint).getChannelName();
    } else {
        throw new NotSerializableException(endpoint + "not serializable");
    }
    String query = BeanSupport.getData(null, bean, dgc, endpoint);
    dgc.setBroadcastEndpointFactory(endpoint);
    return new URI(SchemaConstants.JGROUPS, null, auth, -1, null, query, null);
}

4. ConnectionFactoryURITest#testJGroupsFileURI()

View license
@Test
public void testJGroupsFileURI() throws Exception {
    DiscoveryGroupConfiguration discoveryGroupConfiguration = new DiscoveryGroupConfiguration();
    JGroupsFileBroadcastEndpointFactory endpointFactory = new JGroupsFileBroadcastEndpointFactory().setChannelName("channel-name").setFile("channel-file.xml");
    discoveryGroupConfiguration.setName("foo").setRefreshTimeout(12345).setDiscoveryInitialWaitTimeout(5678).setBroadcastEndpointFactory(endpointFactory);
    ActiveMQConnectionFactory connectionFactoryWithHA = ActiveMQJMSClient.createConnectionFactoryWithHA(discoveryGroupConfiguration, JMSFactoryType.CF);
    URI tcp = parser.createSchema("jgroups", connectionFactoryWithHA);
    ActiveMQConnectionFactory factory = parser.newObject(tcp, null);
    DiscoveryGroupConfiguration dgc = factory.getDiscoveryGroupConfiguration();
    Assert.assertNotNull(dgc);
    BroadcastEndpointFactory befc = dgc.getBroadcastEndpointFactory();
    Assert.assertNotNull(befc);
    Assert.assertTrue(befc instanceof JGroupsFileBroadcastEndpointFactory);
    Assert.assertEquals(dgc.getName(), "foo");
    Assert.assertEquals(dgc.getDiscoveryInitialWaitTimeout(), 5678);
    Assert.assertEquals(dgc.getRefreshTimeout(), 12345);
    JGroupsFileBroadcastEndpointFactory fileBroadcastEndpointFactory = (JGroupsFileBroadcastEndpointFactory) befc;
    Assert.assertEquals(fileBroadcastEndpointFactory.getFile(), "channel-file.xml");
    Assert.assertEquals(fileBroadcastEndpointFactory.getChannelName(), "channel-name");
    BeanUtilsBean bean = new BeanUtilsBean();
    checkEquals(bean, connectionFactoryWithHA, factory);
}

5. ConnectionFactorySerializationTest#testConnectionFactoryJgroupsFile()

View license
@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());
}

6. ResourceAdapterTest#testCreateConnectionFactoryOverrideDiscovery()

View license
@Test
public void testCreateConnectionFactoryOverrideDiscovery() throws Exception {
    ActiveMQResourceAdapter ra = new ActiveMQResourceAdapter();
    ra.setConnectorClassName(InVMConnectorFactory.class.getName());
    ConnectionFactoryProperties connectionFactoryProperties = new ConnectionFactoryProperties();
    connectionFactoryProperties.setDiscoveryAddress("myhost");
    connectionFactoryProperties.setDiscoveryPort(5678);
    connectionFactoryProperties.setDiscoveryLocalBindAddress("newAddress");
    ActiveMQConnectionFactory factory = ra.getConnectionFactory(connectionFactoryProperties);
    ActiveMQConnectionFactory defaultFactory = ra.getDefaultActiveMQConnectionFactory();
    Assert.assertNotSame(factory, defaultFactory);
    DiscoveryGroupConfiguration dc = factory.getServerLocator().getDiscoveryGroupConfiguration();
    UDPBroadcastEndpointFactory udpDg = (UDPBroadcastEndpointFactory) dc.getBroadcastEndpointFactory();
    Assert.assertEquals(udpDg.getLocalBindAddress(), "newAddress");
    Assert.assertEquals(udpDg.getGroupAddress(), "myhost");
    Assert.assertEquals(udpDg.getGroupPort(), 5678);
}

7. ConnectionFactorySerializationTest#testConnectionFactoryJgroupsProperties()

View license
@Test
public void testConnectionFactoryJgroupsProperties() throws Exception {
    createDiscoveryFactoryJGroupsProperties();
    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 JGroupsPropertiesBroadcastEndpointFactory);
    JGroupsPropertiesBroadcastEndpointFactory befc = (JGroupsPropertiesBroadcastEndpointFactory) dgc.getBroadcastEndpointFactory();
    Assert.assertEquals("myChannel", befc.getChannelName());
    Assert.assertEquals("param=1,param2=2", befc.getProperties());
}

8. ConnectionFactorySerializationTest#createDiscoveryFactoryUDP()

View license
private void createDiscoveryFactoryUDP() throws Exception {
    // Deploy a connection factory with discovery
    List<String> bindings = new ArrayList<>();
    bindings.add("MyConnectionFactory");
    final String groupAddress = "1.2.3.4";
    final int port = 1234;
    String localBindAddress = getLocalHost().getHostAddress();
    UDPBroadcastEndpointFactory config = new UDPBroadcastEndpointFactory().setGroupAddress(groupAddress).setGroupPort(port).setLocalBindAddress(localBindAddress).setLocalBindPort(8580);
    DiscoveryGroupConfiguration dcConfig = new DiscoveryGroupConfiguration().setName("dg1").setRefreshTimeout(5000).setDiscoveryInitialWaitTimeout(5000).setBroadcastEndpointFactory(config);
    jmsServer.getActiveMQServer().getConfiguration().getDiscoveryGroupConfigurations().put(dcConfig.getName(), dcConfig);
    jmsServer.createConnectionFactory("MyConnectionFactory", false, JMSFactoryType.CF, dcConfig.getName(), "/MyConnectionFactory");
}

9. ConnectionFactorySerializationTest#createDiscoveryFactoryJGroupsFile()

View license
private void createDiscoveryFactoryJGroupsFile() throws Exception {
    // Deploy a connection factory with discovery
    List<String> bindings = new ArrayList<>();
    bindings.add("MyConnectionFactory");
    JGroupsFileBroadcastEndpointFactory config = new JGroupsFileBroadcastEndpointFactory().setChannelName("myChannel").setFile("/META-INF/myfile.xml");
    DiscoveryGroupConfiguration dcConfig = new DiscoveryGroupConfiguration().setName("dg1").setRefreshTimeout(5000).setDiscoveryInitialWaitTimeout(5000).setBroadcastEndpointFactory(config);
    jmsServer.getActiveMQServer().getConfiguration().getDiscoveryGroupConfigurations().put(dcConfig.getName(), dcConfig);
    jmsServer.createConnectionFactory("MyConnectionFactory", false, JMSFactoryType.CF, dcConfig.getName(), "/MyConnectionFactory");
}

10. ConnectionFactorySerializationTest#createDiscoveryFactoryJGroupsProperties()

View license
private void createDiscoveryFactoryJGroupsProperties() throws Exception {
    // Deploy a connection factory with discovery
    List<String> bindings = new ArrayList<>();
    bindings.add("MyConnectionFactory");
    JGroupsPropertiesBroadcastEndpointFactory config = new JGroupsPropertiesBroadcastEndpointFactory().setChannelName("myChannel").setProperties("param=1,param2=2");
    DiscoveryGroupConfiguration dcConfig = new DiscoveryGroupConfiguration().setName("dg1").setRefreshTimeout(5000).setDiscoveryInitialWaitTimeout(5000).setBroadcastEndpointFactory(config);
    jmsServer.getActiveMQServer().getConfiguration().getDiscoveryGroupConfigurations().put(dcConfig.getName(), dcConfig);
    jmsServer.createConnectionFactory("MyConnectionFactory", false, JMSFactoryType.CF, dcConfig.getName(), "/MyConnectionFactory");
}

11. JMSServerDeployerTest#setUp()

View license
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    DiscoveryGroupConfiguration dcg = new DiscoveryGroupConfiguration().setName("mygroup").setRefreshTimeout(5432).setDiscoveryInitialWaitTimeout(5432).setBroadcastEndpointFactory(new UDPBroadcastEndpointFactory().setGroupAddress("243.7.7.7").setGroupPort(12345).setLocalBindAddress("172.16.8.10"));
    config = createBasicConfig().addConnectorConfiguration("netty", new TransportConfiguration(NettyConnectorFactory.class.getName())).addDiscoveryGroupConfiguration("mygroup", dcg);
    ActiveMQServer server = createServer(false, config);
    jmsServer = new JMSServerManagerImpl(server);
    context = new InVMNamingContext();
    jmsServer.setRegistry(new JndiBindingRegistry(context));
    jmsServer.start();
}

12. SimpleJNDIClientTest#testRemoteCFWithJgroupsWithTransportConfigFile()

View license
@Test
public void testRemoteCFWithJgroupsWithTransportConfigFile() throws Exception {
    Hashtable<String, String> props = new Hashtable<>();
    props.put(Context.INITIAL_CONTEXT_FACTORY, org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory.class.getCanonicalName());
    props.put("connectionFactory.myConnectionFactory", "jgroups://testChannelName?file=test-jgroups-file_ping.xml&" + ActiveMQInitialContextFactory.REFRESH_TIMEOUT + "=5000&" + ActiveMQInitialContextFactory.DISCOVERY_INITIAL_WAIT_TIMEOUT + "=6000");
    Context ctx = new InitialContext(props);
    ActiveMQConnectionFactory cf = (ActiveMQConnectionFactory) ctx.lookup("myConnectionFactory");
    DiscoveryGroupConfiguration discoveryGroupConfiguration = cf.getDiscoveryGroupConfiguration();
    Assert.assertEquals(5000, discoveryGroupConfiguration.getRefreshTimeout());
    Assert.assertEquals(6000, discoveryGroupConfiguration.getDiscoveryInitialWaitTimeout());
    BroadcastEndpoint broadcastEndpoint = cf.getDiscoveryGroupConfiguration().getBroadcastEndpointFactory().createBroadcastEndpoint();
    Assert.assertTrue(broadcastEndpoint instanceof JGroupsFileBroadcastEndpoint);
    broadcastEndpoint.close(false);
}

13. SimpleJNDIClientTest#testRemoteCFWithJgroupsWithTransportConfigProps()

View license
@Test
public void testRemoteCFWithJgroupsWithTransportConfigProps() throws Exception {
    Hashtable<String, String> props = new Hashtable<>();
    props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName());
    props.put("connectionFactory.ConnectionFactory", "jgroups://testChannelName?properties=param=value&" + ActiveMQInitialContextFactory.REFRESH_TIMEOUT + "=5000&" + ActiveMQInitialContextFactory.DISCOVERY_INITIAL_WAIT_TIMEOUT + "=6000");
    Context ctx = new InitialContext(props);
    ActiveMQConnectionFactory cf = (ActiveMQConnectionFactory) ctx.lookup("ConnectionFactory");
    DiscoveryGroupConfiguration discoveryGroupConfiguration = cf.getDiscoveryGroupConfiguration();
    Assert.assertEquals(5000, discoveryGroupConfiguration.getRefreshTimeout());
    Assert.assertEquals(6000, discoveryGroupConfiguration.getDiscoveryInitialWaitTimeout());
    BroadcastEndpointFactory broadcastEndpointFactory = cf.getDiscoveryGroupConfiguration().getBroadcastEndpointFactory();
    Assert.assertTrue(broadcastEndpointFactory instanceof JGroupsPropertiesBroadcastEndpointFactory);
    JGroupsPropertiesBroadcastEndpointFactory endpointFactory = (JGroupsPropertiesBroadcastEndpointFactory) broadcastEndpointFactory;
    Assert.assertEquals(endpointFactory.getProperties(), "param=value");
    Assert.assertEquals(endpointFactory.getChannelName(), "testChannelName");
}

14. SimpleJNDIClientTest#testRemoteCFWithJgroupsWithTransportConfigNullProps()

View license
@Test
public void testRemoteCFWithJgroupsWithTransportConfigNullProps() throws Exception {
    Hashtable<String, String> props = new Hashtable<>();
    props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName());
    props.put("connectionFactory.ConnectionFactory", "jgroups://testChannelName?" + ActiveMQInitialContextFactory.REFRESH_TIMEOUT + "=5000&" + ActiveMQInitialContextFactory.DISCOVERY_INITIAL_WAIT_TIMEOUT + "=6000");
    Context ctx = new InitialContext(props);
    ActiveMQConnectionFactory cf = (ActiveMQConnectionFactory) ctx.lookup("ConnectionFactory");
    DiscoveryGroupConfiguration discoveryGroupConfiguration = cf.getDiscoveryGroupConfiguration();
    Assert.assertEquals(5000, discoveryGroupConfiguration.getRefreshTimeout());
    Assert.assertEquals(6000, discoveryGroupConfiguration.getDiscoveryInitialWaitTimeout());
    BroadcastEndpointFactory broadcastEndpointFactory = cf.getDiscoveryGroupConfiguration().getBroadcastEndpointFactory();
    Assert.assertTrue(broadcastEndpointFactory instanceof JGroupsPropertiesBroadcastEndpointFactory);
    JGroupsPropertiesBroadcastEndpointFactory endpointFactory = (JGroupsPropertiesBroadcastEndpointFactory) broadcastEndpointFactory;
    Assert.assertEquals(endpointFactory.getProperties(), null);
    Assert.assertEquals(endpointFactory.getChannelName(), "testChannelName");
}

15. SimpleJNDIClientTest#testRemoteCFWithUDPWithTransportConfig()

View license
@Test
public void testRemoteCFWithUDPWithTransportConfig() throws NamingException, JMSException {
    Hashtable<String, String> props = new Hashtable<>();
    props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName());
    props.put("connectionFactory.myConnectionFactory", "udp://" + getUDPDiscoveryAddress() + ":" + getUDPDiscoveryPort() + "?" + TransportConstants.LOCAL_ADDRESS_PROP_NAME + "=Server1&" + TransportConstants.LOCAL_PORT_PROP_NAME + "=1198&" + ActiveMQInitialContextFactory.REFRESH_TIMEOUT + "=5000&" + ActiveMQInitialContextFactory.DISCOVERY_INITIAL_WAIT_TIMEOUT + "=6000");
    Context ctx = new InitialContext(props);
    ActiveMQConnectionFactory cf = (ActiveMQConnectionFactory) ctx.lookup("myConnectionFactory");
    DiscoveryGroupConfiguration discoveryGroupConfiguration = cf.getDiscoveryGroupConfiguration();
    Assert.assertEquals(5000, discoveryGroupConfiguration.getRefreshTimeout());
    Assert.assertEquals(6000, discoveryGroupConfiguration.getDiscoveryInitialWaitTimeout());
    UDPBroadcastEndpointFactory udpBroadcastEndpointFactory = (UDPBroadcastEndpointFactory) discoveryGroupConfiguration.getBroadcastEndpointFactory();
    //these 2 are transient so are ignored
    Assert.assertNotEquals("Server1", udpBroadcastEndpointFactory.getLocalBindAddress());
    Assert.assertNotEquals(1198, udpBroadcastEndpointFactory.getLocalBindPort());
    Assert.assertEquals(getUDPDiscoveryAddress(), udpBroadcastEndpointFactory.getGroupAddress());
    Assert.assertEquals(getUDPDiscoveryPort(), udpBroadcastEndpointFactory.getGroupPort());
}

16. ResourceAdapterTest#testResourceAdapterSetupNoOverrideDiscovery()

View license
@Test
public void testResourceAdapterSetupNoOverrideDiscovery() throws Exception {
    ActiveMQResourceAdapter qResourceAdapter = new ActiveMQResourceAdapter();
    qResourceAdapter.setDiscoveryAddress("231.6.6.6");
    qResourceAdapter.setDiscoveryPort(1234);
    qResourceAdapter.setDiscoveryRefreshTimeout(1L);
    qResourceAdapter.setDiscoveryInitialWaitTimeout(1L);
    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);
    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();
}

17. JGroupsServerLocatorSchema#internalNewObject()

View license
@Override
protected ServerLocator internalNewObject(URI uri, Map<String, String> query, String name) throws Exception {
    ConnectionOptions options = newConnectionOptions(uri, query);
    DiscoveryGroupConfiguration dcConfig = getDiscoveryGroupConfiguration(uri, query, name);
    if (options.isHa()) {
        return ActiveMQClient.createServerLocatorWithHA(dcConfig);
    } else {
        return ActiveMQClient.createServerLocatorWithoutHA(dcConfig);
    }
}

18. ConnectionFactorySerializationTest#testConnectionFactoryUDP()

View license
// Public --------------------------------------------------------
@Test
public void testConnectionFactoryUDP() throws Exception {
    createDiscoveryFactoryUDP();
    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 UDPBroadcastEndpointFactory);
    UDPBroadcastEndpointFactory befc = (UDPBroadcastEndpointFactory) dgc.getBroadcastEndpointFactory();
    Assert.assertEquals(Integer.parseInt(System.getProperty("org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory.localBindPort", "-1")), befc.getLocalBindPort());
    Assert.assertEquals(System.getProperty("org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory.localBindAddress"), befc.getLocalBindAddress());
    Assert.assertEquals(1234, befc.getGroupPort());
    Assert.assertEquals("1.2.3.4", befc.getGroupAddress());
}

19. ActiveMQConnectionFactoryTest#testDiscoveryConstructor()

View license
@Test
public void testDiscoveryConstructor() throws Exception {
    DiscoveryGroupConfiguration groupConfiguration = new DiscoveryGroupConfiguration().setBroadcastEndpointFactory(new UDPBroadcastEndpointFactory().setGroupAddress(groupAddress).setGroupPort(groupPort));
    ActiveMQConnectionFactory cf = ActiveMQJMSClient.createConnectionFactoryWithoutHA(groupConfiguration, JMSFactoryType.CF);
    assertFactoryParams(cf, null, groupConfiguration, null, ActiveMQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD, ActiveMQClient.DEFAULT_CONNECTION_TTL, ActiveMQClient.DEFAULT_CALL_TIMEOUT, ActiveMQClient.DEFAULT_CALL_FAILOVER_TIMEOUT, ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE, ActiveMQClient.DEFAULT_CONSUMER_WINDOW_SIZE, ActiveMQClient.DEFAULT_CONSUMER_MAX_RATE, ActiveMQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE, ActiveMQClient.DEFAULT_PRODUCER_MAX_RATE, ActiveMQClient.DEFAULT_BLOCK_ON_ACKNOWLEDGE, ActiveMQClient.DEFAULT_BLOCK_ON_DURABLE_SEND, ActiveMQClient.DEFAULT_BLOCK_ON_NON_DURABLE_SEND, ActiveMQClient.DEFAULT_AUTO_GROUP, ActiveMQClient.DEFAULT_PRE_ACKNOWLEDGE, ActiveMQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME, ActiveMQClient.DEFAULT_ACK_BATCH_SIZE, ActiveMQClient.DEFAULT_ACK_BATCH_SIZE, ActiveMQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT, ActiveMQClient.DEFAULT_USE_GLOBAL_POOLS, ActiveMQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE, ActiveMQClient.DEFAULT_THREAD_POOL_MAX_SIZE, ActiveMQClient.DEFAULT_RETRY_INTERVAL, ActiveMQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER, ActiveMQClient.DEFAULT_RECONNECT_ATTEMPTS);
    Connection conn = cf.createConnection();
    conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
    testSettersThrowException(cf);
    conn.close();
}

20. UDPSchema#internalNewObject()

Project: activemq-artemis
Source File: UDPSchema.java
View license
@Override
public ActiveMQConnectionFactory internalNewObject(URI uri, Map<String, String> query, String name) throws Exception {
    JMSConnectionOptions options = newConectionOptions(uri, query);
    DiscoveryGroupConfiguration dgc = UDPServerLocatorSchema.getDiscoveryGroupConfiguration(uri, query, getHost(uri), getPort(uri), name);
    ActiveMQConnectionFactory factory;
    if (options.isHa()) {
        factory = ActiveMQJMSClient.createConnectionFactoryWithHA(dgc, options.getFactoryTypeEnum());
    } else {
        factory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(dgc, options.getFactoryTypeEnum());
    }
    return BeanSupport.setData(uri, factory, query);
}

21. JGroupsSchema#internalNewObject()

Project: activemq-artemis
Source File: JGroupsSchema.java
View license
@Override
public ActiveMQConnectionFactory internalNewObject(URI uri, Map<String, String> query, String name) throws Exception {
    JMSConnectionOptions options = newConectionOptions(uri, query);
    DiscoveryGroupConfiguration dcConfig = JGroupsServerLocatorSchema.getDiscoveryGroupConfiguration(uri, query, name);
    ActiveMQConnectionFactory factory;
    if (options.isHa()) {
        factory = ActiveMQJMSClient.createConnectionFactoryWithHA(dcConfig, options.getFactoryTypeEnum());
    } else {
        factory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(dcConfig, options.getFactoryTypeEnum());
    }
    return BeanSupport.setData(uri, factory, query);
}

22. UDPServerLocatorSchema#getDiscoveryGroupConfiguration()

View license
public static DiscoveryGroupConfiguration getDiscoveryGroupConfiguration(URI uri, Map<String, String> query, String host, int port, String name) throws Exception {
    UDPBroadcastEndpointFactory endpointFactoryConfiguration = new UDPBroadcastEndpointFactory().setGroupAddress(host).setGroupPort(port);
    BeanSupport.setData(uri, endpointFactoryConfiguration, query);
    DiscoveryGroupConfiguration dgc = BeanSupport.setData(uri, new DiscoveryGroupConfiguration(), query).setName(name).setBroadcastEndpointFactory(endpointFactoryConfiguration);
    BeanSupport.setData(uri, dgc, query);
    return dgc;
}

23. UDPServerLocatorSchema#internalNewObject()

View license
@Override
protected ServerLocator internalNewObject(URI uri, Map<String, String> query, String name) throws Exception {
    ConnectionOptions options = newConnectionOptions(uri, query);
    DiscoveryGroupConfiguration dgc = getDiscoveryGroupConfiguration(uri, query, getHost(uri), getPort(uri), name);
    if (options.isHa()) {
        return ActiveMQClient.createServerLocatorWithHA(dgc);
    } else {
        return ActiveMQClient.createServerLocatorWithoutHA(dgc);
    }
}

24. JGroupsServerLocatorSchema#getDiscoveryGroupConfiguration()

View license
public static DiscoveryGroupConfiguration getDiscoveryGroupConfiguration(URI uri, Map<String, String> query, String name) throws Exception {
    BroadcastEndpointFactory endpointFactory;
    if (query.containsKey("file")) {
        endpointFactory = new JGroupsFileBroadcastEndpointFactory().setChannelName(uri.getAuthority());
    } else {
        endpointFactory = new JGroupsPropertiesBroadcastEndpointFactory().setChannelName(uri.getAuthority());
    }
    BeanSupport.setData(uri, endpointFactory, query);
    DiscoveryGroupConfiguration dcConfig = new DiscoveryGroupConfiguration().setName(name).setBroadcastEndpointFactory(endpointFactory);
    BeanSupport.setData(uri, dcConfig, query);
    return dcConfig;
}

25. ConnectionFactoryURITest#testUDPURI()

View license
@Test
public void testUDPURI() throws Exception {
    DiscoveryGroupConfiguration discoveryGroupConfiguration = new DiscoveryGroupConfiguration();
    UDPBroadcastEndpointFactory endpoint = new UDPBroadcastEndpointFactory();
    endpoint.setGroupPort(3333).setGroupAddress("wahey").setLocalBindPort(555).setLocalBindAddress("uhuh");
    discoveryGroupConfiguration.setName("foo").setRefreshTimeout(12345).setDiscoveryInitialWaitTimeout(5678).setBroadcastEndpointFactory(endpoint);
    ActiveMQConnectionFactory connectionFactoryWithHA = ActiveMQJMSClient.createConnectionFactoryWithHA(discoveryGroupConfiguration, JMSFactoryType.CF);
    URI tcp = parser.createSchema("udp", connectionFactoryWithHA);
    ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(tcp.toString());
    DiscoveryGroupConfiguration dgc = factory.getDiscoveryGroupConfiguration();
    Assert.assertNotNull(dgc);
    BroadcastEndpointFactory befc = dgc.getBroadcastEndpointFactory();
    Assert.assertNotNull(befc);
    Assert.assertTrue(befc instanceof UDPBroadcastEndpointFactory);
    UDPBroadcastEndpointFactory ubgc = (UDPBroadcastEndpointFactory) befc;
    Assert.assertEquals("wahey", ubgc.getGroupAddress());
    Assert.assertEquals(3333, ubgc.getGroupPort());
    //these 2 are transient
    // These will take the System.properties used on the testsuite,
    // for that reason we take them as != instead of checking for null
    Assert.assertNotEquals("uhuh", ubgc.getLocalBindAddress());
    Assert.assertNotEquals(555, ubgc.getLocalBindPort());
    Assert.assertEquals("foo", dgc.getName());
    Assert.assertEquals(5678, dgc.getDiscoveryInitialWaitTimeout());
    Assert.assertEquals(12345, dgc.getRefreshTimeout());
    BeanUtilsBean bean = new BeanUtilsBean();
    checkEquals(bean, connectionFactoryWithHA, factory);
}

26. UDPSchema#internalNewURI()

Project: activemq-artemis
Source File: UDPSchema.java
View license
@Override
protected URI internalNewURI(ActiveMQConnectionFactory bean) throws Exception {
    DiscoveryGroupConfiguration dgc = bean.getDiscoveryGroupConfiguration();
    UDPBroadcastEndpointFactory endpoint = (UDPBroadcastEndpointFactory) dgc.getBroadcastEndpointFactory();
    String query = BeanSupport.getData(UDPServerLocatorSchema.IGNORED, bean, dgc, endpoint);
    dgc.setBroadcastEndpointFactory(endpoint);
    return new URI(SchemaConstants.UDP, null, endpoint.getGroupAddress(), endpoint.getGroupPort(), null, query, null);
}

27. UDPServerLocatorSchema#internalNewURI()

View license
@Override
protected URI internalNewURI(ServerLocator bean) throws Exception {
    DiscoveryGroupConfiguration dgc = bean.getDiscoveryGroupConfiguration();
    UDPBroadcastEndpointFactory endpoint = (UDPBroadcastEndpointFactory) dgc.getBroadcastEndpointFactory();
    dgc.setBroadcastEndpointFactory(endpoint);
    String query = BeanSupport.getData(IGNORED, bean, dgc, endpoint);
    return new URI(SchemaConstants.UDP, null, endpoint.getGroupAddress(), endpoint.getGroupPort(), null, query, null);
}

28. ClusterTestBase#setupBackupServerWithDiscovery()

View license
protected void setupBackupServerWithDiscovery(final int node, final int liveNode, final String groupAddress, final int port, final boolean fileStorage, final boolean netty, final boolean sharedStorage) throws Exception {
    if (servers[node] != null) {
        throw new IllegalArgumentException("Already a server at node " + node);
    }
    Map<String, Object> params = generateParams(node, netty);
    TransportConfiguration connector = createTransportConfiguration(netty, false, params);
    List<String> connectorPairs = new ArrayList<>();
    connectorPairs.add(connector.getName());
    UDPBroadcastEndpointFactory endpoint = new UDPBroadcastEndpointFactory().setGroupAddress(groupAddress).setGroupPort(port);
    BroadcastGroupConfiguration bcConfig = new BroadcastGroupConfiguration().setName("bg1").setBroadcastPeriod(1000).setConnectorInfos(connectorPairs).setEndpointFactory(endpoint);
    DiscoveryGroupConfiguration dcConfig = new DiscoveryGroupConfiguration().setName("dg1").setRefreshTimeout(5000).setDiscoveryInitialWaitTimeout(5000).setBroadcastEndpointFactory(endpoint);
    Configuration configuration = createBasicConfig(sharedStorage ? liveNode : node).clearAcceptorConfigurations().addAcceptorConfiguration(createTransportConfiguration(netty, true, params)).addConnectorConfiguration(connector.getName(), connector).addBroadcastGroupConfiguration(bcConfig).addDiscoveryGroupConfiguration(dcConfig.getName(), dcConfig).setHAPolicyConfiguration(sharedStorage ? new SharedStoreSlavePolicyConfiguration() : new ReplicatedPolicyConfiguration());
    ActiveMQServer server;
    if (sharedStorage) {
        server = createInVMFailoverServer(fileStorage, configuration, nodeManagers[liveNode], liveNode);
    } else {
        boolean enablePersistency = fileStorage ? configuration.isPersistenceEnabled() : false;
        server = addServer(ActiveMQServers.newActiveMQServer(configuration, enablePersistency));
    }
    servers[node] = server;
}

29. ClusterTestBase#setupLiveServerWithDiscovery()

View license
protected void setupLiveServerWithDiscovery(final int node, final String groupAddress, final int port, final boolean fileStorage, final boolean netty, final boolean sharedStorage) throws Exception {
    if (servers[node] != null) {
        throw new IllegalArgumentException("Already a server at node " + node);
    }
    Map<String, Object> params = generateParams(node, netty);
    TransportConfiguration connector = createTransportConfiguration(netty, false, params);
    List<String> connectorPairs = new ArrayList<>();
    connectorPairs.add(connector.getName());
    UDPBroadcastEndpointFactory endpoint = new UDPBroadcastEndpointFactory().setGroupAddress(groupAddress).setGroupPort(port);
    BroadcastGroupConfiguration bcConfig = new BroadcastGroupConfiguration().setName("bg1").setBroadcastPeriod(200).setConnectorInfos(connectorPairs).setEndpointFactory(endpoint);
    DiscoveryGroupConfiguration dcConfig = new DiscoveryGroupConfiguration().setName("dg1").setRefreshTimeout(1000).setDiscoveryInitialWaitTimeout(1000).setBroadcastEndpointFactory(endpoint);
    Configuration configuration = createBasicConfig(node).setJournalMaxIO_AIO(1000).clearAcceptorConfigurations().addAcceptorConfiguration(createTransportConfiguration(netty, true, params)).addConnectorConfiguration(connector.getName(), connector).addBroadcastGroupConfiguration(bcConfig).addDiscoveryGroupConfiguration(dcConfig.getName(), dcConfig).setHAPolicyConfiguration(sharedStorage ? new SharedStoreMasterPolicyConfiguration() : new ReplicatedPolicyConfiguration());
    ActiveMQServer server;
    if (fileStorage) {
        if (sharedStorage) {
            server = createInVMFailoverServer(true, configuration, nodeManagers[node], node);
        } else {
            server = addServer(ActiveMQServers.newActiveMQServer(configuration));
            server.setIdentity("Server " + node);
        }
    } else {
        if (sharedStorage) {
            server = createInVMFailoverServer(false, configuration, nodeManagers[node], node);
        } else {
            server = addServer(ActiveMQServers.newActiveMQServer(configuration, false));
            server.setIdentity("Server " + node);
        }
    }
    servers[node] = server;
}

30. FileConfigurationParser#parseDiscoveryGroupConfiguration()

View license
private void parseDiscoveryGroupConfiguration(final Element e, final Configuration mainConfig) {
    String name = e.getAttribute("name");
    long discoveryInitialWaitTimeout = getLong(e, "initial-wait-timeout", ActiveMQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT, Validators.GT_ZERO);
    long refreshTimeout = getLong(e, "refresh-timeout", ActiveMQDefaultConfiguration.getDefaultBroadcastRefreshTimeout(), Validators.GT_ZERO);
    String localBindAddress = getString(e, "local-bind-address", null, Validators.NO_CHECK);
    int localBindPort = getInteger(e, "local-bind-port", -1, Validators.MINUS_ONE_OR_GT_ZERO);
    String groupAddress = getString(e, "group-address", null, Validators.NO_CHECK);
    int groupPort = getInteger(e, "group-port", -1, Validators.MINUS_ONE_OR_GT_ZERO);
    String jgroupsFile = getString(e, "jgroups-file", null, Validators.NO_CHECK);
    String jgroupsChannel = getString(e, "jgroups-channel", null, Validators.NO_CHECK);
    // TODO: validate if either jgroups or UDP is being filled
    BroadcastEndpointFactory endpointFactory;
    if (jgroupsFile != null) {
        endpointFactory = new JGroupsFileBroadcastEndpointFactory().setFile(jgroupsFile).setChannelName(jgroupsChannel);
    } else {
        endpointFactory = new UDPBroadcastEndpointFactory().setGroupAddress(groupAddress).setGroupPort(groupPort).setLocalBindAddress(localBindAddress).setLocalBindPort(localBindPort);
    }
    DiscoveryGroupConfiguration config = new DiscoveryGroupConfiguration().setName(name).setRefreshTimeout(refreshTimeout).setDiscoveryInitialWaitTimeout(discoveryInitialWaitTimeout).setBroadcastEndpointFactory(endpointFactory);
    if (mainConfig.getDiscoveryGroupConfigurations().containsKey(name)) {
        ActiveMQServerLogger.LOGGER.discoveryGroupAlreadyDeployed(name);
        return;
    } else {
        mainConfig.getDiscoveryGroupConfigurations().put(name, config);
    }
}

31. ClusterConnectionControl2Test#setUp()

View license
@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    String discoveryName = RandomUtil.randomString();
    String groupAddress = "231.7.7.7";
    int groupPort = 9876;
    Map<String, Object> acceptorParams_1 = new HashMap<>();
    acceptorParams_1.put(TransportConstants.PORT_PROP_NAME, port_1);
    TransportConfiguration acceptorConfig_0 = new TransportConfiguration(ActiveMQTestBase.NETTY_ACCEPTOR_FACTORY);
    TransportConfiguration acceptorConfig_1 = new TransportConfiguration(ActiveMQTestBase.NETTY_ACCEPTOR_FACTORY, acceptorParams_1);
    TransportConfiguration connectorConfig_1 = new TransportConfiguration(ActiveMQTestBase.NETTY_CONNECTOR_FACTORY, acceptorParams_1);
    TransportConfiguration connectorConfig_0 = new TransportConfiguration(ActiveMQTestBase.NETTY_CONNECTOR_FACTORY);
    CoreQueueConfiguration queueConfig = new CoreQueueConfiguration().setAddress(RandomUtil.randomString()).setName(RandomUtil.randomString()).setDurable(false);
    List<String> connectorInfos = new ArrayList<>();
    connectorInfos.add("netty");
    BroadcastGroupConfiguration broadcastGroupConfig = new BroadcastGroupConfiguration().setName(discoveryName).setBroadcastPeriod(250).setConnectorInfos(connectorInfos).setEndpointFactory(new UDPBroadcastEndpointFactory().setGroupAddress(groupAddress).setGroupPort(groupPort));
    DiscoveryGroupConfiguration discoveryGroupConfig = new DiscoveryGroupConfiguration().setName(discoveryName).setRefreshTimeout(0).setDiscoveryInitialWaitTimeout(0).setBroadcastEndpointFactory(new UDPBroadcastEndpointFactory().setGroupAddress(groupAddress).setGroupPort(groupPort));
    clusterConnectionConfig_0 = new ClusterConnectionConfiguration().setName(clusterName).setAddress(queueConfig.getAddress()).setConnectorName("netty").setRetryInterval(1000).setDuplicateDetection(false).setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND).setMaxHops(1).setConfirmationWindowSize(1024).setDiscoveryGroupName(discoveryName);
    Configuration conf_1 = createBasicConfig().addClusterConfiguration(clusterConnectionConfig_0).addAcceptorConfiguration(acceptorConfig_1).addConnectorConfiguration("netty", connectorConfig_1).addQueueConfiguration(queueConfig).addDiscoveryGroupConfiguration(discoveryName, discoveryGroupConfig).addBroadcastGroupConfiguration(broadcastGroupConfig);
    Configuration conf_0 = createBasicConfig(1).addClusterConfiguration(clusterConnectionConfig_0).addAcceptorConfiguration(acceptorConfig_0).addConnectorConfiguration("netty", connectorConfig_0).addDiscoveryGroupConfiguration(discoveryName, discoveryGroupConfig).addBroadcastGroupConfiguration(broadcastGroupConfig);
    mbeanServer_1 = MBeanServerFactory.createMBeanServer();
    server1 = addServer(ActiveMQServers.newActiveMQServer(conf_1, mbeanServer_1, false));
    server0 = addServer(ActiveMQServers.newActiveMQServer(conf_0, mbeanServer, false));
    server0.start();
    waitForServerToStart(server0);
}

32. ClusterConnectionControlTest#setUp()

View license
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    Map<String, Object> acceptorParams = new HashMap<>();
    acceptorParams.put(TransportConstants.SERVER_ID_PROP_NAME, 1);
    TransportConfiguration acceptorConfig = new TransportConfiguration(InVMAcceptorFactory.class.getName(), acceptorParams, RandomUtil.randomString());
    TransportConfiguration connectorConfig = new TransportConfiguration(InVMConnectorFactory.class.getName(), acceptorParams, RandomUtil.randomString());
    CoreQueueConfiguration queueConfig = new CoreQueueConfiguration().setAddress(RandomUtil.randomString()).setName(RandomUtil.randomString()).setDurable(false);
    List<String> connectors = new ArrayList<>();
    connectors.add(connectorConfig.getName());
    String discoveryGroupName = RandomUtil.randomString();
    DiscoveryGroupConfiguration discoveryGroupConfig = new DiscoveryGroupConfiguration().setName(discoveryGroupName).setRefreshTimeout(500).setDiscoveryInitialWaitTimeout(0).setBroadcastEndpointFactory(new UDPBroadcastEndpointFactory().setGroupAddress("230.1.2.3").setGroupPort(6745));
    Configuration conf_1 = createBasicConfig().addAcceptorConfiguration(acceptorConfig).addQueueConfiguration(queueConfig);
    clusterConnectionConfig1 = new ClusterConnectionConfiguration().setName(RandomUtil.randomString()).setAddress(queueConfig.getAddress()).setConnectorName(connectorConfig.getName()).setRetryInterval(RandomUtil.randomPositiveLong()).setDuplicateDetection(RandomUtil.randomBoolean()).setMessageLoadBalancingType(MessageLoadBalancingType.STRICT).setMaxHops(RandomUtil.randomPositiveInt()).setConfirmationWindowSize(RandomUtil.randomPositiveInt()).setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND).setStaticConnectors(connectors);
    clusterConnectionConfig2 = new ClusterConnectionConfiguration().setName(RandomUtil.randomString()).setAddress(queueConfig.getAddress()).setConnectorName(connectorConfig.getName()).setRetryInterval(RandomUtil.randomPositiveLong()).setDuplicateDetection(RandomUtil.randomBoolean()).setMessageLoadBalancingType(MessageLoadBalancingType.OFF).setMaxHops(RandomUtil.randomPositiveInt()).setConfirmationWindowSize(RandomUtil.randomPositiveInt()).setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND).setDiscoveryGroupName(discoveryGroupName);
    Configuration conf_0 = createBasicConfig().addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName())).addConnectorConfiguration(connectorConfig.getName(), connectorConfig).addClusterConfiguration(clusterConnectionConfig1).addClusterConfiguration(clusterConnectionConfig2).addDiscoveryGroupConfiguration(discoveryGroupName, discoveryGroupConfig);
    mbeanServer_1 = MBeanServerFactory.createMBeanServer();
    server_1 = addServer(ActiveMQServers.newActiveMQServer(conf_1, mbeanServer_1, false));
    server_1.start();
    server_0 = addServer(ActiveMQServers.newActiveMQServer(conf_0, mbeanServer, false));
    server_0.start();
}

33. ResourceAdapterTest#testResourceAdapterSetupOverrideDiscovery()

View license
@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();
}