use of io.gravitee.rest.api.model.api.ApiEntity in project gravitee-management-rest-api by gravitee-io.
the class ApiService_UpdateTest method shouldUpdateWithValidSchedule.
@Test
public void shouldUpdateWithValidSchedule() throws TechnicalException {
prepareUpdate();
Services services = new Services();
HealthCheckService healthCheckService = new HealthCheckService();
healthCheckService.setSchedule("1,2 */100 5-8 * * *");
services.put(HealthCheckService.class, healthCheckService);
when(existingApi.getServices()).thenReturn(services);
final ApiEntity apiEntity = apiService.update(API_ID, existingApi);
assertNotNull(apiEntity);
assertEquals(API_NAME, apiEntity.getName());
verify(searchEngineService, times(1)).index(any(), eq(false));
}
use of io.gravitee.rest.api.model.api.ApiEntity in project gravitee-management-rest-api by gravitee-io.
the class ApiService_hasHealthCheckEnabledTest method shouldNotBeEnabledWithDisabledGlobalHC.
@Test
public void shouldNotBeEnabledWithDisabledGlobalHC() {
ApiEntity api = mock(ApiEntity.class);
HealthCheckService hcSrv = mock(HealthCheckService.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.rest.api.model.api.ApiEntity in project gravitee-management-rest-api by gravitee-io.
the class ApiService_hasHealthCheckEnabledTest method shouldBeEnabledWithOnlyOneEndpointHC.
@Test
public void shouldBeEnabledWithOnlyOneEndpointHC() {
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, false);
assertTrue(valid);
}
use of io.gravitee.rest.api.model.api.ApiEntity 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.rest.api.model.api.ApiEntity in project gravitee-management-rest-api by gravitee-io.
the class ApiService_hasHealthCheckEnabledTest method shouldNotBeEnabledWithoutServices.
@Test
public void shouldNotBeEnabledWithoutServices() {
ApiEntity api = mock(ApiEntity.class);
mockProxy(api, false);
boolean valid = apiService.hasHealthCheckEnabled(api, true);
assertFalse(valid);
}
Aggregations