use of ubic.gemma.model.expression.arrayDesign.ArrayDesign in project Gemma by PavlidisLab.
the class DiffExMetaAnalyzerServiceTest method cleanup.
private void cleanup() {
for (GeneDifferentialExpressionMetaAnalysisSummaryValueObject vo : geneDiffExMetaAnalysisHelperService.loadAllMetaAnalyses()) {
analysisService.delete(vo.getId());
}
this.deleteSet("GSE2018");
this.deleteSet("GSE2111");
this.deleteSet("GSE6344");
ArrayDesign gpl96 = arrayDesignService.findByShortName("GPL96");
ArrayDesign gpl97 = arrayDesignService.findByShortName("GPL97");
if (gpl96 != null) {
for (ExpressionExperiment ee : arrayDesignService.getExpressionExperiments(gpl96)) {
experimentService.remove(ee);
}
arrayDesignService.remove(gpl96);
}
if (gpl97 != null) {
for (ExpressionExperiment ee : arrayDesignService.getExpressionExperiments(gpl97)) {
experimentService.remove(ee);
}
arrayDesignService.remove(gpl97);
}
Collection<Gene> genes = geneService.loadAll();
for (Gene gene : genes) {
try {
geneService.remove(gene);
} catch (Exception e) {
log.warn("Failed to remove gene " + gene);
}
}
}
use of ubic.gemma.model.expression.arrayDesign.ArrayDesign in project Gemma by PavlidisLab.
the class AclAdviceTest method testNumExperiments.
@Test
public void testNumExperiments() {
this.runAsAdmin();
ArrayDesign ad = super.getTestPersistentArrayDesign(10, true);
ExpressionExperiment ee = super.getTestPersistentBasicExpressionExperiment(ad);
securityService.makePrivate(ee);
ExpressionExperiment ee2 = super.getTestPersistentBasicExpressionExperiment(ad);
securityService.makePublic(ee2);
// admin can see everything
assertEquals(2, arrayDesignService.getExpressionExperiments(ad).size());
// anonymous can only see the public set
this.runAsAnonymous();
assertEquals(1, arrayDesignService.numExperiments(ad));
// make the other data set public too...
this.runAsAdmin();
securityService.makePublic(ee);
// anonymous can see both
this.runAsAnonymous();
assertEquals(2, arrayDesignService.numExperiments(ad));
// logged-in user can also see both
String user = RandomStringUtils.randomAlphabetic(10);
this.makeUser(user);
this.runAsUser(user);
assertEquals(2, arrayDesignService.numExperiments(ad));
// make data set private
this.runAsAdmin();
securityService.makePrivate(ee);
assertEquals(2, arrayDesignService.numExperiments(ad));
// user can't see data set that is now private
this.runAsUser(user);
assertEquals(1, arrayDesignService.numExperiments(ad));
// make the data set owned by user; now they can see both that one and the public one
this.runAsAdmin();
securityService.setOwner(ee, user);
this.runAsUser(user);
assertEquals(2, arrayDesignService.numExperiments(ad));
// anonymous can only see the public one.
this.runAsAnonymous();
assertEquals(1, arrayDesignService.numExperiments(ad));
// create a new user group, add user to it, make ee2 private to group
this.runAsAdmin();
String group = RandomStringUtils.randomAlphabetic(10);
securityService.createGroup(group);
securityService.addUserToGroup(user, group);
securityService.makeReadableByGroup(ee2, group);
securityService.makePrivate(ee2);
assertEquals(2, arrayDesignService.numExperiments(ad));
// anonymous can't see private groups
this.runAsAnonymous();
assertEquals(0, arrayDesignService.numExperiments(ad));
// user can view experiment he owns as well as one shared with him
this.runAsUser(user);
assertEquals(2, arrayDesignService.numExperiments(ad));
}
use of ubic.gemma.model.expression.arrayDesign.ArrayDesign in project Gemma by PavlidisLab.
the class AclAdviceTest method testArrayDesignAclsUser.
@Test
public void testArrayDesignAclsUser() {
String userName = "testuser" + RandomStringUtils.randomAlphabetic(3);
this.makeUser(userName);
this.runAsUser(userName);
ArrayDesign ad = this.getTestPersistentArrayDesign(2, true, false, false);
aclTestUtils.checkHasAcl(ad);
aclTestUtils.checkHasAces(ad);
Sid owner = securityService.getOwner(ad);
assertEquals(userName, ((AclPrincipalSid) owner).getPrincipal());
arrayDesignService.update(ad);
assertEquals(userName, ((AclPrincipalSid) owner).getPrincipal());
arrayDesignService.remove(ad);
aclTestUtils.checkDeletedAcl(ad);
}
use of ubic.gemma.model.expression.arrayDesign.ArrayDesign in project Gemma by PavlidisLab.
the class AclAdviceTest method testArrayDesignAcls.
/*
* Create Array design, check ACLs are put on correctly and removed when the design is removed. Array Designs are
* _simple_ compared to EEs!
*/
@Test
public void testArrayDesignAcls() {
// need to modify
ArrayDesign ad = this.getTestPersistentArrayDesign(2, true, false, false);
aclTestUtils.checkHasAcl(ad);
aclTestUtils.checkHasAces(ad);
Sid owner = securityService.getOwner(ad);
assertEquals("administrator", ((AclPrincipalSid) owner).getPrincipal());
arrayDesignService.remove(ad);
aclTestUtils.checkDeletedAcl(ad);
}
use of ubic.gemma.model.expression.arrayDesign.ArrayDesign in project Gemma by PavlidisLab.
the class SecurityServiceTest method testMakePrivateWithoutPermission.
/*
* Tests changing object level security on the ArrayDesign from public to private WITHOUT the correct permission
* (You need to be administrator).
*/
@Test
public void testMakePrivateWithoutPermission() {
this.makeUser("unauthorizedTestUser");
// test setup.
this.runAsUser("unauthorizedTestUser");
ArrayDesign ad = this.arrayDesignService.findByName(this.arrayDesignName).iterator().next();
try {
this.securityService.makePrivate(ad);
fail("Should have gotten a unauthorized user exception");
} catch (AccessDeniedException e) {
// ok.
}
}
Aggregations