Package org.axonframework.saga

Examples of org.axonframework.saga.Saga


        reset(sagaCache, associationsCache);

        when(repository.load("id")).thenReturn(saga);

        Saga actual = testSubject.load("id");
        assertSame(saga, actual);

        verify(sagaCache).get("id");
        verify(sagaCache).put("id", saga);
        verify(associationsCache, never()).put(any(), any());
View Full Code Here


    @Test
    public void testAddAndLoadSaga_ByIdentifier() {
        String identifier = UUID.randomUUID().toString();
        StubSaga saga = new StubSaga(identifier);
        repository.add(saga);
        Saga loaded = repository.load(identifier);
        assertEquals(identifier, loaded.getSagaIdentifier());
        assertNotNull(entityManager.find(SagaEntry.class, identifier));
    }
View Full Code Here

        StubSaga saga = new StubSaga(identifier);
        saga.registerAssociationValue(new AssociationValue("key", "value"));
        repository.add(saga);
        Set<String> loaded = repository.find(StubSaga.class, new AssociationValue("key", "value"));
        assertEquals(1, loaded.size());
        Saga loadedSaga = repository.load(loaded.iterator().next());
        assertEquals(identifier, loadedSaga.getSagaIdentifier());
        assertNotNull(entityManager.find(SagaEntry.class, identifier));
    }
View Full Code Here

        repository.add(saga);
        saga.registerAssociationValue(new AssociationValue("key", "value"));
        repository.commit(saga);
        Set<String> loaded = repository.find(StubSaga.class, new AssociationValue("key", "value"));
        assertEquals(1, loaded.size());
        Saga loadedSaga = repository.load(loaded.iterator().next());
        assertEquals(identifier, loadedSaga.getSagaIdentifier());
        assertNotNull(entityManager.find(SagaEntry.class, identifier));
    }
View Full Code Here

        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

                                                        identifier, new AssociationValue("key", "value")));
        entityManager.flush();
        entityManager.clear();
        Set<String> loaded = repository.find(StubSaga.class, new AssociationValue("key", "value"));
        assertEquals(1, loaded.size());
        Saga loadedSaga = repository.load(loaded.iterator().next());
        assertEquals(identifier, loadedSaga.getSagaIdentifier());
        assertNotSame(loadedSaga, saga);
        assertNotNull(entityManager.find(SagaEntry.class, identifier));
    }
View Full Code Here

        StubSaga saga = new StubSaga(identifier);
        repository.storeSaga(saga);
        StubSaga loaded = (StubSaga) repository.load(identifier);
        repository.commit(loaded);

        Saga load = repository.load(identifier);
        assertNotSame(loaded, load);
    }
View Full Code Here

        StubSaga saga = new StubSaga(identifier);
        repository.storeSaga(saga);
        StubSaga loaded = (StubSaga) repository.load(identifier);
        repository.commit(loaded);

        Saga load = repository.load(identifier);
        assertNotSame(loaded, load);

        uow.commit();

        // the datasource should only have been asked once
View Full Code Here

    @Test
    public void testAddAndLoadSaga_ByIdentifier() {
        String identifier = UUID.randomUUID().toString();
        StubSaga saga = new StubSaga(identifier);
        repository.add(saga);
        Saga loaded = repository.load(identifier);
        assertEquals(identifier, loaded.getSagaIdentifier());
        assertNotNull(entityManager.find(SagaEntry.class, identifier));
    }
View Full Code Here

        StubSaga saga = new StubSaga(identifier);
        saga.registerAssociationValue(new AssociationValue("key", "value"));
        repository.add(saga);
        Set<String> loaded = repository.find(StubSaga.class, new AssociationValue("key", "value"));
        assertEquals(1, loaded.size());
        Saga loadedSaga = repository.load(loaded.iterator().next());
        assertEquals(identifier, loadedSaga.getSagaIdentifier());
        assertNotNull(entityManager.find(SagaEntry.class, identifier));
    }
View Full Code Here

TOP

Related Classes of org.axonframework.saga.Saga

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.