use of io.gravitee.definition.model.services.Services in project gravitee-management-rest-api by gravitee-io.
the class ApiService_hasHealthCheckEnabledTest method shouldBeEnabledWithGlobalHC.
@Test
public void shouldBeEnabledWithGlobalHC() {
ApiEntity api = mock(ApiEntity.class);
HealthCheckService hcSrv = mock(HealthCheckService.class);
when(hcSrv.isEnabled()).thenReturn(Boolean.TRUE);
Services services = new Services();
services.set(Collections.singletonList(hcSrv));
when(api.getServices()).thenReturn(services);
mockProxy(api, false);
boolean valid = apiService.hasHealthCheckEnabled(api, true);
assertTrue(valid);
}
use of io.gravitee.definition.model.services.Services in project gravitee-management-rest-api by gravitee-io.
the class ApiService_hasHealthCheckEnabledTest method shouldNotBeEnabledWithOnlyOneEndpointHC.
@Test
public void shouldNotBeEnabledWithOnlyOneEndpointHC() {
ApiEntity api = mock(ApiEntity.class);
EndpointHealthCheckService hcSrv = mock(EndpointHealthCheckService.class);
when(hcSrv.isEnabled()).thenReturn(Boolean.FALSE);
Services services = new Services();
services.set(Collections.singletonList(hcSrv));
when(api.getServices()).thenReturn(services);
mockProxy(api, false);
boolean valid = apiService.hasHealthCheckEnabled(api, true);
assertFalse(valid);
}
use of io.gravitee.definition.model.services.Services in project gravitee-management-rest-api by gravitee-io.
the class ApiService_hasHealthCheckEnabledTest method shouldNotBeEnabledWithEmptyServices.
@Test
public void shouldNotBeEnabledWithEmptyServices() {
ApiEntity api = mock(ApiEntity.class);
Services services = new Services();
services.set(Collections.emptyList());
mockProxy(api, false);
boolean valid = apiService.hasHealthCheckEnabled(api, true);
assertFalse(valid);
}
use of io.gravitee.definition.model.services.Services in project gravitee-management-rest-api by gravitee-io.
the class ApiService_hasHealthCheckEnabledTest method shouldNotBeEnabledWithAnotherService.
@Test
public void shouldNotBeEnabledWithAnotherService() {
ApiEntity api = mock(ApiEntity.class);
DynamicPropertyService dpSrv = mock(DynamicPropertyService.class);
when(dpSrv.isEnabled()).thenReturn(Boolean.TRUE);
Services services = new Services();
services.set(Collections.singletonList(dpSrv));
when(api.getServices()).thenReturn(services);
mockProxy(api, false);
boolean valid = apiService.hasHealthCheckEnabled(api, true);
assertFalse(valid);
}
Aggregations