8000 #2 · soujava/soujava-test-kit@01bad6d · GitHub
[go: up one dir, main page]

Skip to content

Commit 01bad6d

Browse files
1 parent 36c8406 commit 01bad6d

File tree

6 files changed

+465
-306
lines changed

6 files changed

+465
-306
lines changed

README.md

Lines changed: 37 additions & 306 deletions
Large diffs are not rendered by default.

gatling/readme.md

Lines changed: 313 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
2+
xmlns:ns="http://schema.dtg.nl/esb_webservice/wsdl/1.1">
3+
<soapenv:Header/>
4+
<soapenv:Body>
5+
<ns:xml>
6+
<![CDATA[
7+
<message>phase1</message>
8+
]]>
9+
</ns:xml>
10+
</soapenv:Body>
11+
</soapenv:Envelope>
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/**
2+
* @author Thomas Modeneis
3+
*/
4+
package soujava
5+
6+
import io.gatling.core.Predef._
7+
import io.gatling.http.Predef._
8+
9+
class BenchmarkSOAPGeneric extends Simulation {
10+
11+
//Definitions for the endpoint 1
12+
def threads_ = System.getProperty("NUM_THREADS")
13+
14+
def rampup_ = System.getProperty("RAMP_TIME")
15+
16+
def duration_ = System.getProperty("DURATION")
17+
18+
def target = System.getProperty("TARGET")
19+
20+
def endpoint_ = System.getProperty("ENDPOINT")
21+
22+
def endpointName_ = System.getProperty("ENDPOINT_NAME")
23+
24+
def testFile = System.getProperty("TEST_FILE")
25+
26+
def statusCheck = System.getProperty("STATUS_CHECK")
27+
28+
val IntStatusCheck = Integer.getInteger("statusCheck", statusCheck.toInt).toInt
29+
30+
def regexCheck = System.getProperty("REGEX_CHECK")
31+
32+
//Definitions for the Switch
33+
def randomSwitch_Target1 = System.getProperty("TARGET1_SWITCH")
34+
35+
//Definitions for the test itself (basics)
36+
val threads = Integer.getInteger("threads", threads_.toInt)
37+
val rampup = Integer.getInteger("rampup", rampup_.toInt).toInt
38+
val duration = Integer.getInteger("duration", duration_.toInt).toInt
39+
40+
def randSwitch1 = randomSwitch_Target1.toDouble
41+
8000 42+
val httpConf = http
43+
.baseURL(target)
44+
45+
def extractMessage(str: String, session: Session): String = {
46+
println("extractMessage "+str)
47+
var ID = str
48+
println("---- ID --------------------------------------------------------------")
49+
println(ID)
50+
println("---- ID --------------------------------------------------------------")
51+
ID
52+
}
53+
54+
def generateMessage(session: Session): String = {
55+
val myID = session("myID").as[String]
56+
57+
var message =
58+
"""
59+
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><xml xmlns="http://schema.soujava.org.br/webservice/wsdl/1.1">"""+myID+"""</xml></soap:Body></soap:Envelope>
60+
"""
61+
62+
println("---- Message --------------------------------------------------------------")
63+
println(message)
64+
println("---- message --------------------------------------------------------------")
65+
66+
message
67+
}
68+
69+
70+
val get_endpoint =
71+
exec(http(endpointName_).post(endpoint_).body(RawFileBody(testFile)).check(status.is(IntStatusCheck))
72+
.check(regex(regexCheck).exists)
73+
.check(xpath(
74+
"/soap:Envelope/soap:Body/w:WebServiceInvocationResult/w:message/text()",
75+
List(
76+
("w", "http://schema.soujava.org.br/webservice/wsdl/1.1"),
77+
("soap", "http://schemas.xmlsoap.org/soap/envelope/")
78+
))
79+
.find
80+
.transform((m, session) =>
81+
extractMessage(m,session)
82+
).saveAs("myID")))
83+
.exec(http(endpointName_).post(endpoint_).body(StringBody(session => "" + generateMessage(session))).asXML.check(status.is(IntStatusCheck))
84+
.check(regex(regexCheck).exists))
85+
86+
val scn = scenario(endpointName_)
87+
.forever("counter") {
88+
randomSwitch(
89+
randSwitch1 -> get_endpoint
90+
)
91+
}
92+
setUp(scn.inject(rampUsers(threads) over rampup))
93+
.protocols(httpConf)
94+
.maxDuration(duration)
95+
}
96+
97+
98+

webservice/src/main/java/br/org/soujava/ReportIncidentRoutes.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/**
2+
* @author Thomas Modeneis
3+
*/
14
package br.org.soujava;
25

36

webservice/src/test/java/br/org/soujava/webservice/WebserviceTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/**
2+
* @author Thomas Modeneis
3+
*/
14
package br.org.soujava.webservice;
25

36
import br.org.soujava.schema.webservice.wsdl._1.WebServiceInvocationResult;

0 commit comments

Comments
 (0)
0