diff --git a/.github/coveragereport/badge_linecoverage.svg b/.github/coveragereport/badge_linecoverage.svg index 22764e15..0ce9a497 100644 --- a/.github/coveragereport/badge_linecoverage.svg +++ b/.github/coveragereport/badge_linecoverage.svg @@ -100,7 +100,7 @@ Coverage Coverage - 95.1%95.1% + 95.2%95.2% diff --git a/.github/coveragereport/badge_methodcoverage.svg b/.github/coveragereport/badge_methodcoverage.svg index 0f8b6dad..39e9e4a9 100644 --- a/.github/coveragereport/badge_methodcoverage.svg +++ b/.github/coveragereport/badge_methodcoverage.svg @@ -102,7 +102,7 @@ Coverage - 93.6%93.6% + 93.7%93.7% diff --git a/cwms-radar-client/src/main/java/mil/army/usace/hec/cwms/radar/client/controllers/TimeSeriesProfileInstanceEndpointInput.java b/cwms-radar-client/src/main/java/mil/army/usace/hec/cwms/radar/client/controllers/TimeSeriesProfileInstanceEndpointInput.java index 26fb5a80..a5c07fcb 100644 --- a/cwms-radar-client/src/main/java/mil/army/usace/hec/cwms/radar/client/controllers/TimeSeriesProfileInstanceEndpointInput.java +++ b/cwms-radar-client/src/main/java/mil/army/usace/hec/cwms/radar/client/controllers/TimeSeriesProfileInstanceEndpointInput.java @@ -20,8 +20,8 @@ public static GetAll getAll() { return new GetAll(); } - public static GetOne getOne(String officeId, String locationId, String parameterId, String version, List unit) { - return new GetOne(officeId, locationId, parameterId, version, unit); + public static GetOne getOne(String officeId, String locationId, String parameterId, String version, List unit, Instant start, Instant end) { + return new GetOne(officeId, locationId, parameterId, version, unit, start, end); } public static Post post(String profileData, TimeSeriesProfile profile, String version) { @@ -101,19 +101,20 @@ public static final class GetOne extends EndpointInput { private boolean previous = false; private boolean next = false; private boolean maxVersion = false; - private Instant start = Instant.now(); - private Instant end = Instant.now(); + private final Instant start; + private final Instant end; private final String locationId; private String page; private int pageSize = 500; - private GetOne(String officeId, String locationId, String parameterId, String version, List unit) { + private GetOne(String officeId, String locationId, String parameterId, String version, List unit, Instant start, Instant end) { this.officeId = Objects.requireNonNull(officeId, "Office is required"); this.locationId = Objects.requireNonNull(locationId, "Location ID is required"); this.parameterId = Objects.requireNonNull(parameterId, "Parameter ID is required"); this.version = Objects.requireNonNull(version, "Version is required"); this.unit = Objects.requireNonNull(unit,"Unit is required"); - + this.start = Objects.requireNonNull(start, "Start is required"); + this.end = Objects.requireNonNull(end, "End is required"); } public GetOne versionDate(Instant versionDate) { @@ -151,16 +152,6 @@ public GetOne maxVersion(boolean maxVersion) { return this; } - public GetOne start(Instant start) { - this.start = start; - return this; - } - - public GetOne end(Instant end) { - this.end = end; - return this; - } - public GetOne page(String page) { this.page = page; return this; diff --git a/cwms-radar-client/src/test/java/mil/army/usace/hec/cwms/radar/client/controllers/TestTimeSeriesProfileInstanceController.java b/cwms-radar-client/src/test/java/mil/army/usace/hec/cwms/radar/client/controllers/TestTimeSeriesProfileInstanceController.java index ec6ed81d..49c360bb 100644 --- a/cwms-radar-client/src/test/java/mil/army/usace/hec/cwms/radar/client/controllers/TestTimeSeriesProfileInstanceController.java +++ b/cwms-radar-client/src/test/java/mil/army/usace/hec/cwms/radar/client/controllers/TestTimeSeriesProfileInstanceController.java @@ -19,9 +19,12 @@ void testGetOne() throws IOException { mockHttpServer.enqueue(collect); mockHttpServer.start(); List parameterList = List.of("F", "m"); + Instant firstDate = Instant.ofEpochMilli(1594296000000L); + Instant lastDate = Instant.ofEpochMilli(1752062400000L); TimeSeriesProfileInstanceEndpointInput.GetOne input = TimeSeriesProfileInstanceEndpointInput .getOne("SWT", "Test_TSP_Location", "Depth", "DSS-Obs", - parameterList).page("CWMSTESTPAGE").pageSize(50); + parameterList, firstDate, lastDate) + .page("CWMSTESTPAGE").pageSize(50); TimeSeriesProfileInstance value = new TimeSeriesProfileInstanceController() .retrieveTimeSeriesProfileInstance(buildConnectionInfo(), input); assertNotNull(value); @@ -31,6 +34,8 @@ void testGetOne() throws IOException { assertEquals("Depth", value.getTimeSeriesProfile().getKeyParameter()); assertEquals("Description", value.getTimeSeriesProfile().getDescription()); assertEquals("SWT", value.getTimeSeriesProfile().getLocationId().getOfficeId()); + assertEquals(firstDate, value.getFirstDate().toInstant()); + assertEquals(lastDate, value.getLastDate().toInstant()); assertEquals(parameterList.get(0), value.getParameterColumns().get(0).getUnit()); assertEquals(parameterList.get(1), value.getParameterColumns().get(1).getUnit()); } diff --git a/cwms-radar-client/src/test/java/mil/army/usace/hec/cwms/radar/client/controllers/TestTimeSeriesProfileInstanceEndpointInput.java b/cwms-radar-client/src/test/java/mil/army/usace/hec/cwms/radar/client/controllers/TestTimeSeriesProfileInstanceEndpointInput.java index d83eb96e..865262d3 100644 --- a/cwms-radar-client/src/test/java/mil/army/usace/hec/cwms/radar/client/controllers/TestTimeSeriesProfileInstanceEndpointInput.java +++ b/cwms-radar-client/src/test/java/mil/army/usace/hec/cwms/radar/client/controllers/TestTimeSeriesProfileInstanceEndpointInput.java @@ -25,9 +25,11 @@ void testGetAllQueryRequest() { String locationMask = "*LOC*"; String officeMask = "SPK"; String parameterMask = "*PAR*"; - GetAll input = TimeSeriesProfileInstanceEndpointInput.getAll() + String versionMask = "1"; + GetAll input = TimeSeriesProfileInstanceEndpointInput.getAll().versionMask(versionMask) .locationMask(locationMask).officeMask(officeMask).parameterMask(parameterMask); input.addInputParameters(mockHttpRequestBuilder); + assertEquals(versionMask, mockHttpRequestBuilder.getQueryParameter(GetAll.VERSION_QUERY_PARAMETER)); assertEquals(ACCEPT_HEADER_V1, mockHttpRequestBuilder.getQueryHeader(ACCEPT_QUERY_HEADER)); assertEquals(locationMask, mockHttpRequestBuilder.getQueryParameter(GetAll.LOCATION_MASK_QUERY_PARAMETER)); assertEquals(officeMask, mockHttpRequestBuilder.getQueryParameter(GetAll.OFFICE_MASK_QUERY_PARAMETER)); @@ -53,8 +55,8 @@ void testGetOneQueryRequest() { String timezone = "PST"; boolean maxVersion = true; Instant versionDate = Instant.now(); - GetOne input = TimeSeriesProfileInstanceEndpointInput.getOne(office, timeSeriesId, parameter, version, unit) - .startInclusive(startInclusive).endInclusive(endInclusive).start(start).end(end).next(next) + GetOne input = TimeSeriesProfileInstanceEndpointInput.getOne(office, timeSeriesId, parameter, version, unit, start, end) + .startInclusive(startInclusive).endInclusive(endInclusive).next(next) .previous(previous).maxVersion(maxVersion).timezone(timezone).versionDate(versionDate) .page(page).pageSize(pageSize); input.addInputParameters(mockHttpRequestBuilder); @@ -98,7 +100,7 @@ void testPostQueryRequest() throws Exception { .method(method).versionDate(versionDate).overrideProtection(overrideProtection); input.addInputParameters(mockHttpRequestBuilder); assertEquals(ACCEPT_HEADER_V1, mockHttpRequestBuilder.getQueryHeader(ACCEPT_QUERY_HEADER)); - assertEquals(profileData, mockHttpRequestBuilder.getQueryParameter(Post.PROFILE_DATA_QUERY_PARAMETER)); + assertEquals(profileData, input.profileData()); assertEquals(RadarObjectMapper.mapObjectToJson(profile), RadarObjectMapper.mapObjectToJson(input.profile())); assertEquals(version, mockHttpRequestBuilder.getQueryParameter(Post.VERSION_QUERY_PARAMETER)); assertEquals(method, mockHttpRequestBuilder.getQueryParameter(Post.METHOD_QUERY_PARAMETER));