rkrsn commited on
Commit
7c9f5a0
·
verified ·
1 Parent(s): 9a22a2b

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +9 -0
  2. benchmark/whole_applications/cargotracker/jakarta/.dockerignore +41 -0
  3. benchmark/whole_applications/cargotracker/jakarta/CONTRIBUTING.md +65 -0
  4. benchmark/whole_applications/cargotracker/jakarta/Dockerfile +66 -0
  5. benchmark/whole_applications/cargotracker/jakarta/LICENSE.md +21 -0
  6. benchmark/whole_applications/cargotracker/jakarta/README.md +140 -0
  7. benchmark/whole_applications/cargotracker/jakarta/cargo-tracker.yml +53 -0
  8. benchmark/whole_applications/cargotracker/jakarta/mvnw +295 -0
  9. benchmark/whole_applications/cargotracker/jakarta/mvnw.cmd +189 -0
  10. benchmark/whole_applications/cargotracker/jakarta/pom.xml +299 -0
  11. benchmark/whole_applications/cargotracker/jakarta/post-boot-commands.asadmin +2 -0
  12. benchmark/whole_applications/cargotracker/jakarta/postgres.yml +41 -0
  13. benchmark/whole_applications/cargotracker/jakarta/test.sh +15 -0
  14. benchmark/whole_applications/cargotracker/quarkus/.dockerignore +41 -0
  15. benchmark/whole_applications/cargotracker/quarkus/Dockerfile +41 -0
  16. benchmark/whole_applications/cargotracker/quarkus/README.md +90 -0
  17. benchmark/whole_applications/cargotracker/quarkus/mvnw +295 -0
  18. benchmark/whole_applications/cargotracker/quarkus/mvnw.cmd +189 -0
  19. benchmark/whole_applications/cargotracker/quarkus/pom.xml +181 -0
  20. benchmark/whole_applications/cargotracker/quarkus/test.sh +15 -0
  21. benchmark/whole_applications/cargotracker/spring/.dockerignore +41 -0
  22. benchmark/whole_applications/cargotracker/spring/Dockerfile +27 -0
  23. benchmark/whole_applications/cargotracker/spring/README.md +0 -0
  24. benchmark/whole_applications/cargotracker/spring/mvnw +295 -0
  25. benchmark/whole_applications/cargotracker/spring/mvnw.cmd +189 -0
  26. benchmark/whole_applications/cargotracker/spring/pom.xml +103 -0
  27. benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/CargoTrackerApplication.java +21 -0
  28. benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/application/ApplicationEvents.java +23 -0
  29. benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/application/BookingService.java +43 -0
  30. benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/application/CargoInspectionService.java +15 -0
  31. benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/application/HandlingEventService.java +25 -0
  32. benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/config/JmsConfig.java +49 -0
  33. benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/cargo/Cargo.java +204 -0
  34. benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/cargo/Delivery.java +383 -0
  35. benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/cargo/HandlingActivity.java +121 -0
  36. benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/cargo/Itinerary.java +159 -0
  37. benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/cargo/Leg.java +148 -0
  38. benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/cargo/RouteSpecification.java +107 -0
  39. benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/cargo/RoutingStatus.java +9 -0
  40. benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/cargo/TrackingId.java +62 -0
  41. benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/cargo/TransportStatus.java +9 -0
  42. benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/handling/CannotCreateHandlingEventException.java +21 -0
  43. benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/handling/HandlingEvent.java +312 -0
  44. benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/handling/HandlingEventFactory.java +101 -0
  45. benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/handling/HandlingHistory.java +76 -0
  46. benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/handling/UnknownCargoException.java +22 -0
  47. benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/handling/UnknownLocationException.java +19 -0
  48. benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/handling/UnknownVoyageException.java +20 -0
  49. benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/location/Location.java +100 -0
  50. benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/location/SampleLocations.java +19 -0
.gitattributes CHANGED
@@ -67,3 +67,12 @@ whole_applications/daytrader/jakarta/resources/data/tradedb/seg0/c760.dat filter
67
  whole_applications/daytrader/jakarta/resources/data/tradedb/seg0/c7c0.dat filter=lfs diff=lfs merge=lfs -text
68
  whole_applications/daytrader/jakarta/resources/data/tradedb/seg0/c720.dat filter=lfs diff=lfs merge=lfs -text
69
  whole_applications/daytrader/jakarta/resources/data/tradedb/seg0/c821.dat filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
67
  whole_applications/daytrader/jakarta/resources/data/tradedb/seg0/c7c0.dat filter=lfs diff=lfs merge=lfs -text
68
  whole_applications/daytrader/jakarta/resources/data/tradedb/seg0/c720.dat filter=lfs diff=lfs merge=lfs -text
69
  whole_applications/daytrader/jakarta/resources/data/tradedb/seg0/c821.dat filter=lfs diff=lfs merge=lfs -text
