use of se.riv.infrastructure.directory.privatepractitioner.getprivatepractitionerresponder.v1.GetPrivatePractitionerResponseType in project webcert by sklintyg.
the class GetPrivatePractitionerResponderStub method getGetPrivatePractitionerResponseTypeForPnr.
private GetPrivatePractitionerResponseType getGetPrivatePractitionerResponseTypeForPnr(GetPrivatePractitionerType parameters) {
String id = parameters.getPersonalIdentityNumber();
Personnummer personnummer = Personnummer.createPersonnummer(id).orElse(null);
GetPrivatePractitionerResponseType response = new GetPrivatePractitionerResponseType();
// if matching -- create error response
if (PERSONNUMMER_ERROR_RESPONSE.equals(id)) {
response.setHoSPerson(null);
response.setResultCode(ResultCodeEnum.ERROR);
response.setResultText("FAILURE: an error occured while trying to get private practitioner with personal identity number: " + Personnummer.getPersonnummerHashSafe(personnummer) + " exists.");
return response;
}
// if matching -- throw exception
if (PERSONNUMMER_THROW_EXCEPTION.equals(id)) {
throw new SOAPFaultException(createSOAPFault());
}
HoSPersonType person = personStub.get(id);
if (person == null) {
response.setResultCode(ResultCodeEnum.INFO);
response.setResultText("No private practitioner with personal identity number: " + Personnummer.getPersonnummerHashSafe(personnummer) + " exists.");
} else {
response.setHoSPerson(person);
response.setResultCode(ResultCodeEnum.OK);
}
return response;
}
use of se.riv.infrastructure.directory.privatepractitioner.getprivatepractitionerresponder.v1.GetPrivatePractitionerResponseType in project webcert by sklintyg.
the class GetPrivatePractitionerResponderStub method getGetPrivatePractitionerResponseTypeForHsaid.
private GetPrivatePractitionerResponseType getGetPrivatePractitionerResponseTypeForHsaid(GetPrivatePractitionerType parameters) {
String hsa = parameters.getPersonHsaId();
GetPrivatePractitionerResponseType response = new GetPrivatePractitionerResponseType();
// if matching -- create error response
if (PERSONNUMMER_ERROR_RESPONSE.equals(hsa)) {
response.setHoSPerson(null);
response.setResultCode(ResultCodeEnum.ERROR);
response.setResultText("FAILURE: an error occured while trying to get private practitioner with hsa id: " + hsa + " exists.");
return response;
}
// if matching -- throw exception
if (PERSONNUMMER_THROW_EXCEPTION.equals(hsa)) {
throw new SOAPFaultException(createSOAPFault());
}
HoSPersonType person = personStub.getByHsaId(hsa);
if (person == null) {
response.setResultCode(ResultCodeEnum.INFO);
response.setResultText("No private practitioner with hsa id: " + hsa + " exists.");
} else {
response.setHoSPerson(person);
response.setResultCode(ResultCodeEnum.OK);
}
return response;
}
use of se.riv.infrastructure.directory.privatepractitioner.getprivatepractitionerresponder.v1.GetPrivatePractitionerResponseType in project webcert by sklintyg.
the class GetPrivatePractitionerResponderTest method verifyExistingPerson.
@Test
public void verifyExistingPerson() {
// Given
ObjectCreator objectCreator = new ObjectCreator();
HoSPersonType hoSPersonType = objectCreator.getHoSPersonType();
GetPrivatePractitionerType request = defaultRequest();
GetPrivatePractitionerResponseType expected = new GetPrivatePractitionerResponseType();
expected.setResultCode(ResultCodeEnum.OK);
expected.setHoSPerson(hoSPersonType);
// When
when(personStub.get(PERSONNUMMER)).thenReturn(hoSPersonType);
// Call web service
GetPrivatePractitionerResponseType actual = ws.getPrivatePractitioner("address", request);
// Then
assertTrue(ResultCodeEnum.OK == actual.getResultCode());
assertEquals(HSAID, actual.getHoSPerson().getHsaId().getExtension());
assertEquals(PERSONNUMMER, actual.getHoSPerson().getPersonId().getExtension());
verify(personStub, times(1)).get(PERSONNUMMER);
}
use of se.riv.infrastructure.directory.privatepractitioner.getprivatepractitionerresponder.v1.GetPrivatePractitionerResponseType in project webcert by sklintyg.
the class GetPrivatePractitionerResponderTest method verifyNonExistingPerson.
@Test
public void verifyNonExistingPerson() {
// Given
GetPrivatePractitionerType request = defaultRequest();
request.setPersonalIdentityNumber("1901010101-0101");
// When
when(personStub.get("1901010101-0101")).thenReturn(null);
// Call web service
GetPrivatePractitionerResponseType actual = ws.getPrivatePractitioner("address", request);
// Then
assertTrue(ResultCodeEnum.INFO == actual.getResultCode());
assertNull(actual.getHoSPerson());
verify(personStub, times(1)).get("1901010101-0101");
}
Aggregations