Search in sources :

Example 61 with AdaptrisMarshaller

use of com.adaptris.core.AdaptrisMarshaller in project interlok by adaptris.

the class MarshallingBaseCase method testMarshalToWriter.

@Test
public void testMarshalToWriter() throws Exception {
    AdaptrisMarshaller marshaller = createMarshaller();
    Adapter adapter = createMarshallingObject();
    StringWriter out = new StringWriter();
    marshaller.marshal(adapter, out);
}
Also used : StringWriter(java.io.StringWriter) AdaptrisMarshaller(com.adaptris.core.AdaptrisMarshaller) Adapter(com.adaptris.core.Adapter) Test(org.junit.Test)

Example 62 with AdaptrisMarshaller

use of com.adaptris.core.AdaptrisMarshaller in project interlok by adaptris.

the class MarshallingBaseCase method testUnmarshalWithTransient.

@Test
public void testUnmarshalWithTransient() throws Exception {
    AdaptrisMarshaller marshaller = createMarshaller();
    Channel channel = new Channel();
    // availability starts off as "true"
    channel.toggleAvailability(false);
    assertEquals(false, channel.isAvailable());
    String xml = marshaller.marshal(channel);
    Channel c2 = (Channel) marshaller.unmarshal(xml);
    // availability should still as per constructor if it's marked as transient
    assertNotSame(false, c2.isAvailable());
}
Also used : AdaptrisMarshaller(com.adaptris.core.AdaptrisMarshaller) Channel(com.adaptris.core.Channel) URLString(com.adaptris.util.URLString) Test(org.junit.Test)

Example 63 with AdaptrisMarshaller

use of com.adaptris.core.AdaptrisMarshaller in project interlok by adaptris.

the class MarshallingBaseCase method testUnmarshalFromReader.

@Test
public void testUnmarshalFromReader() throws Exception {
    AdaptrisMarshaller marshaller = createMarshaller();
    Adapter adapter = createMarshallingObject();
    String s = marshaller.marshal(adapter);
    try (StringReader in = new StringReader(s)) {
        assertRoundtripEquality(adapter, marshaller.unmarshal(in));
    }
}
Also used : AdaptrisMarshaller(com.adaptris.core.AdaptrisMarshaller) StringReader(java.io.StringReader) Adapter(com.adaptris.core.Adapter) URLString(com.adaptris.util.URLString) Test(org.junit.Test)

Example 64 with AdaptrisMarshaller

use of com.adaptris.core.AdaptrisMarshaller in project interlok by adaptris.

the class MarshallingBaseCase method testInlineRoundtrip.

@Test
public void testInlineRoundtrip() throws Exception {
    AdaptrisMarshaller marshaller = createMarshaller();
    Adapter adapter = createMarshallingObject();
    String xml = marshaller.marshal(adapter);
    assertRoundtripEquality(adapter, marshaller.unmarshal(xml));
}
Also used : AdaptrisMarshaller(com.adaptris.core.AdaptrisMarshaller) Adapter(com.adaptris.core.Adapter) URLString(com.adaptris.util.URLString) Test(org.junit.Test)

Aggregations

AdaptrisMarshaller (com.adaptris.core.AdaptrisMarshaller)64 Test (org.junit.Test)57 Adapter (com.adaptris.core.Adapter)43 ObjectName (javax.management.ObjectName)21 NullConnection (com.adaptris.core.NullConnection)17 URLString (com.adaptris.util.URLString)11 CoreException (com.adaptris.core.CoreException)10 GuidGenerator (com.adaptris.util.GuidGenerator)9 File (java.io.File)9 ArrayList (java.util.ArrayList)9 IOException (java.io.IOException)7 Channel (com.adaptris.core.Channel)4 NullService (com.adaptris.core.NullService)4 ByteArrayInputStream (java.io.ByteArrayInputStream)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)4 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)3 SharedConnection (com.adaptris.core.SharedConnection)3 StandardWorkflow (com.adaptris.core.StandardWorkflow)3 MockServiceWithConnection (com.adaptris.core.stubs.MockServiceWithConnection)3 URL (java.net.URL)3