Search in sources :

Example 1 with PageRepository

use of io.gravitee.repository.management.api.PageRepository in project gravitee-management-rest-api by gravitee-io.

the class PageService_ImportDirectoryTest method shouldImportDirectory.

@Test
public void shouldImportDirectory() throws Exception {
    // We mock the validateSafeContent method because the fetcher keeps sending the same json descriptor which is
    // not a swagger valid document (and modify the fetcher mock to produce valid desc is overkill)
    when(pageService.validateSafeContent(any(), any())).thenReturn(new ArrayList<>());
    PageSourceEntity pageSource = new PageSourceEntity();
    pageSource.setType("type");
    pageSource.setConfiguration(mapper.readTree("{}"));
    ImportPageEntity pageEntity = new ImportPageEntity();
    pageEntity.setSource(pageSource);
    pageEntity.setPublished(true);
    FetcherPlugin fetcherPlugin = mock(FetcherPlugin.class);
    when(fetcherPlugin.clazz()).thenReturn("io.gravitee.rest.api.service.PageService_ImportDirectoryMockFetcher");
    when(fetcherPlugin.configuration()).thenReturn(PageService_MockFilesFetcherConfiguration.class);
    when(fetcherPluginManager.get(any())).thenReturn(fetcherPlugin);
    Class<PageService_ImportDirectoryMockFetcher> mockFetcherClass = PageService_ImportDirectoryMockFetcher.class;
    when(fetcherPlugin.fetcher()).thenReturn(mockFetcherClass);
    PageService_MockFilesFetcherConfiguration fetcherConfiguration = new PageService_MockFilesFetcherConfiguration();
    when(fetcherConfigurationFactory.create(eq(PageService_MockFilesFetcherConfiguration.class), anyString())).thenReturn(fetcherConfiguration);
    AutowireCapableBeanFactory mockAutowireCapableBeanFactory = mock(AutowireCapableBeanFactory.class);
    when(applicationContext.getAutowireCapableBeanFactory()).thenReturn(mockAutowireCapableBeanFactory);
    Page newPage = mock(Page.class);
    PageSource ps = new PageSource();
    ps.setType(pageSource.getType());
    ps.setConfiguration(pageSource.getConfiguration());
    when(newPage.getId()).thenReturn(UuidString.generateRandom());
    when(newPage.isPublished()).thenReturn(Boolean.TRUE);
    when(newPage.getSource()).thenReturn(ps);
    when(newPage.getType()).thenReturn("MARKDOWN");
    when(newPage.getReferenceType()).thenReturn(PageReferenceType.ENVIRONMENT);
    when(newPage.getReferenceId()).thenReturn("envId");
    when(newPage.getVisibility()).thenReturn("PUBLIC");
    when(pageRepository.create(any())).thenReturn(newPage);
    when(graviteeDescriptorService.descriptorName()).thenReturn(".gravitee.json");
    List<PageEntity> pageEntities = pageService.importFiles(pageEntity, GraviteeContext.getCurrentEnvironment());
    assertNotNull(pageEntities);
    assertEquals(8, pageEntities.size());
    verify(searchEngineService, times(8)).index(any(), eq(false));
    // //////////////////////
    // check Folder creation
    // //////////////////////
    verify(pageRepository, times(3)).create(argThat(pageToCreate -> "FOLDER".equals(pageToCreate.getType())));
    // /src
    verify(pageRepository).create(argThat(pageToCreate -> "src".equals(pageToCreate.getName()) && "FOLDER".equals(pageToCreate.getType()) && null == pageToCreate.getParentId()));
    // /src/doc
    verify(pageRepository).create(argThat(pageToCreate -> "doc".equals(pageToCreate.getName()) && "FOLDER".equals(pageToCreate.getType()) && null != pageToCreate.getParentId()));
    // /src/folder.with.dot/
    verify(pageRepository).create(argThat(pageToCreate -> "folder.with.dot".equals(pageToCreate.getName()) && "FOLDER".equals(pageToCreate.getType()) && null != pageToCreate.getParentId()));
    // //////////////////////
    // verify files creation
    // //////////////////////
    verify(pageRepository, times(5)).create(argThat(pageToCreate -> pageToCreate.getType() != null && !"FOLDER".equals(pageToCreate.getType())));
    // /src/doc/m1.md
    verify(pageRepository).create(argThat(pageToCreate -> "m1".equals(pageToCreate.getName()) && "MARKDOWN".equals(pageToCreate.getType()) && null != pageToCreate.getParentId()));
    // /swagger.json
    verify(pageRepository).create(argThat(pageToCreate -> "swagger".equals(pageToCreate.getName()) && "SWAGGER".equals(pageToCreate.getType()) && null == pageToCreate.getParentId()));
    // /src/doc/sub.m11.md
    verify(pageRepository).create(argThat(pageToCreate -> "sub.m11".equals(pageToCreate.getName()) && "MARKDOWN".equals(pageToCreate.getType()) && null != pageToCreate.getParentId()));
    // /src/doc/m2.yaml
    verify(pageRepository).create(argThat(pageToCreate -> "m2".equals(pageToCreate.getName()) && "SWAGGER".equals(pageToCreate.getType()) && null != pageToCreate.getParentId()));
    // /src/folder.with.dot/m2.MD
    verify(pageRepository).create(argThat(pageToCreate -> "m2".equals(pageToCreate.getName()) && "MARKDOWN".equals(pageToCreate.getType()) && null != pageToCreate.getParentId()));
    verify(pageRevisionService, times(5)).create(any());
}
Also used : PageEntity(io.gravitee.rest.api.model.PageEntity) ImportPageEntity(io.gravitee.rest.api.model.ImportPageEntity) PageEntity(io.gravitee.rest.api.model.PageEntity) PageServiceImpl(io.gravitee.rest.api.service.impl.PageServiceImpl) ArgumentMatchers(org.mockito.ArgumentMatchers) PageSource(io.gravitee.repository.management.model.PageSource) ImportConfiguration(io.gravitee.rest.api.service.spring.ImportConfiguration) Mock(org.mockito.Mock) RunWith(org.junit.runner.RunWith) AutowireCapableBeanFactory(org.springframework.beans.factory.config.AutowireCapableBeanFactory) ImportPageEntity(io.gravitee.rest.api.model.ImportPageEntity) GraviteeContext(io.gravitee.rest.api.service.common.GraviteeContext) ArrayList(java.util.ArrayList) PageReferenceType(io.gravitee.repository.management.model.PageReferenceType) FetcherConfigurationFactory(io.gravitee.rest.api.fetcher.FetcherConfigurationFactory) PageRepository(io.gravitee.repository.management.api.PageRepository) InjectMocks(org.mockito.InjectMocks) UuidString(io.gravitee.rest.api.service.common.UuidString) Assert.assertNotNull(org.junit.Assert.assertNotNull) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) PluginManager(io.gravitee.plugin.core.api.PluginManager) Test(org.junit.Test) ApplicationContext(org.springframework.context.ApplicationContext) FetcherPlugin(io.gravitee.plugin.fetcher.FetcherPlugin) Mockito(org.mockito.Mockito) List(java.util.List) Page(io.gravitee.repository.management.model.Page) Visibility(io.gravitee.rest.api.model.Visibility) PageSourceEntity(io.gravitee.rest.api.model.PageSourceEntity) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) Assert.assertEquals(org.junit.Assert.assertEquals) SearchEngineService(io.gravitee.rest.api.service.search.SearchEngineService) Page(io.gravitee.repository.management.model.Page) AutowireCapableBeanFactory(org.springframework.beans.factory.config.AutowireCapableBeanFactory) PageSource(io.gravitee.repository.management.model.PageSource) PageSourceEntity(io.gravitee.rest.api.model.PageSourceEntity) FetcherPlugin(io.gravitee.plugin.fetcher.FetcherPlugin) ImportPageEntity(io.gravitee.rest.api.model.ImportPageEntity) Test(org.junit.Test)

