TenantRepository { public void close() { directoryCache.ifPresent(Curator.DirectoryCache::close); try { zkCacheExecutor.shutdown(); checkForRemovedApplicationsService.shutdown(); zkWatcherExecutor.shutdownAndWait(); zkCacheExecutor.awaitTermination(50, TimeUnit.SECONDS); checkForRemovedApplicationsService.awaitTermination(50, TimeUnit.SECONDS); } catch (InterruptedException e) { log.log(Level.WARNING, "Interrupted while shutting down.", e); Thread.currentThread().interrupt(); } } @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 testFailingBootstrap() throws IOException { tenantRepository.close(); expectedException.expect(RuntimeException.class); expectedException.expectMessage("Could not create all tenants when bootstrapping, failed to create: [default]"); new FailingDuringBootstrapTenantRepository(createComponentRegistry()); }