aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEylon Malin <eylon.malin@intl.att.com>2019-10-11 00:26:05 +0300
committerEylon Malin <eylon.malin@intl.att.com>2019-10-11 00:26:05 +0300
commit809dd1050faf1bb3687807be384940ccbb28ff22 (patch)
tree2f9e8c2be8a61b05a5e45e9bad8cfc9400796a58
parent258fecdc8a7745c4085815e57a08162f248432e3 (diff)
Add ability to retrieve from simulator recorded requests and headers
Issue-ID: VID-253 Signed-off-by: Eylon Malin <eylon.malin@intl.att.com> Change-Id: Ie8dfe7216240a95d40c0d7ffdd5c69f6ddb643af
-rw-r--r--vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java b/vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java
index aae494f84..fd7033c6e 100644
--- a/vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java
+++ b/vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java
@@ -46,12 +46,18 @@ public class SimulatorApi {
com.fasterxml.jackson.databind.JsonMappingException: Can not find a (Map) Key deserializer for type
[simple type, class org.mockserver.model.NottableString]
*/
- public static class Path {
+ public static class StringWrapper {
public String value;
}
+ public static class RecordedHeaders {
+ public StringWrapper name;
+ public List<StringWrapper> values;
+ }
+
public static class HttpRequest{
- public Path path;
+ public StringWrapper path;
+ public List<RecordedHeaders> headers;
}
private static final URI uri; //uri for registration
@@ -146,12 +152,16 @@ public class SimulatorApi {
The key of the map is a path, and the value is counter
*/
public static Map<String, Long> retrieveRecordedRequestsPathCounter() {
- Response response = client.target(uri).path("retrieveRecordedRequests").request().get();
- List<HttpRequest> httpRequests = response.readEntity(new GenericType<List<HttpRequest>>(){});
+ List<HttpRequest> httpRequests = retrieveRecordedRequests();
return httpRequests.stream().map(x->x.path.value).collect(
Collectors.groupingBy(Function.identity(), Collectors.counting()));
}
+ public static List<HttpRequest> retrieveRecordedRequests() {
+ Response response = client.target(uri).path("retrieveRecordedRequests").request().get();
+ return response.readEntity(new GenericType<List<HttpRequest>>(){});
+ }
+
private static void registerToSimulatorAndAssertSuccess(String name, Object content, RegistrationStrategy registrationStrategy) {
if (registrationStrategy == RegistrationStrategy.CLEAR_THEN_SET) {
clearRegistrations();