@Test public void getPageListTest() { List<AppPage> queryResult = new ArrayList<>(); queryResult.add(AppPage.builder().page("page1").appName(APPLICATION_NAME.toString()).build()); queryResult.add(AppPage.builder().page("page2").appName(APPLICATION_NAME.toString()).build()); when(appPageIndexAccessor.selectBy(eq(APPLICATION_NAME.toString()))).thenReturn(mockedResultMapping); when(mockedResultMapping.iterator()).thenReturn(queryResult.iterator()); List<Page> result = repository.getPageList(APPLICATION_NAME); assertThat(result.size(), is(queryResult.size())); for (int i = 0; i < queryResult.size(); i++) { Page page = result.get(i); AppPage appPage = queryResult.get(i); assertThat(page.getName().toString(), is(appPage.getPage())); } }
@Override public List<Page> getPageList(Application.Name applicationName) { Stream<AppPage> resultList = getAppPagesFromCassandra(applicationName); return resultList .map(t -> new Page.Builder().withName(Page.Name.valueOf(t.getPage())).build()) .collect(Collectors.toList()); }
CassandraPagesRepository implements PagesRepository { @Override public List<Page> getPageList(Application.Name applicationName) { Stream<AppPage> resultList = getAppPagesFromCassandra(applicationName); return resultList .map(t -> new Page.Builder().withName(Page.Name.valueOf(t.getPage())).build()) .collect(Collectors.toList()); } }
CassandraPagesRepository implements PagesRepository { @Override public List<Page> getPageList(Application.Name applicationName) { Stream<AppPage> resultList = getAppPagesFromCassandra(applicationName); return resultList .map(t -> new Page.Builder().withName(Page.Name.valueOf(t.getPage())).build()) .collect(Collectors.toList()); } @Inject  CassandraPagesRepository(ExperimentAccessor experimentAccessor,
                                    PageExperimentIndexAccessor pageExperimentIndexAccessor,
                                    ExperimentPageAccessor experimentPageAccessor,
                                    AppPageIndexAccessor appPageIndexAccessor,
                                    ExperimentAuditLogAccessor experimentAuditLogAccessor,
                                    MappingManager mappingManager); }
CassandraPagesRepository implements PagesRepository { @Override public List<Page> getPageList(Application.Name applicationName) { Stream<AppPage> resultList = getAppPagesFromCassandra(applicationName); return resultList .map(t -> new Page.Builder().withName(Page.Name.valueOf(t.getPage())).build()) .collect(Collectors.toList()); } @Inject  CassandraPagesRepository(ExperimentAccessor experimentAccessor,
                                    PageExperimentIndexAccessor pageExperimentIndexAccessor,
                                    ExperimentPageAccessor experimentPageAccessor,
                                    AppPageIndexAccessor appPageIndexAccessor,
                                    ExperimentAuditLogAccessor experimentAuditLogAccessor,
                                    MappingManager mappingManager); @Override void postPages(Application.Name applicationName, Experiment.ID experimentID, ExperimentPageList experimentPageList); @Override void deletePage(Application.Name applicationName, Experiment.ID experimentID, Page.Name pageName); @Override List<Page> getPageList(Application.Name applicationName); @Override Map<Page.Name, List<PageExperiment>> getPageExperimentList(Application.Name applicationName); @Override ExperimentPageList getExperimentPages(Experiment.ID experimentID); @Override List<PageExperiment> getExperiments(Application.Name applicationName, Page.Name pageName); @Override List<PageExperiment> getExperimentsWithoutLabels(Application.Name applicationName, Page.Name pageName); @Override Map<Pair<Application.Name, Page.Name>, List<PageExperiment>> getExperimentsWithoutLabels(Collection<Pair<Application.Name, Page.Name>> appAndPagePairs); @Override void erasePageData(Application.Name applicationName, Experiment.ID experimentID); }
CassandraPagesRepository implements PagesRepository { @Override public List<Page> getPageList(Application.Name applicationName) { Stream<AppPage> resultList = getAppPagesFromCassandra(applicationName); return resultList .map(t -> new Page.Builder().withName(Page.Name.valueOf(t.getPage())).build()) .collect(Collectors.toList()); } @Inject  CassandraPagesRepository(ExperimentAccessor experimentAccessor,
                                    PageExperimentIndexAccessor pageExperimentIndexAccessor,
                                    ExperimentPageAccessor experimentPageAccessor,
                                    AppPageIndexAccessor appPageIndexAccessor,
                                    ExperimentAuditLogAccessor experimentAuditLogAccessor,
                                    MappingManager mappingManager); @Override void postPages(Application.Name applicationName, Experiment.ID experimentID, ExperimentPageList experimentPageList); @Override void deletePage(Application.Name applicationName, Experiment.ID experimentID, Page.Name pageName); @Override List<Page> getPageList(Application.Name applicationName); @Override Map<Page.Name, List<PageExperiment>> getPageExperimentList(Application.Name applicationName); @Override ExperimentPageList getExperimentPages(Experiment.ID experimentID); @Override List<PageExperiment> getExperiments(Application.Name applicationName, Page.Name pageName); @Override List<PageExperiment> getExperimentsWithoutLabels(Application.Name applicationName, Page.Name pageName); @Override Map<Pair<Application.Name, Page.Name>, List<PageExperiment>> getExperimentsWithoutLabels(Collection<Pair<Application.Name, Page.Name>> appAndPagePairs); @Override void erasePageData(Application.Name applicationName, Experiment.ID experimentID);  }