scarfbench-dataset

#1
by brmcg - opened
This view is limited to 50 files because it contains too many changes. See the raw diff here.
Files changed (50) hide show
  1. .gitignore +94 -0
  2. CONTRIBUTING.md +1098 -0
  3. README.md +250 -1
  4. benchmark/business_domain/cart/jakarta/.dockerignore +41 -0
  5. benchmark/business_domain/cart/jakarta/.mvn/wrapper/MavenWrapperDownloader.java +117 -0
  6. benchmark/business_domain/cart/jakarta/.mvn/wrapper/maven-wrapper.properties +2 -0
  7. benchmark/business_domain/cart/jakarta/Dockerfile +36 -0
  8. benchmark/business_domain/cart/jakarta/cart-ejb/pom.xml +36 -0
  9. benchmark/business_domain/cart/jakarta/cart-ejb/src/main/java/jakarta/tutorial/cart/ejb/Cart.java +36 -0
  10. benchmark/business_domain/cart/jakarta/cart-ejb/src/main/java/jakarta/tutorial/cart/ejb/CartBean.java +82 -0
  11. benchmark/business_domain/cart/jakarta/cart-ejb/src/main/java/jakarta/tutorial/cart/util/BookException.java +22 -0
  12. benchmark/business_domain/cart/jakarta/cart-ejb/src/main/java/jakarta/tutorial/cart/util/IdVerifier.java +29 -0
  13. benchmark/business_domain/cart/jakarta/cart-ejb/src/main/resources/META-INF/MANIFEST.MF +2 -0
  14. benchmark/business_domain/cart/jakarta/cart-web/pom.xml +82 -0
  15. benchmark/business_domain/cart/jakarta/cart-web/src/main/java/jakarta/tutorial/cart/web/CartResource.java +173 -0
  16. benchmark/business_domain/cart/jakarta/cart-web/src/main/java/jakarta/tutorial/cart/web/RestApplication.java +25 -0
  17. benchmark/business_domain/cart/jakarta/cart-web/src/main/liberty/config/server.xml +46 -0
  18. benchmark/business_domain/cart/jakarta/cart-web/src/main/webapp/WEB-INF/beans.xml +7 -0
  19. benchmark/business_domain/cart/jakarta/mvnw +310 -0
  20. benchmark/business_domain/cart/jakarta/mvnw.cmd +182 -0
  21. benchmark/business_domain/cart/jakarta/pom.xml +112 -0
  22. benchmark/business_domain/cart/jakarta/test.sh +15 -0
  23. benchmark/business_domain/cart/quarkus/.dockerignore +41 -0
  24. benchmark/business_domain/cart/quarkus/.mvn/wrapper/MavenWrapperDownloader.java +117 -0
  25. benchmark/business_domain/cart/quarkus/.mvn/wrapper/maven-wrapper.properties +2 -0
  26. benchmark/business_domain/cart/quarkus/Dockerfile +36 -0
  27. benchmark/business_domain/cart/quarkus/cart-ejb/pom.xml +45 -0
  28. benchmark/business_domain/cart/quarkus/cart-ejb/src/main/java/quarkus/tutorial/cart/service/Cart.java +20 -0
  29. benchmark/business_domain/cart/quarkus/cart-ejb/src/main/java/quarkus/tutorial/cart/service/CartBean.java +70 -0
  30. benchmark/business_domain/cart/quarkus/cart-ejb/src/main/java/quarkus/tutorial/cart/util/BookException.java +11 -0
  31. benchmark/business_domain/cart/quarkus/cart-ejb/src/main/java/quarkus/tutorial/cart/util/IdVerifier.java +17 -0
  32. benchmark/business_domain/cart/quarkus/cart-web/pom.xml +77 -0
  33. benchmark/business_domain/cart/quarkus/cart-web/src/main/docker/Dockerfile.jvm +98 -0
  34. benchmark/business_domain/cart/quarkus/cart-web/src/main/docker/Dockerfile.legacy-jar +94 -0
  35. benchmark/business_domain/cart/quarkus/cart-web/src/main/docker/Dockerfile.native +29 -0
  36. benchmark/business_domain/cart/quarkus/cart-web/src/main/docker/Dockerfile.native-micro +32 -0
  37. benchmark/business_domain/cart/quarkus/cart-web/src/main/java/quarkus/tutorial/cart/CartResource.java +174 -0
  38. benchmark/business_domain/cart/quarkus/cart-web/src/main/resources/application.properties +1 -0
  39. benchmark/business_domain/cart/quarkus/mvnw +332 -0
  40. benchmark/business_domain/cart/quarkus/mvnw.cmd +206 -0
  41. benchmark/business_domain/cart/quarkus/pom.xml +102 -0
  42. benchmark/business_domain/cart/quarkus/test.sh +15 -0
  43. benchmark/business_domain/cart/spring/.dockerignore +41 -0
  44. benchmark/business_domain/cart/spring/.mvn/wrapper/maven-wrapper.properties +3 -0
  45. benchmark/business_domain/cart/spring/Dockerfile +36 -0
  46. benchmark/business_domain/cart/spring/cart-ejb/pom.xml +29 -0
  47. benchmark/business_domain/cart/spring/cart-ejb/src/main/java/spring/examples/tutorial/cart/service/Cart.java +21 -0
  48. benchmark/business_domain/cart/spring/cart-ejb/src/main/java/spring/examples/tutorial/cart/service/CartServiceImpl.java +68 -0
  49. benchmark/business_domain/cart/spring/cart-ejb/src/main/java/spring/examples/tutorial/cart/util/BookException.java +11 -0
  50. benchmark/business_domain/cart/spring/cart-ejb/src/main/java/spring/examples/tutorial/cart/util/IdVerifier.java +17 -0
