Skip to content

Commit

Permalink
chore: initial commit of ee10 migration
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions authored and hantsy committed Oct 22, 2023
1 parent c4d589f commit d38f4b2
Show file tree
Hide file tree
Showing 11 changed files with 115 additions and 164 deletions.
44 changes: 0 additions & 44 deletions .circleci/config.yml

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,33 @@ jobs:
cache: 'maven'
- name: Build with Maven
run: mvn clean package --file pom.xml

coverage:
runs-on: ubuntu-latest
needs: [ build ]
steps:
- uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '21'
cache: 'maven'
- name: Set up Database
run: |
docker-compose up -d postgres
sleep 5
docker ps -a
- name: Build with Maven
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
mvn clean package --file pom.xml
mvn clean verify -Parq-wildfly-managed,coverage jacoco:report \
org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.login=$SONAR_TOKEN \
-Dsonar.organization=hantsy \
-Dsonar.projectKey=hantsy_cargotracker \
-Dsonar.coverage.exclusions=**/dto/*,**/*Configuration.*,**/SampleDataGenerator.*
75 changes: 25 additions & 50 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
<jersey.version>3.1.3</jersey.version>
<eclipselink.version>4.0.1</eclipselink.version>
<arquillian-glassfish-jakarta.version>7.0.9</arquillian-glassfish-jakarta.version>
<!-- websocket client for test-->
<tyrus.version>2.1.3</tyrus.version>

<!-- Wildfly server -->
<wildfly.version>30.0.0.Final</wildfly.version>
Expand Down Expand Up @@ -507,6 +509,12 @@
<skip.integration.tests>false</skip.integration.tests>
</properties>
<dependencies>
<dependency>
<groupId>org.glassfish.tyrus.bundles</groupId>
<artifactId>tyrus-standalone-client</artifactId>
<version>${tyrus.version}</version>
<scope>test</scope>
</dependency>
<!-- Jersey -->
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
Expand Down Expand Up @@ -619,6 +627,12 @@
<skip.integration.tests>false</skip.integration.tests>
</properties>
<dependencies>
<dependency>
<groupId>org.glassfish.tyrus.bundles</groupId>
<artifactId>tyrus-standalone-client</artifactId>
<version>${tyrus.version}</version>
<scope>test</scope>
</dependency>
<!-- Jersey -->
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
Expand Down Expand Up @@ -689,18 +703,12 @@
<serverRoot>${project.build.directory}/wildfly-${wildfly.version}</serverRoot>
</properties>
<dependencies>
<!--<dependency>
<groupId>io.undertow</groupId>
<artifactId>undertow-websockets-jsr</artifactId>
<version>${undertow-websockets-jsr.version}</version>
<dependency>
<groupId>org.glassfish.tyrus.bundles</groupId>
<artifactId>tyrus-standalone-client</artifactId>
<version>${tyrus.version}</version>
<scope>test</scope>
</dependency>-->

<!-- TESTS -->
<!-- JAXRS test need the dependency:resteasy-client -->
<!-- Import the RestEasy Client and jackson2/json-binding/json-p provider, we use
test scope
as we need that for test purposes -->
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
Expand All @@ -714,25 +722,6 @@
<scope>test</scope>
</dependency>

