use of io.spine.client.ActorRequestFactory in project core-java by SpineEventEngine.
the class MultiTenantStandShould method not_trigger_updates_of_aggregate_records_for_another_tenant_subscriptions.
@Test
public void not_trigger_updates_of_aggregate_records_for_another_tenant_subscriptions() {
final StandStorage standStorage = InMemoryStorageFactory.newInstance(newName(getClass().getSimpleName()), isMultitenant()).createStandStorage();
final Stand stand = prepareStandWithAggregateRepo(standStorage);
// --- Default Tenant
final ActorRequestFactory requestFactory = getRequestFactory();
final MemoizeEntityUpdateCallback defaultTenantCallback = subscribeToAllOf(stand, requestFactory, Customer.class);
// --- Another Tenant
final TenantId anotherTenant = newUuid();
final ActorRequestFactory anotherFactory = createRequestFactory(anotherTenant);
final MemoizeEntityUpdateCallback anotherCallback = subscribeToAllOf(stand, anotherFactory, Customer.class);
// Trigger updates in Default Tenant.
final Map.Entry<CustomerId, Customer> sampleData = fillSampleCustomers(1).entrySet().iterator().next();
final CustomerId customerId = sampleData.getKey();
final Customer customer = sampleData.getValue();
final Version stateVersion = GivenVersion.withNumber(1);
stand.update(asEnvelope(customerId, customer, stateVersion));
final Any packedState = AnyPacker.pack(customer);
// Verify that Default Tenant callback has got the update.
assertEquals(packedState, defaultTenantCallback.getNewEntityState());
// And Another Tenant callback has not been called.
assertEquals(null, anotherCallback.getNewEntityState());
}
use of io.spine.client.ActorRequestFactory in project core-java by SpineEventEngine.
the class CommandsShould method obtain_type_url_of_command.
@Test
public void obtain_type_url_of_command() {
final ActorRequestFactory factory = TestActorRequestFactory.newInstance(CommandsShould.class);
final StringValue message = toMessage(Identifier.newUuid());
final Command command = factory.command().create(message);
final TypeUrl typeUrl = CommandEnvelope.of(command).getTypeName().toUrl();
assertEquals(TypeUrl.of(StringValue.class), typeUrl);
}
Aggregations