@Test public void testWithNotValidXML() throws Exception { URI resourceXML = getClass().getResource("/xml/notValid.xml").toURI(); xml = FileUtils.readFileToString(new File(resourceXML)); URI resourceXSD = getClass().getResource("/xml/test.xsd").toURI(); String xsd = FileUtils.readFileToString(new File(resourceXSD)); Map<String, String> result = validate.execute(xml, EMPTY, xsd, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, FALSE); assertEquals(ResponseNames.FAILURE, result.get(RESULT_TEXT)); assertEquals(FAILURE, result.get(RETURN_CODE)); assertEquals(PARSING_ERROR + "cvc-complex-type.4: Attribute 'someid' must appear on element 'root'.", result.get(ERROR_MESSAGE)); }
@Action(name = "Validate", outputs = { @Output(RETURN_CODE), @Output(RESULT_TEXT), @Output(RETURN_RESULT), @Output(ERROR_MESSAGE)}, responses = { @Response(text = ResponseNames.SUCCESS, field = RETURN_CODE, value = SUCCESS, matchType = COMPARE_EQUAL), @Response(text = ResponseNames.FAILURE, field = RETURN_CODE, value = FAILURE, matchType = COMPARE_EQUAL, isDefault = true, isOnFail = true)}) public Map<String, String> execute( @Param(value = XML_DOCUMENT, required = true) String xmlDocument, @Param(value = XML_DOCUMENT_SOURCE) String xmlDocumentSource, @Param(value = XSD_DOCUMENT) String xsdDocument, @Param(value = XSD_DOCUMENT_SOURCE) String xsdDocumentSource, @Param(value = USERNAME) String username, @Param(value = PASSWORD, encrypted = true) String password, @Param(value = TRUST_ALL_ROOTS) String trustAllRoots, @Param(value = KEYSTORE) String keystore, @Param(value = KEYSTORE_PASSWORD, encrypted = true) String keystorePassword, @Param(value = TRUST_KEYSTORE) String trustKeystore, @Param(value = TRUST_PASSWORD, encrypted = true) String trustPassword, @Param(value = X_509_HOSTNAME_VERIFIER) String x509HostnameVerifier, @Param(value = PROXY_HOST) String proxyHost, @Param(value = PROXY_PORT) String proxyPort, @Param(value = PROXY_USERNAME) String proxyUsername, @Param(value = PROXY_PASSWORD, encrypted = true) String proxyPassword, @Param(value = SECURE_PROCESSING) String secureProcessing) { final CommonInputs inputs = new CommonInputs.CommonInputsBuilder() .withXmlDocument(xmlDocument) .withXmlDocumentSource(xmlDocumentSource) .withUsername(username) .withPassword(password) .withTrustAllRoots(trustAllRoots) .withKeystore(keystore) .withKeystorePassword(keystorePassword) .withTrustKeystore(trustKeystore) .withTrustPassword(trustPassword) .withX509HostnameVerifier(x509HostnameVerifier) .withProxyHost(proxyHost) .withProxyPort(proxyPort) .withProxyUsername(proxyUsername) .withProxyPassword(proxyPassword) .withSecureProcessing(secureProcessing) .build(); final CustomInputs customInputs = new CustomInputs.CustomInputsBuilder() .withXsdDocument(xsdDocument) .withXsdDocumentSource(xsdDocumentSource) .build(); return new ValidateService().execute(inputs, customInputs); }
Validate { @Action(name = "Validate", outputs = { @Output(RETURN_CODE), @Output(RESULT_TEXT), @Output(RETURN_RESULT), @Output(ERROR_MESSAGE)}, responses = { @Response(text = ResponseNames.SUCCESS, field = RETURN_CODE, value = SUCCESS, matchType = COMPARE_EQUAL), @Response(text = ResponseNames.FAILURE, field = RETURN_CODE, value = FAILURE, matchType = COMPARE_EQUAL, isDefault = true, isOnFail = true)}) public Map<String, String> execute( @Param(value = XML_DOCUMENT, required = true) String xmlDocument, @Param(value = XML_DOCUMENT_SOURCE) String xmlDocumentSource, @Param(value = XSD_DOCUMENT) String xsdDocument, @Param(value = XSD_DOCUMENT_SOURCE) String xsdDocumentSource, @Param(value = USERNAME) String username, @Param(value = PASSWORD, encrypted = true) String password, @Param(value = TRUST_ALL_ROOTS) String trustAllRoots, @Param(value = KEYSTORE) String keystore, @Param(value = KEYSTORE_PASSWORD, encrypted = true) String keystorePassword, @Param(value = TRUST_KEYSTORE) String trustKeystore, @Param(value = TRUST_PASSWORD, encrypted = true) String trustPassword, @Param(value = X_509_HOSTNAME_VERIFIER) String x509HostnameVerifier, @Param(value = PROXY_HOST) String proxyHost, @Param(value = PROXY_PORT) String proxyPort, @Param(value = PROXY_USERNAME) String proxyUsername, @Param(value = PROXY_PASSWORD, encrypted = true) String proxyPassword, @Param(value = SECURE_PROCESSING) String secureProcessing) { final CommonInputs inputs = new CommonInputs.CommonInputsBuilder() .withXmlDocument(xmlDocument) .withXmlDocumentSource(xmlDocumentSource) .withUsername(username) .withPassword(password) .withTrustAllRoots(trustAllRoots) .withKeystore(keystore) .withKeystorePassword(keystorePassword) .withTrustKeystore(trustKeystore) .withTrustPassword(trustPassword) .withX509HostnameVerifier(x509HostnameVerifier) .withProxyHost(proxyHost) .withProxyPort(proxyPort) .withProxyUsername(proxyUsername) .withProxyPassword(proxyPassword) .withSecureProcessing(secureProcessing) .build(); final CustomInputs customInputs = new CustomInputs.CustomInputsBuilder() .withXsdDocument(xsdDocument) .withXsdDocumentSource(xsdDocumentSource) .build(); return new ValidateService().execute(inputs, customInputs); } }
Validate { @Action(name = "Validate", outputs = { @Output(RETURN_CODE), @Output(RESULT_TEXT), @Output(RETURN_RESULT), @Output(ERROR_MESSAGE)}, responses = { @Response(text = ResponseNames.SUCCESS, field = RETURN_CODE, value = SUCCESS, matchType = COMPARE_EQUAL), @Response(text = ResponseNames.FAILURE, field = RETURN_CODE, value = FAILURE, matchType = COMPARE_EQUAL, isDefault = true, isOnFail = true)}) public Map<String, String> execute( @Param(value = XML_DOCUMENT, required = true) String xmlDocument, @Param(value = XML_DOCUMENT_SOURCE) String xmlDocumentSource, @Param(value = XSD_DOCUMENT) String xsdDocument, @Param(value = XSD_DOCUMENT_SOURCE) String xsdDocumentSource, @Param(value = USERNAME) String username, @Param(value = PASSWORD, encrypted = true) String password, @Param(value = TRUST_ALL_ROOTS) String trustAllRoots, @Param(value = KEYSTORE) String keystore, @Param(value = KEYSTORE_PASSWORD, encrypted = true) String keystorePassword, @Param(value = TRUST_KEYSTORE) String trustKeystore, @Param(value = TRUST_PASSWORD, encrypted = true) String trustPassword, @Param(value = X_509_HOSTNAME_VERIFIER) String x509HostnameVerifier, @Param(value = PROXY_HOST) String proxyHost, @Param(value = PROXY_PORT) String proxyPort, @Param(value = PROXY_USERNAME) String proxyUsername, @Param(value = PROXY_PASSWORD, encrypted = true) String proxyPassword, @Param(value = SECURE_PROCESSING) String secureProcessing) { final CommonInputs inputs = new CommonInputs.CommonInputsBuilder() .withXmlDocument(xmlDocument) .withXmlDocumentSource(xmlDocumentSource) .withUsername(username) .withPassword(password) .withTrustAllRoots(trustAllRoots) .withKeystore(keystore) .withKeystorePassword(keystorePassword) .withTrustKeystore(trustKeystore) .withTrustPassword(trustPassword) .withX509HostnameVerifier(x509HostnameVerifier) .withProxyHost(proxyHost) .withProxyPort(proxyPort) .withProxyUsername(proxyUsername) .withProxyPassword(proxyPassword) .withSecureProcessing(secureProcessing) .build(); final CustomInputs customInputs = new CustomInputs.CustomInputsBuilder() .withXsdDocument(xsdDocument) .withXsdDocumentSource(xsdDocumentSource) .build(); return new ValidateService().execute(inputs, customInputs); }  }
Validate { @Action(name = "Validate", outputs = { @Output(RETURN_CODE), @Output(RESULT_TEXT), @Output(RETURN_RESULT), @Output(ERROR_MESSAGE)}, responses = { @Response(text = ResponseNames.SUCCESS, field = RETURN_CODE, value = SUCCESS, matchType = COMPARE_EQUAL), @Response(text = ResponseNames.FAILURE, field = RETURN_CODE, value = FAILURE, matchType = COMPARE_EQUAL, isDefault = true, isOnFail = true)}) public Map<String, String> execute( @Param(value = XML_DOCUMENT, required = true) String xmlDocument, @Param(value = XML_DOCUMENT_SOURCE) String xmlDocumentSource, @Param(value = XSD_DOCUMENT) String xsdDocument, @Param(value = XSD_DOCUMENT_SOURCE) String xsdDocumentSource, @Param(value = USERNAME) String username, @Param(value = PASSWORD, encrypted = true) String password, @Param(value = TRUST_ALL_ROOTS) String trustAllRoots, @Param(value = KEYSTORE) String keystore, @Param(value = KEYSTORE_PASSWORD, encrypted = true) String keystorePassword, @Param(value = TRUST_KEYSTORE) String trustKeystore, @Param(value = TRUST_PASSWORD, encrypted = true) String trustPassword, @Param(value = X_509_HOSTNAME_VERIFIER) String x509HostnameVerifier, @Param(value = PROXY_HOST) String proxyHost, @Param(value = PROXY_PORT) String proxyPort, @Param(value = PROXY_USERNAME) String proxyUsername, @Param(value = PROXY_PASSWORD, encrypted = true) String proxyPassword, @Param(value = SECURE_PROCESSING) String secureProcessing) { final CommonInputs inputs = new CommonInputs.CommonInputsBuilder() .withXmlDocument(xmlDocument) .withXmlDocumentSource(xmlDocumentSource) .withUsername(username) .withPassword(password) .withTrustAllRoots(trustAllRoots) .withKeystore(keystore) .withKeystorePassword(keystorePassword) .withTrustKeystore(trustKeystore) .withTrustPassword(trustPassword) .withX509HostnameVerifier(x509HostnameVerifier) .withProxyHost(proxyHost) .withProxyPort(proxyPort) .withProxyUsername(proxyUsername) .withProxyPassword(proxyPassword) .withSecureProcessing(secureProcessing) .build(); final CustomInputs customInputs = new CustomInputs.CustomInputsBuilder() .withXsdDocument(xsdDocument) .withXsdDocumentSource(xsdDocumentSource) .build(); return new ValidateService().execute(inputs, customInputs); }  @Action(name = "Validate", outputs = { @Output(RETURN_CODE), @Output(RESULT_TEXT), @Output(RETURN_RESULT), @Output(ERROR_MESSAGE)}, responses = { @Response(text = ResponseNames.SUCCESS, field = RETURN_CODE, value = SUCCESS, matchType = COMPARE_EQUAL), @Response(text = ResponseNames.FAILURE, field = RETURN_CODE, value = FAILURE, matchType = COMPARE_EQUAL, isDefault = true, isOnFail = true)}) Map<String, String> execute(
            @Param(value = XML_DOCUMENT, required = true) String xmlDocument,
            @Param(value = XML_DOCUMENT_SOURCE) String xmlDocumentSource,
            @Param(value = XSD_DOCUMENT) String xsdDocument,
            @Param(value = XSD_DOCUMENT_SOURCE) String xsdDocumentSource,
            @Param(value = USERNAME) String username,
            @Param(value = PASSWORD, encrypted = true) String password,
            @Param(value = TRUST_ALL_ROOTS) String trustAllRoots,
            @Param(value = KEYSTORE) String keystore,
            @Param(value = KEYSTORE_PASSWORD, encrypted = true) String keystorePassword,
            @Param(value = TRUST_KEYSTORE) String trustKeystore,
            @Param(value = TRUST_PASSWORD, encrypted = true) String trustPassword,
            @Param(value = X_509_HOSTNAME_VERIFIER) String x509HostnameVerifier,
            @Param(value = PROXY_HOST) String proxyHost,
            @Param(value = PROXY_PORT) String proxyPort,
            @Param(value = PROXY_USERNAME) String proxyUsername,
            @Param(value = PROXY_PASSWORD, encrypted = true) String proxyPassword,
            @Param(value = SECURE_PROCESSING) String secureProcessing); }
