Search in sources :

Example 1 with CommandStore

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

the class AbstractCommandBusTestSuite method setUp.

@Before
public void setUp() {
    final InMemoryStorageFactory storageFactory = InMemoryStorageFactory.getInstance(this.multitenant);
    final TenantIndex tenantIndex = TenantAwareTest.createTenantIndex(this.multitenant, storageFactory);
    commandStore = spy(new CommandStore(storageFactory, tenantIndex));
    scheduler = spy(new ExecutorCommandScheduler());
    log = spy(new Log());
    failureBus = spy(FailureBus.newBuilder().build());
    commandBus = CommandBus.newBuilder().setMultitenant(this.multitenant).setCommandStore(commandStore).setCommandScheduler(scheduler).setFailureBus(failureBus).setThreadSpawnAllowed(false).setLog(log).setAutoReschedule(false).build();
    eventBus = EventBus.newBuilder().setStorageFactory(storageFactory).build();
    requestFactory = this.multitenant ? TestActorRequestFactory.newInstance(getClass(), newTenantUuid()) : TestActorRequestFactory.newInstance(getClass());
    createProjectHandler = new CreateProjectHandler();
    responseObserver = new TestResponseObserver();
}
Also used : ExecutorCommandScheduler(io.spine.server.commandbus.ExecutorCommandScheduler) TestResponseObserver(io.spine.server.commandbus.TestResponseObserver) Log(io.spine.server.commandbus.Log) InMemoryStorageFactory(io.spine.server.storage.memory.InMemoryStorageFactory) CommandStore(io.spine.server.commandstore.CommandStore) TenantIndex(io.spine.server.tenant.TenantIndex) Before(org.junit.Before)

Example 2 with CommandStore

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

the class CommandBusBuilderShould method set_command_store.

@Test
public void set_command_store() {
    final CommandStore commandStore = mock(CommandStore.class);
    assertEquals(commandStore, CommandBus.newBuilder().setCommandStore(commandStore).getCommandStore());
}
Also used : CommandStore(io.spine.server.commandstore.CommandStore) TenantAwareTest(io.spine.server.tenant.TenantAwareTest) Test(org.junit.Test)

Example 3 with CommandStore

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

the class ProcessManagerShould method setUp.

@Before
public void setUp() {
    final StorageFactory storageFactory = StorageFactorySwitch.get(true);
    final TenantIndex tenantIndex = TenantAwareTest.createTenantIndex(false, storageFactory);
    final CommandStore commandStore = spy(new CommandStore(storageFactory, tenantIndex));
    commandBus = spy(CommandBus.newBuilder().setCommandStore(commandStore).build());
    processManager = Given.processManagerOfClass(TestProcessManager.class).withId(ID).withVersion(2).withState(Any.getDefaultInstance()).build();
}
Also used : StorageFactory(io.spine.server.storage.StorageFactory) CommandStore(io.spine.server.commandstore.CommandStore) TenantIndex(io.spine.server.tenant.TenantIndex) Before(org.junit.Before)

Example 4 with CommandStore

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

the class AggregateCommandEndpointShould method setUp.

@Before
public void setUp() {
    projectId = ProjectId.newBuilder().setId(Identifiers.newUuid()).build();
    final CommandStore commandStore = mock(CommandStore.class);
    final CommandBus.Builder commandBus = CommandBus.newBuilder().setMultitenant(true).setCommandStore(commandStore);
    final BoundedContext boundedContext = newBoundedContext(commandBus);
    subscriber = new Subscriber();
    boundedContext.getEventBus().register(subscriber);
    repository = new ProjectAggregateRepository(boundedContext);
    repositorySpy = spy(repository);
}
Also used : EventSubscriber(io.spine.server.event.EventSubscriber) CommandStore(io.spine.server.commandstore.CommandStore) MultiTenant.newBoundedContext(io.spine.testdata.TestBoundedContextFactory.MultiTenant.newBoundedContext) BoundedContext(io.spine.server.BoundedContext) CommandBus(io.spine.server.commandbus.CommandBus) Before(org.junit.Before)

Example 5 with CommandStore

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

the class CommandBusBuilderShould method setUp.

@Before
public void setUp() {
    final boolean multitenant = true;
    final InMemoryStorageFactory storageFactory = InMemoryStorageFactory.getInstance(multitenant);
    final TenantIndex tenantIndex = TenantAwareTest.createTenantIndex(multitenant, storageFactory);
    commandStore = new CommandStore(storageFactory, tenantIndex);
}
Also used : InMemoryStorageFactory(io.spine.server.storage.memory.InMemoryStorageFactory) CommandStore(io.spine.server.commandstore.CommandStore) TenantIndex(io.spine.server.tenant.TenantIndex) Before(org.junit.Before)

Aggregations

CommandStore (io.spine.server.commandstore.CommandStore)5 Before (org.junit.Before)4 TenantIndex (io.spine.server.tenant.TenantIndex)3 InMemoryStorageFactory (io.spine.server.storage.memory.InMemoryStorageFactory)2 BoundedContext (io.spine.server.BoundedContext)1 CommandBus (io.spine.server.commandbus.CommandBus)1 ExecutorCommandScheduler (io.spine.server.commandbus.ExecutorCommandScheduler)1 Log (io.spine.server.commandbus.Log)1 TestResponseObserver (io.spine.server.commandbus.TestResponseObserver)1 EventSubscriber (io.spine.server.event.EventSubscriber)1 StorageFactory (io.spine.server.storage.StorageFactory)1 TenantAwareTest (io.spine.server.tenant.TenantAwareTest)1 MultiTenant.newBoundedContext (io.spine.testdata.TestBoundedContextFactory.MultiTenant.newBoundedContext)1 Test (org.junit.Test)1