Search in sources :

Example 1 with CorrelationIDAssertion

use of org.talend.esb.policy.correlation.impl.CorrelationIDAssertion in project tesb-rt-se by Talend.

the class CorrelationIdAssertionTest method testIgnorable.

@Test
public void testIgnorable() {
    CorrelationIDAssertion cia = new CorrelationIDAssertion(generateStubElement());
    assertFalse(cia.isIgnorable());
}
Also used : CorrelationIDAssertion(org.talend.esb.policy.correlation.impl.CorrelationIDAssertion) Test(org.junit.Test)

Example 2 with CorrelationIDAssertion

use of org.talend.esb.policy.correlation.impl.CorrelationIDAssertion in project tesb-rt-se by Talend.

the class CorrelationIdAssertionTest method testSerialization.

@Test
public void testSerialization() throws Exception {
    XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
    // $NON-NLS-1$
    outputFactory.setProperty(// $NON-NLS-1$
    "javax.xml.stream.isRepairingNamespaces", Boolean.TRUE);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    XMLStreamWriter writer = outputFactory.createXMLStreamWriter(baos, "UTF-8");
    CorrelationIDAssertion cia = new CorrelationIDAssertion(generateStubElement());
    XpathNamespace xns = new XpathNamespace();
    xns.setPrefix("Prefix");
    xns.setUri("uri");
    cia.addNamespace(xns);
    XpathPart xp = new XpathPart();
    xp.setName("Name");
    xp.setOptional(false);
    xp.setXpath("Xpath");
    cia.addXpathPart(xp);
    cia.setCorrelationName("correlationName");
    cia.serialize(writer);
    writer.flush();
    writer.close();
    assertTrue(baos.toString().equalsIgnoreCase("<tpa:CorrelationID xmlns:tpa=\"http://types.talend.com/policy/assertion/1.0\" type=\"callback\" name=\"correlationName\"><tpa:Part name=\"Name\" xpath=\"Xpath\"/><tpa:Namespace prefix=\"Prefix\" uri=\"uri\"/></tpa:CorrelationID>"));
}
Also used : XMLOutputFactory(javax.xml.stream.XMLOutputFactory) XpathNamespace(org.talend.esb.policy.correlation.impl.xpath.XpathNamespace) XMLStreamWriter(javax.xml.stream.XMLStreamWriter) XpathPart(org.talend.esb.policy.correlation.impl.xpath.XpathPart) CorrelationIDAssertion(org.talend.esb.policy.correlation.impl.CorrelationIDAssertion) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 CorrelationIDAssertion (org.talend.esb.policy.correlation.impl.CorrelationIDAssertion)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 XMLOutputFactory (javax.xml.stream.XMLOutputFactory)1 XMLStreamWriter (javax.xml.stream.XMLStreamWriter)1 XpathNamespace (org.talend.esb.policy.correlation.impl.xpath.XpathNamespace)1 XpathPart (org.talend.esb.policy.correlation.impl.xpath.XpathPart)1