@Test public void testGetExclusionsSuccess() { Exclusion exc = new Exclusion(base.getRawID(), pair.getRawID()); exclusions.add(exc); experiments.add(experiment); Mockito.when(accessor.getExclusions(base.getRawID())).thenReturn(resultDatastax); Mockito.when(resultDatastax.all()).thenReturn(exclusions); Mockito.when(experimentAccessor.getExperiments(Mockito.any())).thenReturn(resultExperimentDatastax); Mockito.when(resultExperimentDatastax.all()) .thenReturn(experiments); ExperimentList result = repository.getExclusions(base); assertEquals("Value should be eq", 1, result.getExperiments().size()); assertEquals("value should be same", experiment.getId(), result.getExperiments().get(0).getID().getRawID()); }
@Override public ExperimentList getExclusions(Experiment.ID base) { LOGGER.debug("Getting exclusion list for {}", base); try { List<Exclusion> exclusions = mutexAccessor.getExclusions(base.getRawID()).all(); List<UUID> experimentIds = new ArrayList<>(); for (Exclusion exclusion : exclusions) experimentIds.add(exclusion.getPair()); List<com.intuit.wasabi.repository.cassandra.pojo.Experiment> experimentPojos = experimentAccessor.getExperiments(experimentIds).all(); List<Experiment> experiments = new ArrayList<>(); for (com.intuit.wasabi.repository.cassandra.pojo.Experiment experimentPojo : experimentPojos) { experiments.add(ExperimentHelper.makeExperiment(experimentPojo)); } ExperimentList experimentList = new ExperimentList(); experimentList.setExperiments(experiments); return experimentList; } catch (Exception e) { LOGGER.error("Error whil getting exclusion list for {}", base, e); throw new RepositoryException("Could not retrieve the exclusions for \"" + base + "\"", e); } }
CassandraMutexRepository implements MutexRepository { @Override public ExperimentList getExclusions(Experiment.ID base) { LOGGER.debug("Getting exclusion list for {}", base); try { List<Exclusion> exclusions = mutexAccessor.getExclusions(base.getRawID()).all(); List<UUID> experimentIds = new ArrayList<>(); for (Exclusion exclusion : exclusions) experimentIds.add(exclusion.getPair()); List<com.intuit.wasabi.repository.cassandra.pojo.Experiment> experimentPojos = experimentAccessor.getExperiments(experimentIds).all(); List<Experiment> experiments = new ArrayList<>(); for (com.intuit.wasabi.repository.cassandra.pojo.Experiment experimentPojo : experimentPojos) { experiments.add(ExperimentHelper.makeExperiment(experimentPojo)); } ExperimentList experimentList = new ExperimentList(); experimentList.setExperiments(experiments); return experimentList; } catch (Exception e) { LOGGER.error("Error whil getting exclusion list for {}", base, e); throw new RepositoryException("Could not retrieve the exclusions for \"" + base + "\"", e); } } }
CassandraMutexRepository implements MutexRepository { @Override public ExperimentList getExclusions(Experiment.ID base) { LOGGER.debug("Getting exclusion list for {}", base); try { List<Exclusion> exclusions = mutexAccessor.getExclusions(base.getRawID()).all(); List<UUID> experimentIds = new ArrayList<>(); for (Exclusion exclusion : exclusions) experimentIds.add(exclusion.getPair()); List<com.intuit.wasabi.repository.cassandra.pojo.Experiment> experimentPojos = experimentAccessor.getExperiments(experimentIds).all(); List<Experiment> experiments = new ArrayList<>(); for (com.intuit.wasabi.repository.cassandra.pojo.Experiment experimentPojo : experimentPojos) { experiments.add(ExperimentHelper.makeExperiment(experimentPojo)); } ExperimentList experimentList = new ExperimentList(); experimentList.setExperiments(experiments); return experimentList; } catch (Exception e) { LOGGER.error("Error whil getting exclusion list for {}", base, e); throw new RepositoryException("Could not retrieve the exclusions for \"" + base + "\"", e); } } @Inject  CassandraMutexRepository(
            ExperimentAccessor experimentAccessor,
            ExclusionAccessor mutexAccessor,
            CassandraDriver driver); }
CassandraMutexRepository implements MutexRepository { @Override public ExperimentList getExclusions(Experiment.ID base) { LOGGER.debug("Getting exclusion list for {}", base); try { List<Exclusion> exclusions = mutexAccessor.getExclusions(base.getRawID()).all(); List<UUID> experimentIds = new ArrayList<>(); for (Exclusion exclusion : exclusions) experimentIds.add(exclusion.getPair()); List<com.intuit.wasabi.repository.cassandra.pojo.Experiment> experimentPojos = experimentAccessor.getExperiments(experimentIds).all(); List<Experiment> experiments = new ArrayList<>(); for (com.intuit.wasabi.repository.cassandra.pojo.Experiment experimentPojo : experimentPojos) { experiments.add(ExperimentHelper.makeExperiment(experimentPojo)); } ExperimentList experimentList = new ExperimentList(); experimentList.setExperiments(experiments); return experimentList; } catch (Exception e) { LOGGER.error("Error whil getting exclusion list for {}", base, e); throw new RepositoryException("Could not retrieve the exclusions for \"" + base + "\"", e); } } @Inject  CassandraMutexRepository(
            ExperimentAccessor experimentAccessor,
            ExclusionAccessor mutexAccessor,
            CassandraDriver driver); @Override List<Experiment.ID> getExclusionList(Experiment.ID experimentID); @Override void deleteExclusion(Experiment.ID base, Experiment.ID pair); @Override void createExclusion(Experiment.ID baseID, Experiment.ID pairID); @Override ExperimentList getExclusions(Experiment.ID base); @Override ExperimentList getNotExclusions(Experiment.ID base); @Override Map<Experiment.ID, List<Experiment.ID>> getExclusivesList(Collection<Experiment.ID> experimentIds); }
CassandraMutexRepository implements MutexRepository { @Override public ExperimentList getExclusions(Experiment.ID base) { LOGGER.debug("Getting exclusion list for {}", base); try { List<Exclusion> exclusions = mutexAccessor.getExclusions(base.getRawID()).all(); List<UUID> experimentIds = new ArrayList<>(); for (Exclusion exclusion : exclusions) experimentIds.add(exclusion.getPair()); List<com.intuit.wasabi.repository.cassandra.pojo.Experiment> experimentPojos = experimentAccessor.getExperiments(experimentIds).all(); List<Experiment> experiments = new ArrayList<>(); for (com.intuit.wasabi.repository.cassandra.pojo.Experiment experimentPojo : experimentPojos) { experiments.add(ExperimentHelper.makeExperiment(experimentPojo)); } ExperimentList experimentList = new ExperimentList(); experimentList.setExperiments(experiments); return experimentList; } catch (Exception e) { LOGGER.error("Error whil getting exclusion list for {}", base, e); throw new RepositoryException("Could not retrieve the exclusions for \"" + base + "\"", e); } } @Inject  CassandraMutexRepository(
            ExperimentAccessor experimentAccessor,
            ExclusionAccessor mutexAccessor,
            CassandraDriver driver); @Override List<Experiment.ID> getExclusionList(Experiment.ID experimentID); @Override void deleteExclusion(Experiment.ID base, Experiment.ID pair); @Override void createExclusion(Experiment.ID baseID, Experiment.ID pairID); @Override ExperimentList getExclusions(Experiment.ID base); @Override ExperimentList getNotExclusions(Experiment.ID base); @Override Map<Experiment.ID, List<Experiment.ID>> getExclusivesList(Collection<Experiment.ID> experimentIds);  }