Example 2 with PageRepository

use of io.gravitee.repository.management.api.PageRepository in project gravitee-management-rest-api by gravitee-io.

the class PageService_UpdateTest method shouldUpdateOrderIncrement.

@Test
public void shouldUpdateOrderIncrement() throws TechnicalException {
    final Page pageOrder1 = new Page();
    pageOrder1.setId(PAGE_ID);
    pageOrder1.setOrder(1);
    pageOrder1.setReferenceId(API_ID);
    pageOrder1.setReferenceType(PageReferenceType.API);
    pageOrder1.setPublished(true);
    pageOrder1.setVisibility("PUBLIC");
    final Page pageOrder2 = new Page();
    pageOrder2.setId("2");
    pageOrder2.setOrder(2);
    pageOrder2.setReferenceId(API_ID);
    pageOrder2.setReferenceType(PageReferenceType.API);
    pageOrder2.setVisibility("PUBLIC");
    final Page pageOrder3 = new Page();
    pageOrder3.setId("3");
    pageOrder3.setOrder(3);
    pageOrder3.setReferenceId(API_ID);
    pageOrder3.setReferenceType(PageReferenceType.API);
    pageOrder3.setVisibility("PUBLIC");
    when(pageRepository.findById(PAGE_ID)).thenReturn(Optional.of(pageOrder1));
    when(pageRepository.search(argThat(o -> o == null || "LINK".equals(o.getType())))).thenReturn(Collections.emptyList());
    when(pageRepository.search(argThat(o -> o == null || API_ID.equals(o.getReferenceId())))).thenReturn(asList(pageOrder1, pageOrder2, pageOrder3));
    when(pageRepository.update(any(Page.class))).thenReturn(pageOrder1);
    final UpdatePageEntity updatePageEntity = new UpdatePageEntity();
    updatePageEntity.setOrder(2);
    updatePageEntity.setVisibility(Visibility.PUBLIC);
    pageService.update(PAGE_ID, updatePageEntity);
    verify(pageRepository, times(3)).update(argThat(pageToUpdate -> {
        if (PAGE_ID.equals(pageToUpdate.getId())) {
            return pageToUpdate.getOrder() == 2;
        }
        if ("2".equals(pageToUpdate.getId())) {
            return pageToUpdate.getOrder() == 1;
        }
        if ("3".equals(pageToUpdate.getId())) {
            return pageToUpdate.getOrder() == 3;
        }
        return false;
    }));
    // neither content nor name are updated
    verify(pageRevisionService, times(0)).create(any());
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) PageServiceImpl(io.gravitee.rest.api.service.impl.PageServiceImpl) ArgumentMatchers.argThat(org.mockito.ArgumentMatchers.argThat) Mock(org.mockito.Mock) TemplateException(freemarker.template.TemplateException) TechnicalException(io.gravitee.repository.exceptions.TechnicalException) RunWith(org.junit.runner.RunWith) HashMap(java.util.HashMap) PageReferenceType(io.gravitee.repository.management.model.PageReferenceType) NotificationTemplateService(io.gravitee.rest.api.service.notification.NotificationTemplateService) Sets(org.mockito.internal.util.collections.Sets) Arrays.asList(java.util.Arrays.asList) Map(java.util.Map) PageRepository(io.gravitee.repository.management.api.PageRepository) io.gravitee.rest.api.model(io.gravitee.rest.api.model) Before(org.junit.Before) InjectMocks(org.mockito.InjectMocks) Test(org.junit.Test) Mockito(org.mockito.Mockito) ReflectionTestUtils.setField(org.springframework.test.util.ReflectionTestUtils.setField) Page(io.gravitee.repository.management.model.Page) io.gravitee.rest.api.service.exceptions(io.gravitee.rest.api.service.exceptions) Optional(java.util.Optional) Collections(java.util.Collections) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) SearchEngineService(io.gravitee.rest.api.service.search.SearchEngineService) Page(io.gravitee.repository.management.model.Page) Test(org.junit.Test)

