Skip to content

Commit a55f6cb

Browse files
committed
Add create institutions
1 parent 2aab0aa commit a55f6cb

File tree

2 files changed

+114
-19
lines changed

2 files changed

+114
-19
lines changed

cluster/src/test/resources/application.conf

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ hmda {
22
benchmark {
33
host = "localhost"
44
host = ${?HMDA_BENCHMARK_HOST}
5-
port = "8080"
5+
port = 8080
66
port = ${?HMDA_BENCHMARK_PORT}
7-
nrOfUsers = 1000
8-
rampUpTime = 30
7+
adminPort = 8081
8+
adminPort = ${?HMDA_BENCHMARK_ADMIN_PORT}
9+
nrOfUsers = 10
10+
rampUpTime = 5
911
}
1012
}

cluster/src/test/scala/api/http/benchmark/FilingSimulation.scala

Lines changed: 109 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class FilingSimulation extends Simulation with WriteInstitutionProtocol {
1616
val config = ConfigFactory.load()
1717
val host = config.getString("hmda.benchmark.host")
1818
val port = config.getInt("hmda.benchmark.port")
19+
val adminPort = config.getInt("hmda.benchmark.adminPort")
1920
val nrOfUsers = config.getInt("hmda.benchmark.nrOfUsers")
2021
val rampUpTime = config.getInt("hmda.benchmark.rampUpTime")
2122

@@ -29,22 +30,114 @@ class FilingSimulation extends Simulation with WriteInstitutionProtocol {
2930
.acceptLanguageHeader("en-US,en;q=0.5")
3031
.userAgentHeader("Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0")
3132
.header("cfpb-hmda-username", "user")
32-
.header("cfpb-hmda-institutions", institutionIds.mkString(","))
33+
//.header("cfpb-hmda-institutions", institutionIds.mkString(","))
3334
.disableCaching
3435

35-
val filingScenario = scenario("HMDA Filing")
36-
.exec(http("GET Institutions")
37-
.get("/institutions")
38-
.check(
39-
status is 200
40-
))
41-
//.pause(1)
42-
// .exec(http("POST Institutions")
43-
// .post("/institutions")
44-
// //.post(Institution.empty.toJson.toString()).asJSON
45-
// .check(status is 201))
46-
47-
setUp(filingScenario.inject(
48-
rampUsers(nrOfUsers) over (rampUpTime seconds)
49-
).protocols(httpProtocol))
36+
object InstitutionScenario {
37+
38+
def list(institutionId: String) = {
39+
exec(http("Institutions")
40+
.get("/institutions")
41+
.header("cfpb-hmda-institutions", institutionId)
42+
.check(status is 200))
43+
}
44+
45+
def create(institutionId: String) = {
46+
exec(http("Create Institution")
47+
.post(s"http://$host:$adminPort/institutions")
48+
.body(StringBody(
49+
s"""
50+
{
51+
"otherLenderCode": 0,
52+
"parent": {
53+
"respondentId": "-1",
54+
"city": "",
55+
"name": "",
56+
"state": "",
57+
"idRssd": -1
58+
},
59+
"activityYear": 2017,
60+
"cra": false,
61+
"assets": 35788,
62+
"agency": "ncua",
63+
"hmdaFilerFlag": false,
64+
"respondent": {
65+
"city": "HONOLULU",
66+
"name": "HAWAIIAN ELECTRIC EMPLOYEES FEDERAL CREDIT UNION",
67+
"externalId": {
68+
"value": "1869",
69+
"externalIdType": {
70+
"code": "ncua-charter-id",
71+
"name": "NCUA Charter Number"
72+
}
73+
},
74+
"state": "HI",
75+
"fipsStateNumber": "15"
76+
},
77+
"topHolder": {
78+
"city": "",
79+
"name": "",
80+
"state": "",
81+
"country": "",
82+
"idRssd": -1
83+
},
84+
"externalIds": [
85+
{
86+
"value": ${JsString(institutionId)},
87+
"externalIdType": {
88+
"code": "rssd-id",
89+
"name": "RSSD ID"
90+
}
91+
},
92+
{
93+
"value": "0",
94+
"externalIdType": {
95+
"code": "fdic-certificate-number",
96+
"name": "FDIC Certificate Number"
97+
}
98+
},
99+
{
100+
"value": "1869",
101+
"externalIdType": {
102+
"code": "ncua-charter-id",
103+
"name": "NCUA Charter Number"
104+
}
105+
},
106+
{
107+
"value": "0",
108+
"externalIdType": {
109+
"code": "occ-charter-id",
110+
"name": "OCC Charter Number"
111+
}
112+
},
113+
{
114+
"value": "990073423",
115+
"externalIdType": {
116+
"code": "federal-tax-id",
117+
"name": "Federal Tax ID"
118+
}
119+
}
120+
],
121+
"id": ${JsString(institutionId)},
122+
"emailDomains": [
123+
""
124+
],
125+
"institutionType": "credit-union"
126+
}
127+
""".stripMargin
128+
)).asJSON)
129+
}
130+
}
131+
132+
val listInstitutions = scenario("List Institutions").exec(InstitutionScenario.list("4277"))
133+
val createInstitutions = scenario("Create Institutions").exec(InstitutionScenario.create("4277"))
134+
135+
setUp(
136+
listInstitutions.inject(
137+
atOnceUsers(1)
138+
),
139+
createInstitutions.inject(atOnceUsers(1))
140+
.protocols(httpProtocol)
141+
)
142+
50143
}

0 commit comments

Comments
 (0)