Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump assertj-core from 3.18.1 to 3.19.0 #3

Merged
merged 24 commits into from
Jan 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2
updates:
- package-ecosystem: maven
directory: "/"
schedule:
interval: daily
time: "21:00"
open-pull-requests-limit: 10
# Overwrite any ignores created using `@dependabot ignore` commands
ignore:
# Ignore updates to packages that start 'aws'
# Wildcards match zero or more arbitrary characters
#- dependency-name: "aws*"
# Ignore some updates to the 'resteasy' package
- dependency-name: "resteasy"
# Ignore only new versions for 4.x
versions: ["3.x, 4.x"]

37 changes: 37 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: build

on:
push:
paths-ignore:
- "docs/**"
branches:
- master
pull_request:
types:
- opened
- synchronize
- reopened

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
# test against latest update of each major Java version, as well as specific updates of LTS versions:
java: [11, 15]
steps:
- uses: actions/checkout@v2
- name: Set up Java
uses: actions/setup-java@v1
with:
java-version: ${{matrix.java}}

- name: Cache Maven packages
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Build with Maven
run: mvn clean package --file pom.xml
39 changes: 39 additions & 0 deletions .github/workflows/it-with-arq-payara-managed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: it-with-arq-payara-managed

on:
push:
paths-ignore:
- "docs/**"
branches:
- master
pull_request:
types:
- opened
- synchronize
- reopened

jobs:
it-with-arq-payara-managed:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 11

- name: Start up databases via Docker Compose
run: |
docker-compose up -d postgres
docker ps -a

- name: Cache Maven packages
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Run integration test with -Parq-payara-managed
run: mvn clean verify -Parq-payara-managed
39 changes: 39 additions & 0 deletions .github/workflows/it-with-arq-payara-micro.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: it-with-arq-payara-micro

on:
push:
paths-ignore:
- "docs/**"
branches:
- master
pull_request:
types:
- opened
- synchronize
- reopened

jobs:
it-with-arq-payara-micro:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 11

- name: Start up databases via Docker Compose
run: |
docker-compose up -d postgres
docker ps -a

- name: Cache Maven packages
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Run integration test with -Parq-payara-micro
run: mvn clean verify -Parq-payara-micro
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ target
.settings
.metadata
/.classpath
/.project
/.project.idea
*.iml
.idea/
nb*
88 changes: 54 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,79 @@
# Eclipse Cargo Tracker - Applied Domain-Driven Design Blueprints for Jakarta EE

