Revert "Add Jenkinsfile & update gatling version"

This reverts commit a2314c69d9.
This commit is contained in:
matt.rossi 2020-01-08 18:12:18 +01:00
parent 58e3ab4deb
commit ef1c761607
6 changed files with 140 additions and 140 deletions

View File

@ -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()
}
}
}
}
}

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.baeldung</groupId> <groupId>org.baeldung</groupId>
<artifactId>gatling</artifactId> <artifactId>gatling</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<name>gatling</name> <name>gatling</name>
<parent> <parent>
<groupId>com.baeldung</groupId> <groupId>com.baeldung</groupId>
<artifactId>parent-modules</artifactId> <artifactId>parent-modules</artifactId>
@ -15,106 +15,122 @@
<relativePath>../../</relativePath> <relativePath>../../</relativePath>
</parent> </parent>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.gatling</groupId>
<artifactId>gatling-app</artifactId>
<version>${gatling.version}</version>
</dependency>
<dependency>
<groupId>io.gatling</groupId>
<artifactId>gatling-recorder</artifactId>
<version>${gatling.version}</version>
</dependency>
<dependency>
<groupId>io.gatling.highcharts</groupId>
<artifactId>gatling-charts-highcharts</artifactId>
<version>${gatling.version}</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>io.gatling.highcharts</groupId>
<artifactId>gatling-charts-highcharts</artifactId>
</dependency>
<dependency>
<groupId>io.gatling</groupId>
<artifactId>gatling-app</artifactId>
</dependency>
<dependency>
<groupId>io.gatling</groupId>
<artifactId>gatling-recorder</artifactId>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
</dependency>
</dependencies>
<dependencyManagement> <build>
<dependencies> <testSourceDirectory>src/test/scala</testSourceDirectory>
<dependency> <pluginManagement>
<groupId>io.gatling</groupId> <plugins>
<artifactId>gatling-app</artifactId> <plugin>
<version>${gatling.version}</version> <groupId>net.alchim31.maven</groupId>
</dependency> <artifactId>scala-maven-plugin</artifactId>
<dependency> <version>${scala-maven-plugin.version}</version>
<groupId>io.gatling</groupId> </plugin>
<artifactId>gatling-recorder</artifactId> </plugins>
<version>${gatling.version}</version> </pluginManagement>
</dependency> <plugins>
<dependency> <plugin>
<groupId>io.gatling.highcharts</groupId> <groupId>net.alchim31.maven</groupId>
<artifactId>gatling-charts-highcharts</artifactId> <artifactId>scala-maven-plugin</artifactId>
<version>${gatling.version}</version> <executions>
</dependency> <execution>
<dependency> <goals>
<groupId>org.scala-lang</groupId> <goal>testCompile</goal>
<artifactId>scala-library</artifactId> </goals>
<version>${scala.version}</version> <configuration>
</dependency> <args>
</dependencies> <!--<arg>-Ybackend:GenBCode</arg> -->
</dependencyManagement> <arg>-Ydelambdafy:method</arg>
<arg>-target:jvm-1.8</arg>
<arg>-deprecation</arg>
<arg>-feature</arg>
<arg>-unchecked</arg>
<arg>-language:implicitConversions</arg>
<arg>-language:postfixOps</arg>
</args>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>simulation</id>
<build>
<plugins>
<plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>${gatling-maven-plugin.version}</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<disableCompiler>true</disableCompiler>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies> <properties>
<dependency> <maven.compiler.source>1.8</maven.compiler.source>
<groupId>io.gatling.highcharts</groupId> <maven.compiler.target>1.8</maven.compiler.target>
<artifactId>gatling-charts-highcharts</artifactId> <encoding>UTF-8</encoding>
</dependency> <scala.version>2.12.6</scala.version> <!--2.11.12 --> <!--2.12.6 -->
<dependency> <gatling.version>2.3.1</gatling.version> <!--2.2.5 --> <!--2.3.1 -->
<groupId>io.gatling</groupId> <scala-maven-plugin.version>3.2.2</scala-maven-plugin.version> <!--3.2.2 --> <!--3.3.2 -->
<artifactId>gatling-app</artifactId> <gatling-maven-plugin.version>2.2.4</gatling-maven-plugin.version> <!--2.2.1 --> <!--2.2.4 -->
</dependency> </properties>
<dependency>
<groupId>io.gatling</groupId>
<artifactId>gatling-recorder</artifactId>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
</dependency>
</dependencies>
<build>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<pluginManagement>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>${scala-maven-plugin.version}</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>testCompile</goal>
</goals>
<configuration>
<args>
<!--<arg>-Ybackend:GenBCode</arg> -->
<arg>-Ydelambdafy:method</arg>
<arg>-target:jvm-1.8</arg>
<arg>-deprecation</arg>
<arg>-feature</arg>
<arg>-unchecked</arg>
<arg>-language:implicitConversions</arg>
<arg>-language:postfixOps</arg>
</args>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>${gatling-maven-plugin.version}</version>
<configuration>
<simulationClass>org.baeldung.RecordedSimulation</simulationClass>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<encoding>UTF-8</encoding>
<scala.version>2.12.6</scala.version> <!--2.11.12 --> <!--2.12.6 -->
<gatling.version>3.3.1</gatling.version> <!--2.2.5 --> <!--2.3.1 -->
<scala-maven-plugin.version>4.3.0</scala-maven-plugin.version> <!--3.2.2 --> <!--3.3.2 -->
<gatling-maven-plugin.version>3.0.4</gatling-maven-plugin.version> <!--2.2.1 --> <!--2.2.4 -->
</properties>
</project> </project>

