This is an automated email from the ASF dual-hosted git repository.

amichair pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/aries-rsa.git

commit 08683c6dcc6f9308a7627d930f05504766d74425
Author: Amichai Rothman <[email protected]>
AuthorDate: Fri Mar 27 00:08:09 2026 +0200

    Separate TcpProvider uri property from endpoint id
---
 .../discovery/config/TestConfigDiscoveryRoundTrip.java     |  1 +
 .../java/org/apache/aries/rsa/provider/tcp/Config.java     | 10 +++++++++-
 .../org/apache/aries/rsa/provider/tcp/TcpEndpoint.java     | 14 +++++++-------
 .../org/apache/aries/rsa/provider/tcp/TcpProvider.java     |  8 ++++----
 4 files changed, 21 insertions(+), 12 deletions(-)

diff --git 
a/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/discovery/config/TestConfigDiscoveryRoundTrip.java
 
b/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/discovery/config/TestConfigDiscoveryRoundTrip.java
index 1733a84e..f8dccb05 100644
--- 
a/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/discovery/config/TestConfigDiscoveryRoundTrip.java
+++ 
b/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/discovery/config/TestConfigDiscoveryRoundTrip.java
@@ -65,6 +65,7 @@ public class TestConfigDiscoveryRoundTrip extends RsaTestBase 
{
             .put("service.imported.configs", "aries.tcp")
             .put("objectClass", 
"org.apache.aries.rsa.examples.echotcp.api.EchoService")
             .put("endpoint.id", "tcp://localhost:8201/echo")
+            .put("aries.tcp.uri", "tcp://localhost:8201/echo")
             .put("aries.tcp.hostname", "localhost")
             .put("aries.tcp.port", "8201")
             .asOption();
diff --git 
a/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/Config.java 
b/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/Config.java
index d18cccb4..a2bd11d6 100644
--- a/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/Config.java
+++ b/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/Config.java
@@ -29,7 +29,7 @@ public class Config {
 
     static final String PREFIX = TcpProvider.TCP_CONFIG_TYPE + ".";
 
-    // endpoint service properties
+    // configuration properties
     static final String
         PORT = PREFIX + "port",
         HOSTNAME = PREFIX + "hostname",
@@ -47,6 +47,10 @@ public class Config {
         KEY_ALIAS = PREFIX + "keyAlias",
         MTLS = PREFIX + "mtls";
 
+    // endpoint runtime properties
+    static final String
+        URI = PREFIX + "uri";
+
     static final int DYNAMIC_PORT = 0;
     static final int DEFAULT_TIMEOUT_MILLIS = 300000;
     static final int DEFAULT_NUM_THREADS = 10;
@@ -125,4 +129,8 @@ public class Config {
     public boolean isMtls() {
         return Boolean.parseBoolean(getString(MTLS, System.getProperty(MTLS)));
     }
+
+    public String getUri() {
+        return getString(URI, null);
+    }
 }
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 99ad5a17..19147c71 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
@@ -28,8 +28,6 @@ import org.apache.aries.rsa.spi.Endpoint;
 import org.osgi.service.remoteserviceadmin.EndpointDescription;
 import org.osgi.service.remoteserviceadmin.RemoteConstants;
 
-import javax.net.ServerSocketFactory;
-
 /**
  * Contains the details of a TcpProvider's Endpoint (exported service).
  */
@@ -59,12 +57,14 @@ public class TcpEndpoint implements Endpoint {
     private void updateEndpointDescription(Map<String, Object> 
effectiveProperties) {
         effectiveProperties = new HashMap<>(effectiveProperties);
         Config config = new Config(effectiveProperties);
-        String endpointId = String.format("tcp://%s:%s/%s", hostname, port, 
config.getId());
-        effectiveProperties.put(RemoteConstants.ENDPOINT_ID, endpointId);
+        String uri = String.format("tcp://%s:%s/%s", hostname, port, 
config.getId());
+        effectiveProperties.put(RemoteConstants.ENDPOINT_ID, uri);
         effectiveProperties.put(RemoteConstants.SERVICE_INTENTS, 
Arrays.asList("osgi.basic", "osgi.async"));
-        // tck tests require at least one config-type specific property... so 
we provide this one
-        // (it also tests that we throw IllegalArgumentException when any 
config-type property value is garbage)
-        effectiveProperties.put(TcpProvider.TCP_CONFIG_TYPE + ".id", 
endpointId);
+        // tck tests require at least one config-type specific property (with 
our config type prefix),
+        // we have the uri to cover that. it also tests that we throw 
IllegalArgumentException when any
+        // config-type property value is garbage, so we validate it here even 
though it's not used
+        config.getUri(); // validate for TCK
+        effectiveProperties.put(Config.URI, uri);
         this.epd = new EndpointDescription(effectiveProperties);
     }
 
diff --git 
a/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TcpProvider.java 
b/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TcpProvider.java
index f6f66b9f..15d22ea4 100644
--- 
a/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TcpProvider.java
+++ 
b/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TcpProvider.java
@@ -191,11 +191,11 @@ public class TcpProvider implements DistributionProvider {
                                           EndpointDescription endpoint)
         throws IntentUnsatisfiedException {
         try {
-            String endpointId = endpoint.getId();
-            URI address = new URI(endpointId);
-            int timeout = new 
Config(endpoint.getProperties()).getTimeoutMillis();
+            Config config = new Config(endpoint.getProperties());
+            URI uri = new URI(config.getUri());
+            int timeout = config.getTimeoutMillis();
             TcpInvocationHandler handler = new TcpInvocationHandler(
-                socketFactory, cl, address.getHost(), address.getPort(), 
endpointId, timeout);
+                socketFactory, cl, uri.getHost(), uri.getPort(), 
endpoint.getId(), timeout);
             Object service = Proxy.newProxyInstance(cl, interfaces, handler);
             return new ImportedService() {
                 @Override

Reply via email to