@Test(expected = TemporaryException.class) public void testRevokeCertificateOnTechnicalErrorResponse() throws Exception { ModuleApi moduleApi = mock(ModuleApi.class); when(registry.getModuleApi(eq(INTYGS_TYP), eq(INTYGS_TYP_VERSION))).thenReturn(moduleApi); doThrow(new ExternalServiceCallException("message", ExternalServiceCallException.ErrorIdEnum.TECHNICAL_ERROR)) .when(moduleApi) .revokeCertificate(eq(BODY), eq(LOGICAL_ADDRESS1)); certificateRevokeProcessor.process(BODY, INTYGS_ID1, LOGICAL_ADDRESS1, INTYGS_TYP, INTYGS_TYP_VERSION); }
public void process(@Body String xmlBody, @Header(Constants.INTYGS_ID) String intygsId, @Header(Constants.LOGICAL_ADDRESS) String logicalAddress, @Header(Constants.INTYGS_TYP) String intygsTyp, @Header(Constants.INTYGS_TYP_VERSION) String intygsTypVersion) throws TemporaryException, PermanentException { checkArgument(!Strings.isNullOrEmpty(intygsId), "Message of type %s does not have a %s header.", Constants.REVOKE_MESSAGE, Constants.INTYGS_ID); checkArgument(!Strings.isNullOrEmpty(logicalAddress), "Message of type %s does not have a %s header.", Constants.REVOKE_MESSAGE, Constants.LOGICAL_ADDRESS); checkArgument(!Strings.isNullOrEmpty(intygsTyp), "Message of type %s does not have a %s header.", Constants.REVOKE_MESSAGE, Constants.INTYGS_TYP); checkArgument(!Strings.isNullOrEmpty(intygsTypVersion), "Message of type %s does not have a %s header.", Constants.REVOKE_MESSAGE, Constants.INTYGS_TYP_VERSION); try { ModuleApi moduleApi = registry.getModuleApi(intygsTyp, intygsTypVersion); moduleApi.revokeCertificate(xmlBody, logicalAddress); } catch (ExternalServiceCallException e) { switch (e.getErroIdEnum()) { case TECHNICAL_ERROR: case APPLICATION_ERROR: throw new TemporaryException(e.getMessage()); default: throw new PermanentException(e.getMessage()); } } catch (ModuleException e) { throw new PermanentException(e.getMessage()); } catch (WebServiceException e) { throw new TemporaryException(e.getMessage()); } catch (Exception e) { throw new PermanentException(e.getMessage()); } }
CertificateRevokeProcessor { public void process(@Body String xmlBody, @Header(Constants.INTYGS_ID) String intygsId, @Header(Constants.LOGICAL_ADDRESS) String logicalAddress, @Header(Constants.INTYGS_TYP) String intygsTyp, @Header(Constants.INTYGS_TYP_VERSION) String intygsTypVersion) throws TemporaryException, PermanentException { checkArgument(!Strings.isNullOrEmpty(intygsId), "Message of type %s does not have a %s header.", Constants.REVOKE_MESSAGE, Constants.INTYGS_ID); checkArgument(!Strings.isNullOrEmpty(logicalAddress), "Message of type %s does not have a %s header.", Constants.REVOKE_MESSAGE, Constants.LOGICAL_ADDRESS); checkArgument(!Strings.isNullOrEmpty(intygsTyp), "Message of type %s does not have a %s header.", Constants.REVOKE_MESSAGE, Constants.INTYGS_TYP); checkArgument(!Strings.isNullOrEmpty(intygsTypVersion), "Message of type %s does not have a %s header.", Constants.REVOKE_MESSAGE, Constants.INTYGS_TYP_VERSION); try { ModuleApi moduleApi = registry.getModuleApi(intygsTyp, intygsTypVersion); moduleApi.revokeCertificate(xmlBody, logicalAddress); } catch (ExternalServiceCallException e) { switch (e.getErroIdEnum()) { case TECHNICAL_ERROR: case APPLICATION_ERROR: throw new TemporaryException(e.getMessage()); default: throw new PermanentException(e.getMessage()); } } catch (ModuleException e) { throw new PermanentException(e.getMessage()); } catch (WebServiceException e) { throw new TemporaryException(e.getMessage()); } catch (Exception e) { throw new PermanentException(e.getMessage()); } } }
CertificateRevokeProcessor { public void process(@Body String xmlBody, @Header(Constants.INTYGS_ID) String intygsId, @Header(Constants.LOGICAL_ADDRESS) String logicalAddress, @Header(Constants.INTYGS_TYP) String intygsTyp, @Header(Constants.INTYGS_TYP_VERSION) String intygsTypVersion) throws TemporaryException, PermanentException { checkArgument(!Strings.isNullOrEmpty(intygsId), "Message of type %s does not have a %s header.", Constants.REVOKE_MESSAGE, Constants.INTYGS_ID); checkArgument(!Strings.isNullOrEmpty(logicalAddress), "Message of type %s does not have a %s header.", Constants.REVOKE_MESSAGE, Constants.LOGICAL_ADDRESS); checkArgument(!Strings.isNullOrEmpty(intygsTyp), "Message of type %s does not have a %s header.", Constants.REVOKE_MESSAGE, Constants.INTYGS_TYP); checkArgument(!Strings.isNullOrEmpty(intygsTypVersion), "Message of type %s does not have a %s header.", Constants.REVOKE_MESSAGE, Constants.INTYGS_TYP_VERSION); try { ModuleApi moduleApi = registry.getModuleApi(intygsTyp, intygsTypVersion); moduleApi.revokeCertificate(xmlBody, logicalAddress); } catch (ExternalServiceCallException e) { switch (e.getErroIdEnum()) { case TECHNICAL_ERROR: case APPLICATION_ERROR: throw new TemporaryException(e.getMessage()); default: throw new PermanentException(e.getMessage()); } } catch (ModuleException e) { throw new PermanentException(e.getMessage()); } catch (WebServiceException e) { throw new TemporaryException(e.getMessage()); } catch (Exception e) { throw new PermanentException(e.getMessage()); } }  }
CertificateRevokeProcessor { public void process(@Body String xmlBody, @Header(Constants.INTYGS_ID) String intygsId, @Header(Constants.LOGICAL_ADDRESS) String logicalAddress, @Header(Constants.INTYGS_TYP) String intygsTyp, @Header(Constants.INTYGS_TYP_VERSION) String intygsTypVersion) throws TemporaryException, PermanentException { checkArgument(!Strings.isNullOrEmpty(intygsId), "Message of type %s does not have a %s header.", Constants.REVOKE_MESSAGE, Constants.INTYGS_ID); checkArgument(!Strings.isNullOrEmpty(logicalAddress), "Message of type %s does not have a %s header.", Constants.REVOKE_MESSAGE, Constants.LOGICAL_ADDRESS); checkArgument(!Strings.isNullOrEmpty(intygsTyp), "Message of type %s does not have a %s header.", Constants.REVOKE_MESSAGE, Constants.INTYGS_TYP); checkArgument(!Strings.isNullOrEmpty(intygsTypVersion), "Message of type %s does not have a %s header.", Constants.REVOKE_MESSAGE, Constants.INTYGS_TYP_VERSION); try { ModuleApi moduleApi = registry.getModuleApi(intygsTyp, intygsTypVersion); moduleApi.revokeCertificate(xmlBody, logicalAddress); } catch (ExternalServiceCallException e) { switch (e.getErroIdEnum()) { case TECHNICAL_ERROR: case APPLICATION_ERROR: throw new TemporaryException(e.getMessage()); default: throw new PermanentException(e.getMessage()); } } catch (ModuleException e) { throw new PermanentException(e.getMessage()); } catch (WebServiceException e) { throw new TemporaryException(e.getMessage()); } catch (Exception e) { throw new PermanentException(e.getMessage()); } }  void process(@Body String xmlBody,
        @Header(Constants.INTYGS_ID) String intygsId,
        @Header(Constants.LOGICAL_ADDRESS) String logicalAddress,
        @Header(Constants.INTYGS_TYP) String intygsTyp,
        @Header(Constants.INTYGS_TYP_VERSION) String intygsTypVersion); }