View File

@ -3,10 +3,11 @@ import io.gatling.core.config.GatlingPropertiesBuilder
object Engine extends App { object Engine extends App {
val props = new GatlingPropertiesBuilder() val props = new GatlingPropertiesBuilder
.resourcesDirectory(IDEPathHelper.resourcesDirectory.toString) props.dataDirectory(IDEPathHelper.dataDirectory.toString)
.resultsDirectory(IDEPathHelper.resultsDirectory.toString) props.resultsDirectory(IDEPathHelper.resultsDirectory.toString)
.binariesDirectory(IDEPathHelper.mavenBinariesDirectory.toString) props.bodiesDirectory(IDEPathHelper.bodiesDirectory.toString)
props.binariesDirectory(IDEPathHelper.mavenBinariesDirectory.toString)
Gatling.fromMap(props.build) Gatling.fromMap(props.build)
} }

View File

@ -4,7 +4,7 @@ import io.gatling.commons.util.PathHelper._
object IDEPathHelper { 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 projectRootDir = gatlingConfUrl.ancestor(3)
val mavenSourcesDirectory = projectRootDir / "src" / "test" / "scala" val mavenSourcesDirectory = projectRootDir / "src" / "test" / "scala"
@ -12,8 +12,11 @@ object IDEPathHelper {
val mavenTargetDirectory = projectRootDir / "target" val mavenTargetDirectory = projectRootDir / "target"
val mavenBinariesDirectory = mavenTargetDirectory / "test-classes" val mavenBinariesDirectory = mavenTargetDirectory / "test-classes"
val resourcesDirectory = mavenResourcesDirectory val dataDirectory = mavenResourcesDirectory / "data"
val recorderSimulationsDirectory = mavenSourcesDirectory val bodiesDirectory = mavenResourcesDirectory / "bodies"
val recorderOutputDirectory = mavenSourcesDirectory
val resultsDirectory = mavenTargetDirectory / "gatling" val resultsDirectory = mavenTargetDirectory / "gatling"
val recorderConfigFile = mavenResourcesDirectory / "recorder.conf" val recorderConfigFile = mavenResourcesDirectory / "recorder.conf"
} }

View File

@ -3,10 +3,10 @@ import io.gatling.recorder.config.RecorderPropertiesBuilder
object Recorder extends App { object Recorder extends App {
val props = new RecorderPropertiesBuilder() val props = new RecorderPropertiesBuilder
.simulationsFolder(IDEPathHelper.recorderSimulationsDirectory.toString) props.simulationOutputFolder(IDEPathHelper.recorderOutputDirectory.toString)
.simulationPackage("org.baeldung") props.simulationPackage("org.baeldung")
.resourcesFolder(IDEPathHelper.resourcesDirectory.toString) props.bodiesFolder(IDEPathHelper.bodiesDirectory.toString)
GatlingRecorder.fromMap(props.build, Some(IDEPathHelper.recorderConfigFile)) GatlingRecorder.fromMap(props.build, Some(IDEPathHelper.recorderConfigFile))
} }

View File

@ -9,7 +9,7 @@ import io.gatling.jdbc.Predef._
class RecordedSimulation extends Simulation { class RecordedSimulation extends Simulation {
val httpProtocol = http val httpProtocol = http
.baseUrl("http://computer-database.gatling.io") .baseURL("http://computer-database.gatling.io")
.inferHtmlResources(BlackList(""".*\.css""", """.*\.js""", """.*\.ico"""), WhiteList()) .inferHtmlResources(BlackList(""".*\.css""", """.*\.js""", """.*\.ico"""), WhiteList())
.acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") .acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
.acceptEncodingHeader("gzip, deflate") .acceptEncodingHeader("gzip, deflate")