Example 3 with PageRepository

use of io.gravitee.repository.management.api.PageRepository in project gravitee-management-rest-api by gravitee-io.

the class PageService_CreateOrUpdatePagesTest method shouldCreateOrUpdatePages.

@Test
public void shouldCreateOrUpdatePages() throws TechnicalException {
    PageEntity page1 = new PageEntity();
    page1.setId(UuidString.generateRandom());
    page1.setName("Page 1");
    page1.setType("SWAGGER");
    page1.setReferenceType("API");
    page1.setReferenceId(API_ID);
    PageEntity page2 = new PageEntity();
    page2.setId(UuidString.generateRandom());
    page2.setName("Page 2");
    page2.setType("MARKDOWN");
    page2.setReferenceType("API");
    page2.setReferenceId(API_ID);
    PageEntity page3 = new PageEntity();
    page3.setId(UuidString.generateRandom());
    page3.setName("Sub Page 3");
    page3.setType("ASCIIDOC");
    page3.setParentId(page1.getId());
    page3.setReferenceType("API");
    page3.setReferenceId(API_ID);
    when(pageRepository.create(any(Page.class))).thenAnswer(returnsFirstArg());
    when(pageRepository.update(any(Page.class))).thenAnswer(returnsFirstArg());
    String page1NewId = UuidString.generateForEnvironment(ENVIRONMENT_ID, API_ID, page1.getId());
    Page page = new Page();
    page.setId(page1NewId);
    page.setName(page1.getName());
    page.setType(page1.getType());
    page.setReferenceType(PageReferenceType.valueOf(page1.getReferenceType()));
    page.setReferenceId(page1.getReferenceId());
    page.setVisibility("PUBLIC");
    // Simulate the fact that page 1 is already created
    when(pageRepository.findById(page1NewId)).thenReturn(Optional.of(page));
    when(pageRepository.findById(argThat(id -> !id.equals(page1NewId)))).thenThrow(new PageNotFoundException(""));
    when(planService.findByApi(anyString())).thenReturn(Collections.emptySet());
    pageService.createOrUpdatePages(List.of(page1, page2, page3), ENVIRONMENT_ID, API_ID);
    ArgumentCaptor<Page> createdPagesCaptor = ArgumentCaptor.forClass(Page.class);
    verify(pageRepository, times(2)).create(createdPagesCaptor.capture());
    List<Page> createdPages = createdPagesCaptor.getAllValues();
    assertThat(createdPages.size()).isEqualTo(2);
    assertThat(createdPages).extracting(Page::getName).containsExactly("Sub Page 3", "Page 2");
    // New parent id of page 3 must be new id of page 1
    assertThat(createdPages.get(0)).extracting(Page::getParentId).isEqualTo(page1NewId);
    assertThat(createdPages).extracting(Page::getId).doesNotContain(page2.getId(), page3.getId());
    ArgumentCaptor<Page> updatedPageCaptor = ArgumentCaptor.forClass(Page.class);
    verify(pageRepository, times(1)).update(updatedPageCaptor.capture());
    List<Page> updatedPages = updatedPageCaptor.getAllValues();
    assertThat(updatedPages.size()).isEqualTo(1);
    assertThat(updatedPages).extracting(Page::getName, Page::getId).containsExactly(tuple("Page 1", page1NewId));
}
Also used : PageEntity(io.gravitee.rest.api.model.PageEntity) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) PageEntity(io.gravitee.rest.api.model.PageEntity) UuidString(io.gravitee.rest.api.service.common.UuidString) PageServiceImpl(io.gravitee.rest.api.service.impl.PageServiceImpl) org.mockito(org.mockito) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) TechnicalException(io.gravitee.repository.exceptions.TechnicalException) RunWith(org.junit.runner.RunWith) Test(org.junit.Test) AssertionsForClassTypes.tuple(org.assertj.core.api.AssertionsForClassTypes.tuple) AdditionalAnswers.returnsFirstArg(org.mockito.AdditionalAnswers.returnsFirstArg) PageReferenceType(io.gravitee.repository.management.model.PageReferenceType) Mockito(org.mockito.Mockito) List(java.util.List) Page(io.gravitee.repository.management.model.Page) PageNotFoundException(io.gravitee.rest.api.service.exceptions.PageNotFoundException) PageRepository(io.gravitee.repository.management.api.PageRepository) Optional(java.util.Optional) Collections(java.util.Collections) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) PageNotFoundException(io.gravitee.rest.api.service.exceptions.PageNotFoundException) Page(io.gravitee.repository.management.model.Page) UuidString(io.gravitee.rest.api.service.common.UuidString) Test(org.junit.Test)

