Skip to content

Commit cbcb5fc

Browse files
authored
Merge pull request #33 from akamai/feature/32
Feature/32
2 parents 0d79e95 + f74bd48 commit cbcb5fc

File tree

15 files changed

+83
-21
lines changed

15 files changed

+83
-21
lines changed

edgegrid-signer-apache-http-client/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Include the following Maven dependency in your project POM:
1818
<dependency>
1919
<groupId>com.akamai.edgegrid</groupId>
2020
<artifactId>edgegrid-signer-apache-http-client</artifactId>
21-
<version>3.0.0</version>
21+
<version>3.0.1-SNAPSHOT</version>
2222
</dependency>
2323
```
2424

edgegrid-signer-apache-http-client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<artifactId>edgegrid-signer-parent</artifactId>
88
<groupId>com.akamai.edgegrid</groupId>
9-
<version>3.0.0</version>
9+
<version>3.0.1-SNAPSHOT</version>
1010
</parent>
1111
<modelVersion>4.0.0</modelVersion>
1212

edgegrid-signer-async-http-client/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Include the following Maven dependency in your project POM:
1818
<dependency>
1919
<groupId>com.akamai.edgegrid</groupId>
2020
<artifactId>edgegrid-signer-async-http-client</artifactId>
21-
<version>3.0.0</version>
21+
<version>3.0.1-SNAPSHOT</version>
2222
</dependency>
2323
```
2424

edgegrid-signer-async-http-client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>edgegrid-signer-parent</artifactId>
77
<groupId>com.akamai.edgegrid</groupId>
8-
<version>3.0.0</version>
8+
<version>3.0.1-SNAPSHOT</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

edgegrid-signer-core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<artifactId>edgegrid-signer-parent</artifactId>
88
<groupId>com.akamai.edgegrid</groupId>
9-
<version>3.0.0</version>
9+
<version>3.0.1-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>edgegrid-signer-core</artifactId>

