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());
}
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>"));
}
Aggregations