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,12 +1,12 @@
<?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>
@ -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>
<dependencyManagement> <dependencies>
<dependencies> <dependency>
<dependency> <groupId>io.gatling.highcharts</groupId>
<groupId>io.gatling</groupId> <artifactId>gatling-charts-highcharts</artifactId>
<artifactId>gatling-app</artifactId> </dependency>
<version>${gatling.version}</version> <dependency>
</dependency> <groupId>io.gatling</groupId>
<dependency> <artifactId>gatling-app</artifactId>
<groupId>io.gatling</groupId> </dependency>
<artifactId>gatling-recorder</artifactId> <dependency>
<version>${gatling.version}</version> <groupId>io.gatling</groupId>
</dependency> <artifactId>gatling-recorder</artifactId>
<dependency> </dependency>
<groupId>io.gatling.highcharts</groupId> <dependency>
<artifactId>gatling-charts-highcharts</artifactId> <groupId>org.scala-lang</groupId>
<version>${gatling.version}</version> <artifactId>scala-library</artifactId>
</dependency> </dependency>
<dependency> </dependencies>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies> <build>
<dependency> <testSourceDirectory>src/test/scala</testSourceDirectory>
<groupId>io.gatling.highcharts</groupId> <pluginManagement>
<artifactId>gatling-charts-highcharts</artifactId> <plugins>
</dependency> <plugin>
<dependency> <groupId>net.alchim31.maven</groupId>
<groupId>io.gatling</groupId> <artifactId>scala-maven-plugin</artifactId>
<artifactId>gatling-app</artifactId> <version>${scala-maven-plugin.version}</version>
</dependency> </plugin>
<dependency> </plugins>
<groupId>io.gatling</groupId> </pluginManagement>
<artifactId>gatling-recorder</artifactId> <plugins>
</dependency> <plugin>
<dependency> <groupId>net.alchim31.maven</groupId>
<groupId>org.scala-lang</groupId> <artifactId>scala-maven-plugin</artifactId>
<artifactId>scala-library</artifactId> <executions>
</dependency> <execution>
</dependencies> <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>
</plugins>
</build>
<build> <profiles>
<testSourceDirectory>src/test/scala</testSourceDirectory> <profile>
<pluginManagement> <id>simulation</id>
<plugins> <build>
<plugin> <plugins>
<groupId>net.alchim31.maven</groupId> <plugin>
<artifactId>scala-maven-plugin</artifactId> <groupId>io.gatling</groupId>
<version>${scala-maven-plugin.version}</version> <artifactId>gatling-maven-plugin</artifactId>
</plugin> <version>${gatling-maven-plugin.version}</version>
</plugins> <executions>
</pluginManagement> <execution>
<plugins> <phase>test</phase>
<plugin> <goals>
<groupId>net.alchim31.maven</groupId> <goal>execute</goal>
<artifactId>scala-maven-plugin</artifactId> </goals>
<executions> <configuration>
<execution> <disableCompiler>true</disableCompiler>
<goals> </configuration>
<goal>testCompile</goal> </execution>
</goals> </executions>
<configuration> </plugin>
<args> </plugins>
<!--<arg>-Ybackend:GenBCode</arg> --> </build>
<arg>-Ydelambdafy:method</arg> </profile>
<arg>-target:jvm-1.8</arg> </profiles>
<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>
<properties> <maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.target>1.8</maven.compiler.target> <encoding>UTF-8</encoding>
<encoding>UTF-8</encoding> <scala.version>2.12.6</scala.version> <!--2.11.12 --> <!--2.12.6 -->
<scala.version>2.12.6</scala.version> <!--2.11.12 --> <!--2.12.6 --> <gatling.version>2.3.1</gatling.version> <!--2.2.5 --> <!--2.3.1 -->
<gatling.version>3.3.1</gatling.version> <!--2.2.5 --> <!--2.3.1 --> <scala-maven-plugin.version>3.2.2</scala-maven-plugin.version> <!--3.2.2 --> <!--3.3.2 -->
<scala-maven-plugin.version>4.3.0</scala-maven-plugin.version> <!--3.2.2 --> <!--3.3.2 --> <gatling-maven-plugin.version>2.2.4</gatling-maven-plugin.version> <!--2.2.1 --> <!--2.2.4 -->
<gatling-maven-plugin.version>3.0.4</gatling-maven-plugin.version> <!--2.2.1 --> <!--2.2.4 --> </properties>
</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")