@@ -16,6 +16,7 @@ class FilingSimulation extends Simulation with WriteInstitutionProtocol {
16
16
val config = ConfigFactory .load()
17
17
val host = config.getString(" hmda.benchmark.host" )
18
18
val port = config.getInt(" hmda.benchmark.port" )
19
+ val adminPort = config.getInt(" hmda.benchmark.adminPort" )
19
20
val nrOfUsers = config.getInt(" hmda.benchmark.nrOfUsers" )
20
21
val rampUpTime = config.getInt(" hmda.benchmark.rampUpTime" )
21
22
@@ -29,22 +30,114 @@ class FilingSimulation extends Simulation with WriteInstitutionProtocol {
29
30
.acceptLanguageHeader(" en-US,en;q=0.5" )
30
31
.userAgentHeader(" Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0" )
31
32
.header(" cfpb-hmda-username" , " user" )
32
- .header(" cfpb-hmda-institutions" , institutionIds.mkString(" ," ))
33
+ // .header("cfpb-hmda-institutions", institutionIds.mkString(","))
33
34
.disableCaching
34
35
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
+
50
143
}
0 commit comments