|
19 | 19 | import org.springframework.http.ResponseEntity;
|
20 | 20 | import org.springframework.test.context.TestPropertySource;
|
21 | 21 |
|
| 22 | +import com.ericsson.ei.controller.EntryPointConstantsUtils; |
22 | 23 | import com.ericsson.ei.mongo.MongoCondition;
|
23 | 24 | import com.ericsson.ei.mongo.MongoDBHandler;
|
24 | 25 | import com.ericsson.ei.utils.FunctionalTestBase;
|
|
41 | 42 | @AutoConfigureMockMvc
|
42 | 43 | public class QueryAggregatedObjectsTestSteps extends FunctionalTestBase {
|
43 | 44 |
|
| 45 | + private static final String CONTENT_TYPE = "application/json"; |
| 46 | + |
44 | 47 | private static final Logger LOGGER = LoggerFactory.getLogger(QueryAggregatedObjectsTestSteps.class);
|
45 | 48 |
|
46 | 49 | private static final String AGGREGATED_OBJ_JSON_PATH = "src/test/resources/AggregatedDocumentInternalCompositionLatest.json";
|
@@ -79,9 +82,8 @@ public class QueryAggregatedObjectsTestSteps extends FunctionalTestBase {
|
79 | 82 |
|
80 | 83 | private ObjectMapper objMapper;
|
81 | 84 |
|
82 |
| - final static private String entryPointQueryAggregatedObject = "/queryAggregatedObject"; |
83 |
| - final static private String entryPointQuery = "/query"; |
84 |
| - final static private String entryPointFailedNotifications = "/failed-notifications"; |
| 85 | + final static private String ENTRY_POINT_QUERY = "/aggregated-objects/query"; |
| 86 | + final static private String ENTRY_POINT_FAILED_NOTIFICATIONS = "/failed-notifications"; |
85 | 87 |
|
86 | 88 | public QueryAggregatedObjectsTestSteps() {
|
87 | 89 | objMapper = new ObjectMapper();
|
@@ -124,13 +126,11 @@ public void perform_valid_query_on_newly_created_aggregated_object() throws Thro
|
124 | 126 | HttpRequest getRequest = new HttpRequest(HttpMethod.GET);
|
125 | 127 | response = getRequest.setPort(applicationPort)
|
126 | 128 | .setHost(hostName)
|
127 |
| - .addHeader("content-type", "application/json") |
128 |
| - .addHeader("Accept", "application/json") |
129 |
| - .setEndpoint(entryPointQueryAggregatedObject) |
130 |
| - .addParam("ID", documentId) |
131 |
| - .performRequest(); |
| 129 | + .addHeader("content-type", CONTENT_TYPE) |
| 130 | + .addHeader("Accept", CONTENT_TYPE) |
| 131 | + .setEndpoint(EntryPointConstantsUtils.AGGREGATED_OBJECTS + "/" + documentId).performRequest(); |
132 | 132 |
|
133 |
| - LOGGER.debug("Response of /queryAggregatedObject RestApi, Status Code: " + response.getStatusCodeValue() |
| 133 | + LOGGER.debug("Response of /aggregated-objects RestApi, Status Code: " + response.getStatusCodeValue() |
134 | 134 | + "\nResponse: " + response.getBody().toString());
|
135 | 135 |
|
136 | 136 | JsonNode jsonNodeResult = objMapper.readValue(response.getBody().toString(), JsonNode.class);
|
@@ -159,10 +159,9 @@ public void perform_invalid_query_on_created_aggregated_object() throws Throwabl
|
159 | 159 | HttpRequest getRequest = new HttpRequest(HttpMethod.GET);
|
160 | 160 | response = getRequest.setPort(applicationPort)
|
161 | 161 | .setHost(hostName)
|
162 |
| - .addHeader("content-type", "application/json") |
163 |
| - .addHeader("Accept", "application/json") |
164 |
| - .setEndpoint(entryPointQueryAggregatedObject) |
165 |
| - .addParam("ID", invalidDocumentId) |
| 162 | + .addHeader("content-type", CONTENT_TYPE) |
| 163 | + .addHeader("Accept", CONTENT_TYPE) |
| 164 | + .setEndpoint(EntryPointConstantsUtils.AGGREGATED_OBJECTS + "/" + invalidDocumentId) |
166 | 165 | .performRequest();
|
167 | 166 |
|
168 | 167 | String responseAsString = response.getBody().toString();
|
@@ -196,9 +195,9 @@ public void perform_several_valid_freestyle_queries_on_created_Aggregated_object
|
196 | 195 | HttpRequest postRequest = new HttpRequest(HttpMethod.POST);
|
197 | 196 | response = postRequest.setPort(applicationPort)
|
198 | 197 | .setHost(hostName)
|
199 |
| - .addHeader("content-type", "application/json") |
200 |
| - .addHeader("Accept", "application/json") |
201 |
| - .setEndpoint(entryPointQuery) |
| 198 | + .addHeader("content-type", CONTENT_TYPE) |
| 199 | + .addHeader("Accept", CONTENT_TYPE) |
| 200 | + .setEndpoint(ENTRY_POINT_QUERY) |
202 | 201 | .setBody(formattedQuery)
|
203 | 202 | .performRequest();
|
204 | 203 |
|
@@ -231,9 +230,9 @@ public void perform_invalid_freestyle_query_on_created_aggregated_object() throw
|
231 | 230 | HttpRequest getRequest = new HttpRequest(HttpMethod.POST);
|
232 | 231 | response = getRequest.setPort(applicationPort)
|
233 | 232 | .setHost(hostName)
|
234 |
| - .addHeader("content-type", "application/json") |
235 |
| - .addHeader("Accept", "application/json") |
236 |
| - .setEndpoint(entryPointQuery) |
| 233 | + .addHeader("content-type", CONTENT_TYPE) |
| 234 | + .addHeader("Accept", CONTENT_TYPE) |
| 235 | + .setEndpoint(ENTRY_POINT_QUERY) |
237 | 236 | .setBody(queryAggrObj)
|
238 | 237 | .performRequest();
|
239 | 238 |
|
@@ -268,9 +267,9 @@ public void perform_a_query_for_missed_notification() throws Throwable {
|
268 | 267 | HttpRequest getRequest = new HttpRequest(HttpMethod.GET);
|
269 | 268 | response = getRequest.setPort(applicationPort)
|
270 | 269 | .setHost(hostName)
|
271 |
| - .addHeader("content-type", "application/json") |
272 |
| - .addHeader("Accept", "application/json") |
273 |
| - .setEndpoint(entryPointFailedNotifications) |
| 270 | + .addHeader("content-type", CONTENT_TYPE) |
| 271 | + .addHeader("Accept", CONTENT_TYPE) |
| 272 | + .setEndpoint(ENTRY_POINT_FAILED_NOTIFICATIONS) |
274 | 273 | .addParam("subscriptionName", subscriptionName)
|
275 | 274 | .performRequest();
|
276 | 275 |
|
@@ -306,9 +305,9 @@ public void check_missed_notification_has_been_returned() throws Throwable {
|
306 | 305 | HttpRequest getRequest = new HttpRequest(HttpMethod.GET);
|
307 | 306 | response = getRequest.setPort(applicationPort)
|
308 | 307 | .setHost(hostName)
|
309 |
| - .addHeader("content-type", "application/json") |
310 |
| - .addHeader("Accept", "application/json") |
311 |
| - .setEndpoint(entryPointFailedNotifications) |
| 308 | + .addHeader("content-type", CONTENT_TYPE) |
| 309 | + .addHeader("Accept", CONTENT_TYPE) |
| 310 | + .setEndpoint(ENTRY_POINT_FAILED_NOTIFICATIONS) |
312 | 311 | .addParam("SubscriptionName", subscriptionName)
|
313 | 312 | .performRequest();
|
314 | 313 |
|
@@ -338,9 +337,9 @@ public void perform_valid_query_and_filter_on_aggregated_object() throws Throwab
|
338 | 337 | HttpRequest postRequest = new HttpRequest(HttpMethod.POST);
|
339 | 338 | response = postRequest.setPort(applicationPort)
|
340 | 339 | .setHost(hostName)
|
341 |
| - .addHeader("content-type", "application/json") |
342 |
| - .addHeader("Accept", "application/json") |
343 |
| - .setEndpoint(entryPointQuery) |
| 340 | + .addHeader("content-type", CONTENT_TYPE) |
| 341 | + .addHeader("Accept", CONTENT_TYPE) |
| 342 | + .setEndpoint(ENTRY_POINT_QUERY) |
344 | 343 | .setBody(query)
|
345 | 344 | .performRequest();
|
346 | 345 |
|
@@ -382,9 +381,9 @@ public void perform__query_and_filter_with_part_of_path() throws Throwable {
|
382 | 381 | HttpRequest postRequest = new HttpRequest(HttpMethod.POST);
|
383 | 382 | response = postRequest.setPort(applicationPort)
|
384 | 383 | .setHost(hostName)
|
385 |
| - .addHeader("content-type", "application/json") |
386 |
| - .addHeader("Accept", "application/json") |
387 |
| - .setEndpoint(entryPointQuery ) |
| 384 | + .addHeader("content-type", CONTENT_TYPE) |
| 385 | + .addHeader("Accept", CONTENT_TYPE) |
| 386 | + .setEndpoint(ENTRY_POINT_QUERY) |
388 | 387 | .setBody(query)
|
389 | 388 | .performRequest();
|
390 | 389 |
|
@@ -415,13 +414,14 @@ public void perform_query_to_retrieve_and_filter_out_confidence_level_informatio
|
415 | 414 | HttpRequest postRequest = new HttpRequest(HttpMethod.POST);
|
416 | 415 | response = postRequest.setPort(applicationPort)
|
417 | 416 | .setHost(hostName)
|
418 |
| - .addHeader("content-type", "application/json") |
419 |
| - .addHeader("Accept", "application/json") |
420 |
| - .setEndpoint(entryPointQuery) |
| 417 | + .addHeader("content-type", CONTENT_TYPE) |
| 418 | + .addHeader("Accept", CONTENT_TYPE) |
| 419 | + .setEndpoint(ENTRY_POINT_QUERY) |
421 | 420 | .setBody(formattedQuery)
|
422 | 421 | .performRequest();
|
423 | 422 |
|
424 |
| - LOGGER.debug("Response of /query RestApi, Status Code: " + response.getStatusCodeValue() + "\nResponse: " |
| 423 | + LOGGER.debug("Response of /aggregated-objects/query RestApi, Status Code: " + response.getStatusCodeValue() |
| 424 | + + "\nResponse: " |
425 | 425 | + response.getBody().toString());
|
426 | 426 |
|
427 | 427 | JsonNode jsonNodeResult = objMapper.readValue(response.getBody().toString(), JsonNode.class);
|
|
0 commit comments