@Test public void circumventRollupTest() { Experiment experiment = mock(Experiment.class); Parameters parameters = mock(Parameters.class); Date date = mock(Date.class); Experiment.ID id = Experiment.ID.newInstance(); when(experiments.getExperiment(eq(id))).thenReturn(experiment); when(parameters.getToTime()).thenReturn(date); when(parameters.getFromTime()).thenReturn(null); boolean result = this.analyticsImpl.circumventRollup(id, parameters); assertThat(result, is(true)); List<String> list = mock(List.class); when(parameters.getFromTime()).thenReturn(null); when(parameters.getActions()).thenReturn(null); when(analyticsRepository.checkMostRecentRollup(eq(experiment), eq(parameters), eq(date))) .thenReturn(false); result = this.analyticsImpl.circumventRollup(id, parameters); assertThat(result, is(false)); when(parameters.getToTime()).thenReturn(null); result = this.analyticsImpl.circumventRollup(id, parameters); assertThat(result, is(false)); }
boolean circumventRollup(final Experiment.ID experimentID, final Parameters parameters) { Experiment exp = getExperimentIfExists(experimentID); Date to = parameters.getToTime(); if (parameters.getFromTime() != null || parameters.getActions() != null) { return true; } else if (to != null) { return analyticsRepository.checkMostRecentRollup(exp, parameters, to); } else { return false; } }
AnalyticsImpl implements Analytics { boolean circumventRollup(final Experiment.ID experimentID, final Parameters parameters) { Experiment exp = getExperimentIfExists(experimentID); Date to = parameters.getToTime(); if (parameters.getFromTime() != null || parameters.getActions() != null) { return true; } else if (to != null) { return analyticsRepository.checkMostRecentRollup(exp, parameters, to); } else { return false; } } }
AnalyticsImpl implements Analytics { boolean circumventRollup(final Experiment.ID experimentID, final Parameters parameters) { Experiment exp = getExperimentIfExists(experimentID); Date to = parameters.getToTime(); if (parameters.getFromTime() != null || parameters.getActions() != null) { return true; } else if (to != null) { return analyticsRepository.checkMostRecentRollup(exp, parameters, to); } else { return false; } } @Inject  AnalyticsImpl(final Experiments experiments, final AssignmentsRepository assignmentRepository,
                         final TransactionFactory dataTransactorFactory, final AnalyticsRepository analyticsRepository,
                         final AnalysisTools analysisTools,
                         final @CassandraRepository ExperimentRepository cassandraRepository); }
AnalyticsImpl implements Analytics { boolean circumventRollup(final Experiment.ID experimentID, final Parameters parameters) { Experiment exp = getExperimentIfExists(experimentID); Date to = parameters.getToTime(); if (parameters.getFromTime() != null || parameters.getActions() != null) { return true; } else if (to != null) { return analyticsRepository.checkMostRecentRollup(exp, parameters, to); } else { return false; } } @Inject  AnalyticsImpl(final Experiments experiments, final AssignmentsRepository assignmentRepository,
                         final TransactionFactory dataTransactorFactory, final AnalyticsRepository analyticsRepository,
                         final AnalysisTools analysisTools,
                         final @CassandraRepository ExperimentRepository cassandraRepository); @Override ExperimentCounts getExperimentRollup(final Experiment.ID experimentID, final Parameters parameters); @Override ExperimentCounts getExperimentCounts(final Experiment.ID experimentID, final Parameters parameters); @Override ExperimentCumulativeCounts getExperimentRollupDailies(final Experiment.ID experimentID,
                                                                 final Parameters parameters); @Override ExperimentCumulativeCounts getExperimentCountsDailies(final Experiment.ID experimentId, final Parameters parameters); @Override ExperimentStatistics getExperimentStatistics(final Experiment.ID experimentId, final Parameters parameters); @Override ExperimentCumulativeStatistics getExperimentStatisticsDailies(final Experiment.ID experimentId,
                                                                         final Parameters parameters); @Override AssignmentCounts getAssignmentCounts(Experiment.ID experimentID, Context context); }
AnalyticsImpl implements Analytics { boolean circumventRollup(final Experiment.ID experimentID, final Parameters parameters) { Experiment exp = getExperimentIfExists(experimentID); Date to = parameters.getToTime(); if (parameters.getFromTime() != null || parameters.getActions() != null) { return true; } else if (to != null) { return analyticsRepository.checkMostRecentRollup(exp, parameters, to); } else { return false; } } @Inject  AnalyticsImpl(final Experiments experiments, final AssignmentsRepository assignmentRepository,
                         final TransactionFactory dataTransactorFactory, final AnalyticsRepository analyticsRepository,
                         final AnalysisTools analysisTools,
                         final @CassandraRepository ExperimentRepository cassandraRepository); @Override ExperimentCounts getExperimentRollup(final Experiment.ID experimentID, final Parameters parameters); @Override ExperimentCounts getExperimentCounts(final Experiment.ID experimentID, final Parameters parameters); @Override ExperimentCumulativeCounts getExperimentRollupDailies(final Experiment.ID experimentID,
                                                                 final Parameters parameters); @Override ExperimentCumulativeCounts getExperimentCountsDailies(final Experiment.ID experimentId, final Parameters parameters); @Override ExperimentStatistics getExperimentStatistics(final Experiment.ID experimentId, final Parameters parameters); @Override ExperimentCumulativeStatistics getExperimentStatisticsDailies(final Experiment.ID experimentId,
                                                                         final Parameters parameters); @Override AssignmentCounts getAssignmentCounts(Experiment.ID experimentID, Context context); static final String PROPERTY_NAME; }