use of com.adaptris.core.AdaptrisMarshaller in project interlok by adaptris.
the class IdentityBuilderTest method testMetadataIdentityBuilder_RoundTrip.
@Test
public void testMetadataIdentityBuilder_RoundTrip() throws Exception {
MetadataIdentityBuilder builder = new MetadataIdentityBuilder(MetadataSource.Standard, Arrays.asList(USER, PASSWORD, ROLE));
AdaptrisMarshaller m = DefaultMarshaller.getDefaultMarshaller();
assertRoundtripEquality(builder, m.unmarshal(m.marshal(builder)));
}
use of com.adaptris.core.AdaptrisMarshaller in project interlok by adaptris.
the class IdentityBuilderTest method testEmptyIdentityBuilder_RoundTrip.
@Test
public void testEmptyIdentityBuilder_RoundTrip() throws Exception {
EmptyIdentityBuilder builder = new EmptyIdentityBuilder();
AdaptrisMarshaller m = DefaultMarshaller.getDefaultMarshaller();
assertRoundtripEquality(builder, m.unmarshal(m.marshal(builder)));
}
use of com.adaptris.core.AdaptrisMarshaller in project interlok by adaptris.
the class ExampleEventHandlerCase method doAssertions.
protected void doAssertions(T eh, int msgCount, Class expectedEventClass) throws Exception {
AdaptrisMarshaller cm = DefaultMarshaller.getDefaultMarshaller();
MockMessageProducer producer = getProducer(eh);
waitForMessages(producer, msgCount);
assertEquals("Should have " + msgCount + " produced message", msgCount, producer.getMessages().size());
for (Iterator i = producer.getMessages().iterator(); i.hasNext(); ) {
AdaptrisMessage m = (AdaptrisMessage) i.next();
Object o = cm.unmarshal(m.getContent());
assertEquals("Classname", expectedEventClass, o.getClass());
}
}
use of com.adaptris.core.AdaptrisMarshaller in project interlok by adaptris.
the class MarshallingBaseCase method testUnmarshalFromUrlStringLocalFile.
@Test
public void testUnmarshalFromUrlStringLocalFile() throws Exception {
AdaptrisMarshaller marshaller = createMarshaller();
Adapter adapter = createMarshallingObject();
File f = new File(testOutputDir, new GuidGenerator().getUUID());
String fname = f.getCanonicalPath();
if (Os.isFamily(Os.WINDOWS_FAMILY)) {
// THis is juist to remove c: and leave us with \blah.
fname = f.getCanonicalPath().substring(2).replaceAll("\\\\", "/");
}
marshaller.marshal(adapter, f);
Adapter o2 = (Adapter) marshaller.unmarshal(new URLString(fname));
assertRoundtripEquality(adapter, o2);
}
use of com.adaptris.core.AdaptrisMarshaller in project interlok by adaptris.
the class MarshallingBaseCase method testUncheckedUnmarshalFromInputStream.
@Test
public void testUncheckedUnmarshalFromInputStream() throws Exception {
AdaptrisMarshaller marshaller = createMarshaller();
Adapter adapter = createMarshallingObject();
String s = marshaller.marshal(adapter);
assertRoundtripEquality(adapter, AdaptrisMarshaller.uncheckedUnmarshal(marshaller, adapter, () -> {
return new ByteArrayInputStream(s.getBytes());
}));
}
Aggregations