Search in sources :

Example 1 with ClientProvider

use of com.yahoo.jdisc.service.ClientProvider in project vespa by vespa-engine.

the class ApplicationStatusHandlerTest method client_providers_are_rendered.

@Test
public void client_providers_are_rendered() throws Exception {
    final String id = "myClient";
    final String clientBinding = "http://*/clientBinding";
    final String clientBinding2 = "http://*/anotherClientBinding";
    final String serverBinding = "http://*/serverBinding";
    HashMap<ComponentId, ClientProvider> clientsById = new HashMap<>();
    clientsById.put(new ComponentId(id), Mockito.mock(ClientProvider.class));
    JdiscBindingsConfig bindingsConfig = new JdiscBindingsConfig(new JdiscBindingsConfig.Builder().handlers(id, new Handlers.Builder().clientBindings(clientBinding).clientBindings(clientBinding2).serverBindings(serverBinding)));
    String json = ApplicationStatusHandler.renderRequestHandlers(bindingsConfig, clientsById).toString();
    System.out.println(json);
    assertThat(json, containsString("\"" + id + "\""));
    assertThat(json, containsString(clientBinding));
    assertThat(json, containsString(clientBinding2));
    assertThat(json, containsString(serverBinding));
}
Also used : Handlers(com.yahoo.container.jdisc.JdiscBindingsConfig.Handlers) ClientProvider(com.yahoo.jdisc.service.ClientProvider) HashMap(java.util.HashMap) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) ComponentId(com.yahoo.component.ComponentId) JdiscBindingsConfig(com.yahoo.container.jdisc.JdiscBindingsConfig) Test(org.junit.Test)

Example 2 with ClientProvider

use of com.yahoo.jdisc.service.ClientProvider in project vespa by vespa-engine.

the class ConfiguredApplication method startClients.

private static void startClients() {
    for (ClientProvider client : Container.get().getClientProviderRegistry().allComponents()) {
        if (!startedClients.contains(client)) {
            client.start();
            startedClients.add(client);
        }
    }
}
Also used : ClientProvider(com.yahoo.jdisc.service.ClientProvider)

Example 3 with ClientProvider

use of com.yahoo.jdisc.service.ClientProvider in project vespa by vespa-engine.

the class NonWorkingClientTestCase method requireThatHandleRequestThrowsException.

@Test
public void requireThatHandleRequestThrowsException() {
    ClientProvider client = new NonWorkingClientProvider();
    try {
        client.handleRequest(null, null);
        fail();
    } catch (UnsupportedOperationException e) {
    }
}
Also used : ClientProvider(com.yahoo.jdisc.service.ClientProvider) Test(org.junit.Test)

Example 4 with ClientProvider

use of com.yahoo.jdisc.service.ClientProvider in project vespa by vespa-engine.

the class NonWorkingClientTestCase method requireThatRetainDoesNotThrow.

@Test
public void requireThatRetainDoesNotThrow() {
    ClientProvider client = new NonWorkingClientProvider();
    client.release();
}
Also used : ClientProvider(com.yahoo.jdisc.service.ClientProvider) Test(org.junit.Test)

Example 5 with ClientProvider

use of com.yahoo.jdisc.service.ClientProvider in project vespa by vespa-engine.

the class NonWorkingClientTestCase method requireThatReleaseDoesNotThrow.

@Test
public void requireThatReleaseDoesNotThrow() {
    ClientProvider client = new NonWorkingClientProvider();
    client.release();
}
Also used : ClientProvider(com.yahoo.jdisc.service.ClientProvider) Test(org.junit.Test)

Aggregations

ClientProvider (com.yahoo.jdisc.service.ClientProvider)7 Test (org.junit.Test)6 ComponentId (com.yahoo.component.ComponentId)1 JdiscBindingsConfig (com.yahoo.container.jdisc.JdiscBindingsConfig)1 Handlers (com.yahoo.container.jdisc.JdiscBindingsConfig.Handlers)1 HashMap (java.util.HashMap)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1