Search in sources :

Example 36 with PipeRunResult

use of nl.nn.adapterframework.core.PipeRunResult in project iaf by ibissource.

the class ShowConfigurationStatusTest method testSingleConfig.

@Test
public void testSingleConfig() throws ConfigurationException, PipeRunException, DomBuilderException, SAXException, IOException, TransformerException {
    ShowConfigurationStatus showConfigurationStatus = new ShowConfigurationStatus();
    PipeLine pipeLine = new PipeLine();
    Adapter adapter = (Adapter) ibisContext.getIbisManager().getRegisteredAdapter("WebControlShowConfigurationStatus");
    pipeLine.setAdapter(adapter);
    showConfigurationStatus.registerForward(createPipeSuccessForward());
    showConfigurationStatus.configure(pipeLine);
    session.put("configuration", "Ibis4Example");
    MockHttpServletRequest request = new MockHttpServletRequest();
    session.put(IPipeLineSession.HTTP_REQUEST_KEY, request);
    PipeRunResult pipeRunResult = showConfigurationStatus.doPipe(null, session);
    compareXML("webcontrol/singleConfig.xml", (String) pipeRunResult.getResult());
}
Also used : PipeRunResult(nl.nn.adapterframework.core.PipeRunResult) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) Adapter(nl.nn.adapterframework.core.Adapter) PipeLine(nl.nn.adapterframework.core.PipeLine) Test(org.junit.Test)

Example 37 with PipeRunResult

use of nl.nn.adapterframework.core.PipeRunResult in project iaf by ibissource.

the class HashPipeTest method basic.

@Test
public void basic() throws ConfigurationException, PipeStartException, IOException, PipeRunException {
    pipe.setSecret("Potato");
    pipe.configure();
    pipe.start();
    PipeRunResult prr = pipe.doPipe("hash me plz", session);
    String hash = (String) prr.getResult();
    assertEquals("KZAvcWh5wSTeoBWty9MHZl+L4ApUjbWnJNaVq6xftAo=", hash);
}
Also used : PipeRunResult(nl.nn.adapterframework.core.PipeRunResult) Test(org.junit.Test)

Example 38 with PipeRunResult

use of nl.nn.adapterframework.core.PipeRunResult in project iaf by ibissource.

the class HashPipeTest method sha512.

@Test
public void sha512() throws ConfigurationException, PipeStartException, IOException, PipeRunException {
    pipe.setSecret("Potato");
    pipe.setAlgorithm("HmacSHA512");
    pipe.configure();
    pipe.start();
    PipeRunResult prr = pipe.doPipe("hash me plz", session);
    String hash = (String) prr.getResult();
    assertEquals("56V9GhAPU9NPP76zJ5KVLrfMaCherC8JcY16PTPEO3W+yxNnoXwmLS+Ic61J3gqZyeUfc0VZzzgg23WqesXm2g==", hash);
}
Also used : PipeRunResult(nl.nn.adapterframework.core.PipeRunResult) Test(org.junit.Test)

Example 39 with PipeRunResult

use of nl.nn.adapterframework.core.PipeRunResult 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 + "]");
        }
    }
}
Also used : PipeRunResult(nl.nn.adapterframework.core.PipeRunResult) PipeRunException(nl.nn.adapterframework.core.PipeRunException) PipeForward(nl.nn.adapterframework.core.PipeForward)

Example 40 with PipeRunResult

use of nl.nn.adapterframework.core.PipeRunResult in project iaf by ibissource.

the class JsonXsltPipeTest method basic.

// @Test
// public void testGetInput() throws ConfigurationException, PipeStartException, IOException, PipeRunException, DomBuilderException, TransformerException {
// pipe.setStyleSheetName("/Xslt3/orgchart.xslt");
// pipe.configure();
// pipe.start();
// String input=getFile("/Xslt3/employees.json");
// log.debug("inputfile ["+input+"]");
// 
// ParameterResolutionContext prc = pipe.getInput(input, session);
// prc.getInputSource();
// TransformerFactory factory = XmlUtils.getTransformerFactory(false);
// Transformer transformer = factory.newTransformer();
// 
// String result = XmlUtils.transformXml(transformer, prc.getInputSource());
// 
// String expected=getFile("/Xslt3/employees.xml");
// assertEquals(expected,result);
// }
@Test
public void basic() throws ConfigurationException, PipeStartException, IOException, PipeRunException {
    pipe.setStyleSheetName("/Xslt3/orgchart.xslt");
    pipe.configure();
    pipe.start();
    String input = getFile("/Xslt3/employees.json");
    log.debug("inputfile [" + input + "]");
    String expectedJson = getFile("/Xslt3/orgchart.json");
    PipeRunResult prr = pipe.doPipe(input, session);
    String jsonOut = (String) prr.getResult();
    assertJsonEqual(null, expectedJson, jsonOut);
}
Also used : PipeRunResult(nl.nn.adapterframework.core.PipeRunResult) Test(org.junit.Test)

Aggregations

PipeRunResult (nl.nn.adapterframework.core.PipeRunResult)89 PipeRunException (nl.nn.adapterframework.core.PipeRunException)65 PipeForward (nl.nn.adapterframework.core.PipeForward)23 ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)22 ParameterResolutionContext (nl.nn.adapterframework.parameters.ParameterResolutionContext)21 IOException (java.io.IOException)17 ParameterException (nl.nn.adapterframework.core.ParameterException)14 ParameterValueList (nl.nn.adapterframework.parameters.ParameterValueList)11 Test (org.junit.Test)11 File (java.io.File)10 Map (java.util.Map)10 ParameterList (nl.nn.adapterframework.parameters.ParameterList)8 InputStream (java.io.InputStream)7 DomBuilderException (nl.nn.adapterframework.util.DomBuilderException)7 Parameter (nl.nn.adapterframework.parameters.Parameter)6 FileInputStream (java.io.FileInputStream)4 StringReader (java.io.StringReader)4 Iterator (java.util.Iterator)4 StringTokenizer (java.util.StringTokenizer)4 TransformerConfigurationException (javax.xml.transform.TransformerConfigurationException)4