Search in sources :

Example 41 with TenantId

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

the class CommandFactoryShould method set_tenant_ID_in_commands_when_created_with_tenant_ID.

@Test
public void set_tenant_ID_in_commands_when_created_with_tenant_ID() {
    final TenantId tenantId = TenantId.newBuilder().setValue(getClass().getSimpleName()).build();
    final ActorRequestFactory mtFactory = ActorRequestFactory.newBuilder().setTenantId(tenantId).setActor(getActor()).setZoneOffset(getZoneOffset()).build();
    final Command command = mtFactory.command().create(StringValue.getDefaultInstance());
    assertEquals(tenantId, command.getContext().getActorContext().getTenantId());
}
Also used : TenantId(io.spine.core.TenantId) GivenTenantId(io.spine.core.given.GivenTenantId) Command(io.spine.core.Command) RequiredFieldCommand(io.spine.test.commands.RequiredFieldCommand) Test(org.junit.Test)

Aggregations

TenantId (io.spine.core.TenantId)41 Test (org.junit.Test)27 Command (io.spine.core.Command)17 Ack (io.spine.core.Ack)11 Event (io.spine.core.Event)6 AggregateMessageDispatcher.dispatchCommand (io.spine.server.aggregate.AggregateMessageDispatcher.dispatchCommand)6 AggregateTestEnv.newTenantId (io.spine.server.aggregate.given.aggregate.AggregateTestEnv.newTenantId)6 CommandBus (io.spine.server.commandbus.CommandBus)6 Error (io.spine.base.Error)4 CommandId (io.spine.core.CommandId)4 IdempotencyGuardTestEnv.newProjectId (io.spine.server.aggregate.given.IdempotencyGuardTestEnv.newProjectId)4 IdempotencyGuardTestEnv.newTenantId (io.spine.server.aggregate.given.IdempotencyGuardTestEnv.newTenantId)4 IgTestAggregate (io.spine.server.aggregate.given.aggregate.IgTestAggregate)4 Nullable (javax.annotation.Nullable)4 ActorContext (io.spine.core.ActorContext)3 CommandContext (io.spine.core.CommandContext)3 Rejection (io.spine.core.Rejection)3 BoundedContext (io.spine.server.BoundedContext)3 AggregateMessageDispatcher.dispatchRejection (io.spine.server.aggregate.AggregateMessageDispatcher.dispatchRejection)3 AggregateTestEnv.newTaskBoundedContext (io.spine.server.aggregate.given.aggregate.AggregateTestEnv.newTaskBoundedContext)3