<!-- use Jersey client instead -->
<!--<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-binding</artifactId>
<version>${jersey.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>${jersey.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>${jersey.version}</version>
<scope>test</scope>
</dependency>-->
<dependency>
<groupId>org.wildfly.arquillian</groupId>
<artifactId>wildfly-arquillian-container-managed</artifactId>
Expand Down Expand Up @@ -809,6 +798,12 @@
<skip.integration.tests>false</skip.integration.tests>
</properties>
<dependencies>
<dependency>
<groupId>org.glassfish.tyrus.bundles</groupId>
<artifactId>tyrus-standalone-client</artifactId>
<version>${tyrus.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
Expand All @@ -821,26 +816,6 @@
<version>${resteasy.version}</version>
<scope>test</scope>
</dependency>
<!-- use Jersey client instead -->
<!--<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-binding</artifactId>
<version>${jersey.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>${jersey.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>${jersey.version}</version>
<scope>test</scope>
</dependency>-->

<dependency>
<groupId>org.wildfly.arquillian</groupId>
<artifactId>wildfly-arquillian-container-remote</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

import static org.assertj.core.api.Assertions.assertThat;
import static org.eclipse.cargotracker.Deployments.*;
import static org.junit.jupiter.api.Assertions.*;

/**
* Application layer integration test covering a number of otherwise fairly trivial components that
Expand Down Expand Up @@ -145,18 +144,18 @@ public void testRegisterNew() {
.setParameter("trackingId", trackingId)
.getSingleResult();

assertEquals(SampleLocations.CHICAGO, cargo.getOrigin());
assertEquals(SampleLocations.STOCKHOLM, cargo.getRouteSpecification().getDestination());
assertTrue(deadline.isEqual(cargo.getRouteSpecification().getArrivalDeadline()));
assertEquals(TransportStatus.NOT_RECEIVED, cargo.getDelivery().getTransportStatus());
assertEquals(Location.UNKNOWN, cargo.getDelivery().getLastKnownLocation());
assertEquals(Voyage.NONE, cargo.getDelivery().getCurrentVoyage());
assertFalse(cargo.getDelivery().isMisdirected());
assertEquals(Delivery.ETA_UNKOWN, cargo.getDelivery().getEstimatedTimeOfArrival());
assertEquals(Delivery.NO_ACTIVITY, cargo.getDelivery().getNextExpectedActivity());
assertFalse(cargo.getDelivery().isUnloadedAtDestination());
assertEquals(RoutingStatus.NOT_ROUTED, cargo.getDelivery().getRoutingStatus());
assertEquals(Itinerary.EMPTY_ITINERARY, cargo.getItinerary());
assertThat( cargo.getOrigin()).isEqualTo(SampleLocations.CHICAGO);
assertThat( cargo.getRouteSpecification().getDestination()).isEqualTo(SampleLocations.STOCKHOLM);
assertThat(cargo.getRouteSpecification().getArrivalDeadline()).isEqualTo(deadline);
assertThat(cargo.getDelivery().getTransportStatus()).isEqualTo(TransportStatus.NOT_RECEIVED);
assertThat(cargo.getDelivery().getLastKnownLocation()).isEqualTo(Location.UNKNOWN);
assertThat( cargo.getDelivery().getCurrentVoyage()).isEqualTo(Voyage.NONE);
assertThat(cargo.getDelivery().isMisdirected()).isFalse();
assertThat(cargo.getDelivery().getEstimatedTimeOfArrival()).isEqualTo(Delivery.ETA_UNKOWN);
assertThat( cargo.getDelivery().getNextExpectedActivity()).isEqualTo(Delivery.NO_ACTIVITY);
assertThat(cargo.getDelivery().isUnloadedAtDestination()).isFalse();
assertThat( cargo.getDelivery().getRoutingStatus()).isEqualTo(RoutingStatus.NOT_ROUTED);
assertThat(cargo.getItinerary()).isEqualTo(Itinerary.EMPTY_ITINERARY);
}

@Test
Expand Down Expand Up @@ -185,20 +184,16 @@ public void testAssignRoute() {
assertThat(cargo.getItinerary()).isEqualTo(assigned);
assertThat(cargo.getDelivery().getTransportStatus())
.isEqualTo(TransportStatus.NOT_RECEIVED);
assertEquals(Location.UNKNOWN, cargo.getDelivery().getLastKnownLocation());
assertEquals(Voyage.NONE, cargo.getDelivery().getCurrentVoyage());
assertThat(cargo.getDelivery().getLastKnownLocation()).isEqualTo(Location.UNKNOWN);
assertThat(cargo.getDelivery().getCurrentVoyage()).isEqualTo(Voyage.NONE);
assertThat(cargo.getDelivery().isMisdirected()).isFalse();
assertThat(
cargo.getDelivery()
.getEstimatedTimeOfArrival()
.isBefore(deadline.atStartOfDay()))
.isTrue();
assertEquals(
HandlingEvent.Type.RECEIVE,
cargo.getDelivery().getNextExpectedActivity().getType());
assertEquals(
SampleLocations.CHICAGO,
cargo.getDelivery().getNextExpectedActivity().getLocation());
assertThat(cargo.getDelivery().getNextExpectedActivity().getType()).isEqualTo(HandlingEvent.Type.RECEIVE);
assertThat(cargo.getDelivery().getNextExpectedActivity().getLocation()).isEqualTo(SampleLocations.CHICAGO);
assertThat(cargo.getDelivery().getNextExpectedActivity().getVoyage()).isNull();
assertThat(cargo.getDelivery().isUnloadedAtDestination()).isFalse();
assertThat(cargo.getDelivery().getRoutingStatus()).isEqualTo(RoutingStatus.ROUTED);
Expand All @@ -216,18 +211,18 @@ public void testChangeDestination() {
.setParameter("trackingId", trackingId)
.getSingleResult();

assertEquals(SampleLocations.CHICAGO, cargo.getOrigin());
assertEquals(SampleLocations.HELSINKI, cargo.getRouteSpecification().getDestination());
assertTrue(deadline.isEqual(cargo.getRouteSpecification().getArrivalDeadline()));
assertThat( cargo.getOrigin()).isEqualTo(SampleLocations.CHICAGO);
assertThat( cargo.getRouteSpecification().getDestination()).isEqualTo(SampleLocations.HELSINKI);
assertThat(cargo.getRouteSpecification().getArrivalDeadline()).isEqualTo(deadline);
assertThat(cargo.getItinerary()).isEqualTo(assigned);
assertEquals(TransportStatus.NOT_RECEIVED, cargo.getDelivery().getTransportStatus());
assertEquals(Location.UNKNOWN, cargo.getDelivery().getLastKnownLocation());
assertEquals(Voyage.NONE, cargo.getDelivery().getCurrentVoyage());
assertFalse(cargo.getDelivery().isMisdirected());
assertEquals(Delivery.ETA_UNKOWN, cargo.getDelivery().getEstimatedTimeOfArrival());
assertEquals(Delivery.NO_ACTIVITY, cargo.getDelivery().getNextExpectedActivity());
assertFalse(cargo.getDelivery().isUnloadedAtDestination());
assertEquals(RoutingStatus.MISROUTED, cargo.getDelivery().getRoutingStatus());
assertThat( cargo.getDelivery().getTransportStatus()).isEqualTo(TransportStatus.NOT_RECEIVED);
assertThat(cargo.getDelivery().getLastKnownLocation()).isEqualTo(Location.UNKNOWN);
assertThat( cargo.getDelivery().getCurrentVoyage()).isEqualTo(Voyage.NONE);
assertThat(cargo.getDelivery().isMisdirected()).isFalse();
assertThat(cargo.getDelivery().getEstimatedTimeOfArrival()).isEqualTo(Delivery.ETA_UNKOWN);
assertThat(cargo.getDelivery().getNextExpectedActivity()).isEqualTo(Delivery.NO_ACTIVITY);
assertThat(cargo.getDelivery().isUnloadedAtDestination()).isFalse();
assertThat( cargo.getDelivery().getRoutingStatus()).isEqualTo(RoutingStatus.MISROUTED);
}

@Test
Expand All @@ -243,17 +238,17 @@ public void testChangeDeadline() {
.setParameter("trackingId", trackingId)
.getSingleResult();

assertEquals(SampleLocations.CHICAGO, cargo.getOrigin());
assertEquals(SampleLocations.HELSINKI, cargo.getRouteSpecification().getDestination());
assertTrue(newDeadline.isEqual(cargo.getRouteSpecification().getArrivalDeadline()));
assertThat( cargo.getOrigin()).isEqualTo(SampleLocations.CHICAGO);
assertThat(cargo.getRouteSpecification().getDestination()).isEqualTo(SampleLocations.HELSINKI);
assertThat(cargo.getRouteSpecification().getArrivalDeadline()).isEqualTo(newDeadline);
assertThat(cargo.getItinerary()).isEqualTo(assigned);
assertEquals(TransportStatus.NOT_RECEIVED, cargo.getDelivery().getTransportStatus());
assertEquals(Location.UNKNOWN, cargo.getDelivery().getLastKnownLocation());
assertEquals(Voyage.NONE, cargo.getDelivery().getCurrentVoyage());
assertFalse(cargo.getDelivery().isMisdirected());
assertEquals(Delivery.ETA_UNKOWN, cargo.getDelivery().getEstimatedTimeOfArrival());
assertEquals(Delivery.NO_ACTIVITY, cargo.getDelivery().getNextExpectedActivity());
assertFalse(cargo.getDelivery().isUnloadedAtDestination());
assertEquals(RoutingStatus.MISROUTED, cargo.getDelivery().getRoutingStatus());
assertThat( cargo.getDelivery().getTransportStatus()).isEqualTo(TransportStatus.NOT_RECEIVED);
assertThat( cargo.getDelivery().getLastKnownLocation()).isEqualTo(Location.UNKNOWN);
assertThat( cargo.getDelivery().getCurrentVoyage()).isEqualTo(Voyage.NONE);
assertThat(cargo.getDelivery().isMisdirected()).isFalse();
assertThat(cargo.getDelivery().getEstimatedTimeOfArrival()).isEqualTo(Delivery.ETA_UNKOWN);
assertThat(cargo.getDelivery().getNextExpectedActivity()).isEqualTo(Delivery.NO_ACTIVITY);
assertThat(cargo.getDelivery().isUnloadedAtDestination()).isFalse();
assertThat( cargo.getDelivery().getRoutingStatus()).isEqualTo(RoutingStatus.MISROUTED);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ public void testConstruction() {

Cargo cargo = new Cargo(trackingId, routeSpecification);

assertThat( cargo.getDelivery().getRoutingStatus()).isEqualTo(RoutingStatus.NOT_ROUTED);
assertThat( cargo.getDelivery().getTransportStatus()).isEqualTo(TransportStatus.NOT_RECEIVED);
assertThat( cargo.getDelivery().getLastKnownLocation()).isEqualTo(Location.UNKNOWN);
assertThat( cargo.getDelivery().getCurrentVoyage()).isEqualTo(Voyage.NONE);
assertThat(cargo.getDelivery().getRoutingStatus()).isEqualTo(RoutingStatus.NOT_ROUTED);
assertThat(cargo.getDelivery().getTransportStatus())
.isEqualTo(TransportStatus.NOT_RECEIVED);
assertThat(cargo.getDelivery().getLastKnownLocation()).isEqualTo(Location.UNKNOWN);
assertThat(cargo.getDelivery().getCurrentVoyage()).isEqualTo(Voyage.NONE);
}

@Test
Expand Down Expand Up @@ -72,10 +73,10 @@ public boolean isSatisfiedBy(Itinerary itinerary) {

cargo.specifyNewRoute(acceptOnlyGood);

assertThat( cargo.getDelivery().getRoutingStatus()).isEqualTo(RoutingStatus.NOT_ROUTED);
assertThat(cargo.getDelivery().getRoutingStatus()).isEqualTo(RoutingStatus.NOT_ROUTED);

cargo.assignToRoute(bad);
assertThat(cargo.getDelivery().getRoutingStatus()).isEqualTo(RoutingStatus.MISROUTED) ;
assertThat(cargo.getDelivery().getRoutingStatus()).isEqualTo(RoutingStatus.MISROUTED);

cargo.assignToRoute(good);
assertThat(cargo.getDelivery().getRoutingStatus()).isEqualTo(RoutingStatus.ROUTED);
Expand All @@ -98,14 +99,14 @@ public void testLastKnownLocationUnknownWhenNoEvents() {
public void testLastKnownLocationReceived() throws Exception {
Cargo cargo = populateCargoReceivedStockholm();

assertThat( cargo.getDelivery().getLastKnownLocation()).isEqualTo(SampleLocations.STOCKHOLM);
assertThat(cargo.getDelivery().getLastKnownLocation()).isEqualTo(SampleLocations.STOCKHOLM);
}

@Test
public void testLastKnownLocationClaimed() throws Exception {
Cargo cargo = populateCargoClaimedMelbourne();

assertThat( cargo.getDelivery().getLastKnownLocation()).isEqualTo(SampleLocations.MELBOURNE);
assertThat(cargo.getDelivery().getLastKnownLocation()).isEqualTo(SampleLocations.MELBOURNE);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import java.util.Arrays;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class RouteSpecificationTest {

Expand Down
Loading

0 comments on commit d38f4b2

Please sign in to comment.