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")