Search in sources :

Example 1 with EndpointGroup

use of io.gravitee.definition.model.EndpointGroup in project gravitee-management-rest-api by gravitee-io.

the class ApiService_hasHealthCheckEnabledTest method mockProxy.

private void mockProxy(final ApiEntity api, final boolean withHC) {
    final Proxy proxy = mock(Proxy.class);
    when(api.getProxy()).thenReturn(proxy);
    final EndpointGroup endpointGroup = mock(EndpointGroup.class);
    when(proxy.getGroups()).thenReturn(Collections.singleton(endpointGroup));
    final HttpEndpoint endpoint1 = mock(HttpEndpoint.class);
    final HttpEndpoint endpoint2 = mock(HttpEndpoint.class);
    when(endpointGroup.getEndpoints()).thenReturn(new HashSet<>(Arrays.asList(endpoint1, endpoint2)));
    final EndpointHealthCheckService endpointHealthCheckService1 = mock(EndpointHealthCheckService.class);
    when(endpoint1.getHealthCheck()).thenReturn(endpointHealthCheckService1);
    when(endpointHealthCheckService1.isEnabled()).thenReturn(true);
    final EndpointHealthCheckService endpointHealthCheckService2 = mock(EndpointHealthCheckService.class);
    when(endpoint2.getHealthCheck()).thenReturn(endpointHealthCheckService2);
    when(endpointHealthCheckService2.isEnabled()).thenReturn(withHC);
}
Also used : Proxy(io.gravitee.definition.model.Proxy) EndpointHealthCheckService(io.gravitee.definition.model.services.healthcheck.EndpointHealthCheckService) EndpointGroup(io.gravitee.definition.model.EndpointGroup) HttpEndpoint(io.gravitee.definition.model.endpoint.HttpEndpoint)

Aggregations

EndpointGroup (io.gravitee.definition.model.EndpointGroup)1 Proxy (io.gravitee.definition.model.Proxy)1 HttpEndpoint (io.gravitee.definition.model.endpoint.HttpEndpoint)1 EndpointHealthCheckService (io.gravitee.definition.model.services.healthcheck.EndpointHealthCheckService)1