Example 4 with PageRepository

use of io.gravitee.repository.management.api.PageRepository in project gravitee-management-rest-api by gravitee-io.

the class PageService_UpdateTest method shouldUpdateRelatedPagesPublicationStatus.

@Test
public void shouldUpdateRelatedPagesPublicationStatus() throws TechnicalException {
    Page unpublishedPage = new Page();
    unpublishedPage.setId(PAGE_ID);
    unpublishedPage.setOrder(1);
    unpublishedPage.setReferenceId("DEFAULT");
    unpublishedPage.setReferenceType(PageReferenceType.ENVIRONMENT);
    unpublishedPage.setType("MARKDOWN");
    unpublishedPage.setPublished(false);
    unpublishedPage.setVisibility("PUBLIC");
    doReturn(Optional.of(unpublishedPage)).when(pageRepository).findById(PAGE_ID);
    Page linkPage = new Page();
    linkPage.setId("LINK_ID");
    linkPage.setOrder(1);
    linkPage.setPublished(false);
    linkPage.setReferenceId("DEFAULT");
    linkPage.setReferenceType(PageReferenceType.ENVIRONMENT);
    linkPage.setType("LINK");
    Map<String, String> conf = new HashMap<String, String>();
    conf.put(PageConfigurationKeys.LINK_RESOURCE_TYPE, "page");
    linkPage.setConfiguration(conf);
    linkPage.setContent(PAGE_ID);
    linkPage.setVisibility("PUBLIC");
    Map<String, String> translationConf = new HashMap<String, String>();
    translationConf.put(PageConfigurationKeys.TRANSLATION_LANG, "fr");
    Page translationPage = new Page();
    translationPage.setId("TRANSLATION_ID");
    translationPage.setParentId(PAGE_ID);
    translationPage.setOrder(1);
    translationPage.setPublished(false);
    translationPage.setReferenceId("DEFAULT");
    translationPage.setReferenceType(PageReferenceType.ENVIRONMENT);
    translationPage.setType("TRANSLATION");
    translationPage.setConfiguration(translationConf);
    translationPage.setVisibility("PUBLIC");
    Page linkTranslationPage = new Page();
    linkTranslationPage.setId("LINK_TRANSLATION_ID");
    linkTranslationPage.setParentId("LINK_ID");
    linkTranslationPage.setOrder(2);
    linkTranslationPage.setPublished(false);
    linkTranslationPage.setReferenceId("DEFAULT");
    linkTranslationPage.setReferenceType(PageReferenceType.ENVIRONMENT);
    linkTranslationPage.setType("TRANSLATION");
    linkTranslationPage.setConfiguration(translationConf);
    linkTranslationPage.setVisibility("PUBLIC");
    doReturn(asList(linkPage)).when(pageRepository).search(argThat(p -> PageType.LINK.name().equals(p.getType())));
    doReturn(asList(translationPage)).when(pageRepository).search(argThat(p -> PageType.TRANSLATION.name().equals(p.getType()) && PAGE_ID.equals(p.getParent())));
    doReturn(asList(linkTranslationPage)).when(pageRepository).search(argThat(p -> PageType.TRANSLATION.name().equals(p.getType()) && "LINK_ID".equals(p.getParent())));
    UpdatePageEntity updatePageEntity = new UpdatePageEntity();
    updatePageEntity.setPublished(true);
    updatePageEntity.setContent("");
    updatePageEntity.setOrder(1);
    updatePageEntity.setConfiguration(conf);
    updatePageEntity.setVisibility(Visibility.PUBLIC);
    Page updatedPage = new Page();
    updatedPage.setId(PAGE_ID);
    updatedPage.setOrder(1);
    updatedPage.setReferenceId("DEFAULT");
    updatedPage.setReferenceType(PageReferenceType.ENVIRONMENT);
    updatedPage.setType("TRANSLATION");
    updatedPage.setPublished(true);
    updatedPage.setVisibility("PUBLIC");
    doReturn(updatedPage).when(pageRepository).update(argThat(p -> p.getId().equals(PAGE_ID)));
    pageService.update(PAGE_ID, updatePageEntity);
    // neither content nor name are updated
    verify(pageRevisionService, times(0)).create(any());
    verify(pageRepository).update(argThat(p -> p.getId().equals(PAGE_ID) && p.isPublished()));
    verify(pageRepository).update(argThat(p -> p.getId().equals("LINK_ID") && p.isPublished()));
    verify(pageRepository).update(argThat(p -> p.getId().equals("TRANSLATION_ID") && p.isPublished()));
    verify(pageRepository).update(argThat(p -> p.getId().equals("LINK_TRANSLATION_ID") && p.isPublished()));
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) PageServiceImpl(io.gravitee.rest.api.service.impl.PageServiceImpl) ArgumentMatchers.argThat(org.mockito.ArgumentMatchers.argThat) Mock(org.mockito.Mock) TemplateException(freemarker.template.TemplateException) TechnicalException(io.gravitee.repository.exceptions.TechnicalException) RunWith(org.junit.runner.RunWith) HashMap(java.util.HashMap) PageReferenceType(io.gravitee.repository.management.model.PageReferenceType) NotificationTemplateService(io.gravitee.rest.api.service.notification.NotificationTemplateService) Sets(org.mockito.internal.util.collections.Sets) Arrays.asList(java.util.Arrays.asList) Map(java.util.Map) PageRepository(io.gravitee.repository.management.api.PageRepository) io.gravitee.rest.api.model(io.gravitee.rest.api.model) Before(org.junit.Before) InjectMocks(org.mockito.InjectMocks) Test(org.junit.Test) Mockito(org.mockito.Mockito) ReflectionTestUtils.setField(org.springframework.test.util.ReflectionTestUtils.setField) Page(io.gravitee.repository.management.model.Page) io.gravitee.rest.api.service.exceptions(io.gravitee.rest.api.service.exceptions) Optional(java.util.Optional) Collections(java.util.Collections) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) SearchEngineService(io.gravitee.rest.api.service.search.SearchEngineService) HashMap(java.util.HashMap) Page(io.gravitee.repository.management.model.Page) Test(org.junit.Test)