70
+ benchmark/whole_applications/daytrader/spring/data/tradedb.mv.db filter=lfs diff=lfs merge=lfs -text
71
+ benchmark/whole_applications/daytrader/spring/src/main/webapp/WAS_V7_64-bit_performance.pdf filter=lfs diff=lfs merge=lfs -text
72
+ benchmark/whole_applications/daytrader/jakarta/src/main/webapp/WAS_V7_64-bit_performance.pdf filter=lfs diff=lfs merge=lfs -text
73
+ benchmark/whole_applications/daytrader/jakarta/resources/data/tradedb/seg0/c230.dat filter=lfs diff=lfs merge=lfs -text
74
+ benchmark/whole_applications/daytrader/jakarta/resources/data/tradedb/seg0/c821.dat filter=lfs diff=lfs merge=lfs -text
75
+ benchmark/whole_applications/daytrader/jakarta/resources/data/tradedb/seg0/c760.dat filter=lfs diff=lfs merge=lfs -text
76
+ benchmark/whole_applications/daytrader/jakarta/resources/data/tradedb/seg0/c720.dat filter=lfs diff=lfs merge=lfs -text
77
+ benchmark/whole_applications/daytrader/jakarta/resources/data/tradedb/seg0/c7c0.dat filter=lfs diff=lfs merge=lfs -text
78
+ benchmark/whole_applications/daytrader/jakarta/resources/data/tradedb/log/log286.dat filter=lfs diff=lfs merge=lfs -text
benchmark/whole_applications/cargotracker/jakarta/.dockerignore ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # VCS
2
+ .git/
3
+
4
+ # Maven
5
+ .mvn/
6
+ **/.mvn/
7
+ mvnw
8
+ mvnw.cmd
9
+ **/mvnw
10
+ **/mvnw.cmd
11
+ target/
12
+ **/target/
13
+ pom.xml.tag
14
+ pom.xml.releaseBackup
15
+ pom.xml.versionsBackup
16
+ pom.xml.next
17
+ release.properties
18
+ dependency-reduced-pom.xml
19
+ buildNumber.properties
20
+
21
+ # IDE / Editor
22
+ .vscode/
23
+ **/.vscode/
24
+ .zed/
25
+ **/.zed/
26
+ .idea/
27
+ **/.idea/
28
+ *.iml
29
+ *.ipr
30
+ *.iws
31
+
32
+ # OS
33
+ .DS_Store
34
+ **/.DS_Store
35
+ Thumbs.db
36
+ ehthumbs.db
37
+
38
+ # Logs / temp
39
+ *.log
40
+ *.tmp
41
+ *.temp
benchmark/whole_applications/cargotracker/jakarta/CONTRIBUTING.md ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contributing to Eclipse Cargo Tracker
2
+
3
+ Thanks for your interest in this project. Your feedback and contributions are most welcome. Please consider contacting the developers of the project before proposing a change, ideally via the [mailing list](https://accounts.eclipse.org/mailing-list/cargotracker-dev).
4
+
5
+ ## Project description
6
+
7
+ The project demonstrates how you can develop applications with Jakarta EE using widely adopted architectural best practices like Domain-Driven Design (DDD).
8
+
9
+ * https://projects.eclipse.org/projects/ee4j.cargotracker
10
+
11
+ ## Developer resources
12
+
13
+ The project maintains the following source code repository. The project is built using Maven.
14
+
15
+ * https://github.com/eclipse-ee4j/cargotracker
16
+
17
+ Issues are tracked on GitHub. Please look through the issues before proposing a change.
18
+
19
+ * https://github.com/eclipse-ee4j/cargotracker/issues
20
+
21
+ The following are the project web site and documentation. Please look through them before proposing a change.
22
+
23
+ * https://eclipse-ee4j.github.io/cargotracker
24
+ * https://github.com/eclipse-ee4j/cargotracker/wiki
25
+
26
+ ## Development Standards/Style
27
+
28
+ This project complies with the Google Style Guides for [Java](https://google.github.io/styleguide/javaguide.html), [JavaScript](https://google.github.io/styleguide/jsguide.html), and [HTML/CSS](https://google.github.io/styleguide/htmlcssguide.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.
29
+
30
+ In general for all files we use a column/line width of 80 whenever possible and we use 2 spaces for indentation. All files must end with a new line. Please adjust the formatting settings of your IDE accordingly. You are encouraged but not required to use HTML Tidy and CSS Tidy to help format your code.
31
+
32
+ ## Roadmap
33
+ The project is currently working on Jakarta EE 10 support. The associated issues are under the jakartaee10 milestone: https://github.com/eclipse-ee4j/cargotracker/milestone/4.
34
+
35
+ Work on any other issues or other changes are welcome, especially issues marked with the 'good first issue' (https://github.com/eclipse-ee4j/cargotracker/labels/good%20first%20issue) and 'help wanted' (https://github.com/eclipse-ee4j/cargotracker/labels/help%20wanted) labels.
36
+
37
+ ## Eclipse Development Process
38
+
39
+ This Eclipse Foundation open project is governed by the Eclipse Foundation
40
+ Development Process and operates under the terms of the Eclipse IP Policy.
41
+
42
+ * https://eclipse.org/projects/dev_process
43
+ * https://www.eclipse.org/org/documents/Eclipse_IP_Policy.pdf
44
+
45
+ ## Eclipse Contributor Agreement
46
+
47
+ Before your contribution can be accepted by the project team contributors must
48
+ electronically sign the Eclipse Contributor Agreement (ECA).
49
+
50
+ * http://www.eclipse.org/legal/ECA.php
51
+
52
+ Commits that are provided by non-committers must have a Signed-off-by field in
53
+ the footer indicating that the author is aware of the terms by which the
54
+ contribution has been provided to the project. The non-committer must
55
+ additionally have an Eclipse Foundation account and must have a signed Eclipse
56
+ Contributor Agreement (ECA) on file.
57
+
58
+ For more information, please see the Eclipse Committer Handbook:
59
+ https://www.eclipse.org/projects/handbook/#resources-commit
60
+
61
+ ## Contact
62
+
63
+ Contact the project developers via the project's "dev" list. Please consider posting to the list before submitting an issue or pull request.
64
+
65
+ * https://accounts.eclipse.org/mailing-list/cargotracker-dev
benchmark/whole_applications/cargotracker/jakarta/Dockerfile ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM maven:3.9.9-ibm-semeru-11-focal
2
+
3
+ # We’ll work as root for package installs (this is the default in this image)
4
+ USER root
5
+
6
+ # --------------------------------------------------------------------
7
+ # System deps: Python, Chromium + driver, curl (for uv installer), and Playwright dependencies
8
+ # --------------------------------------------------------------------
9
+ RUN apt-get update && \
10
+ apt-get install -y --no-install-recommends \
11
+ python3 python3-venv python3-pip \
12
+ curl \
13
+ chromium-browser chromium-chromedriver \
14
+ libglib2.0-0 \
15
+ libnspr4 \
16
+ libnss3 \
17
+ libatk1.0-0 \
18
+ libatk-bridge2.0-0 \
19
+ libcups2 \
20
+ libxcb1 \
21
+ libxkbcommon0 \
22
+ libatspi2.0-0 \
23
+ libx11-6 \
24
+ libxcomposite1 \
25
+ libxdamage1 \
26
+ libxext6 \
27
+ libxfixes3 \
28
+ libxrandr2 \
29
+ libgbm1 \
30
+ libcairo2 \
31
+ libpango-1.0-0 \
32
+ libasound2 \
33
+ && rm -rf /var/lib/apt/lists/*
34
+
35
+ # --------------------------------------------------------------------
36
+ # Install uv (Python package/project manager)
37
+ # --------------------------------------------------------------------
38
+ RUN curl -LsSf https://astral.sh/uv/install.sh | sh && \
39
+ ln -s /root/.cargo/bin/uv /usr/local/bin/uv
40
+
41
+ # --------------------------------------------------------------------
42
+ # App + smoke project
43
+ # --------------------------------------------------------------------
44
+ WORKDIR /workspace
45
+
46
+ # Copy Maven project
47
+ COPY pom.xml .
48
+ COPY src ./src
49
+
50
+ # Copy smoke test project (assumed to be a uv project with pyproject.toml)
51
+ COPY smoke ./smoke
52
+ COPY test.sh .
53
+ RUN chmod +x test.sh
54
+
55
+ # Pre-download Maven deps and build once to warm the cache
56
+ RUN mvn -B -DskipTests package
57
+
58
+ # Optionally pre-resolve Python deps so 'uv run' is fast later:
59
+ # RUN cd smoke && uv sync
60
+
61
+ # --------------------------------------------------------------------
62
+ # Default command: run the app via Maven Cargo
63
+ # You can then exec into the container to run:
64
+ # uv run smoke/smoke.py
65
+ # --------------------------------------------------------------------
66
+ CMD ["mvn", "clean", "-DskipTests", "package", "cargo:run"]
benchmark/whole_applications/cargotracker/jakarta/LICENSE.md ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Eclipse Foundation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
benchmark/whole_applications/cargotracker/jakarta/README.md ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Eclipse Cargo Tracker - Applied Domain-Driven Design Blueprints for Jakarta EE
2
+
3
+ The project demonstrates how you can develop applications with Jakarta EE using widely adopted architectural best practices like Domain-Driven
4
+ Design (DDD). The project is directly based on the well known
5
+ original [Java DDD sample application](http://dddsample.sourceforge.net)
6
+ developed by DDD pioneer Eric Evans' company Domain Language and the Swedish
7
+ software consulting company Citerus. The cargo example actually comes from
8
+ Eric Evans' seminal book on DDD. The original application is written in Spring,
9
+ Hibernate and Jetty whereas the application is built on Jakarta EE.
10
+
11
+ The application is an end-to-end system for keeping track of shipping cargo. It
12
+ has several interfaces described in the following sections.
13
+
14
+ For further details on the project, please visit: https://eclipse-ee4j.github.io/cargotracker/.
15
+
16
+ A slide deck introducing the
17
+ fundamentals of the project is available on the official Eclipse
18
+ Foundation [Jakarta EE SlideShare account](https://www.slideshare.net/Jakarta_EE/applied-domaindriven-design-blueprints-for-jakarta-ee). A recording of the slide deck is available on the official [Jakarta EE YouTube account](https://www.youtube.com/watch?v=pKmmZd-3mhA).
19
+
20
+ ![Eclipse Cargo Tracker cover](cargo_tracker_cover.png)
21
+
22
+ ## Getting Started
23
+
24
+ The [project website](https://eclipse-ee4j.github.io/cargotracker/) has detailed information on how to get started.
25
+
26
+ The simplest steps are the following (no IDE required):
27
+
28
+ * Get the project source code.
29
+ * Ensure you are running Java SE 8, Java SE 11 or Java SE 17.
30
+ * Make sure JAVA_HOME is set.
31
+ * As long as you have Maven set up properly, navigate to the project source root.
32
+ * To run on Payara, type: `mvn clean package cargo:run`
33
+ * To run on Open Liberty, type: `mvn clean -Popenliberty liberty:run`
34
+ * Go to http://localhost:8080/cargo-tracker
35
+
36
+ To set up in the Eclipse IDE, follow these steps:
37
+
38
+ * Set up Java SE 8, Java SE 11, or Java SE 17, [the Eclipse IDE for Enterprise Java Developers](https://www.eclipse.org/downloads/packages/) 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 the Eclipse IDE.
39
+ * Import this code in the Eclipse IDE as a Maven project,
40
+ the Eclipse IDE will do the rest for you. Proceed with clean/building the application.
41
+ * After the project is built (which will take a while the very first time as Maven downloads dependencies), simply run it via Payara 5.
42
+
43
+ ## Exploring the Application
44
+
45
+ After the application runs, it will be available at:
46
+ http://localhost:8080/cargo-tracker/. Under the hood, the application uses a
47
+ number of Jakarta EE features including Faces, CDI, Enterprise Beans, Persistence, REST, Batch, JSON Binding, Bean Validation and Messaging.
48
+
49
+ There are several web interfaces, REST interfaces and a file system scanning
50
+ interface. It's probably best to start exploring the interfaces in the rough
51
+ order below.
52
+
53
+ The tracking interface let's you track the status of cargo and is
54
+ intended for the general public. Try entering a tracking ID like ABC123 (the
55
+ application is pre-populated with some sample data).
56
+
57
+ The administrative interface is intended for the shipping company that manages
58
+ cargo. The landing page of the interface is a dashboard providing an overall
59
+ view of registered cargo. You can book cargo using the booking interface.
60
+ Once cargo is booked, you can route it. When you initiate a routing request,
61
+ the system will determine routes that might work for the cargo. Once you select
62
+ a route, the cargo will be ready to process handling events at the port. You can
63
+ also change the destination for cargo if needed or track cargo.
64
+
65
+ The Handling Event Logging interface is intended for port personnel registering what
66
+ happened to cargo. The interface is primarily intended for mobile devices, but
67
+ you can use it via a desktop browser. The interface is accessible at this URL: http://localhost:8080/cargo-tracker/event-logger/index.xhtml. For convenience, you
68
+ could use a mobile emulator instead of an actual mobile device. Generally speaking cargo
69
+ goes through these events:
70
+
71
+ * It's received at the origin location.
72
+ * It's loaded and unloaded onto voyages on it's itinerary.
73
+ * It's claimed at it's destination location.
74
+ * It may go through customs at arbitrary points.
75
+
76
+ While filling out the event registration form, it's best to have the itinerary
77
+ handy. You can access the itinerary for registered cargo via the admin interface. The cargo handling is done via Messaging for scalability. While using the event logger, note that only the load and unload events require as associated voyage.
78
+
79
+ You should also explore the file system based bulk event registration interface.
80
+ It reads files under /tmp/uploads. The files are just CSV files. A sample CSV
81
+ file is available under [src/test/sample/handling_events.csv](src/test/sample/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.
82
+
83
+ Sucessfully processed entries are archived under /tmp/archive. Any failed records are
84
+ archived under /tmp/failed.
85
+
86
+ Don't worry about making mistakes. The application is intended to be fairly
87
+ error tolerant. If you do come across issues, you should [report them](https://github.com/eclipse-ee4j/cargotracker/issues).
88
+
89
+ You can simply remove ./cargo-tracker-data from the file system to restart fresh. This directory will typically be under $your-payara-installation/glassfish/domains/domain1/config.
90
+
91
+ You can also use the soapUI scripts included in the source code to explore the
92
+ REST interfaces as well as the numerous unit tests covering the code base
93
+ generally. Some of the tests use Arquillian.
94
+
95
+ ## Exploring the Code
96
+
97
+ As mentioned earlier, the real point of the application is demonstrating how to
98
+ create well architected, effective Jakarta EE applications. To that end, once you
99
+ have gotten some familiarity with the application functionality the next thing
100
+ to do is to dig right into the code.
101
+
102
+ DDD is a key aspect of the architecture, so it's important to get at least a
103
+ working understanding of DDD. As the name implies, Domain-Driven Design is an
104
+ approach to software design and development that focuses on the core domain and
105
+ domain logic.
106
+
107
+ For the most part, it's fine if you are new to Jakarta EE. As long as you have a
108
+ basic understanding of server-side applications, the code should be good enough to get started. For learning Jakarta EE further,
109
+ we have recommended a few links in the resources section of the project site. Of
110
+ course, the ideal user of the project is someone who has a basic working
111
+ understanding both Jakarta EE and DDD. Though it's not our goal to become a kitchen
112
+ sink example for demonstrating the vast amount of APIs and features in Jakarta EE,
113
+ we do use a very representative set. You'll find that you'll learn a fair amount
114
+ by simply digging into the code to see how things are implemented.
115
+
116
+ ## Cloud Demo
117
+ Cargo Tracker is deployed to Kubernetes on the cloud using GitHub Actions workflows. You can find the demo deployment on the Scaleforce cloud (https://cargo-tracker.j.scaleforce.net). This project is very thankful to our sponsors [Jelastic](https://jelastic.com) and [Scaleforce](https://www.scaleforce.net) for hosting the demo! The deployment and all data is refreshed nightly. On the cloud Cargo Tracker uses PostgreSQL as the database. The [GitHub Container Registry](https://ghcr.io/eclipse-ee4j/cargo-tracker) is used to publish Docker images.
118
+
119
+ ## Java EE 7
120
+ A Java EE 7, Java SE 8, Payara 4.1 version of Cargo Tracker is available under the ['javaee7' branch](https://github.com/eclipse-ee4j/cargotracker/tree/javaee7).
121
+
122
+ ## Contributing
123
+ This project complies with the Google Style Guides for [Java](https://google.github.io/styleguide/javaguide.html), [JavaScript](https://google.github.io/styleguide/jsguide.html), and [HTML/CSS](https://google.github.io/styleguide/htmlcssguide.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.
124
+
125
+ In general for all files we use a column/line width of 80 whenever possible and we use 2 spaces for indentation. All files must end with a new line. Please adjust the formatting settings of your IDE accordingly. You are encouraged but not required to use HTML Tidy and CSS Tidy to help format your code.
126
+
127
+ For further guidance on contributing including the project roadmap, please look [here](CONTRIBUTING.md).
128
+
129
+ ## Known Issues
130
+ * When you load the project in the Eclipse IDE, you may get some spurious validation failure messages on the XML deployment descriptors (these are essentially bugs in the Eclipse IDE). These are harmless and the application is just fine. You can simply ignore these false validation messages or delete them by going to the Markers tab.
131
+ * You may get a log message stating that Payara SSL certificates have expired. This won't get in the way of functionality, but it will
132
+ 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
133
+ explained [here](https://github.com/payara/Payara/issues/3038).
134
+ * If you restart the application a few times, you will run into a bug causing a spurious deployment failure. While the problem can be annoying, it's harmless.
135
+ Just re-run the application (make sure to completely un-deploy the application and shut down Payara first).
136
+ * Sometimes when the server is not shut down correctly or there is a locking/permissions issue, the H2 database that
137
+ the application uses get's corrupted, resulting in strange database errors. If
138
+ this occurs, you will need to stop the application and clean the database. You
139
+ can do this by simply removing the cargo-tracker-data directory from the file
140
+ system and restarting the application. This directory will typically be under $your-payara-installation/glassfish/domains/domain1/config.
benchmark/whole_applications/cargotracker/jakarta/cargo-tracker.yml ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ apiVersion: apps/v1
2
+ kind: Deployment
3
+ metadata:
4
+ name: cargo-tracker
5
+ spec:
6
+ replicas: 2
7
+ selector:
8
+ matchLabels:
9
+ app: cargo-tracker
10
+ template:
11
+ metadata:
12
+ name: cargo-tracker
13
+ labels:
14
+ app: cargo-tracker
15
+ spec:
16
+ containers:
17
+ - name: cargo-tracker
18
+ image: ghcr.io/eclipse-ee4j/cargo-tracker:v2.2-SNAPSHOT
19
+ imagePullPolicy: Always
20
+ ---
21
+ apiVersion: v1
22
+ kind: Service
23
+ metadata:
24
+ name: cargo-tracker
25
+ spec:
26
+ type: ClusterIP
27
+ ports:
28
+ - port: 80
29
+ targetPort: 8080
30
+ selector:
31
+ app: cargo-tracker
32
+ ---
33
+ apiVersion: networking.k8s.io/v1
34
+ kind: Ingress
35
+ metadata:
36
+ name: cargo-tracker
37
+ namespace: default
38
+ annotations:
39
+ kubernetes.io/ingress.class: nginx
40
+ nginx.ingress.kubernetes.io/affinity: "cookie"
41
+ nginx.ingress.kubernetes.io/session-cookie-expires: "172800"
42
+ nginx.ingress.kubernetes.io/session-cookie-max-age: "172800"
43
+ spec:
44
+ rules:
45
+ - http:
46
+ paths:
47
+ - path: /
48
+ pathType: Prefix
49
+ backend:
50
+ service:
51
+ name: cargo-tracker
52
+ port:
53
+ number: 80
benchmark/whole_applications/cargotracker/jakarta/mvnw ADDED
@@ -0,0 +1,295 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ # ----------------------------------------------------------------------------
3
+ # Licensed to the Apache Software Foundation (ASF) under one
4
+ # or more contributor license agreements. See the NOTICE file
5
+ # distributed with this work for additional information
6
+ # regarding copyright ownership. The ASF licenses this file
7
+ # to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance
9
+ # with the License. You may obtain a copy of the License at
10
+ #
11
+ # https://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing,
14
+ # software distributed under the License is distributed on an
15
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ # KIND, either express or implied. See the License for the
17
+ # specific language governing permissions and limitations
18
+ # under the License.
19
+ # ----------------------------------------------------------------------------
20
+
21
+ # ----------------------------------------------------------------------------
22
+ # Apache Maven Wrapper startup batch script, version 3.3.4
23
+ #
24
+ # Optional ENV vars
25
+ # -----------------
26
+ # JAVA_HOME - location of a JDK home dir, required when download maven via java source
27
+ # MVNW_REPOURL - repo url base for downloading maven distribution
28
+ # MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
29
+ # MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output
30
+ # ----------------------------------------------------------------------------
31
+
32
+ set -euf
33
+ [ "${MVNW_VERBOSE-}" != debug ] || set -x
34
+
35
+ # OS specific support.
36
+ native_path() { printf %s\\n "$1"; }
37
+ case "$(uname)" in
38
+ CYGWIN* | MINGW*)
39
+ [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")"
40
+ native_path() { cygpath --path --windows "$1"; }
41
+ ;;
42
+ esac
43
+
44
+ # set JAVACMD and JAVACCMD
45
+ set_java_home() {
46
+ # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched
47
+ if [ -n "${JAVA_HOME-}" ]; then
48
+ if [ -x "$JAVA_HOME/jre/sh/java" ]; then
49
+ # IBM's JDK on AIX uses strange locations for the executables
50
+ JAVACMD="$JAVA_HOME/jre/sh/java"
51
+ JAVACCMD="$JAVA_HOME/jre/sh/javac"
52
+ else
53
+ JAVACMD="$JAVA_HOME/bin/java"
54
+ JAVACCMD="$JAVA_HOME/bin/javac"
55
+
56
+ if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then
57
+ echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2
58
+ echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2
59
+ return 1
60
+ fi
61
+ fi
62
+ else
63
+ JAVACMD="$(
64
+ 'set' +e
65
+ 'unset' -f command 2>/dev/null
66
+ 'command' -v java
67
+ )" || :
68
+ JAVACCMD="$(
69
+ 'set' +e
70
+ 'unset' -f command 2>/dev/null
71
+ 'command' -v javac
72
+ )" || :
73
+
74
+ if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then
75
+ echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2
76
+ return 1
77
+ fi
78
+ fi
79
+ }
80
+
81
+ # hash string like Java String::hashCode
82
+ hash_string() {
83
+ str="${1:-}" h=0
84
+ while [ -n "$str" ]; do
85
+ char="${str%"${str#?}"}"
86
+ h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296))
87
+ str="${str#?}"
88
+ done
89
+ printf %x\\n $h
90
+ }
91
+
92
+ verbose() { :; }
93
+ [ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; }
94
+
95
+ die() {
96
+ printf %s\\n "$1" >&2
97
+ exit 1
98
+ }
99
+
100
+ trim() {
101
+ # MWRAPPER-139:
102
+ # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds.
103
+ # Needed for removing poorly interpreted newline sequences when running in more
104
+ # exotic environments such as mingw bash on Windows.
105
+ printf "%s" "${1}" | tr -d '[:space:]'
106
+ }
107
+
108
+ scriptDir="$(dirname "$0")"
109
+ scriptName="$(basename "$0")"
110
+
111
+ # parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties
112
+ while IFS="=" read -r key value; do
113
+ case "${key-}" in
114
+ distributionUrl) distributionUrl=$(trim "${value-}") ;;
115
+ distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;;
116
+ esac
117
+ done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties"
118
+ [ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
119
+
120
+ case "${distributionUrl##*/}" in
121
+ maven-mvnd-*bin.*)
122
+ MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/
123
+ case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in
124
+ *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;;
125
+ :Darwin*x86_64) distributionPlatform=darwin-amd64 ;;
126
+ :Darwin*arm64) distributionPlatform=darwin-aarch64 ;;
127
+ :Linux*x86_64*) distributionPlatform=linux-amd64 ;;
128
+ *)
129
+ echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2
130
+ distributionPlatform=linux-amd64
131
+ ;;
132
+ esac
133
+ distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip"
134
+ ;;
135
+ maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;;
136
+ *) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;;
137
+ esac
138
+
139
+ # apply MVNW_REPOURL and calculate MAVEN_HOME
140
+ # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
141
+ [ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}"
142
+ distributionUrlName="${distributionUrl##*/}"
143
+ distributionUrlNameMain="${distributionUrlName%.*}"
144
+ distributionUrlNameMain="${distributionUrlNameMain%-bin}"
145
+ MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}"
146
+ MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")"
147
+
148
+ exec_maven() {
149
+ unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || :
150
+ exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD"
151
+ }
152
+
153
+ if [ -d "$MAVEN_HOME" ]; then
154
+ verbose "found existing MAVEN_HOME at $MAVEN_HOME"
155
+ exec_maven "$@"
156
+ fi
157
+
158
+ case "${distributionUrl-}" in
159
+ *?-bin.zip | *?maven-mvnd-?*-?*.zip) ;;
160
+ *) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;;
161
+ esac
162
+
163
+ # prepare tmp dir
164
+ if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then
165
+ clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; }
166
+ trap clean HUP INT TERM EXIT
167
+ else
168
+ die "cannot create temp dir"
169
+ fi
170
+
171
+ mkdir -p -- "${MAVEN_HOME%/*}"
172
+
173
+ # Download and Install Apache Maven
174
+ verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
175
+ verbose "Downloading from: $distributionUrl"
176
+ verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
177
+
178
+ # select .zip or .tar.gz
179
+ if ! command -v unzip >/dev/null; then
180
+ distributionUrl="${distributionUrl%.zip}.tar.gz"
181
+ distributionUrlName="${distributionUrl##*/}"
182
+ fi
183
+
184
+ # verbose opt
185
+ __MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR=''
186
+ [ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v
187
+
188
+ # normalize http auth
189
+ case "${MVNW_PASSWORD:+has-password}" in
190
+ '') MVNW_USERNAME='' MVNW_PASSWORD='' ;;
191
+ has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;;
192
+ esac
193
+
194
+ if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then
195
+ verbose "Found wget ... using wget"
196
+ wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl"
197
+ elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then
198
+ verbose "Found curl ... using curl"
199
+ curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl"
200
+ elif set_java_home; then
201
+ verbose "Falling back to use Java to download"
202
+ javaSource="$TMP_DOWNLOAD_DIR/Downloader.java"
203
+ targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName"
204
+ cat >"$javaSource" <<-END
205
+ public class Downloader extends java.net.Authenticator
206
+ {
207
+ protected java.net.PasswordAuthentication getPasswordAuthentication()
208
+ {
209
+ return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() );
210
+ }
211
+ public static void main( String[] args ) throws Exception
212
+ {
213
+ setDefault( new Downloader() );
214
+ java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() );
215
+ }
216
+ }
217
+ END
218
+ # For Cygwin/MinGW, switch paths to Windows format before running javac and java
219
+ verbose " - Compiling Downloader.java ..."
220
+ "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java"
221
+ verbose " - Running Downloader.java ..."
222
+ "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")"
223
+ fi
224
+
225
+ # If specified, validate the SHA-256 sum of the Maven distribution zip file
226
+ if [ -n "${distributionSha256Sum-}" ]; then
227
+ distributionSha256Result=false
228
+ if [ "$MVN_CMD" = mvnd.sh ]; then
229
+ echo "Checksum validation is not supported for maven-mvnd." >&2
230
+ echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
231
+ exit 1
232
+ elif command -v sha256sum >/dev/null; then
233
+ if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then
234
+ distributionSha256Result=true
235
+ fi
236
+ elif command -v shasum >/dev/null; then
237
+ if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then
238
+ distributionSha256Result=true
239
+ fi
240
+ else
241
+ echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2
242
+ echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
243
+ exit 1
244
+ fi
245
+ if [ $distributionSha256Result = false ]; then
246
+ echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2
247
+ echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2
248
+ exit 1
249
+ fi
250
+ fi
251
+
252
+ # unzip and move
253
+ if command -v unzip >/dev/null; then
254
+ unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip"
255
+ else
256
+ tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar"
257
+ fi
258
+
259
+ # Find the actual extracted directory name (handles snapshots where filename != directory name)
260
+ actualDistributionDir=""
261
+
262
+ # First try the expected directory name (for regular distributions)
263
+ if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then
264
+ if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then
265
+ actualDistributionDir="$distributionUrlNameMain"
266
+ fi
267
+ fi
268
+
269
+ # If not found, search for any directory with the Maven executable (for snapshots)
270
+ if [ -z "$actualDistributionDir" ]; then
271
+ # enable globbing to iterate over items
272
+ set +f
273
+ for dir in "$TMP_DOWNLOAD_DIR"/*; do
274
+ if [ -d "$dir" ]; then
275
+ if [ -f "$dir/bin/$MVN_CMD" ]; then
276
+ actualDistributionDir="$(basename "$dir")"
277
+ break
278
+ fi
279
+ fi
280
+ done
281
+ set -f
282
+ fi
283
+
284
+ if [ -z "$actualDistributionDir" ]; then
285
+ verbose "Contents of $TMP_DOWNLOAD_DIR:"
286
+ verbose "$(ls -la "$TMP_DOWNLOAD_DIR")"
287
+ die "Could not find Maven distribution directory in extracted archive"
288
+ fi
289
+
290
+ verbose "Found extracted Maven distribution directory: $actualDistributionDir"
291
+ printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url"
292
+ mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME"
293
+
294
+ clean || :
295
+ exec_maven "$@"
benchmark/whole_applications/cargotracker/jakarta/mvnw.cmd ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <# : batch portion
2
+ @REM ----------------------------------------------------------------------------
3
+ @REM Licensed to the Apache Software Foundation (ASF) under one
4
+ @REM or more contributor license agreements. See the NOTICE file
5
+ @REM distributed with this work for additional information
6
+ @REM regarding copyright ownership. The ASF licenses this file
7
+ @REM to you under the Apache License, Version 2.0 (the
8
+ @REM "License"); you may not use this file except in compliance
9
+ @REM with the License. You may obtain a copy of the License at
10
+ @REM
11
+ @REM https://www.apache.org/licenses/LICENSE-2.0
12
+ @REM
13
+ @REM Unless required by applicable law or agreed to in writing,
14
+ @REM software distributed under the License is distributed on an
15
+ @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ @REM KIND, either express or implied. See the License for the
17
+ @REM specific language governing permissions and limitations
18
+ @REM under the License.
19
+ @REM ----------------------------------------------------------------------------
20
+
21
+ @REM ----------------------------------------------------------------------------
22
+ @REM Apache Maven Wrapper startup batch script, version 3.3.4
23
+ @REM
24
+ @REM Optional ENV vars
25
+ @REM MVNW_REPOURL - repo url base for downloading maven distribution
26
+ @REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
27
+ @REM MVNW_VERBOSE - true: enable verbose log; others: silence the output
28
+ @REM ----------------------------------------------------------------------------
29
+
30
+ @IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0)
31
+ @SET __MVNW_CMD__=
32
+ @SET __MVNW_ERROR__=
33
+ @SET __MVNW_PSMODULEP_SAVE=%PSModulePath%
34
+ @SET PSModulePath=
35
+ @FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @(
36
+ IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B)
37
+ )
38
+ @SET PSModulePath=%__MVNW_PSMODULEP_SAVE%
39
+ @SET __MVNW_PSMODULEP_SAVE=
40
+ @SET __MVNW_ARG0_NAME__=
41
+ @SET MVNW_USERNAME=
42
+ @SET MVNW_PASSWORD=
43
+ @IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*)
44
+ @echo Cannot start maven from wrapper >&2 && exit /b 1
45
+ @GOTO :EOF
46
+ : end batch / begin powershell #>
47
+
48
+ $ErrorActionPreference = "Stop"
49
+ if ($env:MVNW_VERBOSE -eq "true") {
50
+ $VerbosePreference = "Continue"
51
+ }
52
+
53
+ # calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties
54
+ $distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl
55
+ if (!$distributionUrl) {
56
+ Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
57
+ }
58
+
59
+ switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) {
60
+ "maven-mvnd-*" {
61
+ $USE_MVND = $true
62
+ $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip"
63
+ $MVN_CMD = "mvnd.cmd"
64
+ break
65
+ }
66
+ default {
67
+ $USE_MVND = $false
68
+ $MVN_CMD = $script -replace '^mvnw','mvn'
69
+ break
70
+ }
71
+ }
72
+
73
+ # apply MVNW_REPOURL and calculate MAVEN_HOME
74
+ # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
75
+ if ($env:MVNW_REPOURL) {
76
+ $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" }
77
+ $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')"
78
+ }
79
+ $distributionUrlName = $distributionUrl -replace '^.*/',''
80
+ $distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$',''
81
+
82
+ $MAVEN_M2_PATH = "$HOME/.m2"
83
+ if ($env:MAVEN_USER_HOME) {
84
+ $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME"
85
+ }
86
+
87
+ if (-not (Test-Path -Path $MAVEN_M2_PATH)) {
88
+ New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null
89
+ }
90
+
91
+ $MAVEN_WRAPPER_DISTS = $null
92
+ if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) {
93
+ $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists"
94
+ } else {
95
+ $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists"
96
+ }
97
+
98
+ $MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain"
99
+ $MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join ''
100
+ $MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME"
101
+
102
+ if (Test-Path -Path "$MAVEN_HOME" -PathType Container) {
103
+ Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME"
104
+ Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
105
+ exit $?
106
+ }
107
+
108
+ if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) {
109
+ Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl"
110
+ }
111
+
112
+ # prepare tmp dir
113
+ $TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile
114
+ $TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir"
115
+ $TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null
116
+ trap {
117
+ if ($TMP_DOWNLOAD_DIR.Exists) {
118
+ try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
119
+ catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
120
+ }
121
+ }
122
+
123
+ New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null
124
+
125
+ # Download and Install Apache Maven
126
+ Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
127
+ Write-Verbose "Downloading from: $distributionUrl"
128
+ Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
129
+
130
+ $webclient = New-Object System.Net.WebClient
131
+ if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) {
132
+ $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD)
133
+ }
134
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
135
+ $webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null
136
+
137
+ # If specified, validate the SHA-256 sum of the Maven distribution zip file
138
+ $distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum
139
+ if ($distributionSha256Sum) {
140
+ if ($USE_MVND) {
141
+ Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties."
142
+ }
143
+ Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash
144
+ if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) {
145
+ Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property."
146
+ }
147
+ }
148
+
149
+ # unzip and move
150
+ Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null
151
+
152
+ # Find the actual extracted directory name (handles snapshots where filename != directory name)
153
+ $actualDistributionDir = ""
154
+
155
+ # First try the expected directory name (for regular distributions)
156
+ $expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain"
157
+ $expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD"
158
+ if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) {
159
+ $actualDistributionDir = $distributionUrlNameMain
160
+ }
161
+
162
+ # If not found, search for any directory with the Maven executable (for snapshots)
163
+ if (!$actualDistributionDir) {
164
+ Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object {
165
+ $testPath = Join-Path $_.FullName "bin/$MVN_CMD"
166
+ if (Test-Path -Path $testPath -PathType Leaf) {
167
+ $actualDistributionDir = $_.Name
168
+ }
169
+ }
170
+ }
171
+
172
+ if (!$actualDistributionDir) {
173
+ Write-Error "Could not find Maven distribution directory in extracted archive"
174
+ }
175
+
176
+ Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir"
177
+ Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null
178
+ try {
179
+ Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null
180
+ } catch {
181
+ if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) {
182
+ Write-Error "fail to move MAVEN_HOME"
183
+ }
184
+ } finally {
185
+ try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
186
+ catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
187
+ }
188
+
189
+ Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
benchmark/whole_applications/cargotracker/jakarta/pom.xml ADDED
@@ -0,0 +1,299 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version='1.0' encoding='utf-8'?>
2
+ <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3
+ <modelVersion>4.0.0</modelVersion>
4
+ <groupId>org.eclipse.ee4j</groupId>
5
+ <artifactId>cargo-tracker</artifactId>
6
+ <version>2.2-SNAPSHOT</version>
7
+ <packaging>war</packaging>
8
+ <name>Eclipse Cargo Tracker</name>
9
+ <description>The project demonstrates how you can develop applications with the Jakarta EE platform using widely adopted architectural best practices like Domain-Driven Design (DDD).</description>
10
+ <url>https://eclipse-ee4j.github.io/cargotracker/</url>
11
+ <organization>
12
+ <name>Eclipse Foundation</name>
13
+ <url>https://www.eclipse.org/org/foundation/</url>
14
+ </organization>
15
+ <issueManagement>
16
+ <system>github</system>
17
+ <url>https://github.com/eclipse-ee4j/cargotracker/issues</url>
18
+ </issueManagement>
19
+ <properties>
20
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
21
+ <project.report.sourceEncoding>UTF-8</project.report.sourceEncoding>
22
+ <maven.compiler.target>1.8</maven.compiler.target>
23
+ <maven.compiler.source>1.8</maven.compiler.source>
24
+ <jakartaee-api.version>8.0.0</jakartaee-api.version>
25
+ </properties>
26
+ <dependencyManagement>
27
+ <dependencies>
28
+ <dependency>
29
+ <groupId>org.jboss.arquillian</groupId>
30
+ <artifactId>arquillian-bom</artifactId>
31
+ <version>1.7.0.Final</version>
32
+ <scope>import</scope>
33
+ <type>pom</type>
34
+ </dependency>
35
+ </dependencies>
36
+ </dependencyManagement>
37
+ <dependencies>
38
+ <dependency>
39
+ <groupId>jakarta.platform</groupId>
40
+ <artifactId>jakarta.jakartaee-api</artifactId>
41
+ <version>${jakartaee-api.version}</version>
42
+ <scope>provided</scope>
43
+ </dependency>
44
+ <dependency>
45
+ <groupId>org.glassfish.jaxb</groupId>
46
+ <artifactId>jaxb-runtime</artifactId>
47
+ <version>2.3.8</version>
48
+ <scope>provided</scope>
49
+ </dependency>
50
+ <dependency>
51
+ <groupId>org.apache.commons</groupId>
52
+ <artifactId>commons-lang3</artifactId>
53
+ <version>3.18.0</version>
54
+ </dependency>
55
+ <dependency>
56
+ <groupId>org.primefaces</groupId>
57
+ <artifactId>primefaces</artifactId>
58
+ <version>10.0.26-LTS</version>
59
+ </dependency>
60
+ <dependency>
61
+ <groupId>junit</groupId>
62
+ <artifactId>junit</artifactId>
63
+ <version>4.13.2</version>
64
+ <scope>test</scope>
65
+ </dependency>
66
+ <dependency>
67
+ <groupId>org.hamcrest</groupId>
68
+ <artifactId>hamcrest</artifactId>
69
+ <version>2.2</version>
70
+ <scope>test</scope>
71
+ </dependency>
72
+ <dependency>
73
+ <groupId>org.assertj</groupId>
74
+ <artifactId>assertj-core</artifactId>
75
+ <version>3.24.2</version>
76
+ <scope>test</scope>
77
+ </dependency>
78
+ <dependency>
79
+ <groupId>org.jboss.arquillian.junit</groupId>
80
+ <artifactId>arquillian-junit-container</artifactId>
81
+ <scope>test</scope>
82
+ </dependency>
83
+ <dependency>
84
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
85
+ <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
86
+ <scope>test</scope>
87
+ </dependency>
88
+ <dependency>
89
+ <groupId>org.slf4j</groupId>
90
+ <artifactId>slf4j-simple</artifactId>
91
+ <scope>test</scope>
92
+ </dependency>
93
+ </dependencies>
94
+ <build>
95
+ <finalName>cargo-tracker</finalName>
96
+ <plugins>
97
+ <plugin>
98
+ <groupId>org.apache.maven.plugins</groupId>
99
+ <artifactId>maven-war-plugin</artifactId>
100
+ <version>3.4.0</version>
101
+ <configuration>
102
+ <failOnMissingWebXml>false</failOnMissingWebXml>
103
+ <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
104
+ </configuration>
105
+ </plugin>
106
+ </plugins>
107
+ </build>
108
+ <profiles>
109
+ <profile>
110
+ <id>openliberty</id>
111
+ <activation>
112
+ <activeByDefault>false</activeByDefault>
113
+ </activation>
114
+ <properties>
115
+ <webapp.graphTraversalUrl>http://localhost:8080/cargo-tracker/rest/graph-traversal/shortest-path</webapp.graphTraversalUrl>
116
+ <db.driverClass>org.h2.jdbcx.JdbcDataSource</db.driverClass>
117
+ <db.jdbcUrl>jdbc:h2:file:./cargo-tracker-data/cargo-tracker-database</db.jdbcUrl>
118
+ <db.user />
119
+ <db.password />
120
+ </properties>
121
+ <dependencies>
122
+ <dependency>
123
+ <groupId>org.glassfish.jersey.core</groupId>
124
+ <artifactId>jersey-server</artifactId>
125
+ <version>3.1.2</version>
126
+ <scope>provided</scope>
127
+ </dependency>
128
+ <dependency>
129
+ <groupId>com.h2database</groupId>
130
+ <artifactId>h2</artifactId>
131
+ <version>2.2.220</version>
132
+ <scope>runtime</scope>
133
+ </dependency>
134
+ </dependencies>
135
+ <build>
136
+ <plugins>
137
+ <plugin>
138
+ <groupId>io.openliberty.tools</groupId>
139
+ <artifactId>liberty-maven-plugin</artifactId>
140
+ <version>3.10.3</version>
141
+ <configuration>
142
+ <serverName>cargo-tracker</serverName>
143
+ <looseApplication>true</looseApplication>
144
+ <copyDependencies>
145
+ <dependencyGroup>
146
+ <location>lib/global/jdbc</location>
147
+ <dependency>
148
+ <groupId>com.h2database</groupId>
149
+ <artifactId>h2</artifactId>
150
+ </dependency>
151
+ </dependencyGroup>
152
+ </copyDependencies>
153
+ </configuration>
154
+ </plugin>
155
+ </plugins>
156
+ </build>
157
+ </profile>
158
+ <profile>
159
+ <id>payara</id>
160
+ <activation>
161
+ <activeByDefault>true</activeByDefault>
162
+ </activation>
163
+ <properties>
164
+ <payara.version>5.2022.5</payara.version>
165
+ <webapp.graphTraversalUrl>http://localhost:8080/cargo-tracker/rest/graph-traversal/shortest-path</webapp.graphTraversalUrl>
166
+ <db.driverClass>org.h2.jdbcx.JdbcDataSource</db.driverClass>
167
+ <db.jdbcUrl>jdbc:h2:file:./cargo-tracker-data/cargo-tracker-database;create=true</db.jdbcUrl>
168
+ <db.user />
169
+ <db.password />
170
+ </properties>
171
+ <dependencies>
172
+ <dependency>
173
+ <groupId>org.glassfish.jersey.core</groupId>
174
+ <artifactId>jersey-server</artifactId>
175
+ <version>3.1.2</version>
176
+ <scope>provided</scope>
177
+ </dependency>
178
+ <dependency>
179
+ <groupId>com.h2database</groupId>
180
+ <artifactId>h2</artifactId>
181
+ <version>2.2.220</version>
182
+ <scope>runtime</scope>
183
+ </dependency>
184
+ <dependency>
185
+ <groupId>fish.payara.extras</groupId>
186
+ <artifactId>payara-micro</artifactId>
187
+ <version>${payara.version}</version>
188
+ <scope>test</scope>
189
+ </dependency>
190
+ <dependency>
191
+ <groupId>fish.payara.arquillian</groupId>
192
+ <artifactId>arquillian-payara-micro-managed</artifactId>
193
+ <version>2.4.5</version>
194
+ <scope>test</scope>
195
+ </dependency>
196
+ </dependencies>
197
+ <build>
198
+ <plugins>
199
+ <plugin>
200
+ <groupId>org.apache.maven.plugins</groupId>
201
+ <artifactId>maven-surefire-plugin</artifactId>
202
+ <version>3.1.2</version>
203
+ </plugin>
204
+ <plugin>
205
+ <groupId>org.codehaus.cargo</groupId>
206
+ <artifactId>cargo-maven3-plugin</artifactId>
207
+ <version>1.10.7</version>
208
+ <configuration>
209
+ <container>
210
+ <containerId>payara</containerId>
211
+ <artifactInstaller>
212
+ <groupId>fish.payara.distributions</groupId>
213
+ <artifactId>payara</artifactId>
214
+ <version>${payara.version}</version>
215
+ </artifactInstaller>
216
+ <timeout>180000</timeout>
217
+ </container>
218
+ </configuration>
219
+ </plugin>
220
+ </plugins>
221
+ </build>
222
+ </profile>
223
+ <profile>
224
+ <id>cloud</id>
225
+ <activation>
226
+ <activeByDefault>false</activeByDefault>
227
+ </activation>
228
+ <properties>
229
+ <payara.version>5.2022.5</payara.version>
230
+ <webapp.graphTraversalUrl>http://localhost:8080/rest/graph-traversal/shortest-path</webapp.graphTraversalUrl>
231
+ <db.driverClass>org.postgresql.ds.PGPoolingDataSource</db.driverClass>
232
+ <db.jdbcUrl>${postgreSqlJdbcUrl}</db.jdbcUrl>
233
+ <db.user>${postgreSqlUsername}</db.user>
234
+ <db.password>${postgreSqlPassword}</db.password>
235
+ </properties>
236
+ <dependencies>
237
+ <dependency>
238
+ <groupId>org.glassfish.jersey.core</groupId>
239
+ <artifactId>jersey-server</artifactId>
240
+ <version>3.1.2</version>
241
+ <scope>provided</scope>
242
+ </dependency>
243
+ <dependency>
244
+ <groupId>com.h2database</groupId>
245
+ <artifactId>h2</artifactId>
246
+ <version>2.2.220</version>
247
+ <scope>test</scope>
248
+ </dependency>
249
+ <dependency>
250
+ <groupId>fish.payara.extras</groupId>
251
+ <artifactId>payara-micro</artifactId>
252
+ <version>${payara.version}</version>
253
+ <scope>test</scope>
254
+ </dependency>
255
+ <dependency>
256
+ <groupId>fish.payara.arquillian</groupId>
257
+ <artifactId>arquillian-payara-micro-managed</artifactId>
258
+ <version>2.5</version>
259
+ <scope>test</scope>
260
+ </dependency>
261
+ </dependencies>
262
+ <build>
263
+ <plugins>
264
+ <plugin>
265
+ <groupId>org.apache.maven.plugins</groupId>
266
+ <artifactId>maven-dependency-plugin</artifactId>
267
+ <version>3.6.0</version>
268
+ <executions>
269
+ <execution>
270
+ <id>copy</id>
271
+ <phase>prepare-package</phase>
272
+ <goals>
273
+ <goal>copy</goal>
274
+ </goals>
275
+ </execution>
276
+ </executions>
277
+ <configuration>
278
+ <artifactItems>
279
+ <artifactItem>
280
+ <groupId>org.postgresql</groupId>
281
+ <artifactId>postgresql</artifactId>
282
+ <version>42.6.0</version>
283
+ <overWrite>true</overWrite>
284
+ <outputDirectory>${project.build.directory}</outputDirectory>
285
+ <destFileName>postgresql.jar</destFileName>
286
+ </artifactItem>
287
+ </artifactItems>
288
+ </configuration>
289
+ </plugin>
290
+ <plugin>
291
+ <groupId>org.apache.maven.plugins</groupId>
292
+ <artifactId>maven-surefire-plugin</artifactId>
293
+ <version>3.1.2</version>
294
+ </plugin>
295
+ </plugins>
296
+ </build>
297
+ </profile>
298
+ </profiles>
299
+ </project>
benchmark/whole_applications/cargotracker/jakarta/post-boot-commands.asadmin ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ add-library /tmp/postgresql.jar
2
+ deploy --name cargo-tracker --contextroot / /tmp/cargo-tracker.war
benchmark/whole_applications/cargotracker/jakarta/postgres.yml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ apiVersion: apps/v1
2
+ kind: Deployment
3
+ metadata:
4
+ name: postgres
5
+ spec:
6
+ selector:
7
+ matchLabels:
8
+ app: postgres
9
+ template:
10
+ metadata:
11
+ labels:
12
+ app: postgres
13
+ spec:
14
+ containers:
15
+ - image: postgres
16
+ name: postgres
17
+ env:
18
+ - name: POSTGRES_USER
19
+ valueFrom:
20
+ configMapKeyRef:
21
+ name: postgres-config
22
+ key: postgres_user
23
+ - name: POSTGRES_PASSWORD
24
+ valueFrom:
25
+ configMapKeyRef:
26
+ name: postgres-config
27
+ key: postgres_password
28
+ ports:
29
+ - containerPort: 5432
30
+ name: postgres
31
+ ---
32
+ apiVersion: v1
33
+ kind: Service
34
+ metadata:
35
+ name: postgres
36
+ spec:
37
+ type: ClusterIP
38
+ ports:
39
+ - port: 5432
40
+ selector:
41
+ app: postgres
benchmark/whole_applications/cargotracker/jakarta/test.sh ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ BASE_URL="${BASE_URL:-http://localhost:8080/cargo-tracker}"
5
+
6
+ echo "Health check: ${BASE_URL}/index.xhtml"
7
+ HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}/index.xhtml")
8
+
9
+ if [ "$HTTP_STATUS" -eq 200 ]; then
10
+ echo "PASS - got HTTP ${HTTP_STATUS}"
11
+ exit 0
12
+ else
13
+ echo "FAIL - got HTTP ${HTTP_STATUS}"
14
+ exit 1
15
+ fi
benchmark/whole_applications/cargotracker/quarkus/.dockerignore ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # VCS
2
+ .git/
3
+
4
+ # Maven
5
+ .mvn/
6
+ **/.mvn/
7
+ mvnw
8
+ mvnw.cmd
9
+ **/mvnw
10
+ **/mvnw.cmd
11
+ target/
12
+ **/target/
13
+ pom.xml.tag
14
+ pom.xml.releaseBackup
15
+ pom.xml.versionsBackup
16
+ pom.xml.next
17
+ release.properties
18
+ dependency-reduced-pom.xml
19
+ buildNumber.properties
20
+
21
+ # IDE / Editor
22
+ .vscode/
23
+ **/.vscode/
24
+ .zed/
25
+ **/.zed/
26
+ .idea/
27
+ **/.idea/
28
+ *.iml
29
+ *.ipr
30
+ *.iws
31
+
32
+ # OS
33
+ .DS_Store
34
+ **/.DS_Store
35
+ Thumbs.db
36
+ ehthumbs.db
37
+
38
+ # Logs / temp
39
+ *.log
40
+ *.tmp
41
+ *.temp
benchmark/whole_applications/cargotracker/quarkus/Dockerfile ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM maven:3.9.12-ibm-semeru-21-noble
2
+
3
+ USER root
4
+ # install uv
5
+ RUN apt-get update && apt-get install -y --no-install-recommends curl lsof python3-venv python3-full && curl -LsSf https://astral.sh/uv/install.sh | sh
6
+
7
+ ENV PATH="/root/.local/bin:$PATH"
8
+
9
+ # Shared browsers path so Chromium is cached once
10
+ ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
11
+ RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright
12
+
13
+ # create venv and install
14
+ RUN uv venv /opt/venv && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest
15
+
16
+ ENV PATH="/opt/venv/bin:$PATH"
17
+ RUN playwright install --with-deps chromium
18
+
19
+ # Install ActiveMQ Artemis (required as AMQP broker for JMS messaging)
20
+ ENV ARTEMIS_VERSION=2.31.2
21
+ ENV ARTEMIS_HOME=/opt/artemis
22
+ RUN curl -L -o /tmp/artemis.tar.gz "https://archive.apache.org/dist/activemq/activemq-artemis/${ARTEMIS_VERSION}/apache-artemis-${ARTEMIS_VERSION}-bin.tar.gz" \
23
+ && mkdir -p ${ARTEMIS_HOME} \
24
+ && tar xzf /tmp/artemis.tar.gz -C ${ARTEMIS_HOME} --strip-components=1 \
25
+ && rm /tmp/artemis.tar.gz \
26
+ && ${ARTEMIS_HOME}/bin/artemis create /var/lib/artemis-broker \
27
+ --user quarkus --password quarkus --allow-anonymous --no-web --silent
28
+
29
+ # Set working directory
30
+ WORKDIR /app
31
+
32
+ # Copy all the assets
33
+ COPY . .
34
+
35
+ RUN if [ -f mvnw ]; then chmod +x mvnw; fi && if [ -f smoke.py ]; then chmod +x smoke.py; fi && if [ -f test.sh ]; then chmod +x test.sh; fi
36
+
37
+ # Build the application at image build time
38
+ RUN mvn clean install -DskipTests
39
+
40
+ # Start Artemis broker in background, then run Quarkus
41
+ CMD /var/lib/artemis-broker/bin/artemis-service start && mvn quarkus:run
benchmark/whole_applications/cargotracker/quarkus/README.md ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # cargo-tracker
2
+
3
+ This project uses Quarkus, the Supersonic Subatomic Java Framework.
4
+
5
+ If you want to learn more about Quarkus, please visit its website: <https://quarkus.io/>.
6
+
7
+ ## Running the application in dev mode
8
+
9
+ The application uses an external messaging sever, so before running the application make sure to start your messaging server.
10
+ For example:
11
+
12
+ ```sh
13
+ docker run -it --rm -p 8161:8161 -p 61616:61616 -p 5672:5672 -e AMQ_USER=quarkus -e AMQ_PASSWORD=quarkus quay.io/artemiscloud/activemq-artemis-broker:1.0.32
14
+ ```
15
+
16
+ You can run your application in dev mode that enables live coding using:
17
+
18
+ ```sh
19
+ ./mvnw quarkus:dev
20
+ ```
21
+
22
+ > **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at <http://localhost:8080/q/dev/>.
23
+
24
+ ## Packaging and running the application
25
+
26
+ The application can be packaged using:
27
+
28
+ ```sh
29
+ ./mvnw package
30
+ ```
31
+
32
+ It produces the `quarkus-run.jar` file in the `target/quarkus-app/` directory.
33
+ Be aware that it’s not an _über-jar_ as the dependencies are copied into the `target/quarkus-app/lib/` directory.
34
+
35
+ The application is now runnable using `java -jar target/quarkus-app/quarkus-run.jar`.
36
+
37
+ If you want to build an _über-jar_, execute the following command:
38
+
39
+ ```sh
40
+ ./mvnw package -Dquarkus.package.jar.type=uber-jar
41
+ ```
42
+
43
+ The application, packaged as an _über-jar_, is now runnable using `java -jar target/*-runner.jar`.
44
+
45
+ ## Creating a native executable
46
+
47
+ You can create a native executable using:
48
+
49
+ ```sh
50
+ ./mvnw package -Dnative
51
+ ```
52
+
53
+ Or, if you don't have GraalVM installed, you can run the native executable build in a container using:
54
+
55
+ ```sh
56
+ ./mvnw package -Dnative -Dquarkus.native.container-build=true
57
+ ```
58
+
59
+ You can then execute your native executable with: `./target/cargo-tracker-1.0.0-SNAPSHOT-runner`
60
+
61
+ If you want to learn more about building native executables, please consult <https://quarkus.io/guides/maven-tooling>.
62
+
63
+ ## Related Guides
64
+
65
+ - AMQP 1.0 JMS client - Apache Qpid JMS ([guide](https://quarkus.io/guides/jms)): Use JMS APIs with AMQP 1.0 servers such as ActiveMQ Artemis, ActiveMQ 5, Qpid Broker-J, Qpid Dispatch router, Azure Service Bus, and more
66
+ - JDBC Driver - H2 ([guide](https://quarkus.io/guides/datasource)): Connect to the H2 database via JDBC
67
+ - Hibernate Validator ([guide](https://quarkus.io/guides/validation)): Validate object properties (field, getter) and method parameters for your beans (REST, CDI, Jakarta Persistence)
68
+ - PrimeFaces ([guide](https://quarkiverse.github.io/quarkiverse-docs/quarkus-primefaces/dev/)): PrimeFaces - lets you utilize PrimeFaces and PF Extensions to make JavaServer Faces (JSF) development so much easier!
69
+ - REST Jackson ([guide](https://quarkus.io/guides/rest#json-serialisation)): Jackson serialization support for Quarkus REST. This extension is not compatible with the quarkus-resteasy extension, or any of the extensions that depend on it
70
+ - Hibernate ORM with Panache ([guide](https://quarkus.io/guides/hibernate-orm-panache)): Simplify your persistence code for Hibernate ORM via the active record or the repository pattern
71
+ - Scheduler ([guide](https://quarkus.io/guides/scheduler)): Schedule jobs and tasks
72
+ - JBeret - Batch Processing ([guide](https://github.com/quarkiverse/quarkus-jberet#readme)): Write Batch Applications with JBeret a JSR-352 implementation
73
+ - REST JAXB ([guide](https://quarkus.io/guides/resteasy-reactive#xml-serialisation)): JAXB serialization support for Quarkus REST. This extension is not compatible with the quarkus-resteasy extension, or any of the extensions that depend on it.
74
+
75
+ ## Provided Code
76
+
77
+ ### Hibernate ORM
78
+
79
+ Create your first JPA entity
80
+
81
+ [Related guide section...](https://quarkus.io/guides/hibernate-orm)
82
+
83
+ [Related Hibernate with Panache section...](https://quarkus.io/guides/hibernate-orm-panache)
84
+
85
+
86
+ ### REST
87
+
88
+ Easily start your REST Web Services
89
+
90
+ [Related guide section...](https://quarkus.io/guides/getting-started-reactive#reactive-jax-rs-resources)
benchmark/whole_applications/cargotracker/quarkus/mvnw ADDED
@@ -0,0 +1,295 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ # ----------------------------------------------------------------------------
3
+ # Licensed to the Apache Software Foundation (ASF) under one
4
+ # or more contributor license agreements. See the NOTICE file
5
+ # distributed with this work for additional information
6
+ # regarding copyright ownership. The ASF licenses this file
7
+ # to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance
9
+ # with the License. You may obtain a copy of the License at
10
+ #
11
+ # https://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing,
14
+ # software distributed under the License is distributed on an
15
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ # KIND, either express or implied. See the License for the
17
+ # specific language governing permissions and limitations
18
+ # under the License.
19
+ # ----------------------------------------------------------------------------
20
+
21
+ # ----------------------------------------------------------------------------
22
+ # Apache Maven Wrapper startup batch script, version 3.3.4
23
+ #
24
+ # Optional ENV vars
25
+ # -----------------
26
+ # JAVA_HOME - location of a JDK home dir, required when download maven via java source
27
+ # MVNW_REPOURL - repo url base for downloading maven distribution
28
+ # MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
29
+ # MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output
30
+ # ----------------------------------------------------------------------------
31
+
32
+ set -euf
33
+ [ "${MVNW_VERBOSE-}" != debug ] || set -x
34
+
35
+ # OS specific support.
36
+ native_path() { printf %s\\n "$1"; }
37
+ case "$(uname)" in
38
+ CYGWIN* | MINGW*)
39
+ [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")"
40
+ native_path() { cygpath --path --windows "$1"; }
41
+ ;;
42
+ esac
43
+
44
+ # set JAVACMD and JAVACCMD
45
+ set_java_home() {
46
+ # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched
47
+ if [ -n "${JAVA_HOME-}" ]; then
48
+ if [ -x "$JAVA_HOME/jre/sh/java" ]; then
49
+ # IBM's JDK on AIX uses strange locations for the executables
50
+ JAVACMD="$JAVA_HOME/jre/sh/java"
51
+ JAVACCMD="$JAVA_HOME/jre/sh/javac"
52
+ else
53
+ JAVACMD="$JAVA_HOME/bin/java"
54
+ JAVACCMD="$JAVA_HOME/bin/javac"
55
+
56
+ if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then
57
+ echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2
58
+ echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2
59
+ return 1
60
+ fi
61
+ fi
62
+ else
63
+ JAVACMD="$(
64
+ 'set' +e
65
+ 'unset' -f command 2>/dev/null
66
+ 'command' -v java
67
+ )" || :
68
+ JAVACCMD="$(
69
+ 'set' +e
70
+ 'unset' -f command 2>/dev/null
71
+ 'command' -v javac
72
+ )" || :
73
+
74
+ if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then
75
+ echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2
76
+ return 1
77
+ fi
78
+ fi
79
+ }
80
+
81
+ # hash string like Java String::hashCode
82
+ hash_string() {
83
+ str="${1:-}" h=0
84
+ while [ -n "$str" ]; do
85
+ char="${str%"${str#?}"}"
86
+ h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296))
87
+ str="${str#?}"
88
+ done
89
+ printf %x\\n $h
90
+ }
91
+
92
+ verbose() { :; }
93
+ [ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; }
94
+
95
+ die() {
96
+ printf %s\\n "$1" >&2
97
+ exit 1
98
+ }
99
+
100
+ trim() {
101
+ # MWRAPPER-139:
102
+ # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds.
103
+ # Needed for removing poorly interpreted newline sequences when running in more
104
+ # exotic environments such as mingw bash on Windows.
105
+ printf "%s" "${1}" | tr -d '[:space:]'
106
+ }
107
+
108
+ scriptDir="$(dirname "$0")"
109
+ scriptName="$(basename "$0")"
110
+
111
+ # parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties
112
+ while IFS="=" read -r key value; do
113
+ case "${key-}" in
114
+ distributionUrl) distributionUrl=$(trim "${value-}") ;;
115
+ distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;;
116
+ esac
117
+ done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties"
118
+ [ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
119
+
120
+ case "${distributionUrl##*/}" in
121
+ maven-mvnd-*bin.*)
122
+ MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/
123
+ case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in
124
+ *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;;
125
+ :Darwin*x86_64) distributionPlatform=darwin-amd64 ;;
126
+ :Darwin*arm64) distributionPlatform=darwin-aarch64 ;;
127
+ :Linux*x86_64*) distributionPlatform=linux-amd64 ;;
128
+ *)
129
+ echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2
130
+ distributionPlatform=linux-amd64
131
+ ;;
132
+ esac
133
+ distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip"
134
+ ;;
135
+ maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;;
136
+ *) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;;
137
+ esac
138
+
139
+ # apply MVNW_REPOURL and calculate MAVEN_HOME
140
+ # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
141
+ [ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}"
142
+ distributionUrlName="${distributionUrl##*/}"
143
+ distributionUrlNameMain="${distributionUrlName%.*}"
144
+ distributionUrlNameMain="${distributionUrlNameMain%-bin}"
145
+ MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}"
146
+ MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")"
147
+
148
+ exec_maven() {
149
+ unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || :
150
+ exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD"
151
+ }
152
+
153
+ if [ -d "$MAVEN_HOME" ]; then
154
+ verbose "found existing MAVEN_HOME at $MAVEN_HOME"
155
+ exec_maven "$@"
156
+ fi
157
+
158
+ case "${distributionUrl-}" in
159
+ *?-bin.zip | *?maven-mvnd-?*-?*.zip) ;;
160
+ *) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;;
161
+ esac
162
+
163
+ # prepare tmp dir
164
+ if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then
165
+ clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; }
166
+ trap clean HUP INT TERM EXIT
167
+ else
168
+ die "cannot create temp dir"
169
+ fi
170
+
171
+ mkdir -p -- "${MAVEN_HOME%/*}"
172
+
173
+ # Download and Install Apache Maven
174
+ verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
175
+ verbose "Downloading from: $distributionUrl"
176
+ verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
177
+
178
+ # select .zip or .tar.gz
179
+ if ! command -v unzip >/dev/null; then
180
+ distributionUrl="${distributionUrl%.zip}.tar.gz"
181
+ distributionUrlName="${distributionUrl##*/}"
182
+ fi
183
+
184
+ # verbose opt
185
+ __MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR=''
186
+ [ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v
187
+
188
+ # normalize http auth
189
+ case "${MVNW_PASSWORD:+has-password}" in
190
+ '') MVNW_USERNAME='' MVNW_PASSWORD='' ;;
191
+ has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;;
192
+ esac
193
+
194
+ if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then
195
+ verbose "Found wget ... using wget"
196
+ wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl"
197
+ elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then
198
+ verbose "Found curl ... using curl"
199
+ curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl"
200
+ elif set_java_home; then
201
+ verbose "Falling back to use Java to download"
202
+ javaSource="$TMP_DOWNLOAD_DIR/Downloader.java"
203
+ targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName"
204
+ cat >"$javaSource" <<-END
205
+ public class Downloader extends java.net.Authenticator
206
+ {
207
+ protected java.net.PasswordAuthentication getPasswordAuthentication()
208
+ {
209
+ return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() );
210
+ }
211
+ public static void main( String[] args ) throws Exception
212
+ {
213
+ setDefault( new Downloader() );
214
+ java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() );
215
+ }
216
+ }
217
+ END
218
+ # For Cygwin/MinGW, switch paths to Windows format before running javac and java
219
+ verbose " - Compiling Downloader.java ..."
220
+ "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java"
221
+ verbose " - Running Downloader.java ..."
222
+ "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")"
223
+ fi
224
+
225
+ # If specified, validate the SHA-256 sum of the Maven distribution zip file
226
+ if [ -n "${distributionSha256Sum-}" ]; then
227
+ distributionSha256Result=false
228
+ if [ "$MVN_CMD" = mvnd.sh ]; then
229
+ echo "Checksum validation is not supported for maven-mvnd." >&2
230
+ echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
231
+ exit 1
232
+ elif command -v sha256sum >/dev/null; then
233
+ if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then
234
+ distributionSha256Result=true
235
+ fi
236
+ elif command -v shasum >/dev/null; then
237
+ if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then
238
+ distributionSha256Result=true
239
+ fi
240
+ else
241
+ echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2
242
+ echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
243
+ exit 1
244
+ fi
245
+ if [ $distributionSha256Result = false ]; then
246
+ echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2
247
+ echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2
248
+ exit 1
249
+ fi
250
+ fi
251
+
252
+ # unzip and move
253
+ if command -v unzip >/dev/null; then
254
+ unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip"
255
+ else
256
+ tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar"
257
+ fi
258
+
259
+ # Find the actual extracted directory name (handles snapshots where filename != directory name)
260
+ actualDistributionDir=""
261
+
262
+ # First try the expected directory name (for regular distributions)
263
+ if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then
264
+ if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then
265
+ actualDistributionDir="$distributionUrlNameMain"
266
+ fi
267
+ fi
268
+
269
+ # If not found, search for any directory with the Maven executable (for snapshots)
270
+ if [ -z "$actualDistributionDir" ]; then
271
+ # enable globbing to iterate over items
272
+ set +f
273
+ for dir in "$TMP_DOWNLOAD_DIR"/*; do
274
+ if [ -d "$dir" ]; then
275
+ if [ -f "$dir/bin/$MVN_CMD" ]; then
276
+ actualDistributionDir="$(basename "$dir")"
277
+ break
278
+ fi
279
+ fi
280
+ done
281
+ set -f
282
+ fi
283
+
284
+ if [ -z "$actualDistributionDir" ]; then
285
+ verbose "Contents of $TMP_DOWNLOAD_DIR:"
286
+ verbose "$(ls -la "$TMP_DOWNLOAD_DIR")"
287
+ die "Could not find Maven distribution directory in extracted archive"
288
+ fi
289
+
290
+ verbose "Found extracted Maven distribution directory: $actualDistributionDir"
291
+ printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url"
292
+ mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME"
293
+
294
+ clean || :
295
+ exec_maven "$@"
benchmark/whole_applications/cargotracker/quarkus/mvnw.cmd ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <# : batch portion
2
+ @REM ----------------------------------------------------------------------------
3
+ @REM Licensed to the Apache Software Foundation (ASF) under one
4
+ @REM or more contributor license agreements. See the NOTICE file
5
+ @REM distributed with this work for additional information
6
+ @REM regarding copyright ownership. The ASF licenses this file
7
+ @REM to you under the Apache License, Version 2.0 (the
8
+ @REM "License"); you may not use this file except in compliance
9
+ @REM with the License. You may obtain a copy of the License at
10
+ @REM
11
+ @REM https://www.apache.org/licenses/LICENSE-2.0
12
+ @REM
13
+ @REM Unless required by applicable law or agreed to in writing,
14
+ @REM software distributed under the License is distributed on an
15
+ @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ @REM KIND, either express or implied. See the License for the
17
+ @REM specific language governing permissions and limitations
18
+ @REM under the License.
19
+ @REM ----------------------------------------------------------------------------
20
+
21
+ @REM ----------------------------------------------------------------------------
22
+ @REM Apache Maven Wrapper startup batch script, version 3.3.4
23
+ @REM
24
+ @REM Optional ENV vars
25
+ @REM MVNW_REPOURL - repo url base for downloading maven distribution
26
+ @REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
27
+ @REM MVNW_VERBOSE - true: enable verbose log; others: silence the output
28
+ @REM ----------------------------------------------------------------------------
29
+
30
+ @IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0)
31
+ @SET __MVNW_CMD__=
32
+ @SET __MVNW_ERROR__=
33
+ @SET __MVNW_PSMODULEP_SAVE=%PSModulePath%
34
+ @SET PSModulePath=
35
+ @FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @(
36
+ IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B)
37
+ )
38
+ @SET PSModulePath=%__MVNW_PSMODULEP_SAVE%
39
+ @SET __MVNW_PSMODULEP_SAVE=
40
+ @SET __MVNW_ARG0_NAME__=
41
+ @SET MVNW_USERNAME=
42
+ @SET MVNW_PASSWORD=
43
+ @IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*)
44
+ @echo Cannot start maven from wrapper >&2 && exit /b 1
45
+ @GOTO :EOF
46
+ : end batch / begin powershell #>
47
+
48
+ $ErrorActionPreference = "Stop"
49
+ if ($env:MVNW_VERBOSE -eq "true") {
50
+ $VerbosePreference = "Continue"
51
+ }
52
+
53
+ # calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties
54
+ $distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl
55
+ if (!$distributionUrl) {
56
+ Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
57
+ }
58
+
59
+ switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) {
60
+ "maven-mvnd-*" {
61
+ $USE_MVND = $true
62
+ $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip"
63
+ $MVN_CMD = "mvnd.cmd"
64
+ break
65
+ }
66
+ default {
67
+ $USE_MVND = $false
68
+ $MVN_CMD = $script -replace '^mvnw','mvn'
69
+ break
70
+ }
71
+ }
72
+
73
+ # apply MVNW_REPOURL and calculate MAVEN_HOME
74
+ # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
75
+ if ($env:MVNW_REPOURL) {
76
+ $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" }
77
+ $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')"
78
+ }
79
+ $distributionUrlName = $distributionUrl -replace '^.*/',''
80
+ $distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$',''
81
+
82
+ $MAVEN_M2_PATH = "$HOME/.m2"
83
+ if ($env:MAVEN_USER_HOME) {
84
+ $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME"
85
+ }
86
+
87
+ if (-not (Test-Path -Path $MAVEN_M2_PATH)) {
88
+ New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null
89
+ }
90
+
91
+ $MAVEN_WRAPPER_DISTS = $null
92
+ if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) {
93
+ $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists"
94
+ } else {
95
+ $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists"
96
+ }
97
+
98
+ $MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain"
99
+ $MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join ''
100
+ $MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME"
101
+
102
+ if (Test-Path -Path "$MAVEN_HOME" -PathType Container) {
103
+ Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME"
104
+ Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
105
+ exit $?
106
+ }
107
+
108
+ if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) {
109
+ Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl"
110
+ }
111
+
112
+ # prepare tmp dir
113
+ $TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile
114
+ $TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir"
115
+ $TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null
116
+ trap {
117
+ if ($TMP_DOWNLOAD_DIR.Exists) {
118
+ try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
119
+ catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
120
+ }
121
+ }
122
+
123
+ New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null
124
+
125
+ # Download and Install Apache Maven
126
+ Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
127
+ Write-Verbose "Downloading from: $distributionUrl"
128
+ Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
129
+
130
+ $webclient = New-Object System.Net.WebClient
131
+ if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) {
132
+ $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD)
133
+ }
134
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
135
+ $webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null
136
+
137
+ # If specified, validate the SHA-256 sum of the Maven distribution zip file
138
+ $distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum
139
+ if ($distributionSha256Sum) {
140
+ if ($USE_MVND) {
141
+ Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties."
142
+ }
143
+ Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash
144
+ if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) {
145
+ Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property."
146
+ }
147
+ }
148
+
149
+ # unzip and move
150
+ Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null
151
+
152
+ # Find the actual extracted directory name (handles snapshots where filename != directory name)
153
+ $actualDistributionDir = ""
154
+
155
+ # First try the expected directory name (for regular distributions)
156
+ $expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain"
157
+ $expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD"
158
+ if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) {
159
+ $actualDistributionDir = $distributionUrlNameMain
160
+ }
161
+
162
+ # If not found, search for any directory with the Maven executable (for snapshots)
163
+ if (!$actualDistributionDir) {
164
+ Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object {
165
+ $testPath = Join-Path $_.FullName "bin/$MVN_CMD"
166
+ if (Test-Path -Path $testPath -PathType Leaf) {
167
+ $actualDistributionDir = $_.Name
168
+ }
169
+ }
170
+ }
171
+
172
+ if (!$actualDistributionDir) {
173
+ Write-Error "Could not find Maven distribution directory in extracted archive"
174
+ }
175
+
176
+ Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir"
177
+ Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null
178
+ try {
179
+ Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null
180
+ } catch {
181
+ if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) {
182
+ Write-Error "fail to move MAVEN_HOME"
183
+ }
184
+ } finally {
185
+ try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
186
+ catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
187
+ }
188
+
189
+ Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
benchmark/whole_applications/cargotracker/quarkus/pom.xml ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
3
+ <modelVersion>4.0.0</modelVersion>
4
+ <groupId>org.eclipse.ee4j.quarkus</groupId>
5
+ <artifactId>cargo-tracker</artifactId>
6
+ <version>1.0.0-SNAPSHOT</version>
7
+
8
+ <properties>
9
+ <compiler-plugin.version>3.14.0</compiler-plugin.version>
10
+ <maven.compiler.release>21</maven.compiler.release>
11
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
12
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
13
+ <quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
14
+ <quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
15
+ <quarkus.platform.version>3.30.5</quarkus.platform.version>
16
+ <skipITs>true</skipITs>
17
+ <surefire-plugin.version>3.5.3</surefire-plugin.version>
18
+ </properties>
19
+
20
+ <dependencyManagement>
21
+ <dependencies>
22
+ <dependency>
23
+ <groupId>${quarkus.platform.group-id}</groupId>
24
+ <artifactId>${quarkus.platform.artifact-id}</artifactId>
25
+ <version>${quarkus.platform.version}</version>
26
+ <type>pom</type>
27
+ <scope>import</scope>
28
+ </dependency>
29
+ <dependency>
30
+ <groupId>${quarkus.platform.group-id}</groupId>
31
+ <artifactId>quarkus-qpid-jms-bom</artifactId>
32
+ <version>${quarkus.platform.version}</version>
33
+ <type>pom</type>
34
+ <scope>import</scope>
35
+ </dependency>
36
+ <!-- <dependency>
37
+ <groupId>io.quarkiverse</groupId>
38
+ <artifactId>quarkiverse-bom</artifactId>
39
+ <version>${quarkiverse.platform.version}</version>
40
+ <type>pom</type>
41
+ <scope>import</scope>
42
+ </dependency> -->
43
+ </dependencies>
44
+ </dependencyManagement>
45
+
46
+ <dependencies>
47
+ <dependency>
48
+ <groupId>org.amqphub.quarkus</groupId>
49
+ <artifactId>quarkus-qpid-jms</artifactId>
50
+ </dependency>
51
+ <dependency>
52
+ <groupId>io.quarkus</groupId>
53
+ <artifactId>quarkus-rest-jackson</artifactId>
54
+ </dependency>
55
+ <dependency>
56
+ <groupId>io.quarkus</groupId>
57
+ <artifactId>quarkus-rest-client-jackson</artifactId>
58
+ </dependency>
59
+ <dependency>
60
+ <groupId>io.quarkus</groupId>
61
+ <artifactId>quarkus-rest-jaxb</artifactId>
62
+ </dependency>
63
+ <dependency>
64
+ <groupId>io.quarkus</groupId>
65
+ <artifactId>quarkus-jdbc-h2</artifactId>
66
+ </dependency>
67
+ <dependency>
68
+ <groupId>io.quarkus</groupId>
69
+ <artifactId>quarkus-hibernate-validator</artifactId>
70
+ </dependency>
71
+
72
+ <dependency>
73
+ <groupId>io.quarkiverse.primefaces</groupId>
74
+ <artifactId>quarkus-primefaces</artifactId>
75
+ <version>4.15.11</version>
76
+ </dependency>
77
+ <dependency>
78
+ <groupId>io.quarkus</groupId>
79
+ <artifactId>quarkus-hibernate-orm-panache</artifactId>
80
+ </dependency>
81
+ <dependency>
82
+ <groupId>io.quarkus</groupId>
83
+ <artifactId>quarkus-scheduler</artifactId>
84
+ </dependency>
85
+ <dependency>
86
+ <groupId>io.quarkiverse.jberet</groupId>
87
+ <artifactId>quarkus-jberet</artifactId>
88
+ <version>2.8.0</version>
89
+ </dependency>
90
+ <dependency>
91
+ <groupId>io.quarkus</groupId>
92
+ <artifactId>quarkus-arc</artifactId>
93
+ </dependency>
94
+ <dependency>
95
+ <groupId>io.quarkus</groupId>
96
+ <artifactId>quarkus-hibernate-orm</artifactId>
97
+ </dependency>
98
+ <dependency>
99
+ <groupId>io.quarkus</groupId>
100
+ <artifactId>quarkus-junit5</artifactId>
101
+ <scope>test</scope>
102
+ </dependency>
103
+ <dependency>
104
+ <groupId>io.rest-assured</groupId>
105
+ <artifactId>rest-assured</artifactId>
106
+ <scope>test</scope>
107
+ </dependency>
108
+ </dependencies>
109
+
110
+ <build>
111
+ <plugins>
112
+ <plugin>
113
+ <groupId>${quarkus.platform.group-id}</groupId>
114
+ <artifactId>quarkus-maven-plugin</artifactId>
115
+ <version>${quarkus.platform.version}</version>
116
+ <extensions>true</extensions>
117
+ <executions>
118
+ <execution>
119
+ <goals>
120
+ <goal>build</goal>
121
+ <goal>generate-code</goal>
122
+ <goal>generate-code-tests</goal>
123
+ <goal>native-image-agent</goal>
124
+ </goals>
125
+ </execution>
126
+ </executions>
127
+ </plugin>
128
+ <plugin>
129
+ <artifactId>maven-compiler-plugin</artifactId>
130
+ <version>${compiler-plugin.version}</version>
131
+ <configuration>
132
+ <parameters>true</parameters>
133
+ </configuration>
134
+ </plugin>
135
+ <plugin>
136
+ <artifactId>maven-surefire-plugin</artifactId>
137
+ <version>${surefire-plugin.version}</version>
138
+ <configuration>
139
+ <systemPropertyVariables>
140
+ <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
141
+ <maven.home>${maven.home}</maven.home>
142
+ </systemPropertyVariables>
143
+ </configuration>
144
+ </plugin>
145
+ <plugin>
146
+ <artifactId>maven-failsafe-plugin</artifactId>
147
+ <version>${surefire-plugin.version}</version>
148
+ <executions>
149
+ <execution>
150
+ <goals>
151
+ <goal>integration-test</goal>
152
+ <goal>verify</goal>
153
+ </goals>
154
+ </execution>
155
+ </executions>
156
+ <configuration>
157
+ <systemPropertyVariables>
158
+ <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
159
+ <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
160
+ <maven.home>${maven.home}</maven.home>
161
+ </systemPropertyVariables>
162
+ </configuration>
163
+ </plugin>
164
+ </plugins>
165
+ </build>
166
+
167
+ <profiles>
168
+ <profile>
169
+ <id>native</id>
170
+ <activation>
171
+ <property>
172
+ <name>native</name>
173
+ </property>
174
+ </activation>
175
+ <properties>
176
+ <skipITs>false</skipITs>
177
+ <quarkus.native.enabled>true</quarkus.native.enabled>
178
+ </properties>
179
+ </profile>
180
+ </profiles>
181
+ </project>
benchmark/whole_applications/cargotracker/quarkus/test.sh ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ BASE_URL="${BASE_URL:-http://localhost:8080/cargo-tracker}"
5
+
6
+ echo "Health check: ${BASE_URL}/index.xhtml"
7
+ HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}/index.xhtml")
8
+
9
+ if [ "$HTTP_STATUS" -eq 200 ]; then
10
+ echo "PASS - got HTTP ${HTTP_STATUS}"
11
+ exit 0
12
+ else
13
+ echo "FAIL - got HTTP ${HTTP_STATUS}"
14
+ exit 1
15
+ fi
benchmark/whole_applications/cargotracker/spring/.dockerignore ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # VCS
2
+ .git/
3
+
4
+ # Maven
5
+ .mvn/
6
+ **/.mvn/
7
+ mvnw
8
+ mvnw.cmd
9
+ **/mvnw
10
+ **/mvnw.cmd
11
+ target/
12
+ **/target/
13
+ pom.xml.tag
14
+ pom.xml.releaseBackup
15
+ pom.xml.versionsBackup
16
+ pom.xml.next
17
+ release.properties
18
+ dependency-reduced-pom.xml
19
+ buildNumber.properties
20
+
21
+ # IDE / Editor
22
+ .vscode/
23
+ **/.vscode/
24
+ .zed/
25
+ **/.zed/
26
+ .idea/
27
+ **/.idea/
28
+ *.iml
29
+ *.ipr
30
+ *.iws
31
+
32
+ # OS
33
+ .DS_Store
34
+ **/.DS_Store
35
+ Thumbs.db
36
+ ehthumbs.db
37
+
38
+ # Logs / temp
39
+ *.log
40
+ *.tmp
41
+ *.temp
benchmark/whole_applications/cargotracker/spring/Dockerfile ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM maven:3.9.12-ibm-semeru-21-noble
2
+
3
+ USER root
4
+ # install uv
5
+ RUN apt-get update && apt-get install -y --no-install-recommends curl python3-venv python3-full && curl -LsSf https://astral.sh/uv/install.sh | sh
6
+
7
+ ENV PATH="/root/.local/bin:$PATH"
8
+
9
+ # Shared browsers path so Chromium is cached once
10
+ ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
11
+ RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright
12
+
13
+ # create venv and install
14
+ RUN uv venv /opt/venv && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest
15
+
16
+ ENV PATH="/opt/venv/bin:$PATH"
17
+ RUN playwright install --with-deps chromium
18
+
19
+ # Set working directory
20
+ WORKDIR /app
21
+
22
+ # Copy all the assets
23
+ COPY . .
24
+
25
+ RUN if [ -f mvnw ]; then chmod +x mvnw; fi && if [ -f smoke.py ]; then chmod +x smoke.py; fi && if [ -f test.sh ]; then chmod +x test.sh; fi
26
+
27
+ CMD [ "mvn", "clean", "spring-boot:run" ]
benchmark/whole_applications/cargotracker/spring/README.md ADDED
File without changes
benchmark/whole_applications/cargotracker/spring/mvnw ADDED
@@ -0,0 +1,295 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ # ----------------------------------------------------------------------------
3
+ # Licensed to the Apache Software Foundation (ASF) under one
4
+ # or more contributor license agreements. See the NOTICE file
5
+ # distributed with this work for additional information
6
+ # regarding copyright ownership. The ASF licenses this file
7
+ # to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance
9
+ # with the License. You may obtain a copy of the License at
10
+ #
11
+ # https://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing,
14
+ # software distributed under the License is distributed on an
15
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ # KIND, either express or implied. See the License for the
17
+ # specific language governing permissions and limitations
18
+ # under the License.
19
+ # ----------------------------------------------------------------------------
20
+
21
+ # ----------------------------------------------------------------------------
22
+ # Apache Maven Wrapper startup batch script, version 3.3.4
23
+ #
24
+ # Optional ENV vars
25
+ # -----------------
26
+ # JAVA_HOME - location of a JDK home dir, required when download maven via java source
27
+ # MVNW_REPOURL - repo url base for downloading maven distribution
28
+ # MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
29
+ # MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output
30
+ # ----------------------------------------------------------------------------
31
+
32
+ set -euf
33
+ [ "${MVNW_VERBOSE-}" != debug ] || set -x
34
+
35
+ # OS specific support.
36
+ native_path() { printf %s\\n "$1"; }
37
+ case "$(uname)" in
38
+ CYGWIN* | MINGW*)
39
+ [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")"
40
+ native_path() { cygpath --path --windows "$1"; }
41
+ ;;
42
+ esac
43
+
44
+ # set JAVACMD and JAVACCMD
45
+ set_java_home() {
46
+ # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched
47
+ if [ -n "${JAVA_HOME-}" ]; then
48
+ if [ -x "$JAVA_HOME/jre/sh/java" ]; then
49
+ # IBM's JDK on AIX uses strange locations for the executables
50
+ JAVACMD="$JAVA_HOME/jre/sh/java"
51
+ JAVACCMD="$JAVA_HOME/jre/sh/javac"
52
+ else
53
+ JAVACMD="$JAVA_HOME/bin/java"
54
+ JAVACCMD="$JAVA_HOME/bin/javac"
55
+
56
+ if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then
57
+ echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2
58
+ echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2
59
+ return 1
60
+ fi
61
+ fi
62
+ else
63
+ JAVACMD="$(
64
+ 'set' +e
65
+ 'unset' -f command 2>/dev/null
66
+ 'command' -v java
67
+ )" || :
68
+ JAVACCMD="$(
69
+ 'set' +e
70
+ 'unset' -f command 2>/dev/null
71
+ 'command' -v javac
72
+ )" || :
73
+
74
+ if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then
75
+ echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2
76
+ return 1
77
+ fi
78
+ fi
79
+ }
80
+
81
+ # hash string like Java String::hashCode
82
+ hash_string() {
83
+ str="${1:-}" h=0
84
+ while [ -n "$str" ]; do
85
+ char="${str%"${str#?}"}"
86
+ h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296))
87
+ str="${str#?}"
88
+ done
89
+ printf %x\\n $h
90
+ }
91
+
92
+ verbose() { :; }
93
+ [ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; }
94
+
95
+ die() {
96
+ printf %s\\n "$1" >&2
97
+ exit 1
98
+ }
99
+
100
+ trim() {
101
+ # MWRAPPER-139:
102
+ # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds.
103
+ # Needed for removing poorly interpreted newline sequences when running in more
104
+ # exotic environments such as mingw bash on Windows.
105
+ printf "%s" "${1}" | tr -d '[:space:]'
106
+ }
107
+
108
+ scriptDir="$(dirname "$0")"
109
+ scriptName="$(basename "$0")"
110
+
111
+ # parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties
112
+ while IFS="=" read -r key value; do
113
+ case "${key-}" in
114
+ distributionUrl) distributionUrl=$(trim "${value-}") ;;
115
+ distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;;
116
+ esac
117
+ done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties"
118
+ [ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
119
+
120
+ case "${distributionUrl##*/}" in
121
+ maven-mvnd-*bin.*)
122
+ MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/
123
+ case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in
124
+ *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;;
125
+ :Darwin*x86_64) distributionPlatform=darwin-amd64 ;;
126
+ :Darwin*arm64) distributionPlatform=darwin-aarch64 ;;
127
+ :Linux*x86_64*) distributionPlatform=linux-amd64 ;;
128
+ *)
129
+ echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2
130
+ distributionPlatform=linux-amd64
131
+ ;;
132
+ esac
133
+ distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip"
134
+ ;;
135
+ maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;;
136
+ *) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;;
137
+ esac
138
+
139
+ # apply MVNW_REPOURL and calculate MAVEN_HOME
140
+ # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
141
+ [ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}"
142
+ distributionUrlName="${distributionUrl##*/}"
143
+ distributionUrlNameMain="${distributionUrlName%.*}"
144
+ distributionUrlNameMain="${distributionUrlNameMain%-bin}"
145
+ MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}"
146
+ MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")"
147
+
148
+ exec_maven() {
149
+ unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || :
150
+ exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD"
151
+ }
152
+
153
+ if [ -d "$MAVEN_HOME" ]; then
154
+ verbose "found existing MAVEN_HOME at $MAVEN_HOME"
155
+ exec_maven "$@"
156
+ fi
157
+
158
+ case "${distributionUrl-}" in
159
+ *?-bin.zip | *?maven-mvnd-?*-?*.zip) ;;
160
+ *) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;;
161
+ esac
162
+
163
+ # prepare tmp dir
164
+ if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then
165
+ clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; }
166
+ trap clean HUP INT TERM EXIT
167
+ else
168
+ die "cannot create temp dir"
169
+ fi
170
+
171
+ mkdir -p -- "${MAVEN_HOME%/*}"
172
+
173
+ # Download and Install Apache Maven
174
+ verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
175
+ verbose "Downloading from: $distributionUrl"
176
+ verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
177
+
178
+ # select .zip or .tar.gz
179
+ if ! command -v unzip >/dev/null; then
180
+ distributionUrl="${distributionUrl%.zip}.tar.gz"
181
+ distributionUrlName="${distributionUrl##*/}"
182
+ fi
183
+
184
+ # verbose opt
185
+ __MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR=''
186
+ [ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v
187
+
188
+ # normalize http auth
189
+ case "${MVNW_PASSWORD:+has-password}" in
190
+ '') MVNW_USERNAME='' MVNW_PASSWORD='' ;;
191
+ has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;;
192
+ esac
193
+
194
+ if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then
195
+ verbose "Found wget ... using wget"
196
+ wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl"
197
+ elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then
198
+ verbose "Found curl ... using curl"
199
+ curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl"
200
+ elif set_java_home; then
201
+ verbose "Falling back to use Java to download"
202
+ javaSource="$TMP_DOWNLOAD_DIR/Downloader.java"
203
+ targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName"
204
+ cat >"$javaSource" <<-END
205
+ public class Downloader extends java.net.Authenticator
206
+ {
207
+ protected java.net.PasswordAuthentication getPasswordAuthentication()
208
+ {
209
+ return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() );
210
+ }
211
+ public static void main( String[] args ) throws Exception
212
+ {
213
+ setDefault( new Downloader() );
214
+ java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() );
215
+ }
216
+ }
217
+ END
218
+ # For Cygwin/MinGW, switch paths to Windows format before running javac and java
219
+ verbose " - Compiling Downloader.java ..."
220
+ "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java"
221
+ verbose " - Running Downloader.java ..."
222
+ "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")"
223
+ fi
224
+
225
+ # If specified, validate the SHA-256 sum of the Maven distribution zip file
226
+ if [ -n "${distributionSha256Sum-}" ]; then
227
+ distributionSha256Result=false
228
+ if [ "$MVN_CMD" = mvnd.sh ]; then
229
+ echo "Checksum validation is not supported for maven-mvnd." >&2
230
+ echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
231
+ exit 1
232
+ elif command -v sha256sum >/dev/null; then
233
+ if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then
234
+ distributionSha256Result=true
235
+ fi
236
+ elif command -v shasum >/dev/null; then
237
+ if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then
238
+ distributionSha256Result=true
239
+ fi
240
+ else
241
+ echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2
242
+ echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
243
+ exit 1
244
+ fi
245
+ if [ $distributionSha256Result = false ]; then
246
+ echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2
247
+ echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2
248
+ exit 1
249
+ fi
250
+ fi
251
+
252
+ # unzip and move
253
+ if command -v unzip >/dev/null; then
254
+ unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip"
255
+ else
256
+ tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar"
257
+ fi
258
+
259
+ # Find the actual extracted directory name (handles snapshots where filename != directory name)
260
+ actualDistributionDir=""
261
+
262
+ # First try the expected directory name (for regular distributions)
263
+ if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then
264
+ if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then
265
+ actualDistributionDir="$distributionUrlNameMain"
266
+ fi
267
+ fi
268
+
269
+ # If not found, search for any directory with the Maven executable (for snapshots)
270
+ if [ -z "$actualDistributionDir" ]; then
271
+ # enable globbing to iterate over items
272
+ set +f
273
+ for dir in "$TMP_DOWNLOAD_DIR"/*; do
274
+ if [ -d "$dir" ]; then
275
+ if [ -f "$dir/bin/$MVN_CMD" ]; then
276
+ actualDistributionDir="$(basename "$dir")"
277
+ break
278
+ fi
279
+ fi
280
+ done
281
+ set -f
282
+ fi
283
+
284
+ if [ -z "$actualDistributionDir" ]; then
285
+ verbose "Contents of $TMP_DOWNLOAD_DIR:"
286
+ verbose "$(ls -la "$TMP_DOWNLOAD_DIR")"
287
+ die "Could not find Maven distribution directory in extracted archive"
288
+ fi
289
+
290
+ verbose "Found extracted Maven distribution directory: $actualDistributionDir"
291
+ printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url"
292
+ mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME"
293
+
294
+ clean || :
295
+ exec_maven "$@"
benchmark/whole_applications/cargotracker/spring/mvnw.cmd ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <# : batch portion
2
+ @REM ----------------------------------------------------------------------------
3
+ @REM Licensed to the Apache Software Foundation (ASF) under one
4
+ @REM or more contributor license agreements. See the NOTICE file
5
+ @REM distributed with this work for additional information
6
+ @REM regarding copyright ownership. The ASF licenses this file
7
+ @REM to you under the Apache License, Version 2.0 (the
8
+ @REM "License"); you may not use this file except in compliance
9
+ @REM with the License. You may obtain a copy of the License at
10
+ @REM
11
+ @REM https://www.apache.org/licenses/LICENSE-2.0
12
+ @REM
13
+ @REM Unless required by applicable law or agreed to in writing,
14
+ @REM software distributed under the License is distributed on an
15
+ @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ @REM KIND, either express or implied. See the License for the
17
+ @REM specific language governing permissions and limitations
18
+ @REM under the License.
19
+ @REM ----------------------------------------------------------------------------
20
+
21
+ @REM ----------------------------------------------------------------------------
22
+ @REM Apache Maven Wrapper startup batch script, version 3.3.4
23
+ @REM
24
+ @REM Optional ENV vars
25
+ @REM MVNW_REPOURL - repo url base for downloading maven distribution
26
+ @REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
27
+ @REM MVNW_VERBOSE - true: enable verbose log; others: silence the output
28
+ @REM ----------------------------------------------------------------------------
29
+
30
+ @IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0)
31
+ @SET __MVNW_CMD__=
32
+ @SET __MVNW_ERROR__=
33
+ @SET __MVNW_PSMODULEP_SAVE=%PSModulePath%
34
+ @SET PSModulePath=
35
+ @FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @(
36
+ IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B)
37
+ )
38
+ @SET PSModulePath=%__MVNW_PSMODULEP_SAVE%
39
+ @SET __MVNW_PSMODULEP_SAVE=
40
+ @SET __MVNW_ARG0_NAME__=
41
+ @SET MVNW_USERNAME=
42
+ @SET MVNW_PASSWORD=
43
+ @IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*)
44
+ @echo Cannot start maven from wrapper >&2 && exit /b 1
45
+ @GOTO :EOF
46
+ : end batch / begin powershell #>
47
+
48
+ $ErrorActionPreference = "Stop"
49
+ if ($env:MVNW_VERBOSE -eq "true") {
50
+ $VerbosePreference = "Continue"
51
+ }
52
+
53
+ # calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties
54
+ $distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl
55
+ if (!$distributionUrl) {
56
+ Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
57
+ }
58
+
59
+ switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) {
60
+ "maven-mvnd-*" {
61
+ $USE_MVND = $true
62
+ $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip"
63
+ $MVN_CMD = "mvnd.cmd"
64
+ break
65
+ }
66
+ default {
67
+ $USE_MVND = $false
68
+ $MVN_CMD = $script -replace '^mvnw','mvn'
69
+ break
70
+ }
71
+ }
72
+
73
+ # apply MVNW_REPOURL and calculate MAVEN_HOME
74
+ # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
75
+ if ($env:MVNW_REPOURL) {
76
+ $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" }
77
+ $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')"
78
+ }
79
+ $distributionUrlName = $distributionUrl -replace '^.*/',''
80
+ $distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$',''
81
+
82
+ $MAVEN_M2_PATH = "$HOME/.m2"
83
+ if ($env:MAVEN_USER_HOME) {
84
+ $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME"
85
+ }
86
+
87
+ if (-not (Test-Path -Path $MAVEN_M2_PATH)) {
88
+ New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null
89
+ }
90
+
91
+ $MAVEN_WRAPPER_DISTS = $null
92
+ if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) {
93
+ $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists"
94
+ } else {
95
+ $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists"
96
+ }
97
+
98
+ $MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain"
99
+ $MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join ''
100
+ $MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME"
101
+
102
+ if (Test-Path -Path "$MAVEN_HOME" -PathType Container) {
103
+ Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME"
104
+ Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
105
+ exit $?
106
+ }
107
+
108
+ if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) {
109
+ Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl"
110
+ }
111
+
112
+ # prepare tmp dir
113
+ $TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile
114
+ $TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir"
115
+ $TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null
116
+ trap {
117
+ if ($TMP_DOWNLOAD_DIR.Exists) {
118
+ try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
119
+ catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
120
+ }
121
+ }
122
+
123
+ New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null
124
+
125
+ # Download and Install Apache Maven
126
+ Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
127
+ Write-Verbose "Downloading from: $distributionUrl"
128
+ Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
129
+
130
+ $webclient = New-Object System.Net.WebClient
131
+ if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) {
132
+ $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD)
133
+ }
134
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
135
+ $webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null
136
+
137
+ # If specified, validate the SHA-256 sum of the Maven distribution zip file
138
+ $distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum
139
+ if ($distributionSha256Sum) {
140
+ if ($USE_MVND) {
141
+ Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties."
142
+ }
143
+ Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash
144
+ if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) {
145
+ Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property."
146
+ }
147
+ }
148
+
149
+ # unzip and move
150
+ Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null
151
+
152
+ # Find the actual extracted directory name (handles snapshots where filename != directory name)
153
+ $actualDistributionDir = ""
154
+
155
+ # First try the expected directory name (for regular distributions)
156
+ $expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain"
157
+ $expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD"
158
+ if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) {
159
+ $actualDistributionDir = $distributionUrlNameMain
160
+ }
161
+
162
+ # If not found, search for any directory with the Maven executable (for snapshots)
163
+ if (!$actualDistributionDir) {
164
+ Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object {
165
+ $testPath = Join-Path $_.FullName "bin/$MVN_CMD"
166
+ if (Test-Path -Path $testPath -PathType Leaf) {
167
+ $actualDistributionDir = $_.Name
168
+ }
169
+ }
170
+ }
171
+
172
+ if (!$actualDistributionDir) {
173
+ Write-Error "Could not find Maven distribution directory in extracted archive"
174
+ }
175
+
176
+ Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir"
177
+ Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null
178
+ try {
179
+ Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null
180
+ } catch {
181
+ if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) {
182
+ Write-Error "fail to move MAVEN_HOME"
183
+ }
184
+ } finally {
185
+ try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
186
+ catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
187
+ }
188
+
189
+ Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
benchmark/whole_applications/cargotracker/spring/pom.xml ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version='1.0' encoding='utf-8'?>
2
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion>
3
+ <parent>
4
+ <groupId>org.springframework.boot</groupId>
5
+ <artifactId>spring-boot-starter-parent</artifactId>
6
+ <version>3.3.0</version>
7
+ <relativePath/>
8
+ </parent>
9
+ <groupId>org.eclipse.ee4j</groupId>
10
+ <artifactId>cargo-tracker</artifactId>
11
+ <version>0.0.1-SNAPSHOT</version>
12
+ <name>Eclipse Cargo Tracker</name>
13
+ <description>The project demonstrates how you can develop applications with the Spring platform using widely adopted architectural best practices like Domain-Driven Design (DDD).</description>
14
+ <url />
15
+ <licenses>
16
+ <license />
17
+ </licenses>
18
+ <developers>
19
+ <developer />
20
+ </developers>
21
+ <scm>
22
+ <connection />
23
+ <developerConnection />
24
+ <tag />
25
+ <url />
26
+ </scm>
27
+ <properties>
28
+ <java.version>17</java.version>
29
+ <maven.compiler.source>17</maven.compiler.source>
30
+ <maven.compiler.target>17</maven.compiler.target>
31
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
32
+ <joinfaces.version>5.5.4</joinfaces.version>
33
+ </properties>
34
+ <dependencyManagement>
35
+ <dependencies>
36
+ <dependency>
37
+ <groupId>org.joinfaces</groupId>
38
+ <artifactId>joinfaces-bom</artifactId>
39
+ <version>${joinfaces.version}</version>
40
+ <type>pom</type>
41
+ <scope>import</scope>
42
+ </dependency>
43
+ </dependencies>
44
+ </dependencyManagement>
45
+ <dependencies>
46
+ <dependency>
47
+ <groupId>org.springframework.boot</groupId>
48
+ <artifactId>spring-boot-starter-data-jpa</artifactId>
49
+ </dependency>
50
+ <dependency>
51
+ <groupId>org.springframework.boot</groupId>
52
+ <artifactId>spring-boot-starter-validation</artifactId>
53
+ </dependency>
54
+ <dependency>
55
+ <groupId>org.springframework.boot</groupId>
56
+ <artifactId>spring-boot-starter-web</artifactId>
57
+ </dependency>
58
+ <dependency>
59
+ <groupId>org.springframework.boot</groupId>
60
+ <artifactId>spring-boot-starter-activemq</artifactId>
61
+ </dependency>
62
+ <dependency>
63
+ <groupId>org.apache.activemq</groupId>
64
+ <artifactId>activemq-broker</artifactId>
65
+ </dependency>
66
+ <dependency>
67
+ <groupId>org.springframework.boot</groupId>
68
+ <artifactId>spring-boot-starter-batch</artifactId>
69
+ </dependency>
70
+ <dependency>
71
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
72
+ <artifactId>jackson-dataformat-xml</artifactId>
73
+ </dependency>
74
+ <dependency>
75
+ <groupId>org.apache.commons</groupId>
76
+ <artifactId>commons-lang3</artifactId>
77
+ <version>3.18.0</version>
78
+ </dependency>
79
+ <dependency>
80
+ <groupId>org.joinfaces</groupId>
81
+ <artifactId>primefaces-spring-boot-starter</artifactId>
82
+ </dependency>
83
+ <dependency>
84
+ <groupId>com.h2database</groupId>
85
+ <artifactId>h2</artifactId>
86
+ <scope>runtime</scope>
87
+ </dependency>
88
+ <dependency>
89
+ <groupId>org.springframework.boot</groupId>
90
+ <artifactId>spring-boot-starter-test</artifactId>
91
+ <scope>test</scope>
92
+ </dependency>
93
+ </dependencies>
94
+ <build>
95
+ <finalName>cargo-tracker</finalName>
96
+ <plugins>
97
+ <plugin>
98
+ <groupId>org.springframework.boot</groupId>
99
+ <artifactId>spring-boot-maven-plugin</artifactId>
100
+ </plugin>
101
+ </plugins>
102
+ </build>
103
+ </project>
benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/CargoTrackerApplication.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.eclipse;
2
+
3
+ import org.springframework.boot.SpringApplication;
4
+ import org.springframework.boot.autoconfigure.SpringBootApplication;
5
+ import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
6
+ import org.springframework.scheduling.annotation.EnableAsync;
7
+ import org.springframework.scheduling.annotation.EnableScheduling;
8
+ import org.springframework.transaction.annotation.EnableTransactionManagement;
9
+
10
+ @SpringBootApplication
11
+ @EnableAsync
12
+ @EnableJpaRepositories
13
+ @EnableScheduling
14
+ @EnableTransactionManagement
15
+ public class CargoTrackerApplication {
16
+
17
+ public static void main(String[] args) {
18
+ SpringApplication.run(CargoTrackerApplication.class, args);
19
+ }
20
+
21
+ }
benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/application/ApplicationEvents.java ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.eclipse.cargotracker.application;
2
+
3
+ import org.eclipse.cargotracker.domain.model.cargo.Cargo;
4
+ import org.eclipse.cargotracker.domain.model.handling.HandlingEvent;
5
+ import org.eclipse.cargotracker.interfaces.handling.HandlingEventRegistrationAttempt;
6
+
7
+ /**
8
+ * This interface provides a way to let other parts of the system know about events that have
9
+ * occurred.
10
+ *
11
+ * <p>
12
+ * It may be implemented synchronously or asynchronously, using for example JMS.
13
+ */
14
+ public interface ApplicationEvents {
15
+
16
+ void cargoWasHandled(HandlingEvent event);
17
+
18
+ void cargoWasMisdirected(Cargo cargo);
19
+
20
+ void cargoHasArrived(Cargo cargo);
21
+
22
+ void receivedHandlingEventRegistrationAttempt(HandlingEventRegistrationAttempt attempt);
23
+ }
benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/application/BookingService.java ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.eclipse.cargotracker.application;
2
+
3
+ import java.time.LocalDate;
4
+ import java.util.List;
5
+ import jakarta.validation.constraints.Future;
6
+ import jakarta.validation.constraints.NotNull;
7
+ import org.eclipse.cargotracker.domain.model.cargo.Itinerary;
8
+ import org.eclipse.cargotracker.domain.model.cargo.TrackingId;
9
+ import org.eclipse.cargotracker.domain.model.location.UnLocode;
10
+ import org.springframework.validation.annotation.Validated;
11
+
12
+ /** Cargo booking service. */
13
+ public interface BookingService {
14
+
15
+ /** Registers a new cargo in the tracking system, not yet routed. */
16
+ TrackingId bookNewCargo(
17
+ @NotNull(message = "Origin is required.") @Validated UnLocode origin,
18
+ @NotNull(message = "Destination is required.") @Validated UnLocode destination,
19
+ @NotNull(message = "Deadline is required.") @Future(
20
+ message = "Deadline must be in the future.") LocalDate arrivalDeadline);
21
+
22
+ /**
23
+ * Requests a list of itineraries describing possible routes for this cargo.
24
+ *
25
+ * @param trackingId Cargo tracking ID
26
+ * @return A list of possible itineraries for this cargo
27
+ */
28
+ List<Itinerary> requestPossibleRoutesForCargo(
29
+ @NotNull(message = "Tracking ID is required.") @Validated TrackingId trackingId);
30
+
31
+ void assignCargoToRoute(
32
+ @NotNull(message = "Itinerary is required.") @Validated Itinerary itinerary,
33
+ @NotNull(message = "Tracking ID is required.") @Validated TrackingId trackingId);
34
+
35
+ void changeDestination(
36
+ @NotNull(message = "Tracking ID is required.") @Validated TrackingId trackingId,
37
+ @NotNull(message = "Destination is required.") @Validated UnLocode unLocode);
38
+
39
+ void changeDeadline(
40
+ @NotNull(message = "Tracking ID is required.") @Validated TrackingId trackingId,
41
+ @NotNull(message = "Deadline is required.") @Future(
42
+ message = "Deadline must be in the future.") LocalDate deadline);
43
+ }
benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/application/CargoInspectionService.java ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.eclipse.cargotracker.application;
2
+
3
+ import jakarta.validation.constraints.NotNull;
4
+ import org.eclipse.cargotracker.domain.model.cargo.TrackingId;
5
+ import org.springframework.validation.annotation.Validated;
6
+
7
+ public interface CargoInspectionService {
8
+
9
+ /**
10
+ * Inspect cargo and send relevant notifications to interested parties, for example if a cargo has
11
+ * been misdirected, or unloaded at the final destination.
12
+ */
13
+ public void inspectCargo(
14
+ @NotNull(message = "Tracking ID is required.") @Validated TrackingId trackingId);
15
+ }
benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/application/HandlingEventService.java ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.eclipse.cargotracker.application;
2
+
3
+ import java.time.LocalDateTime;
4
+ import jakarta.validation.constraints.NotNull;
5
+ import org.eclipse.cargotracker.domain.model.cargo.TrackingId;
6
+ import org.eclipse.cargotracker.domain.model.handling.CannotCreateHandlingEventException;
7
+ import org.eclipse.cargotracker.domain.model.handling.HandlingEvent;
8
+ import org.eclipse.cargotracker.domain.model.location.UnLocode;
9
+ import org.eclipse.cargotracker.domain.model.voyage.VoyageNumber;
10
+ import org.springframework.validation.annotation.Validated;
11
+
12
+ public interface HandlingEventService {
13
+
14
+ /**
15
+ * Registers a handling event in the system, and notifies interested parties that a cargo has been
16
+ * handled.
17
+ */
18
+ void registerHandlingEvent(
19
+ @NotNull(message = "Completion time is required.") LocalDateTime completionTime,
20
+ @NotNull(message = "Tracking ID is required.") @Validated TrackingId trackingId,
21
+ @Validated VoyageNumber voyageNumber,
22
+ @NotNull(message = "Location is required.") @Validated UnLocode unLocode,
23
+ @NotNull(message = "Type is required.") HandlingEvent.Type type)
24
+ throws CannotCreateHandlingEventException;
25
+ }
benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/config/JmsConfig.java ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.eclipse.cargotracker.config;
2
+
3
+ import org.springframework.context.annotation.Bean;
4
+ import org.springframework.context.annotation.Configuration;
5
+ import org.springframework.jms.annotation.EnableJms;
6
+ import org.springframework.jms.core.JmsTemplate;
7
+ import org.springframework.jms.support.converter.MappingJackson2MessageConverter;
8
+ import org.springframework.jms.support.converter.MessageType;
9
+ import com.fasterxml.jackson.databind.ObjectMapper;
10
+ import com.fasterxml.jackson.databind.json.JsonMapper;
11
+ import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
12
+ import jakarta.jms.ConnectionFactory;
13
+
14
+ @Configuration
15
+ @EnableJms
16
+ public class JmsConfig {
17
+
18
+ private static final int LOW_PRIORITY = 0;
19
+
20
+ @Bean
21
+ public ObjectMapper objectMapper() {
22
+ return JsonMapper.builder()
23
+ .addModule(new JavaTimeModule())
24
+ .build();
25
+ }
26
+
27
+ @Bean
28
+ public MappingJackson2MessageConverter jacksonJmsMessageConverter(ObjectMapper objectMapper) {
29
+ MappingJackson2MessageConverter converter = new MappingJackson2MessageConverter();
30
+ converter.setObjectMapper(objectMapper);
31
+ converter.setTargetType(MessageType.TEXT);
32
+ converter.setTypeIdPropertyName("_type");
33
+ return converter;
34
+ }
35
+
36
+ @Bean
37
+ public JmsTemplate jmsTemplate(ConnectionFactory connectionFactory,
38
+ MappingJackson2MessageConverter messageConverter) {
39
+ JmsTemplate template = new JmsTemplate(connectionFactory);
40
+ template.setMessageConverter(messageConverter);
41
+ // for parity with previous implementation
42
+ template.setPriority(LOW_PRIORITY);
43
+ template.setMessageIdEnabled(false);
44
+ template.setMessageTimestampEnabled(false);
45
+
46
+ return template;
47
+ }
48
+
49
+ }
benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/cargo/Cargo.java ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.eclipse.cargotracker.domain.model.cargo;
2
+
3
+ import java.io.Serializable;
4
+ import jakarta.persistence.Embedded;
5
+ import jakarta.persistence.Entity;
6
+ import jakarta.persistence.GeneratedValue;
7
+ import jakarta.persistence.Id;
8
+ import jakarta.persistence.JoinColumn;
9
+ import jakarta.persistence.ManyToOne;
10
+ import jakarta.validation.constraints.NotNull;
11
+ import org.apache.commons.lang3.Validate;
12
+ import org.eclipse.cargotracker.domain.model.handling.HandlingEvent;
13
+ import org.eclipse.cargotracker.domain.model.handling.HandlingHistory;
14
+ import org.eclipse.cargotracker.domain.model.location.Location;
15
+ import org.eclipse.cargotracker.domain.shared.DomainObjectUtils;
16
+
17
+ /**
18
+ * A Cargo. This is the central class in the domain model, and it is the root of the
19
+ * Cargo-Itinerary-Leg-Delivery-RouteSpecification aggregate.
20
+ *
21
+ * <p>
22
+ * A cargo is identified by a unique tracking ID, and it always has an origin and a route
23
+ * specification. The life cycle of a cargo begins with the booking procedure, when the tracking ID
24
+ * is assigned. During a (short) period of time, between booking and initial routing, the cargo has
25
+ * no itinerary.
26
+ *
27
+ * <p>
28
+ * The booking clerk requests a list of possible routes, matching the route specification, and
29
+ * assigns the cargo to one route. The route to which a cargo is assigned is described by an
30
+ * itinerary.
31
+ *
32
+ * <p>
33
+ * A cargo can be re-routed during transport, on demand of the customer, in which case a new route
34
+ * is specified for the cargo and a new route is requested. The old itinerary, being a value object,
35
+ * is discarded and a new one is attached.
36
+ *
37
+ * <p>
38
+ * It may also happen that a cargo is accidentally misrouted, which should notify the proper
39
+ * personnel and also trigger a re-routing procedure.
40
+ *
41
+ * <p>
42
+ * When a cargo is handled, the status of the delivery changes. Everything about the delivery of the
43
+ * cargo is contained in the Delivery value object, which is replaced whenever a cargo is handled by
44
+ * an asynchronous event triggered by the registration of the handling event.
45
+ *
46
+ * <p>
47
+ * The delivery can also be affected by routing changes, i.e. when a the route specification
48
+ * changes, or the cargo is assigned to a new route. In that case, the delivery update is performed
49
+ * synchronously within the cargo aggregate.
50
+ *
51
+ * <p>
52
+ * The life cycle of a cargo ends when the cargo is claimed by the customer.
53
+ *
54
+ * <p>
55
+ * The cargo aggregate, and the entire domain model, is built to solve the problem of booking and
56
+ * tracking cargo. All important business rules for determining whether or not a cargo is
57
+ * misdirected, what the current status of the cargo is (on board carrier, in port etc), are
58
+ * captured in this aggregate.
59
+ */
60
+ @Entity
61
+ public class Cargo implements Serializable {
62
+
63
+ private static final long serialVersionUID = 1L;
64
+
65
+ @Id
66
+ @GeneratedValue
67
+ private Long id;
68
+
69
+ @Embedded
70
+ @NotNull(message = "Tracking ID is required.")
71
+ private TrackingId trackingId;
72
+
73
+ @ManyToOne
74
+ @JoinColumn(name = "origin_id", updatable = false)
75
+ @NotNull
76
+ private Location origin;
77
+
78
+ @Embedded
79
+ @NotNull(message = "Route specification is required.")
80
+ private RouteSpecification routeSpecification;
81
+
82
+ @Embedded
83
+ @NotNull
84
+ private Itinerary itinerary;
85
+ @Embedded
86
+ @NotNull
87
+ private Delivery delivery;
88
+
89
+ public Cargo() {
90
+ // Nothing to initialize.
91
+ }
92
+
93
+ public Cargo(TrackingId trackingId, RouteSpecification routeSpecification) {
94
+ Validate.notNull(trackingId, "Tracking ID is required.");
95
+ Validate.notNull(routeSpecification, "Route specification is required.");
96
+
97
+ this.trackingId = trackingId;
98
+ // Cargo origin never changes, even if the route specification changes.
99
+ // However, at creation, cargo origin can be derived from the initial
100
+ // route specification.
101
+ this.origin = routeSpecification.getOrigin();
102
+ this.routeSpecification = routeSpecification;
103
+
104
+ this.delivery =
105
+ Delivery.derivedFrom(this.routeSpecification, this.itinerary, HandlingHistory.EMPTY);
106
+ this.itinerary = Itinerary.EMPTY_ITINERARY;
107
+ }
108
+
109
+ public TrackingId getTrackingId() {
110
+ return trackingId;
111
+ }
112
+
113
+ public Location getOrigin() {
114
+ return origin;
115
+ }
116
+
117
+ public void setOrigin(Location origin) {
118
+ this.origin = origin;
119
+ }
120
+
121
+ public RouteSpecification getRouteSpecification() {
122
+ return routeSpecification;
123
+ }
124
+
125
+ /** @return The delivery. Never null. */
126
+ public Delivery getDelivery() {
127
+ return delivery;
128
+ }
129
+
130
+ /** @return The itinerary. Never null. */
131
+ public Itinerary getItinerary() {
132
+ return DomainObjectUtils.nullSafe(this.itinerary, Itinerary.EMPTY_ITINERARY);
133
+ }
134
+
135
+ /** Specifies a new route for this cargo. */
136
+ public void specifyNewRoute(RouteSpecification routeSpecification) {
137
+ Validate.notNull(routeSpecification, "Route specification is required.");
138
+
139
+ this.routeSpecification = routeSpecification;
140
+ // Handling consistency within the Cargo aggregate synchronously
141
+ this.delivery = delivery.updateOnRouting(this.routeSpecification, this.itinerary);
142
+ }
143
+
144
+ public void assignToRoute(Itinerary itinerary) {
145
+ Validate.notNull(itinerary, "Itinerary is required for assignment.");
146
+
147
+ this.itinerary = itinerary;
148
+ // Handling consistency within the Cargo aggregate synchronously
149
+ this.delivery = delivery.updateOnRouting(this.routeSpecification, this.itinerary);
150
+ }
151
+
152
+ /**
153
+ * Updates all aspects of the cargo aggregate status based on the current route specification,
154
+ * itinerary and handling of the cargo.
155
+ *
156
+ * <p>
157
+ * When either of those three changes, i.e. when a new route is specified for the cargo, the cargo
158
+ * is assigned to a route or when the cargo is handled, the status must be re-calculated.
159
+ *
160
+ * <p>
161
+ * {@link RouteSpecification} and {@link Itinerary} are both inside the Cargo aggregate, so
162
+ * changes to them cause the status to be updated <b>synchronously</b>, but changes to the
163
+ * delivery history (when a cargo is handled) cause the status update to happen
164
+ * <b>asynchronously</b> since {@link HandlingEvent} is in a different aggregate.
165
+ *
166
+ * @param handlingHistory handling history
167
+ */
168
+ public void deriveDeliveryProgress(HandlingHistory handlingHistory) {
169
+ this.delivery = Delivery.derivedFrom(getRouteSpecification(), getItinerary(), handlingHistory);
170
+ }
171
+
172
+ /**
173
+ * @param object to compare
174
+ * @return True if they have the same identity
175
+ * @see #sameIdentityAs(Cargo)
176
+ */
177
+ @Override
178
+ public boolean equals(Object object) {
179
+ if (this == object) {
180
+ return true;
181
+ }
182
+ if (object == null || !(object instanceof Cargo)) {
183
+ return false;
184
+ }
185
+
186
+ Cargo other = (Cargo) object;
187
+ return sameIdentityAs(other);
188
+ }
189
+
190
+ private boolean sameIdentityAs(Cargo other) {
191
+ return other != null && trackingId.sameValueAs(other.trackingId);
192
+ }
193
+
194
+ /** @return Hash code of tracking id. */
195
+ @Override
196
+ public int hashCode() {
197
+ return trackingId.hashCode();
198
+ }
199
+
200
+ @Override
201
+ public String toString() {
202
+ return trackingId.toString();
203
+ }
204
+ }
benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/cargo/Delivery.java ADDED
@@ -0,0 +1,383 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.eclipse.cargotracker.domain.model.cargo;
2
+
3
+ import static org.eclipse.cargotracker.domain.model.cargo.RoutingStatus.MISROUTED;
4
+ import static org.eclipse.cargotracker.domain.model.cargo.RoutingStatus.NOT_ROUTED;
5
+ import static org.eclipse.cargotracker.domain.model.cargo.RoutingStatus.ROUTED;
6
+ import static org.eclipse.cargotracker.domain.model.cargo.TransportStatus.CLAIMED;
7
+ import static org.eclipse.cargotracker.domain.model.cargo.TransportStatus.IN_PORT;
8
+ import static org.eclipse.cargotracker.domain.model.cargo.TransportStatus.NOT_RECEIVED;
9
+ import static org.eclipse.cargotracker.domain.model.cargo.TransportStatus.ONBOARD_CARRIER;
10
+ import static org.eclipse.cargotracker.domain.model.cargo.TransportStatus.UNKNOWN;
11
+ import java.io.Serializable;
12
+ import java.time.LocalDateTime;
13
+ import java.time.temporal.ChronoUnit;
14
+ import java.util.Iterator;
15
+ import jakarta.persistence.Column;
16
+ import jakarta.persistence.Embeddable;
17
+ import jakarta.persistence.Embedded;
18
+ import jakarta.persistence.EnumType;
19
+ import jakarta.persistence.Enumerated;
20
+ import jakarta.persistence.JoinColumn;
21
+ import jakarta.persistence.ManyToOne;
22
+ import jakarta.validation.constraints.NotNull;
23
+ import org.apache.commons.lang3.Validate;
24
+ import org.apache.commons.lang3.builder.EqualsBuilder;
25
+ import org.apache.commons.lang3.builder.HashCodeBuilder;
26
+ import org.eclipse.cargotracker.domain.model.handling.HandlingEvent;
27
+ import org.eclipse.cargotracker.domain.model.handling.HandlingHistory;
28
+ import org.eclipse.cargotracker.domain.model.location.Location;
29
+ import org.eclipse.cargotracker.domain.model.voyage.Voyage;
30
+ import org.eclipse.cargotracker.domain.shared.DomainObjectUtils;
31
+
32
+ /**
33
+ * The actual transportation of the cargo, as opposed to the customer requirement
34
+ * (RouteSpecification) and the plan (Itinerary).
35
+ */
36
+ @Embeddable
37
+ public class Delivery implements Serializable {
38
+
39
+ private static final long serialVersionUID = 1L;
40
+
41
+ // Null object pattern.
42
+ public static final LocalDateTime ETA_UNKOWN = null;
43
+ public static final HandlingActivity NO_ACTIVITY = new HandlingActivity();
44
+
45
+ @Enumerated(EnumType.STRING)
46
+ @Column(name = "transport_status")
47
+ @NotNull
48
+ private TransportStatus transportStatus;
49
+
50
+ @ManyToOne
51
+ @JoinColumn(name = "last_known_location_id")
52
+ private Location lastKnownLocation;
53
+
54
+ @ManyToOne
55
+ @JoinColumn(name = "current_voyage_id")
56
+ private Voyage currentVoyage;
57
+
58
+ @NotNull
59
+ private boolean misdirected;
60
+
61
+ private LocalDateTime eta;
62
+
63
+ @Embedded
64
+ private HandlingActivity nextExpectedActivity;
65
+
66
+ @Column(name = "unloaded_at_dest")
67
+ @NotNull
68
+ private boolean isUnloadedAtDestination;
69
+
70
+ @Enumerated(EnumType.STRING)
71
+ @Column(name = "routing_status")
72
+ @NotNull
73
+ private RoutingStatus routingStatus;
74
+
75
+ @Column(name = "calculated_at")
76
+ @NotNull
77
+ private LocalDateTime calculatedAt;
78
+
79
+ @ManyToOne
80
+ @JoinColumn(name = "last_event_id")
81
+ private HandlingEvent lastEvent;
82
+
83
+ public Delivery() {
84
+ // Nothing to initialize
85
+ }
86
+
87
+ public Delivery(
88
+ HandlingEvent lastEvent, Itinerary itinerary, RouteSpecification routeSpecification) {
89
+ // This is a workaround to a Hibernate issue. when the `LocalDateTime` field is persisted into
90
+ // the DB, and retrieved from the DB, the values are different by nanoseconds.
91
+ this.calculatedAt = LocalDateTime.now().truncatedTo(ChronoUnit.SECONDS);
92
+ this.lastEvent = lastEvent;
93
+
94
+ this.misdirected = calculateMisdirectionStatus(itinerary);
95
+ this.routingStatus = calculateRoutingStatus(itinerary, routeSpecification);
96
+ this.transportStatus = calculateTransportStatus();
97
+ this.lastKnownLocation = calculateLastKnownLocation();
98
+ this.currentVoyage = calculateCurrentVoyage();
99
+ this.eta = calculateEta(itinerary);
100
+ this.nextExpectedActivity = calculateNextExpectedActivity(routeSpecification, itinerary);
101
+ this.isUnloadedAtDestination = calculateUnloadedAtDestination(routeSpecification);
102
+ }
103
+
104
+ /**
105
+ * Creates a new delivery snapshot based on the complete handling history of a cargo, as well as
106
+ * its route specification and itinerary.
107
+ *
108
+ * @param routeSpecification route specification
109
+ * @param itinerary itinerary
110
+ * @param handlingHistory delivery history
111
+ * @return An up to date delivery.
112
+ */
113
+ static Delivery derivedFrom(
114
+ RouteSpecification routeSpecification, Itinerary itinerary, HandlingHistory handlingHistory) {
115
+ Validate.notNull(routeSpecification, "Route specification is required");
116
+ Validate.notNull(handlingHistory, "Delivery history is required");
117
+
118
+ HandlingEvent lastEvent = handlingHistory.getMostRecentlyCompletedEvent();
119
+
120
+ return new Delivery(lastEvent, itinerary, routeSpecification);
121
+ }
122
+
123
+ /**
124
+ * Creates a new delivery snapshot to reflect changes in routing, i.e. when the route
125
+ * specification or the itinerary has changed but no additional handling of the cargo has been
126
+ * performed.
127
+ */
128
+ Delivery updateOnRouting(RouteSpecification routeSpecification, Itinerary itinerary) {
129
+ Validate.notNull(routeSpecification, "Route specification is required");
130
+
131
+ return new Delivery(this.lastEvent, itinerary, routeSpecification);
132
+ }
133
+
134
+ public TransportStatus getTransportStatus() {
135
+ return transportStatus;
136
+ }
137
+
138
+ public void setTransportStatus(TransportStatus transportStatus) {
139
+ this.transportStatus = transportStatus;
140
+ }
141
+
142
+ public Location getLastKnownLocation() {
143
+ return DomainObjectUtils.nullSafe(lastKnownLocation, Location.UNKNOWN);
144
+ }
145
+
146
+ public void setLastKnownLocation(Location lastKnownLocation) {
147
+ this.lastKnownLocation = lastKnownLocation;
148
+ }
149
+
150
+ public void setLastEvent(HandlingEvent lastEvent) {
151
+ this.lastEvent = lastEvent;
152
+ }
153
+
154
+ public Voyage getCurrentVoyage() {
155
+ return DomainObjectUtils.nullSafe(currentVoyage, Voyage.NONE);
156
+ }
157
+
158
+ /**
159
+ * Check if cargo is misdirected.
160
+ *
161
+ * <p>
162
+ *
163
+ * <ul>
164
+ * <li>A cargo is misdirected if it is in a location that's not in the itinerary.
165
+ * <li>A cargo with no itinerary can not be misdirected.
166
+ * <li>A cargo that has received no handling events can not be misdirected.
167
+ * </ul>
168
+ *
169
+ * @return <code>true</code> if the cargo has been misdirected,
170
+ */
171
+ public boolean isMisdirected() {
172
+ return misdirected;
173
+ }
174
+
175
+ public void setMisdirected(boolean misdirected) {
176
+ this.misdirected = misdirected;
177
+ }
178
+
179
+ public LocalDateTime getEstimatedTimeOfArrival() {
180
+ return eta;
181
+ }
182
+
183
+ public HandlingActivity getNextExpectedActivity() {
184
+ return nextExpectedActivity;
185
+ }
186
+
187
+ /** @return True if the cargo has been unloaded at the final destination. */
188
+ public boolean isUnloadedAtDestination() {
189
+ return isUnloadedAtDestination;
190
+ }
191
+
192
+ public void setUnloadedAtDestination(boolean isUnloadedAtDestination) {
193
+ this.isUnloadedAtDestination = isUnloadedAtDestination;
194
+ }
195
+
196
+ public RoutingStatus getRoutingStatus() {
197
+ return routingStatus;
198
+ }
199
+
200
+ public void setRoutingStatus(RoutingStatus routingStatus) {
201
+ this.routingStatus = routingStatus;
202
+ }
203
+
204
+ public LocalDateTime getCalculatedAt() {
205
+ return calculatedAt;
206
+ }
207
+
208
+ public void setCalculatedAt(LocalDateTime calculatedAt) {
209
+ this.calculatedAt = calculatedAt;
210
+ }
211
+
212
+ private TransportStatus calculateTransportStatus() {
213
+ if (lastEvent == null) {
214
+ return NOT_RECEIVED;
215
+ }
216
+
217
+ switch (lastEvent.getType()) {
218
+ case LOAD:
219
+ return ONBOARD_CARRIER;
220
+ case UNLOAD:
221
+ case RECEIVE:
222
+ case CUSTOMS:
223
+ return IN_PORT;
224
+ case CLAIM:
225
+ return CLAIMED;
226
+ default:
227
+ return UNKNOWN;
228
+ }
229
+ }
230
+
231
+ private Location calculateLastKnownLocation() {
232
+ if (lastEvent != null) {
233
+ return lastEvent.getLocation();
234
+ } else {
235
+ return null;
236
+ }
237
+ }
238
+
239
+ private Voyage calculateCurrentVoyage() {
240
+ if (getTransportStatus().equals(ONBOARD_CARRIER) && lastEvent != null) {
241
+ return lastEvent.getVoyage();
242
+ } else {
243
+ return null;
244
+ }
245
+ }
246
+
247
+ private boolean calculateMisdirectionStatus(Itinerary itinerary) {
248
+ if (lastEvent == null) {
249
+ return false;
250
+ } else {
251
+ return !itinerary.isExpected(lastEvent);
252
+ }
253
+ }
254
+
255
+ private LocalDateTime calculateEta(Itinerary itinerary) {
256
+ if (onTrack()) {
257
+ // This is a workaround to a Hibernate issue. when the `LocalDateTime` field is persisted into
258
+ // the DB, and retrieved from the DB, the values are different by nanoseconds.
259
+ return itinerary.getFinalArrivalDate().truncatedTo(ChronoUnit.SECONDS);
260
+ } else {
261
+ return ETA_UNKOWN;
262
+ }
263
+ }
264
+
265
+ private HandlingActivity calculateNextExpectedActivity(
266
+ RouteSpecification routeSpecification, Itinerary itinerary) {
267
+ if (!onTrack()) {
268
+ return NO_ACTIVITY;
269
+ }
270
+
271
+ if (lastEvent == null) {
272
+ return new HandlingActivity(HandlingEvent.Type.RECEIVE, routeSpecification.getOrigin());
273
+ }
274
+
275
+ switch (lastEvent.getType()) {
276
+ case LOAD:
277
+ for (Leg leg : itinerary.getLegs()) {
278
+ if (leg.getLoadLocation().sameIdentityAs(lastEvent.getLocation())) {
279
+ return new HandlingActivity(
280
+ HandlingEvent.Type.UNLOAD, leg.getUnloadLocation(), leg.getVoyage());
281
+ }
282
+ }
283
+
284
+ return NO_ACTIVITY;
285
+
286
+ case UNLOAD:
287
+ for (Iterator<Leg> iterator = itinerary.getLegs().iterator(); iterator.hasNext();) {
288
+ Leg leg = iterator.next();
289
+
290
+ if (leg.getUnloadLocation().sameIdentityAs(lastEvent.getLocation())) {
291
+ if (iterator.hasNext()) {
292
+ Leg nextLeg = iterator.next();
293
+ return new HandlingActivity(
294
+ HandlingEvent.Type.LOAD, nextLeg.getLoadLocation(), nextLeg.getVoyage());
295
+ } else {
296
+ return new HandlingActivity(HandlingEvent.Type.CLAIM, leg.getUnloadLocation());
297
+ }
298
+ }
299
+ }
300
+
301
+ return NO_ACTIVITY;
302
+
303
+ case RECEIVE:
304
+ Leg firstLeg = itinerary.getLegs().iterator().next();
305
+
306
+ return new HandlingActivity(
307
+ HandlingEvent.Type.LOAD, firstLeg.getLoadLocation(), firstLeg.getVoyage());
308
+
309
+ case CLAIM:
310
+ default:
311
+ return NO_ACTIVITY;
312
+ }
313
+ }
314
+
315
+ private RoutingStatus calculateRoutingStatus(
316
+ Itinerary itinerary, RouteSpecification routeSpecification) {
317
+ if (itinerary == null || itinerary == Itinerary.EMPTY_ITINERARY) {
318
+ return NOT_ROUTED;
319
+ } else {
320
+ if (routeSpecification.isSatisfiedBy(itinerary)) {
321
+ return ROUTED;
322
+ } else {
323
+ return MISROUTED;
324
+ }
325
+ }
326
+ }
327
+
328
+ private boolean calculateUnloadedAtDestination(RouteSpecification routeSpecification) {
329
+ return lastEvent != null
330
+ && HandlingEvent.Type.UNLOAD.sameValueAs(lastEvent.getType())
331
+ && routeSpecification.getDestination().sameIdentityAs(lastEvent.getLocation());
332
+ }
333
+
334
+ private boolean onTrack() {
335
+ return routingStatus.equals(ROUTED) && !misdirected;
336
+ }
337
+
338
+ private boolean sameValueAs(Delivery other) {
339
+ return other != null
340
+ && new EqualsBuilder()
341
+ .append(this.transportStatus, other.transportStatus)
342
+ .append(this.lastKnownLocation, other.lastKnownLocation)
343
+ .append(this.currentVoyage, other.currentVoyage)
344
+ .append(this.misdirected, other.misdirected)
345
+ .append(this.eta, other.eta)
346
+ .append(this.nextExpectedActivity, other.nextExpectedActivity)
347
+ .append(this.isUnloadedAtDestination, other.isUnloadedAtDestination)
348
+ .append(this.routingStatus, other.routingStatus)
349
+ .append(this.calculatedAt, other.calculatedAt)
350
+ .append(this.lastEvent, other.lastEvent)
351
+ .isEquals();
352
+ }
353
+
354
+ @Override
355
+ public boolean equals(Object o) {
356
+ if (this == o) {
357
+ return true;
358
+ }
359
+ if (o == null || !(o instanceof Delivery)) {
360
+ return false;
361
+ }
362
+
363
+ Delivery other = (Delivery) o;
364
+
365
+ return sameValueAs(other);
366
+ }
367
+
368
+ @Override
369
+ public int hashCode() {
370
+ return new HashCodeBuilder()
371
+ .append(transportStatus)
372
+ .append(lastKnownLocation)
373
+ .append(currentVoyage)
374
+ .append(misdirected)
375
+ .append(eta)
376
+ .append(nextExpectedActivity)
377
+ .append(isUnloadedAtDestination)
378
+ .append(routingStatus)
379
+ .append(calculatedAt)
380
+ .append(lastEvent)
381
+ .toHashCode();
382
+ }
383
+ }
benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/cargo/HandlingActivity.java ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.eclipse.cargotracker.domain.model.cargo;
2
+
3
+ import java.io.Serializable;
4
+ import jakarta.persistence.Column;
5
+ import jakarta.persistence.Embeddable;
6
+ import jakarta.persistence.EnumType;
7
+ import jakarta.persistence.Enumerated;
8
+ import jakarta.persistence.JoinColumn;
9
+ import jakarta.persistence.ManyToOne;
10
+ import jakarta.validation.constraints.NotNull;
11
+ import org.apache.commons.lang3.Validate;
12
+ import org.apache.commons.lang3.builder.EqualsBuilder;
13
+ import org.apache.commons.lang3.builder.HashCodeBuilder;
14
+ import org.eclipse.cargotracker.domain.model.handling.HandlingEvent;
15
+ import org.eclipse.cargotracker.domain.model.location.Location;
16
+ import org.eclipse.cargotracker.domain.model.voyage.Voyage;
17
+
18
+ /**
19
+ * A handling activity represents how and where a cargo can be handled, and can be used to express
20
+ * predictions about what is expected to happen to a cargo in the future.
21
+ */
22
+ @Embeddable
23
+ public class HandlingActivity implements Serializable {
24
+
25
+ private static final long serialVersionUID = 1L;
26
+
27
+ @Enumerated(EnumType.STRING)
28
+ @Column(name = "next_expected_handling_event_type")
29
+ @NotNull(message = "Handling event type is required.")
30
+ private HandlingEvent.Type type;
31
+
32
+ @ManyToOne
33
+ @JoinColumn(name = "next_expected_location_id")
34
+ @NotNull(message = "Location is required.")
35
+ private Location location;
36
+
37
+ @ManyToOne
38
+ @JoinColumn(name = "next_expected_voyage_id")
39
+ private Voyage voyage;
40
+
41
+ public HandlingActivity() {}
42
+
43
+ public HandlingActivity(HandlingEvent.Type type, Location location) {
44
+ Validate.notNull(type, "Handling event type is required.");
45
+ Validate.notNull(location, "Location is required.");
46
+
47
+ this.type = type;
48
+ this.location = location;
49
+ }
50
+
51
+ public HandlingActivity(HandlingEvent.Type type, Location location, Voyage voyage) {
52
+ Validate.notNull(type, "Handling event type is required");
53
+ Validate.notNull(location, "Location is required");
54
+ Validate.notNull(voyage, "Voyage is required");
55
+
56
+ this.type = type;
57
+ this.location = location;
58
+ this.voyage = voyage;
59
+ }
60
+
61
+ public HandlingEvent.Type getType() {
62
+ return type;
63
+ }
64
+
65
+ public Location getLocation() {
66
+ return location;
67
+ }
68
+
69
+ public Voyage getVoyage() {
70
+ return voyage;
71
+ }
72
+
73
+ private boolean sameValueAs(HandlingActivity other) {
74
+ return other != null
75
+ && new EqualsBuilder()
76
+ .append(this.type, other.type)
77
+ .append(this.location, other.location)
78
+ .append(this.voyage, other.voyage)
79
+ .isEquals();
80
+ }
81
+
82
+ @Override
83
+ public int hashCode() {
84
+ return new HashCodeBuilder()
85
+ .append(this.type)
86
+ .append(this.location)
87
+ .append(this.voyage)
88
+ .toHashCode();
89
+ }
90
+
91
+ @Override
92
+ public boolean equals(Object obj) {
93
+ if (obj == this) {
94
+ return true;
95
+ }
96
+
97
+ if (obj == null) {
98
+ return false;
99
+ }
100
+
101
+ if (!(obj instanceof HandlingActivity)) {
102
+ return false;
103
+ }
104
+
105
+ HandlingActivity other = (HandlingActivity) obj;
106
+
107
+ return sameValueAs(other);
108
+ }
109
+
110
+ public boolean isEmpty() {
111
+ if (type != null) {
112
+ return false;
113
+ }
114
+
115
+ if (location != null) {
116
+ return false;
117
+ }
118
+
119
+ return voyage == null;
120
+ }
121
+ }
benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/cargo/Itinerary.java ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.eclipse.cargotracker.domain.model.cargo;
2
+
3
+ import java.io.Serializable;
4
+ import java.time.LocalDateTime;
5
+ import java.util.Collections;
6
+ import java.util.List;
7
+ import jakarta.persistence.CascadeType;
8
+ import jakarta.persistence.Embeddable;
9
+ import jakarta.persistence.JoinColumn;
10
+ import jakarta.persistence.OneToMany;
11
+ import jakarta.persistence.OrderColumn;
12
+ import jakarta.validation.constraints.NotEmpty;
13
+ import jakarta.validation.constraints.Size;
14
+ import org.apache.commons.lang3.Validate;
15
+ import org.eclipse.cargotracker.domain.model.handling.HandlingEvent;
16
+ import org.eclipse.cargotracker.domain.model.location.Location;
17
+
18
+ @Embeddable
19
+ public class Itinerary implements Serializable {
20
+
21
+ private static final long serialVersionUID = 1L;
22
+
23
+ // Null object pattern.
24
+ public static final Itinerary EMPTY_ITINERARY = new Itinerary();
25
+
26
+ // TODO [Clean Code] Look into why cascade delete doesn't work.
27
+ @OneToMany(cascade = CascadeType.ALL)
28
+ @JoinColumn(name = "cargo_id")
29
+ @OrderColumn(name = "leg_order")
30
+ @Size(min = 1)
31
+ @NotEmpty(message = "Legs must not be empty.")
32
+ private List<Leg> legs = Collections.emptyList();
33
+
34
+ public Itinerary() {
35
+ // Nothing to initialize.
36
+ }
37
+
38
+ public Itinerary(List<Leg> legs) {
39
+ Validate.notEmpty(legs);
40
+ Validate.noNullElements(legs);
41
+
42
+ this.legs = legs;
43
+ }
44
+
45
+ public List<Leg> getLegs() {
46
+ return Collections.unmodifiableList(legs);
47
+ }
48
+
49
+ /** Test if the given handling event is expected when executing this itinerary. */
50
+ public boolean isExpected(HandlingEvent event) {
51
+ if (legs.isEmpty()) {
52
+ return true;
53
+ }
54
+
55
+ switch (event.getType()) {
56
+ case RECEIVE: {
57
+ // Check that the first leg's origin is the event's location
58
+ Leg leg = legs.get(0);
59
+ return leg.getLoadLocation().equals(event.getLocation());
60
+ }
61
+
62
+ case LOAD: {
63
+ return legs.stream()
64
+ .anyMatch(
65
+ leg -> leg.getLoadLocation().equals(event.getLocation())
66
+ && leg.getVoyage().equals(event.getVoyage()));
67
+ }
68
+
69
+ case UNLOAD: {
70
+ // Check that the there is one leg with same unload location and
71
+ // voyage
72
+ return legs.stream()
73
+ .anyMatch(
74
+ leg -> leg.getUnloadLocation().equals(event.getLocation())
75
+ && leg.getVoyage().equals(event.getVoyage()));
76
+ }
77
+
78
+ case CLAIM: {
79
+ // Check that the last leg's destination is from the event's
80
+ // location
81
+ Leg leg = getLastLeg();
82
+
83
+ return leg.getUnloadLocation().equals(event.getLocation());
84
+ }
85
+
86
+ case CUSTOMS: {
87
+ return true;
88
+ }
89
+
90
+ default:
91
+ throw new RuntimeException("Event case is not handled");
92
+ }
93
+ }
94
+
95
+ Location getInitialDepartureLocation() {
96
+ if (legs.isEmpty()) {
97
+ return Location.UNKNOWN;
98
+ } else {
99
+ return legs.get(0).getLoadLocation();
100
+ }
101
+ }
102
+
103
+ Location getFinalArrivalLocation() {
104
+ if (legs.isEmpty()) {
105
+ return Location.UNKNOWN;
106
+ } else {
107
+ return getLastLeg().getUnloadLocation();
108
+ }
109
+ }
110
+
111
+ /** @return Date when cargo arrives at final destination. */
112
+ LocalDateTime getFinalArrivalDate() {
113
+ Leg lastLeg = getLastLeg();
114
+
115
+ if (lastLeg == null) {
116
+ return LocalDateTime.MAX;
117
+ } else {
118
+ return lastLeg.getUnloadTime();
119
+ }
120
+ }
121
+
122
+ /** @return The last leg on the itinerary. */
123
+ Leg getLastLeg() {
124
+ if (legs.isEmpty()) {
125
+ return null;
126
+ } else {
127
+ return legs.get(legs.size() - 1);
128
+ }
129
+ }
130
+
131
+ private boolean sameValueAs(Itinerary other) {
132
+ return other != null && legs.equals(other.legs);
133
+ }
134
+
135
+ @Override
136
+ public boolean equals(Object o) {
137
+ if (this == o) {
138
+ return true;
139
+ }
140
+
141
+ if (o == null || !(o instanceof Itinerary)) {
142
+ return false;
143
+ }
144
+
145
+ Itinerary itinerary = (Itinerary) o;
146
+
147
+ return sameValueAs(itinerary);
148
+ }
149
+
150
+ @Override
151
+ public int hashCode() {
152
+ return legs.hashCode();
153
+ }
154
+
155
+ @Override
156
+ public String toString() {
157
+ return "Itinerary{" + "legs=" + legs + '}';
158
+ }
159
+ }
benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/cargo/Leg.java ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.eclipse.cargotracker.domain.model.cargo;
2
+
3
+ import java.io.Serializable;
4
+ import java.time.LocalDateTime;
5
+ import java.time.temporal.ChronoUnit;
6
+ import jakarta.persistence.Column;
7
+ import jakarta.persistence.Entity;
8
+ import jakarta.persistence.GeneratedValue;
9
+ import jakarta.persistence.Id;
10
+ import jakarta.persistence.JoinColumn;
11
+ import jakarta.persistence.ManyToOne;
12
+ import jakarta.validation.constraints.NotNull;
13
+ import org.apache.commons.lang3.Validate;
14
+ import org.apache.commons.lang3.builder.EqualsBuilder;
15
+ import org.apache.commons.lang3.builder.HashCodeBuilder;
16
+ import org.eclipse.cargotracker.domain.model.location.Location;
17
+ import org.eclipse.cargotracker.domain.model.voyage.Voyage;
18
+
19
+ @Entity
20
+ public class Leg implements Serializable {
21
+
22
+ private static final long serialVersionUID = 1L;
23
+
24
+ @Id
25
+ @GeneratedValue
26
+ private Long id;
27
+
28
+ @ManyToOne
29
+ @JoinColumn(name = "voyage_id")
30
+ @NotNull
31
+ private Voyage voyage;
32
+
33
+ @ManyToOne
34
+ @JoinColumn(name = "load_location_id")
35
+ @NotNull
36
+ private Location loadLocation;
37
+
38
+ @ManyToOne
39
+ @JoinColumn(name = "unload_location_id")
40
+ @NotNull
41
+ private Location unloadLocation;
42
+
43
+ @Column(name = "load_time")
44
+ @NotNull
45
+ private LocalDateTime loadTime;
46
+
47
+ @Column(name = "unload_time")
48
+ @NotNull
49
+ private LocalDateTime unloadTime;
50
+
51
+ public Leg() {
52
+ // Nothing to initialize.
53
+ }
54
+
55
+ public Leg(
56
+ Voyage voyage,
57
+ Location loadLocation,
58
+ Location unloadLocation,
59
+ LocalDateTime loadTime,
60
+ LocalDateTime unloadTime) {
61
+ Validate.noNullElements(
62
+ new Object[] {voyage, loadLocation, unloadLocation, loadTime, unloadTime});
63
+
64
+ this.voyage = voyage;
65
+ this.loadLocation = loadLocation;
66
+ this.unloadLocation = unloadLocation;
67
+
68
+ // This is a workaround to a Hibernate issue. when the `LocalDateTime` field is persisted into
69
+ // the DB, and retrieved from the DB, the values are different by nanoseconds.
70
+ this.loadTime = loadTime.truncatedTo(ChronoUnit.SECONDS);
71
+ this.unloadTime = unloadTime.truncatedTo(ChronoUnit.SECONDS);
72
+ }
73
+
74
+ public Voyage getVoyage() {
75
+ return voyage;
76
+ }
77
+
78
+ public Location getLoadLocation() {
79
+ return loadLocation;
80
+ }
81
+
82
+ public Location getUnloadLocation() {
83
+ return unloadLocation;
84
+ }
85
+
86
+ public LocalDateTime getLoadTime() {
87
+ return this.loadTime;
88
+ }
89
+
90
+ public LocalDateTime getUnloadTime() {
91
+ return this.unloadTime;
92
+ }
93
+
94
+ private boolean sameValueAs(Leg other) {
95
+ return other != null
96
+ && new EqualsBuilder()
97
+ .append(this.voyage, other.voyage)
98
+ .append(this.loadLocation, other.loadLocation)
99
+ .append(this.unloadLocation, other.unloadLocation)
100
+ .append(this.loadTime, other.loadTime)
101
+ .append(this.unloadTime, other.unloadTime)
102
+ .isEquals();
103
+ }
104
+
105
+ @Override
106
+ public boolean equals(Object o) {
107
+ if (this == o) {
108
+ return true;
109
+ }
110
+
111
+ if (o == null || !(o instanceof Leg)) {
112
+ return false;
113
+ }
114
+
115
+ Leg leg = (Leg) o;
116
+
117
+ return sameValueAs(leg);
118
+ }
119
+
120
+ @Override
121
+ public int hashCode() {
122
+ return new HashCodeBuilder()
123
+ .append(voyage)
124
+ .append(loadLocation)
125
+ .append(unloadLocation)
126
+ .append(loadTime)
127
+ .append(unloadTime)
128
+ .toHashCode();
129
+ }
130
+
131
+ @Override
132
+ public String toString() {
133
+ return "Leg{"
134
+ + "id="
135
+ + id
136
+ + ", voyage="
137
+ + voyage
138
+ + ", loadLocation="
139
+ + loadLocation
140
+ + ", unloadLocation="
141
+ + unloadLocation
142
+ + ", loadTime="
143
+ + loadTime
144
+ + ", unloadTime="
145
+ + unloadTime
146
+ + '}';
147
+ }
148
+ }
benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/cargo/RouteSpecification.java ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.eclipse.cargotracker.domain.model.cargo;
2
+
3
+ import java.io.Serializable;
4
+ import java.time.LocalDate;
5
+ import jakarta.persistence.Column;
6
+ import jakarta.persistence.Embeddable;
7
+ import jakarta.persistence.JoinColumn;
8
+ import jakarta.persistence.ManyToOne;
9
+ import jakarta.validation.constraints.NotNull;
10
+ import org.apache.commons.lang3.Validate;
11
+ import org.apache.commons.lang3.builder.EqualsBuilder;
12
+ import org.apache.commons.lang3.builder.HashCodeBuilder;
13
+ import org.eclipse.cargotracker.domain.model.location.Location;
14
+ import org.eclipse.cargotracker.domain.shared.AbstractSpecification;
15
+
16
+ /**
17
+ * Route specification. Describes where a cargo origin and destination is, and the arrival deadline.
18
+ */
19
+ @Embeddable
20
+ public class RouteSpecification extends AbstractSpecification<Itinerary> implements Serializable {
21
+
22
+ private static final long serialVersionUID = 1L;
23
+
24
+ @ManyToOne
25
+ @JoinColumn(name = "spec_origin_id", updatable = false)
26
+ private Location origin;
27
+
28
+ @ManyToOne
29
+ @JoinColumn(name = "spec_destination_id")
30
+ private Location destination;
31
+
32
+ @Column(name = "spec_arrival_deadline")
33
+ @NotNull
34
+ private LocalDate arrivalDeadline;
35
+
36
+ public RouteSpecification() {}
37
+
38
+ /**
39
+ * @param origin origin location - can't be the same as the destination
40
+ * @param destination destination location - can't be the same as the origin
41
+ * @param arrivalDeadline arrival deadline
42
+ */
43
+ public RouteSpecification(Location origin, Location destination, LocalDate arrivalDeadline) {
44
+ Validate.notNull(origin, "Origin is required");
45
+ Validate.notNull(destination, "Destination is required");
46
+ Validate.notNull(arrivalDeadline, "Arrival deadline is required");
47
+ Validate.isTrue(
48
+ !origin.sameIdentityAs(destination), "Origin and destination can't be the same: " + origin);
49
+
50
+ this.origin = origin;
51
+ this.destination = destination;
52
+ this.arrivalDeadline = arrivalDeadline;
53
+ }
54
+
55
+ public Location getOrigin() {
56
+ return origin;
57
+ }
58
+
59
+ public Location getDestination() {
60
+ return destination;
61
+ }
62
+
63
+ public LocalDate getArrivalDeadline() {
64
+ return arrivalDeadline;
65
+ }
66
+
67
+ @Override
68
+ public boolean isSatisfiedBy(Itinerary itinerary) {
69
+ return itinerary != null
70
+ && getOrigin().sameIdentityAs(itinerary.getInitialDepartureLocation())
71
+ && getDestination().sameIdentityAs(itinerary.getFinalArrivalLocation())
72
+ && getArrivalDeadline().isAfter(itinerary.getFinalArrivalDate().toLocalDate());
73
+ }
74
+
75
+ private boolean sameValueAs(RouteSpecification other) {
76
+ return other != null
77
+ && new EqualsBuilder()
78
+ .append(this.origin, other.origin)
79
+ .append(this.destination, other.destination)
80
+ .append(this.arrivalDeadline, other.arrivalDeadline)
81
+ .isEquals();
82
+ }
83
+
84
+ @Override
85
+ public boolean equals(Object o) {
86
+ if (this == o) {
87
+ return true;
88
+ }
89
+
90
+ if (o == null || !(o instanceof RouteSpecification)) {
91
+ return false;
92
+ }
93
+
94
+ RouteSpecification that = (RouteSpecification) o;
95
+
96
+ return sameValueAs(that);
97
+ }
98
+
99
+ @Override
100
+ public int hashCode() {
101
+ return new HashCodeBuilder()
102
+ .append(this.origin)
103
+ .append(this.destination)
104
+ .append(this.arrivalDeadline)
105
+ .toHashCode();
106
+ }
107
+ }
benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/cargo/RoutingStatus.java ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ package org.eclipse.cargotracker.domain.model.cargo;
2
+
3
+ public enum RoutingStatus {
4
+ NOT_ROUTED, ROUTED, MISROUTED;
5
+
6
+ public boolean sameValueAs(RoutingStatus other) {
7
+ return this.equals(other);
8
+ }
9
+ }
benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/cargo/TrackingId.java ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.eclipse.cargotracker.domain.model.cargo;
2
+
3
+ import java.io.Serializable;
4
+ import java.util.Objects;
5
+ import com.fasterxml.jackson.annotation.JsonGetter;
6
+ import com.fasterxml.jackson.annotation.JsonProperty;
7
+ import jakarta.persistence.Column;
8
+ import jakarta.persistence.Embeddable;
9
+ import jakarta.validation.constraints.NotEmpty;
10
+
11
+ /** Uniquely identifies a particular cargo. Automatically generated by the application. */
12
+ @Embeddable
13
+ public class TrackingId implements Serializable {
14
+
15
+ private static final long serialVersionUID = 1L;
16
+
17
+ @Column(name = "tracking_id", unique = true, updatable = false)
18
+ @NotEmpty(message = "Tracking ID cannot be empty.")
19
+ @JsonProperty("id")
20
+ private String id;
21
+
22
+ public TrackingId() {}
23
+
24
+ public TrackingId(String id) {
25
+ Objects.requireNonNull(id); // replaced depracated method
26
+ this.id = id;
27
+ }
28
+
29
+ @JsonGetter("id")
30
+ public String getIdString() {
31
+ return id;
32
+ }
33
+
34
+ @Override
35
+ public boolean equals(Object o) {
36
+ if (this == o) {
37
+ return true;
38
+ }
39
+
40
+ if (o == null || !(o instanceof TrackingId)) {
41
+ return false;
42
+ }
43
+
44
+ TrackingId other = (TrackingId) o;
45
+
46
+ return sameValueAs(other);
47
+ }
48
+
49
+ @Override
50
+ public int hashCode() {
51
+ return id.hashCode();
52
+ }
53
+
54
+ boolean sameValueAs(TrackingId other) {
55
+ return other != null && this.id.equals(other.id);
56
+ }
57
+
58
+ @Override
59
+ public String toString() {
60
+ return id;
61
+ }
62
+ }
benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/cargo/TransportStatus.java ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ package org.eclipse.cargotracker.domain.model.cargo;
2
+
3
+ public enum TransportStatus {
4
+ NOT_RECEIVED, IN_PORT, ONBOARD_CARRIER, CLAIMED, UNKNOWN;
5
+
6
+ public boolean sameValueAs(TransportStatus other) {
7
+ return this.equals(other);
8
+ }
9
+ }
benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/handling/CannotCreateHandlingEventException.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.eclipse.cargotracker.domain.model.handling;
2
+
3
+ /**
4
+ * If a {@link HandlingEvent} can't be created from a given set of parameters.
5
+ *
6
+ * <p>
7
+ * It is a checked exception because it's not a programming error, but rather a special case that
8
+ * the application is built to handle. It can occur during normal program execution.
9
+ */
10
+ public class CannotCreateHandlingEventException extends Exception {
11
+
12
+ private static final long serialVersionUID = 1L;
13
+
14
+ public CannotCreateHandlingEventException(Exception e) {
15
+ super(e);
16
+ }
17
+
18
+ public CannotCreateHandlingEventException() {
19
+ super();
20
+ }
21
+ }
benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/handling/HandlingEvent.java ADDED
@@ -0,0 +1,312 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.eclipse.cargotracker.domain.model.handling;
2
+
3
+ import java.io.Serializable;
4
+ import java.time.LocalDateTime;
5
+ import java.time.temporal.ChronoUnit;
6
+ import jakarta.persistence.Column;
7
+ import jakarta.persistence.Entity;
8
+ import jakarta.persistence.EnumType;
9
+ import jakarta.persistence.Enumerated;
10
+ import jakarta.persistence.GeneratedValue;
11
+ import jakarta.persistence.Id;
12
+ import jakarta.persistence.JoinColumn;
13
+ import jakarta.persistence.ManyToOne;
14
+ import jakarta.persistence.NamedQuery;
15
+ import jakarta.persistence.Transient;
16
+ import jakarta.validation.constraints.NotNull;
17
+ import org.apache.commons.lang3.Validate;
18
+ import org.apache.commons.lang3.builder.EqualsBuilder;
19
+ import org.apache.commons.lang3.builder.HashCodeBuilder;
20
+ import org.eclipse.cargotracker.domain.model.cargo.Cargo;
21
+ import org.eclipse.cargotracker.domain.model.cargo.TrackingId;
22
+ import org.eclipse.cargotracker.domain.model.location.Location;
23
+ import org.eclipse.cargotracker.domain.model.voyage.Voyage;
24
+ import org.eclipse.cargotracker.domain.shared.DomainObjectUtils;
25
+
26
+ /**
27
+ * A HandlingEvent is used to register the event when, for instance, a cargo is unloaded from a
28
+ * carrier at a some location at a given time.
29
+ *
30
+ * <p>
31
+ * The HandlingEvent's are sent from different Incident Logging Applications some time after the
32
+ * event occurred and contain information about the null {@link TrackingId}, {@link Location}, time
33
+ * stamp of the completion of the event, and possibly, if applicable a {@link Voyage}.
34
+ *
35
+ * <p>
36
+ * This class is the only member, and consequently the root, of the HandlingEvent aggregate.
37
+ *
38
+ * <p>
39
+ * HandlingEvent's could contain information about a {@link Voyage} and if so, the event type must
40
+ * be either {@link Type#LOAD} or {@link Type#UNLOAD}.
41
+ *
42
+ * <p>
43
+ * All other events must be of {@link Type#RECEIVE}, {@link Type#CLAIM} or {@link Type#CUSTOMS}.
44
+ */
45
+ @Entity
46
+ @NamedQuery(
47
+ name = "HandlingEvent.findByTrackingId",
48
+ query = "Select e from HandlingEvent e where e.cargo.trackingId = :trackingId")
49
+ public class HandlingEvent implements Serializable {
50
+
51
+ private static final long serialVersionUID = 1L;
52
+
53
+ @Id
54
+ @GeneratedValue
55
+ private Long id;
56
+
57
+ @Enumerated(EnumType.STRING)
58
+ @NotNull
59
+ private Type type;
60
+
61
+ @ManyToOne
62
+ @JoinColumn(name = "voyage_id")
63
+ private Voyage voyage;
64
+
65
+ @ManyToOne
66
+ @JoinColumn(name = "location_id")
67
+ @NotNull
68
+ private Location location;
69
+
70
+ @NotNull
71
+ @Column(name = "completionTime")
72
+ private LocalDateTime completionTime;
73
+
74
+ @NotNull
75
+ @Column(name = "registration")
76
+ private LocalDateTime registrationTime;
77
+
78
+ @ManyToOne
79
+ @JoinColumn(name = "cargo_id")
80
+ @NotNull
81
+ private Cargo cargo;
82
+
83
+ @Transient
84
+ private String summary;
85
+
86
+ public HandlingEvent() {
87
+ // Nothing to initialize.
88
+ }
89
+
90
+ /**
91
+ * @param cargo The cargo
92
+ * @param completionTime completion time, the reported time that the event actually happened (e.g.
93
+ * the receive took place).
94
+ * @param registrationTime registration time, the time the message is received
95
+ * @param type type of event
96
+ * @param location where the event took place
97
+ * @param voyage the voyage
98
+ */
99
+ public HandlingEvent(
100
+ Cargo cargo,
101
+ LocalDateTime completionTime,
102
+ LocalDateTime registrationTime,
103
+ Type type,
104
+ Location location,
105
+ Voyage voyage) {
106
+ Validate.notNull(cargo, "Cargo is required");
107
+ Validate.notNull(completionTime, "Completion time is required");
108
+ Validate.notNull(registrationTime, "Registration time is required");
109
+ Validate.notNull(type, "Handling event type is required");
110
+ Validate.notNull(location, "Location is required");
111
+ Validate.notNull(voyage, "Voyage is required");
112
+
113
+ if (type.prohibitsVoyage()) {
114
+ throw new IllegalArgumentException("Voyage is not allowed with event type " + type);
115
+ }
116
+
117
+ this.voyage = voyage;
118
+
119
+ // This is a workaround to a Hibernate issue. when the `LocalDateTime` field is persisted into
120
+ // the DB, and retrieved from the DB, the values are different by nanoseconds.
121
+ this.completionTime = completionTime.truncatedTo(ChronoUnit.SECONDS);
122
+ this.registrationTime = registrationTime.truncatedTo(ChronoUnit.SECONDS);
123
+ this.type = type;
124
+ this.location = location;
125
+ this.cargo = cargo;
126
+ }
127
+
128
+ /**
129
+ * @param cargo cargo
130
+ * @param completionTime completion time, the reported time that the event actually happened (e.g.
131
+ * the receive took place).
132
+ * @param registrationTime registration time, the time the message is received
133
+ * @param type type of event
134
+ * @param location where the event took place
135
+ */
136
+ public HandlingEvent(
137
+ Cargo cargo,
138
+ LocalDateTime completionTime,
139
+ LocalDateTime registrationTime,
140
+ Type type,
141
+ Location location) {
142
+ Validate.notNull(cargo, "Cargo is required");
143
+ Validate.notNull(completionTime, "Completion time is required");
144
+ Validate.notNull(registrationTime, "Registration time is required");
145
+ Validate.notNull(type, "Handling event type is required");
146
+ Validate.notNull(location, "Location is required");
147
+
148
+ if (type.requiresVoyage()) {
149
+ throw new IllegalArgumentException("Voyage is required for event type " + type);
150
+ }
151
+
152
+ // This is a workaround to a Hibernate issue. when the `LocalDateTime` field is persisted into
153
+ // the DB, and retrieved from the DB, the values are different by nanoseconds.
154
+ this.completionTime = completionTime.truncatedTo(ChronoUnit.SECONDS);
155
+ this.registrationTime = registrationTime.truncatedTo(ChronoUnit.SECONDS);
156
+ this.type = type;
157
+ this.location = location;
158
+ this.cargo = cargo;
159
+ this.voyage = null;
160
+ }
161
+
162
+ public Type getType() {
163
+ return this.type;
164
+ }
165
+
166
+ public Voyage getVoyage() {
167
+ return DomainObjectUtils.nullSafe(this.voyage, Voyage.NONE);
168
+ }
169
+
170
+ public LocalDateTime getCompletionTime() {
171
+ return completionTime;
172
+ }
173
+
174
+ public LocalDateTime getRegistrationTime() {
175
+ return registrationTime;
176
+ }
177
+
178
+ public Location getLocation() {
179
+ return this.location;
180
+ }
181
+
182
+ public Cargo getCargo() {
183
+ return this.cargo;
184
+ }
185
+
186
+ public String getSummary() {
187
+ StringBuilder builder =
188
+ new StringBuilder(location.getName())
189
+ .append("\n")
190
+ .append(completionTime)
191
+ .append("\n")
192
+ .append("Type: ")
193
+ .append(type)
194
+ .append("\n")
195
+ .append("Reg.: ")
196
+ .append(registrationTime)
197
+ .append("\n");
198
+
199
+ if (voyage != null) {
200
+ builder.append("Voyage: ").append(voyage.getVoyageNumber());
201
+ }
202
+
203
+ return builder.toString();
204
+ }
205
+
206
+ @Override
207
+ public boolean equals(Object o) {
208
+ if (this == o) {
209
+ return true;
210
+ }
211
+
212
+ if (o == null || !(o instanceof HandlingEvent)) {
213
+ return false;
214
+ }
215
+
216
+ HandlingEvent event = (HandlingEvent) o;
217
+
218
+ return sameEventAs(event);
219
+ }
220
+
221
+ private boolean sameEventAs(HandlingEvent other) {
222
+ return other != null
223
+ && new EqualsBuilder()
224
+ .append(this.cargo, other.cargo)
225
+ .append(this.voyage, other.voyage)
226
+ .append(this.completionTime, other.completionTime)
227
+ .append(this.location, other.location)
228
+ .append(this.type, other.type)
229
+ .isEquals();
230
+ }
231
+
232
+ @Override
233
+ public int hashCode() {
234
+ return new HashCodeBuilder()
235
+ .append(cargo)
236
+ .append(voyage)
237
+ .append(completionTime)
238
+ .append(location)
239
+ .append(type)
240
+ .toHashCode();
241
+ }
242
+
243
+ @Override
244
+ public String toString() {
245
+ StringBuilder builder =
246
+ new StringBuilder("\n--- Handling event ---\n")
247
+ .append("Cargo: ")
248
+ .append(cargo.getTrackingId())
249
+ .append("\n")
250
+ .append("Type: ")
251
+ .append(type)
252
+ .append("\n")
253
+ .append("Location: ")
254
+ .append(location.getName())
255
+ .append("\n")
256
+ .append("Completed on: ")
257
+ .append(completionTime)
258
+ .append("\n")
259
+ .append("Registered on: ")
260
+ .append(registrationTime)
261
+ .append("\n");
262
+
263
+ if (voyage != null) {
264
+ builder.append("Voyage: ").append(voyage.getVoyageNumber()).append("\n");
265
+ }
266
+
267
+ return builder.toString();
268
+ }
269
+
270
+ /**
271
+ * Handling event type. Either requires or prohibits a carrier movement association, it's never
272
+ * optional.
273
+ */
274
+ public enum Type {
275
+
276
+ // Loaded onto voyage from port location.
277
+ LOAD(true),
278
+ // Unloaded from voyage to port location
279
+ UNLOAD(true),
280
+ // Received by carrier
281
+ RECEIVE(false),
282
+ // Cargo claimed by recepient
283
+ CLAIM(false),
284
+ // Cargo went through customs
285
+ CUSTOMS(false);
286
+
287
+ private final boolean voyageRequired;
288
+
289
+ /**
290
+ * Private enum constructor.
291
+ *
292
+ * @param voyageRequired whether or not a voyage is associated with this event type
293
+ */
294
+ private Type(boolean voyageRequired) {
295
+ this.voyageRequired = voyageRequired;
296
+ }
297
+
298
+ /** @return True if a voyage association is required for this event type. */
299
+ public boolean requiresVoyage() {
300
+ return voyageRequired;
301
+ }
302
+
303
+ /** @return True if a voyage association is prohibited for this event type. */
304
+ public boolean prohibitsVoyage() {
305
+ return !requiresVoyage();
306
+ }
307
+
308
+ public boolean sameValueAs(Type other) {
309
+ return other != null && this.equals(other);
310
+ }
311
+ }
312
+ }
benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/handling/HandlingEventFactory.java ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.eclipse.cargotracker.domain.model.handling;
2
+
3
+ import java.io.Serializable;
4
+ import java.time.LocalDateTime;
5
+ import org.eclipse.cargotracker.domain.model.cargo.Cargo;
6
+ import org.eclipse.cargotracker.domain.model.cargo.TrackingId;
7
+ import org.eclipse.cargotracker.domain.model.location.Location;
8
+ import org.eclipse.cargotracker.domain.model.location.UnLocode;
9
+ import org.eclipse.cargotracker.domain.model.voyage.Voyage;
10
+ import org.eclipse.cargotracker.domain.model.voyage.VoyageNumber;
11
+ import org.eclipse.cargotracker.infrastructure.persistence.jpa.JpaCargoRepository;
12
+ import org.eclipse.cargotracker.infrastructure.persistence.jpa.JpaLocationRepository;
13
+ import org.eclipse.cargotracker.infrastructure.persistence.jpa.JpaVoyageRepository;
14
+ import org.springframework.stereotype.Component;
15
+
16
+ @Component
17
+ public class HandlingEventFactory implements Serializable {
18
+
19
+ private static final long serialVersionUID = 1L;
20
+
21
+ private JpaCargoRepository cargoRepository;
22
+ private JpaVoyageRepository voyageRepository;
23
+ private JpaLocationRepository locationRepository;
24
+
25
+
26
+ public HandlingEventFactory(
27
+ JpaCargoRepository cargoRepository,
28
+ JpaVoyageRepository voyageRepository,
29
+ JpaLocationRepository locationRepository) {
30
+ this.cargoRepository = cargoRepository;
31
+ this.voyageRepository = voyageRepository;
32
+ this.locationRepository = locationRepository;
33
+ }
34
+
35
+ /**
36
+ * @param registrationTime time when this event was received by the system
37
+ * @param completionTime when the event was completed, for example finished loading
38
+ * @param trackingId cargo tracking id
39
+ * @param voyageNumber voyage number
40
+ * @param unlocode United Nations Location Code for the location of the event
41
+ * @param type type of event
42
+ * @return A handling event.
43
+ * @throws UnknownVoyageException if there's no voyage with this number
44
+ * @throws UnknownCargoException if there's no cargo with this tracking id
45
+ * @throws UnknownLocationException if there's no location with this UN Locode
46
+ */
47
+ // TODO [Clean Code] Look at the exception handling more seriously.
48
+ public HandlingEvent createHandlingEvent(
49
+ LocalDateTime registrationTime,
50
+ LocalDateTime completionTime,
51
+ TrackingId trackingId,
52
+ VoyageNumber voyageNumber,
53
+ UnLocode unlocode,
54
+ HandlingEvent.Type type)
55
+ throws CannotCreateHandlingEventException {
56
+ Cargo cargo = findCargo(trackingId);
57
+ Voyage voyage = findVoyage(voyageNumber);
58
+ Location location = findLocation(unlocode);
59
+
60
+ try {
61
+ if (voyage == null) {
62
+ return new HandlingEvent(cargo, completionTime, registrationTime, type, location);
63
+ } else {
64
+ return new HandlingEvent(cargo, completionTime, registrationTime, type, location, voyage);
65
+ }
66
+ } catch (Exception e) {
67
+ throw new CannotCreateHandlingEventException(e);
68
+ }
69
+ }
70
+
71
+ private Cargo findCargo(TrackingId trackingId) throws UnknownCargoException {
72
+ Cargo cargo = cargoRepository.findByTrackingId(trackingId)
73
+ .orElseThrow(() -> new UnknownCargoException(trackingId));
74
+
75
+ return cargo;
76
+ }
77
+
78
+ private Voyage findVoyage(VoyageNumber voyageNumber) throws UnknownVoyageException {
79
+ if (voyageNumber == null) {
80
+ return null;
81
+ }
82
+
83
+ Voyage voyage = voyageRepository.findByVoyageNumber(voyageNumber);
84
+
85
+ if (voyage == null) {
86
+ throw new UnknownVoyageException(voyageNumber);
87
+ }
88
+
89
+ return voyage;
90
+ }
91
+
92
+ private Location findLocation(UnLocode unlocode) throws UnknownLocationException {
93
+ Location location = locationRepository.findByUnLocode(unlocode);
94
+
95
+ if (location == null) {
96
+ throw new UnknownLocationException(unlocode);
97
+ }
98
+
99
+ return location;
100
+ }
101
+ }
benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/handling/HandlingHistory.java ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.eclipse.cargotracker.domain.model.handling;
2
+
3
+ import java.util.ArrayList;
4
+ import java.util.Collection;
5
+ import java.util.Collections;
6
+ import java.util.Comparator;
7
+ import java.util.HashSet;
8
+ import java.util.List;
9
+ import org.apache.commons.lang3.Validate;
10
+
11
+ public class HandlingHistory {
12
+
13
+ // Null object pattern.
14
+ public static final HandlingHistory EMPTY =
15
+ new HandlingHistory(Collections.<HandlingEvent>emptyList());
16
+ private static final Comparator<HandlingEvent> BY_COMPLETION_TIME_COMPARATOR =
17
+ Comparator.comparing(HandlingEvent::getCompletionTime);
18
+
19
+ private final List<HandlingEvent> handlingEvents;
20
+
21
+ public HandlingHistory(Collection<HandlingEvent> handlingEvents) {
22
+ Validate.notNull(handlingEvents, "Handling events are required.");
23
+
24
+ this.handlingEvents = new ArrayList<>(handlingEvents);
25
+ }
26
+
27
+ public List<HandlingEvent> getAllHandlingEvents() {
28
+ return handlingEvents;
29
+ }
30
+
31
+ /**
32
+ * @return A distinct list (no duplicate registrations) of handling events, ordered by completion
33
+ * time.
34
+ */
35
+ public List<HandlingEvent> getDistinctEventsByCompletionTime() {
36
+ List<HandlingEvent> ordered = new ArrayList<>(new HashSet<>(handlingEvents));
37
+ ordered.sort(BY_COMPLETION_TIME_COMPARATOR);
38
+
39
+ return Collections.unmodifiableList(ordered);
40
+ }
41
+
42
+ /** @return Most recently completed event, or null if the delivery history is empty. */
43
+ public HandlingEvent getMostRecentlyCompletedEvent() {
44
+ List<HandlingEvent> distinctEvents = getDistinctEventsByCompletionTime();
45
+
46
+ if (distinctEvents.isEmpty()) {
47
+ return null;
48
+ } else {
49
+ return distinctEvents.get(distinctEvents.size() - 1);
50
+ }
51
+ }
52
+
53
+ private boolean sameValueAs(HandlingHistory other) {
54
+ return other != null && this.handlingEvents.equals(other.handlingEvents);
55
+ }
56
+
57
+ @Override
58
+ public boolean equals(Object o) {
59
+ if (this == o) {
60
+ return true;
61
+ }
62
+
63
+ if (o == null || !(o instanceof HandlingHistory)) {
64
+ return false;
65
+ }
66
+
67
+ HandlingHistory other = (HandlingHistory) o;
68
+
69
+ return sameValueAs(other);
70
+ }
71
+
72
+ @Override
73
+ public int hashCode() {
74
+ return handlingEvents.hashCode();
75
+ }
76
+ }
benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/handling/UnknownCargoException.java ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.eclipse.cargotracker.domain.model.handling;
2
+
3
+ import org.eclipse.cargotracker.domain.model.cargo.TrackingId;
4
+
5
+ /** Thrown when trying to register an event with an unknown tracking id. */
6
+ public class UnknownCargoException extends CannotCreateHandlingEventException {
7
+
8
+ private static final long serialVersionUID = 1L;
9
+
10
+ private final TrackingId trackingId;
11
+
12
+ /** @param trackingId cargo tracking id */
13
+ public UnknownCargoException(TrackingId trackingId) {
14
+ this.trackingId = trackingId;
15
+ }
16
+
17
+ /** {@inheritDoc} */
18
+ @Override
19
+ public String getMessage() {
20
+ return "No cargo with tracking id " + trackingId.getIdString() + " exists in the system.";
21
+ }
22
+ }
benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/handling/UnknownLocationException.java ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.eclipse.cargotracker.domain.model.handling;
2
+
3
+ import org.eclipse.cargotracker.domain.model.location.UnLocode;
4
+
5
+ public class UnknownLocationException extends CannotCreateHandlingEventException {
6
+
7
+ private static final long serialVersionUID = 1L;
8
+
9
+ private final UnLocode unlocode;
10
+
11
+ public UnknownLocationException(UnLocode unlocode) {
12
+ this.unlocode = unlocode;
13
+ }
14
+
15
+ @Override
16
+ public String getMessage() {
17
+ return "No location with UN locode " + unlocode.getIdString() + " exists in the system.";
18
+ }
19
+ }
benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/handling/UnknownVoyageException.java ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.eclipse.cargotracker.domain.model.handling;
2
+
3
+ import org.eclipse.cargotracker.domain.model.voyage.VoyageNumber;
4
+
5
+ /** Thrown when trying to register an event with an unknown carrier movement id. */
6
+ public class UnknownVoyageException extends CannotCreateHandlingEventException {
7
+
8
+ private static final long serialVersionUID = 1L;
9
+
10
+ private final VoyageNumber voyageNumber;
11
+
12
+ public UnknownVoyageException(VoyageNumber voyageNumber) {
13
+ this.voyageNumber = voyageNumber;
14
+ }
15
+
16
+ @Override
17
+ public String getMessage() {
18
+ return "No voyage with number " + voyageNumber.getIdString() + " exists in the system.";
19
+ }
20
+ }
benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/location/Location.java ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.eclipse.cargotracker.domain.model.location;
2
+
3
+ import java.io.Serializable;
4
+ import java.util.Objects;
5
+ import jakarta.persistence.Embedded;
6
+ import jakarta.persistence.Entity;
7
+ import jakarta.persistence.GeneratedValue;
8
+ import jakarta.persistence.Id;
9
+ import jakarta.validation.constraints.NotEmpty;
10
+ import jakarta.validation.constraints.NotNull;
11
+
12
+ /**
13
+ * A location in our model is stops on a journey, such as cargo origin or destination, or carrier
14
+ * movement end points.
15
+ *
16
+ * <p>
17
+ * It is uniquely identified by a UN location code.
18
+ */
19
+ @Entity
20
+ public class Location implements Serializable {
21
+
22
+ private static final long serialVersionUID = 1L;
23
+
24
+ // Special Location object that marks an unknown location.
25
+ public static final Location UNKNOWN = new Location(new UnLocode("XXXXX"), "Unknown location");
26
+
27
+ @Id
28
+ @GeneratedValue
29
+ private Long id;
30
+ @Embedded
31
+ @NotNull
32
+ private UnLocode unLocode;
33
+ @NotEmpty
34
+ private String name;
35
+
36
+ public Location() {
37
+ // Nothing to do.
38
+ }
39
+
40
+ /**
41
+ * @param unLocode UN Locode
42
+ * @param name Location name
43
+ * @throws IllegalArgumentException if the UN Locode or name is null
44
+ */
45
+ public Location(UnLocode unLocode, String name) {
46
+ Objects.requireNonNull(unLocode);
47
+ Objects.requireNonNull(name);
48
+
49
+ this.unLocode = unLocode;
50
+ this.name = name;
51
+ }
52
+
53
+ /** @return UN location code for this location. */
54
+ public UnLocode getUnLocode() {
55
+ return unLocode;
56
+ }
57
+
58
+ /** @return Actual name of this location, e.g. "Stockholm". */
59
+ public String getName() {
60
+ return name;
61
+ }
62
+
63
+ /**
64
+ * @param object to compare
65
+ * @return Since this is an entiy this will be true iff UN locodes are equal.
66
+ */
67
+ @Override
68
+ public boolean equals(Object object) {
69
+ if (object == null) {
70
+ return false;
71
+ }
72
+
73
+ if (this == object) {
74
+ return true;
75
+ }
76
+
77
+ if (!(object instanceof Location)) {
78
+ return false;
79
+ }
80
+
81
+ Location other = (Location) object;
82
+
83
+ return sameIdentityAs(other);
84
+ }
85
+
86
+ public boolean sameIdentityAs(Location other) {
87
+ return this.unLocode.sameValueAs(other.unLocode);
88
+ }
89
+
90
+ /** @return Hash code of UN locode. */
91
+ @Override
92
+ public int hashCode() {
93
+ return unLocode.hashCode();
94
+ }
95
+
96
+ @Override
97
+ public String toString() {
98
+ return name + " [" + unLocode + "]";
99
+ }
100
+ }
benchmark/whole_applications/cargotracker/spring/src/main/java/org/eclipse/cargotracker/domain/model/location/SampleLocations.java ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.eclipse.cargotracker.domain.model.location;
2
+
3
+ /** Sample locations, for test purposes. */
4
+ public class SampleLocations {
5
+
6
+ public static final Location HONGKONG = new Location(new UnLocode("CNHKG"), "Hong Kong");
7
+ public static final Location MELBOURNE = new Location(new UnLocode("AUMEL"), "Melbourne");
8
+ public static final Location STOCKHOLM = new Location(new UnLocode("SESTO"), "Stockholm");
9
+ public static final Location HELSINKI = new Location(new UnLocode("FIHEL"), "Helsinki");
10
+ public static final Location CHICAGO = new Location(new UnLocode("USCHI"), "Chicago");
11
+ public static final Location TOKYO = new Location(new UnLocode("JNTKO"), "Tokyo");
12
+ public static final Location HAMBURG = new Location(new UnLocode("DEHAM"), "Hamburg");
13
+ public static final Location SHANGHAI = new Location(new UnLocode("CNSHA"), "Shanghai");
14
+ public static final Location ROTTERDAM = new Location(new UnLocode("NLRTM"), "Rotterdam");
15
+ public static final Location GOTHENBURG = new Location(new UnLocode("SEGOT"), "Gothenburg");
16
+ public static final Location HANGZOU = new Location(new UnLocode("CNHGH"), "Hangzhou");
17
+ public static final Location NEWYORK = new Location(new UnLocode("USNYC"), "New York");
18
+ public static final Location DALLAS = new Location(new UnLocode("USDAL"), "Dallas");
19
+ }