Skip to content

Commit

Permalink
commented out code removed
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebrownccd committed Dec 7, 2023
1 parent 7316408 commit 4894472
Showing 1 changed file with 0 additions and 163 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,6 @@ public void resetRequests() {
resetAllRequests();
}

// public void stubRoleAssignmentServiceWithStatus(HttpStatus status) throws JsonProcessingException {
// WIRE_MOCK_SERVER.stubFor(post(urlEqualTo("/am/role-assignments"))
// .willReturn(aResponse()
// .withStatus(status.value())
// .withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE)
// .withBody(OBJECT_MAPPER.writeValueAsString(getRoleAssignmentRequestResource()))));
// }

private RoleAssignmentRequestResource getRoleAssignmentRequestResource() {
var roleAssignmentRequestResource =
new RoleAssignmentRequestResource(AssignmentRequestBuilder.buildAssignmentRequest(false));
Expand All @@ -72,97 +64,6 @@ public void stubRoleAssignmentServiceError() throws JsonProcessingException {
.withBody(OBJECT_MAPPER.writeValueAsString(request))));
}

// public void stubForGetCaseworkerDetailsById(UserRequest userRequest,
// List<CaseWorkerProfile> response) throws JsonProcessingException {
//
// WIRE_MOCK_SERVER.stubFor(post(urlPathMatching("/refdata/case-worker/users/fetchUsersById"))
// .withRequestBody(new EqualToJsonPattern(
// OBJECT_MAPPER.writeValueAsString(userRequest),
// true,
// true)
// ).willReturn(aResponse()
// .withStatus(CREATED.value())
// .withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE)
// .withBody(OBJECT_MAPPER.writeValueAsString(response))));
// }
//
// public void stubForGetCaseworkerDetailsByServiceName(List<CaseWorkerProfilesResponse> response)
// throws JsonProcessingException {
//
// WIRE_MOCK_SERVER.stubFor(get(urlPathMatching("/refdata/internal/staff/usersByServiceName"))
// .withQueryParam("ccd_service_names", equalTo("IA"))
// .withQueryParam("page_size", equalTo("400"))
// .withQueryParam("page_number", equalTo("0"))
// .withQueryParam("sort_direction", equalTo("ASC"))
// .withQueryParam("sort_column", equalTo(""))
// .willReturn(aResponse()
// .withStatus(OK.value())
// .withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE)
// .withHeader("total_records", "2")
// .withBody(OBJECT_MAPPER.writeValueAsString(response))));
// }
//
// public void stubForFailureGetCaseworkerDetailsByServiceName() throws JsonProcessingException {
//
// WIRE_MOCK_SERVER.stubFor(get(urlPathMatching("/refdata/internal/staff/usersByServiceName"))
// .withQueryParam("ccd_service_names", equalTo("IA"))
// .withQueryParam("page_size", equalTo("400"))
// .withQueryParam("page_number", equalTo("0"))
// .withQueryParam("sort_direction", equalTo("ASC"))
// .withQueryParam("sort_column", equalTo(""))
// .willReturn(badRequest().withBody("user not found")));
// }
//
// public void stubForFailureRetryAndSuccessGetCaseworkerDetailsByServiceName(
// List<CaseWorkerProfilesResponse> response) throws JsonProcessingException {
//
// WIRE_MOCK_SERVER.stubFor(get(urlPathMatching("/refdata/internal/staff/usersByServiceName"))
// .withQueryParam("ccd_service_names", equalTo("IA"))
// .withQueryParam("page_size", equalTo("400"))
// .withQueryParam("page_number", equalTo("0"))
// .withQueryParam("sort_direction", equalTo("ASC"))
// .withQueryParam("sort_column", equalTo(""))
// .inScenario("multiple retries")
// .whenScenarioStateIs(STARTED)
// .willSetStateTo("secondRetry")
// .willReturn(badRequest().withBody("user not found")));
//
// WIRE_MOCK_SERVER.stubFor(get(urlPathMatching("/refdata/internal/staff/usersByServiceName"))
// .withQueryParam("ccd_service_names", equalTo("IA"))
// .withQueryParam("page_size", equalTo("400"))
// .withQueryParam("page_number", equalTo("0"))
// .withQueryParam("sort_direction", equalTo("ASC"))
// .withQueryParam("sort_column", equalTo(""))
// .inScenario("multiple retries")
// .whenScenarioStateIs("secondRetry")
// .willSetStateTo("success")
// .willReturn(badRequest().withBody("user not found")));
//
// WIRE_MOCK_SERVER.stubFor(get(urlPathMatching("/refdata/internal/staff/usersByServiceName"))
// .withQueryParam("ccd_service_names", equalTo("IA"))
// .withQueryParam("page_size", equalTo("400"))
// .withQueryParam("page_number", equalTo("0"))
// .withQueryParam("sort_direction", equalTo("ASC"))
// .withQueryParam("sort_column", equalTo(""))
// .inScenario("multiple retries")
// .whenScenarioStateIs("success")
// .willSetStateTo(STARTED)
// .willReturn(aResponse()
// .withStatus(OK.value())
// .withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE)
// .withHeader("total_records", "2")
// .withBody(OBJECT_MAPPER.writeValueAsString(response))));
// }
//
// public void stubForGetJudicialDetailsById(HttpStatus status, String userId) throws JsonProcessingException {
// WIRE_MOCK_SERVER.stubFor(post(urlPathMatching("/refdata/judicial/users"))
// .willReturn(aResponse()
// .withStatus(status.value())
// .withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE)
// .withHeader("total_records", "1")
// .withBody(OBJECT_MAPPER.writeValueAsString(buildJudicialProfilesResponse(userId)))));
// }

