@Test public void shouldFailValidation() throws Exception { try { wsdlValidator.executeValidator("src/test/resources/wsdl/error.wsdl"); fail("should have thrown WsdlValidationException"); } catch (WsdlValidator.WsdlValidationFailedException expected) { assertEquals(ERROR_INVALID_WSDL, expected.getErrorDeviation().getCode()); } }
public List<String> executeValidator(String wsdlUrl) throws WsdlValidatorNotExecutableException, WsdlValidationFailedException, InterruptedException { List<String> warnings = new ArrayList<>(); if (StringUtils.isEmpty(getWsdlValidatorCommand())) { log.warn("Skipping WSDL validator, command not set"); return warnings; } if (StringUtils.isEmpty(wsdlUrl)) { throw new IllegalArgumentException("wsdl url cannot be null or empty"); } try { ExternalProcessRunner.ProcessResult processResult = externalProcessRunner .executeAndThrowOnFailure(getWsdlValidatorCommand(), wsdlUrl); logValidatorOutput(processResult.getProcessOutput()); return processResult.getProcessOutput(); } catch (ProcessNotExecutableException e) { throw new WsdlValidatorNotExecutableException(e); } catch (ProcessFailedException e) { if (e.getErrorDeviation() != null) { logValidatorOutput(e.getErrorDeviation().getMetadata()); } throw new WsdlValidationFailedException(e.getErrorDeviation().getMetadata()); } }
WsdlValidator { public List<String> executeValidator(String wsdlUrl) throws WsdlValidatorNotExecutableException, WsdlValidationFailedException, InterruptedException { List<String> warnings = new ArrayList<>(); if (StringUtils.isEmpty(getWsdlValidatorCommand())) { log.warn("Skipping WSDL validator, command not set"); return warnings; } if (StringUtils.isEmpty(wsdlUrl)) { throw new IllegalArgumentException("wsdl url cannot be null or empty"); } try { ExternalProcessRunner.ProcessResult processResult = externalProcessRunner .executeAndThrowOnFailure(getWsdlValidatorCommand(), wsdlUrl); logValidatorOutput(processResult.getProcessOutput()); return processResult.getProcessOutput(); } catch (ProcessNotExecutableException e) { throw new WsdlValidatorNotExecutableException(e); } catch (ProcessFailedException e) { if (e.getErrorDeviation() != null) { logValidatorOutput(e.getErrorDeviation().getMetadata()); } throw new WsdlValidationFailedException(e.getErrorDeviation().getMetadata()); } } }
WsdlValidator { public List<String> executeValidator(String wsdlUrl) throws WsdlValidatorNotExecutableException, WsdlValidationFailedException, InterruptedException { List<String> warnings = new ArrayList<>(); if (StringUtils.isEmpty(getWsdlValidatorCommand())) { log.warn("Skipping WSDL validator, command not set"); return warnings; } if (StringUtils.isEmpty(wsdlUrl)) { throw new IllegalArgumentException("wsdl url cannot be null or empty"); } try { ExternalProcessRunner.ProcessResult processResult = externalProcessRunner .executeAndThrowOnFailure(getWsdlValidatorCommand(), wsdlUrl); logValidatorOutput(processResult.getProcessOutput()); return processResult.getProcessOutput(); } catch (ProcessNotExecutableException e) { throw new WsdlValidatorNotExecutableException(e); } catch (ProcessFailedException e) { if (e.getErrorDeviation() != null) { logValidatorOutput(e.getErrorDeviation().getMetadata()); } throw new WsdlValidationFailedException(e.getErrorDeviation().getMetadata()); } } @Autowired  WsdlValidator(ExternalProcessRunner externalProcessRunner); }
WsdlValidator { public List<String> executeValidator(String wsdlUrl) throws WsdlValidatorNotExecutableException, WsdlValidationFailedException, InterruptedException { List<String> warnings = new ArrayList<>(); if (StringUtils.isEmpty(getWsdlValidatorCommand())) { log.warn("Skipping WSDL validator, command not set"); return warnings; } if (StringUtils.isEmpty(wsdlUrl)) { throw new IllegalArgumentException("wsdl url cannot be null or empty"); } try { ExternalProcessRunner.ProcessResult processResult = externalProcessRunner .executeAndThrowOnFailure(getWsdlValidatorCommand(), wsdlUrl); logValidatorOutput(processResult.getProcessOutput()); return processResult.getProcessOutput(); } catch (ProcessNotExecutableException e) { throw new WsdlValidatorNotExecutableException(e); } catch (ProcessFailedException e) { if (e.getErrorDeviation() != null) { logValidatorOutput(e.getErrorDeviation().getMetadata()); } throw new WsdlValidationFailedException(e.getErrorDeviation().getMetadata()); } } @Autowired  WsdlValidator(ExternalProcessRunner externalProcessRunner); List<String> executeValidator(String wsdlUrl); }
WsdlValidator { public List<String> executeValidator(String wsdlUrl) throws WsdlValidatorNotExecutableException, WsdlValidationFailedException, InterruptedException { List<String> warnings = new ArrayList<>(); if (StringUtils.isEmpty(getWsdlValidatorCommand())) { log.warn("Skipping WSDL validator, command not set"); return warnings; } if (StringUtils.isEmpty(wsdlUrl)) { throw new IllegalArgumentException("wsdl url cannot be null or empty"); } try { ExternalProcessRunner.ProcessResult processResult = externalProcessRunner .executeAndThrowOnFailure(getWsdlValidatorCommand(), wsdlUrl); logValidatorOutput(processResult.getProcessOutput()); return processResult.getProcessOutput(); } catch (ProcessNotExecutableException e) { throw new WsdlValidatorNotExecutableException(e); } catch (ProcessFailedException e) { if (e.getErrorDeviation() != null) { logValidatorOutput(e.getErrorDeviation().getMetadata()); } throw new WsdlValidationFailedException(e.getErrorDeviation().getMetadata()); } } @Autowired  WsdlValidator(ExternalProcessRunner externalProcessRunner); List<String> executeValidator(String wsdlUrl);  }