Package org.axonframework.serializer.xml

Examples of org.axonframework.serializer.xml.XStreamSerializer


    private Serializer serializer;
    private List<SimpleMessageListenerContainer> containersCreated = new ArrayList<SimpleMessageListenerContainer>();

    @Before
    public void setUp() throws Exception {
        serializer = spy(new XStreamSerializer());
        mockConnectionFactory = mock(ConnectionFactory.class);

        testSubject = new ListenerContainerLifecycleManager() {
            @Override
            public SimpleMessageListenerContainer createContainer(SpringAMQPConsumerConfiguration config) {
View Full Code Here


        // the serialized form of the Saga exceeds the default length of a blob.
        // So we must alter the table to prevent data truncation
        entityManager.createNativeQuery("ALTER TABLE SagaEntry ALTER COLUMN serializedSaga VARBINARY(1024)")
                     .executeUpdate();
        serializer = new XStreamSerializer();
    }
View Full Code Here

    }

    @DirtiesContext
    @Test
    public void testLoadUncachedSaga_ByIdentifier() {
        repository.setSerializer(new XStreamSerializer());
        String identifier = UUID.randomUUID().toString();
        StubSaga saga = new StubSaga(identifier);
        entityManager.persist(new SagaEntry(saga, new XStreamSerializer()));
        entityManager.flush();
        entityManager.clear();
        Saga loaded = repository.load(identifier);
        assertNotSame(saga, loaded);
        assertEquals(identifier, loaded.getSagaIdentifier());
View Full Code Here

    @DirtiesContext
    @Test
    public void testSaveSaga() {
        String identifier = UUID.randomUUID().toString();
        StubSaga saga = new StubSaga(identifier);
        entityManager.persist(new SagaEntry(saga, new XStreamSerializer()));
        entityManager.flush();
        StubSaga loaded = (StubSaga) repository.load(identifier);
        repository.commit(loaded);

        entityManager.clear();

        SagaEntry entry = entityManager.find(SagaEntry.class, identifier);
        StubSaga actualSaga = (StubSaga) entry.getSaga(new XStreamSerializer());
        assertNotSame(loaded, actualSaga);
    }
View Full Code Here

        // the serialized form of the Saga exceeds the default length of a blob.
        // So we must alter the table to prevent data truncation
        entityManager.createNativeQuery("ALTER TABLE SagaEntry ALTER COLUMN serializedSaga VARBINARY(1024)")
                     .executeUpdate();
        serializer = new XStreamSerializer();
        repository.setSerializer(serializer);
    }
View Full Code Here

    }

    @DirtiesContext
    @Test
    public void testLoadUncachedSaga_ByIdentifier() {
        repository.setSerializer(new XStreamSerializer());
        String identifier = UUID.randomUUID().toString();
        StubSaga saga = new StubSaga(identifier);
        entityManager.persist(new SagaEntry(saga, new XStreamSerializer()));
        entityManager.flush();
        entityManager.clear();
        Saga loaded = repository.load(identifier);
        assertNotSame(saga, loaded);
        assertEquals(identifier, loaded.getSagaIdentifier());
View Full Code Here

    @DirtiesContext
    @Test
    public void testSaveSaga() {
        String identifier = UUID.randomUUID().toString();
        StubSaga saga = new StubSaga(identifier);
        entityManager.persist(new SagaEntry(saga, new XStreamSerializer()));
        StubSaga loaded = (StubSaga) repository.load(identifier);
        repository.commit(loaded);

        entityManager.clear();

        SagaEntry entry = entityManager.find(SagaEntry.class, identifier);
        StubSaga actualSaga = (StubSaga) entry.getSaga(new XStreamSerializer());
        assertNotSame(loaded, actualSaga);
    }
View Full Code Here

public class CassandraEventStoreTest {

    @Test
    public void testStoreAndReadEvents() {
        EmbeddedCassandra.start();
        CassandraEventStore cassandraEventStore = new CassandraEventStore(new XStreamSerializer(),
                                                                          EmbeddedCassandra.CLUSTER_NAME,
                                                                          EmbeddedCassandra.KEYSPACE_NAME,
                                                                          EmbeddedCassandra.CF_NAME,
                                                                          EmbeddedCassandra.HOSTS);
        final int batch_count = 100;
View Full Code Here

        // we want to delete the directory that will store our events
        final File eventsDir = new File(System.getProperty("java.io.tmpdir"), "Events");
        FileUtils.deleteDirectory(eventsDir);

        // we create a serializer, so we can ensure the event store and the upcasters use the same configuration
        Serializer serializer = new XStreamSerializer();
        // initialize a FileSystem Event Store
        FileSystemEventStore eventStore = new FileSystemEventStore(serializer, new SimpleEventFileResolver(eventsDir));
        // initialize the upcaster chain with our upcaster
        eventStore.setUpcasterChain(new LazyUpcasterChain(serializer,
                                                          Collections.<Upcaster>singletonList(new ToDoItemUpcaster())));
View Full Code Here

        testSubject = new AggregateRoot();
    }

    @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

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.