Example 5 with PageRepository

use of io.gravitee.repository.management.api.PageRepository in project gravitee-management-rest-api by gravitee-io.

the class PageService_UpdateTest method shouldNotUnpublishPage.

private void shouldNotUnpublishPage(PlanStatus planStatus) throws TechnicalException {
    final String API_ID = "API_ID_TEST";
    Page unpublishedPage = new Page();
    unpublishedPage.setId(PAGE_ID);
    unpublishedPage.setOrder(1);
    unpublishedPage.setReferenceId(API_ID);
    unpublishedPage.setReferenceType(PageReferenceType.API);
    unpublishedPage.setType("MARKDOWN");
    unpublishedPage.setPublished(true);
    unpublishedPage.setVisibility("PUBLIC");
    doReturn(Optional.of(unpublishedPage)).when(pageRepository).findById(PAGE_ID);
    UpdatePageEntity updatePageEntity = new UpdatePageEntity();
    updatePageEntity.setPublished(false);
    updatePageEntity.setOrder(1);
    updatePageEntity.setVisibility(Visibility.PUBLIC);
    PlanEntity plan = mock(PlanEntity.class);
    when(plan.getGeneralConditions()).thenReturn(PAGE_ID);
    when(plan.getStatus()).thenReturn(planStatus);
    when(planService.findByApi(API_ID)).thenReturn(Sets.newSet(plan));
    pageService.update(PAGE_ID, updatePageEntity);
    verify(planService).findByApi(argThat(p -> p.equals(API_ID)));
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) PageServiceImpl(io.gravitee.rest.api.service.impl.PageServiceImpl) ArgumentMatchers.argThat(org.mockito.ArgumentMatchers.argThat) Mock(org.mockito.Mock) TemplateException(freemarker.template.TemplateException) TechnicalException(io.gravitee.repository.exceptions.TechnicalException) RunWith(org.junit.runner.RunWith) HashMap(java.util.HashMap) PageReferenceType(io.gravitee.repository.management.model.PageReferenceType) NotificationTemplateService(io.gravitee.rest.api.service.notification.NotificationTemplateService) Sets(org.mockito.internal.util.collections.Sets) Arrays.asList(java.util.Arrays.asList) Map(java.util.Map) PageRepository(io.gravitee.repository.management.api.PageRepository) io.gravitee.rest.api.model(io.gravitee.rest.api.model) Before(org.junit.Before) InjectMocks(org.mockito.InjectMocks) Test(org.junit.Test) Mockito(org.mockito.Mockito) ReflectionTestUtils.setField(org.springframework.test.util.ReflectionTestUtils.setField) Page(io.gravitee.repository.management.model.Page) io.gravitee.rest.api.service.exceptions(io.gravitee.rest.api.service.exceptions) Optional(java.util.Optional) Collections(java.util.Collections) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) SearchEngineService(io.gravitee.rest.api.service.search.SearchEngineService) Page(io.gravitee.repository.management.model.Page)