CertificateRevokeProcessor { public void process(@Body String xmlBody, @Header(Constants.INTYGS_ID) String intygsId, @Header(Constants.LOGICAL_ADDRESS) String logicalAddress, @Header(Constants.INTYGS_TYP) String intygsTyp, @Header(Constants.INTYGS_TYP_VERSION) String intygsTypVersion) throws TemporaryException, PermanentException { checkArgument(!Strings.isNullOrEmpty(intygsId), "Message of type %s does not have a %s header.", Constants.REVOKE_MESSAGE, Constants.INTYGS_ID); checkArgument(!Strings.isNullOrEmpty(logicalAddress), "Message of type %s does not have a %s header.", Constants.REVOKE_MESSAGE, Constants.LOGICAL_ADDRESS); checkArgument(!Strings.isNullOrEmpty(intygsTyp), "Message of type %s does not have a %s header.", Constants.REVOKE_MESSAGE, Constants.INTYGS_TYP); checkArgument(!Strings.isNullOrEmpty(intygsTypVersion), "Message of type %s does not have a %s header.", Constants.REVOKE_MESSAGE, Constants.INTYGS_TYP_VERSION); try { ModuleApi moduleApi = registry.getModuleApi(intygsTyp, intygsTypVersion); moduleApi.revokeCertificate(xmlBody, logicalAddress); } catch (ExternalServiceCallException e) { switch (e.getErroIdEnum()) { case TECHNICAL_ERROR: case APPLICATION_ERROR: throw new TemporaryException(e.getMessage()); default: throw new PermanentException(e.getMessage()); } } catch (ModuleException e) { throw new PermanentException(e.getMessage()); } catch (WebServiceException e) { throw new TemporaryException(e.getMessage()); } catch (Exception e) { throw new PermanentException(e.getMessage()); } }  void process(@Body String xmlBody,
        @Header(Constants.INTYGS_ID) String intygsId,
        @Header(Constants.LOGICAL_ADDRESS) String logicalAddress,
        @Header(Constants.INTYGS_TYP) String intygsTyp,
        @Header(Constants.INTYGS_TYP_VERSION) String intygsTypVersion);  }