Search in sources :

Example 6 with ServiceType

use of com.yahoo.vespa.applicationmodel.ServiceType in project vespa by vespa-engine.

the class ApplicationApiImplTest method testGetNodesInGroupWithStatus.

@Test
public void testGetNodesInGroupWithStatus() {
    HostName hostName1 = modelUtils.createNode("host1", HostStatus.NO_REMARKS);
    HostName hostName2 = modelUtils.createNode("host2", HostStatus.NO_REMARKS);
    HostName hostName3 = modelUtils.createNode("host3", HostStatus.ALLOWED_TO_BE_DOWN);
    ApplicationInstance applicationInstance = modelUtils.createApplicationInstance(Arrays.asList(modelUtils.createServiceCluster("cluster-1", new ServiceType("service-type-1"), Arrays.asList(modelUtils.createServiceInstance("config-id-10", hostName1, ServiceStatus.UP), modelUtils.createServiceInstance("config-id-11", hostName2, ServiceStatus.UP))), modelUtils.createServiceCluster("cluster-2", new ServiceType("service-type-2"), Arrays.asList(modelUtils.createServiceInstance("config-id-20", hostName1, ServiceStatus.UP), modelUtils.createServiceInstance("config-id-21", hostName3, ServiceStatus.UP)))));
    verifyNodesInGroupWithoutRemarks(modelUtils.createApplicationApiImpl(applicationInstance, hostName1), Arrays.asList(hostName1), Arrays.asList());
    verifyNodesInGroupWithoutRemarks(modelUtils.createApplicationApiImpl(applicationInstance, hostName1, hostName2), Arrays.asList(hostName1, hostName2), Arrays.asList());
    verifyNodesInGroupWithoutRemarks(modelUtils.createApplicationApiImpl(applicationInstance, hostName1, hostName2, hostName3), Arrays.asList(hostName1, hostName2), Arrays.asList(hostName3));
    verifyNodesInGroupWithoutRemarks(modelUtils.createApplicationApiImpl(applicationInstance, hostName3), Arrays.asList(), Arrays.asList(hostName3));
}
Also used : ApplicationInstance(com.yahoo.vespa.applicationmodel.ApplicationInstance) ServiceType(com.yahoo.vespa.applicationmodel.ServiceType) HostName(com.yahoo.vespa.applicationmodel.HostName) Test(org.junit.Test)

Example 7 with ServiceType

use of com.yahoo.vespa.applicationmodel.ServiceType in project vespa by vespa-engine.

the class ApplicationApiImplTest method testGetClustersThatAreOnAtLeastOneNodeInGroup.

@Test
public void testGetClustersThatAreOnAtLeastOneNodeInGroup() {
    HostName hostName1 = new HostName("host1");
    HostName hostName2 = new HostName("host2");
    HostName hostName3 = new HostName("host3");
    HostName hostName4 = new HostName("host4");
    ApplicationInstance applicationInstance = modelUtils.createApplicationInstance(Arrays.asList(modelUtils.createServiceCluster("cluster-3", new ServiceType("service-type-3"), Arrays.asList(modelUtils.createServiceInstance("config-id-1", hostName1, ServiceStatus.UP), modelUtils.createServiceInstance("config-id-2", hostName2, ServiceStatus.UP))), modelUtils.createServiceCluster("cluster-1", new ServiceType("service-type-1"), Arrays.asList(modelUtils.createServiceInstance("config-id-3", hostName1, ServiceStatus.UP), modelUtils.createServiceInstance("config-id-4", hostName3, ServiceStatus.UP))), modelUtils.createServiceCluster("cluster-2", new ServiceType("service-type-2"), Arrays.asList(modelUtils.createServiceInstance("config-id-5", hostName1, ServiceStatus.UP), modelUtils.createServiceInstance("config-id-6", hostName2, ServiceStatus.UP)))));
    verifyClustersInOrder(modelUtils.createApplicationApiImpl(applicationInstance, hostName1), 1, 2, 3);
    verifyClustersInOrder(modelUtils.createApplicationApiImpl(applicationInstance, hostName2), 2, 3);
    verifyClustersInOrder(modelUtils.createApplicationApiImpl(applicationInstance, hostName3), 1);
    verifyClustersInOrder(modelUtils.createApplicationApiImpl(applicationInstance, hostName4));
}
Also used : ApplicationInstance(com.yahoo.vespa.applicationmodel.ApplicationInstance) ServiceType(com.yahoo.vespa.applicationmodel.ServiceType) HostName(com.yahoo.vespa.applicationmodel.HostName) Test(org.junit.Test)

