From 22b4aebd9ddfd0a22447d3e29e8f1861ab05618e Mon Sep 17 00:00:00 2001 From: "matt.rossi" Date: Sat, 16 Nov 2019 18:00:04 +0100 Subject: [PATCH 1/3] Add Jenkinsfile & update gatling version --- testing-modules/gatling/Jenkinsfile | 20 ++ testing-modules/gatling/pom.xml | 230 ++++++++---------- .../gatling/src/test/scala/Engine.scala | 11 +- .../src/test/scala/IDEPathHelper.scala | 9 +- .../gatling/src/test/scala/Recorder.scala | 8 +- .../org/baeldung/RecordedSimulation.scala | 2 +- 6 files changed, 140 insertions(+), 140 deletions(-) create mode 100644 testing-modules/gatling/Jenkinsfile diff --git a/testing-modules/gatling/Jenkinsfile b/testing-modules/gatling/Jenkinsfile new file mode 100644 index 0000000000..0786788406 --- /dev/null +++ b/testing-modules/gatling/Jenkinsfile @@ -0,0 +1,20 @@ +pipeline { + agent any + stages { + stage("Build Maven") { + steps { + sh 'mvn -B clean package' + } + } + stage("Run Gatling") { + steps { + sh 'mvn gatling:test' + } + post { + always { + gatlingArchive() + } + } + } + } +} \ No newline at end of file diff --git a/testing-modules/gatling/pom.xml b/testing-modules/gatling/pom.xml index 37693ebfee..d105cc8b3e 100644 --- a/testing-modules/gatling/pom.xml +++ b/testing-modules/gatling/pom.xml @@ -1,13 +1,13 @@ - 4.0.0 - org.baeldung - gatling - 1.0-SNAPSHOT - gatling - + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + org.baeldung + gatling + 1.0-SNAPSHOT + gatling + com.baeldung parent-modules @@ -15,122 +15,106 @@ ../../ - - - - io.gatling - gatling-app - ${gatling.version} - - - io.gatling - gatling-recorder - ${gatling.version} - - - io.gatling.highcharts - gatling-charts-highcharts - ${gatling.version} - - - org.scala-lang - scala-library - ${scala.version} - - - - - - - io.gatling.highcharts - gatling-charts-highcharts - - - io.gatling - gatling-app - - - io.gatling - gatling-recorder - - - org.scala-lang - scala-library - - - - src/test/scala - - - - net.alchim31.maven - scala-maven-plugin - ${scala-maven-plugin.version} - - - - - - net.alchim31.maven - scala-maven-plugin - - - - testCompile - - - - - -Ydelambdafy:method - -target:jvm-1.8 - -deprecation - -feature - -unchecked - -language:implicitConversions - -language:postfixOps - - - - - - - - - - - simulation - - - - io.gatling - gatling-maven-plugin - ${gatling-maven-plugin.version} - - - test - - execute - - - true - - - - - - - - + + + + io.gatling + gatling-app + ${gatling.version} + + + io.gatling + gatling-recorder + ${gatling.version} + + + io.gatling.highcharts + gatling-charts-highcharts + ${gatling.version} + + + org.scala-lang + scala-library + ${scala.version} + + + - - 1.8 - 1.8 - UTF-8 - 2.12.6 - 2.3.1 - 3.2.2 - 2.2.4 - + + + io.gatling.highcharts + gatling-charts-highcharts + + + io.gatling + gatling-app + + + io.gatling + gatling-recorder + + + org.scala-lang + scala-library + + + + + src/test/scala + + + + net.alchim31.maven + scala-maven-plugin + ${scala-maven-plugin.version} + + + + + + net.alchim31.maven + scala-maven-plugin + + + + testCompile + + + + + -Ydelambdafy:method + -target:jvm-1.8 + -deprecation + -feature + -unchecked + -language:implicitConversions + -language:postfixOps + + + + + + + io.gatling + gatling-maven-plugin + ${gatling-maven-plugin.version} + + org.baeldung.RecordedSimulation + + + + + + + + 1.8 + 1.8 + UTF-8 + 2.12.6 + 3.3.1 + 4.3.0 + 3.0.4 + diff --git a/testing-modules/gatling/src/test/scala/Engine.scala b/testing-modules/gatling/src/test/scala/Engine.scala index c2884fc218..a34d3eaf60 100644 --- a/testing-modules/gatling/src/test/scala/Engine.scala +++ b/testing-modules/gatling/src/test/scala/Engine.scala @@ -3,11 +3,10 @@ import io.gatling.core.config.GatlingPropertiesBuilder object Engine extends App { - val props = new GatlingPropertiesBuilder - props.dataDirectory(IDEPathHelper.dataDirectory.toString) - props.resultsDirectory(IDEPathHelper.resultsDirectory.toString) - props.bodiesDirectory(IDEPathHelper.bodiesDirectory.toString) - props.binariesDirectory(IDEPathHelper.mavenBinariesDirectory.toString) + val props = new GatlingPropertiesBuilder() + .resourcesDirectory(IDEPathHelper.resourcesDirectory.toString) + .resultsDirectory(IDEPathHelper.resultsDirectory.toString) + .binariesDirectory(IDEPathHelper.mavenBinariesDirectory.toString) - Gatling.fromMap(props.build) + Gatling.fromMap(props.build) } diff --git a/testing-modules/gatling/src/test/scala/IDEPathHelper.scala b/testing-modules/gatling/src/test/scala/IDEPathHelper.scala index 9fb1d7d5c8..6aef6707b2 100644 --- a/testing-modules/gatling/src/test/scala/IDEPathHelper.scala +++ b/testing-modules/gatling/src/test/scala/IDEPathHelper.scala @@ -4,7 +4,7 @@ import io.gatling.commons.util.PathHelper._ object IDEPathHelper { - val gatlingConfUrl: Path = getClass.getClassLoader.getResource("gatling.conf").toURI + val gatlingConfUrl: Path = getClass.getClassLoader.getResource("gatling.conf") val projectRootDir = gatlingConfUrl.ancestor(3) val mavenSourcesDirectory = projectRootDir / "src" / "test" / "scala" @@ -12,11 +12,8 @@ object IDEPathHelper { val mavenTargetDirectory = projectRootDir / "target" val mavenBinariesDirectory = mavenTargetDirectory / "test-classes" - val dataDirectory = mavenResourcesDirectory / "data" - val bodiesDirectory = mavenResourcesDirectory / "bodies" - - val recorderOutputDirectory = mavenSourcesDirectory + val resourcesDirectory = mavenResourcesDirectory + val recorderSimulationsDirectory = mavenSourcesDirectory val resultsDirectory = mavenTargetDirectory / "gatling" - val recorderConfigFile = mavenResourcesDirectory / "recorder.conf" } diff --git a/testing-modules/gatling/src/test/scala/Recorder.scala b/testing-modules/gatling/src/test/scala/Recorder.scala index 9c38e52f12..187f566aac 100644 --- a/testing-modules/gatling/src/test/scala/Recorder.scala +++ b/testing-modules/gatling/src/test/scala/Recorder.scala @@ -3,10 +3,10 @@ import io.gatling.recorder.config.RecorderPropertiesBuilder object Recorder extends App { - val props = new RecorderPropertiesBuilder - props.simulationOutputFolder(IDEPathHelper.recorderOutputDirectory.toString) - props.simulationPackage("org.baeldung") - props.bodiesFolder(IDEPathHelper.bodiesDirectory.toString) + val props = new RecorderPropertiesBuilder() + .simulationsFolder(IDEPathHelper.recorderSimulationsDirectory.toString) + .simulationPackage("org.baeldung") + .resourcesFolder(IDEPathHelper.resourcesDirectory.toString) GatlingRecorder.fromMap(props.build, Some(IDEPathHelper.recorderConfigFile)) } diff --git a/testing-modules/gatling/src/test/scala/org/baeldung/RecordedSimulation.scala b/testing-modules/gatling/src/test/scala/org/baeldung/RecordedSimulation.scala index dece393478..9902f91e0f 100644 --- a/testing-modules/gatling/src/test/scala/org/baeldung/RecordedSimulation.scala +++ b/testing-modules/gatling/src/test/scala/org/baeldung/RecordedSimulation.scala @@ -9,7 +9,7 @@ import io.gatling.jdbc.Predef._ class RecordedSimulation extends Simulation { val httpProtocol = http - .baseURL("http://computer-database.gatling.io") + .baseUrl("http://computer-database.gatling.io") .inferHtmlResources(BlackList(""".*\.css""", """.*\.js""", """.*\.ico"""), WhiteList()) .acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") .acceptEncodingHeader("gzip, deflate") From 0cebd99e9edee9ae719acdcbade3545b9c6bef9c Mon Sep 17 00:00:00 2001 From: "matt.rossi" Date: Wed, 8 Jan 2020 18:07:13 +0100 Subject: [PATCH 2/3] Update application-mysql.properties for OpenShift issue --- .../src/main/resources/application-mysql.properties | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spring-boot-bootstrap/src/main/resources/application-mysql.properties b/spring-boot-bootstrap/src/main/resources/application-mysql.properties index a1823b5d7f..069bf2e9d6 100644 --- a/spring-boot-bootstrap/src/main/resources/application-mysql.properties +++ b/spring-boot-bootstrap/src/main/resources/application-mysql.properties @@ -1 +1,4 @@ -spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect \ No newline at end of file +spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect +spring.application.name = spring-boot-bootstrap +spring.datasource.username = ${SPRING_DATASOURCE_USER} +spring.datasource.password = ${SPRING_DATASOURCE_PASSWORD} \ No newline at end of file From 25546574e5b86fdfa2ec457e273d7f53fa5b5163 Mon Sep 17 00:00:00 2001 From: "matt.rossi" Date: Wed, 8 Jan 2020 18:12:18 +0100 Subject: [PATCH 3/3] Revert "Add Jenkinsfile & update gatling version" This reverts commit 22b4aebd9ddfd0a22447d3e29e8f1861ab05618e. --- testing-modules/gatling/Jenkinsfile | 20 -- testing-modules/gatling/pom.xml | 230 ++++++++++-------- .../gatling/src/test/scala/Engine.scala | 11 +- .../src/test/scala/IDEPathHelper.scala | 9 +- .../gatling/src/test/scala/Recorder.scala | 8 +- .../org/baeldung/RecordedSimulation.scala | 2 +- 6 files changed, 140 insertions(+), 140 deletions(-) delete mode 100644 testing-modules/gatling/Jenkinsfile diff --git a/testing-modules/gatling/Jenkinsfile b/testing-modules/gatling/Jenkinsfile deleted file mode 100644 index 0786788406..0000000000 --- a/testing-modules/gatling/Jenkinsfile +++ /dev/null @@ -1,20 +0,0 @@ -pipeline { - agent any - stages { - stage("Build Maven") { - steps { - sh 'mvn -B clean package' - } - } - stage("Run Gatling") { - steps { - sh 'mvn gatling:test' - } - post { - always { - gatlingArchive() - } - } - } - } -} \ No newline at end of file diff --git a/testing-modules/gatling/pom.xml b/testing-modules/gatling/pom.xml index d105cc8b3e..37693ebfee 100644 --- a/testing-modules/gatling/pom.xml +++ b/testing-modules/gatling/pom.xml @@ -1,13 +1,13 @@ - 4.0.0 - org.baeldung - gatling - 1.0-SNAPSHOT - gatling - + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + org.baeldung + gatling + 1.0-SNAPSHOT + gatling + com.baeldung parent-modules @@ -15,106 +15,122 @@ ../../ + + + + io.gatling + gatling-app + ${gatling.version} + + + io.gatling + gatling-recorder + ${gatling.version} + + + io.gatling.highcharts + gatling-charts-highcharts + ${gatling.version} + + + org.scala-lang + scala-library + ${scala.version} + + + + + + + io.gatling.highcharts + gatling-charts-highcharts + + + io.gatling + gatling-app + + + io.gatling + gatling-recorder + + + org.scala-lang + scala-library + + - - - - io.gatling - gatling-app - ${gatling.version} - - - io.gatling - gatling-recorder - ${gatling.version} - - - io.gatling.highcharts - gatling-charts-highcharts - ${gatling.version} - - - org.scala-lang - scala-library - ${scala.version} - - - + + src/test/scala + + + + net.alchim31.maven + scala-maven-plugin + ${scala-maven-plugin.version} + + + + + + net.alchim31.maven + scala-maven-plugin + + + + testCompile + + + + + -Ydelambdafy:method + -target:jvm-1.8 + -deprecation + -feature + -unchecked + -language:implicitConversions + -language:postfixOps + + + + + + + + + + + simulation + + + + io.gatling + gatling-maven-plugin + ${gatling-maven-plugin.version} + + + test + + execute + + + true + + + + + + + + - - - io.gatling.highcharts - gatling-charts-highcharts - - - io.gatling - gatling-app - - - io.gatling - gatling-recorder - - - org.scala-lang - scala-library - - - - - src/test/scala - - - - net.alchim31.maven - scala-maven-plugin - ${scala-maven-plugin.version} - - - - - - net.alchim31.maven - scala-maven-plugin - - - - testCompile - - - - - -Ydelambdafy:method - -target:jvm-1.8 - -deprecation - -feature - -unchecked - -language:implicitConversions - -language:postfixOps - - - - - - - io.gatling - gatling-maven-plugin - ${gatling-maven-plugin.version} - - org.baeldung.RecordedSimulation - - - - - - - - 1.8 - 1.8 - UTF-8 - 2.12.6 - 3.3.1 - 4.3.0 - 3.0.4 - + + 1.8 + 1.8 + UTF-8 + 2.12.6 + 2.3.1 + 3.2.2 + 2.2.4 + diff --git a/testing-modules/gatling/src/test/scala/Engine.scala b/testing-modules/gatling/src/test/scala/Engine.scala index a34d3eaf60..c2884fc218 100644 --- a/testing-modules/gatling/src/test/scala/Engine.scala +++ b/testing-modules/gatling/src/test/scala/Engine.scala @@ -3,10 +3,11 @@ import io.gatling.core.config.GatlingPropertiesBuilder object Engine extends App { - val props = new GatlingPropertiesBuilder() - .resourcesDirectory(IDEPathHelper.resourcesDirectory.toString) - .resultsDirectory(IDEPathHelper.resultsDirectory.toString) - .binariesDirectory(IDEPathHelper.mavenBinariesDirectory.toString) + val props = new GatlingPropertiesBuilder + props.dataDirectory(IDEPathHelper.dataDirectory.toString) + props.resultsDirectory(IDEPathHelper.resultsDirectory.toString) + props.bodiesDirectory(IDEPathHelper.bodiesDirectory.toString) + props.binariesDirectory(IDEPathHelper.mavenBinariesDirectory.toString) - Gatling.fromMap(props.build) + Gatling.fromMap(props.build) } diff --git a/testing-modules/gatling/src/test/scala/IDEPathHelper.scala b/testing-modules/gatling/src/test/scala/IDEPathHelper.scala index 6aef6707b2..9fb1d7d5c8 100644 --- a/testing-modules/gatling/src/test/scala/IDEPathHelper.scala +++ b/testing-modules/gatling/src/test/scala/IDEPathHelper.scala @@ -4,7 +4,7 @@ import io.gatling.commons.util.PathHelper._ object IDEPathHelper { - val gatlingConfUrl: Path = getClass.getClassLoader.getResource("gatling.conf") + val gatlingConfUrl: Path = getClass.getClassLoader.getResource("gatling.conf").toURI val projectRootDir = gatlingConfUrl.ancestor(3) val mavenSourcesDirectory = projectRootDir / "src" / "test" / "scala" @@ -12,8 +12,11 @@ object IDEPathHelper { val mavenTargetDirectory = projectRootDir / "target" val mavenBinariesDirectory = mavenTargetDirectory / "test-classes" - val resourcesDirectory = mavenResourcesDirectory - val recorderSimulationsDirectory = mavenSourcesDirectory + val dataDirectory = mavenResourcesDirectory / "data" + val bodiesDirectory = mavenResourcesDirectory / "bodies" + + val recorderOutputDirectory = mavenSourcesDirectory val resultsDirectory = mavenTargetDirectory / "gatling" + val recorderConfigFile = mavenResourcesDirectory / "recorder.conf" } diff --git a/testing-modules/gatling/src/test/scala/Recorder.scala b/testing-modules/gatling/src/test/scala/Recorder.scala index 187f566aac..9c38e52f12 100644 --- a/testing-modules/gatling/src/test/scala/Recorder.scala +++ b/testing-modules/gatling/src/test/scala/Recorder.scala @@ -3,10 +3,10 @@ import io.gatling.recorder.config.RecorderPropertiesBuilder object Recorder extends App { - val props = new RecorderPropertiesBuilder() - .simulationsFolder(IDEPathHelper.recorderSimulationsDirectory.toString) - .simulationPackage("org.baeldung") - .resourcesFolder(IDEPathHelper.resourcesDirectory.toString) + val props = new RecorderPropertiesBuilder + props.simulationOutputFolder(IDEPathHelper.recorderOutputDirectory.toString) + props.simulationPackage("org.baeldung") + props.bodiesFolder(IDEPathHelper.bodiesDirectory.toString) GatlingRecorder.fromMap(props.build, Some(IDEPathHelper.recorderConfigFile)) } diff --git a/testing-modules/gatling/src/test/scala/org/baeldung/RecordedSimulation.scala b/testing-modules/gatling/src/test/scala/org/baeldung/RecordedSimulation.scala index 9902f91e0f..dece393478 100644 --- a/testing-modules/gatling/src/test/scala/org/baeldung/RecordedSimulation.scala +++ b/testing-modules/gatling/src/test/scala/org/baeldung/RecordedSimulation.scala @@ -9,7 +9,7 @@ import io.gatling.jdbc.Predef._ class RecordedSimulation extends Simulation { val httpProtocol = http - .baseUrl("http://computer-database.gatling.io") + .baseURL("http://computer-database.gatling.io") .inferHtmlResources(BlackList(""".*\.css""", """.*\.js""", """.*\.ico"""), WhiteList()) .acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") .acceptEncodingHeader("gzip, deflate")