From 29a8c2f3ffe5d01b6d70ad0df2fdfc4f1b78bc9b Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Tue, 24 Jan 2017 16:49:19 -0500 Subject: [PATCH] fixes #4 Replaced managementHttpUris with managementHostnames (#5) --- .../SolaceMessagingInfoCreator.java | 13 ++----- .../cloud/core/SolaceMessagingInfo.java | 38 ++++++------------- ...SolaceMessagingServiceInfoCreatorTest.java | 6 +-- .../core/SolaceMessagingServiceInfoTest.java | 9 ++--- 4 files changed, 20 insertions(+), 46 deletions(-) diff --git a/src/main/java/com/solace/labs/spring/cloud/cloudfoundry/SolaceMessagingInfoCreator.java b/src/main/java/com/solace/labs/spring/cloud/cloudfoundry/SolaceMessagingInfoCreator.java index 074ebc5..1edfa13 100644 --- a/src/main/java/com/solace/labs/spring/cloud/cloudfoundry/SolaceMessagingInfoCreator.java +++ b/src/main/java/com/solace/labs/spring/cloud/cloudfoundry/SolaceMessagingInfoCreator.java @@ -57,8 +57,7 @@ public SolaceMessagingInfo createServiceInfo(Map serviceData) { List mqttTlsUris = null; List mqttWsUris = null; List mqttWssUris = null; - List managementHttpUris = null; - List managementHttpsUris = null; + List managementHostnames = null; String managementPassword = null; String managementUsername = null; @@ -130,19 +129,15 @@ public SolaceMessagingInfo createServiceInfo(Map serviceData) { case "mqttWssUris": mqttWssUris = (List) value; break; - case "managementHttpUris": - managementHttpUris = (List) value; - break; - case "managementHttpsUris": - managementHttpsUris = (List) value; + case "managementHostnames": + managementHostnames = (List) value; break; } } SolaceMessagingInfo solMessagingInfo = new SolaceMessagingInfo(id, clientUsername, clientPassword, msgVpnName, smfHost, smfTlsHost, smfZipHost, webMessagingUri, webMessagingTlsUri, jmsJndiUri, jmsJndiTlsUri, restUris, restTlsUris, mqttUris, - mqttTlsUris, mqttWsUris, mqttWssUris, managementHttpUris, managementHttpsUris, managementPassword, - managementUsername); + mqttTlsUris, mqttWsUris, mqttWssUris, managementHostnames, managementPassword, managementUsername); return solMessagingInfo; } diff --git a/src/main/java/com/solace/labs/spring/cloud/core/SolaceMessagingInfo.java b/src/main/java/com/solace/labs/spring/cloud/core/SolaceMessagingInfo.java index 8ac9537..074edb0 100644 --- a/src/main/java/com/solace/labs/spring/cloud/core/SolaceMessagingInfo.java +++ b/src/main/java/com/solace/labs/spring/cloud/core/SolaceMessagingInfo.java @@ -51,8 +51,7 @@ public class SolaceMessagingInfo extends BaseServiceInfo { private List mqttTlsUris; private List mqttWsUris; private List mqttWssUris; - private List managementHttpUris; - private List managementHttpsUris; + private List managementHostnames; private String managementPassword; private String managementUsername; private String webMessagingTlsUri; @@ -65,8 +64,8 @@ public SolaceMessagingInfo() { public SolaceMessagingInfo(String id, String clientUsername, String clientPassword, String msgVpnName, String smfHost, String smfTlsHost, String smfZipHost, String webMessagingUri,String webMessagingTlsUri, String jmsJndiUri, String jmsJndiTlsUri, List restUris, List restTlsUris, List mqttUris, List mqttTlsUris, - List mqttWsUris, List mqttWssUris, List managementHttpUris, - List managementHttpsUris, String managementPassword, String managementUsername) { + List mqttWsUris, List mqttWssUris, List managementHostnames, + String managementPassword, String managementUsername) { super(id); this.clientUsername = clientUsername; this.clientPassword = clientPassword; @@ -84,8 +83,7 @@ public SolaceMessagingInfo(String id, String clientUsername, String clientPasswo this.mqttTlsUris = mqttTlsUris; this.mqttWsUris = mqttWsUris; this.mqttWssUris = mqttWssUris; - this.managementHttpUris = managementHttpUris; - this.managementHttpsUris = managementHttpsUris; + this.managementHostnames = managementHostnames; this.managementPassword = managementPassword; this.managementUsername = managementUsername; } @@ -221,19 +219,11 @@ public List getMqttWssUris() { } /** - * @return the managementHttpUris + * @return the managementHostnames */ @ServiceProperty - public List getManagementHttpUris() { - return managementHttpUris; - } - - /** - * @return the managementHttpsUris - */ - @ServiceProperty - public List getManagementHttpsUris() { - return managementHttpsUris; + public List getManagementHostnames() { + return managementHostnames; } /** @@ -276,8 +266,7 @@ public int hashCode() { result = prime * result + ((clientUsername == null) ? 0 : clientUsername.hashCode()); result = prime * result + ((jmsJndiTlsUri == null) ? 0 : jmsJndiTlsUri.hashCode()); result = prime * result + ((jmsJndiUri == null) ? 0 : jmsJndiUri.hashCode()); - result = prime * result + ((managementHttpUris == null) ? 0 : managementHttpUris.hashCode()); - result = prime * result + ((managementHttpsUris == null) ? 0 : managementHttpsUris.hashCode()); + result = prime * result + ((managementHostnames == null) ? 0 : managementHostnames.hashCode()); result = prime * result + ((managementPassword == null) ? 0 : managementPassword.hashCode()); result = prime * result + ((managementUsername == null) ? 0 : managementUsername.hashCode()); result = prime * result + ((mqttTlsUris == null) ? 0 : mqttTlsUris.hashCode()); @@ -334,15 +323,10 @@ public boolean equals(Object obj) { return false; } else if (!jmsJndiUri.equals(other.jmsJndiUri)) return false; - if (managementHttpUris == null) { - if (other.managementHttpUris != null) - return false; - } else if (!managementHttpUris.equals(other.managementHttpUris)) - return false; - if (managementHttpsUris == null) { - if (other.managementHttpsUris != null) + if (managementHostnames == null) { + if (other.managementHostnames != null) return false; - } else if (!managementHttpsUris.equals(other.managementHttpsUris)) + } else if (!managementHostnames.equals(other.managementHostnames)) return false; if (managementPassword == null) { if (other.managementPassword != null) diff --git a/src/test/java/com/solace/labs/spring/cloud/cloudfoundry/SolaceMessagingServiceInfoCreatorTest.java b/src/test/java/com/solace/labs/spring/cloud/cloudfoundry/SolaceMessagingServiceInfoCreatorTest.java index b14ab2c..f072877 100644 --- a/src/test/java/com/solace/labs/spring/cloud/cloudfoundry/SolaceMessagingServiceInfoCreatorTest.java +++ b/src/test/java/com/solace/labs/spring/cloud/cloudfoundry/SolaceMessagingServiceInfoCreatorTest.java @@ -163,8 +163,7 @@ private Map createVcapMap() { exCred.put("mqttWssUris", Arrays.asList("wss://192.168.1.50:7023")); exCred.put("restUris", Arrays.asList("http://192.168.1.50:7018")); exCred.put("restTlsUris", Arrays.asList("https://192.168.1.50:7019")); - exCred.put("managementHttpUris", Arrays.asList("http://192.168.1.50:8080/SEMP/v2")); - exCred.put("managementHttpsUris", Arrays.asList("https://192.168.1.50:443/SEMP/v2")); + exCred.put("managementHostnames", Arrays.asList("vmr-Medium-VMR-0")); exCred.put("managementUsername", "sample-mgmt-username"); exCred.put("managementPassword", "sample-mgmt-password"); @@ -206,8 +205,7 @@ private void validateExampleSmi(SolaceMessagingInfo smi) { assertThat(smi.getRestTlsUris(), is(Arrays.asList("https://192.168.1.50:7019"))); // Check Management Interfaces - assertThat(smi.getManagementHttpUris(), is(Arrays.asList("http://192.168.1.50:8080/SEMP/v2"))); - assertThat(smi.getManagementHttpsUris(), is(Arrays.asList("https://192.168.1.50:443/SEMP/v2"))); + assertThat(smi.getManagementHostnames(), is(Arrays.asList("vmr-Medium-VMR-0"))); assertEquals("sample-mgmt-username", smi.getManagementUsername()); assertEquals("sample-mgmt-password", smi.getManagementPassword()); } diff --git a/src/test/java/com/solace/labs/spring/cloud/core/SolaceMessagingServiceInfoTest.java b/src/test/java/com/solace/labs/spring/cloud/core/SolaceMessagingServiceInfoTest.java index 63bd004..5cf7206 100644 --- a/src/test/java/com/solace/labs/spring/cloud/core/SolaceMessagingServiceInfoTest.java +++ b/src/test/java/com/solace/labs/spring/cloud/core/SolaceMessagingServiceInfoTest.java @@ -53,15 +53,13 @@ public void fullSetGetCredentialsTest() throws IllegalAccessException, Invocatio List mqttWssUris = Arrays.asList("wss://192.168.1.50:7023"); List restUris = Arrays.asList("http://192.168.1.50:7018"); List restTlsUris = Arrays.asList("https://192.168.1.50:7019"); - List managementHttpUris = Arrays.asList("http://192.168.1.50:8080/SEMP/v2"); - List managementHttpsUris = Arrays.asList("https://192.168.1.50:443/SEMP/v2"); + List managementHostnames = Arrays.asList("vmr-Medium-VMR-0"); String managementUsername = "sample-mgmt-username"; String managementPassword = "sample-mgmt-password"; SolaceMessagingInfo smi = new SolaceMessagingInfo(id, clientUsername, clientPassword, msgVpnName, smfHost, smfTlsHost, smfZipHost, webMessagingUri, webMessagingTlsUri, jmsJndiUri, jmsJndiTlsUri, restUris, restTlsUris, mqttUris, mqttTlsUris, - mqttWsUris, mqttWssUris, managementHttpUris, managementHttpsUris, managementPassword, - managementUsername); + mqttWsUris, mqttWssUris, managementHostnames, managementPassword, managementUsername); // Check Top Level stuff assertEquals(id, smi.getId()); @@ -92,8 +90,7 @@ public void fullSetGetCredentialsTest() throws IllegalAccessException, Invocatio assertThat(smi.getRestTlsUris(), is(restTlsUris)); // Check Management Interfaces - assertThat(smi.getManagementHttpUris(), is(managementHttpUris)); - assertThat(smi.getManagementHttpsUris(), is(managementHttpsUris)); + assertThat(smi.getManagementHostnames(), is(managementHostnames)); assertEquals(managementUsername, smi.getManagementUsername()); assertEquals(managementPassword, smi.getManagementPassword());