use of com.yahoo.config.provision.TenantName in project vespa by vespa-engine.
the class TenantsTestCase method testTenantsChanged.
@Test
public void testTenantsChanged() throws Exception {
tenants = new Tenants(globalComponentRegistry, new ArrayList<>());
tenants.addTenant(tenant2);
tenants.createTenants();
Set<TenantName> allTenants = tenants.getAllTenantNames();
assertTrue(allTenants.contains(tenant2));
tenants.deleteTenant(tenant1);
tenants.deleteTenant(tenant2);
tenants.createTenants();
allTenants = tenants.getAllTenantNames();
assertFalse(allTenants.contains(tenant1));
assertFalse(allTenants.contains(tenant2));
TenantName foo = TenantName.from("foo");
TenantName bar = TenantName.from("bar");
tenants.addTenant(tenant2);
tenants.addTenant(foo);
tenants.addTenant(bar);
tenants.createTenants();
allTenants = tenants.getAllTenantNames();
assertTrue(allTenants.contains(tenant2));
assertTrue(allTenants.contains(foo));
assertTrue(allTenants.contains(bar));
}
use of com.yahoo.config.provision.TenantName in project vespa by vespa-engine.
the class ExampleModel method createExampleSuperModelWithOneRpcPort.
static SuperModel createExampleSuperModelWithOneRpcPort(String hostname, int rpcPort) {
List<String> hosts = Stream.of(hostname).collect(Collectors.toList());
ApplicationInfo applicationInfo = ExampleModel.createApplication(TENANT, APPLICATION_NAME).addServiceCluster(CLUSTER_ID, SERVICE_NAME, SERVICE_TYPE, hosts).addPort(rpcPort, "footag", SlobrokMonitor.SLOBROK_RPC_PORT_TAG).addPort(rpcPort + 1, "bartag").then().build();
Map<TenantName, Map<ApplicationId, ApplicationInfo>> applicationInfos = new HashMap<>();
applicationInfos.put(applicationInfo.getApplicationId().tenant(), new HashMap<>());
applicationInfos.get(applicationInfo.getApplicationId().tenant()).put(applicationInfo.getApplicationId(), applicationInfo);
return new SuperModel(applicationInfos);
}
use of com.yahoo.config.provision.TenantName in project vespa by vespa-engine.
the class ApplicationApiHandler method applications.
private HttpResponse applications(String tenantName, HttpRequest request) {
TenantName tenant = TenantName.from(tenantName);
Slime slime = new Slime();
Cursor array = slime.setArray();
for (Application application : controller.applications().asList(tenant)) toSlime(application, array.addObject(), request);
return new SlimeJsonResponse(slime);
}
Aggregations