From 5fe04b5648ca86d66324555500524387819fcaf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Sapp=C3=A9=20Griot?= Date: Mon, 16 Oct 2023 15:54:33 +0200 Subject: [PATCH] [WFLY-18461] cmt Quickstart Common Enhancements CY2023Q3 --- .github/workflows/quickstart_cmt_ci.yml | 14 ++++ cmt/README.adoc | 4 +- cmt/pom.xml | 83 +++---------------- ...{RemoteCustomerIT.java => CustomerIT.java} | 4 +- .../cmt/ProvisionedManagedCustomerIT.java | 51 ------------ .../quickstarts/cmt/BasicRuntimeIT.java | 61 ++++++++++++++ 6 files changed, 90 insertions(+), 127 deletions(-) create mode 100644 .github/workflows/quickstart_cmt_ci.yml rename cmt/src/test/java/org/jboss/as/quickstarts/cmt/{RemoteCustomerIT.java => CustomerIT.java} (97%) delete mode 100644 cmt/src/test/java/org/jboss/as/quickstarts/cmt/ProvisionedManagedCustomerIT.java create mode 100644 cmt/src/test/java/org/wildfly/quickstarts/cmt/BasicRuntimeIT.java diff --git a/.github/workflows/quickstart_cmt_ci.yml b/.github/workflows/quickstart_cmt_ci.yml new file mode 100644 index 0000000000..192556e276 --- /dev/null +++ b/.github/workflows/quickstart_cmt_ci.yml @@ -0,0 +1,14 @@ +name: WildFly cmt Quickstart CI + +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + paths: + - 'cmt/**' + - '.github/workflows/quickstart_ci.yml' +jobs: + call-quickstart_ci: + uses: ./.github/workflows/quickstart_ci.yml + with: + QUICKSTART_PATH: cmt + TEST_PROVISIONED_SERVER: true diff --git a/cmt/README.adoc b/cmt/README.adoc index 3187572b98..8a03f6bf9f 100644 --- a/cmt/README.adoc +++ b/cmt/README.adoc @@ -74,8 +74,8 @@ If an existing customer name is provided, no JMS message is sent. Instead of the The customer name should match: letter & '-', otherwise an error is given. This is to show that a `LogMessage` entity is still stored in the database. That is because the `logCreateCustomer` method in the `LogMessageManagerEJB` EJB is decorated with the `@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)` annotation. -// Testing with Arquillian -include::../shared-doc/run-arquillian-integration-tests-with-server-distribution.adoc[leveloffset=+2] +// Server Distribution Testing +include::../shared-doc/run-integration-tests-with-server-distribution.adoc[leveloffset=+2] // Undeploy the Quickstart include::../shared-doc/undeploy-the-quickstart.adoc[leveloffset=+2] diff --git a/cmt/pom.xml b/cmt/pom.xml index a4a0b226ff..3ef5acd139 100644 --- a/cmt/pom.xml +++ b/cmt/pom.xml @@ -43,11 +43,12 @@ - - 30.0.0.Beta1 + 30.0.0.Beta1 - 4.2.0.Final - 5.0.0.Beta1 + + ${version.server} + 5.0.0.Beta1 + 4.2.0.Final @@ -111,7 +112,7 @@ org.wildfly.bom wildfly-ee-with-tools - ${version.server.bom} + ${version.bom.ee} pom import @@ -174,50 +175,16 @@ junit test - - org.jboss.arquillian.container - arquillian-container-test-spi - test - jar - - - org.jboss.arquillian.junit - arquillian-junit-container - test - - - org.jboss.arquillian.protocol - arquillian-protocol-servlet-jakarta - test - - - org.wildfly.arquillian - wildfly-arquillian-common - test - - - org.wildfly.arquillian - wildfly-arquillian-container-managed - test - provisioned-server - - - org.wildfly.arquillian - wildfly-arquillian-container-managed - test - - org.wildfly.plugins wildfly-maven-plugin - ${version.wildfly.maven.plugin} @@ -231,7 +198,7 @@ embedded-activemq h2-default-datasource - ROOT.war + ROOT.war @@ -241,30 +208,6 @@ - - org.apache.maven.plugins - maven-failsafe-plugin - ${version.failsafe.plugin} - - - ${project.build.directory}/server - - - **/ProvisionedManagedCustomerIT - - - **/RemoteCustomerIT - - - - - - integration-test - verify - - - - @@ -275,14 +218,13 @@ org.wildfly.plugins wildfly-maven-plugin - ${version.wildfly.maven.plugin} org.wildfly:wildfly-galleon-pack:${version.server} - org.wildfly.cloud:wildfly-cloud-galleon-pack:${version.cloud.fp} + org.wildfly.cloud:wildfly-cloud-galleon-pack:${version.pack.cloud} @@ -306,20 +248,17 @@ - arq-remote + integration-testing org.apache.maven.plugins maven-failsafe-plugin - ${version.failsafe.plugin} - **/RemoteCustomerIT + **/CustomerIT + **/BasicRuntimeIT - - **/ProvisionedManagedCustomerIT - diff --git a/cmt/src/test/java/org/jboss/as/quickstarts/cmt/RemoteCustomerIT.java b/cmt/src/test/java/org/jboss/as/quickstarts/cmt/CustomerIT.java similarity index 97% rename from cmt/src/test/java/org/jboss/as/quickstarts/cmt/RemoteCustomerIT.java rename to cmt/src/test/java/org/jboss/as/quickstarts/cmt/CustomerIT.java index f8688e20f8..9e1e11068c 100644 --- a/cmt/src/test/java/org/jboss/as/quickstarts/cmt/RemoteCustomerIT.java +++ b/cmt/src/test/java/org/jboss/as/quickstarts/cmt/CustomerIT.java @@ -35,9 +35,9 @@ import org.junit.Test; -public class RemoteCustomerIT { +public class CustomerIT { - private static final Logger log = Logger.getLogger(RemoteCustomerIT.class.getName()); + private static final Logger log = Logger.getLogger(CustomerIT.class.getName()); protected URI getHTTPEndpoint(String path) { String host = getServerHost(); diff --git a/cmt/src/test/java/org/jboss/as/quickstarts/cmt/ProvisionedManagedCustomerIT.java b/cmt/src/test/java/org/jboss/as/quickstarts/cmt/ProvisionedManagedCustomerIT.java deleted file mode 100644 index 24bbcc1859..0000000000 --- a/cmt/src/test/java/org/jboss/as/quickstarts/cmt/ProvisionedManagedCustomerIT.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2015, Red Hat, Inc. and/or its affiliates, and individual - * contributors by the @authors tag. See the copyright.txt in the - * distribution for a full listing of individual contributors. - * - * Licensed 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.jboss.as.quickstarts.cmt; - - -import java.net.URI; -import java.net.URISyntaxException; -import org.jboss.arquillian.container.test.api.RunAsClient; -import org.jboss.arquillian.junit.Arquillian; -import org.junit.Test; - -import org.junit.runner.RunWith; - -@RunWith(Arquillian.class) -@RunAsClient -public class ProvisionedManagedCustomerIT extends RemoteCustomerIT { - - @Override - protected URI getHTTPEndpoint(String path) { - String host = getServerHost(); - if (host == null) { - host = "http://localhost:8080/"; - } - try { - return new URI(host + path); - } catch (URISyntaxException ex) { - throw new RuntimeException(ex); - } - } - - @Test - @Override - public void testAddCustomer() throws Exception { - addCustomer("LisaS"); - } - -} diff --git a/cmt/src/test/java/org/wildfly/quickstarts/cmt/BasicRuntimeIT.java b/cmt/src/test/java/org/wildfly/quickstarts/cmt/BasicRuntimeIT.java new file mode 100644 index 0000000000..6ca356e7b8 --- /dev/null +++ b/cmt/src/test/java/org/wildfly/quickstarts/cmt/BasicRuntimeIT.java @@ -0,0 +1,61 @@ +/* + * Copyright 2023 JBoss by Red Hat. + * + * Licensed 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.wildfly.quickstarts.cmt; + +import org.junit.Test; + +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; + +import static org.junit.Assert.assertEquals; + +/** + * The very basic runtime integration testing. + * @author emartins + */ +public class BasicRuntimeIT { + + private static final String DEFAULT_SERVER_HOST = "http://localhost:8080/cmt"; + + @Test + public void testHTTPEndpointIsAvailable() throws IOException, InterruptedException, URISyntaxException { + String serverHost = System.getenv("SERVER_HOST"); + if (serverHost == null) { + serverHost = System.getProperty("server.host"); + } + if (serverHost == null) { + serverHost = DEFAULT_SERVER_HOST; + } + final HttpRequest request = HttpRequest.newBuilder() + .uri(new URI(serverHost+"/")) + .GET() + .build(); + final HttpClient client = HttpClient.newBuilder() + .followRedirects(HttpClient.Redirect.ALWAYS) + .connectTimeout(Duration.ofMinutes(1)) + .build(); + final HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); + assertEquals(200, response.statusCode()); + final String[] bodyLines = response.body().toString().split(System.lineSeparator()); + assertEquals("", bodyLines[bodyLines.length -3]); + } + +}