private void populate(StringBuilder sb, BeanUtilsBean bean, ActiveMQConnectionFactory factory) throws IllegalAccessException, InvocationTargetException { PropertyDescriptor[] descriptors = bean.getPropertyUtils().getPropertyDescriptors(factory); for (PropertyDescriptor descriptor : descriptors) { if (descriptor.getWriteMethod() != null && descriptor.getReadMethod() != null) { if (descriptor.getPropertyType() == String.class) { String value = RandomUtil.randomString(); bean.setProperty(factory, descriptor.getName(), value); sb.append("&").append(descriptor.getName()).append("=").append(value); } else if (descriptor.getPropertyType() == int.class) { int value = RandomUtil.randomPositiveInt(); bean.setProperty(factory, descriptor.getName(), value); sb.append("&").append(descriptor.getName()).append("=").append(value); } else if (descriptor.getPropertyType() == long.class) { long value = RandomUtil.randomPositiveLong(); bean.setProperty(factory, descriptor.getName(), value); sb.append("&").append(descriptor.getName()).append("=").append(value); } else if (descriptor.getPropertyType() == double.class) { double value = RandomUtil.randomDouble(); bean.setProperty(factory, descriptor.getName(), value); sb.append("&").append(descriptor.getName()).append("=").append(value); } } } }
liveParams2.put(TransportConstants.PORT_PROP_NAME, 6665); ConnectionFactoryConfiguration config = new ConnectionFactoryConfigurationImpl().setName("some-name").setConnectorNames(connectorConfigs).setBindings(str).setCallTimeout(RandomUtil.randomPositiveLong()); List<Pair<String, String>> connectors = new ArrayList<>(); connectors.add(new Pair<String, String>(RandomUtil.randomString(), null));
@Test public void testScheduleRandom() throws Exception { ScheduledDeliveryHandlerImpl handler = new ScheduledDeliveryHandlerImpl(null, new FakeQueueForScheduleUnitTest(0)); long nextMessage = 0; long NUMBER_OF_SEQUENCES = 100000; for (int i = 0; i < NUMBER_OF_SEQUENCES; i++) { int numberOfMessages = RandomUtil.randomInt() % 10; if (numberOfMessages == 0) numberOfMessages = 1; long nextScheduledTime = RandomUtil.randomPositiveLong(); for (int j = 0; j < numberOfMessages; j++) { boolean tail = RandomUtil.randomBoolean(); addMessage(handler, nextMessage++, nextScheduledTime, tail); } } debugList(true, handler, nextMessage); }
@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 sourceQueueConfig = new CoreQueueConfiguration().setAddress(RandomUtil.randomString()).setName(RandomUtil.randomString()).setDurable(false); CoreQueueConfiguration targetQueueConfig = new CoreQueueConfiguration().setAddress(RandomUtil.randomString()).setName(RandomUtil.randomString()).setDurable(false); List<String> connectors = new ArrayList<>(); connectors.add(connectorConfig.getName()); bridgeConfig = new BridgeConfiguration().setName(RandomUtil.randomString()).setQueueName(sourceQueueConfig.getName()).setForwardingAddress(targetQueueConfig.getAddress()).setRetryInterval(RandomUtil.randomPositiveLong()).setRetryIntervalMultiplier(RandomUtil.randomDouble()).setInitialConnectAttempts(RandomUtil.randomPositiveInt()).setReconnectAttempts(RandomUtil.randomPositiveInt()).setReconnectAttemptsOnSameNode(RandomUtil.randomPositiveInt()).setUseDuplicateDetection(RandomUtil.randomBoolean()).setConfirmationWindowSize(RandomUtil.randomPositiveInt()).setStaticConnectors(connectors); Configuration conf_1 = createBasicConfig().addAcceptorConfiguration(acceptorConfig).addQueueConfiguration(targetQueueConfig); Configuration conf_0 = createBasicConfig().addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY)).addConnectorConfiguration(connectorConfig.getName(), connectorConfig).addQueueConfiguration(sourceQueueConfig).addBridgeConfiguration(bridgeConfig); server_1 = addServer(ActiveMQServers.newActiveMQServer(conf_1, MBeanServerFactory.createMBeanServer(), false)); server_1.start(); server_0 = addServer(ActiveMQServers.newActiveMQServer(conf_0, mbeanServer, false)); server_0.start(); }
@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 sourceQueueConfig = new CoreQueueConfiguration().setAddress(RandomUtil.randomString()).setName(RandomUtil.randomString()).setDurable(false); CoreQueueConfiguration targetQueueConfig = new CoreQueueConfiguration().setAddress(RandomUtil.randomString()).setName(RandomUtil.randomString()).setDurable(false); List<String> connectors = new ArrayList<>(); connectors.add(connectorConfig.getName()); Configuration conf_1 = createBasicConfig().addAcceptorConfiguration(acceptorConfig).addQueueConfiguration(targetQueueConfig); bridgeConfig = new BridgeConfiguration().setName(RandomUtil.randomString()).setQueueName(sourceQueueConfig.getName()).setForwardingAddress(targetQueueConfig.getAddress()).setRetryInterval(RandomUtil.randomPositiveLong()).setRetryIntervalMultiplier(RandomUtil.randomDouble()).setInitialConnectAttempts(RandomUtil.randomPositiveInt()).setReconnectAttempts(RandomUtil.randomPositiveInt()).setReconnectAttemptsOnSameNode(RandomUtil.randomPositiveInt()).setUseDuplicateDetection(RandomUtil.randomBoolean()).setConfirmationWindowSize(RandomUtil.randomPositiveInt()).setStaticConnectors(connectors).setPassword(CLUSTER_PASSWORD); Configuration conf_0 = createBasicConfig().addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName())).addConnectorConfiguration(connectorConfig.getName(), connectorConfig).addQueueConfiguration(sourceQueueConfig).addBridgeConfiguration(bridgeConfig); server_1 = addServer(ActiveMQServers.newActiveMQServer(conf_1, MBeanServerFactory.createMBeanServer(), false)); addServer(server_1); server_1.start(); server_0 = addServer(ActiveMQServers.newActiveMQServer(conf_0, mbeanServer, false)); addServer(server_0); server_0.start(); }
@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(getUDPDiscoveryAddress()).setGroupPort(getUDPDiscoveryPort())); 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(); }
@Test public void testGettersAndSetters() throws Exception { long clientFailureCheckPeriod = RandomUtil.randomPositiveLong(); long connectionTTL = RandomUtil.randomPositiveLong(); long callTimeout = RandomUtil.randomPositiveLong(); int minLargeMessageSize = RandomUtil.randomPositiveInt(); int consumerWindowSize = RandomUtil.randomPositiveInt(); int scheduledThreadPoolMaxSize = RandomUtil.randomPositiveInt(); int threadPoolMaxSize = RandomUtil.randomPositiveInt(); long retryInterval = RandomUtil.randomPositiveLong(); double retryIntervalMultiplier = RandomUtil.randomDouble(); int reconnectAttempts = RandomUtil.randomPositiveInt();
ActiveMQConnectionFactory cf = ActiveMQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, liveTC); long clientFailureCheckPeriod = RandomUtil.randomPositiveLong(); long connectionTTL = RandomUtil.randomPositiveLong(); long callTimeout = RandomUtil.randomPositiveLong(); int minLargeMessageSize = RandomUtil.randomPositiveInt(); int consumerWindowSize = RandomUtil.randomPositiveInt(); int scheduledThreadPoolMaxSize = RandomUtil.randomPositiveInt(); int threadPoolMaxSize = RandomUtil.randomPositiveInt(); long retryInterval = RandomUtil.randomPositiveLong(); double retryIntervalMultiplier = RandomUtil.randomDouble(); int reconnectAttempts = RandomUtil.randomPositiveInt();
String user = RandomUtil.randomString(); String password = RandomUtil.randomString(); long clientFailureCheckPeriod = RandomUtil.randomPositiveLong(); long connectionTTL = RandomUtil.randomPositiveLong(); long callTimeout = RandomUtil.randomPositiveLong(); int minLargeMessageSize = RandomUtil.randomPositiveInt(); int consumerWindowSize = RandomUtil.randomPositiveInt(); int scheduledThreadPoolMaxSize = RandomUtil.randomPositiveInt(); int threadPoolMaxSize = RandomUtil.randomPositiveInt(); long retryInterval = RandomUtil.randomPositiveLong(); double retryIntervalMultiplier = RandomUtil.randomDouble(); int reconnectAttempts = RandomUtil.randomPositiveInt();
@Test public void testCountDeliveringMessageCountWithFilter() throws Exception { SimpleString key = new SimpleString("key"); long matchingValue = RandomUtil.randomPositiveLong(); long unmatchingValue = matchingValue + 1; SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); session.createQueue(address, queue, null, false); ClientProducer producer = session.createProducer(address); ClientMessage matchingMessage = session.createMessage(false); matchingMessage.putLongProperty(key, matchingValue); ClientMessage unmatchingMessage = session.createMessage(false); unmatchingMessage.putLongProperty(key, unmatchingValue); producer.send(matchingMessage); producer.send(unmatchingMessage); producer.send(matchingMessage); QueueControl queueControl = createManagementControl(address, queue); Assert.assertEquals(0, queueControl.countDeliveringMessages(null)); Assert.assertEquals(0, queueControl.countDeliveringMessages(key + " =" + matchingValue)); Assert.assertEquals(0, queueControl.countDeliveringMessages(key + " =" + unmatchingValue)); ClientConsumer consumer = session.createConsumer(queue, null, 1024 * 1024, 1, false); ClientMessage message = consumer.receive(500); Assert.assertNotNull(message); Assert.assertEquals(3, queueControl.countDeliveringMessages(null)); Assert.assertEquals(2, queueControl.countDeliveringMessages(key + " =" + matchingValue)); Assert.assertEquals(1, queueControl.countDeliveringMessages(key + " =" + unmatchingValue)); consumer.close(); session.deleteQueue(queue); }
private void testSettersThrowException(final ActiveMQConnectionFactory cf) { long clientFailureCheckPeriod = RandomUtil.randomPositiveLong(); long connectionTTL = RandomUtil.randomPositiveLong(); long callTimeout = RandomUtil.randomPositiveLong(); int minLargeMessageSize = RandomUtil.randomPositiveInt(); int consumerWindowSize = RandomUtil.randomPositiveInt(); int scheduledThreadPoolMaxSize = RandomUtil.randomPositiveInt(); int threadPoolMaxSize = RandomUtil.randomPositiveInt(); long retryInterval = RandomUtil.randomPositiveLong(); double retryIntervalMultiplier = RandomUtil.randomDouble(); int reconnectAttempts = RandomUtil.randomPositiveInt();
private void testSettersThrowException(final ClientSessionFactory cf) { long clientFailureCheckPeriod = RandomUtil.randomPositiveLong(); long connectionTTL = RandomUtil.randomPositiveLong(); long callTimeout = RandomUtil.randomPositiveLong(); int minLargeMessageSize = RandomUtil.randomPositiveInt(); int consumerWindowSize = RandomUtil.randomPositiveInt(); int scheduledThreadPoolMaxSize = RandomUtil.randomPositiveInt(); int threadPoolMaxSize = RandomUtil.randomPositiveInt(); long retryInterval = RandomUtil.randomPositiveLong(); double retryIntervalMultiplier = RandomUtil.randomDouble(); int reconnectAttempts = RandomUtil.randomPositiveInt();
Assert.assertEquals(b, conf.isMessageCounterEnabled()); l = RandomUtil.randomPositiveLong(); conf.setMessageCounterSamplePeriod(l); Assert.assertEquals(l, conf.getMessageCounterSamplePeriod());
Assert.assertEquals(b, conf.isMessageCounterEnabled()); l = RandomUtil.randomPositiveLong(); conf.setMessageCounterSamplePeriod(l); Assert.assertEquals(l, conf.getMessageCounterSamplePeriod());