├── src
├── test
│ ├── java
│ │ └── com
│ │ │ └── example
│ │ │ ├── .gitkeep
│ │ │ ├── it
│ │ │ ├── FakeGreetingService.java
│ │ │ ├── DbUtil.java
│ │ │ ├── FakeGreetingServiceTest.java
│ │ │ ├── GreetingServiceTest.java
│ │ │ ├── HelloJmsTest.java
│ │ │ ├── OrderDaoTest.java
│ │ │ ├── GreetingResourceTest.java
│ │ │ ├── OrderResourceTest.java
│ │ │ └── BasketEjbTest.java
│ │ │ └── GreetingMessageTest.java
│ ├── arq-liberty-managed
│ │ ├── arquillian.xml
│ │ ├── logging.properties
│ │ └── server.xml
│ ├── arq-liberty-remote
│ │ ├── arquillian.xml
│ │ ├── logging.properties
│ │ └── server.xml
│ └── resources
│ │ ├── glassfish-resources.xml
│ │ └── arquillian.xml
└── main
│ ├── java
│ └── com
│ │ └── example
│ │ ├── GreetingService.java
│ │ ├── JaxrsActivator.java
│ │ ├── cart
│ │ ├── OrderItemDtoAssembler.java
│ │ ├── OrderDtoAssembler.java
│ │ ├── OrderDao.java
│ │ ├── OrderResource.java
│ │ ├── OrderItemDto.java
│ │ ├── SampleDataGenerator.java
│ │ ├── OrderDto.java
│ │ ├── Basket.java
│ │ ├── PurchaseOrder.java
│ │ └── OrderItem.java
│ │ ├── SimpleGreetingService.java
│ │ ├── jms
│ │ ├── JmsResources.java
│ │ ├── HelloJmsResource.java
│ │ ├── HelloSender.java
│ │ └── HelloConsumer.java
│ │ ├── GreetingMessage.java
│ │ └── GreetingResource.java
│ ├── resources
│ └── META-INF
│ │ ├── beans.xml
│ │ └── persistence.xml
│ └── liberty
│ └── config
│ └── server.xml
├── renovate.json
├── .vscode
└── settings.json
├── docs
├── k8s.png
├── run-nb.png
├── os-scale.png
├── dockerhub-2.png
├── dockerhub.png
├── import-nb.png
├── import-nb2.png
├── jakartaee.png
├── os-status.png
├── k8s-dashboard.png
├── k8s-ds-docker.png
├── k8s-ds-login.png
├── os-scale-pods.png
├── import-eclipse.png
├── nb-new-wildfly.png
├── nb-new-wildfly2.png
├── nb-new-wildfly3.png
├── nb-new-wildfly4.png
├── nb-wildfly-run.png
├── os-new-project.png
├── eclipse-new-server.png
├── glassfish-node-nb.png
├── jakartaee8-starter.png
├── os-status-details.png
├── eclipse-new-liberty1.png
├── eclipse-new-liberty2.png
├── eclipse-new-liberty3.png
├── eclipse-new-liberty4.png
├── eclipse-new-server2.png
├── eclipse-new-server3.png
├── eclipse-new-server4.png
├── eclipse-new-wildfly1.png
├── eclipse-new-wildfly2.png
├── eclipse-new-wildfly3.png
├── eclipse-new-wildfly4.png
├── eclipse-run-on-server.png
├── nb-project-run-wildfly.png
├── eclipse-new-server-running.png
├── glassfish-node-deploy-nb.png
├── glassfish-start-output-nb.png
├── nb-server-view-wildfly-run.png
├── os-container-image-wildfly.png
├── os-switch-developer-view.png
├── eclipse-new-server-running2.png
├── os-container-image2-wildfly.png
├── eclipse-liberty-run-on-server.png
├── eclipse-wildfly-run-on-server.png
├── jakartaee8-compatible-products.png
├── nb-project-properties-wildfly-run.png
├── _config.yml
├── 03run-wildfly.md
├── 05prod.md
├── 03run-openliberty.md
├── 03run-glassfish.md
├── 04test-arq-openliberty.md
├── 04test-arq-wildfly.md
├── 03run.md
├── 04test-arq-payara.md
├── 04test-arq-glassfish.md
├── 03run-payara.md
├── 03run-openliberty-mvn.md
├── 04test-arq-payara-embedded.md
├── 03run-get-appservers.md
├── 04test.md
├── 04test-arq-payara-remote.md
├── 02understand-app.md
├── 04test-arq-payara-managed.md
├── 03run-glassfish-nb.md
├── index.md
├── 03run-wildfly-eclipse.md
├── 04test-arq-wildfly-embedded.md
├── 03run-wildfly-mvn.md
├── 03run-glassfish-eclipse.md
├── 04test-arq-glassfish-embedded.md
├── 03run-glassfish-m.md
├── 03run-openliberty-eclipse.md
├── 05prod-appservers-in-docker.md
├── 04test-arq-wildfly-remote.md
├── 03run-openliberty-m.md
├── 04test-arq-openliberty-remote.md
├── 03run-wildfly-m.md
├── 04test-arq-glassfish-remote.md
├── 03run-glassfish-mvn.md
├── 04test-arq-payara-micro-managed.md
├── 04test-arq-glassfish-managed.md
├── 04test-arq-wildfly-managed.md
└── 03run-wildfly-nb.md
├── Dockerfile.payara
├── Dockerfile.openliberty
├── .github
├── FUNDING.yml
├── ISSUE_TEMPLATE
│ └── bug_report.md
└── workflows
│ ├── it-with-arq-payara-micro.yml
│ ├── it-with-arq-payara-managed.yml
│ ├── it-with-arq-liberty-managed.yml
│ ├── it-with-arq-payara-embedded.yml
│ ├── it-with-arq-wildfly-managed.yml
│ ├── it-with-arq-wildfly-embedded.yml
│ ├── it-with-arq-glassfish-managed.yml
│ ├── it-with-arq-glassfish-embedded.yml
│ ├── build.yml
│ └── dockerize.yml
├── Dockerfile.wildfly
├── .gitignore
├── deployment.yaml
├── docker-compose.yml
└── README.md
/src/test/java/com/example/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/renovate.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["config:base", "schedule:monthly"]
3 | }
4 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "java.configuration.updateBuildConfiguration": "automatic"
3 | }
--------------------------------------------------------------------------------
/docs/k8s.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/k8s.png
--------------------------------------------------------------------------------
/docs/run-nb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/run-nb.png
--------------------------------------------------------------------------------
/docs/os-scale.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/os-scale.png
--------------------------------------------------------------------------------
/docs/dockerhub-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/dockerhub-2.png
--------------------------------------------------------------------------------
/docs/dockerhub.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/dockerhub.png
--------------------------------------------------------------------------------
/docs/import-nb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/import-nb.png
--------------------------------------------------------------------------------
/docs/import-nb2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/import-nb2.png
--------------------------------------------------------------------------------
/docs/jakartaee.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/jakartaee.png
--------------------------------------------------------------------------------
/docs/os-status.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/os-status.png
--------------------------------------------------------------------------------
/Dockerfile.payara:
--------------------------------------------------------------------------------
1 | FROM payara/server-full:5.2022.5-jdk11
2 |
3 | COPY ./target/jakartaee8-starter.war $DEPLOY_DIR
4 |
--------------------------------------------------------------------------------
/docs/k8s-dashboard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/k8s-dashboard.png
--------------------------------------------------------------------------------
/docs/k8s-ds-docker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/k8s-ds-docker.png
--------------------------------------------------------------------------------
/docs/k8s-ds-login.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/k8s-ds-login.png
--------------------------------------------------------------------------------
/docs/os-scale-pods.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/os-scale-pods.png
--------------------------------------------------------------------------------
/docs/import-eclipse.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/import-eclipse.png
--------------------------------------------------------------------------------
/docs/nb-new-wildfly.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/nb-new-wildfly.png
--------------------------------------------------------------------------------
/docs/nb-new-wildfly2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/nb-new-wildfly2.png
--------------------------------------------------------------------------------
/docs/nb-new-wildfly3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/nb-new-wildfly3.png
--------------------------------------------------------------------------------
/docs/nb-new-wildfly4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/nb-new-wildfly4.png
--------------------------------------------------------------------------------
/docs/nb-wildfly-run.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/nb-wildfly-run.png
--------------------------------------------------------------------------------
/docs/os-new-project.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/os-new-project.png
--------------------------------------------------------------------------------
/docs/eclipse-new-server.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/eclipse-new-server.png
--------------------------------------------------------------------------------
/docs/glassfish-node-nb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/glassfish-node-nb.png
--------------------------------------------------------------------------------
/docs/jakartaee8-starter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/jakartaee8-starter.png
--------------------------------------------------------------------------------
/docs/os-status-details.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/os-status-details.png
--------------------------------------------------------------------------------
/docs/eclipse-new-liberty1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/eclipse-new-liberty1.png
--------------------------------------------------------------------------------
/docs/eclipse-new-liberty2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/eclipse-new-liberty2.png
--------------------------------------------------------------------------------
/docs/eclipse-new-liberty3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/eclipse-new-liberty3.png
--------------------------------------------------------------------------------
/docs/eclipse-new-liberty4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/eclipse-new-liberty4.png
--------------------------------------------------------------------------------
/docs/eclipse-new-server2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/eclipse-new-server2.png
--------------------------------------------------------------------------------
/docs/eclipse-new-server3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/eclipse-new-server3.png
--------------------------------------------------------------------------------
/docs/eclipse-new-server4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/eclipse-new-server4.png
--------------------------------------------------------------------------------
/docs/eclipse-new-wildfly1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/eclipse-new-wildfly1.png
--------------------------------------------------------------------------------
/docs/eclipse-new-wildfly2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/eclipse-new-wildfly2.png
--------------------------------------------------------------------------------
/docs/eclipse-new-wildfly3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/eclipse-new-wildfly3.png
--------------------------------------------------------------------------------
/docs/eclipse-new-wildfly4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/eclipse-new-wildfly4.png
--------------------------------------------------------------------------------
/docs/eclipse-run-on-server.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/eclipse-run-on-server.png
--------------------------------------------------------------------------------
/docs/nb-project-run-wildfly.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/nb-project-run-wildfly.png
--------------------------------------------------------------------------------
/docs/eclipse-new-server-running.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/eclipse-new-server-running.png
--------------------------------------------------------------------------------
/docs/glassfish-node-deploy-nb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/glassfish-node-deploy-nb.png
--------------------------------------------------------------------------------
/docs/glassfish-start-output-nb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/glassfish-start-output-nb.png
--------------------------------------------------------------------------------
/docs/nb-server-view-wildfly-run.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/nb-server-view-wildfly-run.png
--------------------------------------------------------------------------------
/docs/os-container-image-wildfly.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/os-container-image-wildfly.png
--------------------------------------------------------------------------------
/docs/os-switch-developer-view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/os-switch-developer-view.png
--------------------------------------------------------------------------------
/docs/eclipse-new-server-running2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/eclipse-new-server-running2.png
--------------------------------------------------------------------------------
/docs/os-container-image2-wildfly.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/os-container-image2-wildfly.png
--------------------------------------------------------------------------------
/docs/eclipse-liberty-run-on-server.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/eclipse-liberty-run-on-server.png
--------------------------------------------------------------------------------
/docs/eclipse-wildfly-run-on-server.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/eclipse-wildfly-run-on-server.png
--------------------------------------------------------------------------------
/docs/jakartaee8-compatible-products.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/jakartaee8-compatible-products.png
--------------------------------------------------------------------------------
/docs/nb-project-properties-wildfly-run.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hantsy/jakartaee8-starter-boilerplate/HEAD/docs/nb-project-properties-wildfly-run.png
--------------------------------------------------------------------------------
/src/main/java/com/example/GreetingService.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | public interface GreetingService {
4 | GreetingMessage buildGreetingMessage(String name);
5 | }
6 |
--------------------------------------------------------------------------------
/docs/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-cayman
2 | title: Kickstart a Jakarta EE 8 Application
3 | description: A series of docs to describe how to write a testable Java EE/Jakarta EE 8 Application
4 |
--------------------------------------------------------------------------------
/src/main/java/com/example/JaxrsActivator.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import javax.ws.rs.ApplicationPath;
4 | import javax.ws.rs.core.Application;
5 |
6 | @ApplicationPath("/api")
7 | public class JaxrsActivator extends Application {
8 | }
9 |
--------------------------------------------------------------------------------
/Dockerfile.openliberty:
--------------------------------------------------------------------------------
1 | FROM openliberty/open-liberty:22.0.0.13-kernel-slim-java11-openj9-ubi
2 | COPY --chown=1001:0 ./target/jakartaee8-starter.war /config/dropins/
3 | COPY --chown=1001:0 ./src/main/liberty/config/server.xml /config/
4 | RUN configure.sh
5 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | # These are supported funding model platforms
4 | #liberapay: hantsy # Replace with a single Liberapay username
5 | #issuehunt: hantsy # Replace with a single IssueHunt username
6 | custom: ['https://www.buymeacoffee.com/hantsy'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
7 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cart/OrderItemDtoAssembler.java:
--------------------------------------------------------------------------------
1 | package com.example.cart;
2 |
3 | public class OrderItemDtoAssembler {
4 | static OrderItemDto toDto(OrderItem item) {
5 | OrderItemDto dto = new OrderItemDto();
6 | dto.setNum(item.getNum());
7 | dto.setProductName(item.getProductName());
8 |
9 | return dto;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Dockerfile.wildfly:
--------------------------------------------------------------------------------
1 | FROM quay.io/wildfly/wildfly:26.1.2.Final-jdk11
2 |
3 | # add deployment archive.
4 | ADD ./target/jakartaee8-starter.war /opt/jboss/wildfly/standalone/deployments/
5 |
6 | # add an admin user.
7 | #RUN /opt/jboss/wildfly/bin/add-user.sh admin Admin#70365 --silent
8 |
9 | # run as standalone mode.
10 | CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-b", "0.0.0.0", "-bmanagement", "0.0.0.0"]
11 |
--------------------------------------------------------------------------------
/docs/03run-wildfly.md:
--------------------------------------------------------------------------------
1 | # Deploying applications to WildFly Server
2 |
3 | Eclipse IDE also has great support for WildFly Server through Redhat Codeready Studio plugin.
4 |
5 | You have several options to deploy an application to WildFly server :
6 |
7 | * [Using Eclipse IDE](./03run-wildfly-eclipse.md)
8 | * [Using WildFly Maven Plugin](./03run-wildfly-mvn.md)
9 | * [The Hard Way](./03run-wildfly-m.md)
10 |
11 |
12 |
--------------------------------------------------------------------------------
/docs/05prod.md:
--------------------------------------------------------------------------------
1 | # Put to production
2 |
3 | Docker and container is very popular in these days, for new applications, it is better to build your applications as a Docker Image, and it is easy to deploy it into the popular container platform today.
4 |
5 | * [Running Application Servers in Docker](./05prod-appservers-in-docker.md)
6 | * [Dockerizing your Applications](./05prod-dockerizing-app.md)
7 | * [Deploying on Cloud](./05prod-k8s.md)
8 |
--------------------------------------------------------------------------------
/docs/03run-openliberty.md:
--------------------------------------------------------------------------------
1 | # Deploying applications to Open Liberty Server
2 |
3 | Eclipse IDE also has great support for Open Liberty Server through Open Liberty tools plugin.
4 |
5 | You have several options to deploy an application to Open Liberty server :
6 |
7 | * [Using Eclipse IDE](./03run-openliberty-eclipse.md)
8 | * [Using Liberty Maven Plugin](./03run-openliberty-mvn.md)
9 | * [The Hard Way](./03run-openliberty-m.md)
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cart/OrderDtoAssembler.java:
--------------------------------------------------------------------------------
1 | package com.example.cart;
2 |
3 | public class OrderDtoAssembler {
4 |
5 | static OrderDto toDto(PurchaseOrder order) {
6 | OrderDto dto = new OrderDto();
7 | dto.setId(order.getId());
8 | dto.setCustomerId(order.getCustomerId());
9 | order.getItems().stream().map(OrderItemDtoAssembler::toDto).forEach(dto::addItem);
10 | return dto;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/main/java/com/example/SimpleGreetingService.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import javax.enterprise.context.ApplicationScoped;
4 | import java.time.LocalDateTime;
5 |
6 | @ApplicationScoped
7 | public class SimpleGreetingService implements GreetingService {
8 |
9 | @Override
10 | public GreetingMessage buildGreetingMessage(String name) {
11 | return GreetingMessage.of("Say Hello to " + name + " at " + LocalDateTime.now());
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/test/java/com/example/it/FakeGreetingService.java:
--------------------------------------------------------------------------------
1 | package com.example.it;
2 |
3 | import com.example.GreetingMessage;
4 | import com.example.GreetingService;
5 |
6 | import javax.enterprise.context.ApplicationScoped;
7 |
8 | @ApplicationScoped
9 | public class FakeGreetingService implements GreetingService {
10 | @Override
11 | public GreetingMessage buildGreetingMessage(String name) {
12 | return GreetingMessage.of("fake message");
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/docs/03run-glassfish.md:
--------------------------------------------------------------------------------
1 | # Deploying applications to Glassfish Server
2 |
3 | Apache NetBeans IDE has built-in Glassfish server support, Eclipse IDE also has good support for Glassfish through plugins.
4 |
5 | You have several options to deploy an application to Glassfish server :
6 |
7 | * [Using Eclipse IDE](./03run-glassfish-eclipse.md)
8 | * [Using NetBeans IDE](./03run-glassfish-nb.md)
9 | * [Using Cargo Maven Plugin](./03run-glassfish-mvn.md)
10 | * [The Hard Way](./03run-glassfish-m.md)
11 |
12 |
13 |
--------------------------------------------------------------------------------
/docs/04test-arq-openliberty.md:
--------------------------------------------------------------------------------
1 | # Open Liberty Server
2 |
3 | The [Liberty Arquillian](https://github.com/openliberty/liberty-arquillian) project provides [Managed Container Adapter and Remote Container Adapter](https://github.com/openliberty/liberty-arquillian).
4 |
5 | Check the following configurations to run tests on Open Liberty Server.
6 |
7 | * [Open Liberty Managed Container Adapter](./04test-arq-openliberty-managed.md)
8 | * [Open Liberty Remote Container Adapter](./04test-arq-openliberty-remote.md)
9 |
10 |
--------------------------------------------------------------------------------
/src/test/java/com/example/GreetingMessageTest.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.assertTrue;
6 |
7 | public class GreetingMessageTest {
8 |
9 | @Test
10 | public void testGreetingMessage() {
11 | GreetingMessage message = GreetingMessage.of("Say Hello to JatartaEE");
12 | assertTrue("message should contains `Say Hello to JatartaEE`",
13 | "Say Hello to JatartaEE".equals(message.getMessage()
14 | ));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled class file
2 | *.class
3 |
4 | # Log file
5 | *.log
6 |
7 | # BlueJ files
8 | *.ctxt
9 |
10 | # Mobile Tools for Java (J2ME)
11 | .mtj.tmp/
12 |
13 | # Package Files #
14 | *.jar
15 | *.war
16 | *.nar
17 | *.ear
18 | *.zip
19 | *.tar.gz
20 | *.rar
21 |
22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23 | hs_err_pid*
24 | *.iml
25 | .idea
26 | target
27 |
28 | /.apt_generated/
29 | /.apt_generated_tests/
30 | .project
31 | .classpath
32 | .factorypath
33 | .settings
34 | nb-*
35 |
--------------------------------------------------------------------------------
/src/main/java/com/example/jms/JmsResources.java:
--------------------------------------------------------------------------------
1 | package com.example.jms;
2 |
3 | import javax.ejb.Singleton;
4 | import javax.ejb.Startup;
5 | import javax.jms.JMSDestinationDefinition;
6 | import javax.jms.JMSDestinationDefinitions;
7 |
8 | @JMSDestinationDefinitions({
9 | @JMSDestinationDefinition(
10 | name = "java:app/jms/HelloQueue",
11 | // resourceAdapter = "jmsra",
12 | interfaceName = "javax.jms.Queue",
13 | destinationName = "HelloQueue")
14 | })
15 | @Singleton
16 | @Startup
17 | public class JmsResources {
18 | }
19 |
--------------------------------------------------------------------------------
/docs/04test-arq-wildfly.md:
--------------------------------------------------------------------------------
1 | # Running tests on WildFly Server
2 |
3 | Like Glassfish and Payara, [WildFly Arquillian](https://github.com/wildfly/wildfly-arquillian) also provide three basic container adapters. Additionally, it contains two adapters for managed domain and remote domain for that running WildFly servers in domain mode.
4 |
5 | Check the following configurations to run tests on Wildlfy Server.
6 |
7 | * [WildFly Managed Container Adapter](./04test-arq-wildfly-managed.md)
8 | * [WildFly Remote Container Adapter](./04test-arq-wildfly-remote.md)
9 | * [WildFly Embedded Container Adapter](./04test-arq-wildfly-embedded.md)
--------------------------------------------------------------------------------
/src/main/java/com/example/GreetingMessage.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import java.io.Serializable;
4 |
5 | @SuppressWarnings("serial")
6 | public class GreetingMessage implements Serializable {
7 | private String message;
8 |
9 | public static GreetingMessage of(String s) {
10 | final GreetingMessage message = new GreetingMessage();
11 | message.setMessage(s);
12 | return message;
13 | }
14 |
15 | public String getMessage() {
16 | return message;
17 | }
18 |
19 | public void setMessage(String message) {
20 | this.message = message;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cart/OrderDao.java:
--------------------------------------------------------------------------------
1 | package com.example.cart;
2 |
3 | import javax.ejb.Stateless;
4 | import javax.persistence.EntityManager;
5 | import javax.persistence.PersistenceContext;
6 | import java.util.List;
7 |
8 | @Stateless
9 | public class OrderDao {
10 |
11 | @PersistenceContext
12 | EntityManager entityManager;
13 |
14 | public List findAll() {
15 | return this.entityManager.createQuery("select po from PurchaseOrder po", PurchaseOrder.class)
16 | .getResultList();
17 | }
18 |
19 | public void store(PurchaseOrder data) {
20 | this.entityManager.persist(data);
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/docs/03run.md:
--------------------------------------------------------------------------------
1 | # Deploying applications to Application Servers
2 |
3 | [ Jakarta EE Compatible Products](https://jakarta.ee/compatibility/) lists all products that compatible with the latest Jakarta EE specifications.
4 |
5 |
6 |
7 |
8 | In this chapter, we will discuss the following topic:
9 |
10 | * [Getting the latest Jakarta EE compatible application servers](./03run.md)
11 | * Deploying the applications to the popular application servers, including:
12 | * [Glassfish](./03run-glassfish.md)
13 | * [Payara](./03run-payara.md)
14 | * [WildFly](./03run-wildfly.md)
15 | * [Open Liberty](./03run-openliberty.md)
16 |
17 |
18 |
--------------------------------------------------------------------------------
/docs/04test-arq-payara.md:
--------------------------------------------------------------------------------
1 | # Running tests on Payara Server
2 |
3 | Payara Server is a fork of Glassfish, you can use the Glassfish container adapter to test on Payara server directly. But Payara maintain [its own container adapters](https://github.com/payara/ecosystem-arquillian-connectors) for Payara Server. Compared to the Glassfish ones, they are updated more frequently, and easier to use.
4 |
5 | Check the following configurations to run tests on Payara Server.
6 |
7 | * [Payara Managed Container Adapter](./04test-arq-payara-managed.md)
8 | * [Payara Remote Container Adapter](./04test-arq-payara-remote.md)
9 | * [Payara Embedded Container Adapter](./04test-arq-payara-embedded.md)
10 | * [Payara Micro Managed Container Adapter](./04test-arq-payara-micro-managed.md)
--------------------------------------------------------------------------------
/src/main/java/com/example/jms/HelloJmsResource.java:
--------------------------------------------------------------------------------
1 | package com.example.jms;
2 |
3 | import javax.enterprise.context.RequestScoped;
4 | import javax.inject.Inject;
5 | import javax.ws.rs.GET;
6 | import javax.ws.rs.Path;
7 | import java.util.logging.Level;
8 | import java.util.logging.Logger;
9 |
10 | @RequestScoped
11 | @Path("hellojms")
12 | public class HelloJmsResource {
13 | private static final Logger LOGGER = Logger.getLogger(HelloJmsResource.class.getName());
14 |
15 | @Inject
16 | private HelloSender sender;
17 |
18 | @GET
19 | @Path("")
20 | public String sayHello() {
21 | LOGGER.log(Level.INFO, "sayHello from HelloJmsResource");
22 | sender.sayHellFromJms();
23 | return "sent";
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: bug
6 | assignees: hantsy
7 |
8 | ---
9 |
10 | Firstly make sure you are using Java 8 and Maven 3.1+ for building this project.
11 |
12 | **Describe the bug**
13 | A clear and concise description of what the bug is.
14 |
15 | **To Reproduce**
16 | Steps to reproduce the behavior:
17 | 1. Go to '...'
18 | 2. Click on '....'
19 | 3. Scroll down to '....'
20 | 4. See error
21 |
22 | **Expected behavior**
23 | A clear and concise description of what you expected to happen.
24 |
25 | **Screenshots**
26 | If applicable, add screenshots to help explain your problem.
27 |
28 | **Additional context**
29 | Add any other context about the problem here.
30 |
--------------------------------------------------------------------------------
/deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: jakartaee8-starter
6 | name: jakartaee8-starter
7 | spec:
8 | replicas: 1
9 | selector:
10 | matchLabels:
11 | app: jakartaee8-starter
12 | template:
13 | metadata:
14 | labels:
15 | app: jakartaee8-starter
16 | spec:
17 | containers:
18 | - image: hantsy/jakartaee8-starter-wildfly
19 | name: jakartaee8-starter-wildfly
20 |
21 | ---
22 | apiVersion: v1
23 | kind: Service
24 | metadata:
25 | labels:
26 | app: jakartaee8-starter
27 | name: jakartaee8-starter
28 | spec:
29 | ports:
30 | - port: 8080
31 | protocol: TCP
32 | targetPort: 8080
33 | selector:
34 | app: jakartaee8-starter
35 | type: NodePort
36 |
37 |
--------------------------------------------------------------------------------
/src/main/java/com/example/GreetingResource.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import javax.enterprise.context.RequestScoped;
4 | import javax.inject.Inject;
5 | import javax.ws.rs.GET;
6 | import javax.ws.rs.Path;
7 | import javax.ws.rs.PathParam;
8 | import javax.ws.rs.Produces;
9 | import javax.ws.rs.core.MediaType;
10 | import javax.ws.rs.core.Response;
11 |
12 | import static javax.ws.rs.core.Response.ok;
13 |
14 | @Path("greeting")
15 | @RequestScoped
16 | public class GreetingResource {
17 |
18 | @Inject
19 | private GreetingService greetingService;
20 |
21 | @GET
22 | @Path("{name}")
23 | @Produces(MediaType.APPLICATION_JSON)
24 | public Response greeting(@PathParam("name") String name) {
25 | return ok(this.greetingService.buildGreetingMessage(name)).build();
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cart/OrderResource.java:
--------------------------------------------------------------------------------
1 | package com.example.cart;
2 |
3 | import javax.enterprise.context.RequestScoped;
4 | import javax.inject.Inject;
5 | import javax.transaction.Transactional;
6 | import javax.ws.rs.GET;
7 | import javax.ws.rs.Path;
8 | import javax.ws.rs.Produces;
9 | import javax.ws.rs.core.MediaType;
10 | import javax.ws.rs.core.Response;
11 |
12 | import static java.util.stream.Collectors.toList;
13 | import static javax.ws.rs.core.Response.ok;
14 |
15 | @Path("orders")
16 | @RequestScoped
17 | public class OrderResource {
18 |
19 | @Inject
20 | private OrderDao orderDao;
21 |
22 | @Transactional
23 | @GET
24 | @Path("")
25 | @Produces(MediaType.APPLICATION_JSON)
26 | public Response allOrders() {
27 | return ok(this.orderDao.findAll().stream().map(OrderDtoAssembler::toDto).collect(toList())).build();
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/.github/workflows/it-with-arq-payara-micro.yml:
--------------------------------------------------------------------------------
1 | name: it-with-arq-payara-micro
2 |
3 | on:
4 | push:
5 | paths-ignore:
6 | - "docs/**"
7 | branches:
8 | - master
9 | pull_request:
10 | types:
11 | - opened
12 | - synchronize
13 | - reopened
14 |
15 | jobs:
16 | it-with-arq-payara-micro:
17 | runs-on: ubuntu-latest
18 |
19 | steps:
20 | - uses: actions/checkout@v4
21 | - name: Set up JDK 8
22 | uses: actions/setup-java@v4
23 | with:
24 | distribution: 'zulu'
25 | java-version: 8
26 |
27 | - name: Cache Maven packages
28 | uses: actions/cache@v3
29 | with:
30 | path: ~/.m2
31 | key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
32 | restore-keys: ${{ runner.os }}-m2
33 |
34 | - name: Run integration test with -Parq-payara-micro
35 | run: mvn clean verify -Parq-payara-micro
36 |
--------------------------------------------------------------------------------
/src/main/java/com/example/jms/HelloSender.java:
--------------------------------------------------------------------------------
1 | package com.example.jms;
2 |
3 | import javax.annotation.Resource;
4 | import javax.enterprise.context.ApplicationScoped;
5 | import javax.inject.Inject;
6 | import javax.jms.Destination;
7 | import javax.jms.JMSContext;
8 | import java.time.Instant;
9 | import java.util.logging.Level;
10 | import java.util.logging.Logger;
11 |
12 | @ApplicationScoped
13 | public class HelloSender {
14 | private static final Logger LOGGER = Logger.getLogger(HelloSender.class.getName());
15 |
16 | @Inject
17 | JMSContext context;
18 |
19 | @Resource(lookup = "java:app/jms/HelloQueue")
20 | private Destination helloQueue;
21 |
22 | public void sayHellFromJms() {
23 | String msg = "Hello JMS at " + Instant.now();
24 | LOGGER.log(Level.INFO, "sending message from HelloSender: {0}", msg);
25 | context.createProducer().send(helloQueue, msg);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/test/arq-liberty-managed/arquillian.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 | target/
8 |
9 |
10 |
11 |
12 | target/wlp/
13 | defaultServer
14 | 9080
15 |
16 | 300
17 | 120
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/test/arq-liberty-remote/arquillian.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 | target/
8 |
9 |
10 |
11 |
12 | localhost
13 | defaultServer
14 | admin
15 | admin
16 | 9080
17 | 9443
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/.github/workflows/it-with-arq-payara-managed.yml:
--------------------------------------------------------------------------------
1 | name: it-with-arq-payara-managed
2 |
3 | on:
4 | push:
5 | paths-ignore:
6 | - "docs/**"
7 | branches:
8 | - master
9 | pull_request:
10 | types:
11 | - opened
12 | - synchronize
13 | - reopened
14 |
15 | jobs:
16 | it-with-arq-payara-managed:
17 | runs-on: ubuntu-latest
18 |
19 | steps:
20 | - uses: actions/checkout@v4
21 | - name: Set up JDK 8
22 | uses: actions/setup-java@v4
23 | with:
24 | distribution: 'zulu'
25 | java-version: 8
26 |
27 | - name: Cache Maven packages
28 | uses: actions/cache@v3
29 | with:
30 | path: ~/.m2
31 | key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
32 | restore-keys: ${{ runner.os }}-m2
33 |
34 | - name: Run integration test with -Parq-payara-managed
35 | run: mvn clean verify -Parq-payara-managed
36 |
--------------------------------------------------------------------------------
/.github/workflows/it-with-arq-liberty-managed.yml:
--------------------------------------------------------------------------------
1 | name: it-with-arq-liberty-managed
2 |
3 | on:
4 | push:
5 | paths-ignore:
6 | - "docs/**"
7 | branches:
8 | - master
9 | pull_request:
10 | types:
11 | - opened
12 | - synchronize
13 | - reopened
14 |
15 | jobs:
16 | it-with-arq-liberty-managed:
17 | runs-on: ubuntu-latest
18 |
19 | steps:
20 | - uses: actions/checkout@v4
21 | - name: Set up JDK 8
22 | uses: actions/setup-java@v4
23 | with:
24 | distribution: 'zulu'
25 | java-version: 8
26 |
27 | - name: Cache Maven packages
28 | uses: actions/cache@v3
29 | with:
30 | path: ~/.m2
31 | key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
32 | restore-keys: ${{ runner.os }}-m2
33 |
34 | - name: Run integration test with -Parq-liberty-managed
35 | run: mvn clean verify -Parq-liberty-managed
36 |
--------------------------------------------------------------------------------
/.github/workflows/it-with-arq-payara-embedded.yml:
--------------------------------------------------------------------------------
1 | name: it-with-arq-payara-embedded
2 |
3 | on:
4 | push:
5 | paths-ignore:
6 | - "docs/**"
7 | branches:
8 | - master
9 | pull_request:
10 | types:
11 | - opened
12 | - synchronize
13 | - reopened
14 |
15 | jobs:
16 | it-with-arq-payara-embedded:
17 | runs-on: ubuntu-latest
18 |
19 | steps:
20 | - uses: actions/checkout@v4
21 | - name: Set up JDK 8
22 | uses: actions/setup-java@v4
23 | with:
24 | distribution: 'zulu'
25 | java-version: 8
26 |
27 | - name: Cache Maven packages
28 | uses: actions/cache@v3
29 | with:
30 | path: ~/.m2
31 | key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
32 | restore-keys: ${{ runner.os }}-m2
33 |
34 | - name: Run integration test with -Parq-payara-embedded
35 | run: mvn clean verify -Parq-payara-embedded
36 |
--------------------------------------------------------------------------------
/.github/workflows/it-with-arq-wildfly-managed.yml:
--------------------------------------------------------------------------------
1 | name: it-with-arq-wildfly-managed
2 |
3 | on:
4 | push:
5 | paths-ignore:
6 | - "docs/**"
7 | branches:
8 | - master
9 | pull_request:
10 | types:
11 | - opened
12 | - synchronize
13 | - reopened
14 |
15 | jobs:
16 | it-with-arq-wildfly-managed:
17 | runs-on: ubuntu-latest
18 |
19 | steps:
20 | - uses: actions/checkout@v4
21 | - name: Set up JDK 8
22 | uses: actions/setup-java@v4
23 | with:
24 | distribution: 'zulu'
25 | java-version: 8
26 |
27 | - name: Cache Maven packages
28 | uses: actions/cache@v3
29 | with:
30 | path: ~/.m2
31 | key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
32 | restore-keys: ${{ runner.os }}-m2
33 |
34 | - name: Run integration test with -Parq-wildfly-managed
35 | run: mvn clean verify -Parq-wildfly-managed
36 |
--------------------------------------------------------------------------------
/.github/workflows/it-with-arq-wildfly-embedded.yml:
--------------------------------------------------------------------------------
1 | name: it-with-arq-wildfly-embedded
2 |
3 | on:
4 | push:
5 | paths-ignore:
6 | - "docs/**"
7 | branches:
8 | - master
9 | pull_request:
10 | types:
11 | - opened
12 | - synchronize
13 | - reopened
14 |
15 | jobs:
16 | it-with-arq-wildfly-embedded:
17 | runs-on: ubuntu-latest
18 |
19 | steps:
20 | - uses: actions/checkout@v4
21 | - name: Set up JDK 11
22 | uses: actions/setup-java@v4
23 | with:
24 | distribution: 'zulu'
25 | java-version: 11
26 |
27 | - name: Cache Maven packages
28 | uses: actions/cache@v3
29 | with:
30 | path: ~/.m2
31 | key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
32 | restore-keys: ${{ runner.os }}-m2
33 |
34 | - name: Run integration test with -Parq-wildfly-embedded
35 | run: mvn clean verify -Parq-wildfly-embedded
36 |
--------------------------------------------------------------------------------
/.github/workflows/it-with-arq-glassfish-managed.yml:
--------------------------------------------------------------------------------
1 | name: it-with-arq-glassfish-managed
2 |
3 | on:
4 | push:
5 | paths-ignore:
6 | - "docs/**"
7 | branches:
8 | - master
9 | pull_request:
10 | types:
11 | - opened
12 | - synchronize
13 | - reopened
14 |
15 | jobs:
16 | it-with-arq-glassfish-managed:
17 | runs-on: ubuntu-latest
18 |
19 | steps:
20 | - uses: actions/checkout@v4
21 | - name: Set up JDK 8
22 | uses: actions/setup-java@v4
23 | with:
24 | distribution: 'zulu'
25 | java-version: 8
26 |
27 | - name: Cache Maven packages
28 | uses: actions/cache@v3
29 | with:
30 | path: ~/.m2
31 | key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
32 | restore-keys: ${{ runner.os }}-m2
33 |
34 | - name: Run integration test with -Parq-glassfish-managed
35 | run: mvn clean verify -Parq-glassfish-managed
36 |
--------------------------------------------------------------------------------
/.github/workflows/it-with-arq-glassfish-embedded.yml:
--------------------------------------------------------------------------------
1 | name: it-with-arq-glassfish-embedded
2 |
3 | on:
4 | push:
5 | paths-ignore:
6 | - "docs/**"
7 | branches:
8 | - master
9 | pull_request:
10 | types:
11 | - opened
12 | - synchronize
13 | - reopened
14 |
15 | jobs:
16 | it-with-arq-glassfish-embedded:
17 | runs-on: ubuntu-latest
18 |
19 | steps:
20 | - uses: actions/checkout@v4
21 | - name: Set up JDK 8
22 | uses: actions/setup-java@v4
23 | with:
24 | distribution: 'zulu'
25 | java-version: 8
26 |
27 | - name: Cache Maven packages
28 | uses: actions/cache@v3
29 | with:
30 | path: ~/.m2
31 | key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
32 | restore-keys: ${{ runner.os }}-m2
33 |
34 | - name: Run integration test with -Parq-glassfish-embedded
35 | run: mvn clean verify -Parq-glassfish-embedded
36 |
--------------------------------------------------------------------------------
/docs/04test-arq-glassfish.md:
--------------------------------------------------------------------------------
1 | # Running tests on Glassfish Server
2 |
3 | Arquillian provides 3 adapters to Glassfish server, check the project [arquillian/arquillian-container-glassfish](https://github.com/arquillian/arquillian-container-glassfish).
4 |
5 | * [GlassFish Managed 3.1 Container Adapter – 1.0.2 ](http://arquillian.org/modules/arquillian-glassfish-managed-3.1-container-adapter/)
6 | * [GlassFish Remote 3.1 Container Adapter – 1.0.2](http://arquillian.org/modules/arquillian-glassfish-remote-3.1-container-adapter/)
7 | * [GlassFish Embedded 3.1 Container Adapter – 1.0.2 ](http://arquillian.org/modules/arquillian-glassfish-embedded-3.1-container-adapter/)
8 |
9 | Check the following configurations to run tests on Glassfish Server.
10 |
11 | * [Glassfish Managed Container Adapter](./04test-arq-glassfish-managed.md)
12 | * [Glassfish Remote Container Adapter](./04test-arq-glassfish-remote.md)
13 | * [Glassfish Embedded Container Adapter](./04test-arq-glassfish-embedded.md)
--------------------------------------------------------------------------------
/docs/03run-payara.md:
--------------------------------------------------------------------------------
1 | # Deploying applications to Payara Server
2 |
3 | Payara server is derived from Glassfish project, the steps of deploying application to Payara server is very similar with the steps of Glassfish.
4 |
5 | ## Deploying applications to Payara Server using NetBeans IDE
6 |
7 | See [Deploying applications to Glassfish Server using NetBeans IDE](./03run-glassfish-nb.md).
8 |
9 |
10 | ## Deploying applications to Payara Server using Eclipse IDE
11 |
12 | See [Deploying applications to Glassfish Server using Eclipse IDE](./03run-glassfish-eclipse.md).
13 |
14 | ## Deploying applications to Payara Server using Cargo Maven Plugin
15 |
16 | The Payara Server is similar with Glassfish, Cargo maven plugin also support Payara Server as well, copy the Glassfish configuration, replace the Glassfish facilities with Payara one.
17 |
18 | More info about Cargo maven plugin support for Payara, see [here](https://codehaus-cargo.github.io/cargo/Payara.html).
19 |
20 | See [Deploying applications to Glassfish Server using Cargo Maven Plugin](./03run-glassfish-mvn.md).
21 |
--------------------------------------------------------------------------------
/docs/03run-openliberty-mvn.md:
--------------------------------------------------------------------------------
1 | # Deploying applications to Open Liberty Server using Liberty Maven plugin
2 |
3 | Open Liberty provides an official maven plugin for application deployment.
4 |
5 | ```xml
6 |
7 |
8 | io.openliberty.tools
9 | liberty-maven-plugin
10 | 3.1
11 |
12 | ```
13 |
14 | `liberty:dev` provides a dev mode for developers.
15 |
16 | `liberty:run` is easy to run the application on a local Open Liberty server. If the server does not exist, it will download it automatically.
17 |
18 | `liberty:deploy` will copy applications to the Liberty server's *dropins* or *apps* directory, If the server instance is running, it will also verify the applications started successfully.
19 |
20 | Unluckily, liberty maven plugin does not support deployment to remote Liberty Server, see [issue #245](https://github.com/OpenLiberty/ci.maven/issues/245).
21 |
22 | More info about Liberty maven plugin, see [here](https://github.com/OpenLiberty/ci.maven).
23 |
24 |
--------------------------------------------------------------------------------
/.github/workflows/build.yml:
--------------------------------------------------------------------------------
1 | name: build
2 |
3 | on:
4 | push:
5 | paths-ignore:
6 | - "docs/**"
7 | branches:
8 | - master
9 | pull_request:
10 | types:
11 | - opened
12 | - synchronize
13 | - reopened
14 |
15 | jobs:
16 | build:
17 | runs-on: ubuntu-latest
18 | strategy:
19 | matrix:
20 | distribution: [ 'zulu', 'adopt' ]
21 | # test against latest update of each major Java version, as well as specific updates of LTS versions:
22 | java: [8, 11, 17, 18]
23 | steps:
24 | - uses: actions/checkout@v4
25 | - name: Set up Java
26 | uses: actions/setup-java@v4
27 | with:
28 | distribution: ${{matrix.distribution}}
29 | java-version: ${{matrix.java}}
30 |
31 | - name: Cache Maven packages
32 | uses: actions/cache@v3
33 | with:
34 | path: ~/.m2
35 | key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
36 | restore-keys: ${{ runner.os }}-m2
37 |
38 | - name: Build with Maven
39 | run: mvn clean package --file pom.xml
40 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cart/OrderItemDto.java:
--------------------------------------------------------------------------------
1 | package com.example.cart;
2 |
3 | import java.io.Serializable;
4 | import java.util.Objects;
5 |
6 | public class OrderItemDto implements Serializable {
7 | private String productName;
8 | private Integer num;
9 |
10 | public String getProductName() {
11 | return productName;
12 | }
13 |
14 | public void setProductName(String productName) {
15 | this.productName = productName;
16 | }
17 |
18 | public Integer getNum() {
19 | return num;
20 | }
21 |
22 | public void setNum(Integer num) {
23 | this.num = num;
24 | }
25 |
26 | @Override
27 | public boolean equals(Object o) {
28 | if (this == o) return true;
29 | if (o == null || getClass() != o.getClass()) return false;
30 | OrderItemDto that = (OrderItemDto) o;
31 | return Objects.equals(productName, that.productName) && Objects.equals(num, that.num);
32 | }
33 |
34 | @Override
35 | public int hashCode() {
36 | return Objects.hash(productName, num);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/test/arq-liberty-managed/logging.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2011, Red Hat Middleware LLC, and individual contributors
3 | # identified by the Git commit log.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 |
16 | # Setup a standard ConsoleHandler in mode FINEST
17 | handlers= java.util.logging.ConsoleHandler
18 | java.util.logging.ConsoleHandler.level = FINEST
19 | java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
20 |
21 | # Configure WAS Container classes to FINEST; everything else to INFO
22 | .level= INFO
23 | io.openliberty.arquillian.level = FINEST
24 |
--------------------------------------------------------------------------------
/src/test/arq-liberty-remote/logging.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2011, Red Hat Middleware LLC, and individual contributors
3 | # identified by the Git commit log.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 |
16 | # Setup a standard ConsoleHandler in mode FINEST
17 | handlers= java.util.logging.ConsoleHandler
18 | java.util.logging.ConsoleHandler.level = FINEST
19 | java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
20 |
21 | # Configure WAS Container classes to FINEST; everything else to INFO
22 | .level= INFO
23 | io.openliberty.arquillian.level = FINEST
24 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | java:comp/DefaultDataSource
7 | false
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/main/java/com/example/jms/HelloConsumer.java:
--------------------------------------------------------------------------------
1 | package com.example.jms;
2 |
3 |
4 | import javax.ejb.ActivationConfigProperty;
5 | import javax.ejb.MessageDriven;
6 | import javax.jms.JMSException;
7 | import javax.jms.Message;
8 | import javax.jms.MessageListener;
9 | import java.util.logging.Level;
10 | import java.util.logging.Logger;
11 |
12 | @MessageDriven(
13 | activationConfig = {
14 | @ActivationConfigProperty(
15 | propertyName = "destinationType",
16 | propertyValue = "javax.jms.Queue"),
17 | @ActivationConfigProperty(
18 | propertyName = "destinationLookup",
19 | propertyValue = "java:app/jms/HelloQueue")
20 | }
21 | )
22 | public class HelloConsumer implements MessageListener {
23 | private static final Logger LOGGER = Logger.getLogger(HelloConsumer.class.getName());
24 |
25 | @Override
26 | public void onMessage(Message message) {
27 | try {
28 | LOGGER.log(Level.INFO, "received message: {0}", message.getBody(String.class));
29 | } catch (JMSException e) {
30 | e.printStackTrace();
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/docs/04test-arq-payara-embedded.md:
--------------------------------------------------------------------------------
1 | # Payara Embedded Container Adapter
2 |
3 | Open the *pom.xml* file, check the **arq-payara-embedded** profile.
4 |
5 | ```xml
6 |
7 | arq-payara-embedded
8 |
9 | false
10 |
11 |
12 |
13 | fish.payara.extras
14 | payara-embedded-all
15 | ${payara.version}
16 | test
17 |
18 |
19 | fish.payara.arquillian
20 | arquillian-payara-server-embedded
21 | ${arquillian-payara-server.version}
22 | test
23 |
24 |
25 |
26 | ```
27 |
28 | Similar with the Glassfish's **arq-glassfish-embedded** profile, but add the Payara specific dependencies instead.
29 |
30 | Run the tests using the following command.
31 |
32 | ```bash
33 | mvn clean verify -Parq-payara-remote
34 | ```
35 |
36 | > Payara arquillian includes all Jersey Client dependencies , we do not need to add it explicitly.
--------------------------------------------------------------------------------
/.github/workflows/dockerize.yml:
--------------------------------------------------------------------------------
1 | name: dockerize
2 |
3 | on: [pull_request]
4 |
5 | jobs:
6 | build:
7 | runs-on: ubuntu-latest
8 |
9 | steps:
10 | - uses: actions/checkout@v4
11 | - name: Set up JDK 8
12 | uses: actions/setup-java@v4
13 | with:
14 | distribution: 'zulu'
15 | java-version: 8
16 |
17 | - name: Build with Maven
18 | run: mvn clean package --file pom.xml
19 |
20 | - name: Login to DockerHub Registry
21 | run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
22 | - name: Build Docker images
23 | run: |
24 | # see: https://www.prestonlamb.com/blog/creating-a-docker-image-with-github-actions
25 | docker build -t hantsy/jakartaee8-starter-payara -f ./Dockerfile.payara .
26 | docker build -t hantsy/jakartaee8-starter-wildfly -f ./Dockerfile.wildfly .
27 | docker build -t hantsy/jakartaee8-starter-openliberty -f ./Dockerfile.openliberty .
28 | - name: Pushing Docker images
29 | run: |
30 | docker push hantsy/jakartaee8-starter-payara
31 | docker push hantsy/jakartaee8-starter-wildfly
32 | docker push hantsy/jakartaee8-starter-openliberty
33 |
--------------------------------------------------------------------------------
/docs/03run-get-appservers.md:
--------------------------------------------------------------------------------
1 | ### Getting Jakarta EE 8 Compatible Application Servers
2 |
3 | In the Jakarta EE [Compatible Products](https://jakarta.ee/compatibility/) , there is a full list of application servers that are compatible with the newest Jakarta EE 8 specification, including:
4 |
5 | * Glassfish is an open-source Java EE/Jakarta EE application server. In the past years, it was the official Java EE reference implementation for a long time, now it is donated to Eclipse Foundation as part of Eclipse EE4J project.
6 |
7 | Download the latest Glassfish [here](https://projects.eclipse.org/projects/ee4j.glassfish/downloads) .
8 |
9 | * Payara Server is a fork of Glassfish, and provides more quickly patch fixes for commercial support for subscribed customers.
10 |
11 | Download Payara server from [Payara website](https://www.payara.fish/software/downloads/).
12 |
13 | * WildFly is the rebranded open-source JBoss application server from Redhat.
14 |
15 | Get the newest WildFly [here](https://wildfly.org/downloads).
16 |
17 | * Open Liberty is an open-source application server sponsored by IBM. Open Liberty follows a monthly-cycle release and the development is very active in the past years.
18 |
19 | Download Open Liberty [from openliberty.io download page](https://openliberty.io/downloads/).
--------------------------------------------------------------------------------
/docs/04test.md:
--------------------------------------------------------------------------------
1 | # Testing Jakarta EE applications
2 |
3 | Generally, in a Jakarta EE application, there are some tools can be used for testing Jakarta EE components.
4 |
5 | * Use [JUnit](https://junit.org/) or [TestNG](https://testng.org/) to test simple POJOs.
6 | * Use [Mockito](https://site.mockito.org/) like mock framework to isolate the dependencies of a component in tests.
7 | * Test Jakarta EE components in a real world environment with [JBoss Arquillian](https://arquillian.org).
8 |
9 | Besides, there are some existing extensions to help for improving testing productivity.
10 |
11 | * [AssertJ](https://assertj.github.io) includes a collection of fluent assertions.
12 | * [RestAssured](http://rest-assured.io/) provides BDD like behaviors for testing RESTful APIs.
13 | * [JsonPath](https://github.com/json-path/JsonPath) provides XPath like query for JSON.
14 | * [awaitility](https://github.com/awaitility/awaitility) provides assertions for async invocation.
15 |
16 | In this post, we will focus on testing Jakarta EE components on the following Jakarta EE 8 compatible application servers with [JBoss Arquillian](https://arquillian.org).
17 |
18 | * [Glassfish Server](./04test-arq-glassfish.md)
19 | * [Payara Server](./04test-arq-payara.md)
20 | * [WildFly Server](./04test-arq-wildfly.md)
21 | * [Open Liberty Server](./04test-arq-openliberty.md)
22 |
23 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cart/SampleDataGenerator.java:
--------------------------------------------------------------------------------
1 | package com.example.cart;
2 |
3 | import javax.annotation.PostConstruct;
4 | import javax.ejb.Singleton;
5 | import javax.ejb.Startup;
6 | import javax.inject.Inject;
7 | import javax.persistence.EntityManager;
8 | import javax.persistence.PersistenceContext;
9 | import java.util.logging.Level;
10 | import java.util.logging.Logger;
11 |
12 | @Startup
13 | @Singleton
14 | public class SampleDataGenerator {
15 | private static final Logger LOGGER = Logger.getLogger(SampleDataGenerator.class.getName());
16 |
17 | @Inject
18 | OrderDao orderDao;
19 |
20 | @PersistenceContext
21 | EntityManager entityManager;
22 |
23 | @PostConstruct
24 | public void initialize() {
25 | LOGGER.log(Level.INFO, "start generating sample data...");
26 | // clear data
27 | int deleted =entityManager.createQuery("delete from PurchaseOrder").executeUpdate();
28 | LOGGER.log(Level.INFO, "clear existing data, deleted purchase order: {0}", deleted);
29 | // add new data.
30 | PurchaseOrder po = new PurchaseOrder();
31 | po.setCustomerId("test");
32 | po.addItem(new OrderItem("Apple", 3));
33 | po.addItem(new OrderItem("Orange", 4));
34 | orderDao.store(po);
35 |
36 | orderDao.findAll().forEach(purchaseOrder -> LOGGER.log(Level.INFO, "saved purchase order: {0}", purchaseOrder));
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.3' # specify docker-compose version
2 |
3 | # Define the services/containers to be run
4 | services:
5 |
6 | # see: https://hub.docker.com/r/payara/server-full/
7 | payara:
8 | image: payara/server-full:5.2022.5-jdk11
9 | ports:
10 | - "8080:8080"
11 | - "8181:8181" # HTTPS listener
12 | - "4848:4848" # HTTPS admin listener
13 | - "9009:9009" # Debug port
14 | restart: always
15 | # environment:
16 | # JVM_ARGS: ""
17 | # - "AS_ADMIN_MASTERPASSWORD=admin" #default password is `changeit`
18 | volumes:
19 | - ./deployments:/opt/payara/deployments
20 |
21 | # see: https://hub.docker.com/r/jboss/wildfly/
22 | wildfly:
23 | image: quay.io/wildfly/wildfly:26.1.2.Final-jdk11
24 | ports:
25 | - "8080:8080"
26 | - "9990:9990" # admin listener
27 | restart: always
28 | command: /opt/jboss/wildfly/bin/standalone.sh -b 0.0.0.0 -bmanagement 0.0.0.0
29 | # environment:
30 | volumes:
31 | - ./deployments:/opt/jboss/wildfly/standalone/deployments/
32 |
33 | # see: https://hub.docker.com/_/open-liberty
34 | openliberty:
35 | image: openliberty/open-liberty:22.0.0.13-kernel-slim-java11-openj9-ubi
36 | ports:
37 | - "9080:9080"
38 | - "9443:9443" # HTTPS listener
39 | restart: always
40 | # command: configure.sh # use for open-liberty:kernel image.
41 | # environment:
42 | volumes:
43 | - ./deployments:/config/dropins
44 |
--------------------------------------------------------------------------------
/src/test/java/com/example/it/DbUtil.java:
--------------------------------------------------------------------------------
1 | package com.example.it;
2 |
3 |
4 | import javax.sql.DataSource;
5 | import java.sql.Connection;
6 | import java.sql.ResultSet;
7 | import java.sql.SQLException;
8 | import java.util.logging.Level;
9 | import java.util.logging.Logger;
10 |
11 | import static org.junit.Assert.assertEquals;
12 |
13 | public class DbUtil {
14 | private static final Logger LOGGER = Logger.getLogger(DbUtil.class.getName());
15 | final DataSource dataSource;
16 |
17 | public DbUtil(DataSource dataSource) {
18 | this.dataSource = dataSource;
19 | }
20 |
21 | public void clearTables() throws SQLException {
22 | clearTable("OrderItem");
23 | clearTable("PurchaseOrder");
24 | }
25 |
26 | public void clearTable(String tableName) throws SQLException {
27 | Connection conn = dataSource.getConnection();
28 | int deleted = conn.prepareStatement("delete from " + tableName + "")
29 | .executeUpdate();
30 | LOGGER.log(Level.INFO, "deleted {0} records from {1} ", new Object[]{deleted, tableName});
31 | }
32 |
33 | public void assertCount(String tableName, int count) throws SQLException {
34 | Connection conn = dataSource.getConnection();
35 | ResultSet rs = conn.prepareStatement("select count(*) from " + tableName + "")
36 | .executeQuery();
37 | int rowCount = 0;
38 | if (rs.next()) {
39 | rowCount = rs.getInt(1);
40 | }
41 | assertEquals(count, rowCount);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cart/OrderDto.java:
--------------------------------------------------------------------------------
1 | package com.example.cart;
2 |
3 | import java.io.Serializable;
4 | import java.util.ArrayList;
5 | import java.util.List;
6 | import java.util.Objects;
7 |
8 | public class OrderDto implements Serializable {
9 |
10 | private Long id;
11 | private String customerId;
12 | List items = new ArrayList<>();
13 |
14 | public Long getId() {
15 | return id;
16 | }
17 |
18 | public void setId(Long id) {
19 | this.id = id;
20 | }
21 |
22 | public String getCustomerId() {
23 | return customerId;
24 | }
25 |
26 | public void setCustomerId(String customerId) {
27 | this.customerId = customerId;
28 | }
29 |
30 | public List getItems() {
31 | return items;
32 | }
33 |
34 | public void setItems(List items) {
35 | this.items = items;
36 | }
37 |
38 | public void addItem(OrderItemDto itemDto){
39 | this.items.add(itemDto);
40 | }
41 |
42 | @Override
43 | public boolean equals(Object o) {
44 | if (this == o) return true;
45 | if (o == null || getClass() != o.getClass()) return false;
46 | OrderDto orderDto = (OrderDto) o;
47 | return Objects.equals(id, orderDto.id)
48 | && Objects.equals(customerId, orderDto.customerId)
49 | && Objects.equals(items, orderDto.items);
50 | }
51 |
52 | @Override
53 | public int hashCode() {
54 | return Objects.hash(id, customerId, items);
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/test/java/com/example/it/FakeGreetingServiceTest.java:
--------------------------------------------------------------------------------
1 | package com.example.it;
2 |
3 | import com.example.GreetingMessage;
4 | import com.example.GreetingService;
5 | import org.jboss.arquillian.container.test.api.Deployment;
6 | import org.jboss.arquillian.junit.Arquillian;
7 | import org.jboss.shrinkwrap.api.ShrinkWrap;
8 | import org.jboss.shrinkwrap.api.asset.EmptyAsset;
9 | import org.jboss.shrinkwrap.api.spec.JavaArchive;
10 | import org.junit.Test;
11 | import org.junit.runner.RunWith;
12 |
13 | import javax.inject.Inject;
14 | import java.util.logging.Level;
15 | import java.util.logging.Logger;
16 |
17 | import static org.junit.Assert.assertTrue;
18 |
19 | @RunWith(Arquillian.class)
20 | public class FakeGreetingServiceTest {
21 | private final static Logger LOGGER = Logger.getLogger(FakeGreetingServiceTest.class.getName());
22 |
23 | @Deployment
24 | public static JavaArchive createDeployment() {
25 | return ShrinkWrap.create(JavaArchive.class)
26 | .addClass(GreetingMessage.class)
27 | .addClass(GreetingService.class).addClass(FakeGreetingService.class)
28 | .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
29 | }
30 |
31 | @Inject
32 | GreetingService service;
33 |
34 | @Test
35 | public void should_create_greeting() {
36 | LOGGER.log(Level.INFO, " Running test:: GreetingServiceTest#should_create_greeting ... ");
37 | GreetingMessage message = service.buildGreetingMessage("Jakarta EE");
38 | assertTrue("message should start with \"fake\"",
39 | message.getMessage().startsWith("fake"));
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/test/java/com/example/it/GreetingServiceTest.java:
--------------------------------------------------------------------------------
1 | package com.example.it;
2 |
3 | import com.example.GreetingMessage;
4 | import com.example.GreetingService;
5 | import com.example.SimpleGreetingService;
6 | import org.jboss.arquillian.container.test.api.Deployment;
7 | import org.jboss.arquillian.junit.Arquillian;
8 | import org.jboss.shrinkwrap.api.ShrinkWrap;
9 | import org.jboss.shrinkwrap.api.asset.EmptyAsset;
10 | import org.jboss.shrinkwrap.api.spec.JavaArchive;
11 | import org.junit.Test;
12 | import org.junit.runner.RunWith;
13 |
14 | import javax.inject.Inject;
15 |
16 | import java.util.logging.Level;
17 | import java.util.logging.Logger;
18 |
19 | import static org.junit.Assert.assertTrue;
20 |
21 | @RunWith(Arquillian.class)
22 | public class GreetingServiceTest {
23 | private final static Logger LOGGER = Logger.getLogger(GreetingServiceTest.class.getName());
24 |
25 | @Deployment
26 | public static JavaArchive createDeployment() {
27 | return ShrinkWrap.create(JavaArchive.class)
28 | .addClass(GreetingMessage.class)
29 | .addClass(GreetingService.class).addClass(SimpleGreetingService.class)
30 | .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
31 | }
32 |
33 | @Inject
34 | GreetingService service;
35 |
36 | @Test
37 | public void should_create_greeting() {
38 | LOGGER.log(Level.INFO, " Running test:: GreetingServiceTest#should_create_greeting ... ");
39 | GreetingMessage message = service.buildGreetingMessage("Jakarta EE");
40 | assertTrue("message should start with \"Say Hello to Jakarta EE at \"",
41 | message.getMessage().startsWith("Say Hello to Jakarta EE at "));
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/docs/04test-arq-payara-remote.md:
--------------------------------------------------------------------------------
1 | # Payara Remote Container Adapter
2 |
3 | Open the *pom.xml* file, locate to **arq-payara-remote** profile.
4 |
5 | ```xml
6 |
7 | arq-payara-remote
8 |
9 | false
10 |
11 |
12 |
13 | fish.payara.arquillian
14 | arquillian-payara-server-remote
15 | ${arquillian-payara-server.version}
16 | test
17 |
18 |
19 |
20 |
21 |
22 | org.apache.maven.plugins
23 | maven-failsafe-plugin
24 | ${maven-failsafe-plugin.version}
25 |
26 |
27 |
28 | glassfish-remote
29 |
30 |
31 |
32 |
33 |
34 |
35 | ```
36 |
37 | It reuses `glassfish-remote` qualifier in *src/resources/arquillian.xml*.
38 |
39 | ```xml
40 |
41 |
42 | admin
43 | adminadmin
44 |
45 |
46 | ```
47 |
48 | Start up a local Payara server for test purpose, make sure the `adminPassword` is set correctly.
49 |
50 | Run the tests using the following command.
51 |
52 | ```bash
53 | mvn clean verify -Parq-payara-remote
54 | ```
55 |
56 |
57 |
--------------------------------------------------------------------------------
/src/test/resources/glassfish-resources.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
14 |
19 |
22 |
25 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/src/test/java/com/example/it/HelloJmsTest.java:
--------------------------------------------------------------------------------
1 | package com.example.it;
2 |
3 | import com.example.jms.HelloSender;
4 | import com.example.jms.JmsResources;
5 | import org.jboss.arquillian.container.test.api.Deployment;
6 | import org.jboss.arquillian.junit.Arquillian;
7 | import org.jboss.shrinkwrap.api.ShrinkWrap;
8 | import org.jboss.shrinkwrap.api.asset.EmptyAsset;
9 | import org.jboss.shrinkwrap.api.spec.JavaArchive;
10 | import org.junit.Test;
11 | import org.junit.runner.RunWith;
12 |
13 | import javax.annotation.Resource;
14 | import javax.inject.Inject;
15 | import javax.jms.*;
16 | import java.util.logging.Logger;
17 |
18 | import static org.junit.Assert.assertTrue;
19 |
20 | @RunWith(Arquillian.class)
21 | public class HelloJmsTest {
22 | private final static Logger LOGGER = Logger.getLogger(HelloJmsTest.class.getName());
23 |
24 | @Deployment
25 | public static JavaArchive createDeployment() {
26 | return ShrinkWrap.create(JavaArchive.class)
27 | .addClass(JmsResources.class)
28 | // .addClass(HelloConsumer.class)
29 | .addClass(HelloSender.class)
30 | .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
31 | }
32 |
33 | @Inject
34 | HelloSender sender;
35 |
36 | @Inject
37 | JMSContext jmsContext;
38 |
39 | @Resource(lookup = "java:app/jms/HelloQueue")
40 | private Destination helloQueue;
41 |
42 | @Test
43 | public void testHelloQueue() throws JMSException {
44 | JMSConsumer consumer = jmsContext.createConsumer(helloQueue);
45 | sender.sayHellFromJms();
46 | Message message = consumer.receive(1000);
47 | assertTrue(message instanceof TextMessage);
48 | String text = message.getBody(String.class);
49 | LOGGER.info("message text:" + text);
50 | assertTrue(text.startsWith("Hello JMS"));
51 | consumer.close();
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cart/Basket.java:
--------------------------------------------------------------------------------
1 | package com.example.cart;
2 |
3 | import javax.ejb.Remove;
4 | import javax.ejb.Stateful;
5 | import javax.persistence.EntityManager;
6 | import javax.persistence.PersistenceContext;
7 | import javax.persistence.PersistenceContextType;
8 | import javax.persistence.SynchronizationType;
9 | import java.util.UUID;
10 | import java.util.logging.Level;
11 | import java.util.logging.Logger;
12 |
13 | @Stateful
14 | public class Basket {
15 | private static final Logger LOGGER = Logger.getLogger(Basket.class.getName());
16 |
17 | @PersistenceContext(type = PersistenceContextType.EXTENDED,
18 | synchronization = SynchronizationType.UNSYNCHRONIZED)
19 | private EntityManager entityManager;
20 |
21 | private PurchaseOrder purchaseOrder;
22 |
23 | public void newOrder() {
24 | LOGGER.log(Level.INFO, "create a new order");
25 | final String customerId = UUID.randomUUID().toString();
26 | this.purchaseOrder = new PurchaseOrder();
27 | this.purchaseOrder.setCustomerId(customerId);
28 | this.entityManager.persist(this.purchaseOrder);
29 | }
30 |
31 | public void add(String product, int num) {
32 | LOGGER.log(Level.INFO, "add product to basket:: {0}, {1}", new Object[]{product, num});
33 | OrderItem item = new OrderItem(product, num);
34 | item.setOrder(this.purchaseOrder);
35 | this.entityManager.persist(item);
36 | }
37 |
38 | public void checkout() {
39 | LOGGER.log(Level.INFO, "checkout purchase order details:: {0}", new Object[]{this.purchaseOrder});
40 | // Manually sync is a must when synchronization = SynchronizationType.UNSYNCHRONIZED)
41 | // You have to join a transaction firstly to attach the EntityManager to the current transaction context.
42 | this.entityManager.joinTransaction();
43 | this.entityManager.flush();
44 |
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cart/PurchaseOrder.java:
--------------------------------------------------------------------------------
1 | package com.example.cart;
2 |
3 | import javax.persistence.*;
4 | import java.io.Serializable;
5 | import java.util.ArrayList;
6 | import java.util.List;
7 | import java.util.Objects;
8 |
9 | @Entity
10 | public class PurchaseOrder implements Serializable {
11 | @Id
12 | @GeneratedValue(strategy = GenerationType.AUTO)
13 | private Long id;
14 | private String customerId;
15 |
16 | @OneToMany(mappedBy = "order", cascade = {CascadeType.PERSIST, CascadeType.REMOVE}, orphanRemoval = true)
17 | List items = new ArrayList<>();
18 |
19 | public Long getId() {
20 | return id;
21 | }
22 |
23 | public void setId(Long id) {
24 | this.id = id;
25 | }
26 |
27 | public String getCustomerId() {
28 | return customerId;
29 | }
30 |
31 | public void setCustomerId(String customerId) {
32 | this.customerId = customerId;
33 | }
34 |
35 | public List getItems() {
36 | return items;
37 | }
38 |
39 | public void setItems(List items) {
40 | this.items = items;
41 | }
42 |
43 | @Override
44 | public boolean equals(Object o) {
45 | if (this == o) return true;
46 | if (o == null || getClass() != o.getClass()) return false;
47 | PurchaseOrder that = (PurchaseOrder) o;
48 | return customerId.equals(that.customerId) && items.equals(that.items);
49 | }
50 |
51 | @Override
52 | public int hashCode() {
53 | return Objects.hash(customerId, items);
54 | }
55 |
56 | @Override
57 | public String toString() {
58 | return "PurchaseOrder{" +
59 | "id=" + id +
60 | ", customerId='" + customerId + '\'' +
61 | ", items=" + items +
62 | '}';
63 | }
64 |
65 | public void addItem(OrderItem item) {
66 | item.setOrder(this);
67 | this.items.add(item);
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cart/OrderItem.java:
--------------------------------------------------------------------------------
1 | package com.example.cart;
2 |
3 | import javax.persistence.*;
4 | import java.io.Serializable;
5 | import java.util.Objects;
6 |
7 | @Entity
8 | public class OrderItem implements Serializable {
9 |
10 | @Id
11 | @GeneratedValue(strategy = GenerationType.AUTO)
12 | private Long id;
13 |
14 | @ManyToOne
15 | @JoinColumn(name = "order_id")
16 | private PurchaseOrder order;
17 |
18 | private String productName;
19 | private Integer num;
20 |
21 | public OrderItem() {
22 | }
23 |
24 | public OrderItem(String productName, Integer num) {
25 | this.productName = productName;
26 | this.num = num;
27 | }
28 |
29 | public String getProductName() {
30 | return productName;
31 | }
32 |
33 | public void setProductName(String productName) {
34 | this.productName = productName;
35 | }
36 |
37 | public Integer getNum() {
38 | return num;
39 | }
40 |
41 | public void setNum(Integer num) {
42 | this.num = num;
43 | }
44 |
45 | public Long getId() {
46 | return id;
47 | }
48 |
49 | public void setId(Long id) {
50 | this.id = id;
51 | }
52 |
53 | public PurchaseOrder getOrder() {
54 | return order;
55 | }
56 |
57 | public void setOrder(PurchaseOrder order) {
58 | this.order = order;
59 | }
60 |
61 | @Override
62 | public boolean equals(Object o) {
63 | if (this == o) return true;
64 | if (o == null || getClass() != o.getClass()) return false;
65 | OrderItem orderItem = (OrderItem) o;
66 | return productName.equals(orderItem.productName);
67 | }
68 |
69 | @Override
70 | public int hashCode() {
71 | return Objects.hash(productName);
72 | }
73 |
74 | @Override
75 | public String toString() {
76 | return "OrderItem{" +
77 | "id=" + id +
78 | ", productName='" + productName + '\'' +
79 | ", num=" + num +
80 | '}';
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/docs/02understand-app.md:
--------------------------------------------------------------------------------
1 | # Understanding Application Architecture
2 |
3 | [toc]
4 |
5 | ## Project File Structure
6 |
7 | After the source codes is imported into IDEs, the project file structure looks like the following:
8 |
9 | ```bash
10 | ├── .github
11 | │ ├── ISSUE_TEMPLATE
12 | │ │ └── bug_report.md
13 | │ └── workflows
14 | │ └── maven.yml
15 | ├── src
16 | │ ├── main
17 | │ │ ├── java
18 | │ │ │ └── com
19 | │ │ │ └── example
20 | │ │ │ ├── GreetingMessage.java
21 | │ │ │ ├── GreetingResource.java
22 | │ │ │ ├── GreetingService.java
23 | │ │ │ └── JaxrsActivator.java
24 | │ │ └── resources
25 | │ │ └── META-INF
26 | │ │ └── beans.xml
27 | │ └── test
28 | │ ├── java
29 | │ │ └── com
30 | │ │ └── example
31 | │ │ ├── it
32 | │ │ │ ├── GreetingResourceTest.java
33 | │ │ │ └── GreetingServiceTest.java
34 | │ │ └── GreetingMessageTest.java
35 | │ └── resources
36 | │ └── arquillian.xml
37 | ├── .gitignore
38 | ├── LICENSE
39 | ├── pom.xml
40 | └── README.md
41 |
42 | ```
43 |
44 | The **.github** folder holds the Github specific configurations, eg, issue templates, Github Actions workflows.
45 |
46 | The *src/main/java* includes some sample codes:
47 |
48 | * `GreetingMessage` is a simple POJO to present a greeting message.
49 | * `GreetingService` is a simple CDI managed bean used to building a greeting message.
50 | * `GreetingResource` is a simple JAX-RS resource to produce RESTful APIs.
51 | * `JaxrsActivator` is the JAX-RS application class which is used to activate JAX-RS in Jakarta EE applications.
52 |
53 | The *src/main/java/resources/META-INF/beans.xml* is a CDI configuration file. CDI is activated by default since Java EE 7, so beans.xml file is optional if you do not have any extra CDI configuration.
54 |
55 | The *src/test/java* includes some ample codes for testing purpose. Especially, the tests under `com.example.it` package is [JBoss Arquillian](http://arquillian.org/) *Integration Tests* , which means it will deploy into application servers and run the tests.
56 |
57 | The *src/test/java/resources/arquillian.xml* is a [JBoss Arquillian](http://arquillian.org/) sample configuration file.
58 |
59 | ## Application Architecture
60 |
61 | A traditional **3**-**tier application architecture** is a modular client-server architecture that consists of a **presentation tier**, an **application tier** and a **data tier**. The three tiers are logical, not physical, and may or may not run on the same physical server.
62 |
63 | In our sample application, the presentation tier is not the web pages in traditional web applications, but consists of a collection of RESTful APIs.
64 |
65 |
--------------------------------------------------------------------------------
/src/test/resources/arquillian.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 | target/
10 |
11 |
12 |
13 |
14 | false
15 |
16 | localhost
17 | 4848
18 | ${enableDerby:true}
19 | true
20 |
21 |
22 |
23 |
24 |
25 |
26 | src/test/resources/glassfish-resources.xml
27 |
28 | 7070
29 | 7071
30 |
31 |
32 |
33 |
34 |
35 |
52 | admin
53 | adminadmin
54 |
55 |
56 |
57 |
58 |
59 |
60 | 127.0.0.1
61 | 9990
62 | http-remoting
63 | admin
64 | Admin@123
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 | standalone-full.xml
73 |
74 |
75 |
76 |
77 |
78 |
79 | standalone-full.xml
80 |
81 |
82 |
--------------------------------------------------------------------------------
/src/test/java/com/example/it/OrderDaoTest.java:
--------------------------------------------------------------------------------
1 | package com.example.it;
2 |
3 | import com.example.cart.OrderDao;
4 | import com.example.cart.OrderItem;
5 | import com.example.cart.PurchaseOrder;
6 | import org.jboss.arquillian.container.test.api.Deployment;
7 | import org.jboss.arquillian.junit.Arquillian;
8 | import org.jboss.shrinkwrap.api.ShrinkWrap;
9 | import org.jboss.shrinkwrap.api.asset.EmptyAsset;
10 | import org.jboss.shrinkwrap.api.spec.WebArchive;
11 | import org.junit.Before;
12 | import org.junit.Test;
13 | import org.junit.runner.RunWith;
14 |
15 | import javax.annotation.Resource;
16 | import javax.ejb.EJB;
17 | import javax.inject.Inject;
18 | import javax.persistence.EntityManager;
19 | import javax.persistence.PersistenceContext;
20 | import javax.sql.DataSource;
21 | import javax.transaction.UserTransaction;
22 | import java.util.logging.Level;
23 | import java.util.logging.Logger;
24 |
25 | import static org.junit.Assert.assertEquals;
26 | import static org.junit.Assert.assertNotNull;
27 |
28 | @RunWith(Arquillian.class)
29 | public class OrderDaoTest {
30 | private final static Logger LOGGER = Logger.getLogger(OrderDaoTest.class.getName());
31 |
32 | @Deployment
33 | public static WebArchive createDeployment() {
34 | return ShrinkWrap.create(WebArchive.class, "test-OrderDaoTest.war")
35 | .addClass(OrderDao.class)
36 | .addClass(PurchaseOrder.class)
37 | .addClass(OrderItem.class)
38 | .addClass(DbUtil.class)
39 | .addAsResource("META-INF/persistence.xml", "META-INF/persistence.xml")
40 | .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
41 | }
42 |
43 | @EJB
44 | OrderDao orderDao;
45 |
46 | @PersistenceContext
47 | EntityManager entityManager;
48 |
49 | @Resource(lookup = "java:comp/DefaultDataSource")
50 | DataSource dataSource;
51 |
52 | @Inject
53 | UserTransaction utx;
54 |
55 | private DbUtil dbUtil;
56 |
57 | @Before()
58 | public void setup() throws Exception {
59 | utx.begin();
60 | dbUtil = new DbUtil(dataSource);
61 | dbUtil.clearTables();
62 | utx.commit();
63 | }
64 |
65 | @Test
66 | public void testNewOrder() throws Exception {
67 | utx.begin();
68 | LOGGER.log(Level.INFO, " Running test:: Basket :: new order... ");
69 | PurchaseOrder po = new PurchaseOrder();
70 | po.setCustomerId("test");
71 | po.addItem(new OrderItem("Apple", 3));
72 | po.addItem(new OrderItem("Orange", 4));
73 |
74 | orderDao.store(po);
75 | utx.commit();
76 |
77 | dbUtil.assertCount("PurchaseOrder", 1);
78 | dbUtil.assertCount("OrderItem", 2);
79 | PurchaseOrder saved = entityManager.find(PurchaseOrder.class, po.getId());
80 | assertNotNull(saved);
81 | assertEquals("test", saved.getCustomerId());
82 | }
83 |
84 |
85 | }
86 |
--------------------------------------------------------------------------------
/src/test/arq-liberty-remote/server.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | javaee-8.0
7 | restConnector-2.0
8 |
9 |
10 |
11 |
12 |
15 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
27 |
29 |
31 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | ${server.config.dir}/dropins
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/src/test/arq-liberty-managed/server.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | javaee-8.0
7 | usr:arquillian-support-1.0
8 | localConnector-1.0
9 |
10 |
11 |
12 |
13 |
16 |
17 |
18 |
19 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/src/main/liberty/config/server.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | javaee-8.0
7 |
8 |
9 |
10 |
11 |
14 |
17 |
18 |
22 |
23 |
24 |
25 |
26 |
27 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/docs/04test-arq-payara-managed.md:
--------------------------------------------------------------------------------
1 | # Payara Managed Container Adapter
2 |
3 | Open the *pom.xml* , check the **arq-payara-managed** profile.
4 |
5 | ```xml
6 |
7 | arq-payara-managed
8 |
9 | false
10 |
11 |
12 |
13 |
14 | fish.payara.arquillian
15 | arquillian-payara-server-managed
16 | ${arquillian-payara-server.version}
17 | test
18 |
19 |
20 |
21 |
22 |
23 | org.apache.maven.plugins
24 | maven-dependency-plugin
25 | ${maven-dependency-plugin.version}
26 |
27 |
28 | unpack
29 | pre-integration-test
30 |
31 | unpack
32 |
33 |
34 |
35 |
36 | fish.payara.distributions
37 | payara
38 | ${payara.version}
39 | zip
40 | false
41 | ${project.build.directory}
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | org.apache.maven.plugins
50 | maven-failsafe-plugin
51 | ${maven-failsafe-plugin.version}
52 |
53 |
54 | ${project.build.directory}/payara5
55 |
56 |
57 |
58 |
59 |
60 |
61 | ```
62 |
63 | Very similar with **arq-glassfish-managed** profile, but there are some difference, including:
64 |
65 | * Add `arquillian-payara-server-managed` as dependency instead.
66 | * The `maven-dependency-plugin` prepares a copy of Payara server to *target* folder. Set a `GLASSFISH_HOME` (or `PAYARA_HOME`) environment variable in the configuration of `maven-failsafe-plugin`.
67 | * For JAX-RS tests, no need to add the Jersey client libraries, `arquillian-payara-server-managed` resolves the tedious dependency configuration.
68 |
69 | Run the following command to run tests against Payara Managed Container Adapter.
70 |
71 | ```bash
72 | mvn clean verify -Parq-payara-managed
73 | ```
74 |
75 |
--------------------------------------------------------------------------------
/docs/03run-glassfish-nb.md:
--------------------------------------------------------------------------------
1 | # Deploying applications to Glassfish Server using Apache NetBeans IDE
2 |
3 | NetBeans has built-in support for Glassfish.
4 |
5 | [toc]
6 |
7 | ## Add a Glassfish Server instance
8 |
9 | Firstly, you should add a Glassfish server instance in NetBeans.
10 |
11 | 1. Click *Windows->Services* or use *Ctrl+5* shortcuts to open *Services* view .
12 | 2. Right click the *Servers* node, select *Add Server...* in the context menu.
13 | 3. In the *Add Server Instance* dialog, there are three steps:
14 | * *Choose Server* :select *Glassfish* in the server list, click *Next* button.
15 | * *Server Location*: select the Glassfish server location, click *Next* button.
16 | * *Domain name/Location*: use the default *domain1* as domain name, click *Finish* button.
17 |
18 | After it is done, there is a new node *Glassfish server* added under the *Server*s nodes.
19 |
20 |
21 |
22 | Right click the Glassfish server node, there is a few actions available for you to control the server instance, such as Start, Stop, Debug etc.
23 |
24 | ## Start and Stop Glassfish Server
25 |
26 | Let's start the Glassfish server by click *Start* in the context menu. Wait for seconds, you will see the *Output* screen similar to the following.
27 |
28 |
29 |
30 | To stop the running Glassfish server, click *Stop* in the context menu of the existed Glassfish server node. Or jus click the *stop* button the *Notifications* windows.
31 |
32 | ## Deploy and undeploy applications
33 |
34 | Switch to *Project* view, right click the project node, and select *Run* in the context menu.
35 |
36 | In the *Select deployment server* dialog, select *Glassfish server* we have created in the dropdown menu.
37 |
38 |
39 |
40 | Click *OK* button. It will try to build the project and deploy the application package into the NetBeans managed Glassfish server.
41 |
42 | After it is deployed successfully, there is a success message similar with the following in the *Output* window.
43 |
44 | ```bash
45 | ------------------------------------------------------------------------
46 | Deploying on GlassFish Server
47 | profile mode: false
48 | debug mode: false
49 | force redeploy: true
50 | In-place deployment at D:\hantsylabs\jakartaee8-starter\target\jakartaee8-starter
51 |
52 | ```
53 |
54 | Let's switch to *Server* view, there several nodes are displayed under Glassfish servers. Expand the *Application* node, you will see there is a new node *jakartaee8-starter* there.
55 |
56 |
57 |
58 | Currently the sample application just includes a simple RESTful APIs which serves at the */api/greeting* endpoint.
59 |
60 | Open your terminal and use `curl` to verify the APIs.
61 |
62 | ```bash
63 | curl http://localhost:8080/jakartaee8-starter/api/greeting/hantsy
64 | {"message":"Say Hello to hantsy at 2019-11-04T16:16:13.509"}
65 | ```
66 |
67 | To undeploy the application, in the *Service* view, expand Servers/Glassfish Server/Applications, right click the *jakartaee8-starter* node, click *Undeploy* to undeploy it from Glassfish server.
68 |
69 |
--------------------------------------------------------------------------------
/docs/index.md:
--------------------------------------------------------------------------------
1 | # Kickstart a Jakarta EE 8 Application
2 |
3 | * [An introduction to Jakarta EE](./00overview.md)
4 | * [Setup local development environment](./01setup.md)
5 | * [Understanding application architecture](./02understand-app.md)
6 | * [Deploying applications to Application Servers](./03run.md)
7 | * [Getting Jakarta EE 8 compatible application servers](./03run-get-appservers.md)
8 | * [Deploying applications to Glassfish Server](./03run-glassfish.md)
9 | * [Using Eclipse IDE](./03run-glassfish-eclipse.md)
10 | * [Using NetBeans IDE](./03run-glassfish-nb.md)
11 | * [Using Cargo Maven Plugin](./03run-glassfish-mvn.md)
12 | * [The Hard Way](./03run-glassfish-m.md)
13 | * [Deploying applications to Payara Server](./03run-payara.md)
14 | * [Deploying applications to WildFly Server](./03run-wildfly.md)
15 | * [Using Eclipse IDE](./03run-wildfly-eclipse.md)
16 | * [Using NetBeans IDE](./03run-wildfly-nb.md)
17 | * [Using WildFly Maven Plugin](./03run-wildfly-mvn.md)
18 | * [The Hard Way](./03run-wildfly-m.md)
19 | * [Deploying applications to Open Liberty Server](./03run-openliberty.md)
20 | * [Using Eclipse IDE](./03run-openliberty-eclipse.md)
21 | * [Using Liberty Maven Plugin](./03run-openliberty-mvn.md)
22 | * [The Hard Way](./03run-openliberty-m.md)
23 | * [Testing Jarakta EE applications](./04test.md)
24 |
25 | * [Getting Started with JBoss Arquillian](./04test-arq-intro.md)
26 | * [Running tests on Glassfish Server](./04test-arq-glassfish.md)
27 | * [Glassfish Managed Container Adapter](./04test-arq-glassfish-managed.md)
28 | * [Glassfish Remote Container Adapter](./04test-arq-glassfish-remote.md)
29 | * [Glassfish Embedded Container Adapter](./04test-arq-glassfish-embedded.md)
30 | * [Running tests on Payara Server](./04test-arq-payara.md)
31 | * [Payara Managed Container Adapter](./04test-arq-payara-managed.md)
32 | * [Payara Remote Container Adapter](./04test-arq-payara-remote.md)
33 | * [Payara Embedded Container Adapter](./04test-arq-payara-embedded.md)
34 | * [Payara Micro Managed Container Adapter](./04test-arq-payara-micro-managed.md)
35 | * [Running tests on WildFly Server](./04test-arq-wildfly.md)
36 | * [WildFly Managed Container Adapter](./04test-arq-wildfly-managed.md)
37 | * [WildFly Remote Container Adapter](./04test-arq-wildfly-remote.md)
38 | * [WildFly Embedded Container Adapter](./04test-arq-wildfly-embedded.md)
39 | * [Running tests on Open Liberty Server](./04test-arq-openliberty.md)
40 | * [Open Liberty Managed Container Adapter](./04test-arq-openliberty-managed.md)
41 | * [Open Liberty Remote Container Adapter](./04test-arq-openliberty-remote.md)
42 | * [Put to production](./05prod.md)
43 | * [Running Application Servers in Docker](./05prod-appservers-in-docker.md)
44 | * [Dockerizing your Applications](./05prod-dockerizing-app.md)
45 | * [Deploying on Cloud](./05prod-k8s.md)
46 |
47 |
48 | ## Resources
49 |
50 | * [Open Liberty Maven Plugin](https://github.com/openliberty/ci.maven)
51 | * [WildFly Maven Plugin (wildfly-maven-plugin)](https://docs.jboss.org/wildfly/plugins/maven/latest/index.html)
52 | * [Deploying to Payara Server Using the Maven Cargo Plugin](https://blog.payara.fish/deploying-to-payara-server-using-the-maven-cargo-plugin) by Payara Blog
53 | * [Cargo Maven2 Plugin for Glassfish v5](https://codehaus-cargo.github.io/cargo/GlassFish+5.x.html)
--------------------------------------------------------------------------------
/src/test/java/com/example/it/GreetingResourceTest.java:
--------------------------------------------------------------------------------
1 | package com.example.it;
2 |
3 | import com.example.*;
4 | import org.jboss.arquillian.container.test.api.Deployment;
5 | import org.jboss.arquillian.junit.Arquillian;
6 | import org.jboss.arquillian.test.api.ArquillianResource;
7 | import org.jboss.shrinkwrap.api.ShrinkWrap;
8 | import org.jboss.shrinkwrap.api.asset.EmptyAsset;
9 | import org.jboss.shrinkwrap.api.spec.WebArchive;
10 | import org.junit.After;
11 | import org.junit.Before;
12 | import org.junit.Test;
13 | import org.junit.runner.RunWith;
14 |
15 | import javax.ws.rs.client.Client;
16 | import javax.ws.rs.client.ClientBuilder;
17 | import javax.ws.rs.client.WebTarget;
18 | import javax.ws.rs.core.MediaType;
19 | import javax.ws.rs.core.Response;
20 | import java.net.MalformedURLException;
21 | import java.net.URL;
22 | import java.util.logging.Level;
23 | import java.util.logging.Logger;
24 |
25 | import static org.junit.Assert.assertEquals;
26 | import static org.junit.Assert.assertTrue;
27 |
28 | @RunWith(Arquillian.class)
29 | public class GreetingResourceTest {
30 | private final static Logger LOGGER = Logger.getLogger(GreetingResourceTest.class.getName());
31 |
32 | @Deployment(testable = false)
33 | public static WebArchive createDeployment() {
34 | return ShrinkWrap.create(WebArchive.class)
35 | .addClass(GreetingMessage.class)
36 | .addClass(GreetingService.class).addClass(SimpleGreetingService.class)
37 | .addClasses(GreetingResource.class, JaxrsActivator.class)
38 | // Enable CDI
39 | .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
40 | }
41 |
42 | @ArquillianResource
43 | private URL base;
44 |
45 | private Client client;
46 |
47 | @Before
48 | public void setup() {
49 | this.client = ClientBuilder.newClient();
50 | try {
51 | LOGGER.log(Level.INFO, " Registering 'com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider' in OpenLiberty/CXF JAX-RS Client ");
52 | Class> clazz = Class.forName("com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider");
53 | this.client.register(clazz);
54 | } catch (ClassNotFoundException e) {
55 | LOGGER.warning("Failed to register 'com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider'. OpenLiberty/CXF does not register a json provider automatically. Please ignore this warning for none OpenLiberty Servers.");
56 | }
57 |
58 | }
59 |
60 | @After
61 | public void teardown() {
62 | if (this.client != null) {
63 | this.client.close();
64 | }
65 | }
66 |
67 | @Test
68 | public void should_create_greeting() throws MalformedURLException {
69 | LOGGER.log(Level.INFO, " Running test:: GreetingResourceTest#should_create_greeting ... ");
70 | final WebTarget greetingTarget = client.target(new URL(base, "api/greeting/JakartaEE").toExternalForm());
71 | try (final Response greetingGetResponse = greetingTarget.request()
72 | .accept(MediaType.APPLICATION_JSON)
73 | .get()) {
74 | assertEquals("response status is ok", 200, greetingGetResponse.getStatus());
75 | assertTrue("message should start with \"Say Hello to JakartaEE at \"",
76 | greetingGetResponse.readEntity(GreetingMessage.class).getMessage().startsWith("Say Hello to JakartaEE"));
77 |
78 | }
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/docs/03run-wildfly-eclipse.md:
--------------------------------------------------------------------------------
1 | # Deploying applications to WildFly Server using Eclipse IDE
2 |
3 | [toc]
4 |
5 | ## Install Redhat CodeReady Studio
6 |
7 | If you installed [Redhat CodeReady Studio](https://developers.redhat.com/products/codeready-studio/overview) instead of the official Eclipse IDE, skip this step.
8 |
9 | Follow the following steps to install Redhat CodeReady Studio plugin into the existing Eclipse IDE.
10 |
11 | 1. Open Eclipse Marketplace from *Help*-> *Eclipse Marketplace* menu.
12 | 2. Click the *Redhat* icon in the bottom *Marketplaces* area of *Eclipse Marketplace* dialog to switch to *Redhat* marketplace.
13 | 3. Select *Redhat CodeReady Studio*, click the *Install* button to install it.
14 | 4. After it is installed, restart Eclipse IDE to apply the plugin.
15 |
16 | Next let's create a WildFly Server instance.
17 |
18 | ## Add a WildFly Server instance
19 |
20 | Right click on the blank area in the *Servers* view, select *New*->*Server* in the context menu.
21 |
22 |
23 |
24 |
25 |
26 | Expand *JBoss Community* node in the tree list, select WildFly 18, click *Next* button.
27 |
28 |
29 |
30 | In the *Create a new Server Adapter* step, use the default selections, click *Next* button.
31 |
32 |
33 |
34 | In the *JBoss Runtime*, select the WildFly server location in your system, click *Finish* button.
35 |
36 | After it is done, there is a WildFly instance in the *Servers* view.
37 |
38 |
39 |
40 |
41 |
42 | ## Start and Stop WildFly server
43 |
44 | To start WildFly Server, right click the WildFly node in the *Servers* view, and click *Start* in the context menu.
45 |
46 | To stop WildFly Server, right click the WildFly node in the *Servers* view, and click *Stop* in the context menu.
47 |
48 | ## Deploy and undeploy applications
49 |
50 | Ok, let's try to run the application on WildFly server.
51 |
52 | In the *Project* or *Packages* view, right click the project node, and click *Run As...*-> *Run on Server*.
53 |
54 | 
55 |
56 | If the Wildlfy is not started, it will start the server firstly, then build, package and deploy the application into the WildFly Server.
57 |
58 | After it is started , open your terminal, try to access the sample endpoint `api/greeting/{name}` via `curl` command.
59 |
60 | ```bash
61 | curl http://localhost:8080/jakartaee8-starter/api/greeting/hantsy
62 | {"message":"Say Hello to hantsy at 2019-12-03T16:34:59.095"}
63 | ```
64 |
65 | To undeploy the application, just right click the *jakartaee8-starter* node under the *WildFly* instance node in the *Servers* view, and click *Remove* in the context menu. It will start undeploying the application, you can see the progress in the *Console* view.
66 |
67 | ```bash
68 | 16:36:13,619 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 8) WFLYUT0022: Unregistered web context: '/jakartaee8-starter' from server 'default-server'
69 | 16:36:13,670 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) WFLYSRV0028: Stopped deployment jakartaee8-starter.war (runtime-name: jakartaee8-starter.war) in 80ms
70 | 16:36:13,758 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0009: Undeployed "jakartaee8-starter.war" (runtime-name: "jakartaee8-starter.war")
71 | ```
72 |
73 |
--------------------------------------------------------------------------------
/src/test/java/com/example/it/OrderResourceTest.java:
--------------------------------------------------------------------------------
1 | package com.example.it;
2 |
3 | import com.example.JaxrsActivator;
4 | import com.example.cart.*;
5 | import org.jboss.arquillian.container.test.api.Deployment;
6 | import org.jboss.arquillian.junit.Arquillian;
7 | import org.jboss.arquillian.test.api.ArquillianResource;
8 | import org.jboss.shrinkwrap.api.ShrinkWrap;
9 | import org.jboss.shrinkwrap.api.asset.EmptyAsset;
10 | import org.jboss.shrinkwrap.api.spec.WebArchive;
11 | import org.junit.After;
12 | import org.junit.Before;
13 | import org.junit.Test;
14 | import org.junit.runner.RunWith;
15 |
16 | import javax.ws.rs.client.Client;
17 | import javax.ws.rs.client.ClientBuilder;
18 | import javax.ws.rs.client.WebTarget;
19 | import javax.ws.rs.core.GenericType;
20 | import javax.ws.rs.core.MediaType;
21 | import javax.ws.rs.core.Response;
22 | import java.net.MalformedURLException;
23 | import java.net.URL;
24 | import java.util.List;
25 | import java.util.logging.Level;
26 | import java.util.logging.Logger;
27 |
28 | import static org.junit.Assert.assertEquals;
29 |
30 | @RunWith(Arquillian.class)
31 | public class OrderResourceTest {
32 | private final static Logger LOGGER = Logger.getLogger(OrderResourceTest.class.getName());
33 |
34 | @Deployment(testable = false)
35 | public static WebArchive createDeployment() {
36 | return ShrinkWrap.create(WebArchive.class)
37 | .addClass(OrderDao.class)
38 | .addClass(PurchaseOrder.class)
39 | .addClass(OrderItem.class)
40 | .addClass(SampleDataGenerator.class)
41 | .addClasses(OrderResource.class, JaxrsActivator.class)
42 | .addClasses(OrderDto.class, OrderItemDto.class, OrderDtoAssembler.class, OrderItemDtoAssembler.class)
43 | .addAsResource("META-INF/persistence.xml", "META-INF/persistence.xml")
44 | // Enable CDI
45 | .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
46 | }
47 |
48 | @ArquillianResource
49 | private URL base;
50 |
51 | private Client client;
52 |
53 | @Before
54 | public void setup() {
55 | this.client = ClientBuilder.newClient();
56 | try {
57 | LOGGER.log(Level.INFO, " Registering 'com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider' in OpenLiberty/CXF JAX-RS Client ");
58 | Class> clazz = Class.forName("com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider");
59 | this.client.register(clazz);
60 | } catch (ClassNotFoundException e) {
61 | LOGGER.warning("Failed to register 'com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider'. OpenLiberty/CXF does not register a json provider automatically. Please ignore this warning for none OpenLiberty Servers.");
62 | }
63 |
64 | }
65 |
66 | @After
67 | public void teardown() {
68 | if (this.client != null) {
69 | this.client.close();
70 | }
71 | }
72 |
73 | @Test
74 | public void shouldGetAllOrders() throws MalformedURLException {
75 | LOGGER.log(Level.INFO, " Running test:: OrderResourceTest#shouldGetAllOrders ... ");
76 | final WebTarget allOrdersTarget = client.target(new URL(base, "api/orders").toExternalForm());
77 | try (final Response getAllOrdersResponse = allOrdersTarget.request()
78 | .accept(MediaType.APPLICATION_JSON)
79 | .get()) {
80 | assertEquals("response status is ok", 200, getAllOrdersResponse.getStatus());
81 | assertEquals(1, getAllOrdersResponse.readEntity(new GenericType>() { }).size());
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/docs/04test-arq-wildfly-embedded.md:
--------------------------------------------------------------------------------
1 | # WildFly Embedded Container Adapter
2 |
3 | Open the *pom.xml* file, check the **arq-wildfly-embedded** profile.
4 |
5 | ```xml
6 |
7 |
9 |
10 | arq-wildfly-embedded
11 |
12 | false
13 |
14 |
15 |
16 | org.jboss.resteasy
17 | resteasy-client
18 | ${resteasy.version}
19 | test
20 |
21 |
22 | org.jboss.resteasy
23 | resteasy-jackson2-provider
24 | ${resteasy.version}
25 | test
26 |
27 |
28 | org.wildfly.arquillian
29 | wildfly-arquillian-container-embedded
30 | ${wildfly-arquillian.version}
31 | test
32 |
33 |
34 |
35 |
36 |
37 | org.apache.maven.plugins
38 | maven-dependency-plugin
39 | ${maven-dependency-plugin.version}
40 |
41 |
42 | unpack
43 | pre-integration-test
44 |
45 | unpack
46 |
47 |
48 |
49 |
50 | org.wildfly
51 | wildfly-dist
52 | ${wildfly.version}
53 | zip
54 | false
55 | ${project.build.directory}
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | maven-failsafe-plugin
64 | ${maven-failsafe-plugin.version}
65 |
66 |
67 | ${project.build.directory}/wildfly-${wildfly.version}
68 |
69 |
70 | org.jboss.logmanager.LogManager
71 |
72 |
73 |
74 |
75 |
76 |
77 | ```
78 |
79 | It adds a `wildfly-arquillian-container-embedded` dependency instead, other config is similar with the **arq-wildfly-managed** profile.
80 |
81 | Run the tests.
82 |
83 | ```bash
84 | mvn clean verify -Parq-wildfly-embedded
85 | ```
86 |
87 |
--------------------------------------------------------------------------------
/docs/03run-wildfly-mvn.md:
--------------------------------------------------------------------------------
1 | # Deploying applications to WildFly Server using WildFly Maven plugin
2 |
3 | Redhat WildFly has official maven plugin support for application deployment and application server management.
4 |
5 | Declare a WildFly maven plugin in the pom.xml file.
6 |
7 | ```xml
8 |
9 |
10 |
11 | org.wildfly.plugins
12 | wildfly-maven-plugin
13 | 2.0.1.Final
14 |
15 | ```
16 |
17 | The `wildfly:start` goal will start an server instance, if there is no server instance configured, it will download the newest WildFly redistribution or define a `wilfly.version` property to specify a version , and extract the files, and start it in an embedded mode.
18 |
19 | If you want to reuse your local WildFly server you have downloaded before, configure a `jbossHome` property in the `configuration` of WildFly maven plugin or an external `wildfly.home` property.
20 |
21 | ```xml
22 |
23 | org.wildfly.plugins
24 | wildfly-maven-plugin
25 | ${wildfly-maven-plugin.version}
26 |
27 |
28 |
29 |
30 | ...
31 |
32 |
33 | ...
34 |
35 |
36 | ...
37 |
38 |
39 | ```
40 |
41 | If the WildFly server instance is running, and run the following command to start deployment.
42 |
43 | ```bash
44 | mvn package wildfly:deploy
45 | ```
46 |
47 | More simply, execute `mvn deploy:run` to start a WildFly server instance and start the deployment immediately.
48 |
49 | WildFly maven plugin also support of deploying to remote WildFly server instance. Configure the host properties.
50 |
51 | ```xml
52 |
53 | org.wildfly.plugins
54 | wildfly-maven-plugin
55 | ${wildfly-maven-plugin.version}
56 |
57 |
58 |
59 | localhost
60 | 9990
61 | admin
62 | admin
63 |
64 |
65 | ```
66 |
67 | Username and password are sensitive info, you can follow the Maven rule, and configure them in the Maven global settings.xml file(*~/.m2/settings.xml*).
68 |
69 | ```xml
70 |
71 | ...
72 |
73 | ...
74 |
75 | wildfly-svr
76 | localhost
77 | 9990
78 | admin
79 | admin
80 |
81 |
82 |
83 | ```
84 | Then configure the server id in the maven plugin configuration.
85 |
86 | ```xml
87 |
88 | org.wildfly.plugins
89 | wildfly-maven-plugin
90 | ${wildfly-maven-plugin.version}
91 |
92 | ...
93 | wildfly-svr
94 |
95 |
96 | ```
97 |
98 | Make sure it it running, run `mvn wildfly:deploy` to start deployment.
99 |
100 | Use `wildfly:undeploy` goal to undeploy an application from a running WildFly server.
101 |
102 | You can also add some configuration to WildFly by maven plugin, such as registering a JDDC driver module, configuring a DataSource, etc, more information please read the [Wildfy maven plugin documentation](https://docs.jboss.org/wildfly/plugins/maven/latest/index.html).
--------------------------------------------------------------------------------
/src/test/java/com/example/it/BasketEjbTest.java:
--------------------------------------------------------------------------------
1 | package com.example.it;
2 |
3 | import com.example.cart.Basket;
4 | import com.example.cart.OrderItem;
5 | import com.example.cart.PurchaseOrder;
6 | import org.jboss.arquillian.container.test.api.Deployment;
7 | import org.jboss.arquillian.junit.Arquillian;
8 | import org.jboss.shrinkwrap.api.ShrinkWrap;
9 | import org.jboss.shrinkwrap.api.asset.EmptyAsset;
10 | import org.jboss.shrinkwrap.api.spec.JavaArchive;
11 | import org.junit.Before;
12 | import org.junit.Test;
13 | import org.junit.runner.RunWith;
14 |
15 | import javax.annotation.Resource;
16 | import javax.ejb.EJB;
17 | import javax.persistence.EntityManager;
18 | import javax.persistence.PersistenceContext;
19 | import javax.sql.DataSource;
20 | import java.sql.SQLException;
21 | import java.util.logging.Level;
22 | import java.util.logging.Logger;
23 |
24 | @RunWith(Arquillian.class)
25 | public class BasketEjbTest {
26 | private final static Logger LOGGER = Logger.getLogger(BasketEjbTest.class.getName());
27 |
28 | @Deployment
29 | public static JavaArchive createDeployment() {
30 | return ShrinkWrap.create(JavaArchive.class)
31 | .addClass(Basket.class)
32 | .addClass(PurchaseOrder.class)
33 | .addClass(OrderItem.class)
34 | .addClass(DbUtil.class)
35 | .addAsManifestResource("META-INF/persistence.xml", "persistence.xml")
36 | .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
37 | }
38 |
39 | @EJB
40 | Basket basket;
41 |
42 | @PersistenceContext
43 | EntityManager entityManager;
44 |
45 | @Resource(lookup = "java:comp/DefaultDataSource")
46 | DataSource dataSource;
47 |
48 |
49 | private DbUtil dbUtil;
50 |
51 | @Before()
52 | public void setup() throws SQLException {
53 | dbUtil = new DbUtil(dataSource);
54 | dbUtil.clearTables();
55 | }
56 | // @Test
57 | // @InSequence(1)
58 | // public void testNewOrder() throws Exception {
59 | // LOGGER.log(Level.INFO, " Running test:: Basket :: new order ... ");
60 | // basket.newOrder();
61 | // assertCount(0);
62 | // assertEquals(0, this.entityManager.createQuery("select po from PurchaseOrder po", PurchaseOrder.class)
63 | // .getResultList().size());
64 | // }
65 | //
66 | // @Test
67 | // @InSequence(2)
68 | // public void testAddProductsToCarts() throws Exception {
69 | // LOGGER.log(Level.INFO, " Running test:: Basket :: add products... ");
70 | // basket.add("Apple", 4);
71 | // basket.add("Orange", 5);
72 | // assertCount(0);
73 | // assertEquals(0, this.entityManager.createQuery("select po from PurchaseOrder po", PurchaseOrder.class)
74 | // .getResultList().size());
75 | // }
76 | //
77 | // @Test
78 | // @InSequence(3)
79 | // public void testCheckout() throws Exception {
80 | // LOGGER.log(Level.INFO, " Running test:: Basket:: checkout ... ");
81 | // basket.checkout();
82 | // assertCount(1);
83 | // assertEquals(1, this.entityManager.createQuery("select po from PurchaseOrder po", PurchaseOrder.class)
84 | // .getResultList().size());
85 | // }
86 |
87 | @Test
88 | public void testNewOrder() throws Exception {
89 | LOGGER.log(Level.INFO, " Running test:: Basket :: new order... ");
90 | basket.newOrder();
91 | dbUtil.assertCount("PurchaseOrder", 0);
92 | dbUtil.assertCount("OrderItem", 0);
93 |
94 | LOGGER.log(Level.INFO, " Running test:: Basket :: add products to basket... ");
95 | basket.add("Apple", 4);
96 | basket.add("Orange", 5);
97 | dbUtil.assertCount("PurchaseOrder", 0);
98 | dbUtil.assertCount("OrderItem", 0);
99 |
100 | LOGGER.log(Level.INFO, " Running test:: Basket :: checkout... ");
101 | basket.checkout();
102 | dbUtil.assertCount("PurchaseOrder", 1);
103 | dbUtil.assertCount("OrderItem", 2);
104 | }
105 |
106 |
107 | }
108 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Jakarta EE 8 Starter Boilerplate
2 |
3 | 
4 |
5 | 
6 |
7 | 
8 | 
9 |
10 | 
11 |
12 | 
13 | 
14 | 
15 |
16 | 
17 | 
18 |
19 |
20 | ## What is it?
21 |
22 | [Jakarta EE 8 starter](https://github.com/hantsy/jakartaee8-starter) is a boilerplate project to help you to bootstrap a new Java EE 8/Jakarta EE 8 application in seconds.
23 |
24 | If you want to explore the real world Jakarta EE 8 applications based on JSF, JAX-RS and MVC, check the following projects which are derived from this project.
25 |
26 | * [Jakarta Faces Sample](https://github.com/hantsy/jakartaee-faces-sample)
27 | * [Jakarta MVC Sample](https://github.com/hantsy/jakartaee-mvc-sample)
28 | * [Jakarta Jaxrs Sample](https://github.com/hantsy/jakartaee-jaxrs-sample)
29 |
30 |
31 | ## Build
32 |
33 | Make sure you have installed the latest JDK 8 and Apache Maven 3.6.
34 |
35 | Execute the following command to build a clean package locally.
36 |
37 | ```bash
38 | mvn clean package
39 | ```
40 | More details of testing and further deployments on application severs, check the [docs](https://hantsy.github.io/jakartaee8-starter-boilerplate/).
41 |
42 | ## Docs
43 |
44 | There is [a comprehensive setup guide](https://hantsy.github.io/jakartaee8-starter-boilerplate/) available for the Jakarta EE newbies, including:
45 |
46 | 1. Setup local development environment with the popular IDEs, such as:
47 | * Apache NetBeans IDE
48 | * Eclipse IDE
49 | * IntelliJ IDEA.
50 | 2. Deploy and Run application on the popular application servers, such as:
51 | * Glassfish
52 | * WildFly
53 | * Open Liberty
54 | 3. Testing Jakarta components using Junit and JBoss Arquillian.
55 | 4. Publish application into production environment.
56 |
57 |
58 | ## Resources
59 |
60 | * [WildFly Maven Plugin (wildfly-maven-plugin)](https://docs.jboss.org/wildfly/plugins/maven/latest/index.html)
61 | * [Deploying to Payara Server Using the Maven Cargo Plugin](https://blog.payara.fish/deploying-to-payara-server-using-the-maven-cargo-plugin) by Payara Blog
62 | * [Cargo Maven2 Plugin for Glassfish v5](https://codehaus-cargo.github.io/cargo/GlassFish+5.x.html)
63 | * [Video course on efficient enterprise testing](https://blog.sebastian-daschner.com/entries/efficient-testing-video-course)
64 | * [Testing Java EE 7 Applications in Docker with Arquillian-Cube](https://blogs.oracle.com/developers/testing-java-ee-7-applications-in-docker-with-arquillian-cube)
65 | * [Testing HTML and JSF-Based UIs with Arquillian](https://blogs.oracle.com/javamagazine/testing-html-and-jsf-based-uis-with-arquillian)
66 | * [Jakarta EE & Wildfly Running on Kubernetes](https://dzone.com/articles/jakarta-ee-amp-wildfly-running-on-kubernetes#)
67 | * [Building Self-Contained and Configurable Java EE Applications](http://dplatz.de/blog/2018/self-contained-jee-app.html)
68 | * [Switching between data sources when using @DataSourceDefinition](http://jdevelopment.nl/switching-data-sources-datasourcedefinition/)
69 | * [The state of @DataSourceDefinition in Java EE](https://henk53.wordpress.com/2012/06/30/the-state-of-datasourcedefinition-in-java-ee/)
70 |
--------------------------------------------------------------------------------
/docs/03run-glassfish-eclipse.md:
--------------------------------------------------------------------------------
1 | # Deploying applications to Glassfish Server using Eclipse IDE
2 |
3 | Follow the following steps to deploy and run the application on Glassfish in Eclipse IDE.
4 |
5 | [toc]
6 |
7 | ## Installing Glassfish tools
8 |
9 | First of all, follow the following steps to install [Eclipse Glassfish Tools](https://projects.eclipse.org/projects/webtools.glassfish-tools/) plugin into Eclipse IDE.
10 |
11 | 1. Open Eclipse Marketplace from *Help*-> *Eclipse Marketplace* menu.
12 | 2. Type *Glassfish* in the search box to filter Glassfish plugins.
13 | 3. In the search result, find *Glassfish tools* , click the *Install* button to install it.
14 | 4. After it is installed, restart Eclipse IDE to apply the plugin.
15 |
16 | Next let's create a Glassfish Server instance.
17 |
18 | ## Adding a Glassfish Server instance
19 |
20 | If the *Servers* view is not opened, try to open it first. Click *Windows*->*Show Views* -> *Servers* from Eclipse main menu.
21 |
22 | Alternatively try to open the Java EE Perspective, click *Windows*-> *Perspective*->*Open Perspective*-> *Other...* from the main menu, and find the *Java EE* perspective in the popup *Perspective* window, it will open a series of views for this perspective, including the *Servers* view.
23 |
24 | In the *Servers* view, right click on the blank area, select *New*->*Server* in the context menu. It starts a *New Server* wizard to set up a server instance.
25 |
26 |
27 |
28 | In the *New Server* wizard, the first step is *Define a New Server*, select *Glassfish* in the server type tree, and click *Next* button.
29 |
30 |
31 |
32 | In the *Glassfish runtime properties* step, you can name the server instance, select the Glassfish location from local machine, and choose a JDK 8 to run Glassfish, click *Next* button.
33 |
34 |
35 |
36 | In the *Glassfish Application Server properties* step, it allows you to setup domain info and the administration properties, let's use the default values, click *Finish* button.
37 |
38 | There is a new node will be appeared in the *Servers* view.
39 |
40 |
41 |
42 | It is easy to control the application server in the *Servers* view, such as start, stop, restart, deploy and undeploy, etc.
43 |
44 | ## Start and Stop Glassfish Server
45 |
46 | Right click the *Glassfish* node, and select *Start* to start Glassfish server. After it is started successfully, under the Glassfish node, it will include the resources in the Glassfish server.
47 |
48 |
49 |
50 | To stop Glassfish Server, just click *Stop* in the context menu, or select *Glassfish* node, and click the *stop* button in the toolbar of the *Servers* view.
51 |
52 |
53 |
54 | ## Deploy and undeploy applications
55 |
56 | Ok, let's try to run our sample application on the Glassish server.
57 |
58 | In the *Project* or *Packages* view, right click the project node, and click *Run As...*-> *Run on Server* in the context menu.
59 |
60 |
61 |
62 | In the *Run on Server* dialog, select *Glassfish*, and click *Finish* button. Wait for seconds, it will build, package and deploy the application into Glassfish server.
63 |
64 | When it is done, you will see there is a *Deployed Applications* under the Glassfish node in the *Servers* view. Expand this node, there is a *jakartaee8-starter* node, it is our application running on the Glassfish server.
65 |
66 |
67 |
68 | Open your terminal, try to access the sample endpoint `api/greeting/{name}` via `curl` command.
69 |
70 | ```bash
71 | curl http://localhost:8080/jakartaee8-starter/api/greeting/hantsy
72 | {"message":"Say Hello to hantsy at 2019-12-03T14:05:28.437"}
73 | ```
74 |
75 | To undeploy the application, in *Servers* view, expand *Glassfish 5*->*Glassfish Management*->*Deployed Applications*, right click *jakartaee8-starter*, click *Undeploy* in the context menu.
76 |
77 | Or right click *Glassfish 5*-> *jakartaee8-starter*, click *Remove* in the context menu.
--------------------------------------------------------------------------------
/docs/04test-arq-glassfish-embedded.md:
--------------------------------------------------------------------------------
1 | # Glassfish Embedded Container Adapter
2 |
3 | Open the *pom.xml* file, check the **arq-glassfish-embedded** profile.
4 |
5 | ```xml
6 |
7 |
8 |
9 | arq-glassfish-embedded
10 |
11 | false
12 |
13 |
14 |
15 |
45 |
46 |
47 | org.glassfish.main.extras
48 | glassfish-embedded-all
49 | ${glassfish.version}
50 | test
51 |
52 |
53 | org.jboss.arquillian.container
54 | arquillian-glassfish-embedded-3.1
55 | ${arquillian-glassfish.version}
56 | test
57 |
58 |
59 |
60 |
61 |
62 | org.apache.maven.plugins
63 | maven-failsafe-plugin
64 | ${maven-failsafe-plugin.version}
65 |
66 |
67 | **/it/GreetingResourceTest*
68 |
69 |
70 |
71 |
72 |
73 |
74 | ```
75 |
76 | Besides adding `arquillian-glassfish-embedded-3.1` as dependency, add an extra `glassfish-embedded-all` as dependencies. The controller(Glassfish Embedded Container Adapter) is fully responsible for the lifecycle of the embedded Glassfish , and will run with the embedded Glassfish in the same JVM process.
77 |
78 | Run the tests using the following command.
79 |
80 | ```bash
81 | mvn clean verify -Parq-glassfish-embedded
82 | ```
83 |
84 | The result info is like :
85 |
86 | ```bash
87 | ...
88 | [INFO] Results:
89 | [INFO]
90 | [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
91 | [INFO]
92 | [INFO]
93 | [INFO] --- maven-failsafe-plugin:3.0.0-M4:verify (integration-test) @ jakartaee8-starter ---
94 | [INFO] ------------------------------------------------------------------------
95 | [INFO] BUILD SUCCESS
96 | [INFO] ------------------------------------------------------------------------
97 | [INFO] Total time: 32.238 s
98 | [INFO] Finished at: 2020-02-22T20:07:21+08:00
99 | [INFO] ------------------------------------------------------------------------
100 | ```
101 |
102 | > Unfortunately, I can not get the JAX-RS test run successfully on Glassfish Embedded Container Adapter, see issue [arquillian/arquillian-container-glassfish#62](https://github.com/arquillian/arquillian-container-glassfish/issues/62).
103 |
104 |
--------------------------------------------------------------------------------
/docs/03run-glassfish-m.md:
--------------------------------------------------------------------------------
1 | # Deploying applications to Glassfish Server - The Hard Way
2 |
3 | Download a copy of [Glassfish v5.1](https://projects.eclipse.org/projects/ee4j.glassfish/downloads), and extract files into your local system.
4 |
5 | ## Start and Stop Glassfish Server
6 |
7 | In the *<Glassfish dir>/glassfish/bin* folder, there are a few command tools used to control Glassfish server.
8 |
9 | Open your terminal, enter *<Glassfish dir>/glassfish/bin*.
10 |
11 | Execute the following command to start Glassfish Server.
12 |
13 | ```bash
14 | # Linux
15 | ./startserv.sh
16 | # windows
17 | startserv
18 | ```
19 |
20 | By default, it will start with the default domain *doman1*, if you want to start the server with a different one, add the domain name to the command line.
21 |
22 | ```bash
23 | startserv domain2
24 | ```
25 |
26 | To stop a running Glassfish Server, jus terminate the process by *Ctrl+C* , or execute the following command in another terminal window.
27 |
28 | ```bash
29 | # Linux
30 | ./stopserv.sh
31 | # windows
32 | stopserv
33 | ```
34 |
35 | Alternatively, you can use the *asadmin* utility in *<Glassfish dir>/bin* to start the server with a specific domain *in background*.
36 |
37 | ```bash
38 | # asadmin start-domain domain1
39 | Waiting for domain1 to start ................................................
40 | Successfully started the domain : domain1
41 | domain Location: D:\appsvr\glassfish5\glassfish\domains\domain1
42 | Log File: D:\appsvr\glassfish5\glassfish\domains\domain1\logs\server.log
43 | Admin Port: 4848
44 | Command start-domain executed successfully.
45 | ```
46 |
47 | Similarly, use `asadmin stop-domain domain1` to stop a domain.
48 |
49 | ```bash
50 | # asadmin stop-domain domain1
51 | Waiting for the domain to stop .
52 | Command stop-domain executed successfully.
53 | ```
54 |
55 |
56 |
57 | ## Deploy applications
58 |
59 | Firstly package the application into a **war** package.
60 | ```bash
61 | # mvn clean package
62 | ...
63 | [INFO] --- maven-war-plugin:2.2:war (default-war) @ jakartaee8-starter ---
64 | ...
65 | [INFO] Building war: D:\hantsylabs\jakartaee8-starter\target\jakartaee8-starter.war
66 | [INFO] ------------------------------------------------------------------------
67 | [INFO] BUILD SUCCESS
68 | [INFO] ------------------------------------------------------------------------
69 | [INFO] Total time: 12.449 s
70 | [INFO] Finished at: 2020-02-18T17:50:43+08:00
71 | [INFO] ------------------------------------------------------------------------
72 | ```
73 | After it is done there is a *jakartaee8-starter.war* is located in the *target* folder.
74 |
75 | Copy this file to *<Glassfish dir>/glassfish/domains/domain1/autodeploy/*.
76 |
77 | In the Glassfish console, you will see the following deployment info.
78 |
79 | ```bash
80 | Selecting file D:\appsvr\glassfish5\glassfish\domains\domain1\autodeploy\jakartaee8-starter.war for autodeployment
81 | ...
82 | Clustered CDI Event bus initialized|
83 | ...
84 | Initializing Soteria 1.1-b01 for context '/jakartaee8-starter'
85 | ...
86 | Loading application [jakartaee8-starter] at [/jakartaee8-starter]
87 | ...
88 | jakartaee8-starter was successfully deployed in 1,956 milliseconds
89 | ...
90 | [AutoDeploy] Successfully autodeployed : D:\appsvr\glassfish5\glassfish\domains\domain1\autodeploy\jakartaee8-starter.war.
91 | ```
92 |
93 | To undeploy an applicaiton, just delete *jakartaee8-starter.war* in the *<Glassfish dir>/glassfish/domains/domain1/autodeploy/*.
94 |
95 | In the Glassfish console, it displays the undeployment progress.
96 |
97 | ```bash
98 | Autoundeploying application: jakartaee8-starter
99 | ...
100 | [AutoDeploy] Successfully autoundeployed : D:\appsvr\glassfish5\glassfish\domains\domain1\autodeploy\jakartaee8-starter.war.
101 | ```
102 |
103 | ## Add an administration user
104 |
105 | An administrator user is required to access [Admin Console](http://localhost:4848) or remote deployment from Maven plugin, etc.
106 |
107 | By default, Glassfish shipped an **admin** user with an empty password. You can set the password by `asadmin` command.
108 |
109 | Enter *<Glassfish dir>/bin* , execute the following command to start changing the password of the admin user.
110 |
111 | ```bash
112 | # asadmin change-admin-password
113 | Enter admin user name [default: admin]>
114 | Enter the admin password>
115 | Enter the new admin password>
116 | Enter the new admin password again>
117 | Command change-admin-password executed successfully.
118 | ```
119 | > Before you execute this command, make sure your Glassfish server is running.
120 |
121 |
--------------------------------------------------------------------------------
/docs/03run-openliberty-eclipse.md:
--------------------------------------------------------------------------------
1 | # Deploying applications to Open Liberty Server using Eclipse IDE
2 |
3 |
4 |
5 | ## Install Open Liberty Developer Tools
6 |
7 | To manage Open Liberty server in Eclipse IDE, you should install Open Liberty Developer tools pluign.
8 |
9 | Follow the following steps to install Open Liberty Developer Tools plugin into Eclipse IDE.
10 |
11 | 1. Open Eclipse Marketplace from *Help*-> *Eclipse Marketplace* menu.
12 | 2. Type *Liberty* in the search box and hit *Enter* to search it.
13 | 3. In the result list, find *IBM Liberty Developer Tools* , then click *Install* button to start the installation.
14 | 4. After it is installed, restart Eclipse IDE to apply the plugin.
15 |
16 | Next let's create an Open Liberty Server instance.
17 |
18 |
19 |
20 | ## Add an Open Liberty Server instance
21 |
22 | Right click on the blank area in the *Servers* view, select *New*->*Server* in the context menu.
23 |
24 |
25 |
26 |
27 | Expand *IBM* node in the tree list, select *Liberty*, and click *Next* button.
28 |
29 |
30 |
31 | In the *Liberty Runtime Environmentr* step, set the Liberty location, click *Next* button.
32 |
33 |
34 |
35 | In the *New Liberty Server*, there is a ** template** field, make sure *javaee-8.0* is selected, others use the default values, click *Finish* button.
36 |
37 | After it is done, there is a Liberty Server instance in the *Servers* view.
38 |
39 |
40 |
41 |
42 |
43 | ## Start and Stop Open Liberty Server
44 |
45 | To start Open Liberty Server, right click the *LibertyServer* node in the *Servers* view, and click *Start* in the context menu.
46 |
47 | To stop Open Liberty Server, right click the *LibertyServer* node in the *Servers* view, and click *Stop* in the context menu.
48 |
49 | ## Deploy and undeploy application
50 |
51 | Ok, let's try to run the application on Open Liberty server.
52 |
53 | In the *Project* or *Packages* view, right click the project node, and click *Run As...*-> *Run on Server*.
54 |
55 | 
56 |
57 | If the Liberty server is not started, it will start the server firstly, then build, package and deploy the application into the Liberty Server.
58 |
59 | If it is first time to run Liberty server, it will popup a dialog for you to setup the keystore. Set up it as you like.
60 |
61 | After it is started successfully, you can see the following like info in the Console view.
62 |
63 | ```bash
64 | [AUDIT ] CWPKI0803A: SSL certificate created in 4.902 seconds. SSL key file: D:/appsvr/wlp/usr/servers/defaultServer/resources/security/key.p12
65 | [AUDIT ] CWWKI0001I: The CORBA name server is now available at corbaloc:iiop:localhost:2809/NameService.
66 | [AUDIT ] CWWKT0016I: Web application available (default_host): http://localhost:9080/jakartaee8-starter/
67 | [AUDIT ] CWWKZ0001I: Application jakartaee8-starter started in 2.888 seconds.
68 | [AUDIT ] CWWKF0012I: The server installed the following features: [appClientSupport-1.0, appSecurity-2.0, appSecurity-3.0, batch-1.0, beanValidation-2.0, cdi-2.0, concurrent-1.0, distributedMap-1.0, ejb-3.2, ejbHome-3.2, ejbLite-3.2, ejbPersistentTimer-3.2, ejbRemote-3.2, el-3.0, j2eeManagement-1.1, jacc-1.5, jaspic-1.1, javaMail-1.6, javaee-8.0, jaxb-2.2, jaxrs-2.1, jaxrsClient-2.1, jaxws-2.2, jca-1.7, jcaInboundSecurity-1.0, jdbc-4.2, jms-2.0, jndi-1.0, jpa-2.2, jpaContainer-2.2, jsf-2.3, jsonb-1.0, jsonp-1.1, jsp-2.3, localConnector-1.0, managedBeans-1.0, mdb-3.2, servlet-4.0, ssl-1.0, wasJmsClient-2.0, wasJmsSecurity-1.0, wasJmsServer-1.0, webProfile-8.0, websocket-1.1].
69 | [AUDIT ] CWWKF0011I: The defaultServer server is ready to run a smarter planet. The defaultServer server started in 54.255 seconds.
70 | ```
71 |
72 | Now open your terminal, try to access the sample endpoint `api/greeting/{name}` via `curl` command.
73 |
74 |
75 | ```bash
76 | curl http://localhost:9080/jakartaee8-starter/api/greeting/hantsy
77 | {"message":"Say Hello to hantsy at 2019-12-03T21:34:00.033"}
78 | ```
79 |
80 | >Note, Liberty Server uses 9080 as port by default.
81 |
82 | To undeploy the application, just right click the *jakartaee8-starter* node under the *Liberty Server* instance node in the *Servers* view, and click *Remove* in the context menu. It will start undeploying the application, you can see the progress in the *Console* view.
83 |
84 | ```bash
85 | [AUDIT ] CWWKG0016I: Starting server configuration update.
86 | [AUDIT ] CWWKG0017I: The server configuration was successfully updated in 0.800 seconds.
87 | [AUDIT ] CWWKT0017I: Web application removed (default_host): http://localhost:9080/jakartaee8-starter/
88 | [AUDIT ] CWWKZ0009I: The application jakartaee8-starter has stopped successfully.
89 | ```
--------------------------------------------------------------------------------
/docs/05prod-appservers-in-docker.md:
--------------------------------------------------------------------------------
1 | # Running Application Servers in Docker
2 |
3 | In the [Deploying applications to Application Servers](./03run.md), we explored how to utilize the deployments scan to deploy a Jakarta EE application on application servers, such as [Glassfish](./03run-glassfish-m.md), [Payara](./03run-payara-m.md), [WildFly](./03run-wildfly-m.md), [Open Liberty](./03run-openliberty-m.md).
4 |
5 | With the deployments scan feature, it is easy to deploy a Jakarta EE application to an application server that running in a Docker container.
6 |
7 | Assume you have installed Docker in your local development environment. If not, check the official [Docker installation guide](https://docs.docker.com/install/) to install it firstly.
8 |
9 | ## Payara Server
10 |
11 | Once Docker is installed, you can start a Payara server with the `docker`command quickly.
12 |
13 | ```bash
14 | docker run -p 8080:8080 -p 4848:4848 -v ./deployments:/opt/payara/deployments payara/server-full
15 | ```
16 |
17 | If this is your first time to run this command, it will take some seconds or minutes to download the *payara/server-full* docker image firstly, the create a docker using *payara/server-full* image. Please be patient and drink a cup of coffee.
18 |
19 | After it is running, copy the packaged war archive to the location *./deployments*. The Payara server will scan the */opt/payara/deployments* in docker to deploy it automatically.
20 |
21 | More simply, you can start a Payara server by `docker-compose`. There is a Docker compose file [*docker-compose.yml*](https://github.com/hantsy/jakartaee8-starter/blob/master/docker-compose.yml) available in the root of [jakartaee8-starter](https://github.com/hantsy/jakartaee8-starter) .
22 |
23 | Run the following command to start a Payara server using `docker-compose` command.
24 |
25 | ```bash
26 | docker-compose up payara
27 | ```
28 |
29 | In the [*docker-compose.yml*](https://github.com/hantsy/jakartaee8-starter/blob/master/docker-compose.yml) , it defines a service for payara server.
30 |
31 | ```yaml
32 | version: '3.3' # specify docker-compose version
33 |
34 | # Define the services/containers to be run
35 | services:
36 | payara:
37 | image: payara/server-full
38 | ports:
39 | - "8080:8080"
40 | - "8181:8181" # HTTPS listener
41 | - "4848:4848" # HTTPS admin listener
42 | - "9009:9009" # Debug port
43 | restart: always
44 | # environment:
45 | # JVM_ARGS: ""
46 | # - "AS_ADMIN_MASTERPASSWORD=admin" #default password is `changeit`
47 | volumes:
48 | - ./deployments:/opt/payara/deployments
49 | ```
50 |
51 |
52 |
53 | ## WildFly Server
54 |
55 | Similar with Payara server, start a WildFly server with `docker` command like this.
56 |
57 | ```bash
58 | docker run -p 8080:8080 -p 9990:9990 -v ./deployments:/opt/jboss/wildfly/standalone/deployments/ -it jboss/wildfly /opt/jboss/wildfly/bin/standalone.sh -b 0.0.0.0 -bmanagement 0.0.0.0
59 | ```
60 |
61 | When it is running, copy *jakartaee8-starter.war* to to the location *./deployments*. It will scan it and deploy it automatically.
62 |
63 | Alternatively, start a WildFly server via `docker-compose` command.
64 |
65 | ```bash
66 | docker-compose up wildfly
67 | ```
68 |
69 | The *wildfly* services defined in the [*docker-compose.yml*](https://github.com/hantsy/jakartaee8-starter/blob/master/docker-compose.yml).
70 |
71 | ```yaml
72 | version: '3.3' # specify docker-compose version
73 |
74 | # Define the services/containers to be run
75 | services:
76 | ...
77 | wildfly:
78 | image: jboss/wildfly
79 | ports:
80 | - "8080:8080"
81 | - "9990:9990" # admin listener
82 | restart: always
83 | command: /opt/jboss/wildfly/bin/standalone.sh -b 0.0.0.0 -bmanagement 0.0.0.0
84 | # environment:
85 | volumes:
86 | - ./deployments:/opt/jboss/wildfly/standalone/deployments/
87 | ```
88 |
89 |
90 |
91 | ## Open Liberty Server
92 |
93 | Start a Open Liberty Server with `docker` command.
94 |
95 | ```bash
96 | docker run -p 9080:9080 -p 9443:9443 -v ./deployments:/config/dropins open-liberty:full
97 | ```
98 |
99 | Instead, start a Open Liberty Server by `docker-compose` command. Define a *service* in the *docker-compose.yml* file.
100 |
101 | ```yaml
102 | version: '3.3' # specify docker-compose version
103 |
104 | # Define the services/containers to be run
105 | services:
106 | ...
107 | openliberty:
108 | image: open-liberty:full
109 | ports:
110 | - "9080:9080"
111 | - "9443:9443" # HTTPS listener
112 | restart: always
113 | # command: configure.sh # use for open-liberty:kernel image.
114 | # environment:
115 | volumes:
116 | - ./deployments:/config/dropins
117 | ```
118 |
119 | > Unfortunately, there is no official Glassfish v5.1 in docker hub. There are some third party Glassfish docker images available, such as [adam-bien's docklands](http://www.adam-bien.com/roller/abien/entry/jakarta_ee_eclipse_glassfish_5), [jelastic/glassfish](https://hub.docker.com/r/jelastic/glassfish).
120 |
121 |
--------------------------------------------------------------------------------
/docs/04test-arq-wildfly-remote.md:
--------------------------------------------------------------------------------
1 | # WildFly Remote Container Adapter
2 |
3 | Open the *pom.xml* file, check the **arq-wildfly-remote** profile.
4 |
5 | ```xml
6 |
7 | arq-wildfly-remote
8 |
9 | false
10 |
11 |
12 |
13 | org.jboss.resteasy
14 | resteasy-client
15 | ${resteasy.version}
16 | test
17 |
18 |
19 | org.jboss.resteasy
20 | resteasy-jackson2-provider
21 | ${resteasy.version}
22 | test
23 |
24 |
25 | org.wildfly.arquillian
26 | wildfly-arquillian-container-remote
27 | ${wildfly-arquillian.version}
28 | test
29 |
30 |
31 |
32 |
33 |
34 | maven-failsafe-plugin
35 | ${maven-failsafe-plugin.version}
36 |
37 |
38 | wildfly-remote
39 | org.jboss.logmanager.LogManager
40 |
41 |
42 |
43 |
44 |
45 |
46 | ```
47 |
48 | The content of `wildfly-remote` qualifier in the *src/test/resources/arquillian.xml*.
49 |
50 | ```xml
51 |
52 |
53 |
54 | 127.0.0.1
55 | 9990
56 | http-remoting
57 | admin
58 | Admin@123
59 |
60 |
61 | ```
62 |
63 | Run the tests.
64 |
65 | ```bash
66 | mvn clean verify -Parq-wildfly-remote
67 | ```
68 |
69 | You will the following info in the console.
70 |
71 | ```bash
72 | [INFO] --- maven-failsafe-plugin:3.0.0-M4:integration-test (integration-test) @ jakartaee8-starter ---
73 | [INFO]
74 | [INFO] -------------------------------------------------------
75 | [INFO] T E S T S
76 | [INFO] -------------------------------------------------------
77 | [INFO] Running com.example.it.GreetingResourceTest
78 | [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 11.022 s - in com.example.it.GreetingResourceTest
79 | [INFO] Running com.example.it.GreetingServiceTest
80 | [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.834 s - in com.example.it.GreetingServiceTest
81 | [INFO]
82 | [INFO] Results:
83 | [INFO]
84 | [INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
85 | [INFO]
86 | [INFO]
87 | [INFO] --- maven-failsafe-plugin:3.0.0-M4:verify (integration-test) @ jakartaee8-starter ---
88 | [INFO] ------------------------------------------------------------------------
89 | [INFO] BUILD SUCCESS
90 | [INFO] ------------------------------------------------------------------------
91 | [INFO] Total time: 27.782 s
92 | [INFO] Finished at: 2020-02-23T18:22:09+08:00
93 | [INFO] ------------------------------------------------------------------------
94 | ```
95 |
96 | More logs of the WildFly server, check the content of the *server.log* in the *< WildFly dir>/standalone/log* folder.
97 |
98 | ```bash
99 | ...
100 | 18:21:57,075 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) WFLYSRV0027: Starting deployment of "34fea863-e144-445e-ae22-c2736ba8915b.war" (runtime-name: "34fea863-e144-445e-ae22-c2736ba8915b.war")
101 | ...
102 | 18:22:03,208 INFO [org.jboss.as.server] (management-handler-thread - 1) WFLYSRV0010: Deployed "34fea863-e144-445e-ae22-c2736ba8915b.war" (runtime-name : "34fea863-e144-445e-ae22-c2736ba8915b.war")
103 | ...
104 | 18:22:04,587 INFO [org.jboss.as.server] (management-handler-thread - 1) WFLYSRV0009: Undeployed "34fea863-e144-445e-ae22-c2736ba8915b.war" (runtime-name: "34fea863-e144-445e-ae22-c2736ba8915b.war")
105 | ...
106 | 18:22:05,929 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0027: Starting deployment of "test.war" (runtime-name: "test.war")
107 | ...
108 | 18:22:08,322 INFO [org.jboss.as.server] (management-handler-thread - 1) WFLYSRV0010: Deployed "test.war" (runtime-name : "test.war")
109 | ...
110 | 18:22:08,576 INFO [org.jboss.as.server] (management-handler-thread - 1) WFLYSRV0009: Undeployed "test.war" (runtime-name: "test.war")
111 | ```
112 |
113 |
--------------------------------------------------------------------------------
/docs/03run-openliberty-m.md:
--------------------------------------------------------------------------------
1 | # Deploying applications to Open Liberty Server - The Hard Way
2 |
3 | Download Open Liberty [from openliberty.io download page](https://openliberty.io/downloads/), and extract files into your local system.
4 |
5 |
6 |
7 | ## Create a Server profile
8 |
9 | Unlike Glassfish or WildFly server, Open Liberty does not provide a default domain.
10 |
11 | Locate to *<Open Liberty dif>/bin*, execute the following command to create a new server profile.
12 |
13 | ```bash
14 | server create
15 | Server defaultServer created.
16 | ```
17 | Open *<Open Liberty dif>/usr/servers*, there is a new *defaultServer* folder created. In this folder, there are some files and folder are generated for your application deployment.
18 |
19 | Open the *server.xml* file, it already included *javaee-8.0* feature. There are several templates allow you create a server profile quickly with essential features, more templates check *<Open Liberty dif>/templates/servers*.
20 |
21 | Try to run the following command to create a **microProfile3** profile with the name *mp3* and the template *microProfile3*.
22 |
23 | ```bash
24 | server create mp3 --template="microProfile3"
25 | Server mp3 created.
26 | ```
27 |
28 | ## Start and Stop Open Liberty Server
29 |
30 | In the *<Open Liberty dir>/bin* folder, execute the following command to start Open Liberty Server.
31 |
32 | ```bash
33 | # server start
34 | Starting server defaultServer.
35 | Server defaultServer started.
36 | ```
37 |
38 | By default, it will start the **defaultServer**. You can specify the server name to start a different server.
39 |
40 | ```bash
41 | # server start mp3
42 | Starting server mp3.
43 | Server mp3 started.
44 | ```
45 |
46 | To start a server with verbose mode, use the following command instead.
47 |
48 | ```bash
49 | server run
50 | Launching defaultServer (Open Liberty 20.0.0.1/wlp-1.0.36.cl200120200108-0300) on OpenJDK 64-Bit Server VM, version 11.0.6+10 (en_US)
51 | [AUDIT ] CWWKE0001I: The server defaultServer has been launched.
52 | [WARNING ] CWWKS3103W: There are no users defined for the BasicRegistry configuration of ID com.ibm.ws.security.registry.basic.config[basic].
53 | [AUDIT ] CWWKZ0058I: Monitoring dropins for applications.
54 | [AUDIT ] CWPKI0820A: The default keystore has been created using the 'keystore_password' environment variable.
55 | [AUDIT ] CWWKI0001I: The CORBA name server is now available at corbaloc:iiop:localhost:2809/NameService.
56 | [AUDIT ] CWWKF0012I: The server installed the following features: [appClientSupport-1.0, appSecurity-2.0, appSecurity-3.0, batch-1.0, beanValidation-2.0, cdi-2.0, concurrent-1.0, distributedMap-1.0, ejb-3.2, ejbHome-3.2, ejbLite-3.2, ejbPersistentTimer-3.2, ejbRemote-3.2, el-3.0, j2eeManagement-1.1, jacc-1.5, jaspic-1.1, javaMail-1.6, javaee-8.0, jaxb-2.2, jaxrs-2.1, jaxrsClient-2.1, jaxws-2.2, jca-1.7, jcaInboundSecurity-1.0, jdbc-4.2, jms-2.0, jndi-1.0, jpa-2.2, jpaContainer-2.2, jsf-2.3, jsonb-1.0, jsonp-1.1, jsp-2.3, managedBeans-1.0, mdb-3.2, servlet-4.0, ssl-1.0, wasJmsClient-2.0, wasJmsSecurity-1.0, wasJmsServer-1.0, webProfile-8.0, websocket-1.1].
57 | [AUDIT ] CWWKF0011I: The defaultServer server is ready to run a smarter planet. The defaultServer server started in 9.205 seconds.
58 | ```
59 |
60 |
61 |
62 | To stop a running Open Liberty Server, execute the following command in another terminal window.
63 |
64 | ```bash
65 | # server stop
66 | Stopping server defaultServer.
67 | Server defaultServer stopped.
68 | ```
69 |
70 |
71 |
72 | ## Deploy applications
73 |
74 | Firstly build the project and package it into a war package.
75 | ```bash
76 | # mvn clean package
77 | ...
78 | [INFO] --- maven-war-plugin:2.2:war (default-war) @ jakartaee8-starter ---
79 | ...
80 | [INFO] Building war: D:\hantsylabs\jakartaee8-starter\target\jakartaee8-starter.war
81 | [INFO] ------------------------------------------------------------------------
82 | [INFO] BUILD SUCCESS
83 | [INFO] ------------------------------------------------------------------------
84 | [INFO] Total time: 12.449 s
85 | [INFO] Finished at: 2020-02-18T17:50:43+08:00
86 | [INFO] ------------------------------------------------------------------------
87 | ```
88 | After it is done there is a *jakartaee8-starter.war* is located in the *target* folder.
89 |
90 | Copy this file to *<Open Liberty dir>/usr/servers/defaultServer/dropins*.
91 |
92 | In the Open Liberty console, you will see the following deployment info.
93 |
94 | ```bash
95 | [AUDIT ] CWWKT0016I: Web application available (default_host): http://localhost:9080/jakartaee8-starter/
96 | [AUDIT ] CWWKZ0001I: Application jakartaee8-starter started in 2.902 seconds.
97 | ```
98 |
99 | To undeploy an applicaiton, just delete *jakartaee8-starter.war* in the *<Open Liberty dir>/usr/servers/defaultServer/dropins/*.
100 |
101 | In the Open Liberty console, it displays the undeployment progress.
102 |
103 | ```bash
104 | [AUDIT ] CWWKT0017I: Web application removed (default_host): http://localhost:9080/jakartaee8-starter/
105 | [AUDIT ] CWWKZ0009I: The application jakartaee8-starter has stopped successfully.
106 | ```
107 |
108 |
--------------------------------------------------------------------------------
/docs/04test-arq-openliberty-remote.md:
--------------------------------------------------------------------------------
1 | # Open Liberty Remote Container Adapter
2 |
3 | Open the *pom.xml* file, check the **arq-liberty-remote** profile.
4 |
5 | ```xml
6 |
7 |
8 | arq-liberty-remote
9 |
10 | false
11 |
12 |
13 |
14 | io.openliberty.arquillian
15 | arquillian-liberty-remote
16 | ${arquillian-liberty.version}
17 |
18 |
19 | org.apache.cxf
20 | cxf-rt-rs-client
21 | ${cxf.version}
22 | test
23 |
24 |
25 | com.fasterxml.jackson.jaxrs
26 | jackson-jaxrs-json-provider
27 | 2.10.1
28 |
29 |
30 | org.apache.cxf
31 | cxf-rt-transports-http-hc
32 | ${cxf.version}
33 | test
34 |
35 |
36 |
37 |
38 |
39 | src/test/arq-liberty-remote
40 |
41 | *
42 |
43 |
44 | server.xml
45 |
46 |
47 |
48 |
49 |
50 | maven-failsafe-plugin
51 | ${maven-failsafe-plugin.version}
52 |
53 |
54 | liberty-remote
55 | ${project.build.testOutputDirectory}/logging.properties
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | ```
64 |
65 | The following is the content of the *arquillian.xml*.
66 |
67 | ```xml
68 |
69 |
70 | localhost
71 | defaultServer
72 | admin
73 | admin
74 | 9080
75 | 9443
76 |
77 |
78 | ```
79 |
80 | To run the tests, you need a running Open Liberty server, and allow our Arquillian controller to connect it.
81 |
82 | Create a server profile by `server` command in the Open Liberty dist, or copy *server.xml* from *src/test/arq-liberty-remote* to *Open Liberty_dir/usr/servers/defaultServer*.
83 |
84 | The content of our sample server.xml.
85 |
86 | ```xml
87 |
88 |
89 |
90 |
91 |
92 | javaee-8.0
93 | restConnector-2.0
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 | ${server.config.dir}/dropins
104 |
105 |
108 |
109 |
110 |
111 |
112 |
113 | ```
114 |
115 | In the above *server.xml* file.
116 |
117 | * The `restConnector-2.0` is required to support remote connection.
118 | * The `quickStartSecurity` is used to setup an administrative account quickly.
119 | * The `remoteFileAccess` allows `${server.config.dir}/dropins` is writable, and to receive deployments.
120 | * Set a `keyStore` and ensure the client to connect to this server securely.
121 |
122 | Start up the Open Liberty server, it will generate the resources for the new server profile, including the keystore files in *${server.config.dir}/resources/security*.
123 |
124 | If you run the tests, you will got a failure about authorization.
125 |
126 | Follow these steps to import the server certification and make it trusted by your client's JDK.
127 |
128 | * Export the certification from the `jks` file in the *${server.config.dir}/resources/security* folder of Open Liberty server.
129 |
130 | ```bash
131 | keytool -export -alias default -file testwlp.crt -keystore key.jks
132 | ```
133 |
134 | * Import `.crt` into the JDK you are running the tests.
135 |
136 | ```
137 | keytool -import -trustcacerts -keystore $JAVA_HOME/jre/lib/security/cacerts -storepass changeit -alias testwlp -file testwlp.crt
138 | ```
139 |
140 | More details about the usage of `keytool` command, see [keytool documentation](https://docs.oracle.com/javase/8/docs/technotes/tools/unix/keytool.html).
141 |
142 | Now let's run the tests.
143 |
144 | ```bash
145 | mvn clean verify -Parq-liberty-remote
146 | ```
147 |
148 |
--------------------------------------------------------------------------------
/docs/03run-wildfly-m.md:
--------------------------------------------------------------------------------
1 | # Deploying applications to WildFly Server - The Hard Way
2 |
3 | Download a copy of [WildFly](https://wildfly.org/downloads), and extract files into your local system.
4 |
5 | ## Start and Stop WildFly Server
6 |
7 | In the *<WildFly dir>/bin* folder, there are a few command tools used to manage WildFly server.
8 |
9 | Open your terminal, enter *<WildFly dir>/bin*.
10 |
11 | Execute the following command to start WildFly Servers in **standalone** mode.
12 |
13 | ```bash
14 | # Linux
15 | ./standalone.sh
16 | # windows
17 | standalone
18 | ```
19 |
20 | Execute the following command to start WildFly Servers in **domain** mode.
21 |
22 | ```bash
23 | # Linux
24 | ./domain.sh
25 | # windows
26 | domain
27 | ```
28 |
29 | To stop a running WildFly Server, jus terminate the process by *Ctrl+C*.
30 |
31 | ## Deploy applications
32 |
33 | Firstly package the application into a **war** package.
34 | ```bash
35 | # mvn clean package
36 | ...
37 | [INFO] --- maven-war-plugin:2.2:war (default-war) @ jakartaee8-starter ---
38 |
39 | [INFO] Packaging webapp
40 | [INFO] Assembling webapp [jakartaee8-starter] in [D:\hantsylabs\jakartaee8-starter\target\jakartaee8-starter]
41 | [INFO] Processing war project
42 | [INFO] Copying webapp resources [D:\hantsylabs\jakartaee8-starter\src\main\webapp]
43 | [INFO] Webapp assembled in [65 msecs]
44 | [INFO] Building war: D:\hantsylabs\jakartaee8-starter\target\jakartaee8-starter.war
45 | [INFO] ------------------------------------------------------------------------
46 | [INFO] BUILD SUCCESS
47 | [INFO] ------------------------------------------------------------------------
48 | [INFO] Total time: 12.449 s
49 | [INFO] Finished at: 2020-02-18T17:50:43+08:00
50 | [INFO] ------------------------------------------------------------------------
51 | ```
52 | After it done there is a *jakartaee8-starter.war* is located in the *target* folder.
53 |
54 | Copy this file to *<WildFly dir>/standalone/deployments*.
55 |
56 | In the WildFly console, you will see the following deployment info.
57 |
58 | ```bash
59 | 17:54:48,491 INFO [org.jboss.as.repository] (DeploymentScanner-threads - 1) WFLYDR0001: Content added at location D:\appsvr\wildfly\standalone\data\content\ac\d8ebc6d4327b6e9b1ec92b10186d2fe7fdda89\content
60 | 17:54:48,515 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0027: Starting deployment of "jakartaee8-starter.war" (runtime-name: "jakartaee8-starter.war")
61 | 17:54:52,510 INFO [org.jboss.weld.deployer] (MSC service thread 1-4) WFLYWELD0003: Processing weld deployment jakartaee8-starter.war
62 | 17:54:53,474 INFO [org.hibernate.validator.internal.util.Version] (MSC service thread 1-4) HV000001: Hibernate Validator 6.0.17.Final
63 | 17:54:53,932 INFO [org.jboss.weld.Version] (MSC service thread 1-3) WELD-000900: 3.1.2 (Final)
64 | 17:54:53,987 INFO [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-8) ISPN000128: Infinispan version: Infinispan 'Infinity Minus ONE +2' 9.4.16.Final
65 | 17:54:54,396 INFO [io.smallrye.metrics] (MSC service thread 1-2) MicroProfile: Metrics activated
66 | 17:54:54,453 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 76) WFLYCLINF0002: Started client-mappings cache from ejb container
67 | 17:54:55,626 INFO [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 76) RESTEASY002225: Deploying javax.ws.rs.core.Application: class com.example.JaxrsActivator
68 | 17:54:55,787 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 76) WFLYUT0021: Registered web context: '/jakartaee8-starter' for server 'default-server'
69 | 17:54:55,883 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0010: Deployed "jakartaee8-starter.war" (runtime-name : "jakartaee8-starter.war")
70 | ```
71 |
72 | To undeploy an applicaiton, just delete *jakartaee8-starter.war.deployed* in the *<WildFly dir>/standalone/deployments*.
73 |
74 | In the WildFly console, there is undeployment info displayed.
75 |
76 | ```bash
77 | 17:57:41,787 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0009: Undeployed "jakartaee8-starter.war" (runtime-name: "jakartaee8-starter.war")
78 | ```
79 |
80 | ## Add an administration user
81 |
82 | Admin user is required to access [management console](http://localhost:9990) or remote deployment from Maven plugin, etc.
83 |
84 | Enter *<WildFly dir>/bin* , execute `add-user` to add a user.
85 |
86 | ```bash
87 | # add-user
88 |
89 | What type of user do you wish to add?
90 | a) Management User (mgmt-users.properties)
91 | b) Application User (application-users.properties)
92 | (a):
93 |
94 | Enter the details of the new user to add.
95 | Using realm 'ManagementRealm' as discovered from the existing property files.
96 | Username : admin
97 | User 'admin' already exists and is disabled, would you like to...
98 | a) Update the existing user password and roles
99 | b) Enable the existing user
100 | c) Type a new username
101 | (a): b
102 | Updated user 'admin' to file 'D:\appsvr\wildfly\standalone\configuration\mgmt-users.properties'
103 | Updated user 'admin' to file 'D:\appsvr\wildfly\domain\configuration\mgmt-users.properties'
104 | Updated user 'admin' with groups null to file 'D:\appsvr\wildfly\standalone\configuration\mgmt-groups.properties'
105 | Updated user 'admin' with groups null to file 'D:\appsvr\wildfly\domain\configuration\mgmt-groups.properties'
106 | Press any key to continue . . .
107 | ```
108 | There is an existing *admin* user , just enable it. If you want to update the password and roles, run `add-user` again, the select *a) Update the existing user password and roles* in the second step, input your new password, add it to the required groups. There are seven groups available in WildFly.
109 |
110 | * Monitor
111 | * Operator
112 | * Maintainer
113 | * Deployer
114 | * Auditor
115 | * Administrator
116 | * SuperUser
117 |
118 | Assign **Administrator** role to *admin* user.
119 |
120 |
--------------------------------------------------------------------------------
/docs/04test-arq-glassfish-remote.md:
--------------------------------------------------------------------------------
1 | # Glassfish Remote Container Adapter
2 |
3 | Assume there is a running Glassfish server. In this case, the Glassfish Remote Container Adapter connects to the Glassfish server by deployment client APIs.
4 |
5 | Start the Glassfish server manually if it is not started.
6 |
7 | ```bash
8 | asadmin start-domain domain1
9 | ```
10 |
11 | > The Glassfish server can be a local server instance, or running on a remote server, make sure the management port 4848 is accessible.
12 |
13 | Open the *pom.xml*, and check the *arq-glassfish-remote* profile.
14 |
15 | ```xml
16 |
17 | arq-glassfish-remote
18 |
19 | false
20 |
21 |
22 |
23 |
24 |
25 | org.glassfish.jersey.media
26 | jersey-media-sse
27 | ${jersey.version}
28 | test
29 |
30 |
31 | org.glassfish.jersey.media
32 | jersey-media-json-binding
33 | ${jersey.version}
34 | test
35 |
36 |
37 | org.glassfish.jersey.inject
38 | jersey-hk2
39 | ${jersey.version}
40 | test
41 |
42 |
43 |
44 | org.glassfish.jersey.core
45 | jersey-client
46 | ${jersey.version}
47 | test
48 |
49 |
50 |
51 |
63 |
64 |
65 | org.jboss.arquillian.container
66 | arquillian-glassfish-remote-3.1
67 | ${arquillian-glassfish.version}
68 | test
69 |
70 |
71 |
72 |
73 |
74 | org.apache.maven.plugins
75 | maven-failsafe-plugin
76 | ${maven-failsafe-plugin.version}
77 |
78 |
79 |
80 | glassfish-remote
81 |
82 |
83 |
84 |
85 |
86 |
87 | ```
88 |
89 | In the configuration of `maven-failsafe-plugin`, there is a `arquillian.launch` property to specify which arquillian qualifier will be selected to run the test.
90 |
91 | Have a look at the `glassfish-remote` qualifier in *src/resources/arquillian.xml*.
92 |
93 | ```xml
94 |
95 |
96 | admin
97 | adminadmin
98 |
99 |
100 | ```
101 |
102 | Here we assume it connects to *localhost:4848*, and the admin password is changed to *adminadmin*.
103 |
104 | Run the tests.
105 |
106 | ```bash
107 | mvn clean verify -Parq-glassfish-remote
108 | ```
109 |
110 | You will see the following info in the console.
111 |
112 | ```bash
113 | [INFO] --- maven-failsafe-plugin:3.0.0-M4:integration-test (integration-test) @ jakartaee8-starter ---
114 | [INFO]
115 | [INFO] -------------------------------------------------------
116 | [INFO] T E S T S
117 | [INFO] -------------------------------------------------------
118 | [INFO] Running com.example.it.GreetingResourceTest
119 | Feb 22, 2020 7:25:32 PM org.jboss.arquillian.container.impl.MapObject populate
120 | WARNING: Configuration contain properties not supported by the backing object org.jboss.arquillian.container.glassfish.remote_3_1.GlassFishRestConfiguration
121 | Supported property names: [adminHttps, remoteServerHttpPort, libraries, type, remoteServerAddress, target, retries, remoteServerAdminPort, remoteServerAdminHttps, adminUser, authorisation, waitTimeMs, adminPort, properties, adminPassword, adminHost]
122 | Feb 22, 2020 7:25:46 PM com.example.it.GreetingResourceTest setup
123 | WARNING: Only use for Open Liberty/CXF which does not register a json provider automatically.
124 | [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 16.217 s - in com.example.it.GreetingResourceTest
125 | [INFO] Running com.example.it.GreetingServiceTest
126 | [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.217 s - in com.example.it.GreetingServiceTest
127 | [INFO]
128 | [INFO] Results:
129 | [INFO]
130 | [INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
131 | [INFO]
132 | [INFO]
133 | [INFO] --- maven-failsafe-plugin:3.0.0-M4:verify (integration-test) @ jakartaee8-starter ---
134 | [INFO] -----------------------------------------------------------------
135 | [INFO] BUILD SUCCESS
136 | [INFO] -----------------------------------------------------------------
137 | [INFO] Total time: 31.404 s
138 | [INFO] Finished at: 2020-02-22T19:25:53+08:00
139 | [INFO] -----------------------------------------------------------------
140 | ```
141 |
--------------------------------------------------------------------------------
/docs/03run-glassfish-mvn.md:
--------------------------------------------------------------------------------
1 | # Deploying applications to Glassfish Server using Cargo Maven Plugin
2 |
3 | The legacy official *maven-glassfish-plugin* is discontinued, but there is a better alternative existed. [Cargo](https://codehaus-cargo.github.io) project provide a common way to deploy the applications into Jakarta EE application servers by maven plugin, Ant tasks, and pure Java APIs. Most of the popular application servers are got supported. Generally, it provides 3 approaches to deploy applications.
4 |
5 | * Remote- Deploying to a running application server via client APIs
6 | * Local - Controlling the lifecycle of application servers such as start and stop, etc.
7 | * Embedded - Package the application and the application server into a single package and run it.
8 |
9 | Most of the application servers support remote and local deployment.
10 |
11 | ## Deploying to a running Glassfish server
12 |
13 | The following is using a maven profile to configure the remote deployment.
14 |
15 | ```xml
16 |
17 | glassfish-remote
18 |
19 |
20 |
21 | org.codehaus.cargo
22 | cargo-maven2-plugin
23 |
24 |
25 | glassfish5x
26 | remote
27 |
28 |
29 | runtime
30 |
31 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | org.glassfish.main.deployment
42 | deployment-client
43 | ${glassfish.version}
44 |
45 |
46 |
47 |
48 |
49 |
50 | ```
51 |
52 | It depends on the Glassfish deployment client, and if you have set the admin password in the target Glassfish server, try to set the related properties.
53 |
54 | Before deploying, make sure the Glassfish is running, then execute the following command to start deployment.
55 |
56 | ```bash
57 | mvn package cargo:deploy -Pglassfish-remote
58 | ```
59 |
60 | After it is deployed successfully, try to access the sample API endpoint.
61 |
62 | ## Deploying to a local Glassfish server
63 |
64 | Similarly, I use another maven profile to configure the local Glassfish server. You can use an existing Glassfish or download a fresh copy for deployment purpose as the following.
65 |
66 | ```xml
67 |
68 | glassfish-local
69 |
70 | ${project.build.directory}/glassfish5
71 | ${glassfish.home}/glassfish/domains
72 | domain1
73 |
74 |
75 |
76 |
77 | org.apache.maven.plugins
78 | maven-dependency-plugin
79 | ${maven-dependency-plugin.version}
80 |
81 |
82 | unpack
83 | process-resources
84 |
85 | unpack
86 |
87 |
88 |
89 |
90 |
96 | org.glassfish.main.distributions
97 | glassfish
98 | ${glassfish.version}
99 | zip
100 | false
101 | ${project.build.directory}
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | org.codehaus.cargo
110 | cargo-maven2-plugin
111 | ${cargo-maven2-plugin.version}
112 |
113 |
114 | glassfish5x
115 | installed
116 | ${glassfish.home}
117 |
118 |
119 | existing
120 | ${glassfish.domainDir}
121 |
122 | ${glassfish.domainName}
123 | 600000
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 | org.glassfish.main.deployment
132 | deployment-client
133 | ${glassfish.version}
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 | ```
142 |
143 | Run the following command to start the application server and deploy the application to the server.
144 |
145 | ```bash
146 | mvn clean package cargo:run -Pglassfish-local
147 | ```
148 |
149 | The `maven-dependency-plugin` will download a copy of Glassfish distribution and extract the files, then `cargo:run` goal will start the server, and deploy the application finally.
150 |
151 | More info about Cargo maven plugin for Glassfish, see [here](https://codehaus-cargo.github.io/cargo/GlassFish+5.x.html).
152 |
153 |
154 |
155 |
156 |
157 |
--------------------------------------------------------------------------------
/docs/04test-arq-payara-micro-managed.md:
--------------------------------------------------------------------------------
1 | # Payara Micro Managed Container Adapter
2 |
3 | Payara server provides a **micro** version of Payara server, which allow you start a Payara server with a single jar file.
4 |
5 | Payara also includes a Micro Managed Adapter to run tests against a Payara Micro dist.
6 |
7 | Open the *pom.xml* file, check the **arq-payara-micro** profile.
8 |
9 | ```xml
10 |
11 | arq-payara-micro
12 |
13 | false
14 |
15 |
16 |
17 |
18 |
19 | fish.payara.arquillian
20 | payara-client-ee8
21 | ${arquillian-payara-server.version}
22 | test
23 |
24 |
25 |
26 |
27 | fish.payara.arquillian
28 | arquillian-payara-micro-managed
29 | ${arquillian-payara-server.version}
30 | test
31 |
32 |
33 |
34 |
35 |
36 | org.apache.maven.plugins
37 | maven-dependency-plugin
38 | ${maven-dependency-plugin.version}
39 |
40 |
41 | unpack
42 | pre-integration-test
43 |
44 | copy
45 |
46 |
47 |
48 |
49 | fish.payara.extras
50 | payara-micro
51 | ${payara.version}
52 | jar
53 | false
54 | ${project.build.directory}
55 | payara-micro.jar
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | org.apache.maven.plugins
64 | maven-failsafe-plugin
65 | ${maven-failsafe-plugin.version}
66 |
67 |
68 | ${project.build.directory}/payara-micro.jar
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 | ```
79 |
80 | Use `maven-dependency-plugin` to download a copy of Payara Micro to the *target* folder, set a `MICRO_JAR` environment variable or a `payara.microJar` system property in the configuration of `maven-failsafe-plugin`. This adapter does not includes the jersey client libraries, add `payara-client-ee8` as dependencies.
81 |
82 | Run the tests with **arq-payara-micro** profile.
83 |
84 | ```bash
85 | mvn clean verify -Parq-payara-micro
86 | ```
87 |
88 | You will the following info in the console.
89 |
90 | ```bash
91 | ...
92 | [2020-02-23T16:50:30.161+0800] [] [INFO] [] [PayaraMicro] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1582447830161] [levelValue: 800] Payara Micro 5.194 #badassmicrofish (build 327) ready in 19,746 (ms)
93 |
94 | Feb 23, 2020 4:50:30 PM fish.payara.arquillian.container.payara.managed.PayaraMicroDeployableContainer deploy
95 | INFO: Payara Micro running on host: 192.168.10.2 port: 8403
96 | Feb 23, 2020 4:50:30 PM fish.payara.arquillian.container.payara.managed.PayaraMicroDeployableContainer printApplicationFound
97 | INFO: Deployed application detected. Name: "test".
98 | Feb 23, 2020 4:50:30 PM fish.payara.arquillian.container.payara.managed.PayaraMicroDeployableContainer printServletFound
99 | INFO: Servlet found. Name: "jsp".
100 | Feb 23, 2020 4:50:30 PM fish.payara.arquillian.container.payara.managed.PayaraMicroDeployableContainer printServletFound
101 | INFO: Servlet found. Name: "ArquillianServletRunner".
102 | Feb 23, 2020 4:50:30 PM fish.payara.arquillian.container.payara.managed.PayaraMicroDeployableContainer printServletFound
103 | INFO: Servlet found. Name: "jsp".
104 | Feb 23, 2020 4:50:30 PM fish.payara.arquillian.container.payara.managed.PayaraMicroDeployableContainer printServletFound
105 | INFO: Servlet found. Name: "default".
106 | [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 29.906 s - in com.example.it.GreetingServiceTest
107 | [INFO]
108 | [INFO] Results:
109 | [INFO]
110 | [INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
111 | [INFO]
112 | [INFO]
113 | [INFO] --- maven-failsafe-plugin:3.0.0-M4:verify (integration-test) @ jakartaee8-starter ---
114 | [INFO] ------------------------------------------------------------------------
115 | [INFO] BUILD SUCCESS
116 | [INFO] ------------------------------------------------------------------------
117 | [INFO] Total time: 01:13 min
118 | [INFO] Finished at: 2020-02-23T16:50:32+08:00
119 | [INFO] ------------------------------------------------------------------------
120 | ```
121 |
122 |
--------------------------------------------------------------------------------
/docs/04test-arq-glassfish-managed.md:
--------------------------------------------------------------------------------
1 | # Glassfish Managed Container Adapter
2 |
3 | Open *pom.xml*, check the **arq-glassfish-managed** profile.
4 |
5 | ```xml
6 |
7 | arq-glassfish-managed
8 |
9 | false
10 |
11 |
12 |
13 |
14 | org.glassfish.jersey.media
15 | jersey-media-sse
16 | ${jersey.version}
17 | test
18 |
19 |
20 | org.glassfish.jersey.media
21 | jersey-media-json-binding
22 | ${jersey.version}
23 | test
24 |
25 |
26 | org.glassfish.jersey.inject
27 | jersey-hk2
28 | ${jersey.version}
29 | test
30 |
31 |
32 |
33 | org.glassfish.jersey.core
34 | jersey-client
35 | ${jersey.version}
36 | test
37 |
38 |
39 |
40 |
52 |
53 |
54 | org.jboss.arquillian.container
55 | arquillian-glassfish-managed-3.1
56 | ${arquillian-glassfish.version}
57 | test
58 |
59 |
60 |
61 |
62 |
63 | org.apache.maven.plugins
64 | maven-dependency-plugin
65 | ${maven-dependency-plugin.version}
66 |
67 |
68 | unpack
69 | pre-integration-test
70 |
71 | unpack
72 |
73 |
74 |
75 |
76 | org.glassfish.main.distributions
77 | glassfish
78 | ${glassfish.version}
79 | zip
80 | false
81 | ${project.build.directory}
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 | org.apache.maven.plugins
90 | maven-failsafe-plugin
91 | ${maven-failsafe-plugin.version}
92 |
93 |
94 |
95 | ${project.build.directory}/glassfish5
96 |
97 |
98 |
99 |
100 |
101 |
102 | ```
103 |
104 | In the above codes, it adds `arquillian-glassfish-managed-3.1` as a dependency of *test* scope, which is required to serve *Glassfish Managed Container Adapter*.
105 |
106 | The Jersey Client related dependencies are required for JAX-RS testing, eg. the `GreetingResourceTest`.
107 |
108 | Here we use `maven-dependency-plugin` to prepare a refresh copy of Glassfish dist for the test, and unzip it to the path `${project.build.directory}`. In the configuration of `maven-failsafe-plugin`, set a `GLASSFISH_HOME` environment variable or configure a `glassfishHome` system property in the Arquillian configuration file - *src/test/resources/arquillian.xml*, specify its location to the `${project.build.directory}/glassfish5`.
109 |
110 | The *Glassfish Managed Container Adapter* controls the lifecycle of the managed Glassfish server, eg.
111 |
112 | * Start the Glassfish server
113 | * Deploy the test archive into the Glassfish server
114 | * Run tests in container
115 | * Undeploy the test archive
116 | * Stop the Glassfish server
117 |
118 | Execute the following command to run the tests against the **arq-glassfish-managed** profile.
119 |
120 | ```bash
121 | mvn clean verify -Parq-glassfish-managed
122 | ```
123 |
124 | You will see the following info in the console.
125 |
126 | ```bash
127 | [INFO] --- maven-failsafe-plugin:3.0.0-M4:integration-test (integration-test) @ jakartaee8-starter ---
128 | [INFO]
129 | [INFO] -------------------------------------------------------
130 | [INFO] T E S T S
131 | [INFO] -------------------------------------------------------
132 | [INFO] Running com.example.it.GreetingResourceTest
133 | Starting container using command: [java, -jar, D:\hantsylabs\jakartaee8-starter\target\glassfish5\glassfish\modules\admin-cli.jar, start-domain, -t]
134 | Attempting to start domain1.... Please look at the server log for more details.....
135 | Feb 22, 2020 6:17:24 PM com.example.it.GreetingResourceTest setup
136 | WARNING: Only use for Open Liberty/CXF which does not register a json provider automatically.
137 | [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 26.895 s - in com.example.it.GreetingResourceTest
138 | [INFO] Running com.example.it.GreetingServiceTest
139 | [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 50.739 s - in com.example.it.GreetingServiceTest
140 | Stopping container using command: [java, -jar, D:\hantsylabs\jakartaee8-starter\target\glassfish5\glassfish\modules\admin-cli.jar, stop-domain, -t]
141 | [INFO]
142 | [INFO] Results:
143 | [INFO]
144 | [INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
145 | [INFO]
146 | [INFO]
147 | [INFO] --- maven-failsafe-plugin:3.0.0-M4:verify (integration-test) @ jakartaee8-starter ---
148 | [INFO] -----------------------------------------------------------------
149 | [INFO] BUILD SUCCESS
150 | [INFO] -----------------------------------------------------------------
151 | [INFO] Total time: 01:51 min
152 | [INFO] Finished at: 2020-02-22T18:18:18+08:00
153 | [INFO] -----------------------------------------------------------------
154 | ```
155 |
--------------------------------------------------------------------------------
/docs/04test-arq-wildfly-managed.md:
--------------------------------------------------------------------------------
1 | # WildFly Managed Container Adapter
2 |
3 | Open the *pom.xml* file, check the **arq-wildfly-managed** profile.
4 |
5 | ```xml
6 |
7 | arq-wildfly-managed
8 |
9 | false
10 | standalone-full.xml
11 | ${project.build.directory}/wildfly-${wildfly.version}
12 |
13 |
14 |
15 | org.jboss.resteasy
16 | resteasy-client
17 | ${resteasy.version}
18 | test
19 |
20 |
21 | org.jboss.resteasy
22 | resteasy-jackson2-provider
23 | ${resteasy.version}
24 | test
25 |
26 |
27 | org.wildfly.arquillian
28 | wildfly-arquillian-container-managed
29 | ${wildfly-arquillian.version}
30 | test
31 |
32 |
33 |
34 |
35 |
36 |
37 | org.apache.maven.plugins
38 | maven-dependency-plugin
39 | ${maven-dependency-plugin.version}
40 |
41 |
42 | unpack
43 | pre-integration-test
44 |
45 | unpack
46 |
47 |
48 |
49 |
50 | org.wildfly
51 | wildfly-dist
52 | ${wildfly.version}
53 | zip
54 | false
55 | ${project.build.directory}
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | maven-failsafe-plugin
64 | ${maven-failsafe-plugin.version}
65 |
66 |
67 | ${project.build.directory}/wildfly-${wildfly.version}
68 |
69 |
70 | org.jboss.logmanager.LogManager
71 |
72 |
73 |
74 |
75 |
76 |
77 | ```
78 |
79 | In the above codes,
80 |
81 | * The `wildfly-arquillian-container-managed` is required for Arquillian WildFly Managed Container adapter.
82 | * The Resteay related dependencies are required for JAX-RS tests.
83 | * Use `maven-dependency-plugin` to download a copy of WildFly server to the *target* folder, and set `JBOSS_HOME` environment variable to use this downloaded WildFly in the `maven-failsafe-plugin`.
84 |
85 | Run the tests via the following command.
86 |
87 | ```bash
88 | mvn clean verify -Parq-wildfly-managed
89 | ```
90 |
91 | You will see the following info in the console.
92 |
93 | ```bash
94 | [INFO] --- maven-failsafe-plugin:3.0.0-M4:integration-test (integration-test) @ jakartaee8-starter ---
95 | [INFO]
96 | [INFO] -------------------------------------------------------
97 | [INFO] T E S T S
98 | [INFO] -------------------------------------------------------
99 | [INFO] Running com.example.it.GreetingResourceTest
100 | 17:46:24,519 INFO [org.jboss.modules] (main) JBoss Modules version 1.9.2.Final
101 | 17:46:26,697 INFO [org.jboss.msc] (main) JBoss MSC version 1.4.11.Final
102 | 17:46:26,727 INFO [org.jboss.threads] (main) JBoss Threads version 2.3.3.Final
103 | 17:46:26,954 INFO [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: WildFly Full 19.0.0.Beta2 (WildFly Core 11.0.0.Beta8) starting
104 | ...
105 | 17:46:33,763 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 19.0.0.Beta2 (WildFly Core 11.0.0.Beta8) started in 10021ms - Started 316 of 582 services (374 services are lazy, passive or on-demand)
106 | ...
107 | 17:46:34,207 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) WFLYSRV0027: Starting deployment of "39fd4362-55da-49b0-8164-7a7a3d92f19f.war" (runtime-name: "39fd4362-55da-49b0-8164-7a7a3d92f19f.war")
108 | ...
109 | 17:46:37,713 INFO [org.jboss.as.server] (management-handler-thread - 1) WFLYSRV0010: Deployed "39fd4362-55da-49b0-8164-7a7a3d92f19f.war" (runtime-name : "39fd4362-55da-49b0-8164-7a7a3d92f19f.war")
110 | ...
111 | 17:46:39,559 INFO [org.jboss.as.server] (management-handler-thread - 1) WFLYSRV0009: Undeployed "39fd4362-55da-49b0-8164-7a7a3d92f19f.war" (runtime-name: "39fd4362-55da-49b0-8164-7a7a3d92f19f.war")
112 | [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 19.854 s - in com.example.it.GreetingResourceTest
113 | [INFO] Running com.example.it.GreetingServiceTest
114 | ...
115 | 17:46:40,900 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) WFLYSRV0027: Starting deployment of "test.war" (runtime-name: "test.war")
116 | ...
117 | 17:46:41,819 INFO [org.jboss.as.server] (management-handler-thread - 1) WFLYSRV0010: Deployed "test.war" (runtime-name : "test.war")
118 | ...
119 | 17:46:42,195 INFO [org.jboss.as.server] (management-handler-thread - 1) WFLYSRV0009: Undeployed "test.war" (runtime-name: "test.war")
120 | [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.576 s - in com.example.it.GreetingServiceTest
121 | ...
122 | 17:46:42,436 INFO [org.jboss.as] (MSC service thread 1-8) WFLYSRV0050: WildFly Full 19.0.0.Beta2 (WildFly Core 11.0.0.Beta8) stopped in 132ms
123 | [INFO]
124 | [INFO] Results:
125 | [INFO]
126 | [INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
127 | [INFO]
128 | [INFO]
129 | [INFO] --- maven-failsafe-plugin:3.0.0-M4:verify (integration-test) @ jakartaee8-starter ---
130 | [INFO] ------------------------------------------------------------------------
131 | [INFO] BUILD SUCCESS
132 | [INFO] ------------------------------------------------------------------------
133 | [INFO] Total time: 51.375 s
134 | [INFO] Finished at: 2020-02-23T17:46:43+08:00
135 | [INFO] ------------------------------------------------------------------------
136 | ```
137 |
138 | From the logging, Aquillian controller have done the following work when running the tests.
139 |
140 | * Starting the WildFly Server.
141 | * Packaging and deploying the archive
142 | * Running the tests
143 | * Undeploying the test archive
144 | * Reporting the result, and repeating the above steps if there are multi tests to run.
145 | * Finally Stopping the WildFly Server
--------------------------------------------------------------------------------
/docs/03run-wildfly-nb.md:
--------------------------------------------------------------------------------
1 | # Deploying applications to WildFly Server using Apache NetBeans IDE
2 |
3 | NetBeans has built-in support for Glassfish.
4 |
5 | [toc]
6 |
7 | ## Install WildFly Application Server plugin
8 |
9 | There is no built-in support for WildFly application server in the newest NetBeans IDE. To get WildFly integration support, follow these steps to install the WildFly plugin from NetBeans Plugin Portal.
10 |
11 | 1. Download [WildFly Application Server plugin](http://plugins.netbeans.org/plugin/76472/wildfly-application-server) from NetBeans Plugin portal.
12 | 2. Open *Plugins* dialog from NetBeans IDE main menu *Tools*->*Plugins*.
13 | 3. Switch to *Downloaded* tab, and click *Add Plugins...* button to select the downloaded plugin(a .nbm file).
14 | 4. When it is added, click *Install* button to start the installation progress.
15 | 5. Follow the wizard to complete the installation. When it is done, restart NetBeans IDE to apply the change.
16 |
17 | ## Add a WildFly Server instance
18 |
19 | Firstly, you should add a WildFly Server instance in NetBeans.
20 |
21 | 1. Click *Windows->Services* or use *Ctrl+5* shortcuts to open *Services* view .
22 | 2. Right click the *Servers* node, select *Add Server...* in the context menu.
23 | 3. In the *Add Server Instance* dialog, there are three steps:
24 | * *Choose Server* :select *WildFly Application Server* in the server list, click *Next* button.
25 |
26 |
27 |
28 | * *Server Location*: select the WildFly server location, click *Next* button.
29 |
30 |
31 |
32 | * *Instance Properties*: use the default values, if you have set an administration user, fill them in *User* and *Password* fields, click *Finish* button.
33 |
34 |
35 |
36 | After it is done, there is a new node *WildFly Application Server* added under the *Server*s nodes.
37 |
38 |
39 |
40 | Right click the *WildFly Application Server* node, there is a few actions available for you to control the server instance, such as Start, Stop, Debug etc.
41 |
42 | ## Start and Stop WildFly Server
43 |
44 | Let's start the WildFly server by clicking *Start* in the context menu. Wait for seconds, you will see the *Output* screen similar to the following.
45 |
46 |
47 |
48 | To stop the running WildFly Server, click *Stop* in the context menu of the existed WildFly Server node. Or jus click the *stop* button the *Output - Wildfly Application Server* window.
49 |
50 | ## Deploy and undeploy applications
51 |
52 | Generally, like what we have done with Glassfish and Payara servers, we can simply deploy and run a Jakarta EE application on an application server by simply clicking *Run* in the context menu of the project node in the *Projects* view.
53 |
54 | However when I try to run this application on Wildfly server, there is no such a Wildfly option in the dropdown list in the popup **Select deployment server**. It should be a bug.
55 |
56 |
57 |
58 |
59 |
60 | To select WildFly server as target server, let's switch to *Projects* view, right click the project node, and select *Properties* in the context menu.
61 |
62 | In the project properties window, select *Run* in the left navigation tree, and in the right panel, select *Wildfly Application Server* in the **Server** dropdown list.
63 |
64 |
65 |
66 | Click *OK* button. It will try to build the project and deploy the application package into the NetBeans managed WildFly server.
67 |
68 | After it is deployed successfully, there is a success message similar with the following in the *Run* tab of the *Output* window.
69 |
70 | ```bash
71 | ------------------------------------------------------------------------
72 | Deploying on WildFly Application Server
73 | profile mode: false
74 | debug mode: false
75 | force redeploy: true
76 | Starting WildFly Application Server
77 | WildFly Application Server Started
78 | Initial deploying jakartaee8-starter to D:\appsvr\wildfly-18.0.1.Final\standalone\deployments\jakartaee8-starter.war
79 | Completed initial distribution of jakartaee8-starter
80 | Deploying D:\appsvr\wildfly-18.0.1.Final\standalone\deployments\jakartaee8-starter.war
81 | Application Deployed
82 |
83 | ```
84 |
85 | Switch to *WildFly Application Server* console tab, you will see the following messages instead.
86 |
87 | ```bash
88 | ...
89 | 20:50:59,798 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
90 | 20:50:59,798 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 18.0.1.Final (WildFly Core 10.0.3.Final) started in 13378ms - Started 355 of 618 services (385 services are lazy, passive or on-demand)
91 | 20:51:06,232 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) WFLYDS0004: Found jakartaee8-starter.war in deployment directory. To trigger deployment create a file called jakartaee8-starter.war.dodeploy
92 | 20:51:06,284 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0027: Starting deployment of "jakartaee8-starter.war" (runtime-name: "jakartaee8-starter.war")
93 | 20:51:08,994 INFO [org.jboss.weld.deployer] (MSC service thread 1-7) WFLYWELD0003: Processing weld deployment jakartaee8-starter.war
94 | 20:51:09,956 INFO [org.hibernate.validator.internal.util.Version] (MSC service thread 1-7) HV000001: Hibernate Validator 6.0.18.Final
95 | 20:51:10,670 INFO [org.jboss.weld.Version] (MSC service thread 1-3) WELD-000900: 3.1.2 (Final)
96 | 20:51:10,797 INFO [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-5) ISPN000128: Infinispan version: Infinispan 'Infinity Minus ONE +2' 9.4.16.Final
97 | 20:51:11,494 INFO [io.smallrye.metrics] (MSC service thread 1-4) MicroProfile: Metrics activated
98 | 20:51:11,688 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 40) WFLYCLINF0002: Started client-mappings cache from ejb container
99 | 20:51:13,027 INFO [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 40) RESTEASY002225: Deploying javax.ws.rs.core.Application: class com.example.JaxrsActivator
100 | 20:51:13,197 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 40) WFLYUT0021: Registered web context: '/jakartaee8-starter' for server 'default-server'
101 | 20:51:13,312 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0010: Deployed "jakartaee8-starter.war" (runtime-name : "jakartaee8-starter.war")
102 |
103 | ```
104 |
105 |
106 |
107 | Let's open the *Server* view, there several nodes are displayed under WildFly Application Server. Expand the *Application*/*Web Applications* node, you will see there is a new node *jakartaee8-starter* there.
108 |
109 |
110 |
111 | Open your terminal and use `curl` to verify the APIs.
112 |
113 | ```bash
114 | curl http://localhost:8080/jakartaee8-starter/api/greeting/hantsy
115 | {"message":"Say Hello to hantsy at 2019-11-04T16:16:13.509"}
116 | ```
117 |
118 | To undeploy the application, in the *Service* view, expand *Servers/WildFly Application Server/Applications/Web Applications*, right click the *jakartaee8-starter* node, click *Undeploy* to undeploy it from the WildFly server.
119 |
120 |
--------------------------------------------------------------------------------