From aec42d117baefd33b71bf9c0e079cf390f3eb138 Mon Sep 17 00:00:00 2001 From: github-actions <> Date: Sun, 22 Oct 2023 13:27:45 +0000 Subject: [PATCH] chore: initial commit of ee10 migration --- .../application/util/SampleDataGenerator.java | 12 ++--- .../application/BookingServiceTest.java | 46 +++++++++++-------- 2 files changed, 33 insertions(+), 25 deletions(-) diff --git a/src/main/java/org/eclipse/cargotracker/application/util/SampleDataGenerator.java b/src/main/java/org/eclipse/cargotracker/application/util/SampleDataGenerator.java index fb496c36..e5eb3cad 100644 --- a/src/main/java/org/eclipse/cargotracker/application/util/SampleDataGenerator.java +++ b/src/main/java/org/eclipse/cargotracker/application/util/SampleDataGenerator.java @@ -24,7 +24,7 @@ @Startup public class SampleDataGenerator { - @Inject private Logger logger; + private static final Logger LOGGER = Logger.getLogger(SampleDataGenerator.class.getName()); @PersistenceContext private EntityManager entityManager; @Inject private HandlingEventFactory handlingEventFactory; @@ -33,7 +33,7 @@ public class SampleDataGenerator { @PostConstruct @TransactionAttribute(TransactionAttributeType.REQUIRED) public void loadSampleData() { - logger.info("Loading sample data."); + LOGGER.info("Loading sample data."); unLoadAll(); // Fail-safe in case of application restart that does not trigger a JPA schema // drop. loadSampleLocations(); @@ -42,7 +42,7 @@ public void loadSampleData() { } private void unLoadAll() { - logger.info("Unloading all existing data."); + LOGGER.info("Unloading all existing data."); // In order to remove handling events, must remove references in cargo. // Dropping cargo first won't work since handling events have references // to it. @@ -66,7 +66,7 @@ private void unLoadAll() { } private void loadSampleLocations() { - logger.info("Loading sample locations."); + LOGGER.info("Loading sample locations."); entityManager.persist(SampleLocations.HONGKONG); entityManager.persist(SampleLocations.MELBOURNE); @@ -84,7 +84,7 @@ private void loadSampleLocations() { } private void loadSampleVoyages() { - logger.info("Loading sample voyages."); + LOGGER.info("Loading sample voyages."); entityManager.persist(SampleVoyages.HONGKONG_TO_NEW_YORK); entityManager.persist(SampleVoyages.NEW_YORK_TO_DALLAS); @@ -94,7 +94,7 @@ private void loadSampleVoyages() { } private void loadSampleCargos() { - logger.info("Loading sample cargo data."); + LOGGER.info("Loading sample cargo data."); // Cargo ABC123. This one is en-route. TrackingId trackingId1 = new TrackingId("ABC123"); diff --git a/src/test/java/org/eclipse/cargotracker/application/BookingServiceTest.java b/src/test/java/org/eclipse/cargotracker/application/BookingServiceTest.java index 801ff32b..ed320bd3 100644 --- a/src/test/java/org/eclipse/cargotracker/application/BookingServiceTest.java +++ b/src/test/java/org/eclipse/cargotracker/application/BookingServiceTest.java @@ -144,17 +144,19 @@ public void testRegisterNew() { .setParameter("trackingId", trackingId) .getSingleResult(); - assertThat( cargo.getOrigin()).isEqualTo(SampleLocations.CHICAGO); - assertThat( cargo.getRouteSpecification().getDestination()).isEqualTo(SampleLocations.STOCKHOLM); + 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().getTransportStatus()) + .isEqualTo(TransportStatus.NOT_RECEIVED); assertThat(cargo.getDelivery().getLastKnownLocation()).isEqualTo(Location.UNKNOWN); - assertThat( cargo.getDelivery().getCurrentVoyage()).isEqualTo(Voyage.NONE); + 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().getNextExpectedActivity()).isEqualTo(Delivery.NO_ACTIVITY); assertThat(cargo.getDelivery().isUnloadedAtDestination()).isFalse(); - assertThat( cargo.getDelivery().getRoutingStatus()).isEqualTo(RoutingStatus.NOT_ROUTED); + assertThat(cargo.getDelivery().getRoutingStatus()).isEqualTo(RoutingStatus.NOT_ROUTED); assertThat(cargo.getItinerary()).isEqualTo(Itinerary.EMPTY_ITINERARY); } @@ -192,8 +194,10 @@ public void testAssignRoute() { .getEstimatedTimeOfArrival() .isBefore(deadline.atStartOfDay())) .isTrue(); - assertThat(cargo.getDelivery().getNextExpectedActivity().getType()).isEqualTo(HandlingEvent.Type.RECEIVE); - assertThat(cargo.getDelivery().getNextExpectedActivity().getLocation()).isEqualTo(SampleLocations.CHICAGO); + 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); @@ -211,18 +215,20 @@ public void testChangeDestination() { .setParameter("trackingId", trackingId) .getSingleResult(); - assertThat( cargo.getOrigin()).isEqualTo(SampleLocations.CHICAGO); - assertThat( cargo.getRouteSpecification().getDestination()).isEqualTo(SampleLocations.HELSINKI); + assertThat(cargo.getOrigin()).isEqualTo(SampleLocations.CHICAGO); + assertThat(cargo.getRouteSpecification().getDestination()) + .isEqualTo(SampleLocations.HELSINKI); assertThat(cargo.getRouteSpecification().getArrivalDeadline()).isEqualTo(deadline); assertThat(cargo.getItinerary()).isEqualTo(assigned); - assertThat( cargo.getDelivery().getTransportStatus()).isEqualTo(TransportStatus.NOT_RECEIVED); + 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().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); + assertThat(cargo.getDelivery().getRoutingStatus()).isEqualTo(RoutingStatus.MISROUTED); } @Test @@ -238,17 +244,19 @@ public void testChangeDeadline() { .setParameter("trackingId", trackingId) .getSingleResult(); - assertThat( cargo.getOrigin()).isEqualTo(SampleLocations.CHICAGO); - assertThat(cargo.getRouteSpecification().getDestination()).isEqualTo(SampleLocations.HELSINKI); + assertThat(cargo.getOrigin()).isEqualTo(SampleLocations.CHICAGO); + assertThat(cargo.getRouteSpecification().getDestination()) + .isEqualTo(SampleLocations.HELSINKI); assertThat(cargo.getRouteSpecification().getArrivalDeadline()).isEqualTo(newDeadline); assertThat(cargo.getItinerary()).isEqualTo(assigned); - 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().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); + assertThat(cargo.getDelivery().getRoutingStatus()).isEqualTo(RoutingStatus.MISROUTED); } }