aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject aries-rsa git commit: [ARIES-1571] Allow Integer values in config
Date Mon, 13 Jun 2016 13:04:57 GMT
Repository: aries-rsa
Updated Branches:
  refs/heads/master ea825a3c3 -> 5c1bd26dc


[ARIES-1571] Allow Integer values in config


Project: http://git-wip-us.apache.org/repos/asf/aries-rsa/repo
Commit: http://git-wip-us.apache.org/repos/asf/aries-rsa/commit/5c1bd26d
Tree: http://git-wip-us.apache.org/repos/asf/aries-rsa/tree/5c1bd26d
Diff: http://git-wip-us.apache.org/repos/asf/aries-rsa/diff/5c1bd26d

Branch: refs/heads/master
Commit: 5c1bd26dc67da4809d527730513cd62a7d96654a
Parents: ea825a3
Author: Christian Schneider <chris@die-schneider.net>
Authored: Mon Jun 13 15:04:45 2016 +0200
Committer: Christian Schneider <chris@die-schneider.net>
Committed: Mon Jun 13 15:04:45 2016 +0200

----------------------------------------------------------------------
 .../apache/aries/rsa/provider/tcp/TcpEndpoint.java    |  4 ++--
 .../aries/rsa/provider/tcp/TcpEndpointTest.java       | 14 ++++++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/5c1bd26d/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TcpEndpoint.java
----------------------------------------------------------------------
diff --git a/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TcpEndpoint.java
b/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TcpEndpoint.java
index 0dfc9de..424a989 100644
--- a/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TcpEndpoint.java
+++ b/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TcpEndpoint.java
@@ -49,8 +49,8 @@ public class TcpEndpoint implements Endpoint {
     }
     
     private String getString(Map<String, Object> effectiveProperties, String key, String
defaultValue) {
-        String value = (String)effectiveProperties.get(key);
-        return value != null ? value : defaultValue;
+        Object value = effectiveProperties.get(key);
+        return value != null ? value.toString() : defaultValue;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/5c1bd26d/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/TcpEndpointTest.java
----------------------------------------------------------------------
diff --git a/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/TcpEndpointTest.java
b/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/TcpEndpointTest.java
index 24a3641..4deeb97 100644
--- a/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/TcpEndpointTest.java
+++ b/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/TcpEndpointTest.java
@@ -31,6 +31,20 @@ public class TcpEndpointTest {
     }
     
     @Test
+    public void testIntPort() throws IOException {
+        Object service = new MyServiceImpl();
+        Map<String, Object> props = new HashMap<>();
+        props.put(Constants.OBJECTCLASS, new String[]{MyService.class.getName()});
+        props.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, "");
+        props.put("port", Integer.parseInt(PORT));
+        props.put("hostname", "myhost");
+        TcpEndpoint tcpEndpoint = new TcpEndpoint(service, props);
+        EndpointDescription epd = tcpEndpoint.description();
+        Assert.assertEquals("tcp://myhost:" + PORT, epd.getId());
+        tcpEndpoint.close();
+    }
+    
+    @Test
     public void testEndpointPropertiesDefault() throws IOException {
         Object service = new MyServiceImpl();
         Map<String, Object> props = new HashMap<>();


Mime
View raw message