use of nl.nn.adapterframework.core.PipeForward in project iaf by ibissource.
the class ShowConfigurationStatusTest method createPipeSuccessForward.
private PipeForward createPipeSuccessForward() {
PipeForward pipeForward = new PipeForward();
pipeForward.setName("success");
return pipeForward;
}
use of nl.nn.adapterframework.core.PipeForward in project iaf by ibissource.
the class Json2WsdlXmlValidatorTest method validatePlainText.
public void validatePlainText(String input, String expectedError) throws Exception {
String wsdl = "/GetPolicyDetailsTravel/wsdl/GetPolicyDetailsTravel.wsdl";
String soapBody = "GetPolicyDetailsTravel_Response";
WsdlXmlValidator val = new WsdlXmlValidator();
val.setWsdl(wsdl);
val.setThrowException(true);
val.registerForward(new PipeForward("success", null));
val.setSoapBody(soapBody);
val.configure();
PipeRunResult result;
try {
result = val.doPipe(input, session);
String resultStr = (String) result.getResult();
fail("expected error [" + expectedError + "]");
} catch (PipeRunException e) {
String msg = e.getMessage();
if (msg == null || msg.indexOf(expectedError) < 0) {
fail("expected [" + expectedError + "] in error message, but was [" + msg + "]");
}
}
}
use of nl.nn.adapterframework.core.PipeForward in project iaf by ibissource.
the class PipeTestBase method setup.
@Before
public void setup() {
pipe = createPipe();
pipe.registerForward(new PipeForward("success", null));
}
use of nl.nn.adapterframework.core.PipeForward in project iaf by ibissource.
the class Json2XmlValidatorTest method validate.
@Override
public String validate(String rootNamespace, String schemaLocation, boolean addNamespaceToSchema, boolean ignoreUnknownNamespaces, String inputFile, String[] expectedFailureReasons) throws IOException, ConfigurationException, PipeRunException {
init();
PipeLineSessionBase session = new PipeLineSessionBase();
// instance.setSchemasProvider(getSchemasProvider(schemaLocation, addNamespaceToSchema));
instance.setSchemaLocation(schemaLocation);
instance.setAddNamespaceToSchema(addNamespaceToSchema);
instance.setIgnoreUnknownNamespaces(ignoreUnknownNamespaces);
// instance.registerForward("success");
instance.setThrowException(true);
instance.setFullSchemaChecking(true);
instance.setTargetNamespace(rootNamespace);
instance.registerForward(new PipeForward("failure", null));
instance.registerForward(new PipeForward("parserError", null));
instance.configure(null);
validator.setSchemasProvider(getSchemasProvider(schemaLocation, addNamespaceToSchema));
validator.setIgnoreUnknownNamespaces(ignoreUnknownNamespaces);
validator.configure("setup");
String testXml = inputFile != null ? getTestXml(inputFile + ".xml") : null;
System.out.println("testXml [" + inputFile + ".xml] contents [" + testXml + "]");
String xml2json = (String) jsonPipe.doPipe(testXml, session).getResult();
System.out.println("testXml [" + inputFile + ".xml] to json [" + xml2json + "]");
String testJson = inputFile != null ? getTestXml(inputFile + ".json") : null;
System.out.println("testJson [" + testJson + "]");
try {
PipeRunResult prr = instance.doPipe(testJson, session);
String result = (String) prr.getResult();
System.out.println("result [" + ToStringBuilder.reflectionToString(prr) + "]");
String event;
if (prr.getPipeForward().getName().equals("success")) {
event = "valid XML";
} else {
if (prr.getPipeForward().getName().equals("failure")) {
event = "Invalid XML";
} else {
event = prr.getPipeForward().getName();
}
}
evaluateResult(event, session, null, expectedFailureReasons);
try {
String validationResult = validator.validate(result, session, "check result", null, null, false);
evaluateResult(validationResult, session, null, expectedFailureReasons);
return result;
} catch (Exception e) {
fail("result XML must be valid");
}
return result;
} catch (PipeRunException pre) {
evaluateResult("Invalid XML", session, pre, expectedFailureReasons);
}
return null;
}
use of nl.nn.adapterframework.core.PipeForward in project iaf by ibissource.
the class Json2XmlValidatorTest method init.
protected void init() throws ConfigurationException {
jsonPipe = new JsonPipe();
jsonPipe.setName("xml2json");
jsonPipe.registerForward(new PipeForward("success", null));
jsonPipe.setDirection("xml2json");
jsonPipe.configure();
try {
validator = implementation.newInstance();
} catch (IllegalAccessException e) {
throw new ConfigurationException(e);
} catch (InstantiationException e) {
throw new ConfigurationException(e);
}
validator.setThrowException(true);
validator.setFullSchemaChecking(true);
instance = new Json2XmlValidator();
instance.registerForward(new PipeForward("success", null));
instance.setSoapNamespace(null);
instance.setFailOnWildcards(false);
}
Aggregations