TenantRepository { public synchronized Tenant addTenant(TenantName tenantName) { writeTenantPath(tenantName); return createTenant(tenantName, componentRegistry.getClock().instant()); } @Inject  TenantRepository(GlobalComponentRegistry componentRegistry); synchronized Tenant addTenant(TenantName tenantName); void createAndWriteTenantMetaData(Tenant tenant); Transaction createWriteTenantMetaDataTransaction(TenantMetaData tenantMetaData); TenantMetaData getTenantMetaData(Tenant tenant); synchronized void updateTenants(); Instant readCreatedTimeFromZooKeeper(TenantName tenantName); synchronized Tenant defaultTenant(); synchronized void deleteTenant(TenantName name); static String logPre(ApplicationId app); static String logPre(TenantName tenant); void close(); boolean checkThatTenantExists(TenantName tenant); Tenant getTenant(TenantName tenantName); Set<TenantName> getAllTenantNames(); Collection<Tenant> getAllTenants(); static Path getTenantPath(TenantName tenantName); static Path getSessionsPath(TenantName tenantName); static Path getApplicationsPath(TenantName tenantName); static Path getLocksPath(TenantName tenantName); Curator getCurator(); static final TenantName HOSTED_VESPA_TENANT; }
@Test public void testAddTenant() throws Exception { Set<TenantName> allTenants = tenantRepository.getAllTenantNames(); assertTrue(allTenants.contains(tenant1)); assertTrue(allTenants.contains(tenant2)); tenantRepository.addTenant(tenant3); assertZooKeeperTenantPathExists(tenant3); allTenants = tenantRepository.getAllTenantNames(); assertTrue(allTenants.contains(tenant1)); assertTrue(allTenants.contains(tenant2)); assertTrue(allTenants.contains(tenant3)); }