Search in sources :

Example 46 with TenantName

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));
}
Also used : TenantName(com.yahoo.config.provision.TenantName) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 47 with TenantName

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);
}
Also used : HashMap(java.util.HashMap) TenantName(com.yahoo.config.provision.TenantName) SuperModel(com.yahoo.config.model.api.SuperModel) ApplicationInfo(com.yahoo.config.model.api.ApplicationInfo) HashMap(java.util.HashMap) Map(java.util.Map)

Example 48 with TenantName

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);
}
Also used : SlimeJsonResponse(com.yahoo.vespa.hosted.controller.restapi.SlimeJsonResponse) TenantName(com.yahoo.config.provision.TenantName) Slime(com.yahoo.slime.Slime) Cursor(com.yahoo.slime.Cursor) Application(com.yahoo.vespa.hosted.controller.Application)

Aggregations

TenantName (com.yahoo.config.provision.TenantName)48 Test (org.junit.Test)15 ApplicationId (com.yahoo.config.provision.ApplicationId)12 Map (java.util.Map)12 LinkedHashMap (java.util.LinkedHashMap)11 Tenant (com.yahoo.vespa.config.server.tenant.Tenant)9 LbServicesConfig (com.yahoo.cloud.config.LbServicesConfig)4 ApplicationInfo (com.yahoo.config.model.api.ApplicationInfo)4 ApplicationName (com.yahoo.config.provision.ApplicationName)4 SuperModel (com.yahoo.config.model.api.SuperModel)3 Slime (com.yahoo.slime.Slime)3 TimeoutBudget (com.yahoo.vespa.config.server.TimeoutBudget)3 PrepareParams (com.yahoo.vespa.config.server.session.PrepareParams)3 File (java.io.File)3 ArrayList (java.util.ArrayList)3 DeployLogger (com.yahoo.config.application.api.DeployLogger)2 DeployState (com.yahoo.config.model.deploy.DeployState)2 Version (com.yahoo.config.provision.Version)2 Zone (com.yahoo.config.provision.Zone)2 ConfigKey (com.yahoo.vespa.config.ConfigKey)2