Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- benchmark/business_domain/cart/jakarta/.dockerignore +41 -0
- benchmark/business_domain/cart/jakarta/.mvn/wrapper/MavenWrapperDownloader.java +117 -0
- benchmark/business_domain/cart/jakarta/.mvn/wrapper/maven-wrapper.properties +2 -0
- benchmark/business_domain/cart/jakarta/Dockerfile +36 -0
- benchmark/business_domain/cart/jakarta/cart-ejb/pom.xml +36 -0
- benchmark/business_domain/cart/jakarta/cart-ejb/src/main/java/jakarta/tutorial/cart/ejb/Cart.java +36 -0
- benchmark/business_domain/cart/jakarta/cart-ejb/src/main/java/jakarta/tutorial/cart/ejb/CartBean.java +82 -0
- benchmark/business_domain/cart/jakarta/cart-ejb/src/main/java/jakarta/tutorial/cart/util/BookException.java +22 -0
- benchmark/business_domain/cart/jakarta/cart-ejb/src/main/java/jakarta/tutorial/cart/util/IdVerifier.java +29 -0
- benchmark/business_domain/cart/jakarta/cart-ejb/src/main/resources/META-INF/MANIFEST.MF +2 -0
- benchmark/business_domain/cart/jakarta/cart-web/pom.xml +82 -0
- benchmark/business_domain/cart/jakarta/cart-web/src/main/java/jakarta/tutorial/cart/web/CartResource.java +173 -0
- benchmark/business_domain/cart/jakarta/cart-web/src/main/java/jakarta/tutorial/cart/web/RestApplication.java +25 -0
- benchmark/business_domain/cart/jakarta/cart-web/src/main/liberty/config/server.xml +46 -0
- benchmark/business_domain/cart/jakarta/cart-web/src/main/webapp/WEB-INF/beans.xml +7 -0
- benchmark/business_domain/cart/jakarta/mvnw +310 -0
- benchmark/business_domain/cart/jakarta/mvnw.cmd +182 -0
- benchmark/business_domain/cart/jakarta/pom.xml +112 -0
- benchmark/business_domain/cart/jakarta/test.sh +15 -0
- benchmark/business_domain/cart/quarkus/.dockerignore +41 -0
- benchmark/business_domain/cart/quarkus/.mvn/wrapper/MavenWrapperDownloader.java +117 -0
- benchmark/business_domain/cart/quarkus/.mvn/wrapper/maven-wrapper.properties +2 -0
- benchmark/business_domain/cart/quarkus/Dockerfile +36 -0
- benchmark/business_domain/cart/quarkus/cart-ejb/pom.xml +45 -0
- benchmark/business_domain/cart/quarkus/cart-ejb/src/main/java/quarkus/tutorial/cart/service/Cart.java +20 -0
- benchmark/business_domain/cart/quarkus/cart-ejb/src/main/java/quarkus/tutorial/cart/service/CartBean.java +70 -0
- benchmark/business_domain/cart/quarkus/cart-ejb/src/main/java/quarkus/tutorial/cart/util/BookException.java +11 -0
- benchmark/business_domain/cart/quarkus/cart-ejb/src/main/java/quarkus/tutorial/cart/util/IdVerifier.java +17 -0
- benchmark/business_domain/cart/quarkus/cart-web/pom.xml +77 -0
- benchmark/business_domain/cart/quarkus/cart-web/src/main/docker/Dockerfile.jvm +98 -0
- benchmark/business_domain/cart/quarkus/cart-web/src/main/docker/Dockerfile.legacy-jar +94 -0
- benchmark/business_domain/cart/quarkus/cart-web/src/main/docker/Dockerfile.native +29 -0
- benchmark/business_domain/cart/quarkus/cart-web/src/main/docker/Dockerfile.native-micro +32 -0
- benchmark/business_domain/cart/quarkus/cart-web/src/main/java/quarkus/tutorial/cart/CartResource.java +174 -0
- benchmark/business_domain/cart/quarkus/cart-web/src/main/resources/application.properties +1 -0
- benchmark/business_domain/cart/quarkus/mvnw +332 -0
- benchmark/business_domain/cart/quarkus/mvnw.cmd +206 -0
- benchmark/business_domain/cart/quarkus/pom.xml +102 -0
- benchmark/business_domain/cart/quarkus/test.sh +15 -0
- benchmark/business_domain/cart/spring/.dockerignore +41 -0
- benchmark/business_domain/cart/spring/.mvn/wrapper/maven-wrapper.properties +3 -0
- benchmark/business_domain/cart/spring/Dockerfile +36 -0
- benchmark/business_domain/cart/spring/cart-ejb/pom.xml +29 -0
- benchmark/business_domain/cart/spring/cart-ejb/src/main/java/spring/examples/tutorial/cart/service/Cart.java +21 -0
- benchmark/business_domain/cart/spring/cart-ejb/src/main/java/spring/examples/tutorial/cart/service/CartServiceImpl.java +68 -0
- benchmark/business_domain/cart/spring/cart-ejb/src/main/java/spring/examples/tutorial/cart/util/BookException.java +11 -0
- benchmark/business_domain/cart/spring/cart-ejb/src/main/java/spring/examples/tutorial/cart/util/IdVerifier.java +17 -0
- benchmark/business_domain/cart/spring/cart-web/pom.xml +57 -0
- benchmark/business_domain/cart/spring/cart-web/src/main/java/spring/examples/tutorial/cart/Application.java +13 -0
- benchmark/business_domain/cart/spring/cart-web/src/main/java/spring/examples/tutorial/cart/CartController.java +149 -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 |
+
}
|
benchmark/business_domain/cart/spring/cart-web/pom.xml
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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-web</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.boot</groupId>
|
| 26 |
+
<artifactId>spring-boot-starter-web</artifactId>
|
| 27 |
+
</dependency>
|
| 28 |
+
|
| 29 |
+
<dependency>
|
| 30 |
+
<groupId>spring.examples.tutorial.cart</groupId>
|
| 31 |
+
<artifactId>cart-ejb</artifactId>
|
| 32 |
+
<version>${project.version}</version>
|
| 33 |
+
</dependency>
|
| 34 |
+
</dependencies>
|
| 35 |
+
|
| 36 |
+
<build>
|
| 37 |
+
<finalName>${project.artifactId}</finalName>
|
| 38 |
+
<plugins>
|
| 39 |
+
<plugin>
|
| 40 |
+
<groupId>org.springframework.boot</groupId>
|
| 41 |
+
<artifactId>spring-boot-maven-plugin</artifactId>
|
| 42 |
+
<version>${spring-boot.version}</version>
|
| 43 |
+
<configuration>
|
| 44 |
+
<mainClass
|
| 45 |
+
>spring.examples.tutorial.cart.Application</mainClass>
|
| 46 |
+
</configuration>
|
| 47 |
+
<executions>
|
| 48 |
+
<execution>
|
| 49 |
+
<goals>
|
| 50 |
+
<goal>repackage</goal>
|
| 51 |
+
</goals>
|
| 52 |
+
</execution>
|
| 53 |
+
</executions>
|
| 54 |
+
</plugin>
|
| 55 |
+
</plugins>
|
| 56 |
+
</build>
|
| 57 |
+
</project>
|
benchmark/business_domain/cart/spring/cart-web/src/main/java/spring/examples/tutorial/cart/Application.java
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package spring.examples.tutorial.cart;
|
| 2 |
+
|
| 3 |
+
import org.springframework.boot.SpringApplication;
|
| 4 |
+
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
| 5 |
+
|
| 6 |
+
@SpringBootApplication
|
| 7 |
+
public class Application {
|
| 8 |
+
|
| 9 |
+
public static void main(String[] args) {
|
| 10 |
+
SpringApplication.run(Application.class, args);
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
}
|
benchmark/business_domain/cart/spring/cart-web/src/main/java/spring/examples/tutorial/cart/CartController.java
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package spring.examples.tutorial.cart;
|
| 2 |
+
|
| 3 |
+
import org.springframework.http.HttpStatus;
|
| 4 |
+
import org.springframework.http.ResponseEntity;
|
| 5 |
+
import org.springframework.web.bind.annotation.*;
|
| 6 |
+
import jakarta.servlet.http.HttpSession;
|
| 7 |
+
import spring.examples.tutorial.cart.util.BookException;
|
| 8 |
+
import spring.examples.tutorial.cart.service.Cart;
|
| 9 |
+
import java.util.HashMap;
|
| 10 |
+
import java.util.List;
|
| 11 |
+
import java.util.Map;
|
| 12 |
+
|
| 13 |
+
@RestController
|
| 14 |
+
@RequestMapping("/api/cart")
|
| 15 |
+
public class CartController {
|
| 16 |
+
|
| 17 |
+
private final Cart cart;
|
| 18 |
+
|
| 19 |
+
public CartController(Cart cart) {
|
| 20 |
+
this.cart = cart;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Initialize a new cart session.
|
| 25 |
+
*
|
| 26 |
+
* POST /api/cart/initialize
|
| 27 |
+
*
|
| 28 |
+
* Body: {"customerName": "John Doe", "customerId": "123"}
|
| 29 |
+
*/
|
| 30 |
+
@PostMapping("/initialize")
|
| 31 |
+
public ResponseEntity<Object> initializeCart(@RequestBody CustomerRequest request) {
|
| 32 |
+
try {
|
| 33 |
+
if (request.customerId != null && !request.customerId.isEmpty()) {
|
| 34 |
+
cart.initialize(request.customerName, request.customerId);
|
| 35 |
+
} else {
|
| 36 |
+
cart.initialize(request.customerName);
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
Map<String, String> response = new HashMap<>();
|
| 40 |
+
response.put("message", "Cart initialized successfully");
|
| 41 |
+
response.put("customerName", request.customerName);
|
| 42 |
+
|
| 43 |
+
return ResponseEntity.ok(response);
|
| 44 |
+
} catch (BookException e) {
|
| 45 |
+
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
|
| 46 |
+
.body(Map.of("error", e.getMessage()));
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
/**
|
| 51 |
+
* Add a book to the cart.
|
| 52 |
+
*
|
| 53 |
+
* POST /api/cart/books/{title}
|
| 54 |
+
*/
|
| 55 |
+
@PostMapping("/books/{title}")
|
| 56 |
+
public ResponseEntity<Object> addBook(@PathVariable("title") String title) {
|
| 57 |
+
try {
|
| 58 |
+
cart.addBook(title);
|
| 59 |
+
|
| 60 |
+
Map<String, Object> response = new HashMap<>();
|
| 61 |
+
response.put("message", "Book added successfully");
|
| 62 |
+
response.put("title", title);
|
| 63 |
+
response.put("cartSize", cart.getContents().size());
|
| 64 |
+
|
| 65 |
+
return ResponseEntity.ok(response);
|
| 66 |
+
} catch (Exception e) {
|
| 67 |
+
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
|
| 68 |
+
.body(Map.of("error", e.getMessage()));
|
| 69 |
+
}
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
/**
|
| 73 |
+
* Remove a book from the cart.
|
| 74 |
+
*
|
| 75 |
+
* DELETE /api/cart/books/{title}
|
| 76 |
+
*/
|
| 77 |
+
@DeleteMapping("/books/{title}")
|
| 78 |
+
public ResponseEntity<Object> removeBook(@PathVariable("title") String title) {
|
| 79 |
+
try {
|
| 80 |
+
cart.removeBook(title);
|
| 81 |
+
|
| 82 |
+
Map<String, Object> response = new HashMap<>();
|
| 83 |
+
response.put("message", "Book removed successfully");
|
| 84 |
+
response.put("title", title);
|
| 85 |
+
response.put("cartSize", cart.getContents().size());
|
| 86 |
+
|
| 87 |
+
return ResponseEntity.ok(response);
|
| 88 |
+
} catch (BookException e) {
|
| 89 |
+
return ResponseEntity.status(HttpStatus.NOT_FOUND)
|
| 90 |
+
.body(Map.of("error", e.getMessage()));
|
| 91 |
+
}
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
/**
|
| 95 |
+
* Get all books in the cart.
|
| 96 |
+
*
|
| 97 |
+
* GET /api/cart/books
|
| 98 |
+
*/
|
| 99 |
+
@GetMapping("/books")
|
| 100 |
+
public ResponseEntity<Object> getBooks() {
|
| 101 |
+
try {
|
| 102 |
+
List<String> contents = cart.getContents();
|
| 103 |
+
|
| 104 |
+
Map<String, Object> response = new HashMap<>();
|
| 105 |
+
response.put("books", contents);
|
| 106 |
+
response.put("count", contents.size());
|
| 107 |
+
|
| 108 |
+
return ResponseEntity.ok(response);
|
| 109 |
+
} catch (Exception e) {
|
| 110 |
+
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
|
| 111 |
+
.body(Map.of("error", e.getMessage()));
|
| 112 |
+
}
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
/**
|
| 116 |
+
* Clear the cart and end the session.
|
| 117 |
+
*
|
| 118 |
+
* DELETE /api/cart
|
| 119 |
+
*/
|
| 120 |
+
@DeleteMapping
|
| 121 |
+
public ResponseEntity<Object> clearCart(HttpSession session) {
|
| 122 |
+
try {
|
| 123 |
+
// Simulate EJB @Remove by clearing the session and destroying the bean
|
| 124 |
+
session.invalidate();
|
| 125 |
+
|
| 126 |
+
return ResponseEntity.ok(Map.of("message", "Cart cleared successfully"));
|
| 127 |
+
} catch (Exception e) {
|
| 128 |
+
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
|
| 129 |
+
.body(Map.of("error", e.getMessage()));
|
| 130 |
+
}
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
/**
|
| 134 |
+
* Health check endpoint.
|
| 135 |
+
*
|
| 136 |
+
* GET /api/cart/health
|
| 137 |
+
*/
|
| 138 |
+
@GetMapping("/health")
|
| 139 |
+
public ResponseEntity<Object> health() {
|
| 140 |
+
return ResponseEntity.ok(Map.of("status", "UP", "service", "cart-api"));
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
// Request/Response DTOs
|
| 144 |
+
public static class CustomerRequest {
|
| 145 |
+
public String customerName;
|
| 146 |
+
public String customerId;
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
}
|