![compile and build](https://github.com/hantsy/cargo-tracker/workflows/build/badge.svg)
![Integration Test with Arquillian Payara Managed Container](https://github.com/hantsy/cargo-tracker/workflows/it-with-arq-payara-managed/badge.svg)
![Integration Test with Arquillian Payara Micro Container](https://github.com/hantsy/cargo-tracker/workflows/it-with-arq-payara-micro/badge.svg)

## Overview

The project demonstrates how you can develop applications with Jakarta EE using widely adopted architectural best practices like Domain-Driven
Design (DDD). The project is directly based on the well known
original [Java DDD sample application](http://dddsample.sourceforge.net)
developed by DDD pioneer Eric Evans' company Domain Language and the Swedish
software consulting company Citerus. The cargo example actually comes from
Eric Evans' seminal book on DDD. The original application is written in Spring,
Hibernate and Jetty whereas the application is built on Jakarta EE.
The project demonstrates how you can develop applications with Jakarta EE using widely adopted architectural best practices like Domain-Driven Design (DDD). The project is directly based on the well known original [ DDD book sample codes](https://github.com/citerus/dddsample-core) developed by DDD pioneer Eric Evans' company Domain Language and the Swedish software consulting company Citerus. The cargo example actually comes from Eric Evans' seminal book on DDD. The original application is written in Spring, Hibernate and Jetty whereas the application is built on Jakarta EE.

The application is an end-to-end system for keeping track of shipping cargo. It
has several interfaces described in the following sections.
The application is an end-to-end system for keeping track of shipping cargo. It has several interfaces described in the following sections.

For further details on the project, please visit: https://eclipse-ee4j.github.io/cargotracker/.

![Cargo Tracker cover](cargo_tracker_cover.png)

## Getting Started

The [project website](https://eclipse-ee4j.github.io/cargotracker/) has detailed information on how to get started.

The simplest steps are the following (no IDE required):
### Prerequisites

* Java 8 or 11
* The latest Apache Maven 3.6.x
* Git
* Docker
* [Payara 5](https://www.payara.fish/downloads/)

### Prepare a running database

In this project, we use Postgres as an example.

There is a *docker-compose.yaml* file in project source codes. Switch to the project root folder, and simply type the following command to start a Postgres instance in docker container.

```bash
docker-compose up postgres
```

### Run the application without IDEs

* Get the project source code.
* Ensure you are running Java SE 8. The project by default uses Payara 4.1, which supports Java SE 8.
* Ensure you are running Java SE 8 or 11. The project by default uses Payara 5, which supports Java SE 8+.
* Make sure JAVA_HOME is set.
* As long as you have Maven set up properly, navigate to the project source root and
type: `mvn package cargo:run`
* As long as you have Maven set up properly, navigate to the project source root and type:

```bash
mvn clean package cargo:run
```
* Go to http://localhost:8080/cargo-tracker

To set up in Eclipse, follow these steps:
### Set up in Eclipse IDE

* Set up [Java SE 8](https://www.azul.com/downloads/zulu-community/?version=java-8-lts), [the 2020-06 release of Eclipse for Enterprise Java Developers](https://www.eclipse.org/downloads/packages/release/2020-06/r/eclipse-ide-enterprise-java-developers) (this is the latest Eclipse IDE version that supports Java SE 8) and [Payara 4.1](https://repo1.maven.org/maven2/fish/payara/distributions/payara/4.1.2.181/payara-4.1.2.181.zip) (Payara 5 is not supported yet. Payara 4.1 only supports Java SE 8). You will also need to set up [Payara Tools](https://marketplace.eclipse.org/content/payara-tools) in Eclipse.
* Set up [Java SE 11](https://www.azul.com/downloads/zulu-community/?version=java-11-lts), [the 2020-06 release of Eclipse for Enterprise Java Developers](https://www.eclipse.org/downloads/packages/release/2020-06/r/eclipse-ide-enterprise-java-developers) (this is the latest Eclipse IDE version that supports Java SE 8) and [Payara 5](https://www.payara.fish/downloads/) . You will also need to set up [Payara Tools](https://marketplace.eclipse.org/content/payara-tools) in Eclipse.
* Import this code in Eclipse as a Maven project,
Eclipse will do the rest for you. Proceed with clean/building the application.
* After the project is built (which will take a while the very first time as
Maven downloads dependencies), simply run it via Payara 4.
Maven downloads dependencies), simply run it via Payara server.

### Set up in Apache NetBeans IDE

* Set up [Java SE 11](https://www.azul.com/downloads/zulu-community/?version=java-11-lts), [NetBeans](http://netbeans.apache.org) and [Payara 5](https://www.payara.fish/downloads/), and configure [Payara in NetBeans](https://blog.payara.fish/adding-payara-server-to-netbeans).
* Open the project from NetBeans directly. NetBeans recognizes Maven projects automatically.
* From the project context menu, simply run it via Payara server.

## Exploring the Application

After the application runs, it will be available at:
http://localhost:8080/cargo-tracker/. Under the hood, the application uses a
number of Jakarta EE (Java EE 7) features including JSF, CDI, EJB, JPA, JAX-RS, WebSocket, JSON Processing, Bean Validation and JMS.
number of Jakarta EE 8 features including JSF, CDI, EJB, JPA, JAX-RS, WebSocket, JSON Processing, Bean Validation and JMS.

There are several web interfaces, REST interfaces and a file system scanning
interface. It's probably best to start exploring the interfaces in the rough
order below.

The tracking interface let's you track the status of cargo and is
intended for the general public. Try entering a tracking ID like ABC123 (the
intended for the general public. Try entering a tracking ID like **ABC123** (the
application is pre-populated with some sample data).

The administrative interface is intended for the shipping company that manages
Expand All @@ -76,17 +100,16 @@ handy. You can access the itinerary for registered cargo via the admin interface
and unload events require as associated voyage.

You should also explore the file system based bulk event registration interface.
It reads files under /tmp/uploads. The files are just CSV files. A sample CSV
file is available under [src/test/resources/handling_events.csv](src/test/resources/handling_events.csv). The sample is already set up to match the remaining itinerary events for cargo ABC123. Just make sure to update the times in the first column of the sample CSV file to match the itinerary as well.
It reads files under */tmp/uploads*. The files are just CSV files. A sample CSV
file is available under [*src/test/resources/handling_events.csv*](src/test/resources/handling_events.csv). The sample is already set up to match the remaining itinerary events for cargo ABC123. Just make sure to update the times in the first column of the sample CSV file to match the itinerary as well.

Sucessfully processed entries are archived under /tmp/archive. Any failed records are
archived under /tmp/failed.
Successfully processed entries are archived under */tmp/archive*. Any failed records are
archived under */tmp/failed*.

Don't worry about making mistakes. The application is intended to be fairly
error tolerant. If you do come across issues, you should [report them](https://github.com/eclipse-ee4j/cargotracker/issues).

*All data entered is wiped upon application restart, so you can start from
a blank slate easily if needed.*
> All data entered is wiped upon application restart, so you can start from a blank slate easily if needed.

You can also use the soapUI scripts included in the source code to explore the
REST interfaces as well as the numerous unit tests covering the code base
Expand Down Expand Up @@ -115,17 +138,17 @@ by simply digging into the code to see how things are implemented.

## Exploring the Tests

Cargo Tracker's testing is done using JUnit and Arquillian. The Arquillian configuration
uses a [remote container](http://arquillian.org/arquillian-core/#_containers) (Payara 4.1). Therefore, to perform a test you will need to make sure
Cargo Tracker's testing is done using JUnit and [Arquillian](http://arquillian.org/). The Arquillian configuration
uses a [remote container](http://arquillian.org/arquillian-core/#_containers) (Payara 5). Therefore, to perform a test you will need to make sure
to have a container running.

## Testing Locally with Payara
For testing locally you will first need to run a Payara 4.1 server.
For testing locally you will first need to run a Payara 5 server.

You can do that with the following script:
```shell script
wget https://repo1.maven.org/maven2/fish/payara/distributions/payara/4.1.2.181/payara-4.1.2.181.zip
unzip payara-4.1.2.181.zip && cd payara41/bin
wget https://repo1.maven.org/maven2/fish/payara/distributions/payara/5.2020.7/payara-5.2020.7.zip
unzip payara-5.2020.7.zip && cd payara5/bin
./asadmin start-domain
```

Expand All @@ -134,9 +157,6 @@ Now for running the tests:
mvn -Ppayara -DskipTests=false test
```

## Contributing
This project complies with the [Google Java Style Guide](https://google.github.io/styleguide/javaguide.html). You can use the [google-java-format](https://github.com/google/google-java-format) tool to help you comply with the Google Java Style Guide. You can use the tool with most major IDEs such as Eclipse and IntelliJ.

## Known Issues
* If you are running older versions of Payara, you will get a log message stating that SSL certificates have expired. This won't get in the way of functionality, but it will
stop log messages from being printed to the IDE console. You can solve this issue by manually removing the expired certificates from the Payara domain, as
Expand All @@ -146,5 +166,5 @@ This project complies with the [Google Java Style Guide](https://google.github.i
* Sometimes when the server is not shut down correctly or there is a locking/permissions issue, the Derby database that
the application uses get's corrupted, resulting in strange database errors. If
this occurs, you will need to stop the application and clean the database. You
can do this by simply removing \tmp\cargo-tracker-database from the file
can do this by simply removing *\tmp\cargo-tracker-database* from the file
system and restarting the application.
17 changes: 17 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: '3.7' # specify docker-compose version

services:
postgres:
image: postgres
ports:
- "5432:5432"
restart: always
environment:
POSTGRES_PASSWORD: password
POSTGRES_DB: cargotracker
POSTGRES_USER: user
volumes:
- ./data:/var/lib/postgresql
# - ./pg-initdb.d:/docker-entrypoint-initdb.d


Loading