use of org.molgenis.data.aggregation.AggregateQuery in project molgenis by molgenis.
the class RepositorySecurityDecoratorTest method testAggregatePermissionGranted.
@Test
public void testAggregatePermissionGranted() {
initPermissionServiceMock(EntityTypePermission.COUNT, true);
AggregateQuery aggregateQuery = mock(AggregateQuery.class);
repositorySecurityDecorator.aggregate(aggregateQuery);
verify(delegateRepository).aggregate(aggregateQuery);
}
use of org.molgenis.data.aggregation.AggregateQuery in project molgenis by molgenis.
the class RepositorySecurityDecoratorTest method testAggregatePermissionDenied.
@Test(expectedExceptions = MolgenisDataAccessException.class, expectedExceptionsMessageRegExp = MESSAGE_NO_COUNT_PERMISSION)
public void testAggregatePermissionDenied() {
initPermissionServiceMock(EntityTypePermission.COUNT, false);
AggregateQuery aggregateQuery = mock(AggregateQuery.class);
repositorySecurityDecorator.aggregate(aggregateQuery);
verify(delegateRepository).aggregate(aggregateQuery);
}
use of org.molgenis.data.aggregation.AggregateQuery in project molgenis by molgenis.
the class AttributeRepositorySecurityDecoratorTest 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 AttributeRepositorySecurityDecoratorTest method aggregateUser.
@WithMockUser(username = USERNAME)
@Test(expectedExceptions = MolgenisDataAccessException.class)
public void aggregateUser() {
AggregateQuery aggregateQuery = mock(AggregateQuery.class);
repo.aggregate(aggregateQuery);
}
use of org.molgenis.data.aggregation.AggregateQuery in project molgenis by molgenis.
the class AggregateAnonymizerRepositoryDecoratorTest method aggregateNoThreshold.
@Test
public void aggregateNoThreshold() throws Exception {
when(appSettings.getAggregateThreshold()).thenReturn(null);
AggregateQuery aggregateQuery = mock(AggregateQuery.class);
AggregateResult aggregateResult = mock(AggregateResult.class);
when(delegateRepository.aggregate(aggregateQuery)).thenReturn(aggregateResult);
assertEquals(aggregateResult, aggregateAnonymizerRepoDecorator.aggregate(aggregateQuery));
verifyZeroInteractions(aggregateAnonymizer);
verifyZeroInteractions(aggregateResult);
}
Aggregations