PageRepository extends AbstractRepository<Page> implements RefreshingRepository, WidgetContainerRepository<Page> { public void refreshIndexing(List<Page> pages) { try { persister.refreshIndexing(this.path.resolve(METADATA), pages); } catch (Exception e) { logger.error("Cannot refresh workspace indexing."); } } @Inject  PageRepository(
            @Named("pagesPath") Path path,
            @Named("pageFileBasedPersister") JsonFileBasedPersister<Page> persister,
            @Named("pageFileBasedLoader") JsonFileBasedLoader<Page> loader,
            BeanValidator validator,
            Watcher watcher); @Override String getComponentName(); List<Page> getArtifactsUsingWidget(String widgetId); Map<String, List<Page>> getArtifactsUsingWidgets(List<String> widgetIds); @Override void refresh(String id); void refreshIndexing(List<Page> pages); static final String METADATA; }
@Test public void should_refreshIndexing_repository() throws Exception { List<Page> pages = new ArrayList<>(); Page page = aPage().withUUID("baz-uuid").withId("page1").build(); Page page2 = aPage().withUUID("foo-uuid").withId("page2").withName("page2").build(); pages.add(page); pages.add(page2); repository.refreshIndexing(pages); verify(persister, times(1)).refreshIndexing(pagesPath.resolve(".metadata"), pages); }