use of io.spine.users.TenantId in project core-java by SpineEventEngine.
the class TenantAwareOperationShould method create_instance_for_non_command_execution_context.
@Test
public void create_instance_for_non_command_execution_context() {
final TenantId tenant = newTenantUuid();
CurrentTenant.set(tenant);
final TenantAwareOperation op = createOperation();
assertEquals(tenant, op.tenantId());
op.execute();
assertEquals(tenant, getTenantFromRun(op));
}
use of io.spine.users.TenantId in project core-java by SpineEventEngine.
the class TenantRepositoryShould method cache_passed_value.
@Test
public void cache_passed_value() {
final TenantId tenantId = newTenantUuid();
repository.keep(tenantId);
repository.keep(tenantId);
verify(repository, times(1)).find(tenantId);
}
use of io.spine.users.TenantId in project core-java by SpineEventEngine.
the class TenantRepositoryShould method clear_cache.
@Test
public void clear_cache() {
final TenantId tenantId = newTenantUuid();
repository.keep(tenantId);
repository.clearCache();
assertFalse(repository.unCache(tenantId));
}
use of io.spine.users.TenantId in project core-java by SpineEventEngine.
the class TenantRepositoryShould method un_cache_values.
@Test
public void un_cache_values() {
final TenantId tenantId = newTenantUuid();
repository.keep(tenantId);
assertTrue(repository.unCache(tenantId));
assertFalse(repository.unCache(tenantId));
}
use of io.spine.users.TenantId in project core-java by SpineEventEngine.
the class CurrentTenantShould method keep_set_value.
// we check isPresent() in assertion
@SuppressWarnings("OptionalGetWithoutIsPresent")
@Test
public void keep_set_value() {
final TenantId expected = newTenantId(getClass());
CurrentTenant.set(expected);
final Optional<TenantId> currentTenant = CurrentTenant.get();
assertTrue(currentTenant.isPresent());
assertEquals(expected, currentTenant.get());
}
Aggregations