11package io .kontur .disasterninja .client ;
22
3+ import io .kontur .disasterninja .dto .GeometryFilterType ;
34import io .kontur .disasterninja .dto .eventapi .EventApiEventDto ;
45import org .junit .jupiter .api .Test ;
56import org .springframework .beans .factory .annotation .Autowired ;
@@ -49,7 +50,8 @@ public void testGetEventsWithoutBbox() {
4950server .expect (ExpectedCount .times (2 ),r ->assertThat (r .getURI ().toString (),
5051matchesRegex (Pattern .compile (
5152"/v1/\\ ?feed=testFeedName&severities=EXTREME,SEVERE,MODERATE&limit=1000" +
52- "&episodeFilterType=NONE&sortOrder=ASC&after=\\ d{4}-\\ d{2}-\\ d{2}[tT]\\ d{2}:\\ d{2}:\\ d{2}.\\ d+Z" ))))
53+ "&episodeFilterType=NONE&sortOrder=ASC&geometryFilterType=ALL" +
54+ "&after=\\ d{4}-\\ d{2}-\\ d{2}[tT]\\ d{2}:\\ d{2}:\\ d{2}.\\ d+Z" ))))
5355 .andExpect (method (HttpMethod .GET ))
5456 .andExpect (header (HttpHeaders .AUTHORIZATION ,"Bearer " +getUserToken ()))
5557 .andRespond (r -> {
@@ -76,7 +78,8 @@ public void testGetEventsTruncateAfterToHours() {
7678server .expect (ExpectedCount .times (2 ),r ->assertThat (r .getURI ().toString (),
7779matchesRegex (Pattern .compile (
7880"/v1/\\ ?feed=testFeedName&severities=EXTREME,SEVERE,MODERATE&limit=1000" +
79- "&episodeFilterType=NONE&sortOrder=ASC&after=\\ d{4}-\\ d{2}-\\ d{2}[tT]\\ d{2}:00:00Z" ))))
81+ "&episodeFilterType=NONE&sortOrder=ASC&geometryFilterType=ALL" +
82+ "&after=\\ d{4}-\\ d{2}-\\ d{2}[tT]\\ d{2}:00:00Z" ))))
8083 .andExpect (method (HttpMethod .GET ))
8184 .andExpect (header (HttpHeaders .AUTHORIZATION ,"Bearer " +getUserToken ()))
8285 .andRespond (r -> {
@@ -104,7 +107,8 @@ public void testGetEventsWithBbox() {
104107server .expect (ExpectedCount .times (2 ),r ->assertThat (r .getURI ().toString (),
105108matchesRegex (Pattern .compile (
106109"/v1/\\ ?feed=testFeedName&severities=EXTREME,SEVERE,MODERATE&limit=1000" +
107- "&episodeFilterType=NONE&sortOrder=DESC&after=\\ d{4}-\\ d{2}-\\ d{2}[tT]\\ d{2}:\\ d{2}:\\ d{2}.\\ d+Z" +
110+ "&episodeFilterType=NONE&sortOrder=DESC&geometryFilterType=ALL" +
111+ "&after=\\ d{4}-\\ d{2}-\\ d{2}[tT]\\ d{2}:\\ d{2}:\\ d{2}.\\ d+Z" +
108112"&bbox=1.1&bbox=2.2&bbox=3.3&bbox=4.4" ))))
109113 .andExpect (method (HttpMethod .GET ))
110114 .andExpect (header (HttpHeaders .AUTHORIZATION ,"Bearer " +getUserToken ()))
@@ -133,7 +137,8 @@ public void testGetEventsWithoutAfter() {
133137server .expect (ExpectedCount .times (2 ),r ->assertThat (r .getURI ().toString (),
134138matchesRegex (Pattern .compile (
135139"/v1/\\ ?feed=testFeedName&severities=EXTREME,SEVERE,MODERATE&limit=1000" +
136- "&episodeFilterType=NONE&sortOrder=ASC&bbox=1.1&bbox=2.2&bbox=3.3&bbox=4.4" ))))
140+ "&episodeFilterType=NONE&sortOrder=ASC&geometryFilterType=ALL" +
141+ "&bbox=1.1&bbox=2.2&bbox=3.3&bbox=4.4" ))))
137142 .andExpect (method (HttpMethod .GET ))
138143 .andExpect (header (HttpHeaders .AUTHORIZATION ,"Bearer " +getUserToken ()))
139144 .andRespond (r -> {
@@ -184,14 +189,14 @@ public void testGetEvent() throws IOException {
184189//given
185190givenJwtTokenIs ("JwtTestToken" );
186191server .expect (ExpectedCount .once (),
187- requestTo ("/v1/event?feed=testFeedName&eventId=1ec05e2b-7d18-490c-ac9f-c33609fdc7a7&episodeFilterType=ANY" ))
192+ requestTo ("/v1/event?feed=testFeedName&eventId=1ec05e2b-7d18-490c-ac9f-c33609fdc7a7&episodeFilterType=ANY&geometryFilterType=ALL " ))
188193 .andExpect (method (HttpMethod .GET ))
189194 .andExpect (header ("Authorization" ,"Bearer " +getUserToken ()))
190195 .andRespond (withSuccess (readFile (this ,"EventApiClientTest.testGetEvent.response.json" ),
191196MediaType .APPLICATION_JSON ));
192197//when
193198EventApiEventDto event =client .getEvent (UUID .fromString ("1ec05e2b-7d18-490c-ac9f-c33609fdc7a7" ),
194- "testFeedName" ,true );
199+ "testFeedName" ,true , GeometryFilterType . ALL );
195200
196201//then
197202verify (securityContext ,times (1 )).getAuthentication ();
@@ -204,14 +209,14 @@ public void testGetEventWithoutEpisodes() throws IOException {
204209//given
205210givenJwtTokenIs ("JwtTestToken" );
206211server .expect (ExpectedCount .once (),
207- requestTo ("/v1/event?feed=testFeedName&eventId=1ec05e2b-7d18-490c-ac9f-c33609fdc7a7&episodeFilterType=NONE" ))
212+ requestTo ("/v1/event?feed=testFeedName&eventId=1ec05e2b-7d18-490c-ac9f-c33609fdc7a7&episodeFilterType=NONE&geometryFilterType=ALL " ))
208213 .andExpect (method (HttpMethod .GET ))
209214 .andExpect (header ("Authorization" ,"Bearer " +getUserToken ()))
210215 .andRespond (withSuccess (readFile (this ,"EventApiClientTest.testGetEvent.response.json" ),
211216MediaType .APPLICATION_JSON ));
212217//when
213218EventApiEventDto event =client .getEvent (UUID .fromString ("1ec05e2b-7d18-490c-ac9f-c33609fdc7a7" ),
214- "testFeedName" ,false );
219+ "testFeedName" ,false , GeometryFilterType . ALL );
215220
216221//then
217222verify (securityContext ,times (1 )).getAuthentication ();