Package org.axonframework.serializer.xml

Examples of org.axonframework.serializer.xml.XStreamSerializer.serialize()


    @Test
    public void testSerializability_GenericXStreamSerializer() throws IOException {
        XStreamSerializer serializer = new XStreamSerializer();
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        baos.write(serializer.serialize(testSubject, byte[].class).getData());

        assertEquals(0, deserialized(baos).getUncommittedEventCount());
        assertFalse(deserialized(baos).getUncommittedEvents().hasNext());
        assertNotNull(deserialized(baos).getIdentifier());
View Full Code Here


        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"));
View Full Code Here

        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"));
View Full Code Here

    @Test
    public void testSerializationSetsLiveStateToTrue() throws Exception {
        LateIdentifiedAggregate aggregate = new LateIdentifiedAggregate();
        aggregate.commitEvents();
        final XStreamSerializer serializer = new XStreamSerializer();
        SerializedObject<String> serialized = serializer.serialize(aggregate, String.class);

        LateIdentifiedAggregate deserializedAggregate = serializer.deserialize(serialized);
        assertTrue(deserializedAggregate.isLive());
    }
View Full Code Here

        aggregateRoot.invoke();
        assertEquals(2, aggregateRoot.getInvocations());
        assertEquals(2, aggregateRoot.getEntity().getInvocations());
        aggregateRoot.commitEvents();
        XStreamSerializer serializer = new XStreamSerializer();
        SerializedObject<byte[]> serialized = serializer.serialize(aggregateRoot, byte[].class);
        StructuredAggregateRoot deserializedAggregate = (StructuredAggregateRoot) serializer.deserialize(serialized);

        deserializedAggregate.invoke();
        assertEquals(3, deserializedAggregate.getInvocations());
        assertEquals(3, deserializedAggregate.getEntity().getInvocations());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.