Skip to content

Commit

Permalink
Updated DTOs, test data, test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
zack-rma committed Nov 22, 2024
1 parent 75cad0a commit ea63671
Show file tree
Hide file tree
Showing 8 changed files with 2,576 additions and 538 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,21 @@ void testRetrieveAll() throws IOException {
Instant startTime = Instant.ofEpochMilli(10000012648000L);
Instant endTime = Instant.ofEpochSecond(10000016484000L);
WaterPumpAccountingEndpointInput.GetAll input = WaterPumpAccountingEndpointInput
.getAll("SWT", "SACRAMENTO", "Test User", "TEST_CONTRACT", startTime, endTime);
.getAll("SPK", "SACRAMENTO", "California Department of Water Resources", "Sac. River Contract", startTime, endTime);
List<WaterSupplyAccounting> values = new WaterPumpAccountingController()
.retrieveWaterPumpAccounting(buildConnectionInfo(cookieJarSupplier), input);
assertFalse(values.isEmpty());
WaterSupplyAccounting value = values.get(0);
assertEquals("TEST_CONTRACT", value.getContractName());
assertEquals("SWT", value.getWaterUser().getProjectId().getOfficeId());
assertEquals("SACRAMENTO", value.getWaterUser().getProjectId().getName());
assertEquals("Test Water Right", value.getWaterUser().getWaterRight());
assertEquals("PUMP3", value.getPumpAccounting().get(0).getPumpLocation().getName());
assertEquals("PUMP1", value.getPumpAccounting().get(1).getPumpLocation().getName());
assertEquals("Test Transfer Type", value.getPumpAccounting().get(0).getTransferType().getDisplayValue());
assertEquals(1.0, value.getPumpAccounting().get(0).getFlow());
assertEquals(2.0, value.getPumpAccounting().get(1).getFlow());
assertEquals("Test Comment 2", value.getPumpAccounting().get(1).getComment());
assertEquals(Instant.ofEpochMilli(10000012648000L), value.getPumpAccounting().get(0).getTransferDate());
assertEquals(Instant.ofEpochMilli(10000016484000L), value.getPumpAccounting().get(1).getTransferDate());
assertEquals("Sac. River Contract", value.getContractName());
assertEquals("SPK", value.getWaterUser().getProjectId().getOfficeId());
assertEquals("Sacramento River Delta", value.getWaterUser().getProjectId().getName());
assertEquals("State of California Water Rights Permit #12345", value.getWaterUser().getWaterRight());
assertEquals("Sacramento River Delta-Dam Water Pump 3", value.getPumpLocations().getPumpBelow().getName());
assertEquals("Sacramento River Delta-Dam Water Pump 1", value.getPumpLocations().getPumpIn().getName());
assertEquals("Pipeline", value.getPumpAccounting().get(Instant.parse("2022-11-20T21:17:28Z")).get(0).getTransferTypeDisplay());
assertEquals(1.0, value.getPumpAccounting().get(Instant.parse("2022-11-20T21:17:28Z")).get(0).getFlow());
assertEquals(2.0, value.getPumpAccounting().get(Instant.parse("2022-11-20T21:17:28Z")).get(1).getFlow());
assertEquals("Added water to the system", value.getPumpAccounting().get(Instant.parse("2022-11-20T21:17:28Z")).get(0).getComment());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,43 +1,87 @@
{
"contract-name": "TEST_CONTRACT",
"contract-name": "Sac. River Contract",
"water-user": {
"entity-name": "Test User",
"entity-name": "California Department of Water Resources",
"project-id": {
"name": "SACRAMENTO",
"office-id": "SWT"
"office-id": "SPK",
"name": "Sacramento River Delta"
},
"water-right": "Test Water Right"
"water-right": "State of California Water Rights Permit #12345"
},
"pump-accounting": [
{
"pump-location": {
"office-id": "SWT",
"name": "PUMP3"
"pump-locations": {
"pump-in": {
"office-id": "SPK",
"name": "Sacramento River Delta-Dam Water Pump 1"
},
"pump-out": {
"office-id": "SPK",
"name": "Sacramento River Delta-Dam Water Pump 2"
},
"pump-below": {
"office-id": "SPK",
"name": "Sacramento River Delta-Dam Water Pump 3"
}
},
"pump-accounting": {
"2022-11-20T21:17:28Z": [
{
"pump-type": "IN",
"transfer-type-display": "Pipeline",
"flow": 1.0,
"comment": "Added water to the system"
},
"transfer-type": {
"office-id": "SWT",
"display-value": "Test Transfer Type",
"tooltip": "Test Tool Tip",
"active": true
{
"pump-type": "OUT",
"transfer-type-display": "Pipeline",
"flow": 2.0,
"comment": "Removed excess water"
},
"flow": 1.0,
"transfer-date": 10000012648000,
"comment": "Test Comment"
},
{
"pump-location": {
"office-id": "SWT",
"name": "PUMP1"
{
"pump-type": "BELOW",
"transfer-type-display": "River",
"flow": 3.0,
"comment": "Daily water release"
}
],
"2022-11-21T21:17:28Z": [
{
"pump-type": "IN",
"transfer-type-display": "Pipeline",
"flow": 4.0,
"comment": "Pump transfer for the day"
},
"transfer-type": {
"office-id": "SWT",
"display-value": "Test Transfer Type",
"tooltip": "Test Tool Tip",
"active": true
{
"pump-type": "OUT",
"transfer-type-display": "Pipeline",
"flow": 5.0,
"comment": "Excess water transfer"
},
"flow": 2.0,
"transfer-date": 10000016484000,
"comment": "Test Comment 2"
}
]
}
{
"pump-type": "BELOW",
"transfer-type-display": "River",
"flow": 6.0,
"comment": "Water returned to the river"
}
],
"2022-11-22T21:17:28Z": [
{
"pump-type": "IN",
"transfer-type-display": "Pipeline",
"flow": 7.0,
"comment": "Pump transfer for the day"
},
{
"pump-type": "OUT",
"transfer-type-display": "Pipeline",
"flow": 8.0,
"comment": "Excess water transfer"
},
{
"pump-type": "BELOW",
"transfer-type-display": "River",
"flow": 9.0,
"comment": "Water returned to the river"
}
]
}
}
Original file line number Diff line number Diff line change
@@ -1,45 +1,89 @@
[
{
"contract-name": "TEST_CONTRACT",
"contract-name": "Sac. River Contract",
"water-user": {
"entity-name": "Test User",
"entity-name": "California Department of Water Resources",
"project-id": {
"name": "SACRAMENTO",
"office-id": "SWT"
"office-id": "SPK",
"name": "Sacramento River Delta"
},
"water-right": "Test Water Right"
"water-right": "State of California Water Rights Permit #12345"
},
"pump-accounting": [
{
"pump-location": {
"office-id": "SWT",
"name": "PUMP3"
"pump-locations": {
"pump-in": {
"office-id": "SPK",
"name": "Sacramento River Delta-Dam Water Pump 1"
},
"pump-out": {
"office-id": "SPK",
"name": "Sacramento River Delta-Dam Water Pump 2"
},
"pump-below": {
"office-id": "SPK",
"name": "Sacramento River Delta-Dam Water Pump 3"
}
},
"pump-accounting": {
"2022-11-20T21:17:28Z": [
{
"pump-type": "IN",
"transfer-type-display": "Pipeline",
"flow": 1.0,
"comment": "Added water to the system"
},
"transfer-type": {
"office-id": "SWT",
"display-value": "Test Transfer Type",
"tooltip": "Test Tool Tip",
"active": true
{
"pump-type": "OUT",
"transfer-type-display": "Pipeline",
"flow": 2.0,
"comment": "Removed excess water"
},
"flow": 1.0,
"transfer-date": 10000012648000,
"comment": "Test Comment"
},
{
"pump-location": {
"office-id": "SWT",
"name": "PUMP1"
{
"pump-type": "BELOW",
"transfer-type-display": "River",
"flow": 3.0,
"comment": "Daily water release"
}
],
"2022-11-21T21:17:28Z": [
{
"pump-type": "IN",
"transfer-type-display": "Pipeline",
"flow": 4.0,
"comment": "Pump transfer for the day"
},
"transfer-type": {
"office-id": "SWT",
"display-value": "Test Transfer Type",
"tooltip": "Test Tool Tip",
"active": true
{
"pump-type": "OUT",
"transfer-type-display": "Pipeline",
"flow": 5.0,
"comment": "Excess water transfer"
},
"flow": 2.0,
"transfer-date": 10000016484000,
"comment": "Test Comment 2"
}
]
{
"pump-type": "BELOW",
"transfer-type-display": "River",
"flow": 6.0,
"comment": "Water returned to the river"
}
],
"2022-11-22T21:17:28Z": [
{
"pump-type": "IN",
"transfer-type-display": "Pipeline",
"flow": 7.0,
"comment": "Pump transfer for the day"
},
{
"pump-type": "OUT",
"transfer-type-display": "Pipeline",
"flow": 8.0,
"comment": "Excess water transfer"
},
{
"pump-type": "BELOW",
"transfer-type-display": "River",
"flow": 9.0,
"comment": "Water returned to the river"
}
]
}
}
]
Loading

0 comments on commit ea63671

Please sign in to comment.