use of com.yahoo.config.model.api.ServiceInfo 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.ServiceInfo in project vespa by vespa-engine.
the class AbstractService method getServiceInfo.
@Override
public ServiceInfo getServiceInfo() {
Set<PortInfo> portInfos = new LinkedHashSet<>();
for (int i = 0; i < portsMeta.getNumPorts(); i++) {
portInfos.add(new PortInfo(ports.get(i), new LinkedHashSet<>(portsMeta.getTagsAt(i))));
}
Map<String, String> properties = new LinkedHashMap<>();
for (Map.Entry<String, Object> prop : serviceProperties.entrySet()) {
properties.put(prop.getKey(), prop.getValue().toString());
}
return new ServiceInfo(getServiceName(), getServiceType(), portInfos, properties, getConfigId(), getHostName());
}
use of com.yahoo.config.model.api.ServiceInfo in project vespa by vespa-engine.
the class HttpProxy method get.
public HttpResponse get(Application application, String hostName, String serviceType, String relativePath) {
HostInfo host = application.getModel().getHosts().stream().filter(hostInfo -> hostInfo.getHostname().equals(hostName)).findFirst().orElseThrow(() -> new NotFoundException("Failed to find host " + hostName));
ServiceInfo service = host.getServices().stream().filter(serviceInfo -> serviceType.equals(serviceInfo.getServiceType())).findFirst().orElseThrow(() -> new NotFoundException("Failed to find any service of type " + serviceType + " on host " + hostName));
// "http" and "state" seems to uniquely identify an interesting HTTP port on each service
PortInfo port = service.getPorts().stream().filter(portInfo -> portInfo.getTags().stream().collect(Collectors.toSet()).containsAll(Stream.of("http", "state").collect(Collectors.toSet()))).findFirst().orElseThrow(() -> new NotFoundException("Failed to find HTTP state port"));
return internalGet(host.getHostname(), port.getPort(), relativePath);
}
use of com.yahoo.config.model.api.ServiceInfo in project vespa by vespa-engine.
the class MockModel method createContainer.
static MockModel createContainer(String hostname, int statePort) {
ServiceInfo container = createServiceInfo(hostname, "container", "container", ClusterSpec.Type.container, statePort, "state");
ServiceInfo serviceNoStatePort = createServiceInfo(hostname, "logserver", "logserver", ClusterSpec.Type.admin, 1234, "logtp");
HostInfo hostInfo = new HostInfo(hostname, Arrays.asList(container, serviceNoStatePort));
return new MockModel(Collections.singleton(hostInfo));
}
use of com.yahoo.config.model.api.ServiceInfo in project vespa by vespa-engine.
the class MockModel method createServiceInfo.
private static ServiceInfo createServiceInfo(String hostname, String name, String type, ClusterSpec.Type clusterType, int port, String portTags) {
PortInfo portInfo = new PortInfo(port, Arrays.stream(portTags.split(" ")).collect(Collectors.toSet()));
Map<String, String> properties = new HashMap<>();
properties.put("clustername", "default");
properties.put("clustertype", clusterType.name());
return new ServiceInfo(name, type, Collections.singleton(portInfo), properties, "", hostname);
}
Aggregations