Search in sources :

Example 56 with BoundedContext

use of io.spine.server.BoundedContext in project core-java by SpineEventEngine.

the class TenantRepositoryShould method setUp.

@Before
public void setUp() {
    final BoundedContext bc = BoundedContext.newBuilder().build();
    TenantRepository<?, ?> impl = new TenantRepositoryImpl();
    impl.initStorage(bc.getStorageFactory());
    repository = spy(impl);
}
Also used : BoundedContext(io.spine.server.BoundedContext) Before(org.junit.Before)

Example 57 with BoundedContext

use of io.spine.server.BoundedContext in project core-java by SpineEventEngine.

the class StandPostShould method projectionRepositoryDispatch.

private static BoundedContextAction projectionRepositoryDispatch() {
    return new BoundedContextAction() {

        @Override
        public void perform(BoundedContext context) {
            // Init repository
            final ProjectionRepository repository = Given.projectionRepo();
            repository.initStorage(storageFactory(context.isMultitenant()));
            // Dispatch an update from projection repo
            repository.dispatch(EventEnvelope.of(Given.validEvent()));
        }
    };
}
Also used : ProjectionRepository(io.spine.server.projection.ProjectionRepository) BoundedContext(io.spine.server.BoundedContext)

Example 58 with BoundedContext

use of io.spine.server.BoundedContext in project core-java by SpineEventEngine.

the class StandShould method register_projection_repositories.

@Test
public void register_projection_repositories() {
    final boolean multitenant = isMultitenant();
    final BoundedContext boundedContext = BoundedContext.newBuilder().setMultitenant(multitenant).build();
    final Stand stand = boundedContext.getStand();
    checkTypesEmpty(stand);
    final StandTestProjectionRepository standTestProjectionRepo = new StandTestProjectionRepository();
    stand.registerTypeSupplier(standTestProjectionRepo);
    checkHasExactlyOne(stand.getExposedTypes(), Project.getDescriptor());
    final ImmutableSet<TypeUrl> knownAggregateTypes = stand.getExposedAggregateTypes();
    // As we registered a projection repo, known aggregate types should be still empty.
    assertTrue("For some reason an aggregate type was registered", knownAggregateTypes.isEmpty());
    final StandTestProjectionRepository anotherTestProjectionRepo = new StandTestProjectionRepository();
    stand.registerTypeSupplier(anotherTestProjectionRepo);
    checkHasExactlyOne(stand.getExposedTypes(), Project.getDescriptor());
}
Also used : BoundedContext(io.spine.server.BoundedContext) TypeUrl(io.spine.type.TypeUrl) StandTestProjectionRepository(io.spine.server.stand.Given.StandTestProjectionRepository) Test(org.junit.Test) TenantAwareTest(io.spine.server.tenant.TenantAwareTest)

Aggregations

BoundedContext (io.spine.server.BoundedContext)58 Test (org.junit.Test)34 Event (io.spine.core.Event)12 InMemoryTransportFactory (io.spine.server.integration.memory.InMemoryTransportFactory)12 Before (org.junit.Before)9 Rejection (io.spine.core.Rejection)6 Ack (io.spine.core.Ack)5 Message (com.google.protobuf.Message)4 Error (io.spine.base.Error)4 TypeUrl (io.spine.type.TypeUrl)4 Any (com.google.protobuf.Any)3 StringValue (com.google.protobuf.StringValue)3 Command (io.spine.core.Command)3 CommandEnvelope (io.spine.core.CommandEnvelope)3 TenantId (io.spine.core.TenantId)3 CustomerAggregateRepository (io.spine.server.Given.CustomerAggregateRepository)3 EventBus (io.spine.server.event.EventBus)3 StandTestProjectionRepository (io.spine.server.stand.Given.StandTestProjectionRepository)3 TenantAwareTest (io.spine.server.tenant.TenantAwareTest)3 NullPointerTester (com.google.common.testing.NullPointerTester)2