@Before
public void before() throws IOException, CatalogException {
MongoDBAdaptorTest dbAdaptorTest = new MongoDBAdaptorTest();
dbAdaptorTest.before();
Configuration configuration = Configuration.load(getClass().getResource("/configuration-test.yml").openStream());
user1 = MongoDBAdaptorTest.user1;
user2 = MongoDBAdaptorTest.user2;
user3 = MongoDBAdaptorTest.user3;
dbAdaptorFactory = MongoDBAdaptorTest.catalogDBAdaptor;
aclDBAdaptor = new AuthorizationMongoDBAdaptor(configuration);
studyId = user3.getProjects().get(0).getStudies().get(0).getUid();
s1 = dbAdaptorFactory.getCatalogSampleDBAdaptor().insert(studyId, new Sample("s1", "", new Individual(), null, null, 1, 1,
"", "", false, Collections.emptyList(), new ArrayList<>(), Collections.emptyMap()), QueryOptions.empty()).first();
acl_s1_user1 = new SampleAclEntry(user1.getId(), Arrays.asList());
acl_s1_user2 = new SampleAclEntry(user2.getId(), Arrays.asList(
SampleAclEntry.SamplePermissions.VIEW.name(),
SampleAclEntry.SamplePermissions.VIEW_ANNOTATIONS.name(),
SampleAclEntry.SamplePermissions.UPDATE.name()
));
aclDBAdaptor.setAcls(Arrays.asList(s1.getUid()), Arrays.asList(acl_s1_user1, acl_s1_user2), Entity.SAMPLE);
}