use of fi.otavanopisto.pyramus.rest.model.Email in project muikku by otavanopisto.
the class PyramusMocks method mockStaffMember.
@SuppressWarnings("unused")
private static StaffMember mockStaffMember(Long personId, Long staffMemberId, String firstName, String lastName, String email, UserRole role, List<String> tags, Map<String, String> variables, List<String> payloads) throws JsonProcessingException {
ObjectMapper objectMapper = new ObjectMapper().registerModule(new JSR310Module()).disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
StaffMember staffMember = new StaffMember(staffMemberId, personId, null, firstName, lastName, null, role, tags, variables);
String staffMemberJson = objectMapper.writeValueAsString(staffMember);
stubFor(get(urlEqualTo("/1/staff/members/" + staffMemberId)).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(staffMemberJson).withStatus(200)));
StaffMember[] staffMemberArray = { staffMember };
String staffMemberArrayJson = objectMapper.writeValueAsString(staffMemberArray);
stubFor(get(urlEqualTo("/1/staff/members?email=" + email)).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(staffMemberArrayJson).withStatus(200)));
Email staffEmail = new Email(staffMemberId, (long) 1, true, email);
Email[] staffEmails = { staffEmail };
String staffEmailJson = objectMapper.writeValueAsString(staffEmails);
stubFor(get(urlEqualTo("/1/staff/members/" + staffMemberId + "/emails")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(staffEmailJson).withStatus(200)));
return staffMember;
}
use of fi.otavanopisto.pyramus.rest.model.Email in project muikku by otavanopisto.
the class PyramusMocksRest method mockStaffMember.
private static StaffMember mockStaffMember(Long personId, Long staffMemberId, String firstName, String lastName, String email, UserRole role, List<String> tags, Map<String, String> variables, List<String> payloads) throws JsonProcessingException {
ObjectMapper objectMapper = new ObjectMapper().registerModule(new JSR310Module()).disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
StaffMember staffMember = new StaffMember(staffMemberId, personId, null, firstName, lastName, null, role, tags, variables);
String staffMemberJson = objectMapper.writeValueAsString(staffMember);
stubFor(get(urlEqualTo("/1/staff/members/" + staffMemberId)).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(staffMemberJson).withStatus(200)));
StaffMember[] staffMemberArray = { staffMember };
String staffMemberArrayJson = objectMapper.writeValueAsString(staffMemberArray);
stubFor(get(urlEqualTo("/1/staff/members?email=" + email)).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(staffMemberArrayJson).withStatus(200)));
Email staffEmail = new Email(staffMemberId, (long) 1, true, email);
Email[] staffEmails = { staffEmail };
String staffEmailJson = objectMapper.writeValueAsString(staffEmails);
stubFor(get(urlEqualTo("/1/staff/members/" + staffMemberId + "/emails")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(staffEmailJson).withStatus(200)));
addPayload(payloads, objectMapper.writeValueAsString(new WebhookStaffMemberCreatePayload(staffMember.getId())));
return staffMember;
}
Aggregations