Validate { @Action(name = "Validate", outputs = { @Output(RETURN_CODE), @Output(RESULT_TEXT), @Output(RETURN_RESULT), @Output(ERROR_MESSAGE)}, responses = { @Response(text = ResponseNames.SUCCESS, field = RETURN_CODE, value = SUCCESS, matchType = COMPARE_EQUAL), @Response(text = ResponseNames.FAILURE, field = RETURN_CODE, value = FAILURE, matchType = COMPARE_EQUAL, isDefault = true, isOnFail = true)}) public Map<String, String> execute( @Param(value = XML_DOCUMENT, required = true) String xmlDocument, @Param(value = XML_DOCUMENT_SOURCE) String xmlDocumentSource, @Param(value = XSD_DOCUMENT) String xsdDocument, @Param(value = XSD_DOCUMENT_SOURCE) String xsdDocumentSource, @Param(value = USERNAME) String username, @Param(value = PASSWORD, encrypted = true) String password, @Param(value = TRUST_ALL_ROOTS) String trustAllRoots, @Param(value = KEYSTORE) String keystore, @Param(value = KEYSTORE_PASSWORD, encrypted = true) String keystorePassword, @Param(value = TRUST_KEYSTORE) String trustKeystore, @Param(value = TRUST_PASSWORD, encrypted = true) String trustPassword, @Param(value = X_509_HOSTNAME_VERIFIER) String x509HostnameVerifier, @Param(value = PROXY_HOST) String proxyHost, @Param(value = PROXY_PORT) String proxyPort, @Param(value = PROXY_USERNAME) String proxyUsername, @Param(value = PROXY_PASSWORD, encrypted = true) String proxyPassword, @Param(value = SECURE_PROCESSING) String secureProcessing) { final CommonInputs inputs = new CommonInputs.CommonInputsBuilder() .withXmlDocument(xmlDocument) .withXmlDocumentSource(xmlDocumentSource) .withUsername(username) .withPassword(password) .withTrustAllRoots(trustAllRoots) .withKeystore(keystore) .withKeystorePassword(keystorePassword) .withTrustKeystore(trustKeystore) .withTrustPassword(trustPassword) .withX509HostnameVerifier(x509HostnameVerifier) .withProxyHost(proxyHost) .withProxyPort(proxyPort) .withProxyUsername(proxyUsername) .withProxyPassword(proxyPassword) .withSecureProcessing(secureProcessing) .build(); final CustomInputs customInputs = new CustomInputs.CustomInputsBuilder() .withXsdDocument(xsdDocument) .withXsdDocumentSource(xsdDocumentSource) .build(); return new ValidateService().execute(inputs, customInputs); }  @Action(name = "Validate", outputs = { @Output(RETURN_CODE), @Output(RESULT_TEXT), @Output(RETURN_RESULT), @Output(ERROR_MESSAGE)}, responses = { @Response(text = ResponseNames.SUCCESS, field = RETURN_CODE, value = SUCCESS, matchType = COMPARE_EQUAL), @Response(text = ResponseNames.FAILURE, field = RETURN_CODE, value = FAILURE, matchType = COMPARE_EQUAL, isDefault = true, isOnFail = true)}) Map<String, String> execute(
            @Param(value = XML_DOCUMENT, required = true) String xmlDocument,
            @Param(value = XML_DOCUMENT_SOURCE) String xmlDocumentSource,
            @Param(value = XSD_DOCUMENT) String xsdDocument,
            @Param(value = XSD_DOCUMENT_SOURCE) String xsdDocumentSource,
            @Param(value = USERNAME) String username,
            @Param(value = PASSWORD, encrypted = true) String password,
            @Param(value = TRUST_ALL_ROOTS) String trustAllRoots,
            @Param(value = KEYSTORE) String keystore,
            @Param(value = KEYSTORE_PASSWORD, encrypted = true) String keystorePassword,
            @Param(value = TRUST_KEYSTORE) String trustKeystore,
            @Param(value = TRUST_PASSWORD, encrypted = true) String trustPassword,
            @Param(value = X_509_HOSTNAME_VERIFIER) String x509HostnameVerifier,
            @Param(value = PROXY_HOST) String proxyHost,
            @Param(value = PROXY_PORT) String proxyPort,
            @Param(value = PROXY_USERNAME) String proxyUsername,
            @Param(value = PROXY_PASSWORD, encrypted = true) String proxyPassword,
            @Param(value = SECURE_PROCESSING) String secureProcessing);  }