use of javax.xml.ws.WebServiceException in project OpenOLAT by OpenOLAT.
the class ViteroManager method changeGroupRole.
public ViteroStatus changeGroupRole(int groupId, int vmsUserId, int roleId) throws VmsNotAvailableException {
try {
Group groupWs = getGroupWebService();
ChangeGroupRoleRequest roleRequest = new ChangeGroupRoleRequest();
roleRequest.setGroupid(groupId);
roleRequest.setUserid(vmsUserId);
roleRequest.setRole(roleId);
groupWs.changeGroupRole(roleRequest);
return new ViteroStatus();
} catch (SOAPFaultException f) {
ErrorCode code = handleAxisFault(f);
switch(code) {
case userDoesntExist:
log.error("The user doesn ́t exist!", f);
break;
case groupDoesntExist:
log.error("The group doesn ́t exist", f);
break;
default:
logAxisError("Cannot add an user to a group", f);
}
return new ViteroStatus(code);
} catch (WebServiceException e) {
if (e.getCause() instanceof ConnectException) {
throw new VmsNotAvailableException();
}
log.error("Cannot add an user to a group", e);
return new ViteroStatus(ErrorCode.unkown);
}
}
use of javax.xml.ws.WebServiceException in project OpenOLAT by OpenOLAT.
the class ViteroManager method getBookingByDate.
public List<ViteroBooking> getBookingByDate(Date start, Date end) throws VmsNotAvailableException {
try {
Booking bookingWs = getBookingWebService();
GetBookingListByDateRequest dateRequest = new GetBookingListByDateRequest();
dateRequest.setStart(format(start));
dateRequest.setEnd(format(end));
dateRequest.setTimezone(viteroModule.getTimeZoneId());
dateRequest.setCustomerid(viteroModule.getCustomerId());
Bookinglist bookingList = bookingWs.getBookingListByDate(dateRequest);
List<Booking_Type> bookings = bookingList.getBooking();
return convert(bookings);
} catch (SOAPFaultException f) {
ErrorCode code = handleAxisFault(f);
switch(code) {
default:
logAxisError("Cannot get the list of bookings by date.", f);
}
return Collections.emptyList();
} catch (WebServiceException e) {
if (e.getCause() instanceof ConnectException) {
throw new VmsNotAvailableException();
}
return Collections.emptyList();
}
}
use of javax.xml.ws.WebServiceException in project webcert by sklintyg.
the class ArendeConverterTest method testDecorateArendeFromUtkastHsaNotResponding.
@Test
public void testDecorateArendeFromUtkastHsaNotResponding() {
Utkast utkast = new Utkast();
utkast.setIntygsTyp("intygstyp");
utkast.setEnhetsId("enhetsid");
utkast.setSignatur(mock(Signatur.class));
when(utkast.getSignatur().getSigneradAv()).thenReturn("signeratav");
when(hsaEmployeeService.getEmployee(anyString(), eq(null))).thenThrow(new WebServiceException());
try {
ArendeConverter.decorateArendeFromUtkast(new Arende(), utkast, LocalDateTime.now(), hsaEmployeeService);
fail("Should throw");
} catch (WebCertServiceException e) {
assertEquals(WebCertServiceErrorCodeEnum.EXTERNAL_SYSTEM_PROBLEM, e.getErrorCode());
}
}
use of javax.xml.ws.WebServiceException in project webcert by sklintyg.
the class NotificationWSClientTest method testSendStatusUpdateClientThrowsException.
@Test(expected = TemporaryException.class)
public void testSendStatusUpdateClientThrowsException() throws Exception {
when(statusUpdateForCareClient.certificateStatusUpdateForCare(anyString(), any(CertificateStatusUpdateForCareType.class))).thenThrow(new WebServiceException());
notificationWsClient.sendStatusUpdate(createRequest(), LOGICAL_ADDRESS);
}
use of javax.xml.ws.WebServiceException in project webcert by sklintyg.
the class CertificateSendProcessorTest method testSendCertificateThrowsPermanentOnWebServiceException.
@Test(expected = TemporaryException.class)
public void testSendCertificateThrowsPermanentOnWebServiceException() throws Exception {
// Given
when(sendServiceClient.sendCertificate(INTYGS_ID1, PERSON_ID1, SKICKAT_AV, RECIPIENT1, LOGICAL_ADDRESS1)).thenThrow(new WebServiceException());
// When
certificateSendProcessor.process(SKICKAT_AV, INTYGS_ID1, PERSON_ID1, RECIPIENT1, LOGICAL_ADDRESS1);
// Then
verify(sendServiceClient).sendCertificate(INTYGS_ID1, PERSON_ID1, SKICKAT_AV, RECIPIENT1, LOGICAL_ADDRESS1);
}
Aggregations