VIVO-308 Revise SelfEditorRelationshipPolicy to fit the ISF

Change the RelationshipChecker classes, and update the unit tests.
This commit is contained in:
j2blake 2013-10-03 11:52:40 -04:00
parent 0896b37c3c
commit b9bf8bb27c
9 changed files with 147 additions and 129 deletions

View file

@ -44,7 +44,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
/**
* Check the relationships in the SelfEditorRelationshipPolicy.
*
* This only checks the relationships that deal with InformationResources.
* This only checks the relationships that deal with InfoContentEntitys.
* Testing the others seems too redundant. If we generalize this to use
* configurable relationships, then we'll be able to make more general tests as
* well.
@ -153,7 +153,6 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
@Before
public void setLogging() {
// setLoggerLevel(this.getClass(), Level.DEBUG);
// setLoggerLevel(InformationResourceEditingPolicy.class, Level.DEBUG);
}
// ----------------------------------------------------------------------
@ -221,18 +220,18 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
}
// ----------------------------------------------------------------------
// InformationResource tests
// InfoContentEntity tests
// ----------------------------------------------------------------------
@Test
public void dataPropSubjectIsInfoResourceButNobodyIsSelfEditing() {
public void dataPropSubjectIsIceButNobodyIsSelfEditing() {
action = new AddDataPropertyStatement(ontModel, URI_JOE_WROTE_IT,
URI_PERMITTED_PREDICATE);
assertDecision(INCONCLUSIVE, policy.isAuthorized(idNobody, action));
}
@Test
public void dataPropSubjectIsInfoResourceButNoAuthorsOrEditorsOrFeatured() {
public void dataPropSubjectIsIceButNoAuthorsOrEditorsOrFeatured() {
action = new AddDataPropertyStatement(ontModel, URI_NOBODY_WROTE_IT,
URI_PERMITTED_PREDICATE);
assertDecision(INCONCLUSIVE, policy.isAuthorized(idJoe, action));
@ -240,28 +239,28 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
}
@Test
public void dataPropSubjectIsInfoResourceButWrongAuthor() {
public void dataPropSubjectIsIceButWrongAuthor() {
action = new AddDataPropertyStatement(ontModel, URI_BOZO_WROTE_IT,
URI_PERMITTED_PREDICATE);
assertDecision(INCONCLUSIVE, policy.isAuthorized(idJoe, action));
}
@Test
public void dataPropSubjectIsInfoResourceButWrongEditor() {
public void dataPropSubjectIsIceButWrongEditor() {
action = new AddDataPropertyStatement(ontModel, URI_BOZO_EDITED_IT,
URI_PERMITTED_PREDICATE);
assertDecision(INCONCLUSIVE, policy.isAuthorized(idJoe, action));
}
@Test
public void dataPropSubjectIsInfoResourceButWrongFeatured() {
public void dataPropSubjectIsIceButWrongFeatured() {
action = new AddDataPropertyStatement(ontModel,
URI_BOZO_FEATURED_IN_IT, URI_PERMITTED_PREDICATE);
assertDecision(INCONCLUSIVE, policy.isAuthorized(idJoe, action));
}
@Test
public void dataPropSubjectIsInfoResourceWithSelfEditingAuthor() {
public void dataPropSubjectIsIceWithSelfEditingAuthor() {
action = new AddDataPropertyStatement(ontModel, URI_JOE_WROTE_IT,
URI_PERMITTED_PREDICATE);
assertDecision(AUTHORIZED, policy.isAuthorized(idJoe, action));
@ -269,7 +268,7 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
}
@Test
public void dataPropSubjectIsInfoResourceWithSelfEditingEditor() {
public void dataPropSubjectIsIceWithSelfEditingEditor() {
action = new AddDataPropertyStatement(ontModel, URI_JOE_EDITED_IT,
URI_PERMITTED_PREDICATE);
assertDecision(AUTHORIZED, policy.isAuthorized(idJoe, action));
@ -277,7 +276,7 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
}
@Test
public void dataPropSubjectIsInfoResourceWithSelfEditingFeatured() {
public void dataPropSubjectIsIceWithSelfEditingFeatured() {
action = new AddDataPropertyStatement(ontModel, URI_JOE_FEATURED_IN_IT,
URI_PERMITTED_PREDICATE);
assertDecision(AUTHORIZED, policy.isAuthorized(idJoe, action));
@ -285,14 +284,14 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
}
@Test
public void objectPropSubjectIsInfoResourceButNobodyIsSelfEditing() {
public void objectPropSubjectIsIceButNobodyIsSelfEditing() {
action = new AddObjectPropertyStatement(ontModel, URI_JOE_EDITED_IT,
PERMITTED_PREDICATE, URI_PERMITTED_RESOURCE);
assertDecision(INCONCLUSIVE, policy.isAuthorized(idNobody, action));
}
@Test
public void objectPropSubjectIsInfoResourceButNoAuthorsOrEditorsOrFeatured() {
public void objectPropSubjectIsIceButNoAuthorsOrEditorsOrFeatured() {
action = new AddObjectPropertyStatement(ontModel, URI_NOBODY_WROTE_IT,
PERMITTED_PREDICATE, URI_PERMITTED_RESOURCE);
assertDecision(INCONCLUSIVE, policy.isAuthorized(idJoe, action));
@ -300,21 +299,21 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
}
@Test
public void objectPropSubjectIsInfoResourceButWrongAuthor() {
public void objectPropSubjectIsIceButWrongAuthor() {
action = new AddObjectPropertyStatement(ontModel, URI_BOZO_WROTE_IT,
PERMITTED_PREDICATE, URI_PERMITTED_RESOURCE);
assertDecision(INCONCLUSIVE, policy.isAuthorized(idJoe, action));
}
@Test
public void objectPropSubjectIsInfoResourceButWrongEditor() {
public void objectPropSubjectIsIceButWrongEditor() {
action = new AddObjectPropertyStatement(ontModel, URI_BOZO_EDITED_IT,
PERMITTED_PREDICATE, URI_PERMITTED_RESOURCE);
assertDecision(INCONCLUSIVE, policy.isAuthorized(idJoe, action));
}
@Test
public void objectPropSubjectIsInfoResourceButWrongFeatured() {
public void objectPropSubjectIsIceButWrongFeatured() {
action = new AddObjectPropertyStatement(ontModel,
URI_BOZO_FEATURED_IN_IT, PERMITTED_PREDICATE,
URI_PERMITTED_RESOURCE);
@ -322,7 +321,7 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
}
@Test
public void objectPropSubjectIsInfoResourceWithSelfEditingAuthor() {
public void objectPropSubjectIsIceWithSelfEditingAuthor() {
action = new AddObjectPropertyStatement(ontModel, URI_JOE_WROTE_IT,
PERMITTED_PREDICATE, URI_PERMITTED_RESOURCE);
assertDecision(AUTHORIZED, policy.isAuthorized(idJoe, action));
@ -330,7 +329,7 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
}
@Test
public void objectPropSubjectIsInfoResourceWithSelfEditingEditor() {
public void objectPropSubjectIsIceWithSelfEditingEditor() {
action = new AddObjectPropertyStatement(ontModel, URI_JOE_EDITED_IT,
PERMITTED_PREDICATE, URI_PERMITTED_RESOURCE);
assertDecision(AUTHORIZED, policy.isAuthorized(idJoe, action));
@ -338,7 +337,7 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
}
@Test
public void objectPropSubjectIsInfoResourceWithSelfEditingFeatured() {
public void objectPropSubjectIsIceWithSelfEditingFeatured() {
action = new AddObjectPropertyStatement(ontModel,
URI_JOE_FEATURED_IN_IT, PERMITTED_PREDICATE,
URI_PERMITTED_RESOURCE);
@ -347,7 +346,7 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
}
@Test
public void objectPropObjectIsInfoResourcebutNobodyIsSelfEditing() {
public void objectPropObjectIsIcebutNobodyIsSelfEditing() {
action = new AddObjectPropertyStatement(ontModel,
URI_PERMITTED_RESOURCE, PERMITTED_PREDICATE,
URI_JOE_EDITED_IT);
@ -355,7 +354,7 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
}
@Test
public void objectPropObjectIsInfoResourceButNoAuthorsOrEditors() {
public void objectPropObjectIsIceButNoAuthorsOrEditors() {
action = new AddObjectPropertyStatement(ontModel,
URI_PERMITTED_RESOURCE, PERMITTED_PREDICATE,
URI_NOBODY_WROTE_IT);
@ -364,7 +363,7 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
}
@Test
public void objectPropObjectIsInfoResourceButWrongAuthor() {
public void objectPropObjectIsIceButWrongAuthor() {
action = new AddObjectPropertyStatement(ontModel,
URI_PERMITTED_RESOURCE, PERMITTED_PREDICATE,
URI_BOZO_WROTE_IT);
@ -372,7 +371,7 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
}
@Test
public void objectPropObjectIsInfoResourceButWrongEditor() {
public void objectPropObjectIsIceButWrongEditor() {
action = new AddObjectPropertyStatement(ontModel,
URI_PERMITTED_RESOURCE, PERMITTED_PREDICATE,
URI_BOZO_EDITED_IT);
@ -380,7 +379,7 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
}
@Test
public void objectPropObjectIsInfoResourceButWrongFeatured() {
public void objectPropObjectIsIceButWrongFeatured() {
action = new AddObjectPropertyStatement(ontModel,
URI_PERMITTED_RESOURCE, PERMITTED_PREDICATE,
URI_BOZO_FEATURED_IN_IT);
@ -388,7 +387,7 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
}
@Test
public void objectPropObjectIsInfoResourceWithSelfEditingAuthor() {
public void objectPropObjectIsIceWithSelfEditingAuthor() {
action = new AddObjectPropertyStatement(ontModel,
URI_PERMITTED_RESOURCE, PERMITTED_PREDICATE,
URI_JOE_WROTE_IT);
@ -397,7 +396,7 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
}
@Test
public void objectPropObjectIsInfoResourceWithSelfEditingEditor() {
public void objectPropObjectIsIceWithSelfEditingEditor() {
action = new AddObjectPropertyStatement(ontModel,
URI_PERMITTED_RESOURCE, PERMITTED_PREDICATE,
URI_JOE_EDITED_IT);
@ -406,7 +405,7 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
}
@Test
public void objectPropObjectIsInfoResourceWithSelfEditingFeatured() {
public void objectPropObjectIsIceWithSelfEditingFeatured() {
action = new AddObjectPropertyStatement(ontModel,
URI_PERMITTED_RESOURCE, PERMITTED_PREDICATE,
URI_JOE_FEATURED_IN_IT);
@ -419,14 +418,14 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
// ----------------------------------------------------------------------
@Test
public void dataPropSubjectIsNotInfoResource() {
public void dataPropSubjectIsNotIce() {
action = new AddDataPropertyStatement(ontModel, URI_PERMITTED_RESOURCE,
URI_PERMITTED_PREDICATE);
assertDecision(INCONCLUSIVE, policy.isAuthorized(idJoe, action));
}
@Test
public void objectPropNeitherSubjectOrObjectIsInfoResource() {
public void objectPropNeitherSubjectOrObjectIsIce() {
action = new AddObjectPropertyStatement(ontModel,
URI_PERMITTED_RESOURCE, PERMITTED_PREDICATE,
URI_PERMITTED_RESOURCE);

View file

@ -6,9 +6,11 @@
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix bib: <http://purl.org/ontology/bibo/> .
@prefix core: <http://vivoweb.org/ontology/core#> .
@prefix obo: <http://purl.obolibrary.org/obo/> .
@prefix mydomain: <http://vivo.mydomain.edu/individual/> .
### This file is for the test InformationResourceEditingPolicyTest.java.
### This file contains data for SelfEditorRelationshipPolicyTest.java.
#
# Bozo
@ -21,8 +23,8 @@ mydomain:bozo
rdfs:label "Person, Bozo" ;
foaf:firstName "Bozo" ;
foaf:lastName "Person" ;
core:editorOf mydomain:bozoEditedIt ;
core:authorInAuthorship mydomain:authorshipBozo ;
core:relatedBy mydomain:authorshipBozo ;
core:relatedBy mydomain:editorshipBozo ;
.
#
@ -36,16 +38,16 @@ mydomain:joe
rdfs:label "Person, Joe" ;
foaf:firstName "Joe" ;
foaf:lastName "Person" ;
core:editorOf mydomain:joeEditedIt ;
core:authorInAuthorship mydomain:authorshipJoe ;
core:relatedBy mydomain:authorshipJoe ;
core:relatedBy mydomain:editorshipJoe ;
.
#
# info resource with no author or editor
# info content entity with no author or editor
#
mydomain:nobodyWroteIt
a core:BlogPosting ;
a core:InformationResource ;
a obo:IAO_0000030 ;
a bib:Article ;
a bib:Document ;
a owl:Thing ;
@ -53,45 +55,53 @@ mydomain:nobodyWroteIt
.
#
# info resource with Bozo as author
# info content entity with Bozo as author
#
mydomain:bozoWroteIt
a core:BlogPosting ;
a core:InformationResource ;
a obo:IAO_0000030 ;
a bib:Article ;
a bib:Document ;
a owl:Thing ;
rdfs:label "Bozo is author" ;
core:informationResourceInAuthorship mydomain:authorshipBozo ;
core:relatedBy mydomain:authorshipBozo ;
.
mydomain:authorshipBozo
a core:Authorship ;
a core:Relationship ;
a owl:Thing ;
core:linkedInformationResource mydomain:bozoWroteIt ;
core:linkedAuthor mydomain:bozo ;
core:relates mydomain:bozoWroteIt ;
core:relates mydomain:bozo ;
.
#
# info resource with Bozo as editor
# info content entity with Bozo as editor
#
mydomain:bozoEditedIt
a core:BlogPosting ;
a core:InformationResource ;
a obo:IAO_0000030 ;
a bib:Article ;
a bib:Document ;
a owl:Thing ;
rdfs:label "Bozo is editor" ;
bib:editor mydomain:bozo ;
core:relatedBy mydomain:editorshipBozo ;
.
mydomain:editorshipBozo
a core:Editorship ;
a core:Relationship ;
a owl:Thing ;
core:relates mydomain:bozoEditedIt ;
core:relates mydomain:bozo ;
.
#
# info resource with Bozo featured
# info content entity with Bozo featured
#
mydomain:bozoFeaturedInIt
a core:BlogPosting ;
a core:InformationResource ;
a obo:IAO_0000030 ;
a bib:Article ;
a bib:Document ;
a owl:Thing ;
@ -100,45 +110,53 @@ mydomain:bozoFeaturedInIt
.
#
# info resource with Joe as author
# info content entity with Joe as author
#
mydomain:joeWroteIt
a core:BlogPosting ;
a core:InformationResource ;
a obo:IAO_0000030 ;
a bib:Article ;
a bib:Document ;
a owl:Thing ;
rdfs:label "Joe is author" ;
core:informationResourceInAuthorship mydomain:authorshipJoe ;
core:relatedBy mydomain:authorshipJoe ;
.
mydomain:authorshipJoe
a core:Authorship ;
a core:Relationship ;
a owl:Thing ;
core:linkedInformationResource mydomain:joeWroteIt ;
core:linkedAuthor mydomain:joe ;
core:relates mydomain:joeWroteIt ;
core:relates mydomain:joe ;
.
#
# info resource with Joe as editor
# info content entity with Joe as editor
#
mydomain:joeEditedIt
a core:BlogPosting ;
a core:InformationResource ;
a obo:IAO_0000030 ;
a bib:Article ;
a bib:Document ;
a owl:Thing ;
rdfs:label "Joe is editor" ;
bib:editor mydomain:joe ;
core:relatedBy mydomain:editorshipJoe ;
.
mydomain:editorshipJoe
a core:Editorship ;
a core:Relationship ;
a owl:Thing ;
core:relates mydomain:joeEditedIt ;
core:relates mydomain:joe ;
.
#
# info resource with Joe featured
# info content entity with Joe featured
#
mydomain:joeFeaturedInIt
a core:BlogPosting ;
a core:InformationResource ;
a obo:IAO_0000030 ;
a bib:Article ;
a bib:Document ;
a owl:Thing ;