Example 8 with ServiceType

use of com.yahoo.vespa.applicationmodel.ServiceType in project vespa by vespa-engine.

the class VespaModelUtilTest method verifyNonControllerClusterIsNotRecognized.

@Test
public void verifyNonControllerClusterIsNotRecognized() {
    ServiceCluster cluster = createServiceCluster(new ServiceType("foo"));
    assertFalse(VespaModelUtil.isClusterController(cluster));
}
Also used : ServiceCluster(com.yahoo.vespa.applicationmodel.ServiceCluster) ServiceType(com.yahoo.vespa.applicationmodel.ServiceType) Test(org.junit.Test)

Example 9 with ServiceType

use of com.yahoo.vespa.applicationmodel.ServiceType in project vespa by vespa-engine.

the class VespaModelUtilTest method verifyNonStorageClusterIsNotRecognized.

@Test
public void verifyNonStorageClusterIsNotRecognized() {
    ServiceCluster cluster = createServiceCluster(new ServiceType("foo"));
    assertFalse(VespaModelUtil.isStorage(cluster));
}
Also used : ServiceCluster(com.yahoo.vespa.applicationmodel.ServiceCluster) ServiceType(com.yahoo.vespa.applicationmodel.ServiceType) Test(org.junit.Test)

Example 10 with ServiceType

use of com.yahoo.vespa.applicationmodel.ServiceType in project vespa by vespa-engine.

the class VespaModelUtilTest method verifyNonContentClusterIsNotRecognized.

@Test
public void verifyNonContentClusterIsNotRecognized() {
    ServiceCluster cluster = createServiceCluster(new ServiceType("foo"));
    assertFalse(VespaModelUtil.isContent(cluster));
}
Also used : ServiceCluster(com.yahoo.vespa.applicationmodel.ServiceCluster) ServiceType(com.yahoo.vespa.applicationmodel.ServiceType) Test(org.junit.Test)

Aggregations

ServiceType (com.yahoo.vespa.applicationmodel.ServiceType)19 Test (org.junit.Test)14 HostName (com.yahoo.vespa.applicationmodel.HostName)10 ServiceCluster (com.yahoo.vespa.applicationmodel.ServiceCluster)9 ApplicationInstance (com.yahoo.vespa.applicationmodel.ApplicationInstance)7 ClusterId (com.yahoo.vespa.applicationmodel.ClusterId)7 ConfigId (com.yahoo.vespa.applicationmodel.ConfigId)6 ApplicationInstanceReference (com.yahoo.vespa.applicationmodel.ApplicationInstanceReference)5 ApplicationInstanceId (com.yahoo.vespa.applicationmodel.ApplicationInstanceId)4 ServiceInstance (com.yahoo.vespa.applicationmodel.ServiceInstance)4 TenantId (com.yahoo.vespa.applicationmodel.TenantId)4 ApplicationId (com.yahoo.config.provision.ApplicationId)3 ServiceClusterKey (com.yahoo.vespa.applicationmodel.ServiceClusterKey)2 ServiceStatus (com.yahoo.vespa.applicationmodel.ServiceStatus)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Map (java.util.Map)2 ApplicationInfo (com.yahoo.config.model.api.ApplicationInfo)1 HostInfo (com.yahoo.config.model.api.HostInfo)1 ServiceInfo (com.yahoo.config.model.api.ServiceInfo)1