This is an automated email from the ASF dual-hosted git repository. kbowers pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/incubator-kie-kogito-benchmarks.git
commit 7b07faef699fd9b7bd25599423e307809a779a32 Author: Marián Macik <[email protected]> AuthorDate: Thu May 6 19:06:38 2021 +0200 Enhancements #2 --- .../org/kie/kogito/benchmarks/framework/App.java | 22 ++++--- .../benchmarks/framework/HTTPRequestInfo.java | 65 ++++++++++++++++++++ .../kie/kogito/benchmarks/framework/MvnCmds.java | 12 ++-- .../kogito/benchmarks/framework/URLContent.java | 25 +------- .../benchmarks/framework/WhitelistLogLines.java | 2 +- .../smarthouse-02-quarkus/threshold.properties | 6 ++ .../smarthouse-02-springboot/threshold.properties | 6 ++ .../smarthouse-03-quarkus/threshold.properties | 6 ++ .../smarthouse-03-springboot/threshold.properties | 6 ++ .../kogito/benchmarks/AbstractTemplateTest.java | 54 +++++++++++------ .../kie/kogito/benchmarks/QuarkusLargeTest.java | 69 ---------------------- .../kie/kogito/benchmarks/QuarkusSmallTest.java | 2 +- .../kogito/benchmarks/SmartHouse02QuarkusTest.java | 35 +++++++++++ .../benchmarks/SmartHouse02SpringBootTest.java | 33 +++++++++++ .../kogito/benchmarks/SmartHouse03QuarkusTest.java | 33 +++++++++++ .../benchmarks/SmartHouse03SpringBootTest.java | 33 +++++++++++ .../org/kie/kogito/benchmarks/StartStopTest.java | 2 +- 17 files changed, 284 insertions(+), 127 deletions(-) diff --git a/framework/src/main/java/org/kie/kogito/benchmarks/framework/App.java b/framework/src/main/java/org/kie/kogito/benchmarks/framework/App.java index 34468a1..e6fe0b8 100644 --- a/framework/src/main/java/org/kie/kogito/benchmarks/framework/App.java +++ b/framework/src/main/java/org/kie/kogito/benchmarks/framework/App.java @@ -1,11 +1,12 @@ package org.kie.kogito.benchmarks.framework; import java.io.File; -import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; +import java.net.URL; import java.util.HashMap; import java.util.Map; +import java.util.Optional; import java.util.Properties; import org.apache.commons.lang3.StringUtils; @@ -13,11 +14,11 @@ import org.apache.commons.lang3.StringUtils; import static org.kie.kogito.benchmarks.framework.Commands.APPS_DIR; public enum App { - SAMPLE_KOGITO_APP_QUARKUS_JVM("sample-kogito-app", MvnCmds.QUARKUS_JVM, URLContent.SAMPLE_KOGITO_APP, WhitelistLogLines.SAMPLE_KOGITO_APP), - SAMPLE_KOGITO_APP_SPRING_BOOT("sample-kogito-app", MvnCmds.SPRING_BOOT_JVM, URLContent.SAMPLE_KOGITO_APP, WhitelistLogLines.SAMPLE_KOGITO_APP); - // JAX_RS_MINIMAL("app-jax-rs-minimal", URLContent.JAX_RS_MINIMAL, WhitelistLogLines.JAX_RS_MINIMAL), - // FULL_MICROPROFILE("app-full-microprofile", URLContent.FULL_MICROPROFILE, WhitelistLogLines.FULL_MICROPROFILE), - // GENERATED_SKELETON("app-generated-skeleton", URLContent.GENERATED_SKELETON, WhitelistLogLines.GENERATED_SKELETON); + SMARTHOUSE_02_QUARKUS_JVM("smarthouse-02-quarkus", MvnCmds.QUARKUS_JVM, URLContent.SMARTHOUSE_02, WhitelistLogLines.EVERYTHING), + SMARTHOUSE_03_QUARKUS_JVM("smarthouse-03-quarkus", MvnCmds.QUARKUS_JVM, URLContent.SMARTHOUSE_03, WhitelistLogLines.EVERYTHING), + + SMARTHOUSE_02_SPRING_BOOT("smarthouse-02-springboot", MvnCmds.SPRING_BOOT_02_JVM, URLContent.SMARTHOUSE_02, WhitelistLogLines.EVERYTHING), + SMARTHOUSE_03_SPRING_BOOT("smarthouse-03-springboot", MvnCmds.SPRING_BOOT_03_JVM, URLContent.SMARTHOUSE_03, WhitelistLogLines.EVERYTHING); public final String dir; public final MvnCmds mavenCommands; @@ -30,9 +31,12 @@ public enum App { this.mavenCommands = mavenCommands; this.urlContent = urlContent; this.whitelistLogLines = whitelistLogLines; - File tpFile = new File(APPS_DIR + File.separator + dir + File.separator + "threshold.properties"); + + String tpFilePath = "/" + dir + "/threshold.properties"; + URL tpFile = Optional.ofNullable(App.class.getResource(tpFilePath)) + .orElseThrow(() -> new RuntimeException("Couldn't find " + tpFilePath)); String appDirNormalized = dir.toUpperCase().replace('-', '_') + "_"; - try (InputStream input = new FileInputStream(tpFile)) { + try (InputStream input = tpFile.openStream()) { Properties props = new Properties(); props.load(input); for (String pn : props.stringPropertyNames()) { @@ -51,7 +55,7 @@ public enum App { throw new IllegalArgumentException("Check threshold.properties and Sys and Env variables (upper case, underscores instead of dots). " + "All values are expected to be of type long."); } catch (IOException e) { - throw new RuntimeException("Couldn't find " + tpFile.getAbsolutePath()); + throw new RuntimeException("Couldn't read " + tpFilePath); } } diff --git a/framework/src/main/java/org/kie/kogito/benchmarks/framework/HTTPRequestInfo.java b/framework/src/main/java/org/kie/kogito/benchmarks/framework/HTTPRequestInfo.java index 74d0ecc..98ac827 100644 --- a/framework/src/main/java/org/kie/kogito/benchmarks/framework/HTTPRequestInfo.java +++ b/framework/src/main/java/org/kie/kogito/benchmarks/framework/HTTPRequestInfo.java @@ -90,4 +90,69 @@ public class HTTPRequestInfo { } + public static class Body { + public static final String HEATING_02 = "{\n" + + " \"Sensors Temperature\": [\n" + + " {\n" + + " \"placement\": \"OUTSIDE\",\n" + + " \"current\": 25,\n" + + " \"previous\": [\n" + + " 24,\n" + + " 23,\n" + + " 19,\n" + + " 16,\n" + + " 15,\n" + + " 11\n" + + " ]\n" + + " },\n" + + " {\n" + + " \"placement\": \"INSIDE\",\n" + + " \"current\": 24.9,\n" + + " \"previous\": [\n" + + " 25,\n" + + " 28,\n" + + " 28,\n" + + " 28,\n" + + " 28,\n" + + " 28\n" + + " ]\n" + + " }\n" + + " ],\n" + + " \"Settings Temperature\": {\n" + + " \"threshold_low\": 21,\n" + + " \"threshold_high\": 24\n" + + " },\n" + + " \"Settings Humidity\": {\n" + + " \"threshold_low\": 0,\n" + + " \"threshold_high\": 0\n" + + " },\n" + + " \"Sensors Humidity\": [\n" + + " {\n" + + " \"placement\": \"OUTSIDE\",\n" + + " \"current\": 0,\n" + + " \"previous\": [\n" + + " 0,\n" + + " 0,\n" + + " 0,\n" + + " 0,\n" + + " 0,\n" + + " 0\n" + + " ]\n" + + " },\n" + + " {\n" + + " \"placement\": \"INSIDE\",\n" + + " \"current\": 0,\n" + + " \"previous\": [\n" + + " 0,\n" + + " 0,\n" + + " 0,\n" + + " 0,\n" + + " 0,\n" + + " 0\n" + + " ]\n" + + " }\n" + + " ]\n" + + "}"; + } + } diff --git a/framework/src/main/java/org/kie/kogito/benchmarks/framework/MvnCmds.java b/framework/src/main/java/org/kie/kogito/benchmarks/framework/MvnCmds.java index e4bbeb4..ca11c75 100644 --- a/framework/src/main/java/org/kie/kogito/benchmarks/framework/MvnCmds.java +++ b/framework/src/main/java/org/kie/kogito/benchmarks/framework/MvnCmds.java @@ -7,12 +7,16 @@ import static org.kie.kogito.benchmarks.framework.Commands.getQuarkusNativePrope public enum MvnCmds { QUARKUS_JVM(new String[][] { - new String[] { "mvn", "clean", "package", /* "quarkus:build", */"-Dquarkus.package.output-name=quarkus" }, + new String[] { "mvn", "clean", "package", "-Dquarkus.package.output-name=quarkus" }, new String[] { "java", "-jar", "target/quarkus-runner.jar" } }), - SPRING_BOOT_JVM(new String[][] { - new String[] { "mvn", "clean", "package", /* "quarkus:build", */"-Dquarkus.package.output-name=quarkus" }, - new String[] { "java", "-jar", "target/quarkus-runner.jar" } + SPRING_BOOT_02_JVM(new String[][] { + new String[] { "mvn", "clean", "package" }, // There is no possibility of changing the final name of the artifact + new String[] { "java", "-jar", "target/smarthouse-02-springboot-1.0-SNAPSHOT.jar" } + }), + SPRING_BOOT_03_JVM(new String[][] { + new String[] { "mvn", "clean", "package" }, + new String[] { "java", "-jar", "target/smarthouse-03-springboot-1.0-SNAPSHOT.jar" } }), DEV(new String[][] { new String[] { "mvn", "clean", "quarkus:dev", "-Dmaven.repo.local=" + getLocalMavenRepoDir() } diff --git a/framework/src/main/java/org/kie/kogito/benchmarks/framework/URLContent.java b/framework/src/main/java/org/kie/kogito/benchmarks/framework/URLContent.java index d44dc8e..d81bea4 100644 --- a/framework/src/main/java/org/kie/kogito/benchmarks/framework/URLContent.java +++ b/framework/src/main/java/org/kie/kogito/benchmarks/framework/URLContent.java @@ -1,29 +1,8 @@ package org.kie.kogito.benchmarks.framework; public enum URLContent { - SAMPLE_KOGITO_APP(new String[][] { new String[] { "http://localhost:8080/LoanApplication", "[]" }, - new String[] { "http://localhost:8080/greeting", "1" } }), - JAX_RS_MINIMAL(new String[][] { - new String[] { "http://localhost:8080", "Hello from a simple JAX-RS app." }, - new String[] { "http://localhost:8080/data/hello", "Hello World" } - }), - FULL_MICROPROFILE(new String[][] { - new String[] { "http://localhost:8080", "Hello from a full MicroProfile suite" }, - new String[] { "http://localhost:8080/data/hello", "Hello World" }, - new String[] { "http://localhost:8080/data/config/injected", "Config value as Injected by CDI Injected value" }, - new String[] { "http://localhost:8080/data/config/lookup", "Config value from ConfigProvider lookup value" }, - new String[] { "http://localhost:8080/data/resilience", "Fallback answer due to timeout" }, - new String[] { "http://localhost:8080/health", "\"UP\"" }, - new String[] { "http://localhost:8080/data/metric/timed", "Request is used in statistics, check with the Metrics call." }, - new String[] { "http://localhost:8080/metrics", "ontroller_timed_request_seconds_count" }, - new String[] { "http://localhost:8080/data/secured/test", "Jessie specific value" }, - new String[] { "http://localhost:8080/openapi", "/resilience" }, - new String[] { "http://localhost:8080/data/client/test/parameterValue=xxx", "Processed parameter value 'parameterValue=xxx'" } - }), - GENERATED_SKELETON(new String[][] { - new String[] { "http://localhost:8080", "Congratulations" }, - new String[] { "http://localhost:8080/hello-spring", "Bye Spring" } - }); + SMARTHOUSE_02(new String[][] { new String[] { "http://localhost:8080/heating", "name=\"heating\"" } }), + SMARTHOUSE_03(new String[][] { new String[] { "http://localhost:8080/heating", "name=\"heating\"" } }); public final String[][] urlContent; diff --git a/framework/src/main/java/org/kie/kogito/benchmarks/framework/WhitelistLogLines.java b/framework/src/main/java/org/kie/kogito/benchmarks/framework/WhitelistLogLines.java index 41aa220..d70315c 100644 --- a/framework/src/main/java/org/kie/kogito/benchmarks/framework/WhitelistLogLines.java +++ b/framework/src/main/java/org/kie/kogito/benchmarks/framework/WhitelistLogLines.java @@ -8,7 +8,7 @@ import java.util.regex.Pattern; * @author Michal Karm Babacek <[email protected]> */ public enum WhitelistLogLines { - SAMPLE_KOGITO_APP(new Pattern[] { Pattern.compile(".*") }), + EVERYTHING(new Pattern[] { Pattern.compile(".*") }), JAX_RS_MINIMAL(new Pattern[] { // Some artifacts names... Pattern.compile(".*maven-error-diagnostics.*"), diff --git a/framework/src/main/resources/smarthouse-02-quarkus/threshold.properties b/framework/src/main/resources/smarthouse-02-quarkus/threshold.properties new file mode 100644 index 0000000..36c0c1c --- /dev/null +++ b/framework/src/main/resources/smarthouse-02-quarkus/threshold.properties @@ -0,0 +1,6 @@ +linux.jvm.time.to.first.ok.request.threshold.ms=3400 +linux.jvm.RSS.threshold.kB=380000 +linux.native.time.to.first.ok.request.threshold.ms=35 +linux.native.RSS.threshold.kB=90000 +windows.jvm.time.to.first.ok.request.threshold.ms=2000 +windows.jvm.RSS.threshold.kB=4000 diff --git a/framework/src/main/resources/smarthouse-02-springboot/threshold.properties b/framework/src/main/resources/smarthouse-02-springboot/threshold.properties new file mode 100644 index 0000000..36c0c1c --- /dev/null +++ b/framework/src/main/resources/smarthouse-02-springboot/threshold.properties @@ -0,0 +1,6 @@ +linux.jvm.time.to.first.ok.request.threshold.ms=3400 +linux.jvm.RSS.threshold.kB=380000 +linux.native.time.to.first.ok.request.threshold.ms=35 +linux.native.RSS.threshold.kB=90000 +windows.jvm.time.to.first.ok.request.threshold.ms=2000 +windows.jvm.RSS.threshold.kB=4000 diff --git a/framework/src/main/resources/smarthouse-03-quarkus/threshold.properties b/framework/src/main/resources/smarthouse-03-quarkus/threshold.properties new file mode 100644 index 0000000..36c0c1c --- /dev/null +++ b/framework/src/main/resources/smarthouse-03-quarkus/threshold.properties @@ -0,0 +1,6 @@ +linux.jvm.time.to.first.ok.request.threshold.ms=3400 +linux.jvm.RSS.threshold.kB=380000 +linux.native.time.to.first.ok.request.threshold.ms=35 +linux.native.RSS.threshold.kB=90000 +windows.jvm.time.to.first.ok.request.threshold.ms=2000 +windows.jvm.RSS.threshold.kB=4000 diff --git a/framework/src/main/resources/smarthouse-03-springboot/threshold.properties b/framework/src/main/resources/smarthouse-03-springboot/threshold.properties new file mode 100644 index 0000000..36c0c1c --- /dev/null +++ b/framework/src/main/resources/smarthouse-03-springboot/threshold.properties @@ -0,0 +1,6 @@ +linux.jvm.time.to.first.ok.request.threshold.ms=3400 +linux.jvm.RSS.threshold.kB=380000 +linux.native.time.to.first.ok.request.threshold.ms=35 +linux.native.RSS.threshold.kB=90000 +windows.jvm.time.to.first.ok.request.threshold.ms=2000 +windows.jvm.RSS.threshold.kB=4000 diff --git a/tests/src/test/java/org/kie/kogito/benchmarks/AbstractTemplateTest.java b/tests/src/test/java/org/kie/kogito/benchmarks/AbstractTemplateTest.java index 27260ed..ee1f7c7 100644 --- a/tests/src/test/java/org/kie/kogito/benchmarks/AbstractTemplateTest.java +++ b/tests/src/test/java/org/kie/kogito/benchmarks/AbstractTemplateTest.java @@ -11,13 +11,16 @@ import java.util.List; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; import org.assertj.core.api.Assertions; import org.jboss.logging.Logger; +import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.TestInfo; +import org.junit.jupiter.api.TestMethodOrder; import org.kie.kogito.benchmarks.framework.App; import org.kie.kogito.benchmarks.framework.BuildResult; import org.kie.kogito.benchmarks.framework.HTTPRequestInfo; @@ -173,7 +176,7 @@ public abstract class AbstractTemplateTest { } public void loadTest(TestInfo testInfo, App app, HTTPRequestInfo requestInfo) throws IOException, InterruptedException { - LOGGER.info("Testing app startStop: " + app.toString() + ", mode: " + app.mavenCommands.toString()); + LOGGER.info("Testing app loadTest: " + app.toString() + ", mode: " + app.mavenCommands.toString()); Process pA = null; File buildLogA = null; @@ -265,31 +268,29 @@ public abstract class AbstractTemplateTest { // Apache HTTP Client 4 - long startTime; + long totalDuration; + long firstResponseTime; try (CloseableHttpClient client = HttpClients.createDefault()){ HttpPost postRequest = new HttpPost(requestInfo.getURI()); postRequest.setEntity(new StringEntity(requestInfo.getBody())); requestInfo.getHeaders().forEach(postRequest::setHeader); - startTime = System.currentTimeMillis(); - for (int i = 0; i < 20000; i++) { - long requestStartTime = System.nanoTime(); - try (CloseableHttpResponse response = client.execute(postRequest)) { - Assertions.assertThat(response.getStatusLine().getStatusCode()).isEqualTo(requestInfo.getExpectedResponseStatusCode()); -// System.out.println("Response code: " + response.getStatusLine().getStatusCode()); -// System.out.println("Page is: " + EntityUtils.toString(response.getEntity())); - EntityUtils.consume(response.getEntity()); - } - long requestEndTime = System.nanoTime(); - long duration = requestEndTime - requestStartTime; - values.add(duration); - } + // Warm up run + runRequests(client, postRequest, 1000, requestInfo.getExpectedResponseStatusCode(), values); + + firstResponseTime = values.get(0); + values.clear(); + + // Measurements run + long startTime = System.currentTimeMillis(); + runRequests(client, postRequest, 20000, requestInfo.getExpectedResponseStatusCode(), values); + long endTime = System.currentTimeMillis(); + totalDuration = endTime - startTime; } - long endTime = System.currentTimeMillis(); - System.out.println("First response time: " + values.get(0)); - System.out.println("Average response time: " + values.stream().mapToLong(Long::longValue).skip(1).average()); - System.out.println("Total duration: " + (endTime - startTime)); + System.out.println("First response time: " + firstResponseTime); + System.out.println("Average response time: " + values.stream().mapToLong(Long::longValue).average()); + System.out.println("Total duration: " + totalDuration); long rssKbFinal = getRSSkB(pA.pid()); long openedFiles = getOpenedFDs(pA.pid()); // TODO also do before the "test" itself? @@ -348,4 +349,19 @@ public abstract class AbstractTemplateTest { } } + private void runRequests(CloseableHttpClient client, HttpUriRequest request, int count, int expectedResponseStatusCode, List<Long> values) throws IOException { + for (int i = 0; i < count; i++) { + long requestStartTime = System.nanoTime(); + try (CloseableHttpResponse response = client.execute(request)) { + Assertions.assertThat(response.getStatusLine().getStatusCode()).isEqualTo(expectedResponseStatusCode); +// System.out.println("Response code: " + response.getStatusLine().getStatusCode()); +// System.out.println("Page is: " + EntityUtils.toString(response.getEntity())); + EntityUtils.consume(response.getEntity()); + } + long requestEndTime = System.nanoTime(); + long duration = requestEndTime - requestStartTime; + values.add(duration); + } + } + } diff --git a/tests/src/test/java/org/kie/kogito/benchmarks/QuarkusLargeTest.java b/tests/src/test/java/org/kie/kogito/benchmarks/QuarkusLargeTest.java deleted file mode 100644 index bce1104..0000000 --- a/tests/src/test/java/org/kie/kogito/benchmarks/QuarkusLargeTest.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.kie.kogito.benchmarks; - -import static org.kie.kogito.benchmarks.framework.Logs.getLogsDir; - -import java.io.IOException; -import java.nio.file.Path; -import java.nio.file.Paths; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.TestInfo; -import org.kie.kogito.benchmarks.framework.App; -import org.kie.kogito.benchmarks.framework.HTTPRequestInfo; -import org.kie.kogito.benchmarks.framework.LogBuilder; -import org.kie.kogito.benchmarks.framework.Logs; - -public class QuarkusLargeTest extends AbstractTemplateTest { - - private static final App APP_TO_TEST = App.SAMPLE_KOGITO_APP_QUARKUS_JVM; - - @Test - public void startStop(TestInfo testInfo) throws IOException, InterruptedException { - startStop(testInfo, APP_TO_TEST); - } - - @Test - public void loadTest(TestInfo testInfo) throws IOException, InterruptedException { - HTTPRequestInfo requestInfo = HTTPRequestInfo.builder() - .URI(LOCALHOST + "/LoanApplication") - .body("{\"amount\":\"2000\"}") - .method("POST") - .header("Accept", "*/*") - .header("Content-Type", "application/json") - .expectedResponseStatusCode(201) - .build(); // This may be directly replaced for example by Apache-specific class, but this keeps - // it detached from any framework - - loadTest(testInfo, APP_TO_TEST, requestInfo); - -// Path measurementLogSummary = Paths.get(getLogsDir(testInfo.getTestClass().get().getCanonicalName()).toString(), "measurementsSummary.csv"); -// -// for (App app : new App[]{APP_TO_TEST, App.SAMPLE_KOGITO_APP_SPRING_BOOT}) { -// LogBuilder.Log log = new LogBuilder() -// .app(app) -// .mode(app.mavenCommands) -// .buildTimeMs(100) -// .timeToFirstOKRequestMs(200) -// .startedInMs(300) -// .stoppedInMs(400) -// .rssKb(500) -// .openedFiles(700) -// .build(); -// -// LogBuilder.Log log2 = new LogBuilder() -// .app(app) -// .mode(app.mavenCommands) -// .rssKbFinal(600) -// .build(); -// -// Logs.logMeasurementsSummary(log, measurementLogSummary); -// Logs.logMeasurementsSummary(log2, measurementLogSummary); -// -// -// Logs.logMeasurementsSummary(log, measurementLogSummary); -// Logs.logMeasurementsSummary(log2, measurementLogSummary); -// } - - - } -} diff --git a/tests/src/test/java/org/kie/kogito/benchmarks/QuarkusSmallTest.java b/tests/src/test/java/org/kie/kogito/benchmarks/QuarkusSmallTest.java index cbaf805..ea1eafd 100644 --- a/tests/src/test/java/org/kie/kogito/benchmarks/QuarkusSmallTest.java +++ b/tests/src/test/java/org/kie/kogito/benchmarks/QuarkusSmallTest.java @@ -8,7 +8,7 @@ import org.kie.kogito.benchmarks.framework.App; public class QuarkusSmallTest extends AbstractTemplateTest { - private static final App APP_TO_TEST = App.SAMPLE_KOGITO_APP_QUARKUS_JVM; + private static final App APP_TO_TEST = App.SMARTHOUSE_02_QUARKUS_JVM; @Test public void startStop(TestInfo testInfo) throws IOException, InterruptedException { diff --git a/tests/src/test/java/org/kie/kogito/benchmarks/SmartHouse02QuarkusTest.java b/tests/src/test/java/org/kie/kogito/benchmarks/SmartHouse02QuarkusTest.java new file mode 100644 index 0000000..0e3661d --- /dev/null +++ b/tests/src/test/java/org/kie/kogito/benchmarks/SmartHouse02QuarkusTest.java @@ -0,0 +1,35 @@ +package org.kie.kogito.benchmarks; + +import static org.kie.kogito.benchmarks.framework.Logs.getLogsDir; + +import java.io.IOException; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInfo; +import org.kie.kogito.benchmarks.framework.App; +import org.kie.kogito.benchmarks.framework.HTTPRequestInfo; + +public class SmartHouse02QuarkusTest extends AbstractTemplateTest { + + private static final App APP_TO_TEST = App.SMARTHOUSE_02_QUARKUS_JVM; + + @Test + public void startStop(TestInfo testInfo) throws IOException, InterruptedException { + startStop(testInfo, APP_TO_TEST); + } + + @Test + public void loadTest(TestInfo testInfo) throws IOException, InterruptedException { + HTTPRequestInfo requestInfo = HTTPRequestInfo.builder() + .URI(LOCALHOST + "/heating") + .body(HTTPRequestInfo.Body.HEATING_02) + .method("POST") + .header("Accept", "application/json") + .header("Content-Type", "application/json") + .expectedResponseStatusCode(200) + .build(); // This may be directly replaced for example by Apache-specific class, but this keeps + // it detached from any framework + + loadTest(testInfo, APP_TO_TEST, requestInfo); + } +} diff --git a/tests/src/test/java/org/kie/kogito/benchmarks/SmartHouse02SpringBootTest.java b/tests/src/test/java/org/kie/kogito/benchmarks/SmartHouse02SpringBootTest.java new file mode 100644 index 0000000..dc6d7e9 --- /dev/null +++ b/tests/src/test/java/org/kie/kogito/benchmarks/SmartHouse02SpringBootTest.java @@ -0,0 +1,33 @@ +package org.kie.kogito.benchmarks; + +import java.io.IOException; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInfo; +import org.kie.kogito.benchmarks.framework.App; +import org.kie.kogito.benchmarks.framework.HTTPRequestInfo; + +public class SmartHouse02SpringBootTest extends AbstractTemplateTest { + + private static final App APP_TO_TEST = App.SMARTHOUSE_02_SPRING_BOOT; + + @Test + public void startStop(TestInfo testInfo) throws IOException, InterruptedException { + startStop(testInfo, APP_TO_TEST); + } + + @Test + public void loadTest(TestInfo testInfo) throws IOException, InterruptedException { + HTTPRequestInfo requestInfo = HTTPRequestInfo.builder() + .URI(LOCALHOST + "/heating") + .body(HTTPRequestInfo.Body.HEATING_02) + .method("POST") + .header("Accept", "application/json") + .header("Content-Type", "application/json") + .expectedResponseStatusCode(200) + .build(); // This may be directly replaced for example by Apache-specific class, but this keeps + // it detached from any framework + + loadTest(testInfo, APP_TO_TEST, requestInfo); + } +} diff --git a/tests/src/test/java/org/kie/kogito/benchmarks/SmartHouse03QuarkusTest.java b/tests/src/test/java/org/kie/kogito/benchmarks/SmartHouse03QuarkusTest.java new file mode 100644 index 0000000..eaafc48 --- /dev/null +++ b/tests/src/test/java/org/kie/kogito/benchmarks/SmartHouse03QuarkusTest.java @@ -0,0 +1,33 @@ +package org.kie.kogito.benchmarks; + +import java.io.IOException; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInfo; +import org.kie.kogito.benchmarks.framework.App; +import org.kie.kogito.benchmarks.framework.HTTPRequestInfo; + +public class SmartHouse03QuarkusTest extends AbstractTemplateTest { + + private static final App APP_TO_TEST = App.SMARTHOUSE_03_QUARKUS_JVM; + + @Test + public void startStop(TestInfo testInfo) throws IOException, InterruptedException { + startStop(testInfo, APP_TO_TEST); + } + + @Test + public void loadTest(TestInfo testInfo) throws IOException, InterruptedException { + HTTPRequestInfo requestInfo = HTTPRequestInfo.builder() + .URI(LOCALHOST + "/heating") + .body(HTTPRequestInfo.Body.HEATING_02) + .method("POST") + .header("Accept", "application/json") + .header("Content-Type", "application/json") + .expectedResponseStatusCode(200) + .build(); // This may be directly replaced for example by Apache-specific class, but this keeps + // it detached from any framework + + loadTest(testInfo, APP_TO_TEST, requestInfo); + } +} diff --git a/tests/src/test/java/org/kie/kogito/benchmarks/SmartHouse03SpringBootTest.java b/tests/src/test/java/org/kie/kogito/benchmarks/SmartHouse03SpringBootTest.java new file mode 100644 index 0000000..1a79de9 --- /dev/null +++ b/tests/src/test/java/org/kie/kogito/benchmarks/SmartHouse03SpringBootTest.java @@ -0,0 +1,33 @@ +package org.kie.kogito.benchmarks; + +import java.io.IOException; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInfo; +import org.kie.kogito.benchmarks.framework.App; +import org.kie.kogito.benchmarks.framework.HTTPRequestInfo; + +public class SmartHouse03SpringBootTest extends AbstractTemplateTest { + + private static final App APP_TO_TEST = App.SMARTHOUSE_03_SPRING_BOOT; + + @Test + public void startStop(TestInfo testInfo) throws IOException, InterruptedException { + startStop(testInfo, APP_TO_TEST); + } + + @Test + public void loadTest(TestInfo testInfo) throws IOException, InterruptedException { + HTTPRequestInfo requestInfo = HTTPRequestInfo.builder() + .URI(LOCALHOST + "/heating") + .body(HTTPRequestInfo.Body.HEATING_02) + .method("POST") + .header("Accept", "application/json") + .header("Content-Type", "application/json") + .expectedResponseStatusCode(200) + .build(); // This may be directly replaced for example by Apache-specific class, but this keeps + // it detached from any framework + + loadTest(testInfo, APP_TO_TEST, requestInfo); + } +} diff --git a/tests/src/test/java/org/kie/kogito/benchmarks/StartStopTest.java b/tests/src/test/java/org/kie/kogito/benchmarks/StartStopTest.java index 04c50e9..b3b94dc 100644 --- a/tests/src/test/java/org/kie/kogito/benchmarks/StartStopTest.java +++ b/tests/src/test/java/org/kie/kogito/benchmarks/StartStopTest.java @@ -187,7 +187,7 @@ public class StartStopTest { @Test public void kogito(TestInfo testInfo) throws IOException, InterruptedException { - testRuntime(testInfo, App.SAMPLE_KOGITO_APP_QUARKUS_JVM, MvnCmds.QUARKUS_JVM); + testRuntime(testInfo, App.SMARTHOUSE_02_QUARKUS_JVM, MvnCmds.QUARKUS_JVM); } // @Test --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
