use of org.hisp.dhis.user.UserGroupAccess in project dhis2-core by dhis2.
the class MetadataExportServiceTest method testSkipSharing.
// @Test
// TODO Fix this
public void testSkipSharing() {
MetadataExportParams params = new MetadataExportParams();
params.setSkipSharing(true);
params.setClasses(Sets.newHashSet(DataElement.class));
User user = createUser('A');
UserGroup group = createUserGroup('A', Sets.newHashSet(user));
DataElement de1 = createDataElement('A');
DataElement de2 = createDataElement('B');
DataElement de3 = createDataElement('C');
DataElement de4 = createDataElement('D');
DataElement de5 = createDataElement('E');
de1.setUserAccesses(Sets.newHashSet(new UserAccess(user, "rwrwrwrw")));
de2.setPublicAccess("rwrwrwrw");
de3.setCreatedBy(user);
de4.setUserGroupAccesses(Sets.newHashSet(new UserGroupAccess(group, "rwrwrwrw")));
de5.setExternalAccess(true);
manager.save(user);
manager.save(group);
manager.save(de1);
manager.save(de2);
manager.save(de3);
manager.save(de4);
manager.save(de5);
Map<Class<? extends IdentifiableObject>, List<? extends IdentifiableObject>> metadata = metadataExportService.getMetadata(params);
assertEquals(5, metadata.get(DataElement.class).size());
metadata.get(DataElement.class).stream().forEach(element -> checkSharingFields(element));
}
Aggregations