Package org.axonframework.serializer.xml

Examples of org.axonframework.serializer.xml.XStreamSerializer


        assertNotNull(deserialized2.getUncommittedEvents().next());
        assertEquals(1, deserialized2.getUncommittedEventCount());
    }

    private AggregateRoot deserialized(ByteArrayOutputStream baos) {
        XStreamSerializer serializer = new XStreamSerializer();
        return (AggregateRoot) serializer.deserialize(new SimpleSerializedObject<byte[]>(baos.toByteArray(),
                                                                                         byte[].class,
                                                                                         "ignored",
                                                                                         "0"));
    }
View Full Code Here


        // let's start with the local Command Bus that registers the handlers
        CommandBus localSegment = new SimpleCommandBus();

        // Configure the required components for jgroup, first een channel and serializer
        JChannel channel = new JChannel("tcp_gossip.xml");
        Serializer serializer = new XStreamSerializer();

        // Use the jgroup channel and the serializer to setup the connector to the jgroup cluster
        JGroupsConnector connector = new JGroupsConnector(channel, "myCluster", localSegment, serializer);

        // Setup the distributed command bus using the connector and the routing strategy
View Full Code Here

    private static final Charset UTF8 = Charset.forName("UTF-8");

    @Test
    public void testSerialize_XStreamWithPureJavaReflectionProvider() {
        XStream xstream = new XStream(new PureJavaReflectionProvider());
        XStreamSerializer serializer = new XStreamSerializer(UTF8, xstream, new SerialVersionUIDRevisionResolver());

        StubAnnotatedAggregate aggregateRoot = new StubAnnotatedAggregate(UUID.randomUUID());
        aggregateRoot.doSomething();
        String xml = new String(serializer.serialize(aggregateRoot, byte[].class).getData(), UTF8);
        assertNotNull(xml);

        StubAnnotatedAggregate unmarshalled = (StubAnnotatedAggregate) serializer.deserialize(
                new SimpleSerializedObject<byte[]>(xml.getBytes(UTF8), byte[].class, "ignored", "0"));

        validateAggregateCondition(aggregateRoot, unmarshalled);
    }
View Full Code Here

    }

    @Test
    public void testSerialize_XStreamWithDefaultReflectionProvider() {
        XStream xstream = new XStream();
        XStreamSerializer serializer = new XStreamSerializer(UTF8, xstream, new AnnotationRevisionResolver());

        StubAnnotatedAggregate aggregateRoot = new StubAnnotatedAggregate(UUID.randomUUID());
        aggregateRoot.doSomething();
        byte[] data = serializer.serialize(aggregateRoot, byte[].class).getData();
        String xml = new String(data, UTF8);
        assertNotNull(xml);

        StubAnnotatedAggregate unmarshalled = (StubAnnotatedAggregate) serializer.deserialize(
                new SimpleSerializedObject<byte[]>(data, byte[].class, "ignored", "0"));

        validateAggregateCondition(aggregateRoot, unmarshalled);
    }
View Full Code Here

public class MessageStreamTest {

    @Test
    public void testStreamEventMessage() throws Exception {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        XStreamSerializer serializer = new XStreamSerializer();
        EventMessageWriter out = new EventMessageWriter(new DataOutputStream(baos), serializer);
        GenericEventMessage<String> message = new GenericEventMessage<String>("This is the payload",
                                                                              Collections.<String, Object>singletonMap(
                                                                                      "metaKey",
                                                                                      "MetaValue"));
View Full Code Here

    }

    @Test
    public void testStreamDomainEventMessage() throws Exception {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        XStreamSerializer serializer = new XStreamSerializer();
        EventMessageWriter out = new EventMessageWriter(new DataOutputStream(baos), serializer);
        GenericDomainEventMessage<String> message = new GenericDomainEventMessage<String>(
                "AggregateID", 1L, "This is the payload", Collections.<String, Object>singletonMap("metaKey",
                                                                                                   "MetaValue"));
        out.writeEventMessage(message);
View Full Code Here

*/
public class ClusterMessageListenerTest {

    @Test
    public void testMessageListenerInvokesAllClusters() throws Exception {
        Serializer serializer = new XStreamSerializer();
        Cluster cluster = mock(Cluster.class);
        ClusterMessageListener testSubject = new ClusterMessageListener(cluster,
                                                                        new DefaultAMQPMessageConverter(serializer));

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
View Full Code Here

        }));
    }

    @Test
    public void testMessageListenerIgnoredOnDeserializationFailure() throws Exception {
        Serializer serializer = new XStreamSerializer();
        Cluster cluster = mock(Cluster.class);
        ClusterMessageListener testSubject = new ClusterMessageListener(cluster,
                                                                        new DefaultAMQPMessageConverter(serializer));

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
View Full Code Here

     * SnapshotEventEntry}.
     *
     * @param entityManagerProvider The EntityManagerProvider providing the EntityManager instance for this EventStore
     */
    public JpaEventStore(EntityManagerProvider entityManagerProvider) {
        this(entityManagerProvider, new XStreamSerializer(), new DefaultEventEntryStore());
    }
View Full Code Here

     *
     * @param entityManagerProvider The EntityManagerProvider providing the EntityManager instance for this EventStore
     * @param eventEntryStore       The instance providing persistence logic for Domain Event entries
     */
    public JpaEventStore(EntityManagerProvider entityManagerProvider, EventEntryStore eventEntryStore) {
        this(entityManagerProvider, new XStreamSerializer(), eventEntryStore);
    }
View Full Code Here

TOP

Related Classes of org.axonframework.serializer.xml.XStreamSerializer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.