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 f7e8c4f003dbcc56f812b3179d804a16db542344 Author: Amichai Rothman <[email protected]> AuthorDate: Sun Jun 7 17:05:57 2026 +0300 ARIES-2236 Add TestMdnsDiscoveryRoundTrip itest --- itests/felix/pom.xml | 141 +++++++++++++++++++++ .../apache/aries/rsa/itests/felix/RsaTestBase.java | 40 ++++++ .../felix/tcp/TestMdnsDiscoveryRoundTrip.java | 68 ++++++++++ 3 files changed, 249 insertions(+) diff --git a/itests/felix/pom.xml b/itests/felix/pom.xml index 41d7c721..681b439e 100644 --- a/itests/felix/pom.xml +++ b/itests/felix/pom.xml @@ -36,6 +36,7 @@ <properties> <asm.version>9.10.1</asm.version> + <cxf.version>3.5.9</cxf.version> </properties> <dependencies> @@ -208,6 +209,140 @@ <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.apache.aries.rsa.discovery</groupId> + <artifactId>org.apache.aries.rsa.discovery.mdns</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.jmdns</groupId> + <artifactId>jmdns</artifactId> + </dependency> + <dependency> + <groupId>org.apache.aries.spec</groupId> + <artifactId>org.apache.aries.javax.jax.rs-api</artifactId> + <version>1.0.4</version> + </dependency> + <dependency> + <groupId>org.apache.aries.component-dsl</groupId> + <artifactId>org.apache.aries.component-dsl.component-dsl</artifactId> + <version>1.2.2</version> + </dependency> + <dependency> + <groupId>org.apache.aries.jax.rs</groupId> + <artifactId>org.apache.aries.jax.rs.whiteboard</artifactId> + <version>2.0.2</version> + </dependency> + <dependency> + <groupId>jakarta.activation</groupId> + <artifactId>jakarta.activation-api</artifactId> + </dependency> + <dependency> + <groupId>com.fasterxml.woodstox</groupId> + <artifactId>woodstox-core</artifactId> + <version>6.5.1</version> + </dependency> + <dependency> + <groupId>com.sun.istack</groupId> + <artifactId>istack-commons-runtime</artifactId> + <version>3.0.12</version> + </dependency> + <dependency> + <groupId>org.glassfish.jaxb</groupId> + <artifactId>jaxb-runtime</artifactId> + <version>2.3.3</version> + </dependency> + <dependency> + <groupId>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-servlet_3.0_spec</artifactId> + <version>1.0</version> + </dependency> + <dependency> + <groupId>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-annotation_1.3_spec</artifactId> + <version>1.3</version> + </dependency> + <dependency> + <groupId>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-jaxws_2.2_spec</artifactId> + <version>1.2</version> + </dependency> + <dependency> + <groupId>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-saaj_1.3_spec</artifactId> + <version>1.1</version> + </dependency> + <dependency> + <groupId>org.apache.ws.xmlschema</groupId> + <artifactId>xmlschema-core</artifactId> + <version>2.3.2</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-core</artifactId> + <version>${cxf.version}</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-features-logging</artifactId> + <version>${cxf.version}</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-frontend-jaxrs</artifactId> + <version>${cxf.version}</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-rs-client</artifactId> + <version>${cxf.version}</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-security</artifactId> + <version>${cxf.version}</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-transports-http</artifactId> + <version>${cxf.version}</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-rs-sse</artifactId> + <version>${cxf.version}</version> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.service.http.whiteboard</artifactId> + <version>1.1.1</version> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.service.jaxrs</artifactId> + <version>1.0.1</version> + </dependency> + <dependency> + <groupId>org.apache.felix</groupId> + <artifactId>org.apache.felix.http.servlet-api</artifactId> + <version>1.2.0</version> + </dependency> + <dependency> + <groupId>org.apache.felix</groupId> + <artifactId>org.apache.felix.http.jetty</artifactId> + <version>4.2.0</version> + </dependency> + <dependency> + <groupId>org.ops4j.pax.logging</groupId> + <artifactId>pax-logging-api</artifactId> + <version>${paxlogging.version}</version> + </dependency> + <dependency> + <groupId>org.ops4j.pax.logging</groupId> + <artifactId>pax-logging-logback</artifactId> + <version>${paxlogging.version}</version> + </dependency> + <dependency> <groupId>org.apache.aries.rsa.examples.echotcp</groupId> <artifactId>org.apache.aries.rsa.examples.echotcp.api</artifactId> @@ -303,6 +438,12 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> + <!-- + This flag works around ARIES-2124 - the org.apache.aries.javax.jax.rs-api bundle + has an embedded geronimo-osgi-locator.jar that is corrupt, so we need to disable + the extra zip validation that causes it to fail + --> + <argLine>-Djdk.util.zip.disableZip64ExtraFieldValidation=true</argLine> <forkCount>1</forkCount> <reuseForks>false</reuseForks> </configuration> diff --git a/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/RsaTestBase.java b/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/RsaTestBase.java index 16953767..e4e9aa68 100644 --- a/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/RsaTestBase.java +++ b/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/RsaTestBase.java @@ -197,6 +197,41 @@ public class RsaTestBase { mvn("org.apache.aries.rsa.provider", "org.apache.aries.rsa.provider.fastbin")); } + protected static Option rsaDiscoveryMdns() { + return composite( + mvn("org.ops4j.pax.logging", "pax-logging-api"), + mvn("org.ops4j.pax.logging", "pax-logging-logback"), + mvn("org.jmdns", "jmdns"), + mvn("org.apache.aries.spec", "org.apache.aries.javax.jax.rs-api"), + mvn("org.apache.aries.component-dsl", "org.apache.aries.component-dsl.component-dsl"), + mvn("org.apache.aries.jax.rs", "org.apache.aries.jax.rs.whiteboard"), + mvn("jakarta.xml.bind", "jakarta.xml.bind-api"), + mvn("jakarta.activation", "jakarta.activation-api"), + mavenBundle("jakarta.activation", "jakarta.activation-api", "1.2.2"), + mavenBundle("jakarta.xml.bind", "jakarta.xml.bind-api", "2.3.3"), + mvn("com.fasterxml.woodstox", "woodstox-core"), + mvn("org.codehaus.woodstox", "stax2-api"), + mvn("com.sun.istack", "istack-commons-runtime"), + mvn("org.glassfish.jaxb", "jaxb-runtime"), + mvn("org.apache.geronimo.specs", "geronimo-servlet_3.0_spec"), + mvn("org.apache.geronimo.specs", "geronimo-annotation_1.3_spec"), + mvn("org.apache.geronimo.specs", "geronimo-jaxws_2.2_spec"), + mvn("org.apache.geronimo.specs", "geronimo-saaj_1.3_spec"), + mvn("org.apache.ws.xmlschema", "xmlschema-core"), + mvn("org.apache.cxf", "cxf-core"), + mvn("org.apache.cxf", "cxf-rt-features-logging"), + mvn("org.apache.cxf", "cxf-rt-frontend-jaxrs"), + mvn("org.apache.cxf", "cxf-rt-rs-client"), + mvn("org.apache.cxf", "cxf-rt-security"), + mvn("org.apache.cxf", "cxf-rt-transports-http"), + mvn("org.apache.cxf", "cxf-rt-rs-sse"), + mvn("org.osgi", "org.osgi.service.http.whiteboard"), + mvn("org.osgi", "org.osgi.service.jaxrs"), + mvn("org.apache.felix", "org.apache.felix.http.servlet-api"), + mvn("org.apache.felix", "org.apache.felix.http.jetty"), + mvn("org.apache.aries.rsa.discovery", "org.apache.aries.rsa.discovery.mdns")); + } + protected static Option configTcpDiscovery(int instance, int peerInstance) { return newConfiguration("org.apache.aries.rsa.discovery.tcp") // .put("address", "127.0.0.1:" + (7667 + instance)) // @@ -204,6 +239,11 @@ public class RsaTestBase { .asOption(); } + protected static Option configMdnsDiscovery() throws IOException { + int port = getFreePort(); + return systemProperty("org.osgi.service.http.port").value(String.valueOf(port)); + } + protected static Option configZKDiscovery() { return newConfiguration("org.apache.aries.rsa.discovery.zookeeper") // .put("zookeeper.host", "127.0.0.1") // diff --git a/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/tcp/TestMdnsDiscoveryRoundTrip.java b/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/tcp/TestMdnsDiscoveryRoundTrip.java new file mode 100644 index 00000000..0f98e0ed --- /dev/null +++ b/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/tcp/TestMdnsDiscoveryRoundTrip.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.aries.rsa.itests.felix.tcp; + +import org.apache.aries.rsa.examples.echotcp.api.EchoService; +import org.apache.aries.rsa.itests.felix.RsaTestBase; +import org.apache.aries.rsa.itests.felix.ServerConfiguration; +import org.apache.aries.rsa.itests.felix.TwoContainerPaxExam; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.Option; + +import javax.inject.Inject; +import java.io.IOException; + +import static org.junit.Assert.assertEquals; + +@RunWith(TwoContainerPaxExam.class) +public class TestMdnsDiscoveryRoundTrip extends RsaTestBase { + + @Inject + EchoService echoService; + + @ServerConfiguration + public static Option[] remoteConfig() throws IOException { + return new Option[] { + rsaCore(), + rsaDiscoveryMdns(), + rsaProviderTcp(), + echoTcpService(), + configMdnsDiscovery() + }; + } + + @Configuration + public static Option[] configure() throws Exception { + return new Option[] { + rsaCore(), + rsaDiscoveryMdns(), + rsaProviderTcp(), + echoTcpConsumer(), + configMdnsDiscovery() + }; + } + + @Test + public void testCall() throws Exception { + assertEquals("test", echoService.echo("test")); + } + +}
