use of org.molgenis.data.aggregation.AggregateQuery in project molgenis by molgenis.
the class IndexedRepositoryDecoratorTest method aggregateUnknownIndexExceptionRecoverable.
@Test
public void aggregateUnknownIndexExceptionRecoverable() {
AggregateQuery aggregateQuery = mock(AggregateQuery.class);
AggregateResult aggregateResult = mock(AggregateResult.class);
when(searchService.aggregate(repositoryEntityType, aggregateQuery)).thenThrow(new UnknownIndexException("msg")).thenReturn(aggregateResult);
assertEquals(indexedRepositoryDecorator.aggregate(aggregateQuery), aggregateResult);
verify(delegateRepository, never()).count(unsupportedQuery);
}
use of org.molgenis.data.aggregation.AggregateQuery in project molgenis by molgenis.
the class EntityTypeRepositorySecurityDecoratorTest method aggregateSuOrSystem.
private void aggregateSuOrSystem() {
AggregateQuery aggregateQuery = mock(AggregateQuery.class);
AggregateResult aggregateResult = mock(AggregateResult.class);
when(delegateRepository.aggregate(aggregateQuery)).thenReturn(aggregateResult);
assertEquals(repo.aggregate(aggregateQuery), aggregateResult);
}
use of org.molgenis.data.aggregation.AggregateQuery in project molgenis by molgenis.
the class AggregateAnonymizerRepositoryDecoratorTest method aggregateThreshold.
@Test
public void aggregateThreshold() throws Exception {
int threshold = 10;
when(appSettings.getAggregateThreshold()).thenReturn(threshold);
AggregateQuery aggregateQuery = mock(AggregateQuery.class);
AggregateResult aggregateResult = mock(AggregateResult.class);
when(delegateRepository.aggregate(aggregateQuery)).thenReturn(aggregateResult);
AnonymizedAggregateResult anonymizedAggregateResult = mock(AnonymizedAggregateResult.class);
when(aggregateAnonymizer.anonymize(aggregateResult, threshold)).thenReturn(anonymizedAggregateResult);
assertEquals(anonymizedAggregateResult, aggregateAnonymizerRepoDecorator.aggregate(aggregateQuery));
}
Aggregations