diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 00000000..a7605f17
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,33 @@
+
+{
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "type": "java",
+ "name": "Main",
+ "request": "launch",
+ "mainClass": "Main"
+ },
+ {
+ "name": "Python: Debug sebs.py Command",
+ "type": "python",
+ "request": "launch",
+ "program": "${workspaceFolder}/sebs.py",
+ "args": [
+ "benchmark",
+ "invoke",
+ "602.login-checker",
+ "test",
+ "--config",
+ "config/login-checker-config.json",
+ "--deployment",
+ "openwhisk",
+ "--verbose"
+ ],
+ "console": "integratedTerminal",
+ "cwd": "${workspaceFolder}",
+ "justMyCode": false
+ }
+ ]
+ }
+
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 00000000..c5f3f6b9
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "java.configuration.updateBuildConfiguration": "interactive"
+}
\ No newline at end of file
diff --git a/benchmarks/600.java/601.hello-world/input.py b/benchmarks/600.java/601.hello-world/input.py
new file mode 100644
index 00000000..e69de29b
diff --git a/benchmarks/600.java/602.login-checker/config.json b/benchmarks/600.java/602.login-checker/config.json
new file mode 100644
index 00000000..4a592102
--- /dev/null
+++ b/benchmarks/600.java/602.login-checker/config.json
@@ -0,0 +1,6 @@
+{
+ "timeout": 60,
+ "memory": 24,
+ "languages": ["java"]
+}
+
diff --git a/benchmarks/600.java/602.login-checker/input.py b/benchmarks/600.java/602.login-checker/input.py
new file mode 100644
index 00000000..136f8bc5
--- /dev/null
+++ b/benchmarks/600.java/602.login-checker/input.py
@@ -0,0 +1,5 @@
+def buckets_count():
+ return (0, 0)
+
+def generate_input(data_dir, size, benchmarks_bucket, input_paths, output_paths, upload_func):
+ return { }
\ No newline at end of file
diff --git a/benchmarks/600.java/602.login-checker/java/pom.xml b/benchmarks/600.java/602.login-checker/java/pom.xml
new file mode 100644
index 00000000..ea706a39
--- /dev/null
+++ b/benchmarks/600.java/602.login-checker/java/pom.xml
@@ -0,0 +1,58 @@
+
+
+ 4.0.0
+
+ faas
+ benchmark
+ 1
+
+
+ 8
+ 8
+ UTF-8
+
+
+
+
+
+ com.google.code.gson
+ gson
+ 2.11.0
+
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.17.2
+
+
+
+ com.fasterxml.jackson.core
+ jackson-core
+ 2.17.2
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 3.2.4
+
+
+ package
+
+ shade
+
+
+ false
+
+
+
+
+
+
+
diff --git a/benchmarks/600.java/602.login-checker/java/src/main/java/faas/App.java b/benchmarks/600.java/602.login-checker/java/src/main/java/faas/App.java
new file mode 100644
index 00000000..ff55cef8
--- /dev/null
+++ b/benchmarks/600.java/602.login-checker/java/src/main/java/faas/App.java
@@ -0,0 +1,26 @@
+package faas;
+import com.google.gson.Gson;
+import com.google.gson.JsonObject;
+import util.SessionBlob;
+import util.ShaSecurityProvider;
+
+//import jakarta.ws.rs.core.Response;
+
+
+public class App {
+ public JsonObject handler(JsonObject args) {
+ Gson gson = new Gson();
+ SessionBlob blob = gson.fromJson(args, SessionBlob.class);
+
+ ShaSecurityProvider securityProvider = new ShaSecurityProvider();
+ SessionBlob validatedBlob = securityProvider.validate(blob);
+
+ JsonObject jsonResult = new JsonObject();
+ if (validatedBlob != null)
+ jsonResult.addProperty("Authorization-Status", "Authorized");
+ else
+ jsonResult.addProperty("Authorization-Status", "Unauthorized");
+ return jsonResult;
+ }
+}
+
diff --git a/benchmarks/600.java/602.login-checker/java/src/main/java/util/ConstantKeyProvider.java b/benchmarks/600.java/602.login-checker/java/src/main/java/util/ConstantKeyProvider.java
new file mode 100644
index 00000000..ed377e1f
--- /dev/null
+++ b/benchmarks/600.java/602.login-checker/java/src/main/java/util/ConstantKeyProvider.java
@@ -0,0 +1,21 @@
+package util;
+
+
+/**
+ * Class for testing. Provides a constant key. DO NOT ADOPT THIS FOR ANY REAL
+ * PRODUCTION WORKLOAD!
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public class ConstantKeyProvider implements IKeyProvider {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getKey(SessionBlob blob) {
+ return "thebestsecretkey";
+ }
+
+}
diff --git a/benchmarks/600.java/602.login-checker/java/src/main/java/util/IKeyProvider.java b/benchmarks/600.java/602.login-checker/java/src/main/java/util/IKeyProvider.java
new file mode 100644
index 00000000..c78e0dd0
--- /dev/null
+++ b/benchmarks/600.java/602.login-checker/java/src/main/java/util/IKeyProvider.java
@@ -0,0 +1,23 @@
+
+package util;
+
+/**
+ * Provides keys for the security provider. The key provider must ensure that
+ * keys accross replicated stores are consistent.
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public interface IKeyProvider {
+
+ /**
+ * Returns a key for a session blob. Key must be the same, regardless of the
+ * store instance upon which this call is made.
+ *
+ * @param blob
+ * The blob to secure.
+ * @return The key.
+ */
+ public String getKey(SessionBlob blob);
+
+}
diff --git a/benchmarks/600.java/602.login-checker/java/src/main/java/util/ISecurityProvider.java b/benchmarks/600.java/602.login-checker/java/src/main/java/util/ISecurityProvider.java
new file mode 100644
index 00000000..8d710001
--- /dev/null
+++ b/benchmarks/600.java/602.login-checker/java/src/main/java/util/ISecurityProvider.java
@@ -0,0 +1,39 @@
+package util;
+
+
+/**
+ * Utilities for securing (e.g. encrypting) session blobs.
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public interface ISecurityProvider {
+
+ /**
+ * Get the key provider for this security provider.
+ *
+ * @return The key provider.
+ */
+ public IKeyProvider getKeyProvider();
+
+ /**
+ * Secures a session blob. May encrypt or hash values within the blob.
+ *
+ * @param blob
+ * The blob to secure.
+ * @return A secure blob to be passed on to the web ui.
+ */
+ public SessionBlob secure(SessionBlob blob);
+
+ /**
+ * Validates a secured session blob. Returns a valid and readable (e.g.
+ * decrypted) blob. Returns null for invalid blobs.
+ *
+ * @param blob
+ * The blob to secure.
+ * @return The valid and readable (e.g. decrypted) blob. Returns null for
+ * invalid blobs.
+ */
+ public SessionBlob validate(SessionBlob blob);
+
+}
diff --git a/benchmarks/600.java/602.login-checker/java/src/main/java/util/Order.java b/benchmarks/600.java/602.login-checker/java/src/main/java/util/Order.java
new file mode 100644
index 00000000..95434605
--- /dev/null
+++ b/benchmarks/600.java/602.login-checker/java/src/main/java/util/Order.java
@@ -0,0 +1,281 @@
+
+package util;
+
+/**
+ * Entity for orders.
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public class Order {
+
+ private long id;
+ private long userId;
+ private String time;
+
+ private long totalPriceInCents;
+ private String addressName;
+ private String address1;
+ private String address2;
+
+ private String creditCardCompany;
+ private String creditCardNumber;
+ private String creditCardExpiryDate;
+
+ /**
+ * Create a new and empty order.
+ */
+ public Order() {
+
+ }
+
+ /**
+ * Every entity needs a copy constructor.
+ *
+ * @param order
+ * The order to copy.
+ */
+ public Order(Order order) {
+ setId(order.getId());
+ setUserId(order.getUserId());
+ setTime(order.getTime());
+ setTotalPriceInCents(order.getTotalPriceInCents());
+ setAddressName(order.getAddressName());
+ setAddress1(order.getAddress1());
+ setAddress2(order.getAddress2());
+ setCreditCardCompany(order.getCreditCardCompany());
+ setCreditCardNumber(order.getCreditCardNumber());
+ setCreditCardExpiryDate(order.getCreditCardExpiryDate());
+ }
+
+ /**
+ * Get the id (remember that this ID may be incorrect, especially if a separate id was passed).
+ *
+ * @return The id.
+ */
+ public long getId() {
+ return id;
+ }
+
+ /**
+ * For REST use only. Sets the ID. Ignored by persistence.
+ *
+ * @param id
+ * ID, as passed by the REST API.
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ /**
+ * Get the User id.
+ *
+ * @return the userId.
+ */
+ public long getUserId() {
+ return userId;
+ }
+
+ /**
+ * Set the User Id.
+ *
+ * @param userId
+ * the userId to set.
+ */
+ public void setUserId(long userId) {
+ this.userId = userId;
+ }
+
+ /**
+ * Get the time of order (ISO formatted). Formatted using {@link DateTimeFormatter.ISO_LOCAL_DATE_TIME}.
+ *
+ * @return the time.
+ */
+ public String getTime() {
+ return time;
+ }
+
+ /**
+ * Set the time of order (ISO formatted). Format using {@link DateTimeFormatter.ISO_LOCAL_DATE_TIME}.
+ *
+ * @param time
+ * the time to set.
+ */
+ public void setTime(String time) {
+ this.time = time;
+ }
+
+ /**
+ * Get the total price in cents.
+ *
+ * @return the totalPriceInCents.
+ */
+ public long getTotalPriceInCents() {
+ return totalPriceInCents;
+ }
+
+ /**
+ * Set the total price in cents.
+ *
+ * @param totalPriceInCents
+ * the totalPriceInCents to set.
+ */
+ public void setTotalPriceInCents(long totalPriceInCents) {
+ this.totalPriceInCents = totalPriceInCents;
+ }
+
+ /**
+ * Get the name for the address.
+ *
+ * @return the addressName.
+ */
+ public String getAddressName() {
+ return addressName;
+ }
+
+ /**
+ * Set the name for the address.
+ *
+ * @param addressName
+ * the addressName to set.
+ */
+ public void setAddressName(String addressName) {
+ this.addressName = addressName;
+ }
+
+ /**
+ * Get address line 1.
+ *
+ * @return the address1.
+ */
+ public String getAddress1() {
+ return address1;
+ }
+
+ /**
+ * Set address line 1.
+ *
+ * @param address1
+ * the address1 to set.
+ */
+ public void setAddress1(String address1) {
+ this.address1 = address1;
+ }
+
+ /**
+ * Get address line 2.
+ *
+ * @return the address2.
+ */
+ public String getAddress2() {
+ return address2;
+ }
+
+ /**
+ * Set address line 2.
+ *
+ * @param address2
+ * the address2 to set.
+ */
+ public void setAddress2(String address2) {
+ this.address2 = address2;
+ }
+
+ /**
+ * Get the name of the credit card company.
+ *
+ * @return the creditCardCompany.
+ */
+ public String getCreditCardCompany() {
+ return creditCardCompany;
+ }
+
+ /**
+ * Set the name of the credit card company.
+ *
+ * @param creditCardCompany
+ * the creditCardCompany to set.
+ */
+ public void setCreditCardCompany(String creditCardCompany) {
+ this.creditCardCompany = creditCardCompany;
+ }
+
+ /**
+ * Get the credit card number.
+ *
+ * @return the creditCardNumber.
+ */
+ public String getCreditCardNumber() {
+ return creditCardNumber;
+ }
+
+ /**
+ * Set the credit card number.
+ *
+ * @param creditCardNumber
+ * the creditCardNumber to set.
+ */
+ public void setCreditCardNumber(String creditCardNumber) {
+ this.creditCardNumber = creditCardNumber;
+ }
+
+ /**
+ * Get the credit card expiry date (ISO formatted). Formatted using {@link DateTimeFormatter.ISO_LOCAL_DATE}.
+ *
+ * @return the creditCardExpiryDate.
+ */
+ public String getCreditCardExpiryDate() {
+ return creditCardExpiryDate;
+ }
+
+ /**
+ * Set the credit card expiry date (ISO formatted). Format using {@link DateTimeFormatter.ISO_LOCAL_DATE}.
+ *
+ * @param creditCardExpiryDate
+ * the creditCardExpiryDate to set.
+ */
+ public void setCreditCardExpiryDate(String creditCardExpiryDate) {
+ this.creditCardExpiryDate = creditCardExpiryDate;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (id ^ (id >>> 32));
+ result = prime * result + (int) (userId ^ (userId >>> 32));
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Order other = (Order) obj;
+ if (id != other.id) {
+ return false;
+ }
+ if (userId != other.userId) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/benchmarks/600.java/602.login-checker/java/src/main/java/util/OrderItem.java b/benchmarks/600.java/602.login-checker/java/src/main/java/util/OrderItem.java
new file mode 100644
index 00000000..f0c01fe9
--- /dev/null
+++ b/benchmarks/600.java/602.login-checker/java/src/main/java/util/OrderItem.java
@@ -0,0 +1,179 @@
+
+package util;
+
+/**
+ * Entity Class for OrderItems (item with quantity in shopping cart or order).
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public class OrderItem {
+
+ private long id;
+ private long productId;
+ private long orderId;
+ private int quantity;
+ private long unitPriceInCents;
+
+ /**
+ * Create a new and empty OrderItem.
+ */
+ public OrderItem() {
+
+ }
+
+ /**
+ * Every Entity needs a Copy-Constructor!
+ *
+ * @param orderItem
+ * The entity to Copy.
+ */
+ public OrderItem(OrderItem orderItem) {
+ setId(orderItem.getId());
+ setProductId(orderItem.getProductId());
+ setOrderId(orderItem.getOrderId());
+ setQuantity(orderItem.getQuantity());
+ setUnitPriceInCents(orderItem.getUnitPriceInCents());
+ }
+
+ /**
+ * Get the id (remember that this ID may be incorrect, especially if a separate id was passed).
+ *
+ * @return The id.
+ */
+ public long getId() {
+ return id;
+ }
+
+ /**
+ * For REST use only. Sets the ID. Ignored by persistence.
+ *
+ * @param id
+ * ID, as passed by the REST API.
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ /**
+ * ID of the order item's product.
+ *
+ * @return Product Id;
+ */
+ public long getProductId() {
+ return productId;
+ }
+
+ /**
+ * Sets the ID of the order item's product. Every order Item MUST have a valid product ID.
+ *
+ * @param productId
+ * The product ID to set.
+ */
+ public void setProductId(long productId) {
+ this.productId = productId;
+ }
+
+ /**
+ * Get the quantity (amount in shopping cart/order).
+ *
+ * @return The quantity.
+ */
+ public int getQuantity() {
+ return quantity;
+ }
+
+ /**
+ * Set the quantity (amount in shopping cart/order).
+ *
+ * @param quantity
+ * The quantity.
+ */
+ public void setQuantity(int quantity) {
+ this.quantity = quantity;
+ }
+
+ /**
+ * The price per single item in the order item.
+ *
+ * @return Price per single item.
+ */
+ public long getUnitPriceInCents() {
+ return unitPriceInCents;
+ }
+
+ /**
+ * Set the price per single item in the order item.
+ *
+ * @param unitPriceInCents
+ * Price per single item.
+ */
+ public void setUnitPriceInCents(long unitPriceInCents) {
+ this.unitPriceInCents = unitPriceInCents;
+ }
+
+ /**
+ * Gets the ID of the order item's order.
+ *
+ * @return The order ID.
+ */
+ public long getOrderId() {
+ return orderId;
+ }
+
+ /**
+ * Sets the ID of the order item's order. Persistence requires that every order item MUST have a valid order ID. For
+ * persistence the order must already exist in database.
+ *
+ * @param orderId
+ * The order ID to set.
+ */
+ public void setOrderId(long orderId) {
+ this.orderId = orderId;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (id ^ (id >>> 32));
+ result = prime * result + (int) (orderId ^ (orderId >>> 32));
+ result = prime * result + (int) (productId ^ (productId >>> 32));
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ OrderItem other = (OrderItem) obj;
+ if (id != other.id) {
+ return false;
+ }
+ if (orderId != other.orderId) {
+ return false;
+ }
+ if (productId != other.productId) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/benchmarks/600.java/602.login-checker/java/src/main/java/util/SessionBlob.java b/benchmarks/600.java/602.login-checker/java/src/main/java/util/SessionBlob.java
new file mode 100644
index 00000000..6875efa4
--- /dev/null
+++ b/benchmarks/600.java/602.login-checker/java/src/main/java/util/SessionBlob.java
@@ -0,0 +1,133 @@
+package util;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Blob containing all information about the user session.
+ * @author Simon
+ */
+public class SessionBlob {
+
+ private Long uid;
+ private String sid;
+ private String token;
+ private Order order;
+ private List orderItems = new LinkedList();
+ private String message;
+
+ /**
+ * Constructor, creates an empty order.
+ */
+ public SessionBlob() {
+ this.setOrder(new Order());
+ }
+
+ /**
+ * Getter for the userid.
+ * @return userid
+ */
+ public Long getUID() {
+ return uid;
+ }
+
+ /**
+ * Setter for the userid.
+ * @param uID userid
+ */
+ public void setUID(Long uID) {
+ uid = uID;
+ }
+
+ /**
+ * Getter for session id.
+ * @return session id
+ */
+ public String getSID() {
+ return sid;
+ }
+
+ /**
+ * Setter for session id.
+ * @param sID session id
+ */
+ public void setSID(String sID) {
+ sid = sID;
+ }
+
+ /**
+ * Getter for trust token.
+ * @return trust token
+ */
+ public String getToken() {
+ return token;
+ }
+
+ /**
+ * Setter for trust token.
+ * @param token trust token.
+ */
+ public void setToken(String token) {
+ this.token = token;
+ }
+
+ /**
+ * Setter for the message.
+ * @param message String
+ */
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ /**
+ * Getter for the message.
+ * @return message
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * Getter for order.
+ * @return order
+ */
+ public Order getOrder() {
+ return order;
+ }
+
+ /**
+ * Setter for order.
+ * @param order order
+ */
+ public void setOrder(Order order) {
+ this.order = order;
+ }
+
+ /**
+ * Getter for order items.
+ * @return order items.
+ */
+ public List getOrderItems() {
+ return orderItems;
+ }
+
+ /**
+ * Setter for order items.
+ * @param orderItems list of order items
+ */
+ public void setOrderItems(List orderItems) {
+ this.orderItems = orderItems;
+ }
+
+ @Override
+ public String toString() {
+ return "ClassName{" +
+ "uid=" + uid +
+ ", sid='" + sid + '\'' +
+ ", token='" + token + '\'' +
+ ", order=" + (order != null ? order.toString() : "null") +
+ ", orderItems=" + (orderItems != null ? orderItems.toString() : "null") +
+ ", message='" + message + '\'' +
+ '}';
+ }
+}
diff --git a/benchmarks/600.java/602.login-checker/java/src/main/java/util/ShaSecurityProvider.java b/benchmarks/600.java/602.login-checker/java/src/main/java/util/ShaSecurityProvider.java
new file mode 100644
index 00000000..d9c88f90
--- /dev/null
+++ b/benchmarks/600.java/602.login-checker/java/src/main/java/util/ShaSecurityProvider.java
@@ -0,0 +1,79 @@
+package util;
+
+import java.io.UnsupportedEncodingException;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import java.net.URLEncoder;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * Secruity provider uscom.fasterxml.jackson.databind.Objecting AES.
+ *
+ * @author Simon
+ *
+ */
+public class ShaSecurityProvider implements ISecurityProvider {
+
+ @Override
+ public IKeyProvider getKeyProvider() {
+ return new ConstantKeyProvider();
+ }
+
+ @Override
+ public SessionBlob secure(SessionBlob blob) {
+ if (blob.getUID() == null || blob.getSID() == null) {
+ return blob;
+ }
+ blob.setToken(null);
+ String blobString = blobToString(blob);
+ blob.setToken(getSha512(blobString));
+ return blob;
+ }
+
+ private String blobToString(SessionBlob blob) {
+ ObjectMapper o = new ObjectMapper();
+ try {
+ return URLEncoder.encode(o.writeValueAsString(blob), "UTF-8");
+ } catch (JsonProcessingException | UnsupportedEncodingException e)
+ {
+ throw new IllegalStateException("Could not save blob!");
+ }
+ }
+
+ @Override
+ public SessionBlob validate(SessionBlob blob) {
+ if (blob.getToken() == null) {
+ return null;
+ }
+
+ String token = blob.getToken();
+ blob.setToken(null);
+ String blobString = blobToString(blob);
+ String validationToken = getSha512(blobString);
+ if (validationToken.equals(token)) {
+ return blob;
+ }
+ return null;
+ }
+
+ private String getSha512(String passwordToHash) {
+ String generatedPassword = null;
+ try {
+ String salt = getKeyProvider().getKey(null);
+ MessageDigest md = MessageDigest.getInstance("SHA-512");
+ md.update(salt.getBytes("UTF-8"));
+ byte[] bytes = md.digest(passwordToHash.getBytes("UTF-8"));
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < bytes.length; i++) {
+ sb.append(Integer.toString((bytes[i] & 0xff) + 0x100, 16).substring(1));
+ }
+ generatedPassword = sb.toString();
+ } catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ return generatedPassword;
+ }
+}
diff --git a/benchmarks/600.java/603.train-recommender/config.json b/benchmarks/600.java/603.train-recommender/config.json
new file mode 100644
index 00000000..11be1ace
--- /dev/null
+++ b/benchmarks/600.java/603.train-recommender/config.json
@@ -0,0 +1,6 @@
+{
+ "timeout": 60,
+ "memory": 512,
+ "languages": ["java"]
+}
+
\ No newline at end of file
diff --git a/benchmarks/600.java/603.train-recommender/input.py b/benchmarks/600.java/603.train-recommender/input.py
new file mode 100644
index 00000000..0db725de
--- /dev/null
+++ b/benchmarks/600.java/603.train-recommender/input.py
@@ -0,0 +1,5 @@
+def buckets_count():
+ return (0, 0)
+
+def generate_input(data_dir, size, benchmarks_bucket, input_paths, output_paths, upload_func):
+ return {"orderItems":[{"id":0,"productId":201,"orderId":1,"quantity":2,"unitPriceInCents":0},{"id":0,"productId":202,"orderId":1,"quantity":1,"unitPriceInCents":0},{"id":0,"productId":203,"orderId":2,"quantity":5,"unitPriceInCents":0}],"orders":[{"id":1,"userId":101,"totalPriceInCents":0},{"id":2,"userId":102,"totalPriceInCents":0}]}
diff --git a/benchmarks/600.java/603.train-recommender/java/pom.xml b/benchmarks/600.java/603.train-recommender/java/pom.xml
new file mode 100644
index 00000000..9c9494cf
--- /dev/null
+++ b/benchmarks/600.java/603.train-recommender/java/pom.xml
@@ -0,0 +1,46 @@
+
+
+ 4.0.0
+
+ faas
+ benchmark
+ 1
+
+
+ 8
+ 8
+ UTF-8
+
+
+
+
+
+ com.google.code.gson
+ gson
+ 2.11.0
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 3.2.4
+
+
+ package
+
+ shade
+
+
+ false
+
+
+
+
+
+
+
diff --git a/benchmarks/600.java/603.train-recommender/java/src/main/java/faas/App.java b/benchmarks/600.java/603.train-recommender/java/src/main/java/faas/App.java
new file mode 100644
index 00000000..7db2fafb
--- /dev/null
+++ b/benchmarks/600.java/603.train-recommender/java/src/main/java/faas/App.java
@@ -0,0 +1,119 @@
+package faas;
+import com.google.gson.*;
+import utils.Order;
+import utils.OrderItem;
+import utils.OrderItemSet;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.HashMap;
+
+public class App {
+
+
+ private static boolean trainingFinished = false;
+
+ public static final int MAX_NUMBER_OF_RECOMMENDATIONS = 10;
+
+
+
+ public static JsonObject handler(JsonObject args) {
+ Gson gson = new Gson();
+ JsonObject jsonResult = new JsonObject();
+ // Deserialize JSON input to Lists of OrderItem and Order
+ JsonArray orderItemsArray = args.getAsJsonArray("orderItems");
+ JsonArray ordersArray = args.getAsJsonArray("orders");
+
+ List orderItems = new ArrayList<>();
+ for (JsonElement element : orderItemsArray) {
+ orderItems.add(gson.fromJson(element, OrderItem.class));
+ }
+
+ List orders = new ArrayList<>();
+ for (JsonElement element : ordersArray) {
+ orders.add(gson.fromJson(element, Order.class));
+ }
+ Map> userBuyingMatrix;
+ Map> userItemSets;
+ Set totalProducts;
+ long tic = System.currentTimeMillis();
+ totalProducts = new HashSet<>();
+ // first create order mapping unorderized
+ Map unOrderizeditemSets = new HashMap<>();
+ for (OrderItem orderItem : orderItems) {
+ if (!unOrderizeditemSets.containsKey(orderItem.getOrderId())) {
+ unOrderizeditemSets.put(orderItem.getOrderId(), new OrderItemSet());
+ unOrderizeditemSets.get(orderItem.getOrderId()).setOrderId(orderItem.getOrderId());
+ }
+ unOrderizeditemSets.get(orderItem.getOrderId()).getOrderset().put(orderItem.getProductId(),
+ orderItem.getQuantity());
+ // see, if we already have our item
+ if (!totalProducts.contains(orderItem.getProductId())) {
+ // if not known yet -> add
+ totalProducts.add(orderItem.getProductId());
+ }
+ }
+ // now map each id with the corresponding order
+ Map itemSets = new HashMap<>();
+ for (Long orderid : unOrderizeditemSets.keySet()) {
+ Order realOrder = findOrder(orders, orderid);
+ itemSets.put(realOrder, unOrderizeditemSets.get(orderid));
+ }
+ userItemSets = new HashMap<>();
+ for (Order order : itemSets.keySet()) {
+ if (!userItemSets.containsKey(order.getUserId())) {
+ userItemSets.put(order.getUserId(), new HashSet());
+ }
+ itemSets.get(order).setUserId(order.getUserId());
+ userItemSets.get(order.getUserId()).add(itemSets.get(order));
+ }
+ userBuyingMatrix = createUserBuyingMatrix(userItemSets);
+ executePreprocessing();
+ trainingFinished = true;
+ jsonResult.addProperty("trainingFinished", trainingFinished);
+ return jsonResult;
+ }
+ protected static void executePreprocessing() {
+ // do nothing
+ }
+
+ private static Order findOrder(List orders, long orderid) {
+ for (Order order : orders) {
+ if (order.getId() == orderid) {
+ return order;
+ }
+ }
+ return null;
+ }
+
+ private static Map> createUserBuyingMatrix(Map> useritemsets) {
+ Map> matrix = new HashMap<>();
+ // for each user
+ for (Map.Entry> entry : useritemsets.entrySet()) {
+ // create a new line for this user-ID
+ Map line = new HashMap<>();
+ // for all orders of that user
+ for (OrderItemSet orderset : entry.getValue()) {
+ // for all orderitems of that orderset
+ for (Entry product : orderset.getOrderset().entrySet()) {
+ // if key was not known before -> first occurence
+ if (!line.containsKey(product.getKey())) {
+ line.put(product.getKey(), Double.valueOf(product.getValue()));
+ } else {
+ // if key was known before -> increase counter
+ line.put(product.getKey(), Double.valueOf(line.get(product.getKey()) + product.getValue()));
+ }
+ }
+ }
+ // add this user-ID to the matrix
+ matrix.put(entry.getKey(), line);
+ }
+ return matrix;
+ }
+
+ }
+//}
diff --git a/benchmarks/600.java/603.train-recommender/java/src/main/java/util/Order.java b/benchmarks/600.java/603.train-recommender/java/src/main/java/util/Order.java
new file mode 100644
index 00000000..975e828a
--- /dev/null
+++ b/benchmarks/600.java/603.train-recommender/java/src/main/java/util/Order.java
@@ -0,0 +1,293 @@
+/**
+ * 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.
+ */
+package utils;
+
+/**
+ * Entity for orders.
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public class Order {
+
+ private long id;
+ private long userId;
+ private String time;
+
+ private long totalPriceInCents;
+ private String addressName;
+ private String address1;
+ private String address2;
+
+ private String creditCardCompany;
+ private String creditCardNumber;
+ private String creditCardExpiryDate;
+
+ /**
+ * Create a new and empty order.
+ */
+ public Order() {
+
+ }
+
+ /**
+ * Every entity needs a copy constructor.
+ *
+ * @param order
+ * The order to copy.
+ */
+ public Order(Order order) {
+ setId(order.getId());
+ setUserId(order.getUserId());
+ setTime(order.getTime());
+ setTotalPriceInCents(order.getTotalPriceInCents());
+ setAddressName(order.getAddressName());
+ setAddress1(order.getAddress1());
+ setAddress2(order.getAddress2());
+ setCreditCardCompany(order.getCreditCardCompany());
+ setCreditCardNumber(order.getCreditCardNumber());
+ setCreditCardExpiryDate(order.getCreditCardExpiryDate());
+ }
+
+ /**
+ * Get the id (remember that this ID may be incorrect, especially if a separate id was passed).
+ *
+ * @return The id.
+ */
+ public long getId() {
+ return id;
+ }
+
+ /**
+ * For REST use only. Sets the ID. Ignored by persistence.
+ *
+ * @param id
+ * ID, as passed by the REST API.
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ /**
+ * Get the User id.
+ *
+ * @return the userId.
+ */
+ public long getUserId() {
+ return userId;
+ }
+
+ /**
+ * Set the User Id.
+ *
+ * @param userId
+ * the userId to set.
+ */
+ public void setUserId(long userId) {
+ this.userId = userId;
+ }
+
+ /**
+ * Get the time of order (ISO formatted). Formatted using {@link DateTimeFormatter.ISO_LOCAL_DATE_TIME}.
+ *
+ * @return the time.
+ */
+ public String getTime() {
+ return time;
+ }
+
+ /**
+ * Set the time of order (ISO formatted). Format using {@link DateTimeFormatter.ISO_LOCAL_DATE_TIME}.
+ *
+ * @param time
+ * the time to set.
+ */
+ public void setTime(String time) {
+ this.time = time;
+ }
+
+ /**
+ * Get the total price in cents.
+ *
+ * @return the totalPriceInCents.
+ */
+ public long getTotalPriceInCents() {
+ return totalPriceInCents;
+ }
+
+ /**
+ * Set the total price in cents.
+ *
+ * @param totalPriceInCents
+ * the totalPriceInCents to set.
+ */
+ public void setTotalPriceInCents(long totalPriceInCents) {
+ this.totalPriceInCents = totalPriceInCents;
+ }
+
+ /**
+ * Get the name for the address.
+ *
+ * @return the addressName.
+ */
+ public String getAddressName() {
+ return addressName;
+ }
+
+ /**
+ * Set the name for the address.
+ *
+ * @param addressName
+ * the addressName to set.
+ */
+ public void setAddressName(String addressName) {
+ this.addressName = addressName;
+ }
+
+ /**
+ * Get address line 1.
+ *
+ * @return the address1.
+ */
+ public String getAddress1() {
+ return address1;
+ }
+
+ /**
+ * Set address line 1.
+ *
+ * @param address1
+ * the address1 to set.
+ */
+ public void setAddress1(String address1) {
+ this.address1 = address1;
+ }
+
+ /**
+ * Get address line 2.
+ *
+ * @return the address2.
+ */
+ public String getAddress2() {
+ return address2;
+ }
+
+ /**
+ * Set address line 2.
+ *
+ * @param address2
+ * the address2 to set.
+ */
+ public void setAddress2(String address2) {
+ this.address2 = address2;
+ }
+
+ /**
+ * Get the name of the credit card company.
+ *
+ * @return the creditCardCompany.
+ */
+ public String getCreditCardCompany() {
+ return creditCardCompany;
+ }
+
+ /**
+ * Set the name of the credit card company.
+ *
+ * @param creditCardCompany
+ * the creditCardCompany to set.
+ */
+ public void setCreditCardCompany(String creditCardCompany) {
+ this.creditCardCompany = creditCardCompany;
+ }
+
+ /**
+ * Get the credit card number.
+ *
+ * @return the creditCardNumber.
+ */
+ public String getCreditCardNumber() {
+ return creditCardNumber;
+ }
+
+ /**
+ * Set the credit card number.
+ *
+ * @param creditCardNumber
+ * the creditCardNumber to set.
+ */
+ public void setCreditCardNumber(String creditCardNumber) {
+ this.creditCardNumber = creditCardNumber;
+ }
+
+ /**
+ * Get the credit card expiry date (ISO formatted). Formatted using {@link DateTimeFormatter.ISO_LOCAL_DATE}.
+ *
+ * @return the creditCardExpiryDate.
+ */
+ public String getCreditCardExpiryDate() {
+ return creditCardExpiryDate;
+ }
+
+ /**
+ * Set the credit card expiry date (ISO formatted). Format using {@link DateTimeFormatter.ISO_LOCAL_DATE}.
+ *
+ * @param creditCardExpiryDate
+ * the creditCardExpiryDate to set.
+ */
+ public void setCreditCardExpiryDate(String creditCardExpiryDate) {
+ this.creditCardExpiryDate = creditCardExpiryDate;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (id ^ (id >>> 32));
+ result = prime * result + (int) (userId ^ (userId >>> 32));
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Order other = (Order) obj;
+ if (id != other.id) {
+ return false;
+ }
+ if (userId != other.userId) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/benchmarks/600.java/603.train-recommender/java/src/main/java/util/OrderItem.java b/benchmarks/600.java/603.train-recommender/java/src/main/java/util/OrderItem.java
new file mode 100644
index 00000000..d49de786
--- /dev/null
+++ b/benchmarks/600.java/603.train-recommender/java/src/main/java/util/OrderItem.java
@@ -0,0 +1,180 @@
+package utils;
+
+
+
+/**
+ * Entity Class for OrderItems (item with quantity in shopping cart or order).
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public class OrderItem {
+
+ private long id;
+ private long productId;
+ private long orderId;
+ private int quantity;
+ private long unitPriceInCents;
+
+ /**
+ * Create a new and empty OrderItem.
+ */
+ public OrderItem() {
+
+ }
+
+ /**
+ * Every Entity needs a Copy-Constructor!
+ *
+ * @param orderItem
+ * The entity to Copy.
+ */
+ public OrderItem(OrderItem orderItem) {
+ setId(orderItem.getId());
+ setProductId(orderItem.getProductId());
+ setOrderId(orderItem.getOrderId());
+ setQuantity(orderItem.getQuantity());
+ setUnitPriceInCents(orderItem.getUnitPriceInCents());
+ }
+
+ /**
+ * Get the id (remember that this ID may be incorrect, especially if a separate id was passed).
+ *
+ * @return The id.
+ */
+ public long getId() {
+ return id;
+ }
+
+ /**
+ * For REST use only. Sets the ID. Ignored by persistence.
+ *
+ * @param id
+ * ID, as passed by the REST API.
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ /**
+ * ID of the order item's product.
+ *
+ * @return Product Id;
+ */
+ public long getProductId() {
+ return productId;
+ }
+
+ /**
+ * Sets the ID of the order item's product. Every order Item MUST have a valid product ID.
+ *
+ * @param productId
+ * The product ID to set.
+ */
+ public void setProductId(long productId) {
+ this.productId = productId;
+ }
+
+ /**
+ * Get the quantity (amount in shopping cart/order).
+ *
+ * @return The quantity.
+ */
+ public int getQuantity() {
+ return quantity;
+ }
+
+ /**
+ * Set the quantity (amount in shopping cart/order).
+ *
+ * @param quantity
+ * The quantity.
+ */
+ public void setQuantity(int quantity) {
+ this.quantity = quantity;
+ }
+
+ /**
+ * The price per single item in the order item.
+ *
+ * @return Price per single item.
+ */
+ public long getUnitPriceInCents() {
+ return unitPriceInCents;
+ }
+
+ /**
+ * Set the price per single item in the order item.
+ *
+ * @param unitPriceInCents
+ * Price per single item.
+ */
+ public void setUnitPriceInCents(long unitPriceInCents) {
+ this.unitPriceInCents = unitPriceInCents;
+ }
+
+ /**
+ * Gets the ID of the order item's order.
+ *
+ * @return The order ID.
+ */
+ public long getOrderId() {
+ return orderId;
+ }
+
+ /**
+ * Sets the ID of the order item's order. Persistence requires that every order item MUST have a valid order ID. For
+ * persistence the order must already exist in database.
+ *
+ * @param orderId
+ * The order ID to set.
+ */
+ public void setOrderId(long orderId) {
+ this.orderId = orderId;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (id ^ (id >>> 32));
+ result = prime * result + (int) (orderId ^ (orderId >>> 32));
+ result = prime * result + (int) (productId ^ (productId >>> 32));
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ OrderItem other = (OrderItem) obj;
+ if (id != other.id) {
+ return false;
+ }
+ if (orderId != other.orderId) {
+ return false;
+ }
+ if (productId != other.productId) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/benchmarks/600.java/603.train-recommender/java/src/main/java/util/OrderItemSet.java b/benchmarks/600.java/603.train-recommender/java/src/main/java/util/OrderItemSet.java
new file mode 100644
index 00000000..f8fb7bf8
--- /dev/null
+++ b/benchmarks/600.java/603.train-recommender/java/src/main/java/util/OrderItemSet.java
@@ -0,0 +1,80 @@
+package utils;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Objects of this class holds a mapping of {@link Product} IDs to quantities
+ * that were bought in the same {@link Order} by one {@link User}. Non-present
+ * {@link Product} IDs imply a quantity of 0.
+ *
+ * @author Johannes Grohmann
+ *
+ */
+public class OrderItemSet {
+
+ /**
+ * Standard constructor.
+ */
+ public OrderItemSet() {
+ orderset = new HashMap<>();
+ }
+
+ /**
+ * The user that made this order.
+ */
+ private long userId;
+
+ /**
+ * The orderId that the Items were bought in.
+ */
+ private long orderId;
+
+ /**
+ * The productIds that were bought together with the given quantity.
+ */
+ private Map orderset;
+
+ /**
+ * @return the orderset
+ */
+ public Map getOrderset() {
+ return orderset;
+ }
+
+ /**
+ * @param orderset
+ * the orderset to set
+ */
+ public void setOrderset(Map orderset) {
+ this.orderset = orderset;
+ }
+
+ /**
+ * @return the orderId
+ */
+ public long getOrderId() {
+ return orderId;
+ }
+
+ /**
+ * @param orderId
+ * the orderId to set
+ */
+ public void setOrderId(long orderId) {
+ this.orderId = orderId;
+ }
+
+ /**
+ * @return the userId
+ */
+ public long getUserId() {
+ return userId;
+ }
+
+ /**
+ * @param userId the userId to set
+ */
+ public void setUserId(long userId) {
+ this.userId = userId;
+ }
+}
diff --git a/benchmarks/600.java/benchmark2/config.json b/benchmarks/600.java/benchmark2/config.json
new file mode 100644
index 00000000..11be1ace
--- /dev/null
+++ b/benchmarks/600.java/benchmark2/config.json
@@ -0,0 +1,6 @@
+{
+ "timeout": 60,
+ "memory": 512,
+ "languages": ["java"]
+}
+
\ No newline at end of file
diff --git a/benchmarks/600.java/benchmark2/input.py b/benchmarks/600.java/benchmark2/input.py
new file mode 100644
index 00000000..136f8bc5
--- /dev/null
+++ b/benchmarks/600.java/benchmark2/input.py
@@ -0,0 +1,5 @@
+def buckets_count():
+ return (0, 0)
+
+def generate_input(data_dir, size, benchmarks_bucket, input_paths, output_paths, upload_func):
+ return { }
\ No newline at end of file
diff --git a/benchmarks/600.java/benchmark2/java/pom.xml b/benchmarks/600.java/benchmark2/java/pom.xml
new file mode 100644
index 00000000..5851f090
--- /dev/null
+++ b/benchmarks/600.java/benchmark2/java/pom.xml
@@ -0,0 +1,64 @@
+
+
+ 4.0.0
+
+ faas
+ benchmark
+ 1
+
+
+ 8
+ 8
+ UTF-8
+
+
+
+
+
+ com.google.code.gson
+ gson
+ 2.11.0
+
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.17.2
+
+
+
+ com.fasterxml.jackson.core
+ jackson-core
+ 2.17.2
+
+
+ org.apache.commons
+ commons-lang3
+ 3.12.0
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 3.2.4
+
+
+ package
+
+ shade
+
+
+ false
+
+
+
+
+
+
+
diff --git a/benchmarks/600.java/benchmark2/java/src/main/java/faas/App.java b/benchmarks/600.java/benchmark2/java/src/main/java/faas/App.java
new file mode 100644
index 00000000..ff55cef8
--- /dev/null
+++ b/benchmarks/600.java/benchmark2/java/src/main/java/faas/App.java
@@ -0,0 +1,26 @@
+package faas;
+import com.google.gson.Gson;
+import com.google.gson.JsonObject;
+import util.SessionBlob;
+import util.ShaSecurityProvider;
+
+//import jakarta.ws.rs.core.Response;
+
+
+public class App {
+ public JsonObject handler(JsonObject args) {
+ Gson gson = new Gson();
+ SessionBlob blob = gson.fromJson(args, SessionBlob.class);
+
+ ShaSecurityProvider securityProvider = new ShaSecurityProvider();
+ SessionBlob validatedBlob = securityProvider.validate(blob);
+
+ JsonObject jsonResult = new JsonObject();
+ if (validatedBlob != null)
+ jsonResult.addProperty("Authorization-Status", "Authorized");
+ else
+ jsonResult.addProperty("Authorization-Status", "Unauthorized");
+ return jsonResult;
+ }
+}
+
diff --git a/benchmarks/600.java/benchmark2/java/src/main/java/util/ConstantKeyProvider.java b/benchmarks/600.java/benchmark2/java/src/main/java/util/ConstantKeyProvider.java
new file mode 100644
index 00000000..ed377e1f
--- /dev/null
+++ b/benchmarks/600.java/benchmark2/java/src/main/java/util/ConstantKeyProvider.java
@@ -0,0 +1,21 @@
+package util;
+
+
+/**
+ * Class for testing. Provides a constant key. DO NOT ADOPT THIS FOR ANY REAL
+ * PRODUCTION WORKLOAD!
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public class ConstantKeyProvider implements IKeyProvider {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getKey(SessionBlob blob) {
+ return "thebestsecretkey";
+ }
+
+}
diff --git a/benchmarks/600.java/benchmark2/java/src/main/java/util/IKeyProvider.java b/benchmarks/600.java/benchmark2/java/src/main/java/util/IKeyProvider.java
new file mode 100644
index 00000000..c78e0dd0
--- /dev/null
+++ b/benchmarks/600.java/benchmark2/java/src/main/java/util/IKeyProvider.java
@@ -0,0 +1,23 @@
+
+package util;
+
+/**
+ * Provides keys for the security provider. The key provider must ensure that
+ * keys accross replicated stores are consistent.
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public interface IKeyProvider {
+
+ /**
+ * Returns a key for a session blob. Key must be the same, regardless of the
+ * store instance upon which this call is made.
+ *
+ * @param blob
+ * The blob to secure.
+ * @return The key.
+ */
+ public String getKey(SessionBlob blob);
+
+}
diff --git a/benchmarks/600.java/benchmark2/java/src/main/java/util/ISecurityProvider.java b/benchmarks/600.java/benchmark2/java/src/main/java/util/ISecurityProvider.java
new file mode 100644
index 00000000..8d710001
--- /dev/null
+++ b/benchmarks/600.java/benchmark2/java/src/main/java/util/ISecurityProvider.java
@@ -0,0 +1,39 @@
+package util;
+
+
+/**
+ * Utilities for securing (e.g. encrypting) session blobs.
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public interface ISecurityProvider {
+
+ /**
+ * Get the key provider for this security provider.
+ *
+ * @return The key provider.
+ */
+ public IKeyProvider getKeyProvider();
+
+ /**
+ * Secures a session blob. May encrypt or hash values within the blob.
+ *
+ * @param blob
+ * The blob to secure.
+ * @return A secure blob to be passed on to the web ui.
+ */
+ public SessionBlob secure(SessionBlob blob);
+
+ /**
+ * Validates a secured session blob. Returns a valid and readable (e.g.
+ * decrypted) blob. Returns null for invalid blobs.
+ *
+ * @param blob
+ * The blob to secure.
+ * @return The valid and readable (e.g. decrypted) blob. Returns null for
+ * invalid blobs.
+ */
+ public SessionBlob validate(SessionBlob blob);
+
+}
diff --git a/benchmarks/600.java/benchmark2/java/src/main/java/util/Order.java b/benchmarks/600.java/benchmark2/java/src/main/java/util/Order.java
new file mode 100644
index 00000000..95434605
--- /dev/null
+++ b/benchmarks/600.java/benchmark2/java/src/main/java/util/Order.java
@@ -0,0 +1,281 @@
+
+package util;
+
+/**
+ * Entity for orders.
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public class Order {
+
+ private long id;
+ private long userId;
+ private String time;
+
+ private long totalPriceInCents;
+ private String addressName;
+ private String address1;
+ private String address2;
+
+ private String creditCardCompany;
+ private String creditCardNumber;
+ private String creditCardExpiryDate;
+
+ /**
+ * Create a new and empty order.
+ */
+ public Order() {
+
+ }
+
+ /**
+ * Every entity needs a copy constructor.
+ *
+ * @param order
+ * The order to copy.
+ */
+ public Order(Order order) {
+ setId(order.getId());
+ setUserId(order.getUserId());
+ setTime(order.getTime());
+ setTotalPriceInCents(order.getTotalPriceInCents());
+ setAddressName(order.getAddressName());
+ setAddress1(order.getAddress1());
+ setAddress2(order.getAddress2());
+ setCreditCardCompany(order.getCreditCardCompany());
+ setCreditCardNumber(order.getCreditCardNumber());
+ setCreditCardExpiryDate(order.getCreditCardExpiryDate());
+ }
+
+ /**
+ * Get the id (remember that this ID may be incorrect, especially if a separate id was passed).
+ *
+ * @return The id.
+ */
+ public long getId() {
+ return id;
+ }
+
+ /**
+ * For REST use only. Sets the ID. Ignored by persistence.
+ *
+ * @param id
+ * ID, as passed by the REST API.
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ /**
+ * Get the User id.
+ *
+ * @return the userId.
+ */
+ public long getUserId() {
+ return userId;
+ }
+
+ /**
+ * Set the User Id.
+ *
+ * @param userId
+ * the userId to set.
+ */
+ public void setUserId(long userId) {
+ this.userId = userId;
+ }
+
+ /**
+ * Get the time of order (ISO formatted). Formatted using {@link DateTimeFormatter.ISO_LOCAL_DATE_TIME}.
+ *
+ * @return the time.
+ */
+ public String getTime() {
+ return time;
+ }
+
+ /**
+ * Set the time of order (ISO formatted). Format using {@link DateTimeFormatter.ISO_LOCAL_DATE_TIME}.
+ *
+ * @param time
+ * the time to set.
+ */
+ public void setTime(String time) {
+ this.time = time;
+ }
+
+ /**
+ * Get the total price in cents.
+ *
+ * @return the totalPriceInCents.
+ */
+ public long getTotalPriceInCents() {
+ return totalPriceInCents;
+ }
+
+ /**
+ * Set the total price in cents.
+ *
+ * @param totalPriceInCents
+ * the totalPriceInCents to set.
+ */
+ public void setTotalPriceInCents(long totalPriceInCents) {
+ this.totalPriceInCents = totalPriceInCents;
+ }
+
+ /**
+ * Get the name for the address.
+ *
+ * @return the addressName.
+ */
+ public String getAddressName() {
+ return addressName;
+ }
+
+ /**
+ * Set the name for the address.
+ *
+ * @param addressName
+ * the addressName to set.
+ */
+ public void setAddressName(String addressName) {
+ this.addressName = addressName;
+ }
+
+ /**
+ * Get address line 1.
+ *
+ * @return the address1.
+ */
+ public String getAddress1() {
+ return address1;
+ }
+
+ /**
+ * Set address line 1.
+ *
+ * @param address1
+ * the address1 to set.
+ */
+ public void setAddress1(String address1) {
+ this.address1 = address1;
+ }
+
+ /**
+ * Get address line 2.
+ *
+ * @return the address2.
+ */
+ public String getAddress2() {
+ return address2;
+ }
+
+ /**
+ * Set address line 2.
+ *
+ * @param address2
+ * the address2 to set.
+ */
+ public void setAddress2(String address2) {
+ this.address2 = address2;
+ }
+
+ /**
+ * Get the name of the credit card company.
+ *
+ * @return the creditCardCompany.
+ */
+ public String getCreditCardCompany() {
+ return creditCardCompany;
+ }
+
+ /**
+ * Set the name of the credit card company.
+ *
+ * @param creditCardCompany
+ * the creditCardCompany to set.
+ */
+ public void setCreditCardCompany(String creditCardCompany) {
+ this.creditCardCompany = creditCardCompany;
+ }
+
+ /**
+ * Get the credit card number.
+ *
+ * @return the creditCardNumber.
+ */
+ public String getCreditCardNumber() {
+ return creditCardNumber;
+ }
+
+ /**
+ * Set the credit card number.
+ *
+ * @param creditCardNumber
+ * the creditCardNumber to set.
+ */
+ public void setCreditCardNumber(String creditCardNumber) {
+ this.creditCardNumber = creditCardNumber;
+ }
+
+ /**
+ * Get the credit card expiry date (ISO formatted). Formatted using {@link DateTimeFormatter.ISO_LOCAL_DATE}.
+ *
+ * @return the creditCardExpiryDate.
+ */
+ public String getCreditCardExpiryDate() {
+ return creditCardExpiryDate;
+ }
+
+ /**
+ * Set the credit card expiry date (ISO formatted). Format using {@link DateTimeFormatter.ISO_LOCAL_DATE}.
+ *
+ * @param creditCardExpiryDate
+ * the creditCardExpiryDate to set.
+ */
+ public void setCreditCardExpiryDate(String creditCardExpiryDate) {
+ this.creditCardExpiryDate = creditCardExpiryDate;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (id ^ (id >>> 32));
+ result = prime * result + (int) (userId ^ (userId >>> 32));
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Order other = (Order) obj;
+ if (id != other.id) {
+ return false;
+ }
+ if (userId != other.userId) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/benchmarks/600.java/benchmark2/java/src/main/java/util/OrderItem.java b/benchmarks/600.java/benchmark2/java/src/main/java/util/OrderItem.java
new file mode 100644
index 00000000..f0c01fe9
--- /dev/null
+++ b/benchmarks/600.java/benchmark2/java/src/main/java/util/OrderItem.java
@@ -0,0 +1,179 @@
+
+package util;
+
+/**
+ * Entity Class for OrderItems (item with quantity in shopping cart or order).
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public class OrderItem {
+
+ private long id;
+ private long productId;
+ private long orderId;
+ private int quantity;
+ private long unitPriceInCents;
+
+ /**
+ * Create a new and empty OrderItem.
+ */
+ public OrderItem() {
+
+ }
+
+ /**
+ * Every Entity needs a Copy-Constructor!
+ *
+ * @param orderItem
+ * The entity to Copy.
+ */
+ public OrderItem(OrderItem orderItem) {
+ setId(orderItem.getId());
+ setProductId(orderItem.getProductId());
+ setOrderId(orderItem.getOrderId());
+ setQuantity(orderItem.getQuantity());
+ setUnitPriceInCents(orderItem.getUnitPriceInCents());
+ }
+
+ /**
+ * Get the id (remember that this ID may be incorrect, especially if a separate id was passed).
+ *
+ * @return The id.
+ */
+ public long getId() {
+ return id;
+ }
+
+ /**
+ * For REST use only. Sets the ID. Ignored by persistence.
+ *
+ * @param id
+ * ID, as passed by the REST API.
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ /**
+ * ID of the order item's product.
+ *
+ * @return Product Id;
+ */
+ public long getProductId() {
+ return productId;
+ }
+
+ /**
+ * Sets the ID of the order item's product. Every order Item MUST have a valid product ID.
+ *
+ * @param productId
+ * The product ID to set.
+ */
+ public void setProductId(long productId) {
+ this.productId = productId;
+ }
+
+ /**
+ * Get the quantity (amount in shopping cart/order).
+ *
+ * @return The quantity.
+ */
+ public int getQuantity() {
+ return quantity;
+ }
+
+ /**
+ * Set the quantity (amount in shopping cart/order).
+ *
+ * @param quantity
+ * The quantity.
+ */
+ public void setQuantity(int quantity) {
+ this.quantity = quantity;
+ }
+
+ /**
+ * The price per single item in the order item.
+ *
+ * @return Price per single item.
+ */
+ public long getUnitPriceInCents() {
+ return unitPriceInCents;
+ }
+
+ /**
+ * Set the price per single item in the order item.
+ *
+ * @param unitPriceInCents
+ * Price per single item.
+ */
+ public void setUnitPriceInCents(long unitPriceInCents) {
+ this.unitPriceInCents = unitPriceInCents;
+ }
+
+ /**
+ * Gets the ID of the order item's order.
+ *
+ * @return The order ID.
+ */
+ public long getOrderId() {
+ return orderId;
+ }
+
+ /**
+ * Sets the ID of the order item's order. Persistence requires that every order item MUST have a valid order ID. For
+ * persistence the order must already exist in database.
+ *
+ * @param orderId
+ * The order ID to set.
+ */
+ public void setOrderId(long orderId) {
+ this.orderId = orderId;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (id ^ (id >>> 32));
+ result = prime * result + (int) (orderId ^ (orderId >>> 32));
+ result = prime * result + (int) (productId ^ (productId >>> 32));
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ OrderItem other = (OrderItem) obj;
+ if (id != other.id) {
+ return false;
+ }
+ if (orderId != other.orderId) {
+ return false;
+ }
+ if (productId != other.productId) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/benchmarks/600.java/benchmark2/java/src/main/java/util/SessionBlob.java b/benchmarks/600.java/benchmark2/java/src/main/java/util/SessionBlob.java
new file mode 100644
index 00000000..6875efa4
--- /dev/null
+++ b/benchmarks/600.java/benchmark2/java/src/main/java/util/SessionBlob.java
@@ -0,0 +1,133 @@
+package util;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Blob containing all information about the user session.
+ * @author Simon
+ */
+public class SessionBlob {
+
+ private Long uid;
+ private String sid;
+ private String token;
+ private Order order;
+ private List orderItems = new LinkedList();
+ private String message;
+
+ /**
+ * Constructor, creates an empty order.
+ */
+ public SessionBlob() {
+ this.setOrder(new Order());
+ }
+
+ /**
+ * Getter for the userid.
+ * @return userid
+ */
+ public Long getUID() {
+ return uid;
+ }
+
+ /**
+ * Setter for the userid.
+ * @param uID userid
+ */
+ public void setUID(Long uID) {
+ uid = uID;
+ }
+
+ /**
+ * Getter for session id.
+ * @return session id
+ */
+ public String getSID() {
+ return sid;
+ }
+
+ /**
+ * Setter for session id.
+ * @param sID session id
+ */
+ public void setSID(String sID) {
+ sid = sID;
+ }
+
+ /**
+ * Getter for trust token.
+ * @return trust token
+ */
+ public String getToken() {
+ return token;
+ }
+
+ /**
+ * Setter for trust token.
+ * @param token trust token.
+ */
+ public void setToken(String token) {
+ this.token = token;
+ }
+
+ /**
+ * Setter for the message.
+ * @param message String
+ */
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ /**
+ * Getter for the message.
+ * @return message
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * Getter for order.
+ * @return order
+ */
+ public Order getOrder() {
+ return order;
+ }
+
+ /**
+ * Setter for order.
+ * @param order order
+ */
+ public void setOrder(Order order) {
+ this.order = order;
+ }
+
+ /**
+ * Getter for order items.
+ * @return order items.
+ */
+ public List getOrderItems() {
+ return orderItems;
+ }
+
+ /**
+ * Setter for order items.
+ * @param orderItems list of order items
+ */
+ public void setOrderItems(List orderItems) {
+ this.orderItems = orderItems;
+ }
+
+ @Override
+ public String toString() {
+ return "ClassName{" +
+ "uid=" + uid +
+ ", sid='" + sid + '\'' +
+ ", token='" + token + '\'' +
+ ", order=" + (order != null ? order.toString() : "null") +
+ ", orderItems=" + (orderItems != null ? orderItems.toString() : "null") +
+ ", message='" + message + '\'' +
+ '}';
+ }
+}
diff --git a/benchmarks/600.java/benchmark2/java/src/main/java/util/ShaSecurityProvider.java b/benchmarks/600.java/benchmark2/java/src/main/java/util/ShaSecurityProvider.java
new file mode 100644
index 00000000..d9c88f90
--- /dev/null
+++ b/benchmarks/600.java/benchmark2/java/src/main/java/util/ShaSecurityProvider.java
@@ -0,0 +1,79 @@
+package util;
+
+import java.io.UnsupportedEncodingException;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import java.net.URLEncoder;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * Secruity provider uscom.fasterxml.jackson.databind.Objecting AES.
+ *
+ * @author Simon
+ *
+ */
+public class ShaSecurityProvider implements ISecurityProvider {
+
+ @Override
+ public IKeyProvider getKeyProvider() {
+ return new ConstantKeyProvider();
+ }
+
+ @Override
+ public SessionBlob secure(SessionBlob blob) {
+ if (blob.getUID() == null || blob.getSID() == null) {
+ return blob;
+ }
+ blob.setToken(null);
+ String blobString = blobToString(blob);
+ blob.setToken(getSha512(blobString));
+ return blob;
+ }
+
+ private String blobToString(SessionBlob blob) {
+ ObjectMapper o = new ObjectMapper();
+ try {
+ return URLEncoder.encode(o.writeValueAsString(blob), "UTF-8");
+ } catch (JsonProcessingException | UnsupportedEncodingException e)
+ {
+ throw new IllegalStateException("Could not save blob!");
+ }
+ }
+
+ @Override
+ public SessionBlob validate(SessionBlob blob) {
+ if (blob.getToken() == null) {
+ return null;
+ }
+
+ String token = blob.getToken();
+ blob.setToken(null);
+ String blobString = blobToString(blob);
+ String validationToken = getSha512(blobString);
+ if (validationToken.equals(token)) {
+ return blob;
+ }
+ return null;
+ }
+
+ private String getSha512(String passwordToHash) {
+ String generatedPassword = null;
+ try {
+ String salt = getKeyProvider().getKey(null);
+ MessageDigest md = MessageDigest.getInstance("SHA-512");
+ md.update(salt.getBytes("UTF-8"));
+ byte[] bytes = md.digest(passwordToHash.getBytes("UTF-8"));
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < bytes.length; i++) {
+ sb.append(Integer.toString((bytes[i] & 0xff) + 0x100, 16).substring(1));
+ }
+ generatedPassword = sb.toString();
+ } catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ return generatedPassword;
+ }
+}
diff --git a/benchmarks/600.java/benchmark3/config.json b/benchmarks/600.java/benchmark3/config.json
new file mode 100644
index 00000000..11be1ace
--- /dev/null
+++ b/benchmarks/600.java/benchmark3/config.json
@@ -0,0 +1,6 @@
+{
+ "timeout": 60,
+ "memory": 512,
+ "languages": ["java"]
+}
+
\ No newline at end of file
diff --git a/benchmarks/600.java/benchmark3/input.py b/benchmarks/600.java/benchmark3/input.py
new file mode 100644
index 00000000..136f8bc5
--- /dev/null
+++ b/benchmarks/600.java/benchmark3/input.py
@@ -0,0 +1,5 @@
+def buckets_count():
+ return (0, 0)
+
+def generate_input(data_dir, size, benchmarks_bucket, input_paths, output_paths, upload_func):
+ return { }
\ No newline at end of file
diff --git a/benchmarks/600.java/benchmark3/java/pom.xml b/benchmarks/600.java/benchmark3/java/pom.xml
new file mode 100644
index 00000000..37bd1c84
--- /dev/null
+++ b/benchmarks/600.java/benchmark3/java/pom.xml
@@ -0,0 +1,63 @@
+
+
+ 4.0.0
+
+ faas
+ benchmark
+ 1
+
+
+ 8
+ 8
+ UTF-8
+
+
+
+
+
+ com.google.code.gson
+ gson
+ 2.11.0
+
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.17.2
+
+
+
+ com.fasterxml.jackson.core
+ jackson-core
+ 2.17.2
+
+
+ commons-io
+ commons-io
+ 2.11.0
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 3.2.4
+
+
+ package
+
+ shade
+
+
+ false
+
+
+
+
+
+
+
diff --git a/benchmarks/600.java/benchmark3/java/src/main/java/faas/App.java b/benchmarks/600.java/benchmark3/java/src/main/java/faas/App.java
new file mode 100644
index 00000000..ff55cef8
--- /dev/null
+++ b/benchmarks/600.java/benchmark3/java/src/main/java/faas/App.java
@@ -0,0 +1,26 @@
+package faas;
+import com.google.gson.Gson;
+import com.google.gson.JsonObject;
+import util.SessionBlob;
+import util.ShaSecurityProvider;
+
+//import jakarta.ws.rs.core.Response;
+
+
+public class App {
+ public JsonObject handler(JsonObject args) {
+ Gson gson = new Gson();
+ SessionBlob blob = gson.fromJson(args, SessionBlob.class);
+
+ ShaSecurityProvider securityProvider = new ShaSecurityProvider();
+ SessionBlob validatedBlob = securityProvider.validate(blob);
+
+ JsonObject jsonResult = new JsonObject();
+ if (validatedBlob != null)
+ jsonResult.addProperty("Authorization-Status", "Authorized");
+ else
+ jsonResult.addProperty("Authorization-Status", "Unauthorized");
+ return jsonResult;
+ }
+}
+
diff --git a/benchmarks/600.java/benchmark3/java/src/main/java/util/ConstantKeyProvider.java b/benchmarks/600.java/benchmark3/java/src/main/java/util/ConstantKeyProvider.java
new file mode 100644
index 00000000..ed377e1f
--- /dev/null
+++ b/benchmarks/600.java/benchmark3/java/src/main/java/util/ConstantKeyProvider.java
@@ -0,0 +1,21 @@
+package util;
+
+
+/**
+ * Class for testing. Provides a constant key. DO NOT ADOPT THIS FOR ANY REAL
+ * PRODUCTION WORKLOAD!
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public class ConstantKeyProvider implements IKeyProvider {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getKey(SessionBlob blob) {
+ return "thebestsecretkey";
+ }
+
+}
diff --git a/benchmarks/600.java/benchmark3/java/src/main/java/util/IKeyProvider.java b/benchmarks/600.java/benchmark3/java/src/main/java/util/IKeyProvider.java
new file mode 100644
index 00000000..c78e0dd0
--- /dev/null
+++ b/benchmarks/600.java/benchmark3/java/src/main/java/util/IKeyProvider.java
@@ -0,0 +1,23 @@
+
+package util;
+
+/**
+ * Provides keys for the security provider. The key provider must ensure that
+ * keys accross replicated stores are consistent.
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public interface IKeyProvider {
+
+ /**
+ * Returns a key for a session blob. Key must be the same, regardless of the
+ * store instance upon which this call is made.
+ *
+ * @param blob
+ * The blob to secure.
+ * @return The key.
+ */
+ public String getKey(SessionBlob blob);
+
+}
diff --git a/benchmarks/600.java/benchmark3/java/src/main/java/util/ISecurityProvider.java b/benchmarks/600.java/benchmark3/java/src/main/java/util/ISecurityProvider.java
new file mode 100644
index 00000000..8d710001
--- /dev/null
+++ b/benchmarks/600.java/benchmark3/java/src/main/java/util/ISecurityProvider.java
@@ -0,0 +1,39 @@
+package util;
+
+
+/**
+ * Utilities for securing (e.g. encrypting) session blobs.
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public interface ISecurityProvider {
+
+ /**
+ * Get the key provider for this security provider.
+ *
+ * @return The key provider.
+ */
+ public IKeyProvider getKeyProvider();
+
+ /**
+ * Secures a session blob. May encrypt or hash values within the blob.
+ *
+ * @param blob
+ * The blob to secure.
+ * @return A secure blob to be passed on to the web ui.
+ */
+ public SessionBlob secure(SessionBlob blob);
+
+ /**
+ * Validates a secured session blob. Returns a valid and readable (e.g.
+ * decrypted) blob. Returns null for invalid blobs.
+ *
+ * @param blob
+ * The blob to secure.
+ * @return The valid and readable (e.g. decrypted) blob. Returns null for
+ * invalid blobs.
+ */
+ public SessionBlob validate(SessionBlob blob);
+
+}
diff --git a/benchmarks/600.java/benchmark3/java/src/main/java/util/Order.java b/benchmarks/600.java/benchmark3/java/src/main/java/util/Order.java
new file mode 100644
index 00000000..95434605
--- /dev/null
+++ b/benchmarks/600.java/benchmark3/java/src/main/java/util/Order.java
@@ -0,0 +1,281 @@
+
+package util;
+
+/**
+ * Entity for orders.
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public class Order {
+
+ private long id;
+ private long userId;
+ private String time;
+
+ private long totalPriceInCents;
+ private String addressName;
+ private String address1;
+ private String address2;
+
+ private String creditCardCompany;
+ private String creditCardNumber;
+ private String creditCardExpiryDate;
+
+ /**
+ * Create a new and empty order.
+ */
+ public Order() {
+
+ }
+
+ /**
+ * Every entity needs a copy constructor.
+ *
+ * @param order
+ * The order to copy.
+ */
+ public Order(Order order) {
+ setId(order.getId());
+ setUserId(order.getUserId());
+ setTime(order.getTime());
+ setTotalPriceInCents(order.getTotalPriceInCents());
+ setAddressName(order.getAddressName());
+ setAddress1(order.getAddress1());
+ setAddress2(order.getAddress2());
+ setCreditCardCompany(order.getCreditCardCompany());
+ setCreditCardNumber(order.getCreditCardNumber());
+ setCreditCardExpiryDate(order.getCreditCardExpiryDate());
+ }
+
+ /**
+ * Get the id (remember that this ID may be incorrect, especially if a separate id was passed).
+ *
+ * @return The id.
+ */
+ public long getId() {
+ return id;
+ }
+
+ /**
+ * For REST use only. Sets the ID. Ignored by persistence.
+ *
+ * @param id
+ * ID, as passed by the REST API.
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ /**
+ * Get the User id.
+ *
+ * @return the userId.
+ */
+ public long getUserId() {
+ return userId;
+ }
+
+ /**
+ * Set the User Id.
+ *
+ * @param userId
+ * the userId to set.
+ */
+ public void setUserId(long userId) {
+ this.userId = userId;
+ }
+
+ /**
+ * Get the time of order (ISO formatted). Formatted using {@link DateTimeFormatter.ISO_LOCAL_DATE_TIME}.
+ *
+ * @return the time.
+ */
+ public String getTime() {
+ return time;
+ }
+
+ /**
+ * Set the time of order (ISO formatted). Format using {@link DateTimeFormatter.ISO_LOCAL_DATE_TIME}.
+ *
+ * @param time
+ * the time to set.
+ */
+ public void setTime(String time) {
+ this.time = time;
+ }
+
+ /**
+ * Get the total price in cents.
+ *
+ * @return the totalPriceInCents.
+ */
+ public long getTotalPriceInCents() {
+ return totalPriceInCents;
+ }
+
+ /**
+ * Set the total price in cents.
+ *
+ * @param totalPriceInCents
+ * the totalPriceInCents to set.
+ */
+ public void setTotalPriceInCents(long totalPriceInCents) {
+ this.totalPriceInCents = totalPriceInCents;
+ }
+
+ /**
+ * Get the name for the address.
+ *
+ * @return the addressName.
+ */
+ public String getAddressName() {
+ return addressName;
+ }
+
+ /**
+ * Set the name for the address.
+ *
+ * @param addressName
+ * the addressName to set.
+ */
+ public void setAddressName(String addressName) {
+ this.addressName = addressName;
+ }
+
+ /**
+ * Get address line 1.
+ *
+ * @return the address1.
+ */
+ public String getAddress1() {
+ return address1;
+ }
+
+ /**
+ * Set address line 1.
+ *
+ * @param address1
+ * the address1 to set.
+ */
+ public void setAddress1(String address1) {
+ this.address1 = address1;
+ }
+
+ /**
+ * Get address line 2.
+ *
+ * @return the address2.
+ */
+ public String getAddress2() {
+ return address2;
+ }
+
+ /**
+ * Set address line 2.
+ *
+ * @param address2
+ * the address2 to set.
+ */
+ public void setAddress2(String address2) {
+ this.address2 = address2;
+ }
+
+ /**
+ * Get the name of the credit card company.
+ *
+ * @return the creditCardCompany.
+ */
+ public String getCreditCardCompany() {
+ return creditCardCompany;
+ }
+
+ /**
+ * Set the name of the credit card company.
+ *
+ * @param creditCardCompany
+ * the creditCardCompany to set.
+ */
+ public void setCreditCardCompany(String creditCardCompany) {
+ this.creditCardCompany = creditCardCompany;
+ }
+
+ /**
+ * Get the credit card number.
+ *
+ * @return the creditCardNumber.
+ */
+ public String getCreditCardNumber() {
+ return creditCardNumber;
+ }
+
+ /**
+ * Set the credit card number.
+ *
+ * @param creditCardNumber
+ * the creditCardNumber to set.
+ */
+ public void setCreditCardNumber(String creditCardNumber) {
+ this.creditCardNumber = creditCardNumber;
+ }
+
+ /**
+ * Get the credit card expiry date (ISO formatted). Formatted using {@link DateTimeFormatter.ISO_LOCAL_DATE}.
+ *
+ * @return the creditCardExpiryDate.
+ */
+ public String getCreditCardExpiryDate() {
+ return creditCardExpiryDate;
+ }
+
+ /**
+ * Set the credit card expiry date (ISO formatted). Format using {@link DateTimeFormatter.ISO_LOCAL_DATE}.
+ *
+ * @param creditCardExpiryDate
+ * the creditCardExpiryDate to set.
+ */
+ public void setCreditCardExpiryDate(String creditCardExpiryDate) {
+ this.creditCardExpiryDate = creditCardExpiryDate;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (id ^ (id >>> 32));
+ result = prime * result + (int) (userId ^ (userId >>> 32));
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Order other = (Order) obj;
+ if (id != other.id) {
+ return false;
+ }
+ if (userId != other.userId) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/benchmarks/600.java/benchmark3/java/src/main/java/util/OrderItem.java b/benchmarks/600.java/benchmark3/java/src/main/java/util/OrderItem.java
new file mode 100644
index 00000000..f0c01fe9
--- /dev/null
+++ b/benchmarks/600.java/benchmark3/java/src/main/java/util/OrderItem.java
@@ -0,0 +1,179 @@
+
+package util;
+
+/**
+ * Entity Class for OrderItems (item with quantity in shopping cart or order).
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public class OrderItem {
+
+ private long id;
+ private long productId;
+ private long orderId;
+ private int quantity;
+ private long unitPriceInCents;
+
+ /**
+ * Create a new and empty OrderItem.
+ */
+ public OrderItem() {
+
+ }
+
+ /**
+ * Every Entity needs a Copy-Constructor!
+ *
+ * @param orderItem
+ * The entity to Copy.
+ */
+ public OrderItem(OrderItem orderItem) {
+ setId(orderItem.getId());
+ setProductId(orderItem.getProductId());
+ setOrderId(orderItem.getOrderId());
+ setQuantity(orderItem.getQuantity());
+ setUnitPriceInCents(orderItem.getUnitPriceInCents());
+ }
+
+ /**
+ * Get the id (remember that this ID may be incorrect, especially if a separate id was passed).
+ *
+ * @return The id.
+ */
+ public long getId() {
+ return id;
+ }
+
+ /**
+ * For REST use only. Sets the ID. Ignored by persistence.
+ *
+ * @param id
+ * ID, as passed by the REST API.
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ /**
+ * ID of the order item's product.
+ *
+ * @return Product Id;
+ */
+ public long getProductId() {
+ return productId;
+ }
+
+ /**
+ * Sets the ID of the order item's product. Every order Item MUST have a valid product ID.
+ *
+ * @param productId
+ * The product ID to set.
+ */
+ public void setProductId(long productId) {
+ this.productId = productId;
+ }
+
+ /**
+ * Get the quantity (amount in shopping cart/order).
+ *
+ * @return The quantity.
+ */
+ public int getQuantity() {
+ return quantity;
+ }
+
+ /**
+ * Set the quantity (amount in shopping cart/order).
+ *
+ * @param quantity
+ * The quantity.
+ */
+ public void setQuantity(int quantity) {
+ this.quantity = quantity;
+ }
+
+ /**
+ * The price per single item in the order item.
+ *
+ * @return Price per single item.
+ */
+ public long getUnitPriceInCents() {
+ return unitPriceInCents;
+ }
+
+ /**
+ * Set the price per single item in the order item.
+ *
+ * @param unitPriceInCents
+ * Price per single item.
+ */
+ public void setUnitPriceInCents(long unitPriceInCents) {
+ this.unitPriceInCents = unitPriceInCents;
+ }
+
+ /**
+ * Gets the ID of the order item's order.
+ *
+ * @return The order ID.
+ */
+ public long getOrderId() {
+ return orderId;
+ }
+
+ /**
+ * Sets the ID of the order item's order. Persistence requires that every order item MUST have a valid order ID. For
+ * persistence the order must already exist in database.
+ *
+ * @param orderId
+ * The order ID to set.
+ */
+ public void setOrderId(long orderId) {
+ this.orderId = orderId;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (id ^ (id >>> 32));
+ result = prime * result + (int) (orderId ^ (orderId >>> 32));
+ result = prime * result + (int) (productId ^ (productId >>> 32));
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ OrderItem other = (OrderItem) obj;
+ if (id != other.id) {
+ return false;
+ }
+ if (orderId != other.orderId) {
+ return false;
+ }
+ if (productId != other.productId) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/benchmarks/600.java/benchmark3/java/src/main/java/util/SessionBlob.java b/benchmarks/600.java/benchmark3/java/src/main/java/util/SessionBlob.java
new file mode 100644
index 00000000..6875efa4
--- /dev/null
+++ b/benchmarks/600.java/benchmark3/java/src/main/java/util/SessionBlob.java
@@ -0,0 +1,133 @@
+package util;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Blob containing all information about the user session.
+ * @author Simon
+ */
+public class SessionBlob {
+
+ private Long uid;
+ private String sid;
+ private String token;
+ private Order order;
+ private List orderItems = new LinkedList();
+ private String message;
+
+ /**
+ * Constructor, creates an empty order.
+ */
+ public SessionBlob() {
+ this.setOrder(new Order());
+ }
+
+ /**
+ * Getter for the userid.
+ * @return userid
+ */
+ public Long getUID() {
+ return uid;
+ }
+
+ /**
+ * Setter for the userid.
+ * @param uID userid
+ */
+ public void setUID(Long uID) {
+ uid = uID;
+ }
+
+ /**
+ * Getter for session id.
+ * @return session id
+ */
+ public String getSID() {
+ return sid;
+ }
+
+ /**
+ * Setter for session id.
+ * @param sID session id
+ */
+ public void setSID(String sID) {
+ sid = sID;
+ }
+
+ /**
+ * Getter for trust token.
+ * @return trust token
+ */
+ public String getToken() {
+ return token;
+ }
+
+ /**
+ * Setter for trust token.
+ * @param token trust token.
+ */
+ public void setToken(String token) {
+ this.token = token;
+ }
+
+ /**
+ * Setter for the message.
+ * @param message String
+ */
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ /**
+ * Getter for the message.
+ * @return message
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * Getter for order.
+ * @return order
+ */
+ public Order getOrder() {
+ return order;
+ }
+
+ /**
+ * Setter for order.
+ * @param order order
+ */
+ public void setOrder(Order order) {
+ this.order = order;
+ }
+
+ /**
+ * Getter for order items.
+ * @return order items.
+ */
+ public List getOrderItems() {
+ return orderItems;
+ }
+
+ /**
+ * Setter for order items.
+ * @param orderItems list of order items
+ */
+ public void setOrderItems(List orderItems) {
+ this.orderItems = orderItems;
+ }
+
+ @Override
+ public String toString() {
+ return "ClassName{" +
+ "uid=" + uid +
+ ", sid='" + sid + '\'' +
+ ", token='" + token + '\'' +
+ ", order=" + (order != null ? order.toString() : "null") +
+ ", orderItems=" + (orderItems != null ? orderItems.toString() : "null") +
+ ", message='" + message + '\'' +
+ '}';
+ }
+}
diff --git a/benchmarks/600.java/benchmark3/java/src/main/java/util/ShaSecurityProvider.java b/benchmarks/600.java/benchmark3/java/src/main/java/util/ShaSecurityProvider.java
new file mode 100644
index 00000000..d9c88f90
--- /dev/null
+++ b/benchmarks/600.java/benchmark3/java/src/main/java/util/ShaSecurityProvider.java
@@ -0,0 +1,79 @@
+package util;
+
+import java.io.UnsupportedEncodingException;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import java.net.URLEncoder;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * Secruity provider uscom.fasterxml.jackson.databind.Objecting AES.
+ *
+ * @author Simon
+ *
+ */
+public class ShaSecurityProvider implements ISecurityProvider {
+
+ @Override
+ public IKeyProvider getKeyProvider() {
+ return new ConstantKeyProvider();
+ }
+
+ @Override
+ public SessionBlob secure(SessionBlob blob) {
+ if (blob.getUID() == null || blob.getSID() == null) {
+ return blob;
+ }
+ blob.setToken(null);
+ String blobString = blobToString(blob);
+ blob.setToken(getSha512(blobString));
+ return blob;
+ }
+
+ private String blobToString(SessionBlob blob) {
+ ObjectMapper o = new ObjectMapper();
+ try {
+ return URLEncoder.encode(o.writeValueAsString(blob), "UTF-8");
+ } catch (JsonProcessingException | UnsupportedEncodingException e)
+ {
+ throw new IllegalStateException("Could not save blob!");
+ }
+ }
+
+ @Override
+ public SessionBlob validate(SessionBlob blob) {
+ if (blob.getToken() == null) {
+ return null;
+ }
+
+ String token = blob.getToken();
+ blob.setToken(null);
+ String blobString = blobToString(blob);
+ String validationToken = getSha512(blobString);
+ if (validationToken.equals(token)) {
+ return blob;
+ }
+ return null;
+ }
+
+ private String getSha512(String passwordToHash) {
+ String generatedPassword = null;
+ try {
+ String salt = getKeyProvider().getKey(null);
+ MessageDigest md = MessageDigest.getInstance("SHA-512");
+ md.update(salt.getBytes("UTF-8"));
+ byte[] bytes = md.digest(passwordToHash.getBytes("UTF-8"));
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < bytes.length; i++) {
+ sb.append(Integer.toString((bytes[i] & 0xff) + 0x100, 16).substring(1));
+ }
+ generatedPassword = sb.toString();
+ } catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ return generatedPassword;
+ }
+}
diff --git a/benchmarks/600.java/benchmark4/config.json b/benchmarks/600.java/benchmark4/config.json
new file mode 100644
index 00000000..11be1ace
--- /dev/null
+++ b/benchmarks/600.java/benchmark4/config.json
@@ -0,0 +1,6 @@
+{
+ "timeout": 60,
+ "memory": 512,
+ "languages": ["java"]
+}
+
\ No newline at end of file
diff --git a/benchmarks/600.java/benchmark4/input.py b/benchmarks/600.java/benchmark4/input.py
new file mode 100644
index 00000000..136f8bc5
--- /dev/null
+++ b/benchmarks/600.java/benchmark4/input.py
@@ -0,0 +1,5 @@
+def buckets_count():
+ return (0, 0)
+
+def generate_input(data_dir, size, benchmarks_bucket, input_paths, output_paths, upload_func):
+ return { }
\ No newline at end of file
diff --git a/benchmarks/600.java/benchmark4/java/pom.xml b/benchmarks/600.java/benchmark4/java/pom.xml
new file mode 100644
index 00000000..dacfe9bf
--- /dev/null
+++ b/benchmarks/600.java/benchmark4/java/pom.xml
@@ -0,0 +1,63 @@
+
+
+ 4.0.0
+
+ faas
+ benchmark
+ 1
+
+
+ 8
+ 8
+ UTF-8
+
+
+
+
+
+ com.google.code.gson
+ gson
+ 2.11.0
+
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.17.2
+
+
+
+ com.fasterxml.jackson.core
+ jackson-core
+ 2.17.2
+
+
+ org.apache.poi
+ poi-ooxml
+ 5.2.3
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 3.2.4
+
+
+ package
+
+ shade
+
+
+ false
+
+
+
+
+
+
+
diff --git a/benchmarks/600.java/benchmark4/java/src/main/java/faas/App.java b/benchmarks/600.java/benchmark4/java/src/main/java/faas/App.java
new file mode 100644
index 00000000..ff55cef8
--- /dev/null
+++ b/benchmarks/600.java/benchmark4/java/src/main/java/faas/App.java
@@ -0,0 +1,26 @@
+package faas;
+import com.google.gson.Gson;
+import com.google.gson.JsonObject;
+import util.SessionBlob;
+import util.ShaSecurityProvider;
+
+//import jakarta.ws.rs.core.Response;
+
+
+public class App {
+ public JsonObject handler(JsonObject args) {
+ Gson gson = new Gson();
+ SessionBlob blob = gson.fromJson(args, SessionBlob.class);
+
+ ShaSecurityProvider securityProvider = new ShaSecurityProvider();
+ SessionBlob validatedBlob = securityProvider.validate(blob);
+
+ JsonObject jsonResult = new JsonObject();
+ if (validatedBlob != null)
+ jsonResult.addProperty("Authorization-Status", "Authorized");
+ else
+ jsonResult.addProperty("Authorization-Status", "Unauthorized");
+ return jsonResult;
+ }
+}
+
diff --git a/benchmarks/600.java/benchmark4/java/src/main/java/util/ConstantKeyProvider.java b/benchmarks/600.java/benchmark4/java/src/main/java/util/ConstantKeyProvider.java
new file mode 100644
index 00000000..ed377e1f
--- /dev/null
+++ b/benchmarks/600.java/benchmark4/java/src/main/java/util/ConstantKeyProvider.java
@@ -0,0 +1,21 @@
+package util;
+
+
+/**
+ * Class for testing. Provides a constant key. DO NOT ADOPT THIS FOR ANY REAL
+ * PRODUCTION WORKLOAD!
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public class ConstantKeyProvider implements IKeyProvider {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getKey(SessionBlob blob) {
+ return "thebestsecretkey";
+ }
+
+}
diff --git a/benchmarks/600.java/benchmark4/java/src/main/java/util/IKeyProvider.java b/benchmarks/600.java/benchmark4/java/src/main/java/util/IKeyProvider.java
new file mode 100644
index 00000000..c78e0dd0
--- /dev/null
+++ b/benchmarks/600.java/benchmark4/java/src/main/java/util/IKeyProvider.java
@@ -0,0 +1,23 @@
+
+package util;
+
+/**
+ * Provides keys for the security provider. The key provider must ensure that
+ * keys accross replicated stores are consistent.
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public interface IKeyProvider {
+
+ /**
+ * Returns a key for a session blob. Key must be the same, regardless of the
+ * store instance upon which this call is made.
+ *
+ * @param blob
+ * The blob to secure.
+ * @return The key.
+ */
+ public String getKey(SessionBlob blob);
+
+}
diff --git a/benchmarks/600.java/benchmark4/java/src/main/java/util/ISecurityProvider.java b/benchmarks/600.java/benchmark4/java/src/main/java/util/ISecurityProvider.java
new file mode 100644
index 00000000..8d710001
--- /dev/null
+++ b/benchmarks/600.java/benchmark4/java/src/main/java/util/ISecurityProvider.java
@@ -0,0 +1,39 @@
+package util;
+
+
+/**
+ * Utilities for securing (e.g. encrypting) session blobs.
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public interface ISecurityProvider {
+
+ /**
+ * Get the key provider for this security provider.
+ *
+ * @return The key provider.
+ */
+ public IKeyProvider getKeyProvider();
+
+ /**
+ * Secures a session blob. May encrypt or hash values within the blob.
+ *
+ * @param blob
+ * The blob to secure.
+ * @return A secure blob to be passed on to the web ui.
+ */
+ public SessionBlob secure(SessionBlob blob);
+
+ /**
+ * Validates a secured session blob. Returns a valid and readable (e.g.
+ * decrypted) blob. Returns null for invalid blobs.
+ *
+ * @param blob
+ * The blob to secure.
+ * @return The valid and readable (e.g. decrypted) blob. Returns null for
+ * invalid blobs.
+ */
+ public SessionBlob validate(SessionBlob blob);
+
+}
diff --git a/benchmarks/600.java/benchmark4/java/src/main/java/util/Order.java b/benchmarks/600.java/benchmark4/java/src/main/java/util/Order.java
new file mode 100644
index 00000000..95434605
--- /dev/null
+++ b/benchmarks/600.java/benchmark4/java/src/main/java/util/Order.java
@@ -0,0 +1,281 @@
+
+package util;
+
+/**
+ * Entity for orders.
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public class Order {
+
+ private long id;
+ private long userId;
+ private String time;
+
+ private long totalPriceInCents;
+ private String addressName;
+ private String address1;
+ private String address2;
+
+ private String creditCardCompany;
+ private String creditCardNumber;
+ private String creditCardExpiryDate;
+
+ /**
+ * Create a new and empty order.
+ */
+ public Order() {
+
+ }
+
+ /**
+ * Every entity needs a copy constructor.
+ *
+ * @param order
+ * The order to copy.
+ */
+ public Order(Order order) {
+ setId(order.getId());
+ setUserId(order.getUserId());
+ setTime(order.getTime());
+ setTotalPriceInCents(order.getTotalPriceInCents());
+ setAddressName(order.getAddressName());
+ setAddress1(order.getAddress1());
+ setAddress2(order.getAddress2());
+ setCreditCardCompany(order.getCreditCardCompany());
+ setCreditCardNumber(order.getCreditCardNumber());
+ setCreditCardExpiryDate(order.getCreditCardExpiryDate());
+ }
+
+ /**
+ * Get the id (remember that this ID may be incorrect, especially if a separate id was passed).
+ *
+ * @return The id.
+ */
+ public long getId() {
+ return id;
+ }
+
+ /**
+ * For REST use only. Sets the ID. Ignored by persistence.
+ *
+ * @param id
+ * ID, as passed by the REST API.
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ /**
+ * Get the User id.
+ *
+ * @return the userId.
+ */
+ public long getUserId() {
+ return userId;
+ }
+
+ /**
+ * Set the User Id.
+ *
+ * @param userId
+ * the userId to set.
+ */
+ public void setUserId(long userId) {
+ this.userId = userId;
+ }
+
+ /**
+ * Get the time of order (ISO formatted). Formatted using {@link DateTimeFormatter.ISO_LOCAL_DATE_TIME}.
+ *
+ * @return the time.
+ */
+ public String getTime() {
+ return time;
+ }
+
+ /**
+ * Set the time of order (ISO formatted). Format using {@link DateTimeFormatter.ISO_LOCAL_DATE_TIME}.
+ *
+ * @param time
+ * the time to set.
+ */
+ public void setTime(String time) {
+ this.time = time;
+ }
+
+ /**
+ * Get the total price in cents.
+ *
+ * @return the totalPriceInCents.
+ */
+ public long getTotalPriceInCents() {
+ return totalPriceInCents;
+ }
+
+ /**
+ * Set the total price in cents.
+ *
+ * @param totalPriceInCents
+ * the totalPriceInCents to set.
+ */
+ public void setTotalPriceInCents(long totalPriceInCents) {
+ this.totalPriceInCents = totalPriceInCents;
+ }
+
+ /**
+ * Get the name for the address.
+ *
+ * @return the addressName.
+ */
+ public String getAddressName() {
+ return addressName;
+ }
+
+ /**
+ * Set the name for the address.
+ *
+ * @param addressName
+ * the addressName to set.
+ */
+ public void setAddressName(String addressName) {
+ this.addressName = addressName;
+ }
+
+ /**
+ * Get address line 1.
+ *
+ * @return the address1.
+ */
+ public String getAddress1() {
+ return address1;
+ }
+
+ /**
+ * Set address line 1.
+ *
+ * @param address1
+ * the address1 to set.
+ */
+ public void setAddress1(String address1) {
+ this.address1 = address1;
+ }
+
+ /**
+ * Get address line 2.
+ *
+ * @return the address2.
+ */
+ public String getAddress2() {
+ return address2;
+ }
+
+ /**
+ * Set address line 2.
+ *
+ * @param address2
+ * the address2 to set.
+ */
+ public void setAddress2(String address2) {
+ this.address2 = address2;
+ }
+
+ /**
+ * Get the name of the credit card company.
+ *
+ * @return the creditCardCompany.
+ */
+ public String getCreditCardCompany() {
+ return creditCardCompany;
+ }
+
+ /**
+ * Set the name of the credit card company.
+ *
+ * @param creditCardCompany
+ * the creditCardCompany to set.
+ */
+ public void setCreditCardCompany(String creditCardCompany) {
+ this.creditCardCompany = creditCardCompany;
+ }
+
+ /**
+ * Get the credit card number.
+ *
+ * @return the creditCardNumber.
+ */
+ public String getCreditCardNumber() {
+ return creditCardNumber;
+ }
+
+ /**
+ * Set the credit card number.
+ *
+ * @param creditCardNumber
+ * the creditCardNumber to set.
+ */
+ public void setCreditCardNumber(String creditCardNumber) {
+ this.creditCardNumber = creditCardNumber;
+ }
+
+ /**
+ * Get the credit card expiry date (ISO formatted). Formatted using {@link DateTimeFormatter.ISO_LOCAL_DATE}.
+ *
+ * @return the creditCardExpiryDate.
+ */
+ public String getCreditCardExpiryDate() {
+ return creditCardExpiryDate;
+ }
+
+ /**
+ * Set the credit card expiry date (ISO formatted). Format using {@link DateTimeFormatter.ISO_LOCAL_DATE}.
+ *
+ * @param creditCardExpiryDate
+ * the creditCardExpiryDate to set.
+ */
+ public void setCreditCardExpiryDate(String creditCardExpiryDate) {
+ this.creditCardExpiryDate = creditCardExpiryDate;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (id ^ (id >>> 32));
+ result = prime * result + (int) (userId ^ (userId >>> 32));
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Order other = (Order) obj;
+ if (id != other.id) {
+ return false;
+ }
+ if (userId != other.userId) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/benchmarks/600.java/benchmark4/java/src/main/java/util/OrderItem.java b/benchmarks/600.java/benchmark4/java/src/main/java/util/OrderItem.java
new file mode 100644
index 00000000..f0c01fe9
--- /dev/null
+++ b/benchmarks/600.java/benchmark4/java/src/main/java/util/OrderItem.java
@@ -0,0 +1,179 @@
+
+package util;
+
+/**
+ * Entity Class for OrderItems (item with quantity in shopping cart or order).
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public class OrderItem {
+
+ private long id;
+ private long productId;
+ private long orderId;
+ private int quantity;
+ private long unitPriceInCents;
+
+ /**
+ * Create a new and empty OrderItem.
+ */
+ public OrderItem() {
+
+ }
+
+ /**
+ * Every Entity needs a Copy-Constructor!
+ *
+ * @param orderItem
+ * The entity to Copy.
+ */
+ public OrderItem(OrderItem orderItem) {
+ setId(orderItem.getId());
+ setProductId(orderItem.getProductId());
+ setOrderId(orderItem.getOrderId());
+ setQuantity(orderItem.getQuantity());
+ setUnitPriceInCents(orderItem.getUnitPriceInCents());
+ }
+
+ /**
+ * Get the id (remember that this ID may be incorrect, especially if a separate id was passed).
+ *
+ * @return The id.
+ */
+ public long getId() {
+ return id;
+ }
+
+ /**
+ * For REST use only. Sets the ID. Ignored by persistence.
+ *
+ * @param id
+ * ID, as passed by the REST API.
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ /**
+ * ID of the order item's product.
+ *
+ * @return Product Id;
+ */
+ public long getProductId() {
+ return productId;
+ }
+
+ /**
+ * Sets the ID of the order item's product. Every order Item MUST have a valid product ID.
+ *
+ * @param productId
+ * The product ID to set.
+ */
+ public void setProductId(long productId) {
+ this.productId = productId;
+ }
+
+ /**
+ * Get the quantity (amount in shopping cart/order).
+ *
+ * @return The quantity.
+ */
+ public int getQuantity() {
+ return quantity;
+ }
+
+ /**
+ * Set the quantity (amount in shopping cart/order).
+ *
+ * @param quantity
+ * The quantity.
+ */
+ public void setQuantity(int quantity) {
+ this.quantity = quantity;
+ }
+
+ /**
+ * The price per single item in the order item.
+ *
+ * @return Price per single item.
+ */
+ public long getUnitPriceInCents() {
+ return unitPriceInCents;
+ }
+
+ /**
+ * Set the price per single item in the order item.
+ *
+ * @param unitPriceInCents
+ * Price per single item.
+ */
+ public void setUnitPriceInCents(long unitPriceInCents) {
+ this.unitPriceInCents = unitPriceInCents;
+ }
+
+ /**
+ * Gets the ID of the order item's order.
+ *
+ * @return The order ID.
+ */
+ public long getOrderId() {
+ return orderId;
+ }
+
+ /**
+ * Sets the ID of the order item's order. Persistence requires that every order item MUST have a valid order ID. For
+ * persistence the order must already exist in database.
+ *
+ * @param orderId
+ * The order ID to set.
+ */
+ public void setOrderId(long orderId) {
+ this.orderId = orderId;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (id ^ (id >>> 32));
+ result = prime * result + (int) (orderId ^ (orderId >>> 32));
+ result = prime * result + (int) (productId ^ (productId >>> 32));
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ OrderItem other = (OrderItem) obj;
+ if (id != other.id) {
+ return false;
+ }
+ if (orderId != other.orderId) {
+ return false;
+ }
+ if (productId != other.productId) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/benchmarks/600.java/benchmark4/java/src/main/java/util/SessionBlob.java b/benchmarks/600.java/benchmark4/java/src/main/java/util/SessionBlob.java
new file mode 100644
index 00000000..6875efa4
--- /dev/null
+++ b/benchmarks/600.java/benchmark4/java/src/main/java/util/SessionBlob.java
@@ -0,0 +1,133 @@
+package util;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Blob containing all information about the user session.
+ * @author Simon
+ */
+public class SessionBlob {
+
+ private Long uid;
+ private String sid;
+ private String token;
+ private Order order;
+ private List orderItems = new LinkedList();
+ private String message;
+
+ /**
+ * Constructor, creates an empty order.
+ */
+ public SessionBlob() {
+ this.setOrder(new Order());
+ }
+
+ /**
+ * Getter for the userid.
+ * @return userid
+ */
+ public Long getUID() {
+ return uid;
+ }
+
+ /**
+ * Setter for the userid.
+ * @param uID userid
+ */
+ public void setUID(Long uID) {
+ uid = uID;
+ }
+
+ /**
+ * Getter for session id.
+ * @return session id
+ */
+ public String getSID() {
+ return sid;
+ }
+
+ /**
+ * Setter for session id.
+ * @param sID session id
+ */
+ public void setSID(String sID) {
+ sid = sID;
+ }
+
+ /**
+ * Getter for trust token.
+ * @return trust token
+ */
+ public String getToken() {
+ return token;
+ }
+
+ /**
+ * Setter for trust token.
+ * @param token trust token.
+ */
+ public void setToken(String token) {
+ this.token = token;
+ }
+
+ /**
+ * Setter for the message.
+ * @param message String
+ */
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ /**
+ * Getter for the message.
+ * @return message
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * Getter for order.
+ * @return order
+ */
+ public Order getOrder() {
+ return order;
+ }
+
+ /**
+ * Setter for order.
+ * @param order order
+ */
+ public void setOrder(Order order) {
+ this.order = order;
+ }
+
+ /**
+ * Getter for order items.
+ * @return order items.
+ */
+ public List getOrderItems() {
+ return orderItems;
+ }
+
+ /**
+ * Setter for order items.
+ * @param orderItems list of order items
+ */
+ public void setOrderItems(List orderItems) {
+ this.orderItems = orderItems;
+ }
+
+ @Override
+ public String toString() {
+ return "ClassName{" +
+ "uid=" + uid +
+ ", sid='" + sid + '\'' +
+ ", token='" + token + '\'' +
+ ", order=" + (order != null ? order.toString() : "null") +
+ ", orderItems=" + (orderItems != null ? orderItems.toString() : "null") +
+ ", message='" + message + '\'' +
+ '}';
+ }
+}
diff --git a/benchmarks/600.java/benchmark4/java/src/main/java/util/ShaSecurityProvider.java b/benchmarks/600.java/benchmark4/java/src/main/java/util/ShaSecurityProvider.java
new file mode 100644
index 00000000..d9c88f90
--- /dev/null
+++ b/benchmarks/600.java/benchmark4/java/src/main/java/util/ShaSecurityProvider.java
@@ -0,0 +1,79 @@
+package util;
+
+import java.io.UnsupportedEncodingException;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import java.net.URLEncoder;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * Secruity provider uscom.fasterxml.jackson.databind.Objecting AES.
+ *
+ * @author Simon
+ *
+ */
+public class ShaSecurityProvider implements ISecurityProvider {
+
+ @Override
+ public IKeyProvider getKeyProvider() {
+ return new ConstantKeyProvider();
+ }
+
+ @Override
+ public SessionBlob secure(SessionBlob blob) {
+ if (blob.getUID() == null || blob.getSID() == null) {
+ return blob;
+ }
+ blob.setToken(null);
+ String blobString = blobToString(blob);
+ blob.setToken(getSha512(blobString));
+ return blob;
+ }
+
+ private String blobToString(SessionBlob blob) {
+ ObjectMapper o = new ObjectMapper();
+ try {
+ return URLEncoder.encode(o.writeValueAsString(blob), "UTF-8");
+ } catch (JsonProcessingException | UnsupportedEncodingException e)
+ {
+ throw new IllegalStateException("Could not save blob!");
+ }
+ }
+
+ @Override
+ public SessionBlob validate(SessionBlob blob) {
+ if (blob.getToken() == null) {
+ return null;
+ }
+
+ String token = blob.getToken();
+ blob.setToken(null);
+ String blobString = blobToString(blob);
+ String validationToken = getSha512(blobString);
+ if (validationToken.equals(token)) {
+ return blob;
+ }
+ return null;
+ }
+
+ private String getSha512(String passwordToHash) {
+ String generatedPassword = null;
+ try {
+ String salt = getKeyProvider().getKey(null);
+ MessageDigest md = MessageDigest.getInstance("SHA-512");
+ md.update(salt.getBytes("UTF-8"));
+ byte[] bytes = md.digest(passwordToHash.getBytes("UTF-8"));
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < bytes.length; i++) {
+ sb.append(Integer.toString((bytes[i] & 0xff) + 0x100, 16).substring(1));
+ }
+ generatedPassword = sb.toString();
+ } catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ return generatedPassword;
+ }
+}
diff --git a/benchmarks/600.java/benchmark5/config.json b/benchmarks/600.java/benchmark5/config.json
new file mode 100644
index 00000000..11be1ace
--- /dev/null
+++ b/benchmarks/600.java/benchmark5/config.json
@@ -0,0 +1,6 @@
+{
+ "timeout": 60,
+ "memory": 512,
+ "languages": ["java"]
+}
+
\ No newline at end of file
diff --git a/benchmarks/600.java/benchmark5/input.py b/benchmarks/600.java/benchmark5/input.py
new file mode 100644
index 00000000..136f8bc5
--- /dev/null
+++ b/benchmarks/600.java/benchmark5/input.py
@@ -0,0 +1,5 @@
+def buckets_count():
+ return (0, 0)
+
+def generate_input(data_dir, size, benchmarks_bucket, input_paths, output_paths, upload_func):
+ return { }
\ No newline at end of file
diff --git a/benchmarks/600.java/benchmark5/java/pom.xml b/benchmarks/600.java/benchmark5/java/pom.xml
new file mode 100644
index 00000000..32025ca0
--- /dev/null
+++ b/benchmarks/600.java/benchmark5/java/pom.xml
@@ -0,0 +1,63 @@
+
+
+ 4.0.0
+
+ faas
+ benchmark
+ 1
+
+
+ 8
+ 8
+ UTF-8
+
+
+
+
+
+ com.google.code.gson
+ gson
+ 2.11.0
+
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.17.2
+
+
+
+ com.fasterxml.jackson.core
+ jackson-core
+ 2.17.2
+
+
+ io.netty
+ netty-all
+ 4.1.65.Final
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 3.2.4
+
+
+ package
+
+ shade
+
+
+ false
+
+
+
+
+
+
+
diff --git a/benchmarks/600.java/benchmark5/java/src/main/java/faas/App.java b/benchmarks/600.java/benchmark5/java/src/main/java/faas/App.java
new file mode 100644
index 00000000..ff55cef8
--- /dev/null
+++ b/benchmarks/600.java/benchmark5/java/src/main/java/faas/App.java
@@ -0,0 +1,26 @@
+package faas;
+import com.google.gson.Gson;
+import com.google.gson.JsonObject;
+import util.SessionBlob;
+import util.ShaSecurityProvider;
+
+//import jakarta.ws.rs.core.Response;
+
+
+public class App {
+ public JsonObject handler(JsonObject args) {
+ Gson gson = new Gson();
+ SessionBlob blob = gson.fromJson(args, SessionBlob.class);
+
+ ShaSecurityProvider securityProvider = new ShaSecurityProvider();
+ SessionBlob validatedBlob = securityProvider.validate(blob);
+
+ JsonObject jsonResult = new JsonObject();
+ if (validatedBlob != null)
+ jsonResult.addProperty("Authorization-Status", "Authorized");
+ else
+ jsonResult.addProperty("Authorization-Status", "Unauthorized");
+ return jsonResult;
+ }
+}
+
diff --git a/benchmarks/600.java/benchmark5/java/src/main/java/util/ConstantKeyProvider.java b/benchmarks/600.java/benchmark5/java/src/main/java/util/ConstantKeyProvider.java
new file mode 100644
index 00000000..ed377e1f
--- /dev/null
+++ b/benchmarks/600.java/benchmark5/java/src/main/java/util/ConstantKeyProvider.java
@@ -0,0 +1,21 @@
+package util;
+
+
+/**
+ * Class for testing. Provides a constant key. DO NOT ADOPT THIS FOR ANY REAL
+ * PRODUCTION WORKLOAD!
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public class ConstantKeyProvider implements IKeyProvider {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getKey(SessionBlob blob) {
+ return "thebestsecretkey";
+ }
+
+}
diff --git a/benchmarks/600.java/benchmark5/java/src/main/java/util/IKeyProvider.java b/benchmarks/600.java/benchmark5/java/src/main/java/util/IKeyProvider.java
new file mode 100644
index 00000000..c78e0dd0
--- /dev/null
+++ b/benchmarks/600.java/benchmark5/java/src/main/java/util/IKeyProvider.java
@@ -0,0 +1,23 @@
+
+package util;
+
+/**
+ * Provides keys for the security provider. The key provider must ensure that
+ * keys accross replicated stores are consistent.
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public interface IKeyProvider {
+
+ /**
+ * Returns a key for a session blob. Key must be the same, regardless of the
+ * store instance upon which this call is made.
+ *
+ * @param blob
+ * The blob to secure.
+ * @return The key.
+ */
+ public String getKey(SessionBlob blob);
+
+}
diff --git a/benchmarks/600.java/benchmark5/java/src/main/java/util/ISecurityProvider.java b/benchmarks/600.java/benchmark5/java/src/main/java/util/ISecurityProvider.java
new file mode 100644
index 00000000..8d710001
--- /dev/null
+++ b/benchmarks/600.java/benchmark5/java/src/main/java/util/ISecurityProvider.java
@@ -0,0 +1,39 @@
+package util;
+
+
+/**
+ * Utilities for securing (e.g. encrypting) session blobs.
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public interface ISecurityProvider {
+
+ /**
+ * Get the key provider for this security provider.
+ *
+ * @return The key provider.
+ */
+ public IKeyProvider getKeyProvider();
+
+ /**
+ * Secures a session blob. May encrypt or hash values within the blob.
+ *
+ * @param blob
+ * The blob to secure.
+ * @return A secure blob to be passed on to the web ui.
+ */
+ public SessionBlob secure(SessionBlob blob);
+
+ /**
+ * Validates a secured session blob. Returns a valid and readable (e.g.
+ * decrypted) blob. Returns null for invalid blobs.
+ *
+ * @param blob
+ * The blob to secure.
+ * @return The valid and readable (e.g. decrypted) blob. Returns null for
+ * invalid blobs.
+ */
+ public SessionBlob validate(SessionBlob blob);
+
+}
diff --git a/benchmarks/600.java/benchmark5/java/src/main/java/util/Order.java b/benchmarks/600.java/benchmark5/java/src/main/java/util/Order.java
new file mode 100644
index 00000000..95434605
--- /dev/null
+++ b/benchmarks/600.java/benchmark5/java/src/main/java/util/Order.java
@@ -0,0 +1,281 @@
+
+package util;
+
+/**
+ * Entity for orders.
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public class Order {
+
+ private long id;
+ private long userId;
+ private String time;
+
+ private long totalPriceInCents;
+ private String addressName;
+ private String address1;
+ private String address2;
+
+ private String creditCardCompany;
+ private String creditCardNumber;
+ private String creditCardExpiryDate;
+
+ /**
+ * Create a new and empty order.
+ */
+ public Order() {
+
+ }
+
+ /**
+ * Every entity needs a copy constructor.
+ *
+ * @param order
+ * The order to copy.
+ */
+ public Order(Order order) {
+ setId(order.getId());
+ setUserId(order.getUserId());
+ setTime(order.getTime());
+ setTotalPriceInCents(order.getTotalPriceInCents());
+ setAddressName(order.getAddressName());
+ setAddress1(order.getAddress1());
+ setAddress2(order.getAddress2());
+ setCreditCardCompany(order.getCreditCardCompany());
+ setCreditCardNumber(order.getCreditCardNumber());
+ setCreditCardExpiryDate(order.getCreditCardExpiryDate());
+ }
+
+ /**
+ * Get the id (remember that this ID may be incorrect, especially if a separate id was passed).
+ *
+ * @return The id.
+ */
+ public long getId() {
+ return id;
+ }
+
+ /**
+ * For REST use only. Sets the ID. Ignored by persistence.
+ *
+ * @param id
+ * ID, as passed by the REST API.
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ /**
+ * Get the User id.
+ *
+ * @return the userId.
+ */
+ public long getUserId() {
+ return userId;
+ }
+
+ /**
+ * Set the User Id.
+ *
+ * @param userId
+ * the userId to set.
+ */
+ public void setUserId(long userId) {
+ this.userId = userId;
+ }
+
+ /**
+ * Get the time of order (ISO formatted). Formatted using {@link DateTimeFormatter.ISO_LOCAL_DATE_TIME}.
+ *
+ * @return the time.
+ */
+ public String getTime() {
+ return time;
+ }
+
+ /**
+ * Set the time of order (ISO formatted). Format using {@link DateTimeFormatter.ISO_LOCAL_DATE_TIME}.
+ *
+ * @param time
+ * the time to set.
+ */
+ public void setTime(String time) {
+ this.time = time;
+ }
+
+ /**
+ * Get the total price in cents.
+ *
+ * @return the totalPriceInCents.
+ */
+ public long getTotalPriceInCents() {
+ return totalPriceInCents;
+ }
+
+ /**
+ * Set the total price in cents.
+ *
+ * @param totalPriceInCents
+ * the totalPriceInCents to set.
+ */
+ public void setTotalPriceInCents(long totalPriceInCents) {
+ this.totalPriceInCents = totalPriceInCents;
+ }
+
+ /**
+ * Get the name for the address.
+ *
+ * @return the addressName.
+ */
+ public String getAddressName() {
+ return addressName;
+ }
+
+ /**
+ * Set the name for the address.
+ *
+ * @param addressName
+ * the addressName to set.
+ */
+ public void setAddressName(String addressName) {
+ this.addressName = addressName;
+ }
+
+ /**
+ * Get address line 1.
+ *
+ * @return the address1.
+ */
+ public String getAddress1() {
+ return address1;
+ }
+
+ /**
+ * Set address line 1.
+ *
+ * @param address1
+ * the address1 to set.
+ */
+ public void setAddress1(String address1) {
+ this.address1 = address1;
+ }
+
+ /**
+ * Get address line 2.
+ *
+ * @return the address2.
+ */
+ public String getAddress2() {
+ return address2;
+ }
+
+ /**
+ * Set address line 2.
+ *
+ * @param address2
+ * the address2 to set.
+ */
+ public void setAddress2(String address2) {
+ this.address2 = address2;
+ }
+
+ /**
+ * Get the name of the credit card company.
+ *
+ * @return the creditCardCompany.
+ */
+ public String getCreditCardCompany() {
+ return creditCardCompany;
+ }
+
+ /**
+ * Set the name of the credit card company.
+ *
+ * @param creditCardCompany
+ * the creditCardCompany to set.
+ */
+ public void setCreditCardCompany(String creditCardCompany) {
+ this.creditCardCompany = creditCardCompany;
+ }
+
+ /**
+ * Get the credit card number.
+ *
+ * @return the creditCardNumber.
+ */
+ public String getCreditCardNumber() {
+ return creditCardNumber;
+ }
+
+ /**
+ * Set the credit card number.
+ *
+ * @param creditCardNumber
+ * the creditCardNumber to set.
+ */
+ public void setCreditCardNumber(String creditCardNumber) {
+ this.creditCardNumber = creditCardNumber;
+ }
+
+ /**
+ * Get the credit card expiry date (ISO formatted). Formatted using {@link DateTimeFormatter.ISO_LOCAL_DATE}.
+ *
+ * @return the creditCardExpiryDate.
+ */
+ public String getCreditCardExpiryDate() {
+ return creditCardExpiryDate;
+ }
+
+ /**
+ * Set the credit card expiry date (ISO formatted). Format using {@link DateTimeFormatter.ISO_LOCAL_DATE}.
+ *
+ * @param creditCardExpiryDate
+ * the creditCardExpiryDate to set.
+ */
+ public void setCreditCardExpiryDate(String creditCardExpiryDate) {
+ this.creditCardExpiryDate = creditCardExpiryDate;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (id ^ (id >>> 32));
+ result = prime * result + (int) (userId ^ (userId >>> 32));
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Order other = (Order) obj;
+ if (id != other.id) {
+ return false;
+ }
+ if (userId != other.userId) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/benchmarks/600.java/benchmark5/java/src/main/java/util/OrderItem.java b/benchmarks/600.java/benchmark5/java/src/main/java/util/OrderItem.java
new file mode 100644
index 00000000..f0c01fe9
--- /dev/null
+++ b/benchmarks/600.java/benchmark5/java/src/main/java/util/OrderItem.java
@@ -0,0 +1,179 @@
+
+package util;
+
+/**
+ * Entity Class for OrderItems (item with quantity in shopping cart or order).
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public class OrderItem {
+
+ private long id;
+ private long productId;
+ private long orderId;
+ private int quantity;
+ private long unitPriceInCents;
+
+ /**
+ * Create a new and empty OrderItem.
+ */
+ public OrderItem() {
+
+ }
+
+ /**
+ * Every Entity needs a Copy-Constructor!
+ *
+ * @param orderItem
+ * The entity to Copy.
+ */
+ public OrderItem(OrderItem orderItem) {
+ setId(orderItem.getId());
+ setProductId(orderItem.getProductId());
+ setOrderId(orderItem.getOrderId());
+ setQuantity(orderItem.getQuantity());
+ setUnitPriceInCents(orderItem.getUnitPriceInCents());
+ }
+
+ /**
+ * Get the id (remember that this ID may be incorrect, especially if a separate id was passed).
+ *
+ * @return The id.
+ */
+ public long getId() {
+ return id;
+ }
+
+ /**
+ * For REST use only. Sets the ID. Ignored by persistence.
+ *
+ * @param id
+ * ID, as passed by the REST API.
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ /**
+ * ID of the order item's product.
+ *
+ * @return Product Id;
+ */
+ public long getProductId() {
+ return productId;
+ }
+
+ /**
+ * Sets the ID of the order item's product. Every order Item MUST have a valid product ID.
+ *
+ * @param productId
+ * The product ID to set.
+ */
+ public void setProductId(long productId) {
+ this.productId = productId;
+ }
+
+ /**
+ * Get the quantity (amount in shopping cart/order).
+ *
+ * @return The quantity.
+ */
+ public int getQuantity() {
+ return quantity;
+ }
+
+ /**
+ * Set the quantity (amount in shopping cart/order).
+ *
+ * @param quantity
+ * The quantity.
+ */
+ public void setQuantity(int quantity) {
+ this.quantity = quantity;
+ }
+
+ /**
+ * The price per single item in the order item.
+ *
+ * @return Price per single item.
+ */
+ public long getUnitPriceInCents() {
+ return unitPriceInCents;
+ }
+
+ /**
+ * Set the price per single item in the order item.
+ *
+ * @param unitPriceInCents
+ * Price per single item.
+ */
+ public void setUnitPriceInCents(long unitPriceInCents) {
+ this.unitPriceInCents = unitPriceInCents;
+ }
+
+ /**
+ * Gets the ID of the order item's order.
+ *
+ * @return The order ID.
+ */
+ public long getOrderId() {
+ return orderId;
+ }
+
+ /**
+ * Sets the ID of the order item's order. Persistence requires that every order item MUST have a valid order ID. For
+ * persistence the order must already exist in database.
+ *
+ * @param orderId
+ * The order ID to set.
+ */
+ public void setOrderId(long orderId) {
+ this.orderId = orderId;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (id ^ (id >>> 32));
+ result = prime * result + (int) (orderId ^ (orderId >>> 32));
+ result = prime * result + (int) (productId ^ (productId >>> 32));
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ OrderItem other = (OrderItem) obj;
+ if (id != other.id) {
+ return false;
+ }
+ if (orderId != other.orderId) {
+ return false;
+ }
+ if (productId != other.productId) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/benchmarks/600.java/benchmark5/java/src/main/java/util/SessionBlob.java b/benchmarks/600.java/benchmark5/java/src/main/java/util/SessionBlob.java
new file mode 100644
index 00000000..6875efa4
--- /dev/null
+++ b/benchmarks/600.java/benchmark5/java/src/main/java/util/SessionBlob.java
@@ -0,0 +1,133 @@
+package util;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Blob containing all information about the user session.
+ * @author Simon
+ */
+public class SessionBlob {
+
+ private Long uid;
+ private String sid;
+ private String token;
+ private Order order;
+ private List orderItems = new LinkedList();
+ private String message;
+
+ /**
+ * Constructor, creates an empty order.
+ */
+ public SessionBlob() {
+ this.setOrder(new Order());
+ }
+
+ /**
+ * Getter for the userid.
+ * @return userid
+ */
+ public Long getUID() {
+ return uid;
+ }
+
+ /**
+ * Setter for the userid.
+ * @param uID userid
+ */
+ public void setUID(Long uID) {
+ uid = uID;
+ }
+
+ /**
+ * Getter for session id.
+ * @return session id
+ */
+ public String getSID() {
+ return sid;
+ }
+
+ /**
+ * Setter for session id.
+ * @param sID session id
+ */
+ public void setSID(String sID) {
+ sid = sID;
+ }
+
+ /**
+ * Getter for trust token.
+ * @return trust token
+ */
+ public String getToken() {
+ return token;
+ }
+
+ /**
+ * Setter for trust token.
+ * @param token trust token.
+ */
+ public void setToken(String token) {
+ this.token = token;
+ }
+
+ /**
+ * Setter for the message.
+ * @param message String
+ */
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ /**
+ * Getter for the message.
+ * @return message
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * Getter for order.
+ * @return order
+ */
+ public Order getOrder() {
+ return order;
+ }
+
+ /**
+ * Setter for order.
+ * @param order order
+ */
+ public void setOrder(Order order) {
+ this.order = order;
+ }
+
+ /**
+ * Getter for order items.
+ * @return order items.
+ */
+ public List getOrderItems() {
+ return orderItems;
+ }
+
+ /**
+ * Setter for order items.
+ * @param orderItems list of order items
+ */
+ public void setOrderItems(List orderItems) {
+ this.orderItems = orderItems;
+ }
+
+ @Override
+ public String toString() {
+ return "ClassName{" +
+ "uid=" + uid +
+ ", sid='" + sid + '\'' +
+ ", token='" + token + '\'' +
+ ", order=" + (order != null ? order.toString() : "null") +
+ ", orderItems=" + (orderItems != null ? orderItems.toString() : "null") +
+ ", message='" + message + '\'' +
+ '}';
+ }
+}
diff --git a/benchmarks/600.java/benchmark5/java/src/main/java/util/ShaSecurityProvider.java b/benchmarks/600.java/benchmark5/java/src/main/java/util/ShaSecurityProvider.java
new file mode 100644
index 00000000..d9c88f90
--- /dev/null
+++ b/benchmarks/600.java/benchmark5/java/src/main/java/util/ShaSecurityProvider.java
@@ -0,0 +1,79 @@
+package util;
+
+import java.io.UnsupportedEncodingException;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import java.net.URLEncoder;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * Secruity provider uscom.fasterxml.jackson.databind.Objecting AES.
+ *
+ * @author Simon
+ *
+ */
+public class ShaSecurityProvider implements ISecurityProvider {
+
+ @Override
+ public IKeyProvider getKeyProvider() {
+ return new ConstantKeyProvider();
+ }
+
+ @Override
+ public SessionBlob secure(SessionBlob blob) {
+ if (blob.getUID() == null || blob.getSID() == null) {
+ return blob;
+ }
+ blob.setToken(null);
+ String blobString = blobToString(blob);
+ blob.setToken(getSha512(blobString));
+ return blob;
+ }
+
+ private String blobToString(SessionBlob blob) {
+ ObjectMapper o = new ObjectMapper();
+ try {
+ return URLEncoder.encode(o.writeValueAsString(blob), "UTF-8");
+ } catch (JsonProcessingException | UnsupportedEncodingException e)
+ {
+ throw new IllegalStateException("Could not save blob!");
+ }
+ }
+
+ @Override
+ public SessionBlob validate(SessionBlob blob) {
+ if (blob.getToken() == null) {
+ return null;
+ }
+
+ String token = blob.getToken();
+ blob.setToken(null);
+ String blobString = blobToString(blob);
+ String validationToken = getSha512(blobString);
+ if (validationToken.equals(token)) {
+ return blob;
+ }
+ return null;
+ }
+
+ private String getSha512(String passwordToHash) {
+ String generatedPassword = null;
+ try {
+ String salt = getKeyProvider().getKey(null);
+ MessageDigest md = MessageDigest.getInstance("SHA-512");
+ md.update(salt.getBytes("UTF-8"));
+ byte[] bytes = md.digest(passwordToHash.getBytes("UTF-8"));
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < bytes.length; i++) {
+ sb.append(Integer.toString((bytes[i] & 0xff) + 0x100, 16).substring(1));
+ }
+ generatedPassword = sb.toString();
+ } catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ return generatedPassword;
+ }
+}
diff --git a/benchmarks/600.java/benchmark6/config.json b/benchmarks/600.java/benchmark6/config.json
new file mode 100644
index 00000000..11be1ace
--- /dev/null
+++ b/benchmarks/600.java/benchmark6/config.json
@@ -0,0 +1,6 @@
+{
+ "timeout": 60,
+ "memory": 512,
+ "languages": ["java"]
+}
+
\ No newline at end of file
diff --git a/benchmarks/600.java/benchmark6/input.py b/benchmarks/600.java/benchmark6/input.py
new file mode 100644
index 00000000..136f8bc5
--- /dev/null
+++ b/benchmarks/600.java/benchmark6/input.py
@@ -0,0 +1,5 @@
+def buckets_count():
+ return (0, 0)
+
+def generate_input(data_dir, size, benchmarks_bucket, input_paths, output_paths, upload_func):
+ return { }
\ No newline at end of file
diff --git a/benchmarks/600.java/benchmark6/java/pom.xml b/benchmarks/600.java/benchmark6/java/pom.xml
new file mode 100644
index 00000000..e159f1f8
--- /dev/null
+++ b/benchmarks/600.java/benchmark6/java/pom.xml
@@ -0,0 +1,68 @@
+
+
+ 4.0.0
+
+ faas
+ benchmark
+ 1
+
+
+ 8
+ 8
+ UTF-8
+
+
+
+
+
+ com.google.code.gson
+ gson
+ 2.11.0
+
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.17.2
+
+
+
+ com.fasterxml.jackson.core
+ jackson-core
+ 2.17.2
+
+
+ io.netty
+ netty-all
+ 4.1.65.Final
+
+
+ org.apache.pdfbox
+ pdfbox
+ 2.0.24
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 3.2.4
+
+
+ package
+
+ shade
+
+
+ false
+
+
+
+
+
+
+
diff --git a/benchmarks/600.java/benchmark6/java/src/main/java/faas/App.java b/benchmarks/600.java/benchmark6/java/src/main/java/faas/App.java
new file mode 100644
index 00000000..ff55cef8
--- /dev/null
+++ b/benchmarks/600.java/benchmark6/java/src/main/java/faas/App.java
@@ -0,0 +1,26 @@
+package faas;
+import com.google.gson.Gson;
+import com.google.gson.JsonObject;
+import util.SessionBlob;
+import util.ShaSecurityProvider;
+
+//import jakarta.ws.rs.core.Response;
+
+
+public class App {
+ public JsonObject handler(JsonObject args) {
+ Gson gson = new Gson();
+ SessionBlob blob = gson.fromJson(args, SessionBlob.class);
+
+ ShaSecurityProvider securityProvider = new ShaSecurityProvider();
+ SessionBlob validatedBlob = securityProvider.validate(blob);
+
+ JsonObject jsonResult = new JsonObject();
+ if (validatedBlob != null)
+ jsonResult.addProperty("Authorization-Status", "Authorized");
+ else
+ jsonResult.addProperty("Authorization-Status", "Unauthorized");
+ return jsonResult;
+ }
+}
+
diff --git a/benchmarks/600.java/benchmark6/java/src/main/java/util/ConstantKeyProvider.java b/benchmarks/600.java/benchmark6/java/src/main/java/util/ConstantKeyProvider.java
new file mode 100644
index 00000000..ed377e1f
--- /dev/null
+++ b/benchmarks/600.java/benchmark6/java/src/main/java/util/ConstantKeyProvider.java
@@ -0,0 +1,21 @@
+package util;
+
+
+/**
+ * Class for testing. Provides a constant key. DO NOT ADOPT THIS FOR ANY REAL
+ * PRODUCTION WORKLOAD!
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public class ConstantKeyProvider implements IKeyProvider {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getKey(SessionBlob blob) {
+ return "thebestsecretkey";
+ }
+
+}
diff --git a/benchmarks/600.java/benchmark6/java/src/main/java/util/IKeyProvider.java b/benchmarks/600.java/benchmark6/java/src/main/java/util/IKeyProvider.java
new file mode 100644
index 00000000..c78e0dd0
--- /dev/null
+++ b/benchmarks/600.java/benchmark6/java/src/main/java/util/IKeyProvider.java
@@ -0,0 +1,23 @@
+
+package util;
+
+/**
+ * Provides keys for the security provider. The key provider must ensure that
+ * keys accross replicated stores are consistent.
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public interface IKeyProvider {
+
+ /**
+ * Returns a key for a session blob. Key must be the same, regardless of the
+ * store instance upon which this call is made.
+ *
+ * @param blob
+ * The blob to secure.
+ * @return The key.
+ */
+ public String getKey(SessionBlob blob);
+
+}
diff --git a/benchmarks/600.java/benchmark6/java/src/main/java/util/ISecurityProvider.java b/benchmarks/600.java/benchmark6/java/src/main/java/util/ISecurityProvider.java
new file mode 100644
index 00000000..8d710001
--- /dev/null
+++ b/benchmarks/600.java/benchmark6/java/src/main/java/util/ISecurityProvider.java
@@ -0,0 +1,39 @@
+package util;
+
+
+/**
+ * Utilities for securing (e.g. encrypting) session blobs.
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public interface ISecurityProvider {
+
+ /**
+ * Get the key provider for this security provider.
+ *
+ * @return The key provider.
+ */
+ public IKeyProvider getKeyProvider();
+
+ /**
+ * Secures a session blob. May encrypt or hash values within the blob.
+ *
+ * @param blob
+ * The blob to secure.
+ * @return A secure blob to be passed on to the web ui.
+ */
+ public SessionBlob secure(SessionBlob blob);
+
+ /**
+ * Validates a secured session blob. Returns a valid and readable (e.g.
+ * decrypted) blob. Returns null for invalid blobs.
+ *
+ * @param blob
+ * The blob to secure.
+ * @return The valid and readable (e.g. decrypted) blob. Returns null for
+ * invalid blobs.
+ */
+ public SessionBlob validate(SessionBlob blob);
+
+}
diff --git a/benchmarks/600.java/benchmark6/java/src/main/java/util/Order.java b/benchmarks/600.java/benchmark6/java/src/main/java/util/Order.java
new file mode 100644
index 00000000..95434605
--- /dev/null
+++ b/benchmarks/600.java/benchmark6/java/src/main/java/util/Order.java
@@ -0,0 +1,281 @@
+
+package util;
+
+/**
+ * Entity for orders.
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public class Order {
+
+ private long id;
+ private long userId;
+ private String time;
+
+ private long totalPriceInCents;
+ private String addressName;
+ private String address1;
+ private String address2;
+
+ private String creditCardCompany;
+ private String creditCardNumber;
+ private String creditCardExpiryDate;
+
+ /**
+ * Create a new and empty order.
+ */
+ public Order() {
+
+ }
+
+ /**
+ * Every entity needs a copy constructor.
+ *
+ * @param order
+ * The order to copy.
+ */
+ public Order(Order order) {
+ setId(order.getId());
+ setUserId(order.getUserId());
+ setTime(order.getTime());
+ setTotalPriceInCents(order.getTotalPriceInCents());
+ setAddressName(order.getAddressName());
+ setAddress1(order.getAddress1());
+ setAddress2(order.getAddress2());
+ setCreditCardCompany(order.getCreditCardCompany());
+ setCreditCardNumber(order.getCreditCardNumber());
+ setCreditCardExpiryDate(order.getCreditCardExpiryDate());
+ }
+
+ /**
+ * Get the id (remember that this ID may be incorrect, especially if a separate id was passed).
+ *
+ * @return The id.
+ */
+ public long getId() {
+ return id;
+ }
+
+ /**
+ * For REST use only. Sets the ID. Ignored by persistence.
+ *
+ * @param id
+ * ID, as passed by the REST API.
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ /**
+ * Get the User id.
+ *
+ * @return the userId.
+ */
+ public long getUserId() {
+ return userId;
+ }
+
+ /**
+ * Set the User Id.
+ *
+ * @param userId
+ * the userId to set.
+ */
+ public void setUserId(long userId) {
+ this.userId = userId;
+ }
+
+ /**
+ * Get the time of order (ISO formatted). Formatted using {@link DateTimeFormatter.ISO_LOCAL_DATE_TIME}.
+ *
+ * @return the time.
+ */
+ public String getTime() {
+ return time;
+ }
+
+ /**
+ * Set the time of order (ISO formatted). Format using {@link DateTimeFormatter.ISO_LOCAL_DATE_TIME}.
+ *
+ * @param time
+ * the time to set.
+ */
+ public void setTime(String time) {
+ this.time = time;
+ }
+
+ /**
+ * Get the total price in cents.
+ *
+ * @return the totalPriceInCents.
+ */
+ public long getTotalPriceInCents() {
+ return totalPriceInCents;
+ }
+
+ /**
+ * Set the total price in cents.
+ *
+ * @param totalPriceInCents
+ * the totalPriceInCents to set.
+ */
+ public void setTotalPriceInCents(long totalPriceInCents) {
+ this.totalPriceInCents = totalPriceInCents;
+ }
+
+ /**
+ * Get the name for the address.
+ *
+ * @return the addressName.
+ */
+ public String getAddressName() {
+ return addressName;
+ }
+
+ /**
+ * Set the name for the address.
+ *
+ * @param addressName
+ * the addressName to set.
+ */
+ public void setAddressName(String addressName) {
+ this.addressName = addressName;
+ }
+
+ /**
+ * Get address line 1.
+ *
+ * @return the address1.
+ */
+ public String getAddress1() {
+ return address1;
+ }
+
+ /**
+ * Set address line 1.
+ *
+ * @param address1
+ * the address1 to set.
+ */
+ public void setAddress1(String address1) {
+ this.address1 = address1;
+ }
+
+ /**
+ * Get address line 2.
+ *
+ * @return the address2.
+ */
+ public String getAddress2() {
+ return address2;
+ }
+
+ /**
+ * Set address line 2.
+ *
+ * @param address2
+ * the address2 to set.
+ */
+ public void setAddress2(String address2) {
+ this.address2 = address2;
+ }
+
+ /**
+ * Get the name of the credit card company.
+ *
+ * @return the creditCardCompany.
+ */
+ public String getCreditCardCompany() {
+ return creditCardCompany;
+ }
+
+ /**
+ * Set the name of the credit card company.
+ *
+ * @param creditCardCompany
+ * the creditCardCompany to set.
+ */
+ public void setCreditCardCompany(String creditCardCompany) {
+ this.creditCardCompany = creditCardCompany;
+ }
+
+ /**
+ * Get the credit card number.
+ *
+ * @return the creditCardNumber.
+ */
+ public String getCreditCardNumber() {
+ return creditCardNumber;
+ }
+
+ /**
+ * Set the credit card number.
+ *
+ * @param creditCardNumber
+ * the creditCardNumber to set.
+ */
+ public void setCreditCardNumber(String creditCardNumber) {
+ this.creditCardNumber = creditCardNumber;
+ }
+
+ /**
+ * Get the credit card expiry date (ISO formatted). Formatted using {@link DateTimeFormatter.ISO_LOCAL_DATE}.
+ *
+ * @return the creditCardExpiryDate.
+ */
+ public String getCreditCardExpiryDate() {
+ return creditCardExpiryDate;
+ }
+
+ /**
+ * Set the credit card expiry date (ISO formatted). Format using {@link DateTimeFormatter.ISO_LOCAL_DATE}.
+ *
+ * @param creditCardExpiryDate
+ * the creditCardExpiryDate to set.
+ */
+ public void setCreditCardExpiryDate(String creditCardExpiryDate) {
+ this.creditCardExpiryDate = creditCardExpiryDate;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (id ^ (id >>> 32));
+ result = prime * result + (int) (userId ^ (userId >>> 32));
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Order other = (Order) obj;
+ if (id != other.id) {
+ return false;
+ }
+ if (userId != other.userId) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/benchmarks/600.java/benchmark6/java/src/main/java/util/OrderItem.java b/benchmarks/600.java/benchmark6/java/src/main/java/util/OrderItem.java
new file mode 100644
index 00000000..f0c01fe9
--- /dev/null
+++ b/benchmarks/600.java/benchmark6/java/src/main/java/util/OrderItem.java
@@ -0,0 +1,179 @@
+
+package util;
+
+/**
+ * Entity Class for OrderItems (item with quantity in shopping cart or order).
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public class OrderItem {
+
+ private long id;
+ private long productId;
+ private long orderId;
+ private int quantity;
+ private long unitPriceInCents;
+
+ /**
+ * Create a new and empty OrderItem.
+ */
+ public OrderItem() {
+
+ }
+
+ /**
+ * Every Entity needs a Copy-Constructor!
+ *
+ * @param orderItem
+ * The entity to Copy.
+ */
+ public OrderItem(OrderItem orderItem) {
+ setId(orderItem.getId());
+ setProductId(orderItem.getProductId());
+ setOrderId(orderItem.getOrderId());
+ setQuantity(orderItem.getQuantity());
+ setUnitPriceInCents(orderItem.getUnitPriceInCents());
+ }
+
+ /**
+ * Get the id (remember that this ID may be incorrect, especially if a separate id was passed).
+ *
+ * @return The id.
+ */
+ public long getId() {
+ return id;
+ }
+
+ /**
+ * For REST use only. Sets the ID. Ignored by persistence.
+ *
+ * @param id
+ * ID, as passed by the REST API.
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ /**
+ * ID of the order item's product.
+ *
+ * @return Product Id;
+ */
+ public long getProductId() {
+ return productId;
+ }
+
+ /**
+ * Sets the ID of the order item's product. Every order Item MUST have a valid product ID.
+ *
+ * @param productId
+ * The product ID to set.
+ */
+ public void setProductId(long productId) {
+ this.productId = productId;
+ }
+
+ /**
+ * Get the quantity (amount in shopping cart/order).
+ *
+ * @return The quantity.
+ */
+ public int getQuantity() {
+ return quantity;
+ }
+
+ /**
+ * Set the quantity (amount in shopping cart/order).
+ *
+ * @param quantity
+ * The quantity.
+ */
+ public void setQuantity(int quantity) {
+ this.quantity = quantity;
+ }
+
+ /**
+ * The price per single item in the order item.
+ *
+ * @return Price per single item.
+ */
+ public long getUnitPriceInCents() {
+ return unitPriceInCents;
+ }
+
+ /**
+ * Set the price per single item in the order item.
+ *
+ * @param unitPriceInCents
+ * Price per single item.
+ */
+ public void setUnitPriceInCents(long unitPriceInCents) {
+ this.unitPriceInCents = unitPriceInCents;
+ }
+
+ /**
+ * Gets the ID of the order item's order.
+ *
+ * @return The order ID.
+ */
+ public long getOrderId() {
+ return orderId;
+ }
+
+ /**
+ * Sets the ID of the order item's order. Persistence requires that every order item MUST have a valid order ID. For
+ * persistence the order must already exist in database.
+ *
+ * @param orderId
+ * The order ID to set.
+ */
+ public void setOrderId(long orderId) {
+ this.orderId = orderId;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (id ^ (id >>> 32));
+ result = prime * result + (int) (orderId ^ (orderId >>> 32));
+ result = prime * result + (int) (productId ^ (productId >>> 32));
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ OrderItem other = (OrderItem) obj;
+ if (id != other.id) {
+ return false;
+ }
+ if (orderId != other.orderId) {
+ return false;
+ }
+ if (productId != other.productId) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/benchmarks/600.java/benchmark6/java/src/main/java/util/SessionBlob.java b/benchmarks/600.java/benchmark6/java/src/main/java/util/SessionBlob.java
new file mode 100644
index 00000000..6875efa4
--- /dev/null
+++ b/benchmarks/600.java/benchmark6/java/src/main/java/util/SessionBlob.java
@@ -0,0 +1,133 @@
+package util;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Blob containing all information about the user session.
+ * @author Simon
+ */
+public class SessionBlob {
+
+ private Long uid;
+ private String sid;
+ private String token;
+ private Order order;
+ private List orderItems = new LinkedList();
+ private String message;
+
+ /**
+ * Constructor, creates an empty order.
+ */
+ public SessionBlob() {
+ this.setOrder(new Order());
+ }
+
+ /**
+ * Getter for the userid.
+ * @return userid
+ */
+ public Long getUID() {
+ return uid;
+ }
+
+ /**
+ * Setter for the userid.
+ * @param uID userid
+ */
+ public void setUID(Long uID) {
+ uid = uID;
+ }
+
+ /**
+ * Getter for session id.
+ * @return session id
+ */
+ public String getSID() {
+ return sid;
+ }
+
+ /**
+ * Setter for session id.
+ * @param sID session id
+ */
+ public void setSID(String sID) {
+ sid = sID;
+ }
+
+ /**
+ * Getter for trust token.
+ * @return trust token
+ */
+ public String getToken() {
+ return token;
+ }
+
+ /**
+ * Setter for trust token.
+ * @param token trust token.
+ */
+ public void setToken(String token) {
+ this.token = token;
+ }
+
+ /**
+ * Setter for the message.
+ * @param message String
+ */
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ /**
+ * Getter for the message.
+ * @return message
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * Getter for order.
+ * @return order
+ */
+ public Order getOrder() {
+ return order;
+ }
+
+ /**
+ * Setter for order.
+ * @param order order
+ */
+ public void setOrder(Order order) {
+ this.order = order;
+ }
+
+ /**
+ * Getter for order items.
+ * @return order items.
+ */
+ public List getOrderItems() {
+ return orderItems;
+ }
+
+ /**
+ * Setter for order items.
+ * @param orderItems list of order items
+ */
+ public void setOrderItems(List orderItems) {
+ this.orderItems = orderItems;
+ }
+
+ @Override
+ public String toString() {
+ return "ClassName{" +
+ "uid=" + uid +
+ ", sid='" + sid + '\'' +
+ ", token='" + token + '\'' +
+ ", order=" + (order != null ? order.toString() : "null") +
+ ", orderItems=" + (orderItems != null ? orderItems.toString() : "null") +
+ ", message='" + message + '\'' +
+ '}';
+ }
+}
diff --git a/benchmarks/600.java/benchmark6/java/src/main/java/util/ShaSecurityProvider.java b/benchmarks/600.java/benchmark6/java/src/main/java/util/ShaSecurityProvider.java
new file mode 100644
index 00000000..d9c88f90
--- /dev/null
+++ b/benchmarks/600.java/benchmark6/java/src/main/java/util/ShaSecurityProvider.java
@@ -0,0 +1,79 @@
+package util;
+
+import java.io.UnsupportedEncodingException;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import java.net.URLEncoder;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * Secruity provider uscom.fasterxml.jackson.databind.Objecting AES.
+ *
+ * @author Simon
+ *
+ */
+public class ShaSecurityProvider implements ISecurityProvider {
+
+ @Override
+ public IKeyProvider getKeyProvider() {
+ return new ConstantKeyProvider();
+ }
+
+ @Override
+ public SessionBlob secure(SessionBlob blob) {
+ if (blob.getUID() == null || blob.getSID() == null) {
+ return blob;
+ }
+ blob.setToken(null);
+ String blobString = blobToString(blob);
+ blob.setToken(getSha512(blobString));
+ return blob;
+ }
+
+ private String blobToString(SessionBlob blob) {
+ ObjectMapper o = new ObjectMapper();
+ try {
+ return URLEncoder.encode(o.writeValueAsString(blob), "UTF-8");
+ } catch (JsonProcessingException | UnsupportedEncodingException e)
+ {
+ throw new IllegalStateException("Could not save blob!");
+ }
+ }
+
+ @Override
+ public SessionBlob validate(SessionBlob blob) {
+ if (blob.getToken() == null) {
+ return null;
+ }
+
+ String token = blob.getToken();
+ blob.setToken(null);
+ String blobString = blobToString(blob);
+ String validationToken = getSha512(blobString);
+ if (validationToken.equals(token)) {
+ return blob;
+ }
+ return null;
+ }
+
+ private String getSha512(String passwordToHash) {
+ String generatedPassword = null;
+ try {
+ String salt = getKeyProvider().getKey(null);
+ MessageDigest md = MessageDigest.getInstance("SHA-512");
+ md.update(salt.getBytes("UTF-8"));
+ byte[] bytes = md.digest(passwordToHash.getBytes("UTF-8"));
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < bytes.length; i++) {
+ sb.append(Integer.toString((bytes[i] & 0xff) + 0x100, 16).substring(1));
+ }
+ generatedPassword = sb.toString();
+ } catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ return generatedPassword;
+ }
+}
diff --git a/benchmarks/600.java/benchmark7/config.json b/benchmarks/600.java/benchmark7/config.json
new file mode 100644
index 00000000..11be1ace
--- /dev/null
+++ b/benchmarks/600.java/benchmark7/config.json
@@ -0,0 +1,6 @@
+{
+ "timeout": 60,
+ "memory": 512,
+ "languages": ["java"]
+}
+
\ No newline at end of file
diff --git a/benchmarks/600.java/benchmark7/input.py b/benchmarks/600.java/benchmark7/input.py
new file mode 100644
index 00000000..136f8bc5
--- /dev/null
+++ b/benchmarks/600.java/benchmark7/input.py
@@ -0,0 +1,5 @@
+def buckets_count():
+ return (0, 0)
+
+def generate_input(data_dir, size, benchmarks_bucket, input_paths, output_paths, upload_func):
+ return { }
\ No newline at end of file
diff --git a/benchmarks/600.java/benchmark7/java/pom.xml b/benchmarks/600.java/benchmark7/java/pom.xml
new file mode 100644
index 00000000..f3a97c70
--- /dev/null
+++ b/benchmarks/600.java/benchmark7/java/pom.xml
@@ -0,0 +1,73 @@
+
+
+ 4.0.0
+
+ faas
+ benchmark
+ 1
+
+
+ 8
+ 8
+ UTF-8
+
+
+
+
+
+ com.google.code.gson
+ gson
+ 2.11.0
+
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.17.2
+
+
+
+ com.fasterxml.jackson.core
+ jackson-core
+ 2.17.2
+
+
+ io.netty
+ netty-all
+ 4.1.65.Final
+
+
+ org.apache.pdfbox
+ pdfbox
+ 2.0.24
+
+
+ org.apache.poi
+ poi-ooxml
+ 5.2.3
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 3.2.4
+
+
+ package
+
+ shade
+
+
+ false
+
+
+
+
+
+
+
diff --git a/benchmarks/600.java/benchmark7/java/src/main/java/faas/App.java b/benchmarks/600.java/benchmark7/java/src/main/java/faas/App.java
new file mode 100644
index 00000000..ff55cef8
--- /dev/null
+++ b/benchmarks/600.java/benchmark7/java/src/main/java/faas/App.java
@@ -0,0 +1,26 @@
+package faas;
+import com.google.gson.Gson;
+import com.google.gson.JsonObject;
+import util.SessionBlob;
+import util.ShaSecurityProvider;
+
+//import jakarta.ws.rs.core.Response;
+
+
+public class App {
+ public JsonObject handler(JsonObject args) {
+ Gson gson = new Gson();
+ SessionBlob blob = gson.fromJson(args, SessionBlob.class);
+
+ ShaSecurityProvider securityProvider = new ShaSecurityProvider();
+ SessionBlob validatedBlob = securityProvider.validate(blob);
+
+ JsonObject jsonResult = new JsonObject();
+ if (validatedBlob != null)
+ jsonResult.addProperty("Authorization-Status", "Authorized");
+ else
+ jsonResult.addProperty("Authorization-Status", "Unauthorized");
+ return jsonResult;
+ }
+}
+
diff --git a/benchmarks/600.java/benchmark7/java/src/main/java/util/ConstantKeyProvider.java b/benchmarks/600.java/benchmark7/java/src/main/java/util/ConstantKeyProvider.java
new file mode 100644
index 00000000..ed377e1f
--- /dev/null
+++ b/benchmarks/600.java/benchmark7/java/src/main/java/util/ConstantKeyProvider.java
@@ -0,0 +1,21 @@
+package util;
+
+
+/**
+ * Class for testing. Provides a constant key. DO NOT ADOPT THIS FOR ANY REAL
+ * PRODUCTION WORKLOAD!
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public class ConstantKeyProvider implements IKeyProvider {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getKey(SessionBlob blob) {
+ return "thebestsecretkey";
+ }
+
+}
diff --git a/benchmarks/600.java/benchmark7/java/src/main/java/util/IKeyProvider.java b/benchmarks/600.java/benchmark7/java/src/main/java/util/IKeyProvider.java
new file mode 100644
index 00000000..c78e0dd0
--- /dev/null
+++ b/benchmarks/600.java/benchmark7/java/src/main/java/util/IKeyProvider.java
@@ -0,0 +1,23 @@
+
+package util;
+
+/**
+ * Provides keys for the security provider. The key provider must ensure that
+ * keys accross replicated stores are consistent.
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public interface IKeyProvider {
+
+ /**
+ * Returns a key for a session blob. Key must be the same, regardless of the
+ * store instance upon which this call is made.
+ *
+ * @param blob
+ * The blob to secure.
+ * @return The key.
+ */
+ public String getKey(SessionBlob blob);
+
+}
diff --git a/benchmarks/600.java/benchmark7/java/src/main/java/util/ISecurityProvider.java b/benchmarks/600.java/benchmark7/java/src/main/java/util/ISecurityProvider.java
new file mode 100644
index 00000000..8d710001
--- /dev/null
+++ b/benchmarks/600.java/benchmark7/java/src/main/java/util/ISecurityProvider.java
@@ -0,0 +1,39 @@
+package util;
+
+
+/**
+ * Utilities for securing (e.g. encrypting) session blobs.
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public interface ISecurityProvider {
+
+ /**
+ * Get the key provider for this security provider.
+ *
+ * @return The key provider.
+ */
+ public IKeyProvider getKeyProvider();
+
+ /**
+ * Secures a session blob. May encrypt or hash values within the blob.
+ *
+ * @param blob
+ * The blob to secure.
+ * @return A secure blob to be passed on to the web ui.
+ */
+ public SessionBlob secure(SessionBlob blob);
+
+ /**
+ * Validates a secured session blob. Returns a valid and readable (e.g.
+ * decrypted) blob. Returns null for invalid blobs.
+ *
+ * @param blob
+ * The blob to secure.
+ * @return The valid and readable (e.g. decrypted) blob. Returns null for
+ * invalid blobs.
+ */
+ public SessionBlob validate(SessionBlob blob);
+
+}
diff --git a/benchmarks/600.java/benchmark7/java/src/main/java/util/Order.java b/benchmarks/600.java/benchmark7/java/src/main/java/util/Order.java
new file mode 100644
index 00000000..95434605
--- /dev/null
+++ b/benchmarks/600.java/benchmark7/java/src/main/java/util/Order.java
@@ -0,0 +1,281 @@
+
+package util;
+
+/**
+ * Entity for orders.
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public class Order {
+
+ private long id;
+ private long userId;
+ private String time;
+
+ private long totalPriceInCents;
+ private String addressName;
+ private String address1;
+ private String address2;
+
+ private String creditCardCompany;
+ private String creditCardNumber;
+ private String creditCardExpiryDate;
+
+ /**
+ * Create a new and empty order.
+ */
+ public Order() {
+
+ }
+
+ /**
+ * Every entity needs a copy constructor.
+ *
+ * @param order
+ * The order to copy.
+ */
+ public Order(Order order) {
+ setId(order.getId());
+ setUserId(order.getUserId());
+ setTime(order.getTime());
+ setTotalPriceInCents(order.getTotalPriceInCents());
+ setAddressName(order.getAddressName());
+ setAddress1(order.getAddress1());
+ setAddress2(order.getAddress2());
+ setCreditCardCompany(order.getCreditCardCompany());
+ setCreditCardNumber(order.getCreditCardNumber());
+ setCreditCardExpiryDate(order.getCreditCardExpiryDate());
+ }
+
+ /**
+ * Get the id (remember that this ID may be incorrect, especially if a separate id was passed).
+ *
+ * @return The id.
+ */
+ public long getId() {
+ return id;
+ }
+
+ /**
+ * For REST use only. Sets the ID. Ignored by persistence.
+ *
+ * @param id
+ * ID, as passed by the REST API.
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ /**
+ * Get the User id.
+ *
+ * @return the userId.
+ */
+ public long getUserId() {
+ return userId;
+ }
+
+ /**
+ * Set the User Id.
+ *
+ * @param userId
+ * the userId to set.
+ */
+ public void setUserId(long userId) {
+ this.userId = userId;
+ }
+
+ /**
+ * Get the time of order (ISO formatted). Formatted using {@link DateTimeFormatter.ISO_LOCAL_DATE_TIME}.
+ *
+ * @return the time.
+ */
+ public String getTime() {
+ return time;
+ }
+
+ /**
+ * Set the time of order (ISO formatted). Format using {@link DateTimeFormatter.ISO_LOCAL_DATE_TIME}.
+ *
+ * @param time
+ * the time to set.
+ */
+ public void setTime(String time) {
+ this.time = time;
+ }
+
+ /**
+ * Get the total price in cents.
+ *
+ * @return the totalPriceInCents.
+ */
+ public long getTotalPriceInCents() {
+ return totalPriceInCents;
+ }
+
+ /**
+ * Set the total price in cents.
+ *
+ * @param totalPriceInCents
+ * the totalPriceInCents to set.
+ */
+ public void setTotalPriceInCents(long totalPriceInCents) {
+ this.totalPriceInCents = totalPriceInCents;
+ }
+
+ /**
+ * Get the name for the address.
+ *
+ * @return the addressName.
+ */
+ public String getAddressName() {
+ return addressName;
+ }
+
+ /**
+ * Set the name for the address.
+ *
+ * @param addressName
+ * the addressName to set.
+ */
+ public void setAddressName(String addressName) {
+ this.addressName = addressName;
+ }
+
+ /**
+ * Get address line 1.
+ *
+ * @return the address1.
+ */
+ public String getAddress1() {
+ return address1;
+ }
+
+ /**
+ * Set address line 1.
+ *
+ * @param address1
+ * the address1 to set.
+ */
+ public void setAddress1(String address1) {
+ this.address1 = address1;
+ }
+
+ /**
+ * Get address line 2.
+ *
+ * @return the address2.
+ */
+ public String getAddress2() {
+ return address2;
+ }
+
+ /**
+ * Set address line 2.
+ *
+ * @param address2
+ * the address2 to set.
+ */
+ public void setAddress2(String address2) {
+ this.address2 = address2;
+ }
+
+ /**
+ * Get the name of the credit card company.
+ *
+ * @return the creditCardCompany.
+ */
+ public String getCreditCardCompany() {
+ return creditCardCompany;
+ }
+
+ /**
+ * Set the name of the credit card company.
+ *
+ * @param creditCardCompany
+ * the creditCardCompany to set.
+ */
+ public void setCreditCardCompany(String creditCardCompany) {
+ this.creditCardCompany = creditCardCompany;
+ }
+
+ /**
+ * Get the credit card number.
+ *
+ * @return the creditCardNumber.
+ */
+ public String getCreditCardNumber() {
+ return creditCardNumber;
+ }
+
+ /**
+ * Set the credit card number.
+ *
+ * @param creditCardNumber
+ * the creditCardNumber to set.
+ */
+ public void setCreditCardNumber(String creditCardNumber) {
+ this.creditCardNumber = creditCardNumber;
+ }
+
+ /**
+ * Get the credit card expiry date (ISO formatted). Formatted using {@link DateTimeFormatter.ISO_LOCAL_DATE}.
+ *
+ * @return the creditCardExpiryDate.
+ */
+ public String getCreditCardExpiryDate() {
+ return creditCardExpiryDate;
+ }
+
+ /**
+ * Set the credit card expiry date (ISO formatted). Format using {@link DateTimeFormatter.ISO_LOCAL_DATE}.
+ *
+ * @param creditCardExpiryDate
+ * the creditCardExpiryDate to set.
+ */
+ public void setCreditCardExpiryDate(String creditCardExpiryDate) {
+ this.creditCardExpiryDate = creditCardExpiryDate;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (id ^ (id >>> 32));
+ result = prime * result + (int) (userId ^ (userId >>> 32));
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Order other = (Order) obj;
+ if (id != other.id) {
+ return false;
+ }
+ if (userId != other.userId) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/benchmarks/600.java/benchmark7/java/src/main/java/util/OrderItem.java b/benchmarks/600.java/benchmark7/java/src/main/java/util/OrderItem.java
new file mode 100644
index 00000000..f0c01fe9
--- /dev/null
+++ b/benchmarks/600.java/benchmark7/java/src/main/java/util/OrderItem.java
@@ -0,0 +1,179 @@
+
+package util;
+
+/**
+ * Entity Class for OrderItems (item with quantity in shopping cart or order).
+ *
+ * @author Joakim von Kistowski
+ *
+ */
+public class OrderItem {
+
+ private long id;
+ private long productId;
+ private long orderId;
+ private int quantity;
+ private long unitPriceInCents;
+
+ /**
+ * Create a new and empty OrderItem.
+ */
+ public OrderItem() {
+
+ }
+
+ /**
+ * Every Entity needs a Copy-Constructor!
+ *
+ * @param orderItem
+ * The entity to Copy.
+ */
+ public OrderItem(OrderItem orderItem) {
+ setId(orderItem.getId());
+ setProductId(orderItem.getProductId());
+ setOrderId(orderItem.getOrderId());
+ setQuantity(orderItem.getQuantity());
+ setUnitPriceInCents(orderItem.getUnitPriceInCents());
+ }
+
+ /**
+ * Get the id (remember that this ID may be incorrect, especially if a separate id was passed).
+ *
+ * @return The id.
+ */
+ public long getId() {
+ return id;
+ }
+
+ /**
+ * For REST use only. Sets the ID. Ignored by persistence.
+ *
+ * @param id
+ * ID, as passed by the REST API.
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ /**
+ * ID of the order item's product.
+ *
+ * @return Product Id;
+ */
+ public long getProductId() {
+ return productId;
+ }
+
+ /**
+ * Sets the ID of the order item's product. Every order Item MUST have a valid product ID.
+ *
+ * @param productId
+ * The product ID to set.
+ */
+ public void setProductId(long productId) {
+ this.productId = productId;
+ }
+
+ /**
+ * Get the quantity (amount in shopping cart/order).
+ *
+ * @return The quantity.
+ */
+ public int getQuantity() {
+ return quantity;
+ }
+
+ /**
+ * Set the quantity (amount in shopping cart/order).
+ *
+ * @param quantity
+ * The quantity.
+ */
+ public void setQuantity(int quantity) {
+ this.quantity = quantity;
+ }
+
+ /**
+ * The price per single item in the order item.
+ *
+ * @return Price per single item.
+ */
+ public long getUnitPriceInCents() {
+ return unitPriceInCents;
+ }
+
+ /**
+ * Set the price per single item in the order item.
+ *
+ * @param unitPriceInCents
+ * Price per single item.
+ */
+ public void setUnitPriceInCents(long unitPriceInCents) {
+ this.unitPriceInCents = unitPriceInCents;
+ }
+
+ /**
+ * Gets the ID of the order item's order.
+ *
+ * @return The order ID.
+ */
+ public long getOrderId() {
+ return orderId;
+ }
+
+ /**
+ * Sets the ID of the order item's order. Persistence requires that every order item MUST have a valid order ID. For
+ * persistence the order must already exist in database.
+ *
+ * @param orderId
+ * The order ID to set.
+ */
+ public void setOrderId(long orderId) {
+ this.orderId = orderId;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (id ^ (id >>> 32));
+ result = prime * result + (int) (orderId ^ (orderId >>> 32));
+ result = prime * result + (int) (productId ^ (productId >>> 32));
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ OrderItem other = (OrderItem) obj;
+ if (id != other.id) {
+ return false;
+ }
+ if (orderId != other.orderId) {
+ return false;
+ }
+ if (productId != other.productId) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/benchmarks/600.java/benchmark7/java/src/main/java/util/SessionBlob.java b/benchmarks/600.java/benchmark7/java/src/main/java/util/SessionBlob.java
new file mode 100644
index 00000000..6875efa4
--- /dev/null
+++ b/benchmarks/600.java/benchmark7/java/src/main/java/util/SessionBlob.java
@@ -0,0 +1,133 @@
+package util;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Blob containing all information about the user session.
+ * @author Simon
+ */
+public class SessionBlob {
+
+ private Long uid;
+ private String sid;
+ private String token;
+ private Order order;
+ private List orderItems = new LinkedList();
+ private String message;
+
+ /**
+ * Constructor, creates an empty order.
+ */
+ public SessionBlob() {
+ this.setOrder(new Order());
+ }
+
+ /**
+ * Getter for the userid.
+ * @return userid
+ */
+ public Long getUID() {
+ return uid;
+ }
+
+ /**
+ * Setter for the userid.
+ * @param uID userid
+ */
+ public void setUID(Long uID) {
+ uid = uID;
+ }
+
+ /**
+ * Getter for session id.
+ * @return session id
+ */
+ public String getSID() {
+ return sid;
+ }
+
+ /**
+ * Setter for session id.
+ * @param sID session id
+ */
+ public void setSID(String sID) {
+ sid = sID;
+ }
+
+ /**
+ * Getter for trust token.
+ * @return trust token
+ */
+ public String getToken() {
+ return token;
+ }
+
+ /**
+ * Setter for trust token.
+ * @param token trust token.
+ */
+ public void setToken(String token) {
+ this.token = token;
+ }
+
+ /**
+ * Setter for the message.
+ * @param message String
+ */
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ /**
+ * Getter for the message.
+ * @return message
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * Getter for order.
+ * @return order
+ */
+ public Order getOrder() {
+ return order;
+ }
+
+ /**
+ * Setter for order.
+ * @param order order
+ */
+ public void setOrder(Order order) {
+ this.order = order;
+ }
+
+ /**
+ * Getter for order items.
+ * @return order items.
+ */
+ public List getOrderItems() {
+ return orderItems;
+ }
+
+ /**
+ * Setter for order items.
+ * @param orderItems list of order items
+ */
+ public void setOrderItems(List orderItems) {
+ this.orderItems = orderItems;
+ }
+
+ @Override
+ public String toString() {
+ return "ClassName{" +
+ "uid=" + uid +
+ ", sid='" + sid + '\'' +
+ ", token='" + token + '\'' +
+ ", order=" + (order != null ? order.toString() : "null") +
+ ", orderItems=" + (orderItems != null ? orderItems.toString() : "null") +
+ ", message='" + message + '\'' +
+ '}';
+ }
+}
diff --git a/benchmarks/600.java/benchmark7/java/src/main/java/util/ShaSecurityProvider.java b/benchmarks/600.java/benchmark7/java/src/main/java/util/ShaSecurityProvider.java
new file mode 100644
index 00000000..d9c88f90
--- /dev/null
+++ b/benchmarks/600.java/benchmark7/java/src/main/java/util/ShaSecurityProvider.java
@@ -0,0 +1,79 @@
+package util;
+
+import java.io.UnsupportedEncodingException;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import java.net.URLEncoder;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * Secruity provider uscom.fasterxml.jackson.databind.Objecting AES.
+ *
+ * @author Simon
+ *
+ */
+public class ShaSecurityProvider implements ISecurityProvider {
+
+ @Override
+ public IKeyProvider getKeyProvider() {
+ return new ConstantKeyProvider();
+ }
+
+ @Override
+ public SessionBlob secure(SessionBlob blob) {
+ if (blob.getUID() == null || blob.getSID() == null) {
+ return blob;
+ }
+ blob.setToken(null);
+ String blobString = blobToString(blob);
+ blob.setToken(getSha512(blobString));
+ return blob;
+ }
+
+ private String blobToString(SessionBlob blob) {
+ ObjectMapper o = new ObjectMapper();
+ try {
+ return URLEncoder.encode(o.writeValueAsString(blob), "UTF-8");
+ } catch (JsonProcessingException | UnsupportedEncodingException e)
+ {
+ throw new IllegalStateException("Could not save blob!");
+ }
+ }
+
+ @Override
+ public SessionBlob validate(SessionBlob blob) {
+ if (blob.getToken() == null) {
+ return null;
+ }
+
+ String token = blob.getToken();
+ blob.setToken(null);
+ String blobString = blobToString(blob);
+ String validationToken = getSha512(blobString);
+ if (validationToken.equals(token)) {
+ return blob;
+ }
+ return null;
+ }
+
+ private String getSha512(String passwordToHash) {
+ String generatedPassword = null;
+ try {
+ String salt = getKeyProvider().getKey(null);
+ MessageDigest md = MessageDigest.getInstance("SHA-512");
+ md.update(salt.getBytes("UTF-8"));
+ byte[] bytes = md.digest(passwordToHash.getBytes("UTF-8"));
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < bytes.length; i++) {
+ sb.append(Integer.toString((bytes[i] & 0xff) + 0x100, 16).substring(1));
+ }
+ generatedPassword = sb.toString();
+ } catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ return generatedPassword;
+ }
+}
diff --git a/benchmarks/wrappers/openwhisk/java/Main.java b/benchmarks/wrappers/openwhisk/java/Main.java
index 828aa64f..e10d9e11 100644
--- a/benchmarks/wrappers/openwhisk/java/Main.java
+++ b/benchmarks/wrappers/openwhisk/java/Main.java
@@ -1,9 +1,13 @@
+import faas.App;
+import com.google.gson.Gson;
import com.google.gson.JsonObject;
-import com.example.project.App ;
+import util.SessionBlob;
+import util.ShaSecurityProvider;
import java.time.Instant;
import java.time.Duration;
import java.io.File;
import java.io.IOException;
+//import jakarta.ws.rs.core.Response;
public class Main {
@@ -15,12 +19,17 @@ public static JsonObject main(JsonObject args) {
Gson gson = new Gson();
App function = new App();
+ long start_nano = System.nanoTime();
+
Instant begin = Instant.now();
JsonObject result = function.handler(args);
Instant end = Instant.now();
- long computeTime = Duration.between(begin, end).toNanos() / 1000; // Convert nanoseconds to microseconds
+ long end_nano = System.nanoTime();
+
+ // long computeTime = Duration.between(begin, end).toNanos() / 1000; // Convert nanoseconds to microseconds
+ long computeTime = end_nano - start_nano;
boolean isCold = false;
String fileName = "/cold_run";
@@ -41,15 +50,13 @@ public static JsonObject main(JsonObject args) {
String requestId = System.getenv("__OW_ACTIVATION_ID");
JsonObject jsonResult = new JsonObject();
- jsonObject.put("begin", formattedBegin);
- jsonObject.put("end", formattedEnd);
- jsonObject.put("request_id", "requestId");
- jsonObject.put("compute_time", computeTime);
- jsonObject.put("is_cold", isCold);
- jsonObject.put("result", result);
+ jsonResult.addProperty("begin", formattedBegin);
+ jsonResult.addProperty("end", formattedEnd);
+ jsonResult.addProperty("request_id", requestId);
+ jsonResult.addProperty("compute_time", computeTime);
+ jsonResult.addProperty("is_cold", isCold);
+ jsonResult.addProperty("result", result.toString());
return jsonResult;
}
-}
-
-
\ No newline at end of file
+}
diff --git a/config/example2.json b/config/example-train.json
similarity index 81%
rename from config/example2.json
rename to config/example-train.json
index 3575d601..b0c46ed9 100644
--- a/config/example2.json
+++ b/config/example-train.json
@@ -10,7 +10,7 @@
},
"type": "invocation-overhead",
"perf-cost": {
- "benchmark": "601.hello-world",
+ "benchmark": "603.train-recommender",
"experiments": ["cold", "warm", "burst", "sequential"],
"input-size": "test",
"repetitions": 50,
@@ -53,16 +53,15 @@
"password": ""
},
"storage": {
- "address": "",
+ "address": "172.20.10.3:9011",
"mapped_port": 9011,
- "access_key": "",
- "secret_key": "",
- "instance_id": "",
+ "access_key": "4K_4r6_i10-WCXctJT7cjSVvr02yzHebpQHdHs96NcM",
+ "secret_key": "7f870971968d1cb7356876993fe61e4edc5977e3825b9617e796e8a333af0ad2",
+ "instance_id": "976374b8ec72f70dc1ac9d414d639f03bb86e1db77eb54291450c9b5ea5df689",
"output_buckets": [],
"input_buckets": [],
"type": "minio"
- }
-
+ }
}
}
}
diff --git a/config/example.json b/config/example.json
index dc4da9ad..3e0ed74a 100644
--- a/config/example.json
+++ b/config/example.json
@@ -5,67 +5,11 @@
"update_storage": false,
"download_results": false,
"runtime": {
- "language": "python",
- "version": "3.7"
- },
- "type": "invocation-overhead",
- "perf-cost": {
- "benchmark": "110.dynamic-html",
- "experiments": ["cold", "warm", "burst", "sequential"],
- "input-size": "test",
- "repetitions": 50,
- "concurrent-invocations": 50,
- "memory-sizes": [128, 256]
- },
- "network-ping-pong": {
- "invocations": 50,
- "repetitions": 1000,
- "threads": 1
- },
- "invocation-overhead": {
- "repetitions": 5,
- "N": 20,
- "type": "payload",
- "payload_begin": 1024,
- "payload_end": 6251000,
- "payload_points": 20,
- "code_begin": 1048576,
- "code_end": 261619712,
- "code_points": 20
- },
- "eviction-model": {
- "invocations": 1,
- "function_copy_idx": 0,
- "repetitions": 5,
- "sleep": 1
+ "language": "java",
+ "version": "8"
}
},
"deployment": {
- "name": "aws",
- "aws": {
- "region": "us-east-1",
- "lambda-role": ""
- },
- "azure": {
- "region": "westeurope"
- },
- "gcp": {
- "region": "europe-west1",
- "project_name": "",
- "credentials": ""
- },
- "local": {
- "storage": {
- "address": "",
- "mapped_port": -1,
- "access_key": "",
- "secret_key": "",
- "instance_id": "",
- "input_buckets": [],
- "output_buckets": [],
- "type": "minio"
- }
- },
"openwhisk": {
"shutdownStorage": false,
"removeCluster": false,
@@ -78,13 +22,13 @@
"password": ""
},
"storage": {
- "address": "",
- "mapped_port": -1,
- "access_key": "",
- "secret_key": "",
- "instance_id": "",
- "input_buckets": [],
+ "address": "172.20.10.3:9011",
+ "mapped_port": 9011,
+ "access_key": "yun7vF4uN_Qiay_H2O-7rnOKBYCQxuKCMqudDufjIJg",
+ "secret_key": "0f5ff6e9ee49adf19879cd6b7e351610eecb5d3d15a0056469b7707618630942",
+ "instance_id": "a5d66a9d5cb9e2348bdf399a4cdc77ea33400cf91b41a9c57114bfa9525e52ab",
"output_buckets": [],
+ "input_buckets": [],
"type": "minio"
}
}
diff --git a/config/login-checker-config.json b/config/login-checker-config.json
new file mode 100644
index 00000000..e2a902f0
--- /dev/null
+++ b/config/login-checker-config.json
@@ -0,0 +1,38 @@
+{
+ "experiments": {
+ "deployment": "openwhisk",
+ "update_code": false,
+ "update_storage": false,
+ "download_results": "true",
+ "runtime": {
+ "language": "java",
+ "version": "8"
+ }
+ },
+
+ "deployment": {
+ "openwhisk": {
+ "shutdownStorage": false,
+ "removeCluster": false,
+ "wskBypassSecurity": "true",
+ "wskExec": "wsk",
+ "experimentalManifest": false,
+ "docker_registry": {
+ "registry": "",
+ "username": "",
+ "password": ""
+ },
+ "storage": {
+ "address": "172.20.10.3:9011",
+ "mapped_port": 9011,
+ "access_key": "yun7vF4uN_Qiay_H2O-7rnOKBYCQxuKCMqudDufjIJg",
+ "secret_key": "0f5ff6e9ee49adf19879cd6b7e351610eecb5d3d15a0056469b7707618630942",
+ "instance_id": "a5d66a9d5cb9e2348bdf399a4cdc77ea33400cf91b41a9c57114bfa9525e52ab",
+ "output_buckets": [],
+ "input_buckets": [],
+ "type": "minio"
+ }
+ }
+ }
+ }
+
\ No newline at end of file
diff --git a/config/systems.json b/config/systems.json
index 757ad388..30c6a7cc 100644
--- a/config/systems.json
+++ b/config/systems.json
@@ -1,6 +1,6 @@
{
"general": {
- "docker_repository": "spcleth/serverless-benchmarks"
+ "docker_repository": "duckerhubformahla/serverless_benchmarks"
},
"local": {
"experiments": {
diff --git a/dockerfiles/openwhisk/java/Dockerfile.function b/dockerfiles/openwhisk/java/Dockerfile.function
index d86cd461..b72ceb15 100644
--- a/dockerfiles/openwhisk/java/Dockerfile.function
+++ b/dockerfiles/openwhisk/java/Dockerfile.function
@@ -2,7 +2,7 @@ ARG BASE_IMAGE
FROM $BASE_IMAGE
COPY . /function/
-RUN apt-get update && apt-get install -y maven
+# RUN apt-get update && apt-get install -y maven
-# Check if pom.xml exists before running Maven
-RUN if [ -f ./pom.xml ]; then mvn clean install; else echo "pom.xml not found, aborting build." && exit 1; fi
+# # Check if pom.xml exists before running Maven
+# RUN if [ -f ./pom.xml ]; then mvn clean install; else echo "pom.xml not found, aborting build." && exit 1; fi
diff --git a/out_storage.json b/out_storage.json
new file mode 100644
index 00000000..1efc2e05
--- /dev/null
+++ b/out_storage.json
@@ -0,0 +1,10 @@
+{
+ "address": "172.20.10.3:9011",
+ "mapped_port": 9011,
+ "access_key": "yun7vF4uN_Qiay_H2O-7rnOKBYCQxuKCMqudDufjIJg",
+ "secret_key": "0f5ff6e9ee49adf19879cd6b7e351610eecb5d3d15a0056469b7707618630942",
+ "instance_id": "a5d66a9d5cb9e2348bdf399a4cdc77ea33400cf91b41a9c57114bfa9525e52ab",
+ "output_buckets": [],
+ "input_buckets": [],
+ "type": "minio"
+}
\ No newline at end of file
diff --git a/sebs/benchmark.py b/sebs/benchmark.py
index 771fde7f..e18c8d4d 100644
--- a/sebs/benchmark.py
+++ b/sebs/benchmark.py
@@ -1,6 +1,7 @@
import glob
import hashlib
import json
+import subprocess
import os
import shutil
import subprocess
@@ -200,8 +201,9 @@ def hash_directory(directory: str, deployment: str, language: str):
FILES = {
"python": ["*.py", "requirements.txt*"],
"nodejs": ["*.js", "package.json"],
+ "java": ["*.java", "pom.xml"],
}
- WRAPPERS = {"python": "*.py", "nodejs": "*.js"}
+ WRAPPERS = {"python": "*.py", "nodejs": "*.js", "java": "*.java"}
NON_LANG_FILES = ["*.sh", "*.json"]
selected_files = FILES[language] + NON_LANG_FILES
for file_type in selected_files:
@@ -273,6 +275,28 @@ def copy_code(self, output_dir):
if os.path.exists(nodejs_package_json):
shutil.copy2(nodejs_package_json, os.path.join(output_dir, "package.json"))
+ #This is for making jar file and add it to docker directory
+ def add_java_output(self, code_dir):
+
+ if self.language_name == "java":
+
+ # Step 1: Move Main.java o src directory
+ src_dir = os.path.join(code_dir, "src", "main", "java")
+ if os.path.exists(code_dir):
+ main_java_path = os.path.join(code_dir, "Main.java")
+ if os.path.exists(main_java_path):
+ shutil.move(main_java_path, src_dir)
+
+ # Step 2: Run mvn clean install
+ try:
+ # Navigate to the code directory where the pom.xml file is located
+ subprocess.run(['mvn', 'clean', 'install'], cwd=code_dir, check=True, text=True, capture_output=True)
+ print("Maven build successful!")
+ except subprocess.CalledProcessError as e:
+ print(f"Error during Maven build:\n{e.stdout}\n{e.stderr}")
+ return
+
+
def add_benchmark_data(self, output_dir):
cmd = "/bin/bash {benchmark_path}/init.sh {output_dir} false"
paths = [
@@ -522,6 +546,7 @@ def build(
self.copy_code(self._output_dir)
self.add_benchmark_data(self._output_dir)
self.add_deployment_files(self._output_dir)
+ self.add_java_output(self._output_dir)
self.add_deployment_package(self._output_dir)
self.install_dependencies(self._output_dir)
self._code_location, self._code_size = deployment_build_step(
diff --git a/sebs/openwhisk/openwhisk.py b/sebs/openwhisk/openwhisk.py
index 01684ed3..a83b5b8d 100644
--- a/sebs/openwhisk/openwhisk.py
+++ b/sebs/openwhisk/openwhisk.py
@@ -168,7 +168,7 @@ def build_base_image(
)
for fn in os.listdir(directory):
- if fn not in ("index.js", "__main__.py", "Main.java"):
+ if fn not in ("index.js", "__main__.py"):
file = os.path.join(directory, fn)
shutil.move(file, build_dir)
@@ -214,24 +214,27 @@ def package_code(
# to allow registration of function with OpenWhisk
self.build_base_image(directory, language_name, language_version, benchmark, is_cached)
- # We deploy Minio config in code package since this depends on local
- # deployment - it cannnot be a part of Docker image
- CONFIG_FILES = {
- "python": ["__main__.py"],
- "nodejs": ["index.js"],
- "java": ["Main.java"],
- }
- package_config = CONFIG_FILES[language_name]
-
- benchmark_archive = os.path.join(directory, f"{benchmark}.zip")
- subprocess.run(
- ["zip", benchmark_archive] + package_config, stdout=subprocess.DEVNULL, cwd=directory
- )
- self.logging.info(f"Created {benchmark_archive} archive")
- bytes_size = os.path.getsize(benchmark_archive)
- self.logging.info("Zip archive size {:2f} MB".format(bytes_size / 1024.0 / 1024.0))
- return benchmark_archive, bytes_size
+ if language_name != 'java':
+ # We deploy Minio config in code package since this depends on local
+ # deployment - it cannnot be a part of Docker image
+ CONFIG_FILES = {
+ "python": ["__main__.py"],
+ "nodejs": ["index.js"],
+ }
+ package_config = CONFIG_FILES[language_name]
+ benchmark_archive = os.path.join(directory, f"{benchmark}.zip")
+ subprocess.run(
+ ["zip", benchmark_archive] + package_config, stdout=subprocess.DEVNULL, cwd=directory
+ )
+ self.logging.info(f"Created {benchmark_archive} archive")
+ bytes_size = os.path.getsize(benchmark_archive)
+ self.logging.info("Zip archive size {:2f} MB".format(bytes_size / 1024.0 / 1024.0))
+ return benchmark_archive, bytes_size
+ benchmark_jar = os.path.join(directory, "docker", "target", "benchmark-1.jar")
+ bytes_size = os.path.getsize(benchmark_jar)
+
+ return benchmark_jar, bytes_size
def storage_arguments(self) -> List[str]:
storage = cast(Minio, self.get_storage())
return [
@@ -281,27 +284,53 @@ def create_function(self, code_package: Benchmark, func_name: str) -> "OpenWhisk
code_package.language_name,
code_package.language_version,
)
- subprocess.run(
- [
- *self.get_wsk_cmd(),
- "action",
- "create",
- func_name,
- "--web",
- "true",
- "--docker",
- docker_image,
- "--memory",
- str(code_package.benchmark_config.memory),
- "--timeout",
- str(code_package.benchmark_config.timeout * 1000),
- *self.storage_arguments(),
- code_package.code_location,
- ],
- stderr=subprocess.PIPE,
- stdout=subprocess.PIPE,
- check=True,
- )
+ if code_package.language_name == 'java':
+ subprocess.run(
+ [
+ *self.get_wsk_cmd(),
+ "action",
+ "create",
+ func_name,
+ "--web",
+ "true",
+ "--docker",
+ docker_image,
+ "--memory",
+ str(code_package.benchmark_config.memory),
+ "--timeout",
+ str(code_package.benchmark_config.timeout * 1000),
+ *self.storage_arguments(),
+ code_package.code_location,
+ "--main",
+ "Main"
+ ],
+ stderr=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ check=True,
+ )
+
+ else:
+ subprocess.run(
+ [
+ *self.get_wsk_cmd(),
+ "action",
+ "create",
+ func_name,
+ "--web",
+ "true",
+ "--docker",
+ docker_image,
+ "--memory",
+ str(code_package.benchmark_config.memory),
+ "--timeout",
+ str(code_package.benchmark_config.timeout * 1000),
+ *self.storage_arguments(),
+ code_package.code_location,
+ ],
+ stderr=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ check=True,
+ )
function_cfg.docker_image = docker_image
res = OpenWhiskFunction(
func_name, code_package.benchmark, code_package.hash, function_cfg