use of io.gravitee.management.model.UpdateApiEntity in project gravitee-management-rest-api by gravitee-io.
the class DynamicPropertyUpdater method convert.
private static UpdateApiEntity convert(ApiEntity apiEntity) {
UpdateApiEntity updateApiEntity = new UpdateApiEntity();
updateApiEntity.setProxy(apiEntity.getProxy());
updateApiEntity.setVersion(apiEntity.getVersion());
updateApiEntity.setName(apiEntity.getName());
updateApiEntity.setProperties(apiEntity.getProperties());
updateApiEntity.setDescription(apiEntity.getDescription());
if (apiEntity.getGroups() != null) {
updateApiEntity.setGroups(apiEntity.getGroups());
}
updateApiEntity.setPaths(apiEntity.getPaths());
updateApiEntity.setPicture(apiEntity.getPicture());
updateApiEntity.setResources(apiEntity.getResources());
updateApiEntity.setTags(apiEntity.getTags());
updateApiEntity.setServices(apiEntity.getServices());
updateApiEntity.setVisibility(apiEntity.getVisibility());
return updateApiEntity;
}
use of io.gravitee.management.model.UpdateApiEntity in project gravitee-management-rest-api by gravitee-io.
the class ApiResourceTest method shouldUpdateApi.
@Test
public void shouldUpdateApi() {
final UpdateApiEntity mockApi = new UpdateApiEntity();
mockApi.setVersion("v1");
mockApi.setDescription("Description of my API");
mockApi.setProxy(new Proxy());
doReturn(new ApiEntity()).when(apiService).update(API_NAME, mockApi);
final Response response = target(API_NAME).request().put(Entity.json(mockApi));
assertEquals(NO_CONTENT_204, response.getStatus());
}
use of io.gravitee.management.model.UpdateApiEntity in project gravitee-management-rest-api by gravitee-io.
the class ApiResourceTest method shouldNotUpdateApiBecausePermissionDenied.
@Test
public void shouldNotUpdateApiBecausePermissionDenied() {
final UpdateApiEntity mockApi = new UpdateApiEntity();
mockApi.setVersion("v1");
mockApi.setDescription("Description of my API");
mockApi.setProxy(new Proxy());
final Response response = target(API_NAME).request().put(Entity.json(mockApi));
assertEquals(FORBIDDEN_403, response.getStatus());
}
Aggregations