@Test public void saveExperimentPageStateTest() { Experiment.ID experimentID = Experiment.ID.valueOf(experimentId); ExperimentPageList oldPageList = new ExperimentPageList(); ExperimentPageList newPageList = new ExperimentPageList(); repository.saveExperimentPageState(experimentID, oldPageList, newPageList); verify(experimentAuditLogAccessor, times(1)).insertBy( eq(experimentId), any(Date.class), eq("pages"), eq(oldPageList.toString()), eq(newPageList.toString()) ); }
void saveExperimentPageState(Experiment.ID experimentID, ExperimentPageList oldPageList, ExperimentPageList newPageList) { try { this.experimentAuditLogAccessor.insertBy( experimentID.getRawID(), new Date(), "pages", oldPageList.toString(), newPageList.toString() ); } catch (WriteTimeoutException | UnavailableException | NoHostAvailableException e) { throw new RepositoryException("Could not write pages change to audit log: \"" + experimentID + "\"", e); } }
CassandraPagesRepository implements PagesRepository { void saveExperimentPageState(Experiment.ID experimentID, ExperimentPageList oldPageList, ExperimentPageList newPageList) { try { this.experimentAuditLogAccessor.insertBy( experimentID.getRawID(), new Date(), "pages", oldPageList.toString(), newPageList.toString() ); } catch (WriteTimeoutException | UnavailableException | NoHostAvailableException e) { throw new RepositoryException("Could not write pages change to audit log: \"" + experimentID + "\"", e); } } }
CassandraPagesRepository implements PagesRepository { void saveExperimentPageState(Experiment.ID experimentID, ExperimentPageList oldPageList, ExperimentPageList newPageList) { try { this.experimentAuditLogAccessor.insertBy( experimentID.getRawID(), new Date(), "pages", oldPageList.toString(), newPageList.toString() ); } catch (WriteTimeoutException | UnavailableException | NoHostAvailableException e) { throw new RepositoryException("Could not write pages change to audit log: \"" + experimentID + "\"", e); } } @Inject  CassandraPagesRepository(ExperimentAccessor experimentAccessor,
                                    PageExperimentIndexAccessor pageExperimentIndexAccessor,
                                    ExperimentPageAccessor experimentPageAccessor,
                                    AppPageIndexAccessor appPageIndexAccessor,
                                    ExperimentAuditLogAccessor experimentAuditLogAccessor,
                                    MappingManager mappingManager); }
CassandraPagesRepository implements PagesRepository { void saveExperimentPageState(Experiment.ID experimentID, ExperimentPageList oldPageList, ExperimentPageList newPageList) { try { this.experimentAuditLogAccessor.insertBy( experimentID.getRawID(), new Date(), "pages", oldPageList.toString(), newPageList.toString() ); } catch (WriteTimeoutException | UnavailableException | NoHostAvailableException e) { throw new RepositoryException("Could not write pages change to audit log: \"" + experimentID + "\"", e); } } @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 { void saveExperimentPageState(Experiment.ID experimentID, ExperimentPageList oldPageList, ExperimentPageList newPageList) { try { this.experimentAuditLogAccessor.insertBy( experimentID.getRawID(), new Date(), "pages", oldPageList.toString(), newPageList.toString() ); } catch (WriteTimeoutException | UnavailableException | NoHostAvailableException e) { throw new RepositoryException("Could not write pages change to audit log: \"" + experimentID + "\"", e); } } @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);  }