use of com.yahoo.config.model.api.SuperModelProvider in project vespa by vespa-engine.
the class InstanceValidatorTest method application_has_wrong_domain.
@Test
public void application_has_wrong_domain() {
ServiceInfo serviceInfo = new ServiceInfo("serviceName", "type", Collections.emptyList(), Collections.singletonMap(SERVICE_PROPERTIES_DOMAIN_KEY, "not-domain"), "confId", "hostName");
SuperModelProvider superModelProvider = mockSuperModelProvider(mockApplicationInfo(applicationId, 5, Collections.singletonList(serviceInfo)));
InstanceValidator instanceValidator = new InstanceValidator(null, superModelProvider);
assertFalse(instanceValidator.isSameIdentityAsInServicesXml(applicationId, domain, service));
}
use of com.yahoo.config.model.api.SuperModelProvider in project vespa by vespa-engine.
the class InstanceValidatorTest method application_does_not_have_domain_set.
@Test
public void application_does_not_have_domain_set() {
SuperModelProvider superModelProvider = mockSuperModelProvider(mockApplicationInfo(applicationId, 5, Collections.emptyList()));
InstanceValidator instanceValidator = new InstanceValidator(null, superModelProvider);
assertFalse(instanceValidator.isSameIdentityAsInServicesXml(applicationId, domain, service));
}
use of com.yahoo.config.model.api.SuperModelProvider in project vespa by vespa-engine.
the class InstanceValidatorTest method application_does_not_exist.
@Test
public void application_does_not_exist() {
SuperModelProvider superModelProvider = mockSuperModelProvider();
InstanceValidator instanceValidator = new InstanceValidator(null, superModelProvider);
assertFalse(instanceValidator.isSameIdentityAsInServicesXml(applicationId, domain, service));
}
use of com.yahoo.config.model.api.SuperModelProvider in project vespa by vespa-engine.
the class SuperModelListenerImplTest method sanityCheck.
@Test
public void sanityCheck() {
SlobrokMonitorManagerImpl slobrokMonitorManager = mock(SlobrokMonitorManagerImpl.class);
ServiceMonitorMetrics metrics = mock(ServiceMonitorMetrics.class);
ModelGenerator modelGenerator = mock(ModelGenerator.class);
Zone zone = mock(Zone.class);
List<String> configServers = new ArrayList<>();
SuperModelListenerImpl listener = new SuperModelListenerImpl(slobrokMonitorManager, metrics, modelGenerator, zone, configServers);
SuperModelProvider superModelProvider = mock(SuperModelProvider.class);
SuperModel superModel = mock(SuperModel.class);
when(superModelProvider.snapshot(listener)).thenReturn(superModel);
ApplicationInfo application1 = mock(ApplicationInfo.class);
ApplicationInfo application2 = mock(ApplicationInfo.class);
List<ApplicationInfo> applications = Stream.of(application1, application2).collect(Collectors.toList());
when(superModel.getAllApplicationInfos()).thenReturn(applications);
listener.start(superModelProvider);
verify(slobrokMonitorManager).applicationActivated(superModel, application1);
verify(slobrokMonitorManager).applicationActivated(superModel, application2);
ServiceModel serviceModel = listener.get();
verify(modelGenerator).toServiceModel(superModel, zone, configServers, slobrokMonitorManager);
}
use of com.yahoo.config.model.api.SuperModelProvider in project vespa by vespa-engine.
the class InstanceValidatorTest method application_has_same_domain_and_service.
@Test
public void application_has_same_domain_and_service() {
Map<String, String> properties = new HashMap<>();
properties.put(SERVICE_PROPERTIES_DOMAIN_KEY, domain);
properties.put(SERVICE_PROPERTIES_SERVICE_KEY, service);
ServiceInfo serviceInfo = new ServiceInfo("serviceName", "type", Collections.emptyList(), properties, "confId", "hostName");
SuperModelProvider superModelProvider = mockSuperModelProvider(mockApplicationInfo(applicationId, 5, Collections.singletonList(serviceInfo)));
InstanceValidator instanceValidator = new InstanceValidator(null, superModelProvider);
assertTrue(instanceValidator.isSameIdentityAsInServicesXml(applicationId, domain, service));
}
Aggregations