diff --git a/benchmark/business_domain/cart/jakarta/.dockerignore b/benchmark/business_domain/cart/jakarta/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..c634c57d9244b4e60b8fa936f09dbe4e75706e74 --- /dev/null +++ b/benchmark/business_domain/cart/jakarta/.dockerignore @@ -0,0 +1,41 @@ +# VCS +.git/ + +# Maven +.mvn/ +**/.mvn/ +mvnw +mvnw.cmd +**/mvnw +**/mvnw.cmd +target/ +**/target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties + +# IDE / Editor +.vscode/ +**/.vscode/ +.zed/ +**/.zed/ +.idea/ +**/.idea/ +*.iml +*.ipr +*.iws + +# OS +.DS_Store +**/.DS_Store +Thumbs.db +ehthumbs.db + +# Logs / temp +*.log +*.tmp +*.temp diff --git a/benchmark/business_domain/cart/jakarta/.mvn/wrapper/MavenWrapperDownloader.java b/benchmark/business_domain/cart/jakarta/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000000000000000000000000000000000..b901097f2db6e50097dc0b222204a88f8cea1609 --- /dev/null +++ b/benchmark/business_domain/cart/jakarta/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/benchmark/business_domain/cart/jakarta/.mvn/wrapper/maven-wrapper.properties b/benchmark/business_domain/cart/jakarta/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..43ad4f7bc95d51463a4cea4b6d84e6e069b98f1f --- /dev/null +++ b/benchmark/business_domain/cart/jakarta/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/benchmark/business_domain/cart/jakarta/Dockerfile b/benchmark/business_domain/cart/jakarta/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..46b5f9b4c3420801d027f8594b90568405133800 --- /dev/null +++ b/benchmark/business_domain/cart/jakarta/Dockerfile @@ -0,0 +1,36 @@ +FROM maven:3.9.12-ibm-semeru-21-noble + +USER root +# install uv +RUN apt-get update && apt-get install -y --no-install-recommends curl python3-venv python3-full \ + && curl -LsSf https://astral.sh/uv/install.sh | sh + +ENV PATH="/root/.local/bin:$PATH" + +# Shared browsers path so Chromium is cached once +ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright +RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright + +# create venv and install +RUN uv venv /opt/venv \ + && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest + +ENV PATH="/opt/venv/bin:$PATH" +RUN playwright install --with-deps chromium + +WORKDIR /app + +# Cache Maven dependencies separately from source (multi-module) +COPY pom.xml . +COPY cart-ejb/pom.xml cart-ejb/ +COPY cart-web/pom.xml cart-web/ +RUN mvn dependency:go-offline -q + +# Build application +COPY . . +RUN mvn package -DskipTests -q + +COPY test.sh . +RUN chmod +x test.sh + +CMD ["mvn", "liberty:run"] diff --git a/benchmark/business_domain/cart/jakarta/cart-ejb/pom.xml b/benchmark/business_domain/cart/jakarta/cart-ejb/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..cc146bdb3ab2d683af902eb2cc1bd86436465286 --- /dev/null +++ b/benchmark/business_domain/cart/jakarta/cart-ejb/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + jakarta.examples.tutorial.ejb.cart + cart + 10-SNAPSHOT + ../pom.xml + + cart-ejb + 10-SNAPSHOT + jar + + cart-ejb + + + 3.2 + 17 + 17 + UTF-8 + + + diff --git a/benchmark/business_domain/cart/jakarta/cart-ejb/src/main/java/jakarta/tutorial/cart/ejb/Cart.java b/benchmark/business_domain/cart/jakarta/cart-ejb/src/main/java/jakarta/tutorial/cart/ejb/Cart.java new file mode 100644 index 0000000000000000000000000000000000000000..6cbff381881a4706e7a29355f028e4dc19ad943f --- /dev/null +++ b/benchmark/business_domain/cart/jakarta/cart-ejb/src/main/java/jakarta/tutorial/cart/ejb/Cart.java @@ -0,0 +1,36 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.cart.ejb; + + +import java.util.List; + +import jakarta.ejb.Remote; +import jakarta.tutorial.cart.util.BookException; + + +@Remote +public interface Cart { + public void initialize(String person) throws BookException; + + public void initialize( + String person, + String id) throws BookException; + + public void addBook(String title); + + public void removeBook(String title) throws BookException; + + public List getContents(); + + public void remove(); +} diff --git a/benchmark/business_domain/cart/jakarta/cart-ejb/src/main/java/jakarta/tutorial/cart/ejb/CartBean.java b/benchmark/business_domain/cart/jakarta/cart-ejb/src/main/java/jakarta/tutorial/cart/ejb/CartBean.java new file mode 100644 index 0000000000000000000000000000000000000000..5bd3e741b1df947c36c1e33377948780397338a9 --- /dev/null +++ b/benchmark/business_domain/cart/jakarta/cart-ejb/src/main/java/jakarta/tutorial/cart/ejb/CartBean.java @@ -0,0 +1,82 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.cart.ejb; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import jakarta.ejb.Stateful; +import jakarta.tutorial.cart.util.BookException; +import jakarta.tutorial.cart.util.IdVerifier; + +@Stateful +public class CartBean implements Cart, Serializable { + + String customerId; + String customerName; + List contents = new ArrayList<>(); + + @Override + public void initialize(String person) throws BookException { + if (person == null) { + throw new BookException("Null person not allowed."); + } else { + customerName = person; + } + + customerId = "0"; + contents = new ArrayList<>(); + } + + @Override + public void initialize(String person, String id) throws BookException { + if (person == null) { + throw new BookException("Null person not allowed."); + } else { + customerName = person; + } + + IdVerifier idChecker = new IdVerifier(); + if (idChecker.validate(id)) { + customerId = id; + } else { + throw new BookException("Invalid id: " + id); + } + + contents = new ArrayList<>(); + } + + @Override + public void addBook(String title) { + contents.add(title); + } + + @Override + public void removeBook(String title) throws BookException { + boolean result = contents.remove(title); + + if (result == false) { + throw new BookException("\"" + title + "\" not in cart."); + } + } + + @Override + public List getContents() { + return contents; + } + + @Override + public void remove() { + contents = new ArrayList<>(); + } +} diff --git a/benchmark/business_domain/cart/jakarta/cart-ejb/src/main/java/jakarta/tutorial/cart/util/BookException.java b/benchmark/business_domain/cart/jakarta/cart-ejb/src/main/java/jakarta/tutorial/cart/util/BookException.java new file mode 100644 index 0000000000000000000000000000000000000000..5c2d348619cc8e30a5cc09da55b269c5befd18e1 --- /dev/null +++ b/benchmark/business_domain/cart/jakarta/cart-ejb/src/main/java/jakarta/tutorial/cart/util/BookException.java @@ -0,0 +1,22 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.cart.util; + +public class BookException extends Exception { + private static final long serialVersionUID = 6274585742564840905L; + public BookException() { + } + + public BookException(String msg) { + super(msg); + } +} diff --git a/benchmark/business_domain/cart/jakarta/cart-ejb/src/main/java/jakarta/tutorial/cart/util/IdVerifier.java b/benchmark/business_domain/cart/jakarta/cart-ejb/src/main/java/jakarta/tutorial/cart/util/IdVerifier.java new file mode 100644 index 0000000000000000000000000000000000000000..b55d65ffed809fb37c7cdd6ed934d358ee1829ed --- /dev/null +++ b/benchmark/business_domain/cart/jakarta/cart-ejb/src/main/java/jakarta/tutorial/cart/util/IdVerifier.java @@ -0,0 +1,29 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.cart.util; + +public class IdVerifier { + public IdVerifier() { + } + + public boolean validate(String id) { + boolean result = true; + + for (int i = 0; i < id.length(); i++) { + if (Character.isDigit(id.charAt(i)) == false) { + result = false; + } + } + + return result; + } +} diff --git a/benchmark/business_domain/cart/jakarta/cart-ejb/src/main/resources/META-INF/MANIFEST.MF b/benchmark/business_domain/cart/jakarta/cart-ejb/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000000000000000000000000000000000000..58630c02ef423cffd6dd6aafd946eb8512040c37 --- /dev/null +++ b/benchmark/business_domain/cart/jakarta/cart-ejb/src/main/resources/META-INF/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/benchmark/business_domain/cart/jakarta/cart-web/pom.xml b/benchmark/business_domain/cart/jakarta/cart-web/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..25d9463bddd19a24c286f6f3f69eb9f116e54e14 --- /dev/null +++ b/benchmark/business_domain/cart/jakarta/cart-web/pom.xml @@ -0,0 +1,82 @@ + + + + 4.0.0 + + jakarta.examples.tutorial.ejb.cart + cart + 10-SNAPSHOT + ../pom.xml + + cart-web + war + + + 17 + 17 + UTF-8 + + + cart-web + + + + ${project.groupId} + cart-ejb + ${project.version} + + + + + + + org.apache.maven.plugins + maven-war-plugin + + false + **/*.class,**/*.xml,**/*.properties,WEB-INF/lib/*.jar + + + + io.openliberty.tools + liberty-maven-plugin + + + io.openliberty + openliberty-kernel + ${liberty.runtime.version} + zip + + defaultServer + true + project + true + apps + + + + package-server + package + + create + install-feature + deploy + + + + + + + diff --git a/benchmark/business_domain/cart/jakarta/cart-web/src/main/java/jakarta/tutorial/cart/web/CartResource.java b/benchmark/business_domain/cart/jakarta/cart-web/src/main/java/jakarta/tutorial/cart/web/CartResource.java new file mode 100644 index 0000000000000000000000000000000000000000..175ce754b77ac5fa2b96b54a545bf1c46b4eaa21 --- /dev/null +++ b/benchmark/business_domain/cart/jakarta/cart-web/src/main/java/jakarta/tutorial/cart/web/CartResource.java @@ -0,0 +1,173 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.cart.web; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import jakarta.ejb.EJB; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.tutorial.cart.ejb.Cart; +import jakarta.tutorial.cart.util.BookException; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; + +/** + * REST resource for cart operations. + * Provides HTTP endpoints to interact with the shopping cart EJB. + */ +@Path("/cart") +@ApplicationScoped +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public class CartResource { + + @EJB + private Cart cart; + + /** + * Initialize a new cart session. + * POST /api/cart/initialize + * Body: {"customerName": "John Doe", "customerId": "123"} + */ + @POST + @Path("/initialize") + public Response initializeCart(CustomerRequest request) { + try { + if (request.customerId != null && !request.customerId.isEmpty()) { + cart.initialize(request.customerName, request.customerId); + } else { + cart.initialize(request.customerName); + } + + Map response = new HashMap<>(); + response.put("message", "Cart initialized successfully"); + response.put("customerName", request.customerName); + + return Response.ok(response).build(); + } catch (BookException e) { + return Response.status(Response.Status.BAD_REQUEST) + .entity(Map.of("error", e.getMessage())) + .build(); + } + } + + /** + * Add a book to the cart. + * POST /api/cart/books/{title} + */ + @POST + @Path("/books/{title}") + public Response addBook(@PathParam("title") String title) { + try { + cart.addBook(title); + + Map response = new HashMap<>(); + response.put("message", "Book added successfully"); + response.put("title", title); + response.put("cartSize", cart.getContents().size()); + + return Response.ok(response).build(); + } catch (Exception e) { + return Response.status(Response.Status.INTERNAL_SERVER_ERROR) + .entity(Map.of("error", e.getMessage())) + .build(); + } + } + + /** + * Remove a book from the cart. + * DELETE /api/cart/books/{title} + */ + @DELETE + @Path("/books/{title}") + public Response removeBook(@PathParam("title") String title) { + try { + cart.removeBook(title); + + Map response = new HashMap<>(); + response.put("message", "Book removed successfully"); + response.put("title", title); + response.put("cartSize", cart.getContents().size()); + + return Response.ok(response).build(); + } catch (BookException e) { + return Response.status(Response.Status.NOT_FOUND) + .entity(Map.of("error", e.getMessage())) + .build(); + } + } + + /** + * Get all books in the cart. + * GET /api/cart/books + */ + @GET + @Path("/books") + public Response getBooks() { + try { + List contents = cart.getContents(); + + Map response = new HashMap<>(); + response.put("books", contents); + response.put("count", contents.size()); + + return Response.ok(response).build(); + } catch (Exception e) { + return Response.status(Response.Status.INTERNAL_SERVER_ERROR) + .entity(Map.of("error", e.getMessage())) + .build(); + } + } + + /** + * Clear the cart and end the session. + * DELETE /api/cart + */ + @DELETE + public Response clearCart() { + try { + cart.remove(); + + return Response.ok(Map.of("message", "Cart cleared successfully")).build(); + } catch (Exception e) { + return Response.status(Response.Status.INTERNAL_SERVER_ERROR) + .entity(Map.of("error", e.getMessage())) + .build(); + } + } + + /** + * Health check endpoint. + * GET /api/cart/health + */ + @GET + @Path("/health") + public Response health() { + return Response.ok(Map.of("status", "UP", "service", "cart-api")).build(); + } + + // Request/Response DTOs + public static class CustomerRequest { + public String customerName; + public String customerId; + } +} diff --git a/benchmark/business_domain/cart/jakarta/cart-web/src/main/java/jakarta/tutorial/cart/web/RestApplication.java b/benchmark/business_domain/cart/jakarta/cart-web/src/main/java/jakarta/tutorial/cart/web/RestApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..0f7543b4c056db0bf5d058ddee312895452bbdbb --- /dev/null +++ b/benchmark/business_domain/cart/jakarta/cart-web/src/main/java/jakarta/tutorial/cart/web/RestApplication.java @@ -0,0 +1,25 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.cart.web; + +import jakarta.ws.rs.ApplicationPath; +import jakarta.ws.rs.core.Application; + +/** + * JAX-RS Application configuration class. + * Maps the REST API to /api/* + */ +@ApplicationPath("/api") +public class RestApplication extends Application { + // No additional configuration needed + // JAX-RS will auto-discover resource classes +} diff --git a/benchmark/business_domain/cart/jakarta/cart-web/src/main/liberty/config/server.xml b/benchmark/business_domain/cart/jakarta/cart-web/src/main/liberty/config/server.xml new file mode 100644 index 0000000000000000000000000000000000000000..8f5b6ca812d292029faeec64e02cb0bdd46fce1f --- /dev/null +++ b/benchmark/business_domain/cart/jakarta/cart-web/src/main/liberty/config/server.xml @@ -0,0 +1,46 @@ + + + + + + jakartaee-9.1 + localConnector-1.0 + + + + + + + + + + + + + + + + + + + + + + + + + admin + + + + + + diff --git a/benchmark/business_domain/cart/jakarta/cart-web/src/main/webapp/WEB-INF/beans.xml b/benchmark/business_domain/cart/jakarta/cart-web/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 0000000000000000000000000000000000000000..2fcf744a0fec0c19809dcbb0f4bdd1125ad0eb9b --- /dev/null +++ b/benchmark/business_domain/cart/jakarta/cart-web/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,7 @@ + + + diff --git a/benchmark/business_domain/cart/jakarta/mvnw b/benchmark/business_domain/cart/jakarta/mvnw new file mode 100644 index 0000000000000000000000000000000000000000..41c0f0c23db5dca836d3db1a17a7a28444d17d74 --- /dev/null +++ b/benchmark/business_domain/cart/jakarta/mvnw @@ -0,0 +1,310 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/benchmark/business_domain/cart/jakarta/mvnw.cmd b/benchmark/business_domain/cart/jakarta/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..86115719e5383e94597f918bf18c5ecbb7cfe492 --- /dev/null +++ b/benchmark/business_domain/cart/jakarta/mvnw.cmd @@ -0,0 +1,182 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/benchmark/business_domain/cart/jakarta/pom.xml b/benchmark/business_domain/cart/jakarta/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..880859a6fbc0a394bf007f47a3bc448480431794 --- /dev/null +++ b/benchmark/business_domain/cart/jakarta/pom.xml @@ -0,0 +1,112 @@ + + + + 4.0.0 + + jakarta.examples.tutorial.ejb.cart + cart + 10-SNAPSHOT + pom + + cart + + + 3.8.1 + 3.3.1 + 3.1.0 + 3.1.0 + 3.1.0 + 2.4 + 3.0.0 + 3.10.3 + 24.0.0.11 + UTF-8 + 9.0.0 + + + + cart-ejb + cart-web + + + + + jakarta.platform + jakarta.jakartaee-api + ${jakarta.jakartaee-api.version} + provided + + + + + ${project.artifactId} + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven.compiler.plugin.version} + + + org.apache.maven.plugins + maven-war-plugin + ${maven.war.plugin.version} + + + org.apache.maven.plugins + maven-ejb-plugin + ${maven.ejb.plugin.version} + + + org.apache.maven.plugins + maven-ear-plugin + ${maven.ear.plugin.version} + + + org.apache.maven.plugins + maven-acr-plugin + ${maven.acr.plugin.version} + + + org.codehaus.mojo + exec-maven-plugin + ${maven.exec.plugin.version} + + + org.apache.maven.plugins + maven-rar-plugin + ${maven.rar.plugin.version} + + + io.openliberty.tools + liberty-maven-plugin + ${liberty.maven.plugin.version} + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 11 + 11 + + + + + + diff --git a/benchmark/business_domain/cart/jakarta/test.sh b/benchmark/business_domain/cart/jakarta/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..de303fa76830ac818c473cbec5a7452e64dd81e3 --- /dev/null +++ b/benchmark/business_domain/cart/jakarta/test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +BASE_URL="${BASE_URL:-http://localhost:9080/cart}" + +echo "Health check: ${BASE_URL}" +HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}") + +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "PASS - got HTTP ${HTTP_STATUS}" + exit 0 +else + echo "FAIL - got HTTP ${HTTP_STATUS}" + exit 1 +fi diff --git a/benchmark/business_domain/cart/quarkus/.dockerignore b/benchmark/business_domain/cart/quarkus/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..c634c57d9244b4e60b8fa936f09dbe4e75706e74 --- /dev/null +++ b/benchmark/business_domain/cart/quarkus/.dockerignore @@ -0,0 +1,41 @@ +# VCS +.git/ + +# Maven +.mvn/ +**/.mvn/ +mvnw +mvnw.cmd +**/mvnw +**/mvnw.cmd +target/ +**/target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties + +# IDE / Editor +.vscode/ +**/.vscode/ +.zed/ +**/.zed/ +.idea/ +**/.idea/ +*.iml +*.ipr +*.iws + +# OS +.DS_Store +**/.DS_Store +Thumbs.db +ehthumbs.db + +# Logs / temp +*.log +*.tmp +*.temp diff --git a/benchmark/business_domain/cart/quarkus/.mvn/wrapper/MavenWrapperDownloader.java b/benchmark/business_domain/cart/quarkus/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000000000000000000000000000000000..b901097f2db6e50097dc0b222204a88f8cea1609 --- /dev/null +++ b/benchmark/business_domain/cart/quarkus/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/benchmark/business_domain/cart/quarkus/.mvn/wrapper/maven-wrapper.properties b/benchmark/business_domain/cart/quarkus/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..43ad4f7bc95d51463a4cea4b6d84e6e069b98f1f --- /dev/null +++ b/benchmark/business_domain/cart/quarkus/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/benchmark/business_domain/cart/quarkus/Dockerfile b/benchmark/business_domain/cart/quarkus/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..3b2c997cdbb3d072455fe712d671ce8ef995bd00 --- /dev/null +++ b/benchmark/business_domain/cart/quarkus/Dockerfile @@ -0,0 +1,36 @@ +FROM maven:3.9.12-ibm-semeru-21-noble + +USER root +# install uv +RUN apt-get update && apt-get install -y --no-install-recommends curl lsof python3-venv python3-full \ + && curl -LsSf https://astral.sh/uv/install.sh | sh + +ENV PATH="/root/.local/bin:$PATH" + +# Shared browsers path so Chromium is cached once +ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright +RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright + +# create venv and install +RUN uv venv /opt/venv \ + && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest + +ENV PATH="/opt/venv/bin:$PATH" +RUN playwright install --with-deps chromium + +WORKDIR /app + +# Cache Maven dependencies separately from source (multi-module) +COPY pom.xml . +COPY cart-ejb/pom.xml cart-ejb/ +COPY cart-web/pom.xml cart-web/ +RUN mvn dependency:go-offline -q + +# Build application +COPY . . +RUN mvn install -pl cart-web -am -DskipTests -q + +COPY test.sh . +RUN chmod +x test.sh + +CMD ["java", "-jar", "cart-web/target/quarkus-app/quarkus-run.jar"] diff --git a/benchmark/business_domain/cart/quarkus/cart-ejb/pom.xml b/benchmark/business_domain/cart/quarkus/cart-ejb/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..2ccc4250e5648cc51d56f10ce69e35ecf086f833 --- /dev/null +++ b/benchmark/business_domain/cart/quarkus/cart-ejb/pom.xml @@ -0,0 +1,45 @@ + + + 4.0.0 + + quarkus.examples.tutorial.cart + parent + 1.0.0-SNAPSHOT + ../pom.xml + + cart-ejb + cart-ejb + + + 17 + UTF-8 + + + + + io.quarkus + quarkus-arc + + + + + + + io.smallrye + jandex-maven-plugin + 3.5.0 + + + make-index + + jandex + + + + + + + + diff --git a/benchmark/business_domain/cart/quarkus/cart-ejb/src/main/java/quarkus/tutorial/cart/service/Cart.java b/benchmark/business_domain/cart/quarkus/cart-ejb/src/main/java/quarkus/tutorial/cart/service/Cart.java new file mode 100644 index 0000000000000000000000000000000000000000..b611f7282006e617e1a19a11d2b9ee1f5a131b7c --- /dev/null +++ b/benchmark/business_domain/cart/quarkus/cart-ejb/src/main/java/quarkus/tutorial/cart/service/Cart.java @@ -0,0 +1,20 @@ +package quarkus.tutorial.cart.service; + +import java.util.List; +import quarkus.tutorial.cart.util.BookException; + +public interface Cart { + public void initialize(String person) throws BookException; + + public void initialize( + String person, + String id) throws BookException; + + public void addBook(String title); + + public void removeBook(String title) throws BookException; + + public List getContents(); + + public void remove(); +} diff --git a/benchmark/business_domain/cart/quarkus/cart-ejb/src/main/java/quarkus/tutorial/cart/service/CartBean.java b/benchmark/business_domain/cart/quarkus/cart-ejb/src/main/java/quarkus/tutorial/cart/service/CartBean.java new file mode 100644 index 0000000000000000000000000000000000000000..c112f16d4977b66b853f4340918a92e12759ad69 --- /dev/null +++ b/benchmark/business_domain/cart/quarkus/cart-ejb/src/main/java/quarkus/tutorial/cart/service/CartBean.java @@ -0,0 +1,70 @@ +package quarkus.tutorial.cart.service; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import jakarta.enterprise.context.SessionScoped; +import quarkus.tutorial.cart.util.BookException; +import quarkus.tutorial.cart.util.IdVerifier; + +@SessionScoped +public class CartBean implements Cart, Serializable { + + String customerId; + String customerName; + List contents = new ArrayList<>(); + + @Override + public void initialize(String person) throws BookException { + if (person == null) { + throw new BookException("Null person not allowed."); + } else { + customerName = person; + } + + customerId = "0"; + contents = new ArrayList<>(); + } + + @Override + public void initialize(String person, String id) throws BookException { + if (person == null) { + throw new BookException("Null person not allowed."); + } else { + customerName = person; + } + + IdVerifier idChecker = new IdVerifier(); + if (idChecker.validate(id)) { + customerId = id; + } else { + throw new BookException("Invalid id: " + id); + } + + contents = new ArrayList<>(); + } + + @Override + public void addBook(String title) { + contents.add(title); + } + + @Override + public void removeBook(String title) throws BookException { + boolean result = contents.remove(title); + + if (result == false) { + throw new BookException("\"" + title + "\" not in cart."); + } + } + + @Override + public List getContents() { + return contents; + } + + @Override + public void remove() { + contents = new ArrayList<>(); + } +} diff --git a/benchmark/business_domain/cart/quarkus/cart-ejb/src/main/java/quarkus/tutorial/cart/util/BookException.java b/benchmark/business_domain/cart/quarkus/cart-ejb/src/main/java/quarkus/tutorial/cart/util/BookException.java new file mode 100644 index 0000000000000000000000000000000000000000..23611645e60592a398317abfe7db788f74aea61a --- /dev/null +++ b/benchmark/business_domain/cart/quarkus/cart-ejb/src/main/java/quarkus/tutorial/cart/util/BookException.java @@ -0,0 +1,11 @@ +package quarkus.tutorial.cart.util; + +public class BookException extends Exception { + private static final long serialVersionUID = 6274585742564840905L; + + public BookException() {} + + public BookException(String msg) { + super(msg); + } +} diff --git a/benchmark/business_domain/cart/quarkus/cart-ejb/src/main/java/quarkus/tutorial/cart/util/IdVerifier.java b/benchmark/business_domain/cart/quarkus/cart-ejb/src/main/java/quarkus/tutorial/cart/util/IdVerifier.java new file mode 100644 index 0000000000000000000000000000000000000000..759f17a1f02f40e0a0110949fe916e1088889111 --- /dev/null +++ b/benchmark/business_domain/cart/quarkus/cart-ejb/src/main/java/quarkus/tutorial/cart/util/IdVerifier.java @@ -0,0 +1,17 @@ +package quarkus.tutorial.cart.util; + +public class IdVerifier { + public IdVerifier() {} + + public boolean validate(String id) { + boolean result = true; + + for (int i = 0; i < id.length(); i++) { + if (Character.isDigit(id.charAt(i)) == false) { + result = false; + } + } + + return result; + } +} diff --git a/benchmark/business_domain/cart/quarkus/cart-web/pom.xml b/benchmark/business_domain/cart/quarkus/cart-web/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..1c8a6ba1de159152896bf14196b55a5d98d18614 --- /dev/null +++ b/benchmark/business_domain/cart/quarkus/cart-web/pom.xml @@ -0,0 +1,77 @@ + + + 4.0.0 + + quarkus.examples.tutorial.cart + parent + 1.0.0-SNAPSHOT + ../pom.xml + + cart-web + cart-web + + + 17 + UTF-8 + + + + + io.quarkus + quarkus-arc + + + io.quarkus + quarkus-resteasy + + + io.quarkus + quarkus-resteasy-jackson + + + + io.quarkus + quarkus-undertow + + + + quarkus.examples.tutorial.cart + cart-ejb + ${project.version} + + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + + + + + ${quarkus.platform.group-id} + quarkus-maven-plugin + true + + + + build + generate-code + generate-code-tests + native-image-agent + + + + + + + + diff --git a/benchmark/business_domain/cart/quarkus/cart-web/src/main/docker/Dockerfile.jvm b/benchmark/business_domain/cart/quarkus/cart-web/src/main/docker/Dockerfile.jvm new file mode 100644 index 0000000000000000000000000000000000000000..c9d7efa883a23545f6e8e17b90e420912d939565 --- /dev/null +++ b/benchmark/business_domain/cart/quarkus/cart-web/src/main/docker/Dockerfile.jvm @@ -0,0 +1,98 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode +# +# Before building the container image run: +# +# ./mvnw package +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/cart-jvm . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/cart-jvm +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005. +# Additionally you will have to set -e JAVA_DEBUG=true and -e JAVA_DEBUG_PORT=*:5005 +# when running the container +# +# Then run the container using : +# +# docker run -i --rm -p 8080:8080 quarkus/cart-jvm +# +# This image uses the `run-java.sh` script to run the application. +# This scripts computes the command line to execute your Java application, and +# includes memory/GC tuning. +# You can configure the behavior using the following environment properties: +# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class") - Be aware that this will override +# the default JVM options, use `JAVA_OPTS_APPEND` to append options +# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options +# in JAVA_OPTS (example: "-Dsome.property=foo") +# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is +# used to calculate a default maximal heap memory based on a containers restriction. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio +# of the container available memory as set here. The default is `50` which means 50% +# of the available memory is used as an upper boundary. You can skip this mechanism by +# setting this value to `0` in which case no `-Xmx` option is added. +# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This +# is used to calculate a default initial heap memory based on the maximum heap memory. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio +# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx` +# is used as the initial heap size. You can skip this mechanism by setting this value +# to `0` in which case no `-Xms` option is added (example: "25") +# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS. +# This is used to calculate the maximum value of the initial heap memory. If used in +# a container without any memory constraints for the container then this option has +# no effect. If there is a memory constraint then `-Xms` is limited to the value set +# here. The default is 4096MB which means the calculated value of `-Xms` never will +# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096") +# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output +# when things are happening. This option, if set to true, will set +# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true"). +# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example: +# true"). +# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787"). +# - CONTAINER_CORE_LIMIT: A calculated core limit as described in +# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2") +# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024"). +# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion. +# (example: "20") +# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking. +# (example: "40") +# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection. +# (example: "4") +# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus +# previous GC times. (example: "90") +# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20") +# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100") +# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should +# contain the necessary JRE command-line options to specify the required GC, which +# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC). +# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080") +# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080") +# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be +# accessed directly. (example: "foo.example.com,bar.example.com") +# +### +FROM registry.access.redhat.com/ubi9/openjdk-21:1.23 + +ENV LANGUAGE='en_US:en' + + +# We make four distinct layers so if there are application changes the library layers can be re-used +COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/ +COPY --chown=185 target/quarkus-app/*.jar /deployments/ +COPY --chown=185 target/quarkus-app/app/ /deployments/app/ +COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/ + +EXPOSE 8080 +USER 185 +ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" + +ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ] + diff --git a/benchmark/business_domain/cart/quarkus/cart-web/src/main/docker/Dockerfile.legacy-jar b/benchmark/business_domain/cart/quarkus/cart-web/src/main/docker/Dockerfile.legacy-jar new file mode 100644 index 0000000000000000000000000000000000000000..63f4d24e2d609586003724b27b0b0ca3dec74d78 --- /dev/null +++ b/benchmark/business_domain/cart/quarkus/cart-web/src/main/docker/Dockerfile.legacy-jar @@ -0,0 +1,94 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode +# +# Before building the container image run: +# +# ./mvnw package -Dquarkus.package.jar.type=legacy-jar +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.legacy-jar -t quarkus/cart-legacy-jar . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/cart-legacy-jar +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005. +# Additionally you will have to set -e JAVA_DEBUG=true and -e JAVA_DEBUG_PORT=*:5005 +# when running the container +# +# Then run the container using : +# +# docker run -i --rm -p 8080:8080 quarkus/cart-legacy-jar +# +# This image uses the `run-java.sh` script to run the application. +# This scripts computes the command line to execute your Java application, and +# includes memory/GC tuning. +# You can configure the behavior using the following environment properties: +# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class") - Be aware that this will override +# the default JVM options, use `JAVA_OPTS_APPEND` to append options +# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options +# in JAVA_OPTS (example: "-Dsome.property=foo") +# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is +# used to calculate a default maximal heap memory based on a containers restriction. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio +# of the container available memory as set here. The default is `50` which means 50% +# of the available memory is used as an upper boundary. You can skip this mechanism by +# setting this value to `0` in which case no `-Xmx` option is added. +# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This +# is used to calculate a default initial heap memory based on the maximum heap memory. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio +# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx` +# is used as the initial heap size. You can skip this mechanism by setting this value +# to `0` in which case no `-Xms` option is added (example: "25") +# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS. +# This is used to calculate the maximum value of the initial heap memory. If used in +# a container without any memory constraints for the container then this option has +# no effect. If there is a memory constraint then `-Xms` is limited to the value set +# here. The default is 4096MB which means the calculated value of `-Xms` never will +# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096") +# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output +# when things are happening. This option, if set to true, will set +# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true"). +# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example: +# true"). +# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787"). +# - CONTAINER_CORE_LIMIT: A calculated core limit as described in +# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2") +# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024"). +# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion. +# (example: "20") +# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking. +# (example: "40") +# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection. +# (example: "4") +# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus +# previous GC times. (example: "90") +# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20") +# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100") +# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should +# contain the necessary JRE command-line options to specify the required GC, which +# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC). +# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080") +# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080") +# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be +# accessed directly. (example: "foo.example.com,bar.example.com") +# +### +FROM registry.access.redhat.com/ubi9/openjdk-21:1.23 + +ENV LANGUAGE='en_US:en' + + +COPY target/lib/* /deployments/lib/ +COPY target/*-runner.jar /deployments/quarkus-run.jar + +EXPOSE 8080 +USER 185 +ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" + +ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ] diff --git a/benchmark/business_domain/cart/quarkus/cart-web/src/main/docker/Dockerfile.native b/benchmark/business_domain/cart/quarkus/cart-web/src/main/docker/Dockerfile.native new file mode 100644 index 0000000000000000000000000000000000000000..16e6589132aaa11d2907fc6bc8f49ccd82d00222 --- /dev/null +++ b/benchmark/business_domain/cart/quarkus/cart-web/src/main/docker/Dockerfile.native @@ -0,0 +1,29 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. +# +# Before building the container image run: +# +# ./mvnw package -Dnative +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.native -t quarkus/cart . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/cart +# +# The ` registry.access.redhat.com/ubi9/ubi-minimal:9.6` base image is based on UBI 9. +# To use UBI 8, switch to `quay.io/ubi8/ubi-minimal:8.10`. +### +FROM registry.access.redhat.com/ubi9/ubi-minimal:9.6 +WORKDIR /work/ +RUN chown 1001 /work \ + && chmod "g+rwX" /work \ + && chown 1001:root /work +COPY --chown=1001:root --chmod=0755 target/*-runner /work/application + +EXPOSE 8080 +USER 1001 + +ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/benchmark/business_domain/cart/quarkus/cart-web/src/main/docker/Dockerfile.native-micro b/benchmark/business_domain/cart/quarkus/cart-web/src/main/docker/Dockerfile.native-micro new file mode 100644 index 0000000000000000000000000000000000000000..537cd10b6c68f46b7bc93c3cf9178359c71b34e5 --- /dev/null +++ b/benchmark/business_domain/cart/quarkus/cart-web/src/main/docker/Dockerfile.native-micro @@ -0,0 +1,32 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. +# It uses a micro base image, tuned for Quarkus native executables. +# It reduces the size of the resulting container image. +# Check https://quarkus.io/guides/quarkus-runtime-base-image for further information about this image. +# +# Before building the container image run: +# +# ./mvnw package -Dnative +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.native-micro -t quarkus/cart . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/cart +# +# The `quay.io/quarkus/ubi9-quarkus-micro-image:2.0` base image is based on UBI 9. +# To use UBI 8, switch to `quay.io/quarkus/quarkus-micro-image:2.0`. +### +FROM quay.io/quarkus/ubi9-quarkus-micro-image:2.0 +WORKDIR /work/ +RUN chown 1001 /work \ + && chmod "g+rwX" /work \ + && chown 1001:root /work +COPY --chown=1001:root --chmod=0755 target/*-runner /work/application + +EXPOSE 8080 +USER 1001 + +ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/benchmark/business_domain/cart/quarkus/cart-web/src/main/java/quarkus/tutorial/cart/CartResource.java b/benchmark/business_domain/cart/quarkus/cart-web/src/main/java/quarkus/tutorial/cart/CartResource.java new file mode 100644 index 0000000000000000000000000000000000000000..732f3e7cd658ab1bcb00ed0cf3749ff51c47c25e --- /dev/null +++ b/benchmark/business_domain/cart/quarkus/cart-web/src/main/java/quarkus/tutorial/cart/CartResource.java @@ -0,0 +1,174 @@ +package quarkus.tutorial.cart; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import quarkus.tutorial.cart.service.Cart; +import quarkus.tutorial.cart.util.BookException; + +/** + * REST resource for cart operations. + * + * Provides HTTP endpoints to interact with the shopping cart EJB. + */ +@Path("/api/cart") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +@RequestScoped +public class CartResource { + + @Inject + Cart cart; + + /** + * Initialize a new cart session. + * + * POST /api/cart/initialize + * + * Body: {"customerName": "John Doe", "customerId": "123"} + */ + @POST + @Path("/initialize") + public Response initializeCart(CustomerRequest request) { + try { + if (request.customerId != null && !request.customerId.isEmpty()) { + cart.initialize(request.customerName, request.customerId); + } else { + cart.initialize(request.customerName); + } + + Map response = new HashMap<>(); + response.put("message", "Cart initialized successfully"); + response.put("customerName", request.customerName); + + return Response.ok(response).build(); + } catch (BookException e) { + return Response.status(Response.Status.BAD_REQUEST) + .entity(Map.of("error", e.getMessage())) + .build(); + } + } + + /** + * Add a book to the cart. + * + * POST /api/cart/books/{title} + */ + @POST + @Path("/books/{title}") + public Response addBook(@PathParam("title") String title) { + try { + cart.addBook(title); + + Map response = new HashMap<>(); + response.put("message", "Book added successfully"); + response.put("title", title); + response.put("cartSize", cart.getContents().size()); + + return Response.ok(response).build(); + } catch (Exception e) { + return Response.status(Response.Status.INTERNAL_SERVER_ERROR) + .entity(Map.of("error", e.getMessage())) + .build(); + } + } + + /** + * Remove a book from the cart. + * + * DELETE /api/cart/books/{title} + */ + @DELETE + @Path("/books/{title}") + public Response removeBook(@PathParam("title") String title) { + try { + cart.removeBook(title); + + Map response = new HashMap<>(); + response.put("message", "Book removed successfully"); + response.put("title", title); + response.put("cartSize", cart.getContents().size()); + + return Response.ok(response).build(); + } catch (BookException e) { + return Response.status(Response.Status.NOT_FOUND) + .entity(Map.of("error", e.getMessage())) + .build(); + } + } + + /** + * Get all books in the cart. + * + * GET /api/cart/books + */ + @GET + @Path("/books") + public Response getBooks() { + try { + List contents = cart.getContents(); + + Map response = new HashMap<>(); + response.put("books", contents); + response.put("count", contents.size()); + + return Response.ok(response).build(); + } catch (Exception e) { + return Response.status(Response.Status.INTERNAL_SERVER_ERROR) + .entity(Map.of("error", e.getMessage())) + .build(); + } + } + + /** + * Clear the cart and end the session. + * + * DELETE /api/cart + */ + @DELETE + public Response clearCart(@Context HttpServletRequest request) { + try { + // Simulate EJB @Remove by clearing the session and destroying the bean + var session = request.getSession(false); + if (session != null) { + session.invalidate(); + } + + return Response.ok(Map.of("message", "Cart cleared successfully")).build(); + } catch (Exception e) { + return Response.status(Response.Status.INTERNAL_SERVER_ERROR) + .entity(Map.of("error", e.getMessage())) + .build(); + } + } + + /** + * Health check endpoint. + * + * GET /api/cart/health + */ + @GET + @Path("/health") + public Response health() { + return Response.ok(Map.of("status", "UP", "service", "cart-api")).build(); + } + + // Request/Response DTOs + public static class CustomerRequest { + public String customerName; + public String customerId; + } +} diff --git a/benchmark/business_domain/cart/quarkus/cart-web/src/main/resources/application.properties b/benchmark/business_domain/cart/quarkus/cart-web/src/main/resources/application.properties new file mode 100644 index 0000000000000000000000000000000000000000..493c927561bf0837c23361ca9932d3fe286df21f --- /dev/null +++ b/benchmark/business_domain/cart/quarkus/cart-web/src/main/resources/application.properties @@ -0,0 +1 @@ +quarkus.http.root-path=/cart \ No newline at end of file diff --git a/benchmark/business_domain/cart/quarkus/mvnw b/benchmark/business_domain/cart/quarkus/mvnw new file mode 100644 index 0000000000000000000000000000000000000000..5e9618cac26d1c3254dc88232a8c4d841316bd29 --- /dev/null +++ b/benchmark/business_domain/cart/quarkus/mvnw @@ -0,0 +1,332 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.2 +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ]; then + + if [ -f /usr/local/etc/mavenrc ]; then + . /usr/local/etc/mavenrc + fi + + if [ -f /etc/mavenrc ]; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ]; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false +darwin=false +mingw=false +case "$(uname)" in +CYGWIN*) cygwin=true ;; +MINGW*) mingw=true ;; +Darwin*) + darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + JAVA_HOME="$(/usr/libexec/java_home)" + export JAVA_HOME + else + JAVA_HOME="/Library/Java/Home" + export JAVA_HOME + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ]; then + if [ -r /etc/gentoo-release ]; then + JAVA_HOME=$(java-config --jre-home) + fi +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin; then + [ -n "$JAVA_HOME" ] \ + && JAVA_HOME=$(cygpath --unix "$JAVA_HOME") + [ -n "$CLASSPATH" ] \ + && CLASSPATH=$(cygpath --path --unix "$CLASSPATH") +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw; then + [ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] \ + && JAVA_HOME="$( + cd "$JAVA_HOME" || ( + echo "cannot cd into $JAVA_HOME." >&2 + exit 1 + ) + pwd + )" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="$(which javac)" + if [ -n "$javaExecutable" ] && ! [ "$(expr "$javaExecutable" : '\([^ ]*\)')" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=$(which readlink) + if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then + if $darwin; then + javaHome="$(dirname "$javaExecutable")" + javaExecutable="$(cd "$javaHome" && pwd -P)/javac" + else + javaExecutable="$(readlink -f "$javaExecutable")" + fi + javaHome="$(dirname "$javaExecutable")" + javaHome=$(expr "$javaHome" : '\(.*\)/bin') + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ]; then + if [ -n "$JAVA_HOME" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="$( + \unset -f command 2>/dev/null + \command -v java + )" + fi +fi + +if [ ! -x "$JAVACMD" ]; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ]; then + echo "Warning: JAVA_HOME environment variable is not set." >&2 +fi + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + if [ -z "$1" ]; then + echo "Path not specified to find_maven_basedir" >&2 + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ]; do + if [ -d "$wdir"/.mvn ]; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=$( + cd "$wdir/.." || exit 1 + pwd + ) + fi + # end of workaround + done + printf '%s' "$( + cd "$basedir" || exit 1 + pwd + )" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + # Remove \r in case we run on Windows within Git Bash + # and check out the repository with auto CRLF management + # enabled. Otherwise, we may read lines that are delimited with + # \r\n and produce $'-Xarg\r' rather than -Xarg due to word + # splitting rules. + tr -s '\r\n' ' ' <"$1" + fi +} + +log() { + if [ "$MVNW_VERBOSE" = true ]; then + printf '%s\n' "$1" + fi +} + +BASE_DIR=$(find_maven_basedir "$(dirname "$0")") +if [ -z "$BASE_DIR" ]; then + exit 1 +fi + +MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +export MAVEN_PROJECTBASEDIR +log "$MAVEN_PROJECTBASEDIR" + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" +if [ -r "$wrapperJarPath" ]; then + log "Found $wrapperJarPath" +else + log "Couldn't find $wrapperJarPath, downloading it ..." + + if [ -n "$MVNW_REPOURL" ]; then + wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar" + else + wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar" + fi + while IFS="=" read -r key value; do + # 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 '=' ) + safeValue=$(echo "$value" | tr -d '\r') + case "$key" in wrapperUrl) + wrapperUrl="$safeValue" + break + ;; + esac + done <"$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" + log "Downloading from: $wrapperUrl" + + if $cygwin; then + wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath") + fi + + if command -v wget >/dev/null; then + log "Found wget ... using wget" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet" + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + else + wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + fi + elif command -v curl >/dev/null; then + log "Found curl ... using curl" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent" + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" + else + curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" + fi + else + log "Falling back to using Java to download" + javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java" + javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaSource=$(cygpath --path --windows "$javaSource") + javaClass=$(cygpath --path --windows "$javaClass") + fi + if [ -e "$javaSource" ]; then + if [ ! -e "$javaClass" ]; then + log " - Compiling MavenWrapperDownloader.java ..." + ("$JAVA_HOME/bin/javac" "$javaSource") + fi + if [ -e "$javaClass" ]; then + log " - Running MavenWrapperDownloader.java ..." + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath" + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +# If specified, validate the SHA-256 sum of the Maven wrapper jar file +wrapperSha256Sum="" +while IFS="=" read -r key value; do + case "$key" in wrapperSha256Sum) + wrapperSha256Sum=$value + break + ;; + esac +done <"$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" +if [ -n "$wrapperSha256Sum" ]; then + wrapperSha256Result=false + if command -v sha256sum >/dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c >/dev/null 2>&1; then + wrapperSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c >/dev/null 2>&1; then + wrapperSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $wrapperSha256Result = false ]; then + echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2 + echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2 + echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2 + exit 1 + fi +fi + +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$JAVA_HOME" ] \ + && JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME") + [ -n "$CLASSPATH" ] \ + && CLASSPATH=$(cygpath --path --windows "$CLASSPATH") + [ -n "$MAVEN_PROJECTBASEDIR" ] \ + && MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR") +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +# shellcheck disable=SC2086 # safe args +exec "$JAVACMD" \ + $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/benchmark/business_domain/cart/quarkus/mvnw.cmd b/benchmark/business_domain/cart/quarkus/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..4136715f081ecad67b4ba4760f84065285a8e72b --- /dev/null +++ b/benchmark/business_domain/cart/quarkus/mvnw.cmd @@ -0,0 +1,206 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.2 +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* +if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. >&2 +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. >&2 +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. >&2 +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. >&2 +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar" + +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %WRAPPER_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file +SET WRAPPER_SHA_256_SUM="" +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B +) +IF NOT %WRAPPER_SHA_256_SUM%=="" ( + powershell -Command "&{"^ + "Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash;"^ + "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^ + "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^ + " Write-Error 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^ + " Write-Error 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^ + " Write-Error 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^ + " exit 1;"^ + "}"^ + "}" + if ERRORLEVEL 1 goto error +) + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% ^ + %JVM_CONFIG_MAVEN_PROPS% ^ + %MAVEN_OPTS% ^ + %MAVEN_DEBUG_OPTS% ^ + -classpath %WRAPPER_JAR% ^ + "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ + %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" +if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%"=="on" pause + +if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% + +cmd /C exit /B %ERROR_CODE% diff --git a/benchmark/business_domain/cart/quarkus/pom.xml b/benchmark/business_domain/cart/quarkus/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..733d392760c386e86c041d170694fcd5f74d40c6 --- /dev/null +++ b/benchmark/business_domain/cart/quarkus/pom.xml @@ -0,0 +1,102 @@ + + + 4.0.0 + quarkus.examples.tutorial.cart + parent + 1.0.0-SNAPSHOT + pom + + + 3.14.0 + 21 + UTF-8 + UTF-8 + quarkus-bom + io.quarkus.platform + 3.30.5 + true + 3.5.3 + + + + cart-ejb + cart-web + + + + + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + + + + + + + + + ${quarkus.platform.group-id} + quarkus-maven-plugin + ${quarkus.platform.version} + + + + + + maven-compiler-plugin + ${compiler-plugin.version} + + true + + + + maven-surefire-plugin + ${surefire-plugin.version} + + + org.jboss.logmanager.LogManager + ${maven.home} + + + + + maven-failsafe-plugin + ${surefire-plugin.version} + + + + integration-test + verify + + + + + + ${project.build.directory}/${project.build.finalName}-runner + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + + + + native + + + native + + + + false + true + + + + diff --git a/benchmark/business_domain/cart/quarkus/test.sh b/benchmark/business_domain/cart/quarkus/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7b2dde2c6a709b55ecbd80a6f6aed435713e4373 --- /dev/null +++ b/benchmark/business_domain/cart/quarkus/test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +BASE_URL="${BASE_URL:-http://localhost:8080/cart}" + +echo "Health check: ${BASE_URL}" +HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}") + +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "PASS - got HTTP ${HTTP_STATUS}" + exit 0 +else + echo "FAIL - got HTTP ${HTTP_STATUS}" + exit 1 +fi diff --git a/benchmark/business_domain/cart/spring/.dockerignore b/benchmark/business_domain/cart/spring/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..c634c57d9244b4e60b8fa936f09dbe4e75706e74 --- /dev/null +++ b/benchmark/business_domain/cart/spring/.dockerignore @@ -0,0 +1,41 @@ +# VCS +.git/ + +# Maven +.mvn/ +**/.mvn/ +mvnw +mvnw.cmd +**/mvnw +**/mvnw.cmd +target/ +**/target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties + +# IDE / Editor +.vscode/ +**/.vscode/ +.zed/ +**/.zed/ +.idea/ +**/.idea/ +*.iml +*.ipr +*.iws + +# OS +.DS_Store +**/.DS_Store +Thumbs.db +ehthumbs.db + +# Logs / temp +*.log +*.tmp +*.temp diff --git a/benchmark/business_domain/cart/spring/.mvn/wrapper/maven-wrapper.properties b/benchmark/business_domain/cart/spring/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..c0bcafe984fe33005eacbcfabe8b188e0f75afcd --- /dev/null +++ b/benchmark/business_domain/cart/spring/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,3 @@ +wrapperVersion=3.3.4 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip diff --git a/benchmark/business_domain/cart/spring/Dockerfile b/benchmark/business_domain/cart/spring/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..71e01742bf6a1ccaeaa840ce9b8c2a5c7c4d8859 --- /dev/null +++ b/benchmark/business_domain/cart/spring/Dockerfile @@ -0,0 +1,36 @@ +FROM maven:3.9.12-ibm-semeru-21-noble + +USER root +# install uv +RUN apt-get update && apt-get install -y --no-install-recommends curl python3-venv python3-full \ + && curl -LsSf https://astral.sh/uv/install.sh | sh + +ENV PATH="/root/.local/bin:$PATH" + +# Shared browsers path so Chromium is cached once +ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright +RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright + +# create venv and install +RUN uv venv /opt/venv \ + && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest + +ENV PATH="/opt/venv/bin:$PATH" +RUN playwright install --with-deps chromium + +WORKDIR /app + +# Cache Maven dependencies separately from source (multi-module) +COPY pom.xml . +COPY cart-ejb/pom.xml cart-ejb/ +COPY cart-web/pom.xml cart-web/ +RUN mvn dependency:go-offline -q + +# Build application +COPY . . +RUN mvn install -DskipTests -q + +COPY test.sh . +RUN chmod +x test.sh + +CMD ["mvn", "spring-boot:run", "-pl", "cart-web"] diff --git a/benchmark/business_domain/cart/spring/cart-ejb/pom.xml b/benchmark/business_domain/cart/spring/cart-ejb/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..d1715c9128bed0ace602c31d44e39bea29710add --- /dev/null +++ b/benchmark/business_domain/cart/spring/cart-ejb/pom.xml @@ -0,0 +1,29 @@ + + 4.0.0 + + spring.examples.tutorial.cart + parent + 0.0.1-SNAPSHOT + ../pom.xml + + cart-ejb + jar + + + 17 + 17 + UTF-8 + + + + + org.springframework + spring-context + + + diff --git a/benchmark/business_domain/cart/spring/cart-ejb/src/main/java/spring/examples/tutorial/cart/service/Cart.java b/benchmark/business_domain/cart/spring/cart-ejb/src/main/java/spring/examples/tutorial/cart/service/Cart.java new file mode 100644 index 0000000000000000000000000000000000000000..ae8e24a39286fd8cd4d0e4a302e2ead722b494ed --- /dev/null +++ b/benchmark/business_domain/cart/spring/cart-ejb/src/main/java/spring/examples/tutorial/cart/service/Cart.java @@ -0,0 +1,21 @@ + +package spring.examples.tutorial.cart.service; + +import java.util.List; +import spring.examples.tutorial.cart.util.BookException; + +public interface Cart { + public void initialize(String person) throws BookException; + + public void initialize( + String person, + String id) throws BookException; + + public void addBook(String title); + + public void removeBook(String title) throws BookException; + + public List getContents(); + + public void remove(); +} diff --git a/benchmark/business_domain/cart/spring/cart-ejb/src/main/java/spring/examples/tutorial/cart/service/CartServiceImpl.java b/benchmark/business_domain/cart/spring/cart-ejb/src/main/java/spring/examples/tutorial/cart/service/CartServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..4d63de6864742ff47872ebf8ab60d0638fee6729 --- /dev/null +++ b/benchmark/business_domain/cart/spring/cart-ejb/src/main/java/spring/examples/tutorial/cart/service/CartServiceImpl.java @@ -0,0 +1,68 @@ +package spring.examples.tutorial.cart.service; + +import org.springframework.context.annotation.Scope; +import org.springframework.context.annotation.ScopedProxyMode; +import org.springframework.stereotype.Service; +import spring.examples.tutorial.cart.util.BookException; +import spring.examples.tutorial.cart.util.IdVerifier; +import java.util.ArrayList; +import java.util.List; + +@Service +@Scope(value = "session", proxyMode = ScopedProxyMode.TARGET_CLASS) +public class CartServiceImpl implements Cart { + + private String customerId; + private String customerName; + private List contents = new ArrayList<>(); + + @Override + public void initialize(String person) throws BookException { + if (person == null) { + throw new BookException("Null person not allowed."); + } + customerName = person; + customerId = "0"; + contents = new ArrayList<>(); + } + + @Override + public void initialize(String person, String id) throws BookException { + if (person == null) { + throw new BookException("Null person not allowed."); + } + customerName = person; + + IdVerifier idChecker = new IdVerifier(); + if (idChecker.validate(id)) { + customerId = id; + } else { + throw new BookException("Invalid id: " + id); + } + + contents = new ArrayList<>(); + } + + @Override + public void addBook(String title) { + contents.add(title); + } + + @Override + public void removeBook(String title) throws BookException { + boolean result = contents.remove(title); + if (!result) { + throw new BookException("\"" + title + "\" not in cart."); + } + } + + @Override + public List getContents() { + return contents; + } + + @Override + public void remove() { + contents = new ArrayList<>(); + } +} diff --git a/benchmark/business_domain/cart/spring/cart-ejb/src/main/java/spring/examples/tutorial/cart/util/BookException.java b/benchmark/business_domain/cart/spring/cart-ejb/src/main/java/spring/examples/tutorial/cart/util/BookException.java new file mode 100644 index 0000000000000000000000000000000000000000..63c75cd08240d09d383403fbb5c80d123f064ccd --- /dev/null +++ b/benchmark/business_domain/cart/spring/cart-ejb/src/main/java/spring/examples/tutorial/cart/util/BookException.java @@ -0,0 +1,11 @@ +package spring.examples.tutorial.cart.util; + +public class BookException extends Exception { + private static final long serialVersionUID = 6274585742564840905L; + + public BookException() {} + + public BookException(String msg) { + super(msg); + } +} diff --git a/benchmark/business_domain/cart/spring/cart-ejb/src/main/java/spring/examples/tutorial/cart/util/IdVerifier.java b/benchmark/business_domain/cart/spring/cart-ejb/src/main/java/spring/examples/tutorial/cart/util/IdVerifier.java new file mode 100644 index 0000000000000000000000000000000000000000..1cf4507ac4afa1ed169f75bfec65ac6dd7097783 --- /dev/null +++ b/benchmark/business_domain/cart/spring/cart-ejb/src/main/java/spring/examples/tutorial/cart/util/IdVerifier.java @@ -0,0 +1,17 @@ +package spring.examples.tutorial.cart.util; + +public class IdVerifier { + public IdVerifier() {} + + public boolean validate(String id) { + boolean result = true; + + for (int i = 0; i < id.length(); i++) { + if (Character.isDigit(id.charAt(i)) == false) { + result = false; + } + } + + return result; + } +} diff --git a/benchmark/business_domain/cart/spring/cart-web/pom.xml b/benchmark/business_domain/cart/spring/cart-web/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..73418e85b55109a701cd02688569d7a8af66bc25 --- /dev/null +++ b/benchmark/business_domain/cart/spring/cart-web/pom.xml @@ -0,0 +1,57 @@ + + 4.0.0 + + spring.examples.tutorial.cart + parent + 0.0.1-SNAPSHOT + ../pom.xml + + cart-web + jar + + + 17 + 17 + UTF-8 + + + + + org.springframework.boot + spring-boot-starter-web + + + + spring.examples.tutorial.cart + cart-ejb + ${project.version} + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + spring.examples.tutorial.cart.Application + + + + + repackage + + + + + + + diff --git a/benchmark/business_domain/cart/spring/cart-web/src/main/java/spring/examples/tutorial/cart/Application.java b/benchmark/business_domain/cart/spring/cart-web/src/main/java/spring/examples/tutorial/cart/Application.java new file mode 100644 index 0000000000000000000000000000000000000000..21a2a940f97068aba7dc3ecb6490e7981647a75e --- /dev/null +++ b/benchmark/business_domain/cart/spring/cart-web/src/main/java/spring/examples/tutorial/cart/Application.java @@ -0,0 +1,13 @@ +package spring.examples.tutorial.cart; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/benchmark/business_domain/cart/spring/cart-web/src/main/java/spring/examples/tutorial/cart/CartController.java b/benchmark/business_domain/cart/spring/cart-web/src/main/java/spring/examples/tutorial/cart/CartController.java new file mode 100644 index 0000000000000000000000000000000000000000..c7ae91f040ec97978df840afa495780c781555dd --- /dev/null +++ b/benchmark/business_domain/cart/spring/cart-web/src/main/java/spring/examples/tutorial/cart/CartController.java @@ -0,0 +1,149 @@ +package spring.examples.tutorial.cart; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; +import jakarta.servlet.http.HttpSession; +import spring.examples.tutorial.cart.util.BookException; +import spring.examples.tutorial.cart.service.Cart; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/api/cart") +public class CartController { + + private final Cart cart; + + public CartController(Cart cart) { + this.cart = cart; + } + + /** + * Initialize a new cart session. + * + * POST /api/cart/initialize + * + * Body: {"customerName": "John Doe", "customerId": "123"} + */ + @PostMapping("/initialize") + public ResponseEntity initializeCart(@RequestBody CustomerRequest request) { + try { + if (request.customerId != null && !request.customerId.isEmpty()) { + cart.initialize(request.customerName, request.customerId); + } else { + cart.initialize(request.customerName); + } + + Map response = new HashMap<>(); + response.put("message", "Cart initialized successfully"); + response.put("customerName", request.customerName); + + return ResponseEntity.ok(response); + } catch (BookException e) { + return ResponseEntity.status(HttpStatus.BAD_REQUEST) + .body(Map.of("error", e.getMessage())); + } + } + + /** + * Add a book to the cart. + * + * POST /api/cart/books/{title} + */ + @PostMapping("/books/{title}") + public ResponseEntity addBook(@PathVariable("title") String title) { + try { + cart.addBook(title); + + Map response = new HashMap<>(); + response.put("message", "Book added successfully"); + response.put("title", title); + response.put("cartSize", cart.getContents().size()); + + return ResponseEntity.ok(response); + } catch (Exception e) { + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) + .body(Map.of("error", e.getMessage())); + } + } + + /** + * Remove a book from the cart. + * + * DELETE /api/cart/books/{title} + */ + @DeleteMapping("/books/{title}") + public ResponseEntity removeBook(@PathVariable("title") String title) { + try { + cart.removeBook(title); + + Map response = new HashMap<>(); + response.put("message", "Book removed successfully"); + response.put("title", title); + response.put("cartSize", cart.getContents().size()); + + return ResponseEntity.ok(response); + } catch (BookException e) { + return ResponseEntity.status(HttpStatus.NOT_FOUND) + .body(Map.of("error", e.getMessage())); + } + } + + /** + * Get all books in the cart. + * + * GET /api/cart/books + */ + @GetMapping("/books") + public ResponseEntity getBooks() { + try { + List contents = cart.getContents(); + + Map response = new HashMap<>(); + response.put("books", contents); + response.put("count", contents.size()); + + return ResponseEntity.ok(response); + } catch (Exception e) { + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) + .body(Map.of("error", e.getMessage())); + } + } + + /** + * Clear the cart and end the session. + * + * DELETE /api/cart + */ + @DeleteMapping + public ResponseEntity clearCart(HttpSession session) { + try { + // Simulate EJB @Remove by clearing the session and destroying the bean + session.invalidate(); + + return ResponseEntity.ok(Map.of("message", "Cart cleared successfully")); + } catch (Exception e) { + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) + .body(Map.of("error", e.getMessage())); + } + } + + /** + * Health check endpoint. + * + * GET /api/cart/health + */ + @GetMapping("/health") + public ResponseEntity health() { + return ResponseEntity.ok(Map.of("status", "UP", "service", "cart-api")); + } + + // Request/Response DTOs + public static class CustomerRequest { + public String customerName; + public String customerId; + } + +} diff --git a/benchmark/business_domain/cart/spring/cart-web/src/main/resources/application.properties b/benchmark/business_domain/cart/spring/cart-web/src/main/resources/application.properties new file mode 100644 index 0000000000000000000000000000000000000000..fb4118157b57459abc8eb9fec4689f25e24f5820 --- /dev/null +++ b/benchmark/business_domain/cart/spring/cart-web/src/main/resources/application.properties @@ -0,0 +1,3 @@ +spring.application.name=cart-app + +server.servlet.contextPath=/cart diff --git a/benchmark/business_domain/cart/spring/mvnw b/benchmark/business_domain/cart/spring/mvnw new file mode 100644 index 0000000000000000000000000000000000000000..bd8896bf2217b46faa0291585e01ac1a3441a958 --- /dev/null +++ b/benchmark/business_domain/cart/spring/mvnw @@ -0,0 +1,295 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.4 +# +# Optional ENV vars +# ----------------- +# JAVA_HOME - location of a JDK home dir, required when download maven via java source +# MVNW_REPOURL - repo url base for downloading maven distribution +# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output +# ---------------------------------------------------------------------------- + +set -euf +[ "${MVNW_VERBOSE-}" != debug ] || set -x + +# OS specific support. +native_path() { printf %s\\n "$1"; } +case "$(uname)" in +CYGWIN* | MINGW*) + [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" + native_path() { cygpath --path --windows "$1"; } + ;; +esac + +# set JAVACMD and JAVACCMD +set_java_home() { + # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched + if [ -n "${JAVA_HOME-}" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACCMD="$JAVA_HOME/jre/sh/javac" + else + JAVACMD="$JAVA_HOME/bin/java" + JAVACCMD="$JAVA_HOME/bin/javac" + + if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then + echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 + echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 + return 1 + fi + fi + else + JAVACMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v java + )" || : + JAVACCMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v javac + )" || : + + if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then + echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 + return 1 + fi + fi +} + +# hash string like Java String::hashCode +hash_string() { + str="${1:-}" h=0 + while [ -n "$str" ]; do + char="${str%"${str#?}"}" + h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) + str="${str#?}" + done + printf %x\\n $h +} + +verbose() { :; } +[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } + +die() { + printf %s\\n "$1" >&2 + exit 1 +} + +trim() { + # MWRAPPER-139: + # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. + # Needed for removing poorly interpreted newline sequences when running in more + # exotic environments such as mingw bash on Windows. + printf "%s" "${1}" | tr -d '[:space:]' +} + +scriptDir="$(dirname "$0")" +scriptName="$(basename "$0")" + +# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties +while IFS="=" read -r key value; do + case "${key-}" in + distributionUrl) distributionUrl=$(trim "${value-}") ;; + distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; + esac +done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" + +case "${distributionUrl##*/}" in +maven-mvnd-*bin.*) + MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ + case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in + *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; + :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; + :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; + :Linux*x86_64*) distributionPlatform=linux-amd64 ;; + *) + echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 + distributionPlatform=linux-amd64 + ;; + esac + distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" + ;; +maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; +*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; +esac + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" +distributionUrlName="${distributionUrl##*/}" +distributionUrlNameMain="${distributionUrlName%.*}" +distributionUrlNameMain="${distributionUrlNameMain%-bin}" +MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" +MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" + +exec_maven() { + unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : + exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" +} + +if [ -d "$MAVEN_HOME" ]; then + verbose "found existing MAVEN_HOME at $MAVEN_HOME" + exec_maven "$@" +fi + +case "${distributionUrl-}" in +*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; +*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; +esac + +# prepare tmp dir +if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then + clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } + trap clean HUP INT TERM EXIT +else + die "cannot create temp dir" +fi + +mkdir -p -- "${MAVEN_HOME%/*}" + +# Download and Install Apache Maven +verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +verbose "Downloading from: $distributionUrl" +verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +# select .zip or .tar.gz +if ! command -v unzip >/dev/null; then + distributionUrl="${distributionUrl%.zip}.tar.gz" + distributionUrlName="${distributionUrl##*/}" +fi + +# verbose opt +__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' +[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v + +# normalize http auth +case "${MVNW_PASSWORD:+has-password}" in +'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; +has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; +esac + +if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then + verbose "Found wget ... using wget" + wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" +elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then + verbose "Found curl ... using curl" + curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" +elif set_java_home; then + verbose "Falling back to use Java to download" + javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" + targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" + cat >"$javaSource" <<-END + public class Downloader extends java.net.Authenticator + { + protected java.net.PasswordAuthentication getPasswordAuthentication() + { + return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); + } + public static void main( String[] args ) throws Exception + { + setDefault( new Downloader() ); + java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); + } + } + END + # For Cygwin/MinGW, switch paths to Windows format before running javac and java + verbose " - Compiling Downloader.java ..." + "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" + verbose " - Running Downloader.java ..." + "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" +fi + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +if [ -n "${distributionSha256Sum-}" ]; then + distributionSha256Result=false + if [ "$MVN_CMD" = mvnd.sh ]; then + echo "Checksum validation is not supported for maven-mvnd." >&2 + echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + elif command -v sha256sum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then + distributionSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $distributionSha256Result = false ]; then + echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 + echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 + exit 1 + fi +fi + +# unzip and move +if command -v unzip >/dev/null; then + unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" +else + tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" +fi + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +actualDistributionDir="" + +# First try the expected directory name (for regular distributions) +if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then + if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then + actualDistributionDir="$distributionUrlNameMain" + fi +fi + +# If not found, search for any directory with the Maven executable (for snapshots) +if [ -z "$actualDistributionDir" ]; then + # enable globbing to iterate over items + set +f + for dir in "$TMP_DOWNLOAD_DIR"/*; do + if [ -d "$dir" ]; then + if [ -f "$dir/bin/$MVN_CMD" ]; then + actualDistributionDir="$(basename "$dir")" + break + fi + fi + done + set -f +fi + +if [ -z "$actualDistributionDir" ]; then + verbose "Contents of $TMP_DOWNLOAD_DIR:" + verbose "$(ls -la "$TMP_DOWNLOAD_DIR")" + die "Could not find Maven distribution directory in extracted archive" +fi + +verbose "Found extracted Maven distribution directory: $actualDistributionDir" +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" + +clean || : +exec_maven "$@" diff --git a/benchmark/business_domain/cart/spring/mvnw.cmd b/benchmark/business_domain/cart/spring/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..5761d948924c19571d27b465c519b2e2f9e30351 --- /dev/null +++ b/benchmark/business_domain/cart/spring/mvnw.cmd @@ -0,0 +1,189 @@ +<# : batch portion +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.4 +@REM +@REM Optional ENV vars +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output +@REM ---------------------------------------------------------------------------- + +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) +) +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> + +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} + +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} + +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' + +$MAVEN_M2_PATH = "$HOME/.m2" +if ($env:MAVEN_USER_HOME) { + $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME" +} + +if (-not (Test-Path -Path $MAVEN_M2_PATH)) { + New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null +} + +$MAVEN_WRAPPER_DISTS = $null +if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) { + $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists" +} else { + $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists" +} + +$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain" +$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" + +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} + +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} + +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} + +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null + +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +$actualDistributionDir = "" + +# First try the expected directory name (for regular distributions) +$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain" +$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD" +if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) { + $actualDistributionDir = $distributionUrlNameMain +} + +# If not found, search for any directory with the Maven executable (for snapshots) +if (!$actualDistributionDir) { + Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object { + $testPath = Join-Path $_.FullName "bin/$MVN_CMD" + if (Test-Path -Path $testPath -PathType Leaf) { + $actualDistributionDir = $_.Name + } + } +} + +if (!$actualDistributionDir) { + Write-Error "Could not find Maven distribution directory in extracted archive" +} + +Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir" +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/benchmark/business_domain/cart/spring/pom.xml b/benchmark/business_domain/cart/spring/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..c6e9f0fcd6ff279d6263b2f2720acf1d43a031e3 --- /dev/null +++ b/benchmark/business_domain/cart/spring/pom.xml @@ -0,0 +1,62 @@ + + 4.0.0 + + + org.springframework.boot + spring-boot-starter-parent + 3.4.2 + + + + spring.examples.tutorial.cart + parent + 0.0.1-SNAPSHOT + pom + + + 17 + 17 + 3.4.2 + UTF-8 + + + + cart-ejb + cart-web + + + + + + org.apache.tomcat.embed + tomcat-embed-core + 11.0.12 + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + + + + ${project.artifactId} + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + + + + diff --git a/benchmark/business_domain/cart/spring/test.sh b/benchmark/business_domain/cart/spring/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7b2dde2c6a709b55ecbd80a6f6aed435713e4373 --- /dev/null +++ b/benchmark/business_domain/cart/spring/test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +BASE_URL="${BASE_URL:-http://localhost:8080/cart}" + +echo "Health check: ${BASE_URL}" +HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}") + +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "PASS - got HTTP ${HTTP_STATUS}" + exit 0 +else + echo "FAIL - got HTTP ${HTTP_STATUS}" + exit 1 +fi diff --git a/benchmark/business_domain/converter/jakarta/.dockerignore b/benchmark/business_domain/converter/jakarta/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..c634c57d9244b4e60b8fa936f09dbe4e75706e74 --- /dev/null +++ b/benchmark/business_domain/converter/jakarta/.dockerignore @@ -0,0 +1,41 @@ +# VCS +.git/ + +# Maven +.mvn/ +**/.mvn/ +mvnw +mvnw.cmd +**/mvnw +**/mvnw.cmd +target/ +**/target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties + +# IDE / Editor +.vscode/ +**/.vscode/ +.zed/ +**/.zed/ +.idea/ +**/.idea/ +*.iml +*.ipr +*.iws + +# OS +.DS_Store +**/.DS_Store +Thumbs.db +ehthumbs.db + +# Logs / temp +*.log +*.tmp +*.temp diff --git a/benchmark/business_domain/converter/jakarta/.mvn/wrapper/MavenWrapperDownloader.java b/benchmark/business_domain/converter/jakarta/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000000000000000000000000000000000..b901097f2db6e50097dc0b222204a88f8cea1609 --- /dev/null +++ b/benchmark/business_domain/converter/jakarta/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/benchmark/business_domain/converter/jakarta/.mvn/wrapper/maven-wrapper.properties b/benchmark/business_domain/converter/jakarta/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..43ad4f7bc95d51463a4cea4b6d84e6e069b98f1f --- /dev/null +++ b/benchmark/business_domain/converter/jakarta/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/benchmark/business_domain/converter/jakarta/Dockerfile b/benchmark/business_domain/converter/jakarta/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..52a2b7f77dd0c4ca02f541e3b14ae226b0c19490 --- /dev/null +++ b/benchmark/business_domain/converter/jakarta/Dockerfile @@ -0,0 +1,34 @@ +FROM maven:3.9.12-ibm-semeru-21-noble + +USER root +# install uv +RUN apt-get update && apt-get install -y --no-install-recommends curl python3-venv python3-full \ + && curl -LsSf https://astral.sh/uv/install.sh | sh + +ENV PATH="/root/.local/bin:$PATH" + +# Shared browsers path so Chromium is cached once +ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright +RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright + +# create venv and install +RUN uv venv /opt/venv \ + && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest + +ENV PATH="/opt/venv/bin:$PATH" +RUN playwright install --with-deps chromium + +WORKDIR /app + +# Cache Maven dependencies separately from source +COPY pom.xml . +RUN mvn dependency:go-offline -q + +# Build application +COPY src ./src +RUN mvn package -DskipTests -q + +COPY test.sh . +RUN chmod +x test.sh + +CMD ["mvn", "liberty:run"] diff --git a/benchmark/business_domain/converter/jakarta/mvnw b/benchmark/business_domain/converter/jakarta/mvnw new file mode 100644 index 0000000000000000000000000000000000000000..41c0f0c23db5dca836d3db1a17a7a28444d17d74 --- /dev/null +++ b/benchmark/business_domain/converter/jakarta/mvnw @@ -0,0 +1,310 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/benchmark/business_domain/converter/jakarta/mvnw.cmd b/benchmark/business_domain/converter/jakarta/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..86115719e5383e94597f918bf18c5ecbb7cfe492 --- /dev/null +++ b/benchmark/business_domain/converter/jakarta/mvnw.cmd @@ -0,0 +1,182 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/benchmark/business_domain/converter/jakarta/pom.xml b/benchmark/business_domain/converter/jakarta/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..8dfe48dc5fbb929bfb3ee00579d47446c4f9e736 --- /dev/null +++ b/benchmark/business_domain/converter/jakarta/pom.xml @@ -0,0 +1,74 @@ + + + + 4.0.0 + + jakarta.examples.tutorial.ejb + converter + 10-SNAPSHOT + + war + + ${project.artifactId} + + + 3.8.1 + 3.3.1 + UTF-8 + 10.0.0 + 3.10.3 + + + + + jakarta.platform + jakarta.jakartaee-api + ${jakarta.jakartaee-api.version} + provided + + + + + ${project.artifactId} + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven.compiler.plugin.version} + + 11 + 11 + + + + org.apache.maven.plugins + maven-war-plugin + ${maven.war.plugin.version} + + false + + + + io.openliberty.tools + liberty-maven-plugin + ${liberty.maven.plugin.version} + + defaultServer + ${project.basedir}/src/main/liberty/config + + + + + diff --git a/benchmark/business_domain/converter/jakarta/src/main/java/jakarta/tutorial/converter/ejb/ConverterBean.java b/benchmark/business_domain/converter/jakarta/src/main/java/jakarta/tutorial/converter/ejb/ConverterBean.java new file mode 100644 index 0000000000000000000000000000000000000000..4f08e63079a5c181930d30f3a8afc85fa2544912 --- /dev/null +++ b/benchmark/business_domain/converter/jakarta/src/main/java/jakarta/tutorial/converter/ejb/ConverterBean.java @@ -0,0 +1,36 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.converter.ejb; + +import java.math.BigDecimal; + +import jakarta.ejb.Stateless; + +/** + * This is the bean class for the ConverterBean enterprise bean. + * @author ian + */ +@Stateless +public class ConverterBean { + private final BigDecimal yenRate = new BigDecimal("104.34"); + private final BigDecimal euroRate = new BigDecimal("0.007"); + + public BigDecimal dollarToYen(BigDecimal dollars) { + BigDecimal result = dollars.multiply(yenRate); + return result.setScale(2, BigDecimal.ROUND_UP); + } + + public BigDecimal yenToEuro(BigDecimal yen) { + BigDecimal result = yen.multiply(euroRate); + return result.setScale(2, BigDecimal.ROUND_UP); + } +} diff --git a/benchmark/business_domain/converter/jakarta/src/main/java/jakarta/tutorial/converter/web/ConverterServlet.java b/benchmark/business_domain/converter/jakarta/src/main/java/jakarta/tutorial/converter/web/ConverterServlet.java new file mode 100644 index 0000000000000000000000000000000000000000..50f0c593366dc27f451a033f8f0b746889a8abba --- /dev/null +++ b/benchmark/business_domain/converter/jakarta/src/main/java/jakarta/tutorial/converter/web/ConverterServlet.java @@ -0,0 +1,120 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.converter.web; + +import java.io.IOException; +import java.io.PrintWriter; +import java.math.BigDecimal; + +import jakarta.ejb.EJB; +import jakarta.servlet.ServletException; +import jakarta.servlet.annotation.WebServlet; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.tutorial.converter.ejb.ConverterBean; + +@WebServlet(urlPatterns="/") +public class ConverterServlet extends HttpServlet { + private static final long serialVersionUID = -8312407323476917087L; + @EJB + ConverterBean converter; + + /** + * Processes requests for both HTTP GET and POST methods. + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + response.setContentType("text/html;charset=UTF-8"); + PrintWriter out = response.getWriter(); + // Output the results + out.println(""); + out.println(""); + out.println("Servlet ConverterServlet"); + out.println(""); + out.println(""); + out.println("

Servlet ConverterServlet at " + + request.getContextPath() + "

"); + try { + String amount = request.getParameter("amount"); + if (amount != null && amount.length() > 0) { + // convert the amount to a BigDecimal from the request parameter + BigDecimal d = new BigDecimal(amount); + // call the ConverterBean.dollarToYen() method to get the amount + // in Yen + BigDecimal yenAmount = converter.dollarToYen(d); + + // call the ConverterBean.yenToEuro() method to get the amount + // in Euros + BigDecimal euroAmount = converter.yenToEuro(yenAmount); + + out.println("

" + amount + " dollars are " + + yenAmount.toPlainString() + " yen.

"); + out.println("

" + yenAmount.toPlainString() + " yen are " + + euroAmount.toPlainString() + " Euro.

"); + } else { + out.println("

Enter a dollar amount to convert:

"); + out.println("
"); + out.println("

$

"); + out.println("
"); + out.println("" + + ""); + out.println("
"); + } + + } finally { + out.println(""); + out.println(""); + out.close(); + } + } + + // + /** + * Handles the HTTP GET method. + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Handles the HTTP POST method. + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Returns a short description of the servlet. + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// +} diff --git a/benchmark/business_domain/converter/jakarta/src/main/liberty/config/server.xml b/benchmark/business_domain/converter/jakarta/src/main/liberty/config/server.xml new file mode 100644 index 0000000000000000000000000000000000000000..e7dc58e95ace9a560228ebcc9860a8cfb80e1d1c --- /dev/null +++ b/benchmark/business_domain/converter/jakarta/src/main/liberty/config/server.xml @@ -0,0 +1,15 @@ + + + + jakartaee-10.0 + + + + + + + + + + + \ No newline at end of file diff --git a/benchmark/business_domain/converter/jakarta/src/main/resources/.gitkeep b/benchmark/business_domain/converter/jakarta/src/main/resources/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/benchmark/business_domain/converter/jakarta/src/main/webapp/WEB-INF/.gitkeep b/benchmark/business_domain/converter/jakarta/src/main/webapp/WEB-INF/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/benchmark/business_domain/converter/jakarta/test.sh b/benchmark/business_domain/converter/jakarta/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..e4924e20774d21fae23fe9cbf99314f56301f800 --- /dev/null +++ b/benchmark/business_domain/converter/jakarta/test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +BASE_URL="${BASE_URL:-http://localhost:9080/converter}" + +echo "Health check: ${BASE_URL}" +HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}") + +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "PASS - got HTTP ${HTTP_STATUS}" + exit 0 +else + echo "FAIL - got HTTP ${HTTP_STATUS}" + exit 1 +fi diff --git a/benchmark/business_domain/converter/quarkus/.dockerignore b/benchmark/business_domain/converter/quarkus/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..c634c57d9244b4e60b8fa936f09dbe4e75706e74 --- /dev/null +++ b/benchmark/business_domain/converter/quarkus/.dockerignore @@ -0,0 +1,41 @@ +# VCS +.git/ + +# Maven +.mvn/ +**/.mvn/ +mvnw +mvnw.cmd +**/mvnw +**/mvnw.cmd +target/ +**/target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties + +# IDE / Editor +.vscode/ +**/.vscode/ +.zed/ +**/.zed/ +.idea/ +**/.idea/ +*.iml +*.ipr +*.iws + +# OS +.DS_Store +**/.DS_Store +Thumbs.db +ehthumbs.db + +# Logs / temp +*.log +*.tmp +*.temp diff --git a/benchmark/business_domain/converter/quarkus/.mvn/wrapper/MavenWrapperDownloader.java b/benchmark/business_domain/converter/quarkus/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000000000000000000000000000000000..b901097f2db6e50097dc0b222204a88f8cea1609 --- /dev/null +++ b/benchmark/business_domain/converter/quarkus/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/benchmark/business_domain/converter/quarkus/.mvn/wrapper/maven-wrapper.properties b/benchmark/business_domain/converter/quarkus/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..43ad4f7bc95d51463a4cea4b6d84e6e069b98f1f --- /dev/null +++ b/benchmark/business_domain/converter/quarkus/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/benchmark/business_domain/converter/quarkus/Dockerfile b/benchmark/business_domain/converter/quarkus/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..dcd2739646fb4fd95a063f846da8c8b49776c723 --- /dev/null +++ b/benchmark/business_domain/converter/quarkus/Dockerfile @@ -0,0 +1,34 @@ +FROM maven:3.9.12-ibm-semeru-21-noble + +USER root +# install uv +RUN apt-get update && apt-get install -y --no-install-recommends curl lsof python3-venv python3-full \ + && curl -LsSf https://astral.sh/uv/install.sh | sh + +ENV PATH="/root/.local/bin:$PATH" + +# Shared browsers path so Chromium is cached once +ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright +RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright + +# create venv and install +RUN uv venv /opt/venv \ + && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest + +ENV PATH="/opt/venv/bin:$PATH" +RUN playwright install --with-deps chromium + +WORKDIR /app + +# Cache Maven dependencies separately from source +COPY pom.xml . +RUN mvn dependency:go-offline -q + +# Build application +COPY src ./src +RUN mvn package -DskipTests -q + +COPY test.sh . +RUN chmod +x test.sh + +CMD ["java", "-jar", "target/quarkus-app/quarkus-run.jar"] diff --git a/benchmark/business_domain/converter/quarkus/README.md b/benchmark/business_domain/converter/quarkus/README.md new file mode 100644 index 0000000000000000000000000000000000000000..a109b649e1013f38d66942d1e66ea675b45d6cd9 --- /dev/null +++ b/benchmark/business_domain/converter/quarkus/README.md @@ -0,0 +1,62 @@ +# converter + +This project uses Quarkus, the Supersonic Subatomic Java Framework. + +If you want to learn more about Quarkus, please visit its website: . + +## Running the application in dev mode + +You can run your application in dev mode that enables live coding using: + +```shell script +./mvnw quarkus:dev +``` + +> **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at . + +## Packaging and running the application + +The application can be packaged using: + +```shell script +./mvnw package +``` + +It produces the `quarkus-run.jar` file in the `target/quarkus-app/` directory. +Be aware that it’s not an _über-jar_ as the dependencies are copied into the `target/quarkus-app/lib/` directory. + +The application is now runnable using `java -jar target/quarkus-app/quarkus-run.jar`. + +If you want to build an _über-jar_, execute the following command: + +```shell script +./mvnw package -Dquarkus.package.jar.type=uber-jar +``` + +The application, packaged as an _über-jar_, is now runnable using `java -jar target/*-runner.jar`. + +## Creating a native executable + +You can create a native executable using: + +```shell script +./mvnw package -Dnative +``` + +Or, if you don't have GraalVM installed, you can run the native executable build in a container using: + +```shell script +./mvnw package -Dnative -Dquarkus.native.container-build=true +``` + +You can then execute your native executable with: `./target/converter-1.0.0-SNAPSHOT-runner` + +If you want to learn more about building native executables, please consult . + +## Provided Code + +### REST + +Easily start your REST Web Services + +[Related guide section...](https://quarkus.io/guides/getting-started-reactive#reactive-jax-rs-resources) diff --git a/benchmark/business_domain/converter/quarkus/mvnw b/benchmark/business_domain/converter/quarkus/mvnw new file mode 100644 index 0000000000000000000000000000000000000000..5e9618cac26d1c3254dc88232a8c4d841316bd29 --- /dev/null +++ b/benchmark/business_domain/converter/quarkus/mvnw @@ -0,0 +1,332 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.2 +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ]; then + + if [ -f /usr/local/etc/mavenrc ]; then + . /usr/local/etc/mavenrc + fi + + if [ -f /etc/mavenrc ]; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ]; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false +darwin=false +mingw=false +case "$(uname)" in +CYGWIN*) cygwin=true ;; +MINGW*) mingw=true ;; +Darwin*) + darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + JAVA_HOME="$(/usr/libexec/java_home)" + export JAVA_HOME + else + JAVA_HOME="/Library/Java/Home" + export JAVA_HOME + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ]; then + if [ -r /etc/gentoo-release ]; then + JAVA_HOME=$(java-config --jre-home) + fi +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin; then + [ -n "$JAVA_HOME" ] \ + && JAVA_HOME=$(cygpath --unix "$JAVA_HOME") + [ -n "$CLASSPATH" ] \ + && CLASSPATH=$(cygpath --path --unix "$CLASSPATH") +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw; then + [ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] \ + && JAVA_HOME="$( + cd "$JAVA_HOME" || ( + echo "cannot cd into $JAVA_HOME." >&2 + exit 1 + ) + pwd + )" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="$(which javac)" + if [ -n "$javaExecutable" ] && ! [ "$(expr "$javaExecutable" : '\([^ ]*\)')" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=$(which readlink) + if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then + if $darwin; then + javaHome="$(dirname "$javaExecutable")" + javaExecutable="$(cd "$javaHome" && pwd -P)/javac" + else + javaExecutable="$(readlink -f "$javaExecutable")" + fi + javaHome="$(dirname "$javaExecutable")" + javaHome=$(expr "$javaHome" : '\(.*\)/bin') + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ]; then + if [ -n "$JAVA_HOME" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="$( + \unset -f command 2>/dev/null + \command -v java + )" + fi +fi + +if [ ! -x "$JAVACMD" ]; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ]; then + echo "Warning: JAVA_HOME environment variable is not set." >&2 +fi + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + if [ -z "$1" ]; then + echo "Path not specified to find_maven_basedir" >&2 + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ]; do + if [ -d "$wdir"/.mvn ]; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=$( + cd "$wdir/.." || exit 1 + pwd + ) + fi + # end of workaround + done + printf '%s' "$( + cd "$basedir" || exit 1 + pwd + )" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + # Remove \r in case we run on Windows within Git Bash + # and check out the repository with auto CRLF management + # enabled. Otherwise, we may read lines that are delimited with + # \r\n and produce $'-Xarg\r' rather than -Xarg due to word + # splitting rules. + tr -s '\r\n' ' ' <"$1" + fi +} + +log() { + if [ "$MVNW_VERBOSE" = true ]; then + printf '%s\n' "$1" + fi +} + +BASE_DIR=$(find_maven_basedir "$(dirname "$0")") +if [ -z "$BASE_DIR" ]; then + exit 1 +fi + +MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +export MAVEN_PROJECTBASEDIR +log "$MAVEN_PROJECTBASEDIR" + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" +if [ -r "$wrapperJarPath" ]; then + log "Found $wrapperJarPath" +else + log "Couldn't find $wrapperJarPath, downloading it ..." + + if [ -n "$MVNW_REPOURL" ]; then + wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar" + else + wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar" + fi + while IFS="=" read -r key value; do + # 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 '=' ) + safeValue=$(echo "$value" | tr -d '\r') + case "$key" in wrapperUrl) + wrapperUrl="$safeValue" + break + ;; + esac + done <"$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" + log "Downloading from: $wrapperUrl" + + if $cygwin; then + wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath") + fi + + if command -v wget >/dev/null; then + log "Found wget ... using wget" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet" + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + else + wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + fi + elif command -v curl >/dev/null; then + log "Found curl ... using curl" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent" + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" + else + curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" + fi + else + log "Falling back to using Java to download" + javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java" + javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaSource=$(cygpath --path --windows "$javaSource") + javaClass=$(cygpath --path --windows "$javaClass") + fi + if [ -e "$javaSource" ]; then + if [ ! -e "$javaClass" ]; then + log " - Compiling MavenWrapperDownloader.java ..." + ("$JAVA_HOME/bin/javac" "$javaSource") + fi + if [ -e "$javaClass" ]; then + log " - Running MavenWrapperDownloader.java ..." + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath" + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +# If specified, validate the SHA-256 sum of the Maven wrapper jar file +wrapperSha256Sum="" +while IFS="=" read -r key value; do + case "$key" in wrapperSha256Sum) + wrapperSha256Sum=$value + break + ;; + esac +done <"$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" +if [ -n "$wrapperSha256Sum" ]; then + wrapperSha256Result=false + if command -v sha256sum >/dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c >/dev/null 2>&1; then + wrapperSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c >/dev/null 2>&1; then + wrapperSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $wrapperSha256Result = false ]; then + echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2 + echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2 + echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2 + exit 1 + fi +fi + +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$JAVA_HOME" ] \ + && JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME") + [ -n "$CLASSPATH" ] \ + && CLASSPATH=$(cygpath --path --windows "$CLASSPATH") + [ -n "$MAVEN_PROJECTBASEDIR" ] \ + && MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR") +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +# shellcheck disable=SC2086 # safe args +exec "$JAVACMD" \ + $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/benchmark/business_domain/converter/quarkus/mvnw.cmd b/benchmark/business_domain/converter/quarkus/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..4136715f081ecad67b4ba4760f84065285a8e72b --- /dev/null +++ b/benchmark/business_domain/converter/quarkus/mvnw.cmd @@ -0,0 +1,206 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.2 +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* +if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. >&2 +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. >&2 +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. >&2 +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. >&2 +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar" + +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %WRAPPER_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file +SET WRAPPER_SHA_256_SUM="" +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B +) +IF NOT %WRAPPER_SHA_256_SUM%=="" ( + powershell -Command "&{"^ + "Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash;"^ + "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^ + "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^ + " Write-Error 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^ + " Write-Error 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^ + " Write-Error 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^ + " exit 1;"^ + "}"^ + "}" + if ERRORLEVEL 1 goto error +) + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% ^ + %JVM_CONFIG_MAVEN_PROPS% ^ + %MAVEN_OPTS% ^ + %MAVEN_DEBUG_OPTS% ^ + -classpath %WRAPPER_JAR% ^ + "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ + %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" +if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%"=="on" pause + +if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% + +cmd /C exit /B %ERROR_CODE% diff --git a/benchmark/business_domain/converter/quarkus/pom.xml b/benchmark/business_domain/converter/quarkus/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..1c94cc3c7c4570b9f155968de619b98152f50544 --- /dev/null +++ b/benchmark/business_domain/converter/quarkus/pom.xml @@ -0,0 +1,124 @@ + + + 4.0.0 + quarkus.examples.tutorial + converter + 1.0.0-SNAPSHOT + + + 3.14.0 + 21 + UTF-8 + UTF-8 + quarkus-bom + io.quarkus.platform + 3.30.5 + true + 3.5.3 + + + + + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + + + + + + + io.quarkus + quarkus-arc + + + io.quarkus + quarkus-rest + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + + + + + ${quarkus.platform.group-id} + quarkus-maven-plugin + ${quarkus.platform.version} + true + + + + build + generate-code + generate-code-tests + native-image-agent + + + + + + maven-compiler-plugin + ${compiler-plugin.version} + + true + + + + maven-surefire-plugin + ${surefire-plugin.version} + + + org.jboss.logmanager.LogManager + ${maven.home} + + + + + maven-failsafe-plugin + ${surefire-plugin.version} + + + + integration-test + verify + + + + + + ${project.build.directory}/${project.build.finalName}-runner + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + + + + native + + + native + + + + false + true + + + + diff --git a/benchmark/business_domain/converter/quarkus/src/main/docker/Dockerfile.jvm b/benchmark/business_domain/converter/quarkus/src/main/docker/Dockerfile.jvm new file mode 100644 index 0000000000000000000000000000000000000000..ae181876fe054be70c96170c0b0145f59e3823b8 --- /dev/null +++ b/benchmark/business_domain/converter/quarkus/src/main/docker/Dockerfile.jvm @@ -0,0 +1,98 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode +# +# Before building the container image run: +# +# ./mvnw package +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/converter-jvm . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/converter-jvm +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005. +# Additionally you will have to set -e JAVA_DEBUG=true and -e JAVA_DEBUG_PORT=*:5005 +# when running the container +# +# Then run the container using : +# +# docker run -i --rm -p 8080:8080 quarkus/converter-jvm +# +# This image uses the `run-java.sh` script to run the application. +# This scripts computes the command line to execute your Java application, and +# includes memory/GC tuning. +# You can configure the behavior using the following environment properties: +# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class") - Be aware that this will override +# the default JVM options, use `JAVA_OPTS_APPEND` to append options +# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options +# in JAVA_OPTS (example: "-Dsome.property=foo") +# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is +# used to calculate a default maximal heap memory based on a containers restriction. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio +# of the container available memory as set here. The default is `50` which means 50% +# of the available memory is used as an upper boundary. You can skip this mechanism by +# setting this value to `0` in which case no `-Xmx` option is added. +# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This +# is used to calculate a default initial heap memory based on the maximum heap memory. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio +# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx` +# is used as the initial heap size. You can skip this mechanism by setting this value +# to `0` in which case no `-Xms` option is added (example: "25") +# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS. +# This is used to calculate the maximum value of the initial heap memory. If used in +# a container without any memory constraints for the container then this option has +# no effect. If there is a memory constraint then `-Xms` is limited to the value set +# here. The default is 4096MB which means the calculated value of `-Xms` never will +# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096") +# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output +# when things are happening. This option, if set to true, will set +# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true"). +# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example: +# true"). +# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787"). +# - CONTAINER_CORE_LIMIT: A calculated core limit as described in +# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2") +# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024"). +# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion. +# (example: "20") +# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking. +# (example: "40") +# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection. +# (example: "4") +# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus +# previous GC times. (example: "90") +# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20") +# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100") +# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should +# contain the necessary JRE command-line options to specify the required GC, which +# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC). +# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080") +# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080") +# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be +# accessed directly. (example: "foo.example.com,bar.example.com") +# +### +FROM registry.access.redhat.com/ubi9/openjdk-21:1.23 + +ENV LANGUAGE='en_US:en' + + +# We make four distinct layers so if there are application changes the library layers can be re-used +COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/ +COPY --chown=185 target/quarkus-app/*.jar /deployments/ +COPY --chown=185 target/quarkus-app/app/ /deployments/app/ +COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/ + +EXPOSE 8080 +USER 185 +ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" + +ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ] + diff --git a/benchmark/business_domain/converter/quarkus/src/main/docker/Dockerfile.legacy-jar b/benchmark/business_domain/converter/quarkus/src/main/docker/Dockerfile.legacy-jar new file mode 100644 index 0000000000000000000000000000000000000000..c30c2fbc95143fca26060b71679500e09a0d0a61 --- /dev/null +++ b/benchmark/business_domain/converter/quarkus/src/main/docker/Dockerfile.legacy-jar @@ -0,0 +1,94 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode +# +# Before building the container image run: +# +# ./mvnw package -Dquarkus.package.jar.type=legacy-jar +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.legacy-jar -t quarkus/converter-legacy-jar . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/converter-legacy-jar +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005. +# Additionally you will have to set -e JAVA_DEBUG=true and -e JAVA_DEBUG_PORT=*:5005 +# when running the container +# +# Then run the container using : +# +# docker run -i --rm -p 8080:8080 quarkus/converter-legacy-jar +# +# This image uses the `run-java.sh` script to run the application. +# This scripts computes the command line to execute your Java application, and +# includes memory/GC tuning. +# You can configure the behavior using the following environment properties: +# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class") - Be aware that this will override +# the default JVM options, use `JAVA_OPTS_APPEND` to append options +# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options +# in JAVA_OPTS (example: "-Dsome.property=foo") +# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is +# used to calculate a default maximal heap memory based on a containers restriction. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio +# of the container available memory as set here. The default is `50` which means 50% +# of the available memory is used as an upper boundary. You can skip this mechanism by +# setting this value to `0` in which case no `-Xmx` option is added. +# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This +# is used to calculate a default initial heap memory based on the maximum heap memory. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio +# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx` +# is used as the initial heap size. You can skip this mechanism by setting this value +# to `0` in which case no `-Xms` option is added (example: "25") +# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS. +# This is used to calculate the maximum value of the initial heap memory. If used in +# a container without any memory constraints for the container then this option has +# no effect. If there is a memory constraint then `-Xms` is limited to the value set +# here. The default is 4096MB which means the calculated value of `-Xms` never will +# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096") +# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output +# when things are happening. This option, if set to true, will set +# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true"). +# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example: +# true"). +# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787"). +# - CONTAINER_CORE_LIMIT: A calculated core limit as described in +# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2") +# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024"). +# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion. +# (example: "20") +# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking. +# (example: "40") +# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection. +# (example: "4") +# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus +# previous GC times. (example: "90") +# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20") +# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100") +# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should +# contain the necessary JRE command-line options to specify the required GC, which +# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC). +# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080") +# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080") +# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be +# accessed directly. (example: "foo.example.com,bar.example.com") +# +### +FROM registry.access.redhat.com/ubi9/openjdk-21:1.23 + +ENV LANGUAGE='en_US:en' + + +COPY target/lib/* /deployments/lib/ +COPY target/*-runner.jar /deployments/quarkus-run.jar + +EXPOSE 8080 +USER 185 +ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" + +ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ] diff --git a/benchmark/business_domain/converter/quarkus/src/main/docker/Dockerfile.native b/benchmark/business_domain/converter/quarkus/src/main/docker/Dockerfile.native new file mode 100644 index 0000000000000000000000000000000000000000..6e05ea83b45f83cc222677e2729476b6818de2eb --- /dev/null +++ b/benchmark/business_domain/converter/quarkus/src/main/docker/Dockerfile.native @@ -0,0 +1,29 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. +# +# Before building the container image run: +# +# ./mvnw package -Dnative +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.native -t quarkus/converter . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/converter +# +# The ` registry.access.redhat.com/ubi9/ubi-minimal:9.6` base image is based on UBI 9. +# To use UBI 8, switch to `quay.io/ubi8/ubi-minimal:8.10`. +### +FROM registry.access.redhat.com/ubi9/ubi-minimal:9.6 +WORKDIR /work/ +RUN chown 1001 /work \ + && chmod "g+rwX" /work \ + && chown 1001:root /work +COPY --chown=1001:root --chmod=0755 target/*-runner /work/application + +EXPOSE 8080 +USER 1001 + +ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/benchmark/business_domain/converter/quarkus/src/main/docker/Dockerfile.native-micro b/benchmark/business_domain/converter/quarkus/src/main/docker/Dockerfile.native-micro new file mode 100644 index 0000000000000000000000000000000000000000..f759763ddffc7e2435b268662f9b49bb00656c1e --- /dev/null +++ b/benchmark/business_domain/converter/quarkus/src/main/docker/Dockerfile.native-micro @@ -0,0 +1,32 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. +# It uses a micro base image, tuned for Quarkus native executables. +# It reduces the size of the resulting container image. +# Check https://quarkus.io/guides/quarkus-runtime-base-image for further information about this image. +# +# Before building the container image run: +# +# ./mvnw package -Dnative +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.native-micro -t quarkus/converter . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/converter +# +# The `quay.io/quarkus/ubi9-quarkus-micro-image:2.0` base image is based on UBI 9. +# To use UBI 8, switch to `quay.io/quarkus/quarkus-micro-image:2.0`. +### +FROM quay.io/quarkus/ubi9-quarkus-micro-image:2.0 +WORKDIR /work/ +RUN chown 1001 /work \ + && chmod "g+rwX" /work \ + && chown 1001:root /work +COPY --chown=1001:root --chmod=0755 target/*-runner /work/application + +EXPOSE 8080 +USER 1001 + +ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/benchmark/business_domain/converter/quarkus/src/main/java/quarkus/examples/tutorial/ConverterBean.java b/benchmark/business_domain/converter/quarkus/src/main/java/quarkus/examples/tutorial/ConverterBean.java new file mode 100644 index 0000000000000000000000000000000000000000..fe3797b745fb3f6e1df35dc1fe572591e11e25e2 --- /dev/null +++ b/benchmark/business_domain/converter/quarkus/src/main/java/quarkus/examples/tutorial/ConverterBean.java @@ -0,0 +1,21 @@ +package quarkus.examples.tutorial; + +import java.math.BigDecimal; + +import jakarta.enterprise.context.ApplicationScoped; + +@ApplicationScoped +public class ConverterBean { + private final BigDecimal yenRate = new BigDecimal("104.34"); + private final BigDecimal euroRate = new BigDecimal("0.007"); + + public BigDecimal dollarToYen(BigDecimal dollars) { + BigDecimal result = dollars.multiply(yenRate); + return result.setScale(2, BigDecimal.ROUND_UP); + } + + public BigDecimal yenToEuro(BigDecimal yen) { + BigDecimal result = yen.multiply(euroRate); + return result.setScale(2, BigDecimal.ROUND_UP); + } +} diff --git a/benchmark/business_domain/converter/quarkus/src/main/java/quarkus/examples/tutorial/ConverterResource.java b/benchmark/business_domain/converter/quarkus/src/main/java/quarkus/examples/tutorial/ConverterResource.java new file mode 100644 index 0000000000000000000000000000000000000000..c40131c79510a644219a678f9a91a84dd7c71ada --- /dev/null +++ b/benchmark/business_domain/converter/quarkus/src/main/java/quarkus/examples/tutorial/ConverterResource.java @@ -0,0 +1,60 @@ +package quarkus.examples.tutorial; + +import java.math.BigDecimal; +import jakarta.inject.Inject; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.UriInfo; + +@Path("/") +public class ConverterResource { + + @Inject + ConverterBean converter; + + @Context + UriInfo uriInfo; + + @GET + @Produces(MediaType.TEXT_HTML) + public String convert(@QueryParam("amount") String amount) { + StringBuilder html = new StringBuilder(); + html.append("") + .append("") + .append("Servlet ConverterServlet") + .append("") + .append("") + .append("

Servlet ConverterServlet at ").append(uriInfo.getBaseUri().getPath()) + .append("

"); + + try { + if (amount != null && !amount.isEmpty()) { + BigDecimal d = new BigDecimal(amount); + BigDecimal yenAmount = converter.dollarToYen(d); + BigDecimal euroAmount = converter.yenToEuro(yenAmount); + + html.append("

").append(amount).append(" dollars are ") + .append(yenAmount.toPlainString()).append(" yen.

"); + html.append("

").append(yenAmount.toPlainString()).append(" yen are ") + .append(euroAmount.toPlainString()).append(" Euro.

"); + } else { + html.append("

Enter a dollar amount to convert:

") + .append("
") + .append("

$

") + .append("
") + .append("") + .append("") + .append("
"); + } + } finally { + html.append("") + .append(""); + } + + return html.toString(); + } +} diff --git a/benchmark/business_domain/converter/quarkus/src/main/resources/application.properties b/benchmark/business_domain/converter/quarkus/src/main/resources/application.properties new file mode 100644 index 0000000000000000000000000000000000000000..3fcbc9b6944249bf750e37a70a073ffbbdb536c3 --- /dev/null +++ b/benchmark/business_domain/converter/quarkus/src/main/resources/application.properties @@ -0,0 +1 @@ +quarkus.http.root-path=/converter \ No newline at end of file diff --git a/benchmark/business_domain/converter/quarkus/test.sh b/benchmark/business_domain/converter/quarkus/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..a38533b5252b94c78ef2f5f7cbb7b59e55ab133d --- /dev/null +++ b/benchmark/business_domain/converter/quarkus/test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +BASE_URL="${BASE_URL:-http://localhost:8080/converter}" + +echo "Health check: ${BASE_URL}" +HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}") + +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "PASS - got HTTP ${HTTP_STATUS}" + exit 0 +else + echo "FAIL - got HTTP ${HTTP_STATUS}" + exit 1 +fi diff --git a/benchmark/business_domain/converter/spring/.dockerignore b/benchmark/business_domain/converter/spring/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..c634c57d9244b4e60b8fa936f09dbe4e75706e74 --- /dev/null +++ b/benchmark/business_domain/converter/spring/.dockerignore @@ -0,0 +1,41 @@ +# VCS +.git/ + +# Maven +.mvn/ +**/.mvn/ +mvnw +mvnw.cmd +**/mvnw +**/mvnw.cmd +target/ +**/target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties + +# IDE / Editor +.vscode/ +**/.vscode/ +.zed/ +**/.zed/ +.idea/ +**/.idea/ +*.iml +*.ipr +*.iws + +# OS +.DS_Store +**/.DS_Store +Thumbs.db +ehthumbs.db + +# Logs / temp +*.log +*.tmp +*.temp diff --git a/benchmark/business_domain/converter/spring/.mvn/wrapper/MavenWrapperDownloader.java b/benchmark/business_domain/converter/spring/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000000000000000000000000000000000..b901097f2db6e50097dc0b222204a88f8cea1609 --- /dev/null +++ b/benchmark/business_domain/converter/spring/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/benchmark/business_domain/converter/spring/.mvn/wrapper/maven-wrapper.properties b/benchmark/business_domain/converter/spring/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..43ad4f7bc95d51463a4cea4b6d84e6e069b98f1f --- /dev/null +++ b/benchmark/business_domain/converter/spring/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/benchmark/business_domain/converter/spring/Dockerfile b/benchmark/business_domain/converter/spring/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..1e5c9660ba86fdee01192feca7895ddda92c99e3 --- /dev/null +++ b/benchmark/business_domain/converter/spring/Dockerfile @@ -0,0 +1,34 @@ +FROM maven:3.9.12-ibm-semeru-21-noble + +USER root +# install uv +RUN apt-get update && apt-get install -y --no-install-recommends curl python3-venv python3-full \ + && curl -LsSf https://astral.sh/uv/install.sh | sh + +ENV PATH="/root/.local/bin:$PATH" + +# Shared browsers path so Chromium is cached once +ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright +RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright + +# create venv and install +RUN uv venv /opt/venv \ + && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest + +ENV PATH="/opt/venv/bin:$PATH" +RUN playwright install --with-deps chromium + +WORKDIR /app + +# Cache Maven dependencies separately from source +COPY pom.xml . +RUN mvn dependency:go-offline -q + +# Build application +COPY src ./src +RUN mvn package -DskipTests -q + +COPY test.sh . +RUN chmod +x test.sh + +CMD ["sh", "-c", "java -jar target/*.jar"] diff --git a/benchmark/business_domain/converter/spring/mvnw b/benchmark/business_domain/converter/spring/mvnw new file mode 100644 index 0000000000000000000000000000000000000000..bd8896bf2217b46faa0291585e01ac1a3441a958 --- /dev/null +++ b/benchmark/business_domain/converter/spring/mvnw @@ -0,0 +1,295 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.4 +# +# Optional ENV vars +# ----------------- +# JAVA_HOME - location of a JDK home dir, required when download maven via java source +# MVNW_REPOURL - repo url base for downloading maven distribution +# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output +# ---------------------------------------------------------------------------- + +set -euf +[ "${MVNW_VERBOSE-}" != debug ] || set -x + +# OS specific support. +native_path() { printf %s\\n "$1"; } +case "$(uname)" in +CYGWIN* | MINGW*) + [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" + native_path() { cygpath --path --windows "$1"; } + ;; +esac + +# set JAVACMD and JAVACCMD +set_java_home() { + # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched + if [ -n "${JAVA_HOME-}" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACCMD="$JAVA_HOME/jre/sh/javac" + else + JAVACMD="$JAVA_HOME/bin/java" + JAVACCMD="$JAVA_HOME/bin/javac" + + if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then + echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 + echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 + return 1 + fi + fi + else + JAVACMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v java + )" || : + JAVACCMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v javac + )" || : + + if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then + echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 + return 1 + fi + fi +} + +# hash string like Java String::hashCode +hash_string() { + str="${1:-}" h=0 + while [ -n "$str" ]; do + char="${str%"${str#?}"}" + h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) + str="${str#?}" + done + printf %x\\n $h +} + +verbose() { :; } +[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } + +die() { + printf %s\\n "$1" >&2 + exit 1 +} + +trim() { + # MWRAPPER-139: + # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. + # Needed for removing poorly interpreted newline sequences when running in more + # exotic environments such as mingw bash on Windows. + printf "%s" "${1}" | tr -d '[:space:]' +} + +scriptDir="$(dirname "$0")" +scriptName="$(basename "$0")" + +# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties +while IFS="=" read -r key value; do + case "${key-}" in + distributionUrl) distributionUrl=$(trim "${value-}") ;; + distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; + esac +done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" + +case "${distributionUrl##*/}" in +maven-mvnd-*bin.*) + MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ + case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in + *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; + :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; + :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; + :Linux*x86_64*) distributionPlatform=linux-amd64 ;; + *) + echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 + distributionPlatform=linux-amd64 + ;; + esac + distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" + ;; +maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; +*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; +esac + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" +distributionUrlName="${distributionUrl##*/}" +distributionUrlNameMain="${distributionUrlName%.*}" +distributionUrlNameMain="${distributionUrlNameMain%-bin}" +MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" +MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" + +exec_maven() { + unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : + exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" +} + +if [ -d "$MAVEN_HOME" ]; then + verbose "found existing MAVEN_HOME at $MAVEN_HOME" + exec_maven "$@" +fi + +case "${distributionUrl-}" in +*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; +*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; +esac + +# prepare tmp dir +if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then + clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } + trap clean HUP INT TERM EXIT +else + die "cannot create temp dir" +fi + +mkdir -p -- "${MAVEN_HOME%/*}" + +# Download and Install Apache Maven +verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +verbose "Downloading from: $distributionUrl" +verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +# select .zip or .tar.gz +if ! command -v unzip >/dev/null; then + distributionUrl="${distributionUrl%.zip}.tar.gz" + distributionUrlName="${distributionUrl##*/}" +fi + +# verbose opt +__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' +[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v + +# normalize http auth +case "${MVNW_PASSWORD:+has-password}" in +'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; +has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; +esac + +if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then + verbose "Found wget ... using wget" + wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" +elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then + verbose "Found curl ... using curl" + curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" +elif set_java_home; then + verbose "Falling back to use Java to download" + javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" + targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" + cat >"$javaSource" <<-END + public class Downloader extends java.net.Authenticator + { + protected java.net.PasswordAuthentication getPasswordAuthentication() + { + return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); + } + public static void main( String[] args ) throws Exception + { + setDefault( new Downloader() ); + java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); + } + } + END + # For Cygwin/MinGW, switch paths to Windows format before running javac and java + verbose " - Compiling Downloader.java ..." + "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" + verbose " - Running Downloader.java ..." + "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" +fi + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +if [ -n "${distributionSha256Sum-}" ]; then + distributionSha256Result=false + if [ "$MVN_CMD" = mvnd.sh ]; then + echo "Checksum validation is not supported for maven-mvnd." >&2 + echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + elif command -v sha256sum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then + distributionSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $distributionSha256Result = false ]; then + echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 + echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 + exit 1 + fi +fi + +# unzip and move +if command -v unzip >/dev/null; then + unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" +else + tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" +fi + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +actualDistributionDir="" + +# First try the expected directory name (for regular distributions) +if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then + if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then + actualDistributionDir="$distributionUrlNameMain" + fi +fi + +# If not found, search for any directory with the Maven executable (for snapshots) +if [ -z "$actualDistributionDir" ]; then + # enable globbing to iterate over items + set +f + for dir in "$TMP_DOWNLOAD_DIR"/*; do + if [ -d "$dir" ]; then + if [ -f "$dir/bin/$MVN_CMD" ]; then + actualDistributionDir="$(basename "$dir")" + break + fi + fi + done + set -f +fi + +if [ -z "$actualDistributionDir" ]; then + verbose "Contents of $TMP_DOWNLOAD_DIR:" + verbose "$(ls -la "$TMP_DOWNLOAD_DIR")" + die "Could not find Maven distribution directory in extracted archive" +fi + +verbose "Found extracted Maven distribution directory: $actualDistributionDir" +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" + +clean || : +exec_maven "$@" diff --git a/benchmark/business_domain/converter/spring/mvnw.cmd b/benchmark/business_domain/converter/spring/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..5761d948924c19571d27b465c519b2e2f9e30351 --- /dev/null +++ b/benchmark/business_domain/converter/spring/mvnw.cmd @@ -0,0 +1,189 @@ +<# : batch portion +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.4 +@REM +@REM Optional ENV vars +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output +@REM ---------------------------------------------------------------------------- + +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) +) +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> + +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} + +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} + +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' + +$MAVEN_M2_PATH = "$HOME/.m2" +if ($env:MAVEN_USER_HOME) { + $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME" +} + +if (-not (Test-Path -Path $MAVEN_M2_PATH)) { + New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null +} + +$MAVEN_WRAPPER_DISTS = $null +if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) { + $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists" +} else { + $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists" +} + +$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain" +$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" + +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} + +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} + +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} + +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null + +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +$actualDistributionDir = "" + +# First try the expected directory name (for regular distributions) +$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain" +$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD" +if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) { + $actualDistributionDir = $distributionUrlNameMain +} + +# If not found, search for any directory with the Maven executable (for snapshots) +if (!$actualDistributionDir) { + Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object { + $testPath = Join-Path $_.FullName "bin/$MVN_CMD" + if (Test-Path -Path $testPath -PathType Leaf) { + $actualDistributionDir = $_.Name + } + } +} + +if (!$actualDistributionDir) { + Write-Error "Could not find Maven distribution directory in extracted archive" +} + +Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir" +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/benchmark/business_domain/converter/spring/pom.xml b/benchmark/business_domain/converter/spring/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..ca8e8aa3128ccc0104bafead3ee64461174d962a --- /dev/null +++ b/benchmark/business_domain/converter/spring/pom.xml @@ -0,0 +1,80 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.4.2 + + + spring.examples.tutorial + converter + 0.0.1-SNAPSHOT + converter + Demo project for Spring Boot + + + + + + + + + + + + + + + 17 + 17 + 17 + UTF-8 + + + + org.springframework + spring-core + 6.2.11 + + + ch.qos.logback + logback-core + 1.5.19 + + + ch.qos.logback + logback-classic + 1.5.19 + + + org.springframework.boot + spring-boot-starter + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/benchmark/business_domain/converter/spring/src/main/java/spring/examples/tutorial/converter/ConverterApplication.java b/benchmark/business_domain/converter/spring/src/main/java/spring/examples/tutorial/converter/ConverterApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..314bbcf003a79f7fc842ff3174533f89feeed7cd --- /dev/null +++ b/benchmark/business_domain/converter/spring/src/main/java/spring/examples/tutorial/converter/ConverterApplication.java @@ -0,0 +1,12 @@ +package spring.examples.tutorial.converter; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class ConverterApplication { + + public static void main(String[] args) { + SpringApplication.run(ConverterApplication.class, args); + } +} diff --git a/benchmark/business_domain/converter/spring/src/main/java/spring/examples/tutorial/converter/controller/ConverterController.java b/benchmark/business_domain/converter/spring/src/main/java/spring/examples/tutorial/converter/controller/ConverterController.java new file mode 100644 index 0000000000000000000000000000000000000000..922b01f6ff456a20c8a91af555314aefd0485665 --- /dev/null +++ b/benchmark/business_domain/converter/spring/src/main/java/spring/examples/tutorial/converter/controller/ConverterController.java @@ -0,0 +1,55 @@ +package spring.examples.tutorial.converter.controller; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.math.BigDecimal; + +import jakarta.servlet.http.HttpServletRequest; +import spring.examples.tutorial.converter.service.ConverterService; + +@RestController +public class ConverterController { + + @Autowired + private ConverterService converter; + + @GetMapping("/") + public String convert(@RequestParam(value = "amount", required = false) String amount, + HttpServletRequest request) { + StringBuilder html = new StringBuilder(); + html.append("") + .append("") + .append("Servlet ConverterServlet") + .append("") + .append("") + .append("

Servlet ConverterServlet at ").append(request.getContextPath()) + .append("

"); + + try { + if (amount != null && !amount.isEmpty()) { + BigDecimal d = new BigDecimal(amount); + BigDecimal yenAmount = converter.dollarToYen(d); + BigDecimal euroAmount = converter.yenToEuro(yenAmount); + + html.append("

").append(amount).append(" dollars are ") + .append(yenAmount.toPlainString()).append(" yen.

"); + html.append("

").append(yenAmount.toPlainString()).append(" yen are ") + .append(euroAmount.toPlainString()).append(" Euro.

"); + } else { + html.append("

Enter a dollar amount to convert:

") + .append("
") + .append("

$

") + .append("
") + .append("") + .append("") + .append("
"); + } + } finally { + html.append("") + .append(""); + } + + return html.toString(); + } +} diff --git a/benchmark/business_domain/converter/spring/src/main/java/spring/examples/tutorial/converter/service/ConverterService.java b/benchmark/business_domain/converter/spring/src/main/java/spring/examples/tutorial/converter/service/ConverterService.java new file mode 100644 index 0000000000000000000000000000000000000000..5dc0552bbb1c8a2a7ec64bc1447f31417ed09aa5 --- /dev/null +++ b/benchmark/business_domain/converter/spring/src/main/java/spring/examples/tutorial/converter/service/ConverterService.java @@ -0,0 +1,20 @@ +package spring.examples.tutorial.converter.service; + +import java.math.BigDecimal; +import org.springframework.stereotype.Service; + +@Service +public class ConverterService { + private final BigDecimal yenRate = new BigDecimal("104.34"); + private final BigDecimal euroRate = new BigDecimal("0.007"); + + public BigDecimal dollarToYen(BigDecimal dollars) { + BigDecimal result = dollars.multiply(yenRate); + return result.setScale(2, BigDecimal.ROUND_UP); + } + + public BigDecimal yenToEuro(BigDecimal yen) { + BigDecimal result = yen.multiply(euroRate); + return result.setScale(2, BigDecimal.ROUND_UP); + } +} diff --git a/benchmark/business_domain/converter/spring/src/main/resources/application.properties b/benchmark/business_domain/converter/spring/src/main/resources/application.properties new file mode 100644 index 0000000000000000000000000000000000000000..c2b8af1d19392918a2203872d151b67df231bcec --- /dev/null +++ b/benchmark/business_domain/converter/spring/src/main/resources/application.properties @@ -0,0 +1,3 @@ +spring.application.name=converter + +server.servlet.contextPath=/converter diff --git a/benchmark/business_domain/converter/spring/test.sh b/benchmark/business_domain/converter/spring/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..a38533b5252b94c78ef2f5f7cbb7b59e55ab133d --- /dev/null +++ b/benchmark/business_domain/converter/spring/test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +BASE_URL="${BASE_URL:-http://localhost:8080/converter}" + +echo "Health check: ${BASE_URL}" +HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}") + +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "PASS - got HTTP ${HTTP_STATUS}" + exit 0 +else + echo "FAIL - got HTTP ${HTTP_STATUS}" + exit 1 +fi diff --git a/benchmark/business_domain/counter/jakarta/.dockerignore b/benchmark/business_domain/counter/jakarta/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..c634c57d9244b4e60b8fa936f09dbe4e75706e74 --- /dev/null +++ b/benchmark/business_domain/counter/jakarta/.dockerignore @@ -0,0 +1,41 @@ +# VCS +.git/ + +# Maven +.mvn/ +**/.mvn/ +mvnw +mvnw.cmd +**/mvnw +**/mvnw.cmd +target/ +**/target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties + +# IDE / Editor +.vscode/ +**/.vscode/ +.zed/ +**/.zed/ +.idea/ +**/.idea/ +*.iml +*.ipr +*.iws + +# OS +.DS_Store +**/.DS_Store +Thumbs.db +ehthumbs.db + +# Logs / temp +*.log +*.tmp +*.temp diff --git a/benchmark/business_domain/counter/jakarta/.mvn/wrapper/MavenWrapperDownloader.java b/benchmark/business_domain/counter/jakarta/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000000000000000000000000000000000..b901097f2db6e50097dc0b222204a88f8cea1609 --- /dev/null +++ b/benchmark/business_domain/counter/jakarta/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/benchmark/business_domain/counter/jakarta/.mvn/wrapper/maven-wrapper.properties b/benchmark/business_domain/counter/jakarta/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..43ad4f7bc95d51463a4cea4b6d84e6e069b98f1f --- /dev/null +++ b/benchmark/business_domain/counter/jakarta/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/benchmark/business_domain/counter/jakarta/Dockerfile b/benchmark/business_domain/counter/jakarta/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..52a2b7f77dd0c4ca02f541e3b14ae226b0c19490 --- /dev/null +++ b/benchmark/business_domain/counter/jakarta/Dockerfile @@ -0,0 +1,34 @@ +FROM maven:3.9.12-ibm-semeru-21-noble + +USER root +# install uv +RUN apt-get update && apt-get install -y --no-install-recommends curl python3-venv python3-full \ + && curl -LsSf https://astral.sh/uv/install.sh | sh + +ENV PATH="/root/.local/bin:$PATH" + +# Shared browsers path so Chromium is cached once +ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright +RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright + +# create venv and install +RUN uv venv /opt/venv \ + && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest + +ENV PATH="/opt/venv/bin:$PATH" +RUN playwright install --with-deps chromium + +WORKDIR /app + +# Cache Maven dependencies separately from source +COPY pom.xml . +RUN mvn dependency:go-offline -q + +# Build application +COPY src ./src +RUN mvn package -DskipTests -q + +COPY test.sh . +RUN chmod +x test.sh + +CMD ["mvn", "liberty:run"] diff --git a/benchmark/business_domain/counter/jakarta/mvnw b/benchmark/business_domain/counter/jakarta/mvnw new file mode 100644 index 0000000000000000000000000000000000000000..41c0f0c23db5dca836d3db1a17a7a28444d17d74 --- /dev/null +++ b/benchmark/business_domain/counter/jakarta/mvnw @@ -0,0 +1,310 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/benchmark/business_domain/counter/jakarta/mvnw.cmd b/benchmark/business_domain/counter/jakarta/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..86115719e5383e94597f918bf18c5ecbb7cfe492 --- /dev/null +++ b/benchmark/business_domain/counter/jakarta/mvnw.cmd @@ -0,0 +1,182 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/benchmark/business_domain/counter/jakarta/pom.xml b/benchmark/business_domain/counter/jakarta/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..60be2303f13ac448429a994843cb8a7c5d9319fc --- /dev/null +++ b/benchmark/business_domain/counter/jakarta/pom.xml @@ -0,0 +1,71 @@ + + + + 4.0.0 + + jakarta.examples.tutorial.ejb + counter + 10-SNAPSHOT + + war + + ${project.artifactId} + + + 3.8.1 + 3.3.1 + UTF-8 + 10.0.0 + 3.10.3 + + + + + jakarta.platform + jakarta.jakartaee-api + ${jakarta.jakartaee-api.version} + provided + + + + + ${project.artifactId} + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven.compiler.plugin.version} + + 11 + 11 + + + + org.apache.maven.plugins + maven-war-plugin + ${maven.war.plugin.version} + + + io.openliberty.tools + liberty-maven-plugin + ${liberty.maven.plugin.version} + + defaultServer + ${project.basedir}/src/main/liberty/config + + + + + diff --git a/benchmark/business_domain/counter/jakarta/src/main/java/jakarta/tutorial/counter/ejb/CounterBean.java b/benchmark/business_domain/counter/jakarta/src/main/java/jakarta/tutorial/counter/ejb/CounterBean.java new file mode 100644 index 0000000000000000000000000000000000000000..a8c7571bca266028f98a3eb1b14e1e5b29093d92 --- /dev/null +++ b/benchmark/business_domain/counter/jakarta/src/main/java/jakarta/tutorial/counter/ejb/CounterBean.java @@ -0,0 +1,30 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.counter.ejb; + +import jakarta.ejb.Singleton; + +/** + * + * @author ian + * CounterBean is a simple singleton session bean that records the number + * of hits to a web page. + */ +@Singleton +public class CounterBean { + private int hits = 1; + + // Increment and return the number of hits + public int getHits() { + return hits++; + } +} diff --git a/benchmark/business_domain/counter/jakarta/src/main/java/jakarta/tutorial/counter/web/Count.java b/benchmark/business_domain/counter/jakarta/src/main/java/jakarta/tutorial/counter/web/Count.java new file mode 100644 index 0000000000000000000000000000000000000000..c49803c5417aef3addca674cbe99b0f33a8f6e6a --- /dev/null +++ b/benchmark/business_domain/counter/jakarta/src/main/java/jakarta/tutorial/counter/web/Count.java @@ -0,0 +1,45 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.counter.web; + +import java.io.Serializable; + +import jakarta.ejb.EJB; +import jakarta.enterprise.context.ConversationScoped; +import jakarta.inject.Named; +import jakarta.tutorial.counter.ejb.CounterBean; + +/** + * + * @author ian + */ +@Named +@ConversationScoped +public class Count implements Serializable { + @EJB + private CounterBean counterBean; + + private int hitCount; + + public Count() { + this.hitCount = 0; + } + + public int getHitCount() { + hitCount = counterBean.getHits(); + return hitCount; + } + + public void setHitCount(int newHits) { + this.hitCount = newHits; + } +} diff --git a/benchmark/business_domain/counter/jakarta/src/main/liberty/config/server.xml b/benchmark/business_domain/counter/jakarta/src/main/liberty/config/server.xml new file mode 100644 index 0000000000000000000000000000000000000000..790077dd5f98d8420cd291851cb334c67fc65917 --- /dev/null +++ b/benchmark/business_domain/counter/jakarta/src/main/liberty/config/server.xml @@ -0,0 +1,15 @@ + + + + jakartaee-10.0 + + + + + + + + + + + \ No newline at end of file diff --git a/benchmark/business_domain/counter/jakarta/src/main/webapp/WEB-INF/web.xml b/benchmark/business_domain/counter/jakarta/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000000000000000000000000000000000..b2312b6b34f6c906e77e836b858d1f7e89da0fcf --- /dev/null +++ b/benchmark/business_domain/counter/jakarta/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,50 @@ + + + + + counter + + + + Tell the runtime where we are in the project development + lifecycle. Valid values are: + Development, UnitTest, SystemTest, or Production. + The runtime will display helpful hints to correct common mistakes + when the value is Development. + + jakarta.faces.PROJECT_STAGE + Development + + + + + Faces Servlet + jakarta.faces.webapp.FacesServlet + 1 + + + + Faces Servlet + *.xhtml + + + + index.xhtml + + + diff --git a/benchmark/business_domain/counter/jakarta/src/main/webapp/index.xhtml b/benchmark/business_domain/counter/jakarta/src/main/webapp/index.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..cc75fd9fb8a5801bdaca95d831e63733833b185a --- /dev/null +++ b/benchmark/business_domain/counter/jakarta/src/main/webapp/index.xhtml @@ -0,0 +1,29 @@ + + + + + + + This page has been accessed #{count.hitCount} time(s). + + + Hooray! + + + + diff --git a/benchmark/business_domain/counter/jakarta/src/main/webapp/resources/css/default.css b/benchmark/business_domain/counter/jakarta/src/main/webapp/resources/css/default.css new file mode 100644 index 0000000000000000000000000000000000000000..33a5857014cfcf5cdb54892c9a1b7fb02d5a1ad8 --- /dev/null +++ b/benchmark/business_domain/counter/jakarta/src/main/webapp/resources/css/default.css @@ -0,0 +1,40 @@ +/** + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +body { + background-color: #ffffff; + font-size: 12px; + font-family: Verdana, "Verdana CE", Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + color: #000000; + margin: 10px; +} + +h1 { + font-family: Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + border-bottom: 1px solid #AFAFAF; + font-size: 16px; + font-weight: bold; + margin: 0px; + padding: 0px; + color: #D20005; +} + +a:link, a:visited { + color: #045491; + font-weight : bold; + text-decoration: none; +} + +a:link:hover, a:visited:hover { + color: #045491; + font-weight : bold; + text-decoration : underline; +} diff --git a/benchmark/business_domain/counter/jakarta/src/main/webapp/template.xhtml b/benchmark/business_domain/counter/jakarta/src/main/webapp/template.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..beef16a0ada3572ae0e8a1fdd78edb21ec745c30 --- /dev/null +++ b/benchmark/business_domain/counter/jakarta/src/main/webapp/template.xhtml @@ -0,0 +1,35 @@ + + + + + + + counter - A singleton session bean example. + + + + +

+ Default Title +

+

+ Default Body +

+ + + diff --git a/benchmark/business_domain/counter/jakarta/test.sh b/benchmark/business_domain/counter/jakarta/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..11ede8c9aba9deb7541bf09f0ff08cdfd0b3c3f5 --- /dev/null +++ b/benchmark/business_domain/counter/jakarta/test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +BASE_URL="${BASE_URL:-http://localhost:9080/counter}" + +echo "Health check: ${BASE_URL}" +HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}") + +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "PASS - got HTTP ${HTTP_STATUS}" + exit 0 +else + echo "FAIL - got HTTP ${HTTP_STATUS}" + exit 1 +fi diff --git a/benchmark/business_domain/counter/quarkus/.dockerignore b/benchmark/business_domain/counter/quarkus/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..c634c57d9244b4e60b8fa936f09dbe4e75706e74 --- /dev/null +++ b/benchmark/business_domain/counter/quarkus/.dockerignore @@ -0,0 +1,41 @@ +# VCS +.git/ + +# Maven +.mvn/ +**/.mvn/ +mvnw +mvnw.cmd +**/mvnw +**/mvnw.cmd +target/ +**/target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties + +# IDE / Editor +.vscode/ +**/.vscode/ +.zed/ +**/.zed/ +.idea/ +**/.idea/ +*.iml +*.ipr +*.iws + +# OS +.DS_Store +**/.DS_Store +Thumbs.db +ehthumbs.db + +# Logs / temp +*.log +*.tmp +*.temp diff --git a/benchmark/business_domain/counter/quarkus/.mvn/wrapper/MavenWrapperDownloader.java b/benchmark/business_domain/counter/quarkus/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000000000000000000000000000000000..b901097f2db6e50097dc0b222204a88f8cea1609 --- /dev/null +++ b/benchmark/business_domain/counter/quarkus/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/benchmark/business_domain/counter/quarkus/.mvn/wrapper/maven-wrapper.properties b/benchmark/business_domain/counter/quarkus/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..43ad4f7bc95d51463a4cea4b6d84e6e069b98f1f --- /dev/null +++ b/benchmark/business_domain/counter/quarkus/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/benchmark/business_domain/counter/quarkus/Dockerfile b/benchmark/business_domain/counter/quarkus/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..dcd2739646fb4fd95a063f846da8c8b49776c723 --- /dev/null +++ b/benchmark/business_domain/counter/quarkus/Dockerfile @@ -0,0 +1,34 @@ +FROM maven:3.9.12-ibm-semeru-21-noble + +USER root +# install uv +RUN apt-get update && apt-get install -y --no-install-recommends curl lsof python3-venv python3-full \ + && curl -LsSf https://astral.sh/uv/install.sh | sh + +ENV PATH="/root/.local/bin:$PATH" + +# Shared browsers path so Chromium is cached once +ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright +RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright + +# create venv and install +RUN uv venv /opt/venv \ + && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest + +ENV PATH="/opt/venv/bin:$PATH" +RUN playwright install --with-deps chromium + +WORKDIR /app + +# Cache Maven dependencies separately from source +COPY pom.xml . +RUN mvn dependency:go-offline -q + +# Build application +COPY src ./src +RUN mvn package -DskipTests -q + +COPY test.sh . +RUN chmod +x test.sh + +CMD ["java", "-jar", "target/quarkus-app/quarkus-run.jar"] diff --git a/benchmark/business_domain/counter/quarkus/README.md b/benchmark/business_domain/counter/quarkus/README.md new file mode 100644 index 0000000000000000000000000000000000000000..ef4384365b11151ee7b35e0d89d182521c06c64d --- /dev/null +++ b/benchmark/business_domain/counter/quarkus/README.md @@ -0,0 +1,58 @@ +# counter + +This project uses Quarkus, the Supersonic Subatomic Java Framework. + +If you want to learn more about Quarkus, please visit its website: . + +## Running the application in dev mode + +You can run your application in dev mode that enables live coding using: + +```shell script +./mvnw quarkus:dev +``` + +> **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at . + +## Packaging and running the application + +The application can be packaged using: + +```shell script +./mvnw package +``` + +It produces the `quarkus-run.jar` file in the `target/quarkus-app/` directory. +Be aware that it’s not an _über-jar_ as the dependencies are copied into the `target/quarkus-app/lib/` directory. + +The application is now runnable using `java -jar target/quarkus-app/quarkus-run.jar`. + +If you want to build an _über-jar_, execute the following command: + +```shell script +./mvnw package -Dquarkus.package.jar.type=uber-jar +``` + +The application, packaged as an _über-jar_, is now runnable using `java -jar target/*-runner.jar`. + +## Creating a native executable + +You can create a native executable using: + +```shell script +./mvnw package -Dnative +``` + +Or, if you don't have GraalVM installed, you can run the native executable build in a container using: + +```shell script +./mvnw package -Dnative -Dquarkus.native.container-build=true +``` + +You can then execute your native executable with: `./target/counter-1.0.0-SNAPSHOT-runner` + +If you want to learn more about building native executables, please consult . + +## Related Guides + +- Apache MyFaces ([guide](https://myfaces.apache.org/#/coregettingstarted?id=quarkus)): Apache MyFaces is a JSF / Faces implementation. diff --git a/benchmark/business_domain/counter/quarkus/mvnw b/benchmark/business_domain/counter/quarkus/mvnw new file mode 100644 index 0000000000000000000000000000000000000000..5e9618cac26d1c3254dc88232a8c4d841316bd29 --- /dev/null +++ b/benchmark/business_domain/counter/quarkus/mvnw @@ -0,0 +1,332 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.2 +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ]; then + + if [ -f /usr/local/etc/mavenrc ]; then + . /usr/local/etc/mavenrc + fi + + if [ -f /etc/mavenrc ]; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ]; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false +darwin=false +mingw=false +case "$(uname)" in +CYGWIN*) cygwin=true ;; +MINGW*) mingw=true ;; +Darwin*) + darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + JAVA_HOME="$(/usr/libexec/java_home)" + export JAVA_HOME + else + JAVA_HOME="/Library/Java/Home" + export JAVA_HOME + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ]; then + if [ -r /etc/gentoo-release ]; then + JAVA_HOME=$(java-config --jre-home) + fi +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin; then + [ -n "$JAVA_HOME" ] \ + && JAVA_HOME=$(cygpath --unix "$JAVA_HOME") + [ -n "$CLASSPATH" ] \ + && CLASSPATH=$(cygpath --path --unix "$CLASSPATH") +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw; then + [ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] \ + && JAVA_HOME="$( + cd "$JAVA_HOME" || ( + echo "cannot cd into $JAVA_HOME." >&2 + exit 1 + ) + pwd + )" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="$(which javac)" + if [ -n "$javaExecutable" ] && ! [ "$(expr "$javaExecutable" : '\([^ ]*\)')" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=$(which readlink) + if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then + if $darwin; then + javaHome="$(dirname "$javaExecutable")" + javaExecutable="$(cd "$javaHome" && pwd -P)/javac" + else + javaExecutable="$(readlink -f "$javaExecutable")" + fi + javaHome="$(dirname "$javaExecutable")" + javaHome=$(expr "$javaHome" : '\(.*\)/bin') + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ]; then + if [ -n "$JAVA_HOME" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="$( + \unset -f command 2>/dev/null + \command -v java + )" + fi +fi + +if [ ! -x "$JAVACMD" ]; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ]; then + echo "Warning: JAVA_HOME environment variable is not set." >&2 +fi + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + if [ -z "$1" ]; then + echo "Path not specified to find_maven_basedir" >&2 + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ]; do + if [ -d "$wdir"/.mvn ]; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=$( + cd "$wdir/.." || exit 1 + pwd + ) + fi + # end of workaround + done + printf '%s' "$( + cd "$basedir" || exit 1 + pwd + )" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + # Remove \r in case we run on Windows within Git Bash + # and check out the repository with auto CRLF management + # enabled. Otherwise, we may read lines that are delimited with + # \r\n and produce $'-Xarg\r' rather than -Xarg due to word + # splitting rules. + tr -s '\r\n' ' ' <"$1" + fi +} + +log() { + if [ "$MVNW_VERBOSE" = true ]; then + printf '%s\n' "$1" + fi +} + +BASE_DIR=$(find_maven_basedir "$(dirname "$0")") +if [ -z "$BASE_DIR" ]; then + exit 1 +fi + +MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +export MAVEN_PROJECTBASEDIR +log "$MAVEN_PROJECTBASEDIR" + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" +if [ -r "$wrapperJarPath" ]; then + log "Found $wrapperJarPath" +else + log "Couldn't find $wrapperJarPath, downloading it ..." + + if [ -n "$MVNW_REPOURL" ]; then + wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar" + else + wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar" + fi + while IFS="=" read -r key value; do + # 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 '=' ) + safeValue=$(echo "$value" | tr -d '\r') + case "$key" in wrapperUrl) + wrapperUrl="$safeValue" + break + ;; + esac + done <"$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" + log "Downloading from: $wrapperUrl" + + if $cygwin; then + wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath") + fi + + if command -v wget >/dev/null; then + log "Found wget ... using wget" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet" + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + else + wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + fi + elif command -v curl >/dev/null; then + log "Found curl ... using curl" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent" + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" + else + curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" + fi + else + log "Falling back to using Java to download" + javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java" + javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaSource=$(cygpath --path --windows "$javaSource") + javaClass=$(cygpath --path --windows "$javaClass") + fi + if [ -e "$javaSource" ]; then + if [ ! -e "$javaClass" ]; then + log " - Compiling MavenWrapperDownloader.java ..." + ("$JAVA_HOME/bin/javac" "$javaSource") + fi + if [ -e "$javaClass" ]; then + log " - Running MavenWrapperDownloader.java ..." + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath" + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +# If specified, validate the SHA-256 sum of the Maven wrapper jar file +wrapperSha256Sum="" +while IFS="=" read -r key value; do + case "$key" in wrapperSha256Sum) + wrapperSha256Sum=$value + break + ;; + esac +done <"$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" +if [ -n "$wrapperSha256Sum" ]; then + wrapperSha256Result=false + if command -v sha256sum >/dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c >/dev/null 2>&1; then + wrapperSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c >/dev/null 2>&1; then + wrapperSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $wrapperSha256Result = false ]; then + echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2 + echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2 + echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2 + exit 1 + fi +fi + +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$JAVA_HOME" ] \ + && JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME") + [ -n "$CLASSPATH" ] \ + && CLASSPATH=$(cygpath --path --windows "$CLASSPATH") + [ -n "$MAVEN_PROJECTBASEDIR" ] \ + && MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR") +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +# shellcheck disable=SC2086 # safe args +exec "$JAVACMD" \ + $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/benchmark/business_domain/counter/quarkus/mvnw.cmd b/benchmark/business_domain/counter/quarkus/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..4136715f081ecad67b4ba4760f84065285a8e72b --- /dev/null +++ b/benchmark/business_domain/counter/quarkus/mvnw.cmd @@ -0,0 +1,206 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.2 +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* +if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. >&2 +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. >&2 +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. >&2 +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. >&2 +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar" + +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %WRAPPER_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file +SET WRAPPER_SHA_256_SUM="" +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B +) +IF NOT %WRAPPER_SHA_256_SUM%=="" ( + powershell -Command "&{"^ + "Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash;"^ + "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^ + "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^ + " Write-Error 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^ + " Write-Error 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^ + " Write-Error 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^ + " exit 1;"^ + "}"^ + "}" + if ERRORLEVEL 1 goto error +) + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% ^ + %JVM_CONFIG_MAVEN_PROPS% ^ + %MAVEN_OPTS% ^ + %MAVEN_DEBUG_OPTS% ^ + -classpath %WRAPPER_JAR% ^ + "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ + %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" +if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%"=="on" pause + +if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% + +cmd /C exit /B %ERROR_CODE% diff --git a/benchmark/business_domain/counter/quarkus/pom.xml b/benchmark/business_domain/counter/quarkus/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..b0b027ca8d94e029e716d6daa7d3f767aaada94d --- /dev/null +++ b/benchmark/business_domain/counter/quarkus/pom.xml @@ -0,0 +1,120 @@ + + + 4.0.0 + quarkus.examples.tutorial + counter + 1.0.0-SNAPSHOT + + + 3.14.0 + 21 + UTF-8 + UTF-8 + quarkus-bom + io.quarkus.platform + 3.30.5 + true + 3.5.3 + + + + + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + + + + + + + org.apache.myfaces.core.extensions.quarkus + myfaces-quarkus + 4.1.2 + + + io.quarkus + quarkus-arc + + + io.quarkus + quarkus-junit5 + test + + + + + + + ${quarkus.platform.group-id} + quarkus-maven-plugin + ${quarkus.platform.version} + true + + + + build + generate-code + generate-code-tests + native-image-agent + + + + + + maven-compiler-plugin + ${compiler-plugin.version} + + true + + + + maven-surefire-plugin + ${surefire-plugin.version} + + + org.jboss.logmanager.LogManager + ${maven.home} + + + + + maven-failsafe-plugin + ${surefire-plugin.version} + + + + integration-test + verify + + + + + + ${project.build.directory}/${project.build.finalName}-runner + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + + + + native + + + native + + + + false + true + + + + diff --git a/benchmark/business_domain/counter/quarkus/src/main/docker/Dockerfile.jvm b/benchmark/business_domain/counter/quarkus/src/main/docker/Dockerfile.jvm new file mode 100644 index 0000000000000000000000000000000000000000..9debeb55e0bc2326d289673e557b8b7bc675d392 --- /dev/null +++ b/benchmark/business_domain/counter/quarkus/src/main/docker/Dockerfile.jvm @@ -0,0 +1,98 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode +# +# Before building the container image run: +# +# ./mvnw package +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/counter-jvm . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/counter-jvm +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005. +# Additionally you will have to set -e JAVA_DEBUG=true and -e JAVA_DEBUG_PORT=*:5005 +# when running the container +# +# Then run the container using : +# +# docker run -i --rm -p 8080:8080 quarkus/counter-jvm +# +# This image uses the `run-java.sh` script to run the application. +# This scripts computes the command line to execute your Java application, and +# includes memory/GC tuning. +# You can configure the behavior using the following environment properties: +# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class") - Be aware that this will override +# the default JVM options, use `JAVA_OPTS_APPEND` to append options +# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options +# in JAVA_OPTS (example: "-Dsome.property=foo") +# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is +# used to calculate a default maximal heap memory based on a containers restriction. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio +# of the container available memory as set here. The default is `50` which means 50% +# of the available memory is used as an upper boundary. You can skip this mechanism by +# setting this value to `0` in which case no `-Xmx` option is added. +# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This +# is used to calculate a default initial heap memory based on the maximum heap memory. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio +# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx` +# is used as the initial heap size. You can skip this mechanism by setting this value +# to `0` in which case no `-Xms` option is added (example: "25") +# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS. +# This is used to calculate the maximum value of the initial heap memory. If used in +# a container without any memory constraints for the container then this option has +# no effect. If there is a memory constraint then `-Xms` is limited to the value set +# here. The default is 4096MB which means the calculated value of `-Xms` never will +# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096") +# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output +# when things are happening. This option, if set to true, will set +# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true"). +# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example: +# true"). +# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787"). +# - CONTAINER_CORE_LIMIT: A calculated core limit as described in +# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2") +# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024"). +# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion. +# (example: "20") +# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking. +# (example: "40") +# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection. +# (example: "4") +# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus +# previous GC times. (example: "90") +# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20") +# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100") +# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should +# contain the necessary JRE command-line options to specify the required GC, which +# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC). +# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080") +# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080") +# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be +# accessed directly. (example: "foo.example.com,bar.example.com") +# +### +FROM registry.access.redhat.com/ubi9/openjdk-21:1.23 + +ENV LANGUAGE='en_US:en' + + +# We make four distinct layers so if there are application changes the library layers can be re-used +COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/ +COPY --chown=185 target/quarkus-app/*.jar /deployments/ +COPY --chown=185 target/quarkus-app/app/ /deployments/app/ +COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/ + +EXPOSE 8080 +USER 185 +ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" + +ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ] + diff --git a/benchmark/business_domain/counter/quarkus/src/main/docker/Dockerfile.legacy-jar b/benchmark/business_domain/counter/quarkus/src/main/docker/Dockerfile.legacy-jar new file mode 100644 index 0000000000000000000000000000000000000000..964226b3747e7575ad2287197fdd4c970be67330 --- /dev/null +++ b/benchmark/business_domain/counter/quarkus/src/main/docker/Dockerfile.legacy-jar @@ -0,0 +1,94 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode +# +# Before building the container image run: +# +# ./mvnw package -Dquarkus.package.jar.type=legacy-jar +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.legacy-jar -t quarkus/counter-legacy-jar . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/counter-legacy-jar +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005. +# Additionally you will have to set -e JAVA_DEBUG=true and -e JAVA_DEBUG_PORT=*:5005 +# when running the container +# +# Then run the container using : +# +# docker run -i --rm -p 8080:8080 quarkus/counter-legacy-jar +# +# This image uses the `run-java.sh` script to run the application. +# This scripts computes the command line to execute your Java application, and +# includes memory/GC tuning. +# You can configure the behavior using the following environment properties: +# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class") - Be aware that this will override +# the default JVM options, use `JAVA_OPTS_APPEND` to append options +# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options +# in JAVA_OPTS (example: "-Dsome.property=foo") +# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is +# used to calculate a default maximal heap memory based on a containers restriction. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio +# of the container available memory as set here. The default is `50` which means 50% +# of the available memory is used as an upper boundary. You can skip this mechanism by +# setting this value to `0` in which case no `-Xmx` option is added. +# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This +# is used to calculate a default initial heap memory based on the maximum heap memory. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio +# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx` +# is used as the initial heap size. You can skip this mechanism by setting this value +# to `0` in which case no `-Xms` option is added (example: "25") +# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS. +# This is used to calculate the maximum value of the initial heap memory. If used in +# a container without any memory constraints for the container then this option has +# no effect. If there is a memory constraint then `-Xms` is limited to the value set +# here. The default is 4096MB which means the calculated value of `-Xms` never will +# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096") +# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output +# when things are happening. This option, if set to true, will set +# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true"). +# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example: +# true"). +# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787"). +# - CONTAINER_CORE_LIMIT: A calculated core limit as described in +# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2") +# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024"). +# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion. +# (example: "20") +# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking. +# (example: "40") +# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection. +# (example: "4") +# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus +# previous GC times. (example: "90") +# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20") +# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100") +# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should +# contain the necessary JRE command-line options to specify the required GC, which +# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC). +# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080") +# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080") +# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be +# accessed directly. (example: "foo.example.com,bar.example.com") +# +### +FROM registry.access.redhat.com/ubi9/openjdk-21:1.23 + +ENV LANGUAGE='en_US:en' + + +COPY target/lib/* /deployments/lib/ +COPY target/*-runner.jar /deployments/quarkus-run.jar + +EXPOSE 8080 +USER 185 +ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" + +ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ] diff --git a/benchmark/business_domain/counter/quarkus/src/main/docker/Dockerfile.native b/benchmark/business_domain/counter/quarkus/src/main/docker/Dockerfile.native new file mode 100644 index 0000000000000000000000000000000000000000..ce60316bb528e6b26dc7014cdaf887728a15a39a --- /dev/null +++ b/benchmark/business_domain/counter/quarkus/src/main/docker/Dockerfile.native @@ -0,0 +1,29 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. +# +# Before building the container image run: +# +# ./mvnw package -Dnative +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.native -t quarkus/counter . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/counter +# +# The ` registry.access.redhat.com/ubi9/ubi-minimal:9.6` base image is based on UBI 9. +# To use UBI 8, switch to `quay.io/ubi8/ubi-minimal:8.10`. +### +FROM registry.access.redhat.com/ubi9/ubi-minimal:9.6 +WORKDIR /work/ +RUN chown 1001 /work \ + && chmod "g+rwX" /work \ + && chown 1001:root /work +COPY --chown=1001:root --chmod=0755 target/*-runner /work/application + +EXPOSE 8080 +USER 1001 + +ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/benchmark/business_domain/counter/quarkus/src/main/docker/Dockerfile.native-micro b/benchmark/business_domain/counter/quarkus/src/main/docker/Dockerfile.native-micro new file mode 100644 index 0000000000000000000000000000000000000000..c603dcd50cc4eefc3bb8a6584cd95e332eb2d3a8 --- /dev/null +++ b/benchmark/business_domain/counter/quarkus/src/main/docker/Dockerfile.native-micro @@ -0,0 +1,32 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. +# It uses a micro base image, tuned for Quarkus native executables. +# It reduces the size of the resulting container image. +# Check https://quarkus.io/guides/quarkus-runtime-base-image for further information about this image. +# +# Before building the container image run: +# +# ./mvnw package -Dnative +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.native-micro -t quarkus/counter . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/counter +# +# The `quay.io/quarkus/ubi9-quarkus-micro-image:2.0` base image is based on UBI 9. +# To use UBI 8, switch to `quay.io/quarkus/quarkus-micro-image:2.0`. +### +FROM quay.io/quarkus/ubi9-quarkus-micro-image:2.0 +WORKDIR /work/ +RUN chown 1001 /work \ + && chmod "g+rwX" /work \ + && chown 1001:root /work +COPY --chown=1001:root --chmod=0755 target/*-runner /work/application + +EXPOSE 8080 +USER 1001 + +ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/benchmark/business_domain/counter/quarkus/src/main/java/quarkus/tutorial/counter/ejb/CounterBean.java b/benchmark/business_domain/counter/quarkus/src/main/java/quarkus/tutorial/counter/ejb/CounterBean.java new file mode 100644 index 0000000000000000000000000000000000000000..ec51845a02d7375f98686cc6ad34bb7bd73b33bc --- /dev/null +++ b/benchmark/business_domain/counter/quarkus/src/main/java/quarkus/tutorial/counter/ejb/CounterBean.java @@ -0,0 +1,13 @@ +package quarkus.tutorial.counter.ejb; + +import jakarta.inject.Singleton; + +@Singleton +public class CounterBean { + private int hits = 1; + + // Increment and return the number of hits + public int getHits() { + return hits++; + } +} diff --git a/benchmark/business_domain/counter/quarkus/src/main/java/quarkus/tutorial/counter/web/Count.java b/benchmark/business_domain/counter/quarkus/src/main/java/quarkus/tutorial/counter/web/Count.java new file mode 100644 index 0000000000000000000000000000000000000000..30028b14c294f9d1c5c3814d7bcd813235e8b915 --- /dev/null +++ b/benchmark/business_domain/counter/quarkus/src/main/java/quarkus/tutorial/counter/web/Count.java @@ -0,0 +1,30 @@ +package quarkus.tutorial.counter.web; + +import java.io.Serializable; + +import jakarta.enterprise.context.SessionScoped; +import jakarta.inject.Inject; +import jakarta.inject.Named; +import quarkus.tutorial.counter.ejb.CounterBean; + +@Named +@SessionScoped // not exactly ConversationScoped, but it's not supported in Quarkus +public class Count implements Serializable { + @Inject + private CounterBean counterBean; + + private int hitCount; + + public Count() { + this.hitCount = 0; + } + + public int getHitCount() { + hitCount = counterBean.getHits(); + return hitCount; + } + + public void setHitCount(int newHits) { + this.hitCount = newHits; + } +} diff --git a/benchmark/business_domain/counter/quarkus/src/main/resources/META-INF/resources/index.xhtml b/benchmark/business_domain/counter/quarkus/src/main/resources/META-INF/resources/index.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..cc75fd9fb8a5801bdaca95d831e63733833b185a --- /dev/null +++ b/benchmark/business_domain/counter/quarkus/src/main/resources/META-INF/resources/index.xhtml @@ -0,0 +1,29 @@ + + + + + + + This page has been accessed #{count.hitCount} time(s). + + + Hooray! + + + + diff --git a/benchmark/business_domain/counter/quarkus/src/main/resources/META-INF/resources/resources/css/default.css b/benchmark/business_domain/counter/quarkus/src/main/resources/META-INF/resources/resources/css/default.css new file mode 100644 index 0000000000000000000000000000000000000000..33a5857014cfcf5cdb54892c9a1b7fb02d5a1ad8 --- /dev/null +++ b/benchmark/business_domain/counter/quarkus/src/main/resources/META-INF/resources/resources/css/default.css @@ -0,0 +1,40 @@ +/** + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +body { + background-color: #ffffff; + font-size: 12px; + font-family: Verdana, "Verdana CE", Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + color: #000000; + margin: 10px; +} + +h1 { + font-family: Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + border-bottom: 1px solid #AFAFAF; + font-size: 16px; + font-weight: bold; + margin: 0px; + padding: 0px; + color: #D20005; +} + +a:link, a:visited { + color: #045491; + font-weight : bold; + text-decoration: none; +} + +a:link:hover, a:visited:hover { + color: #045491; + font-weight : bold; + text-decoration : underline; +} diff --git a/benchmark/business_domain/counter/quarkus/src/main/resources/META-INF/resources/template.xhtml b/benchmark/business_domain/counter/quarkus/src/main/resources/META-INF/resources/template.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..beef16a0ada3572ae0e8a1fdd78edb21ec745c30 --- /dev/null +++ b/benchmark/business_domain/counter/quarkus/src/main/resources/META-INF/resources/template.xhtml @@ -0,0 +1,35 @@ + + + + + + + counter - A singleton session bean example. + + + + +

+ Default Title +

+

+ Default Body +

+ + + diff --git a/benchmark/business_domain/counter/quarkus/src/main/resources/META-INF/web.xml b/benchmark/business_domain/counter/quarkus/src/main/resources/META-INF/web.xml new file mode 100644 index 0000000000000000000000000000000000000000..b2312b6b34f6c906e77e836b858d1f7e89da0fcf --- /dev/null +++ b/benchmark/business_domain/counter/quarkus/src/main/resources/META-INF/web.xml @@ -0,0 +1,50 @@ + + + + + counter + + + + Tell the runtime where we are in the project development + lifecycle. Valid values are: + Development, UnitTest, SystemTest, or Production. + The runtime will display helpful hints to correct common mistakes + when the value is Development. + + jakarta.faces.PROJECT_STAGE + Development + + + + + Faces Servlet + jakarta.faces.webapp.FacesServlet + 1 + + + + Faces Servlet + *.xhtml + + + + index.xhtml + + + diff --git a/benchmark/business_domain/counter/quarkus/src/main/resources/application.properties b/benchmark/business_domain/counter/quarkus/src/main/resources/application.properties new file mode 100644 index 0000000000000000000000000000000000000000..ff3e7b668621e7158989fefcaa333b8c051f8a60 --- /dev/null +++ b/benchmark/business_domain/counter/quarkus/src/main/resources/application.properties @@ -0,0 +1 @@ +quarkus.http.root-path=/counter \ No newline at end of file diff --git a/benchmark/business_domain/counter/quarkus/test.sh b/benchmark/business_domain/counter/quarkus/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..522e36ed7ac069840c9cbaad668dde195bf71250 --- /dev/null +++ b/benchmark/business_domain/counter/quarkus/test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +BASE_URL="${BASE_URL:-http://localhost:8080/counter}" + +echo "Health check: ${BASE_URL}" +HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}") + +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "PASS - got HTTP ${HTTP_STATUS}" + exit 0 +else + echo "FAIL - got HTTP ${HTTP_STATUS}" + exit 1 +fi diff --git a/benchmark/business_domain/counter/spring/.dockerignore b/benchmark/business_domain/counter/spring/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..c634c57d9244b4e60b8fa936f09dbe4e75706e74 --- /dev/null +++ b/benchmark/business_domain/counter/spring/.dockerignore @@ -0,0 +1,41 @@ +# VCS +.git/ + +# Maven +.mvn/ +**/.mvn/ +mvnw +mvnw.cmd +**/mvnw +**/mvnw.cmd +target/ +**/target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties + +# IDE / Editor +.vscode/ +**/.vscode/ +.zed/ +**/.zed/ +.idea/ +**/.idea/ +*.iml +*.ipr +*.iws + +# OS +.DS_Store +**/.DS_Store +Thumbs.db +ehthumbs.db + +# Logs / temp +*.log +*.tmp +*.temp diff --git a/benchmark/business_domain/counter/spring/.mvn/wrapper/MavenWrapperDownloader.java b/benchmark/business_domain/counter/spring/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000000000000000000000000000000000..b901097f2db6e50097dc0b222204a88f8cea1609 --- /dev/null +++ b/benchmark/business_domain/counter/spring/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/benchmark/business_domain/counter/spring/.mvn/wrapper/maven-wrapper.properties b/benchmark/business_domain/counter/spring/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..43ad4f7bc95d51463a4cea4b6d84e6e069b98f1f --- /dev/null +++ b/benchmark/business_domain/counter/spring/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/benchmark/business_domain/counter/spring/Dockerfile b/benchmark/business_domain/counter/spring/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..1e5c9660ba86fdee01192feca7895ddda92c99e3 --- /dev/null +++ b/benchmark/business_domain/counter/spring/Dockerfile @@ -0,0 +1,34 @@ +FROM maven:3.9.12-ibm-semeru-21-noble + +USER root +# install uv +RUN apt-get update && apt-get install -y --no-install-recommends curl python3-venv python3-full \ + && curl -LsSf https://astral.sh/uv/install.sh | sh + +ENV PATH="/root/.local/bin:$PATH" + +# Shared browsers path so Chromium is cached once +ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright +RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright + +# create venv and install +RUN uv venv /opt/venv \ + && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest + +ENV PATH="/opt/venv/bin:$PATH" +RUN playwright install --with-deps chromium + +WORKDIR /app + +# Cache Maven dependencies separately from source +COPY pom.xml . +RUN mvn dependency:go-offline -q + +# Build application +COPY src ./src +RUN mvn package -DskipTests -q + +COPY test.sh . +RUN chmod +x test.sh + +CMD ["sh", "-c", "java -jar target/*.jar"] diff --git a/benchmark/business_domain/counter/spring/mvnw b/benchmark/business_domain/counter/spring/mvnw new file mode 100644 index 0000000000000000000000000000000000000000..bd8896bf2217b46faa0291585e01ac1a3441a958 --- /dev/null +++ b/benchmark/business_domain/counter/spring/mvnw @@ -0,0 +1,295 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.4 +# +# Optional ENV vars +# ----------------- +# JAVA_HOME - location of a JDK home dir, required when download maven via java source +# MVNW_REPOURL - repo url base for downloading maven distribution +# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output +# ---------------------------------------------------------------------------- + +set -euf +[ "${MVNW_VERBOSE-}" != debug ] || set -x + +# OS specific support. +native_path() { printf %s\\n "$1"; } +case "$(uname)" in +CYGWIN* | MINGW*) + [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" + native_path() { cygpath --path --windows "$1"; } + ;; +esac + +# set JAVACMD and JAVACCMD +set_java_home() { + # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched + if [ -n "${JAVA_HOME-}" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACCMD="$JAVA_HOME/jre/sh/javac" + else + JAVACMD="$JAVA_HOME/bin/java" + JAVACCMD="$JAVA_HOME/bin/javac" + + if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then + echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 + echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 + return 1 + fi + fi + else + JAVACMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v java + )" || : + JAVACCMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v javac + )" || : + + if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then + echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 + return 1 + fi + fi +} + +# hash string like Java String::hashCode +hash_string() { + str="${1:-}" h=0 + while [ -n "$str" ]; do + char="${str%"${str#?}"}" + h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) + str="${str#?}" + done + printf %x\\n $h +} + +verbose() { :; } +[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } + +die() { + printf %s\\n "$1" >&2 + exit 1 +} + +trim() { + # MWRAPPER-139: + # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. + # Needed for removing poorly interpreted newline sequences when running in more + # exotic environments such as mingw bash on Windows. + printf "%s" "${1}" | tr -d '[:space:]' +} + +scriptDir="$(dirname "$0")" +scriptName="$(basename "$0")" + +# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties +while IFS="=" read -r key value; do + case "${key-}" in + distributionUrl) distributionUrl=$(trim "${value-}") ;; + distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; + esac +done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" + +case "${distributionUrl##*/}" in +maven-mvnd-*bin.*) + MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ + case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in + *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; + :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; + :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; + :Linux*x86_64*) distributionPlatform=linux-amd64 ;; + *) + echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 + distributionPlatform=linux-amd64 + ;; + esac + distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" + ;; +maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; +*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; +esac + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" +distributionUrlName="${distributionUrl##*/}" +distributionUrlNameMain="${distributionUrlName%.*}" +distributionUrlNameMain="${distributionUrlNameMain%-bin}" +MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" +MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" + +exec_maven() { + unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : + exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" +} + +if [ -d "$MAVEN_HOME" ]; then + verbose "found existing MAVEN_HOME at $MAVEN_HOME" + exec_maven "$@" +fi + +case "${distributionUrl-}" in +*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; +*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; +esac + +# prepare tmp dir +if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then + clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } + trap clean HUP INT TERM EXIT +else + die "cannot create temp dir" +fi + +mkdir -p -- "${MAVEN_HOME%/*}" + +# Download and Install Apache Maven +verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +verbose "Downloading from: $distributionUrl" +verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +# select .zip or .tar.gz +if ! command -v unzip >/dev/null; then + distributionUrl="${distributionUrl%.zip}.tar.gz" + distributionUrlName="${distributionUrl##*/}" +fi + +# verbose opt +__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' +[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v + +# normalize http auth +case "${MVNW_PASSWORD:+has-password}" in +'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; +has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; +esac + +if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then + verbose "Found wget ... using wget" + wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" +elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then + verbose "Found curl ... using curl" + curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" +elif set_java_home; then + verbose "Falling back to use Java to download" + javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" + targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" + cat >"$javaSource" <<-END + public class Downloader extends java.net.Authenticator + { + protected java.net.PasswordAuthentication getPasswordAuthentication() + { + return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); + } + public static void main( String[] args ) throws Exception + { + setDefault( new Downloader() ); + java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); + } + } + END + # For Cygwin/MinGW, switch paths to Windows format before running javac and java + verbose " - Compiling Downloader.java ..." + "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" + verbose " - Running Downloader.java ..." + "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" +fi + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +if [ -n "${distributionSha256Sum-}" ]; then + distributionSha256Result=false + if [ "$MVN_CMD" = mvnd.sh ]; then + echo "Checksum validation is not supported for maven-mvnd." >&2 + echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + elif command -v sha256sum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then + distributionSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $distributionSha256Result = false ]; then + echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 + echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 + exit 1 + fi +fi + +# unzip and move +if command -v unzip >/dev/null; then + unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" +else + tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" +fi + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +actualDistributionDir="" + +# First try the expected directory name (for regular distributions) +if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then + if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then + actualDistributionDir="$distributionUrlNameMain" + fi +fi + +# If not found, search for any directory with the Maven executable (for snapshots) +if [ -z "$actualDistributionDir" ]; then + # enable globbing to iterate over items + set +f + for dir in "$TMP_DOWNLOAD_DIR"/*; do + if [ -d "$dir" ]; then + if [ -f "$dir/bin/$MVN_CMD" ]; then + actualDistributionDir="$(basename "$dir")" + break + fi + fi + done + set -f +fi + +if [ -z "$actualDistributionDir" ]; then + verbose "Contents of $TMP_DOWNLOAD_DIR:" + verbose "$(ls -la "$TMP_DOWNLOAD_DIR")" + die "Could not find Maven distribution directory in extracted archive" +fi + +verbose "Found extracted Maven distribution directory: $actualDistributionDir" +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" + +clean || : +exec_maven "$@" diff --git a/benchmark/business_domain/counter/spring/mvnw.cmd b/benchmark/business_domain/counter/spring/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..5761d948924c19571d27b465c519b2e2f9e30351 --- /dev/null +++ b/benchmark/business_domain/counter/spring/mvnw.cmd @@ -0,0 +1,189 @@ +<# : batch portion +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.4 +@REM +@REM Optional ENV vars +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output +@REM ---------------------------------------------------------------------------- + +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) +) +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> + +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} + +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} + +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' + +$MAVEN_M2_PATH = "$HOME/.m2" +if ($env:MAVEN_USER_HOME) { + $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME" +} + +if (-not (Test-Path -Path $MAVEN_M2_PATH)) { + New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null +} + +$MAVEN_WRAPPER_DISTS = $null +if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) { + $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists" +} else { + $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists" +} + +$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain" +$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" + +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} + +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} + +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} + +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null + +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +$actualDistributionDir = "" + +# First try the expected directory name (for regular distributions) +$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain" +$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD" +if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) { + $actualDistributionDir = $distributionUrlNameMain +} + +# If not found, search for any directory with the Maven executable (for snapshots) +if (!$actualDistributionDir) { + Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object { + $testPath = Join-Path $_.FullName "bin/$MVN_CMD" + if (Test-Path -Path $testPath -PathType Leaf) { + $actualDistributionDir = $_.Name + } + } +} + +if (!$actualDistributionDir) { + Write-Error "Could not find Maven distribution directory in extracted archive" +} + +Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir" +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/benchmark/business_domain/counter/spring/pom.xml b/benchmark/business_domain/counter/spring/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..92bf352797517dbfd41e04c009bec74bd5a298e8 --- /dev/null +++ b/benchmark/business_domain/counter/spring/pom.xml @@ -0,0 +1,65 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.4.2 + + + spring.examples.tutorial + counter + 0.0.1-SNAPSHOT + counter + Demo project for Spring Boot + + + + + + + + + + + + + + + 17 + 17 + 17 + UTF-8 + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/benchmark/business_domain/counter/spring/src/main/java/spring/examples/tutorial/counter/CounterApplication.java b/benchmark/business_domain/counter/spring/src/main/java/spring/examples/tutorial/counter/CounterApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..ae3adf0bf29c7c30ee956a3daa48f02bbeab2fd4 --- /dev/null +++ b/benchmark/business_domain/counter/spring/src/main/java/spring/examples/tutorial/counter/CounterApplication.java @@ -0,0 +1,13 @@ +package spring.examples.tutorial.counter; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class CounterApplication { + + public static void main(String[] args) { + SpringApplication.run(CounterApplication.class, args); + } + +} diff --git a/benchmark/business_domain/counter/spring/src/main/java/spring/examples/tutorial/counter/controller/CountController.java b/benchmark/business_domain/counter/spring/src/main/java/spring/examples/tutorial/counter/controller/CountController.java new file mode 100644 index 0000000000000000000000000000000000000000..c3cc77167b42771656c3b42125d7ed189c10b17e --- /dev/null +++ b/benchmark/business_domain/counter/spring/src/main/java/spring/examples/tutorial/counter/controller/CountController.java @@ -0,0 +1,25 @@ +package spring.examples.tutorial.counter.controller; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; +import spring.examples.tutorial.counter.service.CounterService; + +@Controller +public class CountController { + + private final CounterService counterService; + + @Autowired + public CountController(CounterService counterService) { + this.counterService = counterService; + } + + @GetMapping("/") + public String index(Model model) { + int hitCount = counterService.getHits(); + model.addAttribute("hitCount", hitCount); + return "index"; + } +} diff --git a/benchmark/business_domain/counter/spring/src/main/java/spring/examples/tutorial/counter/service/CounterService.java b/benchmark/business_domain/counter/spring/src/main/java/spring/examples/tutorial/counter/service/CounterService.java new file mode 100644 index 0000000000000000000000000000000000000000..7e941fcda122c3327112def00fd9974f736e25a8 --- /dev/null +++ b/benchmark/business_domain/counter/spring/src/main/java/spring/examples/tutorial/counter/service/CounterService.java @@ -0,0 +1,12 @@ +package spring.examples.tutorial.counter.service; + +import org.springframework.stereotype.Service; + +@Service +public class CounterService { + private int hits = 1; + + public int getHits() { + return hits++; + } +} diff --git a/benchmark/business_domain/counter/spring/src/main/resources/application.properties b/benchmark/business_domain/counter/spring/src/main/resources/application.properties new file mode 100644 index 0000000000000000000000000000000000000000..6eb4ff87ee0c925a605c9352ff151a732cfe4aab --- /dev/null +++ b/benchmark/business_domain/counter/spring/src/main/resources/application.properties @@ -0,0 +1,3 @@ +spring.application.name=counter + +server.servlet.contextPath=/counter diff --git a/benchmark/business_domain/counter/spring/src/main/resources/static/css/default.css b/benchmark/business_domain/counter/spring/src/main/resources/static/css/default.css new file mode 100644 index 0000000000000000000000000000000000000000..33a5857014cfcf5cdb54892c9a1b7fb02d5a1ad8 --- /dev/null +++ b/benchmark/business_domain/counter/spring/src/main/resources/static/css/default.css @@ -0,0 +1,40 @@ +/** + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +body { + background-color: #ffffff; + font-size: 12px; + font-family: Verdana, "Verdana CE", Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + color: #000000; + margin: 10px; +} + +h1 { + font-family: Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + border-bottom: 1px solid #AFAFAF; + font-size: 16px; + font-weight: bold; + margin: 0px; + padding: 0px; + color: #D20005; +} + +a:link, a:visited { + color: #045491; + font-weight : bold; + text-decoration: none; +} + +a:link:hover, a:visited:hover { + color: #045491; + font-weight : bold; + text-decoration : underline; +} diff --git a/benchmark/business_domain/counter/spring/src/main/resources/templates/index.html b/benchmark/business_domain/counter/spring/src/main/resources/templates/index.html new file mode 100644 index 0000000000000000000000000000000000000000..690fc55704a7560f410988142f8d4b3c92d00225 --- /dev/null +++ b/benchmark/business_domain/counter/spring/src/main/resources/templates/index.html @@ -0,0 +1,12 @@ + + + + + +

This page has been accessed [[${hitCount}]] time(s).

+ +

Hooray!

+ + + + \ No newline at end of file diff --git a/benchmark/business_domain/counter/spring/src/main/resources/templates/template.html b/benchmark/business_domain/counter/spring/src/main/resources/templates/template.html new file mode 100644 index 0000000000000000000000000000000000000000..f7b88a34f27c8c81cead0204eb91982c0345f0c0 --- /dev/null +++ b/benchmark/business_domain/counter/spring/src/main/resources/templates/template.html @@ -0,0 +1,15 @@ + + + + + + Counter - A singleton session bean example. + + + + +

Default Title

+

Default Body

+ + + \ No newline at end of file diff --git a/benchmark/business_domain/counter/spring/test.sh b/benchmark/business_domain/counter/spring/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..522e36ed7ac069840c9cbaad668dde195bf71250 --- /dev/null +++ b/benchmark/business_domain/counter/spring/test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +BASE_URL="${BASE_URL:-http://localhost:8080/counter}" + +echo "Health check: ${BASE_URL}" +HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}") + +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "PASS - got HTTP ${HTTP_STATUS}" + exit 0 +else + echo "FAIL - got HTTP ${HTTP_STATUS}" + exit 1 +fi diff --git a/benchmark/business_domain/helloservice/jakarta/.dockerignore b/benchmark/business_domain/helloservice/jakarta/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..c634c57d9244b4e60b8fa936f09dbe4e75706e74 --- /dev/null +++ b/benchmark/business_domain/helloservice/jakarta/.dockerignore @@ -0,0 +1,41 @@ +# VCS +.git/ + +# Maven +.mvn/ +**/.mvn/ +mvnw +mvnw.cmd +**/mvnw +**/mvnw.cmd +target/ +**/target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties + +# IDE / Editor +.vscode/ +**/.vscode/ +.zed/ +**/.zed/ +.idea/ +**/.idea/ +*.iml +*.ipr +*.iws + +# OS +.DS_Store +**/.DS_Store +Thumbs.db +ehthumbs.db + +# Logs / temp +*.log +*.tmp +*.temp diff --git a/benchmark/business_domain/helloservice/jakarta/.mvn/wrapper/MavenWrapperDownloader.java b/benchmark/business_domain/helloservice/jakarta/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000000000000000000000000000000000..b901097f2db6e50097dc0b222204a88f8cea1609 --- /dev/null +++ b/benchmark/business_domain/helloservice/jakarta/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/benchmark/business_domain/helloservice/jakarta/.mvn/wrapper/maven-wrapper.properties b/benchmark/business_domain/helloservice/jakarta/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..43ad4f7bc95d51463a4cea4b6d84e6e069b98f1f --- /dev/null +++ b/benchmark/business_domain/helloservice/jakarta/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/benchmark/business_domain/helloservice/jakarta/Dockerfile b/benchmark/business_domain/helloservice/jakarta/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..5f89bac386bcf1f3e0285b3f2c9cba0e6dd1e4e3 --- /dev/null +++ b/benchmark/business_domain/helloservice/jakarta/Dockerfile @@ -0,0 +1,32 @@ +FROM maven:3.9.12-ibm-semeru-21-noble + +USER root +# install uv +RUN apt-get update && apt-get install -y --no-install-recommends curl python3-venv python3-full && curl -LsSf https://astral.sh/uv/install.sh | sh + +ENV PATH="/root/.local/bin:$PATH" + +# Shared browsers path so Chromium is cached once +ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright +RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright + +# create venv and install +RUN uv venv /opt/venv && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest + +ENV PATH="/opt/venv/bin:$PATH" +RUN playwright install --with-deps chromium + +WORKDIR /app + +# Cache Maven dependencies separately from source +COPY pom.xml . +RUN mvn dependency:go-offline -q + +# Build application +COPY src ./src +RUN mvn package -DskipTests -q + +COPY test.sh . +RUN chmod +x test.sh + +CMD ["mvn", "liberty:run"] diff --git a/benchmark/business_domain/helloservice/jakarta/mvnw b/benchmark/business_domain/helloservice/jakarta/mvnw new file mode 100644 index 0000000000000000000000000000000000000000..41c0f0c23db5dca836d3db1a17a7a28444d17d74 --- /dev/null +++ b/benchmark/business_domain/helloservice/jakarta/mvnw @@ -0,0 +1,310 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/benchmark/business_domain/helloservice/jakarta/mvnw.cmd b/benchmark/business_domain/helloservice/jakarta/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..86115719e5383e94597f918bf18c5ecbb7cfe492 --- /dev/null +++ b/benchmark/business_domain/helloservice/jakarta/mvnw.cmd @@ -0,0 +1,182 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/benchmark/business_domain/helloservice/jakarta/pom.xml b/benchmark/business_domain/helloservice/jakarta/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..8b4bd23c90080720a02a9d6fe0225f6720de3edc --- /dev/null +++ b/benchmark/business_domain/helloservice/jakarta/pom.xml @@ -0,0 +1,64 @@ + + + + 4.0.0 + + jakarta.examples.tutorial.ejb + helloservice + 10-SNAPSHOT + + war + helloservice + + + 3.8.1 + UTF-8 + 10.0.0 + 3.10.3 + + + + + jakarta.platform + jakarta.jakartaee-api + ${jakarta.jakartaee-api.version} + provided + + + + + ${project.artifactId} + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven.compiler.plugin.version} + + 11 + 11 + + + + io.openliberty.tools + liberty-maven-plugin + ${liberty.maven.plugin.version} + + defaultServer + ${project.basedir}/src/main/liberty/config + + + + + diff --git a/benchmark/business_domain/helloservice/jakarta/src/main/java/jakarta/tutorial/helloservice/ejb/HelloServiceBean.java b/benchmark/business_domain/helloservice/jakarta/src/main/java/jakarta/tutorial/helloservice/ejb/HelloServiceBean.java new file mode 100644 index 0000000000000000000000000000000000000000..0c4162235332a9c4b8a1d14ab6614a282ba7f98a --- /dev/null +++ b/benchmark/business_domain/helloservice/jakarta/src/main/java/jakarta/tutorial/helloservice/ejb/HelloServiceBean.java @@ -0,0 +1,34 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.helloservice.ejb; + +import jakarta.ejb.Stateless; +import jakarta.jws.WebMethod; +import jakarta.jws.WebService; + +/** + * HelloServiceBean is a web service endpoint implemented as a stateless + * session bean. + */ + +@Stateless +@WebService +public class HelloServiceBean { + private final String message = "Hello, "; + + public HelloServiceBean() {} + + @WebMethod + public String sayHello(String name) { + return message + name + "."; + } +} diff --git a/benchmark/business_domain/helloservice/jakarta/src/main/liberty/config/server.xml b/benchmark/business_domain/helloservice/jakarta/src/main/liberty/config/server.xml new file mode 100644 index 0000000000000000000000000000000000000000..ffe3f9ec39c5549033515ce66fea7e4565d355dc --- /dev/null +++ b/benchmark/business_domain/helloservice/jakarta/src/main/liberty/config/server.xml @@ -0,0 +1,15 @@ + + + + jakartaee-10.0 + + + + + + + + + + + \ No newline at end of file diff --git a/benchmark/business_domain/helloservice/jakarta/src/main/resources/META-INF/MANIFEST.MF b/benchmark/business_domain/helloservice/jakarta/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000000000000000000000000000000000000..58630c02ef423cffd6dd6aafd946eb8512040c37 --- /dev/null +++ b/benchmark/business_domain/helloservice/jakarta/src/main/resources/META-INF/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/benchmark/business_domain/helloservice/jakarta/test.sh b/benchmark/business_domain/helloservice/jakarta/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..2f71afada2be85ee5ec87d3daeb936a995a19909 --- /dev/null +++ b/benchmark/business_domain/helloservice/jakarta/test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +BASE_URL="${BASE_URL:-http://localhost:9080/helloservice}" + +echo "Health check: ${BASE_URL}" +HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}") + +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "PASS - got HTTP ${HTTP_STATUS}" + exit 0 +else + echo "FAIL - got HTTP ${HTTP_STATUS}" + exit 1 +fi diff --git a/benchmark/business_domain/helloservice/quarkus/.dockerignore b/benchmark/business_domain/helloservice/quarkus/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..c634c57d9244b4e60b8fa936f09dbe4e75706e74 --- /dev/null +++ b/benchmark/business_domain/helloservice/quarkus/.dockerignore @@ -0,0 +1,41 @@ +# VCS +.git/ + +# Maven +.mvn/ +**/.mvn/ +mvnw +mvnw.cmd +**/mvnw +**/mvnw.cmd +target/ +**/target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties + +# IDE / Editor +.vscode/ +**/.vscode/ +.zed/ +**/.zed/ +.idea/ +**/.idea/ +*.iml +*.ipr +*.iws + +# OS +.DS_Store +**/.DS_Store +Thumbs.db +ehthumbs.db + +# Logs / temp +*.log +*.tmp +*.temp diff --git a/benchmark/business_domain/helloservice/quarkus/.mvn/wrapper/MavenWrapperDownloader.java b/benchmark/business_domain/helloservice/quarkus/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000000000000000000000000000000000..b901097f2db6e50097dc0b222204a88f8cea1609 --- /dev/null +++ b/benchmark/business_domain/helloservice/quarkus/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/benchmark/business_domain/helloservice/quarkus/.mvn/wrapper/maven-wrapper.properties b/benchmark/business_domain/helloservice/quarkus/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..43ad4f7bc95d51463a4cea4b6d84e6e069b98f1f --- /dev/null +++ b/benchmark/business_domain/helloservice/quarkus/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/benchmark/business_domain/helloservice/quarkus/Dockerfile b/benchmark/business_domain/helloservice/quarkus/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..dcd2739646fb4fd95a063f846da8c8b49776c723 --- /dev/null +++ b/benchmark/business_domain/helloservice/quarkus/Dockerfile @@ -0,0 +1,34 @@ +FROM maven:3.9.12-ibm-semeru-21-noble + +USER root +# install uv +RUN apt-get update && apt-get install -y --no-install-recommends curl lsof python3-venv python3-full \ + && curl -LsSf https://astral.sh/uv/install.sh | sh + +ENV PATH="/root/.local/bin:$PATH" + +# Shared browsers path so Chromium is cached once +ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright +RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright + +# create venv and install +RUN uv venv /opt/venv \ + && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest + +ENV PATH="/opt/venv/bin:$PATH" +RUN playwright install --with-deps chromium + +WORKDIR /app + +# Cache Maven dependencies separately from source +COPY pom.xml . +RUN mvn dependency:go-offline -q + +# Build application +COPY src ./src +RUN mvn package -DskipTests -q + +COPY test.sh . +RUN chmod +x test.sh + +CMD ["java", "-jar", "target/quarkus-app/quarkus-run.jar"] diff --git a/benchmark/business_domain/helloservice/quarkus/README.md b/benchmark/business_domain/helloservice/quarkus/README.md new file mode 100644 index 0000000000000000000000000000000000000000..9ed06eab862d7b1ce8c0a112a8a334178ea1b700 --- /dev/null +++ b/benchmark/business_domain/helloservice/quarkus/README.md @@ -0,0 +1,58 @@ +# helloservice + +This project uses Quarkus, the Supersonic Subatomic Java Framework. + +If you want to learn more about Quarkus, please visit its website: . + +## Running the application in dev mode + +You can run your application in dev mode that enables live coding using: + +```shell script +./mvnw quarkus:dev +``` + +> **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at . + +## Packaging and running the application + +The application can be packaged using: + +```shell script +./mvnw package +``` + +It produces the `quarkus-run.jar` file in the `target/quarkus-app/` directory. +Be aware that it’s not an _über-jar_ as the dependencies are copied into the `target/quarkus-app/lib/` directory. + +The application is now runnable using `java -jar target/quarkus-app/quarkus-run.jar`. + +If you want to build an _über-jar_, execute the following command: + +```shell script +./mvnw package -Dquarkus.package.jar.type=uber-jar +``` + +The application, packaged as an _über-jar_, is now runnable using `java -jar target/*-runner.jar`. + +## Creating a native executable + +You can create a native executable using: + +```shell script +./mvnw package -Dnative +``` + +Or, if you don't have GraalVM installed, you can run the native executable build in a container using: + +```shell script +./mvnw package -Dnative -Dquarkus.native.container-build=true +``` + +You can then execute your native executable with: `./target/helloservice-1.0.0-SNAPSHOT-runner` + +If you want to learn more about building native executables, please consult . + +## Related Guides + +- Quarkus CXF ([guide](https://quarkiverse.github.io/quarkiverse-docs/quarkus-cxf/dev/reference/extensions/quarkus-cxf.html)): Core capabilities for implementing SOAP clients and JAX-WS services diff --git a/benchmark/business_domain/helloservice/quarkus/mvnw b/benchmark/business_domain/helloservice/quarkus/mvnw new file mode 100644 index 0000000000000000000000000000000000000000..5e9618cac26d1c3254dc88232a8c4d841316bd29 --- /dev/null +++ b/benchmark/business_domain/helloservice/quarkus/mvnw @@ -0,0 +1,332 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.2 +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ]; then + + if [ -f /usr/local/etc/mavenrc ]; then + . /usr/local/etc/mavenrc + fi + + if [ -f /etc/mavenrc ]; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ]; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false +darwin=false +mingw=false +case "$(uname)" in +CYGWIN*) cygwin=true ;; +MINGW*) mingw=true ;; +Darwin*) + darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + JAVA_HOME="$(/usr/libexec/java_home)" + export JAVA_HOME + else + JAVA_HOME="/Library/Java/Home" + export JAVA_HOME + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ]; then + if [ -r /etc/gentoo-release ]; then + JAVA_HOME=$(java-config --jre-home) + fi +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin; then + [ -n "$JAVA_HOME" ] \ + && JAVA_HOME=$(cygpath --unix "$JAVA_HOME") + [ -n "$CLASSPATH" ] \ + && CLASSPATH=$(cygpath --path --unix "$CLASSPATH") +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw; then + [ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] \ + && JAVA_HOME="$( + cd "$JAVA_HOME" || ( + echo "cannot cd into $JAVA_HOME." >&2 + exit 1 + ) + pwd + )" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="$(which javac)" + if [ -n "$javaExecutable" ] && ! [ "$(expr "$javaExecutable" : '\([^ ]*\)')" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=$(which readlink) + if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then + if $darwin; then + javaHome="$(dirname "$javaExecutable")" + javaExecutable="$(cd "$javaHome" && pwd -P)/javac" + else + javaExecutable="$(readlink -f "$javaExecutable")" + fi + javaHome="$(dirname "$javaExecutable")" + javaHome=$(expr "$javaHome" : '\(.*\)/bin') + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ]; then + if [ -n "$JAVA_HOME" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="$( + \unset -f command 2>/dev/null + \command -v java + )" + fi +fi + +if [ ! -x "$JAVACMD" ]; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ]; then + echo "Warning: JAVA_HOME environment variable is not set." >&2 +fi + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + if [ -z "$1" ]; then + echo "Path not specified to find_maven_basedir" >&2 + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ]; do + if [ -d "$wdir"/.mvn ]; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=$( + cd "$wdir/.." || exit 1 + pwd + ) + fi + # end of workaround + done + printf '%s' "$( + cd "$basedir" || exit 1 + pwd + )" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + # Remove \r in case we run on Windows within Git Bash + # and check out the repository with auto CRLF management + # enabled. Otherwise, we may read lines that are delimited with + # \r\n and produce $'-Xarg\r' rather than -Xarg due to word + # splitting rules. + tr -s '\r\n' ' ' <"$1" + fi +} + +log() { + if [ "$MVNW_VERBOSE" = true ]; then + printf '%s\n' "$1" + fi +} + +BASE_DIR=$(find_maven_basedir "$(dirname "$0")") +if [ -z "$BASE_DIR" ]; then + exit 1 +fi + +MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +export MAVEN_PROJECTBASEDIR +log "$MAVEN_PROJECTBASEDIR" + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" +if [ -r "$wrapperJarPath" ]; then + log "Found $wrapperJarPath" +else + log "Couldn't find $wrapperJarPath, downloading it ..." + + if [ -n "$MVNW_REPOURL" ]; then + wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar" + else + wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar" + fi + while IFS="=" read -r key value; do + # 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 '=' ) + safeValue=$(echo "$value" | tr -d '\r') + case "$key" in wrapperUrl) + wrapperUrl="$safeValue" + break + ;; + esac + done <"$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" + log "Downloading from: $wrapperUrl" + + if $cygwin; then + wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath") + fi + + if command -v wget >/dev/null; then + log "Found wget ... using wget" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet" + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + else + wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + fi + elif command -v curl >/dev/null; then + log "Found curl ... using curl" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent" + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" + else + curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" + fi + else + log "Falling back to using Java to download" + javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java" + javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaSource=$(cygpath --path --windows "$javaSource") + javaClass=$(cygpath --path --windows "$javaClass") + fi + if [ -e "$javaSource" ]; then + if [ ! -e "$javaClass" ]; then + log " - Compiling MavenWrapperDownloader.java ..." + ("$JAVA_HOME/bin/javac" "$javaSource") + fi + if [ -e "$javaClass" ]; then + log " - Running MavenWrapperDownloader.java ..." + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath" + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +# If specified, validate the SHA-256 sum of the Maven wrapper jar file +wrapperSha256Sum="" +while IFS="=" read -r key value; do + case "$key" in wrapperSha256Sum) + wrapperSha256Sum=$value + break + ;; + esac +done <"$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" +if [ -n "$wrapperSha256Sum" ]; then + wrapperSha256Result=false + if command -v sha256sum >/dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c >/dev/null 2>&1; then + wrapperSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c >/dev/null 2>&1; then + wrapperSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $wrapperSha256Result = false ]; then + echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2 + echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2 + echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2 + exit 1 + fi +fi + +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$JAVA_HOME" ] \ + && JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME") + [ -n "$CLASSPATH" ] \ + && CLASSPATH=$(cygpath --path --windows "$CLASSPATH") + [ -n "$MAVEN_PROJECTBASEDIR" ] \ + && MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR") +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +# shellcheck disable=SC2086 # safe args +exec "$JAVACMD" \ + $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/benchmark/business_domain/helloservice/quarkus/mvnw.cmd b/benchmark/business_domain/helloservice/quarkus/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..4136715f081ecad67b4ba4760f84065285a8e72b --- /dev/null +++ b/benchmark/business_domain/helloservice/quarkus/mvnw.cmd @@ -0,0 +1,206 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.2 +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* +if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. >&2 +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. >&2 +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. >&2 +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. >&2 +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar" + +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %WRAPPER_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file +SET WRAPPER_SHA_256_SUM="" +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B +) +IF NOT %WRAPPER_SHA_256_SUM%=="" ( + powershell -Command "&{"^ + "Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash;"^ + "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^ + "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^ + " Write-Error 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^ + " Write-Error 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^ + " Write-Error 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^ + " exit 1;"^ + "}"^ + "}" + if ERRORLEVEL 1 goto error +) + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% ^ + %JVM_CONFIG_MAVEN_PROPS% ^ + %MAVEN_OPTS% ^ + %MAVEN_DEBUG_OPTS% ^ + -classpath %WRAPPER_JAR% ^ + "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ + %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" +if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%"=="on" pause + +if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% + +cmd /C exit /B %ERROR_CODE% diff --git a/benchmark/business_domain/helloservice/quarkus/pom.xml b/benchmark/business_domain/helloservice/quarkus/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..2945db1a49eaac39cdaa8b84dadeedf93edfe2a0 --- /dev/null +++ b/benchmark/business_domain/helloservice/quarkus/pom.xml @@ -0,0 +1,126 @@ + + + 4.0.0 + quarkus.examples.tutorial + helloservice + 1.0.0-SNAPSHOT + + + 3.14.0 + 21 + UTF-8 + UTF-8 + quarkus-bom + io.quarkus.platform + 3.30.5 + true + 3.5.3 + + + + + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + + + ${quarkus.platform.group-id} + quarkus-cxf-bom + ${quarkus.platform.version} + pom + import + + + + + + + io.quarkiverse.cxf + quarkus-cxf + + + io.quarkus + quarkus-arc + + + io.quarkus + quarkus-junit5 + test + + + + + + + ${quarkus.platform.group-id} + quarkus-maven-plugin + ${quarkus.platform.version} + true + + + + build + generate-code + generate-code-tests + native-image-agent + + + + + + maven-compiler-plugin + ${compiler-plugin.version} + + true + + + + maven-surefire-plugin + ${surefire-plugin.version} + + + org.jboss.logmanager.LogManager + ${maven.home} + + + + + maven-failsafe-plugin + ${surefire-plugin.version} + + + + integration-test + verify + + + + + + ${project.build.directory}/${project.build.finalName}-runner + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + + + + native + + + native + + + + false + true + + + + diff --git a/benchmark/business_domain/helloservice/quarkus/src/main/docker/Dockerfile.jvm b/benchmark/business_domain/helloservice/quarkus/src/main/docker/Dockerfile.jvm new file mode 100644 index 0000000000000000000000000000000000000000..f439f03d9a8c85ffb692cbcf0308e437d072c06a --- /dev/null +++ b/benchmark/business_domain/helloservice/quarkus/src/main/docker/Dockerfile.jvm @@ -0,0 +1,98 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode +# +# Before building the container image run: +# +# ./mvnw package +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/helloservice-jvm . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/helloservice-jvm +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005. +# Additionally you will have to set -e JAVA_DEBUG=true and -e JAVA_DEBUG_PORT=*:5005 +# when running the container +# +# Then run the container using : +# +# docker run -i --rm -p 8080:8080 quarkus/helloservice-jvm +# +# This image uses the `run-java.sh` script to run the application. +# This scripts computes the command line to execute your Java application, and +# includes memory/GC tuning. +# You can configure the behavior using the following environment properties: +# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class") - Be aware that this will override +# the default JVM options, use `JAVA_OPTS_APPEND` to append options +# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options +# in JAVA_OPTS (example: "-Dsome.property=foo") +# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is +# used to calculate a default maximal heap memory based on a containers restriction. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio +# of the container available memory as set here. The default is `50` which means 50% +# of the available memory is used as an upper boundary. You can skip this mechanism by +# setting this value to `0` in which case no `-Xmx` option is added. +# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This +# is used to calculate a default initial heap memory based on the maximum heap memory. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio +# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx` +# is used as the initial heap size. You can skip this mechanism by setting this value +# to `0` in which case no `-Xms` option is added (example: "25") +# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS. +# This is used to calculate the maximum value of the initial heap memory. If used in +# a container without any memory constraints for the container then this option has +# no effect. If there is a memory constraint then `-Xms` is limited to the value set +# here. The default is 4096MB which means the calculated value of `-Xms` never will +# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096") +# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output +# when things are happening. This option, if set to true, will set +# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true"). +# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example: +# true"). +# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787"). +# - CONTAINER_CORE_LIMIT: A calculated core limit as described in +# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2") +# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024"). +# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion. +# (example: "20") +# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking. +# (example: "40") +# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection. +# (example: "4") +# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus +# previous GC times. (example: "90") +# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20") +# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100") +# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should +# contain the necessary JRE command-line options to specify the required GC, which +# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC). +# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080") +# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080") +# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be +# accessed directly. (example: "foo.example.com,bar.example.com") +# +### +FROM registry.access.redhat.com/ubi9/openjdk-21:1.23 + +ENV LANGUAGE='en_US:en' + + +# We make four distinct layers so if there are application changes the library layers can be re-used +COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/ +COPY --chown=185 target/quarkus-app/*.jar /deployments/ +COPY --chown=185 target/quarkus-app/app/ /deployments/app/ +COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/ + +EXPOSE 8080 +USER 185 +ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" + +ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ] + diff --git a/benchmark/business_domain/helloservice/quarkus/src/main/docker/Dockerfile.legacy-jar b/benchmark/business_domain/helloservice/quarkus/src/main/docker/Dockerfile.legacy-jar new file mode 100644 index 0000000000000000000000000000000000000000..e2efe54658438ffadb64d3d0b85c7d38f35757b3 --- /dev/null +++ b/benchmark/business_domain/helloservice/quarkus/src/main/docker/Dockerfile.legacy-jar @@ -0,0 +1,94 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode +# +# Before building the container image run: +# +# ./mvnw package -Dquarkus.package.jar.type=legacy-jar +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.legacy-jar -t quarkus/helloservice-legacy-jar . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/helloservice-legacy-jar +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005. +# Additionally you will have to set -e JAVA_DEBUG=true and -e JAVA_DEBUG_PORT=*:5005 +# when running the container +# +# Then run the container using : +# +# docker run -i --rm -p 8080:8080 quarkus/helloservice-legacy-jar +# +# This image uses the `run-java.sh` script to run the application. +# This scripts computes the command line to execute your Java application, and +# includes memory/GC tuning. +# You can configure the behavior using the following environment properties: +# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class") - Be aware that this will override +# the default JVM options, use `JAVA_OPTS_APPEND` to append options +# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options +# in JAVA_OPTS (example: "-Dsome.property=foo") +# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is +# used to calculate a default maximal heap memory based on a containers restriction. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio +# of the container available memory as set here. The default is `50` which means 50% +# of the available memory is used as an upper boundary. You can skip this mechanism by +# setting this value to `0` in which case no `-Xmx` option is added. +# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This +# is used to calculate a default initial heap memory based on the maximum heap memory. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio +# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx` +# is used as the initial heap size. You can skip this mechanism by setting this value +# to `0` in which case no `-Xms` option is added (example: "25") +# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS. +# This is used to calculate the maximum value of the initial heap memory. If used in +# a container without any memory constraints for the container then this option has +# no effect. If there is a memory constraint then `-Xms` is limited to the value set +# here. The default is 4096MB which means the calculated value of `-Xms` never will +# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096") +# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output +# when things are happening. This option, if set to true, will set +# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true"). +# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example: +# true"). +# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787"). +# - CONTAINER_CORE_LIMIT: A calculated core limit as described in +# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2") +# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024"). +# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion. +# (example: "20") +# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking. +# (example: "40") +# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection. +# (example: "4") +# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus +# previous GC times. (example: "90") +# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20") +# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100") +# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should +# contain the necessary JRE command-line options to specify the required GC, which +# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC). +# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080") +# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080") +# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be +# accessed directly. (example: "foo.example.com,bar.example.com") +# +### +FROM registry.access.redhat.com/ubi9/openjdk-21:1.23 + +ENV LANGUAGE='en_US:en' + + +COPY target/lib/* /deployments/lib/ +COPY target/*-runner.jar /deployments/quarkus-run.jar + +EXPOSE 8080 +USER 185 +ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" + +ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ] diff --git a/benchmark/business_domain/helloservice/quarkus/src/main/docker/Dockerfile.native b/benchmark/business_domain/helloservice/quarkus/src/main/docker/Dockerfile.native new file mode 100644 index 0000000000000000000000000000000000000000..7f67e80d6975b1783d6ae2f21491fb9d3890d026 --- /dev/null +++ b/benchmark/business_domain/helloservice/quarkus/src/main/docker/Dockerfile.native @@ -0,0 +1,29 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. +# +# Before building the container image run: +# +# ./mvnw package -Dnative +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.native -t quarkus/helloservice . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/helloservice +# +# The ` registry.access.redhat.com/ubi9/ubi-minimal:9.6` base image is based on UBI 9. +# To use UBI 8, switch to `quay.io/ubi8/ubi-minimal:8.10`. +### +FROM registry.access.redhat.com/ubi9/ubi-minimal:9.6 +WORKDIR /work/ +RUN chown 1001 /work \ + && chmod "g+rwX" /work \ + && chown 1001:root /work +COPY --chown=1001:root --chmod=0755 target/*-runner /work/application + +EXPOSE 8080 +USER 1001 + +ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/benchmark/business_domain/helloservice/quarkus/src/main/docker/Dockerfile.native-micro b/benchmark/business_domain/helloservice/quarkus/src/main/docker/Dockerfile.native-micro new file mode 100644 index 0000000000000000000000000000000000000000..2d069f431066613a5987a28889549d48465e7601 --- /dev/null +++ b/benchmark/business_domain/helloservice/quarkus/src/main/docker/Dockerfile.native-micro @@ -0,0 +1,32 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. +# It uses a micro base image, tuned for Quarkus native executables. +# It reduces the size of the resulting container image. +# Check https://quarkus.io/guides/quarkus-runtime-base-image for further information about this image. +# +# Before building the container image run: +# +# ./mvnw package -Dnative +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.native-micro -t quarkus/helloservice . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/helloservice +# +# The `quay.io/quarkus/ubi9-quarkus-micro-image:2.0` base image is based on UBI 9. +# To use UBI 8, switch to `quay.io/quarkus/quarkus-micro-image:2.0`. +### +FROM quay.io/quarkus/ubi9-quarkus-micro-image:2.0 +WORKDIR /work/ +RUN chown 1001 /work \ + && chmod "g+rwX" /work \ + && chown 1001:root /work +COPY --chown=1001:root --chmod=0755 target/*-runner /work/application + +EXPOSE 8080 +USER 1001 + +ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/benchmark/business_domain/helloservice/quarkus/src/main/java/jakarta/tutorial/helloservice/ejb/HelloServiceBean.java b/benchmark/business_domain/helloservice/quarkus/src/main/java/jakarta/tutorial/helloservice/ejb/HelloServiceBean.java new file mode 100644 index 0000000000000000000000000000000000000000..83c183c75c550f52fe23c55d1c12783feec92d47 --- /dev/null +++ b/benchmark/business_domain/helloservice/quarkus/src/main/java/jakarta/tutorial/helloservice/ejb/HelloServiceBean.java @@ -0,0 +1,18 @@ +package jakarta.tutorial.helloservice.ejb; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.jws.WebMethod; +import jakarta.jws.WebService; + +@WebService +public class HelloServiceBean { + private final String message = "Hello, "; + + public HelloServiceBean() { + } + + @WebMethod + public String sayHello(String name) { + return message + name + "."; + } +} diff --git a/benchmark/business_domain/helloservice/quarkus/src/main/resources/application.properties b/benchmark/business_domain/helloservice/quarkus/src/main/resources/application.properties new file mode 100644 index 0000000000000000000000000000000000000000..5c5b812804cc0905d30fde9adea91e838dcf53d9 --- /dev/null +++ b/benchmark/business_domain/helloservice/quarkus/src/main/resources/application.properties @@ -0,0 +1,2 @@ +# just for parity with jakarta +quarkus.cxf.path = /helloservice \ No newline at end of file diff --git a/benchmark/business_domain/helloservice/quarkus/test.sh b/benchmark/business_domain/helloservice/quarkus/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..43307dcd73f7f1efbed34bcc07fb33a75a945a44 --- /dev/null +++ b/benchmark/business_domain/helloservice/quarkus/test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +BASE_URL="${BASE_URL:-http://localhost:8080/helloservice}" + +echo "Health check: ${BASE_URL}" +HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}") + +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "PASS - got HTTP ${HTTP_STATUS}" + exit 0 +else + echo "FAIL - got HTTP ${HTTP_STATUS}" + exit 1 +fi diff --git a/benchmark/business_domain/helloservice/spring/.dockerignore b/benchmark/business_domain/helloservice/spring/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..c634c57d9244b4e60b8fa936f09dbe4e75706e74 --- /dev/null +++ b/benchmark/business_domain/helloservice/spring/.dockerignore @@ -0,0 +1,41 @@ +# VCS +.git/ + +# Maven +.mvn/ +**/.mvn/ +mvnw +mvnw.cmd +**/mvnw +**/mvnw.cmd +target/ +**/target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties + +# IDE / Editor +.vscode/ +**/.vscode/ +.zed/ +**/.zed/ +.idea/ +**/.idea/ +*.iml +*.ipr +*.iws + +# OS +.DS_Store +**/.DS_Store +Thumbs.db +ehthumbs.db + +# Logs / temp +*.log +*.tmp +*.temp diff --git a/benchmark/business_domain/helloservice/spring/.mvn/wrapper/MavenWrapperDownloader.java b/benchmark/business_domain/helloservice/spring/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000000000000000000000000000000000..b901097f2db6e50097dc0b222204a88f8cea1609 --- /dev/null +++ b/benchmark/business_domain/helloservice/spring/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/benchmark/business_domain/helloservice/spring/.mvn/wrapper/maven-wrapper.properties b/benchmark/business_domain/helloservice/spring/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..43ad4f7bc95d51463a4cea4b6d84e6e069b98f1f --- /dev/null +++ b/benchmark/business_domain/helloservice/spring/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/benchmark/business_domain/helloservice/spring/Dockerfile b/benchmark/business_domain/helloservice/spring/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..1e5c9660ba86fdee01192feca7895ddda92c99e3 --- /dev/null +++ b/benchmark/business_domain/helloservice/spring/Dockerfile @@ -0,0 +1,34 @@ +FROM maven:3.9.12-ibm-semeru-21-noble + +USER root +# install uv +RUN apt-get update && apt-get install -y --no-install-recommends curl python3-venv python3-full \ + && curl -LsSf https://astral.sh/uv/install.sh | sh + +ENV PATH="/root/.local/bin:$PATH" + +# Shared browsers path so Chromium is cached once +ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright +RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright + +# create venv and install +RUN uv venv /opt/venv \ + && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest + +ENV PATH="/opt/venv/bin:$PATH" +RUN playwright install --with-deps chromium + +WORKDIR /app + +# Cache Maven dependencies separately from source +COPY pom.xml . +RUN mvn dependency:go-offline -q + +# Build application +COPY src ./src +RUN mvn package -DskipTests -q + +COPY test.sh . +RUN chmod +x test.sh + +CMD ["sh", "-c", "java -jar target/*.jar"] diff --git a/benchmark/business_domain/helloservice/spring/mvnw b/benchmark/business_domain/helloservice/spring/mvnw new file mode 100644 index 0000000000000000000000000000000000000000..bd8896bf2217b46faa0291585e01ac1a3441a958 --- /dev/null +++ b/benchmark/business_domain/helloservice/spring/mvnw @@ -0,0 +1,295 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.4 +# +# Optional ENV vars +# ----------------- +# JAVA_HOME - location of a JDK home dir, required when download maven via java source +# MVNW_REPOURL - repo url base for downloading maven distribution +# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output +# ---------------------------------------------------------------------------- + +set -euf +[ "${MVNW_VERBOSE-}" != debug ] || set -x + +# OS specific support. +native_path() { printf %s\\n "$1"; } +case "$(uname)" in +CYGWIN* | MINGW*) + [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" + native_path() { cygpath --path --windows "$1"; } + ;; +esac + +# set JAVACMD and JAVACCMD +set_java_home() { + # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched + if [ -n "${JAVA_HOME-}" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACCMD="$JAVA_HOME/jre/sh/javac" + else + JAVACMD="$JAVA_HOME/bin/java" + JAVACCMD="$JAVA_HOME/bin/javac" + + if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then + echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 + echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 + return 1 + fi + fi + else + JAVACMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v java + )" || : + JAVACCMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v javac + )" || : + + if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then + echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 + return 1 + fi + fi +} + +# hash string like Java String::hashCode +hash_string() { + str="${1:-}" h=0 + while [ -n "$str" ]; do + char="${str%"${str#?}"}" + h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) + str="${str#?}" + done + printf %x\\n $h +} + +verbose() { :; } +[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } + +die() { + printf %s\\n "$1" >&2 + exit 1 +} + +trim() { + # MWRAPPER-139: + # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. + # Needed for removing poorly interpreted newline sequences when running in more + # exotic environments such as mingw bash on Windows. + printf "%s" "${1}" | tr -d '[:space:]' +} + +scriptDir="$(dirname "$0")" +scriptName="$(basename "$0")" + +# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties +while IFS="=" read -r key value; do + case "${key-}" in + distributionUrl) distributionUrl=$(trim "${value-}") ;; + distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; + esac +done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" + +case "${distributionUrl##*/}" in +maven-mvnd-*bin.*) + MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ + case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in + *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; + :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; + :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; + :Linux*x86_64*) distributionPlatform=linux-amd64 ;; + *) + echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 + distributionPlatform=linux-amd64 + ;; + esac + distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" + ;; +maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; +*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; +esac + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" +distributionUrlName="${distributionUrl##*/}" +distributionUrlNameMain="${distributionUrlName%.*}" +distributionUrlNameMain="${distributionUrlNameMain%-bin}" +MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" +MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" + +exec_maven() { + unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : + exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" +} + +if [ -d "$MAVEN_HOME" ]; then + verbose "found existing MAVEN_HOME at $MAVEN_HOME" + exec_maven "$@" +fi + +case "${distributionUrl-}" in +*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; +*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; +esac + +# prepare tmp dir +if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then + clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } + trap clean HUP INT TERM EXIT +else + die "cannot create temp dir" +fi + +mkdir -p -- "${MAVEN_HOME%/*}" + +# Download and Install Apache Maven +verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +verbose "Downloading from: $distributionUrl" +verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +# select .zip or .tar.gz +if ! command -v unzip >/dev/null; then + distributionUrl="${distributionUrl%.zip}.tar.gz" + distributionUrlName="${distributionUrl##*/}" +fi + +# verbose opt +__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' +[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v + +# normalize http auth +case "${MVNW_PASSWORD:+has-password}" in +'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; +has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; +esac + +if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then + verbose "Found wget ... using wget" + wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" +elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then + verbose "Found curl ... using curl" + curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" +elif set_java_home; then + verbose "Falling back to use Java to download" + javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" + targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" + cat >"$javaSource" <<-END + public class Downloader extends java.net.Authenticator + { + protected java.net.PasswordAuthentication getPasswordAuthentication() + { + return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); + } + public static void main( String[] args ) throws Exception + { + setDefault( new Downloader() ); + java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); + } + } + END + # For Cygwin/MinGW, switch paths to Windows format before running javac and java + verbose " - Compiling Downloader.java ..." + "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" + verbose " - Running Downloader.java ..." + "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" +fi + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +if [ -n "${distributionSha256Sum-}" ]; then + distributionSha256Result=false + if [ "$MVN_CMD" = mvnd.sh ]; then + echo "Checksum validation is not supported for maven-mvnd." >&2 + echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + elif command -v sha256sum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then + distributionSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $distributionSha256Result = false ]; then + echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 + echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 + exit 1 + fi +fi + +# unzip and move +if command -v unzip >/dev/null; then + unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" +else + tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" +fi + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +actualDistributionDir="" + +# First try the expected directory name (for regular distributions) +if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then + if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then + actualDistributionDir="$distributionUrlNameMain" + fi +fi + +# If not found, search for any directory with the Maven executable (for snapshots) +if [ -z "$actualDistributionDir" ]; then + # enable globbing to iterate over items + set +f + for dir in "$TMP_DOWNLOAD_DIR"/*; do + if [ -d "$dir" ]; then + if [ -f "$dir/bin/$MVN_CMD" ]; then + actualDistributionDir="$(basename "$dir")" + break + fi + fi + done + set -f +fi + +if [ -z "$actualDistributionDir" ]; then + verbose "Contents of $TMP_DOWNLOAD_DIR:" + verbose "$(ls -la "$TMP_DOWNLOAD_DIR")" + die "Could not find Maven distribution directory in extracted archive" +fi + +verbose "Found extracted Maven distribution directory: $actualDistributionDir" +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" + +clean || : +exec_maven "$@" diff --git a/benchmark/business_domain/helloservice/spring/mvnw.cmd b/benchmark/business_domain/helloservice/spring/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..5761d948924c19571d27b465c519b2e2f9e30351 --- /dev/null +++ b/benchmark/business_domain/helloservice/spring/mvnw.cmd @@ -0,0 +1,189 @@ +<# : batch portion +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.4 +@REM +@REM Optional ENV vars +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output +@REM ---------------------------------------------------------------------------- + +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) +) +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> + +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} + +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} + +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' + +$MAVEN_M2_PATH = "$HOME/.m2" +if ($env:MAVEN_USER_HOME) { + $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME" +} + +if (-not (Test-Path -Path $MAVEN_M2_PATH)) { + New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null +} + +$MAVEN_WRAPPER_DISTS = $null +if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) { + $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists" +} else { + $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists" +} + +$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain" +$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" + +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} + +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} + +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} + +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null + +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +$actualDistributionDir = "" + +# First try the expected directory name (for regular distributions) +$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain" +$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD" +if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) { + $actualDistributionDir = $distributionUrlNameMain +} + +# If not found, search for any directory with the Maven executable (for snapshots) +if (!$actualDistributionDir) { + Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object { + $testPath = Join-Path $_.FullName "bin/$MVN_CMD" + if (Test-Path -Path $testPath -PathType Leaf) { + $actualDistributionDir = $_.Name + } + } +} + +if (!$actualDistributionDir) { + Write-Error "Could not find Maven distribution directory in extracted archive" +} + +Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir" +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/benchmark/business_domain/helloservice/spring/pom.xml b/benchmark/business_domain/helloservice/spring/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..fbaf2866a643bf2f98629d997af876d333329b8f --- /dev/null +++ b/benchmark/business_domain/helloservice/spring/pom.xml @@ -0,0 +1,94 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.4.2 + + + spring.examples.tutorial + helloservice + 0.0.1-SNAPSHOT + helloservice + Demo project for Spring Boot + + + + + + + + + + + + + + + 17 + 17 + 17 + UTF-8 + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-web-services + + + + wsdl4j + wsdl4j + + + + org.springframework.boot + spring-boot-starter-test + test + + + ch.qos.logback + logback-core + 1.5.19 + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.codehaus.mojo + jaxb2-maven-plugin + 3.2.0 + + + xjc + + xjc + + + + + + ${project.basedir}/src/main/resources/hello.xsd + + + + + + + diff --git a/benchmark/business_domain/helloservice/spring/src/main/java/spring/examples/tutorial/helloservice/HelloServiceApplication.java b/benchmark/business_domain/helloservice/spring/src/main/java/spring/examples/tutorial/helloservice/HelloServiceApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..776a841cbc3361998f4ec795da082e9bceecb7ee --- /dev/null +++ b/benchmark/business_domain/helloservice/spring/src/main/java/spring/examples/tutorial/helloservice/HelloServiceApplication.java @@ -0,0 +1,12 @@ +package spring.examples.tutorial.helloservice; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class HelloServiceApplication { + + public static void main(String[] args) { + SpringApplication.run(HelloServiceApplication.class, args); + } +} diff --git a/benchmark/business_domain/helloservice/spring/src/main/java/spring/examples/tutorial/helloservice/HelloServiceBean.java b/benchmark/business_domain/helloservice/spring/src/main/java/spring/examples/tutorial/helloservice/HelloServiceBean.java new file mode 100644 index 0000000000000000000000000000000000000000..5139141881a7e39a7de8fd34d6e8d1d80798a1e2 --- /dev/null +++ b/benchmark/business_domain/helloservice/spring/src/main/java/spring/examples/tutorial/helloservice/HelloServiceBean.java @@ -0,0 +1,24 @@ +package spring.examples.tutorial.helloservice; + +import jakarta.tutorial.helloservice.ejb.SayHello; +import jakarta.tutorial.helloservice.ejb.SayHelloResponse; +import org.springframework.ws.server.endpoint.annotation.Endpoint; +import org.springframework.ws.server.endpoint.annotation.PayloadRoot; +import org.springframework.ws.server.endpoint.annotation.RequestPayload; +import org.springframework.ws.server.endpoint.annotation.ResponsePayload; + +@Endpoint +public class HelloServiceBean { + + private static final String NAMESPACE_URI = "http://ejb.helloservice.tutorial.jakarta/"; + private final String message = "Hello, "; + + @PayloadRoot(namespace = NAMESPACE_URI, localPart = "sayHello") + @ResponsePayload + public SayHelloResponse sayHello(@RequestPayload SayHello request) { + SayHelloResponse response = new SayHelloResponse(); + response.setReturn(message + request.getArg0() + "."); + return response; + } + +} diff --git a/benchmark/business_domain/helloservice/spring/src/main/java/spring/examples/tutorial/helloservice/WebServiceConfig.java b/benchmark/business_domain/helloservice/spring/src/main/java/spring/examples/tutorial/helloservice/WebServiceConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..b15b3992a438a23e6875a73558ab70de359d9704 --- /dev/null +++ b/benchmark/business_domain/helloservice/spring/src/main/java/spring/examples/tutorial/helloservice/WebServiceConfig.java @@ -0,0 +1,43 @@ +package spring.examples.tutorial.helloservice; + +import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.io.ClassPathResource; +import org.springframework.ws.config.annotation.EnableWs; +import org.springframework.ws.transport.http.MessageDispatcherServlet; +import org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition; +import org.springframework.xml.xsd.SimpleXsdSchema; +import org.springframework.xml.xsd.XsdSchema; + +import java.io.IOException; + +@EnableWs +@Configuration +public class WebServiceConfig { + + @Bean + public ServletRegistrationBean messageDispatcherServlet( + ApplicationContext context) { + MessageDispatcherServlet servlet = new MessageDispatcherServlet(); + servlet.setApplicationContext(context); + servlet.setTransformWsdlLocations(true); + return new ServletRegistrationBean<>(servlet, "/helloservice/*"); + } + + @Bean(name = "HelloServiceBean") + public DefaultWsdl11Definition defaultWsdl11Definition(XsdSchema helloSchema) { + DefaultWsdl11Definition definition = new DefaultWsdl11Definition(); + definition.setPortTypeName("HelloPort"); + definition.setTargetNamespace("http://ejb.helloservice.tutorial.jakarta/"); + definition.setLocationUri("/helloservice/HelloServiceBean"); + definition.setSchema(helloSchema); + return definition; + } + + @Bean + public XsdSchema helloSchema() throws IOException { + return new SimpleXsdSchema(new ClassPathResource("hello.xsd")); + } +} diff --git a/benchmark/business_domain/helloservice/spring/src/main/resources/application.properties b/benchmark/business_domain/helloservice/spring/src/main/resources/application.properties new file mode 100644 index 0000000000000000000000000000000000000000..b6842c3a81bb60a9bc7525c30d9ffbb1ccb6844f --- /dev/null +++ b/benchmark/business_domain/helloservice/spring/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.application.name=helloservice diff --git a/benchmark/business_domain/helloservice/spring/src/main/resources/hello.xsd b/benchmark/business_domain/helloservice/spring/src/main/resources/hello.xsd new file mode 100644 index 0000000000000000000000000000000000000000..0907c65540432fe2c29ffe0b1ea33d4e9703eb23 --- /dev/null +++ b/benchmark/business_domain/helloservice/spring/src/main/resources/hello.xsd @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/benchmark/business_domain/helloservice/spring/test.sh b/benchmark/business_domain/helloservice/spring/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..43307dcd73f7f1efbed34bcc07fb33a75a945a44 --- /dev/null +++ b/benchmark/business_domain/helloservice/spring/test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +BASE_URL="${BASE_URL:-http://localhost:8080/helloservice}" + +echo "Health check: ${BASE_URL}" +HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}") + +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "PASS - got HTTP ${HTTP_STATUS}" + exit 0 +else + echo "FAIL - got HTTP ${HTTP_STATUS}" + exit 1 +fi diff --git a/benchmark/business_domain/standalone/jakarta/.dockerignore b/benchmark/business_domain/standalone/jakarta/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..c634c57d9244b4e60b8fa936f09dbe4e75706e74 --- /dev/null +++ b/benchmark/business_domain/standalone/jakarta/.dockerignore @@ -0,0 +1,41 @@ +# VCS +.git/ + +# Maven +.mvn/ +**/.mvn/ +mvnw +mvnw.cmd +**/mvnw +**/mvnw.cmd +target/ +**/target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties + +# IDE / Editor +.vscode/ +**/.vscode/ +.zed/ +**/.zed/ +.idea/ +**/.idea/ +*.iml +*.ipr +*.iws + +# OS +.DS_Store +**/.DS_Store +Thumbs.db +ehthumbs.db + +# Logs / temp +*.log +*.tmp +*.temp diff --git a/benchmark/business_domain/standalone/jakarta/.mvn/wrapper/MavenWrapperDownloader.java b/benchmark/business_domain/standalone/jakarta/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000000000000000000000000000000000..b901097f2db6e50097dc0b222204a88f8cea1609 --- /dev/null +++ b/benchmark/business_domain/standalone/jakarta/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/benchmark/business_domain/standalone/jakarta/.mvn/wrapper/maven-wrapper.properties b/benchmark/business_domain/standalone/jakarta/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..43ad4f7bc95d51463a4cea4b6d84e6e069b98f1f --- /dev/null +++ b/benchmark/business_domain/standalone/jakarta/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/benchmark/business_domain/standalone/jakarta/Dockerfile b/benchmark/business_domain/standalone/jakarta/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..5f89bac386bcf1f3e0285b3f2c9cba0e6dd1e4e3 --- /dev/null +++ b/benchmark/business_domain/standalone/jakarta/Dockerfile @@ -0,0 +1,32 @@ +FROM maven:3.9.12-ibm-semeru-21-noble + +USER root +# install uv +RUN apt-get update && apt-get install -y --no-install-recommends curl python3-venv python3-full && curl -LsSf https://astral.sh/uv/install.sh | sh + +ENV PATH="/root/.local/bin:$PATH" + +# Shared browsers path so Chromium is cached once +ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright +RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright + +# create venv and install +RUN uv venv /opt/venv && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest + +ENV PATH="/opt/venv/bin:$PATH" +RUN playwright install --with-deps chromium + +WORKDIR /app + +# Cache Maven dependencies separately from source +COPY pom.xml . +RUN mvn dependency:go-offline -q + +# Build application +COPY src ./src +RUN mvn package -DskipTests -q + +COPY test.sh . +RUN chmod +x test.sh + +CMD ["mvn", "liberty:run"] diff --git a/benchmark/business_domain/standalone/jakarta/mvnw b/benchmark/business_domain/standalone/jakarta/mvnw new file mode 100644 index 0000000000000000000000000000000000000000..41c0f0c23db5dca836d3db1a17a7a28444d17d74 --- /dev/null +++ b/benchmark/business_domain/standalone/jakarta/mvnw @@ -0,0 +1,310 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/benchmark/business_domain/standalone/jakarta/mvnw.cmd b/benchmark/business_domain/standalone/jakarta/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..86115719e5383e94597f918bf18c5ecbb7cfe492 --- /dev/null +++ b/benchmark/business_domain/standalone/jakarta/mvnw.cmd @@ -0,0 +1,182 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/benchmark/business_domain/standalone/jakarta/pom.xml b/benchmark/business_domain/standalone/jakarta/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..9d882a43f44e3e0df0833b6187bb11c140c6a553 --- /dev/null +++ b/benchmark/business_domain/standalone/jakarta/pom.xml @@ -0,0 +1,85 @@ + + + + 4.0.0 + + jakarta.examples.tutorial.ejb + standalone + 10-SNAPSHOT + + war + standalone + + + 4.13.1 + 6.2.5 + 3.0.0-M5 + 3.8.1 + UTF-8 + 9.1.0 + 3.10.3 + + + + + jakarta.platform + jakarta.jakartaee-api + ${jakarta.jakartaee-api.version} + provided + + + + junit + junit + ${junit.version} + test + + + org.glassfish.main.extras + glassfish-embedded-all + ${glassfish.embedded.version} + test + + + + + ${project.artifactId} + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven.compiler.plugin.version} + + 11 + 11 + + + + io.openliberty.tools + liberty-maven-plugin + ${liberty.maven.plugin.version} + + defaultServer + ${project.basedir}/src/main/liberty/config + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven.surefire.plugin.version} + + + + diff --git a/benchmark/business_domain/standalone/jakarta/src/main/java/jakarta/tutorial/standalone/ejb/StandaloneBean.java b/benchmark/business_domain/standalone/jakarta/src/main/java/jakarta/tutorial/standalone/ejb/StandaloneBean.java new file mode 100644 index 0000000000000000000000000000000000000000..b3a930edba73c6e5627a44492810899f49e1a37a --- /dev/null +++ b/benchmark/business_domain/standalone/jakarta/src/main/java/jakarta/tutorial/standalone/ejb/StandaloneBean.java @@ -0,0 +1,25 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.standalone.ejb; + +import jakarta.ejb.Stateless; + +@Stateless +public class StandaloneBean { + + private static final String message = "Greetings!"; + + public String returnMessage() { + return message; + } + +} diff --git a/benchmark/business_domain/standalone/jakarta/src/main/java/jakarta/tutorial/standalone/web/GreetResource.java b/benchmark/business_domain/standalone/jakarta/src/main/java/jakarta/tutorial/standalone/web/GreetResource.java new file mode 100644 index 0000000000000000000000000000000000000000..a7bb31bb4f365bd73256cf15a46236141d288a2b --- /dev/null +++ b/benchmark/business_domain/standalone/jakarta/src/main/java/jakarta/tutorial/standalone/web/GreetResource.java @@ -0,0 +1,30 @@ +package jakarta.tutorial.standalone.web; + +import java.util.Map; + +import jakarta.ejb.EJB; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.tutorial.standalone.ejb.StandaloneBean; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; + +@Path("/") +@ApplicationScoped +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public class GreetResource { + + @EJB + private StandaloneBean standaloneBean; + + @GET + @Path("/greet") + public Response greet() { + return Response.ok(Map.of("message", standaloneBean.returnMessage())).build(); + } + +} diff --git a/benchmark/business_domain/standalone/jakarta/src/main/java/jakarta/tutorial/standalone/web/RestApplication.java b/benchmark/business_domain/standalone/jakarta/src/main/java/jakarta/tutorial/standalone/web/RestApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..25cfb5cb9cebc249d72af933b319ffe8480c54fd --- /dev/null +++ b/benchmark/business_domain/standalone/jakarta/src/main/java/jakarta/tutorial/standalone/web/RestApplication.java @@ -0,0 +1,10 @@ +package jakarta.tutorial.standalone.web; + +import jakarta.ws.rs.ApplicationPath; +import jakarta.ws.rs.core.Application; + +@ApplicationPath("/") +public class RestApplication extends Application { + // No additional configuration needed + // JAX-RS will auto-discover resource classes +} diff --git a/benchmark/business_domain/standalone/jakarta/src/main/liberty/config/server.xml b/benchmark/business_domain/standalone/jakarta/src/main/liberty/config/server.xml new file mode 100644 index 0000000000000000000000000000000000000000..76fb908af3254ea4b16b0e4359363b336713320e --- /dev/null +++ b/benchmark/business_domain/standalone/jakarta/src/main/liberty/config/server.xml @@ -0,0 +1,15 @@ + + + + jakartaee-9.1 + + + + + + + + + + + \ No newline at end of file diff --git a/benchmark/business_domain/standalone/jakarta/src/main/resources/META-INF/MANIFEST.MF b/benchmark/business_domain/standalone/jakarta/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000000000000000000000000000000000000..58630c02ef423cffd6dd6aafd946eb8512040c37 --- /dev/null +++ b/benchmark/business_domain/standalone/jakarta/src/main/resources/META-INF/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/benchmark/business_domain/standalone/jakarta/src/test/java/jakarta/tutorial/standalone/ejb/StandaloneBeanTest.java b/benchmark/business_domain/standalone/jakarta/src/test/java/jakarta/tutorial/standalone/ejb/StandaloneBeanTest.java new file mode 100644 index 0000000000000000000000000000000000000000..3089c6d03f995d96a37adb534aca09f2d0c3e7ce --- /dev/null +++ b/benchmark/business_domain/standalone/jakarta/src/test/java/jakarta/tutorial/standalone/ejb/StandaloneBeanTest.java @@ -0,0 +1,65 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.standalone.ejb; + +import static org.junit.Assert.assertEquals; + +import java.util.logging.Logger; + +import javax.naming.Context; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import jakarta.ejb.embeddable.EJBContainer; + +/** + * + * @author ian + */ +public class StandaloneBeanTest { + + private EJBContainer ec; + private Context ctx; + private static final Logger logger = Logger.getLogger("standalone.ejb"); + + public StandaloneBeanTest() { + } + + @Before + public void setUp() { + ec = EJBContainer.createEJBContainer(); + ctx = ec.getContext(); + } + + @After + public void tearDown() { + if (ec != null) { + ec.close(); + } + } + + /** + * Test of returnMessage method, of class StandaloneBean. + * @throws java.lang.Exception + */ + @Test + public void testReturnMessage() throws Exception { + logger.info("Testing standalone.ejb.StandaloneBean.returnMessage()"); + StandaloneBean instance = + (StandaloneBean) ctx.lookup("java:global/classes/StandaloneBean"); + String expResult = "Greetings!"; + String result = instance.returnMessage(); + assertEquals(expResult, result); + } +} diff --git a/benchmark/business_domain/standalone/jakarta/test.sh b/benchmark/business_domain/standalone/jakarta/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..bfa98ddb4630cf1b5fae64faf9610d7c107d752c --- /dev/null +++ b/benchmark/business_domain/standalone/jakarta/test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +BASE_URL="${BASE_URL:-http://localhost:9080/standalone}" + +echo "Health check: ${BASE_URL}" +HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}") + +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "PASS - got HTTP ${HTTP_STATUS}" + exit 0 +else + echo "FAIL - got HTTP ${HTTP_STATUS}" + exit 1 +fi diff --git a/benchmark/business_domain/standalone/quarkus/.dockerignore b/benchmark/business_domain/standalone/quarkus/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..c634c57d9244b4e60b8fa936f09dbe4e75706e74 --- /dev/null +++ b/benchmark/business_domain/standalone/quarkus/.dockerignore @@ -0,0 +1,41 @@ +# VCS +.git/ + +# Maven +.mvn/ +**/.mvn/ +mvnw +mvnw.cmd +**/mvnw +**/mvnw.cmd +target/ +**/target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties + +# IDE / Editor +.vscode/ +**/.vscode/ +.zed/ +**/.zed/ +.idea/ +**/.idea/ +*.iml +*.ipr +*.iws + +# OS +.DS_Store +**/.DS_Store +Thumbs.db +ehthumbs.db + +# Logs / temp +*.log +*.tmp +*.temp diff --git a/benchmark/business_domain/standalone/quarkus/.mvn/wrapper/MavenWrapperDownloader.java b/benchmark/business_domain/standalone/quarkus/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000000000000000000000000000000000..b901097f2db6e50097dc0b222204a88f8cea1609 --- /dev/null +++ b/benchmark/business_domain/standalone/quarkus/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/benchmark/business_domain/standalone/quarkus/.mvn/wrapper/maven-wrapper.properties b/benchmark/business_domain/standalone/quarkus/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..43ad4f7bc95d51463a4cea4b6d84e6e069b98f1f --- /dev/null +++ b/benchmark/business_domain/standalone/quarkus/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/benchmark/business_domain/standalone/quarkus/Dockerfile b/benchmark/business_domain/standalone/quarkus/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..dcd2739646fb4fd95a063f846da8c8b49776c723 --- /dev/null +++ b/benchmark/business_domain/standalone/quarkus/Dockerfile @@ -0,0 +1,34 @@ +FROM maven:3.9.12-ibm-semeru-21-noble + +USER root +# install uv +RUN apt-get update && apt-get install -y --no-install-recommends curl lsof python3-venv python3-full \ + && curl -LsSf https://astral.sh/uv/install.sh | sh + +ENV PATH="/root/.local/bin:$PATH" + +# Shared browsers path so Chromium is cached once +ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright +RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright + +# create venv and install +RUN uv venv /opt/venv \ + && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest + +ENV PATH="/opt/venv/bin:$PATH" +RUN playwright install --with-deps chromium + +WORKDIR /app + +# Cache Maven dependencies separately from source +COPY pom.xml . +RUN mvn dependency:go-offline -q + +# Build application +COPY src ./src +RUN mvn package -DskipTests -q + +COPY test.sh . +RUN chmod +x test.sh + +CMD ["java", "-jar", "target/quarkus-app/quarkus-run.jar"] diff --git a/benchmark/business_domain/standalone/quarkus/README.md b/benchmark/business_domain/standalone/quarkus/README.md new file mode 100644 index 0000000000000000000000000000000000000000..a31b3779ee65e37e6a62ffcf17b1369961fb31b3 --- /dev/null +++ b/benchmark/business_domain/standalone/quarkus/README.md @@ -0,0 +1,62 @@ +# standalone + +This project uses Quarkus, the Supersonic Subatomic Java Framework. + +If you want to learn more about Quarkus, please visit its website: . + +## Running the application in dev mode + +You can run your application in dev mode that enables live coding using: + +```shell script +./mvnw quarkus:dev +``` + +> **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at . + +## Packaging and running the application + +The application can be packaged using: + +```shell script +./mvnw package +``` + +It produces the `quarkus-run.jar` file in the `target/quarkus-app/` directory. +Be aware that it’s not an _über-jar_ as the dependencies are copied into the `target/quarkus-app/lib/` directory. + +The application is now runnable using `java -jar target/quarkus-app/quarkus-run.jar`. + +If you want to build an _über-jar_, execute the following command: + +```shell script +./mvnw package -Dquarkus.package.jar.type=uber-jar +``` + +The application, packaged as an _über-jar_, is now runnable using `java -jar target/*-runner.jar`. + +## Creating a native executable + +You can create a native executable using: + +```shell script +./mvnw package -Dnative +``` + +Or, if you don't have GraalVM installed, you can run the native executable build in a container using: + +```shell script +./mvnw package -Dnative -Dquarkus.native.container-build=true +``` + +You can then execute your native executable with: `./target/standalone-1.0.0-SNAPSHOT-runner` + +If you want to learn more about building native executables, please consult . + +## Provided Code + +### REST + +Easily start your REST Web Services + +[Related guide section...](https://quarkus.io/guides/getting-started-reactive#reactive-jax-rs-resources) diff --git a/benchmark/business_domain/standalone/quarkus/mvnw b/benchmark/business_domain/standalone/quarkus/mvnw new file mode 100644 index 0000000000000000000000000000000000000000..5e9618cac26d1c3254dc88232a8c4d841316bd29 --- /dev/null +++ b/benchmark/business_domain/standalone/quarkus/mvnw @@ -0,0 +1,332 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.2 +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ]; then + + if [ -f /usr/local/etc/mavenrc ]; then + . /usr/local/etc/mavenrc + fi + + if [ -f /etc/mavenrc ]; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ]; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false +darwin=false +mingw=false +case "$(uname)" in +CYGWIN*) cygwin=true ;; +MINGW*) mingw=true ;; +Darwin*) + darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + JAVA_HOME="$(/usr/libexec/java_home)" + export JAVA_HOME + else + JAVA_HOME="/Library/Java/Home" + export JAVA_HOME + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ]; then + if [ -r /etc/gentoo-release ]; then + JAVA_HOME=$(java-config --jre-home) + fi +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin; then + [ -n "$JAVA_HOME" ] \ + && JAVA_HOME=$(cygpath --unix "$JAVA_HOME") + [ -n "$CLASSPATH" ] \ + && CLASSPATH=$(cygpath --path --unix "$CLASSPATH") +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw; then + [ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] \ + && JAVA_HOME="$( + cd "$JAVA_HOME" || ( + echo "cannot cd into $JAVA_HOME." >&2 + exit 1 + ) + pwd + )" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="$(which javac)" + if [ -n "$javaExecutable" ] && ! [ "$(expr "$javaExecutable" : '\([^ ]*\)')" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=$(which readlink) + if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then + if $darwin; then + javaHome="$(dirname "$javaExecutable")" + javaExecutable="$(cd "$javaHome" && pwd -P)/javac" + else + javaExecutable="$(readlink -f "$javaExecutable")" + fi + javaHome="$(dirname "$javaExecutable")" + javaHome=$(expr "$javaHome" : '\(.*\)/bin') + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ]; then + if [ -n "$JAVA_HOME" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="$( + \unset -f command 2>/dev/null + \command -v java + )" + fi +fi + +if [ ! -x "$JAVACMD" ]; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ]; then + echo "Warning: JAVA_HOME environment variable is not set." >&2 +fi + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + if [ -z "$1" ]; then + echo "Path not specified to find_maven_basedir" >&2 + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ]; do + if [ -d "$wdir"/.mvn ]; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=$( + cd "$wdir/.." || exit 1 + pwd + ) + fi + # end of workaround + done + printf '%s' "$( + cd "$basedir" || exit 1 + pwd + )" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + # Remove \r in case we run on Windows within Git Bash + # and check out the repository with auto CRLF management + # enabled. Otherwise, we may read lines that are delimited with + # \r\n and produce $'-Xarg\r' rather than -Xarg due to word + # splitting rules. + tr -s '\r\n' ' ' <"$1" + fi +} + +log() { + if [ "$MVNW_VERBOSE" = true ]; then + printf '%s\n' "$1" + fi +} + +BASE_DIR=$(find_maven_basedir "$(dirname "$0")") +if [ -z "$BASE_DIR" ]; then + exit 1 +fi + +MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +export MAVEN_PROJECTBASEDIR +log "$MAVEN_PROJECTBASEDIR" + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" +if [ -r "$wrapperJarPath" ]; then + log "Found $wrapperJarPath" +else + log "Couldn't find $wrapperJarPath, downloading it ..." + + if [ -n "$MVNW_REPOURL" ]; then + wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar" + else + wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar" + fi + while IFS="=" read -r key value; do + # 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 '=' ) + safeValue=$(echo "$value" | tr -d '\r') + case "$key" in wrapperUrl) + wrapperUrl="$safeValue" + break + ;; + esac + done <"$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" + log "Downloading from: $wrapperUrl" + + if $cygwin; then + wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath") + fi + + if command -v wget >/dev/null; then + log "Found wget ... using wget" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet" + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + else + wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + fi + elif command -v curl >/dev/null; then + log "Found curl ... using curl" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent" + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" + else + curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" + fi + else + log "Falling back to using Java to download" + javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java" + javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaSource=$(cygpath --path --windows "$javaSource") + javaClass=$(cygpath --path --windows "$javaClass") + fi + if [ -e "$javaSource" ]; then + if [ ! -e "$javaClass" ]; then + log " - Compiling MavenWrapperDownloader.java ..." + ("$JAVA_HOME/bin/javac" "$javaSource") + fi + if [ -e "$javaClass" ]; then + log " - Running MavenWrapperDownloader.java ..." + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath" + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +# If specified, validate the SHA-256 sum of the Maven wrapper jar file +wrapperSha256Sum="" +while IFS="=" read -r key value; do + case "$key" in wrapperSha256Sum) + wrapperSha256Sum=$value + break + ;; + esac +done <"$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" +if [ -n "$wrapperSha256Sum" ]; then + wrapperSha256Result=false + if command -v sha256sum >/dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c >/dev/null 2>&1; then + wrapperSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c >/dev/null 2>&1; then + wrapperSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $wrapperSha256Result = false ]; then + echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2 + echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2 + echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2 + exit 1 + fi +fi + +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$JAVA_HOME" ] \ + && JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME") + [ -n "$CLASSPATH" ] \ + && CLASSPATH=$(cygpath --path --windows "$CLASSPATH") + [ -n "$MAVEN_PROJECTBASEDIR" ] \ + && MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR") +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +# shellcheck disable=SC2086 # safe args +exec "$JAVACMD" \ + $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/benchmark/business_domain/standalone/quarkus/mvnw.cmd b/benchmark/business_domain/standalone/quarkus/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..4136715f081ecad67b4ba4760f84065285a8e72b --- /dev/null +++ b/benchmark/business_domain/standalone/quarkus/mvnw.cmd @@ -0,0 +1,206 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.2 +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* +if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. >&2 +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. >&2 +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. >&2 +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. >&2 +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar" + +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %WRAPPER_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file +SET WRAPPER_SHA_256_SUM="" +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B +) +IF NOT %WRAPPER_SHA_256_SUM%=="" ( + powershell -Command "&{"^ + "Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash;"^ + "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^ + "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^ + " Write-Error 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^ + " Write-Error 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^ + " Write-Error 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^ + " exit 1;"^ + "}"^ + "}" + if ERRORLEVEL 1 goto error +) + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% ^ + %JVM_CONFIG_MAVEN_PROPS% ^ + %MAVEN_OPTS% ^ + %MAVEN_DEBUG_OPTS% ^ + -classpath %WRAPPER_JAR% ^ + "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ + %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" +if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%"=="on" pause + +if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% + +cmd /C exit /B %ERROR_CODE% diff --git a/benchmark/business_domain/standalone/quarkus/pom.xml b/benchmark/business_domain/standalone/quarkus/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..cedb94cd3d0ab7606c3d51730fdf6ca7b625947c --- /dev/null +++ b/benchmark/business_domain/standalone/quarkus/pom.xml @@ -0,0 +1,149 @@ + + + 4.0.0 + quarkus.examples.tutorial + standalone + 1.0.0-SNAPSHOT + + + 3.14.0 + 21 + UTF-8 + UTF-8 + quarkus-bom + io.quarkus.platform + 3.30.5 + true + 3.5.3 + + + + + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + + + io.netty + netty-codec-http + 4.1.130.Final + + + io.netty + netty-codec + 4.1.130.Final + + + io.netty + netty-handler + 4.1.130.Final + + + io.vertx + vertx-web + 4.5.23 + + + io.vertx + vertx-web-common + 4.5.23 + + + + + + + io.quarkus + quarkus-arc + + + io.quarkus + quarkus-resteasy-jackson + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + + + + + ${quarkus.platform.group-id} + quarkus-maven-plugin + ${quarkus.platform.version} + true + + + + build + generate-code + generate-code-tests + native-image-agent + + + + + + maven-compiler-plugin + ${compiler-plugin.version} + + true + + + + maven-surefire-plugin + ${surefire-plugin.version} + + + org.jboss.logmanager.LogManager + ${maven.home} + + + + + maven-failsafe-plugin + ${surefire-plugin.version} + + + + integration-test + verify + + + + + + ${project.build.directory}/${project.build.finalName}-runner + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + + + + native + + + native + + + + false + true + + + + diff --git a/benchmark/business_domain/standalone/quarkus/src/main/docker/Dockerfile.jvm b/benchmark/business_domain/standalone/quarkus/src/main/docker/Dockerfile.jvm new file mode 100644 index 0000000000000000000000000000000000000000..9f29b4da1ab270f866f80a434ba8e725b1f974e0 --- /dev/null +++ b/benchmark/business_domain/standalone/quarkus/src/main/docker/Dockerfile.jvm @@ -0,0 +1,98 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode +# +# Before building the container image run: +# +# ./mvnw package +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/standalone-jvm . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/standalone-jvm +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005. +# Additionally you will have to set -e JAVA_DEBUG=true and -e JAVA_DEBUG_PORT=*:5005 +# when running the container +# +# Then run the container using : +# +# docker run -i --rm -p 8080:8080 quarkus/standalone-jvm +# +# This image uses the `run-java.sh` script to run the application. +# This scripts computes the command line to execute your Java application, and +# includes memory/GC tuning. +# You can configure the behavior using the following environment properties: +# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class") - Be aware that this will override +# the default JVM options, use `JAVA_OPTS_APPEND` to append options +# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options +# in JAVA_OPTS (example: "-Dsome.property=foo") +# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is +# used to calculate a default maximal heap memory based on a containers restriction. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio +# of the container available memory as set here. The default is `50` which means 50% +# of the available memory is used as an upper boundary. You can skip this mechanism by +# setting this value to `0` in which case no `-Xmx` option is added. +# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This +# is used to calculate a default initial heap memory based on the maximum heap memory. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio +# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx` +# is used as the initial heap size. You can skip this mechanism by setting this value +# to `0` in which case no `-Xms` option is added (example: "25") +# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS. +# This is used to calculate the maximum value of the initial heap memory. If used in +# a container without any memory constraints for the container then this option has +# no effect. If there is a memory constraint then `-Xms` is limited to the value set +# here. The default is 4096MB which means the calculated value of `-Xms` never will +# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096") +# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output +# when things are happening. This option, if set to true, will set +# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true"). +# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example: +# true"). +# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787"). +# - CONTAINER_CORE_LIMIT: A calculated core limit as described in +# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2") +# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024"). +# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion. +# (example: "20") +# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking. +# (example: "40") +# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection. +# (example: "4") +# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus +# previous GC times. (example: "90") +# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20") +# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100") +# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should +# contain the necessary JRE command-line options to specify the required GC, which +# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC). +# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080") +# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080") +# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be +# accessed directly. (example: "foo.example.com,bar.example.com") +# +### +FROM registry.access.redhat.com/ubi9/openjdk-21:1.23 + +ENV LANGUAGE='en_US:en' + + +# We make four distinct layers so if there are application changes the library layers can be re-used +COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/ +COPY --chown=185 target/quarkus-app/*.jar /deployments/ +COPY --chown=185 target/quarkus-app/app/ /deployments/app/ +COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/ + +EXPOSE 8080 +USER 185 +ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" + +ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ] + diff --git a/benchmark/business_domain/standalone/quarkus/src/main/docker/Dockerfile.legacy-jar b/benchmark/business_domain/standalone/quarkus/src/main/docker/Dockerfile.legacy-jar new file mode 100644 index 0000000000000000000000000000000000000000..2b335b97e05f85bee5d9ee166c65677a6d4c11b1 --- /dev/null +++ b/benchmark/business_domain/standalone/quarkus/src/main/docker/Dockerfile.legacy-jar @@ -0,0 +1,94 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode +# +# Before building the container image run: +# +# ./mvnw package -Dquarkus.package.jar.type=legacy-jar +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.legacy-jar -t quarkus/standalone-legacy-jar . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/standalone-legacy-jar +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005. +# Additionally you will have to set -e JAVA_DEBUG=true and -e JAVA_DEBUG_PORT=*:5005 +# when running the container +# +# Then run the container using : +# +# docker run -i --rm -p 8080:8080 quarkus/standalone-legacy-jar +# +# This image uses the `run-java.sh` script to run the application. +# This scripts computes the command line to execute your Java application, and +# includes memory/GC tuning. +# You can configure the behavior using the following environment properties: +# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class") - Be aware that this will override +# the default JVM options, use `JAVA_OPTS_APPEND` to append options +# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options +# in JAVA_OPTS (example: "-Dsome.property=foo") +# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is +# used to calculate a default maximal heap memory based on a containers restriction. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio +# of the container available memory as set here. The default is `50` which means 50% +# of the available memory is used as an upper boundary. You can skip this mechanism by +# setting this value to `0` in which case no `-Xmx` option is added. +# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This +# is used to calculate a default initial heap memory based on the maximum heap memory. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio +# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx` +# is used as the initial heap size. You can skip this mechanism by setting this value +# to `0` in which case no `-Xms` option is added (example: "25") +# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS. +# This is used to calculate the maximum value of the initial heap memory. If used in +# a container without any memory constraints for the container then this option has +# no effect. If there is a memory constraint then `-Xms` is limited to the value set +# here. The default is 4096MB which means the calculated value of `-Xms` never will +# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096") +# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output +# when things are happening. This option, if set to true, will set +# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true"). +# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example: +# true"). +# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787"). +# - CONTAINER_CORE_LIMIT: A calculated core limit as described in +# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2") +# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024"). +# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion. +# (example: "20") +# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking. +# (example: "40") +# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection. +# (example: "4") +# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus +# previous GC times. (example: "90") +# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20") +# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100") +# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should +# contain the necessary JRE command-line options to specify the required GC, which +# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC). +# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080") +# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080") +# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be +# accessed directly. (example: "foo.example.com,bar.example.com") +# +### +FROM registry.access.redhat.com/ubi9/openjdk-21:1.23 + +ENV LANGUAGE='en_US:en' + + +COPY target/lib/* /deployments/lib/ +COPY target/*-runner.jar /deployments/quarkus-run.jar + +EXPOSE 8080 +USER 185 +ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" + +ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ] diff --git a/benchmark/business_domain/standalone/quarkus/src/main/docker/Dockerfile.native b/benchmark/business_domain/standalone/quarkus/src/main/docker/Dockerfile.native new file mode 100644 index 0000000000000000000000000000000000000000..4f841f2f7d65e063646abb96f45fc60adb0d085c --- /dev/null +++ b/benchmark/business_domain/standalone/quarkus/src/main/docker/Dockerfile.native @@ -0,0 +1,29 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. +# +# Before building the container image run: +# +# ./mvnw package -Dnative +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.native -t quarkus/standalone . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/standalone +# +# The ` registry.access.redhat.com/ubi9/ubi-minimal:9.6` base image is based on UBI 9. +# To use UBI 8, switch to `quay.io/ubi8/ubi-minimal:8.10`. +### +FROM registry.access.redhat.com/ubi9/ubi-minimal:9.6 +WORKDIR /work/ +RUN chown 1001 /work \ + && chmod "g+rwX" /work \ + && chown 1001:root /work +COPY --chown=1001:root --chmod=0755 target/*-runner /work/application + +EXPOSE 8080 +USER 1001 + +ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/benchmark/business_domain/standalone/quarkus/src/main/docker/Dockerfile.native-micro b/benchmark/business_domain/standalone/quarkus/src/main/docker/Dockerfile.native-micro new file mode 100644 index 0000000000000000000000000000000000000000..c50a05b15aa18ff79f35f83baf9b4361c704e3b7 --- /dev/null +++ b/benchmark/business_domain/standalone/quarkus/src/main/docker/Dockerfile.native-micro @@ -0,0 +1,32 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. +# It uses a micro base image, tuned for Quarkus native executables. +# It reduces the size of the resulting container image. +# Check https://quarkus.io/guides/quarkus-runtime-base-image for further information about this image. +# +# Before building the container image run: +# +# ./mvnw package -Dnative +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.native-micro -t quarkus/standalone . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/standalone +# +# The `quay.io/quarkus/ubi9-quarkus-micro-image:2.0` base image is based on UBI 9. +# To use UBI 8, switch to `quay.io/quarkus/quarkus-micro-image:2.0`. +### +FROM quay.io/quarkus/ubi9-quarkus-micro-image:2.0 +WORKDIR /work/ +RUN chown 1001 /work \ + && chmod "g+rwX" /work \ + && chown 1001:root /work +COPY --chown=1001:root --chmod=0755 target/*-runner /work/application + +EXPOSE 8080 +USER 1001 + +ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/benchmark/business_domain/standalone/quarkus/src/main/java/quarkus/examples/tutorial/GreetResource.java b/benchmark/business_domain/standalone/quarkus/src/main/java/quarkus/examples/tutorial/GreetResource.java new file mode 100644 index 0000000000000000000000000000000000000000..06d3ca0097d2858e66369d161c3657266a6e0206 --- /dev/null +++ b/benchmark/business_domain/standalone/quarkus/src/main/java/quarkus/examples/tutorial/GreetResource.java @@ -0,0 +1,29 @@ +package quarkus.examples.tutorial; + +import java.util.Map; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; + +@Path("/") +@ApplicationScoped +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public class GreetResource { + + @Inject + StandaloneBean standaloneBean; + + @GET + @Path("/greet") + public Response greet() { + return Response.ok(Map.of("message", standaloneBean.returnMessage())).build(); + } + +} diff --git a/benchmark/business_domain/standalone/quarkus/src/main/java/quarkus/examples/tutorial/StandaloneBean.java b/benchmark/business_domain/standalone/quarkus/src/main/java/quarkus/examples/tutorial/StandaloneBean.java new file mode 100644 index 0000000000000000000000000000000000000000..b340ad55f5dd73bd71532824a29911a215fd40b9 --- /dev/null +++ b/benchmark/business_domain/standalone/quarkus/src/main/java/quarkus/examples/tutorial/StandaloneBean.java @@ -0,0 +1,14 @@ +package quarkus.examples.tutorial; + +import jakarta.enterprise.context.ApplicationScoped; + +@ApplicationScoped +public class StandaloneBean { + + private static final String message = "Greetings!"; + + public String returnMessage() { + return message; + } + +} diff --git a/benchmark/business_domain/standalone/quarkus/src/main/resources/application.properties b/benchmark/business_domain/standalone/quarkus/src/main/resources/application.properties new file mode 100644 index 0000000000000000000000000000000000000000..44933f2096135fe7e1653ac86d1d2cb89a76811e --- /dev/null +++ b/benchmark/business_domain/standalone/quarkus/src/main/resources/application.properties @@ -0,0 +1 @@ +quarkus.http.root-path=/standalone \ No newline at end of file diff --git a/benchmark/business_domain/standalone/quarkus/src/test/java/quarkus/examples/tutorial/StandaloneBeanTest.java b/benchmark/business_domain/standalone/quarkus/src/test/java/quarkus/examples/tutorial/StandaloneBeanTest.java new file mode 100644 index 0000000000000000000000000000000000000000..def0f15799ebcb537b709f1ce1daca2d60441e02 --- /dev/null +++ b/benchmark/business_domain/standalone/quarkus/src/test/java/quarkus/examples/tutorial/StandaloneBeanTest.java @@ -0,0 +1,24 @@ +package quarkus.examples.tutorial; + +import io.quarkus.test.junit.QuarkusTest; +import jakarta.inject.Inject; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import java.util.logging.Logger; + +@QuarkusTest +class StandaloneBeanTest { + private static final Logger logger = Logger.getLogger("standalone"); + + @Inject + private StandaloneBean standaloneBean; + + @Test + public void testReturnMessage() throws Exception { + logger.info("Testing StandaloneBean.returnMessage()"); + String expResult = "Greetings!"; + String result = standaloneBean.returnMessage(); + assertEquals(expResult, result); + } +} diff --git a/benchmark/business_domain/standalone/quarkus/test.sh b/benchmark/business_domain/standalone/quarkus/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..2f6a7a940e269497834310db734b759b8b44ae0a --- /dev/null +++ b/benchmark/business_domain/standalone/quarkus/test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +BASE_URL="${BASE_URL:-http://localhost:8080/standalone}" + +echo "Health check: ${BASE_URL}" +HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}") + +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "PASS - got HTTP ${HTTP_STATUS}" + exit 0 +else + echo "FAIL - got HTTP ${HTTP_STATUS}" + exit 1 +fi diff --git a/benchmark/business_domain/standalone/spring/.dockerignore b/benchmark/business_domain/standalone/spring/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..c634c57d9244b4e60b8fa936f09dbe4e75706e74 --- /dev/null +++ b/benchmark/business_domain/standalone/spring/.dockerignore @@ -0,0 +1,41 @@ +# VCS +.git/ + +# Maven +.mvn/ +**/.mvn/ +mvnw +mvnw.cmd +**/mvnw +**/mvnw.cmd +target/ +**/target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties + +# IDE / Editor +.vscode/ +**/.vscode/ +.zed/ +**/.zed/ +.idea/ +**/.idea/ +*.iml +*.ipr +*.iws + +# OS +.DS_Store +**/.DS_Store +Thumbs.db +ehthumbs.db + +# Logs / temp +*.log +*.tmp +*.temp diff --git a/benchmark/business_domain/standalone/spring/.mvn/wrapper/MavenWrapperDownloader.java b/benchmark/business_domain/standalone/spring/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000000000000000000000000000000000..b901097f2db6e50097dc0b222204a88f8cea1609 --- /dev/null +++ b/benchmark/business_domain/standalone/spring/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/benchmark/business_domain/standalone/spring/.mvn/wrapper/maven-wrapper.properties b/benchmark/business_domain/standalone/spring/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..43ad4f7bc95d51463a4cea4b6d84e6e069b98f1f --- /dev/null +++ b/benchmark/business_domain/standalone/spring/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/benchmark/business_domain/standalone/spring/Dockerfile b/benchmark/business_domain/standalone/spring/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..1e5c9660ba86fdee01192feca7895ddda92c99e3 --- /dev/null +++ b/benchmark/business_domain/standalone/spring/Dockerfile @@ -0,0 +1,34 @@ +FROM maven:3.9.12-ibm-semeru-21-noble + +USER root +# install uv +RUN apt-get update && apt-get install -y --no-install-recommends curl python3-venv python3-full \ + && curl -LsSf https://astral.sh/uv/install.sh | sh + +ENV PATH="/root/.local/bin:$PATH" + +# Shared browsers path so Chromium is cached once +ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright +RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright + +# create venv and install +RUN uv venv /opt/venv \ + && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest + +ENV PATH="/opt/venv/bin:$PATH" +RUN playwright install --with-deps chromium + +WORKDIR /app + +# Cache Maven dependencies separately from source +COPY pom.xml . +RUN mvn dependency:go-offline -q + +# Build application +COPY src ./src +RUN mvn package -DskipTests -q + +COPY test.sh . +RUN chmod +x test.sh + +CMD ["sh", "-c", "java -jar target/*.jar"] diff --git a/benchmark/business_domain/standalone/spring/mvnw b/benchmark/business_domain/standalone/spring/mvnw new file mode 100644 index 0000000000000000000000000000000000000000..bd8896bf2217b46faa0291585e01ac1a3441a958 --- /dev/null +++ b/benchmark/business_domain/standalone/spring/mvnw @@ -0,0 +1,295 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.4 +# +# Optional ENV vars +# ----------------- +# JAVA_HOME - location of a JDK home dir, required when download maven via java source +# MVNW_REPOURL - repo url base for downloading maven distribution +# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output +# ---------------------------------------------------------------------------- + +set -euf +[ "${MVNW_VERBOSE-}" != debug ] || set -x + +# OS specific support. +native_path() { printf %s\\n "$1"; } +case "$(uname)" in +CYGWIN* | MINGW*) + [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" + native_path() { cygpath --path --windows "$1"; } + ;; +esac + +# set JAVACMD and JAVACCMD +set_java_home() { + # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched + if [ -n "${JAVA_HOME-}" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACCMD="$JAVA_HOME/jre/sh/javac" + else + JAVACMD="$JAVA_HOME/bin/java" + JAVACCMD="$JAVA_HOME/bin/javac" + + if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then + echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 + echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 + return 1 + fi + fi + else + JAVACMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v java + )" || : + JAVACCMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v javac + )" || : + + if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then + echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 + return 1 + fi + fi +} + +# hash string like Java String::hashCode +hash_string() { + str="${1:-}" h=0 + while [ -n "$str" ]; do + char="${str%"${str#?}"}" + h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) + str="${str#?}" + done + printf %x\\n $h +} + +verbose() { :; } +[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } + +die() { + printf %s\\n "$1" >&2 + exit 1 +} + +trim() { + # MWRAPPER-139: + # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. + # Needed for removing poorly interpreted newline sequences when running in more + # exotic environments such as mingw bash on Windows. + printf "%s" "${1}" | tr -d '[:space:]' +} + +scriptDir="$(dirname "$0")" +scriptName="$(basename "$0")" + +# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties +while IFS="=" read -r key value; do + case "${key-}" in + distributionUrl) distributionUrl=$(trim "${value-}") ;; + distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; + esac +done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" + +case "${distributionUrl##*/}" in +maven-mvnd-*bin.*) + MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ + case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in + *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; + :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; + :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; + :Linux*x86_64*) distributionPlatform=linux-amd64 ;; + *) + echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 + distributionPlatform=linux-amd64 + ;; + esac + distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" + ;; +maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; +*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; +esac + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" +distributionUrlName="${distributionUrl##*/}" +distributionUrlNameMain="${distributionUrlName%.*}" +distributionUrlNameMain="${distributionUrlNameMain%-bin}" +MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" +MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" + +exec_maven() { + unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : + exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" +} + +if [ -d "$MAVEN_HOME" ]; then + verbose "found existing MAVEN_HOME at $MAVEN_HOME" + exec_maven "$@" +fi + +case "${distributionUrl-}" in +*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; +*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; +esac + +# prepare tmp dir +if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then + clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } + trap clean HUP INT TERM EXIT +else + die "cannot create temp dir" +fi + +mkdir -p -- "${MAVEN_HOME%/*}" + +# Download and Install Apache Maven +verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +verbose "Downloading from: $distributionUrl" +verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +# select .zip or .tar.gz +if ! command -v unzip >/dev/null; then + distributionUrl="${distributionUrl%.zip}.tar.gz" + distributionUrlName="${distributionUrl##*/}" +fi + +# verbose opt +__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' +[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v + +# normalize http auth +case "${MVNW_PASSWORD:+has-password}" in +'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; +has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; +esac + +if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then + verbose "Found wget ... using wget" + wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" +elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then + verbose "Found curl ... using curl" + curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" +elif set_java_home; then + verbose "Falling back to use Java to download" + javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" + targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" + cat >"$javaSource" <<-END + public class Downloader extends java.net.Authenticator + { + protected java.net.PasswordAuthentication getPasswordAuthentication() + { + return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); + } + public static void main( String[] args ) throws Exception + { + setDefault( new Downloader() ); + java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); + } + } + END + # For Cygwin/MinGW, switch paths to Windows format before running javac and java + verbose " - Compiling Downloader.java ..." + "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" + verbose " - Running Downloader.java ..." + "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" +fi + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +if [ -n "${distributionSha256Sum-}" ]; then + distributionSha256Result=false + if [ "$MVN_CMD" = mvnd.sh ]; then + echo "Checksum validation is not supported for maven-mvnd." >&2 + echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + elif command -v sha256sum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then + distributionSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $distributionSha256Result = false ]; then + echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 + echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 + exit 1 + fi +fi + +# unzip and move +if command -v unzip >/dev/null; then + unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" +else + tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" +fi + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +actualDistributionDir="" + +# First try the expected directory name (for regular distributions) +if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then + if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then + actualDistributionDir="$distributionUrlNameMain" + fi +fi + +# If not found, search for any directory with the Maven executable (for snapshots) +if [ -z "$actualDistributionDir" ]; then + # enable globbing to iterate over items + set +f + for dir in "$TMP_DOWNLOAD_DIR"/*; do + if [ -d "$dir" ]; then + if [ -f "$dir/bin/$MVN_CMD" ]; then + actualDistributionDir="$(basename "$dir")" + break + fi + fi + done + set -f +fi + +if [ -z "$actualDistributionDir" ]; then + verbose "Contents of $TMP_DOWNLOAD_DIR:" + verbose "$(ls -la "$TMP_DOWNLOAD_DIR")" + die "Could not find Maven distribution directory in extracted archive" +fi + +verbose "Found extracted Maven distribution directory: $actualDistributionDir" +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" + +clean || : +exec_maven "$@" diff --git a/benchmark/business_domain/standalone/spring/mvnw.cmd b/benchmark/business_domain/standalone/spring/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..5761d948924c19571d27b465c519b2e2f9e30351 --- /dev/null +++ b/benchmark/business_domain/standalone/spring/mvnw.cmd @@ -0,0 +1,189 @@ +<# : batch portion +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.4 +@REM +@REM Optional ENV vars +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output +@REM ---------------------------------------------------------------------------- + +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) +) +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> + +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} + +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} + +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' + +$MAVEN_M2_PATH = "$HOME/.m2" +if ($env:MAVEN_USER_HOME) { + $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME" +} + +if (-not (Test-Path -Path $MAVEN_M2_PATH)) { + New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null +} + +$MAVEN_WRAPPER_DISTS = $null +if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) { + $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists" +} else { + $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists" +} + +$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain" +$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" + +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} + +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} + +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} + +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null + +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +$actualDistributionDir = "" + +# First try the expected directory name (for regular distributions) +$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain" +$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD" +if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) { + $actualDistributionDir = $distributionUrlNameMain +} + +# If not found, search for any directory with the Maven executable (for snapshots) +if (!$actualDistributionDir) { + Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object { + $testPath = Join-Path $_.FullName "bin/$MVN_CMD" + if (Test-Path -Path $testPath -PathType Leaf) { + $actualDistributionDir = $_.Name + } + } +} + +if (!$actualDistributionDir) { + Write-Error "Could not find Maven distribution directory in extracted archive" +} + +Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir" +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/benchmark/business_domain/standalone/spring/pom.xml b/benchmark/business_domain/standalone/spring/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..d9b108dc10a1f840034cc8c1639032aa554cc140 --- /dev/null +++ b/benchmark/business_domain/standalone/spring/pom.xml @@ -0,0 +1,65 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.4.2 + + + spring.examples.tutorial + standalone + 0.0.1-SNAPSHOT + standalone + Demo project for Spring Boot + + + + + + + + + + + + + + + 17 + 17 + 17 + UTF-8 + + + + org.springframework.boot + spring-boot-starter + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/benchmark/business_domain/standalone/spring/src/main/java/spring/examples/tutorial/standalone/StandaloneApplication.java b/benchmark/business_domain/standalone/spring/src/main/java/spring/examples/tutorial/standalone/StandaloneApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..ab8c606d4b14bee18736206abf2853c50c3d641c --- /dev/null +++ b/benchmark/business_domain/standalone/spring/src/main/java/spring/examples/tutorial/standalone/StandaloneApplication.java @@ -0,0 +1,13 @@ +package spring.examples.tutorial.standalone; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class StandaloneApplication { + + public static void main(String[] args) { + SpringApplication.run(StandaloneApplication.class, args); + } + +} diff --git a/benchmark/business_domain/standalone/spring/src/main/java/spring/examples/tutorial/standalone/controller/GreetController.java b/benchmark/business_domain/standalone/spring/src/main/java/spring/examples/tutorial/standalone/controller/GreetController.java new file mode 100644 index 0000000000000000000000000000000000000000..4670fce58e6f1239335191ae75c1519a7da098f6 --- /dev/null +++ b/benchmark/business_domain/standalone/spring/src/main/java/spring/examples/tutorial/standalone/controller/GreetController.java @@ -0,0 +1,22 @@ +package spring.examples.tutorial.standalone.controller; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import spring.examples.tutorial.standalone.service.StandaloneService; + +@RestController +public class GreetController { + + @Autowired + private StandaloneService standaloneService; + + record GreetResponse(String message) { + } + + @GetMapping("/greet") + public ResponseEntity greet() { + return ResponseEntity.ok(new GreetResponse(standaloneService.returnMessage())); + } +} diff --git a/benchmark/business_domain/standalone/spring/src/main/java/spring/examples/tutorial/standalone/service/StandaloneService.java b/benchmark/business_domain/standalone/spring/src/main/java/spring/examples/tutorial/standalone/service/StandaloneService.java new file mode 100644 index 0000000000000000000000000000000000000000..f00113f8e4995f2ae0314529b12536dd2ed9d7b2 --- /dev/null +++ b/benchmark/business_domain/standalone/spring/src/main/java/spring/examples/tutorial/standalone/service/StandaloneService.java @@ -0,0 +1,14 @@ +package spring.examples.tutorial.standalone.service; + +import org.springframework.stereotype.Service; + +@Service +public class StandaloneService { + + private static final String message = "Greetings!"; + + public String returnMessage() { + return message; + } + +} diff --git a/benchmark/business_domain/standalone/spring/src/main/resources/application.properties b/benchmark/business_domain/standalone/spring/src/main/resources/application.properties new file mode 100644 index 0000000000000000000000000000000000000000..216e453aaa310f1638005010885f16024cb1bc07 --- /dev/null +++ b/benchmark/business_domain/standalone/spring/src/main/resources/application.properties @@ -0,0 +1,3 @@ +spring.application.name=standalone + +server.servlet.contextPath=/standalone diff --git a/benchmark/business_domain/standalone/spring/src/test/java/spring/examples/tutorial/standalone/StandaloneApplicationTests.java b/benchmark/business_domain/standalone/spring/src/test/java/spring/examples/tutorial/standalone/StandaloneApplicationTests.java new file mode 100644 index 0000000000000000000000000000000000000000..90786547ed0eb6867923f04d3c6902475a4bb3aa --- /dev/null +++ b/benchmark/business_domain/standalone/spring/src/test/java/spring/examples/tutorial/standalone/StandaloneApplicationTests.java @@ -0,0 +1,29 @@ +package spring.examples.tutorial.standalone; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import java.util.logging.Logger; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import spring.examples.tutorial.standalone.service.StandaloneService; + +@SpringBootTest +class StandaloneApplicationTests { + + private static final Logger logger = Logger.getLogger("standalone.service"); + + @Autowired + private StandaloneService standaloneService; + + @Test + void contextLoads() {} + + @Test + public void testReturnMessage() throws Exception { + logger.info("Testing standalone.service.StandaloneService.returnMessage()"); + String expResult = "Greetings!"; + String result = standaloneService.returnMessage(); + assertEquals(expResult, result); + } + +} diff --git a/benchmark/business_domain/standalone/spring/test.sh b/benchmark/business_domain/standalone/spring/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..2f6a7a940e269497834310db734b759b8b44ae0a --- /dev/null +++ b/benchmark/business_domain/standalone/spring/test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +BASE_URL="${BASE_URL:-http://localhost:8080/standalone}" + +echo "Health check: ${BASE_URL}" +HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}") + +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "PASS - got HTTP ${HTTP_STATUS}" + exit 0 +else + echo "FAIL - got HTTP ${HTTP_STATUS}" + exit 1 +fi diff --git a/benchmark/persistence/address-book/jakarta/.dockerignore b/benchmark/persistence/address-book/jakarta/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..c634c57d9244b4e60b8fa936f09dbe4e75706e74 --- /dev/null +++ b/benchmark/persistence/address-book/jakarta/.dockerignore @@ -0,0 +1,41 @@ +# VCS +.git/ + +# Maven +.mvn/ +**/.mvn/ +mvnw +mvnw.cmd +**/mvnw +**/mvnw.cmd +target/ +**/target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties + +# IDE / Editor +.vscode/ +**/.vscode/ +.zed/ +**/.zed/ +.idea/ +**/.idea/ +*.iml +*.ipr +*.iws + +# OS +.DS_Store +**/.DS_Store +Thumbs.db +ehthumbs.db + +# Logs / temp +*.log +*.tmp +*.temp diff --git a/benchmark/persistence/address-book/jakarta/.mvn/wrapper/maven-wrapper.properties b/benchmark/persistence/address-book/jakarta/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..8dea6c227c08000d2400d38a2ac886063f22bc36 --- /dev/null +++ b/benchmark/persistence/address-book/jakarta/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,3 @@ +wrapperVersion=3.3.4 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.12/apache-maven-3.9.12-bin.zip diff --git a/benchmark/persistence/address-book/jakarta/Dockerfile b/benchmark/persistence/address-book/jakarta/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..bb9aafb1cb951a1ab54c776a26843385260532e8 --- /dev/null +++ b/benchmark/persistence/address-book/jakarta/Dockerfile @@ -0,0 +1,28 @@ +FROM maven:3.9.12-ibm-semeru-21-noble + +USER root +# install uv +RUN apt-get update && apt-get install -y --no-install-recommends curl python3-venv python3-full && curl -LsSf https://astral.sh/uv/install.sh | sh + +ENV PATH="/root/.local/bin:$PATH" + +# Shared browsers path so Chromium is cached once +ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright +RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright + +# create venv and install +RUN uv venv /opt/venv && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest + +ENV PATH="/opt/venv/bin:$PATH" +RUN playwright install --with-deps chromium + +# Set working directory +WORKDIR /app + +# Copy all the assets +COPY . . + +COPY test.sh . +RUN chmod +x test.sh +RUN mvn clean install -DskipTests +CMD [ "mvn", "liberty:run" ] diff --git a/benchmark/persistence/address-book/jakarta/README.md b/benchmark/persistence/address-book/jakarta/README.md new file mode 100644 index 0000000000000000000000000000000000000000..2a122c6fb1db4c01a9c285973ba63347f78ad9ea --- /dev/null +++ b/benchmark/persistence/address-book/jakarta/README.md @@ -0,0 +1,12 @@ +To test this app, + +```bash +pip install playwright +playwright install --with-deps chromium +``` + +Then run: + +```bash +./smoke.py +``` \ No newline at end of file diff --git a/benchmark/persistence/address-book/jakarta/mvnw b/benchmark/persistence/address-book/jakarta/mvnw new file mode 100644 index 0000000000000000000000000000000000000000..bd8896bf2217b46faa0291585e01ac1a3441a958 --- /dev/null +++ b/benchmark/persistence/address-book/jakarta/mvnw @@ -0,0 +1,295 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.4 +# +# Optional ENV vars +# ----------------- +# JAVA_HOME - location of a JDK home dir, required when download maven via java source +# MVNW_REPOURL - repo url base for downloading maven distribution +# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output +# ---------------------------------------------------------------------------- + +set -euf +[ "${MVNW_VERBOSE-}" != debug ] || set -x + +# OS specific support. +native_path() { printf %s\\n "$1"; } +case "$(uname)" in +CYGWIN* | MINGW*) + [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" + native_path() { cygpath --path --windows "$1"; } + ;; +esac + +# set JAVACMD and JAVACCMD +set_java_home() { + # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched + if [ -n "${JAVA_HOME-}" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACCMD="$JAVA_HOME/jre/sh/javac" + else + JAVACMD="$JAVA_HOME/bin/java" + JAVACCMD="$JAVA_HOME/bin/javac" + + if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then + echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 + echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 + return 1 + fi + fi + else + JAVACMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v java + )" || : + JAVACCMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v javac + )" || : + + if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then + echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 + return 1 + fi + fi +} + +# hash string like Java String::hashCode +hash_string() { + str="${1:-}" h=0 + while [ -n "$str" ]; do + char="${str%"${str#?}"}" + h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) + str="${str#?}" + done + printf %x\\n $h +} + +verbose() { :; } +[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } + +die() { + printf %s\\n "$1" >&2 + exit 1 +} + +trim() { + # MWRAPPER-139: + # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. + # Needed for removing poorly interpreted newline sequences when running in more + # exotic environments such as mingw bash on Windows. + printf "%s" "${1}" | tr -d '[:space:]' +} + +scriptDir="$(dirname "$0")" +scriptName="$(basename "$0")" + +# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties +while IFS="=" read -r key value; do + case "${key-}" in + distributionUrl) distributionUrl=$(trim "${value-}") ;; + distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; + esac +done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" + +case "${distributionUrl##*/}" in +maven-mvnd-*bin.*) + MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ + case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in + *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; + :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; + :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; + :Linux*x86_64*) distributionPlatform=linux-amd64 ;; + *) + echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 + distributionPlatform=linux-amd64 + ;; + esac + distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" + ;; +maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; +*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; +esac + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" +distributionUrlName="${distributionUrl##*/}" +distributionUrlNameMain="${distributionUrlName%.*}" +distributionUrlNameMain="${distributionUrlNameMain%-bin}" +MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" +MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" + +exec_maven() { + unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : + exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" +} + +if [ -d "$MAVEN_HOME" ]; then + verbose "found existing MAVEN_HOME at $MAVEN_HOME" + exec_maven "$@" +fi + +case "${distributionUrl-}" in +*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; +*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; +esac + +# prepare tmp dir +if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then + clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } + trap clean HUP INT TERM EXIT +else + die "cannot create temp dir" +fi + +mkdir -p -- "${MAVEN_HOME%/*}" + +# Download and Install Apache Maven +verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +verbose "Downloading from: $distributionUrl" +verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +# select .zip or .tar.gz +if ! command -v unzip >/dev/null; then + distributionUrl="${distributionUrl%.zip}.tar.gz" + distributionUrlName="${distributionUrl##*/}" +fi + +# verbose opt +__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' +[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v + +# normalize http auth +case "${MVNW_PASSWORD:+has-password}" in +'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; +has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; +esac + +if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then + verbose "Found wget ... using wget" + wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" +elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then + verbose "Found curl ... using curl" + curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" +elif set_java_home; then + verbose "Falling back to use Java to download" + javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" + targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" + cat >"$javaSource" <<-END + public class Downloader extends java.net.Authenticator + { + protected java.net.PasswordAuthentication getPasswordAuthentication() + { + return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); + } + public static void main( String[] args ) throws Exception + { + setDefault( new Downloader() ); + java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); + } + } + END + # For Cygwin/MinGW, switch paths to Windows format before running javac and java + verbose " - Compiling Downloader.java ..." + "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" + verbose " - Running Downloader.java ..." + "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" +fi + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +if [ -n "${distributionSha256Sum-}" ]; then + distributionSha256Result=false + if [ "$MVN_CMD" = mvnd.sh ]; then + echo "Checksum validation is not supported for maven-mvnd." >&2 + echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + elif command -v sha256sum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then + distributionSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $distributionSha256Result = false ]; then + echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 + echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 + exit 1 + fi +fi + +# unzip and move +if command -v unzip >/dev/null; then + unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" +else + tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" +fi + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +actualDistributionDir="" + +# First try the expected directory name (for regular distributions) +if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then + if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then + actualDistributionDir="$distributionUrlNameMain" + fi +fi + +# If not found, search for any directory with the Maven executable (for snapshots) +if [ -z "$actualDistributionDir" ]; then + # enable globbing to iterate over items + set +f + for dir in "$TMP_DOWNLOAD_DIR"/*; do + if [ -d "$dir" ]; then + if [ -f "$dir/bin/$MVN_CMD" ]; then + actualDistributionDir="$(basename "$dir")" + break + fi + fi + done + set -f +fi + +if [ -z "$actualDistributionDir" ]; then + verbose "Contents of $TMP_DOWNLOAD_DIR:" + verbose "$(ls -la "$TMP_DOWNLOAD_DIR")" + die "Could not find Maven distribution directory in extracted archive" +fi + +verbose "Found extracted Maven distribution directory: $actualDistributionDir" +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" + +clean || : +exec_maven "$@" diff --git a/benchmark/persistence/address-book/jakarta/mvnw.cmd b/benchmark/persistence/address-book/jakarta/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..5761d948924c19571d27b465c519b2e2f9e30351 --- /dev/null +++ b/benchmark/persistence/address-book/jakarta/mvnw.cmd @@ -0,0 +1,189 @@ +<# : batch portion +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.4 +@REM +@REM Optional ENV vars +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output +@REM ---------------------------------------------------------------------------- + +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) +) +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> + +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} + +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} + +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' + +$MAVEN_M2_PATH = "$HOME/.m2" +if ($env:MAVEN_USER_HOME) { + $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME" +} + +if (-not (Test-Path -Path $MAVEN_M2_PATH)) { + New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null +} + +$MAVEN_WRAPPER_DISTS = $null +if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) { + $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists" +} else { + $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists" +} + +$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain" +$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" + +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} + +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} + +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} + +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null + +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +$actualDistributionDir = "" + +# First try the expected directory name (for regular distributions) +$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain" +$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD" +if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) { + $actualDistributionDir = $distributionUrlNameMain +} + +# If not found, search for any directory with the Maven executable (for snapshots) +if (!$actualDistributionDir) { + Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object { + $testPath = Join-Path $_.FullName "bin/$MVN_CMD" + if (Test-Path -Path $testPath -PathType Leaf) { + $actualDistributionDir = $_.Name + } + } +} + +if (!$actualDistributionDir) { + Write-Error "Could not find Maven distribution directory in extracted archive" +} + +Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir" +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/benchmark/persistence/address-book/jakarta/pom.xml b/benchmark/persistence/address-book/jakarta/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..368e48ce7c9860175f4520ca0e59a3828c18ac3e --- /dev/null +++ b/benchmark/persistence/address-book/jakarta/pom.xml @@ -0,0 +1,78 @@ + + + 4.0.0 + + + jakarta.examples.tutorial.persistence + address-book + 10-SNAPSHOT + war + + Jakarta EE Address Book Example + + + 17 + 17 + UTF-8 + 24.0.0.12 + + + + + + io.openliberty.features + features-bom + ${liberty.version} + pom + import + + + + + + + jakarta.platform + jakarta.jakartaee-web-api + 10.0.0 + provided + + + + com.h2database + h2 + 2.3.232 + + + + + + + org.apache.maven.plugins + maven-war-plugin + 3.4.0 + + false + + + + + io.openliberty.tools + liberty-maven-plugin + 3.11.1 + + + + ${project.build.directory}/liberty/wlp/usr/shared/resources + + com.h2database + h2 + + + + + + + + diff --git a/benchmark/persistence/address-book/jakarta/src/main/java/jakarta/tutorial/addressbook/ejb/AbstractFacade.java b/benchmark/persistence/address-book/jakarta/src/main/java/jakarta/tutorial/addressbook/ejb/AbstractFacade.java new file mode 100644 index 0000000000000000000000000000000000000000..7effcedc60aeb1fa5ed67db67f4377ce90eb71e6 --- /dev/null +++ b/benchmark/persistence/address-book/jakarta/src/main/java/jakarta/tutorial/addressbook/ejb/AbstractFacade.java @@ -0,0 +1,73 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.addressbook.ejb; + +import java.util.List; + +import jakarta.persistence.EntityManager; +import jakarta.persistence.Query; +import jakarta.persistence.criteria.CriteriaQuery; +import jakarta.persistence.criteria.Root; + +/** + * + * @author ian + */ +public abstract class AbstractFacade { + private Class entityClass; + + public AbstractFacade(Class entityClass) { + this.entityClass = entityClass; + } + + protected abstract EntityManager getEntityManager(); + + public void create(T entity) { + getEntityManager().persist(entity); + } + + public void edit(T entity) { + getEntityManager().merge(entity); + } + + public void remove(T entity) { + getEntityManager().remove(getEntityManager().merge(entity)); + } + + public T find(Object id) { + return getEntityManager().find(entityClass, id); + } + + public List findAll() { + CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery(); + cq.select(cq.from(entityClass)); + return getEntityManager().createQuery(cq).getResultList(); + } + + public List findRange(int[] range) { + CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery(); + cq.select(cq.from(entityClass)); + Query q = getEntityManager().createQuery(cq); + q.setMaxResults(range[1] - range[0]); + q.setFirstResult(range[0]); + return q.getResultList(); + } + + public int count() { + CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery(); + Root rt = cq.from(entityClass); + cq.select(getEntityManager().getCriteriaBuilder().count(rt)); + Query q = getEntityManager().createQuery(cq); + return ((Long) q.getSingleResult()).intValue(); + } + +} diff --git a/benchmark/persistence/address-book/jakarta/src/main/java/jakarta/tutorial/addressbook/ejb/ContactFacade.java b/benchmark/persistence/address-book/jakarta/src/main/java/jakarta/tutorial/addressbook/ejb/ContactFacade.java new file mode 100644 index 0000000000000000000000000000000000000000..15ac33c9957c89ded20cb82e9e023556b44c1644 --- /dev/null +++ b/benchmark/persistence/address-book/jakarta/src/main/java/jakarta/tutorial/addressbook/ejb/ContactFacade.java @@ -0,0 +1,37 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.addressbook.ejb; + +import jakarta.ejb.Stateless; +import jakarta.persistence.EntityManager; +import jakarta.persistence.PersistenceContext; +import jakarta.tutorial.addressbook.entity.Contact; + +/** + * + * @author ian + */ +@Stateless +public class ContactFacade extends AbstractFacade { + @PersistenceContext(unitName = "address-bookPU") + private EntityManager em; + + @Override + protected EntityManager getEntityManager() { + return em; + } + + public ContactFacade() { + super(Contact.class); + } + +} diff --git a/benchmark/persistence/address-book/jakarta/src/main/java/jakarta/tutorial/addressbook/entity/Contact.java b/benchmark/persistence/address-book/jakarta/src/main/java/jakarta/tutorial/addressbook/entity/Contact.java new file mode 100644 index 0000000000000000000000000000000000000000..2470a16cf7e854942dc6355513be76ac2b600410 --- /dev/null +++ b/benchmark/persistence/address-book/jakarta/src/main/java/jakarta/tutorial/addressbook/entity/Contact.java @@ -0,0 +1,199 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.addressbook.entity; + +import java.io.Serializable; +import java.util.Date; + +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Temporal; +import jakarta.persistence.TemporalType; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Past; +import jakarta.validation.constraints.Pattern; + +/** + * + * @author ian + */ +@Entity +public class Contact implements Serializable { + + private static final long serialVersionUID = -825634229676522580L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + @NotNull + protected String firstName; + @NotNull + protected String lastName; + @Pattern(regexp = "[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\." + + "[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@" + + "(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9]" + + "(?:[a-z0-9-]*[a-z0-9])?", + message = "{invalid.email}") + protected String email; + @Pattern(regexp = "^\\(?(\\d{3})\\)?[- ]?(\\d{3})[- ]?(\\d{4})$", + message = "{invalid.phonenumber}") + protected String mobilePhone; + @Pattern(regexp = "^\\(?(\\d{3})\\)?[- ]?(\\d{3})[- ]?(\\d{4})$", + message = "{invalid.phonenumber}") + protected String homePhone; + @Temporal(TemporalType.DATE) + @Past + protected Date birthday; + + /** + * Get the value of birthday + * + * @return the value of birthday + */ + public Date getBirthday() { + return birthday; + } + + /** + * Set the value of birthday + * + * @param birthday new value of birthday + */ + public void setBirthday(Date birthday) { + this.birthday = birthday; + } + + /** + * Get the value of homePhone + * + * @return the value of homePhone + */ + public String getHomePhone() { + return homePhone; + } + + /** + * Set the value of homePhone + * + * @param homePhone new value of homePhone + */ + public void setHomePhone(String homePhone) { + this.homePhone = homePhone; + } + + /** + * Get the value of mobilePhone + * + * @return the value of mobilePhone + */ + public String getMobilePhone() { + return mobilePhone; + } + + /** + * Set the value of mobilePhone + * + * @param mobilePhone new value of mobilePhone + */ + public void setMobilePhone(String mobilePhone) { + this.mobilePhone = mobilePhone; + } + + /** + * Get the value of email + * + * @return the value of email + */ + public String getEmail() { + return email; + } + + /** + * Set the value of email + * + * @param email new value of email + */ + public void setEmail(String email) { + this.email = email; + } + + /** + * Get the value of lastName + * + * @return the value of lastName + */ + public String getLastName() { + return lastName; + } + + /** + * Set the value of lastName + * + * @param lastName new value of lastName + */ + public void setLastName(String lastName) { + this.lastName = lastName; + } + + /** + * Get the value of firstName + * + * @return the value of firstName + */ + public String getFirstName() { + return firstName; + } + + /** + * Set the value of firstName + * + * @param firstName new value of firstName + */ + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (id != null ? id.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Contact)) { + return false; + } + Contact other = (Contact) object; + if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "addressbook.entity.Contact[id=" + id + "]"; + } + +} diff --git a/benchmark/persistence/address-book/jakarta/src/main/java/jakarta/tutorial/addressbook/web/ContactController.java b/benchmark/persistence/address-book/jakarta/src/main/java/jakarta/tutorial/addressbook/web/ContactController.java new file mode 100644 index 0000000000000000000000000000000000000000..b498bec94b5d68bbe00cebd0a3485fd0b75f3d86 --- /dev/null +++ b/benchmark/persistence/address-book/jakarta/src/main/java/jakarta/tutorial/addressbook/web/ContactController.java @@ -0,0 +1,241 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.addressbook.web; + +import java.io.Serializable; +import java.util.ResourceBundle; + +import jakarta.ejb.EJB; +import jakarta.enterprise.context.SessionScoped; +import jakarta.faces.component.UIComponent; +import jakarta.faces.context.FacesContext; +import jakarta.faces.convert.Converter; +import jakarta.faces.convert.FacesConverter; +import jakarta.faces.model.DataModel; +import jakarta.faces.model.ListDataModel; +import jakarta.faces.model.SelectItem; +import jakarta.inject.Named; +import jakarta.tutorial.addressbook.ejb.ContactFacade; +import jakarta.tutorial.addressbook.entity.Contact; +import jakarta.tutorial.addressbook.web.util.JsfUtil; +import jakarta.tutorial.addressbook.web.util.PaginationHelper; + +@Named +@SessionScoped +public class ContactController implements Serializable { + private static final long serialVersionUID = -8163374738411860012L; + private Contact current; + private DataModel items = null; + @EJB private ContactFacade ejbFacade; + private PaginationHelper pagination; + private int selectedItemIndex; + + public ContactController() { + } + + public Contact getSelected() { + if (current == null) { + current = new Contact(); + selectedItemIndex = -1; + } + return current; + } + + private ContactFacade getFacade() { + return ejbFacade; + } + + public PaginationHelper getPagination() { + if (pagination == null) { + pagination = new PaginationHelper(10) { + + @Override + public int getItemsCount() { + return getFacade().count(); + } + + @Override + public DataModel createPageDataModel() { + return new ListDataModel(getFacade().findRange(new int[]{getPageFirstItem(), getPageFirstItem()+getPageSize()})); + } + }; + } + return pagination; + } + + public String prepareList() { + recreateModel(); + return "List"; + } + + public String prepareView() { + current = (Contact)getItems().getRowData(); + selectedItemIndex = pagination.getPageFirstItem() + getItems().getRowIndex(); + return "View"; + } + + public String prepareCreate() { + current = new Contact(); + selectedItemIndex = -1; + return "Create"; + } + + public String create() { + try { + getFacade().create(current); + JsfUtil.addSuccessMessage(ResourceBundle.getBundle("/Bundle").getString("ContactCreated")); + return prepareCreate(); + } catch (Exception e) { + JsfUtil.addErrorMessage(e, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured")); + return null; + } + } + + public String prepareEdit() { + current = (Contact)getItems().getRowData(); + selectedItemIndex = pagination.getPageFirstItem() + getItems().getRowIndex(); + return "Edit"; + } + + public String update() { + try { + getFacade().edit(current); + JsfUtil.addSuccessMessage(ResourceBundle.getBundle("/Bundle").getString("ContactUpdated")); + return "View"; + } catch (Exception e) { + JsfUtil.addErrorMessage(e, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured")); + return null; + } + } + + public String destroy() { + current = (Contact)getItems().getRowData(); + selectedItemIndex = pagination.getPageFirstItem() + getItems().getRowIndex(); + performDestroy(); + recreateModel(); + return "List"; + } + + public String destroyAndView() { + performDestroy(); + recreateModel(); + updateCurrentItem(); + if (selectedItemIndex >= 0) { + return "View"; + } else { + // all items were removed - go back to list + recreateModel(); + return "List"; + } + } + + private void performDestroy() { + try { + getFacade().remove(current); + JsfUtil.addSuccessMessage(ResourceBundle.getBundle("/Bundle").getString("ContactDeleted")); + } catch (Exception e) { + JsfUtil.addErrorMessage(e, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured")); + } + } + + private void updateCurrentItem() { + int count = getFacade().count(); + if (selectedItemIndex >= count) { + // selected index cannot be bigger than number of items: + selectedItemIndex = count-1; + // go to previous page if last page disappeared: + if (pagination.getPageFirstItem() >= count) { + pagination.previousPage(); + } + } + if (selectedItemIndex >= 0) { + current = getFacade().findRange(new int[]{selectedItemIndex, selectedItemIndex+1}).get(0); + } + } + + public DataModel getItems() { + if (items == null) { + items = getPagination().createPageDataModel(); + } + return items; + } + + private void recreateModel() { + items = null; + } + + public String next() { + getPagination().nextPage(); + recreateModel(); + return "List"; + } + + public String previous() { + getPagination().previousPage(); + recreateModel(); + return "List"; + } + + public SelectItem[] getItemsAvailableSelectMany() { + return JsfUtil.getSelectItems(ejbFacade.findAll(), false); + } + + public SelectItem[] getItemsAvailableSelectOne() { + return JsfUtil.getSelectItems(ejbFacade.findAll(), true); + } + + @FacesConverter(forClass=Contact.class) + public static class ContactControllerConverter implements Converter { + + @Override + public Contact getAsObject(FacesContext facesContext, UIComponent component, String value) { + if (value == null || value.length() == 0) { + return null; + } + ContactController controller = (ContactController)facesContext.getApplication().getELResolver(). + getValue(facesContext.getELContext(), null, "contactController"); + return controller.ejbFacade.find(getKey(value)); + } + + java.lang.Long getKey(String value) { + java.lang.Long key; + key = Long.valueOf(value); + return key; + } + + String getStringKey(java.lang.Long value) { + StringBuilder sb = new StringBuilder(); + sb.append(value); + return sb.toString(); + } + + @Override + public String getAsString(FacesContext facesContext, UIComponent component, Contact object) { + if (object == null) { + return null; + } + if (object instanceof Contact) { + Contact o = (Contact) object; + return getStringKey(o.getId()); + } else { + throw new IllegalArgumentException("object " + + object + + " is of type " + + object.getClass().getName() + + "; expected type: " + + ContactController.class.getName()); + } + } + + } + +} diff --git a/benchmark/persistence/address-book/jakarta/src/main/java/jakarta/tutorial/addressbook/web/util/JsfUtil.java b/benchmark/persistence/address-book/jakarta/src/main/java/jakarta/tutorial/addressbook/web/util/JsfUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..3e88a852554c4880368140cfa3a509ff66c37af6 --- /dev/null +++ b/benchmark/persistence/address-book/jakarta/src/main/java/jakarta/tutorial/addressbook/web/util/JsfUtil.java @@ -0,0 +1,72 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.addressbook.web.util; + +import java.util.List; + +import jakarta.faces.application.FacesMessage; +import jakarta.faces.component.UIComponent; +import jakarta.faces.context.FacesContext; +import jakarta.faces.convert.Converter; +import jakarta.faces.model.SelectItem; + +public class JsfUtil { + + public static SelectItem[] getSelectItems(List entities, boolean selectOne) { + int size = selectOne ? entities.size() + 1 : entities.size(); + SelectItem[] items = new SelectItem[size]; + int i = 0; + if (selectOne) { + items[0] = new SelectItem("", "---"); + i++; + } + for (Object x : entities) { + items[i++] = new SelectItem(x, x.toString()); + } + return items; + } + + public static void addErrorMessage(Exception ex, String defaultMsg) { + String msg = ex.getLocalizedMessage(); + if (msg != null && msg.length() > 0) { + addErrorMessage(msg); + } else { + addErrorMessage(defaultMsg); + } + } + + public static void addErrorMessages(List messages) { + for (String message : messages) { + addErrorMessage(message); + } + } + + public static void addErrorMessage(String msg) { + FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg); + FacesContext.getCurrentInstance().addMessage(null, facesMsg); + } + + public static void addSuccessMessage(String msg) { + FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg); + FacesContext.getCurrentInstance().addMessage("successInfo", facesMsg); + } + + public static String getRequestParameter(String key) { + return FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get(key); + } + + public static Object getObjectFromRequestParameter(String requestParameterName, Converter converter, UIComponent component) { + String theId = JsfUtil.getRequestParameter(requestParameterName); + return converter.getAsObject(FacesContext.getCurrentInstance(), component, theId); + } + +} diff --git a/benchmark/persistence/address-book/jakarta/src/main/java/jakarta/tutorial/addressbook/web/util/PaginationHelper.java b/benchmark/persistence/address-book/jakarta/src/main/java/jakarta/tutorial/addressbook/web/util/PaginationHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..b56f99b3b8c0e3f919cbd7dff73086d3ccc9b6a2 --- /dev/null +++ b/benchmark/persistence/address-book/jakarta/src/main/java/jakarta/tutorial/addressbook/web/util/PaginationHelper.java @@ -0,0 +1,69 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.addressbook.web.util; + +import jakarta.faces.model.DataModel; + +public abstract class PaginationHelper { + + private int pageSize; + private int page; + + public PaginationHelper(int pageSize) { + this.pageSize = pageSize; + } + + public abstract int getItemsCount(); + + public abstract DataModel createPageDataModel(); + + public int getPageFirstItem() { + return page*pageSize; + } + + public int getPageLastItem() { + int i = getPageFirstItem() + pageSize -1; + int count = getItemsCount() - 1; + if (i > count) { + i = count; + } + if (i < 0) { + i = 0; + } + return i; + } + + public boolean isHasNextPage() { + return (page+1)*pageSize+1 <= getItemsCount(); + } + + public void nextPage() { + if (isHasNextPage()) { + page++; + } + } + + public boolean isHasPreviousPage() { + return page > 0; + } + + public void previousPage() { + if (isHasPreviousPage()) { + page--; + } + } + + public int getPageSize() { + return pageSize; + } + +} diff --git a/benchmark/persistence/address-book/jakarta/src/main/liberty/config/server.xml b/benchmark/persistence/address-book/jakarta/src/main/liberty/config/server.xml new file mode 100644 index 0000000000000000000000000000000000000000..e13f5dcd15ef9d81712cbe9b2a4ab2a7b03a1580 --- /dev/null +++ b/benchmark/persistence/address-book/jakarta/src/main/liberty/config/server.xml @@ -0,0 +1,23 @@ + + + + + jakartaee-10.0 + + + + + + + + + + + + + + + + + + diff --git a/benchmark/persistence/address-book/jakarta/src/main/resources/Bundle.properties b/benchmark/persistence/address-book/jakarta/src/main/resources/Bundle.properties new file mode 100644 index 0000000000000000000000000000000000000000..02e0ea911cd21469a5b9b4f712721158d9bd87de --- /dev/null +++ b/benchmark/persistence/address-book/jakarta/src/main/resources/Bundle.properties @@ -0,0 +1,92 @@ +# +# Copyright (c), Eclipse Foundation, Inc. and its licensors. +# +# All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Distribution License v1.0, which is available at +# https://www.eclipse.org/org/documents/edl-v10.php +# +# SPDX-License-Identifier: BSD-3-Clause +# + +PersistenceErrorOccured=A persistence error occurred. +Previous=Previous +Next=Next + +ContactCreated=Contact was successfully created. +ContactUpdated=Contact was successfully updated. +ContactDeleted=Contact was successfully deleted. +CreateContactTitle=Create New Contact +CreateContactSaveLink=Save +CreateContactShowAllLink=Show All Contact Items +CreateContactIndexLink=Index +CreateContactLabel_birthday=Birthday: +CreateContactTitle_birthday=Birthday +CreateContactLabel_homePhone=Home Phone: +CreateContactTitle_homePhone=Home Phone +CreateContactLabel_mobilePhone=Mobile Phone: +CreateContactTitle_mobilePhone=Mobile Phone +CreateContactLabel_email=Email: +CreateContactTitle_email=Email +CreateContactLabel_lastName=Last Name: +CreateContactTitle_lastName=Last Name +CreateContactLabel_firstName=First Name: +CreateContactTitle_firstName=First Name +CreateContactLabel_id=Id: +CreateContactTitle_id=Id +EditContactTitle=Edit Contact +EditContactSaveLink=Save +EditContactViewLink=View +EditContactShowAllLink=Show All Contact Items +EditContactIndexLink=Index +EditContactLabel_birthday=Birthday: +EditContactTitle_birthday=Birthday +EditContactLabel_homePhone=Home Phone: +EditContactTitle_homePhone=Home Phone +EditContactLabel_mobilePhone=Mobile Phone: +EditContactTitle_mobilePhone=Mobile Phone +EditContactLabel_email=Email: +EditContactTitle_email=Email +EditContactLabel_lastName=Last Name: +EditContactTitle_lastName=Last Name +EditContactLabel_firstName=First Name: +EditContactTitle_firstName=First Name +EditContactLabel_id=Id: +EditContactTitle_id=Id +ViewContactTitle=View +ViewContactDestroyLink=Destroy +ViewContactEditLink=Edit +ViewContactCreateLink=Create New Contact +ViewContactShowAllLink=Show All Contact Items +ViewContactIndexLink=Index +ViewContactLabel_birthday=Birthday: +ViewContactTitle_birthday=Birthday +ViewContactLabel_homePhone=Home Phone: +ViewContactTitle_homePhone=Home Phone +ViewContactLabel_mobilePhone=Mobile Phone: +ViewContactTitle_mobilePhone=Mobile Phone +ViewContactLabel_email=Email: +ViewContactTitle_email=Email +ViewContactLabel_lastName=Last Name: +ViewContactTitle_lastName=Last Name +ViewContactLabel_firstName=First Name: +ViewContactTitle_firstName=First Name +ViewContactLabel_id=Id: +ViewContactTitle_id=Id +ListContactTitle=List +ListContactEmpty=(No Contact Items Found) +ListContactDestroyLink=Destroy +ListContactEditLink=Edit +ListContactViewLink=View +ListContactCreateLink=Create New Contact +ListContactIndexLink=Index +ListContactTitle_birthday=Birthday +ListContactTitle_homePhone=Home Phone +ListContactTitle_mobilePhone=Mobile Phone +ListContactTitle_email=Email +ListContactTitle_lastName=Last Name +ListContactTitle_firstName=First Name +ListContactTitle_id=Id + + diff --git a/benchmark/persistence/address-book/jakarta/src/main/resources/META-INF/persistence.xml b/benchmark/persistence/address-book/jakarta/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000000000000000000000000000000000000..dfe8a9b556da8362068ca90bef6a54823debb66b --- /dev/null +++ b/benchmark/persistence/address-book/jakarta/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,23 @@ + + + + + jdbc/DefaultDataSource + false + + + + + diff --git a/benchmark/persistence/address-book/jakarta/src/main/resources/ValidationMessages.properties b/benchmark/persistence/address-book/jakarta/src/main/resources/ValidationMessages.properties new file mode 100644 index 0000000000000000000000000000000000000000..c4eb065f57e93900b2eeae7c5ff2b4cd88d2749a --- /dev/null +++ b/benchmark/persistence/address-book/jakarta/src/main/resources/ValidationMessages.properties @@ -0,0 +1,15 @@ +# +# Copyright (c), Eclipse Foundation, Inc. and its licensors. +# +# All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Distribution License v1.0, which is available at +# https://www.eclipse.org/org/documents/edl-v10.php +# +# SPDX-License-Identifier: BSD-3-Clause +# + +# Validation message string for the JavaBeans Validation API +invalid.email=Not a valid email address. +invalid.phonenumber=Not a valid phone number. diff --git a/benchmark/persistence/address-book/jakarta/src/main/webapp/WEB-INF/faces-config.xml b/benchmark/persistence/address-book/jakarta/src/main/webapp/WEB-INF/faces-config.xml new file mode 100644 index 0000000000000000000000000000000000000000..3f31a7897ebe3d64226d6966ddc08cda6dbe4f06 --- /dev/null +++ b/benchmark/persistence/address-book/jakarta/src/main/webapp/WEB-INF/faces-config.xml @@ -0,0 +1,27 @@ + + + + + + + + /Bundle + bundle + + + diff --git a/benchmark/persistence/address-book/jakarta/src/main/webapp/WEB-INF/web.xml b/benchmark/persistence/address-book/jakarta/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000000000000000000000000000000000..f098eac97b98f9dca6eac8dd752fff55ed1753ab --- /dev/null +++ b/benchmark/persistence/address-book/jakarta/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,40 @@ + + + + + jakarta.faces.PROJECT_STAGE + Development + + + Faces Servlet + + jakarta.faces.webapp.FacesServlet + + 1 + + + Faces Servlet + *.xhtml + + + 30 + + + index.xhtml + + diff --git a/benchmark/persistence/address-book/jakarta/src/main/webapp/contact/Create.xhtml b/benchmark/persistence/address-book/jakarta/src/main/webapp/contact/Create.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..1fe9aa0f3f5af23f904d72b2d439f62de791fa93 --- /dev/null +++ b/benchmark/persistence/address-book/jakarta/src/main/webapp/contact/Create.xhtml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+ + diff --git a/benchmark/persistence/address-book/jakarta/src/main/webapp/contact/Edit.xhtml b/benchmark/persistence/address-book/jakarta/src/main/webapp/contact/Edit.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..30d7874193e081773648d2b672ae9d9dd787bd40 --- /dev/null +++ b/benchmark/persistence/address-book/jakarta/src/main/webapp/contact/Edit.xhtml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + diff --git a/benchmark/persistence/address-book/jakarta/src/main/webapp/contact/List.xhtml b/benchmark/persistence/address-book/jakarta/src/main/webapp/contact/List.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..84b340973b0a41c13cf98858c7936a2abef05f50 --- /dev/null +++ b/benchmark/persistence/address-book/jakarta/src/main/webapp/contact/List.xhtml @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + +   +   +   + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+
+
+ + diff --git a/benchmark/persistence/address-book/jakarta/src/main/webapp/contact/View.xhtml b/benchmark/persistence/address-book/jakarta/src/main/webapp/contact/View.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..c42df45a989ccdc3a820fd02c8909e28d31d0d0c --- /dev/null +++ b/benchmark/persistence/address-book/jakarta/src/main/webapp/contact/View.xhtml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+ +
+
+ + +
+
+
+ + diff --git a/benchmark/persistence/address-book/jakarta/src/main/webapp/index.xhtml b/benchmark/persistence/address-book/jakarta/src/main/webapp/index.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..ef91e66add4d78592a851bfc35209463e44a458b --- /dev/null +++ b/benchmark/persistence/address-book/jakarta/src/main/webapp/index.xhtml @@ -0,0 +1,31 @@ + + + + + + Java Persistence API with JavaBeans Annotations Example + + + +

Welcome to the Address Book example.

+ +

+
+
+ + + diff --git a/benchmark/persistence/address-book/jakarta/src/main/webapp/resources/css/jsfcrud.css b/benchmark/persistence/address-book/jakarta/src/main/webapp/resources/css/jsfcrud.css new file mode 100644 index 0000000000000000000000000000000000000000..9ad890eb751df6c25998e4f1b4e77e3c4de70c5d --- /dev/null +++ b/benchmark/persistence/address-book/jakarta/src/main/webapp/resources/css/jsfcrud.css @@ -0,0 +1,122 @@ +/** + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +root { + display: block; +} + +body { + font-family: Univers, "Univers 55", "Lucida Grande CE", lucida, Helvetica, san-serif; + color: black; + background-color: white; + font-size: small; +} + +h1, h2, h3, h4 { + border-bottom: 1px solid #7F7F7F; + font-weight: bold; + margin: 0px; + padding: 0px; + color: #d20005; +} + +h1 { + font-size: 16px; +} + +h2 { + font-size: 14px; +} + +h3 { + font-size: 12px; +} + +h4 { + font-size: 10px; +} + +a:link, a:visited { + color: black; +} + +a:link:hover, a:visited:hover { + text-decoration: underline; + color: #d20005; +} + +table { + empty-cells: show; +} + +form.jsfcrud_list_form th, td th { + font-size: x-small; + color: #d20005; + border-top-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-right-style: solid; + border-top-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-right-width: 1px; + border-top-color: #cccccc; + border-bottom-color: #cccccc; + border-left-color: #999999; + border-right-color: #999999; + letter-spacing: 3px; + text-align: left; + padding-top: 6px; + padding-bottom: 6px; + padding-left: 6px; + padding-right: 6px; + background-color: white; +} + +td { + vertical-align: top; + padding-bottom: 8px; + font-size: small; +} + +form.jsfcrud_list_form td, td td { + border-top-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-right-style: solid; + border-top-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-right-width: 1px; + border-top-color: #cccccc; + border-bottom-color: #cccccc; + border-left-color: #999999; + border-right-color: #999999; + vertical-align: baseline; + padding-bottom: 0px; +} + +tr.jsfcrud_odd_row { + background-color: #e5e5e5; + color: black; +} + + +tr.jsfcrud_even_row { + background-color: #cccccc; + color: black; +} + +#busyImage { + position: absolute; + left: 50%; + top: 50%; +} diff --git a/benchmark/persistence/address-book/jakarta/src/main/webapp/template.xhtml b/benchmark/persistence/address-book/jakarta/src/main/webapp/template.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..4581b49780fc8e0450c27f08f126e2988b0ff569 --- /dev/null +++ b/benchmark/persistence/address-book/jakarta/src/main/webapp/template.xhtml @@ -0,0 +1,35 @@ + + + + + + + <ui:insert name="title">Default Title</ui:insert> + + + + +

+ Default Title +

+

+ Default Body +

+
+ + diff --git a/benchmark/persistence/address-book/jakarta/test.sh b/benchmark/persistence/address-book/jakarta/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..bd060ae487536596a65a09d340d5a1d6a9587f48 --- /dev/null +++ b/benchmark/persistence/address-book/jakarta/test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +BASE_URL="${BASE_URL:-http://localhost:9080/address-book-10-SNAPSHOT}" + +echo "Health check: ${BASE_URL}" +HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}") + +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "PASS - got HTTP ${HTTP_STATUS}" + exit 0 +else + echo "FAIL - got HTTP ${HTTP_STATUS}" + exit 1 +fi diff --git a/benchmark/persistence/address-book/quarkus/.dockerignore b/benchmark/persistence/address-book/quarkus/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..c634c57d9244b4e60b8fa936f09dbe4e75706e74 --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/.dockerignore @@ -0,0 +1,41 @@ +# VCS +.git/ + +# Maven +.mvn/ +**/.mvn/ +mvnw +mvnw.cmd +**/mvnw +**/mvnw.cmd +target/ +**/target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties + +# IDE / Editor +.vscode/ +**/.vscode/ +.zed/ +**/.zed/ +.idea/ +**/.idea/ +*.iml +*.ipr +*.iws + +# OS +.DS_Store +**/.DS_Store +Thumbs.db +ehthumbs.db + +# Logs / temp +*.log +*.tmp +*.temp diff --git a/benchmark/persistence/address-book/quarkus/.mvn/wrapper/maven-wrapper.properties b/benchmark/persistence/address-book/quarkus/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..8dea6c227c08000d2400d38a2ac886063f22bc36 --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,3 @@ +wrapperVersion=3.3.4 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.12/apache-maven-3.9.12-bin.zip diff --git a/benchmark/persistence/address-book/quarkus/Dockerfile b/benchmark/persistence/address-book/quarkus/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..5b85845ebb66e78ecce7a6dd3e30269db90b4bb5 --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/Dockerfile @@ -0,0 +1,33 @@ +FROM maven:3.9.12-ibm-semeru-21-noble + +USER root +# install uv +RUN apt-get update && apt-get install -y --no-install-recommends curl lsof python3-venv python3-full && curl -LsSf https://astral.sh/uv/install.sh | sh + +ENV PATH="/root/.local/bin:$PATH" + +# Shared browsers path so Chromium is cached once +ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright +RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright + +# create venv and install +RUN uv venv /opt/venv && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest + +ENV PATH="/opt/venv/bin:$PATH" +RUN playwright install --with-deps chromium + +# Set working directory +WORKDIR /app + +# Copy all the assets +COPY . . + +# Build the application at image build time +RUN mvn clean install -DskipTests + +COPY test.sh . +RUN chmod +x test.sh + +RUN mvn clean install -DskipTests + +CMD ["mvn", "quarkus:run"] diff --git a/benchmark/persistence/address-book/quarkus/README.md b/benchmark/persistence/address-book/quarkus/README.md new file mode 100644 index 0000000000000000000000000000000000000000..d931cb7d784994803aa5992d62bced04cf5c42ef --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/README.md @@ -0,0 +1,62 @@ +# address-book-quarkus + +This project uses Quarkus, the Supersonic Subatomic Java Framework. + +If you want to learn more about Quarkus, please visit its website: . + +## Running the application in dev mode + +You can run your application in dev mode that enables live coding using: + +```shell script +./mvnw quarkus:dev +``` + +> **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at . + +## Packaging and running the application + +The application can be packaged using: + +```shell script +./mvnw package +``` + +It produces the `quarkus-run.jar` file in the `target/quarkus-app/` directory. +Be aware that it’s not an _über-jar_ as the dependencies are copied into the `target/quarkus-app/lib/` directory. + +The application is now runnable using `java -jar target/quarkus-app/quarkus-run.jar`. + +If you want to build an _über-jar_, execute the following command: + +```shell script +./mvnw package -Dquarkus.package.jar.type=uber-jar +``` + +The application, packaged as an _über-jar_, is now runnable using `java -jar target/*-runner.jar`. + +## Creating a native executable + +You can create a native executable using: + +```shell script +./mvnw package -Dnative +``` + +Or, if you don't have GraalVM installed, you can run the native executable build in a container using: + +```shell script +./mvnw package -Dnative -Dquarkus.native.container-build=true +``` + +You can then execute your native executable with: `./target/address-book-quarkus-1.0.0-SNAPSHOT-runner` + +If you want to learn more about building native executables, please consult . + +## Provided Code + +### REST + +Easily start your REST Web Services + +[Related guide section...](https://quarkus.io/guides/getting-started-reactive#reactive-jax-rs-resources) diff --git a/benchmark/persistence/address-book/quarkus/mvnw b/benchmark/persistence/address-book/quarkus/mvnw new file mode 100644 index 0000000000000000000000000000000000000000..bd8896bf2217b46faa0291585e01ac1a3441a958 --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/mvnw @@ -0,0 +1,295 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.4 +# +# Optional ENV vars +# ----------------- +# JAVA_HOME - location of a JDK home dir, required when download maven via java source +# MVNW_REPOURL - repo url base for downloading maven distribution +# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output +# ---------------------------------------------------------------------------- + +set -euf +[ "${MVNW_VERBOSE-}" != debug ] || set -x + +# OS specific support. +native_path() { printf %s\\n "$1"; } +case "$(uname)" in +CYGWIN* | MINGW*) + [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" + native_path() { cygpath --path --windows "$1"; } + ;; +esac + +# set JAVACMD and JAVACCMD +set_java_home() { + # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched + if [ -n "${JAVA_HOME-}" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACCMD="$JAVA_HOME/jre/sh/javac" + else + JAVACMD="$JAVA_HOME/bin/java" + JAVACCMD="$JAVA_HOME/bin/javac" + + if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then + echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 + echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 + return 1 + fi + fi + else + JAVACMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v java + )" || : + JAVACCMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v javac + )" || : + + if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then + echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 + return 1 + fi + fi +} + +# hash string like Java String::hashCode +hash_string() { + str="${1:-}" h=0 + while [ -n "$str" ]; do + char="${str%"${str#?}"}" + h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) + str="${str#?}" + done + printf %x\\n $h +} + +verbose() { :; } +[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } + +die() { + printf %s\\n "$1" >&2 + exit 1 +} + +trim() { + # MWRAPPER-139: + # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. + # Needed for removing poorly interpreted newline sequences when running in more + # exotic environments such as mingw bash on Windows. + printf "%s" "${1}" | tr -d '[:space:]' +} + +scriptDir="$(dirname "$0")" +scriptName="$(basename "$0")" + +# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties +while IFS="=" read -r key value; do + case "${key-}" in + distributionUrl) distributionUrl=$(trim "${value-}") ;; + distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; + esac +done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" + +case "${distributionUrl##*/}" in +maven-mvnd-*bin.*) + MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ + case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in + *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; + :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; + :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; + :Linux*x86_64*) distributionPlatform=linux-amd64 ;; + *) + echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 + distributionPlatform=linux-amd64 + ;; + esac + distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" + ;; +maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; +*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; +esac + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" +distributionUrlName="${distributionUrl##*/}" +distributionUrlNameMain="${distributionUrlName%.*}" +distributionUrlNameMain="${distributionUrlNameMain%-bin}" +MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" +MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" + +exec_maven() { + unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : + exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" +} + +if [ -d "$MAVEN_HOME" ]; then + verbose "found existing MAVEN_HOME at $MAVEN_HOME" + exec_maven "$@" +fi + +case "${distributionUrl-}" in +*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; +*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; +esac + +# prepare tmp dir +if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then + clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } + trap clean HUP INT TERM EXIT +else + die "cannot create temp dir" +fi + +mkdir -p -- "${MAVEN_HOME%/*}" + +# Download and Install Apache Maven +verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +verbose "Downloading from: $distributionUrl" +verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +# select .zip or .tar.gz +if ! command -v unzip >/dev/null; then + distributionUrl="${distributionUrl%.zip}.tar.gz" + distributionUrlName="${distributionUrl##*/}" +fi + +# verbose opt +__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' +[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v + +# normalize http auth +case "${MVNW_PASSWORD:+has-password}" in +'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; +has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; +esac + +if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then + verbose "Found wget ... using wget" + wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" +elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then + verbose "Found curl ... using curl" + curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" +elif set_java_home; then + verbose "Falling back to use Java to download" + javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" + targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" + cat >"$javaSource" <<-END + public class Downloader extends java.net.Authenticator + { + protected java.net.PasswordAuthentication getPasswordAuthentication() + { + return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); + } + public static void main( String[] args ) throws Exception + { + setDefault( new Downloader() ); + java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); + } + } + END + # For Cygwin/MinGW, switch paths to Windows format before running javac and java + verbose " - Compiling Downloader.java ..." + "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" + verbose " - Running Downloader.java ..." + "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" +fi + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +if [ -n "${distributionSha256Sum-}" ]; then + distributionSha256Result=false + if [ "$MVN_CMD" = mvnd.sh ]; then + echo "Checksum validation is not supported for maven-mvnd." >&2 + echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + elif command -v sha256sum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then + distributionSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $distributionSha256Result = false ]; then + echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 + echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 + exit 1 + fi +fi + +# unzip and move +if command -v unzip >/dev/null; then + unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" +else + tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" +fi + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +actualDistributionDir="" + +# First try the expected directory name (for regular distributions) +if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then + if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then + actualDistributionDir="$distributionUrlNameMain" + fi +fi + +# If not found, search for any directory with the Maven executable (for snapshots) +if [ -z "$actualDistributionDir" ]; then + # enable globbing to iterate over items + set +f + for dir in "$TMP_DOWNLOAD_DIR"/*; do + if [ -d "$dir" ]; then + if [ -f "$dir/bin/$MVN_CMD" ]; then + actualDistributionDir="$(basename "$dir")" + break + fi + fi + done + set -f +fi + +if [ -z "$actualDistributionDir" ]; then + verbose "Contents of $TMP_DOWNLOAD_DIR:" + verbose "$(ls -la "$TMP_DOWNLOAD_DIR")" + die "Could not find Maven distribution directory in extracted archive" +fi + +verbose "Found extracted Maven distribution directory: $actualDistributionDir" +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" + +clean || : +exec_maven "$@" diff --git a/benchmark/persistence/address-book/quarkus/mvnw.cmd b/benchmark/persistence/address-book/quarkus/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..5761d948924c19571d27b465c519b2e2f9e30351 --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/mvnw.cmd @@ -0,0 +1,189 @@ +<# : batch portion +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.4 +@REM +@REM Optional ENV vars +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output +@REM ---------------------------------------------------------------------------- + +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) +) +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> + +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} + +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} + +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' + +$MAVEN_M2_PATH = "$HOME/.m2" +if ($env:MAVEN_USER_HOME) { + $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME" +} + +if (-not (Test-Path -Path $MAVEN_M2_PATH)) { + New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null +} + +$MAVEN_WRAPPER_DISTS = $null +if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) { + $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists" +} else { + $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists" +} + +$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain" +$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" + +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} + +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} + +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} + +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null + +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +$actualDistributionDir = "" + +# First try the expected directory name (for regular distributions) +$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain" +$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD" +if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) { + $actualDistributionDir = $distributionUrlNameMain +} + +# If not found, search for any directory with the Maven executable (for snapshots) +if (!$actualDistributionDir) { + Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object { + $testPath = Join-Path $_.FullName "bin/$MVN_CMD" + if (Test-Path -Path $testPath -PathType Leaf) { + $actualDistributionDir = $_.Name + } + } +} + +if (!$actualDistributionDir) { + Write-Error "Could not find Maven distribution directory in extracted archive" +} + +Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir" +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/benchmark/persistence/address-book/quarkus/pom.xml b/benchmark/persistence/address-book/quarkus/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..00501c11e60164b5eb011f145139ac45e5a74332 --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/pom.xml @@ -0,0 +1,146 @@ + + + 4.0.0 + quarkus.tutorial + address-book-quarkus + 1.0.0-SNAPSHOT + + + 3.14.0 + 17 + UTF-8 + UTF-8 + quarkus-bom + io.quarkus.platform + 3.30.5 + true + 3.5.3 + + + + + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + + + + + + + io.quarkus + quarkus-arc + + + io.quarkus + quarkus-rest + + + io.quarkus + quarkus-hibernate-orm + + + io.quarkus + quarkus-hibernate-validator + + + io.quarkus + quarkus-jdbc-h2 + + + + org.apache.myfaces.core.extensions.quarkus + myfaces-quarkus + 4.1.2 + + + io.quarkus + quarkus-undertow + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + + + + + ${quarkus.platform.group-id} + quarkus-maven-plugin + ${quarkus.platform.version} + true + + + + build + generate-code + generate-code-tests + native-image-agent + + + + + + maven-compiler-plugin + ${compiler-plugin.version} + + true + + + + maven-surefire-plugin + ${surefire-plugin.version} + + + org.jboss.logmanager.LogManager + ${maven.home} + + + + + maven-failsafe-plugin + ${surefire-plugin.version} + + + + integration-test + verify + + + + + + ${project.build.directory}/${project.build.finalName}-runner + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + + + + native + + + native + + + + false + true + + + + diff --git a/benchmark/persistence/address-book/quarkus/src/main/java/quarkus/tutorial/addressbook/ejb/AbstractFacade.java b/benchmark/persistence/address-book/quarkus/src/main/java/quarkus/tutorial/addressbook/ejb/AbstractFacade.java new file mode 100644 index 0000000000000000000000000000000000000000..eeb8591ca0d91d4133c2dfe061dc7c6a9dd5d1a2 --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/src/main/java/quarkus/tutorial/addressbook/ejb/AbstractFacade.java @@ -0,0 +1,78 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package quarkus.tutorial.addressbook.ejb; + +import java.util.List; + +import jakarta.persistence.EntityManager; +import jakarta.persistence.TypedQuery; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.CriteriaQuery; +import jakarta.persistence.criteria.Root; + +/** + * + * @author ian + */ +public abstract class AbstractFacade { + + private final Class entityClass; + + protected AbstractFacade(Class entityClass) { + this.entityClass = entityClass; + } + + protected abstract EntityManager getEntityManager(); + + public void create(T entity) { + getEntityManager().persist(entity); + } + + public void edit(T entity) { + getEntityManager().merge(entity); + } + + public void remove(T entity) { + getEntityManager().remove(getEntityManager().merge(entity)); + } + + public T find(Object id) { + return getEntityManager().find(entityClass, id); + } + + public List findAll() { + CriteriaBuilder cb = getEntityManager().getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(entityClass); + cq.select(cq.from(entityClass)); + TypedQuery q = getEntityManager().createQuery(cq); + return q.getResultList(); + } + + public List findRange(int[] range) { + CriteriaBuilder cb = getEntityManager().getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(entityClass); + cq.select(cq.from(entityClass)); + TypedQuery q = getEntityManager().createQuery(cq); + // keep your current (exclusive upper bound) behavior: + q.setMaxResults(range[1] - range[0]); + q.setFirstResult(range[0]); + return q.getResultList(); + } + + public int count() { + CriteriaBuilder cb = getEntityManager().getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(Long.class); + Root rt = cq.from(entityClass); + cq.select(cb.count(rt)); + return getEntityManager().createQuery(cq).getSingleResult().intValue(); + } +} \ No newline at end of file diff --git a/benchmark/persistence/address-book/quarkus/src/main/java/quarkus/tutorial/addressbook/ejb/ContactFacade.java b/benchmark/persistence/address-book/quarkus/src/main/java/quarkus/tutorial/addressbook/ejb/ContactFacade.java new file mode 100644 index 0000000000000000000000000000000000000000..3641db92bab19461d8b2857e07069e369c9ce600 --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/src/main/java/quarkus/tutorial/addressbook/ejb/ContactFacade.java @@ -0,0 +1,37 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package quarkus.tutorial.addressbook.ejb; + +import jakarta.persistence.EntityManager; +import quarkus.tutorial.addressbook.entity.Contact; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.transaction.Transactional; +import jakarta.inject.Inject; + +/** + * + * @author ian + */ + +@ApplicationScoped +@Transactional +public class ContactFacade extends AbstractFacade { + @Inject EntityManager em; + + @Override protected EntityManager getEntityManager() { return em; } + + public ContactFacade() { + super(Contact.class); + } + +} + diff --git a/benchmark/persistence/address-book/quarkus/src/main/java/quarkus/tutorial/addressbook/entity/Contact.java b/benchmark/persistence/address-book/quarkus/src/main/java/quarkus/tutorial/addressbook/entity/Contact.java new file mode 100644 index 0000000000000000000000000000000000000000..569091e0cb6944047afba60005cd86c6736a9c97 --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/src/main/java/quarkus/tutorial/addressbook/entity/Contact.java @@ -0,0 +1,173 @@ +package quarkus.tutorial.addressbook.entity; + +import java.io.Serializable; +import java.util.Date; + +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Temporal; +import jakarta.persistence.TemporalType; + +/** + * + * @author ian + */ +@Entity +public class Contact implements Serializable { + + private static final long serialVersionUID = -825634229676522580L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + protected String firstName; + protected String lastName; + protected String email; + protected String mobilePhone; + protected String homePhone; + @Temporal(TemporalType.DATE) + protected Date birthday; + + /** + * Get the value of birthday + * + * @return the value of birthday + */ + public Date getBirthday() { + return birthday; + } + + /** + * Set the value of birthday + * + * @param birthday new value of birthday + */ + public void setBirthday(Date birthday) { + this.birthday = birthday; + } + + /** + * Get the value of homePhone + * + * @return the value of homePhone + */ + public String getHomePhone() { + return homePhone; + } + + /** + * Set the value of homePhone + * + * @param homePhone new value of homePhone + */ + public void setHomePhone(String homePhone) { + this.homePhone = homePhone; + } + + /** + * Get the value of mobilePhone + * + * @return the value of mobilePhone + */ + public String getMobilePhone() { + return mobilePhone; + } + + /** + * Set the value of mobilePhone + * + * @param mobilePhone new value of mobilePhone + */ + public void setMobilePhone(String mobilePhone) { + this.mobilePhone = mobilePhone; + } + + /** + * Get the value of email + * + * @return the value of email + */ + public String getEmail() { + return email; + } + + /** + * Set the value of email + * + * @param email new value of email + */ + public void setEmail(String email) { + this.email = email; + } + + /** + * Get the value of lastName + * + * @return the value of lastName + */ + public String getLastName() { + return lastName; + } + + /** + * Set the value of lastName + * + * @param lastName new value of lastName + */ + public void setLastName(String lastName) { + this.lastName = lastName; + } + + /** + * Get the value of firstName + * + * @return the value of firstName + */ + public String getFirstName() { + return firstName; + } + + /** + * Set the value of firstName + * + * @param firstName new value of firstName + */ + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (id != null ? id.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Contact)) { + return false; + } + Contact other = (Contact) object; + if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "addressbook.entity.Contact[id=" + id + "]"; + } + +} diff --git a/benchmark/persistence/address-book/quarkus/src/main/java/quarkus/tutorial/addressbook/web/ContactController.java b/benchmark/persistence/address-book/quarkus/src/main/java/quarkus/tutorial/addressbook/web/ContactController.java new file mode 100644 index 0000000000000000000000000000000000000000..5b0476183b6a87aa41c02459332707553c6ac58f --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/src/main/java/quarkus/tutorial/addressbook/web/ContactController.java @@ -0,0 +1,241 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package quarkus.tutorial.addressbook.web; + +import java.io.Serializable; +import java.util.ResourceBundle; + +import jakarta.inject.Inject; +import jakarta.enterprise.context.SessionScoped; +import jakarta.faces.component.UIComponent; +import jakarta.faces.context.FacesContext; +import jakarta.faces.convert.Converter; +import jakarta.faces.convert.FacesConverter; +import jakarta.faces.model.DataModel; +import jakarta.faces.model.ListDataModel; +import jakarta.faces.model.SelectItem; +import jakarta.inject.Named; +import quarkus.tutorial.addressbook.ejb.ContactFacade; +import quarkus.tutorial.addressbook.entity.Contact; +import quarkus.tutorial.addressbook.web.util.JsfUtil; +import quarkus.tutorial.addressbook.web.util.PaginationHelper; + +@Named +@SessionScoped +public class ContactController implements Serializable { + private static final long serialVersionUID = -8163374738411860012L; + private Contact current; + private DataModel items = null; + @Inject private ContactFacade ejbFacade; + private PaginationHelper pagination; + private int selectedItemIndex; + + public ContactController() { + } + + public Contact getSelected() { + if (current == null) { + current = new Contact(); + selectedItemIndex = -1; + } + return current; + } + + private ContactFacade getFacade() { + return ejbFacade; + } + + public PaginationHelper getPagination() { + if (pagination == null) { + pagination = new PaginationHelper(10) { + + @Override + public int getItemsCount() { + return getFacade().count(); + } + + @Override + public DataModel createPageDataModel() { + return new ListDataModel(getFacade().findRange(new int[]{getPageFirstItem(), getPageFirstItem()+getPageSize()})); + } + }; + } + return pagination; + } + + public String prepareList() { + recreateModel(); + return "List"; + } + + public String prepareView() { + current = (Contact)getItems().getRowData(); + selectedItemIndex = pagination.getPageFirstItem() + getItems().getRowIndex(); + return "View"; + } + + public String prepareCreate() { + current = new Contact(); + selectedItemIndex = -1; + return "Create"; + } + + public String create() { + try { + getFacade().create(current); + JsfUtil.addSuccessMessage(ResourceBundle.getBundle("/Bundle").getString("ContactCreated")); + return prepareCreate(); + } catch (Exception e) { + JsfUtil.addErrorMessage(e, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured")); + return null; + } + } + + public String prepareEdit() { + current = (Contact)getItems().getRowData(); + selectedItemIndex = pagination.getPageFirstItem() + getItems().getRowIndex(); + return "Edit"; + } + + public String update() { + try { + getFacade().edit(current); + JsfUtil.addSuccessMessage(ResourceBundle.getBundle("/Bundle").getString("ContactUpdated")); + return "View"; + } catch (Exception e) { + JsfUtil.addErrorMessage(e, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured")); + return null; + } + } + + public String destroy() { + current = (Contact)getItems().getRowData(); + selectedItemIndex = pagination.getPageFirstItem() + getItems().getRowIndex(); + performDestroy(); + recreateModel(); + return "List"; + } + + public String destroyAndView() { + performDestroy(); + recreateModel(); + updateCurrentItem(); + if (selectedItemIndex >= 0) { + return "View"; + } else { + // all items were removed - go back to list + recreateModel(); + return "List"; + } + } + + private void performDestroy() { + try { + getFacade().remove(current); + JsfUtil.addSuccessMessage(ResourceBundle.getBundle("/Bundle").getString("ContactDeleted")); + } catch (Exception e) { + JsfUtil.addErrorMessage(e, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured")); + } + } + + private void updateCurrentItem() { + int count = getFacade().count(); + if (selectedItemIndex >= count) { + // selected index cannot be bigger than number of items: + selectedItemIndex = count-1; + // go to previous page if last page disappeared: + if (pagination.getPageFirstItem() >= count) { + pagination.previousPage(); + } + } + if (selectedItemIndex >= 0) { + current = getFacade().findRange(new int[]{selectedItemIndex, selectedItemIndex+1}).get(0); + } + } + + public DataModel getItems() { + if (items == null) { + items = getPagination().createPageDataModel(); + } + return items; + } + + private void recreateModel() { + items = null; + } + + public String next() { + getPagination().nextPage(); + recreateModel(); + return "List"; + } + + public String previous() { + getPagination().previousPage(); + recreateModel(); + return "List"; + } + + public SelectItem[] getItemsAvailableSelectMany() { + return JsfUtil.getSelectItems(ejbFacade.findAll(), false); + } + + public SelectItem[] getItemsAvailableSelectOne() { + return JsfUtil.getSelectItems(ejbFacade.findAll(), true); + } + + @FacesConverter(forClass=Contact.class) + public static class ContactControllerConverter implements Converter { + + @Override + public Contact getAsObject(FacesContext facesContext, UIComponent component, String value) { + if (value == null || value.length() == 0) { + return null; + } + ContactController controller = (ContactController)facesContext.getApplication().getELResolver(). + getValue(facesContext.getELContext(), null, "contactController"); + return controller.ejbFacade.find(getKey(value)); + } + + java.lang.Long getKey(String value) { + java.lang.Long key; + key = Long.valueOf(value); + return key; + } + + String getStringKey(java.lang.Long value) { + StringBuilder sb = new StringBuilder(); + sb.append(value); + return sb.toString(); + } + + @Override + public String getAsString(FacesContext facesContext, UIComponent component, Contact object) { + if (object == null) { + return null; + } + if (object instanceof Contact) { + Contact o = (Contact) object; + return getStringKey(o.getId()); + } else { + throw new IllegalArgumentException("object " + + object + + " is of type " + + object.getClass().getName() + + "; expected type: " + + ContactController.class.getName()); + } + } + + } + +} diff --git a/benchmark/persistence/address-book/quarkus/src/main/java/quarkus/tutorial/addressbook/web/util/JsfUtil.java b/benchmark/persistence/address-book/quarkus/src/main/java/quarkus/tutorial/addressbook/web/util/JsfUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..5e2bf0add54859bf1ec03a46557a403820de8c38 --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/src/main/java/quarkus/tutorial/addressbook/web/util/JsfUtil.java @@ -0,0 +1,72 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package quarkus.tutorial.addressbook.web.util; + +import java.util.List; + +import jakarta.faces.application.FacesMessage; +import jakarta.faces.component.UIComponent; +import jakarta.faces.context.FacesContext; +import jakarta.faces.convert.Converter; +import jakarta.faces.model.SelectItem; + +public class JsfUtil { + + public static SelectItem[] getSelectItems(List entities, boolean selectOne) { + int size = selectOne ? entities.size() + 1 : entities.size(); + SelectItem[] items = new SelectItem[size]; + int i = 0; + if (selectOne) { + items[0] = new SelectItem("", "---"); + i++; + } + for (Object x : entities) { + items[i++] = new SelectItem(x, x.toString()); + } + return items; + } + + public static void addErrorMessage(Exception ex, String defaultMsg) { + String msg = ex.getLocalizedMessage(); + if (msg != null && msg.length() > 0) { + addErrorMessage(msg); + } else { + addErrorMessage(defaultMsg); + } + } + + public static void addErrorMessages(List messages) { + for (String message : messages) { + addErrorMessage(message); + } + } + + public static void addErrorMessage(String msg) { + FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg); + FacesContext.getCurrentInstance().addMessage(null, facesMsg); + } + + public static void addSuccessMessage(String msg) { + FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg); + FacesContext.getCurrentInstance().addMessage("successInfo", facesMsg); + } + + public static String getRequestParameter(String key) { + return FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get(key); + } + + public static Object getObjectFromRequestParameter(String requestParameterName, Converter converter, UIComponent component) { + String theId = JsfUtil.getRequestParameter(requestParameterName); + return converter.getAsObject(FacesContext.getCurrentInstance(), component, theId); + } + +} diff --git a/benchmark/persistence/address-book/quarkus/src/main/java/quarkus/tutorial/addressbook/web/util/PaginationHelper.java b/benchmark/persistence/address-book/quarkus/src/main/java/quarkus/tutorial/addressbook/web/util/PaginationHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..b866f21e7a38ea37583952dcfd6576beef1e749e --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/src/main/java/quarkus/tutorial/addressbook/web/util/PaginationHelper.java @@ -0,0 +1,69 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package quarkus.tutorial.addressbook.web.util; + +import jakarta.faces.model.DataModel; + +public abstract class PaginationHelper { + + private int pageSize; + private int page; + + public PaginationHelper(int pageSize) { + this.pageSize = pageSize; + } + + public abstract int getItemsCount(); + + public abstract DataModel createPageDataModel(); + + public int getPageFirstItem() { + return page*pageSize; + } + + public int getPageLastItem() { + int i = getPageFirstItem() + pageSize -1; + int count = getItemsCount() - 1; + if (i > count) { + i = count; + } + if (i < 0) { + i = 0; + } + return i; + } + + public boolean isHasNextPage() { + return (page+1)*pageSize+1 <= getItemsCount(); + } + + public void nextPage() { + if (isHasNextPage()) { + page++; + } + } + + public boolean isHasPreviousPage() { + return page > 0; + } + + public void previousPage() { + if (isHasPreviousPage()) { + page--; + } + } + + public int getPageSize() { + return pageSize; + } + +} diff --git a/benchmark/persistence/address-book/quarkus/src/main/resources/.mvn/wrapper/maven-wrapper.properties b/benchmark/persistence/address-book/quarkus/src/main/resources/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..ffcab66aa2834b68df24bd23612a717fdbf7920a --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/src/main/resources/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,3 @@ +wrapperVersion=3.3.4 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip diff --git a/benchmark/persistence/address-book/quarkus/src/main/resources/Bundle.properties b/benchmark/persistence/address-book/quarkus/src/main/resources/Bundle.properties new file mode 100644 index 0000000000000000000000000000000000000000..02e0ea911cd21469a5b9b4f712721158d9bd87de --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/src/main/resources/Bundle.properties @@ -0,0 +1,92 @@ +# +# Copyright (c), Eclipse Foundation, Inc. and its licensors. +# +# All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Distribution License v1.0, which is available at +# https://www.eclipse.org/org/documents/edl-v10.php +# +# SPDX-License-Identifier: BSD-3-Clause +# + +PersistenceErrorOccured=A persistence error occurred. +Previous=Previous +Next=Next + +ContactCreated=Contact was successfully created. +ContactUpdated=Contact was successfully updated. +ContactDeleted=Contact was successfully deleted. +CreateContactTitle=Create New Contact +CreateContactSaveLink=Save +CreateContactShowAllLink=Show All Contact Items +CreateContactIndexLink=Index +CreateContactLabel_birthday=Birthday: +CreateContactTitle_birthday=Birthday +CreateContactLabel_homePhone=Home Phone: +CreateContactTitle_homePhone=Home Phone +CreateContactLabel_mobilePhone=Mobile Phone: +CreateContactTitle_mobilePhone=Mobile Phone +CreateContactLabel_email=Email: +CreateContactTitle_email=Email +CreateContactLabel_lastName=Last Name: +CreateContactTitle_lastName=Last Name +CreateContactLabel_firstName=First Name: +CreateContactTitle_firstName=First Name +CreateContactLabel_id=Id: +CreateContactTitle_id=Id +EditContactTitle=Edit Contact +EditContactSaveLink=Save +EditContactViewLink=View +EditContactShowAllLink=Show All Contact Items +EditContactIndexLink=Index +EditContactLabel_birthday=Birthday: +EditContactTitle_birthday=Birthday +EditContactLabel_homePhone=Home Phone: +EditContactTitle_homePhone=Home Phone +EditContactLabel_mobilePhone=Mobile Phone: +EditContactTitle_mobilePhone=Mobile Phone +EditContactLabel_email=Email: +EditContactTitle_email=Email +EditContactLabel_lastName=Last Name: +EditContactTitle_lastName=Last Name +EditContactLabel_firstName=First Name: +EditContactTitle_firstName=First Name +EditContactLabel_id=Id: +EditContactTitle_id=Id +ViewContactTitle=View +ViewContactDestroyLink=Destroy +ViewContactEditLink=Edit +ViewContactCreateLink=Create New Contact +ViewContactShowAllLink=Show All Contact Items +ViewContactIndexLink=Index +ViewContactLabel_birthday=Birthday: +ViewContactTitle_birthday=Birthday +ViewContactLabel_homePhone=Home Phone: +ViewContactTitle_homePhone=Home Phone +ViewContactLabel_mobilePhone=Mobile Phone: +ViewContactTitle_mobilePhone=Mobile Phone +ViewContactLabel_email=Email: +ViewContactTitle_email=Email +ViewContactLabel_lastName=Last Name: +ViewContactTitle_lastName=Last Name +ViewContactLabel_firstName=First Name: +ViewContactTitle_firstName=First Name +ViewContactLabel_id=Id: +ViewContactTitle_id=Id +ListContactTitle=List +ListContactEmpty=(No Contact Items Found) +ListContactDestroyLink=Destroy +ListContactEditLink=Edit +ListContactViewLink=View +ListContactCreateLink=Create New Contact +ListContactIndexLink=Index +ListContactTitle_birthday=Birthday +ListContactTitle_homePhone=Home Phone +ListContactTitle_mobilePhone=Mobile Phone +ListContactTitle_email=Email +ListContactTitle_lastName=Last Name +ListContactTitle_firstName=First Name +ListContactTitle_id=Id + + diff --git a/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/resources/WEB-INF/faces-config.xml b/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/resources/WEB-INF/faces-config.xml new file mode 100644 index 0000000000000000000000000000000000000000..3f31a7897ebe3d64226d6966ddc08cda6dbe4f06 --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/resources/WEB-INF/faces-config.xml @@ -0,0 +1,27 @@ + + + + + + + + /Bundle + bundle + + + diff --git a/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/resources/WEB-INF/web.xml b/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/resources/WEB-INF/web.xml new file mode 100644 index 0000000000000000000000000000000000000000..37159047cffaa0adc7435fad0ae8a36b27fc73c8 --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/resources/WEB-INF/web.xml @@ -0,0 +1,39 @@ + + + + + jakarta.faces.PROJECT_STAGE + Development + + + jakarta.faces.FACELETS_SKIP_COMMENTS + true + + + jakarta.faces.FACELETS_REFRESH_PERIOD + -1 + + + Faces Servlet + jakarta.faces.webapp.FacesServlet + 1 + + + Faces Servlet + *.xhtml + + + index.xhtml + + + diff --git a/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/resources/contact/Create.xhtml b/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/resources/contact/Create.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..1fe9aa0f3f5af23f904d72b2d439f62de791fa93 --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/resources/contact/Create.xhtml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+ + diff --git a/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/resources/contact/Edit.xhtml b/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/resources/contact/Edit.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..30d7874193e081773648d2b672ae9d9dd787bd40 --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/resources/contact/Edit.xhtml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + diff --git a/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/resources/contact/List.xhtml b/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/resources/contact/List.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..84b340973b0a41c13cf98858c7936a2abef05f50 --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/resources/contact/List.xhtml @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + +   +   +   + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+
+
+ + diff --git a/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/resources/contact/View.xhtml b/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/resources/contact/View.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..c42df45a989ccdc3a820fd02c8909e28d31d0d0c --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/resources/contact/View.xhtml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+ +
+
+ + +
+
+
+ + diff --git a/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/resources/index.xhtml b/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/resources/index.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..ef91e66add4d78592a851bfc35209463e44a458b --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/resources/index.xhtml @@ -0,0 +1,31 @@ + + + + + + Java Persistence API with JavaBeans Annotations Example + + + +

Welcome to the Address Book example.

+ +

+
+
+ + + diff --git a/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/resources/resources/css/jsfcrud.css b/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/resources/resources/css/jsfcrud.css new file mode 100644 index 0000000000000000000000000000000000000000..9ad890eb751df6c25998e4f1b4e77e3c4de70c5d --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/resources/resources/css/jsfcrud.css @@ -0,0 +1,122 @@ +/** + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +root { + display: block; +} + +body { + font-family: Univers, "Univers 55", "Lucida Grande CE", lucida, Helvetica, san-serif; + color: black; + background-color: white; + font-size: small; +} + +h1, h2, h3, h4 { + border-bottom: 1px solid #7F7F7F; + font-weight: bold; + margin: 0px; + padding: 0px; + color: #d20005; +} + +h1 { + font-size: 16px; +} + +h2 { + font-size: 14px; +} + +h3 { + font-size: 12px; +} + +h4 { + font-size: 10px; +} + +a:link, a:visited { + color: black; +} + +a:link:hover, a:visited:hover { + text-decoration: underline; + color: #d20005; +} + +table { + empty-cells: show; +} + +form.jsfcrud_list_form th, td th { + font-size: x-small; + color: #d20005; + border-top-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-right-style: solid; + border-top-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-right-width: 1px; + border-top-color: #cccccc; + border-bottom-color: #cccccc; + border-left-color: #999999; + border-right-color: #999999; + letter-spacing: 3px; + text-align: left; + padding-top: 6px; + padding-bottom: 6px; + padding-left: 6px; + padding-right: 6px; + background-color: white; +} + +td { + vertical-align: top; + padding-bottom: 8px; + font-size: small; +} + +form.jsfcrud_list_form td, td td { + border-top-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-right-style: solid; + border-top-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-right-width: 1px; + border-top-color: #cccccc; + border-bottom-color: #cccccc; + border-left-color: #999999; + border-right-color: #999999; + vertical-align: baseline; + padding-bottom: 0px; +} + +tr.jsfcrud_odd_row { + background-color: #e5e5e5; + color: black; +} + + +tr.jsfcrud_even_row { + background-color: #cccccc; + color: black; +} + +#busyImage { + position: absolute; + left: 50%; + top: 50%; +} diff --git a/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/resources/template.xhtml b/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/resources/template.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..4581b49780fc8e0450c27f08f126e2988b0ff569 --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/resources/template.xhtml @@ -0,0 +1,35 @@ + + + + + + + <ui:insert name="title">Default Title</ui:insert> + + + + +

+ Default Title +

+

+ Default Body +

+
+ + diff --git a/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/web.xml b/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/web.xml new file mode 100644 index 0000000000000000000000000000000000000000..37159047cffaa0adc7435fad0ae8a36b27fc73c8 --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/src/main/resources/META-INF/web.xml @@ -0,0 +1,39 @@ + + + + + jakarta.faces.PROJECT_STAGE + Development + + + jakarta.faces.FACELETS_SKIP_COMMENTS + true + + + jakarta.faces.FACELETS_REFRESH_PERIOD + -1 + + + Faces Servlet + jakarta.faces.webapp.FacesServlet + 1 + + + Faces Servlet + *.xhtml + + + index.xhtml + + + diff --git a/benchmark/persistence/address-book/quarkus/src/main/resources/ValidationMessages.properties b/benchmark/persistence/address-book/quarkus/src/main/resources/ValidationMessages.properties new file mode 100644 index 0000000000000000000000000000000000000000..c4eb065f57e93900b2eeae7c5ff2b4cd88d2749a --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/src/main/resources/ValidationMessages.properties @@ -0,0 +1,15 @@ +# +# Copyright (c), Eclipse Foundation, Inc. and its licensors. +# +# All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Distribution License v1.0, which is available at +# https://www.eclipse.org/org/documents/edl-v10.php +# +# SPDX-License-Identifier: BSD-3-Clause +# + +# Validation message string for the JavaBeans Validation API +invalid.email=Not a valid email address. +invalid.phonenumber=Not a valid phone number. diff --git a/benchmark/persistence/address-book/quarkus/src/main/resources/application.properties b/benchmark/persistence/address-book/quarkus/src/main/resources/application.properties new file mode 100644 index 0000000000000000000000000000000000000000..c509eaadffcfb36282a69794ed71a7e6e531d78e --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/src/main/resources/application.properties @@ -0,0 +1,8 @@ +quarkus.datasource.db-kind=h2 +quarkus.datasource.jdbc.url=jdbc:h2:mem:addressbook;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE +quarkus.datasource.username=sa +quarkus.datasource.password= +quarkus.hibernate-orm.database.generation=update +quarkus.hibernate-orm.log.sql=true +quarkus.http.port=8080 + diff --git a/benchmark/persistence/address-book/quarkus/src/main/resources/mvnw b/benchmark/persistence/address-book/quarkus/src/main/resources/mvnw new file mode 100644 index 0000000000000000000000000000000000000000..bd8896bf2217b46faa0291585e01ac1a3441a958 --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/src/main/resources/mvnw @@ -0,0 +1,295 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.4 +# +# Optional ENV vars +# ----------------- +# JAVA_HOME - location of a JDK home dir, required when download maven via java source +# MVNW_REPOURL - repo url base for downloading maven distribution +# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output +# ---------------------------------------------------------------------------- + +set -euf +[ "${MVNW_VERBOSE-}" != debug ] || set -x + +# OS specific support. +native_path() { printf %s\\n "$1"; } +case "$(uname)" in +CYGWIN* | MINGW*) + [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" + native_path() { cygpath --path --windows "$1"; } + ;; +esac + +# set JAVACMD and JAVACCMD +set_java_home() { + # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched + if [ -n "${JAVA_HOME-}" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACCMD="$JAVA_HOME/jre/sh/javac" + else + JAVACMD="$JAVA_HOME/bin/java" + JAVACCMD="$JAVA_HOME/bin/javac" + + if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then + echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 + echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 + return 1 + fi + fi + else + JAVACMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v java + )" || : + JAVACCMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v javac + )" || : + + if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then + echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 + return 1 + fi + fi +} + +# hash string like Java String::hashCode +hash_string() { + str="${1:-}" h=0 + while [ -n "$str" ]; do + char="${str%"${str#?}"}" + h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) + str="${str#?}" + done + printf %x\\n $h +} + +verbose() { :; } +[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } + +die() { + printf %s\\n "$1" >&2 + exit 1 +} + +trim() { + # MWRAPPER-139: + # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. + # Needed for removing poorly interpreted newline sequences when running in more + # exotic environments such as mingw bash on Windows. + printf "%s" "${1}" | tr -d '[:space:]' +} + +scriptDir="$(dirname "$0")" +scriptName="$(basename "$0")" + +# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties +while IFS="=" read -r key value; do + case "${key-}" in + distributionUrl) distributionUrl=$(trim "${value-}") ;; + distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; + esac +done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" + +case "${distributionUrl##*/}" in +maven-mvnd-*bin.*) + MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ + case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in + *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; + :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; + :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; + :Linux*x86_64*) distributionPlatform=linux-amd64 ;; + *) + echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 + distributionPlatform=linux-amd64 + ;; + esac + distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" + ;; +maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; +*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; +esac + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" +distributionUrlName="${distributionUrl##*/}" +distributionUrlNameMain="${distributionUrlName%.*}" +distributionUrlNameMain="${distributionUrlNameMain%-bin}" +MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" +MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" + +exec_maven() { + unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : + exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" +} + +if [ -d "$MAVEN_HOME" ]; then + verbose "found existing MAVEN_HOME at $MAVEN_HOME" + exec_maven "$@" +fi + +case "${distributionUrl-}" in +*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; +*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; +esac + +# prepare tmp dir +if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then + clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } + trap clean HUP INT TERM EXIT +else + die "cannot create temp dir" +fi + +mkdir -p -- "${MAVEN_HOME%/*}" + +# Download and Install Apache Maven +verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +verbose "Downloading from: $distributionUrl" +verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +# select .zip or .tar.gz +if ! command -v unzip >/dev/null; then + distributionUrl="${distributionUrl%.zip}.tar.gz" + distributionUrlName="${distributionUrl##*/}" +fi + +# verbose opt +__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' +[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v + +# normalize http auth +case "${MVNW_PASSWORD:+has-password}" in +'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; +has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; +esac + +if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then + verbose "Found wget ... using wget" + wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" +elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then + verbose "Found curl ... using curl" + curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" +elif set_java_home; then + verbose "Falling back to use Java to download" + javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" + targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" + cat >"$javaSource" <<-END + public class Downloader extends java.net.Authenticator + { + protected java.net.PasswordAuthentication getPasswordAuthentication() + { + return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); + } + public static void main( String[] args ) throws Exception + { + setDefault( new Downloader() ); + java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); + } + } + END + # For Cygwin/MinGW, switch paths to Windows format before running javac and java + verbose " - Compiling Downloader.java ..." + "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" + verbose " - Running Downloader.java ..." + "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" +fi + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +if [ -n "${distributionSha256Sum-}" ]; then + distributionSha256Result=false + if [ "$MVN_CMD" = mvnd.sh ]; then + echo "Checksum validation is not supported for maven-mvnd." >&2 + echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + elif command -v sha256sum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then + distributionSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $distributionSha256Result = false ]; then + echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 + echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 + exit 1 + fi +fi + +# unzip and move +if command -v unzip >/dev/null; then + unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" +else + tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" +fi + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +actualDistributionDir="" + +# First try the expected directory name (for regular distributions) +if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then + if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then + actualDistributionDir="$distributionUrlNameMain" + fi +fi + +# If not found, search for any directory with the Maven executable (for snapshots) +if [ -z "$actualDistributionDir" ]; then + # enable globbing to iterate over items + set +f + for dir in "$TMP_DOWNLOAD_DIR"/*; do + if [ -d "$dir" ]; then + if [ -f "$dir/bin/$MVN_CMD" ]; then + actualDistributionDir="$(basename "$dir")" + break + fi + fi + done + set -f +fi + +if [ -z "$actualDistributionDir" ]; then + verbose "Contents of $TMP_DOWNLOAD_DIR:" + verbose "$(ls -la "$TMP_DOWNLOAD_DIR")" + die "Could not find Maven distribution directory in extracted archive" +fi + +verbose "Found extracted Maven distribution directory: $actualDistributionDir" +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" + +clean || : +exec_maven "$@" diff --git a/benchmark/persistence/address-book/quarkus/src/main/resources/mvnw.cmd b/benchmark/persistence/address-book/quarkus/src/main/resources/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..5761d948924c19571d27b465c519b2e2f9e30351 --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/src/main/resources/mvnw.cmd @@ -0,0 +1,189 @@ +<# : batch portion +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.4 +@REM +@REM Optional ENV vars +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output +@REM ---------------------------------------------------------------------------- + +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) +) +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> + +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} + +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} + +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' + +$MAVEN_M2_PATH = "$HOME/.m2" +if ($env:MAVEN_USER_HOME) { + $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME" +} + +if (-not (Test-Path -Path $MAVEN_M2_PATH)) { + New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null +} + +$MAVEN_WRAPPER_DISTS = $null +if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) { + $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists" +} else { + $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists" +} + +$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain" +$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" + +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} + +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} + +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} + +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null + +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +$actualDistributionDir = "" + +# First try the expected directory name (for regular distributions) +$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain" +$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD" +if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) { + $actualDistributionDir = $distributionUrlNameMain +} + +# If not found, search for any directory with the Maven executable (for snapshots) +if (!$actualDistributionDir) { + Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object { + $testPath = Join-Path $_.FullName "bin/$MVN_CMD" + if (Test-Path -Path $testPath -PathType Leaf) { + $actualDistributionDir = $_.Name + } + } +} + +if (!$actualDistributionDir) { + Write-Error "Could not find Maven distribution directory in extracted archive" +} + +Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir" +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/benchmark/persistence/address-book/quarkus/test.sh b/benchmark/persistence/address-book/quarkus/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..21784743b019b9893b6c1981b7bb76709e960d6b --- /dev/null +++ b/benchmark/persistence/address-book/quarkus/test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +BASE_URL="${BASE_URL:-http://localhost:8080}" + +echo "Health check: ${BASE_URL}/" +HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}/") + +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "PASS - got HTTP ${HTTP_STATUS}" + exit 0 +else + echo "FAIL - got HTTP ${HTTP_STATUS}" + exit 1 +fi diff --git a/benchmark/persistence/address-book/spring/.dockerignore b/benchmark/persistence/address-book/spring/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..c634c57d9244b4e60b8fa936f09dbe4e75706e74 --- /dev/null +++ b/benchmark/persistence/address-book/spring/.dockerignore @@ -0,0 +1,41 @@ +# VCS +.git/ + +# Maven +.mvn/ +**/.mvn/ +mvnw +mvnw.cmd +**/mvnw +**/mvnw.cmd +target/ +**/target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties + +# IDE / Editor +.vscode/ +**/.vscode/ +.zed/ +**/.zed/ +.idea/ +**/.idea/ +*.iml +*.ipr +*.iws + +# OS +.DS_Store +**/.DS_Store +Thumbs.db +ehthumbs.db + +# Logs / temp +*.log +*.tmp +*.temp diff --git a/benchmark/persistence/address-book/spring/.mvn/wrapper/maven-wrapper.properties b/benchmark/persistence/address-book/spring/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..8dea6c227c08000d2400d38a2ac886063f22bc36 --- /dev/null +++ b/benchmark/persistence/address-book/spring/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,3 @@ +wrapperVersion=3.3.4 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.12/apache-maven-3.9.12-bin.zip diff --git a/benchmark/persistence/address-book/spring/Dockerfile b/benchmark/persistence/address-book/spring/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..57e175bfb6aea19c77e95e82697b83253c1d3191 --- /dev/null +++ b/benchmark/persistence/address-book/spring/Dockerfile @@ -0,0 +1,31 @@ +FROM maven:3.9.12-ibm-semeru-21-noble + +USER root +# install uv +RUN apt-get update && apt-get install -y --no-install-recommends curl python3-venv python3-full && curl -LsSf https://astral.sh/uv/install.sh | sh + +ENV PATH="/root/.local/bin:$PATH" + +# Shared browsers path so Chromium is cached once +ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright +RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright + +# create venv and install +RUN uv venv /opt/venv && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest + +ENV PATH="/opt/venv/bin:$PATH" +RUN playwright install --with-deps chromium + +# Set working directory +WORKDIR /app + +# Copy all the assets +COPY . . + +COPY test.sh . +RUN chmod +x test.sh + +# Build application at image build time +RUN mvn clean install -DskipTests + +CMD ["mvn", "spring-boot:run"] diff --git a/benchmark/persistence/address-book/spring/mvnw b/benchmark/persistence/address-book/spring/mvnw new file mode 100644 index 0000000000000000000000000000000000000000..bd8896bf2217b46faa0291585e01ac1a3441a958 --- /dev/null +++ b/benchmark/persistence/address-book/spring/mvnw @@ -0,0 +1,295 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.4 +# +# Optional ENV vars +# ----------------- +# JAVA_HOME - location of a JDK home dir, required when download maven via java source +# MVNW_REPOURL - repo url base for downloading maven distribution +# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output +# ---------------------------------------------------------------------------- + +set -euf +[ "${MVNW_VERBOSE-}" != debug ] || set -x + +# OS specific support. +native_path() { printf %s\\n "$1"; } +case "$(uname)" in +CYGWIN* | MINGW*) + [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" + native_path() { cygpath --path --windows "$1"; } + ;; +esac + +# set JAVACMD and JAVACCMD +set_java_home() { + # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched + if [ -n "${JAVA_HOME-}" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACCMD="$JAVA_HOME/jre/sh/javac" + else + JAVACMD="$JAVA_HOME/bin/java" + JAVACCMD="$JAVA_HOME/bin/javac" + + if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then + echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 + echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 + return 1 + fi + fi + else + JAVACMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v java + )" || : + JAVACCMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v javac + )" || : + + if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then + echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 + return 1 + fi + fi +} + +# hash string like Java String::hashCode +hash_string() { + str="${1:-}" h=0 + while [ -n "$str" ]; do + char="${str%"${str#?}"}" + h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) + str="${str#?}" + done + printf %x\\n $h +} + +verbose() { :; } +[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } + +die() { + printf %s\\n "$1" >&2 + exit 1 +} + +trim() { + # MWRAPPER-139: + # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. + # Needed for removing poorly interpreted newline sequences when running in more + # exotic environments such as mingw bash on Windows. + printf "%s" "${1}" | tr -d '[:space:]' +} + +scriptDir="$(dirname "$0")" +scriptName="$(basename "$0")" + +# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties +while IFS="=" read -r key value; do + case "${key-}" in + distributionUrl) distributionUrl=$(trim "${value-}") ;; + distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; + esac +done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" + +case "${distributionUrl##*/}" in +maven-mvnd-*bin.*) + MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ + case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in + *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; + :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; + :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; + :Linux*x86_64*) distributionPlatform=linux-amd64 ;; + *) + echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 + distributionPlatform=linux-amd64 + ;; + esac + distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" + ;; +maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; +*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; +esac + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" +distributionUrlName="${distributionUrl##*/}" +distributionUrlNameMain="${distributionUrlName%.*}" +distributionUrlNameMain="${distributionUrlNameMain%-bin}" +MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" +MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" + +exec_maven() { + unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : + exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" +} + +if [ -d "$MAVEN_HOME" ]; then + verbose "found existing MAVEN_HOME at $MAVEN_HOME" + exec_maven "$@" +fi + +case "${distributionUrl-}" in +*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; +*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; +esac + +# prepare tmp dir +if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then + clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } + trap clean HUP INT TERM EXIT +else + die "cannot create temp dir" +fi + +mkdir -p -- "${MAVEN_HOME%/*}" + +# Download and Install Apache Maven +verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +verbose "Downloading from: $distributionUrl" +verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +# select .zip or .tar.gz +if ! command -v unzip >/dev/null; then + distributionUrl="${distributionUrl%.zip}.tar.gz" + distributionUrlName="${distributionUrl##*/}" +fi + +# verbose opt +__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' +[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v + +# normalize http auth +case "${MVNW_PASSWORD:+has-password}" in +'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; +has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; +esac + +if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then + verbose "Found wget ... using wget" + wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" +elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then + verbose "Found curl ... using curl" + curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" +elif set_java_home; then + verbose "Falling back to use Java to download" + javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" + targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" + cat >"$javaSource" <<-END + public class Downloader extends java.net.Authenticator + { + protected java.net.PasswordAuthentication getPasswordAuthentication() + { + return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); + } + public static void main( String[] args ) throws Exception + { + setDefault( new Downloader() ); + java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); + } + } + END + # For Cygwin/MinGW, switch paths to Windows format before running javac and java + verbose " - Compiling Downloader.java ..." + "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" + verbose " - Running Downloader.java ..." + "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" +fi + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +if [ -n "${distributionSha256Sum-}" ]; then + distributionSha256Result=false + if [ "$MVN_CMD" = mvnd.sh ]; then + echo "Checksum validation is not supported for maven-mvnd." >&2 + echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + elif command -v sha256sum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then + distributionSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $distributionSha256Result = false ]; then + echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 + echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 + exit 1 + fi +fi + +# unzip and move +if command -v unzip >/dev/null; then + unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" +else + tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" +fi + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +actualDistributionDir="" + +# First try the expected directory name (for regular distributions) +if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then + if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then + actualDistributionDir="$distributionUrlNameMain" + fi +fi + +# If not found, search for any directory with the Maven executable (for snapshots) +if [ -z "$actualDistributionDir" ]; then + # enable globbing to iterate over items + set +f + for dir in "$TMP_DOWNLOAD_DIR"/*; do + if [ -d "$dir" ]; then + if [ -f "$dir/bin/$MVN_CMD" ]; then + actualDistributionDir="$(basename "$dir")" + break + fi + fi + done + set -f +fi + +if [ -z "$actualDistributionDir" ]; then + verbose "Contents of $TMP_DOWNLOAD_DIR:" + verbose "$(ls -la "$TMP_DOWNLOAD_DIR")" + die "Could not find Maven distribution directory in extracted archive" +fi + +verbose "Found extracted Maven distribution directory: $actualDistributionDir" +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" + +clean || : +exec_maven "$@" diff --git a/benchmark/persistence/address-book/spring/mvnw.cmd b/benchmark/persistence/address-book/spring/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..5761d948924c19571d27b465c519b2e2f9e30351 --- /dev/null +++ b/benchmark/persistence/address-book/spring/mvnw.cmd @@ -0,0 +1,189 @@ +<# : batch portion +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.4 +@REM +@REM Optional ENV vars +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output +@REM ---------------------------------------------------------------------------- + +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) +) +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> + +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} + +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} + +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' + +$MAVEN_M2_PATH = "$HOME/.m2" +if ($env:MAVEN_USER_HOME) { + $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME" +} + +if (-not (Test-Path -Path $MAVEN_M2_PATH)) { + New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null +} + +$MAVEN_WRAPPER_DISTS = $null +if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) { + $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists" +} else { + $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists" +} + +$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain" +$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" + +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} + +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} + +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} + +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null + +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +$actualDistributionDir = "" + +# First try the expected directory name (for regular distributions) +$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain" +$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD" +if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) { + $actualDistributionDir = $distributionUrlNameMain +} + +# If not found, search for any directory with the Maven executable (for snapshots) +if (!$actualDistributionDir) { + Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object { + $testPath = Join-Path $_.FullName "bin/$MVN_CMD" + if (Test-Path -Path $testPath -PathType Leaf) { + $actualDistributionDir = $_.Name + } + } +} + +if (!$actualDistributionDir) { + Write-Error "Could not find Maven distribution directory in extracted archive" +} + +Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir" +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/benchmark/persistence/address-book/spring/pom.xml b/benchmark/persistence/address-book/spring/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..f481c1fcb35cbf55ac4a2bb9ede2a6317014eb4b --- /dev/null +++ b/benchmark/persistence/address-book/spring/pom.xml @@ -0,0 +1,105 @@ + + 4.0.0 + com.example + address-book-spring + 0.0.1-SNAPSHOT + war + Address Book (Spring) + Demo project for Spring Boot + + + + + + + + + + + + + + + 17 + 17 + 17 + UTF-8 + + + + + org.springframework + spring-core + 6.2.11 + + + ch.qos.logback + logback-core + 1.5.19 + + + ch.qos.logback + logback-classic + 1.5.19 + + + org.joinfaces + joinfaces-platform + 5.5.5 + pom + import + + + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-validation + + + org.joinfaces + jsf-spring-boot-starter + + + org.glassfish + jakarta.faces + 4.0.2 + + + org.jboss.weld.servlet + weld-servlet-core + 5.1.0.Final + + + com.h2database + h2 + runtime + + + org.springframework.boot + spring-boot-starter-tomcat + provided + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + \ No newline at end of file diff --git a/benchmark/persistence/address-book/spring/src/main/java/com/example/addressbookspring/Application.java b/benchmark/persistence/address-book/spring/src/main/java/com/example/addressbookspring/Application.java new file mode 100644 index 0000000000000000000000000000000000000000..1f19bacc344a3d15f666b171ae155fed19532942 --- /dev/null +++ b/benchmark/persistence/address-book/spring/src/main/java/com/example/addressbookspring/Application.java @@ -0,0 +1,13 @@ +package com.example.addressbookspring; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/benchmark/persistence/address-book/spring/src/main/java/com/example/addressbookspring/ServletInitializer.java b/benchmark/persistence/address-book/spring/src/main/java/com/example/addressbookspring/ServletInitializer.java new file mode 100644 index 0000000000000000000000000000000000000000..dad93156dd17ceefe3ebf6659bc46cb782416dd1 --- /dev/null +++ b/benchmark/persistence/address-book/spring/src/main/java/com/example/addressbookspring/ServletInitializer.java @@ -0,0 +1,13 @@ +package com.example.addressbookspring; + +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; + +public class ServletInitializer extends SpringBootServletInitializer { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application.sources(Application.class); + } + +} diff --git a/benchmark/persistence/address-book/spring/src/main/java/com/example/addressbookspring/config/JsfConfig.java b/benchmark/persistence/address-book/spring/src/main/java/com/example/addressbookspring/config/JsfConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..18cf52c04ef7d637b3349e4633ff1ce5dcd75f9f --- /dev/null +++ b/benchmark/persistence/address-book/spring/src/main/java/com/example/addressbookspring/config/JsfConfig.java @@ -0,0 +1,18 @@ +package com.example.addressbookspring.config; + +import jakarta.faces.webapp.FacesServlet; +import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class JsfConfig { + + @Bean + public ServletRegistrationBean facesServletRegistration() { + ServletRegistrationBean srb = + new ServletRegistrationBean<>(new FacesServlet(), "*.xhtml"); + srb.setLoadOnStartup(1); + return srb; + } +} diff --git a/benchmark/persistence/address-book/spring/src/main/java/com/example/addressbookspring/config/SpringConfig.java b/benchmark/persistence/address-book/spring/src/main/java/com/example/addressbookspring/config/SpringConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..d1ae899b3944e9cb4a85487e222a7d7635a51dc0 --- /dev/null +++ b/benchmark/persistence/address-book/spring/src/main/java/com/example/addressbookspring/config/SpringConfig.java @@ -0,0 +1,9 @@ +package com.example.addressbookspring.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.ComponentScan; + +@Configuration +@ComponentScan(basePackages = "com.example.addressbookspring") +public class SpringConfig { +} diff --git a/benchmark/persistence/address-book/spring/src/main/java/com/example/addressbookspring/entity/Contact.java b/benchmark/persistence/address-book/spring/src/main/java/com/example/addressbookspring/entity/Contact.java new file mode 100644 index 0000000000000000000000000000000000000000..a73565afcd9bf0e8f2a69613128c01e5a2ecf594 --- /dev/null +++ b/benchmark/persistence/address-book/spring/src/main/java/com/example/addressbookspring/entity/Contact.java @@ -0,0 +1,185 @@ +package com.example.addressbookspring.entity; + +import java.io.Serializable; +import java.util.Date; + +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Temporal; +import jakarta.persistence.TemporalType; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Past; +import jakarta.validation.constraints.Pattern; + + +@Entity +public class Contact implements Serializable { + + private static final long serialVersionUID = -825634229676522580L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + @NotNull + protected String firstName; + @NotNull + protected String lastName; + @Pattern(regexp = "[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\." + + "[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@" + + "(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9]" + + "(?:[a-z0-9-]*[a-z0-9])?", + message = "{invalid.email}") + protected String email; + @Pattern(regexp = "^\\(?(\\d{3})\\)?[- ]?(\\d{3})[- ]?(\\d{4})$", + message = "{invalid.phonenumber}") + protected String mobilePhone; + @Pattern(regexp = "^\\(?(\\d{3})\\)?[- ]?(\\d{3})[- ]?(\\d{4})$", + message = "{invalid.phonenumber}") + protected String homePhone; + @Temporal(TemporalType.DATE) + @Past + protected Date birthday; + + /** + * Get the value of birthday + * + * @return the value of birthday + */ + public Date getBirthday() { + return birthday; + } + + /** + * Set the value of birthday + * + * @param birthday new value of birthday + */ + public void setBirthday(Date birthday) { + this.birthday = birthday; + } + + /** + * Get the value of homePhone + * + * @return the value of homePhone + */ + public String getHomePhone() { + return homePhone; + } + + /** + * Set the value of homePhone + * + * @param homePhone new value of homePhone + */ + public void setHomePhone(String homePhone) { + this.homePhone = homePhone; + } + + /** + * Get the value of mobilePhone + * + * @return the value of mobilePhone + */ + public String getMobilePhone() { + return mobilePhone; + } + + /** + * Set the value of mobilePhone + * + * @param mobilePhone new value of mobilePhone + */ + public void setMobilePhone(String mobilePhone) { + this.mobilePhone = mobilePhone; + } + + /** + * Get the value of email + * + * @return the value of email + */ + public String getEmail() { + return email; + } + + /** + * Set the value of email + * + * @param email new value of email + */ + public void setEmail(String email) { + this.email = email; + } + + /** + * Get the value of lastName + * + * @return the value of lastName + */ + public String getLastName() { + return lastName; + } + + /** + * Set the value of lastName + * + * @param lastName new value of lastName + */ + public void setLastName(String lastName) { + this.lastName = lastName; + } + + /** + * Get the value of firstName + * + * @return the value of firstName + */ + public String getFirstName() { + return firstName; + } + + /** + * Set the value of firstName + * + * @param firstName new value of firstName + */ + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (id != null ? id.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Contact)) { + return false; + } + Contact other = (Contact) object; + if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "addressbookspring.entity.Contact[id=" + id + "]"; + } + +} diff --git a/benchmark/persistence/address-book/spring/src/main/java/com/example/addressbookspring/repo/ContactRepository.java b/benchmark/persistence/address-book/spring/src/main/java/com/example/addressbookspring/repo/ContactRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..f529bc331de4aa76040c7a4cd531d7abdb7bef7f --- /dev/null +++ b/benchmark/persistence/address-book/spring/src/main/java/com/example/addressbookspring/repo/ContactRepository.java @@ -0,0 +1,8 @@ +package com.example.addressbookspring.repo; + +import com.example.addressbookspring.entity.Contact; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface ContactRepository extends JpaRepository { } diff --git a/benchmark/persistence/address-book/spring/src/main/java/com/example/addressbookspring/service/ContactService.java b/benchmark/persistence/address-book/spring/src/main/java/com/example/addressbookspring/service/ContactService.java new file mode 100644 index 0000000000000000000000000000000000000000..c8294ae29efba9e3254e74512a055c0463e68139 --- /dev/null +++ b/benchmark/persistence/address-book/spring/src/main/java/com/example/addressbookspring/service/ContactService.java @@ -0,0 +1,60 @@ +package com.example.addressbookspring.service; + +import com.example.addressbookspring.entity.Contact; +import com.example.addressbookspring.repo.ContactRepository; +import org.springframework.data.domain.PageRequest; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Service +@Transactional +public class ContactService { + private final ContactRepository repo; + + public ContactService(ContactRepository repo) { + this.repo = repo; + } + + + public void create(Contact entity) { + repo.save(entity); + } + + public void edit(Contact entity) { + repo.save(entity); + } + + public void remove(Contact entity) { + if (entity == null) return; + Long id = entity.getId(); + if (id != null && repo.existsById(id)) { + repo.deleteById(id); + } else { + repo.delete(entity); + } + } + + public Contact find(Long id) { + return (id == null) ? null : repo.findById(id).orElse(null); + } + + public List findAll() { + return repo.findAll(); + } + + public List findRange(int[] range) { + int start = range[0]; + int endExclusive = range[1]; + int size = Math.max(0, endExclusive - start); + if (size <= 0) return List.of(); + int page = start / size; + return repo.findAll(PageRequest.of(page, size)).getContent(); + } + + public int count() { + long c = repo.count(); + return (c > Integer.MAX_VALUE) ? Integer.MAX_VALUE : (int) c; + } +} diff --git a/benchmark/persistence/address-book/spring/src/main/java/com/example/addressbookspring/web/ContactController.java b/benchmark/persistence/address-book/spring/src/main/java/com/example/addressbookspring/web/ContactController.java new file mode 100644 index 0000000000000000000000000000000000000000..aded9d983b80e90b2ddd7282641f24800382b375 --- /dev/null +++ b/benchmark/persistence/address-book/spring/src/main/java/com/example/addressbookspring/web/ContactController.java @@ -0,0 +1,245 @@ +package com.example.addressbookspring.web; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import java.util.ResourceBundle; +import org.springframework.context.annotation.Scope; +import jakarta.faces.context.FacesContext; +import jakarta.validation.Valid; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.example.addressbookspring.entity.Contact; +import com.example.addressbookspring.service.ContactService; + +@Component("contactController") +@Scope("session") +public class ContactController implements Serializable { + + private static final long serialVersionUID = -8163374738411860012L; + + @Autowired + private ContactService ejbFacade; + + private Contact current; + private List items = null; + private PaginationHelper pagination; + private int selectedItemIndex; + + public Contact getSelected() { + if (current == null) { + current = new Contact(); + selectedItemIndex = -1; + } + return current; + } + + private ContactService getFacade() { + return ejbFacade; + } + + public static abstract class PaginationHelper { + private final int pageSize; + private int page; + + protected PaginationHelper(int pageSize) { this.pageSize = pageSize; } + + public abstract int getItemsCount(); + + public abstract List createPageData(); + + public int getPageFirstItem() { + return page*pageSize; + } + + public int getPageLastItem() { + int i = getPageFirstItem() + pageSize -1; + int count = getItemsCount() - 1; + if (i > count) { + i = count; + } + if (i < 0) { + i = 0; + } + return i; + } + + public boolean isHasNextPage() { + return (page+1)*pageSize+1 <= getItemsCount(); + } + + public void nextPage() { + if (isHasNextPage()) { + page++; + } + } + + public boolean isHasPreviousPage() { + return page > 0; + } + + public void previousPage() { + if (isHasPreviousPage()) { + page--; + } + } + + public int getPageSize() { + return pageSize; + } + + } + + public PaginationHelper getPagination() { + if (pagination == null) { + pagination = new PaginationHelper(10) { + @Override + public int getItemsCount() { + return getFacade().count(); + } + + @Override + public List createPageData() { + int first = getPageFirstItem(); + int lastExclusive = getPageFirstItem() + getPageSize(); + return getFacade().findRange(new int[]{ first, lastExclusive }); + } + }; + } + return pagination; + } + + public String prepareList() { + recreateModel(); + return "List"; + } + + public String prepareView(Contact contact) { + current = contact; + selectedItemIndex = getItems().indexOf(contact); + return "View"; + } + + public String prepareCreate() { + current = new Contact(); + selectedItemIndex = -1; + return "Create"; + } + + public String create() { + try { + getFacade().create(current); + FacesContext.getCurrentInstance().addMessage(null, + new jakarta.faces.application.FacesMessage( + ResourceBundle.getBundle("Bundle").getString("ContactCreated"))); + return prepareCreate(); + } catch (Exception e) { + FacesContext.getCurrentInstance().addMessage(null, + new jakarta.faces.application.FacesMessage( + ResourceBundle.getBundle("Bundle").getString("PersistenceErrorOccured"))); + return null; + } + } + + public String prepareEdit(Contact contact) { + current = contact; + selectedItemIndex = getItems().indexOf(contact); + return "Edit"; + } + + public String update() { + try { + getFacade().edit(current); + FacesContext.getCurrentInstance().addMessage(null, + new jakarta.faces.application.FacesMessage( + ResourceBundle.getBundle("Bundle").getString("ContactUpdated"))); + return "View"; + } catch (Exception e) { + FacesContext.getCurrentInstance().addMessage(null, + new jakarta.faces.application.FacesMessage( + ResourceBundle.getBundle("Bundle").getString("PersistenceErrorOccured"))); + return null; + } + } + + public String destroy(Contact contact) { + current = contact; + selectedItemIndex = getItems().indexOf(contact); + performDestroy(); + recreateModel(); + return "List"; + } + + public String destroyAndView() { + performDestroy(); + recreateModel(); + updateCurrentItem(); + if (selectedItemIndex >= 0) { + return "View"; + } else { + recreateModel(); + return "List"; + } + } + + private void performDestroy() { + try { + getFacade().remove(current); + FacesContext.getCurrentInstance().addMessage(null, + new jakarta.faces.application.FacesMessage( + ResourceBundle.getBundle("Bundle").getString("ContactDeleted"))); + } catch (Exception e) { + FacesContext.getCurrentInstance().addMessage(null, + new jakarta.faces.application.FacesMessage( + ResourceBundle.getBundle("Bundle").getString("PersistenceErrorOccured"))); + } + } + + private void updateCurrentItem() { + int count = getFacade().count(); + if (selectedItemIndex >= count) { + selectedItemIndex = count - 1; + if (getPagination().getPageFirstItem() >= count) { + getPagination().previousPage(); + } + } + if (selectedItemIndex >= 0) { + current = getFacade().findRange(new int[]{ selectedItemIndex, selectedItemIndex + 1 }).get(0); + } else { + current = null; + } + } + + public List getItems() { + if (items == null) { + items = new ArrayList<>(getPagination().createPageData()); + } + return items; + } + + private void recreateModel() { + items = null; + } + + public String next() { + getPagination().nextPage(); + recreateModel(); + return "List"; + } + + public String previous() { + getPagination().previousPage(); + recreateModel(); + return "List"; + } + + public List getItemsAvailableSelectMany() { + return getFacade().findAll(); + } + + public List getItemsAvailableSelectOne() { + return getFacade().findAll(); + } +} \ No newline at end of file diff --git a/benchmark/persistence/address-book/spring/src/main/resources/Bundle.properties b/benchmark/persistence/address-book/spring/src/main/resources/Bundle.properties new file mode 100644 index 0000000000000000000000000000000000000000..02e0ea911cd21469a5b9b4f712721158d9bd87de --- /dev/null +++ b/benchmark/persistence/address-book/spring/src/main/resources/Bundle.properties @@ -0,0 +1,92 @@ +# +# Copyright (c), Eclipse Foundation, Inc. and its licensors. +# +# All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Distribution License v1.0, which is available at +# https://www.eclipse.org/org/documents/edl-v10.php +# +# SPDX-License-Identifier: BSD-3-Clause +# + +PersistenceErrorOccured=A persistence error occurred. +Previous=Previous +Next=Next + +ContactCreated=Contact was successfully created. +ContactUpdated=Contact was successfully updated. +ContactDeleted=Contact was successfully deleted. +CreateContactTitle=Create New Contact +CreateContactSaveLink=Save +CreateContactShowAllLink=Show All Contact Items +CreateContactIndexLink=Index +CreateContactLabel_birthday=Birthday: +CreateContactTitle_birthday=Birthday +CreateContactLabel_homePhone=Home Phone: +CreateContactTitle_homePhone=Home Phone +CreateContactLabel_mobilePhone=Mobile Phone: +CreateContactTitle_mobilePhone=Mobile Phone +CreateContactLabel_email=Email: +CreateContactTitle_email=Email +CreateContactLabel_lastName=Last Name: +CreateContactTitle_lastName=Last Name +CreateContactLabel_firstName=First Name: +CreateContactTitle_firstName=First Name +CreateContactLabel_id=Id: +CreateContactTitle_id=Id +EditContactTitle=Edit Contact +EditContactSaveLink=Save +EditContactViewLink=View +EditContactShowAllLink=Show All Contact Items +EditContactIndexLink=Index +EditContactLabel_birthday=Birthday: +EditContactTitle_birthday=Birthday +EditContactLabel_homePhone=Home Phone: +EditContactTitle_homePhone=Home Phone +EditContactLabel_mobilePhone=Mobile Phone: +EditContactTitle_mobilePhone=Mobile Phone +EditContactLabel_email=Email: +EditContactTitle_email=Email +EditContactLabel_lastName=Last Name: +EditContactTitle_lastName=Last Name +EditContactLabel_firstName=First Name: +EditContactTitle_firstName=First Name +EditContactLabel_id=Id: +EditContactTitle_id=Id +ViewContactTitle=View +ViewContactDestroyLink=Destroy +ViewContactEditLink=Edit +ViewContactCreateLink=Create New Contact +ViewContactShowAllLink=Show All Contact Items +ViewContactIndexLink=Index +ViewContactLabel_birthday=Birthday: +ViewContactTitle_birthday=Birthday +ViewContactLabel_homePhone=Home Phone: +ViewContactTitle_homePhone=Home Phone +ViewContactLabel_mobilePhone=Mobile Phone: +ViewContactTitle_mobilePhone=Mobile Phone +ViewContactLabel_email=Email: +ViewContactTitle_email=Email +ViewContactLabel_lastName=Last Name: +ViewContactTitle_lastName=Last Name +ViewContactLabel_firstName=First Name: +ViewContactTitle_firstName=First Name +ViewContactLabel_id=Id: +ViewContactTitle_id=Id +ListContactTitle=List +ListContactEmpty=(No Contact Items Found) +ListContactDestroyLink=Destroy +ListContactEditLink=Edit +ListContactViewLink=View +ListContactCreateLink=Create New Contact +ListContactIndexLink=Index +ListContactTitle_birthday=Birthday +ListContactTitle_homePhone=Home Phone +ListContactTitle_mobilePhone=Mobile Phone +ListContactTitle_email=Email +ListContactTitle_lastName=Last Name +ListContactTitle_firstName=First Name +ListContactTitle_id=Id + + diff --git a/benchmark/persistence/address-book/spring/src/main/resources/META-INF/faces-config.xml b/benchmark/persistence/address-book/spring/src/main/resources/META-INF/faces-config.xml new file mode 100644 index 0000000000000000000000000000000000000000..b40e8f98257159210b7472952111b20fb3bd005e --- /dev/null +++ b/benchmark/persistence/address-book/spring/src/main/resources/META-INF/faces-config.xml @@ -0,0 +1,15 @@ + + + + + + Bundle + bundle + + + + diff --git a/benchmark/persistence/address-book/spring/src/main/resources/META-INF/resources/contact/Create.xhtml b/benchmark/persistence/address-book/spring/src/main/resources/META-INF/resources/contact/Create.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..1fe9aa0f3f5af23f904d72b2d439f62de791fa93 --- /dev/null +++ b/benchmark/persistence/address-book/spring/src/main/resources/META-INF/resources/contact/Create.xhtml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+ + diff --git a/benchmark/persistence/address-book/spring/src/main/resources/META-INF/resources/contact/Edit.xhtml b/benchmark/persistence/address-book/spring/src/main/resources/META-INF/resources/contact/Edit.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..30d7874193e081773648d2b672ae9d9dd787bd40 --- /dev/null +++ b/benchmark/persistence/address-book/spring/src/main/resources/META-INF/resources/contact/Edit.xhtml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + diff --git a/benchmark/persistence/address-book/spring/src/main/resources/META-INF/resources/contact/List.xhtml b/benchmark/persistence/address-book/spring/src/main/resources/META-INF/resources/contact/List.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..02fb306caddffc42774d57fde54e65da273cd9f2 --- /dev/null +++ b/benchmark/persistence/address-book/spring/src/main/resources/META-INF/resources/contact/List.xhtml @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + +   +   +   + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+
+
+ + diff --git a/benchmark/persistence/address-book/spring/src/main/resources/META-INF/resources/contact/View.xhtml b/benchmark/persistence/address-book/spring/src/main/resources/META-INF/resources/contact/View.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..c42df45a989ccdc3a820fd02c8909e28d31d0d0c --- /dev/null +++ b/benchmark/persistence/address-book/spring/src/main/resources/META-INF/resources/contact/View.xhtml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+ +
+
+ + +
+
+
+ + diff --git a/benchmark/persistence/address-book/spring/src/main/resources/META-INF/resources/css/jsfcrud.css b/benchmark/persistence/address-book/spring/src/main/resources/META-INF/resources/css/jsfcrud.css new file mode 100644 index 0000000000000000000000000000000000000000..9ad890eb751df6c25998e4f1b4e77e3c4de70c5d --- /dev/null +++ b/benchmark/persistence/address-book/spring/src/main/resources/META-INF/resources/css/jsfcrud.css @@ -0,0 +1,122 @@ +/** + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +root { + display: block; +} + +body { + font-family: Univers, "Univers 55", "Lucida Grande CE", lucida, Helvetica, san-serif; + color: black; + background-color: white; + font-size: small; +} + +h1, h2, h3, h4 { + border-bottom: 1px solid #7F7F7F; + font-weight: bold; + margin: 0px; + padding: 0px; + color: #d20005; +} + +h1 { + font-size: 16px; +} + +h2 { + font-size: 14px; +} + +h3 { + font-size: 12px; +} + +h4 { + font-size: 10px; +} + +a:link, a:visited { + color: black; +} + +a:link:hover, a:visited:hover { + text-decoration: underline; + color: #d20005; +} + +table { + empty-cells: show; +} + +form.jsfcrud_list_form th, td th { + font-size: x-small; + color: #d20005; + border-top-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-right-style: solid; + border-top-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-right-width: 1px; + border-top-color: #cccccc; + border-bottom-color: #cccccc; + border-left-color: #999999; + border-right-color: #999999; + letter-spacing: 3px; + text-align: left; + padding-top: 6px; + padding-bottom: 6px; + padding-left: 6px; + padding-right: 6px; + background-color: white; +} + +td { + vertical-align: top; + padding-bottom: 8px; + font-size: small; +} + +form.jsfcrud_list_form td, td td { + border-top-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-right-style: solid; + border-top-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-right-width: 1px; + border-top-color: #cccccc; + border-bottom-color: #cccccc; + border-left-color: #999999; + border-right-color: #999999; + vertical-align: baseline; + padding-bottom: 0px; +} + +tr.jsfcrud_odd_row { + background-color: #e5e5e5; + color: black; +} + + +tr.jsfcrud_even_row { + background-color: #cccccc; + color: black; +} + +#busyImage { + position: absolute; + left: 50%; + top: 50%; +} diff --git a/benchmark/persistence/address-book/spring/src/main/resources/META-INF/resources/index.xhtml b/benchmark/persistence/address-book/spring/src/main/resources/META-INF/resources/index.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..f012e65017a32ea66400ce7043bd6f2c5eabca89 --- /dev/null +++ b/benchmark/persistence/address-book/spring/src/main/resources/META-INF/resources/index.xhtml @@ -0,0 +1,30 @@ + + + + + + Java Persistence API with JavaBeans Annotations Example + + + +

Welcome to the Address Book example.

+ +

+
+
+ + diff --git a/benchmark/persistence/address-book/spring/src/main/resources/META-INF/resources/template.xhtml b/benchmark/persistence/address-book/spring/src/main/resources/META-INF/resources/template.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..4581b49780fc8e0450c27f08f126e2988b0ff569 --- /dev/null +++ b/benchmark/persistence/address-book/spring/src/main/resources/META-INF/resources/template.xhtml @@ -0,0 +1,35 @@ + + + + + + + <ui:insert name="title">Default Title</ui:insert> + + + + +

+ Default Title +

+

+ Default Body +

+
+ + diff --git a/benchmark/persistence/address-book/spring/src/main/resources/ValidationMessages.properties b/benchmark/persistence/address-book/spring/src/main/resources/ValidationMessages.properties new file mode 100644 index 0000000000000000000000000000000000000000..c4eb065f57e93900b2eeae7c5ff2b4cd88d2749a --- /dev/null +++ b/benchmark/persistence/address-book/spring/src/main/resources/ValidationMessages.properties @@ -0,0 +1,15 @@ +# +# Copyright (c), Eclipse Foundation, Inc. and its licensors. +# +# All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Distribution License v1.0, which is available at +# https://www.eclipse.org/org/documents/edl-v10.php +# +# SPDX-License-Identifier: BSD-3-Clause +# + +# Validation message string for the JavaBeans Validation API +invalid.email=Not a valid email address. +invalid.phonenumber=Not a valid phone number. diff --git a/benchmark/persistence/address-book/spring/src/main/resources/application.properties b/benchmark/persistence/address-book/spring/src/main/resources/application.properties new file mode 100644 index 0000000000000000000000000000000000000000..a1e8d82570dca3e2b8621a9a8026831da7fa0675 --- /dev/null +++ b/benchmark/persistence/address-book/spring/src/main/resources/application.properties @@ -0,0 +1,15 @@ +spring.application.name=Address Book (Spring + JSF) +spring.datasource.url=jdbc:h2:mem:addressbook;DB_CLOSE_DELAY=-1 +spring.datasource.username=sa +spring.datasource.password= +spring.jpa.hibernate.ddl-auto=update +spring.jpa.show-sql=true +spring.mvc.format.date=MM/dd/yyyy +spring.messages.basename=Bundle,ValidationMessages +server.port=8080 + +# JSF Configuration +joinfaces.faces-servlet.enabled=true +joinfaces.faces-servlet.url-mappings=*.xhtml,/faces/* +joinfaces.jsf.project-stage=Development + diff --git a/benchmark/persistence/address-book/spring/test.sh b/benchmark/persistence/address-book/spring/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..21784743b019b9893b6c1981b7bb76709e960d6b --- /dev/null +++ b/benchmark/persistence/address-book/spring/test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +BASE_URL="${BASE_URL:-http://localhost:8080}" + +echo "Health check: ${BASE_URL}/" +HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}/") + +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "PASS - got HTTP ${HTTP_STATUS}" + exit 0 +else + echo "FAIL - got HTTP ${HTTP_STATUS}" + exit 1 +fi diff --git a/benchmark/persistence/order/jakarta/.dockerignore b/benchmark/persistence/order/jakarta/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..c634c57d9244b4e60b8fa936f09dbe4e75706e74 --- /dev/null +++ b/benchmark/persistence/order/jakarta/.dockerignore @@ -0,0 +1,41 @@ +# VCS +.git/ + +# Maven +.mvn/ +**/.mvn/ +mvnw +mvnw.cmd +**/mvnw +**/mvnw.cmd +target/ +**/target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties + +# IDE / Editor +.vscode/ +**/.vscode/ +.zed/ +**/.zed/ +.idea/ +**/.idea/ +*.iml +*.ipr +*.iws + +# OS +.DS_Store +**/.DS_Store +Thumbs.db +ehthumbs.db + +# Logs / temp +*.log +*.tmp +*.temp diff --git a/benchmark/persistence/order/jakarta/.mvn/wrapper/maven-wrapper.properties b/benchmark/persistence/order/jakarta/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..8dea6c227c08000d2400d38a2ac886063f22bc36 --- /dev/null +++ b/benchmark/persistence/order/jakarta/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,3 @@ +wrapperVersion=3.3.4 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.12/apache-maven-3.9.12-bin.zip diff --git a/benchmark/persistence/order/jakarta/Dockerfile b/benchmark/persistence/order/jakarta/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..bb9aafb1cb951a1ab54c776a26843385260532e8 --- /dev/null +++ b/benchmark/persistence/order/jakarta/Dockerfile @@ -0,0 +1,28 @@ +FROM maven:3.9.12-ibm-semeru-21-noble + +USER root +# install uv +RUN apt-get update && apt-get install -y --no-install-recommends curl python3-venv python3-full && curl -LsSf https://astral.sh/uv/install.sh | sh + +ENV PATH="/root/.local/bin:$PATH" + +# Shared browsers path so Chromium is cached once +ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright +RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright + +# create venv and install +RUN uv venv /opt/venv && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest + +ENV PATH="/opt/venv/bin:$PATH" +RUN playwright install --with-deps chromium + +# Set working directory +WORKDIR /app + +# Copy all the assets +COPY . . + +COPY test.sh . +RUN chmod +x test.sh +RUN mvn clean install -DskipTests +CMD [ "mvn", "liberty:run" ] diff --git a/benchmark/persistence/order/jakarta/mvnw b/benchmark/persistence/order/jakarta/mvnw new file mode 100644 index 0000000000000000000000000000000000000000..bd8896bf2217b46faa0291585e01ac1a3441a958 --- /dev/null +++ b/benchmark/persistence/order/jakarta/mvnw @@ -0,0 +1,295 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.4 +# +# Optional ENV vars +# ----------------- +# JAVA_HOME - location of a JDK home dir, required when download maven via java source +# MVNW_REPOURL - repo url base for downloading maven distribution +# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output +# ---------------------------------------------------------------------------- + +set -euf +[ "${MVNW_VERBOSE-}" != debug ] || set -x + +# OS specific support. +native_path() { printf %s\\n "$1"; } +case "$(uname)" in +CYGWIN* | MINGW*) + [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" + native_path() { cygpath --path --windows "$1"; } + ;; +esac + +# set JAVACMD and JAVACCMD +set_java_home() { + # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched + if [ -n "${JAVA_HOME-}" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACCMD="$JAVA_HOME/jre/sh/javac" + else + JAVACMD="$JAVA_HOME/bin/java" + JAVACCMD="$JAVA_HOME/bin/javac" + + if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then + echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 + echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 + return 1 + fi + fi + else + JAVACMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v java + )" || : + JAVACCMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v javac + )" || : + + if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then + echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 + return 1 + fi + fi +} + +# hash string like Java String::hashCode +hash_string() { + str="${1:-}" h=0 + while [ -n "$str" ]; do + char="${str%"${str#?}"}" + h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) + str="${str#?}" + done + printf %x\\n $h +} + +verbose() { :; } +[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } + +die() { + printf %s\\n "$1" >&2 + exit 1 +} + +trim() { + # MWRAPPER-139: + # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. + # Needed for removing poorly interpreted newline sequences when running in more + # exotic environments such as mingw bash on Windows. + printf "%s" "${1}" | tr -d '[:space:]' +} + +scriptDir="$(dirname "$0")" +scriptName="$(basename "$0")" + +# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties +while IFS="=" read -r key value; do + case "${key-}" in + distributionUrl) distributionUrl=$(trim "${value-}") ;; + distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; + esac +done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" + +case "${distributionUrl##*/}" in +maven-mvnd-*bin.*) + MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ + case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in + *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; + :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; + :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; + :Linux*x86_64*) distributionPlatform=linux-amd64 ;; + *) + echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 + distributionPlatform=linux-amd64 + ;; + esac + distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" + ;; +maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; +*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; +esac + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" +distributionUrlName="${distributionUrl##*/}" +distributionUrlNameMain="${distributionUrlName%.*}" +distributionUrlNameMain="${distributionUrlNameMain%-bin}" +MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" +MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" + +exec_maven() { + unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : + exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" +} + +if [ -d "$MAVEN_HOME" ]; then + verbose "found existing MAVEN_HOME at $MAVEN_HOME" + exec_maven "$@" +fi + +case "${distributionUrl-}" in +*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; +*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; +esac + +# prepare tmp dir +if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then + clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } + trap clean HUP INT TERM EXIT +else + die "cannot create temp dir" +fi + +mkdir -p -- "${MAVEN_HOME%/*}" + +# Download and Install Apache Maven +verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +verbose "Downloading from: $distributionUrl" +verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +# select .zip or .tar.gz +if ! command -v unzip >/dev/null; then + distributionUrl="${distributionUrl%.zip}.tar.gz" + distributionUrlName="${distributionUrl##*/}" +fi + +# verbose opt +__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' +[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v + +# normalize http auth +case "${MVNW_PASSWORD:+has-password}" in +'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; +has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; +esac + +if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then + verbose "Found wget ... using wget" + wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" +elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then + verbose "Found curl ... using curl" + curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" +elif set_java_home; then + verbose "Falling back to use Java to download" + javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" + targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" + cat >"$javaSource" <<-END + public class Downloader extends java.net.Authenticator + { + protected java.net.PasswordAuthentication getPasswordAuthentication() + { + return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); + } + public static void main( String[] args ) throws Exception + { + setDefault( new Downloader() ); + java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); + } + } + END + # For Cygwin/MinGW, switch paths to Windows format before running javac and java + verbose " - Compiling Downloader.java ..." + "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" + verbose " - Running Downloader.java ..." + "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" +fi + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +if [ -n "${distributionSha256Sum-}" ]; then + distributionSha256Result=false + if [ "$MVN_CMD" = mvnd.sh ]; then + echo "Checksum validation is not supported for maven-mvnd." >&2 + echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + elif command -v sha256sum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then + distributionSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $distributionSha256Result = false ]; then + echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 + echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 + exit 1 + fi +fi + +# unzip and move +if command -v unzip >/dev/null; then + unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" +else + tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" +fi + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +actualDistributionDir="" + +# First try the expected directory name (for regular distributions) +if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then + if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then + actualDistributionDir="$distributionUrlNameMain" + fi +fi + +# If not found, search for any directory with the Maven executable (for snapshots) +if [ -z "$actualDistributionDir" ]; then + # enable globbing to iterate over items + set +f + for dir in "$TMP_DOWNLOAD_DIR"/*; do + if [ -d "$dir" ]; then + if [ -f "$dir/bin/$MVN_CMD" ]; then + actualDistributionDir="$(basename "$dir")" + break + fi + fi + done + set -f +fi + +if [ -z "$actualDistributionDir" ]; then + verbose "Contents of $TMP_DOWNLOAD_DIR:" + verbose "$(ls -la "$TMP_DOWNLOAD_DIR")" + die "Could not find Maven distribution directory in extracted archive" +fi + +verbose "Found extracted Maven distribution directory: $actualDistributionDir" +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" + +clean || : +exec_maven "$@" diff --git a/benchmark/persistence/order/jakarta/mvnw.cmd b/benchmark/persistence/order/jakarta/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..5761d948924c19571d27b465c519b2e2f9e30351 --- /dev/null +++ b/benchmark/persistence/order/jakarta/mvnw.cmd @@ -0,0 +1,189 @@ +<# : batch portion +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.4 +@REM +@REM Optional ENV vars +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output +@REM ---------------------------------------------------------------------------- + +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) +) +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> + +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} + +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} + +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' + +$MAVEN_M2_PATH = "$HOME/.m2" +if ($env:MAVEN_USER_HOME) { + $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME" +} + +if (-not (Test-Path -Path $MAVEN_M2_PATH)) { + New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null +} + +$MAVEN_WRAPPER_DISTS = $null +if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) { + $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists" +} else { + $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists" +} + +$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain" +$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" + +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} + +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} + +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} + +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null + +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +$actualDistributionDir = "" + +# First try the expected directory name (for regular distributions) +$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain" +$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD" +if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) { + $actualDistributionDir = $distributionUrlNameMain +} + +# If not found, search for any directory with the Maven executable (for snapshots) +if (!$actualDistributionDir) { + Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object { + $testPath = Join-Path $_.FullName "bin/$MVN_CMD" + if (Test-Path -Path $testPath -PathType Leaf) { + $actualDistributionDir = $_.Name + } + } +} + +if (!$actualDistributionDir) { + Write-Error "Could not find Maven distribution directory in extracted archive" +} + +Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir" +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/benchmark/persistence/order/jakarta/pom.xml b/benchmark/persistence/order/jakarta/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..6c77ead8c37af2c64c3dde491a9383be95ad49a9 --- /dev/null +++ b/benchmark/persistence/order/jakarta/pom.xml @@ -0,0 +1,74 @@ + + + + 4.0.0 + + jakarta.examples.tutorial.persistence + order + 10-SNAPSHOT + war + order + + + 17 + UTF-8 + 2.2.224 + + + + + jakarta.platform + jakarta.jakartaee-web-api + 10.0.0 + provided + + + com.h2database + h2 + ${h2.version} + + + + + + + maven-war-plugin + 3.4.0 + + false + + + + io.openliberty.tools + liberty-maven-plugin + 3.10 + + + + ${project.build.directory}/liberty/wlp/usr/shared/resources + + com.h2database + h2 + ${h2.version} + + + + + + + + diff --git a/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/ejb/ConfigBean.java b/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/ejb/ConfigBean.java new file mode 100644 index 0000000000000000000000000000000000000000..1e6ce6738aef76f60ff9374c4133ae815b894988 --- /dev/null +++ b/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/ejb/ConfigBean.java @@ -0,0 +1,90 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.order.ejb; + +import jakarta.annotation.PostConstruct; +import jakarta.annotation.PreDestroy; +import jakarta.ejb.EJB; +import jakarta.ejb.Singleton; +import jakarta.ejb.Startup; + +/** + * + * @author ian + */ +@Singleton +@Startup +public class ConfigBean { + + @EJB + private RequestBean request; + + @PostConstruct + public void createData() { + request.createPart("1234-5678-01", 1, "ABC PART", + new java.util.Date(), "PARTQWERTYUIOPASXDCFVGBHNJMKL", null); + request.createPart("9876-4321-02", 2, "DEF PART", + new java.util.Date(), "PARTQWERTYUIOPASXDCFVGBHNJMKL", null); + request.createPart("5456-6789-03", 3, "GHI PART", + new java.util.Date(), "PARTQWERTYUIOPASXDCFVGBHNJMKL", null); + request.createPart("ABCD-XYZW-FF", 5, "XYZ PART", + new java.util.Date(), "PARTQWERTYUIOPASXDCFVGBHNJMKL", null); + request.createPart("SDFG-ERTY-BN", 7, "BOM PART", + new java.util.Date(), "PARTQWERTYUIOPASXDCFVGBHNJMKL", null); + + request.addPartToBillOfMaterial("SDFG-ERTY-BN", 7, + "1234-5678-01", 1); + request.addPartToBillOfMaterial("SDFG-ERTY-BN", 7, + "9876-4321-02", 2); + request.addPartToBillOfMaterial("SDFG-ERTY-BN", 7, + "5456-6789-03", 3); + request.addPartToBillOfMaterial("SDFG-ERTY-BN", 7, + "ABCD-XYZW-FF", 5); + + request.createVendor(100, "WidgetCorp", + "111 Main St., Anytown, KY 99999", "Mr. Jones", + "888-777-9999"); + request.createVendor(200, "Gadget, Inc.", + "123 State St., Sometown, MI 88888", "Mrs. Smith", + "866-345-6789"); + + request.createVendorPart("1234-5678-01", 1, + "PART1", 100.00, 100); + request.createVendorPart("9876-4321-02", 2, + "PART2", 10.44, 200); + request.createVendorPart("5456-6789-03", 3, + "PART3", 76.23, 200); + request.createVendorPart("ABCD-XYZW-FF", 5, + "PART4", 55.19, 100); + request.createVendorPart("SDFG-ERTY-BN", 7, + "PART5", 345.87, 100); + + Integer orderId = 1111; + request.createOrder(orderId, 'N', 10, + "333 New Court, New City, CA 90000"); + request.addLineItem(orderId, "1234-5678-01", 1, 3); + request.addLineItem(orderId, "9876-4321-02", 2, 5); + request.addLineItem(orderId, "ABCD-XYZW-FF", 5, 7); + + orderId = 4312; + request.createOrder(orderId, 'N', 0, + "333 New Court, New City, CA 90000"); + request.addLineItem(orderId, "SDFG-ERTY-BN", 7, 1); + request.addLineItem(orderId, "ABCD-XYZW-FF", 5, 3); + request.addLineItem(orderId, "1234-5678-01", 1, 15); + } + + @PreDestroy + public void deleteData() { + + } +} diff --git a/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/ejb/RequestBean.java b/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/ejb/RequestBean.java new file mode 100644 index 0000000000000000000000000000000000000000..7ae4a6154d0b98d081c1f7388de45dd826670396 --- /dev/null +++ b/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/ejb/RequestBean.java @@ -0,0 +1,304 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.order.ejb; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import jakarta.ejb.EJBException; +import jakarta.ejb.Stateful; +import jakarta.persistence.EntityManager; +import jakarta.persistence.PersistenceContext; +import jakarta.tutorial.order.entity.CustomerOrder; +import jakarta.tutorial.order.entity.LineItem; +import jakarta.tutorial.order.entity.Part; +import jakarta.tutorial.order.entity.PartKey; +import jakarta.tutorial.order.entity.Vendor; +import jakarta.tutorial.order.entity.VendorPart; + + +@Stateful +public class RequestBean { + + @PersistenceContext + private EntityManager em; + + private static final Logger logger = Logger.getLogger("order.ejb.RequestBean"); + + public void createPart(String partNumber, + int revision, + String description, + java.util.Date revisionDate, + String specification, + Serializable drawing) { + try { + Part part = new Part(partNumber, + revision, + description, + revisionDate, + specification, + drawing); + logger.log(Level.INFO, "Created part {0}-{1}", new Object[]{partNumber, revision}); + em.persist(part); + logger.log(Level.INFO, "Persisted part {0}-{1}", new Object[]{partNumber, revision}); + } catch (Exception ex) { + throw new EJBException(ex.getMessage()); + } + } + + public List getAllParts() { + List parts = (List) em.createNamedQuery("findAllParts").getResultList(); + return parts; + } + + public void addPartToBillOfMaterial(String bomPartNumber, + int bomRevision, + String partNumber, + int revision) { + logger.log(Level.INFO, "BOM part number: {0}", bomPartNumber); + logger.log(Level.INFO, "BOM revision: {0}", bomRevision); + logger.log(Level.INFO, "Part number: {0}", partNumber); + logger.log(Level.INFO, "Part revision: {0}", revision); + try { + PartKey bomKey = new PartKey(); + bomKey.setPartNumber(bomPartNumber); + bomKey.setRevision(bomRevision); + + Part bom = em.find(Part.class, bomKey); + logger.log(Level.INFO, "BOM Part found: {0}", bom.getPartNumber()); + + PartKey partKey = new PartKey(); + partKey.setPartNumber(partNumber); + partKey.setRevision(revision); + + Part part = em.find(Part.class, partKey); + logger.log(Level.INFO, "Part found: {0}", part.getPartNumber()); + bom.getParts().add(part); + part.setBomPart(bom); + } catch (EJBException e) { + } + } + + public void createVendor(int vendorId, + String name, + String address, + String contact, + String phone) { + try { + Vendor vendor = new Vendor(vendorId, name, address, contact, phone); + em.persist(vendor); + } catch (Exception e) { + throw new EJBException(e); + } + } + + public void createVendorPart(String partNumber, + int revision, + String description, + double price, + int vendorId) { + try { + PartKey pkey = new PartKey(); + pkey.setPartNumber(partNumber); + pkey.setRevision(revision); + + Part part = em.find(Part.class, pkey); + + VendorPart vendorPart = new VendorPart(description, price, part); + em.persist(vendorPart); + + Vendor vendor = em.find(Vendor.class, vendorId); + vendor.addVendorPart(vendorPart); + vendorPart.setVendor(vendor); + } catch (Exception e) { + throw new EJBException(e.getMessage()); + } + } + + public void createOrder(Integer orderId, char status, int discount, String shipmentInfo) { + try { + CustomerOrder order = new CustomerOrder(orderId, status, discount, shipmentInfo); + em.persist(order); + } catch (Exception e) { + throw new EJBException(e.getMessage()); + } + } + + public List getOrders() { + try { + return (List) em.createNamedQuery("findAllOrders").getResultList(); + } catch (Exception e) { + throw new EJBException(e.getMessage()); + } + } + + public void addLineItem(Integer orderId, String partNumber, int revision, int quantity) { + try { + CustomerOrder order = em.find(CustomerOrder.class, orderId); + logger.log(Level.INFO, "Found order ID {0}", orderId); + + PartKey pkey = new PartKey(); + pkey.setPartNumber(partNumber); + pkey.setRevision(revision); + + Part part = em.find(Part.class, pkey); + + LineItem lineItem = new LineItem(order, quantity, part.getVendorPart()); + order.addLineItem(lineItem); + } catch (Exception e) { + logger.log(Level.WARNING, "Couldn''t add {0} to order ID {1}.", new Object[]{partNumber, orderId}); + throw new EJBException(e.getMessage()); + } + } + + public double getBillOfMaterialPrice(String bomPartNumber, int bomRevision, String partNumber, int revision) { + double price = 0.0; + try { + PartKey bomkey = new PartKey(); + bomkey.setPartNumber(bomPartNumber); + bomkey.setRevision(bomRevision); + + Part bom = em.find(Part.class, bomkey); + Collection parts = bom.getParts(); + for (Part part : parts) { + VendorPart vendorPart = part.getVendorPart(); + price += vendorPart.getPrice(); + } + + } catch (Exception e) { + throw new EJBException(e.getMessage()); + } + return price; + } + + public double getOrderPrice(Integer orderId) { + double price = 0.0; + try { + CustomerOrder order = em.find(CustomerOrder.class, orderId); + price = order.calculateAmmount(); + } catch (Exception e) { + throw new EJBException(e.getMessage()); + } + return price; + } + + public void adjustOrderDiscount(int adjustment) { + try { + List orders = em.createNamedQuery( + "findAllOrders") + .getResultList(); + for (Iterator it = orders.iterator(); it.hasNext();) { + CustomerOrder order = (CustomerOrder)it.next(); + int newDiscount = order.getDiscount() + adjustment; + order.setDiscount((newDiscount > 0)? newDiscount : 0); + } + } catch (Exception e) { + throw new EJBException(e.getMessage()); + } + } + + public Double getAvgPrice() { + try { + return (Double) em.createNamedQuery( + "findAverageVendorPartPrice") + .getSingleResult(); + } catch (Exception e) { + throw new EJBException(e.getMessage()); + } + } + + public Double getTotalPricePerVendor(int vendorId) { + try { + return (Double) em.createNamedQuery( + "findTotalVendorPartPricePerVendor") + .setParameter("id", vendorId) + .getSingleResult(); + } catch (Exception e) { + throw new EJBException(e.getMessage()); + } + } + + public List locateVendorsByPartialName(String name) { + + List names = new ArrayList<>(); + try { + List vendors = em.createNamedQuery( + "findVendorsByPartialName") + .setParameter("name", name) + .getResultList(); + for (Iterator iterator = vendors.iterator(); iterator.hasNext();) { + Vendor vendor = (Vendor)iterator.next(); + names.add(vendor.getName()); + } + } catch (Exception e) { + throw new EJBException(e.getMessage()); + } + return names; + } + + public int countAllItems() { + int count = 0; + try { + count = em.createNamedQuery( + "findAllLineItems") + .getResultList() + .size(); + } catch (Exception e) { + throw new EJBException(e.getMessage()); + } + return count; + } + + public List getLineItems(int orderId) { + try { + return em.createNamedQuery("findLineItemsByOrderId") + .setParameter("orderId", orderId) + .getResultList(); + } catch (Exception e) { + throw new EJBException(e.getMessage()); + } + } + + public void removeOrder(Integer orderId) { + try { + CustomerOrder order = em.find(CustomerOrder.class, orderId); + em.remove(order); + } catch (Exception e) { + throw new EJBException(e.getMessage()); + } + } + + public String reportVendorsByOrder(Integer orderId) { + StringBuilder report = new StringBuilder(); + try { + List vendors = em.createNamedQuery( + "findVendorByOrder") + .setParameter("id", orderId) + .getResultList(); + for (Iterator iterator = vendors.iterator(); iterator.hasNext();) { + Vendor vendor = (Vendor)iterator.next(); + report.append(vendor.getVendorId()).append(' ') + .append(vendor.getName()).append(' ') + .append(vendor.getContact()).append('\n'); + } + + } catch (Exception e) { + throw new EJBException(e); + } + return report.toString(); + } +} diff --git a/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/entity/CustomerOrder.java b/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/entity/CustomerOrder.java new file mode 100644 index 0000000000000000000000000000000000000000..46bcf6ab1be4ef8a348f350657b510d0a46f185c --- /dev/null +++ b/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/entity/CustomerOrder.java @@ -0,0 +1,128 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.order.entity; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; + +import jakarta.persistence.CascadeType; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.NamedQuery; +import jakarta.persistence.OneToMany; +import jakarta.persistence.Table; +import jakarta.persistence.Temporal; +import jakarta.persistence.TemporalType; +import jakarta.persistence.Transient; + +@Entity +@Table(name="PERSISTENCE_ORDER_CUSTOMERORDER") +@NamedQuery( + name="findAllOrders", + query="SELECT co FROM CustomerOrder co " + + "ORDER BY co.orderId" +) +public class CustomerOrder implements java.io.Serializable { + private static final long serialVersionUID = 6582105865012174694L; + private Integer orderId; + private char status; + private Date lastUpdate; + private int discount; + private String shipmentInfo; + private Collection lineItems; + + public CustomerOrder() { + this.lastUpdate = new Date(); + this.lineItems = new ArrayList<>(); + } + + public CustomerOrder(Integer orderId, char status, int discount, + String shipmentInfo) { + this.orderId = orderId; + this.status = status; + this.discount = discount; + this.shipmentInfo = shipmentInfo; + this.lastUpdate = new Date(); + this.lineItems = new ArrayList<>(); + } + + @Id + public Integer getOrderId() { + return orderId; + } + + public void setOrderId(Integer orderId) { + this.orderId = orderId; + } + + public char getStatus() { + return status; + } + + public void setStatus(char status) { + this.status = status; + } + + @Temporal(TemporalType.TIMESTAMP) + public Date getLastUpdate() { + return lastUpdate; + } + + public void setLastUpdate(Date lastUpdate) { + this.lastUpdate = lastUpdate; + } + + public int getDiscount() { + return discount; + } + + public void setDiscount(int discount) { + this.discount = discount; + } + + public String getShipmentInfo() { + return shipmentInfo; + } + + public void setShipmentInfo(String shipmentInfo) { + this.shipmentInfo = shipmentInfo; + } + + @OneToMany(cascade=CascadeType.ALL, mappedBy="customerOrder") + public Collection getLineItems() { + return lineItems; + } + + public void setLineItems(Collection lineItems) { + this.lineItems = lineItems; + } + + public double calculateAmmount() { + double ammount = 0; + Collection items = getLineItems(); + for (LineItem item : items) { + VendorPart part = item.getVendorPart(); + ammount += part.getPrice() * item.getQuantity(); + } + return (ammount * (100 - getDiscount()))/100; + } + + public void addLineItem(LineItem lineItem) { + this.getLineItems().add(lineItem); + } + + @Transient + public int getNextId() { + return this.lineItems.size() + 1; + } +} diff --git a/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/entity/LineItem.java b/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/entity/LineItem.java new file mode 100644 index 0000000000000000000000000000000000000000..35af87d46793ad41819af3001acdc2274094c0fa --- /dev/null +++ b/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/entity/LineItem.java @@ -0,0 +1,96 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.order.entity; + +import java.io.Serializable; + +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.IdClass; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.NamedQueries; +import jakarta.persistence.NamedQuery; +import jakarta.persistence.Table; + +@IdClass(LineItemKey.class) +@Entity +@Table(name="PERSISTENCE_ORDER_LINEITEM") +@NamedQueries({ + @NamedQuery( + name="findAllLineItems", + query="SELECT l " + + "FROM LineItem l"), + @NamedQuery( + name="findLineItemsByOrderId", + query="SELECT l FROM LineItem l " + + "WHERE l.customerOrder.orderId = :orderId " + + "ORDER BY l.itemId"), + @NamedQuery( + name="findLineItemById", + query="SELECT DISTINCT l FROM LineItem l " + + "WHERE l.itemId = :itemId AND l.customerOrder.orderId = :orderId") +}) +public class LineItem implements Serializable { + private static final long serialVersionUID = 3229188813505619743L; + private int itemId; + private int quantity; + private VendorPart vendorPart; + private CustomerOrder customerOrder; + + public LineItem() {} + + public LineItem(CustomerOrder order, int quantity, VendorPart vendorPart) { + this.customerOrder = order; + this.itemId = order.getNextId(); + this.quantity = quantity; + this.vendorPart = vendorPart; + } + + @Id + public int getItemId() { + return itemId; + } + + public void setItemId(int itemId) { + this.itemId = itemId; + } + + public int getQuantity() { + return quantity; + } + + public void setQuantity(int quantity) { + this.quantity = quantity; + } + + @JoinColumn(name="VENDORPARTNUMBER") + @ManyToOne + public VendorPart getVendorPart() { + return vendorPart; + } + + public void setVendorPart(VendorPart vendorPart) { + this.vendorPart = vendorPart; + } + + @Id + @ManyToOne + @JoinColumn(name="ORDERID") + public CustomerOrder getCustomerOrder() { + return customerOrder; + } + + public void setCustomerOrder(CustomerOrder customerOrder) { + this.customerOrder = customerOrder; + } +} diff --git a/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/entity/LineItemKey.java b/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/entity/LineItemKey.java new file mode 100644 index 0000000000000000000000000000000000000000..8f060cfbc6ff3087e2f01a22372fc2e8ee01a049 --- /dev/null +++ b/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/entity/LineItemKey.java @@ -0,0 +1,73 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.order.entity; + +import java.io.Serializable; + +public final class LineItemKey implements Serializable { + + private static final long serialVersionUID = 1562260205094677677L; + private Integer customerOrder; + private int itemId; + + public LineItemKey() { + } + + public LineItemKey(Integer order, int itemId) { + this.setCustomerOrder(order); + this.setItemId(itemId); + } + + @Override + public int hashCode() { + return ((this.getCustomerOrder() == null + ? 0 : this.getCustomerOrder().hashCode()) + ^ ((int) this.getItemId())); + } + + @Override + public boolean equals(Object otherOb) { + + if (this == otherOb) { + return true; + } + if (!(otherOb instanceof LineItemKey)) { + return false; + } + LineItemKey other = (LineItemKey) otherOb; + return ((this.getCustomerOrder() == null + ? other.getCustomerOrder() == null : this.getCustomerOrder() + .equals(other.getCustomerOrder())) + && (this.getItemId() == other.getItemId())); + } + + @Override + public String toString() { + return "" + getCustomerOrder() + "-" + getItemId(); + } + + public Integer getCustomerOrder() { + return customerOrder; + } + + public void setCustomerOrder(Integer order) { + this.customerOrder = order; + } + + public int getItemId() { + return itemId; + } + + public void setItemId(int itemId) { + this.itemId = itemId; + } +} diff --git a/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/entity/Part.java b/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/entity/Part.java new file mode 100644 index 0000000000000000000000000000000000000000..968e809b48b38f344da39e828ed83675d0558cbc --- /dev/null +++ b/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/entity/Part.java @@ -0,0 +1,164 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.order.entity; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.IdClass; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.JoinColumns; +import jakarta.persistence.Lob; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.NamedQuery; +import jakarta.persistence.OneToMany; +import jakarta.persistence.OneToOne; +import jakarta.persistence.PrimaryKeyJoinColumn; +import jakarta.persistence.SecondaryTable; +import jakarta.persistence.Table; +import jakarta.persistence.Temporal; +import jakarta.persistence.TemporalType; + +@IdClass(PartKey.class) +@Entity +@Table(name="PERSISTENCE_ORDER_PART") +@SecondaryTable(name="PERSISTENCE_ORDER_PART_DETAIL", pkJoinColumns={ + @PrimaryKeyJoinColumn(name="PARTNUMBER", referencedColumnName="PARTNUMBER"), + @PrimaryKeyJoinColumn(name="REVISION", referencedColumnName="REVISION") +}) +@NamedQuery( + name="findAllParts", + query="SELECT p FROM Part p " + + "ORDER BY p.partNumber" +) +public class Part implements Serializable { + private static final long serialVersionUID = -3082087016342644227L; + private String partNumber; + private int revision; + private String description; + private Date revisionDate; + private Serializable drawing; + private String specification; + private Part bomPart; + private List parts; + private VendorPart vendorPart; + + public Part() {} + + public Part(String partNumber, + int revision, + String description, + Date revisionDate, + String specification, + Serializable drawing) { + this.partNumber = partNumber; + this.revision = revision; + this.description = description; + this.revisionDate = revisionDate; + this.specification = specification; + this.drawing = drawing; + this.parts = new ArrayList<>(); + } + + @Id + @Column(nullable=false) + public String getPartNumber() { + return partNumber; + } + + public void setPartNumber(String partNumber) { + this.partNumber = partNumber; + } + + @Id + @Column(nullable=false) + public int getRevision() { + return revision; + } + + public void setRevision(int revision) { + this.revision = revision; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @Temporal(TemporalType.DATE) + public Date getRevisionDate() { + return revisionDate; + } + + public void setRevisionDate(Date revisionDate) { + this.revisionDate = revisionDate; + } + + @Column(table="PERSISTENCE_ORDER_PART_DETAIL") + @Lob + public Serializable getDrawing() { + return drawing; + } + + public void setDrawing(Serializable drawing) { + this.drawing = drawing; + } + + @Column(table="PERSISTENCE_ORDER_PART_DETAIL") + @Lob + public String getSpecification() { + return specification; + } + + public void setSpecification(String specification) { + this.specification = specification; + } + + @ManyToOne + @JoinColumns({ + @JoinColumn(name="BOMPARTNUMBER", referencedColumnName="PARTNUMBER"), + @JoinColumn(name="BOMREVISION", referencedColumnName="REVISION") + }) + public Part getBomPart() { + return bomPart; + } + + public void setBomPart(Part bomPart) { + this.bomPart = bomPart; + } + + @OneToMany(mappedBy="bomPart") + public List getParts() { + return parts; + } + + public void setParts(List parts) { + this.parts = parts; + } + + @OneToOne(mappedBy="part") + public VendorPart getVendorPart() { + return vendorPart; + } + + public void setVendorPart(VendorPart vendorPart) { + this.vendorPart = vendorPart; + } +} diff --git a/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/entity/PartKey.java b/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/entity/PartKey.java new file mode 100644 index 0000000000000000000000000000000000000000..1acf1ed44f4f92a620758b955b737d1609023415 --- /dev/null +++ b/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/entity/PartKey.java @@ -0,0 +1,71 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.order.entity; + +import java.io.Serializable; + +/** + * + * @author ian + */ +public class PartKey implements Serializable { + private static final long serialVersionUID = -3162267592969127613L; + private String partNumber; + private int revision; + + @Override + public int hashCode() { + return ( + (this.getPartNumber()==null?0:this.getPartNumber().hashCode()) + ^ + ((int) this.getRevision()) + ); + } + + @Override + public boolean equals(Object otherOb) { + + if (this == otherOb) { + return true; + } + if (!(otherOb instanceof PartKey)) { + return false; + } + PartKey other = (PartKey) otherOb; + return ( + (this.getPartNumber()==null?other.getPartNumber()==null:this.getPartNumber().equals(other.getPartNumber())) + && + (getRevision() == other.getRevision()) + ); + } + + @Override + public String toString() { + return getPartNumber() + " rev" + this.getRevision(); + } + + public String getPartNumber() { + return partNumber; + } + + public void setPartNumber(String partNumber) { + this.partNumber = partNumber; + } + + public int getRevision() { + return revision; + } + + public void setRevision(int revision) { + this.revision = revision; + } +} diff --git a/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/entity/Vendor.java b/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/entity/Vendor.java new file mode 100644 index 0000000000000000000000000000000000000000..eec404a0b6c04cd06d9e7107fb8c04d6c8e85283 --- /dev/null +++ b/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/entity/Vendor.java @@ -0,0 +1,119 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.order.entity; + +import java.util.Collection; + +import jakarta.persistence.CascadeType; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.NamedQueries; +import jakarta.persistence.NamedQuery; +import jakarta.persistence.OneToMany; +import jakarta.persistence.Table; + +@Entity +@Table(name="PERSISTENCE_ORDER_VENDOR") +@NamedQueries({ + @NamedQuery( + name="findVendorsByPartialName", + query="SELECT v " + + "FROM Vendor v " + + "WHERE LOCATE(:name, v.name) > 0" + ), + @NamedQuery( + name="findVendorByCustomerOrder", + query="SELECT DISTINCT l.vendorPart.vendor " + + "FROM CustomerOrder co, IN(co.lineItems) l " + + "WHERE co.orderId = :id " + + "ORDER BY l.vendorPart.vendor.name" + ) +}) +public class Vendor implements java.io.Serializable { + private static final long serialVersionUID = 2538635007598426330L; + private int vendorId; + private String name; + private String address; + private String contact; + private String phone; + private Collection vendorParts; + + public Vendor() {} + + public Vendor(int vendorId, + String name, + String address, + String contact, + String phone) { + this.vendorId = vendorId; + this.name = name; + this.address = address; + this.contact = contact; + this.phone = phone; + } + + @Id + public int getVendorId() { + return vendorId; + } + + public void setVendorId(int vendorId) { + this.vendorId = vendorId; + } + + @Column(name="VENDORNAME") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getContact() { + return contact; + } + + public void setContact(String contact) { + this.contact = contact; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + @OneToMany(cascade=CascadeType.ALL, mappedBy="vendor") + public Collection getVendorParts() { + return vendorParts; + } + + public void setVendorParts(Collection vendorParts) { + this.vendorParts = vendorParts; + } + + public void addVendorPart(VendorPart vendorPart) { + this.getVendorParts().add(vendorPart); + } +} diff --git a/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/entity/VendorPart.java b/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/entity/VendorPart.java new file mode 100644 index 0000000000000000000000000000000000000000..a33fbbaa89d822ce6817bf27cb190c944f95d5e5 --- /dev/null +++ b/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/entity/VendorPart.java @@ -0,0 +1,123 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.order.entity; + +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.JoinColumns; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.NamedQueries; +import jakarta.persistence.NamedQuery; +import jakarta.persistence.OneToOne; +import jakarta.persistence.Table; +import jakarta.persistence.TableGenerator; +import jakarta.persistence.UniqueConstraint; + +@Entity +@Table(name="PERSISTENCE_ORDER_VENDOR_PART", + uniqueConstraints= + @UniqueConstraint(columnNames={"PARTNUMBER", "PARTREVISION"}) +) +@NamedQueries({ + @NamedQuery( + name="findAverageVendorPartPrice", + query="SELECT AVG(vp.price) " + + "FROM VendorPart vp" + ), + @NamedQuery( + name="findTotalVendorPartPricePerVendor", + query="SELECT SUM(vp.price) " + + "FROM VendorPart vp " + + "WHERE vp.vendor.vendorId = :id" + ), + @NamedQuery( + name="findAllVendorParts", + query="SELECT vp FROM VendorPart vp ORDER BY vp.vendorPartNumber" + ) +}) +public class VendorPart implements java.io.Serializable { + private static final long serialVersionUID = 4685631589912848921L; + private Long vendorPartNumber; + private String description; + private double price; + private Part part; + private Vendor vendor; + + public VendorPart() {} + + public VendorPart(String description, double price, Part part) { + this.description = description; + this.price = price; + this.part = part; + part.setVendorPart(this); + } + + @TableGenerator( + name="vendorPartGen", + table="PERSISTENCE_ORDER_SEQUENCE_GENERATOR", + pkColumnName="GEN_KEY", + valueColumnName="GEN_VALUE", + pkColumnValue="VENDOR_PART_ID", + allocationSize=10) + @Id + @GeneratedValue(strategy=GenerationType.TABLE, generator="vendorPartGen") + public Long getVendorPartNumber() { + return vendorPartNumber; + } + + public void setVendorPartNumber(Long vendorPartNumber) { + this.vendorPartNumber = vendorPartNumber; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public double getPrice() { + return price; + } + + public void setPrice(double price) { + this.price = price; + } + + @OneToOne + @JoinColumns({ + @JoinColumn(name="PARTNUMBER", referencedColumnName="PARTNUMBER"), + @JoinColumn(name="PARTREVISION", referencedColumnName="REVISION") + }) + public Part getPart() { + return part; + } + + public void setPart(Part part) { + this.part = part; + } + + @JoinColumn(name="VENDORID") + @ManyToOne + public Vendor getVendor() { + return vendor; + } + + public void setVendor(Vendor vendor) { + this.vendor = vendor; + } + +} diff --git a/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/web/OrderManager.java b/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/web/OrderManager.java new file mode 100644 index 0000000000000000000000000000000000000000..304df3f9882c903df2135479bb11fd675a756fb6 --- /dev/null +++ b/benchmark/persistence/order/jakarta/src/main/java/jakarta/tutorial/order/web/OrderManager.java @@ -0,0 +1,348 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.order.web; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import jakarta.ejb.EJB; +import jakarta.enterprise.context.SessionScoped; +import jakarta.faces.component.UIParameter; +import jakarta.faces.event.ActionEvent; +import jakarta.inject.Named; +import jakarta.tutorial.order.ejb.RequestBean; +import jakarta.tutorial.order.entity.CustomerOrder; +import jakarta.tutorial.order.entity.LineItem; +import jakarta.tutorial.order.entity.Part; + + +/** + * + * @author ian + */ +@SessionScoped +@Named +public class OrderManager implements Serializable{ + private static final long serialVersionUID = 2142383151318489373L; + @EJB + private RequestBean request; + private static final Logger logger = Logger.getLogger("order.web.OrderManager"); + private List orders; + private Integer currentOrder; + private Integer newOrderId; + private String newOrderShippingInfo; + private char newOrderStatus; + private int newOrderDiscount; + private List newOrderParts; + private List newOrderSelectedParts; + private String vendorName; + private List vendorSearchResults; + private String selectedPartNumber; + private int selectedPartRevision; + private Long selectedVendorPartNumber; + private Boolean findVendorTableDisabled = false; + private Boolean partsTableDisabled = true; + + /** + * @return the orders + */ + public List getOrders() { + try { + this.orders = request.getOrders(); + } catch (Exception e) { + logger.warning("Couldn't get orders."); + } + return orders; + } + + public List getLineItems() { + try { + return request.getLineItems(this.currentOrder); + } catch (Exception e) { + logger.warning("Couldn't get lineItems."); + return null; + } + } + + public void removeOrder(ActionEvent event) { + try { + UIParameter param = (UIParameter) event.getComponent().findComponent("deleteOrderId"); + Integer id = Integer.parseInt(param.getValue().toString()); + request.removeOrder(id); + logger.log(Level.INFO, "Removed order {0}.", id); + } catch (NumberFormatException e) { + } + } + + public void findVendor() { + try { + this.findVendorTableDisabled = true; + this.vendorSearchResults = (List) request.locateVendorsByPartialName(vendorName); + logger.log(Level.INFO, "Found {0} vendor(s) using the search string {1}.", + new Object[]{vendorSearchResults.size(), vendorName}); + } catch (Exception e) { + logger.warning("Problem calling RequestBean.locateVendorsByPartialName from findVendor"); + } + } + + public void submitOrder() { + try { + request.createOrder(newOrderId, newOrderStatus, newOrderDiscount, + newOrderShippingInfo); + + logger.log(Level.INFO, "Created new order with order ID {0}, status {1}, " + + "discount {2}, and shipping info {3}.", + new Object[]{newOrderId, newOrderStatus, newOrderDiscount, newOrderShippingInfo}); + this.newOrderId = null; + this.newOrderDiscount = 0; + this.newOrderParts = null; + this.newOrderShippingInfo = null; + } catch (Exception e) { + logger.warning("Problem creating order in submitOrder."); + } + } + + public void addLineItem() { + try { + List lineItems = request.getLineItems(currentOrder); + logger.log(Level.INFO, "There are {0} line items in {1}.", + new Object[]{lineItems.size(), currentOrder}); + request.addLineItem(this.currentOrder, + this.selectedPartNumber, + this.selectedPartRevision, + 1); + logger.log(Level.INFO, "Adding line item to order # {0}", + this.currentOrder); + //this.clearSelected(); + } catch (Exception e) { + logger.log(Level.WARNING, "Problem adding line items to order ID {0}", + newOrderId); + } + } + + /** + * @param orders the orders to set + */ + public void setOrders(List orders) { + this.orders = orders; + } + + /** + * @return the currentOrder + */ + public int getCurrentOrder() { + return currentOrder; + } + + /** + * @param currentOrder the currentOrder to set + */ + public void setCurrentOrder(int currentOrder) { + this.currentOrder = currentOrder; + } + + /** + * @return the newOrderId + */ + public Integer getNewOrderId() { + return newOrderId; + } + + /** + * @param newOrderId the newOrderId to set + */ + public void setNewOrderId(Integer newOrderId) { + this.newOrderId = newOrderId; + } + + /** + * @return the newOrderShippingInfo + */ + public String getNewOrderShippingInfo() { + return newOrderShippingInfo; + } + + /** + * @param newOrderShippingInfo the newOrderShippingInfo to set + */ + public void setNewOrderShippingInfo(String newOrderShippingInfo) { + this.newOrderShippingInfo = newOrderShippingInfo; + } + + /** + * @return the newOrderStatus + */ + public char getNewOrderStatus() { + return newOrderStatus; + } + + /** + * @param newOrderStatus the newOrderStatus to set + */ + public void setNewOrderStatus(char newOrderStatus) { + this.newOrderStatus = newOrderStatus; + } + + /** + * @return the newOrderDiscount + */ + public int getNewOrderDiscount() { + return newOrderDiscount; + } + + /** + * @param newOrderDiscount the newOrderDiscount to set + */ + public void setNewOrderDiscount(int newOrderDiscount) { + this.newOrderDiscount = newOrderDiscount; + } + + /** + * @return the newOrderParts + */ + public List getNewOrderParts() { + return request.getAllParts(); + } + + /** + * @param newOrderParts the newOrderParts to set + */ + public void setNewOrderParts(List newOrderParts) { + this.newOrderParts = newOrderParts; + } + + /** + * @return the vendorName + */ + public String getVendorName() { + return vendorName; + } + + /** + * @param vendorName the vendorName to set + */ + public void setVendorName(String vendorName) { + this.vendorName = vendorName; + } + + /** + * @return the vendorSearchResults + */ + public List getVendorSearchResults() { + return vendorSearchResults; + } + + /** + * @param vendorSearchResults the vendorSearchResults to set + */ + public void setVendorSearchResults(List vendorSearchResults) { + this.vendorSearchResults = vendorSearchResults; + } + + /** + * @return the newOrderSelectedParts + */ + public List getNewOrderSelectedParts() { + return newOrderSelectedParts; + } + + /** + * @param newOrderSelectedParts the newOrderSelectedParts to set + */ + public void setNewOrderSelectedParts(List newOrderSelectedParts) { + Iterator i = newOrderSelectedParts.iterator(); + while (i.hasNext()) { + Part part = i.next(); + logger.log(Level.INFO, "Selected part {0}.", part.getPartNumber()); + } + this.newOrderSelectedParts = newOrderSelectedParts; + } + + /** + * @return the selectedPartNumber + */ + public String getSelectedPartNumber() { + return selectedPartNumber; + } + + /** + * @param selectedPartNumber the selectedPartNumber to set + */ + public void setSelectedPartNumber(String selectedPartNumber) { + this.selectedPartNumber = selectedPartNumber; + } + + /** + * @return the selectedPartRevision + */ + public int getSelectedPartRevision() { + return selectedPartRevision; + } + + /** + * @param selectedPartRevision the selectedPartRevision to set + */ + public void setSelectedPartRevision(int selectedPartRevision) { + this.selectedPartRevision = selectedPartRevision; + } + + /** + * @return the selectedVendorPartNumber + */ + public Long getSelectedVendorPartNumber() { + return selectedVendorPartNumber; + } + + /** + * @param selectedVendorPartNumber the selectedVendorPartNumber to set + */ + public void setSelectedVendorPartNumber(Long selectedVendorPartNumber) { + this.selectedVendorPartNumber = selectedVendorPartNumber; + } + + private void clearSelected() { + this.setSelectedPartNumber(null); + this.setSelectedPartRevision(0); + this.setSelectedVendorPartNumber(0L); + } + + /** + * @return the findVendorTableDisabled + */ + public Boolean getFindVendorTableDisabled() { + return findVendorTableDisabled; + } + + /** + * @param findVendorTableDisabled the findVendorTableDisabled to set + */ + public void setFindVendorTableDisabled(Boolean findVendorTableDisabled) { + this.findVendorTableDisabled = findVendorTableDisabled; + } + + /** + * @return the partsTableDisabled + */ + public Boolean getPartsTableDisabled() { + return partsTableDisabled; + } + + /** + * @param partsTableDisabled the partsTableDisabled to set + */ + public void setPartsTableDisabled(Boolean partsTableDisabled) { + this.partsTableDisabled = partsTableDisabled; + } +} diff --git a/benchmark/persistence/order/jakarta/src/main/liberty/config/server.xml b/benchmark/persistence/order/jakarta/src/main/liberty/config/server.xml new file mode 100644 index 0000000000000000000000000000000000000000..e13f5dcd15ef9d81712cbe9b2a4ab2a7b03a1580 --- /dev/null +++ b/benchmark/persistence/order/jakarta/src/main/liberty/config/server.xml @@ -0,0 +1,23 @@ + + + + + jakartaee-10.0 + + + + + + + + + + + + + + + + + + diff --git a/benchmark/persistence/order/jakarta/src/main/resources/META-INF/persistence.xml b/benchmark/persistence/order/jakarta/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000000000000000000000000000000000000..a069ff6ef9788f076977d68c05607b75aa4c3544 --- /dev/null +++ b/benchmark/persistence/order/jakarta/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,25 @@ + + + + + java:comp/DefaultDataSource + + + + + + + + diff --git a/benchmark/persistence/order/jakarta/src/main/webapp/WEB-INF/web.xml b/benchmark/persistence/order/jakarta/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000000000000000000000000000000000..c90fea852436fd4f9db75e8c0c645a79dd42a14e --- /dev/null +++ b/benchmark/persistence/order/jakarta/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,40 @@ + + + + + jakarta.faces.PROJECT_STAGE + Development + + + Faces Servlet + + jakarta.faces.webapp.FacesServlet + + 1 + + + Faces Servlet + *.xhtml + + + 30 + + + order.xhtml + + diff --git a/benchmark/persistence/order/jakarta/src/main/webapp/lineItem-template.xhtml b/benchmark/persistence/order/jakarta/src/main/webapp/lineItem-template.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..c5a7fede5db55bb9b3ac240f4cef82d0f7ca7f4c --- /dev/null +++ b/benchmark/persistence/order/jakarta/src/main/webapp/lineItem-template.xhtml @@ -0,0 +1,30 @@ + + + + + + Order Persistence Example + + + +

Default Title

+ + Default Body + + + diff --git a/benchmark/persistence/order/jakarta/src/main/webapp/lineItem.xhtml b/benchmark/persistence/order/jakarta/src/main/webapp/lineItem.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..9a6c34fbc634ad3ca32d79c95ecac716bf5faccb --- /dev/null +++ b/benchmark/persistence/order/jakarta/src/main/webapp/lineItem.xhtml @@ -0,0 +1,95 @@ + + + + + + + Line Items for Order #{orderManager.currentOrder} + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ +
+ + diff --git a/benchmark/persistence/order/jakarta/src/main/webapp/order-template.xhtml b/benchmark/persistence/order/jakarta/src/main/webapp/order-template.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..9c214ccdc3a670975a29cfede1deb22e676f2c03 --- /dev/null +++ b/benchmark/persistence/order/jakarta/src/main/webapp/order-template.xhtml @@ -0,0 +1,41 @@ + + + + + + Order JPA Example + + + +

Default Title

+ + Default Body + +

View All Orders

+ Default ordersTable + +

Create New Order

+ Default new orders form + +

Find Vendors

+ Default find vendors form + + Default find vendor table + + + diff --git a/benchmark/persistence/order/jakarta/src/main/webapp/order.xhtml b/benchmark/persistence/order/jakarta/src/main/webapp/order.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..695b2e5ab61f07b94b0adabae70fdbac4f388e65 --- /dev/null +++ b/benchmark/persistence/order/jakarta/src/main/webapp/order.xhtml @@ -0,0 +1,142 @@ + + + + + + Order Java Persistence Example + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + +
+ + + + + + + + + + + + +
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/benchmark/persistence/order/jakarta/src/main/webapp/resources/css/default.css b/benchmark/persistence/order/jakarta/src/main/webapp/resources/css/default.css new file mode 100644 index 0000000000000000000000000000000000000000..cf1f0b31d150939811f62238b663f7995cc7b727 --- /dev/null +++ b/benchmark/persistence/order/jakarta/src/main/webapp/resources/css/default.css @@ -0,0 +1,49 @@ +/** + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +body { + background-color: #ffffff; + font-size: 12px; + font-family: Verdana, "Verdana CE", Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + color: #000000; + margin: 10px; +} + +h1 { + font-family: Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + border-bottom: 1px solid #AFAFAF; + font-size: 16px; + font-weight: bold; + margin: 0px; + padding: 0px; + color: #D20005; +} + +a:link, a:visited { + color: #045491; + font-weight : bold; + text-decoration: none; +} + +a:link:hover, a:visited:hover { + color: #045491; + font-weight : bold; + text-decoration : underline; +} + +th { + font-weight: bold; + text-align: center; +} + +td { + text-align: center; +} diff --git a/benchmark/persistence/order/jakarta/test.sh b/benchmark/persistence/order/jakarta/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..f8274d526904577f71e81b292188a03329c75c46 --- /dev/null +++ b/benchmark/persistence/order/jakarta/test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +BASE_URL="${BASE_URL:-http://localhost:9080/order-10-SNAPSHOT}" + +echo "Health check: ${BASE_URL}" +HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}") + +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "PASS - got HTTP ${HTTP_STATUS}" + exit 0 +else + echo "FAIL - got HTTP ${HTTP_STATUS}" + exit 1 +fi diff --git a/benchmark/persistence/order/quarkus/.dockerignore b/benchmark/persistence/order/quarkus/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..c634c57d9244b4e60b8fa936f09dbe4e75706e74 --- /dev/null +++ b/benchmark/persistence/order/quarkus/.dockerignore @@ -0,0 +1,41 @@ +# VCS +.git/ + +# Maven +.mvn/ +**/.mvn/ +mvnw +mvnw.cmd +**/mvnw +**/mvnw.cmd +target/ +**/target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties + +# IDE / Editor +.vscode/ +**/.vscode/ +.zed/ +**/.zed/ +.idea/ +**/.idea/ +*.iml +*.ipr +*.iws + +# OS +.DS_Store +**/.DS_Store +Thumbs.db +ehthumbs.db + +# Logs / temp +*.log +*.tmp +*.temp diff --git a/benchmark/persistence/order/quarkus/.mvn/wrapper/maven-wrapper.properties b/benchmark/persistence/order/quarkus/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..8dea6c227c08000d2400d38a2ac886063f22bc36 --- /dev/null +++ b/benchmark/persistence/order/quarkus/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,3 @@ +wrapperVersion=3.3.4 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.12/apache-maven-3.9.12-bin.zip diff --git a/benchmark/persistence/order/quarkus/Dockerfile b/benchmark/persistence/order/quarkus/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..69c4e7a98a9ffec83a261b35eaa4c2ee0eb78343 --- /dev/null +++ b/benchmark/persistence/order/quarkus/Dockerfile @@ -0,0 +1,33 @@ +FROM maven:3.9.12-ibm-semeru-21-noble + +USER root +# install uv +RUN apt-get update && apt-get install -y --no-install-recommends curl lsof python3-venv python3-full && curl -LsSf https://astral.sh/uv/install.sh | sh + +ENV PATH="/root/.local/bin:$PATH" + +# Shared browsers path so Chromium is cached once +ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright +RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright + +# create venv and install +RUN uv venv /opt/venv && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest aiohttp + +ENV PATH="/opt/venv/bin:$PATH" +RUN playwright install --with-deps chromium + +# Set working directory +WORKDIR /app + +# Copy all the assets +COPY . . + +# Build the application at image build time +RUN mvn clean install -DskipTests + +COPY test.sh . +RUN chmod +x test.sh + +RUN mvn clean install -DskipTests + +CMD ["mvn", "quarkus:run"] diff --git a/benchmark/persistence/order/quarkus/README.md b/benchmark/persistence/order/quarkus/README.md new file mode 100644 index 0000000000000000000000000000000000000000..97a505b0dc2e0077ecae55737e9961a1d203a23e --- /dev/null +++ b/benchmark/persistence/order/quarkus/README.md @@ -0,0 +1,62 @@ +# order-quarkus + +This project uses Quarkus, the Supersonic Subatomic Java Framework. + +If you want to learn more about Quarkus, please visit its website: . + +## Running the application in dev mode + +You can run your application in dev mode that enables live coding using: + +```shell script +./mvnw quarkus:dev +``` + +> **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at . + +## Packaging and running the application + +The application can be packaged using: + +```shell script +./mvnw package +``` + +It produces the `quarkus-run.jar` file in the `target/quarkus-app/` directory. +Be aware that it’s not an _über-jar_ as the dependencies are copied into the `target/quarkus-app/lib/` directory. + +The application is now runnable using `java -jar target/quarkus-app/quarkus-run.jar`. + +If you want to build an _über-jar_, execute the following command: + +```shell script +./mvnw package -Dquarkus.package.jar.type=uber-jar +``` + +The application, packaged as an _über-jar_, is now runnable using `java -jar target/*-runner.jar`. + +## Creating a native executable + +You can create a native executable using: + +```shell script +./mvnw package -Dnative +``` + +Or, if you don't have GraalVM installed, you can run the native executable build in a container using: + +```shell script +./mvnw package -Dnative -Dquarkus.native.container-build=true +``` + +You can then execute your native executable with: `./target/order-quarkus-1.0.0-SNAPSHOT-runner` + +If you want to learn more about building native executables, please consult . + +## Provided Code + +### REST + +Easily start your REST Web Services + +[Related guide section...](https://quarkus.io/guides/getting-started-reactive#reactive-jax-rs-resources) diff --git a/benchmark/persistence/order/quarkus/mvnw b/benchmark/persistence/order/quarkus/mvnw new file mode 100644 index 0000000000000000000000000000000000000000..bd8896bf2217b46faa0291585e01ac1a3441a958 --- /dev/null +++ b/benchmark/persistence/order/quarkus/mvnw @@ -0,0 +1,295 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.4 +# +# Optional ENV vars +# ----------------- +# JAVA_HOME - location of a JDK home dir, required when download maven via java source +# MVNW_REPOURL - repo url base for downloading maven distribution +# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output +# ---------------------------------------------------------------------------- + +set -euf +[ "${MVNW_VERBOSE-}" != debug ] || set -x + +# OS specific support. +native_path() { printf %s\\n "$1"; } +case "$(uname)" in +CYGWIN* | MINGW*) + [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" + native_path() { cygpath --path --windows "$1"; } + ;; +esac + +# set JAVACMD and JAVACCMD +set_java_home() { + # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched + if [ -n "${JAVA_HOME-}" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACCMD="$JAVA_HOME/jre/sh/javac" + else + JAVACMD="$JAVA_HOME/bin/java" + JAVACCMD="$JAVA_HOME/bin/javac" + + if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then + echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 + echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 + return 1 + fi + fi + else + JAVACMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v java + )" || : + JAVACCMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v javac + )" || : + + if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then + echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 + return 1 + fi + fi +} + +# hash string like Java String::hashCode +hash_string() { + str="${1:-}" h=0 + while [ -n "$str" ]; do + char="${str%"${str#?}"}" + h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) + str="${str#?}" + done + printf %x\\n $h +} + +verbose() { :; } +[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } + +die() { + printf %s\\n "$1" >&2 + exit 1 +} + +trim() { + # MWRAPPER-139: + # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. + # Needed for removing poorly interpreted newline sequences when running in more + # exotic environments such as mingw bash on Windows. + printf "%s" "${1}" | tr -d '[:space:]' +} + +scriptDir="$(dirname "$0")" +scriptName="$(basename "$0")" + +# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties +while IFS="=" read -r key value; do + case "${key-}" in + distributionUrl) distributionUrl=$(trim "${value-}") ;; + distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; + esac +done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" + +case "${distributionUrl##*/}" in +maven-mvnd-*bin.*) + MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ + case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in + *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; + :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; + :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; + :Linux*x86_64*) distributionPlatform=linux-amd64 ;; + *) + echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 + distributionPlatform=linux-amd64 + ;; + esac + distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" + ;; +maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; +*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; +esac + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" +distributionUrlName="${distributionUrl##*/}" +distributionUrlNameMain="${distributionUrlName%.*}" +distributionUrlNameMain="${distributionUrlNameMain%-bin}" +MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" +MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" + +exec_maven() { + unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : + exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" +} + +if [ -d "$MAVEN_HOME" ]; then + verbose "found existing MAVEN_HOME at $MAVEN_HOME" + exec_maven "$@" +fi + +case "${distributionUrl-}" in +*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; +*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; +esac + +# prepare tmp dir +if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then + clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } + trap clean HUP INT TERM EXIT +else + die "cannot create temp dir" +fi + +mkdir -p -- "${MAVEN_HOME%/*}" + +# Download and Install Apache Maven +verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +verbose "Downloading from: $distributionUrl" +verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +# select .zip or .tar.gz +if ! command -v unzip >/dev/null; then + distributionUrl="${distributionUrl%.zip}.tar.gz" + distributionUrlName="${distributionUrl##*/}" +fi + +# verbose opt +__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' +[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v + +# normalize http auth +case "${MVNW_PASSWORD:+has-password}" in +'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; +has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; +esac + +if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then + verbose "Found wget ... using wget" + wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" +elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then + verbose "Found curl ... using curl" + curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" +elif set_java_home; then + verbose "Falling back to use Java to download" + javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" + targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" + cat >"$javaSource" <<-END + public class Downloader extends java.net.Authenticator + { + protected java.net.PasswordAuthentication getPasswordAuthentication() + { + return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); + } + public static void main( String[] args ) throws Exception + { + setDefault( new Downloader() ); + java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); + } + } + END + # For Cygwin/MinGW, switch paths to Windows format before running javac and java + verbose " - Compiling Downloader.java ..." + "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" + verbose " - Running Downloader.java ..." + "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" +fi + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +if [ -n "${distributionSha256Sum-}" ]; then + distributionSha256Result=false + if [ "$MVN_CMD" = mvnd.sh ]; then + echo "Checksum validation is not supported for maven-mvnd." >&2 + echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + elif command -v sha256sum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then + distributionSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $distributionSha256Result = false ]; then + echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 + echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 + exit 1 + fi +fi + +# unzip and move +if command -v unzip >/dev/null; then + unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" +else + tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" +fi + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +actualDistributionDir="" + +# First try the expected directory name (for regular distributions) +if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then + if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then + actualDistributionDir="$distributionUrlNameMain" + fi +fi + +# If not found, search for any directory with the Maven executable (for snapshots) +if [ -z "$actualDistributionDir" ]; then + # enable globbing to iterate over items + set +f + for dir in "$TMP_DOWNLOAD_DIR"/*; do + if [ -d "$dir" ]; then + if [ -f "$dir/bin/$MVN_CMD" ]; then + actualDistributionDir="$(basename "$dir")" + break + fi + fi + done + set -f +fi + +if [ -z "$actualDistributionDir" ]; then + verbose "Contents of $TMP_DOWNLOAD_DIR:" + verbose "$(ls -la "$TMP_DOWNLOAD_DIR")" + die "Could not find Maven distribution directory in extracted archive" +fi + +verbose "Found extracted Maven distribution directory: $actualDistributionDir" +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" + +clean || : +exec_maven "$@" diff --git a/benchmark/persistence/order/quarkus/mvnw.cmd b/benchmark/persistence/order/quarkus/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..5761d948924c19571d27b465c519b2e2f9e30351 --- /dev/null +++ b/benchmark/persistence/order/quarkus/mvnw.cmd @@ -0,0 +1,189 @@ +<# : batch portion +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.4 +@REM +@REM Optional ENV vars +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output +@REM ---------------------------------------------------------------------------- + +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) +) +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> + +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} + +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} + +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' + +$MAVEN_M2_PATH = "$HOME/.m2" +if ($env:MAVEN_USER_HOME) { + $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME" +} + +if (-not (Test-Path -Path $MAVEN_M2_PATH)) { + New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null +} + +$MAVEN_WRAPPER_DISTS = $null +if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) { + $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists" +} else { + $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists" +} + +$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain" +$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" + +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} + +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} + +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} + +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null + +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +$actualDistributionDir = "" + +# First try the expected directory name (for regular distributions) +$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain" +$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD" +if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) { + $actualDistributionDir = $distributionUrlNameMain +} + +# If not found, search for any directory with the Maven executable (for snapshots) +if (!$actualDistributionDir) { + Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object { + $testPath = Join-Path $_.FullName "bin/$MVN_CMD" + if (Test-Path -Path $testPath -PathType Leaf) { + $actualDistributionDir = $_.Name + } + } +} + +if (!$actualDistributionDir) { + Write-Error "Could not find Maven distribution directory in extracted archive" +} + +Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir" +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/benchmark/persistence/order/quarkus/pom.xml b/benchmark/persistence/order/quarkus/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..77fc8e9d975edf4cf0e341220a9bcc5e23575708 --- /dev/null +++ b/benchmark/persistence/order/quarkus/pom.xml @@ -0,0 +1,154 @@ + + + 4.0.0 + quarkus.tutorial + order-quarkus + 1.0.0-SNAPSHOT + + + 3.14.0 + 17 + UTF-8 + UTF-8 + quarkus-bom + io.quarkus.platform + 3.30.5 + true + 3.5.3 + + + + + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + + + + + + + io.quarkus + quarkus-arc + + + io.quarkus + quarkus-rest + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + io.quarkus + quarkus-hibernate-orm + + + io.quarkus + quarkus-hibernate-orm-panache + + + io.quarkus + quarkus-jdbc-h2 + + + io.quarkus + quarkus-hibernate-validator + + + io.quarkus + quarkus-qute + + + io.quarkus + quarkus-rest-qute + + + io.quarkus + quarkus-undertow + + + + + + + + + ${quarkus.platform.group-id} + quarkus-maven-plugin + ${quarkus.platform.version} + true + + + + build + generate-code + generate-code-tests + native-image-agent + + + + + + maven-compiler-plugin + ${compiler-plugin.version} + + true + + + + maven-surefire-plugin + ${surefire-plugin.version} + + + org.jboss.logmanager.LogManager + ${maven.home} + + + + + maven-failsafe-plugin + ${surefire-plugin.version} + + + + integration-test + verify + + + + + + ${project.build.directory}/${project.build.finalName}-runner + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + + + + native + + + native + + + + false + true + + + + diff --git a/benchmark/persistence/order/quarkus/src/main/docker/Dockerfile.jvm b/benchmark/persistence/order/quarkus/src/main/docker/Dockerfile.jvm new file mode 100644 index 0000000000000000000000000000000000000000..e167834d9d8609321b5916a2f087fb78ec0eca52 --- /dev/null +++ b/benchmark/persistence/order/quarkus/src/main/docker/Dockerfile.jvm @@ -0,0 +1,98 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode +# +# Before building the container image run: +# +# ./mvnw package +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/order-quarkus-jvm . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/order-quarkus-jvm +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005. +# Additionally you will have to set -e JAVA_DEBUG=true and -e JAVA_DEBUG_PORT=*:5005 +# when running the container +# +# Then run the container using : +# +# docker run -i --rm -p 8080:8080 quarkus/order-quarkus-jvm +# +# This image uses the `run-java.sh` script to run the application. +# This scripts computes the command line to execute your Java application, and +# includes memory/GC tuning. +# You can configure the behavior using the following environment properties: +# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class") - Be aware that this will override +# the default JVM options, use `JAVA_OPTS_APPEND` to append options +# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options +# in JAVA_OPTS (example: "-Dsome.property=foo") +# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is +# used to calculate a default maximal heap memory based on a containers restriction. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio +# of the container available memory as set here. The default is `50` which means 50% +# of the available memory is used as an upper boundary. You can skip this mechanism by +# setting this value to `0` in which case no `-Xmx` option is added. +# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This +# is used to calculate a default initial heap memory based on the maximum heap memory. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio +# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx` +# is used as the initial heap size. You can skip this mechanism by setting this value +# to `0` in which case no `-Xms` option is added (example: "25") +# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS. +# This is used to calculate the maximum value of the initial heap memory. If used in +# a container without any memory constraints for the container then this option has +# no effect. If there is a memory constraint then `-Xms` is limited to the value set +# here. The default is 4096MB which means the calculated value of `-Xms` never will +# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096") +# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output +# when things are happening. This option, if set to true, will set +# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true"). +# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example: +# true"). +# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787"). +# - CONTAINER_CORE_LIMIT: A calculated core limit as described in +# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2") +# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024"). +# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion. +# (example: "20") +# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking. +# (example: "40") +# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection. +# (example: "4") +# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus +# previous GC times. (example: "90") +# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20") +# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100") +# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should +# contain the necessary JRE command-line options to specify the required GC, which +# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC). +# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080") +# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080") +# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be +# accessed directly. (example: "foo.example.com,bar.example.com") +# +### +FROM registry.access.redhat.com/ubi9/openjdk-21:1.23 + +ENV LANGUAGE='en_US:en' + + +# We make four distinct layers so if there are application changes the library layers can be re-used +COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/ +COPY --chown=185 target/quarkus-app/*.jar /deployments/ +COPY --chown=185 target/quarkus-app/app/ /deployments/app/ +COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/ + +EXPOSE 8080 +USER 185 +ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" + +ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ] + diff --git a/benchmark/persistence/order/quarkus/src/main/docker/Dockerfile.legacy-jar b/benchmark/persistence/order/quarkus/src/main/docker/Dockerfile.legacy-jar new file mode 100644 index 0000000000000000000000000000000000000000..41fe617ede89c1287747127a344a71d5ef7f6a3e --- /dev/null +++ b/benchmark/persistence/order/quarkus/src/main/docker/Dockerfile.legacy-jar @@ -0,0 +1,94 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode +# +# Before building the container image run: +# +# ./mvnw package -Dquarkus.package.jar.type=legacy-jar +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.legacy-jar -t quarkus/order-quarkus-legacy-jar . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/order-quarkus-legacy-jar +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005. +# Additionally you will have to set -e JAVA_DEBUG=true and -e JAVA_DEBUG_PORT=*:5005 +# when running the container +# +# Then run the container using : +# +# docker run -i --rm -p 8080:8080 quarkus/order-quarkus-legacy-jar +# +# This image uses the `run-java.sh` script to run the application. +# This scripts computes the command line to execute your Java application, and +# includes memory/GC tuning. +# You can configure the behavior using the following environment properties: +# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class") - Be aware that this will override +# the default JVM options, use `JAVA_OPTS_APPEND` to append options +# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options +# in JAVA_OPTS (example: "-Dsome.property=foo") +# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is +# used to calculate a default maximal heap memory based on a containers restriction. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio +# of the container available memory as set here. The default is `50` which means 50% +# of the available memory is used as an upper boundary. You can skip this mechanism by +# setting this value to `0` in which case no `-Xmx` option is added. +# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This +# is used to calculate a default initial heap memory based on the maximum heap memory. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio +# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx` +# is used as the initial heap size. You can skip this mechanism by setting this value +# to `0` in which case no `-Xms` option is added (example: "25") +# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS. +# This is used to calculate the maximum value of the initial heap memory. If used in +# a container without any memory constraints for the container then this option has +# no effect. If there is a memory constraint then `-Xms` is limited to the value set +# here. The default is 4096MB which means the calculated value of `-Xms` never will +# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096") +# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output +# when things are happening. This option, if set to true, will set +# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true"). +# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example: +# true"). +# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787"). +# - CONTAINER_CORE_LIMIT: A calculated core limit as described in +# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2") +# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024"). +# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion. +# (example: "20") +# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking. +# (example: "40") +# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection. +# (example: "4") +# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus +# previous GC times. (example: "90") +# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20") +# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100") +# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should +# contain the necessary JRE command-line options to specify the required GC, which +# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC). +# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080") +# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080") +# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be +# accessed directly. (example: "foo.example.com,bar.example.com") +# +### +FROM registry.access.redhat.com/ubi9/openjdk-21:1.23 + +ENV LANGUAGE='en_US:en' + + +COPY target/lib/* /deployments/lib/ +COPY target/*-runner.jar /deployments/quarkus-run.jar + +EXPOSE 8080 +USER 185 +ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" + +ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ] diff --git a/benchmark/persistence/order/quarkus/src/main/docker/Dockerfile.native b/benchmark/persistence/order/quarkus/src/main/docker/Dockerfile.native new file mode 100644 index 0000000000000000000000000000000000000000..7d37838570dc81ebdd94279b057aa28cb09a66f2 --- /dev/null +++ b/benchmark/persistence/order/quarkus/src/main/docker/Dockerfile.native @@ -0,0 +1,29 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. +# +# Before building the container image run: +# +# ./mvnw package -Dnative +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.native -t quarkus/order-quarkus . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/order-quarkus +# +# The ` registry.access.redhat.com/ubi9/ubi-minimal:9.6` base image is based on UBI 9. +# To use UBI 8, switch to `quay.io/ubi8/ubi-minimal:8.10`. +### +FROM registry.access.redhat.com/ubi9/ubi-minimal:9.6 +WORKDIR /work/ +RUN chown 1001 /work \ + && chmod "g+rwX" /work \ + && chown 1001:root /work +COPY --chown=1001:root --chmod=0755 target/*-runner /work/application + +EXPOSE 8080 +USER 1001 + +ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/benchmark/persistence/order/quarkus/src/main/docker/Dockerfile.native-micro b/benchmark/persistence/order/quarkus/src/main/docker/Dockerfile.native-micro new file mode 100644 index 0000000000000000000000000000000000000000..839706b7aa91c298054c9e6907656347ee7ffa70 --- /dev/null +++ b/benchmark/persistence/order/quarkus/src/main/docker/Dockerfile.native-micro @@ -0,0 +1,32 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. +# It uses a micro base image, tuned for Quarkus native executables. +# It reduces the size of the resulting container image. +# Check https://quarkus.io/guides/quarkus-runtime-base-image for further information about this image. +# +# Before building the container image run: +# +# ./mvnw package -Dnative +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.native-micro -t quarkus/order-quarkus . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/order-quarkus +# +# The `quay.io/quarkus/ubi9-quarkus-micro-image:2.0` base image is based on UBI 9. +# To use UBI 8, switch to `quay.io/quarkus/quarkus-micro-image:2.0`. +### +FROM quay.io/quarkus/ubi9-quarkus-micro-image:2.0 +WORKDIR /work/ +RUN chown 1001 /work \ + && chmod "g+rwX" /work \ + && chown 1001:root /work +COPY --chown=1001:root --chmod=0755 target/*-runner /work/application + +EXPOSE 8080 +USER 1001 + +ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/entity/CustomerOrder.java b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/entity/CustomerOrder.java new file mode 100644 index 0000000000000000000000000000000000000000..7bed383fcf65a66543a06c49e4ec5d1c19b64261 --- /dev/null +++ b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/entity/CustomerOrder.java @@ -0,0 +1,130 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package quarkus.tutorial.order.entity; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; + + +import jakarta.persistence.CascadeType; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.NamedQuery; +import jakarta.persistence.OneToMany; +import jakarta.persistence.Table; +import jakarta.persistence.Temporal; +import jakarta.persistence.TemporalType; +import jakarta.persistence.Transient; + + +@Entity +@Table(name="PERSISTENCE_ORDER_CUSTOMERORDER") +@NamedQuery( + name="findAllOrders", + query="SELECT co FROM CustomerOrder co " + + "ORDER BY co.orderId" +) +public class CustomerOrder implements java.io.Serializable { + private static final long serialVersionUID = 6582105865012174694L; + private Integer orderId; + private char status; + private Date lastUpdate; + private int discount; + private String shipmentInfo; + private Collection lineItems = new ArrayList<>(); + + public CustomerOrder() { + this.lastUpdate = new Date(); + this.lineItems = new ArrayList<>(); + } + + public CustomerOrder(Integer orderId, char status, int discount, + String shipmentInfo) { + this.orderId = orderId; + this.status = status; + this.discount = discount; + this.shipmentInfo = shipmentInfo; + this.lastUpdate = new Date(); + this.lineItems = new ArrayList<>(); + } + + @Id + public Integer getOrderId() { + return orderId; + } + + public void setOrderId(Integer orderId) { + this.orderId = orderId; + } + + public char getStatus() { + return status; + } + + public void setStatus(char status) { + this.status = status; + } + + @Temporal(TemporalType.TIMESTAMP) + public Date getLastUpdate() { + return lastUpdate; + } + + public void setLastUpdate(Date lastUpdate) { + this.lastUpdate = lastUpdate; + } + + public int getDiscount() { + return discount; + } + + public void setDiscount(int discount) { + this.discount = discount; + } + + public String getShipmentInfo() { + return shipmentInfo; + } + + public void setShipmentInfo(String shipmentInfo) { + this.shipmentInfo = shipmentInfo; + } + + @OneToMany(cascade=CascadeType.ALL, mappedBy="customerOrder") + public Collection getLineItems() { + return lineItems; + } + + public void setLineItems(Collection lineItems) { + this.lineItems = lineItems; + } + + public double calculateAmmount() { + double ammount = 0; + Collection items = getLineItems(); + for (LineItem item : items) { + VendorPart part = item.getVendorPart(); + ammount += part.getPrice() * item.getQuantity(); + } + return (ammount * (100 - getDiscount()))/100; + } + + public void addLineItem(LineItem lineItem) { + this.getLineItems().add(lineItem); + } + + @Transient + public int getNextId() { + return this.lineItems.size() + 1; + } +} diff --git a/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/entity/LineItem.java b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/entity/LineItem.java new file mode 100644 index 0000000000000000000000000000000000000000..22c41fb09541fcf8177b65b5e7a4114f72d43b66 --- /dev/null +++ b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/entity/LineItem.java @@ -0,0 +1,96 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package quarkus.tutorial.order.entity; + +import java.io.Serializable; + +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.IdClass; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.NamedQueries; +import jakarta.persistence.NamedQuery; +import jakarta.persistence.Table; + +@IdClass(LineItemKey.class) +@Entity +@Table(name="PERSISTENCE_ORDER_LINEITEM") +@NamedQueries({ + @NamedQuery( + name="findAllLineItems", + query="SELECT l " + + "FROM LineItem l"), + @NamedQuery( + name="findLineItemsByOrderId", + query="SELECT l FROM LineItem l " + + "WHERE l.customerOrder.orderId = :orderId " + + "ORDER BY l.itemId"), + @NamedQuery( + name="findLineItemById", + query="SELECT DISTINCT l FROM LineItem l " + + "WHERE l.itemId = :itemId AND l.customerOrder.orderId = :orderId") +}) +public class LineItem implements Serializable { + private static final long serialVersionUID = 3229188813505619743L; + private int itemId; + private int quantity; + private VendorPart vendorPart; + private CustomerOrder customerOrder; + + public LineItem() {} + + public LineItem(CustomerOrder order, int quantity, VendorPart vendorPart) { + this.customerOrder = order; + this.itemId = order.getNextId(); + this.quantity = quantity; + this.vendorPart = vendorPart; + } + + @Id + public int getItemId() { + return itemId; + } + + public void setItemId(int itemId) { + this.itemId = itemId; + } + + public int getQuantity() { + return quantity; + } + + public void setQuantity(int quantity) { + this.quantity = quantity; + } + + @JoinColumn(name="VENDORPARTNUMBER") + @ManyToOne + public VendorPart getVendorPart() { + return vendorPart; + } + + public void setVendorPart(VendorPart vendorPart) { + this.vendorPart = vendorPart; + } + + @Id + @ManyToOne + @JoinColumn(name="ORDERID") + public CustomerOrder getCustomerOrder() { + return customerOrder; + } + + public void setCustomerOrder(CustomerOrder customerOrder) { + this.customerOrder = customerOrder; + } +} diff --git a/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/entity/LineItemKey.java b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/entity/LineItemKey.java new file mode 100644 index 0000000000000000000000000000000000000000..5182d7c1349f799dcc1d578f7ddc7d4c7a33aced --- /dev/null +++ b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/entity/LineItemKey.java @@ -0,0 +1,73 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package quarkus.tutorial.order.entity; + +import java.io.Serializable; + +public final class LineItemKey implements Serializable { + + private static final long serialVersionUID = 1562260205094677677L; + private Integer customerOrder; + private int itemId; + + public LineItemKey() { + } + + public LineItemKey(Integer order, int itemId) { + this.setCustomerOrder(order); + this.setItemId(itemId); + } + + @Override + public int hashCode() { + return ((this.getCustomerOrder() == null + ? 0 : this.getCustomerOrder().hashCode()) + ^ ((int) this.getItemId())); + } + + @Override + public boolean equals(Object otherOb) { + + if (this == otherOb) { + return true; + } + if (!(otherOb instanceof LineItemKey)) { + return false; + } + LineItemKey other = (LineItemKey) otherOb; + return ((this.getCustomerOrder() == null + ? other.getCustomerOrder() == null : this.getCustomerOrder() + .equals(other.getCustomerOrder())) + && (this.getItemId() == other.getItemId())); + } + + @Override + public String toString() { + return "" + getCustomerOrder() + "-" + getItemId(); + } + + public Integer getCustomerOrder() { + return customerOrder; + } + + public void setCustomerOrder(Integer order) { + this.customerOrder = order; + } + + public int getItemId() { + return itemId; + } + + public void setItemId(int itemId) { + this.itemId = itemId; + } +} diff --git a/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/entity/Part.java b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/entity/Part.java new file mode 100644 index 0000000000000000000000000000000000000000..42baa9e41576170f71fbe81a478579c1e6d98080 --- /dev/null +++ b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/entity/Part.java @@ -0,0 +1,161 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package quarkus.tutorial.order.entity; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.IdClass; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.JoinColumns; +import jakarta.persistence.Lob; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.NamedQuery; +import jakarta.persistence.OneToMany; +import jakarta.persistence.OneToOne; +import jakarta.persistence.PrimaryKeyJoinColumn; +import jakarta.persistence.SecondaryTable; +import jakarta.persistence.Table; + +@IdClass(PartKey.class) +@Entity +@Table(name="PERSISTENCE_ORDER_PART") +@SecondaryTable(name="PERSISTENCE_ORDER_PART_DETAIL", pkJoinColumns={ + @PrimaryKeyJoinColumn(name="PARTNUMBER", referencedColumnName="PARTNUMBER"), + @PrimaryKeyJoinColumn(name="REVISION", referencedColumnName="REVISION") +}) +@NamedQuery( + name="findAllParts", + query="SELECT p FROM Part p " + + "ORDER BY p.partNumber" +) +public class Part implements Serializable { + private static final long serialVersionUID = -3082087016342644227L; + private String partNumber; + private int revision; + private String description; + private Date revisionDate; + private Serializable drawing; + private String specification; + private Part bomPart; + private List parts; + private VendorPart vendorPart; + + public Part() {} + + public Part(String partNumber, + int revision, + String description, + Date revisionDate, + String specification, + Serializable drawing) { + this.partNumber = partNumber; + this.revision = revision; + this.description = description; + this.revisionDate = revisionDate; + this.specification = specification; + this.drawing = drawing; + this.parts = new ArrayList<>(); + } + + @Id + @Column(nullable=false) + public String getPartNumber() { + return partNumber; + } + + public void setPartNumber(String partNumber) { + this.partNumber = partNumber; + } + + @Id + @Column(nullable=false) + public int getRevision() { + return revision; + } + + public void setRevision(int revision) { + this.revision = revision; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Date getRevisionDate() { + return revisionDate; + } + + public void setRevisionDate(Date revisionDate) { + this.revisionDate = revisionDate; + } + + @Column(table="PERSISTENCE_ORDER_PART_DETAIL") + @Lob + public Serializable getDrawing() { + return drawing; + } + + public void setDrawing(Serializable drawing) { + this.drawing = drawing; + } + + @Column(table="PERSISTENCE_ORDER_PART_DETAIL") + @Lob + public String getSpecification() { + return specification; + } + + public void setSpecification(String specification) { + this.specification = specification; + } + + @ManyToOne + @JoinColumns({ + @JoinColumn(name="BOMPARTNUMBER", referencedColumnName="PARTNUMBER"), + @JoinColumn(name="BOMREVISION", referencedColumnName="REVISION") + }) + public Part getBomPart() { + return bomPart; + } + + public void setBomPart(Part bomPart) { + this.bomPart = bomPart; + } + + @OneToMany(mappedBy="bomPart") + public List getParts() { + return parts; + } + + public void setParts(List parts) { + this.parts = parts; + } + + @OneToOne(mappedBy="part") + public VendorPart getVendorPart() { + return vendorPart; + } + + public void setVendorPart(VendorPart vendorPart) { + this.vendorPart = vendorPart; + } +} diff --git a/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/entity/PartKey.java b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/entity/PartKey.java new file mode 100644 index 0000000000000000000000000000000000000000..24094fb60b1e32566609cf51fbccd724c5aa90a9 --- /dev/null +++ b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/entity/PartKey.java @@ -0,0 +1,71 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package quarkus.tutorial.order.entity; + +import java.io.Serializable; + +/** + * + * @author ian + */ +public class PartKey implements Serializable { + private static final long serialVersionUID = -3162267592969127613L; + private String partNumber; + private int revision; + + @Override + public int hashCode() { + return ( + (this.getPartNumber()==null?0:this.getPartNumber().hashCode()) + ^ + ((int) this.getRevision()) + ); + } + + @Override + public boolean equals(Object otherOb) { + + if (this == otherOb) { + return true; + } + if (!(otherOb instanceof PartKey)) { + return false; + } + PartKey other = (PartKey) otherOb; + return ( + (this.getPartNumber()==null?other.getPartNumber()==null:this.getPartNumber().equals(other.getPartNumber())) + && + (getRevision() == other.getRevision()) + ); + } + + @Override + public String toString() { + return getPartNumber() + " rev" + this.getRevision(); + } + + public String getPartNumber() { + return partNumber; + } + + public void setPartNumber(String partNumber) { + this.partNumber = partNumber; + } + + public int getRevision() { + return revision; + } + + public void setRevision(int revision) { + this.revision = revision; + } +} diff --git a/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/entity/Vendor.java b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/entity/Vendor.java new file mode 100644 index 0000000000000000000000000000000000000000..4abcdfafe4d14ea3ad70fa7663d77d160dc10a6c --- /dev/null +++ b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/entity/Vendor.java @@ -0,0 +1,120 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package quarkus.tutorial.order.entity; + +import java.util.Collection; + +import jakarta.persistence.CascadeType; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.NamedQueries; +import jakarta.persistence.NamedQuery; +import jakarta.persistence.OneToMany; +import jakarta.persistence.Table; +import java.util.ArrayList; + +@Entity +@Table(name="PERSISTENCE_ORDER_VENDOR") +@NamedQueries({ + @NamedQuery( + name="findVendorsByPartialName", + query="SELECT v " + + "FROM Vendor v " + + "WHERE LOCATE(:name, v.name) > 0" + ), + @NamedQuery( + name="findVendorByCustomerOrder", + query="SELECT DISTINCT l.vendorPart.vendor " + + "FROM CustomerOrder co, IN(co.lineItems) l " + + "WHERE co.orderId = :id " + + "ORDER BY l.vendorPart.vendor.name" + ) +}) +public class Vendor implements java.io.Serializable { + private static final long serialVersionUID = 2538635007598426330L; + private int vendorId; + private String name; + private String address; + private String contact; + private String phone; + private Collection vendorParts = new ArrayList<>(); + + public Vendor() {} + + public Vendor(int vendorId, + String name, + String address, + String contact, + String phone) { + this.vendorId = vendorId; + this.name = name; + this.address = address; + this.contact = contact; + this.phone = phone; + } + + @Id + public int getVendorId() { + return vendorId; + } + + public void setVendorId(int vendorId) { + this.vendorId = vendorId; + } + + @Column(name="VENDORNAME") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getContact() { + return contact; + } + + public void setContact(String contact) { + this.contact = contact; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + @OneToMany(cascade=CascadeType.ALL, mappedBy="vendor") + public Collection getVendorParts() { + return vendorParts; + } + + public void setVendorParts(Collection vendorParts) { + this.vendorParts = vendorParts; + } + + public void addVendorPart(VendorPart vendorPart) { + this.getVendorParts().add(vendorPart); + } +} diff --git a/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/entity/VendorPart.java b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/entity/VendorPart.java new file mode 100644 index 0000000000000000000000000000000000000000..87aec93f86702e202dbe6632efd4aabba4e0616f --- /dev/null +++ b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/entity/VendorPart.java @@ -0,0 +1,124 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package quarkus.tutorial.order.entity; + +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.JoinColumns; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.NamedQueries; +import jakarta.persistence.NamedQuery; +import jakarta.persistence.OneToOne; +import jakarta.persistence.Table; +import jakarta.persistence.TableGenerator; +import jakarta.persistence.UniqueConstraint; + +@Entity +@Table(name="PERSISTENCE_ORDER_VENDOR_PART", + uniqueConstraints= + @UniqueConstraint(columnNames={"PARTNUMBER", "PARTREVISION"}) +) +@NamedQueries({ + @NamedQuery( + name="findAverageVendorPartPrice", + query="SELECT AVG(vp.price) " + + "FROM VendorPart vp" + ), + @NamedQuery( + name="findTotalVendorPartPricePerVendor", + query="SELECT SUM(vp.price) " + + "FROM VendorPart vp " + + "WHERE vp.vendor.vendorId = :id" + ), + @NamedQuery( + name="findAllVendorParts", + query="SELECT vp FROM VendorPart vp ORDER BY vp.vendorPartNumber" + ) +}) +public class VendorPart implements java.io.Serializable { + private static final long serialVersionUID = 4685631589912848921L; + private Long vendorPartNumber; + private String description; + private double price; + private Part part; + private Vendor vendor; + + public VendorPart() {} + + public VendorPart(String description, double price, Part part) { + this.description = description; + this.price = price; + this.part = part; + part.setVendorPart(this); + } + + + @TableGenerator( + name="vendorPartGen", + table="PERSISTENCE_ORDER_SEQUENCE_GENERATOR", + pkColumnName="GEN_KEY", + valueColumnName="GEN_VALUE", + pkColumnValue="VENDOR_PART_ID", + allocationSize=10) + @Id + @GeneratedValue(strategy=GenerationType.TABLE, generator="vendorPartGen") + public Long getVendorPartNumber() { + return vendorPartNumber; + } + + public void setVendorPartNumber(Long vendorPartNumber) { + this.vendorPartNumber = vendorPartNumber; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public double getPrice() { + return price; + } + + public void setPrice(double price) { + this.price = price; + } + + @OneToOne + @JoinColumns({ + @JoinColumn(name="PARTNUMBER", referencedColumnName="PARTNUMBER"), + @JoinColumn(name="PARTREVISION", referencedColumnName="REVISION") + }) + public Part getPart() { + return part; + } + + public void setPart(Part part) { + this.part = part; + } + + @JoinColumn(name="VENDORID") + @ManyToOne + public Vendor getVendor() { + return vendor; + } + + public void setVendor(Vendor vendor) { + this.vendor = vendor; + } + +} diff --git a/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/repository/CustomerOrderRepository.java b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/repository/CustomerOrderRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..86e2e5b444bd8ef0ffba55410ea24508c75637ee --- /dev/null +++ b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/repository/CustomerOrderRepository.java @@ -0,0 +1,81 @@ +package quarkus.tutorial.order.repository; + +import quarkus.tutorial.order.entity.CustomerOrder; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.persistence.EntityManager; +import jakarta.persistence.PersistenceContext; +import java.util.List; +import java.util.logging.Logger; +import jakarta.transaction.Transactional; + +@ApplicationScoped +public class CustomerOrderRepository { + private static final Logger logger = Logger.getLogger(CustomerOrderRepository.class.getName()); + + @PersistenceContext + private EntityManager em; + + @Transactional + public void createOrder(Integer orderId, char status, int discount, String shipmentInfo) { + try { + CustomerOrder order = new CustomerOrder(orderId, status, discount, shipmentInfo); + em.persist(order); + logger.info("Created order ID " + orderId); + } catch (Exception e) { + logger.severe("Failed to create order ID " + orderId + ": " + e.getMessage()); + throw new RuntimeException(e.getMessage(), e); + } + } + + public List getOrders() { + try { + return em.createNamedQuery("findAllOrders", CustomerOrder.class).getResultList(); + } catch (Exception e) { + logger.severe("Failed to get orders: " + e.getMessage()); + throw new RuntimeException(e.getMessage(), e); + } + } + + @Transactional + public void removeOrder(Integer orderId) { + try { + CustomerOrder order = em.find(CustomerOrder.class, orderId); + if (order != null) { + em.remove(order); + logger.info("Removed order ID " + orderId); + } + } catch (Exception e) { + logger.severe("Failed to remove order ID " + orderId + ": " + e.getMessage()); + throw new RuntimeException(e.getMessage(), e); + } + } + + public double getOrderPrice(Integer orderId) { + try { + CustomerOrder order = em.find(CustomerOrder.class, orderId); + if (order == null) { + throw new RuntimeException("Order ID " + orderId + " not found"); + } + return order.calculateAmmount(); + } catch (Exception e) { + logger.severe("Failed to get price for order ID " + orderId + ": " + e.getMessage()); + throw new RuntimeException(e.getMessage(), e); + } + } + + @Transactional + public void adjustOrderDiscount(int adjustment) { + try { + List orders = em.createNamedQuery("findAllOrders", CustomerOrder.class).getResultList(); + for (CustomerOrder order : orders) { + int newDiscount = order.getDiscount() + adjustment; + order.setDiscount(Math.max(newDiscount, 0)); + em.merge(order); + } + logger.info("Adjusted discount by " + adjustment); + } catch (Exception e) { + logger.severe("Failed to adjust discounts: " + e.getMessage()); + throw new RuntimeException(e.getMessage(), e); + } + } +} \ No newline at end of file diff --git a/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/repository/LineItemRepository.java b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/repository/LineItemRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..7609baa17e767c923e3a92ef301bdcd12851fd7f --- /dev/null +++ b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/repository/LineItemRepository.java @@ -0,0 +1,68 @@ +package quarkus.tutorial.order.repository; + +import quarkus.tutorial.order.entity.CustomerOrder; +import quarkus.tutorial.order.entity.LineItem; +import quarkus.tutorial.order.entity.Part; +import quarkus.tutorial.order.entity.PartKey; +import quarkus.tutorial.order.entity.VendorPart; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.persistence.EntityManager; +import jakarta.persistence.PersistenceContext; +import java.util.List; +import java.util.logging.Logger; +import jakarta.transaction.Transactional; + +@ApplicationScoped +public class LineItemRepository { + private static final Logger logger = Logger.getLogger(LineItemRepository.class.getName()); + + @PersistenceContext + private EntityManager em; + + @Transactional + public void addLineItem(Integer orderId, String partNumber, int revision, int quantity) { + try { + CustomerOrder order = em.find(CustomerOrder.class, orderId); + if (order == null) { + throw new RuntimeException("Order ID " + orderId + " not found"); + } + PartKey pkey = new PartKey(); + pkey.setPartNumber(partNumber); + pkey.setRevision(revision); + Part part = em.find(Part.class, pkey); + if (part == null) { + throw new RuntimeException("Part " + partNumber + "-" + revision + " not found"); + } + VendorPart vendorPart = part.getVendorPart(); + LineItem lineItem = new LineItem(order, quantity, vendorPart); + order.addLineItem(lineItem); + em.persist(lineItem); + logger.info("Added line item for order ID " + orderId + ", part " + partNumber); + } catch (Exception e) { + logger.severe("Failed to add line item for order ID " + orderId + ": " + e.getMessage()); + throw new RuntimeException(e.getMessage(), e); + } + } + + public List getLineItems(int orderId) { + try { + return em.createNamedQuery("findLineItemsByOrderId", LineItem.class) + .setParameter("orderId", orderId) + .getResultList(); + } catch (Exception e) { + logger.severe("Failed to get line items for order ID " + orderId + ": " + e.getMessage()); + throw new RuntimeException(e.getMessage(), e); + } + } + + public int countAllItems() { + try { + return em.createNamedQuery("findAllLineItems", LineItem.class) + .getResultList() + .size(); + } catch (Exception e) { + logger.severe("Failed to count line items: " + e.getMessage()); + throw new RuntimeException(e.getMessage(), e); + } + } +} \ No newline at end of file diff --git a/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/repository/PartRepository.java b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/repository/PartRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..3b3ec5d9949ce9306c18a1794981b11a9ea1b686 --- /dev/null +++ b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/repository/PartRepository.java @@ -0,0 +1,91 @@ +package quarkus.tutorial.order.repository; + +import quarkus.tutorial.order.entity.Part; +import quarkus.tutorial.order.entity.PartKey; +import quarkus.tutorial.order.entity.VendorPart; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.persistence.EntityManager; +import jakarta.persistence.PersistenceContext; +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import java.util.logging.Logger; +import jakarta.transaction.Transactional; + +@ApplicationScoped +public class PartRepository { + private static final Logger logger = Logger.getLogger(PartRepository.class.getName()); + + @PersistenceContext + private EntityManager em; + + @Transactional + public void createPart(String partNumber, int revision, String description, + Date revisionDate, String specification, Serializable drawing) { + try { + Part part = new Part(partNumber, revision, description, revisionDate, specification, drawing); + em.persist(part); + logger.info("Created part " + partNumber + "-" + revision); + } catch (Exception e) { + logger.severe("Failed to create part " + partNumber + "-" + revision + ": " + e.getMessage()); + throw new RuntimeException(e.getMessage(), e); + } + } + + public List getAllParts() { + try { + return em.createNamedQuery("findAllParts", Part.class).getResultList(); + } catch (Exception e) { + logger.severe("Failed to get all parts: " + e.getMessage()); + throw new RuntimeException(e.getMessage(), e); + } + } + + @Transactional + public void addPartToBillOfMaterial(String bomPartNumber, int bomRevision, String partNumber, int revision) { + try { + PartKey bomKey = new PartKey(); + bomKey.setPartNumber(bomPartNumber); + bomKey.setRevision(bomRevision); + Part bom = em.find(Part.class, bomKey); + if (bom == null) { + throw new RuntimeException("BOM part " + bomPartNumber + "-" + bomRevision + " not found"); + } + PartKey partKey = new PartKey(); + partKey.setPartNumber(partNumber); + partKey.setRevision(revision); + Part part = em.find(Part.class, partKey); + if (part == null) { + throw new RuntimeException("Part " + partNumber + "-" + revision + " not found"); + } + bom.getParts().add(part); + part.setBomPart(bom); + em.merge(bom); + logger.info("Added part " + partNumber + " to BOM " + bomPartNumber); + } catch (Exception e) { + logger.severe("Failed to add part to BOM: " + e.getMessage()); + throw new RuntimeException(e.getMessage(), e); + } + } + + public double getBillOfMaterialPrice(String bomPartNumber, int bomRevision) { + try { + PartKey bomKey = new PartKey(); + bomKey.setPartNumber(bomPartNumber); + bomKey.setRevision(bomRevision); + Part bom = em.find(Part.class, bomKey); + if (bom == null) { + throw new RuntimeException("BOM part " + bomPartNumber + "-" + bomRevision + " not found"); + } + double price = 0.0; + for (Part part : bom.getParts()) { + VendorPart vendorPart = part.getVendorPart(); + price += vendorPart.getPrice(); + } + return price; + } catch (Exception e) { + logger.severe("Failed to get BOM price: " + e.getMessage()); + throw new RuntimeException(e.getMessage(), e); + } + } +} \ No newline at end of file diff --git a/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/repository/VendorPartRepository.java b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/repository/VendorPartRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..d233b972d576c67c3f405379bf68f10d2fc356a8 --- /dev/null +++ b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/repository/VendorPartRepository.java @@ -0,0 +1,74 @@ +package quarkus.tutorial.order.repository; + +import quarkus.tutorial.order.entity.Part; +import quarkus.tutorial.order.entity.PartKey; +import quarkus.tutorial.order.entity.Vendor; +import quarkus.tutorial.order.entity.VendorPart; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.persistence.EntityManager; +import jakarta.persistence.PersistenceContext; +import java.util.List; +import java.util.logging.Logger; +import jakarta.transaction.Transactional; + +@ApplicationScoped +public class VendorPartRepository { + private static final Logger logger = Logger.getLogger(VendorPartRepository.class.getName()); + + @PersistenceContext + private EntityManager em; + + @Transactional + public void createVendorPart(String partNumber, int revision, String description, double price, int vendorId) { + try { + PartKey pkey = new PartKey(); + pkey.setPartNumber(partNumber); + pkey.setRevision(revision); + Part part = em.find(Part.class, pkey); + if (part == null) { + throw new RuntimeException("Part " + partNumber + "-" + revision + " not found"); + } + Vendor vendor = em.find(Vendor.class, vendorId); + if (vendor == null) { + throw new RuntimeException("Vendor ID " + vendorId + " not found"); + } + VendorPart vendorPart = new VendorPart(description, price, part); + vendorPart.setVendor(vendor); + vendor.addVendorPart(vendorPart); + em.persist(vendorPart); + logger.info("Created vendor part for part " + partNumber + "-" + revision); + } catch (Exception e) { + logger.severe("Failed to create vendor part: " + e.getMessage()); + throw new RuntimeException(e.getMessage(), e); + } + } + + public Double getAvgPrice() { + try { + return em.createNamedQuery("findAverageVendorPartPrice", Double.class).getSingleResult(); + } catch (Exception e) { + logger.severe("Failed to get average vendor part price: " + e.getMessage()); + throw new RuntimeException(e.getMessage(), e); + } + } + + public Double getTotalPricePerVendor(int vendorId) { + try { + return em.createNamedQuery("findTotalVendorPartPricePerVendor", Double.class) + .setParameter("id", vendorId) + .getSingleResult(); + } catch (Exception e) { + logger.severe("Failed to get total price for vendor ID " + vendorId + ": " + e.getMessage()); + throw new RuntimeException(e.getMessage(), e); + } + } + + public List findAllVendorParts() { + try { + return em.createNamedQuery("findAllVendorParts", VendorPart.class).getResultList(); + } catch (Exception e) { + logger.severe("Failed to get all vendor parts: " + e.getMessage()); + throw new RuntimeException(e.getMessage(), e); + } + } +} \ No newline at end of file diff --git a/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/repository/VendorRepository.java b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/repository/VendorRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..3bc31b92a1431ace492f1864a4a038c396c12430 --- /dev/null +++ b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/repository/VendorRepository.java @@ -0,0 +1,64 @@ +package quarkus.tutorial.order.repository; + +import quarkus.tutorial.order.entity.Vendor; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.persistence.EntityManager; +import jakarta.persistence.PersistenceContext; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Logger; +import jakarta.transaction.Transactional; + +@ApplicationScoped +public class VendorRepository { + private static final Logger logger = Logger.getLogger(VendorRepository.class.getName()); + + @PersistenceContext + private EntityManager em; + + @Transactional + public void createVendor(int vendorId, String name, String address, String contact, String phone) { + try { + Vendor vendor = new Vendor(vendorId, name, address, contact, phone); + em.persist(vendor); + logger.info("Created vendor ID " + vendorId); + } catch (Exception e) { + logger.severe("Failed to create vendor ID " + vendorId + ": " + e.getMessage()); + throw new RuntimeException(e.getMessage(), e); + } + } + + public List locateVendorsByPartialName(String name) { + try { + List vendors = em.createNamedQuery("findVendorsByPartialName", Vendor.class) + .setParameter("name", name) + .getResultList(); + List names = new ArrayList<>(); + for (Vendor vendor : vendors) { + names.add(vendor.getName()); + } + return names; + } catch (Exception e) { + logger.severe("Failed to locate vendors by name " + name + ": " + e.getMessage()); + throw new RuntimeException(e.getMessage(), e); + } + } + + public String reportVendorsByOrder(Integer orderId) { + try { + List vendors = em.createNamedQuery("findVendorByCustomerOrder", Vendor.class) + .setParameter("id", orderId) + .getResultList(); + StringBuilder report = new StringBuilder(); + for (Vendor vendor : vendors) { + report.append(vendor.getVendorId()).append(' ') + .append(vendor.getName()).append(' ') + .append(vendor.getContact()).append('\n'); + } + return report.toString(); + } catch (Exception e) { + logger.severe("Failed to report vendors for order ID " + orderId + ": " + e.getMessage()); + throw new RuntimeException(e.getMessage(), e); + } + } +} \ No newline at end of file diff --git a/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/service/OrderConfigService.java b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/service/OrderConfigService.java new file mode 100644 index 0000000000000000000000000000000000000000..290dd71c022fc9f0f54d741342990212cc3ae2e3 --- /dev/null +++ b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/service/OrderConfigService.java @@ -0,0 +1,71 @@ +package quarkus.tutorial.order.service; + +import quarkus.tutorial.order.repository.CustomerOrderRepository; +import quarkus.tutorial.order.repository.LineItemRepository; +import quarkus.tutorial.order.repository.PartRepository; +import quarkus.tutorial.order.repository.VendorPartRepository; +import quarkus.tutorial.order.repository.VendorRepository; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import jakarta.transaction.Transactional; +import java.util.logging.Logger; + +@ApplicationScoped +public class OrderConfigService { + private static final Logger logger = Logger.getLogger(OrderConfigService.class.getName()); + + @Inject + private PartRepository partRepository; + @Inject + private VendorRepository vendorRepository; + @Inject + private VendorPartRepository vendorPartRepository; + @Inject + private CustomerOrderRepository customerOrderRepository; + @Inject + private LineItemRepository lineItemRepository; + + @Transactional + public void createData() { + logger.info("Starting dataset initialization"); + + // Create Parts + partRepository.createPart("1234-5678-01", 1, "ABC PART", new java.util.Date(), "PARTQWERTYUIOPASXDCFVGBHNJMKL", null); + partRepository.createPart("9876-4321-02", 2, "DEF PART", new java.util.Date(), "PARTQWERTYUIOPASXDCFVGBHNJMKL", null); + partRepository.createPart("5456-6789-03", 3, "GHI PART", new java.util.Date(), "PARTQWERTYUIOPASXDCFVGBHNJMKL", null); + partRepository.createPart("ABCD-XYZW-FF", 5, "XYZ PART", new java.util.Date(), "PARTQWERTYUIOPASXDCFVGBHNJMKL", null); + partRepository.createPart("SDFG-ERTY-BN", 7, "BOM PART", new java.util.Date(), "PARTQWERTYUIOPASXDCFVGBHNJMKL", null); + + // Add Parts to BOM + partRepository.addPartToBillOfMaterial("SDFG-ERTY-BN", 7, "1234-5678-01", 1); + partRepository.addPartToBillOfMaterial("SDFG-ERTY-BN", 7, "9876-4321-02", 2); + partRepository.addPartToBillOfMaterial("SDFG-ERTY-BN", 7, "5456-6789-03", 3); + partRepository.addPartToBillOfMaterial("SDFG-ERTY-BN", 7, "ABCD-XYZW-FF", 5); + + // Create Vendors + vendorRepository.createVendor(100, "WidgetCorp", "111 Main St., Anytown, KY 99999", "Mr. Jones", "888-777-9999"); + vendorRepository.createVendor(200, "Gadget, Inc.", "123 State St., Sometown, MI 88888", "Mrs. Smith", "866-345-6789"); + + // Create VendorParts + vendorPartRepository.createVendorPart("1234-5678-01", 1, "PART1", 100.00, 100); + vendorPartRepository.createVendorPart("9876-4321-02", 2, "PART2", 10.44, 200); + vendorPartRepository.createVendorPart("5456-6789-03", 3, "PART3", 76.23, 200); + vendorPartRepository.createVendorPart("ABCD-XYZW-FF", 5, "PART4", 55.19, 100); + vendorPartRepository.createVendorPart("SDFG-ERTY-BN", 7, "PART5", 345.87, 100); + + // Create Orders and LineItems + Integer orderId = 1111; + customerOrderRepository.createOrder(orderId, 'N', 10, "333 New Court, New City, CA 90000"); + lineItemRepository.addLineItem(orderId, "1234-5678-01", 1, 3); + lineItemRepository.addLineItem(orderId, "9876-4321-02", 2, 5); + lineItemRepository.addLineItem(orderId, "ABCD-XYZW-FF", 5, 7); + + orderId = 4312; + customerOrderRepository.createOrder(orderId, 'N', 0, "333 New Court, New City, CA 90000"); + lineItemRepository.addLineItem(orderId, "SDFG-ERTY-BN", 7, 1); + lineItemRepository.addLineItem(orderId, "ABCD-XYZW-FF", 5, 3); + lineItemRepository.addLineItem(orderId, "1234-5678-01", 1, 15); + + logger.info("Order data initialization completed successfully"); + } +} \ No newline at end of file diff --git a/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/web/OrderController.java b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/web/OrderController.java new file mode 100644 index 0000000000000000000000000000000000000000..c9162c17a27504816c8c95ffba2061a228f45605 --- /dev/null +++ b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/web/OrderController.java @@ -0,0 +1,97 @@ +package quarkus.tutorial.order.web; + +import quarkus.tutorial.order.entity.CustomerOrder; +import quarkus.tutorial.order.entity.LineItem; +import quarkus.tutorial.order.entity.Part; +import quarkus.tutorial.order.repository.CustomerOrderRepository; +import quarkus.tutorial.order.repository.LineItemRepository; +import quarkus.tutorial.order.repository.PartRepository; +import quarkus.tutorial.order.repository.VendorRepository; +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; +import jakarta.inject.Named; +import java.io.Serializable; +import java.util.List; +import java.util.logging.Logger; + +@RequestScoped +@Named +public class OrderController implements Serializable { + private static final long serialVersionUID = 2142383151318489373L; + private static final Logger logger = Logger.getLogger(OrderController.class.getName()); + + @Inject + private CustomerOrderRepository customerOrderRepository; + @Inject + private LineItemRepository lineItemRepository; + @Inject + private PartRepository partRepository; + @Inject + private VendorRepository vendorRepository; + + public List getOrders() { + try { + return customerOrderRepository.getOrders(); + } catch (Exception e) { + logger.warning("Couldn't get orders: " + e.getMessage()); + return null; + } + } + + public List getLineItems(Integer currentOrder) { + try { + return lineItemRepository.getLineItems(currentOrder); + } catch (Exception e) { + logger.warning("Couldn't get line items for order ID " + currentOrder + ": " + e.getMessage()); + return null; + } + } + + public String removeOrder(Integer orderId) { + try { + customerOrderRepository.removeOrder(orderId); + logger.info("Removed order " + orderId); + return "/orders"; + } catch (Exception e) { + logger.warning("Problem removing order ID " + orderId + ": " + e.getMessage()); + return null; + } + } + + public List findVendor(String vendorName) { + try { + List vendorSearchResults = vendorRepository.locateVendorsByPartialName(vendorName); + logger.info("Found " + vendorSearchResults.size() + " vendor(s) using search string " + vendorName); + return vendorSearchResults; + } catch (Exception e) { + logger.warning("Problem finding vendors: " + e.getMessage()); + return null; + } + } + + public String submitOrder(Integer newOrderId, char newOrderStatus, int newOrderDiscount, String newOrderShippingInfo) { + try { + customerOrderRepository.createOrder(newOrderId, newOrderStatus, newOrderDiscount, newOrderShippingInfo); + logger.info("Created new order with ID " + newOrderId); + return "/orders"; + } catch (Exception e) { + logger.warning("Problem creating order: " + e.getMessage()); + return null; + } + } + + public String addLineItem(Integer currentOrder, String selectedPartNumber, int selectedPartRevision) { + try { + lineItemRepository.addLineItem(currentOrder, selectedPartNumber, selectedPartRevision, 1); + logger.info("Added line item to order ID " + currentOrder); + return "/lineItems?orderId=" + currentOrder; + } catch (Exception e) { + logger.warning("Problem adding line item to order ID " + currentOrder + ": " + e.getMessage()); + return null; + } + } + + public List getNewOrderParts() { + return partRepository.getAllParts(); + } +} \ No newline at end of file diff --git a/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/web/OrderWebController.java b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/web/OrderWebController.java new file mode 100644 index 0000000000000000000000000000000000000000..9eee4f522df01b62c44edf0149200704a8f867a3 --- /dev/null +++ b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/web/OrderWebController.java @@ -0,0 +1,89 @@ +package quarkus.tutorial.order.web; + +import io.quarkus.qute.Template; +import io.quarkus.qute.TemplateInstance; +import jakarta.inject.Inject; +import jakarta.ws.rs.*; +import jakarta.ws.rs.core.MediaType; +import java.util.List; + +@Path("/") +public class OrderWebController { + + @Inject + OrderController orderController; + + @Inject + Template orders; + + @Inject + Template lineItems; + + @GET + @Path("/orders") + @Produces(MediaType.TEXT_HTML) + public TemplateInstance getOrders(@QueryParam("vendorName") String vendorName, @QueryParam("vendorSearchResults") List vendorSearchResults) { + return orders.data("orders", orderController.getOrders()) + .data("vendorName", vendorName) + .data("vendorSearchResults", vendorSearchResults) + .data("findVendorTableDisabled", vendorSearchResults != null); + } + + @POST + @Path("/submitOrder") + @Produces(MediaType.TEXT_HTML) + public TemplateInstance submitOrder( + @FormParam("newOrderId") Integer newOrderId, + @FormParam("newOrderStatus") String newOrderStatus, + @FormParam("newOrderDiscount") int newOrderDiscount, + @FormParam("newOrderShippingInfo") String newOrderShippingInfo) { + orderController.submitOrder(newOrderId, newOrderStatus.charAt(0), newOrderDiscount, newOrderShippingInfo); + return orders.data("orders", orderController.getOrders()) + .data("vendorName", null) + .data("vendorSearchResults", null) + .data("findVendorTableDisabled", false); + } + + @POST + @Path("/removeOrder") + @Produces(MediaType.TEXT_HTML) + public TemplateInstance removeOrder(@FormParam("orderId") Integer orderId) { + orderController.removeOrder(orderId); + return orders.data("orders", orderController.getOrders()) + .data("vendorName", null) + .data("vendorSearchResults", null) + .data("findVendorTableDisabled", false); + } + + @GET + @Path("/lineItems") + @Produces(MediaType.TEXT_HTML) + public TemplateInstance getLineItems(@QueryParam("orderId") Integer orderId) { + return lineItems.data("currentOrder", orderId) + .data("lineItems", orderController.getLineItems(orderId)) + .data("newOrderParts", orderController.getNewOrderParts()); + } + + @POST + @Path("/addLineItem") + @Produces(MediaType.TEXT_HTML) + public TemplateInstance addLineItem( + @FormParam("currentOrder") Integer currentOrder, + @FormParam("selectedPartNumber") String selectedPartNumber, + @FormParam("selectedPartRevision") int selectedPartRevision) { + orderController.addLineItem(currentOrder, selectedPartNumber, selectedPartRevision); + return lineItems.data("currentOrder", currentOrder) + .data("lineItems", orderController.getLineItems(currentOrder)) + .data("newOrderParts", orderController.getNewOrderParts()); + } + + @POST + @Path("/findVendor") + @Produces(MediaType.TEXT_HTML) + public TemplateInstance findVendor(@FormParam("vendorName") String vendorName) { + return orders.data("orders", orderController.getOrders()) + .data("vendorName", vendorName) + .data("vendorSearchResults", orderController.findVendor(vendorName)) + .data("findVendorTableDisabled", true); + } +} \ No newline at end of file diff --git a/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/web/StartupInitializer.java b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/web/StartupInitializer.java new file mode 100644 index 0000000000000000000000000000000000000000..c5186fbf8c49a88dfdb13b31ee14091f8d7a70b2 --- /dev/null +++ b/benchmark/persistence/order/quarkus/src/main/java/quarkus/tutorial/order/web/StartupInitializer.java @@ -0,0 +1,23 @@ + +package quarkus.tutorial.order.web; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.event.Observes; +import jakarta.inject.Inject; +import io.quarkus.runtime.StartupEvent; +import java.util.logging.Logger; +import quarkus.tutorial.order.service.OrderConfigService; + +@ApplicationScoped +public class StartupInitializer { + private static final Logger logger = Logger.getLogger(StartupInitializer.class.getName()); + + @Inject + OrderConfigService orderConfigService; + + void onStart(@Observes StartupEvent ev) { + logger.info("Manually triggering dataset initialization"); + orderConfigService.createData(); + logger.info("Manual dataset initialization completed"); + } +} diff --git a/benchmark/persistence/order/quarkus/src/main/resources/application.properties b/benchmark/persistence/order/quarkus/src/main/resources/application.properties new file mode 100644 index 0000000000000000000000000000000000000000..0ad1f4468ebf5fd497be1cd3142bc34260c260ae --- /dev/null +++ b/benchmark/persistence/order/quarkus/src/main/resources/application.properties @@ -0,0 +1,10 @@ +quarkus.http.port=8082 +quarkus.datasource.db-kind=h2 +quarkus.datasource.jdbc.url=jdbc:h2:mem:order;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE +quarkus.datasource.username=sa +quarkus.datasource.password= +quarkus.hibernate-orm.database.generation=update +quarkus.hibernate-orm.log.sql=true +quarkus.qute.suffixes=html +quarkus.datasource.jdbc.transactions=xa +quarkus.hibernate-orm.jdbc.transactions.enabled=trueq \ No newline at end of file diff --git a/benchmark/persistence/order/quarkus/src/main/resources/css/default.css b/benchmark/persistence/order/quarkus/src/main/resources/css/default.css new file mode 100644 index 0000000000000000000000000000000000000000..cf1f0b31d150939811f62238b663f7995cc7b727 --- /dev/null +++ b/benchmark/persistence/order/quarkus/src/main/resources/css/default.css @@ -0,0 +1,49 @@ +/** + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +body { + background-color: #ffffff; + font-size: 12px; + font-family: Verdana, "Verdana CE", Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + color: #000000; + margin: 10px; +} + +h1 { + font-family: Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + border-bottom: 1px solid #AFAFAF; + font-size: 16px; + font-weight: bold; + margin: 0px; + padding: 0px; + color: #D20005; +} + +a:link, a:visited { + color: #045491; + font-weight : bold; + text-decoration: none; +} + +a:link:hover, a:visited:hover { + color: #045491; + font-weight : bold; + text-decoration : underline; +} + +th { + font-weight: bold; + text-align: center; +} + +td { + text-align: center; +} diff --git a/benchmark/persistence/order/quarkus/src/main/resources/templates/lineItemTemplate.html b/benchmark/persistence/order/quarkus/src/main/resources/templates/lineItemTemplate.html new file mode 100644 index 0000000000000000000000000000000000000000..9983c874871cfd474c9a1c0e415ba45cd7125250 --- /dev/null +++ b/benchmark/persistence/order/quarkus/src/main/resources/templates/lineItemTemplate.html @@ -0,0 +1,12 @@ + + + + {#insert title}Default Title{/insert} + + + +

{#insert title}Default Title{/insert}

+ + {#insert body}Default Body{/insert} + + \ No newline at end of file diff --git a/benchmark/persistence/order/quarkus/src/main/resources/templates/lineItems.html b/benchmark/persistence/order/quarkus/src/main/resources/templates/lineItems.html new file mode 100644 index 0000000000000000000000000000000000000000..eb0764a4b3d9b642ae85e530b2e0d3da6c33b333 --- /dev/null +++ b/benchmark/persistence/order/quarkus/src/main/resources/templates/lineItems.html @@ -0,0 +1,55 @@ + + + + Line Items for Order {currentOrder} + + + {#include lineItemTemplate} + {#title}Line Items for Order {currentOrder}{/title} + {#body} +
+ + + + + + + {#for lineItem in lineItems} + + + + + + {/for} +
Item IDQuantityVendor Part Number
{lineItem.itemId}{lineItem.quantity}{lineItem.vendorPart?.vendorPartNumber ?: 'N/A'}
+
+ + + + + + + + {#for part in newOrderParts} + + + + + + + {/for} +
Part NumberRevisionVendor Part NumberAdd To Order
{part.partNumber}{part.revision}{part.vendorPart?.vendorPartNumber ?: 'N/A'} + + + + + + +
+
+ Back to Orders + + {/body} + {/include} + + \ No newline at end of file diff --git a/benchmark/persistence/order/quarkus/src/main/resources/templates/orderTemplate.html b/benchmark/persistence/order/quarkus/src/main/resources/templates/orderTemplate.html new file mode 100644 index 0000000000000000000000000000000000000000..38422e2c5233540464a71bd87bd3f84c72ee2227 --- /dev/null +++ b/benchmark/persistence/order/quarkus/src/main/resources/templates/orderTemplate.html @@ -0,0 +1,23 @@ + + + + {#insert title}Default Title{/insert} + + + +

{#insert title}Default Title{/insert}

+ + {#insert body}Default Body{/insert} + +

View All Orders

+ {#insert ordersTable}Default ordersTable{/insert} + +

Create New Order

+ {#insert newOrderForm}Default new orders form{/insert} + +

Find Vendors

+ {#insert findVendorForm}Default find vendors form{/insert} + + {#insert findVendorTable}Default find vendor table{/insert} + + \ No newline at end of file diff --git a/benchmark/persistence/order/quarkus/src/main/resources/templates/orders.html b/benchmark/persistence/order/quarkus/src/main/resources/templates/orders.html new file mode 100644 index 0000000000000000000000000000000000000000..b9ee1059a8e3848d7fd9858e412069c65c228af2 --- /dev/null +++ b/benchmark/persistence/order/quarkus/src/main/resources/templates/orders.html @@ -0,0 +1,83 @@ + + + + Order Java Persistence Example + + + {#include orderTemplate} + {#title}Order Java Persistence Example{/title} + {#ordersTable} + + + + + + + + + + {#for order in orders} + + + + + + + + + {/for} +
Order IDShipment InfoStatusLast UpdatedDiscountActions
+ {order.orderId} + {order.shipmentInfo}{order.status}{order.lastUpdate}{order.discount}% +
+ + +
+
+ {/ordersTable} + {#newOrderForm} +
+ +
+ +
+ +
+ +
+ +
+ {/newOrderForm} + {#findVendorForm} +
+ + + +
+ {/findVendorForm} + {#findVendorTable} + {#if findVendorTableDisabled} + + + {#for vendor in vendorSearchResults} + + {/for} +
Vendor
{vendor}
+ {/if} + {/findVendorTable} + {/include} + + \ No newline at end of file diff --git a/benchmark/persistence/order/quarkus/test.sh b/benchmark/persistence/order/quarkus/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..6f5388b3a69b90f8fd435067c7959ff27e990d76 --- /dev/null +++ b/benchmark/persistence/order/quarkus/test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +BASE_URL="${BASE_URL:-http://localhost:8082}" + +echo "Health check: ${BASE_URL}/" +HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}/") + +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "PASS - got HTTP ${HTTP_STATUS}" + exit 0 +else + echo "FAIL - got HTTP ${HTTP_STATUS}" + exit 1 +fi diff --git a/benchmark/persistence/order/spring/.dockerignore b/benchmark/persistence/order/spring/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..c634c57d9244b4e60b8fa936f09dbe4e75706e74 --- /dev/null +++ b/benchmark/persistence/order/spring/.dockerignore @@ -0,0 +1,41 @@ +# VCS +.git/ + +# Maven +.mvn/ +**/.mvn/ +mvnw +mvnw.cmd +**/mvnw +**/mvnw.cmd +target/ +**/target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties + +# IDE / Editor +.vscode/ +**/.vscode/ +.zed/ +**/.zed/ +.idea/ +**/.idea/ +*.iml +*.ipr +*.iws + +# OS +.DS_Store +**/.DS_Store +Thumbs.db +ehthumbs.db + +# Logs / temp +*.log +*.tmp +*.temp diff --git a/benchmark/persistence/order/spring/.mvn/wrapper/maven-wrapper.properties b/benchmark/persistence/order/spring/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..c0bcafe984fe33005eacbcfabe8b188e0f75afcd --- /dev/null +++ b/benchmark/persistence/order/spring/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,3 @@ +wrapperVersion=3.3.4 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip diff --git a/benchmark/persistence/order/spring/Dockerfile b/benchmark/persistence/order/spring/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..57e175bfb6aea19c77e95e82697b83253c1d3191 --- /dev/null +++ b/benchmark/persistence/order/spring/Dockerfile @@ -0,0 +1,31 @@ +FROM maven:3.9.12-ibm-semeru-21-noble + +USER root +# install uv +RUN apt-get update && apt-get install -y --no-install-recommends curl python3-venv python3-full && curl -LsSf https://astral.sh/uv/install.sh | sh + +ENV PATH="/root/.local/bin:$PATH" + +# Shared browsers path so Chromium is cached once +ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright +RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright + +# create venv and install +RUN uv venv /opt/venv && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest + +ENV PATH="/opt/venv/bin:$PATH" +RUN playwright install --with-deps chromium + +# Set working directory +WORKDIR /app + +# Copy all the assets +COPY . . + +COPY test.sh . +RUN chmod +x test.sh + +# Build application at image build time +RUN mvn clean install -DskipTests + +CMD ["mvn", "spring-boot:run"] diff --git a/benchmark/persistence/order/spring/README.md b/benchmark/persistence/order/spring/README.md new file mode 100644 index 0000000000000000000000000000000000000000..b8984036cd17c2fa1107f9de2ee80387f2efb669 --- /dev/null +++ b/benchmark/persistence/order/spring/README.md @@ -0,0 +1,110 @@ +# Order Management Application - Spring Boot Version + +This is a Spring Boot conversion of the Jakarta EE Order Management application, maintaining the original JSF frontend while using Spring Boot for the backend services. + +## Features + +- **Order Management**: Create, view, and delete customer orders +- **Line Item Management**: Add parts to orders as line items +- **Part Management**: Manage parts with bill of materials (BOM) relationships +- **Vendor Management**: Search and manage vendor information +- **Vendor Part Management**: Associate parts with vendors and pricing + +## Technology Stack + +- **Spring Boot 3.2.0** - Main framework +- **Spring Data JPA** - Data access layer +- **JSF 4.0** - Web framework (maintaining original frontend) +- **H2 Database** - In-memory database for development +- **Maven** - Build tool + +## Project Structure + +``` +src/main/java/com/example/orderspring/ +├── entity/ # JPA entities (Part, CustomerOrder, LineItem, etc.) +├── repository/ # Spring Data JPA repositories +├── service/ # Business logic services +├── web/ # JSF managed beans +├── config/ # Spring configuration classes +└── OrderApplication.java # Main Spring Boot application + +src/main/webapp/ +├── *.xhtml # JSF pages (copied from Jakarta version) +├── resources/css/ # CSS stylesheets +└── WEB-INF/ # Web configuration files +``` + +## Key Changes from Jakarta EE Version + +1. **Dependency Injection**: Replaced `@EJB` with `@Autowired` and Spring's dependency injection +2. **Persistence**: Replaced JTA with Spring's `@Transactional` annotations +3. **Managed Beans**: Converted JSF managed beans to Spring `@Component` beans +4. **Configuration**: Replaced `persistence.xml` with Spring Boot's `application.properties` +5. **Database**: Added H2 database for development (replaces Payara's default datasource) + +## Running the Application + +1. **Prerequisites**: + - Java 17 or higher + - Maven 3.6 or higher + +2. **Build and Run**: + ```bash + cd persistence/spring/order + mvn clean install + mvn spring-boot:run + ``` + +3. **Access the Application**: + - Main application: http://localhost:8080/order.xhtml + - H2 Database Console: http://localhost:8080/h2-console + - JDBC URL: `jdbc:h2:mem:testdb` + - Username: `sa` + - Password: (empty) + +## Application Features + +### Order Management +- View all orders in a table format +- Create new orders with status, discount, and shipping information +- Delete existing orders +- Navigate to line items for each order + +### Line Item Management +- View line items for a specific order +- Add parts to orders as line items +- Each line item includes quantity and vendor part information + +### Part Management +- View all available parts +- Parts can have bill of materials (BOM) relationships +- Each part can be associated with a vendor part + +### Vendor Management +- Search vendors by partial name +- View vendor information and contact details + +## Database Schema + +The application uses the same database schema as the original Jakarta EE version: +- `PERSISTENCE_ORDER_PART` - Parts table +- `PERSISTENCE_ORDER_CUSTOMERORDER` - Orders table +- `PERSISTENCE_ORDER_LINEITEM` - Line items table +- `PERSISTENCE_ORDER_VENDOR` - Vendors table +- `PERSISTENCE_ORDER_VENDOR_PART` - Vendor parts table + +## Configuration + +The application is configured through `application.properties`: +- Database connection settings +- JPA/Hibernate configuration +- JSF configuration +- Logging levels + +## Development Notes + +- The application automatically creates sample data on startup +- All original JSF pages and functionality are preserved +- The UI remains exactly the same as the Jakarta EE version +- Spring Boot provides embedded server, so no external application server is needed diff --git a/benchmark/persistence/order/spring/mvnw b/benchmark/persistence/order/spring/mvnw new file mode 100644 index 0000000000000000000000000000000000000000..bd8896bf2217b46faa0291585e01ac1a3441a958 --- /dev/null +++ b/benchmark/persistence/order/spring/mvnw @@ -0,0 +1,295 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.4 +# +# Optional ENV vars +# ----------------- +# JAVA_HOME - location of a JDK home dir, required when download maven via java source +# MVNW_REPOURL - repo url base for downloading maven distribution +# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output +# ---------------------------------------------------------------------------- + +set -euf +[ "${MVNW_VERBOSE-}" != debug ] || set -x + +# OS specific support. +native_path() { printf %s\\n "$1"; } +case "$(uname)" in +CYGWIN* | MINGW*) + [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" + native_path() { cygpath --path --windows "$1"; } + ;; +esac + +# set JAVACMD and JAVACCMD +set_java_home() { + # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched + if [ -n "${JAVA_HOME-}" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACCMD="$JAVA_HOME/jre/sh/javac" + else + JAVACMD="$JAVA_HOME/bin/java" + JAVACCMD="$JAVA_HOME/bin/javac" + + if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then + echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 + echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 + return 1 + fi + fi + else + JAVACMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v java + )" || : + JAVACCMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v javac + )" || : + + if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then + echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 + return 1 + fi + fi +} + +# hash string like Java String::hashCode +hash_string() { + str="${1:-}" h=0 + while [ -n "$str" ]; do + char="${str%"${str#?}"}" + h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) + str="${str#?}" + done + printf %x\\n $h +} + +verbose() { :; } +[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } + +die() { + printf %s\\n "$1" >&2 + exit 1 +} + +trim() { + # MWRAPPER-139: + # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. + # Needed for removing poorly interpreted newline sequences when running in more + # exotic environments such as mingw bash on Windows. + printf "%s" "${1}" | tr -d '[:space:]' +} + +scriptDir="$(dirname "$0")" +scriptName="$(basename "$0")" + +# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties +while IFS="=" read -r key value; do + case "${key-}" in + distributionUrl) distributionUrl=$(trim "${value-}") ;; + distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; + esac +done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" + +case "${distributionUrl##*/}" in +maven-mvnd-*bin.*) + MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ + case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in + *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; + :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; + :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; + :Linux*x86_64*) distributionPlatform=linux-amd64 ;; + *) + echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 + distributionPlatform=linux-amd64 + ;; + esac + distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" + ;; +maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; +*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; +esac + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" +distributionUrlName="${distributionUrl##*/}" +distributionUrlNameMain="${distributionUrlName%.*}" +distributionUrlNameMain="${distributionUrlNameMain%-bin}" +MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" +MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" + +exec_maven() { + unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : + exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" +} + +if [ -d "$MAVEN_HOME" ]; then + verbose "found existing MAVEN_HOME at $MAVEN_HOME" + exec_maven "$@" +fi + +case "${distributionUrl-}" in +*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; +*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; +esac + +# prepare tmp dir +if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then + clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } + trap clean HUP INT TERM EXIT +else + die "cannot create temp dir" +fi + +mkdir -p -- "${MAVEN_HOME%/*}" + +# Download and Install Apache Maven +verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +verbose "Downloading from: $distributionUrl" +verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +# select .zip or .tar.gz +if ! command -v unzip >/dev/null; then + distributionUrl="${distributionUrl%.zip}.tar.gz" + distributionUrlName="${distributionUrl##*/}" +fi + +# verbose opt +__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' +[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v + +# normalize http auth +case "${MVNW_PASSWORD:+has-password}" in +'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; +has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; +esac + +if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then + verbose "Found wget ... using wget" + wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" +elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then + verbose "Found curl ... using curl" + curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" +elif set_java_home; then + verbose "Falling back to use Java to download" + javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" + targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" + cat >"$javaSource" <<-END + public class Downloader extends java.net.Authenticator + { + protected java.net.PasswordAuthentication getPasswordAuthentication() + { + return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); + } + public static void main( String[] args ) throws Exception + { + setDefault( new Downloader() ); + java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); + } + } + END + # For Cygwin/MinGW, switch paths to Windows format before running javac and java + verbose " - Compiling Downloader.java ..." + "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" + verbose " - Running Downloader.java ..." + "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" +fi + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +if [ -n "${distributionSha256Sum-}" ]; then + distributionSha256Result=false + if [ "$MVN_CMD" = mvnd.sh ]; then + echo "Checksum validation is not supported for maven-mvnd." >&2 + echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + elif command -v sha256sum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then + distributionSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $distributionSha256Result = false ]; then + echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 + echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 + exit 1 + fi +fi + +# unzip and move +if command -v unzip >/dev/null; then + unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" +else + tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" +fi + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +actualDistributionDir="" + +# First try the expected directory name (for regular distributions) +if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then + if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then + actualDistributionDir="$distributionUrlNameMain" + fi +fi + +# If not found, search for any directory with the Maven executable (for snapshots) +if [ -z "$actualDistributionDir" ]; then + # enable globbing to iterate over items + set +f + for dir in "$TMP_DOWNLOAD_DIR"/*; do + if [ -d "$dir" ]; then + if [ -f "$dir/bin/$MVN_CMD" ]; then + actualDistributionDir="$(basename "$dir")" + break + fi + fi + done + set -f +fi + +if [ -z "$actualDistributionDir" ]; then + verbose "Contents of $TMP_DOWNLOAD_DIR:" + verbose "$(ls -la "$TMP_DOWNLOAD_DIR")" + die "Could not find Maven distribution directory in extracted archive" +fi + +verbose "Found extracted Maven distribution directory: $actualDistributionDir" +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" + +clean || : +exec_maven "$@" diff --git a/benchmark/persistence/order/spring/mvnw.cmd b/benchmark/persistence/order/spring/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..5761d948924c19571d27b465c519b2e2f9e30351 --- /dev/null +++ b/benchmark/persistence/order/spring/mvnw.cmd @@ -0,0 +1,189 @@ +<# : batch portion +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.4 +@REM +@REM Optional ENV vars +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output +@REM ---------------------------------------------------------------------------- + +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) +) +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> + +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} + +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} + +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' + +$MAVEN_M2_PATH = "$HOME/.m2" +if ($env:MAVEN_USER_HOME) { + $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME" +} + +if (-not (Test-Path -Path $MAVEN_M2_PATH)) { + New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null +} + +$MAVEN_WRAPPER_DISTS = $null +if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) { + $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists" +} else { + $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists" +} + +$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain" +$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" + +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} + +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} + +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} + +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null + +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +$actualDistributionDir = "" + +# First try the expected directory name (for regular distributions) +$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain" +$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD" +if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) { + $actualDistributionDir = $distributionUrlNameMain +} + +# If not found, search for any directory with the Maven executable (for snapshots) +if (!$actualDistributionDir) { + Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object { + $testPath = Join-Path $_.FullName "bin/$MVN_CMD" + if (Test-Path -Path $testPath -PathType Leaf) { + $actualDistributionDir = $_.Name + } + } +} + +if (!$actualDistributionDir) { + Write-Error "Could not find Maven distribution directory in extracted archive" +} + +Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir" +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/benchmark/persistence/order/spring/pom.xml b/benchmark/persistence/order/spring/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..6907094544b0f7d55d41ee68073e44ac153522c2 --- /dev/null +++ b/benchmark/persistence/order/spring/pom.xml @@ -0,0 +1,67 @@ + + 4.0.0 + + + org.springframework.boot + spring-boot-starter-parent + 3.3.7 + + + + example + order-boot + 1.0.0-SNAPSHOT + order-boot + jar + + + 17 + 5.5.6 + 17 + 17 + UTF-8 + + + + + + org.joinfaces + joinfaces-bom + ${joinfaces.version} + pom + import + + + + + + + org.joinfaces + primefaces-spring-boot-starter + + + org.springframework.boot + spring-boot-starter-data-jpa + + + com.h2database + h2 + 2.2.224 + runtime + + + jakarta.inject + jakarta.inject-api + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + diff --git a/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/OrderApplication.java b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/OrderApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..fe5e4f8a4087def3ee584c94d323dba66755a5ab --- /dev/null +++ b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/OrderApplication.java @@ -0,0 +1,12 @@ +package com.example.orderspring; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class OrderApplication { + + public static void main(String[] args) { + SpringApplication.run(OrderApplication.class, args); + } +} diff --git a/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/entity/CustomerOrder.java b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/entity/CustomerOrder.java new file mode 100644 index 0000000000000000000000000000000000000000..999a79d369f3d06c305845cb6fcd5d0c92de5e13 --- /dev/null +++ b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/entity/CustomerOrder.java @@ -0,0 +1,119 @@ +package com.example.orderspring.entity; + +import jakarta.persistence.*; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; + +@Entity +@Table(name="PERSISTENCE_ORDER_CUSTOMERORDER") +@NamedQuery( + name="findAllOrders", + query="SELECT co FROM CustomerOrder co " + + "ORDER BY co.orderId" +) +public class CustomerOrder implements Serializable { + private static final long serialVersionUID = 6582105865012174694L; + + private Integer orderId; + private char status; + private Date lastUpdate; + private int discount; + private String shipmentInfo; + private Collection lineItems = new ArrayList<>(); + + public CustomerOrder() { + this.lastUpdate = new Date(); + } + + public CustomerOrder(Integer orderId, char status, int discount, + String shipmentInfo) { + this.orderId = orderId; + this.status = status; + this.discount = discount; + this.shipmentInfo = shipmentInfo; + this.lastUpdate = new Date(); + } + + @Id + public Integer getOrderId() { + return orderId; + } + + public void setOrderId(Integer orderId) { + this.orderId = orderId; + } + + public char getStatus() { + return status; + } + + public void setStatus(char status) { + this.status = status; + } + + @Temporal(TemporalType.TIMESTAMP) + public Date getLastUpdate() { + return lastUpdate; + } + + public void setLastUpdate(Date lastUpdate) { + this.lastUpdate = lastUpdate; + } + + public int getDiscount() { + return discount; + } + + public void setDiscount(int discount) { + this.discount = discount; + } + + public String getShipmentInfo() { + return shipmentInfo; + } + + public void setShipmentInfo(String shipmentInfo) { + this.shipmentInfo = shipmentInfo; + } + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "customerOrder", orphanRemoval = true) + public Collection getLineItems() { + return lineItems; + } + + public void setLineItems(Collection lineItems) { + this.lineItems = lineItems; + } + + public double calculateAmmount() { + double amount = 0; + for (LineItem item : getLineItems()) { + if (item.getVendorPart() != null) { + amount += item.getVendorPart().getPrice() * item.getQuantity(); + } + } + return (amount * (100 - getDiscount())) / 100.0; + } + + public double calculateAmount() { + return calculateAmmount(); + } + + public void addLineItem(LineItem lineItem) { + lineItem.setCustomerOrder(this); + this.getLineItems().add(lineItem); + } + + @Transient + public int getNextId() { + return this.lineItems.size() + 1; + } + + @PrePersist + @PreUpdate + private void touchLastUpdate() { + this.lastUpdate = new Date(); + } +} diff --git a/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/entity/LineItem.java b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/entity/LineItem.java new file mode 100644 index 0000000000000000000000000000000000000000..38af10f96aeeb31571c3ca8bf235a1866bd4a4f3 --- /dev/null +++ b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/entity/LineItem.java @@ -0,0 +1,50 @@ +package com.example.orderspring.entity; + +import jakarta.persistence.*; +import java.io.Serializable; + +@IdClass(LineItemKey.class) +@Entity +@Table(name="PERSISTENCE_ORDER_LINEITEM") +@NamedQueries({ + @NamedQuery(name="findAllLineItems", query="SELECT l FROM LineItem l"), + @NamedQuery(name="findLineItemsByOrderId", + query="SELECT l FROM LineItem l WHERE l.customerOrder.orderId = :orderId ORDER BY l.itemId"), + @NamedQuery(name="findLineItemById", + query="SELECT DISTINCT l FROM LineItem l WHERE l.itemId = :itemId AND l.customerOrder.orderId = :orderId") +}) +public class LineItem implements Serializable { + private static final long serialVersionUID = 3229188813505619743L; + + private int itemId; + private int quantity; + private VendorPart vendorPart; + private CustomerOrder customerOrder; + + public LineItem() { } + + public LineItem(CustomerOrder order, int quantity, VendorPart vendorPart) { + this.customerOrder = order; + this.itemId = order.getNextId(); + this.quantity = quantity; + this.vendorPart = vendorPart; + } + + @Id + public int getItemId() { return itemId; } + public void setItemId(int itemId) { this.itemId = itemId; } + + public int getQuantity() { return quantity; } + public void setQuantity(int quantity) { this.quantity = quantity; } + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name="VENDORPARTNUMBER") + public VendorPart getVendorPart() { return vendorPart; } + public void setVendorPart(VendorPart vendorPart) { this.vendorPart = vendorPart; } + + @Id + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name="ORDERID") + public CustomerOrder getCustomerOrder() { return customerOrder; } + public void setCustomerOrder(CustomerOrder customerOrder) { this.customerOrder = customerOrder; } +} diff --git a/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/entity/LineItemKey.java b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/entity/LineItemKey.java new file mode 100644 index 0000000000000000000000000000000000000000..91fea39c1a60eeffef924cf3ba4a933fff8ee783 --- /dev/null +++ b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/entity/LineItemKey.java @@ -0,0 +1,60 @@ +package com.example.orderspring.entity; + +import java.io.Serializable; + +public final class LineItemKey implements Serializable { + private static final long serialVersionUID = 1562260205094677677L; + private Integer customerOrder; + private int itemId; + + public LineItemKey() { + } + + public LineItemKey(Integer order, int itemId) { + this.setCustomerOrder(order); + this.setItemId(itemId); + } + + @Override + public int hashCode() { + return ((this.getCustomerOrder() == null + ? 0 : this.getCustomerOrder().hashCode()) + ^ ((int) this.getItemId())); + } + + @Override + public boolean equals(Object otherOb) { + if (this == otherOb) { + return true; + } + if (!(otherOb instanceof LineItemKey)) { + return false; + } + LineItemKey other = (LineItemKey) otherOb; + return ((this.getCustomerOrder() == null + ? other.getCustomerOrder() == null : this.getCustomerOrder() + .equals(other.getCustomerOrder())) + && (this.getItemId() == other.getItemId())); + } + + @Override + public String toString() { + return "" + getCustomerOrder() + "-" + getItemId(); + } + + public Integer getCustomerOrder() { + return customerOrder; + } + + public void setCustomerOrder(Integer order) { + this.customerOrder = order; + } + + public int getItemId() { + return itemId; + } + + public void setItemId(int itemId) { + this.itemId = itemId; + } +} diff --git a/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/entity/Part.java b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/entity/Part.java new file mode 100644 index 0000000000000000000000000000000000000000..32d14a1bcb8762c90428b8dcc51d59cb579edc48 --- /dev/null +++ b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/entity/Part.java @@ -0,0 +1,83 @@ +package com.example.orderspring.entity; + +import jakarta.persistence.*; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +@IdClass(PartKey.class) +@Entity +@Table(name="PERSISTENCE_ORDER_PART") +@SecondaryTable(name="PERSISTENCE_ORDER_PART_DETAIL", pkJoinColumns={ + @PrimaryKeyJoinColumn(name="PARTNUMBER", referencedColumnName="PARTNUMBER"), + @PrimaryKeyJoinColumn(name="REVISION", referencedColumnName="REVISION") +}) +@NamedQuery(name="findAllParts", + query="SELECT p FROM Part p ORDER BY p.partNumber") +public class Part implements Serializable { + private static final long serialVersionUID = -3082087016342644227L; + + private String partNumber; + private int revision; + private String description; + private Date revisionDate; + private Serializable drawing; + private String specification; + private Part bomPart; + private List parts = new ArrayList<>(); + private VendorPart vendorPart; + + public Part() {} + + public Part(String partNumber, int revision, String description, + Date revisionDate, String specification, Serializable drawing) { + this.partNumber = partNumber; + this.revision = revision; + this.description = description; + this.revisionDate = revisionDate; + this.specification = specification; + this.drawing = drawing; + } + + @Id @Column(nullable=false) + public String getPartNumber() { return partNumber; } + public void setPartNumber(String partNumber) { this.partNumber = partNumber; } + + @Id @Column(nullable=false) + public int getRevision() { return revision; } + public void setRevision(int revision) { this.revision = revision; } + + public String getDescription() { return description; } + public void setDescription(String description) { this.description = description; } + + @Temporal(TemporalType.DATE) + public Date getRevisionDate() { return revisionDate; } + public void setRevisionDate(Date revisionDate) { this.revisionDate = revisionDate; } + + @Lob @Basic(fetch = FetchType.LAZY) + @Column(table="PERSISTENCE_ORDER_PART_DETAIL") + public Serializable getDrawing() { return drawing; } + public void setDrawing(Serializable drawing) { this.drawing = drawing; } + + @Lob @Basic(fetch = FetchType.LAZY) + @Column(table="PERSISTENCE_ORDER_PART_DETAIL") + public String getSpecification() { return specification; } + public void setSpecification(String specification) { this.specification = specification; } + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumns({ + @JoinColumn(name="BOMPARTNUMBER", referencedColumnName="PARTNUMBER"), + @JoinColumn(name="BOMREVISION", referencedColumnName="REVISION") + }) + public Part getBomPart() { return bomPart; } + public void setBomPart(Part bomPart) { this.bomPart = bomPart; } + + @OneToMany(mappedBy="bomPart") + public List getParts() { return parts; } + public void setParts(List parts) { this.parts = parts; } + + @OneToOne(mappedBy="part", fetch = FetchType.LAZY) + public VendorPart getVendorPart() { return vendorPart; } + public void setVendorPart(VendorPart vendorPart) { this.vendorPart = vendorPart; } +} diff --git a/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/entity/PartKey.java b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/entity/PartKey.java new file mode 100644 index 0000000000000000000000000000000000000000..0e388c635fcb65a11e931e543efa1eb91d6a4f75 --- /dev/null +++ b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/entity/PartKey.java @@ -0,0 +1,56 @@ +package com.example.orderspring.entity; + +import java.io.Serializable; + +public class PartKey implements Serializable { + private static final long serialVersionUID = -3162267592969127613L; + private String partNumber; + private int revision; + + public PartKey() {} + + public PartKey(String partNumber, int revision) { + this.partNumber = partNumber; + this.revision = revision; + } + + @Override + public int hashCode() { + return ((this.getPartNumber() == null ? 0 : this.getPartNumber().hashCode()) + ^ ((int) this.getRevision())); + } + + @Override + public boolean equals(Object otherOb) { + if (this == otherOb) { + return true; + } + if (!(otherOb instanceof PartKey)) { + return false; + } + PartKey other = (PartKey) otherOb; + return ((this.getPartNumber() == null ? other.getPartNumber() == null : this.getPartNumber().equals(other.getPartNumber())) + && (getRevision() == other.getRevision())); + } + + @Override + public String toString() { + return getPartNumber() + " rev" + this.getRevision(); + } + + public String getPartNumber() { + return partNumber; + } + + public void setPartNumber(String partNumber) { + this.partNumber = partNumber; + } + + public int getRevision() { + return revision; + } + + public void setRevision(int revision) { + this.revision = revision; + } +} diff --git a/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/entity/Vendor.java b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/entity/Vendor.java new file mode 100644 index 0000000000000000000000000000000000000000..5f2be163abd5647a1a1f6535102d0b18f5b3f8e6 --- /dev/null +++ b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/entity/Vendor.java @@ -0,0 +1,57 @@ +package com.example.orderspring.entity; + +import jakarta.persistence.*; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; + +@Entity +@Table(name="PERSISTENCE_ORDER_VENDOR") +@NamedQueries({ + @NamedQuery(name="findVendorsByPartialName", + query="SELECT v FROM Vendor v WHERE LOCATE(:name, v.name) > 0"), + @NamedQuery(name="findVendorByCustomerOrder", + query="SELECT DISTINCT l.vendorPart.vendor FROM CustomerOrder co, IN(co.lineItems) l WHERE co.orderId = :id ORDER BY l.vendorPart.vendor.name") +}) +public class Vendor implements Serializable { + private static final long serialVersionUID = 2538635007598426330L; + + private int vendorId; + private String name; + private String address; + private String contact; + private String phone; + private Collection vendorParts = new ArrayList<>(); + + public Vendor() {} + public Vendor(int vendorId, String name, String address, String contact, String phone) { + this.vendorId = vendorId; this.name = name; this.address = address; + this.contact = contact; this.phone = phone; + } + + @Id + public int getVendorId() { return vendorId; } + public void setVendorId(int vendorId) { this.vendorId = vendorId; } + + @Column(name="VENDORNAME") + public String getName() { return name; } + public void setName(String name) { this.name = name; } + + public String getAddress() { return address; } + public void setAddress(String address) { this.address = address; } + + public String getContact() { return contact; } + public void setContact(String contact) { this.contact = contact; } + + public String getPhone() { return phone; } + public void setPhone(String phone) { this.phone = phone; } + + @OneToMany(cascade=CascadeType.ALL, mappedBy="vendor", orphanRemoval = true) + public Collection getVendorParts() { return vendorParts; } + public void setVendorParts(Collection vendorParts) { this.vendorParts = vendorParts; } + + public void addVendorPart(VendorPart vendorPart) { + vendorPart.setVendor(this); // keep both sides in sync + getVendorParts().add(vendorPart); + } +} diff --git a/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/entity/VendorPart.java b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/entity/VendorPart.java new file mode 100644 index 0000000000000000000000000000000000000000..b2b3eceacafc03a5cd38780ee8f39940b630cf8e --- /dev/null +++ b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/entity/VendorPart.java @@ -0,0 +1,72 @@ +package com.example.orderspring.entity; + +import jakarta.persistence.*; +import java.io.Serializable; + +@Entity +@Table( + name = "PERSISTENCE_ORDER_VENDOR_PART", + uniqueConstraints = @UniqueConstraint(columnNames = {"PARTNUMBER", "PARTREVISION"}) +) +@NamedQueries({ + @NamedQuery(name = "findAverageVendorPartPrice", + query = "SELECT AVG(vp.price) FROM VendorPart vp"), + @NamedQuery(name = "findTotalVendorPartPricePerVendor", + query = "SELECT SUM(vp.price) FROM VendorPart vp WHERE vp.vendor.vendorId = :id"), + @NamedQuery(name = "findAllVendorParts", + query = "SELECT vp FROM VendorPart vp ORDER BY vp.vendorPartNumber") +}) +public class VendorPart implements Serializable { + private static final long serialVersionUID = 4685631589912848921L; + + private Long vendorPartNumber; + private String description; + private double price; + private Part part; + private Vendor vendor; + + public VendorPart() {} + + public VendorPart(String description, double price, Part part) { + this.description = description; + this.price = price; + setPart(part); + } + + @TableGenerator( + name = "vendorPartGen", + table = "PERSISTENCE_ORDER_SEQUENCE_GENERATOR", + pkColumnName = "GEN_KEY", + valueColumnName = "GEN_VALUE", + pkColumnValue = "VENDOR_PART_ID", + allocationSize = 10 + ) + @Id + @GeneratedValue(strategy = GenerationType.TABLE, generator = "vendorPartGen") + public Long getVendorPartNumber() { return vendorPartNumber; } + public void setVendorPartNumber(Long vendorPartNumber) { this.vendorPartNumber = vendorPartNumber; } + + public String getDescription() { return description; } + public void setDescription(String description) { this.description = description; } + + public double getPrice() { return price; } + public void setPrice(double price) { this.price = price; } + + @OneToOne(fetch = FetchType.LAZY) + @JoinColumns({ + @JoinColumn(name = "PARTNUMBER", referencedColumnName = "PARTNUMBER"), + @JoinColumn(name = "PARTREVISION", referencedColumnName = "REVISION") + }) + public Part getPart() { return part; } + public void setPart(Part part) { + this.part = part; + if (part != null && part.getVendorPart() != this) { + part.setVendorPart(this); + } + } + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "VENDORID") + public Vendor getVendor() { return vendor; } + public void setVendor(Vendor vendor) { this.vendor = vendor; } +} diff --git a/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/repository/CustomerOrderRepository.java b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/repository/CustomerOrderRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..4be13eaba3b94592df0ac929436e5b7d506ae737 --- /dev/null +++ b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/repository/CustomerOrderRepository.java @@ -0,0 +1,15 @@ +package com.example.orderspring.repository; + +import com.example.orderspring.entity.CustomerOrder; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface CustomerOrderRepository extends JpaRepository { + + @Query("SELECT co FROM CustomerOrder co ORDER BY co.orderId") + List findAllOrders(); +} diff --git a/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/repository/LineItemRepository.java b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/repository/LineItemRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..00db63afc81865275aa696b9bb32f10d8184025b --- /dev/null +++ b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/repository/LineItemRepository.java @@ -0,0 +1,29 @@ +package com.example.orderspring.repository; + +import com.example.orderspring.entity.LineItem; +import com.example.orderspring.entity.LineItemKey; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface LineItemRepository extends JpaRepository { + + @Query("SELECT l FROM LineItem l") + List findAllLineItems(); + + @Query("SELECT l FROM LineItem l WHERE l.customerOrder.orderId = :orderId ORDER BY l.itemId") + List findLineItemsByOrderId(@Param("orderId") Integer orderId); + + @Query("SELECT DISTINCT l FROM LineItem l WHERE l.itemId = :itemId AND l.customerOrder.orderId = :orderId") + LineItem findLineItemById(@Param("itemId") int itemId, @Param("orderId") Integer orderId); + + @Modifying(clearAutomatically = true, flushAutomatically = true) + @Query("DELETE FROM LineItem l WHERE l.customerOrder.orderId = :orderId") + void deleteAllByOrderId(@Param("orderId") Integer orderId); + +} diff --git a/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/repository/PartRepository.java b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/repository/PartRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..bced8c54643e4b6d5528627c9185b503934f040c --- /dev/null +++ b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/repository/PartRepository.java @@ -0,0 +1,19 @@ +package com.example.orderspring.repository; + +import com.example.orderspring.entity.Part; +import com.example.orderspring.entity.PartKey; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.stereotype.Repository; + +import java.util.List; +import java.util.Optional; + +@Repository +public interface PartRepository extends JpaRepository { + + @Query("SELECT p FROM Part p ORDER BY p.partNumber") + List findAllParts(); + + Optional findByPartNumberAndRevision(String partNumber, int revision); +} diff --git a/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/repository/VendorPartRepository.java b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/repository/VendorPartRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..b4fdbd73a2e632dc38204b0bed989c218a402bd2 --- /dev/null +++ b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/repository/VendorPartRepository.java @@ -0,0 +1,22 @@ +package com.example.orderspring.repository; + +import com.example.orderspring.entity.VendorPart; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface VendorPartRepository extends JpaRepository { + + @Query("SELECT AVG(vp.price) FROM VendorPart vp") + Double findAverageVendorPartPrice(); + + @Query("SELECT SUM(vp.price) FROM VendorPart vp WHERE vp.vendor.vendorId = :id") + Double findTotalVendorPartPricePerVendor(@Param("id") int vendorId); + + @Query("SELECT vp FROM VendorPart vp ORDER BY vp.vendorPartNumber") + List findAllVendorParts(); +} diff --git a/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/repository/VendorRepository.java b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/repository/VendorRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..b42552c70501b324554439b72c9cf1f55b297179 --- /dev/null +++ b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/repository/VendorRepository.java @@ -0,0 +1,19 @@ +package com.example.orderspring.repository; + +import com.example.orderspring.entity.Vendor; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface VendorRepository extends JpaRepository { + + @Query("SELECT v FROM Vendor v WHERE LOCATE(:name, v.name) > 0") + List findVendorsByPartialName(@Param("name") String name); + + @Query("SELECT DISTINCT l.vendorPart.vendor FROM CustomerOrder co, IN(co.lineItems) l WHERE co.orderId = :id ORDER BY l.vendorPart.vendor.name") + List findVendorByCustomerOrder(@Param("id") Integer orderId); +} diff --git a/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/service/DataInitializationService.java b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/service/DataInitializationService.java new file mode 100644 index 0000000000000000000000000000000000000000..0910c5cbc61c5018e1d3b7507e0059946cf18b01 --- /dev/null +++ b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/service/DataInitializationService.java @@ -0,0 +1,69 @@ +package com.example.orderspring.service; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.event.ApplicationReadyEvent; +import org.springframework.context.event.EventListener; +import org.springframework.stereotype.Component; +import java.io.Serializable; +import org.springframework.transaction.annotation.Transactional; + +@Component +public class DataInitializationService { + + @Autowired + private OrderService orderService; + + @EventListener(ApplicationReadyEvent.class) + @Transactional + public void onApplicationReady() { + createInitialData(); + } + + private void createInitialData() { + // Create parts + orderService.createPart("1234-5678-01", 1, "ABC PART", + new java.util.Date(), "PARTQWERTYUIOPASXDCFVGBHNJMKL", null); + orderService.createPart("9876-4321-02", 2, "DEF PART", + new java.util.Date(), "PARTQWERTYUIOPASXDCFVGBHNJMKL", null); + orderService.createPart("5456-6789-03", 3, "GHI PART", + new java.util.Date(), "PARTQWERTYUIOPASXDCFVGBHNJMKL", null); + orderService.createPart("ABCD-XYZW-FF", 5, "XYZ PART", + new java.util.Date(), "PARTQWERTYUIOPASXDCFVGBHNJMKL", null); + orderService.createPart("SDFG-ERTY-BN", 7, "BOM PART", + new java.util.Date(), "PARTQWERTYUIOPASXDCFVGBHNJMKL", null); + + // Add parts to bill of materials + orderService.addPartToBillOfMaterial("SDFG-ERTY-BN", 7, "1234-5678-01", 1); + orderService.addPartToBillOfMaterial("SDFG-ERTY-BN", 7, "9876-4321-02", 2); + orderService.addPartToBillOfMaterial("SDFG-ERTY-BN", 7, "5456-6789-03", 3); + orderService.addPartToBillOfMaterial("SDFG-ERTY-BN", 7, "ABCD-XYZW-FF", 5); + + // Create vendors + orderService.createVendor(100, "WidgetCorp", + "111 Main St., Anytown, KY 99999", "Mr. Jones", + "888-777-9999"); + orderService.createVendor(200, "Gadget, Inc.", + "123 State St., Sometown, MI 88888", "Mrs. Smith", + "866-345-6789"); + + // Create vendor parts + orderService.createVendorPart("1234-5678-01", 1, "PART1", 100.00, 100); + orderService.createVendorPart("9876-4321-02", 2, "PART2", 10.44, 200); + orderService.createVendorPart("5456-6789-03", 3, "PART3", 76.23, 200); + orderService.createVendorPart("ABCD-XYZW-FF", 5, "PART4", 55.19, 100); + orderService.createVendorPart("SDFG-ERTY-BN", 7, "PART5", 345.87, 100); + + // Create orders + Integer orderId = 1111; + orderService.createOrder(orderId, 'N', 10, "333 New Court, New City, CA 90000"); + orderService.addLineItem(orderId, "1234-5678-01", 1, 3); + orderService.addLineItem(orderId, "9876-4321-02", 2, 5); + orderService.addLineItem(orderId, "ABCD-XYZW-FF", 5, 7); + + orderId = 4312; + orderService.createOrder(orderId, 'N', 0, "333 New Court, New City, CA 90000"); + orderService.addLineItem(orderId, "SDFG-ERTY-BN", 7, 1); + orderService.addLineItem(orderId, "ABCD-XYZW-FF", 5, 3); + orderService.addLineItem(orderId, "1234-5678-01", 1, 15); + } +} diff --git a/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/service/OrderService.java b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/service/OrderService.java new file mode 100644 index 0000000000000000000000000000000000000000..4d441c315b6084cdb37c85378cdea8c2d6613aa5 --- /dev/null +++ b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/service/OrderService.java @@ -0,0 +1,294 @@ +package com.example.orderspring.service; + +import com.example.orderspring.entity.*; +import com.example.orderspring.repository.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +@Service +@Transactional +public class OrderService { + + @Autowired + private PartRepository partRepository; + + @Autowired + private CustomerOrderRepository customerOrderRepository; + + @Autowired + private VendorRepository vendorRepository; + + @Autowired + private VendorPartRepository vendorPartRepository; + + @Autowired + private LineItemRepository lineItemRepository; + + private static final Logger logger = Logger.getLogger("order.service.OrderService"); + + public void createPart(String partNumber, int revision, String description, + java.util.Date revisionDate, String specification, Serializable drawing) { + try { + Part part = new Part(partNumber, revision, description, revisionDate, specification, drawing); + logger.log(Level.INFO, "Created part {0}-{1}", new Object[]{partNumber, revision}); + partRepository.save(part); + logger.log(Level.INFO, "Persisted part {0}-{1}", new Object[]{partNumber, revision}); + } catch (Exception ex) { + logger.log(Level.SEVERE, "Error creating part", ex); + throw new RuntimeException(ex.getMessage()); + } + } + + public List getAllParts() { + return partRepository.findAllParts(); + } + + public void addPartToBillOfMaterial(String bomPartNumber, int bomRevision, + String partNumber, int revision) { + logger.log(Level.INFO, "BOM part number: {0}", bomPartNumber); + logger.log(Level.INFO, "BOM revision: {0}", bomRevision); + logger.log(Level.INFO, "Part number: {0}", partNumber); + logger.log(Level.INFO, "Part revision: {0}", revision); + try { + PartKey bomKey = new PartKey(); + bomKey.setPartNumber(bomPartNumber); + bomKey.setRevision(bomRevision); + + Part bom = partRepository.findByPartNumberAndRevision(bomPartNumber, bomRevision).orElse(null); + if (bom != null) { + logger.log(Level.INFO, "BOM Part found: {0}", bom.getPartNumber()); + + Part part = partRepository.findByPartNumberAndRevision(partNumber, revision).orElse(null); + if (part != null) { + logger.log(Level.INFO, "Part found: {0}", part.getPartNumber()); + bom.getParts().add(part); + part.setBomPart(bom); + partRepository.save(bom); + partRepository.save(part); + } + } + } catch (Exception e) { + logger.log(Level.SEVERE, "Error adding part to BOM", e); + } + } + + public void createVendor(int vendorId, String name, String address, String contact, String phone) { + try { + Vendor vendor = new Vendor(vendorId, name, address, contact, phone); + vendorRepository.save(vendor); + } catch (Exception e) { + logger.log(Level.SEVERE, "Error creating vendor", e); + throw new RuntimeException(e); + } + } + + public void createVendorPart(String partNumber, int revision, String description, + double price, int vendorId) { + try { + Part part = partRepository.findByPartNumberAndRevision(partNumber, revision).orElse(null); + if (part != null) { + VendorPart vendorPart = new VendorPart(description, price, part); + vendorPartRepository.save(vendorPart); + + Vendor vendor = vendorRepository.findById(vendorId).orElse(null); + if (vendor != null) { + vendor.addVendorPart(vendorPart); + vendorPart.setVendor(vendor); + vendorRepository.save(vendor); + vendorPartRepository.save(vendorPart); + } + } + } catch (Exception e) { + logger.log(Level.SEVERE, "Error creating vendor part", e); + throw new RuntimeException(e.getMessage()); + } + } + + @Transactional + public void createOrder(Integer orderId, char status, int discount, String shipmentInfo) { + if (orderId == null) throw new IllegalArgumentException("Order ID is required"); + if (customerOrderRepository.existsById(orderId)) { + throw new IllegalStateException("Order ID " + orderId + " already exists"); + } + customerOrderRepository.save(new CustomerOrder(orderId, status, discount, shipmentInfo)); + } + + public List getOrders() { + try { + return customerOrderRepository.findAllOrders(); + } catch (Exception e) { + logger.log(Level.SEVERE, "Error getting orders", e); + throw new RuntimeException(e.getMessage()); + } + } + + public void addLineItem(Integer orderId, String partNumber, int revision, int quantity) { + try { + CustomerOrder order = customerOrderRepository.findById(orderId).orElse(null); + if (order != null) { + logger.log(Level.INFO, "Found order ID {0}", orderId); + + Part part = partRepository.findByPartNumberAndRevision(partNumber, revision).orElse(null); + if (part != null && part.getVendorPart() != null) { + LineItem lineItem = new LineItem(order, quantity, part.getVendorPart()); + order.addLineItem(lineItem); + lineItemRepository.save(lineItem); + customerOrderRepository.save(order); + } + } + } catch (Exception e) { + logger.log(Level.WARNING, "Couldn't add {0} to order ID {1}.", new Object[]{partNumber, orderId}); + throw new RuntimeException(e.getMessage()); + } + } + + public double getBillOfMaterialPrice(String bomPartNumber, int bomRevision, + String partNumber, int revision) { + double price = 0.0; + try { + Part bom = partRepository.findByPartNumberAndRevision(bomPartNumber, bomRevision).orElse(null); + if (bom != null) { + Collection parts = bom.getParts(); + for (Part part : parts) { + VendorPart vendorPart = part.getVendorPart(); + if (vendorPart != null) { + price += vendorPart.getPrice(); + } + } + } + } catch (Exception e) { + logger.log(Level.SEVERE, "Error calculating BOM price", e); + throw new RuntimeException(e.getMessage()); + } + return price; + } + + public double getOrderPrice(Integer orderId) { + double price = 0.0; + try { + CustomerOrder order = customerOrderRepository.findById(orderId).orElse(null); + if (order != null) { + price = order.calculateAmount(); + } + } catch (Exception e) { + logger.log(Level.SEVERE, "Error calculating order price", e); + throw new RuntimeException(e.getMessage()); + } + return price; + } + + public void adjustOrderDiscount(int adjustment) { + try { + List orders = customerOrderRepository.findAllOrders(); + for (CustomerOrder order : orders) { + int newDiscount = order.getDiscount() + adjustment; + order.setDiscount((newDiscount > 0) ? newDiscount : 0); + customerOrderRepository.save(order); + } + } catch (Exception e) { + logger.log(Level.SEVERE, "Error adjusting order discount", e); + throw new RuntimeException(e.getMessage()); + } + } + + public Double getAvgPrice() { + try { + return vendorPartRepository.findAverageVendorPartPrice(); + } catch (Exception e) { + logger.log(Level.SEVERE, "Error getting average price", e); + throw new RuntimeException(e.getMessage()); + } + } + + public Double getTotalPricePerVendor(int vendorId) { + try { + return vendorPartRepository.findTotalVendorPartPricePerVendor(vendorId); + } catch (Exception e) { + logger.log(Level.SEVERE, "Error getting total price per vendor", e); + throw new RuntimeException(e.getMessage()); + } + } + + public List locateVendorsByPartialName(String name) { + List names = new ArrayList<>(); + try { + List vendors = vendorRepository.findVendorsByPartialName(name); + for (Vendor vendor : vendors) { + names.add(vendor.getName()); + } + } catch (Exception e) { + logger.log(Level.SEVERE, "Error locating vendors", e); + throw new RuntimeException(e.getMessage()); + } + return names; + } + + public int countAllItems() { + int count = 0; + try { + count = lineItemRepository.findAllLineItems().size(); + } catch (Exception e) { + logger.log(Level.SEVERE, "Error counting items", e); + throw new RuntimeException(e.getMessage()); + } + return count; + } + + public List getLineItems(int orderId) { + try { + return lineItemRepository.findLineItemsByOrderId(orderId); + } catch (Exception e) { + logger.log(Level.SEVERE, "Error getting line items", e); + throw new RuntimeException(e.getMessage()); + } + } + + @Transactional + public void removeOrder(Integer orderId) { + lineItemRepository.deleteAllByOrderId(orderId); + customerOrderRepository.deleteById(orderId); + } + + public String reportVendorsByOrder(Integer orderId) { + StringBuilder report = new StringBuilder(); + try { + List vendors = vendorRepository.findVendorByCustomerOrder(orderId); + for (Vendor vendor : vendors) { + report.append(vendor.getVendorId()).append(' ') + .append(vendor.getName()).append(' ') + .append(vendor.getContact()).append('\n'); + } + } catch (Exception e) { + logger.log(Level.SEVERE, "Error reporting vendors by order", e); + throw new RuntimeException(e); + } + return report.toString(); + } + + // Additional methods for JSF integration + public List getAllOrders() { + return getOrders(); + } + + public List getLineItemsByOrderId(Integer orderId) { + return getLineItems(orderId); + } + + public List findVendorsByName(String name) { + try { + return vendorRepository.findVendorsByPartialName(name); + } catch (Exception e) { + logger.log(Level.SEVERE, "Error finding vendors by name", e); + throw new RuntimeException(e.getMessage()); + } + } +} diff --git a/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/web/OrderManager.java b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/web/OrderManager.java new file mode 100644 index 0000000000000000000000000000000000000000..0989f8e0bca07d4f5fdcf517758cfaa8c4d1ead5 --- /dev/null +++ b/benchmark/persistence/order/spring/src/main/java/com/example/orderspring/web/OrderManager.java @@ -0,0 +1,185 @@ +package com.example.orderspring.web; + +import com.example.orderspring.entity.CustomerOrder; +import com.example.orderspring.entity.LineItem; +import com.example.orderspring.entity.Part; +import com.example.orderspring.entity.Vendor; +import com.example.orderspring.service.OrderService; +import jakarta.enterprise.context.SessionScoped; +import jakarta.inject.Inject; +import jakarta.inject.Named; +import jakarta.faces.context.FacesContext; +import jakarta.faces.event.ActionEvent; +import java.io.Serializable; +import java.util.List; + +@Named("orderManager") +@SessionScoped +public class OrderManager implements Serializable { + private static final long serialVersionUID = 1L; + + @Inject + private OrderService orderService; + + private List orders; + private List lineItems; + private List parts; + private List vendorSearchResults; + + private Integer currentOrder; + private Integer newOrderId; + private String newOrderShippingInfo; + private Character newOrderStatus = 'P'; + private Integer newOrderDiscount = 0; + private String vendorName; + private boolean findVendorTableDisabled = true; + + private List newOrderParts; + private String selectedPartNumber; + private Integer selectedPartRevision; + private Long selectedVendorPartNumber; + + public List getOrders() { + if (orders == null) { + orders = orderService.getAllOrders(); + } + return orders; + } + public void setOrders(List orders) { this.orders = orders; } + + public List getLineItems() { + if (lineItems == null && currentOrder != null) { + lineItems = orderService.getLineItemsByOrderId(currentOrder); + } + return lineItems; + } + public void setLineItems(List lineItems) { this.lineItems = lineItems; } + + public List getParts() { + if (parts == null) { + parts = orderService.getAllParts(); + } + return parts; + } + public void setParts(List parts) { this.parts = parts; } + + public List getVendorSearchResults() { return vendorSearchResults; } + public void setVendorSearchResults(List vendorSearchResults) { this.vendorSearchResults = vendorSearchResults; } + + public Integer getCurrentOrder() { return currentOrder; } + public void setCurrentOrder(Integer currentOrder) { + this.currentOrder = currentOrder; + this.lineItems = null; + } + + public Integer getNewOrderId() { return newOrderId; } + public void setNewOrderId(Integer newOrderId) { this.newOrderId = newOrderId; } + + public String getNewOrderShippingInfo() { return newOrderShippingInfo; } + public void setNewOrderShippingInfo(String newOrderShippingInfo) { this.newOrderShippingInfo = newOrderShippingInfo; } + + public Character getNewOrderStatus() { return newOrderStatus; } + public void setNewOrderStatus(Character newOrderStatus) { this.newOrderStatus = newOrderStatus; } + + public Integer getNewOrderDiscount() { return newOrderDiscount; } + public void setNewOrderDiscount(Integer newOrderDiscount) { this.newOrderDiscount = newOrderDiscount; } + + public String getVendorName() { return vendorName; } + public void setVendorName(String vendorName) { this.vendorName = vendorName; } + + public boolean isFindVendorTableDisabled() { return findVendorTableDisabled; } + public void setFindVendorTableDisabled(boolean findVendorTableDisabled) { this.findVendorTableDisabled = findVendorTableDisabled; } + + public List getNewOrderParts() { + if (newOrderParts == null) { + newOrderParts = orderService.getAllParts(); + } + return newOrderParts; + } + public void setNewOrderParts(List newOrderParts) { this.newOrderParts = newOrderParts; } + + public String getSelectedPartNumber() { return selectedPartNumber; } + public void setSelectedPartNumber(String selectedPartNumber) { this.selectedPartNumber = selectedPartNumber; } + + public Integer getSelectedPartRevision() { return selectedPartRevision; } + public void setSelectedPartRevision(Integer selectedPartRevision) { this.selectedPartRevision = selectedPartRevision; } + + public Long getSelectedVendorPartNumber() { return selectedVendorPartNumber; } + public void setSelectedVendorPartNumber(Long selectedVendorPartNumber) { this.selectedVendorPartNumber = selectedVendorPartNumber; } + + public String submitOrder() { + try { + if (newOrderId == null) return "order"; + char status = (newOrderStatus != null ? newOrderStatus : 'P'); + int discount = (newOrderDiscount != null ? newOrderDiscount : 0); + orderService.createOrder(newOrderId, status, discount, newOrderShippingInfo); + newOrderId = null; + newOrderShippingInfo = null; + newOrderStatus = 'P'; + newOrderDiscount = 0; + orders = null; + if (currentOrder != null) lineItems = null; + return "order"; + } catch (Exception e) { + e.printStackTrace(); + return "order"; + } + } + + public String removeOrder() { + try { + if (currentOrder != null) { + orderService.removeOrder(currentOrder); + orders = null; + lineItems = null; + currentOrder = null; + } + return "order"; + } catch (Exception e) { + e.printStackTrace(); + return "order"; + } + } + + public void removeOrder(ActionEvent event) { + String id = FacesContext.getCurrentInstance() + .getExternalContext() + .getRequestParameterMap() + .get("deleteOrderId"); + if (id != null && !id.isBlank()) { + Integer orderId = Integer.valueOf(id); + orderService.removeOrder(orderId); + orders = null; + lineItems = null; + if (orderId.equals(currentOrder)) currentOrder = null; + } + } + + public String findVendor() { + try { + vendorSearchResults = orderService.findVendorsByName(vendorName); + findVendorTableDisabled = false; + return "order"; + } catch (Exception e) { + e.printStackTrace(); + findVendorTableDisabled = true; + return "order"; + } + } + + public String addLineItem() { + try { + if (currentOrder != null && selectedPartNumber != null && selectedPartRevision != null) { + orderService.addLineItem(currentOrder, selectedPartNumber, selectedPartRevision, 1); + lineItems = null; + } + return "lineItem"; + } catch (Exception e) { + e.printStackTrace(); + return "lineItem"; + } + } + + public String lineItem() { return "lineItem"; } + public String order() { return "order"; } +} diff --git a/benchmark/persistence/order/spring/src/main/resources/META-INF/resources/lineItem-template.xhtml b/benchmark/persistence/order/spring/src/main/resources/META-INF/resources/lineItem-template.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..c5a7fede5db55bb9b3ac240f4cef82d0f7ca7f4c --- /dev/null +++ b/benchmark/persistence/order/spring/src/main/resources/META-INF/resources/lineItem-template.xhtml @@ -0,0 +1,30 @@ + + + + + + Order Persistence Example + + + +

Default Title

+ + Default Body + + + diff --git a/benchmark/persistence/order/spring/src/main/resources/META-INF/resources/lineItem.xhtml b/benchmark/persistence/order/spring/src/main/resources/META-INF/resources/lineItem.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..9a6c34fbc634ad3ca32d79c95ecac716bf5faccb --- /dev/null +++ b/benchmark/persistence/order/spring/src/main/resources/META-INF/resources/lineItem.xhtml @@ -0,0 +1,95 @@ + + + + + + + Line Items for Order #{orderManager.currentOrder} + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ +
+ + diff --git a/benchmark/persistence/order/spring/src/main/resources/META-INF/resources/order-template.xhtml b/benchmark/persistence/order/spring/src/main/resources/META-INF/resources/order-template.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..9c214ccdc3a670975a29cfede1deb22e676f2c03 --- /dev/null +++ b/benchmark/persistence/order/spring/src/main/resources/META-INF/resources/order-template.xhtml @@ -0,0 +1,41 @@ + + + + + + Order JPA Example + + + +

Default Title

+ + Default Body + +

View All Orders

+ Default ordersTable + +

Create New Order

+ Default new orders form + +

Find Vendors

+ Default find vendors form + + Default find vendor table + + + diff --git a/benchmark/persistence/order/spring/src/main/resources/META-INF/resources/order.xhtml b/benchmark/persistence/order/spring/src/main/resources/META-INF/resources/order.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..16b7ed53151af7c43b3782eee8bfb9dcd8bb1c0c --- /dev/null +++ b/benchmark/persistence/order/spring/src/main/resources/META-INF/resources/order.xhtml @@ -0,0 +1,142 @@ + + + + + + Order Java Persistence Example + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + +
+ + + + + + + + + + + + +
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/benchmark/persistence/order/spring/src/main/resources/META-INF/resources/resources/css/default.css b/benchmark/persistence/order/spring/src/main/resources/META-INF/resources/resources/css/default.css new file mode 100644 index 0000000000000000000000000000000000000000..cf1f0b31d150939811f62238b663f7995cc7b727 --- /dev/null +++ b/benchmark/persistence/order/spring/src/main/resources/META-INF/resources/resources/css/default.css @@ -0,0 +1,49 @@ +/** + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +body { + background-color: #ffffff; + font-size: 12px; + font-family: Verdana, "Verdana CE", Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + color: #000000; + margin: 10px; +} + +h1 { + font-family: Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + border-bottom: 1px solid #AFAFAF; + font-size: 16px; + font-weight: bold; + margin: 0px; + padding: 0px; + color: #D20005; +} + +a:link, a:visited { + color: #045491; + font-weight : bold; + text-decoration: none; +} + +a:link:hover, a:visited:hover { + color: #045491; + font-weight : bold; + text-decoration : underline; +} + +th { + font-weight: bold; + text-align: center; +} + +td { + text-align: center; +} diff --git a/benchmark/persistence/order/spring/src/main/resources/application.properties b/benchmark/persistence/order/spring/src/main/resources/application.properties new file mode 100644 index 0000000000000000000000000000000000000000..2c15f73c6f8d0429349eba39a90f96d7b1cba40c --- /dev/null +++ b/benchmark/persistence/order/spring/src/main/resources/application.properties @@ -0,0 +1,20 @@ +server.port=8081 + +spring.datasource.url=jdbc:h2:mem:testdb +spring.datasource.driverClassName=org.h2.Driver +spring.datasource.username=sa +spring.datasource.password= + +spring.jpa.hibernate.ddl-auto=create-drop +spring.jpa.show-sql=true +spring.jpa.properties.hibernate.format_sql=true + +spring.h2.console.enabled=true +spring.h2.console.path=/h2-console + +joinfaces.faces.PROJECT_STAGE=Development +joinfaces.primefaces.theme=saga + +logging.level.com.example.orderspring=INFO +logging.level.org.hibernate.SQL=DEBUG +logging.level.org.hibernate.type.descriptor.sql=TRACE \ No newline at end of file diff --git a/benchmark/persistence/order/spring/test.sh b/benchmark/persistence/order/spring/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..310cbb0d55466a5f4e1eac0fc53ec610c159ad1c --- /dev/null +++ b/benchmark/persistence/order/spring/test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +BASE_URL="${BASE_URL:-http://localhost:8081}" + +echo "Health check: ${BASE_URL}/" +HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}/") + +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "PASS - got HTTP ${HTTP_STATUS}" + exit 0 +else + echo "FAIL - got HTTP ${HTTP_STATUS}" + exit 1 +fi diff --git a/benchmark/persistence/roster/jakarta/.dockerignore b/benchmark/persistence/roster/jakarta/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..c634c57d9244b4e60b8fa936f09dbe4e75706e74 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/.dockerignore @@ -0,0 +1,41 @@ +# VCS +.git/ + +# Maven +.mvn/ +**/.mvn/ +mvnw +mvnw.cmd +**/mvnw +**/mvnw.cmd +target/ +**/target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties + +# IDE / Editor +.vscode/ +**/.vscode/ +.zed/ +**/.zed/ +.idea/ +**/.idea/ +*.iml +*.ipr +*.iws + +# OS +.DS_Store +**/.DS_Store +Thumbs.db +ehthumbs.db + +# Logs / temp +*.log +*.tmp +*.temp diff --git a/benchmark/persistence/roster/jakarta/.mvn/wrapper/maven-wrapper.properties b/benchmark/persistence/roster/jakarta/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..8dea6c227c08000d2400d38a2ac886063f22bc36 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,3 @@ +wrapperVersion=3.3.4 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.12/apache-maven-3.9.12-bin.zip diff --git a/benchmark/persistence/roster/jakarta/Dockerfile b/benchmark/persistence/roster/jakarta/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..838da23224dd71c20dd0ecf9d54c9c99a2bdac2f --- /dev/null +++ b/benchmark/persistence/roster/jakarta/Dockerfile @@ -0,0 +1,27 @@ +FROM maven:3.9.12-ibm-semeru-21-noble + +USER root +# install uv +RUN apt-get update && apt-get install -y --no-install-recommends curl python3-venv python3-full \ + && curl -LsSf https://astral.sh/uv/install.sh | sh + +ENV PATH="/root/.local/bin:$PATH" + +# create venv and install +RUN uv venv /opt/venv \ + && uv pip install --python /opt/venv/bin/python pytest + +ENV PATH="/opt/venv/bin:$PATH" + +# Set working directory +WORKDIR /app + +# Copy all the assets +COPY . . + +RUN mvn clean install -pl roster-ear -am + +COPY test.sh . +RUN chmod +x test.sh + +CMD ["mvn", "liberty:run", "-pl", "roster-ear"] diff --git a/benchmark/persistence/roster/jakarta/mvnw b/benchmark/persistence/roster/jakarta/mvnw new file mode 100644 index 0000000000000000000000000000000000000000..bd8896bf2217b46faa0291585e01ac1a3441a958 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/mvnw @@ -0,0 +1,295 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.4 +# +# Optional ENV vars +# ----------------- +# JAVA_HOME - location of a JDK home dir, required when download maven via java source +# MVNW_REPOURL - repo url base for downloading maven distribution +# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output +# ---------------------------------------------------------------------------- + +set -euf +[ "${MVNW_VERBOSE-}" != debug ] || set -x + +# OS specific support. +native_path() { printf %s\\n "$1"; } +case "$(uname)" in +CYGWIN* | MINGW*) + [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" + native_path() { cygpath --path --windows "$1"; } + ;; +esac + +# set JAVACMD and JAVACCMD +set_java_home() { + # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched + if [ -n "${JAVA_HOME-}" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACCMD="$JAVA_HOME/jre/sh/javac" + else + JAVACMD="$JAVA_HOME/bin/java" + JAVACCMD="$JAVA_HOME/bin/javac" + + if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then + echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 + echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 + return 1 + fi + fi + else + JAVACMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v java + )" || : + JAVACCMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v javac + )" || : + + if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then + echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 + return 1 + fi + fi +} + +# hash string like Java String::hashCode +hash_string() { + str="${1:-}" h=0 + while [ -n "$str" ]; do + char="${str%"${str#?}"}" + h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) + str="${str#?}" + done + printf %x\\n $h +} + +verbose() { :; } +[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } + +die() { + printf %s\\n "$1" >&2 + exit 1 +} + +trim() { + # MWRAPPER-139: + # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. + # Needed for removing poorly interpreted newline sequences when running in more + # exotic environments such as mingw bash on Windows. + printf "%s" "${1}" | tr -d '[:space:]' +} + +scriptDir="$(dirname "$0")" +scriptName="$(basename "$0")" + +# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties +while IFS="=" read -r key value; do + case "${key-}" in + distributionUrl) distributionUrl=$(trim "${value-}") ;; + distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; + esac +done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" + +case "${distributionUrl##*/}" in +maven-mvnd-*bin.*) + MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ + case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in + *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; + :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; + :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; + :Linux*x86_64*) distributionPlatform=linux-amd64 ;; + *) + echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 + distributionPlatform=linux-amd64 + ;; + esac + distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" + ;; +maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; +*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; +esac + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" +distributionUrlName="${distributionUrl##*/}" +distributionUrlNameMain="${distributionUrlName%.*}" +distributionUrlNameMain="${distributionUrlNameMain%-bin}" +MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" +MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" + +exec_maven() { + unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : + exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" +} + +if [ -d "$MAVEN_HOME" ]; then + verbose "found existing MAVEN_HOME at $MAVEN_HOME" + exec_maven "$@" +fi + +case "${distributionUrl-}" in +*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; +*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; +esac + +# prepare tmp dir +if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then + clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } + trap clean HUP INT TERM EXIT +else + die "cannot create temp dir" +fi + +mkdir -p -- "${MAVEN_HOME%/*}" + +# Download and Install Apache Maven +verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +verbose "Downloading from: $distributionUrl" +verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +# select .zip or .tar.gz +if ! command -v unzip >/dev/null; then + distributionUrl="${distributionUrl%.zip}.tar.gz" + distributionUrlName="${distributionUrl##*/}" +fi + +# verbose opt +__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' +[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v + +# normalize http auth +case "${MVNW_PASSWORD:+has-password}" in +'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; +has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; +esac + +if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then + verbose "Found wget ... using wget" + wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" +elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then + verbose "Found curl ... using curl" + curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" +elif set_java_home; then + verbose "Falling back to use Java to download" + javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" + targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" + cat >"$javaSource" <<-END + public class Downloader extends java.net.Authenticator + { + protected java.net.PasswordAuthentication getPasswordAuthentication() + { + return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); + } + public static void main( String[] args ) throws Exception + { + setDefault( new Downloader() ); + java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); + } + } + END + # For Cygwin/MinGW, switch paths to Windows format before running javac and java + verbose " - Compiling Downloader.java ..." + "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" + verbose " - Running Downloader.java ..." + "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" +fi + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +if [ -n "${distributionSha256Sum-}" ]; then + distributionSha256Result=false + if [ "$MVN_CMD" = mvnd.sh ]; then + echo "Checksum validation is not supported for maven-mvnd." >&2 + echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + elif command -v sha256sum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then + distributionSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $distributionSha256Result = false ]; then + echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 + echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 + exit 1 + fi +fi + +# unzip and move +if command -v unzip >/dev/null; then + unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" +else + tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" +fi + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +actualDistributionDir="" + +# First try the expected directory name (for regular distributions) +if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then + if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then + actualDistributionDir="$distributionUrlNameMain" + fi +fi + +# If not found, search for any directory with the Maven executable (for snapshots) +if [ -z "$actualDistributionDir" ]; then + # enable globbing to iterate over items + set +f + for dir in "$TMP_DOWNLOAD_DIR"/*; do + if [ -d "$dir" ]; then + if [ -f "$dir/bin/$MVN_CMD" ]; then + actualDistributionDir="$(basename "$dir")" + break + fi + fi + done + set -f +fi + +if [ -z "$actualDistributionDir" ]; then + verbose "Contents of $TMP_DOWNLOAD_DIR:" + verbose "$(ls -la "$TMP_DOWNLOAD_DIR")" + die "Could not find Maven distribution directory in extracted archive" +fi + +verbose "Found extracted Maven distribution directory: $actualDistributionDir" +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" + +clean || : +exec_maven "$@" diff --git a/benchmark/persistence/roster/jakarta/mvnw.cmd b/benchmark/persistence/roster/jakarta/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..5761d948924c19571d27b465c519b2e2f9e30351 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/mvnw.cmd @@ -0,0 +1,189 @@ +<# : batch portion +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.4 +@REM +@REM Optional ENV vars +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output +@REM ---------------------------------------------------------------------------- + +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) +) +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> + +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} + +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} + +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' + +$MAVEN_M2_PATH = "$HOME/.m2" +if ($env:MAVEN_USER_HOME) { + $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME" +} + +if (-not (Test-Path -Path $MAVEN_M2_PATH)) { + New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null +} + +$MAVEN_WRAPPER_DISTS = $null +if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) { + $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists" +} else { + $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists" +} + +$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain" +$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" + +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} + +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} + +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} + +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null + +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +$actualDistributionDir = "" + +# First try the expected directory name (for regular distributions) +$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain" +$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD" +if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) { + $actualDistributionDir = $distributionUrlNameMain +} + +# If not found, search for any directory with the Maven executable (for snapshots) +if (!$actualDistributionDir) { + Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object { + $testPath = Join-Path $_.FullName "bin/$MVN_CMD" + if (Test-Path -Path $testPath -PathType Leaf) { + $actualDistributionDir = $_.Name + } + } +} + +if (!$actualDistributionDir) { + Write-Error "Could not find Maven distribution directory in extracted archive" +} + +Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir" +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/benchmark/persistence/roster/jakarta/pom.xml b/benchmark/persistence/roster/jakarta/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..80d4d38bdd8ccd96963ebd82ec50c9b904f98d12 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/pom.xml @@ -0,0 +1,49 @@ + + 4.0.0 + + jakarta.tutorial + roster + 1.0.0 + pom + roster + + + 17 + UTF-8 + 24.0.0.12 + + + + + + io.openliberty.features + features-bom + ${liberty.version} + pom + import + + + + + + roster-common + roster-ejb + roster-appclient + roster-web + roster-ear + + + + + + + io.openliberty.tools + liberty-maven-plugin + 3.11.1 + + + + + diff --git a/benchmark/persistence/roster/jakarta/roster-appclient/pom.xml b/benchmark/persistence/roster/jakarta/roster-appclient/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..151e7f59fcc371d869fee3ceac96e7461f95408c --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-appclient/pom.xml @@ -0,0 +1,34 @@ + + 4.0.0 + + + jakarta.tutorial + roster + 1.0.0 + + + roster-appclient + jar + + + 17 + 17 + UTF-8 + + roster-appclient + + + + jakarta.tutorial + roster-common + ${project.version} + + + jakarta.platform + jakarta.jakartaee-api + 10.0.0 + provided + + + diff --git a/benchmark/persistence/roster/jakarta/roster-appclient/src/main/java/jakarta/tutorial/roster/client/RosterClient.java b/benchmark/persistence/roster/jakarta/roster-appclient/src/main/java/jakarta/tutorial/roster/client/RosterClient.java new file mode 100644 index 0000000000000000000000000000000000000000..151d481193513c69d2b9574067c138b3eb7ecb38 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-appclient/src/main/java/jakarta/tutorial/roster/client/RosterClient.java @@ -0,0 +1,356 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.roster.client; + + +import java.util.Iterator; +import java.util.List; + +import jakarta.ejb.EJB; +import jakarta.tutorial.roster.request.Request; +import jakarta.tutorial.roster.util.LeagueDetails; +import jakarta.tutorial.roster.util.PlayerDetails; +import jakarta.tutorial.roster.util.TeamDetails; + +public class RosterClient { + @EJB + private static Request request; + + public RosterClient(String[] args) { + } + + public static void main(String[] args) { + RosterClient client = new RosterClient(args); + try { + client.insertInfo(); + client.getSomeInfo(); + client.getMoreInfo(); + client.removeInfo(); + + System.exit(0); + + } catch (Exception ex) { + System.err.println("Caught an exception:"); + } + } + + private void insertInfo() { + + try { + // Leagues + request.createLeague(new LeagueDetails("L1", "Mountain", "Soccer")); + request.createLeague(new LeagueDetails("L2", "Valley", "Basketball")); + request.createLeague(new LeagueDetails("L3", "Foothills", "Soccer")); + request.createLeague(new LeagueDetails("L4", "Alpine", "Snowboarding")); + + // Teams + request.createTeamInLeague(new TeamDetails("T1", "Honey Bees", "Visalia"), + "L1"); + request.createTeamInLeague(new TeamDetails("T2", "Gophers", "Manteca"), + "L1"); + request.createTeamInLeague(new TeamDetails("T5", "Crows", "Orland"), + "L1"); + + request.createTeamInLeague(new TeamDetails("T3", "Deer", "Bodie"), + "L2"); + request.createTeamInLeague(new TeamDetails("T4", "Trout", "Truckee"), + "L2"); + + request.createTeamInLeague(new TeamDetails("T6", "Marmots", "Auburn"), + "L3"); + request.createTeamInLeague(new TeamDetails("T7", "Bobcats", "Grass Valley"), + "L3"); + request.createTeamInLeague(new TeamDetails("T8", "Beavers", "Placerville"), + "L3"); + + request.createTeamInLeague(new TeamDetails("T9", "Penguins", "Incline Village"), + "L4"); + request.createTeamInLeague(new TeamDetails("T10", "Land Otters", "Tahoe City"), + "L4"); + + // Players, Team T1 + request.createPlayer("P1", "Phil Jones", "goalkeeper", 100.00); + request.addPlayer("P1", "T1"); + + request.createPlayer("P2", "Alice Smith", "defender", 505.00); + request.addPlayer("P2", "T1"); + + request.createPlayer("P3", "Bob Roberts", "midfielder", 65.00); + request.addPlayer("P3", "T1"); + + request.createPlayer("P4", "Grace Phillips", "forward", 100.00); + request.addPlayer("P4", "T1"); + + request.createPlayer("P5", "Barney Bold", "defender", 100.00); + request.addPlayer("P5", "T1"); + + // Players, Team T2 + request.createPlayer("P6", "Ian Carlyle", "goalkeeper", 555.00); + request.addPlayer("P6", "T2"); + + request.createPlayer("P7", "Rebecca Struthers", "midfielder", 777.00); + request.addPlayer("P7", "T2"); + + request.createPlayer("P8", "Anne Anderson", "forward", 65.00); + request.addPlayer("P8", "T2"); + + request.createPlayer("P9", "Jan Wesley", "defender", 100.00); + request.addPlayer("P9", "T2"); + + request.createPlayer("P10", "Terry Smithson", "midfielder", 100.00); + request.addPlayer("P10", "T2"); + + // Players, Team T3 + request.createPlayer("P11", "Ben Shore", "point guard", 188.00); + request.addPlayer("P11", "T3"); + + request.createPlayer("P12", "Chris Farley", "shooting guard", 577.00); + request.addPlayer("P12", "T3"); + + request.createPlayer("P13", "Audrey Brown", "small forward", 995.00); + request.addPlayer("P13", "T3"); + + request.createPlayer("P14", "Jack Patterson", "power forward", 100.00); + request.addPlayer("P14", "T3"); + + request.createPlayer("P15", "Candace Lewis", "point guard", 100.00); + request.addPlayer("P15", "T3"); + + // Players, Team T4 + request.createPlayer("P16", "Linda Berringer", "point guard", 844.00); + request.addPlayer("P16", "T4"); + + request.createPlayer("P17", "Bertrand Morris", "shooting guard", 452.00); + request.addPlayer("P17", "T4"); + + request.createPlayer("P18", "Nancy White", "small forward", 833.00); + request.addPlayer("P18", "T4"); + + request.createPlayer("P19", "Billy Black", "power forward", 444.00); + request.addPlayer("P19", "T4"); + + request.createPlayer("P20", "Jodie James", "point guard", 100.00); + request.addPlayer("P20", "T4"); + + // Players, Team T5 + request.createPlayer("P21", "Henry Shute", "goalkeeper", 205.00); + request.addPlayer("P21", "T5"); + + request.createPlayer("P22", "Janice Walker", "defender", 857.00); + request.addPlayer("P22", "T5"); + + request.createPlayer("P23", "Wally Hendricks", "midfielder", 748.00); + request.addPlayer("P23", "T5"); + + request.createPlayer("P24", "Gloria Garber", "forward", 777.00); + request.addPlayer("P24", "T5"); + + request.createPlayer("P25", "Frank Fletcher", "defender", 399.00); + request.addPlayer("P25", "T5"); + + // Players, Team T9 + request.createPlayer("P30", "Lakshme Singh", "downhill", 450.00); + request.addPlayer("P30","T9"); + + request.createPlayer("P31", "Mariela Prieto", "freestyle", 420.00); + request.addPlayer("P31", "T9"); + + // Players, Team T10 + request.createPlayer("P32", "Soren Johannsen", "freestyle", 375.00); + request.addPlayer("P32", "T10"); + + request.createPlayer("P33", "Andre Gerson", "freestyle", 396.00); + request.addPlayer("P33", "T10"); + + request.createPlayer("P34", "Zoria Lepsius", "downhill", 431.00); + request.addPlayer("P34", "T10"); + + // Players, no team + request.createPlayer("P26", "Hobie Jackson", + "pitcher", 582.00); + request.createPlayer("P27", "Melinda Kendall", + "catcher", 677.00); + + // Players, multiple teams + request.createPlayer("P28", "Constance Adams", + "substitute", 966.00); + request.addPlayer("P28", "T1"); + request.addPlayer("P28", "T3"); + + // Adding existing players to second soccer league + request.addPlayer("P24", "T6"); + request.addPlayer("P21", "T6"); + request.addPlayer("P9", "T6"); + request.addPlayer("P7", "T5"); + + + } catch (Exception ex) { + System.err.println("Caught an exception:"); + } + + } + + private void getSomeInfo() { + + try { + + List playerList; + List teamList; + List leagueList; + + System.out.println("List all players in team T2:"); + playerList = request.getPlayersOfTeam("T2"); + printDetailsList(playerList); + System.out.println(); + + System.out.println("List all teams in league L1:"); + teamList = request.getTeamsOfLeague("L1"); + printDetailsList(teamList); + System.out.println(); + + System.out.println("List all defenders:"); + playerList = request.getPlayersByPosition("defender"); + printDetailsList(playerList); + System.out.println(); + + System.out.println("List the leagues of player P28"); + leagueList = request.getLeaguesOfPlayer("P28"); + printDetailsList(leagueList); + System.out.println(); + + } catch (Exception ex) { + System.err.println("Caught an exception:"); + } + + } // getSomeInfo + + private void getMoreInfo() { + + try { + + LeagueDetails leagueDetails; + TeamDetails teamDetails; + PlayerDetails playerDetails; + List playerList; + List teamList; + List leagueList; + List sportList; + + System.out.println("Details of league L1:"); + leagueDetails = request.getLeague("L1"); + System.out.println(leagueDetails.toString()); + System.out.println(); + + System.out.println("Details of team T3:"); + teamDetails = request.getTeam("T3"); + System.out.println(teamDetails.toString()); + System.out.println(); + + System.out.println("Details of player P20:"); + playerDetails = request.getPlayer("P20"); + System.out.println(playerDetails.toString()); + System.out.println(); + + System.out.println("List all teams in league L3:"); + teamList = request.getTeamsOfLeague("L3"); + printDetailsList(teamList); + System.out.println(); + + System.out.println("List all players:"); + playerList = request.getAllPlayers(); + printDetailsList(playerList); + System.out.println(); + + System.out.println("List all players not on a team:"); + playerList = request.getPlayersNotOnTeam(); + printDetailsList(playerList); + System.out.println(); + + System.out.println("Details of Jack Patterson, a power forward:"); + playerList = request.getPlayersByPositionAndName("power forward", + "Jack Patterson"); + printDetailsList(playerList); + System.out.println(); + + System.out.println("List all players in the city of Truckee:"); + playerList = request.getPlayersByCity("Truckee"); + printDetailsList(playerList); + System.out.println(); + + System.out.println("List all soccer players:"); + playerList = request.getPlayersBySport("Soccer"); + printDetailsList(playerList); + System.out.println(); + + System.out.println("List all players in league L1:"); + playerList = request.getPlayersByLeagueId("L1"); + printDetailsList(playerList); + System.out.println(); + + System.out.println("List all players making a higher salary than Ian Carlyle:"); + playerList = request.getPlayersByHigherSalary("Ian Carlyle"); + printDetailsList(playerList); + System.out.println(); + + System.out.println("List all players with a salary between 500 and 800:"); + playerList = request.getPlayersBySalaryRange(500.00, 800.00); + printDetailsList(playerList); + System.out.println(); + + System.out.println("List all players of team T5:"); + playerList = request.getPlayersOfTeam("T5"); + printDetailsList(playerList); + System.out.println(); + + System.out.println("List all the leagues of player P28:"); + leagueList = request.getLeaguesOfPlayer("P28"); + printDetailsList(leagueList); + System.out.println(); + + System.out.println("List all the sports of player P28:"); + sportList = request.getSportsOfPlayer("P28"); + printDetailsList(sportList); + System.out.println(); + + } catch (Exception ex) { + System.err.println("Caught an exception:"); + } + + } // getMoreInfo + + private void removeInfo() { + try { + System.out.println("Removing team T6."); + request.removeTeam("T6"); + System.out.println(); + + System.out.println("Removing player P24"); + request.removePlayer("P24"); + System.out.println(); + } catch (Exception ex) { + System.err.println("Caught an exception:"); + } + } + + private static void printDetailsList(List list) { + + Iterator i = list.iterator(); + + while (i.hasNext()) { + Object details = (Object) i.next(); + + System.out.println(details.toString()); + } + System.out.println(); + } // printDetailsList + +} diff --git a/benchmark/persistence/roster/jakarta/roster-appclient/src/main/resources/META-INF/MANIFEST.MF b/benchmark/persistence/roster/jakarta/roster-appclient/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000000000000000000000000000000000000..c259ab60eebea93a1acf4b2ae8f7b974cb155a39 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-appclient/src/main/resources/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: roster-ejb.jar, roster-common.jar +Main-Class: jakarta.tutorial.roster.client.RosterClient diff --git a/benchmark/persistence/roster/jakarta/roster-appclient/src/main/resources/META-INF/application-client.xml b/benchmark/persistence/roster/jakarta/roster-appclient/src/main/resources/META-INF/application-client.xml new file mode 100644 index 0000000000000000000000000000000000000000..53dd4fc67a0ab6730f82e74b66c17a36c2c1bbf2 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-appclient/src/main/resources/META-INF/application-client.xml @@ -0,0 +1,20 @@ + + + + roster application client + diff --git a/benchmark/persistence/roster/jakarta/roster-common/pom.xml b/benchmark/persistence/roster/jakarta/roster-common/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..6354c6905482d071e6e0edecf11525a0ac79be0c --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-common/pom.xml @@ -0,0 +1,30 @@ + + 4.0.0 + + + jakarta.tutorial + roster + 1.0.0 + + + roster-common + jar + + + 17 + 17 + UTF-8 + + roster-common + + + + jakarta.platform + jakarta.jakartaee-api + 10.0.0 + provided + + + diff --git a/benchmark/persistence/roster/jakarta/roster-common/src/main/java/jakarta/tutorial/roster/request/Request.java b/benchmark/persistence/roster/jakarta/roster-common/src/main/java/jakarta/tutorial/roster/request/Request.java new file mode 100644 index 0000000000000000000000000000000000000000..9e80046f77fb261328c29c6f272181340d38acb0 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-common/src/main/java/jakarta/tutorial/roster/request/Request.java @@ -0,0 +1,73 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.roster.request; + +import java.util.List; + +import jakarta.ejb.Remote; +import jakarta.tutorial.roster.util.LeagueDetails; +import jakarta.tutorial.roster.util.PlayerDetails; +import jakarta.tutorial.roster.util.TeamDetails; + +@Remote +public interface Request { + void addPlayer(String playerId, String teamId); + + void createLeague(LeagueDetails leagueDetails); + + void createPlayer(String id, String name, String position, double salary); + + void createTeamInLeague(TeamDetails teamDetails, String leagueId); + + void dropPlayer(String playerId, String teamId); + + List getAllPlayers(); + + List getAllLeagues(); + + LeagueDetails getLeague(String leagueId); + + List getLeaguesOfPlayer(String playerId); + + PlayerDetails getPlayer(String playerId); + + List getPlayersByCity(String city); + + List getPlayersByHigherSalary(String name); + + List getPlayersByLeagueId(String leagueId); + + List getPlayersByPosition(String position); + + List getPlayersByPositionAndName(String position, String name); + + List getPlayersBySalaryRange(double low, double high); + + List getPlayersBySport(String sport); + + List getPlayersNotOnTeam(); + + List getPlayersOfTeam(String teamId); + + List getSportsOfPlayer(String playerId); + + TeamDetails getTeam(String teamId); + + List getTeamsOfLeague(String leagueId); + + void removeLeague(String leagueId); + + void removePlayer(String playerId); + + void removeTeam(String teamId); + +} diff --git a/benchmark/persistence/roster/jakarta/roster-common/src/main/java/jakarta/tutorial/roster/util/IncorrectSportException.java b/benchmark/persistence/roster/jakarta/roster-common/src/main/java/jakarta/tutorial/roster/util/IncorrectSportException.java new file mode 100644 index 0000000000000000000000000000000000000000..e1064bf6cf661fec25a99dbe159d34d466406503 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-common/src/main/java/jakarta/tutorial/roster/util/IncorrectSportException.java @@ -0,0 +1,30 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.roster.util; + +public class IncorrectSportException extends java.lang.Exception { + + /** + * Creates a new instance of IncorrectSportException without detail message. + */ + public IncorrectSportException() { + } + + + /** + * Constructs an instance of IncorrectSportException with the specified detail message. + * @param msg the detail message. + */ + public IncorrectSportException(String msg) { + super(msg); + } +} diff --git a/benchmark/persistence/roster/jakarta/roster-common/src/main/java/jakarta/tutorial/roster/util/LeagueDetails.java b/benchmark/persistence/roster/jakarta/roster-common/src/main/java/jakarta/tutorial/roster/util/LeagueDetails.java new file mode 100644 index 0000000000000000000000000000000000000000..39a9b1a6c35501f22b2daecc3ba828661d56b266 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-common/src/main/java/jakarta/tutorial/roster/util/LeagueDetails.java @@ -0,0 +1,63 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.roster.util; + +import java.io.Serializable; + + +public class LeagueDetails implements Serializable { + private static final long serialVersionUID = 290368886584321980L; + private String id; + private String name; + private String sport; + + public LeagueDetails() { + } + + public LeagueDetails(String id, String name, String sport) { + + this.id = id; + this.name = name; + this.sport = sport; + } + + public void setId(String id) { + this.id = id; + } + + public void setName(String name) { + this.name = name; + } + + public void setSport(String sport) { + this.sport = sport; + } + + public String getId() { + return id; + } + + public String getName() { + return name; + } + + public String getSport() { + return sport; + } + + @Override + public String toString() { + String s = id + " " + name + " " + sport; + return s; + } + +} diff --git a/benchmark/persistence/roster/jakarta/roster-common/src/main/java/jakarta/tutorial/roster/util/PlayerDetails.java b/benchmark/persistence/roster/jakarta/roster-common/src/main/java/jakarta/tutorial/roster/util/PlayerDetails.java new file mode 100644 index 0000000000000000000000000000000000000000..7c9fab71c024170530800de6658a67b61abe3991 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-common/src/main/java/jakarta/tutorial/roster/util/PlayerDetails.java @@ -0,0 +1,58 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.roster.util; + +import java.io.Serializable; + +public class PlayerDetails implements Serializable { + private static final long serialVersionUID = -5352446961599198526L; + + private String id; + private String name; + private String position; + private double salary; + + public PlayerDetails() { + } + + public PlayerDetails(String id, String name, String position, + double salary) { + + this.id = id; + this.name = name; + this.position = position; + this.salary = salary; + } + + public String getId() { + return id; + } + + public String getName() { + return name; + } + + public String getPosition() { + return position; + } + + public double getSalary() { + return salary; + } + + @Override + public String toString() { + String s = id + " " + name + " " + position + " " + salary; + return s; + } + +} diff --git a/benchmark/persistence/roster/jakarta/roster-common/src/main/java/jakarta/tutorial/roster/util/TeamDetails.java b/benchmark/persistence/roster/jakarta/roster-common/src/main/java/jakarta/tutorial/roster/util/TeamDetails.java new file mode 100644 index 0000000000000000000000000000000000000000..f3caf5f9f117d562d4f6cbe322f099b2e2a5aae9 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-common/src/main/java/jakarta/tutorial/roster/util/TeamDetails.java @@ -0,0 +1,64 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.roster.util; + +import java.io.Serializable; + + +public class TeamDetails implements Serializable { + private static final long serialVersionUID = -1618941013515364318L; + private String id; + private String name; + private String city; + + public TeamDetails() { + } + + public TeamDetails(String id, String name, String city) { + + this.id = id; + this.name = name; + this.city = city; + } + + public void setId(String id) { + this.id = id; + } + + public void setName(String name) { + this.name = name; + } + + public void setCity(String city) { + this.city = city; + } + + public String getId() { + return id; + } + + public String getName() { + return name; + } + + public String getCity() { + return city; + } + + @Override + public String toString() { + String s = id + " " + name + " " + city; + + return s; + } + +} diff --git a/benchmark/persistence/roster/jakarta/roster-ear/pom.xml b/benchmark/persistence/roster/jakarta/roster-ear/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..6ec6054dda726644886ff41d9c57835d6d165264 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-ear/pom.xml @@ -0,0 +1,96 @@ + + 4.0.0 + + + jakarta.tutorial + roster + 1.0.0 + + + roster-ear + ear + + + 17 + 17 + UTF-8 + + roster-ear + + + + + jakarta.tutorial + roster-common + ${project.version} + + + jakarta.tutorial + roster-ejb + ${project.version} + ejb + + + jakarta.tutorial + roster-appclient + ${project.version} + + + jakarta.tutorial + roster-web + ${project.version} + war + + + com.h2database + h2 + 2.3.232 + + + + + + + org.apache.maven.plugins + maven-ear-plugin + 3.3.0 + + true + lib + + + jakarta.tutorial + roster-ejb + + + jakarta.tutorial + roster-appclient + + + jakarta.tutorial + roster-web + /roster + + + + + + io.openliberty.tools + liberty-maven-plugin + + + + ${project.build.directory}/liberty/wlp/usr/shared/resources + + com.h2database + h2 + + + + + + + + diff --git a/benchmark/persistence/roster/jakarta/roster-ear/src/main/application/META-INF/MANIFEST.MF b/benchmark/persistence/roster/jakarta/roster-ear/src/main/application/META-INF/MANIFEST.MF new file mode 100644 index 0000000000000000000000000000000000000000..58630c02ef423cffd6dd6aafd946eb8512040c37 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-ear/src/main/application/META-INF/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/benchmark/persistence/roster/jakarta/roster-ear/src/main/liberty/config/server.xml b/benchmark/persistence/roster/jakarta/roster-ear/src/main/liberty/config/server.xml new file mode 100644 index 0000000000000000000000000000000000000000..4bedb66d6df732199ef7bce010f4d4cd4f9c4552 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-ear/src/main/liberty/config/server.xml @@ -0,0 +1,35 @@ + + + + + jakartaee-10.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/benchmark/persistence/roster/jakarta/roster-ear/src/main/resources/empty b/benchmark/persistence/roster/jakarta/roster-ear/src/main/resources/empty new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/benchmark/persistence/roster/jakarta/roster-ejb/pom.xml b/benchmark/persistence/roster/jakarta/roster-ejb/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..ad2b0de94bcc5822ae0e8b981595f6268f26fe55 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-ejb/pom.xml @@ -0,0 +1,66 @@ + + 4.0.0 + + + jakarta.tutorial + roster + 1.0.0 + + + roster-ejb + ejb + + + 17 + 17 + UTF-8 + + roster-ejb + + + + jakarta.tutorial + roster-common + ${project.version} + + + + jakarta.platform + jakarta.jakartaee-api + 10.0.0 + provided + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.13.0 + + + + org.eclipse.persistence + org.eclipse.persistence.jpa.modelgen.processor + 4.0.5 + + + + ${project.build.directory}/generated-sources/annotations + + + + + org.apache.maven.plugins + maven-ejb-plugin + 3.2.1 + + 4.0 + + + + + diff --git a/benchmark/persistence/roster/jakarta/roster-ejb/src/main/java/jakarta/tutorial/roster/request/DataInitializer.java b/benchmark/persistence/roster/jakarta/roster-ejb/src/main/java/jakarta/tutorial/roster/request/DataInitializer.java new file mode 100644 index 0000000000000000000000000000000000000000..554b335c0e29cbc43c04e3bbc15e6492cb4cfe5b --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-ejb/src/main/java/jakarta/tutorial/roster/request/DataInitializer.java @@ -0,0 +1,51 @@ +package jakarta.tutorial.roster.request; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import jakarta.annotation.PostConstruct; +import jakarta.ejb.Singleton; +import jakarta.ejb.Startup; +import jakarta.ejb.TransactionAttribute; +import jakarta.ejb.TransactionAttributeType; +import jakarta.persistence.EntityManager; +import jakarta.persistence.PersistenceContext; +import jakartaee.tutorial.roster.entity.League; +import jakartaee.tutorial.roster.entity.SummerLeague; +import jakartaee.tutorial.roster.entity.WinterLeague; + +@Singleton +@Startup +public class DataInitializer { + + private static final Logger logger = Logger.getLogger("roster.request.DataInitializer"); + + @PersistenceContext + private EntityManager em; + + @PostConstruct + @TransactionAttribute(TransactionAttributeType.REQUIRED) + public void init() { + seedCanonicalLeagues(); + } + + private void seedCanonicalLeagues() { + try { + if (em.find(League.class, "L1") == null) { + em.persist(new SummerLeague("L1", "Mountain", "Soccer")); + } + if (em.find(League.class, "L2") == null) { + em.persist(new SummerLeague("L2", "Valley", "Basketball")); + } + if (em.find(League.class, "L3") == null) { + em.persist(new SummerLeague("L3", "Foothills", "Soccer")); + } + if (em.find(League.class, "L4") == null) { + em.persist(new WinterLeague("L4", "Alpine", "Snowboarding")); + } + logger.info("Canonical leagues seeded successfully"); + } catch (Exception ex) { + logger.log(Level.WARNING, "Failed to seed canonical leagues", ex); + } + } +} diff --git a/benchmark/persistence/roster/jakarta/roster-ejb/src/main/java/jakarta/tutorial/roster/request/RequestBean.java b/benchmark/persistence/roster/jakarta/roster-ejb/src/main/java/jakarta/tutorial/roster/request/RequestBean.java new file mode 100644 index 0000000000000000000000000000000000000000..7156a0652c97f697f2f3daef2108688fb75065a7 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-ejb/src/main/java/jakarta/tutorial/roster/request/RequestBean.java @@ -0,0 +1,639 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.roster.request; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import jakarta.annotation.PostConstruct; +import jakarta.ejb.EJBException; +import jakarta.ejb.LocalBean; +import jakarta.ejb.Stateful; +import jakarta.persistence.EntityManager; +import jakarta.persistence.PersistenceContext; +import jakarta.persistence.TypedQuery; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.CriteriaQuery; +import jakarta.persistence.criteria.Join; +import jakarta.persistence.criteria.Predicate; +import jakarta.persistence.criteria.Root; +import jakarta.tutorial.roster.util.IncorrectSportException; +import jakarta.tutorial.roster.util.LeagueDetails; +import jakarta.tutorial.roster.util.PlayerDetails; +import jakarta.tutorial.roster.util.TeamDetails; +import jakartaee.tutorial.roster.entity.League; +import jakartaee.tutorial.roster.entity.League_; +import jakartaee.tutorial.roster.entity.Player; +import jakartaee.tutorial.roster.entity.Player_; +import jakartaee.tutorial.roster.entity.SummerLeague; +import jakartaee.tutorial.roster.entity.Team; +import jakartaee.tutorial.roster.entity.Team_; +import jakartaee.tutorial.roster.entity.WinterLeague; + +/** + * This is the bean class for the RequestBean enterprise bean. + * + * @author ian + */ +@Stateful +@LocalBean +public class RequestBean implements Request, Serializable { + + private static final Logger logger = Logger.getLogger("roster.request.RequestBean"); + @PersistenceContext + private EntityManager em; + private CriteriaBuilder cb; + + @PostConstruct + private void init() { + cb = em.getCriteriaBuilder(); + } + + @Override + public void createPlayer(String id, + String name, + String position, + double salary) { + logger.info("createPlayer"); + try { + Player player = new Player(id, name, position, salary); + em.persist(player); + } catch (Exception ex) { + throw new EJBException(ex); + } + } + + @Override + public void addPlayer(String playerId, String teamId) { + logger.info("addPlayer"); + try { + Player player = em.find(Player.class, playerId); + Team team = em.find(Team.class, teamId); + + team.addPlayer(player); + player.addTeam(team); + } catch (Exception ex) { + throw new EJBException(ex); + } + } + + @Override + public void removePlayer(String playerId) { + logger.info("removePlayer"); + try { + Player player = em.find(Player.class, playerId); + + Collection teams = player.getTeams(); + Iterator i = teams.iterator(); + while (i.hasNext()) { + Team team = i.next(); + team.dropPlayer(player); + } + + em.remove(player); + } catch (Exception ex) { + throw new EJBException(ex); + } + } + + @Override + public void dropPlayer(String playerId, String teamId) { + logger.info("dropPlayer"); + try { + Player player = em.find(Player.class, playerId); + Team team = em.find(Team.class, teamId); + + team.dropPlayer(player); + player.dropTeam(team); + } catch (Exception ex) { + throw new EJBException(ex); + } + } + + @Override + public PlayerDetails getPlayer(String playerId) { + logger.info("getPlayerDetails"); + try { + Player player = em.find(Player.class, playerId); + PlayerDetails playerDetails = new PlayerDetails(player.getId(), + player.getName(), + player.getPosition(), + player.getSalary()); + return playerDetails; + } catch (Exception ex) { + throw new EJBException(ex); + } + } + + @Override + public List getPlayersOfTeam(String teamId) { + logger.info("getPlayersOfTeam"); + List playerList = null; + try { + Team team = em.find(Team.class, teamId); + playerList = this.copyPlayersToDetails((List) team.getPlayers()); + } catch (Exception ex) { + throw new EJBException(ex); + } + return playerList; + } + + @Override + public List getAllLeagues() { + logger.info("getAllLeagues"); + try { + CriteriaQuery cq = cb.createQuery(League.class); + Root league = cq.from(League.class); + cq.select(league); + cq.orderBy(cb.asc(league.get(League_.id))); + List leagues = em.createQuery(cq).getResultList(); + + List details = new ArrayList<>(); + for (League l : leagues) { + details.add(new LeagueDetails(l.getId(), l.getName(), l.getSport())); + } + return details; + } catch (Exception ex) { + throw new EJBException(ex); + } + } + + @Override + public List getTeamsOfLeague(String leagueId) { + logger.info("getTeamsOfLeague"); + List detailsList = new ArrayList<>(); + Collection teams = null; + + try { + League league = em.find(League.class, leagueId); + teams = league.getTeams(); + } catch (Exception ex) { + throw new EJBException(ex); + } + + Iterator i = teams.iterator(); + while (i.hasNext()) { + Team team = (Team) i.next(); + TeamDetails teamDetails = new TeamDetails(team.getId(), + team.getName(), + team.getCity()); + detailsList.add(teamDetails); + } + return detailsList; + } + + @Override + public List getPlayersByPosition(String position) { + logger.info("getPlayersByPosition"); + List players = null; + + try { + CriteriaQuery cq = cb.createQuery(Player.class); + if (cq != null) { + Root player = cq.from(Player.class); + + // Get MetaModel from Root + // EntityType Player_ = player.getModel(); + + // set the where clause + cq.where(cb.equal(player.get(Player_.position), position)); + cq.select(player); + TypedQuery q = em.createQuery(cq); + players = q.getResultList(); + } + return copyPlayersToDetails(players); + } catch (Exception ex) { + throw new EJBException(ex); + } + } + + @Override + public List getPlayersByHigherSalary(String name) { + logger.info("getPlayersByHigherSalary"); + List players = null; + + try { + CriteriaQuery cq = cb.createQuery(Player.class); + if (cq != null) { + Root player1 = cq.from(Player.class); + Root player2 = cq.from(Player.class); + + // Get MetaModel from Root + // EntityType Player_ = player1.getModel(); + + // create a Predicate object that finds players with a salary + // greater than player1 + Predicate gtPredicate = cb.greaterThan( + player1.get(Player_.salary), + player2.get(Player_.salary)); + // create a Predicate object that finds the player based on + // the name parameter + Predicate equalPredicate = cb.equal( + player2.get(Player_.name), + name); + // set the where clause with the predicates + cq.where(gtPredicate, equalPredicate); + // set the select clause, and return only unique entries + cq.select(player1).distinct(true); + TypedQuery q = em.createQuery(cq); + players = q.getResultList(); + } + return copyPlayersToDetails(players); + } catch (Exception ex) { + throw new EJBException(ex); + } + } + + @Override + public List getPlayersBySalaryRange(double low, double high) { + logger.info("getPlayersBySalaryRange"); + List players = null; + + try { + CriteriaQuery cq = cb.createQuery(Player.class); + if (cq != null) { + Root player = cq.from(Player.class); + + // Get MetaModel from Root + // EntityType Player_ = player.getModel(); + + // set the where clause + cq.where(cb.between(player.get( + Player_.salary), + low, + high)); + // set the select clause + cq.select(player).distinct(true); + TypedQuery q = em.createQuery(cq); + players = q.getResultList(); + } + return copyPlayersToDetails(players); + } catch (Exception ex) { + throw new EJBException(ex); + } + } + + @Override + public List getPlayersByLeagueId(String leagueId) { + logger.info("getPlayersByLeagueId"); + List players = null; + + try { + CriteriaQuery cq = cb.createQuery(Player.class); + if (cq != null) { + Root player = cq.from(Player.class); + Join team = player.join(Player_.teams); + Join league = team.join(Team_.league); + + // Get MetaModel from Root + // EntityType Player_ = player.getModel(); + + // set the where clause + cq.where(cb.equal(league.get(League_.id), leagueId)); + cq.select(player).distinct(true); + TypedQuery q = em.createQuery(cq); + players = q.getResultList(); + } + return copyPlayersToDetails(players); + } catch (Exception ex) { + throw new EJBException(ex); + } + } + + @Override + public List getPlayersBySport(String sport) { + logger.info("getPlayersByLeagueId"); + List players = null; + + try { + CriteriaQuery cq = cb.createQuery(Player.class); + if (cq != null) { + Root player = cq.from(Player.class); + Join team = player.join(Player_.teams); + Join league = team.join(Team_.league); + + // Get MetaModel from Root + // EntityType Player_ = player.getModel(); + + // set the where clause + cq.where(cb.equal(league.get(League_.sport), sport)); + cq.select(player).distinct(true); + TypedQuery q = em.createQuery(cq); + players = q.getResultList(); + } + return copyPlayersToDetails(players); + } catch (Exception ex) { + throw new EJBException(ex); + } + } + + @Override + public List getPlayersByCity(String city) { + logger.info("getPlayersByCity"); + List players = null; + + try { + CriteriaQuery cq = cb.createQuery(Player.class); + if (cq != null) { + Root player = cq.from(Player.class); + Join team = player.join(Player_.teams); + + // Get MetaModel from Root + // EntityType Player_ = player.getModel(); + + // set the where clause + cq.where(cb.equal(team.get(Team_.city), city)); + cq.select(player).distinct(true); + TypedQuery q = em.createQuery(cq); + players = q.getResultList(); + } + return copyPlayersToDetails(players); + } catch (Exception ex) { + throw new EJBException(ex); + } + } + + @Override + public List getAllPlayers() { + logger.info("getAllPlayers"); + List players = null; + + try { + CriteriaQuery cq = cb.createQuery(Player.class); + if (cq != null) { + Root player = cq.from(Player.class); + + cq.select(player); + TypedQuery q = em.createQuery(cq); + players = q.getResultList(); + } + return copyPlayersToDetails(players); + } catch (Exception ex) { + throw new EJBException(ex); + } + } + + @Override + public List getPlayersNotOnTeam() { + logger.info("getPlayersNotOnTeam"); + List players = null; + + try { + CriteriaQuery cq = cb.createQuery(Player.class); + if (cq != null) { + Root player = cq.from(Player.class); + + // Get MetaModel from Root + // EntityType Player_ = player.getModel(); + + // set the where clause + cq.where(cb.isEmpty(player.get(Player_.teams))); + cq.select(player).distinct(true); + TypedQuery q = em.createQuery(cq); + players = q.getResultList(); + } + return copyPlayersToDetails(players); + } catch (Exception ex) { + throw new EJBException(ex); + } + } + + @Override + public List getPlayersByPositionAndName(String position, String name) { + logger.info("getPlayersByPositionAndName"); + List players = null; + + try { + CriteriaQuery cq = cb.createQuery(Player.class); + if (cq != null) { + Root player = cq.from(Player.class); + + // Get MetaModel from Root + // EntityType Player_ = player.getModel(); + + // set the where clause + cq.where(cb.equal(player.get(Player_.position), position), + cb.equal(player.get(Player_.name), name)); + cq.select(player).distinct(true); + TypedQuery q = em.createQuery(cq); + players = q.getResultList(); + } + return copyPlayersToDetails(players); + } catch (Exception ex) { + throw new EJBException(ex); + } + } + + @Override + public List getLeaguesOfPlayer(String playerId) { + logger.info("getLeaguesOfPlayer"); + List detailsList = new ArrayList<>(); + List leagues = null; + + try { + CriteriaQuery cq = cb.createQuery(League.class); + if (cq != null) { + Root league = cq.from(League.class); + // EntityType League_ = league.getModel(); + Join team = league.join(League_.teams); + // EntityType Team_ = team.getModel(); + Join player = team.join(Team_.players); + + cq.where(cb.equal(player.get(Player_.id), playerId)); + cq.select(league).distinct(true); + TypedQuery q = em.createQuery(cq); + leagues = q.getResultList(); + } + } catch (Exception ex) { + throw new EJBException(ex); + } + + if (leagues == null) { + logger.log(Level.WARNING, "No leagues found for player with ID {0}.", playerId); + return null; + } else { + Iterator i = leagues.iterator(); + while (i.hasNext()) { + League league = (League) i.next(); + LeagueDetails leagueDetails = new LeagueDetails(league.getId(), + league.getName(), + league.getSport()); + detailsList.add(leagueDetails); + } + + } + return detailsList; + } + + @Override + public List getSportsOfPlayer(String playerId) { + logger.info("getSportsOfPlayer"); + List sports = new ArrayList<>(); + + try { + CriteriaQuery cq = cb.createQuery(String.class); + if (cq != null) { + Root player = cq.from(Player.class); + Join team = player.join(Player_.teams); + Join league = team.join(Team_.league); + + // Get MetaModel from Root + // EntityType Player_ = player.getModel(); + + // set the where clause + cq.where(cb.equal(player.get(Player_.id), playerId)); + cq.select(league.get(League_.sport)).distinct(true); + TypedQuery q = em.createQuery(cq); + sports = q.getResultList(); + } + + // Player player = em.find(Player.class, playerId); + // Iterator i = player.getTeams().iterator(); + // while (i.hasNext()) { + // Team team = i.next(); + // League league = team.getLeague(); + // sports.add(league.getSport()); + // } + } catch (Exception ex) { + throw new EJBException(ex); + } + return sports; + } + + @Override + public void createTeamInLeague(TeamDetails teamDetails, String leagueId) { + logger.info("createTeamInLeague"); + try { + League league = em.find(League.class, leagueId); + if (league == null) { + throw new IllegalArgumentException("League not found: " + leagueId); + } + Team team = new Team(teamDetails.getId(), + teamDetails.getName(), + teamDetails.getCity()); + em.persist(team); + team.setLeague(league); + league.addTeam(team); + } catch (Exception ex) { + throw new EJBException(ex); + } + } + + @Override + public void removeTeam(String teamId) { + logger.info("removeTeam"); + try { + Team team = em.find(Team.class, teamId); + + Collection players = team.getPlayers(); + Iterator i = players.iterator(); + while (i.hasNext()) { + Player player = (Player) i.next(); + player.dropTeam(team); + } + + em.remove(team); + } catch (Exception ex) { + throw new EJBException(ex); + } + } + + @Override + public TeamDetails getTeam(String teamId) { + logger.info("getTeam"); + TeamDetails teamDetails = null; + + try { + Team team = em.find(Team.class, teamId); + teamDetails = new TeamDetails(team.getId(), team.getName(), team.getCity()); + } catch (Exception ex) { + throw new EJBException(ex); + } + return teamDetails; + } + + @Override + public void createLeague(LeagueDetails leagueDetails) { + logger.info("createLeague"); + try { + if (leagueDetails.getSport().equalsIgnoreCase("soccer") + || leagueDetails.getSport().equalsIgnoreCase("swimming") + || leagueDetails.getSport().equalsIgnoreCase("basketball") + || leagueDetails.getSport().equalsIgnoreCase("baseball")) { + SummerLeague league = new SummerLeague(leagueDetails.getId(), + leagueDetails.getName(), + leagueDetails.getSport()); + em.persist(league); + } else if (leagueDetails.getSport().equalsIgnoreCase("hockey") + || leagueDetails.getSport().equalsIgnoreCase("skiing") + || leagueDetails.getSport().equalsIgnoreCase("snowboarding")) { + WinterLeague league = new WinterLeague(leagueDetails.getId(), + leagueDetails.getName(), + leagueDetails.getSport()); + em.persist(league); + } else { + throw new IncorrectSportException("The specified sport is not valid."); + } + } catch (Exception ex) { + throw new EJBException(ex); + } + } + + @Override + public void removeLeague(String leagueId) { + logger.info("removeLeague"); + try { + League league = em.find(League.class, leagueId); + em.remove(league); + } catch (Exception ex) { + throw new EJBException(ex); + } + } + + @Override + public LeagueDetails getLeague(String leagueId) { + logger.info("getLeague"); + LeagueDetails leagueDetails = null; + + try { + League league = em.find(League.class, leagueId); + if (league == null) { + return null; + } + leagueDetails = new LeagueDetails(league.getId(), + league.getName(), + league.getSport()); + } catch (Exception ex) { + throw new EJBException(ex); + } + return leagueDetails; + } + + private List copyPlayersToDetails(List players) { + List detailsList = new ArrayList<>(); + Iterator i = players.iterator(); + while (i.hasNext()) { + Player player = (Player) i.next(); + PlayerDetails playerDetails = new PlayerDetails(player.getId(), + player.getName(), + player.getPosition(), + player.getSalary()); + detailsList.add(playerDetails); + } + return detailsList; + } +} diff --git a/benchmark/persistence/roster/jakarta/roster-ejb/src/main/java/jakartaee/tutorial/roster/entity/League.java b/benchmark/persistence/roster/jakarta/roster-ejb/src/main/java/jakartaee/tutorial/roster/entity/League.java new file mode 100644 index 0000000000000000000000000000000000000000..6adeb6a0f5584d942ed1d144701f8d9dd946dfea --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-ejb/src/main/java/jakartaee/tutorial/roster/entity/League.java @@ -0,0 +1,75 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakartaee.tutorial.roster.entity; + +import java.io.Serializable; +import java.util.Collection; + +import jakarta.persistence.CascadeType; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.OneToMany; +import jakarta.persistence.Table; + + +@Entity +@Table(name = "PERSISTENCE_ROSTER_LEAGUE") +public abstract class League implements Serializable { + private static final long serialVersionUID = 5060910864394673463L; + protected String id; + protected String name; + protected String sport; + protected Collection teams; + + @Id + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSport() { + return sport; + } + + public void setSport(String sport) { + this.sport = sport; + } + + @OneToMany(cascade=CascadeType.ALL, mappedBy="league") + public Collection getTeams() { + return teams; + } + + public void setTeams(Collection teams) { + this.teams = teams; + } + + public void addTeam(Team team) { + this.getTeams().add(team); + } + + public void dropTeam(Team team) { + this.getTeams().remove(team); + } + +} diff --git a/benchmark/persistence/roster/jakarta/roster-ejb/src/main/java/jakartaee/tutorial/roster/entity/Player.java b/benchmark/persistence/roster/jakarta/roster-ejb/src/main/java/jakartaee/tutorial/roster/entity/Player.java new file mode 100644 index 0000000000000000000000000000000000000000..ee958f86dac29db1137dba708415cafd0833b1d8 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-ejb/src/main/java/jakartaee/tutorial/roster/entity/Player.java @@ -0,0 +1,93 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakartaee.tutorial.roster.entity; + +import java.io.Serializable; +import java.util.Collection; + +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.ManyToMany; +import jakarta.persistence.Table; + +@Entity +@Table(name = "PERSISTENCE_ROSTER_PLAYER") +public class Player implements Serializable { + private static final long serialVersionUID = -2760127516426049966L; + private String id; + private String name; + private String position; + private double salary; + private Collection teams; + + /** Creates a new instance of Player */ + public Player() { + } + + public Player(String id, String name, String position, double salary) { + this.id = id; + this.name = name; + this.position = position; + this.salary = salary; + } + + @Id + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public double getSalary() { + return salary; + } + + public void setSalary(double salary) { + this.salary = salary; + } + + @ManyToMany(mappedBy="players") + public Collection getTeams() { + return teams; + } + + public void setTeams(Collection teams) { + this.teams = teams; + } + + public void addTeam(Team team) { + this.getTeams().add(team); + } + + public void dropTeam(Team team) { + this.getTeams().remove(team); + } + +} diff --git a/benchmark/persistence/roster/jakarta/roster-ejb/src/main/java/jakartaee/tutorial/roster/entity/SummerLeague.java b/benchmark/persistence/roster/jakarta/roster-ejb/src/main/java/jakartaee/tutorial/roster/entity/SummerLeague.java new file mode 100644 index 0000000000000000000000000000000000000000..513d3e7f8eb897d17211f2c172179a9a43fc8394 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-ejb/src/main/java/jakartaee/tutorial/roster/entity/SummerLeague.java @@ -0,0 +1,40 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakartaee.tutorial.roster.entity; + +import java.io.Serializable; + +import jakarta.persistence.Entity; +import jakarta.tutorial.roster.util.IncorrectSportException; + +@Entity +public class SummerLeague extends League implements Serializable { + private static final long serialVersionUID = 4846138039113922695L; + + /** Creates a new instance of SummerLeague */ + public SummerLeague() { + } + + public SummerLeague(String id, String name, String sport) + throws IncorrectSportException { + this.id = id; + this.name = name; + if (sport.equalsIgnoreCase("swimming") || + sport.equalsIgnoreCase("soccer") || + sport.equalsIgnoreCase("basketball") || + sport.equalsIgnoreCase("baseball")) { + this.sport = sport; + } else { + throw new IncorrectSportException("Sport is not a summer sport."); + } + } +} diff --git a/benchmark/persistence/roster/jakarta/roster-ejb/src/main/java/jakartaee/tutorial/roster/entity/Team.java b/benchmark/persistence/roster/jakarta/roster-ejb/src/main/java/jakartaee/tutorial/roster/entity/Team.java new file mode 100644 index 0000000000000000000000000000000000000000..b45f22177d28de1114aa63b19966063a3262d7f8 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-ejb/src/main/java/jakartaee/tutorial/roster/entity/Team.java @@ -0,0 +1,102 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakartaee.tutorial.roster.entity; + +import java.io.Serializable; +import java.util.Collection; + +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.JoinTable; +import jakarta.persistence.ManyToMany; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; + + +@Entity +@Table(name = "PERSISTENCE_ROSTER_TEAM") +public class Team implements Serializable { + private static final long serialVersionUID = 4797864229333271809L; + private String id; + private String name; + private String city; + private Collection players; + private League league; + + /** Creates a new instance of Team */ + public Team() { + } + + public Team(String id, String name, String city) { + this.id = id; + this.name = name; + this.city = city; + } + + @Id + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + @ManyToMany + @JoinTable( + name="PERSISTENCE_ROSTER_TEAM_PLAYER", + joinColumns= + @JoinColumn(name="TEAM_ID", referencedColumnName="ID"), + inverseJoinColumns= + @JoinColumn(name="PLAYER_ID", referencedColumnName="ID") + ) + public Collection getPlayers() { + return players; + } + + public void setPlayers(Collection players) { + this.players = players; + } + + @ManyToOne public League getLeague() { + return league; + } + + public void setLeague(League league) { + this.league = league; + } + + public void addPlayer(Player player) { + this.getPlayers().add(player); + } + + public void dropPlayer(Player player) { + this.getPlayers().remove(player); + } +} diff --git a/benchmark/persistence/roster/jakarta/roster-ejb/src/main/java/jakartaee/tutorial/roster/entity/WinterLeague.java b/benchmark/persistence/roster/jakarta/roster-ejb/src/main/java/jakartaee/tutorial/roster/entity/WinterLeague.java new file mode 100644 index 0000000000000000000000000000000000000000..95f89e65773d2e12652003a1badd0b9bbf949c7d --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-ejb/src/main/java/jakartaee/tutorial/roster/entity/WinterLeague.java @@ -0,0 +1,40 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakartaee.tutorial.roster.entity; + +import java.io.Serializable; + +import jakarta.persistence.Entity; +import jakarta.tutorial.roster.util.IncorrectSportException; + +@Entity +public class WinterLeague extends League implements Serializable { + private static final long serialVersionUID = 8942582153559426625L; + + /** Creates a new instance of WinterLeague */ + public WinterLeague() { + } + + public WinterLeague(String id, String name, String sport) throws + IncorrectSportException { + this.id = id; + this.name = name; + if (sport.equalsIgnoreCase("hockey") || + sport.equalsIgnoreCase("skiing") || + sport.equalsIgnoreCase("snowboarding")) { + this.sport = sport; + } else { + throw new IncorrectSportException("Sport is not a winter sport."); + } + } + +} diff --git a/benchmark/persistence/roster/jakarta/roster-ejb/src/main/resources/META-INF/MANIFEST.MF b/benchmark/persistence/roster/jakarta/roster-ejb/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000000000000000000000000000000000000..0f831c5bbbb3617be0186e5135664aded247f1d9 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-ejb/src/main/resources/META-INF/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 +Class-Path: roster-common.jar diff --git a/benchmark/persistence/roster/jakarta/roster-ejb/src/main/resources/META-INF/persistence.xml b/benchmark/persistence/roster/jakarta/roster-ejb/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000000000000000000000000000000000000..b2986be2363be1be74bdbcf803bd83ce0274c78a --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-ejb/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,26 @@ + + + + + java:comp/DefaultDataSource + + + + + diff --git a/benchmark/persistence/roster/jakarta/roster-web/pom.xml b/benchmark/persistence/roster/jakarta/roster-web/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..80be25fe2b039ddd444410f75cf600a0314ef81e --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-web/pom.xml @@ -0,0 +1,59 @@ + + 4.0.0 + + + jakarta.tutorial + roster + 1.0.0 + + + roster-web + war + roster-web + + + 17 + 17 + UTF-8 + + + + + jakarta.tutorial + roster-common + ${project.version} + + + + jakarta.platform + jakarta.jakartaee-web-api + 10.0.0 + provided + + + + + jakarta.tutorial + roster-ejb + ${project.version} + ejb + provided + + + + + roster + + + org.apache.maven.plugins + maven-war-plugin + 3.4.0 + + false + + + + + diff --git a/benchmark/persistence/roster/jakarta/roster-web/src/main/java/jakartaee/tutorial/roster/web/LeagueBean.java b/benchmark/persistence/roster/jakarta/roster-web/src/main/java/jakartaee/tutorial/roster/web/LeagueBean.java new file mode 100644 index 0000000000000000000000000000000000000000..5acbb44232e24998f68f0fa852c179f50c5ada85 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-web/src/main/java/jakartaee/tutorial/roster/web/LeagueBean.java @@ -0,0 +1,153 @@ +package jakartaee.tutorial.roster.web; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import jakarta.annotation.PostConstruct; +import jakarta.ejb.EJB; +import jakarta.enterprise.context.SessionScoped; +import jakarta.faces.application.FacesMessage; +import jakarta.faces.context.FacesContext; +import jakarta.inject.Named; +import jakarta.tutorial.roster.request.RequestBean; +import jakarta.tutorial.roster.util.LeagueDetails; +import jakarta.tutorial.roster.util.TeamDetails; + +@Named +@SessionScoped +public class LeagueBean implements Serializable { + + @EJB + private RequestBean requestBean; + + private List leagues; + private List teams; + + private String newLeagueId; + private String newLeagueName; + private String newLeagueSport; + + @PostConstruct + public void init() { + loadData(); + } + + public void loadData() { + loadLeagues(); + loadTeams(); + } + + private void loadLeagues() { + try { + leagues = requestBean.getAllLeagues(); + if (leagues == null) { + leagues = new ArrayList<>(); + } + } catch (Exception e) { + FacesContext.getCurrentInstance().addMessage(null, + new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error loading leagues", e.getMessage())); + leagues = new ArrayList<>(); + } + } + + private void loadTeams() { + try { + teams = new ArrayList<>(); + // Get teams from all leagues + for (LeagueDetails league : getLeagues()) { + List leagueTeams = requestBean.getTeamsOfLeague(league.getId()); + if (leagueTeams != null) { + teams.addAll(leagueTeams); + } + } + } catch (Exception e) { + FacesContext.getCurrentInstance().addMessage(null, + new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error loading teams", e.getMessage())); + teams = new ArrayList<>(); + } + } + + public String createLeague() { + try { + if (newLeagueId == null || newLeagueId.isBlank() + || newLeagueName == null || newLeagueName.isBlank() + || newLeagueSport == null || newLeagueSport.isBlank()) { + FacesContext.getCurrentInstance().addMessage(null, + new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error", "All league fields are required.")); + return null; + } + + LeagueDetails leagueDetails = new LeagueDetails(newLeagueId.trim(), newLeagueName.trim(), + newLeagueSport.trim()); + requestBean.createLeague(leagueDetails); + + newLeagueId = null; + newLeagueName = null; + newLeagueSport = null; + + clearCache(); + FacesContext.getCurrentInstance().addMessage(null, + new FacesMessage(FacesMessage.SEVERITY_INFO, "Success", "League created successfully.")); + return null; + } catch (Exception e) { + FacesContext.getCurrentInstance().addMessage(null, + new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error creating league", e.getMessage())); + return null; + } + } + + public void clearCache() { + leagues = null; + teams = null; + loadData(); + } + + public List getLeagueIds() { + List ids = new ArrayList<>(); + for (LeagueDetails league : getLeagues()) { + ids.add(league.getId()); + } + return ids; + } + + // Getters + + public List getLeagues() { + if (leagues == null) { + loadLeagues(); + } + return leagues; + } + + public List getTeams() { + if (teams == null) { + loadTeams(); + } + return teams; + } + + public String getNewLeagueId() { + return newLeagueId; + } + + public void setNewLeagueId(String newLeagueId) { + this.newLeagueId = newLeagueId; + } + + public String getNewLeagueName() { + return newLeagueName; + } + + public void setNewLeagueName(String newLeagueName) { + this.newLeagueName = newLeagueName; + } + + public String getNewLeagueSport() { + return newLeagueSport; + } + + public void setNewLeagueSport(String newLeagueSport) { + this.newLeagueSport = newLeagueSport; + } +} diff --git a/benchmark/persistence/roster/jakarta/roster-web/src/main/java/jakartaee/tutorial/roster/web/PlayerBean.java b/benchmark/persistence/roster/jakarta/roster-web/src/main/java/jakartaee/tutorial/roster/web/PlayerBean.java new file mode 100644 index 0000000000000000000000000000000000000000..758131db348b202b9b98aaa42c546f8ee6133f6d --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-web/src/main/java/jakartaee/tutorial/roster/web/PlayerBean.java @@ -0,0 +1,149 @@ +package jakartaee.tutorial.roster.web; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import jakarta.annotation.PostConstruct; +import jakarta.ejb.EJB; +import jakarta.enterprise.context.SessionScoped; +import jakarta.faces.application.FacesMessage; +import jakarta.faces.context.FacesContext; +import jakarta.inject.Named; +import jakarta.tutorial.roster.request.RequestBean; +import jakarta.tutorial.roster.util.PlayerDetails; + +@Named +@SessionScoped +public class PlayerBean implements Serializable { + + @EJB + private RequestBean requestBean; + + private List players; + private String newPlayerId; + private String newPlayerName; + private String newPlayerPosition; + private double newPlayerSalary; + private String selectedTeamId; + + @PostConstruct + public void init() { + loadPlayers(); + } + + public void loadPlayers() { + try { + players = requestBean.getAllPlayers(); + } catch (Exception e) { + FacesContext.getCurrentInstance().addMessage(null, + new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error loading players", e.getMessage())); + players = new ArrayList<>(); + } + } + + public String createPlayer() { + try { + // Generate a simple ID if not provided + String playerId = (newPlayerId != null && !newPlayerId.isEmpty()) + ? newPlayerId + : "P" + System.currentTimeMillis(); + + // Create the player + requestBean.createPlayer(playerId, newPlayerName, newPlayerPosition, newPlayerSalary); + + // Add player to team if one is selected + if (selectedTeamId != null && !selectedTeamId.isEmpty()) { + requestBean.addPlayer(playerId, selectedTeamId); + } + + // Clear form + newPlayerId = null; + newPlayerName = null; + newPlayerPosition = null; + newPlayerSalary = 0.0; + selectedTeamId = null; + + // Reload players + loadPlayers(); + + FacesContext.getCurrentInstance().addMessage(null, + new FacesMessage(FacesMessage.SEVERITY_INFO, "Success", "Player created successfully")); + + return null; + } catch (Exception e) { + FacesContext.getCurrentInstance().addMessage(null, + new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error creating player", e.getMessage())); + return null; + } + } + + public String deletePlayer(String playerId) { + try { + requestBean.removePlayer(playerId); + loadPlayers(); + + FacesContext.getCurrentInstance().addMessage(null, + new FacesMessage(FacesMessage.SEVERITY_INFO, "Success", "Player deleted successfully")); + + return null; + } catch (Exception e) { + FacesContext.getCurrentInstance().addMessage(null, + new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error deleting player", e.getMessage())); + return null; + } + } + + // Getters and setters + + public List getPlayers() { + if (players == null) { + loadPlayers(); + } + return players; + } + + public void setPlayers(List players) { + this.players = players; + } + + public String getNewPlayerId() { + return newPlayerId; + } + + public void setNewPlayerId(String newPlayerId) { + this.newPlayerId = newPlayerId; + } + + public String getNewPlayerName() { + return newPlayerName; + } + + public void setNewPlayerName(String newPlayerName) { + this.newPlayerName = newPlayerName; + } + + public String getNewPlayerPosition() { + return newPlayerPosition; + } + + public void setNewPlayerPosition(String newPlayerPosition) { + this.newPlayerPosition = newPlayerPosition; + } + + public double getNewPlayerSalary() { + return newPlayerSalary; + } + + public void setNewPlayerSalary(double newPlayerSalary) { + this.newPlayerSalary = newPlayerSalary; + } + + public String getSelectedTeamId() { + return selectedTeamId; + } + + public void setSelectedTeamId(String selectedTeamId) { + this.selectedTeamId = selectedTeamId; + } +} diff --git a/benchmark/persistence/roster/jakarta/roster-web/src/main/java/jakartaee/tutorial/roster/web/RosterApplication.java b/benchmark/persistence/roster/jakarta/roster-web/src/main/java/jakartaee/tutorial/roster/web/RosterApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..620ddd70ae78c024e01ca594027b42f836067404 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-web/src/main/java/jakartaee/tutorial/roster/web/RosterApplication.java @@ -0,0 +1,8 @@ +package jakartaee.tutorial.roster.web; + +import jakarta.ws.rs.ApplicationPath; +import jakarta.ws.rs.core.Application; + +@ApplicationPath("") +public class RosterApplication extends Application { +} diff --git a/benchmark/persistence/roster/jakarta/roster-web/src/main/java/jakartaee/tutorial/roster/web/RosterResource.java b/benchmark/persistence/roster/jakarta/roster-web/src/main/java/jakartaee/tutorial/roster/web/RosterResource.java new file mode 100644 index 0000000000000000000000000000000000000000..3e8f7794334b83fbdbcff44afd5cc5167f6e562a --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-web/src/main/java/jakartaee/tutorial/roster/web/RosterResource.java @@ -0,0 +1,247 @@ +package jakartaee.tutorial.roster.web; + +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import jakarta.ejb.EJB; +import jakarta.ejb.EJBException; +import jakarta.tutorial.roster.request.Request; +import jakarta.tutorial.roster.util.IncorrectSportException; +import jakarta.tutorial.roster.util.LeagueDetails; +import jakarta.tutorial.roster.util.PlayerDetails; +import jakarta.tutorial.roster.util.TeamDetails; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; + +@Path("/") +@Produces(MediaType.APPLICATION_JSON) +public class RosterResource { + + private static final Logger logger = Logger.getLogger("roster.web.RosterResource"); + + @EJB + private Request requestBean; + + // ----------------------------------------------------------------------- + // League endpoints + // ----------------------------------------------------------------------- + + @POST + @Path("/league") + @Consumes(MediaType.APPLICATION_JSON) + public Response createLeague(LeagueDetails league) { + try { + requestBean.createLeague(league); + return Response.ok().build(); + } catch (EJBException e) { + if (hasIncorrectSportCause(e)) { + return Response.status(Response.Status.BAD_REQUEST) + .entity("{\"error\":\"Invalid sport: " + league.getSport() + "\"}") + .build(); + } + throw e; + } + } + + @GET + @Path("/league/{id}") + public Response getLeague(@PathParam("id") String id) { + LeagueDetails league = requestBean.getLeague(id); + if (league == null) { + return Response.status(Response.Status.NOT_FOUND).build(); + } + return Response.ok(league).build(); + } + + @DELETE + @Path("/league/{id}") + public Response removeLeague(@PathParam("id") String id) { + requestBean.removeLeague(id); + return Response.ok().build(); + } + + @GET + @Path("/league/{id}/teams") + public List getTeamsOfLeague(@PathParam("id") String id) { + return requestBean.getTeamsOfLeague(id); + } + + // ----------------------------------------------------------------------- + // Team endpoints + // ----------------------------------------------------------------------- + + @POST + @Path("/team/league/{leagueId}") + @Consumes(MediaType.APPLICATION_JSON) + public Response createTeamInLeague(TeamDetails team, @PathParam("leagueId") String leagueId) { + requestBean.createTeamInLeague(team, leagueId); + return Response.ok().build(); + } + + @GET + @Path("/team/{id}") + public Response getTeam(@PathParam("id") String id) { + TeamDetails team = requestBean.getTeam(id); + if (team == null) { + return Response.status(Response.Status.NOT_FOUND).build(); + } + return Response.ok(team).build(); + } + + @DELETE + @Path("/team/{id}") + public Response removeTeam(@PathParam("id") String id) { + requestBean.removeTeam(id); + return Response.ok().build(); + } + + @GET + @Path("/team/{id}/players") + public List getPlayersOfTeam(@PathParam("id") String id) { + return requestBean.getPlayersOfTeam(id); + } + + // ----------------------------------------------------------------------- + // Player endpoints + // ----------------------------------------------------------------------- + + @POST + @Path("/player") + public Response createPlayer( + @QueryParam("id") String id, + @QueryParam("name") String name, + @QueryParam("position") String position, + @QueryParam("salary") double salary) { + requestBean.createPlayer(id, name, position, salary); + return Response.ok().build(); + } + + @GET + @Path("/player/{id}") + public Response getPlayer(@PathParam("id") String id) { + try { + PlayerDetails player = requestBean.getPlayer(id); + if (player == null) { + return Response.status(Response.Status.NOT_FOUND).build(); + } + return Response.ok(player).build(); + } catch (EJBException e) { + return Response.status(Response.Status.NOT_FOUND).build(); + } + } + + @DELETE + @Path("/player/{id}") + public Response removePlayer(@PathParam("id") String id) { + try { + requestBean.removePlayer(id); + return Response.ok().build(); + } catch (EJBException e) { + return Response.status(Response.Status.NOT_FOUND).build(); + } + } + + @POST + @Path("/player/{pid}/team/{tid}") + public Response addPlayerToTeam(@PathParam("pid") String pid, @PathParam("tid") String tid) { + requestBean.addPlayer(pid, tid); + return Response.ok().build(); + } + + @DELETE + @Path("/player/{pid}/team/{tid}") + public Response dropPlayerFromTeam(@PathParam("pid") String pid, @PathParam("tid") String tid) { + requestBean.dropPlayer(pid, tid); + return Response.ok().build(); + } + + @GET + @Path("/player/{id}/leagues") + public List getLeaguesOfPlayer(@PathParam("id") String id) { + return requestBean.getLeaguesOfPlayer(id); + } + + @GET + @Path("/player/{id}/sports") + public List getSportsOfPlayer(@PathParam("id") String id) { + return requestBean.getSportsOfPlayer(id); + } + + // ----------------------------------------------------------------------- + // Query endpoints + // ----------------------------------------------------------------------- + + @GET + @Path("/players") + public List getAllPlayers() { + return requestBean.getAllPlayers(); + } + + @GET + @Path("/players/position/{position}") + public List getPlayersByPosition(@PathParam("position") String position) { + return requestBean.getPlayersByPosition(position); + } + + @GET + @Path("/players/salary/higher/{name}") + public List getPlayersByHigherSalary(@PathParam("name") String name) { + return requestBean.getPlayersByHigherSalary(name); + } + + @GET + @Path("/players/salary/range") + public List getPlayersBySalaryRange( + @QueryParam("low") double low, + @QueryParam("high") double high) { + return requestBean.getPlayersBySalaryRange(low, high); + } + + @GET + @Path("/players/league/{id}") + public List getPlayersByLeague(@PathParam("id") String id) { + return requestBean.getPlayersByLeagueId(id); + } + + @GET + @Path("/players/sport/{sport}") + public List getPlayersBySport(@PathParam("sport") String sport) { + return requestBean.getPlayersBySport(sport); + } + + @GET + @Path("/players/city/{city}") + public List getPlayersByCity(@PathParam("city") String city) { + return requestBean.getPlayersByCity(city); + } + + @GET + @Path("/players/not-on-team") + public List getPlayersNotOnTeam() { + return requestBean.getPlayersNotOnTeam(); + } + + // ----------------------------------------------------------------------- + // Helpers + // ----------------------------------------------------------------------- + + private boolean hasIncorrectSportCause(EJBException e) { + Throwable cause = e.getCause(); + while (cause != null) { + if (cause instanceof IncorrectSportException) { + return true; + } + cause = cause.getCause(); + } + return false; + } +} diff --git a/benchmark/persistence/roster/jakarta/roster-web/src/main/java/jakartaee/tutorial/roster/web/TeamBean.java b/benchmark/persistence/roster/jakarta/roster-web/src/main/java/jakartaee/tutorial/roster/web/TeamBean.java new file mode 100644 index 0000000000000000000000000000000000000000..44e4381b7126f94b376ec046be12ffee7ab00e5a --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-web/src/main/java/jakartaee/tutorial/roster/web/TeamBean.java @@ -0,0 +1,125 @@ +package jakartaee.tutorial.roster.web; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import jakarta.annotation.PostConstruct; +import jakarta.ejb.EJB; +import jakarta.enterprise.context.SessionScoped; +import jakarta.faces.application.FacesMessage; +import jakarta.faces.context.FacesContext; +import jakarta.inject.Inject; +import jakarta.inject.Named; +import jakarta.tutorial.roster.request.RequestBean; +import jakarta.tutorial.roster.util.TeamDetails; + +@Named +@SessionScoped +public class TeamBean implements Serializable { + + @EJB + private RequestBean requestBean; + + @Inject + private LeagueBean leagueBean; + + private List teams; + private String newTeamId; + private String newTeamName; + private String newTeamCity; + private String selectedLeagueId; + + @PostConstruct + public void init() { + loadTeams(); + } + + public void loadTeams() { + try { + teams = new ArrayList<>(); + // Get teams from all leagues + for (String leagueId : leagueBean.getLeagueIds()) { + List leagueTeams = requestBean.getTeamsOfLeague(leagueId); + if (leagueTeams != null) { + teams.addAll(leagueTeams); + } + } + } catch (Exception e) { + FacesContext.getCurrentInstance().addMessage(null, + new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error loading teams", e.getMessage())); + teams = new ArrayList<>(); + } + } + + public String createTeam() { + try { + TeamDetails teamDetails = new TeamDetails(newTeamId, newTeamName, newTeamCity); + requestBean.createTeamInLeague(teamDetails, selectedLeagueId); + + // Clear form + newTeamId = null; + newTeamName = null; + newTeamCity = null; + selectedLeagueId = null; + + // Reload teams + loadTeams(); + leagueBean.clearCache(); // Clear the cache to reload teams for dropdowns + + FacesContext.getCurrentInstance().addMessage(null, + new FacesMessage(FacesMessage.SEVERITY_INFO, "Success", "Team created successfully")); + + return null; + } catch (Exception e) { + FacesContext.getCurrentInstance().addMessage(null, + new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error creating team", e.getMessage())); + return null; + } + } + + // Getters and setters + + public List getTeams() { + if (teams == null) { + loadTeams(); + } + return teams; + } + + public void setTeams(List teams) { + this.teams = teams; + } + + public String getNewTeamId() { + return newTeamId; + } + + public void setNewTeamId(String newTeamId) { + this.newTeamId = newTeamId; + } + + public String getNewTeamName() { + return newTeamName; + } + + public void setNewTeamName(String newTeamName) { + this.newTeamName = newTeamName; + } + + public String getNewTeamCity() { + return newTeamCity; + } + + public void setNewTeamCity(String newTeamCity) { + this.newTeamCity = newTeamCity; + } + + public String getSelectedLeagueId() { + return selectedLeagueId; + } + + public void setSelectedLeagueId(String selectedLeagueId) { + this.selectedLeagueId = selectedLeagueId; + } +} diff --git a/benchmark/persistence/roster/jakarta/roster-web/src/main/webapp/WEB-INF/beans.xml b/benchmark/persistence/roster/jakarta/roster-web/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 0000000000000000000000000000000000000000..35fd4317713815478e1b58786c74b0de0f1f0cc4 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-web/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,8 @@ + + + diff --git a/benchmark/persistence/roster/jakarta/roster-web/src/main/webapp/WEB-INF/web.xml b/benchmark/persistence/roster/jakarta/roster-web/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000000000000000000000000000000000..e454f0cea9255e66b05d6be068b7cc3246f5e249 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-web/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,34 @@ + + + + Roster Web Application + + + player.xhtml + + + + jakarta.faces.PROJECT_STAGE + Production + + + + jakarta.faces.FACELETS_SKIP_COMMENTS + true + + + + Faces Servlet + jakarta.faces.webapp.FacesServlet + 1 + + + + Faces Servlet + *.xhtml + + diff --git a/benchmark/persistence/roster/jakarta/roster-web/src/main/webapp/league.xhtml b/benchmark/persistence/roster/jakarta/roster-web/src/main/webapp/league.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..c066d5ef005c0314be2e5d044a62b87a17989a90 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-web/src/main/webapp/league.xhtml @@ -0,0 +1,115 @@ + + + + + + + Roster - League Management + + + +
+

Roster Application - League Management

+ + + + + +
+

Create League

+ +
+ + +
+ +
+ + +
+ +
+ + +
+ Valid sports: soccer, swimming, basketball, baseball, hockey, skiing, snowboarding +
+
+ +
+ + +
+
+
+ +
+

All Leagues

+ + + ID + #{league.id} + + + Name + #{league.name} + + + Sport + #{league.sport} + + + +

+ No leagues found. +

+
+
+
+ + diff --git a/benchmark/persistence/roster/jakarta/roster-web/src/main/webapp/player.xhtml b/benchmark/persistence/roster/jakarta/roster-web/src/main/webapp/player.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..09fe9b9390125e8f54b95a5c2ef573e825b3035e --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-web/src/main/webapp/player.xhtml @@ -0,0 +1,156 @@ + + + + + + + Roster - Player Management + + + +
+

Roster Application - Player Management

+ + + + + +
+

Add New Player

+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + + + +
+ +
+ + + + + +
+ +
+ +
+
+
+ +
+

All Players

+ + + + ID + #{player.id} + + + Name + #{player.name} + + + Position + #{player.position} + + + Salary + + + + + + Actions + + + + + + +

+ No players found. Add one using the form above. +

+
+
+
+
+ + \ No newline at end of file diff --git a/benchmark/persistence/roster/jakarta/roster-web/src/main/webapp/resources/css/styles.css b/benchmark/persistence/roster/jakarta/roster-web/src/main/webapp/resources/css/styles.css new file mode 100644 index 0000000000000000000000000000000000000000..b502a7499ed55d39301c2080f554e18698c549b0 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-web/src/main/webapp/resources/css/styles.css @@ -0,0 +1,204 @@ +/* Roster Application Styles */ + +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif; + line-height: 1.6; + color: #333; + background-color: #f5f5f5; + padding: 20px; +} + +.container { + max-width: 1200px; + margin: 0 auto; + background-color: white; + padding: 30px; + border-radius: 8px; + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); +} + +h1 { + color: #2c3e50; + margin-bottom: 30px; + border-bottom: 3px solid #3498db; + padding-bottom: 10px; +} + +h2 { + color: #34495e; + margin: 20px 0 15px 0; +} + +.nav { + margin-bottom: 30px; + border-bottom: 1px solid #ddd; + padding-bottom: 10px; +} + +.nav-link { + display: inline-block; + padding: 10px 20px; + margin-right: 10px; + text-decoration: none; + color: #3498db; + border-radius: 4px; + transition: background-color 0.3s; +} + +.nav-link:hover { + background-color: #ecf0f1; +} + +.section { + margin-bottom: 40px; +} + +.form { + background-color: #f9f9f9; + padding: 20px; + border-radius: 4px; + margin-bottom: 20px; +} + +.form-group { + margin-bottom: 15px; +} + +.form-group label { + display: block; + margin-bottom: 5px; + font-weight: 600; + color: #555; +} + +.form-control { + width: 100%; + padding: 10px; + border: 1px solid #ddd; + border-radius: 4px; + font-size: 14px; + transition: border-color 0.3s; +} + +.form-control:focus { + outline: none; + border-color: #3498db; + box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1); +} + +.form-actions { + margin-top: 20px; +} + +.btn { + padding: 10px 20px; + border: none; + border-radius: 4px; + font-size: 14px; + cursor: pointer; + transition: background-color 0.3s, transform 0.1s; +} + +.btn:active { + transform: translateY(1px); +} + +.btn-primary { + background-color: #3498db; + color: white; +} + +.btn-primary:hover { + background-color: #2980b9; +} + +.btn-danger { + background-color: #e74c3c; + color: white; +} + +.btn-danger:hover { + background-color: #c0392b; +} + +.btn-sm { + padding: 5px 10px; + font-size: 12px; +} + +.data-table { + width: 100%; + border-collapse: collapse; + margin-top: 20px; +} + +.table-header { + background-color: #34495e; + color: white; + padding: 12px; + text-align: left; + font-weight: 600; +} + +.data-table td { + padding: 12px; + border-bottom: 1px solid #ddd; +} + +.table-row-odd { + background-color: #f9f9f9; +} + +.table-row-even { + background-color: white; +} + +.data-table tr:hover { + background-color: #ecf0f1; +} + +.messages { + padding: 15px; + margin-bottom: 20px; + border-radius: 4px; + border-left: 4px solid; +} + +.messages.info { + background-color: #d1ecf1; + border-color: #0c5460; + color: #0c5460; +} + +.messages.error { + background-color: #f8d7da; + border-color: #721c24; + color: #721c24; +} + +.no-data { + text-align: center; + padding: 40px 20px; + color: #7f8c8d; + font-style: italic; +} + +@media (max-width: 768px) { + .container { + padding: 15px; + } + + .data-table { + font-size: 14px; + } + + .data-table td { + padding: 8px; + } +} \ No newline at end of file diff --git a/benchmark/persistence/roster/jakarta/roster-web/src/main/webapp/team.xhtml b/benchmark/persistence/roster/jakarta/roster-web/src/main/webapp/team.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..fca133db8516407bf68262484fbb736fa10293e3 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/roster-web/src/main/webapp/team.xhtml @@ -0,0 +1,124 @@ + + + + + + + Roster - Team Management + + + +
+

Roster Application - Team Management

+ + + + + +
+

Add New Team

+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + + + + +
+ +
+ +
+
+
+ +
+

All Teams

+ + + ID + #{team.id} + + + Name + #{team.name} + + + City + #{team.city} + + + +

+ No teams found. Add one using the form above. +

+
+
+
+ + \ No newline at end of file diff --git a/benchmark/persistence/roster/jakarta/test.sh b/benchmark/persistence/roster/jakarta/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..f6a157ecdc0a944e447b8e779826a62055372345 --- /dev/null +++ b/benchmark/persistence/roster/jakarta/test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +BASE_URL="${BASE_URL:-http://localhost:9080/roster}" + +echo "Health check: ${BASE_URL}" +HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}") + +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "PASS - got HTTP ${HTTP_STATUS}" + exit 0 +else + echo "FAIL - got HTTP ${HTTP_STATUS}" + exit 1 +fi diff --git a/benchmark/persistence/roster/quarkus/.dockerignore b/benchmark/persistence/roster/quarkus/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..c634c57d9244b4e60b8fa936f09dbe4e75706e74 --- /dev/null +++ b/benchmark/persistence/roster/quarkus/.dockerignore @@ -0,0 +1,41 @@ +# VCS +.git/ + +# Maven +.mvn/ +**/.mvn/ +mvnw +mvnw.cmd +**/mvnw +**/mvnw.cmd +target/ +**/target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties + +# IDE / Editor +.vscode/ +**/.vscode/ +.zed/ +**/.zed/ +.idea/ +**/.idea/ +*.iml +*.ipr +*.iws + +# OS +.DS_Store +**/.DS_Store +Thumbs.db +ehthumbs.db + +# Logs / temp +*.log +*.tmp +*.temp diff --git a/benchmark/persistence/roster/quarkus/.mvn/wrapper/maven-wrapper.properties b/benchmark/persistence/roster/quarkus/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..8dea6c227c08000d2400d38a2ac886063f22bc36 --- /dev/null +++ b/benchmark/persistence/roster/quarkus/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,3 @@ +wrapperVersion=3.3.4 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.12/apache-maven-3.9.12-bin.zip diff --git a/benchmark/persistence/roster/quarkus/Dockerfile b/benchmark/persistence/roster/quarkus/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..5b85845ebb66e78ecce7a6dd3e30269db90b4bb5 --- /dev/null +++ b/benchmark/persistence/roster/quarkus/Dockerfile @@ -0,0 +1,33 @@ +FROM maven:3.9.12-ibm-semeru-21-noble + +USER root +# install uv +RUN apt-get update && apt-get install -y --no-install-recommends curl lsof python3-venv python3-full && curl -LsSf https://astral.sh/uv/install.sh | sh + +ENV PATH="/root/.local/bin:$PATH" + +# Shared browsers path so Chromium is cached once +ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright +RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright + +# create venv and install +RUN uv venv /opt/venv && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest + +ENV PATH="/opt/venv/bin:$PATH" +RUN playwright install --with-deps chromium + +# Set working directory +WORKDIR /app + +# Copy all the assets +COPY . . + +# Build the application at image build time +RUN mvn clean install -DskipTests + +COPY test.sh . +RUN chmod +x test.sh + +RUN mvn clean install -DskipTests + +CMD ["mvn", "quarkus:run"] diff --git a/benchmark/persistence/roster/quarkus/README.md b/benchmark/persistence/roster/quarkus/README.md new file mode 100644 index 0000000000000000000000000000000000000000..b19cfe20a44c96f66cfd31b67b17f6b1b530132b --- /dev/null +++ b/benchmark/persistence/roster/quarkus/README.md @@ -0,0 +1,75 @@ +# roster-quarkus + +This project uses Quarkus, the Supersonic Subatomic Java Framework. + +If you want to learn more about Quarkus, please visit its website: . + +## Running the application in dev mode + +You can run your application in dev mode that enables live coding using: + +```shell script +./mvnw quarkus:dev +``` + +> **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at . + +## Packaging and running the application + +The application can be packaged using: + +```shell script +./mvnw package +``` + +It produces the `quarkus-run.jar` file in the `target/quarkus-app/` directory. +Be aware that it’s not an _über-jar_ as the dependencies are copied into the `target/quarkus-app/lib/` directory. + +The application is now runnable using `java -jar target/quarkus-app/quarkus-run.jar`. + +If you want to build an _über-jar_, execute the following command: + +```shell script +./mvnw package -Dquarkus.package.jar.type=uber-jar +``` + +The application, packaged as an _über-jar_, is now runnable using `java -jar target/*-runner.jar`. + +## Creating a native executable + +You can create a native executable using: + +```shell script +./mvnw package -Dnative +``` + +Or, if you don't have GraalVM installed, you can run the native executable build in a container using: + +```shell script +./mvnw package -Dnative -Dquarkus.native.container-build=true +``` + +You can then execute your native executable with: `./target/roster-quarkus-1.0.0-SNAPSHOT-runner` + +If you want to learn more about building native executables, please consult . + +## Related Guides + +- Hibernate ORM ([guide](https://quarkus.io/guides/hibernate-orm)): Define your persistent model with Hibernate ORM and Jakarta Persistence +- REST ([guide](https://quarkus.io/guides/rest)): A Jakarta REST implementation utilizing build time processing and Vert.x. This extension is not compatible with the quarkus-resteasy extension, or any of the extensions that depend on it. + +## Provided Code + +### Hibernate ORM + +Create your first JPA entity + +[Related guide section...](https://quarkus.io/guides/hibernate-orm) + + + +### REST + +Easily start your REST Web Services + +[Related guide section...](https://quarkus.io/guides/getting-started-reactive#reactive-jax-rs-resources) diff --git a/benchmark/persistence/roster/quarkus/mvnw b/benchmark/persistence/roster/quarkus/mvnw new file mode 100644 index 0000000000000000000000000000000000000000..bd8896bf2217b46faa0291585e01ac1a3441a958 --- /dev/null +++ b/benchmark/persistence/roster/quarkus/mvnw @@ -0,0 +1,295 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.4 +# +# Optional ENV vars +# ----------------- +# JAVA_HOME - location of a JDK home dir, required when download maven via java source +# MVNW_REPOURL - repo url base for downloading maven distribution +# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output +# ---------------------------------------------------------------------------- + +set -euf +[ "${MVNW_VERBOSE-}" != debug ] || set -x + +# OS specific support. +native_path() { printf %s\\n "$1"; } +case "$(uname)" in +CYGWIN* | MINGW*) + [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" + native_path() { cygpath --path --windows "$1"; } + ;; +esac + +# set JAVACMD and JAVACCMD +set_java_home() { + # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched + if [ -n "${JAVA_HOME-}" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACCMD="$JAVA_HOME/jre/sh/javac" + else + JAVACMD="$JAVA_HOME/bin/java" + JAVACCMD="$JAVA_HOME/bin/javac" + + if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then + echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 + echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 + return 1 + fi + fi + else + JAVACMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v java + )" || : + JAVACCMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v javac + )" || : + + if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then + echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 + return 1 + fi + fi +} + +# hash string like Java String::hashCode +hash_string() { + str="${1:-}" h=0 + while [ -n "$str" ]; do + char="${str%"${str#?}"}" + h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) + str="${str#?}" + done + printf %x\\n $h +} + +verbose() { :; } +[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } + +die() { + printf %s\\n "$1" >&2 + exit 1 +} + +trim() { + # MWRAPPER-139: + # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. + # Needed for removing poorly interpreted newline sequences when running in more + # exotic environments such as mingw bash on Windows. + printf "%s" "${1}" | tr -d '[:space:]' +} + +scriptDir="$(dirname "$0")" +scriptName="$(basename "$0")" + +# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties +while IFS="=" read -r key value; do + case "${key-}" in + distributionUrl) distributionUrl=$(trim "${value-}") ;; + distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; + esac +done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" + +case "${distributionUrl##*/}" in +maven-mvnd-*bin.*) + MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ + case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in + *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; + :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; + :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; + :Linux*x86_64*) distributionPlatform=linux-amd64 ;; + *) + echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 + distributionPlatform=linux-amd64 + ;; + esac + distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" + ;; +maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; +*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; +esac + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" +distributionUrlName="${distributionUrl##*/}" +distributionUrlNameMain="${distributionUrlName%.*}" +distributionUrlNameMain="${distributionUrlNameMain%-bin}" +MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" +MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" + +exec_maven() { + unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : + exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" +} + +if [ -d "$MAVEN_HOME" ]; then + verbose "found existing MAVEN_HOME at $MAVEN_HOME" + exec_maven "$@" +fi + +case "${distributionUrl-}" in +*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; +*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; +esac + +# prepare tmp dir +if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then + clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } + trap clean HUP INT TERM EXIT +else + die "cannot create temp dir" +fi + +mkdir -p -- "${MAVEN_HOME%/*}" + +# Download and Install Apache Maven +verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +verbose "Downloading from: $distributionUrl" +verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +# select .zip or .tar.gz +if ! command -v unzip >/dev/null; then + distributionUrl="${distributionUrl%.zip}.tar.gz" + distributionUrlName="${distributionUrl##*/}" +fi + +# verbose opt +__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' +[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v + +# normalize http auth +case "${MVNW_PASSWORD:+has-password}" in +'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; +has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; +esac + +if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then + verbose "Found wget ... using wget" + wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" +elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then + verbose "Found curl ... using curl" + curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" +elif set_java_home; then + verbose "Falling back to use Java to download" + javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" + targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" + cat >"$javaSource" <<-END + public class Downloader extends java.net.Authenticator + { + protected java.net.PasswordAuthentication getPasswordAuthentication() + { + return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); + } + public static void main( String[] args ) throws Exception + { + setDefault( new Downloader() ); + java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); + } + } + END + # For Cygwin/MinGW, switch paths to Windows format before running javac and java + verbose " - Compiling Downloader.java ..." + "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" + verbose " - Running Downloader.java ..." + "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" +fi + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +if [ -n "${distributionSha256Sum-}" ]; then + distributionSha256Result=false + if [ "$MVN_CMD" = mvnd.sh ]; then + echo "Checksum validation is not supported for maven-mvnd." >&2 + echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + elif command -v sha256sum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then + distributionSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $distributionSha256Result = false ]; then + echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 + echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 + exit 1 + fi +fi + +# unzip and move +if command -v unzip >/dev/null; then + unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" +else + tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" +fi + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +actualDistributionDir="" + +# First try the expected directory name (for regular distributions) +if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then + if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then + actualDistributionDir="$distributionUrlNameMain" + fi +fi + +# If not found, search for any directory with the Maven executable (for snapshots) +if [ -z "$actualDistributionDir" ]; then + # enable globbing to iterate over items + set +f + for dir in "$TMP_DOWNLOAD_DIR"/*; do + if [ -d "$dir" ]; then + if [ -f "$dir/bin/$MVN_CMD" ]; then + actualDistributionDir="$(basename "$dir")" + break + fi + fi + done + set -f +fi + +if [ -z "$actualDistributionDir" ]; then + verbose "Contents of $TMP_DOWNLOAD_DIR:" + verbose "$(ls -la "$TMP_DOWNLOAD_DIR")" + die "Could not find Maven distribution directory in extracted archive" +fi + +verbose "Found extracted Maven distribution directory: $actualDistributionDir" +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" + +clean || : +exec_maven "$@" diff --git a/benchmark/persistence/roster/quarkus/mvnw.cmd b/benchmark/persistence/roster/quarkus/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..5761d948924c19571d27b465c519b2e2f9e30351 --- /dev/null +++ b/benchmark/persistence/roster/quarkus/mvnw.cmd @@ -0,0 +1,189 @@ +<# : batch portion +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.4 +@REM +@REM Optional ENV vars +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output +@REM ---------------------------------------------------------------------------- + +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) +) +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> + +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} + +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} + +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' + +$MAVEN_M2_PATH = "$HOME/.m2" +if ($env:MAVEN_USER_HOME) { + $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME" +} + +if (-not (Test-Path -Path $MAVEN_M2_PATH)) { + New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null +} + +$MAVEN_WRAPPER_DISTS = $null +if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) { + $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists" +} else { + $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists" +} + +$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain" +$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" + +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} + +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} + +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} + +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null + +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +$actualDistributionDir = "" + +# First try the expected directory name (for regular distributions) +$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain" +$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD" +if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) { + $actualDistributionDir = $distributionUrlNameMain +} + +# If not found, search for any directory with the Maven executable (for snapshots) +if (!$actualDistributionDir) { + Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object { + $testPath = Join-Path $_.FullName "bin/$MVN_CMD" + if (Test-Path -Path $testPath -PathType Leaf) { + $actualDistributionDir = $_.Name + } + } +} + +if (!$actualDistributionDir) { + Write-Error "Could not find Maven distribution directory in extracted archive" +} + +Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir" +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/benchmark/persistence/roster/quarkus/pom.xml b/benchmark/persistence/roster/quarkus/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..ba5228c4468b397632380e54874845d4f5eacf0d --- /dev/null +++ b/benchmark/persistence/roster/quarkus/pom.xml @@ -0,0 +1,174 @@ + + + 4.0.0 + quarkus.tutorial + roster-quarkus + 1.0.0-SNAPSHOT + + + 3.14.0 + 21 + UTF-8 + UTF-8 + quarkus-bom + io.quarkus.platform + 3.30.5 + true + 3.5.3 + + + + + + + io.netty + netty-codec-http + 4.1.130.Final + + + io.netty + netty-codec + 4.1.130.Final + + + io.netty + netty-handler + 4.1.130.Final + + + + + io.vertx + vertx-web + 4.5.23 + + + io.vertx + vertx-web-common + 4.5.23 + + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + + + + + + + io.quarkus + quarkus-hibernate-orm + + + io.quarkus + quarkus-jdbc-h2 + + + io.quarkus + quarkus-smallrye-health + + + io.quarkus + quarkus-arc + + + org.hibernate + hibernate-jpamodelgen + provided + + + org.antlr + antlr4-runtime + provided + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + io.quarkus + quarkus-resteasy-jackson + + + + + + + ${quarkus.platform.group-id} + quarkus-maven-plugin + ${quarkus.platform.version} + true + + + + build + generate-code + generate-code-tests + native-image-agent + + + + + + maven-compiler-plugin + ${compiler-plugin.version} + + true + + + + maven-surefire-plugin + ${surefire-plugin.version} + + + org.jboss.logmanager.LogManager + ${maven.home} + + + + + maven-failsafe-plugin + ${surefire-plugin.version} + + + + integration-test + verify + + + + + + ${project.build.directory}/${project.build.finalName}-runner + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + + + + native + + + native + + + + false + true + + + + diff --git a/benchmark/persistence/roster/quarkus/src/main/docker/Dockerfile.jvm b/benchmark/persistence/roster/quarkus/src/main/docker/Dockerfile.jvm new file mode 100644 index 0000000000000000000000000000000000000000..152ffe30fc97c5485cb028b5bd663455aba1bf7c --- /dev/null +++ b/benchmark/persistence/roster/quarkus/src/main/docker/Dockerfile.jvm @@ -0,0 +1,98 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode +# +# Before building the container image run: +# +# ./mvnw package +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/roster-quarkus-jvm . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/roster-quarkus-jvm +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005. +# Additionally you will have to set -e JAVA_DEBUG=true and -e JAVA_DEBUG_PORT=*:5005 +# when running the container +# +# Then run the container using : +# +# docker run -i --rm -p 8080:8080 quarkus/roster-quarkus-jvm +# +# This image uses the `run-java.sh` script to run the application. +# This scripts computes the command line to execute your Java application, and +# includes memory/GC tuning. +# You can configure the behavior using the following environment properties: +# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class") - Be aware that this will override +# the default JVM options, use `JAVA_OPTS_APPEND` to append options +# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options +# in JAVA_OPTS (example: "-Dsome.property=foo") +# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is +# used to calculate a default maximal heap memory based on a containers restriction. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio +# of the container available memory as set here. The default is `50` which means 50% +# of the available memory is used as an upper boundary. You can skip this mechanism by +# setting this value to `0` in which case no `-Xmx` option is added. +# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This +# is used to calculate a default initial heap memory based on the maximum heap memory. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio +# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx` +# is used as the initial heap size. You can skip this mechanism by setting this value +# to `0` in which case no `-Xms` option is added (example: "25") +# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS. +# This is used to calculate the maximum value of the initial heap memory. If used in +# a container without any memory constraints for the container then this option has +# no effect. If there is a memory constraint then `-Xms` is limited to the value set +# here. The default is 4096MB which means the calculated value of `-Xms` never will +# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096") +# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output +# when things are happening. This option, if set to true, will set +# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true"). +# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example: +# true"). +# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787"). +# - CONTAINER_CORE_LIMIT: A calculated core limit as described in +# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2") +# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024"). +# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion. +# (example: "20") +# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking. +# (example: "40") +# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection. +# (example: "4") +# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus +# previous GC times. (example: "90") +# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20") +# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100") +# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should +# contain the necessary JRE command-line options to specify the required GC, which +# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC). +# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080") +# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080") +# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be +# accessed directly. (example: "foo.example.com,bar.example.com") +# +### +FROM registry.access.redhat.com/ubi9/openjdk-21:1.23 + +ENV LANGUAGE='en_US:en' + + +# We make four distinct layers so if there are application changes the library layers can be re-used +COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/ +COPY --chown=185 target/quarkus-app/*.jar /deployments/ +COPY --chown=185 target/quarkus-app/app/ /deployments/app/ +COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/ + +EXPOSE 8080 +USER 185 +ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" + +ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ] + diff --git a/benchmark/persistence/roster/quarkus/src/main/docker/Dockerfile.legacy-jar b/benchmark/persistence/roster/quarkus/src/main/docker/Dockerfile.legacy-jar new file mode 100644 index 0000000000000000000000000000000000000000..4183d2b7a1823678499de2d685956e1b47a4f77a --- /dev/null +++ b/benchmark/persistence/roster/quarkus/src/main/docker/Dockerfile.legacy-jar @@ -0,0 +1,94 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode +# +# Before building the container image run: +# +# ./mvnw package -Dquarkus.package.jar.type=legacy-jar +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.legacy-jar -t quarkus/roster-quarkus-legacy-jar . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/roster-quarkus-legacy-jar +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005. +# Additionally you will have to set -e JAVA_DEBUG=true and -e JAVA_DEBUG_PORT=*:5005 +# when running the container +# +# Then run the container using : +# +# docker run -i --rm -p 8080:8080 quarkus/roster-quarkus-legacy-jar +# +# This image uses the `run-java.sh` script to run the application. +# This scripts computes the command line to execute your Java application, and +# includes memory/GC tuning. +# You can configure the behavior using the following environment properties: +# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class") - Be aware that this will override +# the default JVM options, use `JAVA_OPTS_APPEND` to append options +# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options +# in JAVA_OPTS (example: "-Dsome.property=foo") +# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is +# used to calculate a default maximal heap memory based on a containers restriction. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio +# of the container available memory as set here. The default is `50` which means 50% +# of the available memory is used as an upper boundary. You can skip this mechanism by +# setting this value to `0` in which case no `-Xmx` option is added. +# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This +# is used to calculate a default initial heap memory based on the maximum heap memory. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio +# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx` +# is used as the initial heap size. You can skip this mechanism by setting this value +# to `0` in which case no `-Xms` option is added (example: "25") +# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS. +# This is used to calculate the maximum value of the initial heap memory. If used in +# a container without any memory constraints for the container then this option has +# no effect. If there is a memory constraint then `-Xms` is limited to the value set +# here. The default is 4096MB which means the calculated value of `-Xms` never will +# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096") +# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output +# when things are happening. This option, if set to true, will set +# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true"). +# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example: +# true"). +# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787"). +# - CONTAINER_CORE_LIMIT: A calculated core limit as described in +# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2") +# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024"). +# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion. +# (example: "20") +# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking. +# (example: "40") +# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection. +# (example: "4") +# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus +# previous GC times. (example: "90") +# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20") +# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100") +# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should +# contain the necessary JRE command-line options to specify the required GC, which +# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC). +# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080") +# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080") +# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be +# accessed directly. (example: "foo.example.com,bar.example.com") +# +### +FROM registry.access.redhat.com/ubi9/openjdk-21:1.23 + +ENV LANGUAGE='en_US:en' + + +COPY target/lib/* /deployments/lib/ +COPY target/*-runner.jar /deployments/quarkus-run.jar + +EXPOSE 8080 +USER 185 +ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" + +ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ] diff --git a/benchmark/persistence/roster/quarkus/src/main/docker/Dockerfile.native b/benchmark/persistence/roster/quarkus/src/main/docker/Dockerfile.native new file mode 100644 index 0000000000000000000000000000000000000000..253362403faf0d4cb8eadb864b948bf1ff557b91 --- /dev/null +++ b/benchmark/persistence/roster/quarkus/src/main/docker/Dockerfile.native @@ -0,0 +1,29 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. +# +# Before building the container image run: +# +# ./mvnw package -Dnative +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.native -t quarkus/roster-quarkus . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/roster-quarkus +# +# The ` registry.access.redhat.com/ubi9/ubi-minimal:9.6` base image is based on UBI 9. +# To use UBI 8, switch to `quay.io/ubi8/ubi-minimal:8.10`. +### +FROM registry.access.redhat.com/ubi9/ubi-minimal:9.6 +WORKDIR /work/ +RUN chown 1001 /work \ + && chmod "g+rwX" /work \ + && chown 1001:root /work +COPY --chown=1001:root --chmod=0755 target/*-runner /work/application + +EXPOSE 8080 +USER 1001 + +ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/benchmark/persistence/roster/quarkus/src/main/docker/Dockerfile.native-micro b/benchmark/persistence/roster/quarkus/src/main/docker/Dockerfile.native-micro new file mode 100644 index 0000000000000000000000000000000000000000..1c21fcc950a00186840862b7ca478673881880fb --- /dev/null +++ b/benchmark/persistence/roster/quarkus/src/main/docker/Dockerfile.native-micro @@ -0,0 +1,32 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. +# It uses a micro base image, tuned for Quarkus native executables. +# It reduces the size of the resulting container image. +# Check https://quarkus.io/guides/quarkus-runtime-base-image for further information about this image. +# +# Before building the container image run: +# +# ./mvnw package -Dnative +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.native-micro -t quarkus/roster-quarkus . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/roster-quarkus +# +# The `quay.io/quarkus/ubi9-quarkus-micro-image:2.0` base image is based on UBI 9. +# To use UBI 8, switch to `quay.io/quarkus/quarkus-micro-image:2.0`. +### +FROM quay.io/quarkus/ubi9-quarkus-micro-image:2.0 +WORKDIR /work/ +RUN chown 1001 /work \ + && chmod "g+rwX" /work \ + && chown 1001:root /work +COPY --chown=1001:root --chmod=0755 target/*-runner /work/application + +EXPOSE 8080 +USER 1001 + +ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/client/RosterClient.java b/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/client/RosterClient.java new file mode 100644 index 0000000000000000000000000000000000000000..19a92b09e5164c4fea11a28e77be5c907acb44f5 --- /dev/null +++ b/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/client/RosterClient.java @@ -0,0 +1,565 @@ +package quarkus.tutorial.roster.client; + +import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.client.ClientBuilder; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.core.GenericType; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.MultivaluedHashMap; +import jakarta.ws.rs.core.MultivaluedMap; +import quarkus.tutorial.roster.util.LeagueDetails; +import quarkus.tutorial.roster.util.PlayerDetails; +import quarkus.tutorial.roster.util.TeamDetails; + +import java.util.List; + +public class RosterClient { + private static final String BASE_URI = "http://localhost:8080/roster"; + + public RosterClient(String[] args) { + } + + public static void main(String[] args) { + RosterClient client = new RosterClient(args); + try (Client jaxrsClient = ClientBuilder.newClient()) { + client.insertInfo(jaxrsClient); + client.getSomeInfo(jaxrsClient); + client.getMoreInfo(jaxrsClient); + client.removeInfo(jaxrsClient); + System.exit(0); + } catch (Exception ex) { + System.err.println("Caught an exception: " + ex.getMessage()); + ex.printStackTrace(); + } + } + + private void insertInfo(Client client) { + try { + // Leagues + client.target(BASE_URI).path("/league") + .request() + .post(Entity.json(new LeagueDetails("L1", "Mountain", "Soccer"))); + client.target(BASE_URI).path("/league") + .request() + .post(Entity.json(new LeagueDetails("L2", "Valley", "Basketball"))); + client.target(BASE_URI).path("/league") + .request() + .post(Entity.json(new LeagueDetails("L3", "Foothills", "Soccer"))); + client.target(BASE_URI).path("/league") + .request() + .post(Entity.json(new LeagueDetails("L4", "Alpine", "Snowboarding"))); + + // Teams + client.target(BASE_URI).path("/team/league/L1") + .request() + .post(Entity.json(new TeamDetails("T1", "Honey Bees", "Visalia"))); + client.target(BASE_URI).path("/team/league/L1") + .request() + .post(Entity.json(new TeamDetails("T2", "Gophers", "Manteca"))); + client.target(BASE_URI).path("/team/league/L1") + .request() + .post(Entity.json(new TeamDetails("T5", "Crows", "Orland"))); + client.target(BASE_URI).path("/team/league/L2") + .request() + .post(Entity.json(new TeamDetails("T3", "Deer", "Bodie"))); + client.target(BASE_URI).path("/team/league/L2") + .request() + .post(Entity.json(new TeamDetails("T4", "Trout", "Truckee"))); + client.target(BASE_URI).path("/team/league/L3") + .request() + .post(Entity.json(new TeamDetails("T6", "Marmots", "Auburn"))); + client.target(BASE_URI).path("/team/league/L3") + .request() + .post(Entity.json(new TeamDetails("T7", "Bobcats", "Grass Valley"))); + client.target(BASE_URI).path("/team/league/L3") + .request() + .post(Entity.json(new TeamDetails("T8", "Beavers", "Placerville"))); + client.target(BASE_URI).path("/team/league/L4") + .request() + .post(Entity.json(new TeamDetails("T9", "Penguins", "Incline Village"))); + client.target(BASE_URI).path("/team/league/L4") + .request() + .post(Entity.json(new TeamDetails("T10", "Land Otters", "Tahoe City"))); + + // Players, Team T1 + MultivaluedMap playerForm1 = new MultivaluedHashMap<>(); + playerForm1.add("id", "P1"); + playerForm1.add("name", "Phil Jones"); + playerForm1.add("position", "goalkeeper"); + playerForm1.add("salary", "100.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm1)); + client.target(BASE_URI).path("/player/P1/team/T1").request().post(Entity.json("")); + + MultivaluedMap playerForm2 = new MultivaluedHashMap<>(); + playerForm2.add("id", "P2"); + playerForm2.add("name", "Alice Smith"); + playerForm2.add("position", "defender"); + playerForm2.add("salary", "505.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm2)); + client.target(BASE_URI).path("/player/P2/team/T1").request().post(Entity.json("")); + + MultivaluedMap playerForm3 = new MultivaluedHashMap<>(); + playerForm3.add("id", "P3"); + playerForm3.add("name", "Bob Roberts"); + playerForm3.add("position", "midfielder"); + playerForm3.add("salary", "65.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm3)); + client.target(BASE_URI).path("/player/P3/team/T1").request().post(Entity.json("")); + + MultivaluedMap playerForm4 = new MultivaluedHashMap<>(); + playerForm4.add("id", "P4"); + playerForm4.add("name", "Grace Phillips"); + playerForm4.add("position", "forward"); + playerForm4.add("salary", "100.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm4)); + client.target(BASE_URI).path("/player/P4/team/T1").request().post(Entity.json("")); + + MultivaluedMap playerForm5 = new MultivaluedHashMap<>(); + playerForm5.add("id", "P5"); + playerForm5.add("name", "Barney Bold"); + playerForm5.add("position", "defender"); + playerForm5.add("salary", "100.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm5)); + client.target(BASE_URI).path("/player/P5/team/T1").request().post(Entity.json("")); + + // Players, Team T2 + MultivaluedMap playerForm6 = new MultivaluedHashMap<>(); + playerForm6.add("id", "P6"); + playerForm6.add("name", "Ian Carlyle"); + playerForm6.add("position", "goalkeeper"); + playerForm6.add("salary", "555.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm6)); + client.target(BASE_URI).path("/player/P6/team/T2").request().post(Entity.json("")); + + MultivaluedMap playerForm7 = new MultivaluedHashMap<>(); + playerForm7.add("id", "P7"); + playerForm7.add("name", "Rebecca Struthers"); + playerForm7.add("position", "midfielder"); + playerForm7.add("salary", "777.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm7)); + client.target(BASE_URI).path("/player/P7/team/T2").request().post(Entity.json("")); + + MultivaluedMap playerForm8 = new MultivaluedHashMap<>(); + playerForm8.add("id", "P8"); + playerForm8.add("name", "Anne Anderson"); + playerForm8.add("position", "forward"); + playerForm8.add("salary", "65.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm8)); + client.target(BASE_URI).path("/player/P8/team/T2").request().post(Entity.json("")); + + MultivaluedMap playerForm9 = new MultivaluedHashMap<>(); + playerForm9.add("id", "P9"); + playerForm9.add("name", "Jan Wesley"); + playerForm9.add("position", "defender"); + playerForm9.add("salary", "100.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm9)); + client.target(BASE_URI).path("/player/P9/team/T2").request().post(Entity.json("")); + + MultivaluedMap playerForm10 = new MultivaluedHashMap<>(); + playerForm10.add("id", "P10"); + playerForm10.add("name", "Terry Smithson"); + playerForm10.add("position", "midfielder"); + playerForm10.add("salary", "100.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm10)); + client.target(BASE_URI).path("/player/P10/team/T2").request().post(Entity.json("")); + + // Players, Team T3 + MultivaluedMap playerForm11 = new MultivaluedHashMap<>(); + playerForm11.add("id", "P11"); + playerForm11.add("name", "Ben Shore"); + playerForm11.add("position", "point guard"); + playerForm11.add("salary", "188.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm11)); + client.target(BASE_URI).path("/player/P11/team/T3").request().post(Entity.json("")); + + MultivaluedMap playerForm12 = new MultivaluedHashMap<>(); + playerForm12.add("id", "P12"); + playerForm12.add("name", "Chris Farley"); + playerForm12.add("position", "shooting guard"); + playerForm12.add("salary", "577.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm12)); + client.target(BASE_URI).path("/player/P12/team/T3").request().post(Entity.json("")); + + MultivaluedMap playerForm13 = new MultivaluedHashMap<>(); + playerForm13.add("id", "P13"); + playerForm13.add("name", "Audrey Brown"); + playerForm13.add("position", "small forward"); + playerForm13.add("salary", "995.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm13)); + client.target(BASE_URI).path("/player/P13/team/T3").request().post(Entity.json("")); + + MultivaluedMap playerForm14 = new MultivaluedHashMap<>(); + playerForm14.add("id", "P14"); + playerForm14.add("name", "Jack Patterson"); + playerForm14.add("position", "power forward"); + playerForm14.add("salary", "100.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm14)); + client.target(BASE_URI).path("/player/P14/team/T3").request().post(Entity.json("")); + + MultivaluedMap playerForm15 = new MultivaluedHashMap<>(); + playerForm15.add("id", "P15"); + playerForm15.add("name", "Candace Lewis"); + playerForm15.add("position", "point guard"); + playerForm15.add("salary", "100.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm15)); + client.target(BASE_URI).path("/player/P15/team/T3").request().post(Entity.json("")); + + // Players, Team T4 + MultivaluedMap playerForm16 = new MultivaluedHashMap<>(); + playerForm16.add("id", "P16"); + playerForm16.add("name", "Linda Berringer"); + playerForm16.add("position", "point guard"); + playerForm16.add("salary", "844.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm16)); + client.target(BASE_URI).path("/player/P16/team/T4").request().post(Entity.json("")); + + MultivaluedMap playerForm17 = new MultivaluedHashMap<>(); + playerForm17.add("id", "P17"); + playerForm17.add("name", "Bertrand Morris"); + playerForm17.add("position", "shooting guard"); + playerForm17.add("salary", "452.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm17)); + client.target(BASE_URI).path("/player/P17/team/T4").request().post(Entity.json("")); + + MultivaluedMap playerForm18 = new MultivaluedHashMap<>(); + playerForm18.add("id", "P18"); + playerForm18.add("name", "Nancy White"); + playerForm18.add("position", "small forward"); + playerForm18.add("salary", "833.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm18)); + client.target(BASE_URI).path("/player/P18/team/T4").request().post(Entity.json("")); + + MultivaluedMap playerForm19 = new MultivaluedHashMap<>(); + playerForm19.add("id", "P19"); + playerForm19.add("name", "Billy Black"); + playerForm19.add("position", "power forward"); + playerForm19.add("salary", "444.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm19)); + client.target(BASE_URI).path("/player/P19/team/T4").request().post(Entity.json("")); + + MultivaluedMap playerForm20 = new MultivaluedHashMap<>(); + playerForm20.add("id", "P20"); + playerForm20.add("name", "Jodie James"); + playerForm20.add("position", "point guard"); + playerForm20.add("salary", "100.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm20)); + client.target(BASE_URI).path("/player/P20/team/T4").request().post(Entity.json("")); + + // Players, Team T5 + MultivaluedMap playerForm21 = new MultivaluedHashMap<>(); + playerForm21.add("id", "P21"); + playerForm21.add("name", "Henry Shute"); + playerForm21.add("position", "goalkeeper"); + playerForm21.add("salary", "205.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm21)); + client.target(BASE_URI).path("/player/P21/team/T5").request().post(Entity.json("")); + + MultivaluedMap playerForm22 = new MultivaluedHashMap<>(); + playerForm22.add("id", "P22"); + playerForm22.add("name", "Janice Walker"); + playerForm22.add("position", "defender"); + playerForm22.add("salary", "857.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm22)); + client.target(BASE_URI).path("/player/P22/team/T5").request().post(Entity.json("")); + + MultivaluedMap playerForm23 = new MultivaluedHashMap<>(); + playerForm23.add("id", "P23"); + playerForm23.add("name", "Wally Hendricks"); + playerForm23.add("position", "midfielder"); + playerForm23.add("salary", "748.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm23)); + client.target(BASE_URI).path("/player/P23/team/T5").request().post(Entity.json("")); + + MultivaluedMap playerForm24 = new MultivaluedHashMap<>(); + playerForm24.add("id", "P24"); + playerForm24.add("name", "Gloria Garber"); + playerForm24.add("position", "forward"); + playerForm24.add("salary", "777.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm24)); + client.target(BASE_URI).path("/player/P24/team/T5").request().post(Entity.json("")); + + MultivaluedMap playerForm25 = new MultivaluedHashMap<>(); + playerForm25.add("id", "P25"); + playerForm25.add("name", "Frank Fletcher"); + playerForm25.add("position", "defender"); + playerForm25.add("salary", "399.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm25)); + client.target(BASE_URI).path("/player/P25/team/T5").request().post(Entity.json("")); + + // Players, Team T9 + MultivaluedMap playerForm30 = new MultivaluedHashMap<>(); + playerForm30.add("id", "P30"); + playerForm30.add("name", "Lakshme Singh"); + playerForm30.add("position", "downhill"); + playerForm30.add("salary", "450.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm30)); + client.target(BASE_URI).path("/player/P30/team/T9").request().post(Entity.json("")); + + MultivaluedMap playerForm31 = new MultivaluedHashMap<>(); + playerForm31.add("id", "P31"); + playerForm31.add("name", "Mariela Prieto"); + playerForm31.add("position", "freestyle"); + playerForm31.add("salary", "420.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm31)); + client.target(BASE_URI).path("/player/P31/team/T9").request().post(Entity.json("")); + + // Players, Team T10 + MultivaluedMap playerForm32 = new MultivaluedHashMap<>(); + playerForm32.add("id", "P32"); + playerForm32.add("name", "Soren Johannsen"); + playerForm32.add("position", "freestyle"); + playerForm32.add("salary", "375.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm32)); + client.target(BASE_URI).path("/player/P32/team/T10").request().post(Entity.json("")); + + MultivaluedMap playerForm33 = new MultivaluedHashMap<>(); + playerForm33.add("id", "P33"); + playerForm33.add("name", "Andre Gerson"); + playerForm33.add("position", "freestyle"); + playerForm33.add("salary", "396.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm33)); + client.target(BASE_URI).path("/player/P33/team/T10").request().post(Entity.json("")); + + MultivaluedMap playerForm34 = new MultivaluedHashMap<>(); + playerForm34.add("id", "P34"); + playerForm34.add("name", "Zoria Lepsius"); + playerForm34.add("position", "downhill"); + playerForm34.add("salary", "431.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm34)); + client.target(BASE_URI).path("/player/P34/team/T10").request().post(Entity.json("")); + + // Players, no team + MultivaluedMap playerForm26 = new MultivaluedHashMap<>(); + playerForm26.add("id", "P26"); + playerForm26.add("name", "Hobie Jackson"); + playerForm26.add("position", "pitcher"); + playerForm26.add("salary", "582.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm26)); + + MultivaluedMap playerForm27 = new MultivaluedHashMap<>(); + playerForm27.add("id", "P27"); + playerForm27.add("name", "Melinda Kendall"); + playerForm27.add("position", "catcher"); + playerForm27.add("salary", "677.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm27)); + + // Players, multiple teams + MultivaluedMap playerForm28 = new MultivaluedHashMap<>(); + playerForm28.add("id", "P28"); + playerForm28.add("name", "Constance Adams"); + playerForm28.add("position", "substitute"); + playerForm28.add("salary", "966.00"); + client.target(BASE_URI).path("/player").request() + .post(Entity.form(playerForm28)); + client.target(BASE_URI).path("/player/P28/team/T1").request().post(Entity.json("")); + client.target(BASE_URI).path("/player/P28/team/T3").request().post(Entity.json("")); + + // Adding existing players to second soccer league + client.target(BASE_URI).path("/player/P24/team/T6").request().post(Entity.json("")); + client.target(BASE_URI).path("/player/P21/team/T6").request().post(Entity.json("")); + client.target(BASE_URI).path("/player/P9/team/T6").request().post(Entity.json("")); + client.target(BASE_URI).path("/player/P7/team/T5").request().post(Entity.json("")); + } catch (Exception ex) { + System.err.println("Caught an exception: " + ex.getMessage()); + } + } + + private void getSomeInfo(Client client) { + try { + System.out.println("List all players in team T2:"); + List playerList = client.target(BASE_URI).path("/team/T2/players") + .request(MediaType.APPLICATION_JSON) + .get(new GenericType>() {}); + printDetailsList(playerList); + System.out.println(); + + System.out.println("List all teams in league L1:"); + List teamList = client.target(BASE_URI).path("/league/L1/teams") + .request(MediaType.APPLICATION_JSON) + .get(new GenericType>() {}); + printDetailsList(teamList); + System.out.println(); + + System.out.println("List all defenders:"); + playerList = client.target(BASE_URI).path("/players/position/defender") + .request(MediaType.APPLICATION_JSON) + .get(new GenericType>() {}); + printDetailsList(playerList); + System.out.println(); + + System.out.println("List the leagues of player P28:"); + List leagueList = client.target(BASE_URI).path("/player/P28/leagues") + .request(MediaType.APPLICATION_JSON) + .get(new GenericType>() {}); + printDetailsList(leagueList); + System.out.println(); + } catch (Exception ex) { + System.err.println("Caught an exception: " + ex.getMessage()); + } + } + + private void getMoreInfo(Client client) { + try { + System.out.println("Details of league L1:"); + LeagueDetails leagueDetails = client.target(BASE_URI).path("/league/L1") + .request(MediaType.APPLICATION_JSON) + .get(LeagueDetails.class); + System.out.println(leagueDetails.toString()); + System.out.println(); + + System.out.println("Details of team T3:"); + TeamDetails teamDetails = client.target(BASE_URI).path("/team/T3") + .request(MediaType.APPLICATION_JSON) + .get(TeamDetails.class); + System.out.println(teamDetails.toString()); + System.out.println(); + + System.out.println("Details of player P20:"); + PlayerDetails playerDetails = client.target(BASE_URI).path("/player/P20") + .request(MediaType.APPLICATION_JSON) + .get(PlayerDetails.class); + System.out.println(playerDetails.toString()); + System.out.println(); + + System.out.println("List all teams in league L3:"); + List teamList = client.target(BASE_URI).path("/league/L3/teams") + .request(MediaType.APPLICATION_JSON) + .get(new GenericType>() {}); + printDetailsList(teamList); + System.out.println(); + + System.out.println("List all players:"); + List playerList = client.target(BASE_URI).path("/players") + .request(MediaType.APPLICATION_JSON) + .get(new GenericType>() {}); + printDetailsList(playerList); + System.out.println(); + + System.out.println("List all players not on a team:"); + playerList = client.target(BASE_URI).path("/players/not-on-team") + .request(MediaType.APPLICATION_JSON) + .get(new GenericType>() {}); + printDetailsList(playerList); + System.out.println(); + + System.out.println("Details of Jack Patterson, a power forward:"); + playerList = client.target(BASE_URI).path("/players/position/power forward/name/Jack Patterson") + .request(MediaType.APPLICATION_JSON) + .get(new GenericType>() {}); + printDetailsList(playerList); + System.out.println(); + + System.out.println("List all players in the city of Truckee:"); + playerList = client.target(BASE_URI).path("/players/city/Truckee") + .request(MediaType.APPLICATION_JSON) + .get(new GenericType>() {}); + printDetailsList(playerList); + System.out.println(); + + System.out.println("List all soccer players:"); + playerList = client.target(BASE_URI).path("/players/sport/Soccer") + .request(MediaType.APPLICATION_JSON) + .get(new GenericType>() {}); + printDetailsList(playerList); + System.out.println(); + + System.out.println("List all players in league L1:"); + playerList = client.target(BASE_URI).path("/players/league/L1") + .request(MediaType.APPLICATION_JSON) + .get(new GenericType>() {}); + printDetailsList(playerList); + System.out.println(); + + System.out.println("List all players making a higher salary than Ian Carlyle:"); + playerList = client.target(BASE_URI).path("/players/salary/higher/Ian Carlyle") + .request(MediaType.APPLICATION_JSON) + .get(new GenericType>() {}); + printDetailsList(playerList); + System.out.println(); + + System.out.println("List all players with a salary between 500 and 800:"); + playerList = client.target(BASE_URI).path("/players/salary/range") + .queryParam("low", 500.00).queryParam("high", 800.00) + .request(MediaType.APPLICATION_JSON) + .get(new GenericType>() {}); + printDetailsList(playerList); + System.out.println(); + + System.out.println("List all players of team T5:"); + playerList = client.target(BASE_URI).path("/team/T5/players") + .request(MediaType.APPLICATION_JSON) + .get(new GenericType>() {}); + printDetailsList(playerList); + System.out.println(); + + System.out.println("List all the leagues of player P28:"); + List leagueList = client.target(BASE_URI).path("/player/P28/leagues") + .request(MediaType.APPLICATION_JSON) + .get(new GenericType>() {}); + printDetailsList(leagueList); + System.out.println(); + + System.out.println("List all the sports of player P28:"); + List sportList = client.target(BASE_URI).path("/player/P28/sports") + .request(MediaType.APPLICATION_JSON) + .get(new GenericType>() {}); + printDetailsList(sportList); + System.out.println(); + } catch (Exception ex) { + System.err.println("Caught an exception: " + ex.getMessage()); + } + } + + private void removeInfo(Client client) { + try { + System.out.println("Removing team T6."); + client.target(BASE_URI).path("/team/T6").request().delete(); + System.out.println(); + + System.out.println("Removing player P24"); + client.target(BASE_URI).path("/player/P24").request().delete(); + System.out.println(); + } catch (Exception ex) { + System.err.println("Caught an exception: " + ex.getMessage()); + } + } + + private static void printDetailsList(List list) { + for (Object details : list) { + System.out.println(details.toString()); + } + System.out.println(); + } +} diff --git a/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/entity/League.java b/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/entity/League.java new file mode 100644 index 0000000000000000000000000000000000000000..6635550eaf733045fdca7b1252aecb6b0553966c --- /dev/null +++ b/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/entity/League.java @@ -0,0 +1,65 @@ +package quarkus.tutorial.roster.entity; + +import jakarta.persistence.*; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; + +@Entity +@Inheritance(strategy = InheritanceType.SINGLE_TABLE) +@DiscriminatorColumn(name = "LEAGUE_TYPE") +public abstract class League implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + protected String id; + protected String name; + protected String sport; + @OneToMany(mappedBy = "league") + protected Collection teams = new ArrayList<>(); + + public League() { + } + + public League(String id, String name, String sport) { + this.id = id; + this.name = name; + this.sport = sport; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSport() { + return sport; + } + + public void setSport(String sport) { + this.sport = sport; + } + + public Collection getTeams() { + return teams; + } + + public void setTeams(Collection teams) { + this.teams = teams; + } + + public void addTeam(Team team) { + this.teams.add(team); + } +} \ No newline at end of file diff --git a/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/entity/Player.java b/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/entity/Player.java new file mode 100644 index 0000000000000000000000000000000000000000..9a95d58a727017bcd82f156984709bc1f03fbf47 --- /dev/null +++ b/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/entity/Player.java @@ -0,0 +1,77 @@ +package quarkus.tutorial.roster.entity; + +import jakarta.persistence.*; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; + +@Entity +public class Player implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + private String id; + private String name; + private String position; + private double salary; + @ManyToMany(mappedBy = "players") + private Collection teams = new ArrayList<>(); + + public Player() { + } + + public Player(String id, String name, String position, double salary) { + this.id = id; + this.name = name; + this.position = position; + this.salary = salary; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public double getSalary() { + return salary; + } + + public void setSalary(double salary) { + this.salary = salary; + } + + public Collection getTeams() { + return teams; + } + + public void setTeams(Collection teams) { + this.teams = teams; + } + + public void addTeam(Team team) { + this.teams.add(team); + } + + public void dropTeam(Team team) { + this.teams.remove(team); + } +} \ No newline at end of file diff --git a/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/entity/SummerLeague.java b/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/entity/SummerLeague.java new file mode 100644 index 0000000000000000000000000000000000000000..5de5c33fba4fb58688eb5268d685312f23e0e3e9 --- /dev/null +++ b/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/entity/SummerLeague.java @@ -0,0 +1,22 @@ +package quarkus.tutorial.roster.entity; + +import jakarta.persistence.DiscriminatorValue; +import jakarta.persistence.Entity; +import quarkus.tutorial.roster.util.IncorrectSportException; + +@Entity +@DiscriminatorValue("SUMMER") +public class SummerLeague extends League { + private static final long serialVersionUID = 1L; + + public SummerLeague() { + } + + public SummerLeague(String id, String name, String sport) throws IncorrectSportException { + super(id, name, sport); + if (!sport.equalsIgnoreCase("soccer") && !sport.equalsIgnoreCase("swimming") && + !sport.equalsIgnoreCase("basketball") && !sport.equalsIgnoreCase("baseball")) { + throw new IncorrectSportException("Sport is not a summer sport."); + } + } +} \ No newline at end of file diff --git a/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/entity/Team.java b/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/entity/Team.java new file mode 100644 index 0000000000000000000000000000000000000000..7dab1f9a36e25afdd342ac846fa2e1dcba94ee30 --- /dev/null +++ b/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/entity/Team.java @@ -0,0 +1,77 @@ +package quarkus.tutorial.roster.entity; + +import jakarta.persistence.*; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; + +@Entity +public class Team implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + private String id; + private String name; + private String city; + @ManyToMany + private Collection players = new ArrayList<>(); + @ManyToOne + private League league; + + public Team() { + } + + public Team(String id, String name, String city) { + this.id = id; + this.name = name; + this.city = city; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public Collection getPlayers() { + return players; + } + + public void setPlayers(Collection players) { + this.players = players; + } + + public League getLeague() { + return league; + } + + public void setLeague(League league) { + this.league = league; + } + + public void addPlayer(Player player) { + this.players.add(player); + } + + public void dropPlayer(Player player) { + this.players.remove(player); + } +} \ No newline at end of file diff --git a/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/entity/WinterLeague.java b/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/entity/WinterLeague.java new file mode 100644 index 0000000000000000000000000000000000000000..502188e925206f9ea0989225dfcbe5d4c4a5fcae --- /dev/null +++ b/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/entity/WinterLeague.java @@ -0,0 +1,22 @@ +package quarkus.tutorial.roster.entity; + +import jakarta.persistence.DiscriminatorValue; +import jakarta.persistence.Entity; +import quarkus.tutorial.roster.util.IncorrectSportException; + +@Entity +@DiscriminatorValue("WINTER") +public class WinterLeague extends League { + private static final long serialVersionUID = 1L; + + public WinterLeague() { + } + + public WinterLeague(String id, String name, String sport) throws IncorrectSportException { + super(id, name, sport); + if (!sport.equalsIgnoreCase("hockey") && !sport.equalsIgnoreCase("skiing") && + !sport.equalsIgnoreCase("snowboarding")) { + throw new IncorrectSportException("Sport is not a winter sport."); + } + } +} \ No newline at end of file diff --git a/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/request/Request.java b/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/request/Request.java new file mode 100644 index 0000000000000000000000000000000000000000..c224e732319912f72af4ff8738205905dd030541 --- /dev/null +++ b/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/request/Request.java @@ -0,0 +1,34 @@ +package quarkus.tutorial.roster.request; + +import quarkus.tutorial.roster.util.LeagueDetails; +import quarkus.tutorial.roster.util.TeamDetails; +import quarkus.tutorial.roster.util.PlayerDetails; + +import java.util.List; + +public interface Request { + void createPlayer(String id, String name, String position, double salary); + void addPlayer(String playerId, String teamId); + void removePlayer(String playerId); + void dropPlayer(String playerId, String teamId); + PlayerDetails getPlayer(String playerId); + List getPlayersOfTeam(String teamId); + List getTeamsOfLeague(String leagueId); + List getPlayersByPosition(String position); + List getPlayersByHigherSalary(String name); + List getPlayersBySalaryRange(double low, double high); + List getPlayersByLeagueId(String leagueId); + List getPlayersBySport(String sport); + List getPlayersByCity(String city); + List getAllPlayers(); + List getPlayersNotOnTeam(); + List getPlayersByPositionAndName(String position, String name); + List getLeaguesOfPlayer(String playerId); + List getSportsOfPlayer(String playerId); + void createTeamInLeague(TeamDetails teamDetails, String leagueId); + void removeTeam(String teamId); + TeamDetails getTeam(String teamId); + void createLeague(LeagueDetails leagueDetails); + void removeLeague(String leagueId); + LeagueDetails getLeague(String leagueId); +} \ No newline at end of file diff --git a/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/request/RequestBean.java b/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/request/RequestBean.java new file mode 100644 index 0000000000000000000000000000000000000000..28c395d911121dcd91db6fc6b52d73affb9274f7 --- /dev/null +++ b/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/request/RequestBean.java @@ -0,0 +1,568 @@ +package quarkus.tutorial.roster.request; + +import jakarta.annotation.PostConstruct; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import jakarta.persistence.EntityManager; +import jakarta.persistence.TypedQuery; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.CriteriaQuery; +import jakarta.persistence.criteria.Join; +import jakarta.persistence.criteria.Predicate; +import jakarta.persistence.criteria.Root; +import quarkus.tutorial.roster.entity.League; +import quarkus.tutorial.roster.entity.League_; +import quarkus.tutorial.roster.entity.Player; +import quarkus.tutorial.roster.entity.Player_; +import quarkus.tutorial.roster.entity.SummerLeague; +import quarkus.tutorial.roster.entity.Team; +import quarkus.tutorial.roster.entity.Team_; +import quarkus.tutorial.roster.entity.WinterLeague; +import quarkus.tutorial.roster.util.IncorrectSportException; +import quarkus.tutorial.roster.util.LeagueDetails; +import quarkus.tutorial.roster.util.PlayerDetails; +import quarkus.tutorial.roster.util.TeamDetails; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.FormParam; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.logging.Logger; +import jakarta.transaction.Transactional; + +@ApplicationScoped +@Path("/roster") +public class RequestBean implements Request, Serializable { + private static final Logger logger = Logger.getLogger("quarkus.tutorial.roster.request.RequestBean"); + + @Inject + private EntityManager em; + private CriteriaBuilder cb; + + @PostConstruct + private void init() { + cb = em.getCriteriaBuilder(); + } + + @Override + @POST + @Path("/player") + @Consumes(MediaType.APPLICATION_FORM_URLENCODED) + @Produces(MediaType.APPLICATION_JSON) + @Transactional + public void createPlayer( + @FormParam("id") String id, + @FormParam("name") String name, + @FormParam("position") String position, + @FormParam("salary") double salary) { + logger.info("createPlayer"); + try { + Player player = new Player(id, name, position, salary); + em.persist(player); + em.flush(); + } catch (Exception ex) { + throw new WebApplicationException(ex, Response.Status.INTERNAL_SERVER_ERROR); + } + } + + @Override + @POST + @Path("/player/{playerId}/team/{teamId}") + @Produces(MediaType.APPLICATION_JSON) + @Transactional + public void addPlayer(@PathParam("playerId") String playerId, @PathParam("teamId") String teamId) { + logger.info("addPlayer"); + try { + Player player = em.find(Player.class, playerId); + Team team = em.find(Team.class, teamId); + if (player == null || team == null) { + throw new WebApplicationException("Player or Team not found", Response.Status.NOT_FOUND); + } + team.addPlayer(player); + player.addTeam(team); + em.merge(player); + em.merge(team); + em.flush(); + } catch (Exception ex) { + throw new WebApplicationException(ex, Response.Status.INTERNAL_SERVER_ERROR); + } + } + + @Override + @DELETE + @Path("/player/{playerId}") + @Produces(MediaType.APPLICATION_JSON) + @Transactional + public void removePlayer(@PathParam("playerId") String playerId) { + logger.info("removePlayer"); + try { + Player player = em.find(Player.class, playerId); + if (player == null) { + throw new WebApplicationException("Player not found", Response.Status.NOT_FOUND); + } + Collection teams = player.getTeams(); + for (Team team : teams) { + team.dropPlayer(player); + } + em.remove(player); + em.flush(); + } catch (Exception ex) { + throw new WebApplicationException(ex, Response.Status.INTERNAL_SERVER_ERROR); + } + } + + @Override + @DELETE + @Path("/player/{playerId}/team/{teamId}") + @Produces(MediaType.APPLICATION_JSON) + @Transactional + public void dropPlayer(@PathParam("playerId") String playerId, @PathParam("teamId") String teamId) { + logger.info("dropPlayer"); + try { + Player player = em.find(Player.class, playerId); + Team team = em.find(Team.class, teamId); + if (player == null || team == null) { + throw new WebApplicationException("Player or Team not found", Response.Status.NOT_FOUND); + } + team.dropPlayer(player); + player.dropTeam(team); + em.merge(player); + em.merge(team); + em.flush(); + } catch (Exception ex) { + throw new WebApplicationException(ex, Response.Status.INTERNAL_SERVER_ERROR); + } + } + + @Override + @GET + @Path("/player/{playerId}") + @Produces(MediaType.APPLICATION_JSON) + public PlayerDetails getPlayer(@PathParam("playerId") String playerId) { + logger.info("getPlayerDetails"); + try { + Player player = em.find(Player.class, playerId); + if (player == null) { + throw new WebApplicationException("Player not found", Response.Status.NOT_FOUND); + } + return new PlayerDetails(player.getId(), player.getName(), player.getPosition(), player.getSalary()); + } catch (Exception ex) { + throw new WebApplicationException(ex, Response.Status.INTERNAL_SERVER_ERROR); + } + } + + @Override + @GET + @Path("/team/{teamId}/players") + @Produces(MediaType.APPLICATION_JSON) + public List getPlayersOfTeam(@PathParam("teamId") String teamId) { + logger.info("getPlayersOfTeam"); + try { + Team team = em.find(Team.class, teamId); + if (team == null) { + throw new WebApplicationException("Team not found", Response.Status.NOT_FOUND); + } + return copyPlayersToDetails((List) team.getPlayers()); + } catch (Exception ex) { + throw new WebApplicationException(ex, Response.Status.INTERNAL_SERVER_ERROR); + } + } + + @Override + @GET + @Path("/league/{leagueId}/teams") + @Produces(MediaType.APPLICATION_JSON) + public List getTeamsOfLeague(@PathParam("leagueId") String leagueId) { + logger.info("getTeamsOfLeague"); + List detailsList = new ArrayList<>(); + try { + League league = em.find(League.class, leagueId); + if (league == null) { + throw new WebApplicationException("League not found", Response.Status.NOT_FOUND); + } + for (Team team : league.getTeams()) { + detailsList.add(new TeamDetails(team.getId(), team.getName(), team.getCity())); + } + return detailsList; + } catch (Exception ex) { + throw new WebApplicationException(ex, Response.Status.INTERNAL_SERVER_ERROR); + } + } + + @Override + @GET + @Path("/players/position/{position}") + @Produces(MediaType.APPLICATION_JSON) + public List getPlayersByPosition(@PathParam("position") String position) { + logger.info("getPlayersByPosition"); + try { + CriteriaQuery cq = cb.createQuery(Player.class); + Root player = cq.from(Player.class); + cq.where(cb.equal(player.get(Player_.position), position)); + cq.select(player); + TypedQuery q = em.createQuery(cq); + List players = q.getResultList(); + return copyPlayersToDetails(players); + } catch (Exception ex) { + throw new WebApplicationException(ex, Response.Status.INTERNAL_SERVER_ERROR); + } + } + + @Override + @GET + @Path("/players/salary/higher/{name}") + @Produces(MediaType.APPLICATION_JSON) + public List getPlayersByHigherSalary(@PathParam("name") String name) { + logger.info("getPlayersByHigherSalary"); + try { + CriteriaQuery cq = cb.createQuery(Player.class); + Root player1 = cq.from(Player.class); + Root player2 = cq.from(Player.class); + Predicate gtPredicate = cb.greaterThan(player1.get(Player_.salary), player2.get(Player_.salary)); + Predicate equalPredicate = cb.equal(player2.get(Player_.name), name); + cq.where(gtPredicate, equalPredicate); + cq.select(player1).distinct(true); + TypedQuery q = em.createQuery(cq); + List players = q.getResultList(); + return copyPlayersToDetails(players); + } catch (Exception ex) { + throw new WebApplicationException(ex, Response.Status.INTERNAL_SERVER_ERROR); + } + } + + @Override + @GET + @Path("/players/salary/range") + @Produces(MediaType.APPLICATION_JSON) + public List getPlayersBySalaryRange(@QueryParam("low") double low, @QueryParam("high") double high) { + logger.info("getPlayersBySalaryRange"); + try { + CriteriaQuery cq = cb.createQuery(Player.class); + Root player = cq.from(Player.class); + cq.where(cb.between(player.get(Player_.salary), low, high)); + cq.select(player).distinct(true); + TypedQuery q = em.createQuery(cq); + List players = q.getResultList(); + return copyPlayersToDetails(players); + } catch (Exception ex) { + throw new WebApplicationException(ex, Response.Status.INTERNAL_SERVER_ERROR); + } + } + + @Override + @GET + @Path("/players/league/{leagueId}") + @Produces(MediaType.APPLICATION_JSON) + @Transactional + public List getPlayersByLeagueId(@PathParam("leagueId") String leagueId) { + logger.info("getPlayersByLeagueId"); + try { + CriteriaQuery cq = cb.createQuery(Player.class); + Root player = cq.from(Player.class); + Join team = player.join(Player_.teams); + Join league = team.join(Team_.league); + cq.where(cb.equal(league.get(League_.id), leagueId)); + cq.select(player).distinct(true); + TypedQuery q = em.createQuery(cq); + List players = q.getResultList(); + return copyPlayersToDetails(players); + } catch (Exception ex) { + throw new WebApplicationException(ex, Response.Status.INTERNAL_SERVER_ERROR); + } + } + + @Override + @GET + @Path("/players/sport/{sport}") + @Produces(MediaType.APPLICATION_JSON) + public List getPlayersBySport(@PathParam("sport") String sport) { + logger.info("getPlayersBySport"); + try { + CriteriaQuery cq = cb.createQuery(Player.class); + Root player = cq.from(Player.class); + Join team = player.join(Player_.teams); + Join league = team.join(Team_.league); + cq.where(cb.equal(league.get(League_.sport), sport)); + cq.select(player).distinct(true); + TypedQuery q = em.createQuery(cq); + List players = q.getResultList(); + return copyPlayersToDetails(players); + } catch (Exception ex) { + throw new WebApplicationException(ex, Response.Status.INTERNAL_SERVER_ERROR); + } + } + + @Override + @GET + @Path("/players/city/{city}") + @Produces(MediaType.APPLICATION_JSON) + public List getPlayersByCity(@PathParam("city") String city) { + logger.info("getPlayersByCity"); + try { + CriteriaQuery cq = cb.createQuery(Player.class); + Root player = cq.from(Player.class); + Join team = player.join(Player_.teams); + cq.where(cb.equal(team.get(Team_.city), city)); + cq.select(player).distinct(true); + TypedQuery q = em.createQuery(cq); + List players = q.getResultList(); + return copyPlayersToDetails(players); + } catch (Exception ex) { + throw new WebApplicationException(ex, Response.Status.INTERNAL_SERVER_ERROR); + } + } + + @Override + @GET + @Path("/players") + @Produces(MediaType.APPLICATION_JSON) + public List getAllPlayers() { + logger.info("getAllPlayers"); + try { + CriteriaQuery cq = cb.createQuery(Player.class); + Root player = cq.from(Player.class); + cq.select(player); + TypedQuery q = em.createQuery(cq); + List players = q.getResultList(); + return copyPlayersToDetails(players); + } catch (Exception ex) { + throw new WebApplicationException(ex, Response.Status.INTERNAL_SERVER_ERROR); + } + } + + @Override + @GET + @Path("/players/not-on-team") + @Produces(MediaType.APPLICATION_JSON) + public List getPlayersNotOnTeam() { + logger.info("getPlayersNotOnTeam"); + try { + CriteriaQuery cq = cb.createQuery(Player.class); + Root player = cq.from(Player.class); + cq.where(cb.isEmpty(player.get(Player_.teams))); + cq.select(player).distinct(true); + TypedQuery q = em.createQuery(cq); + List players = q.getResultList(); + return copyPlayersToDetails(players); + } catch (Exception ex) { + throw new WebApplicationException(ex, Response.Status.INTERNAL_SERVER_ERROR); + } + } + + @Override + @GET + @Path("/players/position/{position}/name/{name}") + @Produces(MediaType.APPLICATION_JSON) + public List getPlayersByPositionAndName( + @PathParam("position") String position, + @PathParam("name") String name) { + logger.info("getPlayersByPositionAndName"); + try { + CriteriaQuery cq = cb.createQuery(Player.class); + Root player = cq.from(Player.class); + cq.where(cb.equal(player.get(Player_.position), position), + cb.equal(player.get(Player_.name), name)); + cq.select(player).distinct(true); + TypedQuery q = em.createQuery(cq); + List players = q.getResultList(); + return copyPlayersToDetails(players); + } catch (Exception ex) { + throw new WebApplicationException(ex, Response.Status.INTERNAL_SERVER_ERROR); + } + } + + @Override + @GET + @Path("/player/{playerId}/leagues") + @Produces(MediaType.APPLICATION_JSON) + public List getLeaguesOfPlayer(@PathParam("playerId") String playerId) { + logger.info("getLeaguesOfPlayer"); + List detailsList = new ArrayList<>(); + try { + CriteriaQuery cq = cb.createQuery(League.class); + Root leagueRoot = cq.from(League.class); + Join team = leagueRoot.join(League_.teams); + Join player = team.join(Team_.players); + cq.where(cb.equal(player.get(Player_.id), playerId)); + cq.select(leagueRoot).distinct(true); + TypedQuery q = em.createQuery(cq); + List leagues = q.getResultList(); + if (leagues == null || leagues.isEmpty()) { + logger.warning("No leagues found for player with ID " + playerId); + return null; + } + for (League currentLeague : leagues) { + detailsList.add(new LeagueDetails(currentLeague.getId(), currentLeague.getName(), currentLeague.getSport())); + } + return detailsList; + } catch (Exception ex) { + throw new WebApplicationException(ex, Response.Status.INTERNAL_SERVER_ERROR); + } + } + + @Override + @GET + @Path("/player/{playerId}/sports") + @Produces(MediaType.APPLICATION_JSON) + public List getSportsOfPlayer(@PathParam("playerId") String playerId) { + logger.info("getSportsOfPlayer"); + try { + CriteriaQuery cq = cb.createQuery(String.class); + Root player = cq.from(Player.class); + Join team = player.join(Player_.teams); + Join league = team.join(Team_.league); + cq.where(cb.equal(player.get(Player_.id), playerId)); + cq.select(league.get(League_.sport)).distinct(true); + TypedQuery q = em.createQuery(cq); + return q.getResultList(); + } catch (Exception ex) { + throw new WebApplicationException(ex, Response.Status.INTERNAL_SERVER_ERROR); + } + } + + @Override + @POST + @Path("/team/league/{leagueId}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @Transactional + public void createTeamInLeague(TeamDetails teamDetails, @PathParam("leagueId") String leagueId) { + logger.info("createTeamInLeague"); + try { + League league = em.find(League.class, leagueId); + if (league == null) { + throw new WebApplicationException("League not found", Response.Status.NOT_FOUND); + } + Team team = new Team(teamDetails.getId(), teamDetails.getName(), teamDetails.getCity()); + em.persist(team); + team.setLeague(league); + league.addTeam(team); + em.merge(league); + em.flush(); + } catch (Exception ex) { + throw new WebApplicationException(ex, Response.Status.INTERNAL_SERVER_ERROR); + } + } + + @Override + @DELETE + @Path("/team/{teamId}") + @Produces(MediaType.APPLICATION_JSON) + @Transactional + public void removeTeam(@PathParam("teamId") String teamId) { + logger.info("removeTeam"); + try { + Team team = em.find(Team.class, teamId); + if (team == null) { + throw new WebApplicationException("Team not found", Response.Status.NOT_FOUND); + } + for (Player player : team.getPlayers()) { + player.dropTeam(team); + em.merge(player); + } + em.remove(team); + em.flush(); + } catch (Exception ex) { + throw new WebApplicationException(ex, Response.Status.INTERNAL_SERVER_ERROR); + } + } + + @Override + @GET + @Path("/team/{teamId}") + @Produces(MediaType.APPLICATION_JSON) + public TeamDetails getTeam(@PathParam("teamId") String teamId) { + logger.info("getTeam"); + try { + Team team = em.find(Team.class, teamId); + if (team == null) { + throw new WebApplicationException("Team not found", Response.Status.NOT_FOUND); + } + return new TeamDetails(team.getId(), team.getName(), team.getCity()); + } catch (Exception ex) { + throw new WebApplicationException(ex, Response.Status.INTERNAL_SERVER_ERROR); + } + } + + @Override + @POST + @Path("/league") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @Transactional + public void createLeague(LeagueDetails leagueDetails) { + logger.info("createLeague"); + try { + String sport = leagueDetails.getSport().toLowerCase(); + if (sport.equals("soccer") || sport.equals("swimming") || sport.equals("basketball") || sport.equals("baseball")) { + SummerLeague league = new SummerLeague(leagueDetails.getId(), leagueDetails.getName(), leagueDetails.getSport()); + em.persist(league); + em.flush(); + } else if (sport.equals("hockey") || sport.equals("skiing") || sport.equals("snowboarding")) { + WinterLeague league = new WinterLeague(leagueDetails.getId(), leagueDetails.getName(), leagueDetails.getSport()); + em.persist(league); + em.flush(); + } else { + throw new IncorrectSportException("The specified sport is not valid."); + } + } catch (Exception ex) { + throw new WebApplicationException(ex, Response.Status.BAD_REQUEST); + } + } + + @Override + @DELETE + @Path("/league/{leagueId}") + @Produces(MediaType.APPLICATION_JSON) + @Transactional + public void removeLeague(@PathParam("leagueId") String leagueId) { + logger.info("removeLeague"); + try { + League league = em.find(League.class, leagueId); + if (league == null) { + throw new WebApplicationException("League not found", Response.Status.NOT_FOUND); + } + em.remove(league); + em.flush(); + } catch (Exception ex) { + throw new WebApplicationException(ex, Response.Status.INTERNAL_SERVER_ERROR); + } + } + + @Override + @GET + @Path("/league/{leagueId}") + @Produces(MediaType.APPLICATION_JSON) + public LeagueDetails getLeague(@PathParam("leagueId") String leagueId) { + logger.info("getLeague"); + try { + League league = em.find(League.class, leagueId); + if (league == null) { + throw new WebApplicationException("League not found", Response.Status.NOT_FOUND); + } + return new LeagueDetails(league.getId(), league.getName(), league.getSport()); + } catch (Exception ex) { + throw new WebApplicationException(ex, Response.Status.INTERNAL_SERVER_ERROR); + } + } + + private List copyPlayersToDetails(List players) { + List detailsList = new ArrayList<>(); + for (Player player : players) { + detailsList.add(new PlayerDetails(player.getId(), player.getName(), player.getPosition(), player.getSalary())); + } + return detailsList; + } +} \ No newline at end of file diff --git a/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/util/IncorrectSportException.java b/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/util/IncorrectSportException.java new file mode 100644 index 0000000000000000000000000000000000000000..38b047192a85b13d080cb6bc02e3322d78aaf4dc --- /dev/null +++ b/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/util/IncorrectSportException.java @@ -0,0 +1,30 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package quarkus.tutorial.roster.util; + +public class IncorrectSportException extends java.lang.Exception { + + /** + * Creates a new instance of IncorrectSportException without detail message. + */ + public IncorrectSportException() { + } + + + /** + * Constructs an instance of IncorrectSportException with the specified detail message. + * @param msg the detail message. + */ + public IncorrectSportException(String msg) { + super(msg); + } +} diff --git a/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/util/LeagueDetails.java b/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/util/LeagueDetails.java new file mode 100644 index 0000000000000000000000000000000000000000..b59de6eaf6912bf42c9d07b96b3063eff4bf26cb --- /dev/null +++ b/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/util/LeagueDetails.java @@ -0,0 +1,51 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package quarkus.tutorial.roster.util; + +import java.io.Serializable; + + +public class LeagueDetails implements Serializable { + private static final long serialVersionUID = 290368886584321980L; + private String id; + private String name; + private String sport; + + public LeagueDetails() { + } + + public LeagueDetails(String id, String name, String sport) { + + this.id = id; + this.name = name; + this.sport = sport; + } + + public String getId() { + return id; + } + + public String getName() { + return name; + } + + public String getSport() { + return sport; + } + + @Override + public String toString() { + String s = id + " " + name + " " + sport; + return s; + } + +} diff --git a/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/util/PlayerDetails.java b/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/util/PlayerDetails.java new file mode 100644 index 0000000000000000000000000000000000000000..5fb4060dfb828852be7921d4cce0a32b981eb66f --- /dev/null +++ b/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/util/PlayerDetails.java @@ -0,0 +1,58 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package quarkus.tutorial.roster.util; + +import java.io.Serializable; + +public class PlayerDetails implements Serializable { + private static final long serialVersionUID = -5352446961599198526L; + + private String id; + private String name; + private String position; + private double salary; + + public PlayerDetails() { + } + + public PlayerDetails(String id, String name, String position, + double salary) { + + this.id = id; + this.name = name; + this.position = position; + this.salary = salary; + } + + public String getId() { + return id; + } + + public String getName() { + return name; + } + + public String getPosition() { + return position; + } + + public double getSalary() { + return salary; + } + + @Override + public String toString() { + String s = id + " " + name + " " + position + " " + salary; + return s; + } + +} diff --git a/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/util/TeamDetails.java b/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/util/TeamDetails.java new file mode 100644 index 0000000000000000000000000000000000000000..29797810ce4482e30ad75f7397933b7c4ac50a29 --- /dev/null +++ b/benchmark/persistence/roster/quarkus/src/main/java/quarkus/tutorial/roster/util/TeamDetails.java @@ -0,0 +1,52 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package quarkus.tutorial.roster.util; + +import java.io.Serializable; + + +public class TeamDetails implements Serializable { + private static final long serialVersionUID = -1618941013515364318L; + private String id; + private String name; + private String city; + + public TeamDetails() { + } + + public TeamDetails(String id, String name, String city) { + + this.id = id; + this.name = name; + this.city = city; + } + + public String getId() { + return id; + } + + public String getName() { + return name; + } + + public String getCity() { + return city; + } + + @Override + public String toString() { + String s = id + " " + name + " " + city; + + return s; + } + +} diff --git a/benchmark/persistence/roster/quarkus/src/main/resources/application.properties b/benchmark/persistence/roster/quarkus/src/main/resources/application.properties new file mode 100644 index 0000000000000000000000000000000000000000..720a9f464d64c6abdab61586c4576869cedc2bdb --- /dev/null +++ b/benchmark/persistence/roster/quarkus/src/main/resources/application.properties @@ -0,0 +1,7 @@ +quarkus.datasource.db-kind=h2 +quarkus.datasource.username=sa +quarkus.datasource.password= +quarkus.datasource.jdbc.url=jdbc:h2:mem:roster;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE +quarkus.hibernate-orm.database.generation=drop-and-create +quarkus.hibernate-orm.log.sql=true +quarkus.http.port=8080 \ No newline at end of file diff --git a/benchmark/persistence/roster/quarkus/src/main/resources/import.sql b/benchmark/persistence/roster/quarkus/src/main/resources/import.sql new file mode 100644 index 0000000000000000000000000000000000000000..16aa5235ec238cd2e5a90f8232fbe20624ab73bf --- /dev/null +++ b/benchmark/persistence/roster/quarkus/src/main/resources/import.sql @@ -0,0 +1,6 @@ +-- This file allow to write SQL commands that will be emitted in test and dev. +-- The commands are commented as their support depends of the database +-- insert into myentity (id, field) values(1, 'field-1'); +-- insert into myentity (id, field) values(2, 'field-2'); +-- insert into myentity (id, field) values(3, 'field-3'); +-- alter sequence myentity_seq restart with 4; \ No newline at end of file diff --git a/benchmark/persistence/roster/quarkus/test.sh b/benchmark/persistence/roster/quarkus/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..e5b08bda347ec5eb82843556b8e8a3fc82a49cd3 --- /dev/null +++ b/benchmark/persistence/roster/quarkus/test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +BASE_URL="${BASE_URL:-http://localhost:8080/roster}" + +echo "Health check: ${BASE_URL}" +HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}") + +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "PASS - got HTTP ${HTTP_STATUS}" + exit 0 +else + echo "FAIL - got HTTP ${HTTP_STATUS}" + exit 1 +fi diff --git a/benchmark/persistence/roster/spring/.dockerignore b/benchmark/persistence/roster/spring/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..c634c57d9244b4e60b8fa936f09dbe4e75706e74 --- /dev/null +++ b/benchmark/persistence/roster/spring/.dockerignore @@ -0,0 +1,41 @@ +# VCS +.git/ + +# Maven +.mvn/ +**/.mvn/ +mvnw +mvnw.cmd +**/mvnw +**/mvnw.cmd +target/ +**/target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties + +# IDE / Editor +.vscode/ +**/.vscode/ +.zed/ +**/.zed/ +.idea/ +**/.idea/ +*.iml +*.ipr +*.iws + +# OS +.DS_Store +**/.DS_Store +Thumbs.db +ehthumbs.db + +# Logs / temp +*.log +*.tmp +*.temp diff --git a/benchmark/persistence/roster/spring/.mvn/wrapper/maven-wrapper.properties b/benchmark/persistence/roster/spring/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..8dea6c227c08000d2400d38a2ac886063f22bc36 --- /dev/null +++ b/benchmark/persistence/roster/spring/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,3 @@ +wrapperVersion=3.3.4 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.12/apache-maven-3.9.12-bin.zip diff --git a/benchmark/persistence/roster/spring/Dockerfile b/benchmark/persistence/roster/spring/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..1de99a4541a0f0c769c557207476839e7f84bb50 --- /dev/null +++ b/benchmark/persistence/roster/spring/Dockerfile @@ -0,0 +1,28 @@ +FROM maven:3.9.12-ibm-semeru-21-noble + +USER root +# install uv +RUN apt-get update && apt-get install -y --no-install-recommends curl python3-venv python3-full && curl -LsSf https://astral.sh/uv/install.sh | sh + +ENV PATH="/root/.local/bin:$PATH" + +# Shared browsers path so Chromium is cached once +ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright +RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright + +# create venv and install +RUN uv venv /opt/venv && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest + +ENV PATH="/opt/venv/bin:$PATH" +RUN playwright install --with-deps chromium + +# Set working directory +WORKDIR /app + +# Copy all the assets +COPY . . + +COPY test.sh . +RUN chmod +x test.sh + +CMD sh -c "mvn clean install -DskipTests && mvn spring-boot:run -pl roster-boot" diff --git a/benchmark/persistence/roster/spring/mvnw b/benchmark/persistence/roster/spring/mvnw new file mode 100644 index 0000000000000000000000000000000000000000..bd8896bf2217b46faa0291585e01ac1a3441a958 --- /dev/null +++ b/benchmark/persistence/roster/spring/mvnw @@ -0,0 +1,295 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.4 +# +# Optional ENV vars +# ----------------- +# JAVA_HOME - location of a JDK home dir, required when download maven via java source +# MVNW_REPOURL - repo url base for downloading maven distribution +# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output +# ---------------------------------------------------------------------------- + +set -euf +[ "${MVNW_VERBOSE-}" != debug ] || set -x + +# OS specific support. +native_path() { printf %s\\n "$1"; } +case "$(uname)" in +CYGWIN* | MINGW*) + [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" + native_path() { cygpath --path --windows "$1"; } + ;; +esac + +# set JAVACMD and JAVACCMD +set_java_home() { + # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched + if [ -n "${JAVA_HOME-}" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACCMD="$JAVA_HOME/jre/sh/javac" + else + JAVACMD="$JAVA_HOME/bin/java" + JAVACCMD="$JAVA_HOME/bin/javac" + + if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then + echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 + echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 + return 1 + fi + fi + else + JAVACMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v java + )" || : + JAVACCMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v javac + )" || : + + if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then + echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 + return 1 + fi + fi +} + +# hash string like Java String::hashCode +hash_string() { + str="${1:-}" h=0 + while [ -n "$str" ]; do + char="${str%"${str#?}"}" + h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) + str="${str#?}" + done + printf %x\\n $h +} + +verbose() { :; } +[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } + +die() { + printf %s\\n "$1" >&2 + exit 1 +} + +trim() { + # MWRAPPER-139: + # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. + # Needed for removing poorly interpreted newline sequences when running in more + # exotic environments such as mingw bash on Windows. + printf "%s" "${1}" | tr -d '[:space:]' +} + +scriptDir="$(dirname "$0")" +scriptName="$(basename "$0")" + +# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties +while IFS="=" read -r key value; do + case "${key-}" in + distributionUrl) distributionUrl=$(trim "${value-}") ;; + distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; + esac +done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" + +case "${distributionUrl##*/}" in +maven-mvnd-*bin.*) + MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ + case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in + *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; + :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; + :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; + :Linux*x86_64*) distributionPlatform=linux-amd64 ;; + *) + echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 + distributionPlatform=linux-amd64 + ;; + esac + distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" + ;; +maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; +*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; +esac + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" +distributionUrlName="${distributionUrl##*/}" +distributionUrlNameMain="${distributionUrlName%.*}" +distributionUrlNameMain="${distributionUrlNameMain%-bin}" +MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" +MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" + +exec_maven() { + unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : + exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" +} + +if [ -d "$MAVEN_HOME" ]; then + verbose "found existing MAVEN_HOME at $MAVEN_HOME" + exec_maven "$@" +fi + +case "${distributionUrl-}" in +*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; +*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; +esac + +# prepare tmp dir +if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then + clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } + trap clean HUP INT TERM EXIT +else + die "cannot create temp dir" +fi + +mkdir -p -- "${MAVEN_HOME%/*}" + +# Download and Install Apache Maven +verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +verbose "Downloading from: $distributionUrl" +verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +# select .zip or .tar.gz +if ! command -v unzip >/dev/null; then + distributionUrl="${distributionUrl%.zip}.tar.gz" + distributionUrlName="${distributionUrl##*/}" +fi + +# verbose opt +__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' +[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v + +# normalize http auth +case "${MVNW_PASSWORD:+has-password}" in +'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; +has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; +esac + +if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then + verbose "Found wget ... using wget" + wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" +elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then + verbose "Found curl ... using curl" + curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" +elif set_java_home; then + verbose "Falling back to use Java to download" + javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" + targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" + cat >"$javaSource" <<-END + public class Downloader extends java.net.Authenticator + { + protected java.net.PasswordAuthentication getPasswordAuthentication() + { + return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); + } + public static void main( String[] args ) throws Exception + { + setDefault( new Downloader() ); + java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); + } + } + END + # For Cygwin/MinGW, switch paths to Windows format before running javac and java + verbose " - Compiling Downloader.java ..." + "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" + verbose " - Running Downloader.java ..." + "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" +fi + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +if [ -n "${distributionSha256Sum-}" ]; then + distributionSha256Result=false + if [ "$MVN_CMD" = mvnd.sh ]; then + echo "Checksum validation is not supported for maven-mvnd." >&2 + echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + elif command -v sha256sum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then + distributionSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $distributionSha256Result = false ]; then + echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 + echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 + exit 1 + fi +fi + +# unzip and move +if command -v unzip >/dev/null; then + unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" +else + tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" +fi + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +actualDistributionDir="" + +# First try the expected directory name (for regular distributions) +if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then + if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then + actualDistributionDir="$distributionUrlNameMain" + fi +fi + +# If not found, search for any directory with the Maven executable (for snapshots) +if [ -z "$actualDistributionDir" ]; then + # enable globbing to iterate over items + set +f + for dir in "$TMP_DOWNLOAD_DIR"/*; do + if [ -d "$dir" ]; then + if [ -f "$dir/bin/$MVN_CMD" ]; then + actualDistributionDir="$(basename "$dir")" + break + fi + fi + done + set -f +fi + +if [ -z "$actualDistributionDir" ]; then + verbose "Contents of $TMP_DOWNLOAD_DIR:" + verbose "$(ls -la "$TMP_DOWNLOAD_DIR")" + die "Could not find Maven distribution directory in extracted archive" +fi + +verbose "Found extracted Maven distribution directory: $actualDistributionDir" +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" + +clean || : +exec_maven "$@" diff --git a/benchmark/persistence/roster/spring/mvnw.cmd b/benchmark/persistence/roster/spring/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..5761d948924c19571d27b465c519b2e2f9e30351 --- /dev/null +++ b/benchmark/persistence/roster/spring/mvnw.cmd @@ -0,0 +1,189 @@ +<# : batch portion +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.4 +@REM +@REM Optional ENV vars +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output +@REM ---------------------------------------------------------------------------- + +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) +) +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> + +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} + +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} + +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' + +$MAVEN_M2_PATH = "$HOME/.m2" +if ($env:MAVEN_USER_HOME) { + $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME" +} + +if (-not (Test-Path -Path $MAVEN_M2_PATH)) { + New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null +} + +$MAVEN_WRAPPER_DISTS = $null +if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) { + $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists" +} else { + $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists" +} + +$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain" +$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" + +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} + +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} + +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} + +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null + +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +$actualDistributionDir = "" + +# First try the expected directory name (for regular distributions) +$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain" +$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD" +if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) { + $actualDistributionDir = $distributionUrlNameMain +} + +# If not found, search for any directory with the Maven executable (for snapshots) +if (!$actualDistributionDir) { + Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object { + $testPath = Join-Path $_.FullName "bin/$MVN_CMD" + if (Test-Path -Path $testPath -PathType Leaf) { + $actualDistributionDir = $_.Name + } + } +} + +if (!$actualDistributionDir) { + Write-Error "Could not find Maven distribution directory in extracted archive" +} + +Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir" +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/benchmark/persistence/roster/spring/pom.xml b/benchmark/persistence/roster/spring/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..51d74dc4a89ce4a3d94b63694f5e8ea930f7039f --- /dev/null +++ b/benchmark/persistence/roster/spring/pom.xml @@ -0,0 +1,21 @@ + + 4.0.0 + + spring.tutorial + roster + 1.0.0 + pom + roster + + + 17 + UTF-8 + + + + roster-common + roster-boot + + diff --git a/benchmark/persistence/roster/spring/roster-boot/pom.xml b/benchmark/persistence/roster/spring/roster-boot/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..899a8954f3e685f9962e5d5039915cc4383c69d9 --- /dev/null +++ b/benchmark/persistence/roster/spring/roster-boot/pom.xml @@ -0,0 +1,94 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.1.0 + + + spring.tutorial + roster-boot + 1.0.0 + roster-boot + + 17 + 5.5.0 + 17 + 17 + UTF-8 + + + + + org.joinfaces + joinfaces-bom + ${joinfaces.version} + pom + import + + + + + + spring.tutorial + roster-common + 1.0.0 + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-data-jpa + + + jakarta.validation + jakarta.validation-api + + + org.springframework.boot + spring-boot-starter-test + test + + + org.joinfaces + primefaces-spring-boot-starter + + + com.h2database + h2 + runtime + + + jakarta.annotation + jakarta.annotation-api + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-failsafe-plugin + + + + integration-test + verify + + + + **/*IT.java + + + + + + + + diff --git a/benchmark/persistence/roster/spring/roster-boot/src/main/java/jakartaee/tutorial/roster/entity/League.java b/benchmark/persistence/roster/spring/roster-boot/src/main/java/jakartaee/tutorial/roster/entity/League.java new file mode 100644 index 0000000000000000000000000000000000000000..6adeb6a0f5584d942ed1d144701f8d9dd946dfea --- /dev/null +++ b/benchmark/persistence/roster/spring/roster-boot/src/main/java/jakartaee/tutorial/roster/entity/League.java @@ -0,0 +1,75 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakartaee.tutorial.roster.entity; + +import java.io.Serializable; +import java.util.Collection; + +import jakarta.persistence.CascadeType; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.OneToMany; +import jakarta.persistence.Table; + + +@Entity +@Table(name = "PERSISTENCE_ROSTER_LEAGUE") +public abstract class League implements Serializable { + private static final long serialVersionUID = 5060910864394673463L; + protected String id; + protected String name; + protected String sport; + protected Collection teams; + + @Id + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSport() { + return sport; + } + + public void setSport(String sport) { + this.sport = sport; + } + + @OneToMany(cascade=CascadeType.ALL, mappedBy="league") + public Collection getTeams() { + return teams; + } + + public void setTeams(Collection teams) { + this.teams = teams; + } + + public void addTeam(Team team) { + this.getTeams().add(team); + } + + public void dropTeam(Team team) { + this.getTeams().remove(team); + } + +} diff --git a/benchmark/persistence/roster/spring/roster-boot/src/main/java/jakartaee/tutorial/roster/entity/Player.java b/benchmark/persistence/roster/spring/roster-boot/src/main/java/jakartaee/tutorial/roster/entity/Player.java new file mode 100644 index 0000000000000000000000000000000000000000..9071fb5a2e222b2748eefcd9c85464752eef5675 --- /dev/null +++ b/benchmark/persistence/roster/spring/roster-boot/src/main/java/jakartaee/tutorial/roster/entity/Player.java @@ -0,0 +1,94 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakartaee.tutorial.roster.entity; + +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.ManyToMany; +import jakarta.persistence.Table; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; + +@Entity +@Table(name = "PERSISTENCE_ROSTER_PLAYER") +public class Player implements Serializable { + + private String id; + private String name; + private String position; + private double salary; + private Collection teams = new ArrayList<>(); + + public Player() { + } + + public Player(String id, String name, String position, double salary) { + this.id = id; + this.name = name; + this.position = position; + this.salary = salary; + } + + @Id + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public double getSalary() { + return salary; + } + + public void setSalary(double salary) { + this.salary = salary; + } + + @ManyToMany(mappedBy="players") + public Collection getTeams() { + if (teams == null) teams = new ArrayList<>(); + return teams; + } + + public void setTeams(Collection teams) { + this.teams = teams; + } + + public void addTeam(Team team) { + getTeams().add(team); + team.getPlayers().add(this); + } + + public void dropTeam(Team team) { + getTeams().remove(team); + team.getPlayers().remove(this); + } +} diff --git a/benchmark/persistence/roster/spring/roster-boot/src/main/java/jakartaee/tutorial/roster/entity/SummerLeague.java b/benchmark/persistence/roster/spring/roster-boot/src/main/java/jakartaee/tutorial/roster/entity/SummerLeague.java new file mode 100644 index 0000000000000000000000000000000000000000..4a0ac0d5c1f1c2e228fad13a0c511ec7967210d7 --- /dev/null +++ b/benchmark/persistence/roster/spring/roster-boot/src/main/java/jakartaee/tutorial/roster/entity/SummerLeague.java @@ -0,0 +1,40 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakartaee.tutorial.roster.entity; + +import java.io.Serializable; + +import jakarta.persistence.Entity; +import spring.tutorial.roster.util.IncorrectSportException; + +@Entity +public class SummerLeague extends League implements Serializable { + private static final long serialVersionUID = 4846138039113922695L; + + /** Creates a new instance of SummerLeague */ + public SummerLeague() { + } + + public SummerLeague(String id, String name, String sport) + throws IncorrectSportException { + this.id = id; + this.name = name; + if (sport.equalsIgnoreCase("swimming") || + sport.equalsIgnoreCase("soccer") || + sport.equalsIgnoreCase("basketball") || + sport.equalsIgnoreCase("baseball")) { + this.sport = sport; + } else { + throw new IncorrectSportException("Sport is not a summer sport."); + } + } +} diff --git a/benchmark/persistence/roster/spring/roster-boot/src/main/java/jakartaee/tutorial/roster/entity/Team.java b/benchmark/persistence/roster/spring/roster-boot/src/main/java/jakartaee/tutorial/roster/entity/Team.java new file mode 100644 index 0000000000000000000000000000000000000000..8b191573423fd376f8b6a88963bd11a631a01eee --- /dev/null +++ b/benchmark/persistence/roster/spring/roster-boot/src/main/java/jakartaee/tutorial/roster/entity/Team.java @@ -0,0 +1,103 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakartaee.tutorial.roster.entity; + +import jakarta.persistence.CascadeType; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.JoinTable; +import jakarta.persistence.ManyToMany; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; + +@Entity +@Table(name = "PERSISTENCE_ROSTER_TEAM") +public class Team implements Serializable { + + private String id; + private String name; + private String city; + private Collection players = new ArrayList<>(); + private League league; + + public Team() { + } + + public Team(String id, String name, String city) { + this.id = id; + this.name = name; + this.city = city; + } + + @Id + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + @ManyToMany + @JoinTable( + name="PERSISTENCE_ROSTER_TEAM_PLAYER", + joinColumns=@JoinColumn(name="TEAM_ID", referencedColumnName="ID"), + inverseJoinColumns=@JoinColumn(name="PLAYER_ID", referencedColumnName="ID") + ) + public Collection getPlayers() { + if (players == null) players = new ArrayList<>(); + return players; + } + + public void setPlayers(Collection players) { + this.players = players; + } + + @ManyToOne + public League getLeague() { + return league; + } + + public void setLeague(League league) { + this.league = league; + } + + public void addPlayer(Player player) { + getPlayers().add(player); + player.getTeams().add(this); + } + + public void dropPlayer(Player player) { + getPlayers().remove(player); + player.getTeams().remove(this); + } +} \ No newline at end of file diff --git a/benchmark/persistence/roster/spring/roster-boot/src/main/java/jakartaee/tutorial/roster/entity/WinterLeague.java b/benchmark/persistence/roster/spring/roster-boot/src/main/java/jakartaee/tutorial/roster/entity/WinterLeague.java new file mode 100644 index 0000000000000000000000000000000000000000..340eb8024a525118a32ec5a099a066549e45acc2 --- /dev/null +++ b/benchmark/persistence/roster/spring/roster-boot/src/main/java/jakartaee/tutorial/roster/entity/WinterLeague.java @@ -0,0 +1,40 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakartaee.tutorial.roster.entity; + +import java.io.Serializable; + +import jakarta.persistence.Entity; +import spring.tutorial.roster.util.IncorrectSportException; + +@Entity +public class WinterLeague extends League implements Serializable { + private static final long serialVersionUID = 8942582153559426625L; + + /** Creates a new instance of WinterLeague */ + public WinterLeague() { + } + + public WinterLeague(String id, String name, String sport) throws + IncorrectSportException { + this.id = id; + this.name = name; + if (sport.equalsIgnoreCase("hockey") || + sport.equalsIgnoreCase("skiing") || + sport.equalsIgnoreCase("snowboarding")) { + this.sport = sport; + } else { + throw new IncorrectSportException("Sport is not a winter sport."); + } + } + +} diff --git a/benchmark/persistence/roster/spring/roster-boot/src/main/java/spring/tutorial/roster/RosterApplication.java b/benchmark/persistence/roster/spring/roster-boot/src/main/java/spring/tutorial/roster/RosterApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..037359d3f61ad674610fd95d11cdb9f560821cc9 --- /dev/null +++ b/benchmark/persistence/roster/spring/roster-boot/src/main/java/spring/tutorial/roster/RosterApplication.java @@ -0,0 +1,15 @@ +package spring.tutorial.roster; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.domain.EntityScan; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; + +@SpringBootApplication +@EntityScan("jakartaee.tutorial.roster.entity") +@EnableJpaRepositories("spring.tutorial.roster.repository") +public class RosterApplication { + public static void main(String[] args) { + SpringApplication.run(RosterApplication.class, args); + } +} \ No newline at end of file diff --git a/benchmark/persistence/roster/spring/roster-boot/src/main/java/spring/tutorial/roster/repository/LeagueRepository.java b/benchmark/persistence/roster/spring/roster-boot/src/main/java/spring/tutorial/roster/repository/LeagueRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..ae7ffdc1b7223079ee3e7d549b398b16759ece76 --- /dev/null +++ b/benchmark/persistence/roster/spring/roster-boot/src/main/java/spring/tutorial/roster/repository/LeagueRepository.java @@ -0,0 +1,7 @@ +package spring.tutorial.roster.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import jakartaee.tutorial.roster.entity.League; + +public interface LeagueRepository extends JpaRepository { +} \ No newline at end of file diff --git a/benchmark/persistence/roster/spring/roster-boot/src/main/java/spring/tutorial/roster/repository/PlayerRepository.java b/benchmark/persistence/roster/spring/roster-boot/src/main/java/spring/tutorial/roster/repository/PlayerRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..4b6a9034b62c3487cd6b21f889e75f50dc350bc1 --- /dev/null +++ b/benchmark/persistence/roster/spring/roster-boot/src/main/java/spring/tutorial/roster/repository/PlayerRepository.java @@ -0,0 +1,19 @@ +package spring.tutorial.roster.repository; + +import java.util.List; +import java.util.Optional; +import org.springframework.data.jpa.repository.JpaRepository; +import jakartaee.tutorial.roster.entity.Player; + +public interface PlayerRepository extends JpaRepository { + List findByPosition(String position); + List findBySalaryBetween(double low, double high); + List findBySalaryGreaterThan(double salary); + List findByTeams_Id(String teamId); + List findByTeamsIsEmpty(); + List findByPositionAndName(String position, String name); + List findDistinctByTeams_League_Id(String leagueId); + List findDistinctByTeams_League_Sport(String sport); + List findDistinctByTeams_City(String city); + Optional findFirstByName(String name); +} \ No newline at end of file diff --git a/benchmark/persistence/roster/spring/roster-boot/src/main/java/spring/tutorial/roster/repository/TeamRepository.java b/benchmark/persistence/roster/spring/roster-boot/src/main/java/spring/tutorial/roster/repository/TeamRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..03e52b01181aaf2bd4fdc232c62e67765a4d8766 --- /dev/null +++ b/benchmark/persistence/roster/spring/roster-boot/src/main/java/spring/tutorial/roster/repository/TeamRepository.java @@ -0,0 +1,9 @@ +package spring.tutorial.roster.repository; + +import java.util.List; +import org.springframework.data.jpa.repository.JpaRepository; +import jakartaee.tutorial.roster.entity.Team; + +public interface TeamRepository extends JpaRepository { + List findByLeague_Id(String leagueId); +} \ No newline at end of file diff --git a/benchmark/persistence/roster/spring/roster-boot/src/main/java/spring/tutorial/roster/request/RequestBean.java b/benchmark/persistence/roster/spring/roster-boot/src/main/java/spring/tutorial/roster/request/RequestBean.java new file mode 100644 index 0000000000000000000000000000000000000000..415205f50b0f766bb16aa1678943e6f403724307 --- /dev/null +++ b/benchmark/persistence/roster/spring/roster-boot/src/main/java/spring/tutorial/roster/request/RequestBean.java @@ -0,0 +1,221 @@ +package spring.tutorial.roster.request; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import jakarta.annotation.PostConstruct; +import spring.tutorial.roster.repository.LeagueRepository; +import spring.tutorial.roster.repository.PlayerRepository; +import spring.tutorial.roster.repository.TeamRepository; +import spring.tutorial.roster.util.IncorrectSportException; +import spring.tutorial.roster.util.LeagueDetails; +import spring.tutorial.roster.util.PlayerDetails; +import spring.tutorial.roster.util.TeamDetails; +import jakartaee.tutorial.roster.entity.League; +import jakartaee.tutorial.roster.entity.Player; +import jakartaee.tutorial.roster.entity.SummerLeague; +import jakartaee.tutorial.roster.entity.Team; +import jakartaee.tutorial.roster.entity.WinterLeague; + +@Service("requestBean") +@Transactional +public class RequestBean implements Request, Serializable { + private final PlayerRepository playerRepository; + private final TeamRepository teamRepository; + private final LeagueRepository leagueRepository; + + public RequestBean(PlayerRepository playerRepository, TeamRepository teamRepository, LeagueRepository leagueRepository) { + this.playerRepository = playerRepository; + this.teamRepository = teamRepository; + this.leagueRepository = leagueRepository; + } + + @PostConstruct + private void init() { + } + + @Override + public void createPlayer(String id, String name, String position, double salary) { + Player p = new Player(id, name, position, salary); + playerRepository.save(p); + } + + @Override + public void addPlayer(String playerId, String teamId) { + Player p = playerRepository.findById(playerId).orElse(null); + Team t = teamRepository.findById(teamId).orElse(null); + if (p == null || t == null) return; + t.addPlayer(p); + teamRepository.save(t); + } + + @Override + public void removePlayer(String playerId) { + playerRepository.findById(playerId).ifPresent(p -> { + List teams = new ArrayList<>(Optional.ofNullable(p.getTeams()).orElse(List.of())); + for (Team t : teams) { + t.dropPlayer(p); + } + teamRepository.saveAll(teams); + playerRepository.deleteById(playerId); + }); + } + + @Override + public void dropPlayer(String playerId, String teamId) { + Player p = playerRepository.findById(playerId).orElse(null); + Team t = teamRepository.findById(teamId).orElse(null); + if (p == null || t == null) return; + t.dropPlayer(p); + teamRepository.save(t); + } + + @Override + public PlayerDetails getPlayer(String playerId) { + return playerRepository.findById(playerId).map(this::toPlayerDetails).orElse(null); + } + + @Override + public List getPlayersOfTeam(String teamId) { + return playerRepository.findByTeams_Id(teamId).stream().map(this::toPlayerDetails).toList(); + } + + @Override + public List getTeamsOfLeague(String leagueId) { + return teamRepository.findByLeague_Id(leagueId).stream().map(this::toTeamDetails).toList(); + } + + @Override + public List getPlayersByPosition(String position) { + return playerRepository.findByPosition(position).stream().map(this::toPlayerDetails).toList(); + } + + @Override + public List getPlayersByHigherSalary(String name) { + Optional base = playerRepository.findFirstByName(name); + if (base.isEmpty()) return List.of(); + return playerRepository.findBySalaryGreaterThan(base.get().getSalary()).stream().map(this::toPlayerDetails).toList(); + } + + @Override + public List getPlayersBySalaryRange(double low, double high) { + return playerRepository.findBySalaryBetween(low, high).stream().map(this::toPlayerDetails).toList(); + } + + @Override + public List getPlayersByLeagueId(String leagueId) { + return playerRepository.findDistinctByTeams_League_Id(leagueId).stream().map(this::toPlayerDetails).toList(); + } + + @Override + public List getPlayersBySport(String sport) { + return playerRepository.findDistinctByTeams_League_Sport(sport).stream().map(this::toPlayerDetails).toList(); + } + + @Override + public List getPlayersByCity(String city) { + return playerRepository.findDistinctByTeams_City(city).stream().map(this::toPlayerDetails).toList(); + } + + @Override + public List getAllPlayers() { + return playerRepository.findAll().stream().sorted(Comparator.comparing(Player::getId)).map(this::toPlayerDetails).toList(); + } + + @Override + public List getPlayersNotOnTeam() { + return playerRepository.findByTeamsIsEmpty().stream().map(this::toPlayerDetails).toList(); + } + + @Override + public List getPlayersByPositionAndName(String position, String name) { + return playerRepository.findByPositionAndName(position, name).stream().map(this::toPlayerDetails).toList(); + } + + @Override + public List getLeaguesOfPlayer(String playerId) { + return playerRepository.findById(playerId).map(p -> Optional.ofNullable(p.getTeams()).orElse(List.of()).stream() + .map(Team::getLeague).filter(Objects::nonNull).collect(Collectors.toMap(League::getId, l -> l, (a, b) -> a)).values().stream() + .map(this::toLeagueDetails).toList()).orElse(List.of()); + } + + @Override + public List getSportsOfPlayer(String playerId) { + return playerRepository.findById(playerId).map(p -> Optional.ofNullable(p.getTeams()).orElse(List.of()).stream() + .map(Team::getLeague).filter(Objects::nonNull).map(League::getSport).filter(Objects::nonNull) + .collect(Collectors.toCollection(java.util.LinkedHashSet::new))).orElseGet(java.util.LinkedHashSet::new).stream().toList(); + } + + @Override + public void createTeamInLeague(TeamDetails teamDetails, String leagueId) { + League league = leagueRepository.findById(leagueId).orElse(null); + if (league == null) return; + Team t = new Team(teamDetails.getId(), teamDetails.getName(), teamDetails.getCity()); + t.setLeague(league); + teamRepository.save(t); + } + + @Override + public void removeTeam(String teamId) { + teamRepository.findById(teamId).ifPresent(t -> { + List players = new ArrayList<>(Optional.ofNullable(t.getPlayers()).orElse(List.of())); + for (Player p : players) { + t.dropPlayer(p); + } + teamRepository.save(t); + teamRepository.deleteById(teamId); + }); + } + + @Override + public TeamDetails getTeam(String teamId) { + return teamRepository.findById(teamId).map(this::toTeamDetails).orElse(null); + } + + @Override + public void createLeague(LeagueDetails leagueDetails) { + League l = instantiateLeague(leagueDetails); + leagueRepository.save(l); + } + + @Override + public void removeLeague(String leagueId) { + leagueRepository.deleteById(leagueId); + } + + @Override + public LeagueDetails getLeague(String leagueId) { + return leagueRepository.findById(leagueId).map(this::toLeagueDetails).orElse(null); + } + + private PlayerDetails toPlayerDetails(Player p) { + return new PlayerDetails(p.getId(), p.getName(), p.getPosition(), p.getSalary()); + } + + private TeamDetails toTeamDetails(Team t) { + return new TeamDetails(t.getId(), t.getName(), t.getCity()); + } + + private LeagueDetails toLeagueDetails(League l) { + return new LeagueDetails(l.getId(), l.getName(), l.getSport()); + } + + private League instantiateLeague(LeagueDetails d) { + try { + String sport = d.getSport() == null ? "" : d.getSport().toLowerCase(); + if (sport.contains("ski") || sport.contains("hockey") || sport.contains("ice") || sport.contains("snow")) { + return new WinterLeague(d.getId(), d.getName(), d.getSport()); + } + return new SummerLeague(d.getId(), d.getName(), d.getSport()); + } catch (IncorrectSportException e) { + throw new IllegalArgumentException(e); + } + } +} \ No newline at end of file diff --git a/benchmark/persistence/roster/spring/roster-boot/src/main/java/spring/tutorial/roster/rest/RosterController.java b/benchmark/persistence/roster/spring/roster-boot/src/main/java/spring/tutorial/roster/rest/RosterController.java new file mode 100644 index 0000000000000000000000000000000000000000..d5e6cbec24217a10a08f950aa4662a61357e30ee --- /dev/null +++ b/benchmark/persistence/roster/spring/roster-boot/src/main/java/spring/tutorial/roster/rest/RosterController.java @@ -0,0 +1,171 @@ +package spring.tutorial.roster.rest; + +import java.util.List; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; +import spring.tutorial.roster.request.Request; +import spring.tutorial.roster.util.LeagueDetails; +import spring.tutorial.roster.util.PlayerDetails; +import spring.tutorial.roster.util.TeamDetails; + +@RestController +@RequestMapping("/roster") +public class RosterController { + + private final Request request; + + public RosterController(Request request) { + this.request = request; + } + + // ---- League ---- + + @PostMapping("/league") + public ResponseEntity createLeague(@RequestBody LeagueDetails details) { + try { + request.createLeague(details); + return ResponseEntity.ok().build(); + } catch (IllegalArgumentException e) { + return ResponseEntity.badRequest().build(); + } + } + + @GetMapping("/league/{id}") + public ResponseEntity getLeague(@PathVariable String id) { + LeagueDetails d = request.getLeague(id); + return d != null ? ResponseEntity.ok(d) : ResponseEntity.notFound().build(); + } + + @DeleteMapping("/league/{id}") + public ResponseEntity removeLeague(@PathVariable String id) { + request.removeLeague(id); + return ResponseEntity.ok().build(); + } + + @GetMapping("/league/{id}/teams") + public List getTeamsOfLeague(@PathVariable String id) { + return request.getTeamsOfLeague(id); + } + + // ---- Team ---- + + @PostMapping("/team/league/{leagueId}") + public ResponseEntity createTeamInLeague(@RequestBody TeamDetails details, + @PathVariable String leagueId) { + request.createTeamInLeague(details, leagueId); + return ResponseEntity.ok().build(); + } + + @GetMapping("/team/{id}") + public ResponseEntity getTeam(@PathVariable String id) { + TeamDetails d = request.getTeam(id); + return d != null ? ResponseEntity.ok(d) : ResponseEntity.notFound().build(); + } + + @DeleteMapping("/team/{id}") + public ResponseEntity removeTeam(@PathVariable String id) { + request.removeTeam(id); + return ResponseEntity.ok().build(); + } + + @GetMapping("/team/{id}/players") + public List getPlayersOfTeam(@PathVariable String id) { + return request.getPlayersOfTeam(id); + } + + // ---- Player ---- + + @PostMapping("/player") + public ResponseEntity createPlayer(@RequestParam String id, + @RequestParam String name, + @RequestParam String position, + @RequestParam double salary) { + request.createPlayer(id, name, position, salary); + return ResponseEntity.ok().build(); + } + + @GetMapping("/player/{id}") + public ResponseEntity getPlayer(@PathVariable String id) { + PlayerDetails d = request.getPlayer(id); + return d != null ? ResponseEntity.ok(d) : ResponseEntity.notFound().build(); + } + + @DeleteMapping("/player/{id}") + public ResponseEntity removePlayer(@PathVariable String id) { + request.removePlayer(id); + return ResponseEntity.ok().build(); + } + + @PostMapping("/player/{pid}/team/{tid}") + public ResponseEntity addPlayerToTeam(@PathVariable String pid, + @PathVariable String tid) { + request.addPlayer(pid, tid); + return ResponseEntity.ok().build(); + } + + @DeleteMapping("/player/{pid}/team/{tid}") + public ResponseEntity dropPlayerFromTeam(@PathVariable String pid, + @PathVariable String tid) { + request.dropPlayer(pid, tid); + return ResponseEntity.ok().build(); + } + + @GetMapping("/player/{id}/leagues") + public List getLeaguesOfPlayer(@PathVariable String id) { + return request.getLeaguesOfPlayer(id); + } + + @GetMapping("/player/{id}/sports") + public List getSportsOfPlayer(@PathVariable String id) { + return request.getSportsOfPlayer(id); + } + + // ---- Queries ---- + + @GetMapping("/players") + public List getAllPlayers() { + return request.getAllPlayers(); + } + + @GetMapping("/players/position/{pos}") + public List getPlayersByPosition(@PathVariable String pos) { + return request.getPlayersByPosition(pos); + } + + @GetMapping("/players/salary/higher/{name}") + public List getPlayersByHigherSalary(@PathVariable String name) { + return request.getPlayersByHigherSalary(name); + } + + @GetMapping("/players/salary/range") + public List getPlayersBySalaryRange(@RequestParam double low, + @RequestParam double high) { + return request.getPlayersBySalaryRange(low, high); + } + + @GetMapping("/players/league/{id}") + public List getPlayersByLeagueId(@PathVariable String id) { + return request.getPlayersByLeagueId(id); + } + + @GetMapping("/players/sport/{sport}") + public List getPlayersBySport(@PathVariable String sport) { + return request.getPlayersBySport(sport); + } + + @GetMapping("/players/city/{city}") + public List getPlayersByCity(@PathVariable String city) { + return request.getPlayersByCity(city); + } + + @GetMapping("/players/not-on-team") + public List getPlayersNotOnTeam() { + return request.getPlayersNotOnTeam(); + } + + @GetMapping("/players/position/{pos}/name/{name}") + public List getPlayersByPositionAndName(@PathVariable String pos, + @PathVariable String name) { + return request.getPlayersByPositionAndName(pos, name); + } +} diff --git a/benchmark/persistence/roster/spring/roster-boot/src/main/resources/application.properties b/benchmark/persistence/roster/spring/roster-boot/src/main/resources/application.properties new file mode 100644 index 0000000000000000000000000000000000000000..0e16ae1b10b906679bd7d46c1f6b012b616a68ca --- /dev/null +++ b/benchmark/persistence/roster/spring/roster-boot/src/main/resources/application.properties @@ -0,0 +1,14 @@ +server.port=8080 + +spring.datasource.url=jdbc:h2:mem:roster;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE +spring.datasource.driver-class-name=org.h2.Driver +spring.datasource.username=sa +spring.datasource.password= + +spring.jpa.hibernate.ddl-auto=update +spring.jpa.show-sql=true +spring.jpa.open-in-view=false + +spring.h2.console.enabled=true + +joinfaces.primefaces.theme=saga \ No newline at end of file diff --git a/benchmark/persistence/roster/spring/roster-boot/src/test/java/spring/tutorial/roster/RequestBeanUnitTest.java b/benchmark/persistence/roster/spring/roster-boot/src/test/java/spring/tutorial/roster/RequestBeanUnitTest.java new file mode 100644 index 0000000000000000000000000000000000000000..b56e891846ef650d1860c35bc88f199f0c5d908a --- /dev/null +++ b/benchmark/persistence/roster/spring/roster-boot/src/test/java/spring/tutorial/roster/RequestBeanUnitTest.java @@ -0,0 +1,59 @@ +package spring.tutorial.roster; + +import java.util.Optional; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.ArgumentCaptor; +import org.mockito.junit.jupiter.MockitoExtension; +import org.mockito.Mock; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.Mockito.*; +import spring.tutorial.roster.request.RequestBean; +import spring.tutorial.roster.util.LeagueDetails; +import spring.tutorial.roster.repository.LeagueRepository; +import spring.tutorial.roster.repository.PlayerRepository; +import spring.tutorial.roster.repository.TeamRepository; +import jakartaee.tutorial.roster.entity.League; +import jakartaee.tutorial.roster.entity.Player; +import jakartaee.tutorial.roster.entity.SummerLeague; +import jakartaee.tutorial.roster.entity.Team; +import jakartaee.tutorial.roster.entity.WinterLeague; + +@ExtendWith(MockitoExtension.class) +class RequestBeanUnitTest { + + @Mock PlayerRepository playerRepository; + @Mock TeamRepository teamRepository; + @Mock LeagueRepository leagueRepository; + + @Test + void createLeagueChoosesSeasonType() { + RequestBean bean = new RequestBean(playerRepository, teamRepository, leagueRepository); + + bean.createLeague(new LeagueDetails("L1","Name","soccer")); + ArgumentCaptor cap1 = ArgumentCaptor.forClass(League.class); + verify(leagueRepository).save(cap1.capture()); + assertTrue(cap1.getValue() instanceof SummerLeague); + + reset(leagueRepository); + bean.createLeague(new LeagueDetails("L2","Name","hockey")); + ArgumentCaptor cap2 = ArgumentCaptor.forClass(League.class); + verify(leagueRepository).save(cap2.capture()); + assertTrue(cap2.getValue() instanceof WinterLeague); + } + + @Test + void addPlayerLinksAndSavesTeam() { + RequestBean bean = new RequestBean(playerRepository, teamRepository, leagueRepository); + Player p = new Player("P1","Alice","Forward",100); + Team t = new Team("T1","Tigers","Austin"); + when(playerRepository.findById("P1")).thenReturn(Optional.of(p)); + when(teamRepository.findById("T1")).thenReturn(Optional.of(t)); + + bean.addPlayer("P1","T1"); + + verify(teamRepository).save(t); + assertTrue(t.getPlayers().contains(p)); + assertTrue(p.getTeams().contains(t)); + } +} diff --git a/benchmark/persistence/roster/spring/roster-boot/src/test/java/spring/tutorial/roster/RequestCrudIT.java b/benchmark/persistence/roster/spring/roster-boot/src/test/java/spring/tutorial/roster/RequestCrudIT.java new file mode 100644 index 0000000000000000000000000000000000000000..658a1a6a55845ba34b371cbd58b20829619c723b --- /dev/null +++ b/benchmark/persistence/roster/spring/roster-boot/src/test/java/spring/tutorial/roster/RequestCrudIT.java @@ -0,0 +1,42 @@ +package spring.tutorial.roster; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.DirtiesContext; +import spring.tutorial.roster.request.Request; +import spring.tutorial.roster.util.LeagueDetails; +import spring.tutorial.roster.util.TeamDetails; + +import static org.junit.jupiter.api.Assertions.*; + +@SpringBootTest +@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) +class RequestCrudIT { + + @Autowired + Request request; + + @Test + void leagueTeamPlayerCrud() { + request.createLeague(new LeagueDetails("Lx","LX","soccer")); + request.createTeamInLeague(new TeamDetails("Tx","Tigers","Austin"), "Lx"); + request.createPlayer("Px","Alice","Forward",100.0); + request.addPlayer("Px","Tx"); + + assertEquals(1, request.getPlayersOfTeam("Tx").size()); + assertNotNull(request.getTeam("Tx")); + assertNotNull(request.getLeague("Lx")); + + request.removeTeam("Tx"); + assertEquals(0, request.getTeamsOfLeague("Lx").size()); + assertEquals(0, request.getPlayersOfTeam("Tx").size()); + + request.removeLeague("Lx"); + assertNull(request.getLeague("Lx")); + + request.removePlayer("Px"); + assertNull(request.getPlayer("Px")); + assertEquals(0, request.getAllPlayers().size()); + } +} diff --git a/benchmark/persistence/roster/spring/roster-boot/src/test/java/spring/tutorial/roster/RequestQueriesIT.java b/benchmark/persistence/roster/spring/roster-boot/src/test/java/spring/tutorial/roster/RequestQueriesIT.java new file mode 100644 index 0000000000000000000000000000000000000000..3680350d8b1888a26b30986324830cef1df0f580 --- /dev/null +++ b/benchmark/persistence/roster/spring/roster-boot/src/test/java/spring/tutorial/roster/RequestQueriesIT.java @@ -0,0 +1,47 @@ +package spring.tutorial.roster; + +import java.util.List; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.DirtiesContext; +import spring.tutorial.roster.request.Request; +import spring.tutorial.roster.util.LeagueDetails; +import spring.tutorial.roster.util.PlayerDetails; +import spring.tutorial.roster.util.TeamDetails; + +import static org.junit.jupiter.api.Assertions.*; + +@SpringBootTest +@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) +class RequestQueriesIT { + + @Autowired + Request request; + + @Test + void queryScenarios() { + request.createLeague(new LeagueDetails("Lq","Summer","soccer")); + request.createTeamInLeague(new TeamDetails("Tq","Tigers","Austin"), "Lq"); + request.createPlayer("Pa","Alice","Forward",100); + request.createPlayer("Pb","Bob","Goalie",120); + request.createPlayer("Pz","Zed","Forward",90); + request.addPlayer("Pa","Tq"); + request.addPlayer("Pb","Tq"); + + assertTrue(ids(request.getPlayersByPosition("Forward")).containsAll(List.of("Pa","Pz"))); + assertEquals(List.of("Pb"), ids(request.getPlayersByHigherSalary("Alice"))); + assertEquals(List.of("Pa"), ids(request.getPlayersBySalaryRange(95,110))); + assertTrue(ids(request.getPlayersByLeagueId("Lq")).containsAll(List.of("Pa","Pb"))); + assertTrue(ids(request.getPlayersBySport("soccer")).containsAll(List.of("Pa","Pb"))); + assertTrue(ids(request.getPlayersByCity("Austin")).containsAll(List.of("Pa","Pb"))); + assertTrue(ids(request.getPlayersNotOnTeam()).contains("Pz")); + assertEquals(List.of("Pa"), ids(request.getPlayersByPositionAndName("Forward","Alice"))); + assertEquals(List.of("Lq"), request.getLeaguesOfPlayer("Pa").stream().map(LeagueDetails::getId).toList()); + assertTrue(request.getSportsOfPlayer("Pa").contains("soccer")); + } + + private static List ids(List list) { + return list.stream().map(PlayerDetails::getId).toList(); + } +} diff --git a/benchmark/persistence/roster/spring/roster-boot/src/test/java/spring/tutorial/roster/RequestSmokeText,java b/benchmark/persistence/roster/spring/roster-boot/src/test/java/spring/tutorial/roster/RequestSmokeText,java new file mode 100644 index 0000000000000000000000000000000000000000..62fc42b97dd02f1a0abcf05e1d2cf18f48b0cfca --- /dev/null +++ b/benchmark/persistence/roster/spring/roster-boot/src/test/java/spring/tutorial/roster/RequestSmokeText,java @@ -0,0 +1,26 @@ +package spring.tutorial.roster; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import spring.tutorial.roster.request.Request; +import spring.tutorial.roster.util.LeagueDetails; +import spring.tutorial.roster.util.TeamDetails; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +@SpringBootTest +class RequestSmokeTest { + + @Autowired + Request request; + + @Test + void roundTrip() { + request.createLeague(new LeagueDetails("L1","Summer Fun","soccer")); + request.createTeamInLeague(new TeamDetails("T1","Tigers","Austin"), "L1"); + request.createPlayer("P1","Alice","Forward",100000); + request.addPlayer("P1","T1"); + assertEquals(1, request.getPlayersOfTeam("T1").size()); + } +} diff --git a/benchmark/persistence/roster/spring/roster-common/pom.xml b/benchmark/persistence/roster/spring/roster-common/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..1d9a12640d3efb34f95b868dac160b59b91e8645 --- /dev/null +++ b/benchmark/persistence/roster/spring/roster-common/pom.xml @@ -0,0 +1,28 @@ + + 4.0.0 + + spring.tutorial + roster + 1.0.0 + + roster-common + jar + + + 17 + 17 + UTF-8 + + roster-common + + + + jakarta.platform + jakarta.jakartaee-api + 10.0.0 + provided + + + diff --git a/benchmark/persistence/roster/spring/roster-common/src/main/java/spring/tutorial/roster/request/Request.java b/benchmark/persistence/roster/spring/roster-common/src/main/java/spring/tutorial/roster/request/Request.java new file mode 100644 index 0000000000000000000000000000000000000000..ffd2631400cea1d6e8e333fd6a4f057e19268ee2 --- /dev/null +++ b/benchmark/persistence/roster/spring/roster-common/src/main/java/spring/tutorial/roster/request/Request.java @@ -0,0 +1,70 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package spring.tutorial.roster.request; + +import java.util.List; + +import spring.tutorial.roster.util.LeagueDetails; +import spring.tutorial.roster.util.PlayerDetails; +import spring.tutorial.roster.util.TeamDetails; + + +public interface Request { + void addPlayer(String playerId, String teamId); + + void createLeague(LeagueDetails leagueDetails); + + void createPlayer(String id, String name, String position, double salary); + + void createTeamInLeague(TeamDetails teamDetails, String leagueId); + + void dropPlayer(String playerId, String teamId); + + List getAllPlayers(); + + LeagueDetails getLeague(String leagueId); + + List getLeaguesOfPlayer(String playerId); + + PlayerDetails getPlayer(String playerId); + + List getPlayersByCity(String city); + + List getPlayersByHigherSalary(String name); + + List getPlayersByLeagueId(String leagueId); + + List getPlayersByPosition(String position); + + List getPlayersByPositionAndName(String position, String name); + + List getPlayersBySalaryRange(double low, double high); + + List getPlayersBySport(String sport); + + List getPlayersNotOnTeam(); + + List getPlayersOfTeam(String teamId); + + List getSportsOfPlayer(String playerId); + + TeamDetails getTeam(String teamId); + + List getTeamsOfLeague(String leagueId); + + void removeLeague(String leagueId); + + void removePlayer(String playerId); + + void removeTeam(String teamId); + +} diff --git a/benchmark/persistence/roster/spring/roster-common/src/main/java/spring/tutorial/roster/util/IncorrectSportException.java b/benchmark/persistence/roster/spring/roster-common/src/main/java/spring/tutorial/roster/util/IncorrectSportException.java new file mode 100644 index 0000000000000000000000000000000000000000..55c231b09addc0ef4e35be431f09284613da5a82 --- /dev/null +++ b/benchmark/persistence/roster/spring/roster-common/src/main/java/spring/tutorial/roster/util/IncorrectSportException.java @@ -0,0 +1,30 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package spring.tutorial.roster.util; + +public class IncorrectSportException extends java.lang.Exception { + + /** + * Creates a new instance of IncorrectSportException without detail message. + */ + public IncorrectSportException() { + } + + + /** + * Constructs an instance of IncorrectSportException with the specified detail message. + * @param msg the detail message. + */ + public IncorrectSportException(String msg) { + super(msg); + } +} diff --git a/benchmark/persistence/roster/spring/roster-common/src/main/java/spring/tutorial/roster/util/LeagueDetails.java b/benchmark/persistence/roster/spring/roster-common/src/main/java/spring/tutorial/roster/util/LeagueDetails.java new file mode 100644 index 0000000000000000000000000000000000000000..efd47abb5462d8cdd24d98660095ccfb13bff13c --- /dev/null +++ b/benchmark/persistence/roster/spring/roster-common/src/main/java/spring/tutorial/roster/util/LeagueDetails.java @@ -0,0 +1,51 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package spring.tutorial.roster.util; + +import java.io.Serializable; + + +public class LeagueDetails implements Serializable { + private static final long serialVersionUID = 290368886584321980L; + private String id; + private String name; + private String sport; + + public LeagueDetails() { + } + + public LeagueDetails(String id, String name, String sport) { + + this.id = id; + this.name = name; + this.sport = sport; + } + + public String getId() { + return id; + } + + public String getName() { + return name; + } + + public String getSport() { + return sport; + } + + @Override + public String toString() { + String s = id + " " + name + " " + sport; + return s; + } + +} diff --git a/benchmark/persistence/roster/spring/roster-common/src/main/java/spring/tutorial/roster/util/PlayerDetails.java b/benchmark/persistence/roster/spring/roster-common/src/main/java/spring/tutorial/roster/util/PlayerDetails.java new file mode 100644 index 0000000000000000000000000000000000000000..22ff7eb4568f3f59a636807b9ad1b9c1e4f78942 --- /dev/null +++ b/benchmark/persistence/roster/spring/roster-common/src/main/java/spring/tutorial/roster/util/PlayerDetails.java @@ -0,0 +1,58 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package spring.tutorial.roster.util; + +import java.io.Serializable; + +public class PlayerDetails implements Serializable { + private static final long serialVersionUID = -5352446961599198526L; + + private String id; + private String name; + private String position; + private double salary; + + public PlayerDetails() { + } + + public PlayerDetails(String id, String name, String position, + double salary) { + + this.id = id; + this.name = name; + this.position = position; + this.salary = salary; + } + + public String getId() { + return id; + } + + public String getName() { + return name; + } + + public String getPosition() { + return position; + } + + public double getSalary() { + return salary; + } + + @Override + public String toString() { + String s = id + " " + name + " " + position + " " + salary; + return s; + } + +} diff --git a/benchmark/persistence/roster/spring/roster-common/src/main/java/spring/tutorial/roster/util/TeamDetails.java b/benchmark/persistence/roster/spring/roster-common/src/main/java/spring/tutorial/roster/util/TeamDetails.java new file mode 100644 index 0000000000000000000000000000000000000000..3d2818d95d704c9fd14622c8872a2c3c89ce7ff6 --- /dev/null +++ b/benchmark/persistence/roster/spring/roster-common/src/main/java/spring/tutorial/roster/util/TeamDetails.java @@ -0,0 +1,52 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package spring.tutorial.roster.util; + +import java.io.Serializable; + + +public class TeamDetails implements Serializable { + private static final long serialVersionUID = -1618941013515364318L; + private String id; + private String name; + private String city; + + public TeamDetails() { + } + + public TeamDetails(String id, String name, String city) { + + this.id = id; + this.name = name; + this.city = city; + } + + public String getId() { + return id; + } + + public String getName() { + return name; + } + + public String getCity() { + return city; + } + + @Override + public String toString() { + String s = id + " " + name + " " + city; + + return s; + } + +} diff --git a/benchmark/persistence/roster/spring/test.sh b/benchmark/persistence/roster/spring/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..e5b08bda347ec5eb82843556b8e8a3fc82a49cd3 --- /dev/null +++ b/benchmark/persistence/roster/spring/test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +BASE_URL="${BASE_URL:-http://localhost:8080/roster}" + +echo "Health check: ${BASE_URL}" +HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}") + +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "PASS - got HTTP ${HTTP_STATUS}" + exit 0 +else + echo "FAIL - got HTTP ${HTTP_STATUS}" + exit 1 +fi diff --git a/benchmark/presentation/mood/jakarta/src/main/webapp/resources/images/duke.cookies.gif b/benchmark/presentation/mood/jakarta/src/main/webapp/resources/images/duke.cookies.gif new file mode 100644 index 0000000000000000000000000000000000000000..1448bc0f27f43108f97810bfc1d5f772ae229bcd --- /dev/null +++ b/benchmark/presentation/mood/jakarta/src/main/webapp/resources/images/duke.cookies.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:83fd08ec81b796b7b2f990bf2913a716643d111cfced632b386f61e0354d9dd6 +size 3349 diff --git a/benchmark/presentation/mood/jakarta/src/main/webapp/resources/images/duke.handsOnHips.gif b/benchmark/presentation/mood/jakarta/src/main/webapp/resources/images/duke.handsOnHips.gif new file mode 100644 index 0000000000000000000000000000000000000000..5b94561600cb9fac6d0f0e9e4d6fd970291c5d8f --- /dev/null +++ b/benchmark/presentation/mood/jakarta/src/main/webapp/resources/images/duke.handsOnHips.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9ca76b8f825a777b1cd7c2a92684293e16fbb6bef1235e487d215fd7552bf398 +size 2720 diff --git a/benchmark/presentation/mood/jakarta/src/main/webapp/resources/images/duke.pensive.gif b/benchmark/presentation/mood/jakarta/src/main/webapp/resources/images/duke.pensive.gif new file mode 100644 index 0000000000000000000000000000000000000000..7b4f7789dfe3b3aa41537cc754576fe03f582300 --- /dev/null +++ b/benchmark/presentation/mood/jakarta/src/main/webapp/resources/images/duke.pensive.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3c3cee4daf07024c3ff289592026348eb7855c8ad62adbd7a5579e71710cbebe +size 2065 diff --git a/benchmark/presentation/mood/jakarta/src/main/webapp/resources/images/duke.snooze.gif b/benchmark/presentation/mood/jakarta/src/main/webapp/resources/images/duke.snooze.gif new file mode 100644 index 0000000000000000000000000000000000000000..069e89c8fdbd45fda2f4e2ad44ae079f6591d893 --- /dev/null +++ b/benchmark/presentation/mood/jakarta/src/main/webapp/resources/images/duke.snooze.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:83355aca3da1d6a681f3df18c2d04327bfecf39b65231b02900d89c102722cf6 +size 2859 diff --git a/benchmark/presentation/mood/jakarta/src/main/webapp/resources/images/duke.thumbsup.gif b/benchmark/presentation/mood/jakarta/src/main/webapp/resources/images/duke.thumbsup.gif new file mode 100644 index 0000000000000000000000000000000000000000..36a55281b1071d2dc1d90373ca1562f8f23d6767 --- /dev/null +++ b/benchmark/presentation/mood/jakarta/src/main/webapp/resources/images/duke.thumbsup.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:36584aadb24445b77859b7cc6fb4744b1d46c86e528464fa539e6ca2ded72fbf +size 2218 diff --git a/benchmark/presentation/mood/jakarta/src/main/webapp/resources/images/duke.waving.gif b/benchmark/presentation/mood/jakarta/src/main/webapp/resources/images/duke.waving.gif new file mode 100644 index 0000000000000000000000000000000000000000..8c4493f0350eb35c3e0fa43702b1e2b1ff0b8477 --- /dev/null +++ b/benchmark/presentation/mood/jakarta/src/main/webapp/resources/images/duke.waving.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b3a63a2bb41532a2d4a2b1490b4098895a1740e2532dbe9fdc17cf664aa686ee +size 1741 diff --git a/benchmark/presentation/mood/quarkus/src/main/resources/META-INF/resources/images/duke.cookies.gif b/benchmark/presentation/mood/quarkus/src/main/resources/META-INF/resources/images/duke.cookies.gif new file mode 100644 index 0000000000000000000000000000000000000000..1448bc0f27f43108f97810bfc1d5f772ae229bcd --- /dev/null +++ b/benchmark/presentation/mood/quarkus/src/main/resources/META-INF/resources/images/duke.cookies.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:83fd08ec81b796b7b2f990bf2913a716643d111cfced632b386f61e0354d9dd6 +size 3349 diff --git a/benchmark/presentation/mood/quarkus/src/main/resources/META-INF/resources/images/duke.handsOnHips.gif b/benchmark/presentation/mood/quarkus/src/main/resources/META-INF/resources/images/duke.handsOnHips.gif new file mode 100644 index 0000000000000000000000000000000000000000..5b94561600cb9fac6d0f0e9e4d6fd970291c5d8f --- /dev/null +++ b/benchmark/presentation/mood/quarkus/src/main/resources/META-INF/resources/images/duke.handsOnHips.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9ca76b8f825a777b1cd7c2a92684293e16fbb6bef1235e487d215fd7552bf398 +size 2720 diff --git a/benchmark/presentation/mood/quarkus/src/main/resources/META-INF/resources/images/duke.pensive.gif b/benchmark/presentation/mood/quarkus/src/main/resources/META-INF/resources/images/duke.pensive.gif new file mode 100644 index 0000000000000000000000000000000000000000..7b4f7789dfe3b3aa41537cc754576fe03f582300 --- /dev/null +++ b/benchmark/presentation/mood/quarkus/src/main/resources/META-INF/resources/images/duke.pensive.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3c3cee4daf07024c3ff289592026348eb7855c8ad62adbd7a5579e71710cbebe +size 2065 diff --git a/benchmark/presentation/mood/quarkus/src/main/resources/META-INF/resources/images/duke.snooze.gif b/benchmark/presentation/mood/quarkus/src/main/resources/META-INF/resources/images/duke.snooze.gif new file mode 100644 index 0000000000000000000000000000000000000000..069e89c8fdbd45fda2f4e2ad44ae079f6591d893 --- /dev/null +++ b/benchmark/presentation/mood/quarkus/src/main/resources/META-INF/resources/images/duke.snooze.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:83355aca3da1d6a681f3df18c2d04327bfecf39b65231b02900d89c102722cf6 +size 2859 diff --git a/benchmark/presentation/mood/quarkus/src/main/resources/META-INF/resources/images/duke.thumbsup.gif b/benchmark/presentation/mood/quarkus/src/main/resources/META-INF/resources/images/duke.thumbsup.gif new file mode 100644 index 0000000000000000000000000000000000000000..36a55281b1071d2dc1d90373ca1562f8f23d6767 --- /dev/null +++ b/benchmark/presentation/mood/quarkus/src/main/resources/META-INF/resources/images/duke.thumbsup.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:36584aadb24445b77859b7cc6fb4744b1d46c86e528464fa539e6ca2ded72fbf +size 2218 diff --git a/benchmark/presentation/mood/quarkus/src/main/resources/META-INF/resources/images/duke.waving.gif b/benchmark/presentation/mood/quarkus/src/main/resources/META-INF/resources/images/duke.waving.gif new file mode 100644 index 0000000000000000000000000000000000000000..8c4493f0350eb35c3e0fa43702b1e2b1ff0b8477 --- /dev/null +++ b/benchmark/presentation/mood/quarkus/src/main/resources/META-INF/resources/images/duke.waving.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b3a63a2bb41532a2d4a2b1490b4098895a1740e2532dbe9fdc17cf664aa686ee +size 1741 diff --git a/benchmark/presentation/mood/spring/src/main/resources/static/images/duke.cookies.gif b/benchmark/presentation/mood/spring/src/main/resources/static/images/duke.cookies.gif new file mode 100644 index 0000000000000000000000000000000000000000..1448bc0f27f43108f97810bfc1d5f772ae229bcd --- /dev/null +++ b/benchmark/presentation/mood/spring/src/main/resources/static/images/duke.cookies.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:83fd08ec81b796b7b2f990bf2913a716643d111cfced632b386f61e0354d9dd6 +size 3349 diff --git a/benchmark/presentation/mood/spring/src/main/resources/static/images/duke.handsOnHips.gif b/benchmark/presentation/mood/spring/src/main/resources/static/images/duke.handsOnHips.gif new file mode 100644 index 0000000000000000000000000000000000000000..5b94561600cb9fac6d0f0e9e4d6fd970291c5d8f --- /dev/null +++ b/benchmark/presentation/mood/spring/src/main/resources/static/images/duke.handsOnHips.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9ca76b8f825a777b1cd7c2a92684293e16fbb6bef1235e487d215fd7552bf398 +size 2720 diff --git a/benchmark/presentation/mood/spring/src/main/resources/static/images/duke.pensive.gif b/benchmark/presentation/mood/spring/src/main/resources/static/images/duke.pensive.gif new file mode 100644 index 0000000000000000000000000000000000000000..7b4f7789dfe3b3aa41537cc754576fe03f582300 --- /dev/null +++ b/benchmark/presentation/mood/spring/src/main/resources/static/images/duke.pensive.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3c3cee4daf07024c3ff289592026348eb7855c8ad62adbd7a5579e71710cbebe +size 2065 diff --git a/benchmark/presentation/mood/spring/src/main/resources/static/images/duke.snooze.gif b/benchmark/presentation/mood/spring/src/main/resources/static/images/duke.snooze.gif new file mode 100644 index 0000000000000000000000000000000000000000..069e89c8fdbd45fda2f4e2ad44ae079f6591d893 --- /dev/null +++ b/benchmark/presentation/mood/spring/src/main/resources/static/images/duke.snooze.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:83355aca3da1d6a681f3df18c2d04327bfecf39b65231b02900d89c102722cf6 +size 2859 diff --git a/benchmark/presentation/mood/spring/src/main/resources/static/images/duke.thumbsup.gif b/benchmark/presentation/mood/spring/src/main/resources/static/images/duke.thumbsup.gif new file mode 100644 index 0000000000000000000000000000000000000000..36a55281b1071d2dc1d90373ca1562f8f23d6767 --- /dev/null +++ b/benchmark/presentation/mood/spring/src/main/resources/static/images/duke.thumbsup.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:36584aadb24445b77859b7cc6fb4744b1d46c86e528464fa539e6ca2ded72fbf +size 2218 diff --git a/benchmark/presentation/mood/spring/src/main/resources/static/images/duke.waving.gif b/benchmark/presentation/mood/spring/src/main/resources/static/images/duke.waving.gif new file mode 100644 index 0000000000000000000000000000000000000000..8c4493f0350eb35c3e0fa43702b1e2b1ff0b8477 --- /dev/null +++ b/benchmark/presentation/mood/spring/src/main/resources/static/images/duke.waving.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b3a63a2bb41532a2d4a2b1490b4098895a1740e2532dbe9fdc17cf664aa686ee +size 1741 diff --git a/benchmark/presentation/websocketbot/jakarta/.dockerignore b/benchmark/presentation/websocketbot/jakarta/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..c634c57d9244b4e60b8fa936f09dbe4e75706e74 --- /dev/null +++ b/benchmark/presentation/websocketbot/jakarta/.dockerignore @@ -0,0 +1,41 @@ +# VCS +.git/ + +# Maven +.mvn/ +**/.mvn/ +mvnw +mvnw.cmd +**/mvnw +**/mvnw.cmd +target/ +**/target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties + +# IDE / Editor +.vscode/ +**/.vscode/ +.zed/ +**/.zed/ +.idea/ +**/.idea/ +*.iml +*.ipr +*.iws + +# OS +.DS_Store +**/.DS_Store +Thumbs.db +ehthumbs.db + +# Logs / temp +*.log +*.tmp +*.temp diff --git a/benchmark/presentation/websocketbot/jakarta/.mvn/wrapper/maven-wrapper.properties b/benchmark/presentation/websocketbot/jakarta/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..8dea6c227c08000d2400d38a2ac886063f22bc36 --- /dev/null +++ b/benchmark/presentation/websocketbot/jakarta/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,3 @@ +wrapperVersion=3.3.4 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.12/apache-maven-3.9.12-bin.zip diff --git a/benchmark/presentation/websocketbot/jakarta/Dockerfile b/benchmark/presentation/websocketbot/jakarta/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..bb9aafb1cb951a1ab54c776a26843385260532e8 --- /dev/null +++ b/benchmark/presentation/websocketbot/jakarta/Dockerfile @@ -0,0 +1,28 @@ +FROM maven:3.9.12-ibm-semeru-21-noble + +USER root +# install uv +RUN apt-get update && apt-get install -y --no-install-recommends curl python3-venv python3-full && curl -LsSf https://astral.sh/uv/install.sh | sh + +ENV PATH="/root/.local/bin:$PATH" + +# Shared browsers path so Chromium is cached once +ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright +RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright + +# create venv and install +RUN uv venv /opt/venv && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest + +ENV PATH="/opt/venv/bin:$PATH" +RUN playwright install --with-deps chromium + +# Set working directory +WORKDIR /app + +# Copy all the assets +COPY . . + +COPY test.sh . +RUN chmod +x test.sh +RUN mvn clean install -DskipTests +CMD [ "mvn", "liberty:run" ] diff --git a/benchmark/presentation/websocketbot/jakarta/mvnw b/benchmark/presentation/websocketbot/jakarta/mvnw new file mode 100644 index 0000000000000000000000000000000000000000..bd8896bf2217b46faa0291585e01ac1a3441a958 --- /dev/null +++ b/benchmark/presentation/websocketbot/jakarta/mvnw @@ -0,0 +1,295 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.4 +# +# Optional ENV vars +# ----------------- +# JAVA_HOME - location of a JDK home dir, required when download maven via java source +# MVNW_REPOURL - repo url base for downloading maven distribution +# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output +# ---------------------------------------------------------------------------- + +set -euf +[ "${MVNW_VERBOSE-}" != debug ] || set -x + +# OS specific support. +native_path() { printf %s\\n "$1"; } +case "$(uname)" in +CYGWIN* | MINGW*) + [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" + native_path() { cygpath --path --windows "$1"; } + ;; +esac + +# set JAVACMD and JAVACCMD +set_java_home() { + # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched + if [ -n "${JAVA_HOME-}" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACCMD="$JAVA_HOME/jre/sh/javac" + else + JAVACMD="$JAVA_HOME/bin/java" + JAVACCMD="$JAVA_HOME/bin/javac" + + if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then + echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 + echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 + return 1 + fi + fi + else + JAVACMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v java + )" || : + JAVACCMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v javac + )" || : + + if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then + echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 + return 1 + fi + fi +} + +# hash string like Java String::hashCode +hash_string() { + str="${1:-}" h=0 + while [ -n "$str" ]; do + char="${str%"${str#?}"}" + h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) + str="${str#?}" + done + printf %x\\n $h +} + +verbose() { :; } +[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } + +die() { + printf %s\\n "$1" >&2 + exit 1 +} + +trim() { + # MWRAPPER-139: + # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. + # Needed for removing poorly interpreted newline sequences when running in more + # exotic environments such as mingw bash on Windows. + printf "%s" "${1}" | tr -d '[:space:]' +} + +scriptDir="$(dirname "$0")" +scriptName="$(basename "$0")" + +# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties +while IFS="=" read -r key value; do + case "${key-}" in + distributionUrl) distributionUrl=$(trim "${value-}") ;; + distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; + esac +done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" + +case "${distributionUrl##*/}" in +maven-mvnd-*bin.*) + MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ + case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in + *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; + :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; + :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; + :Linux*x86_64*) distributionPlatform=linux-amd64 ;; + *) + echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 + distributionPlatform=linux-amd64 + ;; + esac + distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" + ;; +maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; +*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; +esac + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" +distributionUrlName="${distributionUrl##*/}" +distributionUrlNameMain="${distributionUrlName%.*}" +distributionUrlNameMain="${distributionUrlNameMain%-bin}" +MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" +MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" + +exec_maven() { + unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : + exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" +} + +if [ -d "$MAVEN_HOME" ]; then + verbose "found existing MAVEN_HOME at $MAVEN_HOME" + exec_maven "$@" +fi + +case "${distributionUrl-}" in +*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; +*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; +esac + +# prepare tmp dir +if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then + clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } + trap clean HUP INT TERM EXIT +else + die "cannot create temp dir" +fi + +mkdir -p -- "${MAVEN_HOME%/*}" + +# Download and Install Apache Maven +verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +verbose "Downloading from: $distributionUrl" +verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +# select .zip or .tar.gz +if ! command -v unzip >/dev/null; then + distributionUrl="${distributionUrl%.zip}.tar.gz" + distributionUrlName="${distributionUrl##*/}" +fi + +# verbose opt +__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' +[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v + +# normalize http auth +case "${MVNW_PASSWORD:+has-password}" in +'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; +has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; +esac + +if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then + verbose "Found wget ... using wget" + wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" +elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then + verbose "Found curl ... using curl" + curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" +elif set_java_home; then + verbose "Falling back to use Java to download" + javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" + targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" + cat >"$javaSource" <<-END + public class Downloader extends java.net.Authenticator + { + protected java.net.PasswordAuthentication getPasswordAuthentication() + { + return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); + } + public static void main( String[] args ) throws Exception + { + setDefault( new Downloader() ); + java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); + } + } + END + # For Cygwin/MinGW, switch paths to Windows format before running javac and java + verbose " - Compiling Downloader.java ..." + "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" + verbose " - Running Downloader.java ..." + "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" +fi + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +if [ -n "${distributionSha256Sum-}" ]; then + distributionSha256Result=false + if [ "$MVN_CMD" = mvnd.sh ]; then + echo "Checksum validation is not supported for maven-mvnd." >&2 + echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + elif command -v sha256sum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then + distributionSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $distributionSha256Result = false ]; then + echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 + echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 + exit 1 + fi +fi + +# unzip and move +if command -v unzip >/dev/null; then + unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" +else + tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" +fi + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +actualDistributionDir="" + +# First try the expected directory name (for regular distributions) +if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then + if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then + actualDistributionDir="$distributionUrlNameMain" + fi +fi + +# If not found, search for any directory with the Maven executable (for snapshots) +if [ -z "$actualDistributionDir" ]; then + # enable globbing to iterate over items + set +f + for dir in "$TMP_DOWNLOAD_DIR"/*; do + if [ -d "$dir" ]; then + if [ -f "$dir/bin/$MVN_CMD" ]; then + actualDistributionDir="$(basename "$dir")" + break + fi + fi + done + set -f +fi + +if [ -z "$actualDistributionDir" ]; then + verbose "Contents of $TMP_DOWNLOAD_DIR:" + verbose "$(ls -la "$TMP_DOWNLOAD_DIR")" + die "Could not find Maven distribution directory in extracted archive" +fi + +verbose "Found extracted Maven distribution directory: $actualDistributionDir" +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" + +clean || : +exec_maven "$@" diff --git a/benchmark/presentation/websocketbot/jakarta/mvnw.cmd b/benchmark/presentation/websocketbot/jakarta/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..5761d948924c19571d27b465c519b2e2f9e30351 --- /dev/null +++ b/benchmark/presentation/websocketbot/jakarta/mvnw.cmd @@ -0,0 +1,189 @@ +<# : batch portion +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.4 +@REM +@REM Optional ENV vars +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output +@REM ---------------------------------------------------------------------------- + +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) +) +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> + +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} + +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} + +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' + +$MAVEN_M2_PATH = "$HOME/.m2" +if ($env:MAVEN_USER_HOME) { + $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME" +} + +if (-not (Test-Path -Path $MAVEN_M2_PATH)) { + New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null +} + +$MAVEN_WRAPPER_DISTS = $null +if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) { + $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists" +} else { + $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists" +} + +$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain" +$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" + +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} + +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} + +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} + +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null + +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +$actualDistributionDir = "" + +# First try the expected directory name (for regular distributions) +$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain" +$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD" +if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) { + $actualDistributionDir = $distributionUrlNameMain +} + +# If not found, search for any directory with the Maven executable (for snapshots) +if (!$actualDistributionDir) { + Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object { + $testPath = Join-Path $_.FullName "bin/$MVN_CMD" + if (Test-Path -Path $testPath -PathType Leaf) { + $actualDistributionDir = $_.Name + } + } +} + +if (!$actualDistributionDir) { + Write-Error "Could not find Maven distribution directory in extracted archive" +} + +Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir" +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/benchmark/presentation/websocketbot/jakarta/pom.xml b/benchmark/presentation/websocketbot/jakarta/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..421263a5b7d2f09bf9e2927c99f58348845a665a --- /dev/null +++ b/benchmark/presentation/websocketbot/jakarta/pom.xml @@ -0,0 +1,80 @@ + + + + 4.0.0 + + + jakarta.examples.tutorial + websocketbot + 10-SNAPSHOT + war + + websocketbot + + + 17 + UTF-8 + 3.11.0 + 3.4.0 + 3.10.3 + + + + + jakarta.platform + jakarta.jakartaee-api + 10.0.0 + provided + + + + org.eclipse.persistence + eclipselink + 4.0.2 + provided + + + + + websocketbot-10-SNAPSHOT + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven.compiler.plugin.version} + + ${maven.compiler.release} + + + + org.apache.maven.plugins + maven-war-plugin + ${maven.war.plugin.version} + + false + + + + io.openliberty.tools + liberty-maven-plugin + ${liberty.maven.plugin.version} + + defaultServer + ${project.basedir}/src/main/liberty/config + + + + + diff --git a/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/BotBean.java b/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/BotBean.java new file mode 100644 index 0000000000000000000000000000000000000000..209b2527a784de7cb2a0cf587822380faa5f4fba --- /dev/null +++ b/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/BotBean.java @@ -0,0 +1,49 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.web.websocketbot; + +import java.util.Calendar; +import java.util.GregorianCalendar; + +import jakarta.inject.Named; + +@Named +public class BotBean { + + /* Respond to a message from the chat */ + public String respond(String msg) { + String response; + + /* Remove question marks */ + msg = msg.toLowerCase().replaceAll("\\?", ""); + if (msg.contains("how are you")) { + response = "I'm doing great, thank you!"; + } else if (msg.contains("how old are you")) { + Calendar dukesBirthday = new GregorianCalendar(1995, Calendar.MAY, 23); + Calendar now = GregorianCalendar.getInstance(); + int dukesAge = now.get(Calendar.YEAR) - dukesBirthday.get(Calendar.YEAR); + response = String.format("I'm %d years old.", dukesAge); + } else if (msg.contains("when is your birthday")) { + response = "My birthday is on May 23rd. Thanks for asking!"; + } else if (msg.contains("your favorite color")) { + response = "My favorite color is blue. What's yours?"; + } else { + response = "Sorry, I did not understand what you said. "; + response += "You can ask me how I'm doing today; how old I am; or "; + response += "what my favorite color is."; + } + try { + Thread.sleep(1200); + } catch (InterruptedException ex) { } + return response; + } +} diff --git a/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/BotEndpoint.java b/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/BotEndpoint.java new file mode 100644 index 0000000000000000000000000000000000000000..9c0d48813e7929cd318a1a4b947d543fa3755fe9 --- /dev/null +++ b/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/BotEndpoint.java @@ -0,0 +1,140 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.web.websocketbot; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import jakarta.annotation.Resource; +import jakarta.enterprise.concurrent.ManagedExecutorService; +import jakarta.inject.Inject; +import jakarta.tutorial.web.websocketbot.decoders.MessageDecoder; +import jakarta.tutorial.web.websocketbot.encoders.ChatMessageEncoder; +import jakarta.tutorial.web.websocketbot.encoders.InfoMessageEncoder; +import jakarta.tutorial.web.websocketbot.encoders.JoinMessageEncoder; +import jakarta.tutorial.web.websocketbot.encoders.UsersMessageEncoder; +import jakarta.tutorial.web.websocketbot.messages.ChatMessage; +import jakarta.tutorial.web.websocketbot.messages.InfoMessage; +import jakarta.tutorial.web.websocketbot.messages.JoinMessage; +import jakarta.tutorial.web.websocketbot.messages.Message; +import jakarta.tutorial.web.websocketbot.messages.UsersMessage; +import jakarta.websocket.EncodeException; +import jakarta.websocket.OnClose; +import jakarta.websocket.OnError; +import jakarta.websocket.OnMessage; +import jakarta.websocket.OnOpen; +import jakarta.websocket.Session; +import jakarta.websocket.server.ServerEndpoint; + +/* Websocket endpoint */ +@ServerEndpoint( + value = "/websocketbot", + decoders = { MessageDecoder.class }, + encoders = { JoinMessageEncoder.class, ChatMessageEncoder.class, + InfoMessageEncoder.class, UsersMessageEncoder.class } + ) +/* There is a BotEndpoint instance per connetion */ +public class BotEndpoint { + private static final Logger logger = Logger.getLogger("BotEndpoint"); + /* Bot functionality bean */ + @Inject + private BotBean botbean; + /* Executor service for asynchronous processing */ + @Resource(name="comp/DefaultManagedExecutorService") + private ManagedExecutorService mes; + + @OnOpen + public void openConnection(Session session) { + logger.log(Level.INFO, "Connection opened."); + } + + @OnMessage + public void message(final Session session, Message msg) { + logger.log(Level.INFO, "Received: {0}", msg.toString()); + + if (msg instanceof JoinMessage) { + /* Add the new user and notify everybody */ + JoinMessage jmsg = (JoinMessage) msg; + session.getUserProperties().put("name", jmsg.getName()); + session.getUserProperties().put("active", true); + logger.log(Level.INFO, "Received: {0}", jmsg.toString()); + sendAll(session, new InfoMessage(jmsg.getName() + + " has joined the chat")); + sendAll(session, new ChatMessage("Duke", jmsg.getName(), + "Hi there!!")); + sendAll(session, new UsersMessage(this.getUserList(session))); + + } else if (msg instanceof ChatMessage) { + /* Forward the message to everybody */ + final ChatMessage cmsg = (ChatMessage) msg; + logger.log(Level.INFO, "Received: {0}", cmsg.toString()); + sendAll(session, cmsg); + if (cmsg.getTarget().compareTo("Duke") == 0) { + /* The bot replies to the message */ + mes.submit(new Runnable() { + @Override + public void run() { + String resp = botbean.respond(cmsg.getMessage()); + sendAll(session, new ChatMessage("Duke", + cmsg.getName(), resp)); + } + }); + } + } + } + + @OnClose + public void closedConnection(Session session) { + /* Notify everybody */ + session.getUserProperties().put("active", false); + if (session.getUserProperties().containsKey("name")) { + String name = session.getUserProperties().get("name").toString(); + sendAll(session, new InfoMessage(name + " has left the chat")); + sendAll(session, new UsersMessage(this.getUserList(session))); + } + logger.log(Level.INFO, "Connection closed."); + } + + @OnError + public void error(Session session, Throwable t) { + logger.log(Level.INFO, "Connection error ({0})", t.toString()); + } + + /* Forward a message to all connected clients + * The endpoint figures what encoder to use based on the message type */ + public synchronized void sendAll(Session session, Object msg) { + try { + for (Session s : session.getOpenSessions()) { + if (s.isOpen()) { + s.getBasicRemote().sendObject(msg); + logger.log(Level.INFO, "Sent: {0}", msg.toString()); + } + } + } catch (IOException | EncodeException e) { + logger.log(Level.INFO, e.toString()); + } + } + + /* Returns the list of users from the properties of all open sessions */ + public List getUserList(Session session) { + List users = new ArrayList<>(); + users.add("Duke"); + for (Session s : session.getOpenSessions()) { + if (s.isOpen() && (boolean) s.getUserProperties().get("active")) + users.add(s.getUserProperties().get("name").toString()); + } + return users; + } +} diff --git a/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/decoders/MessageDecoder.java b/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/decoders/MessageDecoder.java new file mode 100644 index 0000000000000000000000000000000000000000..cc661001db34f4abe42be8a8c2b143a1a58843af --- /dev/null +++ b/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/decoders/MessageDecoder.java @@ -0,0 +1,97 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.web.websocketbot.decoders; + +import java.io.StringReader; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import jakarta.json.Json; +import jakarta.json.stream.JsonParser; +import jakarta.tutorial.web.websocketbot.messages.ChatMessage; +import jakarta.tutorial.web.websocketbot.messages.JoinMessage; +import jakarta.tutorial.web.websocketbot.messages.Message; +import jakarta.websocket.DecodeException; +import jakarta.websocket.Decoder; +import jakarta.websocket.EndpointConfig; + +/* Decode a JSON message into a JoinMessage or a ChatMessage. + * For example, the incoming message + * {"type":"chat","name":"Peter","target":"Duke","message":"How are you?"} + * is decoded as (new ChatMessage("Peter", "Duke", "How are you?")) + */ +public class MessageDecoder implements Decoder.Text { + /* Stores the name-value pairs from a JSON message as a Map */ + private Map messageMap; + + @Override + public void init(EndpointConfig ec) { } + + @Override + public void destroy() { } + + /* Create a new Message object if the message can be decoded */ + @Override + public Message decode(String string) throws DecodeException { + Message msg = null; + if (willDecode(string)) { + switch (messageMap.get("type")) { + case "join": + msg = new JoinMessage(messageMap.get("name")); + break; + case "chat": + msg = new ChatMessage(messageMap.get("name"), + messageMap.get("target"), + messageMap.get("message")); + } + } else { + throw new DecodeException(string, "[Message] Can't decode."); + } + return msg; + } + + /* Decode a JSON message into a Map and check if it contains + * all the required fields according to its type. */ + @Override + public boolean willDecode(String string) { + boolean decodes = false; + /* Convert the message into a map */ + messageMap = new HashMap<>(); + JsonParser parser = Json.createParser(new StringReader(string)); + while (parser.hasNext()) { + if (parser.next() == JsonParser.Event.KEY_NAME) { + String key = parser.getString(); + parser.next(); + String value = parser.getString(); + messageMap.put(key, value); + } + } + /* Check the kind of message and if all fields are included */ + Set keys = messageMap.keySet(); + if (keys.contains("type")) { + switch (messageMap.get("type")) { + case "join": + if (keys.contains("name")) + decodes = true; + break; + case "chat": + String[] chatMsgKeys = {"name", "target", "message"}; + if (keys.containsAll(Arrays.asList(chatMsgKeys))) + decodes = true; + break; + } + } + return decodes; + } +} diff --git a/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/encoders/ChatMessageEncoder.java b/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/encoders/ChatMessageEncoder.java new file mode 100644 index 0000000000000000000000000000000000000000..9e621d89bb9def7263a5e82b4315f823239913b6 --- /dev/null +++ b/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/encoders/ChatMessageEncoder.java @@ -0,0 +1,54 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.web.websocketbot.encoders; + +import java.io.StringWriter; + +import jakarta.json.Json; +import jakarta.json.stream.JsonGenerator; +import jakarta.tutorial.web.websocketbot.messages.ChatMessage; +import jakarta.websocket.EncodeException; +import jakarta.websocket.Encoder; +import jakarta.websocket.EndpointConfig; + + +/* Encode a ChatMessage as JSON. + * For example, (new ChatMessage("Peter","Duke","How are you?")) + * is encoded as follows: + * { + * "type": "chat", + * "target": "Duke", + * "message": "How are you?" + * } + */ +public class ChatMessageEncoder implements Encoder.Text { + + @Override + public void init(EndpointConfig ec) { } + + @Override + public void destroy() { } + + @Override + public String encode(ChatMessage chatMessage) throws EncodeException { + StringWriter swriter = new StringWriter(); + try (JsonGenerator jsonGen = Json.createGenerator(swriter)) { + jsonGen.writeStartObject() + .write("type", "chat") + .write("name", chatMessage.getName()) + .write("target", chatMessage.getTarget()) + .write("message", chatMessage.getMessage()) + .writeEnd(); + } + return swriter.toString(); + } +} diff --git a/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/encoders/InfoMessageEncoder.java b/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/encoders/InfoMessageEncoder.java new file mode 100644 index 0000000000000000000000000000000000000000..0b382bc6ca718de53b0f06b0e1effe591ad01be3 --- /dev/null +++ b/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/encoders/InfoMessageEncoder.java @@ -0,0 +1,49 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.web.websocketbot.encoders; + +import java.io.StringWriter; + +import jakarta.json.Json; +import jakarta.json.stream.JsonGenerator; +import jakarta.tutorial.web.websocketbot.messages.InfoMessage; +import jakarta.websocket.EncodeException; +import jakarta.websocket.Encoder; +import jakarta.websocket.EndpointConfig; + +/* Encode an InfoMessage as JSON. + * For example, (new InfoMessage("Peter has joined the chat.")) + * is encoded as follows: + * { + * "type": "info", + * "info": "Peter has joined the chat" + * } + */ +public class InfoMessageEncoder implements Encoder.Text { + @Override + public void init(EndpointConfig ec) { } + + @Override + public void destroy() { } + + @Override + public String encode(InfoMessage joinMessage) throws EncodeException { + StringWriter swriter = new StringWriter(); + try (JsonGenerator jsonGen = Json.createGenerator(swriter)) { + jsonGen.writeStartObject() + .write("type", "info") + .write("info", joinMessage.getInfo()) + .writeEnd(); + } + return swriter.toString(); + } +} diff --git a/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/encoders/JoinMessageEncoder.java b/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/encoders/JoinMessageEncoder.java new file mode 100644 index 0000000000000000000000000000000000000000..2f021afce1bb414ef55415db2550398259395c01 --- /dev/null +++ b/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/encoders/JoinMessageEncoder.java @@ -0,0 +1,49 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.web.websocketbot.encoders; + +import java.io.StringWriter; + +import jakarta.json.Json; +import jakarta.json.stream.JsonGenerator; +import jakarta.tutorial.web.websocketbot.messages.JoinMessage; +import jakarta.websocket.EncodeException; +import jakarta.websocket.Encoder; +import jakarta.websocket.EndpointConfig; + +/* Encode a JoinMessage as JSON. + * For example, (new JoinMessage("Peter")) + * is encoded as follows: + * { + * "type": "join", + * "name": "Peter" + * } + */ +public class JoinMessageEncoder implements Encoder.Text { + @Override + public void init(EndpointConfig ec) { } + + @Override + public void destroy() { } + + @Override + public String encode(JoinMessage joinMessage) throws EncodeException { + StringWriter swriter = new StringWriter(); + try (JsonGenerator jsonGen = Json.createGenerator(swriter)) { + jsonGen.writeStartObject() + .write("type", "join") + .write("name", joinMessage.getName()) + .writeEnd(); + } + return swriter.toString(); + } +} diff --git a/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/encoders/UsersMessageEncoder.java b/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/encoders/UsersMessageEncoder.java new file mode 100644 index 0000000000000000000000000000000000000000..1c0f8fa55a5ad2f6269e3479504853f01cbecd37 --- /dev/null +++ b/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/encoders/UsersMessageEncoder.java @@ -0,0 +1,55 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.web.websocketbot.encoders; + +import java.io.StringWriter; + +import jakarta.json.Json; +import jakarta.json.stream.JsonGenerator; +import jakarta.tutorial.web.websocketbot.messages.UsersMessage; +import jakarta.websocket.EncodeException; +import jakarta.websocket.Encoder; +import jakarta.websocket.EndpointConfig; + +/* Encode a UsersMessage as JSON. + * For example, + * List list = new ArrayList<>(); + * list.add("Peter"); + * list.add("Duke"); + * new UsersMessage(list) + * is encoded as follows: + * { + * "type": "users", + * "userlist": [ "Peter", "Duke" ] + * } + */ +public class UsersMessageEncoder implements Encoder.Text { + @Override + public void init(EndpointConfig ec) { } + + @Override + public void destroy() { } + + @Override + public String encode(UsersMessage usersMessage) throws EncodeException { + StringWriter swriter = new StringWriter(); + try (JsonGenerator jsonGen = Json.createGenerator(swriter)) { + jsonGen.writeStartObject() + .write("type", "users") + .writeStartArray("userlist"); + for (String user : usersMessage.getUserList()) + jsonGen.write(user); + jsonGen.writeEnd().writeEnd(); + } + return swriter.toString(); + } +} diff --git a/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/messages/ChatMessage.java b/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/messages/ChatMessage.java new file mode 100644 index 0000000000000000000000000000000000000000..136d7903c3914eb4db207d362fc31ad576b828ac --- /dev/null +++ b/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/messages/ChatMessage.java @@ -0,0 +1,47 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.web.websocketbot.messages; + +/* Represents a chat message */ +public class ChatMessage extends Message { + private String name; + private String target; + private String message; + + public ChatMessage(String name, String target, String message) { + this.name = name; + this.target = target; + this.message = message; + } + + public String getName() { + return name; + } + + public String getTarget() { + return target; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + /* For logging purposes */ + @Override + public String toString() { + return "[ChatMessage] " + name + "-" + target + "-" + message; + } +} diff --git a/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/messages/InfoMessage.java b/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/messages/InfoMessage.java new file mode 100644 index 0000000000000000000000000000000000000000..e9111a36f598e689625cf9902082c63e6448b58b --- /dev/null +++ b/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/messages/InfoMessage.java @@ -0,0 +1,33 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.web.websocketbot.messages; + +/* Represents an information message, like + * an user entering or leaving the chat */ +public class InfoMessage extends Message { + + private String info; + + public InfoMessage(String info) { + this.info = info; + } + + public String getInfo() { + return info; + } + + /* For logging purposes */ + @Override + public String toString() { + return "[InfoMessage] " + info; + } +} diff --git a/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/messages/JoinMessage.java b/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/messages/JoinMessage.java new file mode 100644 index 0000000000000000000000000000000000000000..053dcd56236fc6eb9de03a949b5f847a0061089b --- /dev/null +++ b/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/messages/JoinMessage.java @@ -0,0 +1,31 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.web.websocketbot.messages; + +/* Represents a join message for the chat */ +public class JoinMessage extends Message { + private String name; + + public JoinMessage(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + /* For logging purposes */ + @Override + public String toString() { + return "[JoinMessage] " + name; + } +} diff --git a/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/messages/Message.java b/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/messages/Message.java new file mode 100644 index 0000000000000000000000000000000000000000..c0e2dfc015c73d911652dcaf24a6f0fa1df3bd02 --- /dev/null +++ b/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/messages/Message.java @@ -0,0 +1,16 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.web.websocketbot.messages; + +public class Message { + +} diff --git a/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/messages/UsersMessage.java b/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/messages/UsersMessage.java new file mode 100644 index 0000000000000000000000000000000000000000..5914179bce75a6958c2c35d87342f857e2ddb858 --- /dev/null +++ b/benchmark/presentation/websocketbot/jakarta/src/main/java/jakarta/tutorial/web/websocketbot/messages/UsersMessage.java @@ -0,0 +1,33 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package jakarta.tutorial.web.websocketbot.messages; + +import java.util.List; + +/* Represents the list of users currently connected to the chat */ +public class UsersMessage extends Message { + private List userlist; + + public UsersMessage(List userlist) { + this.userlist = userlist; + } + + public List getUserList() { + return userlist; + } + + /* For logging purposes */ + @Override + public String toString() { + return "[UsersMessage] " + userlist.toString(); + } +} diff --git a/benchmark/presentation/websocketbot/jakarta/src/main/liberty/config/server.xml b/benchmark/presentation/websocketbot/jakarta/src/main/liberty/config/server.xml new file mode 100644 index 0000000000000000000000000000000000000000..f8fa5ce64c42c1e7df52cb3a2fc928e8402ba6ee --- /dev/null +++ b/benchmark/presentation/websocketbot/jakarta/src/main/liberty/config/server.xml @@ -0,0 +1,12 @@ + + + + jakartaee-10.0 + + + + + + + + diff --git a/benchmark/presentation/websocketbot/jakarta/src/main/resources/.gitkeep b/benchmark/presentation/websocketbot/jakarta/src/main/resources/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/benchmark/presentation/websocketbot/jakarta/src/main/webapp/WEB-INF/beans.xml b/benchmark/presentation/websocketbot/jakarta/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 0000000000000000000000000000000000000000..e47eb991f34f48aabfd7106d2a6ce1d2d4bbad38 --- /dev/null +++ b/benchmark/presentation/websocketbot/jakarta/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,20 @@ + + + + diff --git a/benchmark/presentation/websocketbot/jakarta/src/main/webapp/index.html b/benchmark/presentation/websocketbot/jakarta/src/main/webapp/index.html new file mode 100644 index 0000000000000000000000000000000000000000..eb8358023d20050c9f31f20625c05f7abbebcc2d --- /dev/null +++ b/benchmark/presentation/websocketbot/jakarta/src/main/webapp/index.html @@ -0,0 +1,173 @@ + + + + + WebsocketBot + + + + +

WebsocketBot

+ Your name: +
+
+ + +


+ + Show WebSocket console
+
+ + diff --git a/benchmark/presentation/websocketbot/jakarta/src/main/webapp/resources/css/default.css b/benchmark/presentation/websocketbot/jakarta/src/main/webapp/resources/css/default.css new file mode 100644 index 0000000000000000000000000000000000000000..33a5857014cfcf5cdb54892c9a1b7fb02d5a1ad8 --- /dev/null +++ b/benchmark/presentation/websocketbot/jakarta/src/main/webapp/resources/css/default.css @@ -0,0 +1,40 @@ +/** + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +body { + background-color: #ffffff; + font-size: 12px; + font-family: Verdana, "Verdana CE", Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + color: #000000; + margin: 10px; +} + +h1 { + font-family: Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + border-bottom: 1px solid #AFAFAF; + font-size: 16px; + font-weight: bold; + margin: 0px; + padding: 0px; + color: #D20005; +} + +a:link, a:visited { + color: #045491; + font-weight : bold; + text-decoration: none; +} + +a:link:hover, a:visited:hover { + color: #045491; + font-weight : bold; + text-decoration : underline; +} diff --git a/benchmark/presentation/websocketbot/jakarta/test.sh b/benchmark/presentation/websocketbot/jakarta/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..12bdd9adc8a6e3aec17f087ff1288c4df071d64f --- /dev/null +++ b/benchmark/presentation/websocketbot/jakarta/test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +BASE_URL="${BASE_URL:-http://localhost:9080/websocketbot-10-SNAPSHOT}" + +echo "Health check: ${BASE_URL}" +HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}") + +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "PASS - got HTTP ${HTTP_STATUS}" + exit 0 +else + echo "FAIL - got HTTP ${HTTP_STATUS}" + exit 1 +fi diff --git a/benchmark/presentation/websocketbot/quarkus/.mvn/wrapper/maven-wrapper.properties b/benchmark/presentation/websocketbot/quarkus/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..8dea6c227c08000d2400d38a2ac886063f22bc36 --- /dev/null +++ b/benchmark/presentation/websocketbot/quarkus/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,3 @@ +wrapperVersion=3.3.4 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.12/apache-maven-3.9.12-bin.zip diff --git a/benchmark/presentation/websocketbot/quarkus/README.md b/benchmark/presentation/websocketbot/quarkus/README.md new file mode 100644 index 0000000000000000000000000000000000000000..e4c2697dcb6238bd37c9ad9c52384e303d428860 --- /dev/null +++ b/benchmark/presentation/websocketbot/quarkus/README.md @@ -0,0 +1,62 @@ +# websocket-quarkus + +This project uses Quarkus, the Supersonic Subatomic Java Framework. + +If you want to learn more about Quarkus, please visit its website: . + +## Running the application in dev mode + +You can run your application in dev mode that enables live coding using: + +```shell script +./mvnw quarkus:dev +``` + +> **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at . + +## Packaging and running the application + +The application can be packaged using: + +```shell script +./mvnw package +``` + +It produces the `quarkus-run.jar` file in the `target/quarkus-app/` directory. +Be aware that it’s not an _über-jar_ as the dependencies are copied into the `target/quarkus-app/lib/` directory. + +The application is now runnable using `java -jar target/quarkus-app/quarkus-run.jar`. + +If you want to build an _über-jar_, execute the following command: + +```shell script +./mvnw package -Dquarkus.package.jar.type=uber-jar +``` + +The application, packaged as an _über-jar_, is now runnable using `java -jar target/*-runner.jar`. + +## Creating a native executable + +You can create a native executable using: + +```shell script +./mvnw package -Dnative +``` + +Or, if you don't have GraalVM installed, you can run the native executable build in a container using: + +```shell script +./mvnw package -Dnative -Dquarkus.native.container-build=true +``` + +You can then execute your native executable with: `./target/websocket-quarkus-1.0.0-SNAPSHOT-runner` + +If you want to learn more about building native executables, please consult . + +## Provided Code + +### REST + +Easily start your REST Web Services + +[Related guide section...](https://quarkus.io/guides/getting-started-reactive#reactive-jax-rs-resources) diff --git a/benchmark/presentation/websocketbot/quarkus/mvnw.cmd b/benchmark/presentation/websocketbot/quarkus/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..5761d948924c19571d27b465c519b2e2f9e30351 --- /dev/null +++ b/benchmark/presentation/websocketbot/quarkus/mvnw.cmd @@ -0,0 +1,189 @@ +<# : batch portion +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.4 +@REM +@REM Optional ENV vars +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output +@REM ---------------------------------------------------------------------------- + +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) +) +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> + +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} + +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} + +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' + +$MAVEN_M2_PATH = "$HOME/.m2" +if ($env:MAVEN_USER_HOME) { + $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME" +} + +if (-not (Test-Path -Path $MAVEN_M2_PATH)) { + New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null +} + +$MAVEN_WRAPPER_DISTS = $null +if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) { + $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists" +} else { + $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists" +} + +$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain" +$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" + +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} + +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} + +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} + +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null + +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +$actualDistributionDir = "" + +# First try the expected directory name (for regular distributions) +$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain" +$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD" +if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) { + $actualDistributionDir = $distributionUrlNameMain +} + +# If not found, search for any directory with the Maven executable (for snapshots) +if (!$actualDistributionDir) { + Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object { + $testPath = Join-Path $_.FullName "bin/$MVN_CMD" + if (Test-Path -Path $testPath -PathType Leaf) { + $actualDistributionDir = $_.Name + } + } +} + +if (!$actualDistributionDir) { + Write-Error "Could not find Maven distribution directory in extracted archive" +} + +Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir" +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/benchmark/presentation/websocketbot/quarkus/src/main/java/quarkus/tutorial/websocket/BotBean.java b/benchmark/presentation/websocketbot/quarkus/src/main/java/quarkus/tutorial/websocket/BotBean.java new file mode 100644 index 0000000000000000000000000000000000000000..a1f2216c09624fee6297b25913106c32d9c4d9af --- /dev/null +++ b/benchmark/presentation/websocketbot/quarkus/src/main/java/quarkus/tutorial/websocket/BotBean.java @@ -0,0 +1,38 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * SPDX-License-License: BSD-3-Clause + */ +package quarkus.tutorial.websocket; + +import jakarta.enterprise.context.ApplicationScoped; +import java.util.Calendar; +import java.util.GregorianCalendar; + +@ApplicationScoped +public class BotBean { + + /* Respond to a message from the chat */ + public String respond(String msg) { + String response; + + /* Remove question marks */ + msg = msg.toLowerCase().replaceAll("\\?", ""); + if (msg.contains("how are you")) { + response = "I'm doing great, thank you!"; + } else if (msg.contains("how old are you")) { + Calendar dukesBirthday = new GregorianCalendar(1995, Calendar.MAY, 23); + Calendar now = GregorianCalendar.getInstance(); + int dukesAge = now.get(Calendar.YEAR) - dukesBirthday.get(Calendar.YEAR); + response = String.format("I'm %d years old.", dukesAge); + } else if (msg.contains("when is your birthday")) { + response = "My birthday is on May 23rd. Thanks for asking!"; + } else if (msg.contains("your favorite color")) { + response = "My favorite color is blue. What's yours?"; + } else { + response = "Sorry, I did not understand what you said. "; + response += "You can ask me how I'm doing today; how old I am; or "; + response += "what my favorite color is."; + } + return response; + } +} \ No newline at end of file diff --git a/benchmark/presentation/websocketbot/quarkus/src/main/java/quarkus/tutorial/websocket/BotEndpoint.java b/benchmark/presentation/websocketbot/quarkus/src/main/java/quarkus/tutorial/websocket/BotEndpoint.java new file mode 100644 index 0000000000000000000000000000000000000000..9a5572bfb96f1dbfdb78f975aa173d53a6a22304 --- /dev/null +++ b/benchmark/presentation/websocketbot/quarkus/src/main/java/quarkus/tutorial/websocket/BotEndpoint.java @@ -0,0 +1,139 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * SPDX-License-License: BSD-3-Clause + */ +package quarkus.tutorial.websocket; + +import com.fasterxml.jackson.databind.ObjectMapper; +import jakarta.inject.Inject; +import jakarta.websocket.*; +import jakarta.websocket.server.ServerEndpoint; +import quarkus.tutorial.websocket.messages.ChatMessage; +import quarkus.tutorial.websocket.messages.InfoMessage; +import quarkus.tutorial.websocket.messages.JoinMessage; +import quarkus.tutorial.websocket.messages.Message; +import quarkus.tutorial.websocket.messages.UsersMessage; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; + +@ServerEndpoint("/websocketbot") +public class BotEndpoint { + private static final Logger logger = Logger.getLogger("BotEndpoint"); + + @Inject + BotBean botbean; + + @Inject + ObjectMapper mapper; + + @OnOpen + public void openConnection(Session session) { + logger.log(Level.INFO, "Connection opened."); + } + + @OnMessage + public void message(Session session, String rawMessage) { + try { + // Validate incoming message + if (!willDecode(rawMessage)) { + logger.log(Level.INFO, "Invalid message: {0}", rawMessage); + return; + } + + // Decode incoming message + Message msg = mapper.readValue(rawMessage, Message.class); + logger.log(Level.INFO, "Received: {0}", msg.toString()); + + if (msg instanceof JoinMessage) { + JoinMessage jmsg = (JoinMessage) msg; + session.getUserProperties().put("name", jmsg.getName()); + session.getUserProperties().put("active", true); + sendAll(session, new InfoMessage(jmsg.getName() + " has joined the chat")); + sendAll(session, new ChatMessage("Duke", jmsg.getName(), "Hi there!!")); + sendAll(session, new UsersMessage(getUserList(session))); + + } else if (msg instanceof ChatMessage) { + ChatMessage cmsg = (ChatMessage) msg; + sendAll(session, cmsg); + if (cmsg.getTarget().equals("Duke")) { + String resp = botbean.respond(cmsg.getMessage()); + sendAll(session, new ChatMessage("Duke", cmsg.getName(), resp)); + } + } + } catch (Exception e) { + logger.log(Level.INFO, "Error processing message: {0}", e.toString()); + } + } + + @OnClose + public void closedConnection(Session session) { + session.getUserProperties().put("active", false); + if (session.getUserProperties().containsKey("name")) { + String name = (String) session.getUserProperties().get("name"); + sendAll(session, new InfoMessage(name + " has left the chat")); + sendAll(session, new UsersMessage(getUserList(session))); + } + logger.log(Level.INFO, "Connection closed."); + } + + @OnError + public void error(Session session, Throwable t) { + logger.log(Level.INFO, "Connection error: {0}", t.toString()); + } + + public synchronized void sendAll(Session session, Object msg) { + try { + String json = mapper.writeValueAsString(msg); + for (Session s : session.getOpenSessions()) { + if (s.isOpen()) { + s.getAsyncRemote().sendText(json); + logger.log(Level.INFO, "Sent: {0}", msg.toString()); + } + } + } catch (Exception e) { + logger.log(Level.INFO, "Error sending message: {0}", e.toString()); + } + } + + public List getUserList(Session session) { + List users = new ArrayList<>(); + users.add("Duke"); + for (Session s : session.getOpenSessions()) { + if (s.isOpen() && (boolean) s.getUserProperties().get("active")) { + users.add((String) s.getUserProperties().get("name")); + } + } + return users; + } + + private boolean willDecode(String string) { + try { + // Parse JSON into a Map + Map jsonMap = mapper.readValue(string, Map.class); + Map messageMap = new HashMap<>(); + jsonMap.forEach((key, value) -> messageMap.put(key, String.valueOf(value))); + + // Check required fields based on type + if (!messageMap.containsKey("type")) { + return false; + } + Set keys = messageMap.keySet(); + switch (messageMap.get("type")) { + case "join": + return messageMap.containsKey("name"); + case "chat": + return keys.containsAll(Arrays.asList("name", "target", "message")); + default: + return false; + } + } catch (Exception e) { + return false; + } + } +} \ No newline at end of file diff --git a/benchmark/presentation/websocketbot/quarkus/src/main/java/quarkus/tutorial/websocket/messages/ChatMessage.java b/benchmark/presentation/websocketbot/quarkus/src/main/java/quarkus/tutorial/websocket/messages/ChatMessage.java new file mode 100644 index 0000000000000000000000000000000000000000..945d724c96c880d2aa40a3a82f3ec00371d623a4 --- /dev/null +++ b/benchmark/presentation/websocketbot/quarkus/src/main/java/quarkus/tutorial/websocket/messages/ChatMessage.java @@ -0,0 +1,58 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * SPDX-License-Identifier: BSD-3-Clause + */ +package quarkus.tutorial.websocket.messages; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/* Represents a chat message */ +public class ChatMessage extends Message { + private String name; + private String target; + private String message; + + // No-arg constructor for Jackson + public ChatMessage() { + } + + @JsonCreator + public ChatMessage(@JsonProperty("name") String name, + @JsonProperty("target") String target, + @JsonProperty("message") String message) { + this.name = name; + this.target = target; + this.message = message; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getTarget() { + return target; + } + + public void setTarget(String target) { + this.target = target; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + /* For logging purposes */ + @Override + public String toString() { + return "[ChatMessage] " + name + "-" + target + "-" + message; + } +} \ No newline at end of file diff --git a/benchmark/presentation/websocketbot/quarkus/src/main/java/quarkus/tutorial/websocket/messages/InfoMessage.java b/benchmark/presentation/websocketbot/quarkus/src/main/java/quarkus/tutorial/websocket/messages/InfoMessage.java new file mode 100644 index 0000000000000000000000000000000000000000..cd98838a5516ff5917189df90c5ab6015ba1ed28 --- /dev/null +++ b/benchmark/presentation/websocketbot/quarkus/src/main/java/quarkus/tutorial/websocket/messages/InfoMessage.java @@ -0,0 +1,37 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * SPDX-License-Identifier: BSD-3-Clause + */ +package quarkus.tutorial.websocket.messages; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/* Represents an information message, like + * an user entering or leaving the chat */ +public class InfoMessage extends Message { + private String info; + + // No-arg constructor for Jackson + public InfoMessage() { + } + + @JsonCreator + public InfoMessage(@JsonProperty("info") String info) { + this.info = info; + } + + public String getInfo() { + return info; + } + + public void setInfo(String info) { + this.info = info; + } + + /* For logging purposes */ + @Override + public String toString() { + return "[InfoMessage] " + info; + } +} \ No newline at end of file diff --git a/benchmark/presentation/websocketbot/quarkus/src/main/java/quarkus/tutorial/websocket/messages/JoinMessage.java b/benchmark/presentation/websocketbot/quarkus/src/main/java/quarkus/tutorial/websocket/messages/JoinMessage.java new file mode 100644 index 0000000000000000000000000000000000000000..6eef193874b664f1755dc33170a0fe487da0f9d9 --- /dev/null +++ b/benchmark/presentation/websocketbot/quarkus/src/main/java/quarkus/tutorial/websocket/messages/JoinMessage.java @@ -0,0 +1,36 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * SPDX-License-Identifier: BSD-3-Clause + */ +package quarkus.tutorial.websocket.messages; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/* Represents a join message for the chat */ +public class JoinMessage extends Message { + private String name; + + // No-arg constructor for Jackson + public JoinMessage() { + } + + @JsonCreator + public JoinMessage(@JsonProperty("name") String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /* For logging purposes */ + @Override + public String toString() { + return "[JoinMessage] " + name; + } +} \ No newline at end of file diff --git a/benchmark/presentation/websocketbot/quarkus/src/main/java/quarkus/tutorial/websocket/messages/Message.java b/benchmark/presentation/websocketbot/quarkus/src/main/java/quarkus/tutorial/websocket/messages/Message.java new file mode 100644 index 0000000000000000000000000000000000000000..010f2aa8cfdd1130ae3841eed79dfeeff7120948 --- /dev/null +++ b/benchmark/presentation/websocketbot/quarkus/src/main/java/quarkus/tutorial/websocket/messages/Message.java @@ -0,0 +1,19 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * SPDX-License-Identifier: BSD-3-Clause + */ +package quarkus.tutorial.websocket.messages; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonSubTypes({ + @JsonSubTypes.Type(value = ChatMessage.class, name = "chat"), + @JsonSubTypes.Type(value = JoinMessage.class, name = "join"), + @JsonSubTypes.Type(value = InfoMessage.class, name = "info"), + @JsonSubTypes.Type(value = UsersMessage.class, name = "users") +}) +public abstract class Message { + // No fields or methods; subclasses define specific behavior +} \ No newline at end of file diff --git a/benchmark/presentation/websocketbot/quarkus/src/main/java/quarkus/tutorial/websocket/messages/UsersMessage.java b/benchmark/presentation/websocketbot/quarkus/src/main/java/quarkus/tutorial/websocket/messages/UsersMessage.java new file mode 100644 index 0000000000000000000000000000000000000000..1c9b18aeb7ffc409cfbeeb80559abdf5fd29c9cc --- /dev/null +++ b/benchmark/presentation/websocketbot/quarkus/src/main/java/quarkus/tutorial/websocket/messages/UsersMessage.java @@ -0,0 +1,37 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * SPDX-License-Identifier: BSD-3-Clause + */ +package quarkus.tutorial.websocket.messages; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/* Represents the list of users currently connected to the chat */ +public class UsersMessage extends Message { + private List userlist; + + // No-arg constructor for Jackson + public UsersMessage() { + } + + @JsonCreator + public UsersMessage(@JsonProperty("userlist") List userlist) { + this.userlist = userlist; + } + + public List getUserList() { + return userlist; + } + + public void setUserList(List userlist) { + this.userlist = userlist; + } + + /* For logging purposes */ + @Override + public String toString() { + return "[UsersMessage] " + userlist.toString(); + } +} \ No newline at end of file diff --git a/benchmark/presentation/websocketbot/quarkus/src/main/resources/META-INF/beans.xml b/benchmark/presentation/websocketbot/quarkus/src/main/resources/META-INF/beans.xml new file mode 100644 index 0000000000000000000000000000000000000000..e00acae78c5fd1696fceb0093007e165732d36ae --- /dev/null +++ b/benchmark/presentation/websocketbot/quarkus/src/main/resources/META-INF/beans.xml @@ -0,0 +1,11 @@ + + + + \ No newline at end of file diff --git a/benchmark/presentation/websocketbot/quarkus/src/main/resources/META-INF/resources/index.html b/benchmark/presentation/websocketbot/quarkus/src/main/resources/META-INF/resources/index.html new file mode 100644 index 0000000000000000000000000000000000000000..9a5b26c4768a93fbc0aaf418cd9a8f944318d69d --- /dev/null +++ b/benchmark/presentation/websocketbot/quarkus/src/main/resources/META-INF/resources/index.html @@ -0,0 +1,164 @@ + + + + + WebsocketBot + + + + +

WebsocketBot

+ Your name: +
+
+ + +


+ + Show WebSocket console
+
+ + \ No newline at end of file diff --git a/benchmark/presentation/websocketbot/quarkus/src/main/resources/META-INF/resources/resources/css/default.css b/benchmark/presentation/websocketbot/quarkus/src/main/resources/META-INF/resources/resources/css/default.css new file mode 100644 index 0000000000000000000000000000000000000000..33a5857014cfcf5cdb54892c9a1b7fb02d5a1ad8 --- /dev/null +++ b/benchmark/presentation/websocketbot/quarkus/src/main/resources/META-INF/resources/resources/css/default.css @@ -0,0 +1,40 @@ +/** + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +body { + background-color: #ffffff; + font-size: 12px; + font-family: Verdana, "Verdana CE", Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + color: #000000; + margin: 10px; +} + +h1 { + font-family: Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + border-bottom: 1px solid #AFAFAF; + font-size: 16px; + font-weight: bold; + margin: 0px; + padding: 0px; + color: #D20005; +} + +a:link, a:visited { + color: #045491; + font-weight : bold; + text-decoration: none; +} + +a:link:hover, a:visited:hover { + color: #045491; + font-weight : bold; + text-decoration : underline; +} diff --git a/benchmark/presentation/websocketbot/quarkus/src/main/resources/application.properties b/benchmark/presentation/websocketbot/quarkus/src/main/resources/application.properties new file mode 100644 index 0000000000000000000000000000000000000000..452e88563a8d5bee25d09f79c77db432cda58033 --- /dev/null +++ b/benchmark/presentation/websocketbot/quarkus/src/main/resources/application.properties @@ -0,0 +1,2 @@ +quarkus.http.port=8080 +quarkus.log.level=INFO \ No newline at end of file diff --git a/benchmark/presentation/websocketbot/spring/.dockerignore b/benchmark/presentation/websocketbot/spring/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..c634c57d9244b4e60b8fa936f09dbe4e75706e74 --- /dev/null +++ b/benchmark/presentation/websocketbot/spring/.dockerignore @@ -0,0 +1,41 @@ +# VCS +.git/ + +# Maven +.mvn/ +**/.mvn/ +mvnw +mvnw.cmd +**/mvnw +**/mvnw.cmd +target/ +**/target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties + +# IDE / Editor +.vscode/ +**/.vscode/ +.zed/ +**/.zed/ +.idea/ +**/.idea/ +*.iml +*.ipr +*.iws + +# OS +.DS_Store +**/.DS_Store +Thumbs.db +ehthumbs.db + +# Logs / temp +*.log +*.tmp +*.temp diff --git a/benchmark/presentation/websocketbot/spring/.mvn/wrapper/maven-wrapper.properties b/benchmark/presentation/websocketbot/spring/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..8dea6c227c08000d2400d38a2ac886063f22bc36 --- /dev/null +++ b/benchmark/presentation/websocketbot/spring/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,3 @@ +wrapperVersion=3.3.4 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.12/apache-maven-3.9.12-bin.zip diff --git a/benchmark/presentation/websocketbot/spring/Dockerfile b/benchmark/presentation/websocketbot/spring/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..57e175bfb6aea19c77e95e82697b83253c1d3191 --- /dev/null +++ b/benchmark/presentation/websocketbot/spring/Dockerfile @@ -0,0 +1,31 @@ +FROM maven:3.9.12-ibm-semeru-21-noble + +USER root +# install uv +RUN apt-get update && apt-get install -y --no-install-recommends curl python3-venv python3-full && curl -LsSf https://astral.sh/uv/install.sh | sh + +ENV PATH="/root/.local/bin:$PATH" + +# Shared browsers path so Chromium is cached once +ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright +RUN mkdir -p /ms-playwright && chmod 755 /ms-playwright + +# create venv and install +RUN uv venv /opt/venv && uv pip install --python /opt/venv/bin/python playwright==1.47.0 pytest + +ENV PATH="/opt/venv/bin:$PATH" +RUN playwright install --with-deps chromium + +# Set working directory +WORKDIR /app + +# Copy all the assets +COPY . . + +COPY test.sh . +RUN chmod +x test.sh + +# Build application at image build time +RUN mvn clean install -DskipTests + +CMD ["mvn", "spring-boot:run"] diff --git a/benchmark/presentation/websocketbot/spring/mvnw b/benchmark/presentation/websocketbot/spring/mvnw new file mode 100644 index 0000000000000000000000000000000000000000..bd8896bf2217b46faa0291585e01ac1a3441a958 --- /dev/null +++ b/benchmark/presentation/websocketbot/spring/mvnw @@ -0,0 +1,295 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.4 +# +# Optional ENV vars +# ----------------- +# JAVA_HOME - location of a JDK home dir, required when download maven via java source +# MVNW_REPOURL - repo url base for downloading maven distribution +# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output +# ---------------------------------------------------------------------------- + +set -euf +[ "${MVNW_VERBOSE-}" != debug ] || set -x + +# OS specific support. +native_path() { printf %s\\n "$1"; } +case "$(uname)" in +CYGWIN* | MINGW*) + [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" + native_path() { cygpath --path --windows "$1"; } + ;; +esac + +# set JAVACMD and JAVACCMD +set_java_home() { + # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched + if [ -n "${JAVA_HOME-}" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACCMD="$JAVA_HOME/jre/sh/javac" + else + JAVACMD="$JAVA_HOME/bin/java" + JAVACCMD="$JAVA_HOME/bin/javac" + + if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then + echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 + echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 + return 1 + fi + fi + else + JAVACMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v java + )" || : + JAVACCMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v javac + )" || : + + if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then + echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 + return 1 + fi + fi +} + +# hash string like Java String::hashCode +hash_string() { + str="${1:-}" h=0 + while [ -n "$str" ]; do + char="${str%"${str#?}"}" + h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) + str="${str#?}" + done + printf %x\\n $h +} + +verbose() { :; } +[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } + +die() { + printf %s\\n "$1" >&2 + exit 1 +} + +trim() { + # MWRAPPER-139: + # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. + # Needed for removing poorly interpreted newline sequences when running in more + # exotic environments such as mingw bash on Windows. + printf "%s" "${1}" | tr -d '[:space:]' +} + +scriptDir="$(dirname "$0")" +scriptName="$(basename "$0")" + +# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties +while IFS="=" read -r key value; do + case "${key-}" in + distributionUrl) distributionUrl=$(trim "${value-}") ;; + distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; + esac +done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" + +case "${distributionUrl##*/}" in +maven-mvnd-*bin.*) + MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ + case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in + *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; + :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; + :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; + :Linux*x86_64*) distributionPlatform=linux-amd64 ;; + *) + echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 + distributionPlatform=linux-amd64 + ;; + esac + distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" + ;; +maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; +*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; +esac + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" +distributionUrlName="${distributionUrl##*/}" +distributionUrlNameMain="${distributionUrlName%.*}" +distributionUrlNameMain="${distributionUrlNameMain%-bin}" +MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" +MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" + +exec_maven() { + unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : + exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" +} + +if [ -d "$MAVEN_HOME" ]; then + verbose "found existing MAVEN_HOME at $MAVEN_HOME" + exec_maven "$@" +fi + +case "${distributionUrl-}" in +*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; +*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; +esac + +# prepare tmp dir +if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then + clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } + trap clean HUP INT TERM EXIT +else + die "cannot create temp dir" +fi + +mkdir -p -- "${MAVEN_HOME%/*}" + +# Download and Install Apache Maven +verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +verbose "Downloading from: $distributionUrl" +verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +# select .zip or .tar.gz +if ! command -v unzip >/dev/null; then + distributionUrl="${distributionUrl%.zip}.tar.gz" + distributionUrlName="${distributionUrl##*/}" +fi + +# verbose opt +__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' +[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v + +# normalize http auth +case "${MVNW_PASSWORD:+has-password}" in +'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; +has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; +esac + +if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then + verbose "Found wget ... using wget" + wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" +elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then + verbose "Found curl ... using curl" + curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" +elif set_java_home; then + verbose "Falling back to use Java to download" + javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" + targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" + cat >"$javaSource" <<-END + public class Downloader extends java.net.Authenticator + { + protected java.net.PasswordAuthentication getPasswordAuthentication() + { + return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); + } + public static void main( String[] args ) throws Exception + { + setDefault( new Downloader() ); + java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); + } + } + END + # For Cygwin/MinGW, switch paths to Windows format before running javac and java + verbose " - Compiling Downloader.java ..." + "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" + verbose " - Running Downloader.java ..." + "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" +fi + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +if [ -n "${distributionSha256Sum-}" ]; then + distributionSha256Result=false + if [ "$MVN_CMD" = mvnd.sh ]; then + echo "Checksum validation is not supported for maven-mvnd." >&2 + echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + elif command -v sha256sum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then + distributionSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $distributionSha256Result = false ]; then + echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 + echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 + exit 1 + fi +fi + +# unzip and move +if command -v unzip >/dev/null; then + unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" +else + tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" +fi + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +actualDistributionDir="" + +# First try the expected directory name (for regular distributions) +if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then + if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then + actualDistributionDir="$distributionUrlNameMain" + fi +fi + +# If not found, search for any directory with the Maven executable (for snapshots) +if [ -z "$actualDistributionDir" ]; then + # enable globbing to iterate over items + set +f + for dir in "$TMP_DOWNLOAD_DIR"/*; do + if [ -d "$dir" ]; then + if [ -f "$dir/bin/$MVN_CMD" ]; then + actualDistributionDir="$(basename "$dir")" + break + fi + fi + done + set -f +fi + +if [ -z "$actualDistributionDir" ]; then + verbose "Contents of $TMP_DOWNLOAD_DIR:" + verbose "$(ls -la "$TMP_DOWNLOAD_DIR")" + die "Could not find Maven distribution directory in extracted archive" +fi + +verbose "Found extracted Maven distribution directory: $actualDistributionDir" +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" + +clean || : +exec_maven "$@" diff --git a/benchmark/presentation/websocketbot/spring/mvnw.cmd b/benchmark/presentation/websocketbot/spring/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..5761d948924c19571d27b465c519b2e2f9e30351 --- /dev/null +++ b/benchmark/presentation/websocketbot/spring/mvnw.cmd @@ -0,0 +1,189 @@ +<# : batch portion +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.4 +@REM +@REM Optional ENV vars +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output +@REM ---------------------------------------------------------------------------- + +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) +) +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> + +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} + +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} + +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' + +$MAVEN_M2_PATH = "$HOME/.m2" +if ($env:MAVEN_USER_HOME) { + $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME" +} + +if (-not (Test-Path -Path $MAVEN_M2_PATH)) { + New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null +} + +$MAVEN_WRAPPER_DISTS = $null +if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) { + $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists" +} else { + $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists" +} + +$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain" +$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" + +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} + +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} + +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} + +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null + +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +$actualDistributionDir = "" + +# First try the expected directory name (for regular distributions) +$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain" +$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD" +if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) { + $actualDistributionDir = $distributionUrlNameMain +} + +# If not found, search for any directory with the Maven executable (for snapshots) +if (!$actualDistributionDir) { + Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object { + $testPath = Join-Path $_.FullName "bin/$MVN_CMD" + if (Test-Path -Path $testPath -PathType Leaf) { + $actualDistributionDir = $_.Name + } + } +} + +if (!$actualDistributionDir) { + Write-Error "Could not find Maven distribution directory in extracted archive" +} + +Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir" +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/benchmark/presentation/websocketbot/spring/pom.xml b/benchmark/presentation/websocketbot/spring/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..5b442b82882950e5ab6b0c4dbee2c473ec618338 --- /dev/null +++ b/benchmark/presentation/websocketbot/spring/pom.xml @@ -0,0 +1,83 @@ + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.3.0 + + + + spring.tutorial.web + websocketbot + 1.0.0 + jar + + 17 + 17 + 17 + UTF-8 + + + + + org.springframework + spring-websocket + 6.2.12 + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-websocket + + + + org.apache.tomcat.embed + tomcat-embed-websocket + + + + com.fasterxml.jackson.core + jackson-databind + + + + org.springframework.boot + spring-boot-starter-test + test + + + + jakarta.json + jakarta.json-api + 2.1.3 + + + + org.glassfish.tyrus.bundles + tyrus-standalone-client + 2.1.4 + test + + + + org.eclipse.parsson + parsson + 1.1.7 + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + diff --git a/benchmark/presentation/websocketbot/spring/simple_test.py b/benchmark/presentation/websocketbot/spring/simple_test.py new file mode 100644 index 0000000000000000000000000000000000000000..08c4f0887a9676e34413df4c37bfaca2c1b2d230 --- /dev/null +++ b/benchmark/presentation/websocketbot/spring/simple_test.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python3 +""" +Simple WebSocket test to debug connection issues +""" +import socket +import base64 +import os +from urllib.parse import urlparse + +def test_websocket_connection(): + """Test basic WebSocket connection""" + url = "ws://localhost:8080/websocketbot" + pu = urlparse(url) + host = pu.hostname + port = pu.port or 80 + path = pu.path or "/" + + print(f"Connecting to {host}:{port}{path}") + + # Create socket connection + sock = socket.create_connection((host, port), timeout=10) + print("TCP connection established") + + # WebSocket handshake + key = base64.b64encode(os.urandom(16)).decode() + headers = [ + f"GET {path} HTTP/1.1", + f"Host: {host}:{port}", + "Upgrade: websocket", + "Connection: Upgrade", + f"Sec-WebSocket-Key: {key}", + "Sec-WebSocket-Version: 13", + "", + "" + ] + + handshake = "\r\n".join(headers) + print(f"Sending handshake:\n{handshake}") + sock.sendall(handshake.encode()) + + # Read response + response = b"" + while b"\r\n\r\n" not in response: + chunk = sock.recv(4096) + if not chunk: + break + response += chunk + print(f"Received chunk: {chunk}") + + header, leftover = response.split(b"\r\n\r\n", 1) + print(f"Response header: {header.decode()}") + + if b" 101 " in header: + print("WebSocket handshake successful!") + print(f"Leftover data: {leftover}") + + # Try to send a simple message + join_msg = '{"type": "join", "name": "TestUser"}' + print(f"Sending message: {join_msg}") + + # Simple WebSocket frame + payload = join_msg.encode('utf-8') + length = len(payload) + header = bytes([0x81, length]) + payload + sock.sendall(header) + + # Try to read response + sock.settimeout(5) + try: + response = sock.recv(4096) + print(f"Received response: {response}") + except socket.timeout: + print("No response received") + except Exception as e: + print(f"Error reading response: {e}") + + else: + print("WebSocket handshake failed!") + print(f"Response: {header.decode()}") + + sock.close() + print("Connection closed") + +if __name__ == "__main__": + test_websocket_connection() diff --git a/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/BotEndpoint.java b/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/BotEndpoint.java new file mode 100644 index 0000000000000000000000000000000000000000..bbf8e1dd123317ce0a31e544f7986ffb447c21d6 --- /dev/null +++ b/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/BotEndpoint.java @@ -0,0 +1,151 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package spring.tutorial.web.websocketbot; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.Executor; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.springframework.beans.factory.annotation.Autowired; + +import jakarta.websocket.EncodeException; +import jakarta.websocket.OnClose; +import jakarta.websocket.OnError; +import jakarta.websocket.OnMessage; +import jakarta.websocket.OnOpen; +import jakarta.websocket.Session; +import jakarta.websocket.server.ServerEndpoint; + +import spring.tutorial.web.websocketbot.config.SpringEndpointConfigurator; +import spring.tutorial.web.websocketbot.decoders.MessageDecoder; +import spring.tutorial.web.websocketbot.encoders.ChatMessageEncoder; +import spring.tutorial.web.websocketbot.encoders.InfoMessageEncoder; +import spring.tutorial.web.websocketbot.encoders.JoinMessageEncoder; +import spring.tutorial.web.websocketbot.encoders.UsersMessageEncoder; +import spring.tutorial.web.websocketbot.messages.ChatMessage; +import spring.tutorial.web.websocketbot.messages.InfoMessage; +import spring.tutorial.web.websocketbot.messages.JoinMessage; +import spring.tutorial.web.websocketbot.messages.Message; +import spring.tutorial.web.websocketbot.messages.UsersMessage; +import spring.tutorial.web.websocketbot.service.BotService; +import org.springframework.stereotype.Component; + + +@Component +@ServerEndpoint( + value = "/websocketbot", + decoders = { MessageDecoder.class }, + encoders = { JoinMessageEncoder.class, ChatMessageEncoder.class, + InfoMessageEncoder.class, UsersMessageEncoder.class }, + configurator = SpringEndpointConfigurator.class +) +public class BotEndpoint { + private static final Logger logger = Logger.getLogger("BotEndpoint"); + + @Autowired + private BotService botbean; + + @Autowired + private Executor executor; + + @OnOpen + public void openConnection(Session session) { + logger.log(Level.INFO, "Connection opened."); + } + + @OnMessage + public void message(final Session session, Message msg) { + logger.log(Level.INFO, "Received: {0}", msg.toString()); + + if (msg instanceof JoinMessage) { + JoinMessage jmsg = (JoinMessage) msg; + session.getUserProperties().put("name", jmsg.getName()); + session.getUserProperties().put("active", true); + logger.log(Level.INFO, "Received: {0}", jmsg.toString()); + sendAll(session, new InfoMessage(jmsg.getName() + + " has joined the chat")); + sendAll(session, new ChatMessage("Duke", jmsg.getName(), + "Hi there!!")); + sendAll(session, new UsersMessage(this.getUserList(session))); + + } else if (msg instanceof ChatMessage) { + final ChatMessage cmsg = (ChatMessage) msg; + logger.log(Level.INFO, "Received: {0}", cmsg.toString()); + sendAll(session, cmsg); + if (cmsg.getTarget().compareTo("Duke") == 0) { + executor.execute(new Runnable() { + @Override + public void run() { + String resp = botbean.respond(cmsg.getMessage()); + sendAll(session, new ChatMessage("Duke", + cmsg.getName(), resp)); + } + }); + } + } + } + + @OnClose + public void closedConnection(Session session) { + session.getUserProperties().put("active", false); + if (session.getUserProperties().containsKey("name")) { + String name = session.getUserProperties().get("name").toString(); + sendAllExcept(session, new InfoMessage(name + " has left the chat")); + sendAllExcept(session, new UsersMessage(this.getUserList(session))); + } + logger.log(Level.INFO, "Connection closed."); + } + + @OnError + public void error(Session session, Throwable t) { + logger.log(Level.INFO, "Connection error ({0})", t.toString()); + } + + public synchronized void sendAll(Session session, Object msg) { + try { + for (Session s : session.getOpenSessions()) { + if (s.isOpen()) { + s.getBasicRemote().sendObject(msg); + logger.log(Level.INFO, "Sent: {0}", msg.toString()); + } + } + } catch (IllegalStateException | IOException | EncodeException e) { + logger.log(Level.INFO, e.toString()); + } + } + + private synchronized void sendAllExcept(Session exclude, Object msg) { + for (Session s : exclude.getOpenSessions()) { + if (!s.isOpen() || s.equals(exclude)) + continue; + try { + s.getBasicRemote().sendObject(msg); + logger.log(Level.INFO, "Sent: {0}", msg.toString()); + } catch (IllegalStateException | IOException | EncodeException e) { + logger.log(Level.INFO, e.toString()); + } + } + } + + public List getUserList(Session session) { + List users = new ArrayList<>(); + users.add("Duke"); + for (Session s : session.getOpenSessions()) { + if (s.isOpen() && Boolean.TRUE.equals(s.getUserProperties().get("active"))) + users.add(s.getUserProperties().get("name").toString()); + } + return users; + } +} diff --git a/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/WebsocketBotApplication.java b/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/WebsocketBotApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..1814845eeca40a74eb99272714f5dc13fa4061ee --- /dev/null +++ b/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/WebsocketBotApplication.java @@ -0,0 +1,29 @@ +package spring.tutorial.web.websocketbot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.web.socket.config.annotation.EnableWebSocket; +import org.springframework.web.socket.server.standard.ServerEndpointExporter; +import java.util.concurrent.Executors; +import java.util.concurrent.Executor; + +@SpringBootApplication +@EnableWebSocket +public class WebsocketBotApplication { + public static void main(String[] args) { + SpringApplication.run(WebsocketBotApplication.class, args); + } + + @Bean + public ServerEndpointExporter serverEndpointExporter() { + return new ServerEndpointExporter(); + } + + @Bean + public Executor websocketBotExecutor() { + return Executors.newCachedThreadPool(); + } + + +} diff --git a/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/config/SpringEndpointConfigurator.java b/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/config/SpringEndpointConfigurator.java new file mode 100644 index 0000000000000000000000000000000000000000..041edd7a755feee3c5c965dc3342930e31a4f150 --- /dev/null +++ b/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/config/SpringEndpointConfigurator.java @@ -0,0 +1,24 @@ +package spring.tutorial.web.websocketbot.config; + +import jakarta.websocket.server.ServerEndpointConfig; +import org.springframework.beans.factory.config.AutowireCapableBeanFactory; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + +@Component +public class SpringEndpointConfigurator extends ServerEndpointConfig.Configurator + implements ApplicationContextAware { + + private static AutowireCapableBeanFactory beanFactory; + + @Override + public void setApplicationContext(ApplicationContext ctx) { + beanFactory = ctx.getAutowireCapableBeanFactory(); + } + + @Override + public T getEndpointInstance(Class clazz) { + return beanFactory.createBean(clazz); + } +} diff --git a/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/decoders/MessageDecoder.java b/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/decoders/MessageDecoder.java new file mode 100644 index 0000000000000000000000000000000000000000..61bea75ba2ee3890ace30d2b942b6be433f4fda7 --- /dev/null +++ b/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/decoders/MessageDecoder.java @@ -0,0 +1,97 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package spring.tutorial.web.websocketbot.decoders; + +import java.io.StringReader; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import jakarta.json.Json; +import jakarta.json.stream.JsonParser; +import spring.tutorial.web.websocketbot.messages.ChatMessage; +import spring.tutorial.web.websocketbot.messages.JoinMessage; +import spring.tutorial.web.websocketbot.messages.Message; +import jakarta.websocket.DecodeException; +import jakarta.websocket.Decoder; +import jakarta.websocket.EndpointConfig; + +/* Decode a JSON message into a JoinMessage or a ChatMessage. + * For example, the incoming message + * {"type":"chat","name":"Peter","target":"Duke","message":"How are you?"} + * is decoded as (new ChatMessage("Peter", "Duke", "How are you?")) + */ +public class MessageDecoder implements Decoder.Text { + /* Stores the name-value pairs from a JSON message as a Map */ + private Map messageMap; + + @Override + public void init(EndpointConfig ec) { } + + @Override + public void destroy() { } + + /* Create a new Message object if the message can be decoded */ + @Override + public Message decode(String string) throws DecodeException { + Message msg = null; + if (willDecode(string)) { + switch (messageMap.get("type")) { + case "join": + msg = new JoinMessage(messageMap.get("name")); + break; + case "chat": + msg = new ChatMessage(messageMap.get("name"), + messageMap.get("target"), + messageMap.get("message")); + } + } else { + throw new DecodeException(string, "[Message] Can't decode."); + } + return msg; + } + + /* Decode a JSON message into a Map and check if it contains + * all the required fields according to its type. */ + @Override + public boolean willDecode(String string) { + boolean decodes = false; + /* Convert the message into a map */ + messageMap = new HashMap<>(); + JsonParser parser = Json.createParser(new StringReader(string)); + while (parser.hasNext()) { + if (parser.next() == JsonParser.Event.KEY_NAME) { + String key = parser.getString(); + parser.next(); + String value = parser.getString(); + messageMap.put(key, value); + } + } + /* Check the kind of message and if all fields are included */ + Set keys = messageMap.keySet(); + if (keys.contains("type")) { + switch (messageMap.get("type")) { + case "join": + if (keys.contains("name")) + decodes = true; + break; + case "chat": + String[] chatMsgKeys = {"name", "target", "message"}; + if (keys.containsAll(Arrays.asList(chatMsgKeys))) + decodes = true; + break; + } + } + return decodes; + } +} diff --git a/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/encoders/ChatMessageEncoder.java b/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/encoders/ChatMessageEncoder.java new file mode 100644 index 0000000000000000000000000000000000000000..6a88447cfa521a32cc2c854e2117bad0a2ac56be --- /dev/null +++ b/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/encoders/ChatMessageEncoder.java @@ -0,0 +1,57 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package spring.tutorial.web.websocketbot.encoders; + +import java.io.StringWriter; + +import jakarta.json.Json; +import jakarta.json.stream.JsonGenerator; +import spring.tutorial.web.websocketbot.messages.ChatMessage; +import jakarta.websocket.EncodeException; +import jakarta.websocket.Encoder; +import jakarta.websocket.EndpointConfig; + + +/* Encode a ChatMessage as JSON. + * For example, (new ChatMessage("Peter","Duke","How are you?")) + * is encoded as follows: + * { + * "type": "chat", + * "target": "Duke", + * "message": "How are you?" + * } + */ +public class ChatMessageEncoder implements Encoder.Text { + + @Override + public void init(EndpointConfig ec) { } + + @Override + public void destroy() { } + + @Override + public String encode(ChatMessage chatMessage) throws EncodeException { + StringWriter swriter = new StringWriter(); + try (JsonGenerator jsonGen = Json.createGenerator(swriter)) { + jsonGen.writeStartObject() + .write("type", "chat") + .write("name", chatMessage.getName()) + .write("target", chatMessage.getTarget()) + .write("message", chatMessage.getMessage()) + .writeEnd(); + }catch (Exception e) { + e.printStackTrace(); + throw new EncodeException(chatMessage, "Encoding failed", e); + } + return swriter.toString(); + } +} diff --git a/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/encoders/InfoMessageEncoder.java b/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/encoders/InfoMessageEncoder.java new file mode 100644 index 0000000000000000000000000000000000000000..f4507c2e360f6cdf399763206842636c04e98d58 --- /dev/null +++ b/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/encoders/InfoMessageEncoder.java @@ -0,0 +1,52 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package spring.tutorial.web.websocketbot.encoders; + +import java.io.StringWriter; + +import jakarta.json.Json; +import jakarta.json.stream.JsonGenerator; +import spring.tutorial.web.websocketbot.messages.InfoMessage; +import jakarta.websocket.EncodeException; +import jakarta.websocket.Encoder; +import jakarta.websocket.EndpointConfig; + +/* Encode an InfoMessage as JSON. + * For example, (new InfoMessage("Peter has joined the chat.")) + * is encoded as follows: + * { + * "type": "info", + * "info": "Peter has joined the chat" + * } + */ +public class InfoMessageEncoder implements Encoder.Text { + @Override + public void init(EndpointConfig ec) { } + + @Override + public void destroy() { } + + @Override + public String encode(InfoMessage joinMessage) throws EncodeException { + StringWriter swriter = new StringWriter(); + try (JsonGenerator jsonGen = Json.createGenerator(swriter)) { + jsonGen.writeStartObject() + .write("type", "info") + .write("info", joinMessage.getInfo()) + .writeEnd(); + }catch (Exception e) { + e.printStackTrace(); + throw new EncodeException(joinMessage, "Encoding failed", e); + } + return swriter.toString(); + } +} diff --git a/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/encoders/JoinMessageEncoder.java b/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/encoders/JoinMessageEncoder.java new file mode 100644 index 0000000000000000000000000000000000000000..7b8824a7a7365170422dc0507da2b5860c40406a --- /dev/null +++ b/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/encoders/JoinMessageEncoder.java @@ -0,0 +1,52 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package spring.tutorial.web.websocketbot.encoders; + +import java.io.StringWriter; + +import jakarta.json.Json; +import jakarta.json.stream.JsonGenerator; +import spring.tutorial.web.websocketbot.messages.JoinMessage; +import jakarta.websocket.EncodeException; +import jakarta.websocket.Encoder; +import jakarta.websocket.EndpointConfig; + +/* Encode a JoinMessage as JSON. + * For example, (new JoinMessage("Peter")) + * is encoded as follows: + * { + * "type": "join", + * "name": "Peter" + * } + */ +public class JoinMessageEncoder implements Encoder.Text { + @Override + public void init(EndpointConfig ec) { } + + @Override + public void destroy() { } + + @Override + public String encode(JoinMessage joinMessage) throws EncodeException { + StringWriter swriter = new StringWriter(); + try (JsonGenerator jsonGen = Json.createGenerator(swriter)) { + jsonGen.writeStartObject() + .write("type", "join") + .write("name", joinMessage.getName()) + .writeEnd(); + } catch (Exception e) { + e.printStackTrace(); + throw new EncodeException(joinMessage, "Encoding failed", e); + } + return swriter.toString(); + } +} diff --git a/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/encoders/UsersMessageEncoder.java b/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/encoders/UsersMessageEncoder.java new file mode 100644 index 0000000000000000000000000000000000000000..e2dfa4dc1a730ba5da333e57f64d67faf53db8b8 --- /dev/null +++ b/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/encoders/UsersMessageEncoder.java @@ -0,0 +1,58 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package spring.tutorial.web.websocketbot.encoders; + +import java.io.StringWriter; + +import jakarta.json.Json; +import jakarta.json.stream.JsonGenerator; +import spring.tutorial.web.websocketbot.messages.UsersMessage; +import jakarta.websocket.EncodeException; +import jakarta.websocket.Encoder; +import jakarta.websocket.EndpointConfig; + +/* Encode a UsersMessage as JSON. + * For example, + * List list = new ArrayList<>(); + * list.add("Peter"); + * list.add("Duke"); + * new UsersMessage(list) + * is encoded as follows: + * { + * "type": "users", + * "userlist": [ "Peter", "Duke" ] + * } + */ +public class UsersMessageEncoder implements Encoder.Text { + @Override + public void init(EndpointConfig ec) { } + + @Override + public void destroy() { } + + @Override + public String encode(UsersMessage usersMessage) throws EncodeException { + StringWriter swriter = new StringWriter(); + try (JsonGenerator jsonGen = Json.createGenerator(swriter)) { + jsonGen.writeStartObject() + .write("type", "users") + .writeStartArray("userlist"); + for (String user : usersMessage.getUserList()) + jsonGen.write(user); + jsonGen.writeEnd().writeEnd(); + } catch (Exception e) { + e.printStackTrace(); + throw new EncodeException(usersMessage, "Encoding failed", e); + } + return swriter.toString(); + } +} diff --git a/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/messages/ChatMessage.java b/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/messages/ChatMessage.java new file mode 100644 index 0000000000000000000000000000000000000000..b882e9b7d1c591e183e5e107fc46c3c724a8d366 --- /dev/null +++ b/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/messages/ChatMessage.java @@ -0,0 +1,47 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package spring.tutorial.web.websocketbot.messages; + +/* Represents a chat message */ +public class ChatMessage extends Message { + private String name; + private String target; + private String message; + + public ChatMessage(String name, String target, String message) { + this.name = name; + this.target = target; + this.message = message; + } + + public String getName() { + return name; + } + + public String getTarget() { + return target; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + /* For logging purposes */ + @Override + public String toString() { + return "[ChatMessage] " + name + "-" + target + "-" + message; + } +} diff --git a/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/messages/InfoMessage.java b/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/messages/InfoMessage.java new file mode 100644 index 0000000000000000000000000000000000000000..e05a6da89fa881e2bc2eac68e8c455397b25dcfc --- /dev/null +++ b/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/messages/InfoMessage.java @@ -0,0 +1,33 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package spring.tutorial.web.websocketbot.messages; + +/* Represents an information message, like + * an user entering or leaving the chat */ +public class InfoMessage extends Message { + + private String info; + + public InfoMessage(String info) { + this.info = info; + } + + public String getInfo() { + return info; + } + + /* For logging purposes */ + @Override + public String toString() { + return "[InfoMessage] " + info; + } +} diff --git a/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/messages/JoinMessage.java b/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/messages/JoinMessage.java new file mode 100644 index 0000000000000000000000000000000000000000..3129fbbf5b34a66af73e084c166e4266731fe865 --- /dev/null +++ b/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/messages/JoinMessage.java @@ -0,0 +1,31 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package spring.tutorial.web.websocketbot.messages; + +/* Represents a join message for the chat */ +public class JoinMessage extends Message { + private String name; + + public JoinMessage(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + /* For logging purposes */ + @Override + public String toString() { + return "[JoinMessage] " + name; + } +} diff --git a/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/messages/Message.java b/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/messages/Message.java new file mode 100644 index 0000000000000000000000000000000000000000..b10e3a09b80b36f80b9af247adb51f4bbaf5a3c9 --- /dev/null +++ b/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/messages/Message.java @@ -0,0 +1,16 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package spring.tutorial.web.websocketbot.messages; + +public class Message { + +} diff --git a/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/messages/UsersMessage.java b/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/messages/UsersMessage.java new file mode 100644 index 0000000000000000000000000000000000000000..0a41000d6e32509ab5e69e573cf864f56cb6351b --- /dev/null +++ b/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/messages/UsersMessage.java @@ -0,0 +1,33 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package spring.tutorial.web.websocketbot.messages; + +import java.util.List; + +/* Represents the list of users currently connected to the chat */ +public class UsersMessage extends Message { + private List userlist; + + public UsersMessage(List userlist) { + this.userlist = userlist; + } + + public List getUserList() { + return userlist; + } + + /* For logging purposes */ + @Override + public String toString() { + return "[UsersMessage] " + userlist.toString(); + } +} diff --git a/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/service/BotService.java b/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/service/BotService.java new file mode 100644 index 0000000000000000000000000000000000000000..8198765a367c71867c2d303fc98413c682bd1762 --- /dev/null +++ b/benchmark/presentation/websocketbot/spring/src/main/java/spring/tutorial/web/websocketbot/service/BotService.java @@ -0,0 +1,48 @@ +/* + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package spring.tutorial.web.websocketbot.service; + +import org.springframework.stereotype.Service; + +import java.util.Calendar; +import java.util.GregorianCalendar; + +@Service("botbean") +public class BotService { + + public String respond(String msg) { + String response; + + msg = msg.toLowerCase().replaceAll("\\?", ""); + if (msg.contains("how are you")) { + response = "I'm doing great, thank you!"; + } else if (msg.contains("how old are you")) { + Calendar dukesBirthday = new GregorianCalendar(1995, Calendar.MAY, 23); + Calendar now = GregorianCalendar.getInstance(); + int dukesAge = now.get(Calendar.YEAR) - dukesBirthday.get(Calendar.YEAR); + response = String.format("I'm %d years old.", dukesAge); + } else if (msg.contains("when is your birthday")) { + response = "My birthday is on May 23rd. Thanks for asking!"; + } else if (msg.contains("your favorite color")) { + response = "My favorite color is blue. What's yours?"; + } else { + response = "Sorry, I did not understand what you said. "; + response += "You can ask me how I'm doing today; how old I am; or "; + response += "what my favorite color is."; + } + try { + Thread.sleep(1200); + } catch (InterruptedException ex) { + // ignore + } + return response; + } +} diff --git a/benchmark/presentation/websocketbot/spring/src/main/resources/.gitkeep b/benchmark/presentation/websocketbot/spring/src/main/resources/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/benchmark/presentation/websocketbot/spring/src/main/resources/static/css/default.css b/benchmark/presentation/websocketbot/spring/src/main/resources/static/css/default.css new file mode 100644 index 0000000000000000000000000000000000000000..33a5857014cfcf5cdb54892c9a1b7fb02d5a1ad8 --- /dev/null +++ b/benchmark/presentation/websocketbot/spring/src/main/resources/static/css/default.css @@ -0,0 +1,40 @@ +/** + * Copyright (c), Eclipse Foundation, Inc. and its licensors. + * + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v1.0, which is available at + * https://www.eclipse.org/org/documents/edl-v10.php + * + * SPDX-License-Identifier: BSD-3-Clause + */ +body { + background-color: #ffffff; + font-size: 12px; + font-family: Verdana, "Verdana CE", Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + color: #000000; + margin: 10px; +} + +h1 { + font-family: Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + border-bottom: 1px solid #AFAFAF; + font-size: 16px; + font-weight: bold; + margin: 0px; + padding: 0px; + color: #D20005; +} + +a:link, a:visited { + color: #045491; + font-weight : bold; + text-decoration: none; +} + +a:link:hover, a:visited:hover { + color: #045491; + font-weight : bold; + text-decoration : underline; +} diff --git a/benchmark/presentation/websocketbot/spring/src/main/resources/static/index.html b/benchmark/presentation/websocketbot/spring/src/main/resources/static/index.html new file mode 100644 index 0000000000000000000000000000000000000000..351875ffebb718502e6bc7b41b0de582634587b9 --- /dev/null +++ b/benchmark/presentation/websocketbot/spring/src/main/resources/static/index.html @@ -0,0 +1,178 @@ + + + + + WebsocketBot + + + + +

WebsocketBot

+ Your name: +
+
+ + +


+ + Show WebSocket console
+
+ + diff --git a/benchmark/presentation/websocketbot/spring/test.sh b/benchmark/presentation/websocketbot/spring/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..21784743b019b9893b6c1981b7bb76709e960d6b --- /dev/null +++ b/benchmark/presentation/websocketbot/spring/test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +BASE_URL="${BASE_URL:-http://localhost:8080}" + +echo "Health check: ${BASE_URL}/" +HTTP_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "${BASE_URL}/") + +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "PASS - got HTTP ${HTTP_STATUS}" + exit 0 +else + echo "FAIL - got HTTP ${HTTP_STATUS}" + exit 1 +fi diff --git a/benchmark/whole_applications/cargotracker/jakarta/cargo_tracker_cover.png b/benchmark/whole_applications/cargotracker/jakarta/cargo_tracker_cover.png new file mode 100644 index 0000000000000000000000000000000000000000..ba0e9e4666876d46c44945478ed6f16ef6c3fa36 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/jakarta/cargo_tracker_cover.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:148e92ab2835a09f3114808743001cc4476a8d0beb1b0d0ba85817d368bbcc6f +size 909717 diff --git a/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/images/CTlogo128.png b/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/images/CTlogo128.png new file mode 100644 index 0000000000000000000000000000000000000000..dac4fa5c3d91528263534c48a8347e196faec520 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/images/CTlogo128.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a69e151d42bf7df989a8e8ddd0ecfe16d2806301e8fc29cd92196850d439fc8c +size 12993 diff --git a/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/images/CTlogobadge128.png b/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/images/CTlogobadge128.png new file mode 100644 index 0000000000000000000000000000000000000000..b442e55813b687861f4dc1b0df78985a77d0d020 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/images/CTlogobadge128.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ecdf9c53eafba8240a0e869dc8ca504c479d8bcf0ad090f1ba97a369f7be02d5 +size 29266 diff --git a/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/images/calendarTrigger.gif b/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/images/calendarTrigger.gif new file mode 100644 index 0000000000000000000000000000000000000000..c57053788181f89f2283a9f5aeb5d2359ff5f8b5 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/images/calendarTrigger.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7c5ae277eef01254e4cb0f5e8924fe41426d6528696e72cee603583d62ca65c7 +size 1032 diff --git a/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/images/cargoTug.jpg b/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/images/cargoTug.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1e38a720cc68f613f6ff058138ae10a4a4df3521 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/images/cargoTug.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:20366abd004d10e94cbbf137c9d494c816f20bdf345558563900ce50131e7b6b +size 791805 diff --git a/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/images/cross.png b/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/images/cross.png new file mode 100644 index 0000000000000000000000000000000000000000..54758aad06f0f39d9c787aa9a3cfea85313df58a --- /dev/null +++ b/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/images/cross.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d04ecfc93ff86c44f6fc39e35945e3d8a7648ba8fcd97a2635920df2e88893b3 +size 655 diff --git a/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/images/error.png b/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/images/error.png new file mode 100644 index 0000000000000000000000000000000000000000..1b878a72b61cbff6e2b5f9ba0b6f85aa414a74d8 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/images/error.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:011f4e33d86b448078a2bd56b7060770b2c079e86aad2b7298ab0db216758f34 +size 666 diff --git a/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/images/tick.png b/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/images/tick.png new file mode 100644 index 0000000000000000000000000000000000000000..78c32af0d77bfba24fdbb442bb7d9ff24ab5e833 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/images/tick.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:644faffc659fb1e6778cf5290022fbcde177952c66881848e6380ed91211e878 +size 537 diff --git a/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/leaflet/images/layers-2x.png b/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/leaflet/images/layers-2x.png new file mode 100644 index 0000000000000000000000000000000000000000..d3cf7e52a82af25702fb438e39628b5de5e59748 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/leaflet/images/layers-2x.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:066daca850d8ffbef007af00b06eac0015728dee279c51f3cb6c716df7c42edf +size 1259 diff --git a/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/leaflet/images/layers.png b/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/leaflet/images/layers.png new file mode 100644 index 0000000000000000000000000000000000000000..7b44754c2818d1c3a93b252beaaa09996ca13d04 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/leaflet/images/layers.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1dbbe9d028e292f36fcba8f8b3a28d5e8932754fc2215b9ac69e4cdecf5107c6 +size 696 diff --git a/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/leaflet/images/marker-icon-2x.png b/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/leaflet/images/marker-icon-2x.png new file mode 100644 index 0000000000000000000000000000000000000000..09e8445f54e259e1c37c8a275f0fe1d782f98a0f --- /dev/null +++ b/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/leaflet/images/marker-icon-2x.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:00179c4c1ee830d3a108412ae0d294f55776cfeb085c60129a39aa6fc4ae2528 +size 2464 diff --git a/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/leaflet/images/marker-icon.png b/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/leaflet/images/marker-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..b1789c767ea343516eec571d6533ac6379d822f8 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/leaflet/images/marker-icon.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:574c3a5cca85f4114085b6841596d62f00d7c892c7b03f28cbfa301deb1dc437 +size 1466 diff --git a/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/leaflet/images/marker-shadow.png b/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/leaflet/images/marker-shadow.png new file mode 100644 index 0000000000000000000000000000000000000000..dc11121699291167ac4075d6f133105b7ad7fc78 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/jakarta/src/main/webapp/resources/leaflet/images/marker-shadow.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:264f5c640339f042dd729062cfc04c17f8ea0f29882b538e3848ed8f10edb4da +size 618 diff --git a/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/images/CTlogo128.png b/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/images/CTlogo128.png new file mode 100644 index 0000000000000000000000000000000000000000..dac4fa5c3d91528263534c48a8347e196faec520 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/images/CTlogo128.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a69e151d42bf7df989a8e8ddd0ecfe16d2806301e8fc29cd92196850d439fc8c +size 12993 diff --git a/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/images/CTlogobadge128.png b/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/images/CTlogobadge128.png new file mode 100644 index 0000000000000000000000000000000000000000..b442e55813b687861f4dc1b0df78985a77d0d020 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/images/CTlogobadge128.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ecdf9c53eafba8240a0e869dc8ca504c479d8bcf0ad090f1ba97a369f7be02d5 +size 29266 diff --git a/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/images/calendarTrigger.gif b/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/images/calendarTrigger.gif new file mode 100644 index 0000000000000000000000000000000000000000..c57053788181f89f2283a9f5aeb5d2359ff5f8b5 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/images/calendarTrigger.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7c5ae277eef01254e4cb0f5e8924fe41426d6528696e72cee603583d62ca65c7 +size 1032 diff --git a/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/images/cargoTug.jpg b/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/images/cargoTug.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1e38a720cc68f613f6ff058138ae10a4a4df3521 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/images/cargoTug.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:20366abd004d10e94cbbf137c9d494c816f20bdf345558563900ce50131e7b6b +size 791805 diff --git a/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/images/cross.png b/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/images/cross.png new file mode 100644 index 0000000000000000000000000000000000000000..54758aad06f0f39d9c787aa9a3cfea85313df58a --- /dev/null +++ b/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/images/cross.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d04ecfc93ff86c44f6fc39e35945e3d8a7648ba8fcd97a2635920df2e88893b3 +size 655 diff --git a/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/images/error.png b/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/images/error.png new file mode 100644 index 0000000000000000000000000000000000000000..1b878a72b61cbff6e2b5f9ba0b6f85aa414a74d8 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/images/error.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:011f4e33d86b448078a2bd56b7060770b2c079e86aad2b7298ab0db216758f34 +size 666 diff --git a/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/images/tick.png b/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/images/tick.png new file mode 100644 index 0000000000000000000000000000000000000000..78c32af0d77bfba24fdbb442bb7d9ff24ab5e833 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/images/tick.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:644faffc659fb1e6778cf5290022fbcde177952c66881848e6380ed91211e878 +size 537 diff --git a/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/leaflet/images/layers-2x.png b/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/leaflet/images/layers-2x.png new file mode 100644 index 0000000000000000000000000000000000000000..d3cf7e52a82af25702fb438e39628b5de5e59748 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/leaflet/images/layers-2x.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:066daca850d8ffbef007af00b06eac0015728dee279c51f3cb6c716df7c42edf +size 1259 diff --git a/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/leaflet/images/layers.png b/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/leaflet/images/layers.png new file mode 100644 index 0000000000000000000000000000000000000000..7b44754c2818d1c3a93b252beaaa09996ca13d04 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/leaflet/images/layers.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1dbbe9d028e292f36fcba8f8b3a28d5e8932754fc2215b9ac69e4cdecf5107c6 +size 696 diff --git a/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/leaflet/images/marker-icon-2x.png b/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/leaflet/images/marker-icon-2x.png new file mode 100644 index 0000000000000000000000000000000000000000..09e8445f54e259e1c37c8a275f0fe1d782f98a0f --- /dev/null +++ b/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/leaflet/images/marker-icon-2x.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:00179c4c1ee830d3a108412ae0d294f55776cfeb085c60129a39aa6fc4ae2528 +size 2464 diff --git a/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/leaflet/images/marker-icon.png b/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/leaflet/images/marker-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..b1789c767ea343516eec571d6533ac6379d822f8 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/leaflet/images/marker-icon.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:574c3a5cca85f4114085b6841596d62f00d7c892c7b03f28cbfa301deb1dc437 +size 1466 diff --git a/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/leaflet/images/marker-shadow.png b/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/leaflet/images/marker-shadow.png new file mode 100644 index 0000000000000000000000000000000000000000..dc11121699291167ac4075d6f133105b7ad7fc78 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/quarkus/src/main/resources/META-INF/resources/resources/leaflet/images/marker-shadow.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:264f5c640339f042dd729062cfc04c17f8ea0f29882b538e3848ed8f10edb4da +size 618 diff --git a/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/images/CTlogo128.png b/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/images/CTlogo128.png new file mode 100644 index 0000000000000000000000000000000000000000..dac4fa5c3d91528263534c48a8347e196faec520 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/images/CTlogo128.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a69e151d42bf7df989a8e8ddd0ecfe16d2806301e8fc29cd92196850d439fc8c +size 12993 diff --git a/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/images/CTlogobadge128.png b/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/images/CTlogobadge128.png new file mode 100644 index 0000000000000000000000000000000000000000..b442e55813b687861f4dc1b0df78985a77d0d020 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/images/CTlogobadge128.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ecdf9c53eafba8240a0e869dc8ca504c479d8bcf0ad090f1ba97a369f7be02d5 +size 29266 diff --git a/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/images/calendarTrigger.gif b/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/images/calendarTrigger.gif new file mode 100644 index 0000000000000000000000000000000000000000..c57053788181f89f2283a9f5aeb5d2359ff5f8b5 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/images/calendarTrigger.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7c5ae277eef01254e4cb0f5e8924fe41426d6528696e72cee603583d62ca65c7 +size 1032 diff --git a/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/images/cargoTug.jpg b/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/images/cargoTug.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1e38a720cc68f613f6ff058138ae10a4a4df3521 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/images/cargoTug.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:20366abd004d10e94cbbf137c9d494c816f20bdf345558563900ce50131e7b6b +size 791805 diff --git a/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/images/cross.png b/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/images/cross.png new file mode 100644 index 0000000000000000000000000000000000000000..54758aad06f0f39d9c787aa9a3cfea85313df58a --- /dev/null +++ b/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/images/cross.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d04ecfc93ff86c44f6fc39e35945e3d8a7648ba8fcd97a2635920df2e88893b3 +size 655 diff --git a/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/images/error.png b/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/images/error.png new file mode 100644 index 0000000000000000000000000000000000000000..1b878a72b61cbff6e2b5f9ba0b6f85aa414a74d8 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/images/error.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:011f4e33d86b448078a2bd56b7060770b2c079e86aad2b7298ab0db216758f34 +size 666 diff --git a/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/images/tick.png b/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/images/tick.png new file mode 100644 index 0000000000000000000000000000000000000000..78c32af0d77bfba24fdbb442bb7d9ff24ab5e833 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/images/tick.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:644faffc659fb1e6778cf5290022fbcde177952c66881848e6380ed91211e878 +size 537 diff --git a/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/leaflet/images/layers-2x.png b/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/leaflet/images/layers-2x.png new file mode 100644 index 0000000000000000000000000000000000000000..d3cf7e52a82af25702fb438e39628b5de5e59748 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/leaflet/images/layers-2x.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:066daca850d8ffbef007af00b06eac0015728dee279c51f3cb6c716df7c42edf +size 1259 diff --git a/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/leaflet/images/layers.png b/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/leaflet/images/layers.png new file mode 100644 index 0000000000000000000000000000000000000000..7b44754c2818d1c3a93b252beaaa09996ca13d04 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/leaflet/images/layers.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1dbbe9d028e292f36fcba8f8b3a28d5e8932754fc2215b9ac69e4cdecf5107c6 +size 696 diff --git a/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/leaflet/images/marker-icon-2x.png b/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/leaflet/images/marker-icon-2x.png new file mode 100644 index 0000000000000000000000000000000000000000..09e8445f54e259e1c37c8a275f0fe1d782f98a0f --- /dev/null +++ b/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/leaflet/images/marker-icon-2x.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:00179c4c1ee830d3a108412ae0d294f55776cfeb085c60129a39aa6fc4ae2528 +size 2464 diff --git a/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/leaflet/images/marker-icon.png b/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/leaflet/images/marker-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..b1789c767ea343516eec571d6533ac6379d822f8 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/leaflet/images/marker-icon.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:574c3a5cca85f4114085b6841596d62f00d7c892c7b03f28cbfa301deb1dc437 +size 1466 diff --git a/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/leaflet/images/marker-shadow.png b/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/leaflet/images/marker-shadow.png new file mode 100644 index 0000000000000000000000000000000000000000..dc11121699291167ac4075d6f133105b7ad7fc78 --- /dev/null +++ b/benchmark/whole_applications/cargotracker/spring/src/main/resources/META-INF/resources/leaflet/images/marker-shadow.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:264f5c640339f042dd729062cfc04c17f8ea0f29882b538e3848ed8f10edb4da +size 618 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/application/Application__DB__Class.png b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/application/Application__DB__Class.png new file mode 100644 index 0000000000000000000000000000000000000000..db02e08e917c3d84d57d6c36e2b2e24f58a59cf0 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/application/Application__DB__Class.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c432d564b3164f31e5332932d880799ec372adf27a1bb903b373e73927ebf09e +size 30280 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/application/Application__UseCases.png b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/application/Application__UseCases.png new file mode 100644 index 0000000000000000000000000000000000000000..bdd87d97b5007fc43aba61c1d329a5b38a18e413 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/application/Application__UseCases.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e84aa101d3295ec3556de7b73b3d10322d2854c28cd3cc90ec58421b0358b675 +size 129812 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/application/Application__View__Class.png b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/application/Application__View__Class.png new file mode 100644 index 0000000000000000000000000000000000000000..57cf8c50c3a09250068576a1b47ab4c4ea063aad --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/application/Application__View__Class.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:94f5b496e8b65fd36d770d115353baaebfc0060621f4422d0419c37e5ef9ded5 +size 81129 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/owner/Owner__DB__class.png b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/owner/Owner__DB__class.png new file mode 100644 index 0000000000000000000000000000000000000000..16d10bc422d2f9e873c5c052567c04595f0f1017 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/owner/Owner__DB__class.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e21dd880ecfb25bd735f4abefdb7e6759a8243e98554d5c8643b7af0cd52b4de +size 116068 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/owner/Owner__View__Class.png b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/owner/Owner__View__Class.png new file mode 100644 index 0000000000000000000000000000000000000000..dae0f91bfaf0aeddb37c826e80931c1b9198966e --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/owner/Owner__View__Class.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:14fbd7b9d09218d34dbe107a811d352956cd2bec60e7ca735d7bff1bbc5c307b +size 377105 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/owner/owner/Owner__Domain_Class_Modell.png b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/owner/owner/Owner__Domain_Class_Modell.png new file mode 100644 index 0000000000000000000000000000000000000000..42fa723b9ecb0c5b087722f1d57c8b73acf91bb9 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/owner/owner/Owner__Domain_Class_Modell.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:345ad9a5a3d4ee2a2503501bc8f2dbc5e4ec12c2654daccbaad3fbbd4d769829 +size 107870 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/owner/owner/Owner__UseCases.png b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/owner/owner/Owner__UseCases.png new file mode 100644 index 0000000000000000000000000000000000000000..562e702a1927d64f46360741e87b703734029285 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/owner/owner/Owner__UseCases.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4cf00f50d1205835c132ef61077214cc8770fce4ff96227c2a9327e6ef4cf3b5 +size 75639 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/owner/owner/Owner__UseCases__State.png b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/owner/owner/Owner__UseCases__State.png new file mode 100644 index 0000000000000000000000000000000000000000..789f511bf51f571be3fbd3cb8047b768be18a863 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/owner/owner/Owner__UseCases__State.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5940d36212d6b573c524742967b3261ade7c6562f8e615b38678a84fdb6a4d60 +size 124690 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/owner/pettype/PetType__Domain_Class_Modell.png b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/owner/pettype/PetType__Domain_Class_Modell.png new file mode 100644 index 0000000000000000000000000000000000000000..d937231c64e858f9246667f679149e1abba5bff7 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/owner/pettype/PetType__Domain_Class_Modell.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a17e355532954c6eb3f43c19169b72391a9bed9ba5116823acb16c650450c44d +size 108001 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/owner/pettype/PetType__UseCase.png b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/owner/pettype/PetType__UseCase.png new file mode 100644 index 0000000000000000000000000000000000000000..57f9ddff836dac86f3ad31bc76d0fa6220af9637 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/owner/pettype/PetType__UseCase.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:020dfd127a019c59a79549b856cc328600a3980deca1a51559b1fc0d9a3f02eb +size 71425 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/owner/pettype/PetType__UseCase_State.png b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/owner/pettype/PetType__UseCase_State.png new file mode 100644 index 0000000000000000000000000000000000000000..316624f966fe4df02be0be93376f71af354dbceb --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/owner/pettype/PetType__UseCase_State.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b2d831ec227c03ea22ad4d597b9a95a39854dd163bdd71e2e81cf3ef5132adb1 +size 93522 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/vet/Vet__DB__Class.png b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/vet/Vet__DB__Class.png new file mode 100644 index 0000000000000000000000000000000000000000..c504bc43c6a68adacb5ddbce392734e751a53c6f --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/vet/Vet__DB__Class.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca912ff162bb0cab4e18478c84c0870fe22a3f93a95034facdd5d42ba51f2b8e +size 78828 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/vet/Vet__View__Class.png b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/vet/Vet__View__Class.png new file mode 100644 index 0000000000000000000000000000000000000000..9ca602d49a3e4e74ac6460aa892a304830337ce3 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/vet/Vet__View__Class.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:594b21d1a8a651c048c48fcefb63df9fee67be383c250908cbca0e5edd1b5a73 +size 289345 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/vet/specialty/Specialty__Domain_Class_Modell.png b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/vet/specialty/Specialty__Domain_Class_Modell.png new file mode 100644 index 0000000000000000000000000000000000000000..9753fbaf5d7225240d86ef0f260eeb8eb0d5197d --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/vet/specialty/Specialty__Domain_Class_Modell.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:193f61510b4ffa9717f26b1b6e491b9268f459d61c0c4b34c74b8d3d59b180a5 +size 89017 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/vet/specialty/Specialty__Ui.png b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/vet/specialty/Specialty__Ui.png new file mode 100644 index 0000000000000000000000000000000000000000..4e5be58712df27ec9a22fe2205d2c6e197410ace --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/vet/specialty/Specialty__Ui.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f39a22659d937a3f24b9edf9e9c9e855f9544129fc1e897492831ddd3ab5aa2a +size 5601 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/vet/specialty/Specialty__UseCase.png b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/vet/specialty/Specialty__UseCase.png new file mode 100644 index 0000000000000000000000000000000000000000..2e114ac877b795ea1704fdcde834a2f0dd49d3ff --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/vet/specialty/Specialty__UseCase.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:04a37cc9ef25b7fee51a2c4f2848d0bffc62725b03b0dd9a0e2f5be971f30c5e +size 72799 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/vet/specialty/Specialty__UseCase__State.png b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/vet/specialty/Specialty__UseCase__State.png new file mode 100644 index 0000000000000000000000000000000000000000..7a2c4f78c718990667de0b2310ad1c3caf91a93d --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/vet/specialty/Specialty__UseCase__State.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:73a68e63bbf8518f2cb7eb06b107835eefb816b6d81e8ff1ee228402ca1c48ec +size 91066 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/vet/vet/Vet__Domain_Class_Modell.png b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/vet/vet/Vet__Domain_Class_Modell.png new file mode 100644 index 0000000000000000000000000000000000000000..d53ad30177d1bad1a82b3a4e81cd7d8c5db48a9a --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/vet/vet/Vet__Domain_Class_Modell.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b8ab490296e0caa87daabcc6ae2a42c4c54dffbb9135496da0c55cec7c923bee +size 86940 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/vet/vet/Vet__UseCase.png b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/vet/vet/Vet__UseCase.png new file mode 100644 index 0000000000000000000000000000000000000000..3819ffed6c62a9cf8a5c5f5d8f4102c7c33aa9ef --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/vet/vet/Vet__UseCase.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:48a132b7217bd7587376e61f5e2282c6d302316629ea727019059a295fe27a76 +size 67527 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/vet/vet/Vet__UseCase__State.png b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/vet/vet/Vet__UseCase__State.png new file mode 100644 index 0000000000000000000000000000000000000000..d36b56556fac01dd843522d92f1f7f0f1fcfdd5f --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/plantuml/vet/vet/Vet__UseCase__State.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c46555b6eceb924db1ac88ad98c20567764b33fd4d488c0d0853ab2dde83af95 +size 104578 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/homePage/after.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/homePage/after.png new file mode 100644 index 0000000000000000000000000000000000000000..c1a6d2dd9df40b3cf7bd0402978185748895117a --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/homePage/after.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4e6306b89be300fe58054aae992aaf76273b45e7fefe7aea93b62e71fed904d4 +size 67929 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/homePage/before.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/homePage/before.png new file mode 100644 index 0000000000000000000000000000000000000000..fb3de49e8f99356e3ae0bcb334afbb7118edc93d --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/homePage/before.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d3cd3cef8dcbccaf0755e11377df9568ac1b4c9a3f06c5e3d1321ea1f3c65105 +size 5130 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/homePage/get0_onEveryAction.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/homePage/get0_onEveryAction.png new file mode 100644 index 0000000000000000000000000000000000000000..3d90051b5a30031c381ba6bfcee965fd904dba26 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/homePage/get0_onEveryAction.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:86b9872a937fb19534d5dc6c51e2c4e8944adc62910ed66939bc8eb8c0e9da0e +size 61293 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/homePage/manage1_onEveryAction.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/homePage/manage1_onEveryAction.png new file mode 100644 index 0000000000000000000000000000000000000000..3d90051b5a30031c381ba6bfcee965fd904dba26 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/homePage/manage1_onEveryAction.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:86b9872a937fb19534d5dc6c51e2c4e8944adc62910ed66939bc8eb8c0e9da0e +size 61293 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerAddNewPageCancel/after.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerAddNewPageCancel/after.png new file mode 100644 index 0000000000000000000000000000000000000000..f85a624cb610a4a0131e26de1f77dff73206c860 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerAddNewPageCancel/after.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:833bc3069255d1ea2601bce022e5de8713bf1286f69c63b47299ac28d4b45d6e +size 71851 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerAddNewPageCancel/before.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerAddNewPageCancel/before.png new file mode 100644 index 0000000000000000000000000000000000000000..bee6a4d4059e6830863ae491680a9b138f3c6c99 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerAddNewPageCancel/before.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d578c8dd31e5524171f84be13ddfe75227ebedcb8cdab34242f5d267ccbaae03 +size 72262 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerDeletePage/after.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerDeletePage/after.png new file mode 100644 index 0000000000000000000000000000000000000000..2d91e608f5af73de9f738ac7e3d8240c98aac075 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerDeletePage/after.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:83ca4408950bbc6a68cd0afc5ad171aac2c29a5945a546558c9f8f08a0dc0547 +size 84214 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerDeletePage/before.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerDeletePage/before.png new file mode 100644 index 0000000000000000000000000000000000000000..f5b6ce5ec83c6336dbeb53aa19ebed4260123970 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerDeletePage/before.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c567eb0d26ea23d4b42ac74cf8fd2c68083dd1f137ac6894d093b97922acadc9 +size 84060 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerDetailsPage/after.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerDetailsPage/after.png new file mode 100644 index 0000000000000000000000000000000000000000..f5b6ce5ec83c6336dbeb53aa19ebed4260123970 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerDetailsPage/after.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c567eb0d26ea23d4b42ac74cf8fd2c68083dd1f137ac6894d093b97922acadc9 +size 84060 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerDetailsPage/before.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerDetailsPage/before.png new file mode 100644 index 0000000000000000000000000000000000000000..f85a624cb610a4a0131e26de1f77dff73206c860 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerDetailsPage/before.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:833bc3069255d1ea2601bce022e5de8713bf1286f69c63b47299ac28d4b45d6e +size 71851 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerDetailsPageCancel/after.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerDetailsPageCancel/after.png new file mode 100644 index 0000000000000000000000000000000000000000..f85a624cb610a4a0131e26de1f77dff73206c860 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerDetailsPageCancel/after.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:833bc3069255d1ea2601bce022e5de8713bf1286f69c63b47299ac28d4b45d6e +size 71851 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerDetailsPageCancel/before.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerDetailsPageCancel/before.png new file mode 100644 index 0000000000000000000000000000000000000000..f5b6ce5ec83c6336dbeb53aa19ebed4260123970 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerDetailsPageCancel/before.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c567eb0d26ea23d4b42ac74cf8fd2c68083dd1f137ac6894d093b97922acadc9 +size 84060 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerDetailsPageCancel/manage0_onEveryAction.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerDetailsPageCancel/manage0_onEveryAction.png new file mode 100644 index 0000000000000000000000000000000000000000..3085f205f41c7564e7bab04248db5cedb96930dc --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerDetailsPageCancel/manage0_onEveryAction.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:376609d532c3ef05490b2097127b997d2f38f44319dbfc86461d6e99079f900b +size 65283 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerDetailsPageCancel/manage1_onEveryAction.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerDetailsPageCancel/manage1_onEveryAction.png new file mode 100644 index 0000000000000000000000000000000000000000..f85a624cb610a4a0131e26de1f77dff73206c860 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/ownerDetailsPageCancel/manage1_onEveryAction.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:833bc3069255d1ea2601bce022e5de8713bf1286f69c63b47299ac28d4b45d6e +size 71851 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeAddNewPage/after.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeAddNewPage/after.png new file mode 100644 index 0000000000000000000000000000000000000000..5803757af66d7ccc12e2b719acabc6a79fe114ba --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeAddNewPage/after.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a6f6b2f1842a6ac2481c775a3e95be9e0fec12f0fc952d8c6f7d4e07f5555749 +size 55891 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeAddNewPage/before.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeAddNewPage/before.png new file mode 100644 index 0000000000000000000000000000000000000000..9552d5707219c08be5031c7e358951cfc32ebcf0 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeAddNewPage/before.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5a6c98cf487b0d8918bfe54ee77f3786edb68ffef5ca06646a484635d3b63df7 +size 64267 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeDeletePage/after.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeDeletePage/after.png new file mode 100644 index 0000000000000000000000000000000000000000..1a90974e7b02e2026ff00a4230eb12cc46b7a16c --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeDeletePage/after.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f306e23f0fb7ffb8f8e9dfc493fc3dc2b6e39a83f6ba7e1b7e128009de1738b +size 53822 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeDeletePage/before.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeDeletePage/before.png new file mode 100644 index 0000000000000000000000000000000000000000..c0ef96cf694da444f4ca7c2b909d8e0691305462 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeDeletePage/before.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8d3fcf1d4a67ea6230f63265d3bf6a7f972dd16dc9f22c76de0fcbf704400813 +size 53546 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeDeletePageCancel/after.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeDeletePageCancel/after.png new file mode 100644 index 0000000000000000000000000000000000000000..c0ef96cf694da444f4ca7c2b909d8e0691305462 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeDeletePageCancel/after.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8d3fcf1d4a67ea6230f63265d3bf6a7f972dd16dc9f22c76de0fcbf704400813 +size 53546 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeDeletePageCancel/before.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeDeletePageCancel/before.png new file mode 100644 index 0000000000000000000000000000000000000000..1a90974e7b02e2026ff00a4230eb12cc46b7a16c --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeDeletePageCancel/before.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f306e23f0fb7ffb8f8e9dfc493fc3dc2b6e39a83f6ba7e1b7e128009de1738b +size 53822 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeDetailsPage/after.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeDetailsPage/after.png new file mode 100644 index 0000000000000000000000000000000000000000..c0ef96cf694da444f4ca7c2b909d8e0691305462 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeDetailsPage/after.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8d3fcf1d4a67ea6230f63265d3bf6a7f972dd16dc9f22c76de0fcbf704400813 +size 53546 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeDetailsPage/before.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeDetailsPage/before.png new file mode 100644 index 0000000000000000000000000000000000000000..9552d5707219c08be5031c7e358951cfc32ebcf0 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeDetailsPage/before.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5a6c98cf487b0d8918bfe54ee77f3786edb68ffef5ca06646a484635d3b63df7 +size 64267 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeDetailsPageCancel/after.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeDetailsPageCancel/after.png new file mode 100644 index 0000000000000000000000000000000000000000..9552d5707219c08be5031c7e358951cfc32ebcf0 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeDetailsPageCancel/after.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5a6c98cf487b0d8918bfe54ee77f3786edb68ffef5ca06646a484635d3b63df7 +size 64267 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeDetailsPageCancel/before.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeDetailsPageCancel/before.png new file mode 100644 index 0000000000000000000000000000000000000000..c0ef96cf694da444f4ca7c2b909d8e0691305462 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeDetailsPageCancel/before.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8d3fcf1d4a67ea6230f63265d3bf6a7f972dd16dc9f22c76de0fcbf704400813 +size 53546 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeEditPageCancel/after.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeEditPageCancel/after.png new file mode 100644 index 0000000000000000000000000000000000000000..c0ef96cf694da444f4ca7c2b909d8e0691305462 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeEditPageCancel/after.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8d3fcf1d4a67ea6230f63265d3bf6a7f972dd16dc9f22c76de0fcbf704400813 +size 53546 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeEditPageCancel/before.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeEditPageCancel/before.png new file mode 100644 index 0000000000000000000000000000000000000000..dcb0a83db80db1f13e5cb1fcfa8d869be0ae91a9 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypeEditPageCancel/before.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:00945967d03f828e1b55be7ce4c1b0bb8918e18797f70738a337072c42df198c +size 54490 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypePage/after.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypePage/after.png new file mode 100644 index 0000000000000000000000000000000000000000..9552d5707219c08be5031c7e358951cfc32ebcf0 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypePage/after.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5a6c98cf487b0d8918bfe54ee77f3786edb68ffef5ca06646a484635d3b63df7 +size 64267 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypePage/before.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypePage/before.png new file mode 100644 index 0000000000000000000000000000000000000000..08bec405256eb1e9113daee4183d1b04fd3af572 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypePage/before.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f81c9bb2646991967a452d5e9943ac6195ba50aa5443cca7e334d6c0a48eb8e +size 70656 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypePage/get0_onEveryAction.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypePage/get0_onEveryAction.png new file mode 100644 index 0000000000000000000000000000000000000000..34cf894b3d053777e40a94656beb48eefb7bb4f9 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypePage/get0_onEveryAction.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a5ae5b99ed8d93068f21e57d5a6d4d970a07f1c67e421ca2c78e35dd3492b574 +size 45502 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypePage/manage1_onEveryAction.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypePage/manage1_onEveryAction.png new file mode 100644 index 0000000000000000000000000000000000000000..34cf894b3d053777e40a94656beb48eefb7bb4f9 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/petTypePage/manage1_onEveryAction.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a5ae5b99ed8d93068f21e57d5a6d4d970a07f1c67e421ca2c78e35dd3492b574 +size 45502 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyAddNewForm/after.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyAddNewForm/after.png new file mode 100644 index 0000000000000000000000000000000000000000..29ceb68ef85a25e3a2239f6e4116039b10256732 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyAddNewForm/after.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bcf1ee6b29bed9fd99db12df80b239259663f653e41ebe8d145e3765082c0de9 +size 63876 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyAddNewForm/before.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyAddNewForm/before.png new file mode 100644 index 0000000000000000000000000000000000000000..08bec405256eb1e9113daee4183d1b04fd3af572 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyAddNewForm/before.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f81c9bb2646991967a452d5e9943ac6195ba50aa5443cca7e334d6c0a48eb8e +size 70656 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyAddNewFormCancel/after.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyAddNewFormCancel/after.png new file mode 100644 index 0000000000000000000000000000000000000000..08bec405256eb1e9113daee4183d1b04fd3af572 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyAddNewFormCancel/after.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f81c9bb2646991967a452d5e9943ac6195ba50aa5443cca7e334d6c0a48eb8e +size 70656 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyAddNewFormCancel/before.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyAddNewFormCancel/before.png new file mode 100644 index 0000000000000000000000000000000000000000..29ceb68ef85a25e3a2239f6e4116039b10256732 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyAddNewFormCancel/before.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bcf1ee6b29bed9fd99db12df80b239259663f653e41ebe8d145e3765082c0de9 +size 63876 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyDeleteForm/after.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyDeleteForm/after.png new file mode 100644 index 0000000000000000000000000000000000000000..1da6a798d11aad567ccc8afbfd304e9cf9a538a9 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyDeleteForm/after.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e88696304a738e440b80ae4636d69a0716247e4c9d431752801839329b78a5e0 +size 63950 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyDeleteForm/before.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyDeleteForm/before.png new file mode 100644 index 0000000000000000000000000000000000000000..a7026d6d72db986c8b31d1db9f642b79c713761e --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyDeleteForm/before.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:50302cc03478adb6762ba5fe75e7e2886035b273cfd136f122fddbee97117f93 +size 62683 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyEditFormCancel/after.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyEditFormCancel/after.png new file mode 100644 index 0000000000000000000000000000000000000000..a7026d6d72db986c8b31d1db9f642b79c713761e --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyEditFormCancel/after.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:50302cc03478adb6762ba5fe75e7e2886035b273cfd136f122fddbee97117f93 +size 62683 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyEditFormCancel/before.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyEditFormCancel/before.png new file mode 100644 index 0000000000000000000000000000000000000000..a44ece4b3a45a84d13d32ca8721f50e0fde96c57 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyEditFormCancel/before.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f8f9b7be28d796f6ab5566d5e0c2f69f6ad5896119c84aeecff8ab1fd090d934 +size 62777 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyPage/after.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyPage/after.png new file mode 100644 index 0000000000000000000000000000000000000000..08bec405256eb1e9113daee4183d1b04fd3af572 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyPage/after.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f81c9bb2646991967a452d5e9943ac6195ba50aa5443cca7e334d6c0a48eb8e +size 70656 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyPage/before.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyPage/before.png new file mode 100644 index 0000000000000000000000000000000000000000..d07e397c64a7983caf6a404e9e501b9a4ede8dd0 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyPage/before.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:88447f9b60b554def463997d2a92bffb6f0d77a1b7ccb2f65bf30576b1621955 +size 172692 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyPage/get0_onEveryAction.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyPage/get0_onEveryAction.png new file mode 100644 index 0000000000000000000000000000000000000000..e261c3dcaf025700ed552cbd84a6fdc086e20d35 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyPage/get0_onEveryAction.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:66152ee34f8c113b7c1577b8b4c0350da259ecff85c0156d78dea813f20c3a85 +size 51948 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyPage/manage1_onEveryAction.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyPage/manage1_onEveryAction.png new file mode 100644 index 0000000000000000000000000000000000000000..e261c3dcaf025700ed552cbd84a6fdc086e20d35 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/specialtyPage/manage1_onEveryAction.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:66152ee34f8c113b7c1577b8b4c0350da259ecff85c0156d78dea813f20c3a85 +size 51948 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinariaAddNewPage/after.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinariaAddNewPage/after.png new file mode 100644 index 0000000000000000000000000000000000000000..1c5095bbbd088c9d7bbf651f6357b372349e66e1 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinariaAddNewPage/after.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d66582a7e6b4285df7d06e2aa1be7fb47295b9d0f329ba5918eaabd41a7a8cf4 +size 82253 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinariaAddNewPage/before.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinariaAddNewPage/before.png new file mode 100644 index 0000000000000000000000000000000000000000..5d599bacf546f0ead399f8cafb457025bc2e960c --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinariaAddNewPage/before.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af8accc8b44fe1d710ca1a3fca06aedbea120bb28241a29a89dc4ff3dd4df097 +size 78032 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianDetailsPage/after.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianDetailsPage/after.png new file mode 100644 index 0000000000000000000000000000000000000000..7f082709658ae0a54d6073c8d6ff303fb0a6f1f6 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianDetailsPage/after.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4aaa32eca9d11a5bb6965d7b726e498c9fce89638b02b1b773581f9ca37fbbab +size 81204 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianDetailsPage/before.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianDetailsPage/before.png new file mode 100644 index 0000000000000000000000000000000000000000..5d599bacf546f0ead399f8cafb457025bc2e960c --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianDetailsPage/before.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af8accc8b44fe1d710ca1a3fca06aedbea120bb28241a29a89dc4ff3dd4df097 +size 78032 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianDetailsPageCancel/after.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianDetailsPageCancel/after.png new file mode 100644 index 0000000000000000000000000000000000000000..5d599bacf546f0ead399f8cafb457025bc2e960c --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianDetailsPageCancel/after.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af8accc8b44fe1d710ca1a3fca06aedbea120bb28241a29a89dc4ff3dd4df097 +size 78032 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianDetailsPageCancel/before.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianDetailsPageCancel/before.png new file mode 100644 index 0000000000000000000000000000000000000000..7f082709658ae0a54d6073c8d6ff303fb0a6f1f6 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianDetailsPageCancel/before.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4aaa32eca9d11a5bb6965d7b726e498c9fce89638b02b1b773581f9ca37fbbab +size 81204 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianEditPageCancel/after.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianEditPageCancel/after.png new file mode 100644 index 0000000000000000000000000000000000000000..7f082709658ae0a54d6073c8d6ff303fb0a6f1f6 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianEditPageCancel/after.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4aaa32eca9d11a5bb6965d7b726e498c9fce89638b02b1b773581f9ca37fbbab +size 81204 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianEditPageCancel/before.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianEditPageCancel/before.png new file mode 100644 index 0000000000000000000000000000000000000000..0d704d9ba2f55a5bb90346a8c18ef451a6864903 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianEditPageCancel/before.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3379740b9f617bd987cff1ad5182fe46899dd839538cd433c12cc50a6992f48e +size 82115 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianPage/after.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianPage/after.png new file mode 100644 index 0000000000000000000000000000000000000000..5d599bacf546f0ead399f8cafb457025bc2e960c --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianPage/after.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af8accc8b44fe1d710ca1a3fca06aedbea120bb28241a29a89dc4ff3dd4df097 +size 78032 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianPage/before.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianPage/before.png new file mode 100644 index 0000000000000000000000000000000000000000..9552d5707219c08be5031c7e358951cfc32ebcf0 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianPage/before.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5a6c98cf487b0d8918bfe54ee77f3786edb68ffef5ca06646a484635d3b63df7 +size 64267 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianPage/get0_onEveryAction.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianPage/get0_onEveryAction.png new file mode 100644 index 0000000000000000000000000000000000000000..04b1e3ac2c1a87ae822eac2598eb6770a32f4e0a --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianPage/get0_onEveryAction.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a4c03d2ec000142e1d852305b54a9292660f1c201f73923386ae5f9f3ef7003d +size 73329 diff --git a/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianPage/manage1_onEveryAction.png b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianPage/manage1_onEveryAction.png new file mode 100644 index 0000000000000000000000000000000000000000..04b1e3ac2c1a87ae822eac2598eb6770a32f4e0a --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/etc/screenshots/org.woehlke.jakartaee.petclinic.it.ui.TellTheStoryUiTest/veterinarianPage/manage1_onEveryAction.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a4c03d2ec000142e1d852305b54a9292660f1c201f73923386ae5f9f3ef7003d +size 73329 diff --git a/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Application__DB__Class.png b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Application__DB__Class.png new file mode 100644 index 0000000000000000000000000000000000000000..db02e08e917c3d84d57d6c36e2b2e24f58a59cf0 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Application__DB__Class.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c432d564b3164f31e5332932d880799ec372adf27a1bb903b373e73927ebf09e +size 30280 diff --git a/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Application__UseCases.png b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Application__UseCases.png new file mode 100644 index 0000000000000000000000000000000000000000..bdd87d97b5007fc43aba61c1d329a5b38a18e413 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Application__UseCases.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e84aa101d3295ec3556de7b73b3d10322d2854c28cd3cc90ec58421b0358b675 +size 129812 diff --git a/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Application__View__Class.png b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Application__View__Class.png new file mode 100644 index 0000000000000000000000000000000000000000..57cf8c50c3a09250068576a1b47ab4c4ea063aad --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Application__View__Class.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:94f5b496e8b65fd36d770d115353baaebfc0060621f4422d0419c37e5ef9ded5 +size 81129 diff --git a/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Owner__DB__class.png b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Owner__DB__class.png new file mode 100644 index 0000000000000000000000000000000000000000..16d10bc422d2f9e873c5c052567c04595f0f1017 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Owner__DB__class.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e21dd880ecfb25bd735f4abefdb7e6759a8243e98554d5c8643b7af0cd52b4de +size 116068 diff --git a/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Owner__Domain_Class_Modell.png b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Owner__Domain_Class_Modell.png new file mode 100644 index 0000000000000000000000000000000000000000..42fa723b9ecb0c5b087722f1d57c8b73acf91bb9 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Owner__Domain_Class_Modell.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:345ad9a5a3d4ee2a2503501bc8f2dbc5e4ec12c2654daccbaad3fbbd4d769829 +size 107870 diff --git a/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Owner__UseCases.png b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Owner__UseCases.png new file mode 100644 index 0000000000000000000000000000000000000000..562e702a1927d64f46360741e87b703734029285 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Owner__UseCases.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4cf00f50d1205835c132ef61077214cc8770fce4ff96227c2a9327e6ef4cf3b5 +size 75639 diff --git a/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Owner__UseCases__State.png b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Owner__UseCases__State.png new file mode 100644 index 0000000000000000000000000000000000000000..789f511bf51f571be3fbd3cb8047b768be18a863 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Owner__UseCases__State.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5940d36212d6b573c524742967b3261ade7c6562f8e615b38678a84fdb6a4d60 +size 124690 diff --git a/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Owner__View__Class.png b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Owner__View__Class.png new file mode 100644 index 0000000000000000000000000000000000000000..dae0f91bfaf0aeddb37c826e80931c1b9198966e --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Owner__View__Class.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:14fbd7b9d09218d34dbe107a811d352956cd2bec60e7ca735d7bff1bbc5c307b +size 377105 diff --git a/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/PetType__Domain_Class_Modell.png b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/PetType__Domain_Class_Modell.png new file mode 100644 index 0000000000000000000000000000000000000000..d937231c64e858f9246667f679149e1abba5bff7 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/PetType__Domain_Class_Modell.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a17e355532954c6eb3f43c19169b72391a9bed9ba5116823acb16c650450c44d +size 108001 diff --git a/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/PetType__UseCase.png b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/PetType__UseCase.png new file mode 100644 index 0000000000000000000000000000000000000000..57f9ddff836dac86f3ad31bc76d0fa6220af9637 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/PetType__UseCase.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:020dfd127a019c59a79549b856cc328600a3980deca1a51559b1fc0d9a3f02eb +size 71425 diff --git a/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/PetType__UseCase_State.png b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/PetType__UseCase_State.png new file mode 100644 index 0000000000000000000000000000000000000000..316624f966fe4df02be0be93376f71af354dbceb --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/PetType__UseCase_State.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b2d831ec227c03ea22ad4d597b9a95a39854dd163bdd71e2e81cf3ef5132adb1 +size 93522 diff --git a/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Petclinic__Domain_Class_Modell.png b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Petclinic__Domain_Class_Modell.png new file mode 100644 index 0000000000000000000000000000000000000000..a2457224025bb9edf9f3c62d6e3cd0e5a86a7b4f --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Petclinic__Domain_Class_Modell.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6743a1537d4ae1fc7c04e722ea27e9e603816b6b72baecd069550aca4004cd9b +size 146295 diff --git a/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Petclinic__Use_Cases.png b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Petclinic__Use_Cases.png new file mode 100644 index 0000000000000000000000000000000000000000..cf7fed5b4b1086dc1e2edaa6f9fd99683b50fb7a --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Petclinic__Use_Cases.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:30aff6ed06e714908a62c5147a1702613a33f8e6f0e2cbb4a0200898f1de19da +size 165714 diff --git a/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Specialty__Domain_Class_Modell.png b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Specialty__Domain_Class_Modell.png new file mode 100644 index 0000000000000000000000000000000000000000..9753fbaf5d7225240d86ef0f260eeb8eb0d5197d --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Specialty__Domain_Class_Modell.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:193f61510b4ffa9717f26b1b6e491b9268f459d61c0c4b34c74b8d3d59b180a5 +size 89017 diff --git a/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Specialty__Ui.png b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Specialty__Ui.png new file mode 100644 index 0000000000000000000000000000000000000000..4e5be58712df27ec9a22fe2205d2c6e197410ace --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Specialty__Ui.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f39a22659d937a3f24b9edf9e9c9e855f9544129fc1e897492831ddd3ab5aa2a +size 5601 diff --git a/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Specialty__UseCase.png b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Specialty__UseCase.png new file mode 100644 index 0000000000000000000000000000000000000000..2e114ac877b795ea1704fdcde834a2f0dd49d3ff --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Specialty__UseCase.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:04a37cc9ef25b7fee51a2c4f2848d0bffc62725b03b0dd9a0e2f5be971f30c5e +size 72799 diff --git a/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Specialty__UseCase__State.png b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Specialty__UseCase__State.png new file mode 100644 index 0000000000000000000000000000000000000000..7a2c4f78c718990667de0b2310ad1c3caf91a93d --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Specialty__UseCase__State.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:73a68e63bbf8518f2cb7eb06b107835eefb816b6d81e8ff1ee228402ca1c48ec +size 91066 diff --git a/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Vet__DB__Class.png b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Vet__DB__Class.png new file mode 100644 index 0000000000000000000000000000000000000000..c504bc43c6a68adacb5ddbce392734e751a53c6f --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Vet__DB__Class.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca912ff162bb0cab4e18478c84c0870fe22a3f93a95034facdd5d42ba51f2b8e +size 78828 diff --git a/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Vet__Domain_Class_Modell.png b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Vet__Domain_Class_Modell.png new file mode 100644 index 0000000000000000000000000000000000000000..d53ad30177d1bad1a82b3a4e81cd7d8c5db48a9a --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Vet__Domain_Class_Modell.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b8ab490296e0caa87daabcc6ae2a42c4c54dffbb9135496da0c55cec7c923bee +size 86940 diff --git a/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Vet__UseCase.png b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Vet__UseCase.png new file mode 100644 index 0000000000000000000000000000000000000000..3819ffed6c62a9cf8a5c5f5d8f4102c7c33aa9ef --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Vet__UseCase.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:48a132b7217bd7587376e61f5e2282c6d302316629ea727019059a295fe27a76 +size 67527 diff --git a/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Vet__UseCase__State.png b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Vet__UseCase__State.png new file mode 100644 index 0000000000000000000000000000000000000000..d36b56556fac01dd843522d92f1f7f0f1fcfdd5f --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Vet__UseCase__State.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c46555b6eceb924db1ac88ad98c20567764b33fd4d488c0d0853ab2dde83af95 +size 104578 diff --git a/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Vet__View__Class.png b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Vet__View__Class.png new file mode 100644 index 0000000000000000000000000000000000000000..9ca602d49a3e4e74ac6460aa892a304830337ce3 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/Vet__View__Class.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:594b21d1a8a651c048c48fcefb63df9fee67be383c250908cbca0e5edd1b5a73 +size 289345 diff --git a/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/logos/Jakarta_10__22_09_2022.jpg b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/logos/Jakarta_10__22_09_2022.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c31b6df93217bcaa3ada39d261b7a3739c1d6591 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/logos/Jakarta_10__22_09_2022.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2584e98656c81a219ae439b1b3840ad2449291bce61edff4dc3552250d6eb9fd +size 41670 diff --git a/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/logos/home_logo_jakartaee.png b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/logos/home_logo_jakartaee.png new file mode 100644 index 0000000000000000000000000000000000000000..2daa056e9188dfd68216b289a9a40ad35704064c --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/logos/home_logo_jakartaee.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ae5110e287bbabfca5b9b841d2f1f073d35c2bd94faf250fa333d2a08ac44301 +size 9265 diff --git a/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/logos/home_logo_microprofile.png b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/logos/home_logo_microprofile.png new file mode 100644 index 0000000000000000000000000000000000000000..13894b7da3eeda17f32afec81f1ac11ec292ead5 --- /dev/null +++ b/benchmark/whole_applications/petclinic/jakarta/src/main/webapp/img/logos/home_logo_microprofile.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0ebdef1646ba8f74703f49fa8b2a50e7c2c5fc385e63d06347433fc0bae20d3e +size 19631