edgegrid-signer-gatling/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Include the following Maven dependency in your project POM:
1818
<dependency>
1919
<groupId>com.akamai.edgegrid</groupId>
2020
<artifactId>edgegrid-signer-gatling</artifactId>
21-
<version>3.0.0</version>
21+
<version>3.0.1-SNAPSHOT</version>
2222
</dependency>
2323
```
2424

edgegrid-signer-gatling/pom.xml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<artifactId>edgegrid-signer-parent</artifactId>
99
<groupId>com.akamai.edgegrid</groupId>
10-
<version>3.0.0</version>
10+
<version>3.0.1-SNAPSHOT</version>
1111
</parent>
1212

1313
<artifactId>edgegrid-signer-gatling</artifactId>
@@ -32,6 +32,10 @@
3232
<groupId>org.scala-lang</groupId>
3333
<artifactId>scala-library</artifactId>
3434
</dependency>
35+
<dependency>
36+
<groupId>com.github.tomakehurst</groupId>
37+
<artifactId>wiremock</artifactId>
38+
</dependency>
3539
</dependencies>
3640

3741
<build>
@@ -61,7 +65,16 @@
6165
<version>2.2.4</version>
6266
<configuration>
6367
<runMultipleSimulations>true</runMultipleSimulations>
68+
<disableCompiler>true</disableCompiler>
6469
</configuration>
70+
<executions>
71+
<execution>
72+
<id>gatling-integration-tests</id>
73+
<goals>
74+
<goal>integration-test</goal>
75+
</goals>
76+
</execution>
77+
</executions>
6578
</plugin>
6679
</plugins>
6780
</build>

edgegrid-signer-gatling/src/test/scala/com/akamai/edgegrid/signer/gatling/EdgeGridSignerSimulation1.scala

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,46 @@
1717
package com.akamai.edgegrid.signer.gatling
1818

1919
import com.akamai.edgegrid.signer.ahc.AsyncHttpClientEdgeGridSignatureCalculator
20+
import com.github.tomakehurst.wiremock.WireMockServer
21+
import com.github.tomakehurst.wiremock.client.WireMock._
22+
import com.github.tomakehurst.wiremock.core.WireMockConfiguration
2023
import io.gatling.core.Predef._
2124
import io.gatling.http.Predef._
2225

2326

2427
class EdgeGridSignerSimulation1 extends Simulation {
2528

2629
val httpConf = http
27-
.baseURL("http://localhost")
30+
.baseURL("http://" + testdata.SERVICE_MOCK_HOST)
31+
32+
val wireMockServer = new WireMockServer(WireMockConfiguration.wireMockConfig().port(testdata.SERVICE_MOCK_PORT))
2833

2934
val testScenario = scenario("Test scenario")
3035
.exec(
3136
http("fakeRequest")
3237
.get("/test")
3338
.signatureCalculator(new AsyncHttpClientEdgeGridSignatureCalculator(testdata.testCredential))
39+
.check(status.is(201))
40+
)
41+
42+
before {
43+
wireMockServer.start()
44+
wireMockServer.stubFor(get(urlPathEqualTo("/test"))
45+
.withHeader("Authorization", matching(".*"))
46+
.withHeader("Host", equalTo(testdata.SERVICE_MOCK))
47+
.willReturn(aResponse.withStatus(201)
48+
.withHeader("Content-Type", "text/xml")
49+
.withBody("<response>Some content</response>")))
50+
}
51+
52+
setUp(testScenario.inject(atOnceUsers(1)))
53+
.protocols(httpConf)
54+
.assertions(
55+
global.successfulRequests.percent.is(100)
3456
)
3557

36-
setUp(
37-
testScenario.inject(atOnceUsers(1))
38-
).protocols(httpConf)
58+
after {
59+
wireMockServer.stop()
60+
}
3961

4062
}

edgegrid-signer-gatling/src/test/scala/com/akamai/edgegrid/signer/gatling/EdgeGridSignerSimulation2.scala

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,44 @@
1717
package com.akamai.edgegrid.signer.gatling
1818

1919
import com.akamai.edgegrid.signer.ahc.AsyncHttpClientEdgeGridSignatureCalculator
20+
import com.github.tomakehurst.wiremock.WireMockServer
21+
import com.github.tomakehurst.wiremock.client.WireMock._
22+
import com.github.tomakehurst.wiremock.core.WireMockConfiguration
2023
import io.gatling.core.Predef._
2124
import io.gatling.http.Predef._
2225

23-
class EdgeGridSignerSimulation2 extends Simulation{
26+
class EdgeGridSignerSimulation2 extends Simulation {
2427

2528
val httpConf = http
2629

30+
val wireMockServer = new WireMockServer(WireMockConfiguration.wireMockConfig().port(testdata.SERVICE_MOCK_PORT))
31+
2732
val testScenario = scenario("Test scenario")
2833
.exec(
2934
http("fakeRequest")
30-
.get("https://" + testdata.testCredential.getHost + "/test")
35+
.get("http://" + testdata.testCredential.getHost + "/test")
3136
.signatureCalculator(new AsyncHttpClientEdgeGridSignatureCalculator(testdata.testCredential))
3237
)
3338

34-
setUp(
35-
testScenario.inject(atOnceUsers(1))
36-
).protocols(httpConf)
39+
before {
40+
wireMockServer.start()
41+
wireMockServer.stubFor(get(urlPathEqualTo("/test"))
42+
.withHeader("Authorization", matching(".*"))
43+
.withHeader("Host", equalTo(testdata.SERVICE_MOCK))
44+
.willReturn(aResponse.withStatus(201)
45+
.withHeader("Content-Type", "text/xml")
46+
.withBody("<response>Some content</response>")))
47+
}
48+
49+
setUp(testScenario.inject(atOnceUsers(1)))
50+
.protocols(httpConf)
51+
.assertions(
52+
global.successfulRequests.percent.is(100)
53+
)
54+
55+
after {
56+
wireMockServer.stop()
57+
}
58+
3759

3860
}

edgegrid-signer-gatling/src/test/scala/com/akamai/edgegrid/signer/gatling/TestData.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,9 @@ package object testdata {
2626
.clientSecret("SOMESECRET")
2727
.host("localhost:9089").build
2828

29+
val SERVICE_MOCK_HOST = "localhost"
30+
val SERVICE_MOCK_PORT = 9089
31+
val SERVICE_MOCK = testdata.SERVICE_MOCK_HOST + ":" + testdata.SERVICE_MOCK_PORT
32+
33+
2934
}

0 commit comments

Comments
 (0)