.gitignore ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Build output
2
+ dist/
3
+ site/site/
4
+ *.pyc
5
+ __pycache__/
6
+ *.py[cod]
7
+ *$py.class
8
+
9
+ # Virtual environment
10
+ venv/
11
+ env/
12
+ ENV/
13
+ .venv/
14
+
15
+ # IDE
16
+ .vscode/
17
+ .idea/
18
+ *.swp
19
+ *.swo
20
+ *~
21
+
22
+ # OS
23
+ .DS_Store
24
+ Thumbs.db
25
+
26
+ # Logs
27
+ *.log
28
+
29
+ # Java
30
+ *.class
31
+ *.jar
32
+ *.war
33
+ *.ear
34
+ *.nar
35
+ hs_err_pid*
36
+ replay_pid*
37
+
38
+ # Java IDE / tooling
39
+ .classpath
40
+ .project
41
+ .settings/
42
+ .factorypath
43
+
44
+ # Maven
45
+ **/target/
46
+ dependency-reduced-pom.xml
47
+ pom.xml.tag
48
+ pom.xml.releaseBackup
49
+ pom.xml.versionsBackup
50
+ pom.xml.next
51
+ release.properties
52
+
53
+ # Gradle
54
+ **/.gradle/
55
+ **/build/
56
+ gradle-app.setting
57
+
58
+ # Docker
59
+ *.tar
60
+ *.tar.gz
61
+ docker-compose.override.yml
62
+ .env
63
+ .env.*
64
+ !.env.example
65
+
66
+ # HTML / static build artifacts
67
+ **/.sass-cache/
68
+ **/.cache/
69
+
70
+ # Python
71
+ .pytest_cache/
72
+ .mypy_cache/
73
+ .ruff_cache/
74
+ .coverage
75
+ coverage.xml
76
+ htmlcov/
77
+ **/*.egg-info/
78
+ .tox/
79
+ .nox/
80
+ pip-wheel-metadata/
81
+ **/__pypackages__/
82
+ **/.ipynb_checkpoints/
83
+
84
+ # MkDocs
85
+ .mkdocs_cache/
86
+
87
+ # VS Code
88
+ .vscode/
89
+
90
+ # Binaries
91
+ *.png
92
+ *.jpg
93
+ *.dat
94
+ *.pdf
CONTRIBUTING.md ADDED
@@ -0,0 +1,1098 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contributing to SCARFBench
2
+
3
+ This guide explains how to contribute a new application to the SCARFBench benchmark suite.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Getting Started](#getting-started)
8
+ - [Contribution Workflow](#contribution-workflow)
9
+ - [Overview](#overview)
10
+ - [Required Files](#required-files)
11
+ - [1. Dockerfile](#1-dockerfile)
12
+ - [2. Makefile](#2-Makefile)
13
+ - [3. Smoke Test (smoke.py)](#3-smoke-test-smokepy)
14
+ - [Standard Patterns](#standard-patterns)
15
+ - [Checklist](#checklist)
16
+
17
+ ## Getting Started
18
+
19
+ ### Prerequisites
20
+
21
+ Before contributing, ensure you have:
22
+ - **Git** installed
23
+ - **Docker** installed and running
24
+ - **make**Makefile build tool
25
+ - Basic familiarity with the three frameworks (Jakarta EE, Quarkus, Spring Boot)
26
+
27
+ ### Forking the Repository
28
+
29
+ 1. **Fork** the repository on GitHub by clicking the "Fork" button at the top right of the repository page
30
+ 2. **Clone** your fork locally:
31
+ ```bash
32
+ git clone https://github.com/<your-username>/scarfbench.git
33
+ cd scarfbench
34
+ ```
35
+ 3. **Add upstream** remote to keep your fork synchronized:
36
+ ```bash
37
+ git remote add upstream https://github.com/original-repo/scarfbench.git
38
+ ```
39
+ 4. **Create a branch** for your contribution:
40
+ ```bash
41
+ git checkout -b add-<application-name>
42
+ ```
43
+
44
+ ## Contribution Workflow
45
+
46
+ Follow these steps to contribute a new benchmark application:
47
+
48
+ ### 1. Choose Application Category
49
+
50
+ Determine which category your application belongs to:
51
+ - `business_domain/` - Core business logic patterns
52
+ - `dependency_injection/` - DI and configuration patterns
53
+ - `infrastructure/` - Infrastructure services (concurrency, messaging, etc.)
54
+ - `integration/` - External system integration (batch, messaging, web services)
55
+ - `persistence/` - Database and persistence patterns
56
+ - `presentation/` - Web UI and REST API patterns
57
+ - `security/` - Authentication and authorization patterns
58
+ - `whole_applications/` - Complete, production-like applications
59
+
60
+ ### 2. Create Directory Structure
61
+
62
+ Create your application directory under the appropriate category:
63
+ ```bash
64
+ mkdir -p benchmark/<category>/<your-app-name>/{jakarta,quarkus,spring}
65
+ ```
66
+
67
+ ### 3. Implement Framework Variants
68
+
69
+ For each framework (Jakarta, Quarkus, Spring):
70
+ 1. Implement the application using framework-specific patterns
71
+ 2. Create `Dockerfile` (see [Dockerfile section](#1-dockerfile))
72
+ 3. Create `Makefile` (see [Makefile section](#2-Makefile))
73
+ 4. Create smoke tests - either `smoke.py` or `smoke/` folder (see [Smoke Test section](#3-smoke-test-smokepy))
74
+
75
+ ### 4. Verify All Implementations
76
+
77
+ For each framework, run the complete test sequence:
78
+ ```bash
79
+ cd benchmark/<category>/<your-app-name>/<framework>
80
+ just build # Build Docker image
81
+ just up # Start container
82
+ just test # Run smoke tests (should PASS)
83
+ just logs # Verify application logs
84
+ just down # Clean up
85
+ ```
86
+
87
+ Repeat for all three frameworks: `jakarta`, `quarkus`, and `spring`.
88
+
89
+ ### 5. Document Your Application
90
+
91
+ Create a `README.md` in your application directory:
92
+ ```bash
93
+ benchmark/<category>/<your-app-name>/README.md
94
+ ```
95
+
96
+ Include:
97
+ - **Purpose**: What the application demonstrates
98
+ - **Key Features**: Technologies and patterns showcased
99
+ - **Framework Implementations**: Brief notes on each variant
100
+ - **Testing**: What the smoke tests validate
101
+
102
+ ### 6. Submit Pull Request
103
+
104
+ Once all implementations are working:
105
+
106
+ 1. **Commit your changes**:
107
+ ```bash
108
+ git add benchmark/<category>/<your-app-name>
109
+ git commit -m "Add <application-name> benchmark for <category>"
110
+ ```
111
+
112
+ 2. **Push to your fork**:
113
+ ```bash
114
+ git push origin add-<application-name>
115
+ ```
116
+
117
+ 3. **Create Pull Request** on GitHub:
118
+ - Go to your fork on GitHub
119
+ - Click "New Pull Request"
120
+ - Fill out the PR template (automatically populated)
121
+ - Ensure all checklist items are completed
122
+ - Submit for review
123
+
124
+ 4. **Respond to feedback**: Maintainers may request changes or improvements
125
+
126
+ ### 7. Keep Your Fork Updated
127
+
128
+ Sync with upstream before starting new contributions:
129
+ ```bash
130
+ git fetch upstream
131
+ git checkout main
132
+ git merge upstream/main
133
+ git push origin main
134
+ ```
135
+
136
+ ## Overview
137
+
138
+ Each benchmark application in SCARFBench should support three frameworks:
139
+ - **Jakarta EE** (using Open Liberty)
140
+ - **Quarkus**
141
+ - **Spring Boot**
142
+
143
+ In addition to the source application files, each framework implementation requires three standard files:
144
+ 1. `Dockerfile` - Container definition
145
+ 2. `Makefile` - Build and run automation
146
+ 3. `smoke.py` - Automated smoke tests
147
+
148
+ **Note on Technology Choices**: This guide demonstrates examples using **Python**, **uv**, and **Playwright** for smoke tests. However, these are not strict requirements. You are free to implement smoke tests in any language (Shell, JavaScript, Go, Java, etc.) as long as your Dockerfile and Makefile's `test` target work correctly. See [Alternative Smoke Test Implementations](#alternative-smoke-test-implementations) for examples in other languages.
149
+
150
+ This guide uses the following applications as reference standards:
151
+
152
+ 1. [`benchmark/infrastructure/concurrency-jobs`](benchmark/infrastructure/concurrency-jobs) for basic REST/HTTP applications
153
+ 2. [`benchmark/infrastructure/ejb-async`](benchmark/infrastructure/ejb-async) for applications requiring browser automation and UI testing
154
+ 3. [`benchmark/whole_applications/daytrader`](benchmark/whole_applications/daytrader) for complex, multi-framework applications with extensive smoke tests
155
+
156
+ ## Required Files
157
+
158
+ ### 1. Dockerfile
159
+
160
+ The Dockerfile creates a containerized environment for building and running your application.
161
+
162
+ #### Standard Structure (Basic Pattern)
163
+
164
+ For applications with simple REST/HTTP API testing:
165
+
166
+ ```dockerfile
167
+ FROM maven:3.9-eclipse-temurin-21
168
+
169
+ USER root
170
+ RUN apt-get update && apt-get install -y python3 curl && rm -rf /var/lib/apt/lists/*
171
+
172
+ WORKDIR /app
173
+
174
+ # Copy all project files
175
+ COPY pom.xml .
176
+ COPY src src
177
+ COPY smoke.py .
178
+
179
+ # Default command matches your local workflow
180
+ # Framework-specific goal to be replaced accordingly
181
+ # | Framework | Maven Goal |
182
+ # |-----------------------|-------------------------------|
183
+ # | Jakarta/OpenLiberty | liberty:run |
184
+ # | Quarkus | quarkus:dev |
185
+ # | Spring | spring-boot:run |
186
+ CMD ["mvn", "clean", "package", "<framework-specific-goal>"]
187
+ ```
188
+
189
+ #### Playwright Pattern (For UI/Browser Testing)
190
+
191
+ For applications requiring browser automation and UI testing (reference: [`benchmark/infrastructure/ejb-async`](benchmark/infrastructure/ejb-async)):
192
+
193
+ ```dockerfile
194
+ FROM maven:3.9-eclipse-temurin-21
195
+
196
+ # Run everything as root (needed for Playwright installation)
197
+ USER root
198
+
199
+ # Install Python and needed tools (add python3-venv for virtual environment support)
200
+ RUN apt-get update && apt-get install -y python3 python3-venv python3-pip curl && rm -rf /var/lib/apt/lists/*
201
+
202
+ # Create and activate virtual environment for Python dependencies (PEP 668 safe)
203
+ RUN python3 -m venv /opt/venv
204
+ ENV PATH="/opt/venv/bin:$PATH"
205
+
206
+ # Shared browsers path so Chromium is cached once
207
+ ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
208
+ RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright
209
+
210
+ # Install Playwright and Chromium dependencies inside venv
211
+ RUN pip install --no-cache-dir --upgrade pip setuptools wheel \
212
+ && pip install --no-cache-dir playwright==1.47.0 \
213
+ && playwright install --with-deps chromium
214
+
215
+ WORKDIR /app
216
+
217
+ # Copy Maven wrapper first (cache efficient)
218
+ COPY .mvn .mvn
219
+ COPY mvnw .
220
+ RUN chmod +x mvnw
221
+
222
+ # Copy root pom and module poms for dependency layer caching
223
+ COPY pom.xml ./
224
+ # If you have multiple modules, copy each module's pom separately:
225
+ # COPY module1/pom.xml module1/pom.xml
226
+ # COPY module2/pom.xml module2/pom.xml
227
+ RUN ./mvnw -q -DskipTests dependency:go-offline || true
228
+
229
+ # Copy full module sources
230
+ COPY src src
231
+ # If you have multiple modules:
232
+ # COPY module1 module1
233
+ # COPY module2 module2
234
+
235
+ # Copy unified smoke test (includes Playwright logic)
236
+ COPY smoke.py .
237
+ RUN chmod +x smoke.py
238
+
239
+ # For Playwright tests, CMD can run smoke.py directly or the Maven goal
240
+ # Framework-specific goal to be replaced accordingly
241
+ # | Framework | Maven Goal |
242
+ # |-----------------------|-------------------------------|
243
+ # | Jakarta/OpenLiberty | liberty:run |
244
+ # | Quarkus | quarkus:dev |
245
+ # | Spring | spring-boot:run |
246
+ CMD ["mvn", "clean", "package", "<framework-specific-goal>"]
247
+ ```
248
+
249
+ #### Important Notes
250
+
251
+ 1. **Python3 and curl**: Always install these for smoke tests
252
+ 2. **User ID 1001**: Standard non-root user for security (basic pattern only)
253
+ 3. **Root User for Playwright**: Playwright installation requires root privileges; use root user when browser automation is needed
254
+ 4. **Virtual Environment**: Use Python venv (`/opt/venv`) for Playwright to comply with PEP 668
255
+ 5. **File Ownership**: Use `--chown=1001:1001` for all COPY commands in basic pattern; omit in Playwright pattern (root owns everything)
256
+ 6. **smoke.py**: Must be copied into the container
257
+ 7. **No Port Exposure**: Do NOT use `EXPOSE` directive - tests run internally via `docker exec`, not through exposed ports
258
+ 8. **Maven Wrapper**: Ensure `mvnw` is executable with `chmod +x`
259
+ 9. **Layer Caching**: For Playwright pattern, copy pom.xml files first to cache dependencies separately from source code
260
+ 10. **Browser Path**: Set `PLAYWRIGHT_BROWSERS_PATH=/ms-playwright` to share browser binaries across builds
261
+
262
+ ### 2. Makefile
263
+
264
+ The Makefile provides standard commands for building, running, testing, and managing your application.
265
+
266
+ #### Standard Structure
267
+
268
+ ```just
269
+ ### <Application Name> (<Framework>) Makefile
270
+ APP_NAME := "<app-name>-<framework>"
271
+ IMAGE_NAME := "<app-name>-<framework>:latest"
272
+ SUCCESS_PATTERN := "<framework-specific-pattern>"
273
+
274
+ build:
275
+ docker build -f Dockerfile -t {{IMAGE_NAME}} .
276
+ @echo "[INFO] Built image: {{IMAGE_NAME}}"
277
+
278
+ rebuild:
279
+ docker build --no-cache -f Dockerfile -t {{IMAGE_NAME}} .
280
+ @echo "[INFO] Rebuilt image (no cache): {{IMAGE_NAME}}"
281
+
282
+ up: build
283
+ ### The below section will look for exisiting containers and if so, remove them.
284
+ @if docker ps --all --quiet --filter name=^/{{APP_NAME}}$ | grep -q .; then \
285
+ echo "[INFO] Removing existing container"; \
286
+ docker rm -f {{APP_NAME}} >/dev/null; \
287
+ fi
288
+
289
+ ### Run the container in detached mode
290
+ docker run -d --name {{APP_NAME}} {{IMAGE_NAME}}
291
+ @echo "[INFO] Started {{APP_NAME}}, waiting for app to start..."
292
+
293
+ ### Check for build failure
294
+ @until docker logs {{APP_NAME}} 2>&1 | grep -q "BUILD FAILURE"; do \
295
+ if docker logs {{APP_NAME}} 2>&1 | grep -q "{{SUCCESS_PATTERN}}"; then \
296
+ break; \
297
+ fi; \
298
+ sleep 1; \
299
+ done
300
+ @if docker logs {{APP_NAME}} 2>&1 | grep -q "BUILD FAILURE"; then \
301
+ echo "[ERROR] Build failed in container:"; \
302
+ docker logs {{APP_NAME}} 2>&1; \
303
+ exit 1; \
304
+ fi
305
+
306
+ ### Wait for success pattern
307
+ @until docker logs {{APP_NAME}} 2>&1 | grep -q "{{SUCCESS_PATTERN}}"; do sleep 1; done
308
+ @echo "[INFO] App started and ready."
309
+
310
+ logs:
311
+ docker logs -f {{APP_NAME}}
312
+
313
+ down:
314
+ - docker rm -f {{APP_NAME}}
315
+ @echo "[INFO] Container removed (if it existed)"
316
+
317
+ test: up
318
+ @docker exec {{APP_NAME}} sh -c 'python3 /app/smoke.py'
319
+
320
+ local:
321
+ ./mvnw clean package <framework-goal>
322
+ ```
323
+
324
+ #### Framework-Specific Startup Patterns
325
+
326
+ The `SUCCESS_PATTERN` variable should be set based on the framework:
327
+
328
+ | Framework | Success Pattern | Example |
329
+ |-----------|-----------------|---------|
330
+ | Jakarta | `CWWKF0011I` | `SUCCESS_PATTERN := "CWWKF0011I"` |
331
+ | Quarkus | `started in.*Listening on:` | `SUCCESS_PATTERN := "started in.*Listening on:"` |
332
+ | Spring Boot | `Tomcat started on port\|Started .* in .* seconds` | `SUCCESS_PATTERN := "Tomcat started on port"` |
333
+
334
+ **Note**: These patterns are used in extended grep (`grep -E`), so use regex syntax where needed.
335
+
336
+ #### Startup Wait Loop Explained
337
+
338
+ The `up` target uses two separate checks:
339
+
340
+ 1. **Build Failure Check**: Polls logs looking for `BUILD FAILURE` (a standard Maven failure message)
341
+ - While checking, also looks for the success pattern
342
+ - If success pattern found first, breaks out of the failure check
343
+ - If `BUILD FAILURE` found: displays full logs and exits with error
344
+
345
+ 2. **Success Pattern Wait**: If no build failure, continues waiting for the success pattern
346
+ - Loops until the framework-specific success pattern appears in logs
347
+ - Pattern indicates the application is fully started and ready
348
+
349
+
350
+ #### Port Notes
351
+
352
+ Applications bind to internal ports (usually `9080` or `8080`) for communication within the container. Since tests run internally via `docker exec`, **no port mapping to the host is needed**. The Makefile does not expose ports, and containers run without `-p` flags.
353
+
354
+ #### Required Targets
355
+
356
+ All Makefiles must include these standard targets:
357
+
358
+ - `build`: Build the Docker image
359
+ - `rebuild`: Rebuild without cache (for troubleshooting)
360
+ - `up`: Start container, wait for readiness
361
+ - `logs`: Stream container logs
362
+ - `down`: Stop and remove container
363
+ - `test`: Run smoke tests
364
+ - `local`: Run locally without Docker
365
+
366
+ ### 3. Smoke Test (smoke.py or custom smoke tests)
367
+
368
+ The smoke test validates your application's core functionality. While examples below use Python, **you are free to write smoke tests in any language** - the only requirements are:
369
+
370
+ 1. **Dockerfile** must exist and be able to run the tests
371
+ 2. **Makefile** must have a `test` target that executes the tests
372
+ 3. Tests must exit with code `0` on success, non-zero on failure
373
+
374
+ This allows flexibility to use:
375
+ - Python with pytest/Playwright (recommended for complex UI testing)
376
+ - Shell scripts with curl (lightweight HTTP testing)
377
+ - JavaScript with Node.js (if you prefer JavaScript)
378
+ - Go, Java, or any other language
379
+ - Combinations of multiple test frameworks
380
+
381
+ The key requirement is that `just test` must work inside the container.
382
+
383
+ #### Standard Structure
384
+
385
+ ```python
386
+ #!/usr/bin/env python3
387
+ """Smoke test for <Application Name> (<Framework>).
388
+
389
+ Checks:
390
+ 1) Discover reachable base path
391
+ 2) <Test 1 description>
392
+ 3) <Test 2 description>
393
+ ...
394
+
395
+ Exit codes:
396
+ 0 success, non-zero on first failure encountered.
397
+ """
398
+ import os
399
+ import sys
400
+ import time
401
+ from urllib.request import Request, urlopen
402
+ from urllib.error import HTTPError, URLError
403
+
404
+ # Configuration
405
+ VERBOSE = os.getenv("VERBOSE") == "1"
406
+
407
+ # Base URL candidates (try in order)
408
+ CANDIDATES = [
409
+ os.getenv("<APP>_BASE_URL"), # Environment variable override
410
+ "http://localhost:<internal-port>/<path>/", # Container internal
411
+ ]
412
+
413
+ def vprint(msg: str):
414
+ """Print only if VERBOSE=1"""
415
+ if VERBOSE:
416
+ print(msg)
417
+
418
+ def http_request(
419
+ method: str,
420
+ url: str,
421
+ data: bytes | None = None,
422
+ headers: dict | None = None,
423
+ timeout: int = 10,
424
+ ):
425
+ """Make HTTP request, return (status, body) or None on network error"""
426
+ req = Request(url, data=data, method=method, headers=headers or {})
427
+ try:
428
+ with urlopen(req, timeout=timeout) as resp:
429
+ status = resp.getcode()
430
+ body = resp.read().decode("utf-8", "replace")
431
+ except HTTPError as e:
432
+ status = e.code
433
+ body = e.read().decode("utf-8", "replace")
434
+ except (URLError, Exception) as e:
435
+ return None, f"NETWORK-ERROR: {e}"
436
+ return (status, body), None
437
+
438
+ def discover_base() -> str:
439
+ """Try each candidate URL, return first working one"""
440
+ for cand in CANDIDATES:
441
+ if not cand:
442
+ continue
443
+ # Try to validate candidate
444
+ if validate_candidate(cand):
445
+ print(f"[INFO] Base discovered: {cand}")
446
+ return cand
447
+ # Fallback
448
+ for cand in CANDIDATES:
449
+ if cand:
450
+ print(f"[WARN] No base validated, using fallback {cand}")
451
+ return cand
452
+ print("[ERROR] No base URL candidates available", file=sys.stderr)
453
+ sys.exit(2)
454
+
455
+ def validate_candidate(base: str) -> bool:
456
+ """Implement validation logic for your app"""
457
+ # Example: Try a health check endpoint
458
+ pass
459
+
460
+ def main():
461
+ start = time.time()
462
+ base = discover_base()
463
+
464
+ # Run your test sequence here
465
+ # Example:
466
+ # test_endpoint_1(base)
467
+ # test_endpoint_2(base)
468
+
469
+ elapsed = time.time() - start
470
+ print(f"[PASS] Smoke sequence complete in {elapsed:.2f}s")
471
+ return 0
472
+
473
+ if __name__ == "__main__":
474
+ sys.exit(main())
475
+ ```
476
+
477
+ #### Key Components
478
+
479
+ 1. **Docstring**: Describe what the smoke test validates
480
+ 2. **URL Discovery**: Try multiple URL candidates (env var, localhost variations, container ports)
481
+ 3. **HTTP Helper**: Reusable function for making requests
482
+ 4. **Verbose Logging**: Support `VERBOSE=1` environment variable
483
+ 5. **Exit Codes**: Use specific exit codes for different failure types
484
+ 6. **Pass/Fail Messages**: Clear `[PASS]`/`[FAIL]` prefixes
485
+ 7. **Timing**: Report total test execution time
486
+
487
+ #### Playwright-Based Testing (Advanced)
488
+
489
+ For applications requiring browser automation and UI testing, use Playwright. Example structure:
490
+
491
+ ```python
492
+ #!/usr/bin/env python3
493
+ """Smoke test with Playwright for UI validation.
494
+
495
+ Checks:
496
+ 1) Start application server
497
+ 2) Launch browser and navigate to UI
498
+ 3) Interact with UI elements
499
+ 4) Validate UI behavior and responses
500
+
501
+ Exit codes:
502
+ 0 success, non-zero on failure.
503
+ """
504
+ import os
505
+ import sys
506
+ import time
507
+ import subprocess
508
+ from playwright.sync_api import sync_playwright, TimeoutError as PlaywrightTimeout
509
+
510
+ VERBOSE = os.getenv("VERBOSE") == "1"
511
+ BASE_URL = "http://localhost:9080"
512
+
513
+ def vprint(msg: str):
514
+ if VERBOSE:
515
+ print(msg)
516
+
517
+ def start_server():
518
+ """Start the application server"""
519
+ vprint("[INFO] Starting application server...")
520
+ # Example: Start Liberty server
521
+ proc = subprocess.Popen(
522
+ ["./mvnw", "clean", "package", "liberty:run"],
523
+ stdout=subprocess.PIPE,
524
+ stderr=subprocess.STDOUT,
525
+ text=True
526
+ )
527
+
528
+ # Wait for server to be ready
529
+ for line in proc.stdout:
530
+ vprint(line.rstrip())
531
+ if "CWWKF0011I" in line: # Liberty started
532
+ print("[INFO] Server started successfully")
533
+ break
534
+
535
+ return proc
536
+
537
+ def test_ui_with_playwright(base_url: str):
538
+ """Test UI using Playwright browser automation"""
539
+ print("[INFO] Launching browser...")
540
+
541
+ with sync_playwright() as p:
542
+ browser = p.chromium.launch(headless=True)
543
+ page = browser.new_page()
544
+
545
+ try:
546
+ # Navigate to application
547
+ vprint(f"[INFO] Navigating to {base_url}")
548
+ page.goto(base_url, wait_until="networkidle", timeout=30000)
549
+
550
+ # Example: Check page title
551
+ title = page.title()
552
+ if "Expected Title" not in title:
553
+ print(f"[FAIL] Unexpected page title: {title}", file=sys.stderr)
554
+ return False
555
+ print(f"[PASS] Page title: {title}")
556
+
557
+ # Example: Fill form and submit
558
+ page.fill("#inputField", "test value")
559
+ page.click("#submitButton")
560
+
561
+ # Wait for response
562
+ page.wait_for_selector(".result", timeout=10000)
563
+ result = page.text_content(".result")
564
+
565
+ if "expected result" not in result.lower():
566
+ print(f"[FAIL] Unexpected result: {result}", file=sys.stderr)
567
+ return False
568
+ print(f"[PASS] Form submission successful: {result}")
569
+
570
+ return True
571
+
572
+ except PlaywrightTimeout as e:
573
+ print(f"[FAIL] Timeout: {e}", file=sys.stderr)
574
+ return False
575
+ except Exception as e:
576
+ print(f"[FAIL] Error: {e}", file=sys.stderr)
577
+ return False
578
+ finally:
579
+ browser.close()
580
+
581
+ def main():
582
+ start = time.time()
583
+
584
+ # Start server
585
+ server_proc = start_server()
586
+
587
+ try:
588
+ # Run UI tests
589
+ success = test_ui_with_playwright(BASE_URL)
590
+
591
+ if not success:
592
+ return 1
593
+
594
+ elapsed = time.time() - start
595
+ print(f"[PASS] Smoke sequence complete in {elapsed:.2f}s")
596
+ return 0
597
+
598
+ finally:
599
+ # Clean up
600
+ if server_proc:
601
+ vprint("[INFO] Stopping server...")
602
+ server_proc.terminate()
603
+ server_proc.wait()
604
+
605
+ if __name__ == "__main__":
606
+ sys.exit(main())
607
+ ```
608
+
609
+ #### Playwright Testing Notes
610
+
611
+ 1. **Browser Setup**: Use `chromium.launch(headless=True)` for CI/CD compatibility
612
+ 2. **Timeouts**: Set appropriate timeouts for page loads and element waits
613
+ 3. **Wait Strategies**: Use `wait_until="networkidle"` for page loads, `wait_for_selector` for elements
614
+ 4. **Error Handling**: Always use try/finally to ensure browser cleanup
615
+ 5. **Server Management**: Start application server before tests, terminate after
616
+ 6. **Selectors**: Use stable selectors (IDs, data attributes) instead of classes
617
+ 7. **Screenshots**: Capture on failure for debugging: `page.screenshot(path="error.png")`
618
+ 8. **Virtual Display**: In Docker, browsers run headless automatically
619
+
620
+ #### Best Practices
621
+
622
+ 1. **Test Real Functionality**: Don't just check if the server responds - validate actual behavior
623
+ 2. **Multiple Scenarios**: Test with and without authentication, different inputs, etc.
624
+ 3. **Meaningful Assertions**: Check status codes AND response content
625
+ 4. **Clear Error Messages**: Include URL, status, and response body in failures
626
+ 5. **Early Exit**: Exit on first failure with specific exit code
627
+ 6. **Timeout Handling**: Use reasonable timeouts (10s default)
628
+ 7. **Network Resilience**: Handle both HTTP errors and network failures
629
+
630
+ #### Example Test Pattern
631
+
632
+ ```python
633
+ def test_endpoint(base: str, description: str, path: str,
634
+ method: str = "GET", expected_status: int = 200,
635
+ expected_content: str = None, headers: dict = None):
636
+ """Reusable test function"""
637
+ url = f"{base.rstrip('/')}{path}"
638
+ resp, err = http_request(method, url, headers=headers)
639
+
640
+ if err:
641
+ print(f"[FAIL] {description}: {err}", file=sys.stderr)
642
+ sys.exit(1)
643
+
644
+ status, body = resp
645
+ body_stripped = body.strip()
646
+
647
+ if status != expected_status:
648
+ print(f"[FAIL] {description}: Expected {expected_status}, got {status}",
649
+ file=sys.stderr)
650
+ sys.exit(1)
651
+
652
+ if expected_content and expected_content not in body_stripped:
653
+ print(f"[FAIL] {description}: Expected content '{expected_content}' not found",
654
+ file=sys.stderr)
655
+ sys.exit(1)
656
+
657
+ print(f"[PASS] {description}")
658
+ ```
659
+
660
+ #### Smoke Test Folder Structure (For Complex Applications)
661
+
662
+ For large, multi-framework applications (reference: [`benchmark/whole_applications/daytrader`](benchmark/whole_applications/daytrader)), organize smoke tests in a dedicated folder with multiple test files and a dependency manifest:
663
+
664
+ **Folder Structure:**
665
+ ```
666
+ <application>/<framework>/smoke/
667
+ ├── smoke.py # Main entry point with pytest fixtures
668
+ ├── test_*.py # Individual test modules
669
+ ├── playwright-test-cases.md # Documentation of test scenarios
670
+ ├── pyproject.toml # Python dependencies (pytest, pytest-playwright, etc.)
671
+ ├── pytest.ini # Pytest configuration
672
+ ├── conftest.py # Pytest fixtures and configuration
673
+ └── README.md # Test documentation
674
+ ```
675
+
676
+ **pyproject.toml** (using `uv` for modern dependency management - recommended):
677
+ ```toml
678
+ [project]
679
+ name = "smoke"
680
+ version = "0.1.0"
681
+ description = "Smoke tests for <Application>"
682
+ requires-python = ">=3.11"
683
+ dependencies = [
684
+ "playwright>=1.47.0",
685
+ "pytest>=8.0.0,<9.0.0",
686
+ "pytest-playwright>=0.7.0",
687
+ ]
688
+
689
+ [tool.pytest.ini_options]
690
+ testpaths = ["."]
691
+ python_files = ["test_*.py", "smoke.py"]
692
+
693
+ # Optional: specify script entry point
694
+ [project.scripts]
695
+ smoke = "smoke:main"
696
+ ```
697
+
698
+ **conftest.py** (pytest fixtures):
699
+ ```python
700
+ import os
701
+ import pytest
702
+ from playwright.sync_api import sync_playwright
703
+
704
+ BASE_URL = os.getenv("BASE_URL", "http://localhost:9080/app")
705
+
706
+ @pytest.fixture
707
+ def page():
708
+ """Provide a Playwright page fixture for all tests"""
709
+ with sync_playwright() as p:
710
+ browser = p.chromium.launch(headless=True)
711
+ context = browser.new_context()
712
+ page = context.new_page()
713
+ yield page
714
+ browser.close()
715
+
716
+ @pytest.fixture
717
+ def base_url():
718
+ """Provide base URL to all tests"""
719
+ return BASE_URL
720
+ ```
721
+
722
+ **smoke.py** (example with pytest markers):
723
+ ```python
724
+ import pytest
725
+ from playwright.sync_api import Page, expect
726
+
727
+ BASE_URL = "http://localhost:9080/app"
728
+
729
+ @pytest.mark.smoke
730
+ def test_home_page_loads(page: Page) -> None:
731
+ """Test that home page loads successfully"""
732
+ page.goto(BASE_URL, wait_until="domcontentloaded")
733
+ expect(page).to_have_title("Application Title")
734
+
735
+ @pytest.mark.smoke
736
+ def test_navigation_links(page: Page) -> None:
737
+ """Test that main navigation links are present"""
738
+ page.goto(BASE_URL, wait_until="domcontentloaded")
739
+ links = page.get_by_role("link")
740
+ assert links.count() > 0
741
+
742
+ @pytest.mark.smoke
743
+ def test_login_form(page: Page) -> None:
744
+ """Test login functionality"""
745
+ page.goto(f"{BASE_URL}/login", wait_until="domcontentloaded")
746
+ page.fill('input[name="username"]', "testuser")
747
+ page.fill('input[name="password"]', "password")
748
+ page.click('button[type="submit"]')
749
+ # Assert successful login
750
+ assert page.url != f"{BASE_URL}/login"
751
+ ```
752
+
753
+ **Dockerfile Integration** (using `uv` for fast, reproducible test environments - recommended):
754
+ ```dockerfile
755
+ FROM maven:3.9-eclipse-temurin-21
756
+
757
+ USER root
758
+ RUN apt-get update && apt-get install -y python3 curl && rm -rf /var/lib/apt/lists/*
759
+
760
+ # Install uv for fast Python dependency management
761
+ RUN curl -sSL https://astral.sh/uv/install.sh | sh
762
+ ENV PATH="$HOME/.cargo/bin:$PATH"
763
+
764
+ WORKDIR /app
765
+
766
+ # Copy application files
767
+ COPY pom.xml .
768
+ COPY src src
769
+ COPY .mvn .mvn
770
+ COPY mvnw .
771
+ RUN chmod +x mvnw
772
+
773
+ # Copy entire smoke test folder (includes pyproject.toml, uv.lock, test files)
774
+ COPY smoke smoke
775
+
776
+ CMD ["./mvnw", "clean", "package", "<framework-specific-goal>"]
777
+ ```
778
+
779
+ **Makefile Integration** (using `uv` with Playwright - recommended for complex apps):
780
+ ```just
781
+ ### <Application Name> (<Framework>) Makefile
782
+ APP_NAME := "<app-name>-<framework>"
783
+ IMAGE_NAME := "<app-name>-<framework>:latest"
784
+ APP_PORT := "9080"
785
+
786
+ build:
787
+ docker build -f Dockerfile -t {{IMAGE_NAME}} .
788
+ @echo "[INFO] Built image: {{IMAGE_NAME}}"
789
+
790
+ rebuild:
791
+ docker build --no-cache -f Dockerfile -t {{IMAGE_NAME}} .
792
+ @echo "[INFO] Rebuilt image (no cache): {{IMAGE_NAME}}"
793
+
794
+ up: build
795
+ - docker rm -f {{APP_NAME}} 2>/dev/null || true
796
+ docker run -d --name {{APP_NAME}} {{IMAGE_NAME}}
797
+ @echo "[INFO] Started {{APP_NAME}} (internal port {{APP_PORT}})..."
798
+ @echo "[INFO] Waiting for application to start..."
799
+ @until docker logs {{APP_NAME}} 2>&1 | grep -q "<startup-pattern>"; do sleep 1; done
800
+ @echo "[INFO] Application started, port {{APP_PORT}} is ready."
801
+
802
+ logs:
803
+ docker logs -f {{APP_NAME}}
804
+
805
+ down:
806
+ - docker rm -f {{APP_NAME}}
807
+ @echo "[INFO] Container {{APP_NAME}} removed (if it existed)."
808
+
809
+ # Run Playwright-based smoke tests inside the running container with uv
810
+ smoke: up
811
+ @echo "[INFO] Running smoke tests inside container {{APP_NAME}}..."
812
+ docker exec {{APP_NAME}} bash -lc "cd smoke && uv sync && uv run playwright install chromium && uv run pytest -v --tb=short"
813
+
814
+ test: smoke
815
+
816
+ local:
817
+ ./mvnw clean package <framework-specific-goal>
818
+ ```
819
+
820
+ **Key Benefits of Folder Structure:**
821
+
822
+ 1. **Scalability**: Organize tests into multiple files as test suite grows
823
+ 2. **Modularity**: Separate concerns (auth tests, API tests, UI tests, etc.)
824
+ 3. **pytest Features**: Use markers, fixtures, and parameterization
825
+ 4. **Dependencies**: Centralized management in `pyproject.toml` with `uv.lock` for reproducibility
826
+ 5. **Documentation**: Each test file and test case is self-documenting
827
+ 6. **CI/CD Friendly**: pytest integrates with most CI/CD systems
828
+ 7. **Fast Dependency Sync**: `uv sync` is significantly faster than `pip install`
829
+
830
+ **Running Tests Locally (with `uv` - recommended):**
831
+ ```bash
832
+ cd smoke
833
+ uv sync # Install dependencies from pyproject.toml
834
+ uv run pytest -v # Run all tests
835
+ uv run pytest -m smoke # Run only smoke tests
836
+ uv run pytest test_login.py # Run specific test file
837
+ uv run pytest -v --tb=short # Run with short traceback
838
+ VERBOSE=1 uv run pytest -v # Run with verbose output
839
+ ```
840
+
841
+ **Running Tests Locally (with pip - legacy approach):**
842
+ ```bash
843
+ cd smoke
844
+ pip install -e . # Install from pyproject.toml
845
+ pytest -v # Run all tests
846
+ pytest -m smoke # Run only smoke tests
847
+ ```
848
+
849
+ #### Alternative Smoke Test Implementations
850
+
851
+ While Python with pytest is recommended for complex applications, here are other valid approaches:
852
+
853
+ **Shell Script Example** (simple HTTP testing):
854
+ ```bash
855
+ #!/bin/bash
856
+ # smoke.sh - Lightweight smoke test using curl
857
+
858
+ set -e
859
+ BASE_URL="http://localhost:9080/app"
860
+
861
+ echo "[INFO] Testing home page..."
862
+ curl -sf "$BASE_URL/" > /dev/null || exit 1
863
+
864
+ echo "[INFO] Testing API endpoint..."
865
+ curl -sf "$BASE_URL/api/status" | grep -q "ok" || exit 1
866
+
867
+ echo "[PASS] Smoke tests complete"
868
+ exit 0
869
+ ```
870
+
871
+ **JavaScript/Node.js Example** (with Jest):
872
+ ```javascript
873
+ // smoke.test.js
874
+ const axios = require('axios');
875
+
876
+ const BASE_URL = 'http://localhost:9080/app';
877
+
878
+ describe('Smoke Tests', () => {
879
+ test('home page loads', async () => {
880
+ const response = await axios.get(BASE_URL);
881
+ expect(response.status).toBe(200);
882
+ expect(response.data).toContain('app');
883
+ });
884
+
885
+ test('API endpoint responds', async () => {
886
+ const response = await axios.get(`${BASE_URL}/api/status`);
887
+ expect(response.data.status).toBe('ok');
888
+ });
889
+ });
890
+ ```
891
+
892
+ **Makefile Integration** (shell script example):
893
+ ```just
894
+ smoke: up
895
+ @echo "[INFO] Running smoke tests..."
896
+ docker exec {{APP_NAME}} bash -c "cd /app && bash smoke.sh"
897
+
898
+ test: smoke
899
+ ```
900
+
901
+ **Key Point**: The implementation language doesn't matter, as long as:
902
+ - The Dockerfile includes necessary runtime and dependencies
903
+ - The `test` target in Makefile successfully runs the tests within the container
904
+ - Tests exit with appropriate exit codes (0 = success)
905
+
906
+ ## Standard Patterns
907
+
908
+ ### Directory Structure
909
+
910
+ For **simple applications** (single smoke.py):
911
+ ```
912
+ benchmark/<category>/<application-name>/
913
+ ├── jakarta/
914
+ │ ├── Dockerfile
915
+ │ ├── Makefile
916
+ │ ├── smoke.py
917
+ │ ├── pom.xml
918
+ │ ├── mvnw
919
+ │ ├── mvnw.cmd
920
+ │ ├── .mvn/
921
+ │ └── src/
922
+ ├── quarkus/
923
+ │ ├── Dockerfile
924
+ │ ├── Makefile
925
+ │ ├── smoke.py
926
+ │ ├── pom.xml
927
+ │ ├── mvnw
928
+ │ ├── mvnw.cmd
929
+ │ ├── .mvn/
930
+ │ └── src/
931
+ └── spring/
932
+ ├── Dockerfile
933
+ ├── Makefile
934
+ ├── smoke.py
935
+ ├── pom.xml
936
+ ├── mvnw
937
+ ├── mvnw.cmd
938
+ ├── .mvn/
939
+ └── src/
940
+ ```
941
+
942
+ For **complex applications** (smoke folder with pytest):
943
+ ```
944
+ benchmark/<category>/<application-name>/
945
+ ├── jakarta/
946
+ │ ├── Dockerfile
947
+ │ ├── Makefile
948
+ │ ├── pom.xml
949
+ │ ├── mvnw
950
+ │ ├── mvnw.cmd
951
+ │ ├── .mvn/
952
+ │ ├── src/
953
+ │ └── smoke/ # Folder instead of single file
954
+ │ ├── smoke.py
955
+ │ ├── test_home.py
956
+ │ ├── test_auth.py
957
+ │ ├── test_api.py
958
+ │ ├── conftest.py
959
+ │ ├── pytest.ini
960
+ │ ├── pyproject.toml
961
+ │ ├── playwright-test-cases.md
962
+ │ └── README.md
963
+ ├── quarkus/
964
+ │ ├── ... (same structure)
965
+ │ └── smoke/
966
+ │ └── ... (same structure)
967
+ └── spring/
968
+ ├── ... (same structure)
969
+ └── smoke/
970
+ └── ... (same structure)
971
+ ```
972
+
973
+ ### Naming Conventions
974
+
975
+ 1. **Container Names**: `<app>-<framework>` (e.g., `jobs-jakarta`, `jobs-quarkus`)
976
+ 2. **Image Names**: `<app>-<framework>:latest`
977
+ 3. **Variables**: Use uppercase with underscores (e.g., `APP_NAME`, `IMAGE_NAME`)
978
+ 4. **Paths**: Use consistent endpoint paths across frameworks
979
+
980
+ ### Common Variables
981
+
982
+ These should appear in every Makefile:
983
+
984
+ ```just
985
+ APP_NAME := "<app>-<framework>"
986
+ IMAGE_NAME := "<app>-<framework>:latest"
987
+ ```
988
+
989
+ ## Checklist
990
+
991
+ Before submitting your contribution, verify:
992
+
993
+ ### Dockerfile
994
+ - [ ] Uses appropriate JDK base image for framework
995
+ - [ ] Installs `python3` and `curl`
996
+ - [ ] **Basic pattern**: Creates non-root user with UID 1001
997
+ - [ ] **Playwright pattern**: Runs as root and installs Python venv, pip, and Playwright
998
+ - [ ] **Playwright pattern**: Sets up `PLAYWRIGHT_BROWSERS_PATH` and installs Chromium
999
+ - [ ] Copies all necessary files with correct ownership (use `--chown=1001:1001` for basic pattern)
1000
+ - [ ] Makes `mvnw` executable
1001
+ - [ ] Does NOT include `EXPOSE` directive (tests run internally)
1002
+ - [ ] Uses correct Maven goal in CMD
1003
+ - [ ] **Playwright pattern**: Implements layer caching for pom.xml files
1004
+
1005
+ ### Makefile
1006
+ - [ ] All variables defined at top (APP_NAME, IMAGE_NAME)
1007
+ - [ ] `build` target works
1008
+ - [ ] `rebuild` target works (no cache)
1009
+ - [ ] `up` target waits for correct startup pattern
1010
+ - [ ] `logs` target streams container logs
1011
+ - [ ] `down` target cleans up container
1012
+ - [ ] `test` target runs smoke tests successfully
1013
+ - [ ] `local` target runs app without Docker
1014
+
1015
+ ### Smoke Test (smoke.py)
1016
+ - [ ] Has descriptive docstring
1017
+ - [ ] Includes shebang `#!/usr/bin/env python3`
1018
+ - [ ] Has URL discovery with multiple candidates
1019
+ - [ ] Supports `VERBOSE=1` environment variable
1020
+ - [ ] Tests real application functionality (not just health checks)
1021
+ - [ ] Uses clear `[PASS]`/`[FAIL]` messages
1022
+ - [ ] Exits with code 0 on success, non-zero on failure
1023
+ - [ ] Reports execution time
1024
+ - [ ] Handles network errors gracefully
1025
+ - [ ] Works both inside container and from host
1026
+ - [ ] **Playwright tests**: Properly manages browser lifecycle (launch/close)
1027
+ - [ ] **Playwright tests**: Uses appropriate timeouts and wait strategies
1028
+ - [ ] **Playwright tests**: Handles server startup and shutdown
1029
+
1030
+ ### Testing
1031
+ - [ ] `just build` succeeds for all frameworks
1032
+ - [ ] `just up` starts container and waits for ready state
1033
+ - [ ] `just test` passes all smoke tests
1034
+ - [ ] `just logs` shows application logs
1035
+ - [ ] `just down` cleans up successfully
1036
+ - [ ] `just local` runs application locally
1037
+ - [ ] All three frameworks (jakarta, quarkus, spring) work identically
1038
+ - [ ] **Playwright tests**: Browser tests pass in headless mode
1039
+ - [ ] **Playwright tests**: Tests work both inside container and from host
1040
+
1041
+ ### Documentation
1042
+ - [ ] Add README.md explaining the application's purpose
1043
+ - [ ] Document any special configuration or requirements
1044
+ - [ ] Document if Playwright is used for UI testing
1045
+ - [ ] Update main benchmark documentation if needed
1046
+
1047
+ ## Tips and Troubleshooting
1048
+
1049
+ ### Debugging
1050
+
1051
+ **Test startup pattern**: `docker logs <container> 2>&1 | grep -q "<pattern>"`
1052
+
1053
+ **Run smoke test manually**: `docker exec <container> python3 /app/smoke.py`
1054
+
1055
+ **Verbose output**: `VERBOSE=1 python3 smoke.py`
1056
+
1057
+ **Playwright debugging**: Set `headless=False` and use `page.pause()`
1058
+
1059
+ ### Common Issues
1060
+
1061
+ **Container won't start**: Check logs with `docker logs <container>`
1062
+
1063
+ **Smoke test fails**: Run with `VERBOSE=1` to see detailed request/response
1064
+
1065
+ **Startup timeout**: Increase sleep or check startup pattern regex
1066
+
1067
+ **Permission denied**: Verify file ownership matches user UID 1001 (basic pattern only)
1068
+
1069
+ **Playwright browser won't launch**: Ensure you're running as root in Dockerfile or install system dependencies
1070
+
1071
+ **Playwright timeout**: Increase timeout values or check if page is actually loading
1072
+
1073
+ **Python package conflicts**: Use virtual environment with `python3 -m venv` (required for Playwright)
1074
+
1075
+ **Chromium not found**: Verify `playwright install chromium` ran successfully and `PLAYWRIGHT_BROWSERS_PATH` is set
1076
+
1077
+ ## Quick Start
1078
+
1079
+ ```bash
1080
+ # 1. Create structure
1081
+ mkdir -p benchmark/<category>/<app>/{jakarta,quarkus,spring}
1082
+
1083
+ # 2. Implement first framework
1084
+ cd benchmark/<category>/<app>/jakarta
1085
+ # ... create Dockerfile, Makefile, smoke.py
1086
+
1087
+ # 3. Test
1088
+ just build && just up && just test
1089
+
1090
+ # 4. Adapt to other frameworks
1091
+ # 5. Submit PR
1092
+ ```
1093
+
1094
+ ## Reference Implementations
1095
+
1096
+ - **Basic pattern**: [`benchmark/infrastructure/concurrency-jobs`](benchmark/infrastructure/concurrency-jobs)
1097
+ - **Playwright pattern**: [`benchmark/infrastructure/ejb-async`](benchmark/infrastructure/ejb-async)
1098
+ - **Complex multi-test**: [`benchmark/whole_applications/daytrader`](benchmark/whole_applications/daytrader)
README.md CHANGED
@@ -1,3 +1,252 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
- license: apache-2.0
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="https://github.com/scarfbench/site/blob/main/public/assets/images/scarf-dark.png">
4
+ <source media="(prefers-color-scheme: light)" srcset="https://github.com/scarfbench/site/blob/main/public/assets/images/scarf-light.png">
5
+ <img alt="Logo">
6
+ </picture>
7
+
8
+ <div align="center">
9
+ <a href="https://scarfbench.github.io/site"><img src="https://img.shields.io/badge/site-scarfbench.info-blue?style=for-the-badge" alt="Documentation"></a>
10
+ <a href="https://scarfbench.github.io/site/leaderboard/"><img src="https://img.shields.io/badge/leaderboard-view%20results-orange?style=for-the-badge" alt="Leaderboard"></a>
11
+ </div>
12
+
13
+ **Scarf** (short for **S**elf-**C**ontained **A**pplication **R**efactoring) benchmark is a suite of Java applications across frameworks: Jakarta EE, Quarkus, and Spring for evaluating agentic transformation between the frameworks. This suite enables systematic assessment of AI agents' ability to migrate enterprise Java applications while preserving functionality, idiomatic patterns, and architectural integrity across different runtime environments.
14
+
15
+ The benchmark includes comprehensive examples ranging from focused layer-specific demonstrations to complete production-grade applications, each with verified implementations across all supported frameworks.
16
+
17
+ > **Note:** All applications in this benchmark have been meticulously converted and verified by experienced developers. Each implementation has undergone rigorous testing to ensure functional correctness, adherence to framework-specific idioms, and preservation of architectural integrity across Jakarta EE, Quarkus, and Spring frameworks.
18
+
19
  ---
20
+
21
+ ## Table of Contents
22
+
23
+ - [Quickstart Guide](#quickstart-guide)
24
+ - [Benchmark Applications](#benchmark-applications)
25
+ - [Focused Examples](#focused-examples)
26
+ - [Whole Applications](#whole-applications)
27
+ - [Roadmap](#roadmap)
28
+ - [Contact](#contact)
29
+
30
  ---
31
+
32
+ ## Quickstart Guide
33
+
34
+ This benchmark suite comes with most things needed to run the benchmark applications. Everything is already set up!
35
+
36
+ ### What's Included
37
+
38
+ Each application comes with:
39
+
40
+ - **Dockerfile** - Pre-configured container with all dependencies installed
41
+ - **Makefile** - Simple commands to build and run everything
42
+ - **smoke.py or smoke/** - Automated tests to verify the application works
43
+
44
+ You don't need to install Maven, Java, or any dependencies. Docker handles it all!
45
+
46
+ ### Prerequisites
47
+
48
+ You only need:
49
+
50
+ - Docker installed on your machine
51
+ - make command runner (you can install it via Cargo or your package manager)
52
+
53
+ ### Running an Application
54
+
55
+ #### Step 1: Pick an Application
56
+
57
+ Browse the directory structure and choose any application. For example:
58
+
59
+ ```
60
+ business_domain/counter/spring/
61
+ dependency_injection/encoder/jakarta/
62
+ presentation/mood/quarkus/
63
+ ```
64
+
65
+ #### Step 2: Navigate to the Application
66
+
67
+ ```bash
68
+ cd business_domain/counter/spring
69
+ ```
70
+
71
+ #### Step 3: Run It!
72
+
73
+ ```bash
74
+ make up
75
+ ```
76
+
77
+ That's it! The `make up` command will:
78
+ 1. Build your application
79
+ 2. Build the Docker container
80
+ 3. Start everything up
81
+
82
+ #### Step 4: Check the Logs
83
+
84
+ ```bash
85
+ make logs
86
+ ```
87
+
88
+ #### Step 5: Stop When Done
89
+
90
+ ```bash
91
+ make down
92
+ ```
93
+
94
+ ### Common Commands
95
+
96
+ Every application supports these commands (via the `Makefile`):
97
+
98
+ | Command | What it does |
99
+ |--------------|------------------------------------|
100
+ | `make help` | Shows all available commands |
101
+ | `make up` | Builds and starts the application |
102
+ | `make logs` | Shows application logs |
103
+ | `make test` | Runs everything and the smoke tests|
104
+ | `make clean` | Removes build artifacts |
105
+
106
+ ### Running Smoke Tests
107
+
108
+ Most applications include automated tests. To run, just use `make test`:
109
+
110
+ ```bash
111
+ make test
112
+ ```
113
+
114
+ ### Framework Variations
115
+
116
+ Each application type comes in three flavors:
117
+
118
+ - **jakarta/** - Jakarta EE (enterprise Java)
119
+ - **quarkus/** - Quarkus (cloud-native Java)
120
+ - **spring/** - Spring Boot (popular Java framework)
121
+
122
+ Pick whichever framework you want to test!
123
+
124
+ ### Troubleshooting
125
+
126
+ **Port already in use?**
127
+ ```bash
128
+ make rebuild
129
+ ```
130
+
131
+ **Want to rebuild from scratch?**
132
+ ```bash
133
+ make clean
134
+ make rebuild
135
+ make up
136
+ ```
137
+
138
+ **Need to see what's happening?**
139
+ ```bash
140
+ make logs
141
+ ```
142
+
143
+ ---
144
+
145
+ ## Benchmark Applications
146
+
147
+ This benchmark contains self-contained applications demonstrating core Java EE functionalities and their framework-specific implementations. Each example has been manually converted and verified across all target frameworks, with smoke tests included to verify application behavior after transformation.
148
+
149
+ The benchmark includes two types of examples:
150
+
151
+ ### Focused Examples
152
+
153
+ Application examples organized per layer, where each example demonstrates a specific technology within that layer (e.g., persistence, presentation, integration).
154
+
155
+ #### Business Domain Layer
156
+
157
+ Core business logic implementations using Enterprise JavaBeans (EJBs). Demonstrates stateful, stateless, and singleton session beans for shopping carts, currency conversion, hit counters, web services, and standalone EJB usage.
158
+
159
+ **Examples:**
160
+ - **cart** - Stateful session bean with shopping cart lifecycle management and `@Remove` methods
161
+ - **converter** - Stateless session bean demonstrating currency conversion business logic
162
+ - **counter** - Singleton session bean with shared state for tracking web page hits
163
+ - **helloservice** - JAX-WS web service implemented as a stateless session bean
164
+ - **standalone** - Stateless session bean for standalone EJB container usage
165
+
166
+ #### Dependency Injection Layer
167
+
168
+ CDI and dependency injection patterns including custom qualifiers, interceptors, decorators, producer methods, event observers, and alternative implementations for conditional bean selection.
169
+
170
+ #### Infrastructure Layer
171
+
172
+ Enterprise features including managed executors for concurrency, asynchronous EJB methods, interceptors for cross-cutting concerns, and timer services for scheduled task execution.
173
+
174
+ #### Integration Layer
175
+
176
+ Integration technologies featuring Jakarta Batch processing, JMS messaging patterns, message-driven beans, JAX-WS web services, and Java Connector Architecture for enterprise system integration.
177
+
178
+ #### Persistence Layer
179
+
180
+ Data persistence patterns using JPA entities with CRUD operations, complex entity relationships, composite keys, inheritance strategies, and JPQL queries for database interactions.
181
+
182
+ #### Presentation Layer
183
+
184
+ Web tier implementations including servlets, JAX-RS REST APIs, WebSocket endpoints, server-sent events, file uploads, filters, listeners, and real-time communication patterns.
185
+
186
+ #### Security Layer
187
+
188
+ Authentication and authorization patterns featuring Jakarta Security identity stores, form-based and basic authentication, EJB security, role-based access control, and password hashing.
189
+
190
+ ---
191
+
192
+ ### Whole Applications
193
+
194
+ Complete, functioning applications that demonstrate the coordination and interaction between multiple layers.
195
+
196
+ #### CargoTracker
197
+
198
+ Domain-Driven Design cargo shipping tracker with Jakarta Faces, CDI, Enterprise Beans, JPA, REST, Batch, and JMS. Showcases aggregates, repositories, and domain events following Eric Evans' DDD patterns.
199
+
200
+ Demonstrates Jakarta Faces, CDI, Enterprise Beans, JPA, REST, Batch, JSON Binding, Bean Validation, and JMS. Showcases end-to-end application architecture with multiple interfaces (web UI, REST API, file scanning) and complex domain modeling including aggregates, repositories, and domain events. Implements the cargo tracking example from Eric Evans' DDD book.
201
+
202
+ #### Coffee Shop
203
+
204
+ Event-driven microservices with Orders, Barista, and Kitchen services via Kafka. Demonstrates MicroProfile stack, reactive messaging, distributed transactions, and eventual consistency.
205
+
206
+ Microservices architecture with Orders, Barista, and Kitchen services communicating via Apache Kafka. Demonstrates MicroProfile (Config, Health, OpenAPI, Metrics), JPA with PostgreSQL, JAX-RS REST APIs, reactive messaging patterns, and distributed transaction coordination. Shows event-driven architecture with asynchronous inter-service communication and eventual consistency.
207
+
208
+ #### DayTrader
209
+
210
+ High-performance stock trading benchmark with stateless session beans, JPA optimistic locking, transaction management, and connection pooling. Used for measuring server performance.
211
+
212
+ Online stock trading benchmark application demonstrating real-world Java EE workload patterns. Implements user authentication, portfolio management, stock quote lookup, and buy/sell transactions. Showcases performance-oriented design with stateless session beans, JPA entities with optimistic locking, transaction management, connection pooling, and web service interfaces.
213
+
214
+ #### PetClinic
215
+
216
+ Veterinary clinic management with Jakarta Faces (PrimeFaces), complex JPA relationships, CDI, and Bean Validation. Complete workflows for owners, pets, visits, and veterinarians.
217
+
218
+ Full-featured veterinary clinic management system using Jakarta Faces (PrimeFaces) for the UI layer. Demonstrates CRUD operations with JPA entities showing one-to-many, many-to-one, and many-to-many relationships (owners-pets, pets-visits, vets-specialties). Includes CDI beans, Bean Validation, JSF navigation, complex forms, and master-detail views.
219
+
220
+ #### RealWorld
221
+
222
+ Medium.com clone with MicroProfile JWT, JAX-RS REST API, article management, comments, favorites, tags, and user following. Includes Testcontainers integration tests.
223
+
224
+ Medium.com clone (Conduit) implementing the RealWorld specification with full CRUD operations, JWT authentication, article management, comments, favorites, tags, and user following. Demonstrates MicroProfile JWT, JAX-RS REST API design, JPA with PostgreSQL, password hashing (BCrypt), slug generation, pagination, filtering, and comprehensive exception handling. Includes integration tests with Testcontainers and MicroShed testing framework.
225
+
226
+ ---
227
+
228
+ ## Contact
229
+
230
+ For any questions, feedback, or suggestions, or to submit your own agent results for the leaderboard, please contact the authors:
231
+
232
+ | Name | Email |
233
+ | -------------- | ---------------------------------------- |
234
+ | Rahul Krishna | [i.m.ralk@gmail.com](mailto:imralk+oss@gmail.com) |
235
+ | Bridget McGinn | [bridget.mcginn@ibm.com](bridget.mcginn@ibm.com) |
236
+ | Raju Pavuluri | [pavuluri@us.ibm.com](mailto:pavuluri@us.ibm.com) |
237
+
238
+ ---
239
+
240
+ ## Citation
241
+
242
+ If you use this benchmark in your research, please cite our paper:
243
+
244
+ ```bibtex
245
+ [Placeholder: BibTeX citation will be added when paper is published]
246
+ ```
247
+
248
+ ---
249
+
250
+ ## License
251
+
252
+ Apache-2.0
benchmark/business_domain/cart/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/business_domain/cart/jakarta/.mvn/wrapper/MavenWrapperDownloader.java ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright 2007-present the original author or authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import java.net.*;
17
+ import java.io.*;
18
+ import java.nio.channels.*;
19
+ import java.util.Properties;
20
+
21
+ public class MavenWrapperDownloader {
22
+
23
+ private static final String WRAPPER_VERSION = "0.5.6";
24
+ /**
25
+ * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
26
+ */
27
+ private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
28
+ + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
29
+
30
+ /**
31
+ * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
32
+ * use instead of the default one.
33
+ */
34
+ private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
35
+ ".mvn/wrapper/maven-wrapper.properties";
36
+
37
+ /**
38
+ * Path where the maven-wrapper.jar will be saved to.
39
+ */
40
+ private static final String MAVEN_WRAPPER_JAR_PATH =
41
+ ".mvn/wrapper/maven-wrapper.jar";
42
+
43
+ /**
44
+ * Name of the property which should be used to override the default download url for the wrapper.
45
+ */
46
+ private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
47
+
48
+ public static void main(String args[]) {
49
+ System.out.println("- Downloader started");
50
+ File baseDirectory = new File(args[0]);
51
+ System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
52
+
53
+ // If the maven-wrapper.properties exists, read it and check if it contains a custom
54
+ // wrapperUrl parameter.
55
+ File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
56
+ String url = DEFAULT_DOWNLOAD_URL;
57
+ if(mavenWrapperPropertyFile.exists()) {
58
+ FileInputStream mavenWrapperPropertyFileInputStream = null;
59
+ try {
60
+ mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
61
+ Properties mavenWrapperProperties = new Properties();
62
+ mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
63
+ url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
64
+ } catch (IOException e) {
65
+ System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
66
+ } finally {
67
+ try {
68
+ if(mavenWrapperPropertyFileInputStream != null) {
69
+ mavenWrapperPropertyFileInputStream.close();
70
+ }
71
+ } catch (IOException e) {
72
+ // Ignore ...
73
+ }
74
+ }
75
+ }
76
+ System.out.println("- Downloading from: " + url);
77
+
78
+ File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
79
+ if(!outputFile.getParentFile().exists()) {
80
+ if(!outputFile.getParentFile().mkdirs()) {
81
+ System.out.println(
82
+ "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
83
+ }
84
+ }
85
+ System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
86
+ try {
87
+ downloadFileFromURL(url, outputFile);
88
+ System.out.println("Done");
89
+ System.exit(0);
90
+ } catch (Throwable e) {
91
+ System.out.println("- Error downloading");
92
+ e.printStackTrace();
93
+ System.exit(1);
94
+ }
95
+ }
96
+
97
+ private static void downloadFileFromURL(String urlString, File destination) throws Exception {
98
+ if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
99
+ String username = System.getenv("MVNW_USERNAME");
100
+ char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
101
+ Authenticator.setDefault(new Authenticator() {
102
+ @Override
103
+ protected PasswordAuthentication getPasswordAuthentication() {
104
+ return new PasswordAuthentication(username, password);
105
+ }
106
+ });
107
+ }
108
+ URL website = new URL(urlString);
109
+ ReadableByteChannel rbc;
110
+ rbc = Channels.newChannel(website.openStream());
111
+ FileOutputStream fos = new FileOutputStream(destination);
112
+ fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
113
+ fos.close();
114
+ rbc.close();
115
+ }
116
+
117
+ }
benchmark/business_domain/cart/jakarta/.mvn/wrapper/maven-wrapper.properties ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip
2
+ wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
benchmark/business_domain/cart/jakarta/Dockerfile ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 \
6
+ && curl -LsSf https://astral.sh/uv/install.sh | sh
7
+
8
+ ENV PATH="/root/.local/bin:$PATH"
9
+
10
+ # Shared browsers path so Chromium is cached once
11
+ ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
12
+ RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright
13
+
14
+ # create venv and install
15
+ RUN uv venv /opt/venv \
16
+ && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest
17
+
18
+ ENV PATH="/opt/venv/bin:$PATH"
19
+ RUN playwright install --with-deps chromium
20
+
21
+ WORKDIR /app
22
+
23
+ # Cache Maven dependencies separately from source (multi-module)
24
+ COPY pom.xml .
25
+ COPY cart-ejb/pom.xml cart-ejb/
26
+ COPY cart-web/pom.xml cart-web/
27
+ RUN mvn dependency:go-offline -q
28
+
29
+ # Build application
30
+ COPY . .
31
+ RUN mvn package -DskipTests -q
32
+
33
+ COPY test.sh .
34
+ RUN chmod +x test.sh
35
+
36
+ CMD ["mvn", "liberty:run"]
benchmark/business_domain/cart/jakarta/cart-ejb/pom.xml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+
4
+ Copyright (c), Eclipse Foundation, Inc. and its licensors.
5
+
6
+ All rights reserved.
7
+
8
+ This program and the accompanying materials are made available under the
9
+ terms of the Eclipse Distribution License v1.0, which is available at
10
+ https://www.eclipse.org/org/documents/edl-v10.php
11
+
12
+ SPDX-License-Identifier: BSD-3-Clause
13
+
14
+ -->
15
+ <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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
16
+ <modelVersion>4.0.0</modelVersion>
17
+ <parent>
18
+ <groupId>jakarta.examples.tutorial.ejb.cart</groupId>
19
+ <artifactId>cart</artifactId>
20
+ <version>10-SNAPSHOT</version>
21
+ <relativePath>../pom.xml</relativePath>
22
+ </parent>
23
+ <artifactId>cart-ejb</artifactId>
24
+ <version>10-SNAPSHOT</version>
25
+ <packaging>jar</packaging>
26
+
27
+ <name>cart-ejb</name>
28
+
29
+ <properties>
30
+ <jakarta.ejb.version>3.2</jakarta.ejb.version>
31
+ <maven.compiler.source>17</maven.compiler.source>
32
+ <maven.compiler.target>17</maven.compiler.target>
33
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
34
+ </properties>
35
+
36
+ </project>
benchmark/business_domain/cart/jakarta/cart-ejb/src/main/java/jakarta/tutorial/cart/ejb/Cart.java ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (c), Eclipse Foundation, Inc. and its licensors.
3
+ *
4
+ * All rights reserved.
5
+ *
6
+ * This program and the accompanying materials are made available under the
7
+ * terms of the Eclipse Distribution License v1.0, which is available at
8
+ * https://www.eclipse.org/org/documents/edl-v10.php
9
+ *
10
+ * SPDX-License-Identifier: BSD-3-Clause
11
+ */
12
+ package jakarta.tutorial.cart.ejb;
13
+
14
+
15
+ import java.util.List;
16
+
17
+ import jakarta.ejb.Remote;
18
+ import jakarta.tutorial.cart.util.BookException;
19
+
20
+
21
+ @Remote
22
+ public interface Cart {
23
+ public void initialize(String person) throws BookException;
24
+
25
+ public void initialize(
26
+ String person,
27
+ String id) throws BookException;
28
+
29
+ public void addBook(String title);
30
+
31
+ public void removeBook(String title) throws BookException;
32
+
33
+ public List<String> getContents();
34
+
35
+ public void remove();
36
+ }
benchmark/business_domain/cart/jakarta/cart-ejb/src/main/java/jakarta/tutorial/cart/ejb/CartBean.java ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (c), Eclipse Foundation, Inc. and its licensors.
3
+ *
4
+ * All rights reserved.
5
+ *
6
+ * This program and the accompanying materials are made available under the
7
+ * terms of the Eclipse Distribution License v1.0, which is available at
8
+ * https://www.eclipse.org/org/documents/edl-v10.php
9
+ *
10
+ * SPDX-License-Identifier: BSD-3-Clause
11
+ */
12
+ package jakarta.tutorial.cart.ejb;
13
+
14
+ import java.io.Serializable;
15
+ import java.util.ArrayList;
16
+ import java.util.List;
17
+
18
+ import jakarta.ejb.Stateful;
19
+ import jakarta.tutorial.cart.util.BookException;
20
+ import jakarta.tutorial.cart.util.IdVerifier;
21
+
22
+ @Stateful
23
+ public class CartBean implements Cart, Serializable {
24
+
25
+ String customerId;
26
+ String customerName;
27
+ List<String> contents = new ArrayList<>();
28
+
29
+ @Override
30
+ public void initialize(String person) throws BookException {
31
+ if (person == null) {
32
+ throw new BookException("Null person not allowed.");
33
+ } else {
34
+ customerName = person;
35
+ }
36
+
37
+ customerId = "0";
38
+ contents = new ArrayList<>();
39
+ }
40
+
41
+ @Override
42
+ public void initialize(String person, String id) throws BookException {
43
+ if (person == null) {
44
+ throw new BookException("Null person not allowed.");
45
+ } else {
46
+ customerName = person;
47
+ }
48
+
49
+ IdVerifier idChecker = new IdVerifier();
50
+ if (idChecker.validate(id)) {
51
+ customerId = id;
52
+ } else {
53
+ throw new BookException("Invalid id: " + id);
54
+ }
55
+
56
+ contents = new ArrayList<>();
57
+ }
58
+
59
+ @Override
60
+ public void addBook(String title) {
61
+ contents.add(title);
62
+ }
63
+
64
+ @Override
65
+ public void removeBook(String title) throws BookException {
66
+ boolean result = contents.remove(title);
67
+
68
+ if (result == false) {
69
+ throw new BookException("\"" + title + "\" not in cart.");
70
+ }
71
+ }
72
+
73
+ @Override
74
+ public List<String> getContents() {
75
+ return contents;
76
+ }
77
+
78
+ @Override
79
+ public void remove() {
80
+ contents = new ArrayList<>();
81
+ }
82
+ }
benchmark/business_domain/cart/jakarta/cart-ejb/src/main/java/jakarta/tutorial/cart/util/BookException.java ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (c), Eclipse Foundation, Inc. and its licensors.
3
+ *
4
+ * All rights reserved.
5
+ *
6
+ * This program and the accompanying materials are made available under the
7
+ * terms of the Eclipse Distribution License v1.0, which is available at
8
+ * https://www.eclipse.org/org/documents/edl-v10.php
9
+ *
10
+ * SPDX-License-Identifier: BSD-3-Clause
11
+ */
12
+ package jakarta.tutorial.cart.util;
13
+
14
+ public class BookException extends Exception {
15
+ private static final long serialVersionUID = 6274585742564840905L;
16
+ public BookException() {
17
+ }
18
+
19
+ public BookException(String msg) {
20
+ super(msg);
21
+ }
22
+ }
benchmark/business_domain/cart/jakarta/cart-ejb/src/main/java/jakarta/tutorial/cart/util/IdVerifier.java ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (c), Eclipse Foundation, Inc. and its licensors.
3
+ *
4
+ * All rights reserved.
5
+ *
6
+ * This program and the accompanying materials are made available under the
7
+ * terms of the Eclipse Distribution License v1.0, which is available at
8
+ * https://www.eclipse.org/org/documents/edl-v10.php
9
+ *
10
+ * SPDX-License-Identifier: BSD-3-Clause
11
+ */
12
+ package jakarta.tutorial.cart.util;
13
+
14
+ public class IdVerifier {
15
+ public IdVerifier() {
16
+ }
17
+
18
+ public boolean validate(String id) {
19
+ boolean result = true;
20
+
21
+ for (int i = 0; i < id.length(); i++) {
22
+ if (Character.isDigit(id.charAt(i)) == false) {
23
+ result = false;
24
+ }
25
+ }
26
+
27
+ return result;
28
+ }
29
+ }
benchmark/business_domain/cart/jakarta/cart-ejb/src/main/resources/META-INF/MANIFEST.MF ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ Manifest-Version: 1.0
2
+
benchmark/business_domain/cart/jakarta/cart-web/pom.xml ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+
4
+ Copyright (c), Eclipse Foundation, Inc. and its licensors.
5
+
6
+ All rights reserved.
7
+
8
+ This program and the accompanying materials are made available under the
9
+ terms of the Eclipse Distribution License v1.0, which is available at
10
+ https://www.eclipse.org/org/documents/edl-v10.php
11
+
12
+ SPDX-License-Identifier: BSD-3-Clause
13
+
14
+ -->
15
+ <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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
16
+ <modelVersion>4.0.0</modelVersion>
17
+ <parent>
18
+ <groupId>jakarta.examples.tutorial.ejb.cart</groupId>
19
+ <artifactId>cart</artifactId>
20
+ <version>10-SNAPSHOT</version>
21
+ <relativePath>../pom.xml</relativePath>
22
+ </parent>
23
+ <artifactId>cart-web</artifactId>
24
+ <packaging>war</packaging>
25
+
26
+ <properties>
27
+ <maven.compiler.source>17</maven.compiler.source>
28
+ <maven.compiler.target>17</maven.compiler.target>
29
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
30
+ </properties>
31
+
32
+ <name>cart-web</name>
33
+
34
+ <dependencies>
35
+ <dependency>
36
+ <groupId>${project.groupId}</groupId>
37
+ <artifactId>cart-ejb</artifactId>
38
+ <version>${project.version}</version>
39
+ </dependency>
40
+ </dependencies>
41
+
42
+ <build>
43
+ <plugins>
44
+ <plugin>
45
+ <groupId>org.apache.maven.plugins</groupId>
46
+ <artifactId>maven-war-plugin</artifactId>
47
+ <configuration>
48
+ <failOnMissingWebXml>false</failOnMissingWebXml>
49
+ <packagingIncludes>**/*.class,**/*.xml,**/*.properties,WEB-INF/lib/*.jar</packagingIncludes>
50
+ </configuration>
51
+ </plugin>
52
+ <plugin>
53
+ <groupId>io.openliberty.tools</groupId>
54
+ <artifactId>liberty-maven-plugin</artifactId>
55
+ <configuration>
56
+ <assemblyArtifact>
57
+ <groupId>io.openliberty</groupId>
58
+ <artifactId>openliberty-kernel</artifactId>
59
+ <version>${liberty.runtime.version}</version>
60
+ <type>zip</type>
61
+ </assemblyArtifact>
62
+ <serverName>defaultServer</serverName>
63
+ <stripVersion>true</stripVersion>
64
+ <installAppPackages>project</installAppPackages>
65
+ <looseApplication>true</looseApplication>
66
+ <appsDirectory>apps</appsDirectory>
67
+ </configuration>
68
+ <executions>
69
+ <execution>
70
+ <id>package-server</id>
71
+ <phase>package</phase>
72
+ <goals>
73
+ <goal>create</goal>
74
+ <goal>install-feature</goal>
75
+ <goal>deploy</goal>
76
+ </goals>
77
+ </execution>
78
+ </executions>
79
+ </plugin>
80
+ </plugins>
81
+ </build>
82
+ </project>
benchmark/business_domain/cart/jakarta/cart-web/src/main/java/jakarta/tutorial/cart/web/CartResource.java ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (c), Eclipse Foundation, Inc. and its licensors.
3
+ *
4
+ * All rights reserved.
5
+ *
6
+ * This program and the accompanying materials are made available under the
7
+ * terms of the Eclipse Distribution License v1.0, which is available at
8
+ * https://www.eclipse.org/org/documents/edl-v10.php
9
+ *
10
+ * SPDX-License-Identifier: BSD-3-Clause
11
+ */
12
+ package jakarta.tutorial.cart.web;
13
+
14
+ import java.util.HashMap;
15
+ import java.util.List;
16
+ import java.util.Map;
17
+ import java.util.UUID;
18
+
19
+ import jakarta.ejb.EJB;
20
+ import jakarta.enterprise.context.ApplicationScoped;
21
+ import jakarta.tutorial.cart.ejb.Cart;
22
+ import jakarta.tutorial.cart.util.BookException;
23
+ import jakarta.ws.rs.Consumes;
24
+ import jakarta.ws.rs.DELETE;
25
+ import jakarta.ws.rs.GET;
26
+ import jakarta.ws.rs.POST;
27
+ import jakarta.ws.rs.Path;
28
+ import jakarta.ws.rs.PathParam;
29
+ import jakarta.ws.rs.Produces;
30
+ import jakarta.ws.rs.core.MediaType;
31
+ import jakarta.ws.rs.core.Response;
32
+
33
+ /**
34
+ * REST resource for cart operations.
35
+ * Provides HTTP endpoints to interact with the shopping cart EJB.
36
+ */
37
+ @Path("/cart")
38
+ @ApplicationScoped
39
+ @Produces(MediaType.APPLICATION_JSON)
40
+ @Consumes(MediaType.APPLICATION_JSON)
41
+ public class CartResource {
42
+
43
+ @EJB
44
+ private Cart cart;
45
+
46
+ /**
47
+ * Initialize a new cart session.
48
+ * POST /api/cart/initialize
49
+ * Body: {"customerName": "John Doe", "customerId": "123"}
50
+ */
51
+ @POST
52
+ @Path("/initialize")
53
+ public Response initializeCart(CustomerRequest request) {
54
+ try {
55
+ if (request.customerId != null && !request.customerId.isEmpty()) {
56
+ cart.initialize(request.customerName, request.customerId);
57
+ } else {
58
+ cart.initialize(request.customerName);
59
+ }
60
+
61
+ Map<String, String> response = new HashMap<>();
62
+ response.put("message", "Cart initialized successfully");
63
+ response.put("customerName", request.customerName);
64
+
65
+ return Response.ok(response).build();
66
+ } catch (BookException e) {
67
+ return Response.status(Response.Status.BAD_REQUEST)
68
+ .entity(Map.of("error", e.getMessage()))
69
+ .build();
70
+ }
71
+ }
72
+
73
+ /**
74
+ * Add a book to the cart.
75
+ * POST /api/cart/books/{title}
76
+ */
77
+ @POST
78
+ @Path("/books/{title}")
79
+ public Response addBook(@PathParam("title") String title) {
80
+ try {
81
+ cart.addBook(title);
82
+
83
+ Map<String, Object> response = new HashMap<>();
84
+ response.put("message", "Book added successfully");
85
+ response.put("title", title);
86
+ response.put("cartSize", cart.getContents().size());
87
+
88
+ return Response.ok(response).build();
89
+ } catch (Exception e) {
90
+ return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
91
+ .entity(Map.of("error", e.getMessage()))
92
+ .build();
93
+ }
94
+ }
95
+
96
+ /**
97
+ * Remove a book from the cart.
98
+ * DELETE /api/cart/books/{title}
99
+ */
100
+ @DELETE
101
+ @Path("/books/{title}")
102
+ public Response removeBook(@PathParam("title") String title) {
103
+ try {
104
+ cart.removeBook(title);
105
+
106
+ Map<String, Object> response = new HashMap<>();
107
+ response.put("message", "Book removed successfully");
108
+ response.put("title", title);
109
+ response.put("cartSize", cart.getContents().size());
110
+
111
+ return Response.ok(response).build();
112
+ } catch (BookException e) {
113
+ return Response.status(Response.Status.NOT_FOUND)
114
+ .entity(Map.of("error", e.getMessage()))
115
+ .build();
116
+ }
117
+ }
118
+
119
+ /**
120
+ * Get all books in the cart.
121
+ * GET /api/cart/books
122
+ */
123
+ @GET
124
+ @Path("/books")
125
+ public Response getBooks() {
126
+ try {
127
+ List<String> contents = cart.getContents();
128
+
129
+ Map<String, Object> response = new HashMap<>();
130
+ response.put("books", contents);
131
+ response.put("count", contents.size());
132
+
133
+ return Response.ok(response).build();
134
+ } catch (Exception e) {
135
+ return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
136
+ .entity(Map.of("error", e.getMessage()))
137
+ .build();
138
+ }
139
+ }
140
+
141
+ /**
142
+ * Clear the cart and end the session.
143
+ * DELETE /api/cart
144
+ */
145
+ @DELETE
146
+ public Response clearCart() {
147
+ try {
148
+ cart.remove();
149
+
150
+ return Response.ok(Map.of("message", "Cart cleared successfully")).build();
151
+ } catch (Exception e) {
152
+ return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
153
+ .entity(Map.of("error", e.getMessage()))
154
+ .build();
155
+ }
156
+ }
157
+
158
+ /**
159
+ * Health check endpoint.
160
+ * GET /api/cart/health
161
+ */
162
+ @GET
163
+ @Path("/health")
164
+ public Response health() {
165
+ return Response.ok(Map.of("status", "UP", "service", "cart-api")).build();
166
+ }
167
+
168
+ // Request/Response DTOs
169
+ public static class CustomerRequest {
170
+ public String customerName;
171
+ public String customerId;
172
+ }
173
+ }
benchmark/business_domain/cart/jakarta/cart-web/src/main/java/jakarta/tutorial/cart/web/RestApplication.java ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (c), Eclipse Foundation, Inc. and its licensors.
3
+ *
4
+ * All rights reserved.
5
+ *
6
+ * This program and the accompanying materials are made available under the
7
+ * terms of the Eclipse Distribution License v1.0, which is available at
8
+ * https://www.eclipse.org/org/documents/edl-v10.php
9
+ *
10
+ * SPDX-License-Identifier: BSD-3-Clause
11
+ */
12
+ package jakarta.tutorial.cart.web;
13
+
14
+ import jakarta.ws.rs.ApplicationPath;
15
+ import jakarta.ws.rs.core.Application;
16
+
17
+ /**
18
+ * JAX-RS Application configuration class.
19
+ * Maps the REST API to /api/*
20
+ */
21
+ @ApplicationPath("/api")
22
+ public class RestApplication extends Application {
23
+ // No additional configuration needed
24
+ // JAX-RS will auto-discover resource classes
25
+ }
benchmark/business_domain/cart/jakarta/cart-web/src/main/liberty/config/server.xml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <server description="Cart Application Server">
3
+
4
+ <!-- Enable features -->
5
+ <featureManager>
6
+ <feature>jakartaee-9.1</feature>
7
+ <feature>localConnector-1.0</feature>
8
+ </featureManager>
9
+
10
+ <!-- HTTP endpoint -->
11
+ <httpEndpoint id="defaultHttpEndpoint"
12
+ httpPort="9080"
13
+ httpsPort="9443"
14
+ host="*" />
15
+
16
+ <!-- Automatically expand WAR files -->
17
+ <applicationManager autoExpand="true"/>
18
+
19
+ <!-- Application configuration -->
20
+ <webApplication id="cart-web"
21
+ location="cart-web.war"
22
+ name="cart-web"
23
+ contextRoot="/cart">
24
+ <application-bnd>
25
+ <security-role name="**">
26
+ <special-subject type="ALL_AUTHENTICATED_USERS" />
27
+ </security-role>
28
+ </application-bnd>
29
+ </webApplication>
30
+
31
+ <!-- Basic user registry for development -->
32
+ <basicRegistry id="basic" realm="BasicRealm">
33
+ <user name="admin" password="admin" />
34
+ </basicRegistry>
35
+
36
+ <!-- Administrator role -->
37
+ <administrator-role>
38
+ <user>admin</user>
39
+ </administrator-role>
40
+
41
+ <!-- Logging configuration -->
42
+ <logging consoleLogLevel="INFO"
43
+ consoleFormat="simple"
44
+ consoleSource="message,trace,accessLog,ffdc,audit" />
45
+
46
+ </server>
benchmark/business_domain/cart/jakarta/cart-web/src/main/webapp/WEB-INF/beans.xml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
3
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+ xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd"
5
+ version="3.0"
6
+ bean-discovery-mode="all">
7
+ </beans>
benchmark/business_domain/cart/jakarta/mvnw ADDED
@@ -0,0 +1,310 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # http://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
+ # Maven Start Up Batch script
23
+ #
24
+ # Required ENV vars:
25
+ # ------------------
26
+ # JAVA_HOME - location of a JDK home dir
27
+ #
28
+ # Optional ENV vars
29
+ # -----------------
30
+ # M2_HOME - location of maven2's installed home dir
31
+ # MAVEN_OPTS - parameters passed to the Java VM when running Maven
32
+ # e.g. to debug Maven itself, use
33
+ # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
34
+ # MAVEN_SKIP_RC - flag to disable loading of mavenrc files
35
+ # ----------------------------------------------------------------------------
36
+
37
+ if [ -z "$MAVEN_SKIP_RC" ] ; then
38
+
39
+ if [ -f /etc/mavenrc ] ; then
40
+ . /etc/mavenrc
41
+ fi
42
+
43
+ if [ -f "$HOME/.mavenrc" ] ; then
44
+ . "$HOME/.mavenrc"
45
+ fi
46
+
47
+ fi
48
+
49
+ # OS specific support. $var _must_ be set to either true or false.
50
+ cygwin=false;
51
+ darwin=false;
52
+ mingw=false
53
+ case "`uname`" in
54
+ CYGWIN*) cygwin=true ;;
55
+ MINGW*) mingw=true;;
56
+ Darwin*) darwin=true
57
+ # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
58
+ # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
59
+ if [ -z "$JAVA_HOME" ]; then
60
+ if [ -x "/usr/libexec/java_home" ]; then
61
+ export JAVA_HOME="`/usr/libexec/java_home`"
62
+ else
63
+ export JAVA_HOME="/Library/Java/Home"
64
+ fi
65
+ fi
66
+ ;;
67
+ esac
68
+
69
+ if [ -z "$JAVA_HOME" ] ; then
70
+ if [ -r /etc/gentoo-release ] ; then
71
+ JAVA_HOME=`java-config --jre-home`
72
+ fi
73
+ fi
74
+
75
+ if [ -z "$M2_HOME" ] ; then
76
+ ## resolve links - $0 may be a link to maven's home
77
+ PRG="$0"
78
+
79
+ # need this for relative symlinks
80
+ while [ -h "$PRG" ] ; do
81
+ ls=`ls -ld "$PRG"`
82
+ link=`expr "$ls" : '.*-> \(.*\)$'`
83
+ if expr "$link" : '/.*' > /dev/null; then
84
+ PRG="$link"
85
+ else
86
+ PRG="`dirname "$PRG"`/$link"
87
+ fi
88
+ done
89
+
90
+ saveddir=`pwd`
91
+
92
+ M2_HOME=`dirname "$PRG"`/..
93
+
94
+ # make it fully qualified
95
+ M2_HOME=`cd "$M2_HOME" && pwd`
96
+
97
+ cd "$saveddir"
98
+ # echo Using m2 at $M2_HOME
99
+ fi
100
+
101
+ # For Cygwin, ensure paths are in UNIX format before anything is touched
102
+ if $cygwin ; then
103
+ [ -n "$M2_HOME" ] &&
104
+ M2_HOME=`cygpath --unix "$M2_HOME"`
105
+ [ -n "$JAVA_HOME" ] &&
106
+ JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
107
+ [ -n "$CLASSPATH" ] &&
108
+ CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
109
+ fi
110
+
111
+ # For Mingw, ensure paths are in UNIX format before anything is touched
112
+ if $mingw ; then
113
+ [ -n "$M2_HOME" ] &&
114
+ M2_HOME="`(cd "$M2_HOME"; pwd)`"
115
+ [ -n "$JAVA_HOME" ] &&
116
+ JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
117
+ fi
118
+
119
+ if [ -z "$JAVA_HOME" ]; then
120
+ javaExecutable="`which javac`"
121
+ if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
122
+ # readlink(1) is not available as standard on Solaris 10.
123
+ readLink=`which readlink`
124
+ if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
125
+ if $darwin ; then
126
+ javaHome="`dirname \"$javaExecutable\"`"
127
+ javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
128
+ else
129
+ javaExecutable="`readlink -f \"$javaExecutable\"`"
130
+ fi
131
+ javaHome="`dirname \"$javaExecutable\"`"
132
+ javaHome=`expr "$javaHome" : '\(.*\)/bin'`
133
+ JAVA_HOME="$javaHome"
134
+ export JAVA_HOME
135
+ fi
136
+ fi
137
+ fi
138
+
139
+ if [ -z "$JAVACMD" ] ; then
140
+ if [ -n "$JAVA_HOME" ] ; then
141
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
142
+ # IBM's JDK on AIX uses strange locations for the executables
143
+ JAVACMD="$JAVA_HOME/jre/sh/java"
144
+ else
145
+ JAVACMD="$JAVA_HOME/bin/java"
146
+ fi
147
+ else
148
+ JAVACMD="`which java`"
149
+ fi
150
+ fi
151
+
152
+ if [ ! -x "$JAVACMD" ] ; then
153
+ echo "Error: JAVA_HOME is not defined correctly." >&2
154
+ echo " We cannot execute $JAVACMD" >&2
155
+ exit 1
156
+ fi
157
+
158
+ if [ -z "$JAVA_HOME" ] ; then
159
+ echo "Warning: JAVA_HOME environment variable is not set."
160
+ fi
161
+
162
+ CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
163
+
164
+ # traverses directory structure from process work directory to filesystem root
165
+ # first directory with .mvn subdirectory is considered project base directory
166
+ find_maven_basedir() {
167
+
168
+ if [ -z "$1" ]
169
+ then
170
+ echo "Path not specified to find_maven_basedir"
171
+ return 1
172
+ fi
173
+
174
+ basedir="$1"
175
+ wdir="$1"
176
+ while [ "$wdir" != '/' ] ; do
177
+ if [ -d "$wdir"/.mvn ] ; then
178
+ basedir=$wdir
179
+ break
180
+ fi
181
+ # workaround for JBEAP-8937 (on Solaris 10/Sparc)
182
+ if [ -d "${wdir}" ]; then
183
+ wdir=`cd "$wdir/.."; pwd`
184
+ fi
185
+ # end of workaround
186
+ done
187
+ echo "${basedir}"
188
+ }
189
+
190
+ # concatenates all lines of a file
191
+ concat_lines() {
192
+ if [ -f "$1" ]; then
193
+ echo "$(tr -s '\n' ' ' < "$1")"
194
+ fi
195
+ }
196
+
197
+ BASE_DIR=`find_maven_basedir "$(pwd)"`
198
+ if [ -z "$BASE_DIR" ]; then
199
+ exit 1;
200
+ fi
201
+
202
+ ##########################################################################################
203
+ # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
204
+ # This allows using the maven wrapper in projects that prohibit checking in binary data.
205
+ ##########################################################################################
206
+ if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
207
+ if [ "$MVNW_VERBOSE" = true ]; then
208
+ echo "Found .mvn/wrapper/maven-wrapper.jar"
209
+ fi
210
+ else
211
+ if [ "$MVNW_VERBOSE" = true ]; then
212
+ echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
213
+ fi
214
+ if [ -n "$MVNW_REPOURL" ]; then
215
+ jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
216
+ else
217
+ jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
218
+ fi
219
+ while IFS="=" read key value; do
220
+ case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
221
+ esac
222
+ done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
223
+ if [ "$MVNW_VERBOSE" = true ]; then
224
+ echo "Downloading from: $jarUrl"
225
+ fi
226
+ wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
227
+ if $cygwin; then
228
+ wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
229
+ fi
230
+
231
+ if command -v wget > /dev/null; then
232
+ if [ "$MVNW_VERBOSE" = true ]; then
233
+ echo "Found wget ... using wget"
234
+ fi
235
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
236
+ wget "$jarUrl" -O "$wrapperJarPath"
237
+ else
238
+ wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
239
+ fi
240
+ elif command -v curl > /dev/null; then
241
+ if [ "$MVNW_VERBOSE" = true ]; then
242
+ echo "Found curl ... using curl"
243
+ fi
244
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
245
+ curl -o "$wrapperJarPath" "$jarUrl" -f
246
+ else
247
+ curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
248
+ fi
249
+
250
+ else
251
+ if [ "$MVNW_VERBOSE" = true ]; then
252
+ echo "Falling back to using Java to download"
253
+ fi
254
+ javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
255
+ # For Cygwin, switch paths to Windows format before running javac
256
+ if $cygwin; then
257
+ javaClass=`cygpath --path --windows "$javaClass"`
258
+ fi
259
+ if [ -e "$javaClass" ]; then
260
+ if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
261
+ if [ "$MVNW_VERBOSE" = true ]; then
262
+ echo " - Compiling MavenWrapperDownloader.java ..."
263
+ fi
264
+ # Compiling the Java class
265
+ ("$JAVA_HOME/bin/javac" "$javaClass")
266
+ fi
267
+ if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
268
+ # Running the downloader
269
+ if [ "$MVNW_VERBOSE" = true ]; then
270
+ echo " - Running MavenWrapperDownloader.java ..."
271
+ fi
272
+ ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
273
+ fi
274
+ fi
275
+ fi
276
+ fi
277
+ ##########################################################################################
278
+ # End of extension
279
+ ##########################################################################################
280
+
281
+ export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
282
+ if [ "$MVNW_VERBOSE" = true ]; then
283
+ echo $MAVEN_PROJECTBASEDIR
284
+ fi
285
+ MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
286
+
287
+ # For Cygwin, switch paths to Windows format before running java
288
+ if $cygwin; then
289
+ [ -n "$M2_HOME" ] &&
290
+ M2_HOME=`cygpath --path --windows "$M2_HOME"`
291
+ [ -n "$JAVA_HOME" ] &&
292
+ JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
293
+ [ -n "$CLASSPATH" ] &&
294
+ CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
295
+ [ -n "$MAVEN_PROJECTBASEDIR" ] &&
296
+ MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
297
+ fi
298
+
299
+ # Provide a "standardized" way to retrieve the CLI args that will
300
+ # work with both Windows and non-Windows executions.
301
+ MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
302
+ export MAVEN_CMD_LINE_ARGS
303
+
304
+ WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
305
+
306
+ exec "$JAVACMD" \
307
+ $MAVEN_OPTS \
308
+ -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
309
+ "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
310
+ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
benchmark/business_domain/cart/jakarta/mvnw.cmd ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @REM ----------------------------------------------------------------------------
2
+ @REM Licensed to the Apache Software Foundation (ASF) under one
3
+ @REM or more contributor license agreements. See the NOTICE file
4
+ @REM distributed with this work for additional information
5
+ @REM regarding copyright ownership. The ASF licenses this file
6
+ @REM to you under the Apache License, Version 2.0 (the
7
+ @REM "License"); you may not use this file except in compliance
8
+ @REM with the License. You may obtain a copy of the License at
9
+ @REM
10
+ @REM http://www.apache.org/licenses/LICENSE-2.0
11
+ @REM
12
+ @REM Unless required by applicable law or agreed to in writing,
13
+ @REM software distributed under the License is distributed on an
14
+ @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ @REM KIND, either express or implied. See the License for the
16
+ @REM specific language governing permissions and limitations
17
+ @REM under the License.
18
+ @REM ----------------------------------------------------------------------------
19
+
20
+ @REM ----------------------------------------------------------------------------
21
+ @REM Maven Start Up Batch script
22
+ @REM
23
+ @REM Required ENV vars:
24
+ @REM JAVA_HOME - location of a JDK home dir
25
+ @REM
26
+ @REM Optional ENV vars
27
+ @REM M2_HOME - location of maven2's installed home dir
28
+ @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
29
+ @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
30
+ @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
31
+ @REM e.g. to debug Maven itself, use
32
+ @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
33
+ @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
34
+ @REM ----------------------------------------------------------------------------
35
+
36
+ @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
37
+ @echo off
38
+ @REM set title of command window
39
+ title %0
40
+ @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
41
+ @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
42
+
43
+ @REM set %HOME% to equivalent of $HOME
44
+ if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
45
+
46
+ @REM Execute a user defined script before this one
47
+ if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
48
+ @REM check for pre script, once with legacy .bat ending and once with .cmd ending
49
+ if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
50
+ if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
51
+ :skipRcPre
52
+
53
+ @setlocal
54
+
55
+ set ERROR_CODE=0
56
+
57
+ @REM To isolate internal variables from possible post scripts, we use another setlocal
58
+ @setlocal
59
+
60
+ @REM ==== START VALIDATION ====
61
+ if not "%JAVA_HOME%" == "" goto OkJHome
62
+
63
+ echo.
64
+ echo Error: JAVA_HOME not found in your environment. >&2
65
+ echo Please set the JAVA_HOME variable in your environment to match the >&2
66
+ echo location of your Java installation. >&2
67
+ echo.
68
+ goto error
69
+
70
+ :OkJHome
71
+ if exist "%JAVA_HOME%\bin\java.exe" goto init
72
+
73
+ echo.
74
+ echo Error: JAVA_HOME is set to an invalid directory. >&2
75
+ echo JAVA_HOME = "%JAVA_HOME%" >&2
76
+ echo Please set the JAVA_HOME variable in your environment to match the >&2
77
+ echo location of your Java installation. >&2
78
+ echo.
79
+ goto error
80
+
81
+ @REM ==== END VALIDATION ====
82
+
83
+ :init
84
+
85
+ @REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
86
+ @REM Fallback to current working directory if not found.
87
+
88
+ set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
89
+ IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
90
+
91
+ set EXEC_DIR=%CD%
92
+ set WDIR=%EXEC_DIR%
93
+ :findBaseDir
94
+ IF EXIST "%WDIR%"\.mvn goto baseDirFound
95
+ cd ..
96
+ IF "%WDIR%"=="%CD%" goto baseDirNotFound
97
+ set WDIR=%CD%
98
+ goto findBaseDir
99
+
100
+ :baseDirFound
101
+ set MAVEN_PROJECTBASEDIR=%WDIR%
102
+ cd "%EXEC_DIR%"
103
+ goto endDetectBaseDir
104
+
105
+ :baseDirNotFound
106
+ set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
107
+ cd "%EXEC_DIR%"
108
+
109
+ :endDetectBaseDir
110
+
111
+ IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
112
+
113
+ @setlocal EnableExtensions EnableDelayedExpansion
114
+ for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
115
+ @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
116
+
117
+ :endReadAdditionalConfig
118
+
119
+ SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
120
+ set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
121
+ set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
122
+
123
+ set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
124
+
125
+ FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
126
+ IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
127
+ )
128
+
129
+ @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
130
+ @REM This allows using the maven wrapper in projects that prohibit checking in binary data.
131
+ if exist %WRAPPER_JAR% (
132
+ if "%MVNW_VERBOSE%" == "true" (
133
+ echo Found %WRAPPER_JAR%
134
+ )
135
+ ) else (
136
+ if not "%MVNW_REPOURL%" == "" (
137
+ SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
138
+ )
139
+ if "%MVNW_VERBOSE%" == "true" (
140
+ echo Couldn't find %WRAPPER_JAR%, downloading it ...
141
+ echo Downloading from: %DOWNLOAD_URL%
142
+ )
143
+
144
+ powershell -Command "&{"^
145
+ "$webclient = new-object System.Net.WebClient;"^
146
+ "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
147
+ "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
148
+ "}"^
149
+ "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
150
+ "}"
151
+ if "%MVNW_VERBOSE%" == "true" (
152
+ echo Finished downloading %WRAPPER_JAR%
153
+ )
154
+ )
155
+ @REM End of extension
156
+
157
+ @REM Provide a "standardized" way to retrieve the CLI args that will
158
+ @REM work with both Windows and non-Windows executions.
159
+ set MAVEN_CMD_LINE_ARGS=%*
160
+
161
+ %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
162
+ if ERRORLEVEL 1 goto error
163
+ goto end
164
+
165
+ :error
166
+ set ERROR_CODE=1
167
+
168
+ :end
169
+ @endlocal & set ERROR_CODE=%ERROR_CODE%
170
+
171
+ if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
172
+ @REM check for post script, once with legacy .bat ending and once with .cmd ending
173
+ if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
174
+ if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
175
+ :skipRcPost
176
+
177
+ @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
178
+ if "%MAVEN_BATCH_PAUSE%" == "on" pause
179
+
180
+ if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
181
+
182
+ exit /B %ERROR_CODE%
benchmark/business_domain/cart/jakarta/pom.xml ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+
4
+ Copyright (c), Eclipse Foundation, Inc. and its licensors.
5
+
6
+ All rights reserved.
7
+
8
+ This program and the accompanying materials are made available under the
9
+ terms of the Eclipse Distribution License v1.0, which is available at
10
+ https://www.eclipse.org/org/documents/edl-v10.php
11
+
12
+ SPDX-License-Identifier: BSD-3-Clause
13
+
14
+ -->
15
+ <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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
16
+ <modelVersion>4.0.0</modelVersion>
17
+
18
+ <groupId>jakarta.examples.tutorial.ejb.cart</groupId>
19
+ <artifactId>cart</artifactId>
20
+ <version>10-SNAPSHOT</version>
21
+ <packaging>pom</packaging>
22
+
23
+ <name>cart</name>
24
+
25
+ <properties>
26
+ <maven.compiler.plugin.version>3.8.1</maven.compiler.plugin.version>
27
+ <maven.war.plugin.version>3.3.1</maven.war.plugin.version>
28
+ <maven.ejb.plugin.version>3.1.0</maven.ejb.plugin.version>
29
+ <maven.ear.plugin.version>3.1.0</maven.ear.plugin.version>
30
+ <maven.acr.plugin.version>3.1.0</maven.acr.plugin.version>
31
+ <maven.rar.plugin.version>2.4</maven.rar.plugin.version>
32
+ <maven.exec.plugin.version>3.0.0</maven.exec.plugin.version>
33
+ <liberty.maven.plugin.version>3.10.3</liberty.maven.plugin.version>
34
+ <liberty.runtime.version>24.0.0.11</liberty.runtime.version>
35
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
36
+ <jakarta.jakartaee-api.version>9.0.0</jakarta.jakartaee-api.version>
37
+ </properties>
38
+
39
+ <modules>
40
+ <module>cart-ejb</module>
41
+ <module>cart-web</module>
42
+ </modules>
43
+
44
+ <dependencies>
45
+ <dependency>
46
+ <groupId>jakarta.platform</groupId>
47
+ <artifactId>jakarta.jakartaee-api</artifactId>
48
+ <version>${jakarta.jakartaee-api.version}</version>
49
+ <scope>provided</scope>
50
+ </dependency>
51
+ </dependencies>
52
+
53
+ <build>
54
+ <finalName>${project.artifactId}</finalName>
55
+ <pluginManagement>
56
+ <plugins>
57
+ <plugin>
58
+ <groupId>org.apache.maven.plugins</groupId>
59
+ <artifactId>maven-compiler-plugin</artifactId>
60
+ <version>${maven.compiler.plugin.version}</version>
61
+ </plugin>
62
+ <plugin>
63
+ <groupId>org.apache.maven.plugins</groupId>
64
+ <artifactId>maven-war-plugin</artifactId>
65
+ <version>${maven.war.plugin.version}</version>
66
+ </plugin>
67
+ <plugin>
68
+ <groupId>org.apache.maven.plugins</groupId>
69
+ <artifactId>maven-ejb-plugin</artifactId>
70
+ <version>${maven.ejb.plugin.version}</version>
71
+ </plugin>
72
+ <plugin>
73
+ <groupId>org.apache.maven.plugins</groupId>
74
+ <artifactId>maven-ear-plugin</artifactId>
75
+ <version>${maven.ear.plugin.version}</version>
76
+ </plugin>
77
+ <plugin>
78
+ <groupId>org.apache.maven.plugins</groupId>
79
+ <artifactId>maven-acr-plugin</artifactId>
80
+ <version>${maven.acr.plugin.version}</version>
81
+ </plugin>
82
+ <plugin>
83
+ <groupId>org.codehaus.mojo</groupId>
84
+ <artifactId>exec-maven-plugin</artifactId>
85
+ <version>${maven.exec.plugin.version}</version>
86
+ </plugin>
87
+ <plugin>
88
+ <groupId>org.apache.maven.plugins</groupId>
89
+ <artifactId>maven-rar-plugin</artifactId>
90
+ <version>${maven.rar.plugin.version}</version>
91
+ </plugin>
92
+ <plugin>
93
+ <groupId>io.openliberty.tools</groupId>
94
+ <artifactId>liberty-maven-plugin</artifactId>
95
+ <version>${liberty.maven.plugin.version}</version>
96
+ </plugin>
97
+ </plugins>
98
+ </pluginManagement>
99
+
100
+ <plugins>
101
+ <plugin>
102
+ <groupId>org.apache.maven.plugins</groupId>
103
+ <artifactId>maven-compiler-plugin</artifactId>
104
+ <configuration>
105
+ <source>11</source>
106
+ <target>11</target>
107
+ </configuration>
108
+ </plugin>
109
+ </plugins>
110
+ </build>
111
+
112
+ </project>
benchmark/business_domain/cart/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:9080/cart}"
5
+
6
+ echo "Health check: ${BASE_URL}"
7
+ HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}")
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/business_domain/cart/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/business_domain/cart/quarkus/.mvn/wrapper/MavenWrapperDownloader.java ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright 2007-present the original author or authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import java.net.*;
17
+ import java.io.*;
18
+ import java.nio.channels.*;
19
+ import java.util.Properties;
20
+
21
+ public class MavenWrapperDownloader {
22
+
23
+ private static final String WRAPPER_VERSION = "0.5.6";
24
+ /**
25
+ * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
26
+ */
27
+ private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
28
+ + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
29
+
30
+ /**
31
+ * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
32
+ * use instead of the default one.
33
+ */
34
+ private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
35
+ ".mvn/wrapper/maven-wrapper.properties";
36
+
37
+ /**
38
+ * Path where the maven-wrapper.jar will be saved to.
39
+ */
40
+ private static final String MAVEN_WRAPPER_JAR_PATH =
41
+ ".mvn/wrapper/maven-wrapper.jar";
42
+
43
+ /**
44
+ * Name of the property which should be used to override the default download url for the wrapper.
45
+ */
46
+ private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
47
+
48
+ public static void main(String args[]) {
49
+ System.out.println("- Downloader started");
50
+ File baseDirectory = new File(args[0]);
51
+ System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
52
+
53
+ // If the maven-wrapper.properties exists, read it and check if it contains a custom
54
+ // wrapperUrl parameter.
55
+ File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
56
+ String url = DEFAULT_DOWNLOAD_URL;
57
+ if(mavenWrapperPropertyFile.exists()) {
58
+ FileInputStream mavenWrapperPropertyFileInputStream = null;
59
+ try {
60
+ mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
61
+ Properties mavenWrapperProperties = new Properties();
62
+ mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
63
+ url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
64
+ } catch (IOException e) {
65
+ System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
66
+ } finally {
67
+ try {
68
+ if(mavenWrapperPropertyFileInputStream != null) {
69
+ mavenWrapperPropertyFileInputStream.close();
70
+ }
71
+ } catch (IOException e) {
72
+ // Ignore ...
73
+ }
74
+ }
75
+ }
76
+ System.out.println("- Downloading from: " + url);
77
+
78
+ File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
79
+ if(!outputFile.getParentFile().exists()) {
80
+ if(!outputFile.getParentFile().mkdirs()) {
81
+ System.out.println(
82
+ "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
83
+ }
84
+ }
85
+ System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
86
+ try {
87
+ downloadFileFromURL(url, outputFile);
88
+ System.out.println("Done");
89
+ System.exit(0);
90
+ } catch (Throwable e) {
91
+ System.out.println("- Error downloading");
92
+ e.printStackTrace();
93
+ System.exit(1);
94
+ }
95
+ }
96
+
97
+ private static void downloadFileFromURL(String urlString, File destination) throws Exception {
98
+ if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
99
+ String username = System.getenv("MVNW_USERNAME");
100
+ char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
101
+ Authenticator.setDefault(new Authenticator() {
102
+ @Override
103
+ protected PasswordAuthentication getPasswordAuthentication() {
104
+ return new PasswordAuthentication(username, password);
105
+ }
106
+ });
107
+ }
108
+ URL website = new URL(urlString);
109
+ ReadableByteChannel rbc;
110
+ rbc = Channels.newChannel(website.openStream());
111
+ FileOutputStream fos = new FileOutputStream(destination);
112
+ fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
113
+ fos.close();
114
+ rbc.close();
115
+ }
116
+
117
+ }
benchmark/business_domain/cart/quarkus/.mvn/wrapper/maven-wrapper.properties ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip
2
+ wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
benchmark/business_domain/cart/quarkus/Dockerfile ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 \
6
+ && curl -LsSf https://astral.sh/uv/install.sh | sh
7
+
8
+ ENV PATH="/root/.local/bin:$PATH"
9
+
10
+ # Shared browsers path so Chromium is cached once
11
+ ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
12
+ RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright
13
+
14
+ # create venv and install
15
+ RUN uv venv /opt/venv \
16
+ && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest
17
+
18
+ ENV PATH="/opt/venv/bin:$PATH"
19
+ RUN playwright install --with-deps chromium
20
+
21
+ WORKDIR /app
22
+
23
+ # Cache Maven dependencies separately from source (multi-module)
24
+ COPY pom.xml .
25
+ COPY cart-ejb/pom.xml cart-ejb/
26
+ COPY cart-web/pom.xml cart-web/
27
+ RUN mvn dependency:go-offline -q
28
+
29
+ # Build application
30
+ COPY . .
31
+ RUN mvn install -pl cart-web -am -DskipTests -q
32
+
33
+ COPY test.sh .
34
+ RUN chmod +x test.sh
35
+
36
+ CMD ["java", "-jar", "cart-web/target/quarkus-app/quarkus-run.jar"]
benchmark/business_domain/cart/quarkus/cart-ejb/pom.xml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
+ xmlns="http://maven.apache.org/POM/4.0.0"
4
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
+ <modelVersion>4.0.0</modelVersion>
6
+ <parent>
7
+ <groupId>quarkus.examples.tutorial.cart</groupId>
8
+ <artifactId>parent</artifactId>
9
+ <version>1.0.0-SNAPSHOT</version>
10
+ <relativePath>../pom.xml</relativePath>
11
+ </parent>
12
+ <artifactId>cart-ejb</artifactId>
13
+ <name>cart-ejb</name>
14
+
15
+ <properties>
16
+ <maven.compiler.release>17</maven.compiler.release>
17
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
18
+ </properties>
19
+
20
+ <dependencies>
21
+ <dependency>
22
+ <groupId>io.quarkus</groupId>
23
+ <artifactId>quarkus-arc</artifactId>
24
+ </dependency>
25
+ </dependencies>
26
+
27
+ <build>
28
+ <plugins>
29
+ <plugin>
30
+ <groupId>io.smallrye</groupId>
31
+ <artifactId>jandex-maven-plugin</artifactId>
32
+ <version>3.5.0</version>
33
+ <executions>
34
+ <execution>
35
+ <id>make-index</id>
36
+ <goals>
37
+ <goal>jandex</goal>
38
+ </goals>
39
+ </execution>
40
+ </executions>
41
+ </plugin>
42
+ </plugins>
43
+ </build>
44
+
45
+ </project>
benchmark/business_domain/cart/quarkus/cart-ejb/src/main/java/quarkus/tutorial/cart/service/Cart.java ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package quarkus.tutorial.cart.service;
2
+
3
+ import java.util.List;
4
+ import quarkus.tutorial.cart.util.BookException;
5
+
6
+ public interface Cart {
7
+ public void initialize(String person) throws BookException;
8
+
9
+ public void initialize(
10
+ String person,
11
+ String id) throws BookException;
12
+
13
+ public void addBook(String title);
14
+
15
+ public void removeBook(String title) throws BookException;
16
+
17
+ public List<String> getContents();
18
+
19
+ public void remove();
20
+ }
benchmark/business_domain/cart/quarkus/cart-ejb/src/main/java/quarkus/tutorial/cart/service/CartBean.java ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package quarkus.tutorial.cart.service;
2
+
3
+ import java.io.Serializable;
4
+ import java.util.ArrayList;
5
+ import java.util.List;
6
+ import jakarta.enterprise.context.SessionScoped;
7
+ import quarkus.tutorial.cart.util.BookException;
8
+ import quarkus.tutorial.cart.util.IdVerifier;
9
+
10
+ @SessionScoped
11
+ public class CartBean implements Cart, Serializable {
12
+
13
+ String customerId;
14
+ String customerName;
15
+ List<String> contents = new ArrayList<>();
16
+
17
+ @Override
18
+ public void initialize(String person) throws BookException {
19
+ if (person == null) {
20
+ throw new BookException("Null person not allowed.");
21
+ } else {
22
+ customerName = person;
23
+ }
24
+
25
+ customerId = "0";
26
+ contents = new ArrayList<>();
27
+ }
28
+
29
+ @Override
30
+ public void initialize(String person, String id) throws BookException {
31
+ if (person == null) {
32
+ throw new BookException("Null person not allowed.");
33
+ } else {
34
+ customerName = person;
35
+ }
36
+
37
+ IdVerifier idChecker = new IdVerifier();
38
+ if (idChecker.validate(id)) {
39
+ customerId = id;
40
+ } else {
41
+ throw new BookException("Invalid id: " + id);
42
+ }
43
+
44
+ contents = new ArrayList<>();
45
+ }
46
+
47
+ @Override
48
+ public void addBook(String title) {
49
+ contents.add(title);
50
+ }
51
+
52
+ @Override
53
+ public void removeBook(String title) throws BookException {
54
+ boolean result = contents.remove(title);
55
+
56
+ if (result == false) {
57
+ throw new BookException("\"" + title + "\" not in cart.");
58
+ }
59
+ }
60
+
61
+ @Override
62
+ public List<String> getContents() {
63
+ return contents;
64
+ }
65
+
66
+ @Override
67
+ public void remove() {
68
+ contents = new ArrayList<>();
69
+ }
70
+ }
benchmark/business_domain/cart/quarkus/cart-ejb/src/main/java/quarkus/tutorial/cart/util/BookException.java ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package quarkus.tutorial.cart.util;
2
+
3
+ public class BookException extends Exception {
4
+ private static final long serialVersionUID = 6274585742564840905L;
5
+
6
+ public BookException() {}
7
+
8
+ public BookException(String msg) {
9
+ super(msg);
10
+ }
11
+ }
benchmark/business_domain/cart/quarkus/cart-ejb/src/main/java/quarkus/tutorial/cart/util/IdVerifier.java ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package quarkus.tutorial.cart.util;
2
+
3
+ public class IdVerifier {
4
+ public IdVerifier() {}
5
+
6
+ public boolean validate(String id) {
7
+ boolean result = true;
8
+
9
+ for (int i = 0; i < id.length(); i++) {
10
+ if (Character.isDigit(id.charAt(i)) == false) {
11
+ result = false;
12
+ }
13
+ }
14
+
15
+ return result;
16
+ }
17
+ }
benchmark/business_domain/cart/quarkus/cart-web/pom.xml ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
+ xmlns="http://maven.apache.org/POM/4.0.0"
4
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
+ <modelVersion>4.0.0</modelVersion>
6
+ <parent>
7
+ <groupId>quarkus.examples.tutorial.cart</groupId>
8
+ <artifactId>parent</artifactId>
9
+ <version>1.0.0-SNAPSHOT</version>
10
+ <relativePath>../pom.xml</relativePath>
11
+ </parent>
12
+ <artifactId>cart-web</artifactId>
13
+ <name>cart-web</name>
14
+
15
+ <properties>
16
+ <maven.compiler.release>17</maven.compiler.release>
17
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
18
+ </properties>
19
+
20
+ <dependencies>
21
+ <dependency>
22
+ <groupId>io.quarkus</groupId>
23
+ <artifactId>quarkus-arc</artifactId>
24
+ </dependency>
25
+ <dependency>
26
+ <groupId>io.quarkus</groupId>
27
+ <artifactId>quarkus-resteasy</artifactId>
28
+ </dependency>
29
+ <dependency>
30
+ <groupId>io.quarkus</groupId>
31
+ <artifactId>quarkus-resteasy-jackson</artifactId>
32
+ </dependency>
33
+ <!-- used to invalidate the session -->
34
+ <dependency>
35
+ <groupId>io.quarkus</groupId>
36
+ <artifactId>quarkus-undertow</artifactId>
37
+ </dependency>
38
+
39
+ <dependency>
40
+ <groupId>quarkus.examples.tutorial.cart</groupId>
41
+ <artifactId>cart-ejb</artifactId>
42
+ <version>${project.version}</version>
43
+ </dependency>
44
+
45
+ <dependency>
46
+ <groupId>io.quarkus</groupId>
47
+ <artifactId>quarkus-junit5</artifactId>
48
+ <scope>test</scope>
49
+ </dependency>
50
+ <dependency>
51
+ <groupId>io.rest-assured</groupId>
52
+ <artifactId>rest-assured</artifactId>
53
+ <scope>test</scope>
54
+ </dependency>
55
+ </dependencies>
56
+
57
+ <build>
58
+ <plugins>
59
+ <plugin>
60
+ <groupId>${quarkus.platform.group-id}</groupId>
61
+ <artifactId>quarkus-maven-plugin</artifactId>
62
+ <extensions>true</extensions>
63
+ <executions>
64
+ <execution>
65
+ <goals>
66
+ <goal>build</goal>
67
+ <goal>generate-code</goal>
68
+ <goal>generate-code-tests</goal>
69
+ <goal>native-image-agent</goal>
70
+ </goals>
71
+ </execution>
72
+ </executions>
73
+ </plugin>
74
+ </plugins>
75
+ </build>
76
+
77
+ </project>
benchmark/business_domain/cart/quarkus/cart-web/src/main/docker/Dockerfile.jvm ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ####
2
+ # This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode
3
+ #
4
+ # Before building the container image run:
5
+ #
6
+ # ./mvnw package
7
+ #
8
+ # Then, build the image with:
9
+ #
10
+ # docker build -f src/main/docker/Dockerfile.jvm -t quarkus/cart-jvm .
11
+ #
12
+ # Then run the container using:
13
+ #
14
+ # docker run -i --rm -p 8080:8080 quarkus/cart-jvm
15
+ #
16
+ # If you want to include the debug port into your docker image
17
+ # you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005.
18
+ # Additionally you will have to set -e JAVA_DEBUG=true and -e JAVA_DEBUG_PORT=*:5005
19
+ # when running the container
20
+ #
21
+ # Then run the container using :
22
+ #
23
+ # docker run -i --rm -p 8080:8080 quarkus/cart-jvm
24
+ #
25
+ # This image uses the `run-java.sh` script to run the application.
26
+ # This scripts computes the command line to execute your Java application, and
27
+ # includes memory/GC tuning.
28
+ # You can configure the behavior using the following environment properties:
29
+ # - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class") - Be aware that this will override
30
+ # the default JVM options, use `JAVA_OPTS_APPEND` to append options
31
+ # - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options
32
+ # in JAVA_OPTS (example: "-Dsome.property=foo")
33
+ # - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is
34
+ # used to calculate a default maximal heap memory based on a containers restriction.
35
+ # If used in a container without any memory constraints for the container then this
36
+ # option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio
37
+ # of the container available memory as set here. The default is `50` which means 50%
38
+ # of the available memory is used as an upper boundary. You can skip this mechanism by
39
+ # setting this value to `0` in which case no `-Xmx` option is added.
40
+ # - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This
41
+ # is used to calculate a default initial heap memory based on the maximum heap memory.
42
+ # If used in a container without any memory constraints for the container then this
43
+ # option has no effect. If there is a memory constraint then `-Xms` is set to a ratio
44
+ # of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx`
45
+ # is used as the initial heap size. You can skip this mechanism by setting this value
46
+ # to `0` in which case no `-Xms` option is added (example: "25")
47
+ # - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS.
48
+ # This is used to calculate the maximum value of the initial heap memory. If used in
49
+ # a container without any memory constraints for the container then this option has
50
+ # no effect. If there is a memory constraint then `-Xms` is limited to the value set
51
+ # here. The default is 4096MB which means the calculated value of `-Xms` never will
52
+ # be greater than 4096MB. The value of this variable is expressed in MB (example: "4096")
53
+ # - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output
54
+ # when things are happening. This option, if set to true, will set
55
+ # `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true").
56
+ # - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example:
57
+ # true").
58
+ # - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787").
59
+ # - CONTAINER_CORE_LIMIT: A calculated core limit as described in
60
+ # https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2")
61
+ # - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024").
62
+ # - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion.
63
+ # (example: "20")
64
+ # - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking.
65
+ # (example: "40")
66
+ # - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection.
67
+ # (example: "4")
68
+ # - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus
69
+ # previous GC times. (example: "90")
70
+ # - GC_METASPACE_SIZE: The initial metaspace size. (example: "20")
71
+ # - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100")
72
+ # - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should
73
+ # contain the necessary JRE command-line options to specify the required GC, which
74
+ # will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC).
75
+ # - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080")
76
+ # - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080")
77
+ # - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be
78
+ # accessed directly. (example: "foo.example.com,bar.example.com")
79
+ #
80
+ ###
81
+ FROM registry.access.redhat.com/ubi9/openjdk-21:1.23
82
+
83
+ ENV LANGUAGE='en_US:en'
84
+
85
+
86
+ # We make four distinct layers so if there are application changes the library layers can be re-used
87
+ COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/
88
+ COPY --chown=185 target/quarkus-app/*.jar /deployments/
89
+ COPY --chown=185 target/quarkus-app/app/ /deployments/app/
90
+ COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/
91
+
92
+ EXPOSE 8080
93
+ USER 185
94
+ ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
95
+ ENV JAVA_APP_JAR="/deployments/quarkus-run.jar"
96
+
97
+ ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ]
98
+
benchmark/business_domain/cart/quarkus/cart-web/src/main/docker/Dockerfile.legacy-jar ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ####
2
+ # This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode
3
+ #
4
+ # Before building the container image run:
5
+ #
6
+ # ./mvnw package -Dquarkus.package.jar.type=legacy-jar
7
+ #
8
+ # Then, build the image with:
9
+ #
10
+ # docker build -f src/main/docker/Dockerfile.legacy-jar -t quarkus/cart-legacy-jar .
11
+ #
12
+ # Then run the container using:
13
+ #
14
+ # docker run -i --rm -p 8080:8080 quarkus/cart-legacy-jar
15
+ #
16
+ # If you want to include the debug port into your docker image
17
+ # you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005.
18
+ # Additionally you will have to set -e JAVA_DEBUG=true and -e JAVA_DEBUG_PORT=*:5005
19
+ # when running the container
20
+ #
21
+ # Then run the container using :
22
+ #
23
+ # docker run -i --rm -p 8080:8080 quarkus/cart-legacy-jar
24
+ #
25
+ # This image uses the `run-java.sh` script to run the application.
26
+ # This scripts computes the command line to execute your Java application, and
27
+ # includes memory/GC tuning.
28
+ # You can configure the behavior using the following environment properties:
29
+ # - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class") - Be aware that this will override
30
+ # the default JVM options, use `JAVA_OPTS_APPEND` to append options
31
+ # - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options
32
+ # in JAVA_OPTS (example: "-Dsome.property=foo")
33
+ # - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is
34
+ # used to calculate a default maximal heap memory based on a containers restriction.
35
+ # If used in a container without any memory constraints for the container then this
36
+ # option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio
37
+ # of the container available memory as set here. The default is `50` which means 50%
38
+ # of the available memory is used as an upper boundary. You can skip this mechanism by
39
+ # setting this value to `0` in which case no `-Xmx` option is added.
40
+ # - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This
41
+ # is used to calculate a default initial heap memory based on the maximum heap memory.
42
+ # If used in a container without any memory constraints for the container then this
43
+ # option has no effect. If there is a memory constraint then `-Xms` is set to a ratio
44
+ # of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx`
45
+ # is used as the initial heap size. You can skip this mechanism by setting this value
46
+ # to `0` in which case no `-Xms` option is added (example: "25")
47
+ # - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS.
48
+ # This is used to calculate the maximum value of the initial heap memory. If used in
49
+ # a container without any memory constraints for the container then this option has
50
+ # no effect. If there is a memory constraint then `-Xms` is limited to the value set
51
+ # here. The default is 4096MB which means the calculated value of `-Xms` never will
52
+ # be greater than 4096MB. The value of this variable is expressed in MB (example: "4096")
53
+ # - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output
54
+ # when things are happening. This option, if set to true, will set
55
+ # `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true").
56
+ # - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example:
57
+ # true").
58
+ # - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787").
59
+ # - CONTAINER_CORE_LIMIT: A calculated core limit as described in
60
+ # https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2")
61
+ # - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024").
62
+ # - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion.
63
+ # (example: "20")
64
+ # - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking.
65
+ # (example: "40")
66
+ # - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection.
67
+ # (example: "4")
68
+ # - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus
69
+ # previous GC times. (example: "90")
70
+ # - GC_METASPACE_SIZE: The initial metaspace size. (example: "20")
71
+ # - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100")
72
+ # - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should
73
+ # contain the necessary JRE command-line options to specify the required GC, which
74
+ # will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC).
75
+ # - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080")
76
+ # - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080")
77
+ # - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be
78
+ # accessed directly. (example: "foo.example.com,bar.example.com")
79
+ #
80
+ ###
81
+ FROM registry.access.redhat.com/ubi9/openjdk-21:1.23
82
+
83
+ ENV LANGUAGE='en_US:en'
84
+
85
+
86
+ COPY target/lib/* /deployments/lib/
87
+ COPY target/*-runner.jar /deployments/quarkus-run.jar
88
+
89
+ EXPOSE 8080
90
+ USER 185
91
+ ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
92
+ ENV JAVA_APP_JAR="/deployments/quarkus-run.jar"
93
+
94
+ ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ]
benchmark/business_domain/cart/quarkus/cart-web/src/main/docker/Dockerfile.native ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ####
2
+ # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode.
3
+ #
4
+ # Before building the container image run:
5
+ #
6
+ # ./mvnw package -Dnative
7
+ #
8
+ # Then, build the image with:
9
+ #
10
+ # docker build -f src/main/docker/Dockerfile.native -t quarkus/cart .
11
+ #
12
+ # Then run the container using:
13
+ #
14
+ # docker run -i --rm -p 8080:8080 quarkus/cart
15
+ #
16
+ # The ` registry.access.redhat.com/ubi9/ubi-minimal:9.6` base image is based on UBI 9.
17
+ # To use UBI 8, switch to `quay.io/ubi8/ubi-minimal:8.10`.
18
+ ###
19
+ FROM registry.access.redhat.com/ubi9/ubi-minimal:9.6
20
+ WORKDIR /work/
21
+ RUN chown 1001 /work \
22
+ && chmod "g+rwX" /work \
23
+ && chown 1001:root /work
24
+ COPY --chown=1001:root --chmod=0755 target/*-runner /work/application
25
+
26
+ EXPOSE 8080
27
+ USER 1001
28
+
29
+ ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"]
benchmark/business_domain/cart/quarkus/cart-web/src/main/docker/Dockerfile.native-micro ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ####
2
+ # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode.
3
+ # It uses a micro base image, tuned for Quarkus native executables.
4
+ # It reduces the size of the resulting container image.
5
+ # Check https://quarkus.io/guides/quarkus-runtime-base-image for further information about this image.
6
+ #
7
+ # Before building the container image run:
8
+ #
9
+ # ./mvnw package -Dnative
10
+ #
11
+ # Then, build the image with:
12
+ #
13
+ # docker build -f src/main/docker/Dockerfile.native-micro -t quarkus/cart .
14
+ #
15
+ # Then run the container using:
16
+ #
17
+ # docker run -i --rm -p 8080:8080 quarkus/cart
18
+ #
19
+ # The `quay.io/quarkus/ubi9-quarkus-micro-image:2.0` base image is based on UBI 9.
20
+ # To use UBI 8, switch to `quay.io/quarkus/quarkus-micro-image:2.0`.
21
+ ###
22
+ FROM quay.io/quarkus/ubi9-quarkus-micro-image:2.0
23
+ WORKDIR /work/
24
+ RUN chown 1001 /work \
25
+ && chmod "g+rwX" /work \
26
+ && chown 1001:root /work
27
+ COPY --chown=1001:root --chmod=0755 target/*-runner /work/application
28
+
29
+ EXPOSE 8080
30
+ USER 1001
31
+
32
+ ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"]
benchmark/business_domain/cart/quarkus/cart-web/src/main/java/quarkus/tutorial/cart/CartResource.java ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package quarkus.tutorial.cart;
2
+
3
+ import java.util.HashMap;
4
+ import java.util.List;
5
+ import java.util.Map;
6
+ import jakarta.enterprise.context.RequestScoped;
7
+ import jakarta.inject.Inject;
8
+ import jakarta.servlet.http.HttpServletRequest;
9
+ import jakarta.ws.rs.Consumes;
10
+ import jakarta.ws.rs.DELETE;
11
+ import jakarta.ws.rs.GET;
12
+ import jakarta.ws.rs.POST;
13
+ import jakarta.ws.rs.Path;
14
+ import jakarta.ws.rs.PathParam;
15
+ import jakarta.ws.rs.Produces;
16
+ import jakarta.ws.rs.core.Context;
17
+ import jakarta.ws.rs.core.MediaType;
18
+ import jakarta.ws.rs.core.Response;
19
+ import quarkus.tutorial.cart.service.Cart;
20
+ import quarkus.tutorial.cart.util.BookException;
21
+
22
+ /**
23
+ * REST resource for cart operations.
24
+ *
25
+ * Provides HTTP endpoints to interact with the shopping cart EJB.
26
+ */
27
+ @Path("/api/cart")
28
+ @Produces(MediaType.APPLICATION_JSON)
29
+ @Consumes(MediaType.APPLICATION_JSON)
30
+ @RequestScoped
31
+ public class CartResource {
32
+
33
+ @Inject
34
+ Cart cart;
35
+
36
+ /**
37
+ * Initialize a new cart session.
38
+ *
39
+ * POST /api/cart/initialize
40
+ *
41
+ * Body: {"customerName": "John Doe", "customerId": "123"}
42
+ */
43
+ @POST
44
+ @Path("/initialize")
45
+ public Response initializeCart(CustomerRequest request) {
46
+ try {
47
+ if (request.customerId != null && !request.customerId.isEmpty()) {
48
+ cart.initialize(request.customerName, request.customerId);
49
+ } else {
50
+ cart.initialize(request.customerName);
51
+ }
52
+
53
+ Map<String, String> response = new HashMap<>();
54
+ response.put("message", "Cart initialized successfully");
55
+ response.put("customerName", request.customerName);
56
+
57
+ return Response.ok(response).build();
58
+ } catch (BookException e) {
59
+ return Response.status(Response.Status.BAD_REQUEST)
60
+ .entity(Map.of("error", e.getMessage()))
61
+ .build();
62
+ }
63
+ }
64
+
65
+ /**
66
+ * Add a book to the cart.
67
+ *
68
+ * POST /api/cart/books/{title}
69
+ */
70
+ @POST
71
+ @Path("/books/{title}")
72
+ public Response addBook(@PathParam("title") String title) {
73
+ try {
74
+ cart.addBook(title);
75
+
76
+ Map<String, Object> response = new HashMap<>();
77
+ response.put("message", "Book added successfully");
78
+ response.put("title", title);
79
+ response.put("cartSize", cart.getContents().size());
80
+
81
+ return Response.ok(response).build();
82
+ } catch (Exception e) {
83
+ return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
84
+ .entity(Map.of("error", e.getMessage()))
85
+ .build();
86
+ }
87
+ }
88
+
89
+ /**
90
+ * Remove a book from the cart.
91
+ *
92
+ * DELETE /api/cart/books/{title}
93
+ */
94
+ @DELETE
95
+ @Path("/books/{title}")
96
+ public Response removeBook(@PathParam("title") String title) {
97
+ try {
98
+ cart.removeBook(title);
99
+
100
+ Map<String, Object> response = new HashMap<>();
101
+ response.put("message", "Book removed successfully");
102
+ response.put("title", title);
103
+ response.put("cartSize", cart.getContents().size());
104
+
105
+ return Response.ok(response).build();
106
+ } catch (BookException e) {
107
+ return Response.status(Response.Status.NOT_FOUND)
108
+ .entity(Map.of("error", e.getMessage()))
109
+ .build();
110
+ }
111
+ }
112
+
113
+ /**
114
+ * Get all books in the cart.
115
+ *
116
+ * GET /api/cart/books
117
+ */
118
+ @GET
119
+ @Path("/books")
120
+ public Response getBooks() {
121
+ try {
122
+ List<String> contents = cart.getContents();
123
+
124
+ Map<String, Object> response = new HashMap<>();
125
+ response.put("books", contents);
126
+ response.put("count", contents.size());
127
+
128
+ return Response.ok(response).build();
129
+ } catch (Exception e) {
130
+ return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
131
+ .entity(Map.of("error", e.getMessage()))
132
+ .build();
133
+ }
134
+ }
135
+
136
+ /**
137
+ * Clear the cart and end the session.
138
+ *
139
+ * DELETE /api/cart
140
+ */
141
+ @DELETE
142
+ public Response clearCart(@Context HttpServletRequest request) {
143
+ try {
144
+ // Simulate EJB @Remove by clearing the session and destroying the bean
145
+ var session = request.getSession(false);
146
+ if (session != null) {
147
+ session.invalidate();
148
+ }
149
+
150
+ return Response.ok(Map.of("message", "Cart cleared successfully")).build();
151
+ } catch (Exception e) {
152
+ return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
153
+ .entity(Map.of("error", e.getMessage()))
154
+ .build();
155
+ }
156
+ }
157
+
158
+ /**
159
+ * Health check endpoint.
160
+ *
161
+ * GET /api/cart/health
162
+ */
163
+ @GET
164
+ @Path("/health")
165
+ public Response health() {
166
+ return Response.ok(Map.of("status", "UP", "service", "cart-api")).build();
167
+ }
168
+
169
+ // Request/Response DTOs
170
+ public static class CustomerRequest {
171
+ public String customerName;
172
+ public String customerId;
173
+ }
174
+ }
benchmark/business_domain/cart/quarkus/cart-web/src/main/resources/application.properties ADDED
@@ -0,0 +1 @@
 
 
1
+ quarkus.http.root-path=/cart
benchmark/business_domain/cart/quarkus/mvnw ADDED
@@ -0,0 +1,332 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # http://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.2
23
+ #
24
+ # Required ENV vars:
25
+ # ------------------
26
+ # JAVA_HOME - location of a JDK home dir
27
+ #
28
+ # Optional ENV vars
29
+ # -----------------
30
+ # MAVEN_OPTS - parameters passed to the Java VM when running Maven
31
+ # e.g. to debug Maven itself, use
32
+ # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
33
+ # MAVEN_SKIP_RC - flag to disable loading of mavenrc files
34
+ # ----------------------------------------------------------------------------
35
+
36
+ if [ -z "$MAVEN_SKIP_RC" ]; then
37
+
38
+ if [ -f /usr/local/etc/mavenrc ]; then
39
+ . /usr/local/etc/mavenrc
40
+ fi
41
+
42
+ if [ -f /etc/mavenrc ]; then
43
+ . /etc/mavenrc
44
+ fi
45
+
46
+ if [ -f "$HOME/.mavenrc" ]; then
47
+ . "$HOME/.mavenrc"
48
+ fi
49
+
50
+ fi
51
+
52
+ # OS specific support. $var _must_ be set to either true or false.
53
+ cygwin=false
54
+ darwin=false
55
+ mingw=false
56
+ case "$(uname)" in
57
+ CYGWIN*) cygwin=true ;;
58
+ MINGW*) mingw=true ;;
59
+ Darwin*)
60
+ darwin=true
61
+ # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
62
+ # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
63
+ if [ -z "$JAVA_HOME" ]; then
64
+ if [ -x "/usr/libexec/java_home" ]; then
65
+ JAVA_HOME="$(/usr/libexec/java_home)"
66
+ export JAVA_HOME
67
+ else
68
+ JAVA_HOME="/Library/Java/Home"
69
+ export JAVA_HOME
70
+ fi
71
+ fi
72
+ ;;
73
+ esac
74
+
75
+ if [ -z "$JAVA_HOME" ]; then
76
+ if [ -r /etc/gentoo-release ]; then
77
+ JAVA_HOME=$(java-config --jre-home)
78
+ fi
79
+ fi
80
+
81
+ # For Cygwin, ensure paths are in UNIX format before anything is touched
82
+ if $cygwin; then
83
+ [ -n "$JAVA_HOME" ] \
84
+ && JAVA_HOME=$(cygpath --unix "$JAVA_HOME")
85
+ [ -n "$CLASSPATH" ] \
86
+ && CLASSPATH=$(cygpath --path --unix "$CLASSPATH")
87
+ fi
88
+
89
+ # For Mingw, ensure paths are in UNIX format before anything is touched
90
+ if $mingw; then
91
+ [ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] \
92
+ && JAVA_HOME="$(
93
+ cd "$JAVA_HOME" || (
94
+ echo "cannot cd into $JAVA_HOME." >&2
95
+ exit 1
96
+ )
97
+ pwd
98
+ )"
99
+ fi
100
+
101
+ if [ -z "$JAVA_HOME" ]; then
102
+ javaExecutable="$(which javac)"
103
+ if [ -n "$javaExecutable" ] && ! [ "$(expr "$javaExecutable" : '\([^ ]*\)')" = "no" ]; then
104
+ # readlink(1) is not available as standard on Solaris 10.
105
+ readLink=$(which readlink)
106
+ if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then
107
+ if $darwin; then
108
+ javaHome="$(dirname "$javaExecutable")"
109
+ javaExecutable="$(cd "$javaHome" && pwd -P)/javac"
110
+ else
111
+ javaExecutable="$(readlink -f "$javaExecutable")"
112
+ fi
113
+ javaHome="$(dirname "$javaExecutable")"
114
+ javaHome=$(expr "$javaHome" : '\(.*\)/bin')
115
+ JAVA_HOME="$javaHome"
116
+ export JAVA_HOME
117
+ fi
118
+ fi
119
+ fi
120
+
121
+ if [ -z "$JAVACMD" ]; then
122
+ if [ -n "$JAVA_HOME" ]; then
123
+ if [ -x "$JAVA_HOME/jre/sh/java" ]; then
124
+ # IBM's JDK on AIX uses strange locations for the executables
125
+ JAVACMD="$JAVA_HOME/jre/sh/java"
126
+ else
127
+ JAVACMD="$JAVA_HOME/bin/java"
128
+ fi
129
+ else
130
+ JAVACMD="$(
131
+ \unset -f command 2>/dev/null
132
+ \command -v java
133
+ )"
134
+ fi
135
+ fi
136
+
137
+ if [ ! -x "$JAVACMD" ]; then
138
+ echo "Error: JAVA_HOME is not defined correctly." >&2
139
+ echo " We cannot execute $JAVACMD" >&2
140
+ exit 1
141
+ fi
142
+
143
+ if [ -z "$JAVA_HOME" ]; then
144
+ echo "Warning: JAVA_HOME environment variable is not set." >&2
145
+ fi
146
+
147
+ # traverses directory structure from process work directory to filesystem root
148
+ # first directory with .mvn subdirectory is considered project base directory
149
+ find_maven_basedir() {
150
+ if [ -z "$1" ]; then
151
+ echo "Path not specified to find_maven_basedir" >&2
152
+ return 1
153
+ fi
154
+
155
+ basedir="$1"
156
+ wdir="$1"
157
+ while [ "$wdir" != '/' ]; do
158
+ if [ -d "$wdir"/.mvn ]; then
159
+ basedir=$wdir
160
+ break
161
+ fi
162
+ # workaround for JBEAP-8937 (on Solaris 10/Sparc)
163
+ if [ -d "${wdir}" ]; then
164
+ wdir=$(
165
+ cd "$wdir/.." || exit 1
166
+ pwd
167
+ )
168
+ fi
169
+ # end of workaround
170
+ done
171
+ printf '%s' "$(
172
+ cd "$basedir" || exit 1
173
+ pwd
174
+ )"
175
+ }
176
+
177
+ # concatenates all lines of a file
178
+ concat_lines() {
179
+ if [ -f "$1" ]; then
180
+ # Remove \r in case we run on Windows within Git Bash
181
+ # and check out the repository with auto CRLF management
182
+ # enabled. Otherwise, we may read lines that are delimited with
183
+ # \r\n and produce $'-Xarg\r' rather than -Xarg due to word
184
+ # splitting rules.
185
+ tr -s '\r\n' ' ' <"$1"
186
+ fi
187
+ }
188
+
189
+ log() {
190
+ if [ "$MVNW_VERBOSE" = true ]; then
191
+ printf '%s\n' "$1"
192
+ fi
193
+ }
194
+
195
+ BASE_DIR=$(find_maven_basedir "$(dirname "$0")")
196
+ if [ -z "$BASE_DIR" ]; then
197
+ exit 1
198
+ fi
199
+
200
+ MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
201
+ export MAVEN_PROJECTBASEDIR
202
+ log "$MAVEN_PROJECTBASEDIR"
203
+
204
+ ##########################################################################################
205
+ # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
206
+ # This allows using the maven wrapper in projects that prohibit checking in binary data.
207
+ ##########################################################################################
208
+ wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar"
209
+ if [ -r "$wrapperJarPath" ]; then
210
+ log "Found $wrapperJarPath"
211
+ else
212
+ log "Couldn't find $wrapperJarPath, downloading it ..."
213
+
214
+ if [ -n "$MVNW_REPOURL" ]; then
215
+ wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar"
216
+ else
217
+ wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar"
218
+ fi
219
+ while IFS="=" read -r key value; do
220
+ # Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' )
221
+ safeValue=$(echo "$value" | tr -d '\r')
222
+ case "$key" in wrapperUrl)
223
+ wrapperUrl="$safeValue"
224
+ break
225
+ ;;
226
+ esac
227
+ done <"$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
228
+ log "Downloading from: $wrapperUrl"
229
+
230
+ if $cygwin; then
231
+ wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath")
232
+ fi
233
+
234
+ if command -v wget >/dev/null; then
235
+ log "Found wget ... using wget"
236
+ [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet"
237
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
238
+ wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
239
+ else
240
+ wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
241
+ fi
242
+ elif command -v curl >/dev/null; then
243
+ log "Found curl ... using curl"
244
+ [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent"
245
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
246
+ curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
247
+ else
248
+ curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
249
+ fi
250
+ else
251
+ log "Falling back to using Java to download"
252
+ javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java"
253
+ javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class"
254
+ # For Cygwin, switch paths to Windows format before running javac
255
+ if $cygwin; then
256
+ javaSource=$(cygpath --path --windows "$javaSource")
257
+ javaClass=$(cygpath --path --windows "$javaClass")
258
+ fi
259
+ if [ -e "$javaSource" ]; then
260
+ if [ ! -e "$javaClass" ]; then
261
+ log " - Compiling MavenWrapperDownloader.java ..."
262
+ ("$JAVA_HOME/bin/javac" "$javaSource")
263
+ fi
264
+ if [ -e "$javaClass" ]; then
265
+ log " - Running MavenWrapperDownloader.java ..."
266
+ ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath"
267
+ fi
268
+ fi
269
+ fi
270
+ fi
271
+ ##########################################################################################
272
+ # End of extension
273
+ ##########################################################################################
274
+
275
+ # If specified, validate the SHA-256 sum of the Maven wrapper jar file
276
+ wrapperSha256Sum=""
277
+ while IFS="=" read -r key value; do
278
+ case "$key" in wrapperSha256Sum)
279
+ wrapperSha256Sum=$value
280
+ break
281
+ ;;
282
+ esac
283
+ done <"$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
284
+ if [ -n "$wrapperSha256Sum" ]; then
285
+ wrapperSha256Result=false
286
+ if command -v sha256sum >/dev/null; then
287
+ if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c >/dev/null 2>&1; then
288
+ wrapperSha256Result=true
289
+ fi
290
+ elif command -v shasum >/dev/null; then
291
+ if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c >/dev/null 2>&1; then
292
+ wrapperSha256Result=true
293
+ fi
294
+ else
295
+ echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2
296
+ echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties." >&2
297
+ exit 1
298
+ fi
299
+ if [ $wrapperSha256Result = false ]; then
300
+ echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2
301
+ echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2
302
+ echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2
303
+ exit 1
304
+ fi
305
+ fi
306
+
307
+ MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
308
+
309
+ # For Cygwin, switch paths to Windows format before running java
310
+ if $cygwin; then
311
+ [ -n "$JAVA_HOME" ] \
312
+ && JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME")
313
+ [ -n "$CLASSPATH" ] \
314
+ && CLASSPATH=$(cygpath --path --windows "$CLASSPATH")
315
+ [ -n "$MAVEN_PROJECTBASEDIR" ] \
316
+ && MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR")
317
+ fi
318
+
319
+ # Provide a "standardized" way to retrieve the CLI args that will
320
+ # work with both Windows and non-Windows executions.
321
+ MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*"
322
+ export MAVEN_CMD_LINE_ARGS
323
+
324
+ WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
325
+
326
+ # shellcheck disable=SC2086 # safe args
327
+ exec "$JAVACMD" \
328
+ $MAVEN_OPTS \
329
+ $MAVEN_DEBUG_OPTS \
330
+ -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
331
+ "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
332
+ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
benchmark/business_domain/cart/quarkus/mvnw.cmd ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @REM ----------------------------------------------------------------------------
2
+ @REM Licensed to the Apache Software Foundation (ASF) under one
3
+ @REM or more contributor license agreements. See the NOTICE file
4
+ @REM distributed with this work for additional information
5
+ @REM regarding copyright ownership. The ASF licenses this file
6
+ @REM to you under the Apache License, Version 2.0 (the
7
+ @REM "License"); you may not use this file except in compliance
8
+ @REM with the License. You may obtain a copy of the License at
9
+ @REM
10
+ @REM http://www.apache.org/licenses/LICENSE-2.0
11
+ @REM
12
+ @REM Unless required by applicable law or agreed to in writing,
13
+ @REM software distributed under the License is distributed on an
14
+ @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ @REM KIND, either express or implied. See the License for the
16
+ @REM specific language governing permissions and limitations
17
+ @REM under the License.
18
+ @REM ----------------------------------------------------------------------------
19
+
20
+ @REM ----------------------------------------------------------------------------
21
+ @REM Apache Maven Wrapper startup batch script, version 3.3.2
22
+ @REM
23
+ @REM Required ENV vars:
24
+ @REM JAVA_HOME - location of a JDK home dir
25
+ @REM
26
+ @REM Optional ENV vars
27
+ @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
28
+ @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
29
+ @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
30
+ @REM e.g. to debug Maven itself, use
31
+ @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
32
+ @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
33
+ @REM ----------------------------------------------------------------------------
34
+
35
+ @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
36
+ @echo off
37
+ @REM set title of command window
38
+ title %0
39
+ @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
40
+ @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
41
+
42
+ @REM set %HOME% to equivalent of $HOME
43
+ if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
44
+
45
+ @REM Execute a user defined script before this one
46
+ if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
47
+ @REM check for pre script, once with legacy .bat ending and once with .cmd ending
48
+ if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
49
+ if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
50
+ :skipRcPre
51
+
52
+ @setlocal
53
+
54
+ set ERROR_CODE=0
55
+
56
+ @REM To isolate internal variables from possible post scripts, we use another setlocal
57
+ @setlocal
58
+
59
+ @REM ==== START VALIDATION ====
60
+ if not "%JAVA_HOME%" == "" goto OkJHome
61
+
62
+ echo. >&2
63
+ echo Error: JAVA_HOME not found in your environment. >&2
64
+ echo Please set the JAVA_HOME variable in your environment to match the >&2
65
+ echo location of your Java installation. >&2
66
+ echo. >&2
67
+ goto error
68
+
69
+ :OkJHome
70
+ if exist "%JAVA_HOME%\bin\java.exe" goto init
71
+
72
+ echo. >&2
73
+ echo Error: JAVA_HOME is set to an invalid directory. >&2
74
+ echo JAVA_HOME = "%JAVA_HOME%" >&2
75
+ echo Please set the JAVA_HOME variable in your environment to match the >&2
76
+ echo location of your Java installation. >&2
77
+ echo. >&2
78
+ goto error
79
+
80
+ @REM ==== END VALIDATION ====
81
+
82
+ :init
83
+
84
+ @REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
85
+ @REM Fallback to current working directory if not found.
86
+
87
+ set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
88
+ IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
89
+
90
+ set EXEC_DIR=%CD%
91
+ set WDIR=%EXEC_DIR%
92
+ :findBaseDir
93
+ IF EXIST "%WDIR%"\.mvn goto baseDirFound
94
+ cd ..
95
+ IF "%WDIR%"=="%CD%" goto baseDirNotFound
96
+ set WDIR=%CD%
97
+ goto findBaseDir
98
+
99
+ :baseDirFound
100
+ set MAVEN_PROJECTBASEDIR=%WDIR%
101
+ cd "%EXEC_DIR%"
102
+ goto endDetectBaseDir
103
+
104
+ :baseDirNotFound
105
+ set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
106
+ cd "%EXEC_DIR%"
107
+
108
+ :endDetectBaseDir
109
+
110
+ IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
111
+
112
+ @setlocal EnableExtensions EnableDelayedExpansion
113
+ for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
114
+ @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
115
+
116
+ :endReadAdditionalConfig
117
+
118
+ SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
119
+ set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
120
+ set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
121
+
122
+ set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar"
123
+
124
+ FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
125
+ IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
126
+ )
127
+
128
+ @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
129
+ @REM This allows using the maven wrapper in projects that prohibit checking in binary data.
130
+ if exist %WRAPPER_JAR% (
131
+ if "%MVNW_VERBOSE%" == "true" (
132
+ echo Found %WRAPPER_JAR%
133
+ )
134
+ ) else (
135
+ if not "%MVNW_REPOURL%" == "" (
136
+ SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar"
137
+ )
138
+ if "%MVNW_VERBOSE%" == "true" (
139
+ echo Couldn't find %WRAPPER_JAR%, downloading it ...
140
+ echo Downloading from: %WRAPPER_URL%
141
+ )
142
+
143
+ powershell -Command "&{"^
144
+ "$webclient = new-object System.Net.WebClient;"^
145
+ "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
146
+ "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
147
+ "}"^
148
+ "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
149
+ "}"
150
+ if "%MVNW_VERBOSE%" == "true" (
151
+ echo Finished downloading %WRAPPER_JAR%
152
+ )
153
+ )
154
+ @REM End of extension
155
+
156
+ @REM If specified, validate the SHA-256 sum of the Maven wrapper jar file
157
+ SET WRAPPER_SHA_256_SUM=""
158
+ FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
159
+ IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B
160
+ )
161
+ IF NOT %WRAPPER_SHA_256_SUM%=="" (
162
+ powershell -Command "&{"^
163
+ "Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash;"^
164
+ "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^
165
+ "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^
166
+ " Write-Error 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^
167
+ " Write-Error 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^
168
+ " Write-Error 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^
169
+ " exit 1;"^
170
+ "}"^
171
+ "}"
172
+ if ERRORLEVEL 1 goto error
173
+ )
174
+
175
+ @REM Provide a "standardized" way to retrieve the CLI args that will
176
+ @REM work with both Windows and non-Windows executions.
177
+ set MAVEN_CMD_LINE_ARGS=%*
178
+
179
+ %MAVEN_JAVA_EXE% ^
180
+ %JVM_CONFIG_MAVEN_PROPS% ^
181
+ %MAVEN_OPTS% ^
182
+ %MAVEN_DEBUG_OPTS% ^
183
+ -classpath %WRAPPER_JAR% ^
184
+ "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
185
+ %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
186
+ if ERRORLEVEL 1 goto error
187
+ goto end
188
+
189
+ :error
190
+ set ERROR_CODE=1
191
+
192
+ :end
193
+ @endlocal & set ERROR_CODE=%ERROR_CODE%
194
+
195
+ if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
196
+ @REM check for post script, once with legacy .bat ending and once with .cmd ending
197
+ if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
198
+ if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
199
+ :skipRcPost
200
+
201
+ @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
202
+ if "%MAVEN_BATCH_PAUSE%"=="on" pause
203
+
204
+ if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
205
+
206
+ cmd /C exit /B %ERROR_CODE%
benchmark/business_domain/cart/quarkus/pom.xml ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>quarkus.examples.tutorial.cart</groupId>
5
+ <artifactId>parent</artifactId>
6
+ <version>1.0.0-SNAPSHOT</version>
7
+ <packaging>pom</packaging>
8
+
9
+ <properties>
10
+ <compiler-plugin.version>3.14.0</compiler-plugin.version>
11
+ <maven.compiler.release>21</maven.compiler.release>
12
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
13
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
14
+ <quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
15
+ <quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
16
+ <quarkus.platform.version>3.30.5</quarkus.platform.version>
17
+ <skipITs>true</skipITs>
18
+ <surefire-plugin.version>3.5.3</surefire-plugin.version>
19
+ </properties>
20
+
21
+ <modules>
22
+ <module>cart-ejb</module>
23
+ <module>cart-web</module>
24
+ </modules>
25
+
26
+ <dependencyManagement>
27
+ <dependencies>
28
+ <dependency>
29
+ <groupId>${quarkus.platform.group-id}</groupId>
30
+ <artifactId>${quarkus.platform.artifact-id}</artifactId>
31
+ <version>${quarkus.platform.version}</version>
32
+ <type>pom</type>
33
+ <scope>import</scope>
34
+ </dependency>
35
+ </dependencies>
36
+ </dependencyManagement>
37
+
38
+ <build>
39
+ <pluginManagement>
40
+ <plugins>
41
+ <plugin>
42
+ <groupId>${quarkus.platform.group-id}</groupId>
43
+ <artifactId>quarkus-maven-plugin</artifactId>
44
+ <version>${quarkus.platform.version}</version>
45
+ </plugin>
46
+ </plugins>
47
+ </pluginManagement>
48
+ <plugins>
49
+ <plugin>
50
+ <artifactId>maven-compiler-plugin</artifactId>
51
+ <version>${compiler-plugin.version}</version>
52
+ <configuration>
53
+ <parameters>true</parameters>
54
+ </configuration>
55
+ </plugin>
56
+ <plugin>
57
+ <artifactId>maven-surefire-plugin</artifactId>
58
+ <version>${surefire-plugin.version}</version>
59
+ <configuration>
60
+ <systemPropertyVariables>
61
+ <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
62
+ <maven.home>${maven.home}</maven.home>
63
+ </systemPropertyVariables>
64
+ </configuration>
65
+ </plugin>
66
+ <plugin>
67
+ <artifactId>maven-failsafe-plugin</artifactId>
68
+ <version>${surefire-plugin.version}</version>
69
+ <executions>
70
+ <execution>
71
+ <goals>
72
+ <goal>integration-test</goal>
73
+ <goal>verify</goal>
74
+ </goals>
75
+ </execution>
76
+ </executions>
77
+ <configuration>
78
+ <systemPropertyVariables>
79
+ <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
80
+ <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
81
+ <maven.home>${maven.home}</maven.home>
82
+ </systemPropertyVariables>
83
+ </configuration>
84
+ </plugin>
85
+ </plugins>
86
+ </build>
87
+
88
+ <profiles>
89
+ <profile>
90
+ <id>native</id>
91
+ <activation>
92
+ <property>
93
+ <name>native</name>
94
+ </property>
95
+ </activation>
96
+ <properties>
97
+ <skipITs>false</skipITs>
98
+ <quarkus.native.enabled>true</quarkus.native.enabled>
99
+ </properties>
100
+ </profile>
101
+ </profiles>
102
+ </project>
benchmark/business_domain/cart/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/cart}"
5
+
6
+ echo "Health check: ${BASE_URL}"
7
+ HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}")
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/business_domain/cart/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/business_domain/cart/spring/.mvn/wrapper/maven-wrapper.properties ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ wrapperVersion=3.3.4
2
+ distributionType=only-script
3
+ distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip
benchmark/business_domain/cart/spring/Dockerfile ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 \
6
+ && curl -LsSf https://astral.sh/uv/install.sh | sh
7
+
8
+ ENV PATH="/root/.local/bin:$PATH"
9
+
10
+ # Shared browsers path so Chromium is cached once
11
+ ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
12
+ RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright
13
+
14
+ # create venv and install
15
+ RUN uv venv /opt/venv \
16
+ && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest
17
+
18
+ ENV PATH="/opt/venv/bin:$PATH"
19
+ RUN playwright install --with-deps chromium
20
+
21
+ WORKDIR /app
22
+
23
+ # Cache Maven dependencies separately from source (multi-module)
24
+ COPY pom.xml .
25
+ COPY cart-ejb/pom.xml cart-ejb/
26
+ COPY cart-web/pom.xml cart-web/
27
+ RUN mvn dependency:go-offline -q
28
+
29
+ # Build application
30
+ COPY . .
31
+ RUN mvn install -DskipTests -q
32
+
33
+ COPY test.sh .
34
+ RUN chmod +x test.sh
35
+
36
+ CMD ["mvn", "spring-boot:run", "-pl", "cart-web"]
benchmark/business_domain/cart/spring/cart-ejb/pom.xml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <project
2
+ xmlns="http://maven.apache.org/POM/4.0.0"
3
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
5
+ http://maven.apache.org/xsd/maven-4.0.0.xsd"
6
+ >
7
+ <modelVersion>4.0.0</modelVersion>
8
+ <parent>
9
+ <groupId>spring.examples.tutorial.cart</groupId>
10
+ <artifactId>parent</artifactId>
11
+ <version>0.0.1-SNAPSHOT</version>
12
+ <relativePath>../pom.xml</relativePath>
13
+ </parent>
14
+ <artifactId>cart-ejb</artifactId>
15
+ <packaging>jar</packaging>
16
+
17
+ <properties>
18
+ <maven.compiler.source>17</maven.compiler.source>
19
+ <maven.compiler.target>17</maven.compiler.target>
20
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
21
+ </properties>
22
+
23
+ <dependencies>
24
+ <dependency>
25
+ <groupId>org.springframework</groupId>
26
+ <artifactId>spring-context</artifactId>
27
+ </dependency>
28
+ </dependencies>
29
+ </project>
benchmark/business_domain/cart/spring/cart-ejb/src/main/java/spring/examples/tutorial/cart/service/Cart.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ package spring.examples.tutorial.cart.service;
3
+
4
+ import java.util.List;
5
+ import spring.examples.tutorial.cart.util.BookException;
6
+
7
+ public interface Cart {
8
+ public void initialize(String person) throws BookException;
9
+
10
+ public void initialize(
11
+ String person,
12
+ String id) throws BookException;
13
+
14
+ public void addBook(String title);
15
+
16
+ public void removeBook(String title) throws BookException;
17
+
18
+ public List<String> getContents();
19
+
20
+ public void remove();
21
+ }
benchmark/business_domain/cart/spring/cart-ejb/src/main/java/spring/examples/tutorial/cart/service/CartServiceImpl.java ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package spring.examples.tutorial.cart.service;
2
+
3
+ import org.springframework.context.annotation.Scope;
4
+ import org.springframework.context.annotation.ScopedProxyMode;
5
+ import org.springframework.stereotype.Service;
6
+ import spring.examples.tutorial.cart.util.BookException;
7
+ import spring.examples.tutorial.cart.util.IdVerifier;
8
+ import java.util.ArrayList;
9
+ import java.util.List;
10
+
11
+ @Service
12
+ @Scope(value = "session", proxyMode = ScopedProxyMode.TARGET_CLASS)
13
+ public class CartServiceImpl implements Cart {
14
+
15
+ private String customerId;
16
+ private String customerName;
17
+ private List<String> contents = new ArrayList<>();
18
+
19
+ @Override
20
+ public void initialize(String person) throws BookException {
21
+ if (person == null) {
22
+ throw new BookException("Null person not allowed.");
23
+ }
24
+ customerName = person;
25
+ customerId = "0";
26
+ contents = new ArrayList<>();
27
+ }
28
+
29
+ @Override
30
+ public void initialize(String person, String id) throws BookException {
31
+ if (person == null) {
32
+ throw new BookException("Null person not allowed.");
33
+ }
34
+ customerName = person;
35
+
36
+ IdVerifier idChecker = new IdVerifier();
37
+ if (idChecker.validate(id)) {
38
+ customerId = id;
39
+ } else {
40
+ throw new BookException("Invalid id: " + id);
41
+ }
42
+
43
+ contents = new ArrayList<>();
44
+ }
45
+
46
+ @Override
47
+ public void addBook(String title) {
48
+ contents.add(title);
49
+ }
50
+
51
+ @Override
52
+ public void removeBook(String title) throws BookException {
53
+ boolean result = contents.remove(title);
54
+ if (!result) {
55
+ throw new BookException("\"" + title + "\" not in cart.");
56
+ }
57
+ }
58
+
59
+ @Override
60
+ public List<String> getContents() {
61
+ return contents;
62
+ }
63
+
64
+ @Override
65
+ public void remove() {
66
+ contents = new ArrayList<>();
67
+ }
68
+ }
benchmark/business_domain/cart/spring/cart-ejb/src/main/java/spring/examples/tutorial/cart/util/BookException.java ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package spring.examples.tutorial.cart.util;
2
+
3
+ public class BookException extends Exception {
4
+ private static final long serialVersionUID = 6274585742564840905L;
5
+
6
+ public BookException() {}
7
+
8
+ public BookException(String msg) {
9
+ super(msg);
10
+ }
11
+ }
benchmark/business_domain/cart/spring/cart-ejb/src/main/java/spring/examples/tutorial/cart/util/IdVerifier.java ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package spring.examples.tutorial.cart.util;
2
+
3
+ public class IdVerifier {
4
+ public IdVerifier() {}
5
+
6
+ public boolean validate(String id) {
7
+ boolean result = true;
8
+
9
+ for (int i = 0; i < id.length(); i++) {
10
+ if (Character.isDigit(id.charAt(i)) == false) {
11
+ result = false;
12
+ }
13
+ }
14
+
15
+ return result;
16
+ }
17
+ }