Aggregations

PageRepository (io.gravitee.repository.management.api.PageRepository)12 Page (io.gravitee.repository.management.model.Page)12 PageReferenceType (io.gravitee.repository.management.model.PageReferenceType)12 PageServiceImpl (io.gravitee.rest.api.service.impl.PageServiceImpl)12 Test (org.junit.Test)12 RunWith (org.junit.runner.RunWith)12 Mockito (org.mockito.Mockito)12 MockitoJUnitRunner (org.mockito.junit.MockitoJUnitRunner)12 TechnicalException (io.gravitee.repository.exceptions.TechnicalException)11 SearchEngineService (io.gravitee.rest.api.service.search.SearchEngineService)11 Collections (java.util.Collections)11 Optional (java.util.Optional)11 ArgumentMatchers.any (org.mockito.ArgumentMatchers.any)11 InjectMocks (org.mockito.InjectMocks)11 Mock (org.mockito.Mock)11 TemplateException (freemarker.template.TemplateException)10 io.gravitee.rest.api.model (io.gravitee.rest.api.model)10 io.gravitee.rest.api.service.exceptions (io.gravitee.rest.api.service.exceptions)10 NotificationTemplateService (io.gravitee.rest.api.service.notification.NotificationTemplateService)10 HashMap (java.util.HashMap)10