@Test public void testSelectQueriesWithNoSelectionPolicies(){ FinishedLensQuery mockFinishedQuery = mock(FinishedLensQuery.class); EstimatedImmutableQueryCollection mockWaitingQueries = mock(EstimatedImmutableQueryCollection.class); Set<WaitingQueriesSelectionPolicy> emptySetOfPolicies = Sets.newHashSet(); when(mockFinishedQuery.getDriverSelectionPolicies()).thenReturn(ImmutableSet.copyOf(emptySetOfPolicies)); WaitingQueriesSelector selector = new UnioningWaitingQueriesSelector(ImmutableSet.copyOf(emptySetOfPolicies)); Set<QueryContext> actualEligibleQueries = selector.selectQueries(mockFinishedQuery, mockWaitingQueries); assertTrue(actualEligibleQueries.isEmpty()); }
@Override public Set<QueryContext> selectQueries(final FinishedLensQuery finishedQuery, final EstimatedImmutableQueryCollection waitingQueries) { Set<WaitingQueriesSelectionPolicy> allSelectionPolicies = prepareAllSelectionPolicies(finishedQuery); List<Set<QueryContext>> candiateQueriesSets = getAllCandidateQueriesSets(finishedQuery, waitingQueries, allSelectionPolicies); return Sets.newHashSet(Iterables.concat(candiateQueriesSets)); }
UnioningWaitingQueriesSelector implements WaitingQueriesSelector { @Override public Set<QueryContext> selectQueries(final FinishedLensQuery finishedQuery, final EstimatedImmutableQueryCollection waitingQueries) { Set<WaitingQueriesSelectionPolicy> allSelectionPolicies = prepareAllSelectionPolicies(finishedQuery); List<Set<QueryContext>> candiateQueriesSets = getAllCandidateQueriesSets(finishedQuery, waitingQueries, allSelectionPolicies); return Sets.newHashSet(Iterables.concat(candiateQueriesSets)); } }
UnioningWaitingQueriesSelector implements WaitingQueriesSelector { @Override public Set<QueryContext> selectQueries(final FinishedLensQuery finishedQuery, final EstimatedImmutableQueryCollection waitingQueries) { Set<WaitingQueriesSelectionPolicy> allSelectionPolicies = prepareAllSelectionPolicies(finishedQuery); List<Set<QueryContext>> candiateQueriesSets = getAllCandidateQueriesSets(finishedQuery, waitingQueries, allSelectionPolicies); return Sets.newHashSet(Iterables.concat(candiateQueriesSets)); } UnioningWaitingQueriesSelector(
    @NonNull final ImmutableSet<WaitingQueriesSelectionPolicy> selectionPolicies); }
UnioningWaitingQueriesSelector implements WaitingQueriesSelector { @Override public Set<QueryContext> selectQueries(final FinishedLensQuery finishedQuery, final EstimatedImmutableQueryCollection waitingQueries) { Set<WaitingQueriesSelectionPolicy> allSelectionPolicies = prepareAllSelectionPolicies(finishedQuery); List<Set<QueryContext>> candiateQueriesSets = getAllCandidateQueriesSets(finishedQuery, waitingQueries, allSelectionPolicies); return Sets.newHashSet(Iterables.concat(candiateQueriesSets)); } UnioningWaitingQueriesSelector(
    @NonNull final ImmutableSet<WaitingQueriesSelectionPolicy> selectionPolicies); @Override Set<QueryContext> selectQueries(final FinishedLensQuery finishedQuery,
      final EstimatedImmutableQueryCollection waitingQueries); }
UnioningWaitingQueriesSelector implements WaitingQueriesSelector { @Override public Set<QueryContext> selectQueries(final FinishedLensQuery finishedQuery, final EstimatedImmutableQueryCollection waitingQueries) { Set<WaitingQueriesSelectionPolicy> allSelectionPolicies = prepareAllSelectionPolicies(finishedQuery); List<Set<QueryContext>> candiateQueriesSets = getAllCandidateQueriesSets(finishedQuery, waitingQueries, allSelectionPolicies); return Sets.newHashSet(Iterables.concat(candiateQueriesSets)); } UnioningWaitingQueriesSelector(
    @NonNull final ImmutableSet<WaitingQueriesSelectionPolicy> selectionPolicies); @Override Set<QueryContext> selectQueries(final FinishedLensQuery finishedQuery,
      final EstimatedImmutableQueryCollection waitingQueries);  }