@@ -131,6 +131,44 @@ void test_location_level() throws Exception {
131
131
.body ("constant-value" ,equalTo (1.0F ));
132
132
}
133
133
134
+ @ Test
135
+ void test_retrieve_effective_date () throws Exception {
136
+ createLocation ("level_with_effective_date" , true , OFFICE );
137
+ String levelId = "level_with_effective_date.Stor.Ave.1Day.Regulating" ;
138
+ ZonedDateTime time = ZonedDateTime .of (2023 , 6 , 1 , 0 , 0 , 0 , 0 , ZoneId .of ("America/Los_Angeles" ));
139
+ CwmsDataApiSetupCallback .getDatabaseLink ().connection (c -> {
140
+ LocationLevel level = new LocationLevel .Builder (levelId , time )
141
+ .withOfficeId (OFFICE )
142
+ .withConstantValue (1.0 )
143
+ .withLevelUnitsId ("ft" )
144
+ .build ();
145
+ levelList .add (level );
146
+ DSLContext dsl = dslContext (c , OFFICE );
147
+ LocationLevelsDaoImpl dao = new LocationLevelsDaoImpl (dsl );
148
+ dao .storeLocationLevel (level );
149
+ });
150
+
151
+ ExtractableResponse <Response > response = given ()
152
+ .log ().ifValidationFails (LogDetail .ALL , true )
153
+ .accept (Formats .JSONV2 )
154
+ .contentType (Formats .JSONV2 )
155
+ .queryParam (Controllers .OFFICE , OFFICE )
156
+ .queryParam (LEVEL_ID_MASK , "level_get_all_loc_*" )
157
+ .queryParam (BEGIN , "2020-06-01T00:00:00Z" )
158
+ .when ()
159
+ .redirects ().follow (true )
160
+ .redirects ().max (3 )
161
+ .get ("/levels/" )
162
+ .then ()
163
+ .log ().ifValidationFails (LogDetail .ALL , true )
164
+ .assertThat ()
165
+ .statusCode (is (HttpServletResponse .SC_OK ))
166
+ .extract ();
167
+
168
+ assertEquals ("2023-06-01T07:00:00Z" , response .path ("levels[0].level-date" ));
169
+ }
170
+
171
+
134
172
@ Test
135
173
void test_retrieve_time_window () throws Exception {
136
174
createLocation ("level_get_all_loc_1" , true , OFFICE );
0 commit comments