use of io.gravitee.repository.management.model.Parameter in project gravitee-management-rest-api by gravitee-io.
the class ParameterServiceTest method shouldFindAll.
@Test
public void shouldFindAll() throws TechnicalException {
final Parameter parameter = new Parameter();
parameter.setKey(PARAMETER_KEY);
parameter.setValue("api1;api2");
when(parameterRepository.findById(PARAMETER_KEY)).thenReturn(of(parameter));
final List<String> values = parameterService.findAll(PARAMETER_KEY, value -> value);
assertEquals(asList("api1", "api2"), values);
}
use of io.gravitee.repository.management.model.Parameter in project gravitee-management-rest-api by gravitee-io.
the class ParameterServiceTest method shouldUpdate.
@Test
public void shouldUpdate() throws TechnicalException {
final Parameter parameter = new Parameter();
parameter.setKey(PARAMETER_KEY);
parameter.setValue("api1");
final Parameter newParameter = new Parameter();
newParameter.setKey(PARAMETER_KEY);
newParameter.setValue("api2");
when(parameterRepository.findById(PARAMETER_KEY)).thenReturn(of(parameter));
when(parameterRepository.update(newParameter)).thenReturn(newParameter);
parameterService.update(PARAMETER_KEY, "api2");
verify(parameterRepository).update(newParameter);
verify(auditService).createPortalAuditLog(eq(singletonMap(PARAMETER, PARAMETER_KEY)), eq(PARAMETER_UPDATED), any(), eq(parameter), eq(newParameter));
}
Aggregations