private List<JudicialProfile> buildJudicialProfilesResponse(String userId) {
List<JudicialProfile> bookings = new ArrayList<>();
bookings.add(JudicialProfile.builder()
Expand All @@ -178,46 +79,6 @@ private List<JudicialProfile> buildJudicialProfilesResponse(String userId) {
return bookings;
}

// public void stubForGetJudicialDetailsByIdFailure(HttpStatus status) throws JsonProcessingException {
// Map<String, String> body = Map.of(
// "errorDescription", "The User Profile data could not be found",
// "status", "Not Found");
//
// WIRE_MOCK_SERVER.stubFor(post(urlPathMatching("/refdata/judicial/users"))
// .willReturn(aResponse()
// .withStatus(status.value())
// .withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE)
// .withBody(OBJECT_MAPPER.writeValueAsString(body))));
//
// }

// public void stubForGetJudicialBookingByUserIds(String... userIds) throws JsonProcessingException {
// WIRE_MOCK_SERVER.stubFor(post(urlPathMatching("/am/bookings/query"))
// .willReturn(aResponse()
// .withStatus(OK.value())
// .withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE)
// .withHeader("total_records", "1")
// .withBody(OBJECT_MAPPER.writeValueAsString(buildJudicialBookingResponse(userIds)))));
// }

// private JudicialBookingResponse buildJudicialBookingResponse(String... userIds) {
// List<JudicialBooking> bookings = new ArrayList<>();
//
// for (String userId : userIds) {
// bookings.add(
// JudicialBooking.builder()
// .beginTime(ZonedDateTime.now())
// .endTime(ZonedDateTime.now().plusDays(5))
// .userId(userId)
// .locationId("location")
// .regionId("region")
// .build()
// );
// }
//
// return new JudicialBookingResponse(bookings);
// }

public void stubIdamConfig() throws JsonProcessingException {

WIRE_MOCK_SERVER.stubFor(get(urlPathMatching("/o/.well-known/openid-configuration"))
Expand All @@ -236,19 +97,6 @@ public void stubIdamConfig() throws JsonProcessingException {

}

// private Map<String, Object> getUserInfoResponse() {
// LinkedHashMap<String,Object> data1 = new LinkedHashMap<>();
//
// data1.put("id","%s");
// data1.put("uid","%s");
// data1.put("forename","Super");
// data1.put("surname","User");
// data1.put("email","dummy@email.com");
// data1.put("roles", List.of("%s"));
//
// return data1;
// }

private Map<String, Object> getOpenIdResponse() {
LinkedHashMap<String,Object> data1 = new LinkedHashMap<>();
data1.put("issuer", "http://localhost:" + WIRE_MOCK_SERVER.port() + "/o");
Expand All @@ -269,17 +117,6 @@ private String getJwksResponse() {

}

// private TokenResponse getTokenResponse() {
// return new TokenResponse(
// "user1",
// "expiresInValue",
// "idTokenValue",
// "refreshTokenValue",
// "scopeValue",
// "tokenTypeValue"
// );
// }

public void stubRoleAssignments(String body, int returnHttpStatus) {
WIRE_MOCK_SERVER.stubFor(WireMock.post(urlEqualTo("/am/role-assignments"))
.willReturn(aResponse()
Expand Down

0 comments on commit 4894472

Please sign in to comment.