TenantRepository { public Tenant getTenant(TenantName tenantName) { return tenants.get(tenantName); } @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 testStartUp() { assertEquals(tenantRepository.getTenant(tenant1).getName(), tenant1); assertEquals(tenantRepository.getTenant(tenant2).getName(), tenant2); }
@Test public void testListenersAdded() throws IOException, SAXException { TenantApplications applicationRepo = tenantRepository.getTenant(tenant1).getApplicationRepo(); ApplicationId id = ApplicationId.from(tenant1, ApplicationName.defaultName(), InstanceName.defaultName()); applicationRepo.createApplication(id); applicationRepo.createPutTransaction(id, 4).commit(); applicationRepo.reloadConfig(ApplicationSet.fromSingle( new Application(new VespaModel(MockApplicationPackage.createEmpty()), new ServerCache(), 4L, false, new Version(1, 2, 3), MetricUpdater.createTestUpdater(), id))); assertEquals(1, listener.reloaded.get()); }