public Builder endpoint(final String name, final String protocol, final int port, final String domain, final String host, final List<String> tags) { endpoints.add(new Endpoint(name, protocol, port, domain, host, tags, null)); return this; }
private void assertContainerRegistersAfterPoke(final HeliosClient client, final Job job) throws Exception { final JobId jobId = createJob(job); deployJob(jobId, testHost()); awaitTaskState(jobId, testHost(), HEALTHCHECKING); // wait a few seconds to see if the service gets registered Thread.sleep(3000); // shouldn't be registered, since we haven't poked it yet verify(registrar, never()).register(any(ServiceRegistration.class)); pokeAndVerifyRegistration(client, jobId, LONG_WAIT_SECONDS); final ServiceRegistration serviceRegistration = registrationCaptor.getValue(); final Map<String, Endpoint> registered = Maps.newHashMap(); for (final Endpoint endpoint : serviceRegistration.getEndpoints()) { registered.put(endpoint.getName(), endpoint); } assertEquals("wrong service", "foo_service", registered.get("foo_service").getName()); assertEquals("wrong protocol", "foo_proto", registered.get("foo_service").getProtocol()); }
@Test public void test() throws Exception { startDefaultMaster("--service-registry=" + registryAddress); verify(registrar, timeout((int) SECONDS.toMillis(LONG_WAIT_SECONDS))) .register(registrationCaptor.capture()); final ServiceRegistration registration = registrationCaptor.getValue(); final ServiceRegistration.Endpoint endpoint = getOnlyElement(registration.getEndpoints()); assertEquals("http", endpoint.getProtocol()); assertEquals("helios", endpoint.getName()); assertEquals(masterPort(), endpoint.getPort()); } }
public Builder endpoint(final String name, final String protocol, final int port, final String domain, final String host, final List<String> tags, final EndpointHealthCheck healthCheck) { endpoints.add(new Endpoint(name, protocol, port, domain, host, tags, healthCheck)); return this; }
public Builder endpoint(final String name, final String protocol, final int port, final String domain, final String host) { endpoints.add(new Endpoint(name, protocol, port, domain, host, null, null)); return this; }
public Builder endpoint(final String name, final String protocol, final int port, final String domain, final String host, final List<String> tags) { endpoints.add(new Endpoint(name, protocol, port, domain, host, tags, null)); return this; }
final Endpoint registeredEndpoint = serviceRegistration.getEndpoints().get(0); assertEquals("wrong service", serviceName, registeredEndpoint.getName()); assertEquals("wrong protocol", serviceProtocol, registeredEndpoint.getProtocol());
registered.put(endpoint.getName(), endpoint); assertEquals("wrong service", "foo_service", registered.get("foo_service").getName()); assertEquals("wrong protocol", "foo_proto", registered.get("foo_service").getProtocol()); assertEquals("wrong port", externalPort, registered.get("foo_service").getPort()); assertEquals("wrong service", "bar_service", registered.get("bar_service").getName()); assertEquals("wrong protocol", "bar_proto", registered.get("bar_service").getProtocol()); assertNotEquals("wrong port", externalPort, registered.get("bar_service").getPort());
public Builder endpoint(final String name, final String protocol, final int port, final String domain, final String host, final List<String> tags, final EndpointHealthCheck healthCheck) { endpoints.add(new Endpoint(name, protocol, port, domain, host, tags, healthCheck)); return this; }
public Builder endpoint(final String name, final String protocol, final int port, final String domain, final String host) { endpoints.add(new Endpoint(name, protocol, port, domain, host, null, null)); return this; }