Search in sources :

Example 1 with UpdateApiEntity

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;
}
Also used : UpdateApiEntity(io.gravitee.management.model.UpdateApiEntity)

Example 2 with 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());
}
Also used : Response(javax.ws.rs.core.Response) Proxy(io.gravitee.definition.model.Proxy) UpdateApiEntity(io.gravitee.management.model.UpdateApiEntity) ApiEntity(io.gravitee.management.model.ApiEntity) UpdateApiEntity(io.gravitee.management.model.UpdateApiEntity) Test(org.junit.Test)

Example 3 with UpdateApiEntity

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());
}
Also used : Response(javax.ws.rs.core.Response) Proxy(io.gravitee.definition.model.Proxy) UpdateApiEntity(io.gravitee.management.model.UpdateApiEntity) Test(org.junit.Test)

Aggregations

UpdateApiEntity (io.gravitee.management.model.UpdateApiEntity)3 Proxy (io.gravitee.definition.model.Proxy)2 Response (javax.ws.rs.core.Response)2 Test (org.junit.Test)2 ApiEntity (io.gravitee.management.model.ApiEntity)1