diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..9dab07da5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,93 @@ +name: Java CI with Maven + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + + arquillian-build-jdk8: + name: Integration - JDK 8 + runs-on: ubuntu-latest + timeout-minutes: 10 + outputs: + SNAPSHOT_VERSION: ${{ steps.arq-version.outputs.SNAPSHOT_VERSION }} + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-java@v4 + name: JDK 8 setup + with: + java-version: 8 + distribution: 'temurin' + cache: maven + + - name: Build with Maven + run: mvn clean -B install + + - name: Version save + id: arq-version + run: | + VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) + echo "SNAPSHOT_VERSION=$VERSION" >> $GITHUB_OUTPUT + echo "Arquillian version: $VERSION" + + - name: Artifact upload + uses: actions/upload-artifact@v4 + with: + name: arquillian + path: ~/.m2/repository/org/jboss/ + + arquillian-build-jdk11: + name: Integration - JDK 11 + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-java@v4 + name: JDK 11 setup + with: + java-version: 11 + distribution: 'temurin' + cache: maven + + - name: Build with Maven + run: mvn clean -B install + + integration-wildfly-job: + runs-on: ubuntu-latest + name: Integration verification for WildFly + needs: arquillian-build-jdk8 + timeout-minutes: 300 + + steps: + - uses: actions/checkout@v4 + + - uses: actions/download-artifact@v4 + with: + name: arquillian + path: ~/.m2/repository/org/jboss + + - uses: actions/setup-java@v4 + name: JDK 17 setup + with: + java-version: 17 + distribution: 'temurin' + cache: maven + + - uses: actions/checkout@v4 + name: Checkout WildFly + with: + repository: wildfly/wildfly + + - name: WildFly integration + env: + SNAPSHOT_VERSION: ${{ needs.arquillian-build-jdk8.outputs.SNAPSHOT_VERSION }} + run: | + mvn clean install -Dquickly -Dversion.org.jboss.arquillian.core="$SNAPSHOT_VERSION" + mvn clean verify -f testsuite/integration -DallTests -Dversion.org.jboss.arquillian.core="$SNAPSHOT_VERSION" diff --git a/config/impl-base/src/test/java/org/jboss/arquillian/config/impl/extension/PropertiesParserTestCase.java b/config/impl-base/src/test/java/org/jboss/arquillian/config/impl/extension/PropertiesParserTestCase.java index 34ca67e4e..d9fab4230 100644 --- a/config/impl-base/src/test/java/org/jboss/arquillian/config/impl/extension/PropertiesParserTestCase.java +++ b/config/impl-base/src/test/java/org/jboss/arquillian/config/impl/extension/PropertiesParserTestCase.java @@ -468,6 +468,16 @@ public String get() { }); } + @Test(expected = IllegalArgumentException.class) + public void shouldThrowExceptionIfDescriptorIsNull() { + new PropertiesParser().addProperties(null, System.getProperties()); + } + + @Test(expected = IllegalArgumentException.class) + public void shouldThrowExceptionIfPropertiesIsNull() { + new PropertiesParser().addProperties(desc, null); + } + private void validate(String property, String value, ValueCallback callback) { validate(property, value, value, callback); } diff --git a/protocols/servlet/src/main/java/org/jboss/arquillian/protocol/servlet/runner/ServletTestRunner.java b/protocols/servlet/src/main/java/org/jboss/arquillian/protocol/servlet/runner/ServletTestRunner.java index 01fd0141b..1bb1d4624 100644 --- a/protocols/servlet/src/main/java/org/jboss/arquillian/protocol/servlet/runner/ServletTestRunner.java +++ b/protocols/servlet/src/main/java/org/jboss/arquillian/protocol/servlet/runner/ServletTestRunner.java @@ -201,7 +201,9 @@ private void writeObject(Object object, HttpServletResponse response) { try { response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage()); } catch (Exception e2) { - throw new RuntimeException("Could not write to output", e2); + RuntimeException runtimeException = new RuntimeException("Could not write to output", e2); + runtimeException.addSuppressed(e); + throw runtimeException; } } } diff --git a/protocols/servlet/src/test/java/org/jboss/arquillian/protocol/servlet/BaseServletProtocolTestCase.java b/protocols/servlet/src/test/java/org/jboss/arquillian/protocol/servlet/BaseServletProtocolTestCase.java index c7f8464be..bcbf4c077 100644 --- a/protocols/servlet/src/test/java/org/jboss/arquillian/protocol/servlet/BaseServletProtocolTestCase.java +++ b/protocols/servlet/src/test/java/org/jboss/arquillian/protocol/servlet/BaseServletProtocolTestCase.java @@ -121,6 +121,16 @@ public void shouldThrowExceptionOnMissingNamedTargetedContext() throws Exception handler.locateTestServlet(testMethod); } + @Test(expected = IllegalArgumentException.class) + public void shouldThrowExceptionWhenNoConfig() throws Exception { + new ServletURIHandler(null, to(new HTTPContext("127.0.0.1", 8080).add(new Servlet(ServletMethodExecutor.ARQUILLIAN_SERVLET_NAME, "test")))); + } + + @Test(expected = IllegalArgumentException.class) + public void shouldThrowExceptionOnNoContexts() throws Exception { + new ServletURIHandler(new ServletProtocolConfiguration(), null); + } + private Collection to(HTTPContext... inputs) { List contexts = new ArrayList(); Collections.addAll(contexts, inputs); diff --git a/protocols/servlet/src/test/java/org/jboss/arquillian/protocol/servlet/ServletCommandServiceTestCase.java b/protocols/servlet/src/test/java/org/jboss/arquillian/protocol/servlet/ServletCommandServiceTestCase.java index a53317748..612a96bc0 100644 --- a/protocols/servlet/src/test/java/org/jboss/arquillian/protocol/servlet/ServletCommandServiceTestCase.java +++ b/protocols/servlet/src/test/java/org/jboss/arquillian/protocol/servlet/ServletCommandServiceTestCase.java @@ -103,4 +103,25 @@ public void shouldDisableCommandService() throws Exception { "Timeout exception should have been thrown", result.getThrowable().getMessage().contains("timeout")); } + + @Test(expected = IllegalArgumentException.class) + public void shouldThrowExceptionIfNoConfig() throws Exception { + new ServletMethodExecutor(null, createContexts(), new TestCommandCallback()); + } + + @Test(expected = IllegalArgumentException.class) + public void shouldThrowExceptionIfNoContexts() { + new ServletMethodExecutor(new ServletProtocolConfiguration(), null, new TestCommandCallback()); + } + + @Test(expected = IllegalArgumentException.class) + public void shouldThrowExceptionIfNoCallback() throws Exception { + new ServletMethodExecutor(new ServletProtocolConfiguration(), createContexts(), null); + } + + @Test(expected = IllegalArgumentException.class) + public void shouldThrowExceptionIfNoExecutor() throws Exception { + ServletMethodExecutor executor = new ServletMethodExecutor(new ServletProtocolConfiguration(), createContexts(), new TestCommandCallback()); + executor.invoke(null); + } } diff --git a/protocols/servlet/src/test/java/org/jboss/arquillian/protocol/servlet/v_2_5/ServletProtocolDeploymentPackagerTestCase.java b/protocols/servlet/src/test/java/org/jboss/arquillian/protocol/servlet/v_2_5/ServletProtocolDeploymentPackagerTestCase.java index 4772eac0a..0328751a0 100644 --- a/protocols/servlet/src/test/java/org/jboss/arquillian/protocol/servlet/v_2_5/ServletProtocolDeploymentPackagerTestCase.java +++ b/protocols/servlet/src/test/java/org/jboss/arquillian/protocol/servlet/v_2_5/ServletProtocolDeploymentPackagerTestCase.java @@ -302,6 +302,11 @@ public void shouldThrowExceptionOnEnterpriseArchiveWithMultipleMarkedWebArchives processors()); } + @Test(expected = IllegalArgumentException.class) + public void shouldVerifyExceptionOnEmptyVersion() throws Exception { + Descriptors.create(WebAppDescriptor.class).version(""); + } + private Collection> createAuxiliaryArchives() { List> archives = new ArrayList>(); archives.add(ShrinkWrap.create(JavaArchive.class, "auxiliaryArchive1.jar"));