use of io.gravitee.management.model.PageEntity in project gravitee-management-rest-api by gravitee-io.
the class SwaggerService_TransformTest method shouldTransformAPIFromSwaggerV2_json.
@Test
public void shouldTransformAPIFromSwaggerV2_json() throws IOException {
PageEntity pageEntity = getPage("io/gravitee/management/service/swagger-petstore.json", MediaType.APPLICATION_JSON);
swaggerService.transform(pageEntity);
assertNotNull(pageEntity.getContent());
validateV2(Json.mapper().readTree(pageEntity.getContent()));
}
use of io.gravitee.management.model.PageEntity in project gravitee-management-rest-api by gravitee-io.
the class SwaggerService_TransformTest method shouldTransformAPIFromSwaggerV3_json.
@Test
public void shouldTransformAPIFromSwaggerV3_json() throws IOException {
PageEntity pageEntity = getPage("io/gravitee/management/service/openapi.json", MediaType.APPLICATION_JSON);
swaggerService.transform(pageEntity);
assertNotNull(pageEntity.getContent());
validateV3(Json.mapper().readTree(pageEntity.getContent()));
}
use of io.gravitee.management.model.PageEntity in project gravitee-management-rest-api by gravitee-io.
the class SwaggerService_TransformTest method shouldTransformAPIFromSwaggerV2_yaml.
@Test
public void shouldTransformAPIFromSwaggerV2_yaml() throws IOException {
PageEntity pageEntity = getPage("io/gravitee/management/service/swagger-petstore.yaml", MediaType.TEXT_PLAIN);
swaggerService.transform(pageEntity);
assertNotNull(pageEntity.getContent());
validateV2(Yaml.mapper().readTree(pageEntity.getContent()));
}
use of io.gravitee.management.model.PageEntity in project gravitee-management-rest-api by gravitee-io.
the class SwaggerService_TransformTest method shouldTransformAPIFromSwaggerV3_yaml.
@Test
public void shouldTransformAPIFromSwaggerV3_yaml() throws IOException {
PageEntity pageEntity = getPage("io/gravitee/management/service/openapi.yaml", MediaType.TEXT_PLAIN);
swaggerService.transform(pageEntity);
assertNotNull(pageEntity.getContent());
validateV3(Yaml.mapper().readTree(pageEntity.getContent()));
}
use of io.gravitee.management.model.PageEntity in project gravitee-management-rest-api by gravitee-io.
the class ApiPagesResourceAdminTest method shouldGetPrivateApiPublishedPage.
@Test
public void shouldGetPrivateApiPublishedPage() {
reset(apiService, pageService, membershipService);
final ApiEntity apiMock = mock(ApiEntity.class);
when(apiMock.getVisibility()).thenReturn(Visibility.PRIVATE);
when(apiMock.getName()).thenReturn(API_NAME);
doReturn(apiMock).when(apiService).findById(API_NAME);
final PageEntity pageMock = new PageEntity();
pageMock.setPublished(true);
pageMock.setName(PAGE_NAME);
doReturn(pageMock).when(pageService).findById(PAGE_NAME, false);
final Response response = target().request().get();
assertEquals(OK_200, response.getStatus());
final PageEntity responsePage = response.readEntity(PageEntity.class);
assertNotNull(responsePage);
assertEquals(PAGE_NAME, responsePage.getName());
verify(membershipService, never()).getRole(any(), any(), any(), any());
verify(apiService, times(1)).findById(API_NAME);
verify(pageService, times(1)).findById(PAGE_NAME, false);
verify(pageService, never()).isDisplayable(apiMock, pageMock.isPublished(), USER_NAME);
}
Aggregations