rename property to remoteURI
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/d4551c48 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/d4551c48 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/d4551c48 Branch: refs/heads/master Commit: d4551c487dc33e9029f87c942dee1cf235fe1c59 Parents: 0af121b Author: Robert Gemmell <[email protected]> Authored: Tue Jan 27 12:39:51 2015 +0000 Committer: Robert Gemmell <[email protected]> Committed: Tue Jan 27 14:42:04 2015 +0000 ---------------------------------------------------------------------- .../java/org/apache/qpid/jms/JmsConnection.java | 10 +-- .../apache/qpid/jms/JmsConnectionFactory.java | 74 ++++++++++---------- .../qpid/jms/JmsConnectionFactoryTest.java | 10 +-- .../jms/integration/IntegrationTestFixture.java | 6 +- 4 files changed, 50 insertions(+), 50 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/d4551c48/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java ---------------------------------------------------------------------- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java index afe6a52..cd7679b 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java @@ -100,7 +100,7 @@ public class JmsConnection implements Connection, TopicConnection, QueueConnecti private final ThreadPoolExecutor executor; - private URI brokerURI; + private URI remoteURI; private Provider provider; private final Set<JmsConnectionListener> connectionListeners = new CopyOnWriteArraySet<JmsConnectionListener>(); @@ -906,12 +906,12 @@ public class JmsConnection implements Connection, TopicConnection, QueueConnecti connectionInfo.setRequestTimeout(requestTimeout); } - public URI getBrokerURI() { - return brokerURI; + public URI getRemoteURI() { + return remoteURI; } - public void setBrokerURI(URI brokerURI) { - this.brokerURI = brokerURI; + public void setRemoteURI(URI remoteURI) { + this.remoteURI = remoteURI; } public String getUsername() { http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/d4551c48/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionFactory.java ---------------------------------------------------------------------- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionFactory.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionFactory.java index cf2efd1..55e8360 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionFactory.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionFactory.java @@ -48,9 +48,9 @@ public class JmsConnectionFactory extends JNDIStorable implements ConnectionFact private static final Logger LOG = LoggerFactory.getLogger(JmsConnectionFactory.class); private static final String CLIENT_ID_PROP = "clientID"; - private static final String BROKER_URI_PROP = "brokerURI"; + private static final String REMOTE_URI_PROP = "remoteURI"; - private URI brokerURI; + private URI remoteURI; private String username; private String password; private String clientID; @@ -81,24 +81,24 @@ public class JmsConnectionFactory extends JNDIStorable implements ConnectionFact setPassword(password); } - public JmsConnectionFactory(String brokerURI) { - this(createURI(brokerURI)); + public JmsConnectionFactory(String remoteURI) { + this(createURI(remoteURI)); } - public JmsConnectionFactory(URI brokerURI) { - setBrokerURI(brokerURI.toString()); + public JmsConnectionFactory(URI remoteURI) { + setRemoteURI(remoteURI.toString()); } - public JmsConnectionFactory(String userName, String password, URI brokerURI) { + public JmsConnectionFactory(String userName, String password, URI remoteURI) { setUsername(userName); setPassword(password); - setBrokerURI(brokerURI.toString()); + setRemoteURI(remoteURI.toString()); } - public JmsConnectionFactory(String userName, String password, String brokerURI) { + public JmsConnectionFactory(String userName, String password, String remoteURI) { setUsername(userName); setPassword(password); - setBrokerURI(brokerURI); + setRemoteURI(remoteURI); } /** @@ -106,12 +106,12 @@ public class JmsConnectionFactory extends JNDIStorable implements ConnectionFact */ @Override protected void buildFromProperties(Map<String, String> map) { - // Apply the broker URI in a consistent order before + // Apply the remoteURI in a consistent order before // any other properties, since as it may contain // some options within it. - String brokerURI = map.remove(BROKER_URI_PROP); - if (brokerURI != null) { - setBrokerURI(brokerURI); + String remoteURI = map.remove(REMOTE_URI_PROP); + if (remoteURI != null) { + setRemoteURI(remoteURI); } PropertyUtil.setProperties(this, map); @@ -152,7 +152,7 @@ public class JmsConnectionFactory extends JNDIStorable implements ConnectionFact public TopicConnection createTopicConnection(String username, String password) throws JMSException { try { String connectionId = getConnectionIdGenerator().generateId(); - Provider provider = createProvider(brokerURI); + Provider provider = createProvider(remoteURI); JmsTopicConnection result = new JmsTopicConnection(connectionId, provider, getClientIdGenerator()); return configureConnection(result, username, password); } catch (Exception e) { @@ -181,7 +181,7 @@ public class JmsConnectionFactory extends JNDIStorable implements ConnectionFact public Connection createConnection(String username, String password) throws JMSException { try { String connectionId = getConnectionIdGenerator().generateId(); - Provider provider = createProvider(brokerURI); + Provider provider = createProvider(remoteURI); JmsConnection result = new JmsConnection(connectionId, provider, getClientIdGenerator()); return configureConnection(result, username, password); } catch (Exception e) { @@ -211,7 +211,7 @@ public class JmsConnectionFactory extends JNDIStorable implements ConnectionFact public QueueConnection createQueueConnection(String username, String password) throws JMSException { try { String connectionId = getConnectionIdGenerator().generateId(); - Provider provider = createProvider(brokerURI); + Provider provider = createProvider(remoteURI); JmsQueueConnection result = new JmsQueueConnection(connectionId, provider, getClientIdGenerator()); return configureConnection(result, username, password); } catch (Exception e) { @@ -235,7 +235,7 @@ public class JmsConnectionFactory extends JNDIStorable implements ConnectionFact connection.setExceptionListener(exceptionListener); connection.setUsername(username); connection.setPassword(password); - connection.setBrokerURI(brokerURI); + connection.setRemoteURI(remoteURI); if(setClientID){ connection.setClientID(clientID); } @@ -246,14 +246,14 @@ public class JmsConnectionFactory extends JNDIStorable implements ConnectionFact } } - protected Provider createProvider(URI brokerURI) throws Exception { + protected Provider createProvider(URI remoteURI) throws Exception { Provider result = null; try { - result = ProviderFactory.create(brokerURI); + result = ProviderFactory.create(remoteURI); result.connect(); } catch (Exception ex) { - LOG.error("Failed to create JMS Provider instance for: {}", brokerURI.getScheme()); + LOG.error("Failed to create JMS Provider instance for: {}", remoteURI.getScheme()); LOG.trace("Error: ", ex); throw ex; } @@ -266,7 +266,7 @@ public class JmsConnectionFactory extends JNDIStorable implements ConnectionFact try { return new URI(name); } catch (URISyntaxException e) { - throw (IllegalArgumentException) new IllegalArgumentException("Invalid broker URI: " + name).initCause(e); + throw (IllegalArgumentException) new IllegalArgumentException("Invalid remote URI: " + name).initCause(e); } } return null; @@ -292,25 +292,25 @@ public class JmsConnectionFactory extends JNDIStorable implements ConnectionFact ////////////////////////////////////////////////////////////////////////// /** - * @return the brokerURI + * @return the remoteURI */ - public String getBrokerURI() { - return this.brokerURI != null ? this.brokerURI.toString() : ""; + public String getRemoteURI() { + return this.remoteURI != null ? this.remoteURI.toString() : ""; } /** - * @param brokerURI - * the brokerURI to set + * @param remoteURI + * the remoteURI to set */ - public void setBrokerURI(String brokerURI) { - if (brokerURI == null) { - throw new IllegalArgumentException("brokerURI cannot be null"); + public void setRemoteURI(String remoteURI) { + if (remoteURI == null) { + throw new IllegalArgumentException("remoteURI cannot be null"); } - this.brokerURI = createURI(brokerURI); + this.remoteURI = createURI(remoteURI); try { - if (this.brokerURI.getQuery() != null) { - Map<String, String> map = PropertyUtil.parseQuery(this.brokerURI.getQuery()); + if (this.remoteURI.getQuery() != null) { + Map<String, String> map = PropertyUtil.parseQuery(this.remoteURI.getQuery()); Map<String, String> jmsOptionsMap = PropertyUtil.filterProperties(map, "jms."); if (!PropertyUtil.setProperties(this, jmsOptionsMap)) { @@ -321,10 +321,10 @@ public class JmsConnectionFactory extends JNDIStorable implements ConnectionFact + " This connection factory cannot be started."; throw new IllegalArgumentException(msg); } else { - this.brokerURI = PropertyUtil.replaceQuery(this.brokerURI, map); + this.remoteURI = PropertyUtil.replaceQuery(this.remoteURI, map); } - } else if (URISupport.isCompositeURI(this.brokerURI)) { - CompositeData data = URISupport.parseComposite(this.brokerURI); + } else if (URISupport.isCompositeURI(this.remoteURI)) { + CompositeData data = URISupport.parseComposite(this.remoteURI); Map<String, String> jmsOptionsMap = PropertyUtil.filterProperties(data.getParameters(), "jms."); if (!PropertyUtil.setProperties(this, jmsOptionsMap)) { String msg = "" @@ -334,7 +334,7 @@ public class JmsConnectionFactory extends JNDIStorable implements ConnectionFact + " This connection factory cannot be started."; throw new IllegalArgumentException(msg); } else { - this.brokerURI = data.toURI(); + this.remoteURI = data.toURI(); } } } catch (Exception e) { http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/d4551c48/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionFactoryTest.java ---------------------------------------------------------------------- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionFactoryTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionFactoryTest.java index dde6bba..46cf305 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionFactoryTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionFactoryTest.java @@ -50,12 +50,12 @@ public class JmsConnectionFactoryTest extends QpidJmsTestCase { // Verify the outcome conditions have not been met already assertNotEquals("value should not match yet", clientID, cf.getClientID()); assertNotEquals("value should not match yet", queuePrefix, cf.getQueuePrefix()); - assertNotEquals("value should not match yet", baseUri, cf.getBrokerURI()); + assertNotEquals("value should not match yet", baseUri, cf.getRemoteURI()); // Set the properties Map<String, String> props = new HashMap<String, String>(); // Add the URI property, itself containing a property option in its query - props.put("brokerURI", uri); + props.put("remoteURI", uri); // Add another property directly props.put("queuePrefix", queuePrefix); cf.setProperties(props); @@ -65,7 +65,7 @@ public class JmsConnectionFactoryTest extends QpidJmsTestCase { // Verify the direct property was applied assertEquals("direct property not applied as expected", queuePrefix, cf.getQueuePrefix()); // Verify the URI was filtered to remove the applied options - assertEquals("URI was filtered to remove options that were applied", baseUri, cf.getBrokerURI()); + assertEquals("URI was filtered to remove options that were applied", baseUri, cf.getRemoteURI()); } @Test @@ -80,7 +80,7 @@ public class JmsConnectionFactoryTest extends QpidJmsTestCase { JmsConnectionFactory cf = new JmsConnectionFactory(); // Set the URI property, itself containing a property option in its query - cf.setBrokerURI(uri); + cf.setRemoteURI(uri); // Set another property directly cf.setQueuePrefix(queuePrefix); @@ -105,7 +105,7 @@ public class JmsConnectionFactoryTest extends QpidJmsTestCase { assertNotNull("Null object returned", roundTripped); assertEquals("Unexpected type", JmsConnectionFactory.class, roundTripped.getClass()); - assertEquals("Unexpected uri", uri, ((JmsConnectionFactory)roundTripped).getBrokerURI()); + assertEquals("Unexpected uri", uri, ((JmsConnectionFactory)roundTripped).getRemoteURI()); Map<String, String> props2 = ((JmsConnectionFactory)roundTripped).getProperties(); assertEquals("Properties were not equal", props, props2); http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/d4551c48/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/IntegrationTestFixture.java ---------------------------------------------------------------------- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/IntegrationTestFixture.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/IntegrationTestFixture.java index 34fd3cc..83b35f8 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/IntegrationTestFixture.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/IntegrationTestFixture.java @@ -59,12 +59,12 @@ public class IntegrationTestFixture { testPeer.expectBegin(true); final String baseURI = "amqp://localhost:" + testPeer.getServerPort(); - String brokerURI = baseURI; + String remoteURI = baseURI; if (optionsString != null) { - brokerURI = baseURI + optionsString; + remoteURI = baseURI + optionsString; } - ConnectionFactory factory = new JmsConnectionFactory(brokerURI); + ConnectionFactory factory = new JmsConnectionFactory(remoteURI); Connection connection = factory.createConnection("guest", "guest"); if(setClientId) { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
