props.setProperty("dispatchAsync", Boolean.toString(isDispatchAsync())); if (getBrokerURL() != null) { props.setProperty(Context.PROVIDER_URL, getBrokerURL()); props.setProperty("brokerURL", getBrokerURL());
public String getBrokerURL() { return connectionFactory.getBrokerURL(); }
private void turnOffConnectionErrorLog(final Exception e) { if (logConnectionError) { logger.info("Wilma could not connect to Indexer JMS Queue @" + connectionFactory.getBrokerURL(), e); //turn off logging connection errors to avoid duplicate errors in Wilma log logConnectionError = false; } }
private void turnOnConnectionErrorLog() { if (!logConnectionError) { logger.info("Wilma successfully connected to Indexer JMS Queue @" + connectionFactory.getBrokerURL()); logConnectionError = true; } } }
public boolean isMatchingConnectionFactory(ConnectionFactory connectionFactory, JMSURLHelper jmsURL, HashMap properties) { String brokerURL = null; if (connectionFactory instanceof ActiveMQConnectionFactory) { ActiveMQConnectionFactory amqConnectionFactory = (ActiveMQConnectionFactory)connectionFactory; // get existing queue connection factory properties brokerURL = amqConnectionFactory.getBrokerURL(); } // compare broker url String propertyBrokerURL = (String)properties.get(BROKER_URL); if (brokerURL == null || !brokerURL.equals(propertyBrokerURL)) { return false; } return true; } }
/** * Invoked by JUnit to setup the client resource. */ @Override protected void before() throws Throwable { log.info("Starting {}: {}", this.getClass().getSimpleName(), connectionFactory.getBrokerURL()); this.start(); super.before(); }
/** * Invoked by JUnit to tear down the client resource. */ @Override protected void after() { log.info("Stopping {}: {}", this.getClass().getSimpleName(), connectionFactory.getBrokerURL()); super.after(); this.stop(); }
/** * Manually start the Client. */ public void start() { try { try { connection = connectionFactory.createConnection(); String clientId = getClientId(); if (clientId != null) { connection.setClientID(clientId); } session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); createClient(); } catch (JMSException jmsEx) { throw new RuntimeException("Producer initialization failed" + this.getClass().getSimpleName(), jmsEx); } connection.start(); } catch (JMSException jmsEx) { throw new IllegalStateException("Producer failed to start", jmsEx); } log.info("Ready to produce messages to {}", connectionFactory.getBrokerURL()); }
props.setProperty("dispatchAsync", Boolean.toString(isDispatchAsync())); if (getBrokerURL() != null) { props.setProperty(Context.PROVIDER_URL, getBrokerURL()); props.setProperty("brokerURL", getBrokerURL());
props.setProperty("dispatchAsync", Boolean.toString(isDispatchAsync())); if (getBrokerURL() != null) { props.setProperty(Context.PROVIDER_URL, getBrokerURL()); props.setProperty("brokerURL", getBrokerURL());
props.setProperty("dispatchAsync", Boolean.toString(isDispatchAsync())); if (getBrokerURL() != null) { props.setProperty(Context.PROVIDER_URL, getBrokerURL()); props.setProperty("brokerURL", getBrokerURL());
@BeforeMethod public void setUp() { MockitoAnnotations.initMocks(this); given(connectionFactory.getBrokerURL()).willReturn(""); }
props.setProperty("dispatchAsync", Boolean.toString(isDispatchAsync())); if (getBrokerURL() != null) { props.setProperty(Context.PROVIDER_URL, getBrokerURL()); props.setProperty("brokerURL", getBrokerURL());
@Test public void testGetJmsFactory() { final NotificationsConfiguration c = new NotificationsConfiguration(); c.setConnectionString("localhost:61616"); final ActiveMQConnectionFactory factory1 = AppUtils.getJmsFactory(c); assertNull(factory1.getUserName(), "Unexpected username!"); assertNull(factory1.getPassword(), "Unexpected password!"); assertEquals("localhost:61616", factory1.getBrokerURL(), "Incorrect broker URL!"); c.set("password", "pass"); final ActiveMQConnectionFactory factory2 = AppUtils.getJmsFactory(c); assertNull(factory2.getUserName(), "Unexpected username!"); assertNull(factory2.getPassword(), "Unexpected password!"); assertEquals("localhost:61616", factory2.getBrokerURL(), "Incorrect broker URL!"); c.set("username", "user"); final ActiveMQConnectionFactory factory3 = AppUtils.getJmsFactory(c); assertEquals("user", factory3.getUserName(), "Incorrect username!"); assertEquals("pass", factory3.getPassword(), "Incorrect password!"); assertEquals("localhost:61616", factory3.getBrokerURL(), "Incorrect broker URL!"); } }