diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml index 6820560..81350d1 100644 --- a/.github/workflows/maven-build.yml +++ b/.github/workflows/maven-build.yml @@ -29,3 +29,5 @@ jobs: sonar-run-on-java-version: 21 sonar-token: ${{ secrets.SONAR_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }} + # clean install required for slingfeature-maven-plugin + maven-verify-args: -s ./.maven-settings.xml -Pcontinuous-integration -B -U clean install diff --git a/integration-test/helloworld-consumer/src/main/java/io/wcm/caravan/jaxws/integrationtest/helloworld/consumer/HelloWorldConsumer.java b/integration-test/helloworld-consumer/src/main/java/io/wcm/caravan/jaxws/integrationtest/helloworld/consumer/HelloWorldConsumer.java index 6e11389..5f54bda 100644 --- a/integration-test/helloworld-consumer/src/main/java/io/wcm/caravan/jaxws/integrationtest/helloworld/consumer/HelloWorldConsumer.java +++ b/integration-test/helloworld-consumer/src/main/java/io/wcm/caravan/jaxws/integrationtest/helloworld/consumer/HelloWorldConsumer.java @@ -24,6 +24,9 @@ import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; +import org.osgi.service.metatype.annotations.AttributeDefinition; +import org.osgi.service.metatype.annotations.Designate; +import org.osgi.service.metatype.annotations.ObjectClassDefinition; import io.wcm.caravan.jaxws.consumer.JaxWsClientFactory; @@ -31,16 +34,26 @@ * Hello World SOAP Client. */ @Component(service = HelloWorldConsumer.class) +@Designate(ocd = HelloWorldConsumer.Config.class) public class HelloWorldConsumer { + @ObjectClassDefinition(name = "HelloWorld Consumer", + description = "Integration Test Configuration") + @interface Config { + + @AttributeDefinition(description = "Server URL") + String serverUrl() default "http://localhost:8080"; + + } + @Reference private JaxWsClientFactory jaxWsClientFactory; private Greeter greeterClient; @Activate - private void activate() { - String url = System.getProperty("launchpad.http.server.url") + "/helloWorldService"; + private void activate(Config config) { + String url = config.serverUrl() + "/helloWorldService"; greeterClient = jaxWsClientFactory.create(Greeter.class, url); } diff --git a/integration-test/launchpad-test/pom.xml b/integration-test/launchpad-test/pom.xml index 111fceb..6faba9a 100644 --- a/integration-test/launchpad-test/pom.xml +++ b/integration-test/launchpad-test/pom.xml @@ -32,7 +32,6 @@ io.wcm.caravan io.wcm.caravan.jaxws.integration-test.launchpad-test 1-SNAPSHOT - slingstart JAX-WS Integration Test Launchpad Test @@ -41,21 +40,15 @@ - - localhost + + 17 - - false + + 14-SNAPSHOT - - - + + 200 + 60 @@ -64,20 +57,55 @@ org.apache.sling org.apache.sling.junit.teleporter - 1.0.18 + 1.1.0 test + + + commons-io + commons-io + + + - org.apache.sling - org.apache.sling.junit.core - 1.0.26 - provided + org.apache.sling + org.apache.sling.commons.testing + 2.2.0 + compile + + + org.slf4j + slf4j-simple + + + junit + junit-dep + + + asm + asm + + + commons-io + commons-io + + + org.apache.jackrabbit + jackrabbit-api + + - org.apache.sling - org.apache.sling.testing.tools - 1.0.16 - provided + jakarta.json + jakarta.json-api + 2.0.2 + test + + + org.apache.johnzon + johnzon-core + 2.0.2 + test @@ -129,13 +157,6 @@ - - io.wcm.caravan - io.wcm.caravan.integration-test.minimal-launchpad - 1.2.0 - slingfeature - provided - javax.servlet javax.servlet-api @@ -155,18 +176,18 @@ org.codehaus.mojo build-helper-maven-plugin - 1.9.1 + reserve-network-port reserve-network-port - process-resources + initialize + http.port - sling.control.port @@ -174,55 +195,127 @@ - org.apache.maven.plugins - maven-failsafe-plugin + org.apache.sling + slingfeature-maven-plugin + 1.9.2 + true + + + apache-cxf-version + true + + + app + *.json + + ${http.port} + + + org.apache.sling + org.apache.sling.starter + nosample_base + ${sling.starter.version} + slingosgifeature + + + org.apache.sling + org.apache.sling.starter + oak_persistence_sns + ${sling.starter.version} + slingosgifeature + + + org.apache.sling + org.apache.sling.starter + junit + ${sling.starter.version} + slingosgifeature + + + + + + app + + + + prepare-features + prepare-package - integration-test - verify + aggregate-features + analyse-features + attach-features - - alphabetical - - http://${test.host}:${http.port} - http://${test.host}:${http.port}/${webdav.workspace.path} - - + org.apache.sling - slingstart-maven-plugin - 1.6.0 - true + feature-launcher-maven-plugin + 1.0.0 + + + + sling-starter-oak-tar + + io.wcm.caravan + io.wcm.caravan.jaxws.integration-test.launchpad-test + 1-SNAPSHOT + app + slingosgifeature + + + + --add-opens java.base/java.lang=ALL-UNNAMED + --add-opens java.base/java.net=ALL-UNNAMED + + + ${http.port} + 5000000 + + + ${it.startTimeoutSeconds} + + + - start-container start stop + + + + + maven-failsafe-plugin - true - true - - - ${http.port} - ${sling.control.port} - ${http.base.path} - ${launchpad.debug} - - -Xmx1024m -XX:MaxPermSize=256m -Djava.awt.headless=true -Dlaunchpad.http.server.url=http://${test.host}:${http.port} - - + + http://localhost:${http.port}/ + false:${http.port} + ${starter.min.bundles.count} + + + /system/console/bundles, + + + + + + integration-test + verify + + + - + org.apache.maven.plugins @@ -309,16 +402,6 @@ - - - run8080 - - true - true - 8080 - - - diff --git a/integration-test/launchpad-test/src/main/features/launcher.json b/integration-test/launchpad-test/src/main/features/launcher.json new file mode 100644 index 0000000..0fe3636 --- /dev/null +++ b/integration-test/launchpad-test/src/main/features/launcher.json @@ -0,0 +1,60 @@ +{ + "variables": { + "http.port": "8080" + }, + "bundles": [ + { + "id": "org.apache.servicemix.specs/org.apache.servicemix.specs.jaxws-api-2.3/2.3_3", + "start-order": 15 + }, + { + "id": "org.apache.servicemix.specs/org.apache.servicemix.specs.saaj-api-1.4/1.4_2", + "start-order": 15 + }, + { + "id": "org.apache.servicemix.bundles/org.apache.servicemix.bundles.saaj-impl/1.5.1_1", + "start-order": 15 + }, + { + "id": "jakarta.jws/jakarta.jws-api/2.1.0", + "start-order": 15 + }, + { + "id": "org.apache.servicemix.specs/org.apache.servicemix.specs.jaxb-api-2.3/2.3_3", + "start-order": 15 + }, + { + "id": "org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-impl/2.2.11_1", + "start-order": 15 + }, + { + "id": "io.wcm.osgi.wrapper/io.wcm.osgi.wrapper.cxf/${apache-cxf-version}-0000", + "start-order": 15 + }, + { + "id": "io.wcm.caravan/io.wcm.caravan.jaxws.consumer/1.1.3-SNAPSHOT", + "start-order": 20 + }, + { + "id": "io.wcm.caravan/io.wcm.caravan.jaxws.publisher/1.0.3-SNAPSHOT", + "start-order": 20 + }, + { + "id": "io.wcm.caravan/io.wcm.caravan.jaxws.integration-test.helloworld-proxy/1-SNAPSHOT", + "start-order": 20 + }, + { + "id": "io.wcm.caravan/io.wcm.caravan.jaxws.integration-test.helloworld-publisher/1-SNAPSHOT", + "start-order": 20 + }, + { + "id": "io.wcm.caravan/io.wcm.caravan.jaxws.integration-test.helloworld-consumer/1-SNAPSHOT", + "start-order": 20 + } + ], + "configurations": { + "io.wcm.caravan.jaxws.integrationtest.helloworld.consumer.HelloWorldConsumer": { + "serverUrl": "http://localhost:${http.port}" + } + } +} diff --git a/integration-test/launchpad-test/src/main/provisioning/integration-test.txt b/integration-test/launchpad-test/src/main/provisioning/integration-test.txt deleted file mode 100644 index b9b3d3d..0000000 --- a/integration-test/launchpad-test/src/main/provisioning/integration-test.txt +++ /dev/null @@ -1,16 +0,0 @@ -[feature name=integration-test] - -[artifacts] - io.wcm.caravan/io.wcm.caravan.integration-test.minimal-launchpad//slingfeature - -[artifacts startLevel=15] - io.wcm.osgi.wrapper/io.wcm.osgi.wrapper.cxf - -[artifacts startLevel=20] - io.wcm.caravan/io.wcm.caravan.jaxws.consumer - io.wcm.caravan/io.wcm.caravan.jaxws.publisher - io.wcm.caravan/io.wcm.caravan.jaxws.integration-test.helloworld-proxy - io.wcm.caravan/io.wcm.caravan.jaxws.integration-test.helloworld-publisher - io.wcm.caravan/io.wcm.caravan.jaxws.integration-test.helloworld-consumer - org.apache.sling/org.apache.sling.junit.core - org.apache.sling/org.apache.sling.testing.tools diff --git a/integration-test/launchpad-test/src/test/java/org/apache/sling/junit/teleporter/customizers/ITCustomizer.java b/integration-test/launchpad-test/src/test/java/org/apache/sling/junit/teleporter/customizers/ITCustomizer.java index ac076c7..bf274df 100644 --- a/integration-test/launchpad-test/src/test/java/org/apache/sling/junit/teleporter/customizers/ITCustomizer.java +++ b/integration-test/launchpad-test/src/test/java/org/apache/sling/junit/teleporter/customizers/ITCustomizer.java @@ -19,21 +19,37 @@ */ package org.apache.sling.junit.teleporter.customizers; +import org.apache.sling.commons.testing.integration.HttpTest; import org.apache.sling.junit.rules.TeleporterRule; import org.apache.sling.testing.teleporter.client.ClientSideTeleporter; -import org.apache.sling.testing.tools.sling.TimeoutsProvider; +import static org.junit.Assert.fail; + +/** TeleporterRule Customizer used for Sling launchpad integration tests. + * Waits for Sling to be ready and sets the appropriate parameters + * on the ClientSideTeleporter. + */ public class ITCustomizer implements TeleporterRule.Customizer { - public static final String BASE_URL_PROP = "launchpad.http.server.url"; + private static final HttpTest H = new HttpTest(); + private static final int testReadyTimeout = Integer.getInteger("ClientSideTeleporter.testReadyTimeoutSeconds", 12); - @Override - public void customize(TeleporterRule t, String options) { - final ClientSideTeleporter cst = (ClientSideTeleporter)t; - cst.setBaseUrl(System.getProperty(BASE_URL_PROP, BASE_URL_PROP + "_IS_NOT_SET")); - cst.setServerCredentials("admin", "admin"); - cst.includeDependencyPrefix("io.wcm.caravan.jaxws.publisher.it"); - cst.setTestReadyTimeoutSeconds(TimeoutsProvider.getInstance().getTimeout(10)); - } + @Override + /** Customize the client-side TeleporterRule by first waiting + * for Sling to be ready and then setting it up with the test server + * URL, timeout etc. + */ + public void customize(TeleporterRule t, String options) { + // Setup Sling and the ClientSideTeleporter + try { + H.setUp(); + } catch (Exception e) { + fail("HttpTest setup failed: " + e); + } + final ClientSideTeleporter cst = (ClientSideTeleporter)t; + cst.setBaseUrl(HttpTest.HTTP_BASE_URL); + cst.setTestReadyTimeoutSeconds(testReadyTimeout); + cst.setServerCredentials("admin", "admin"); + } } diff --git a/integration-test/pom.xml b/integration-test/pom.xml index 585cc40..6b86058 100644 --- a/integration-test/pom.xml +++ b/integration-test/pom.xml @@ -41,9 +41,7 @@ helloworld-proxy helloworld-publisher helloworld-consumer - diff --git a/parent/pom.xml b/parent/pom.xml index fa3de12..fe00ced 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -56,7 +56,7 @@ jaxws - 3.1.9 + 3.1.10