NIHVIVO-2299 Continue converting from older Identifiers to newer Identifiers.

This commit is contained in:
j2blake 2011-05-11 21:19:57 +00:00
parent 491f5d3728
commit f41d69753b
3 changed files with 24 additions and 42 deletions

View file

@ -15,8 +15,8 @@ import stubs.edu.cornell.mannlib.vitro.webapp.auth.policy.bean.PropertyRestricti
import stubs.javax.servlet.ServletContextStub;
import edu.cornell.mannlib.vitro.testing.AbstractTestClass;
import edu.cornell.mannlib.vitro.webapp.auth.identifier.ArrayIdentifierBundle;
import edu.cornell.mannlib.vitro.webapp.auth.identifier.HasAssociatedIndividual;
import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle;
import edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingIdentifierFactory;
import edu.cornell.mannlib.vitro.webapp.auth.policy.bean.PropertyRestrictionPolicyHelper;
import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.Authorization;
import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyDecision;
@ -69,14 +69,11 @@ public class SelfEditingPolicyTest extends AbstractTestClass {
policy = new SelfEditingPolicy(ctx);
ids = new ArrayIdentifierBundle();
ids.add(new SelfEditingIdentifierFactory.NetId("test223"));
IndividualImpl ind = new IndividualImpl();
ind.setURI(SELFEDITOR_URI);
ids.add(new SelfEditingIdentifierFactory.SelfEditing(ind,
SelfEditingIdentifierFactory.NOT_BLACKLISTED));
ids = new ArrayIdentifierBundle();
ids.add(new HasAssociatedIndividual(SELFEDITOR_URI));
}
@Test
@ -323,19 +320,13 @@ public class SelfEditingPolicyTest extends AbstractTestClass {
private void setUpTwoSEIs() {
ids = new ArrayIdentifierBundle();
ids.add(new SelfEditingIdentifierFactory.NetId("bozoUser"));
IndividualImpl ind1 = new IndividualImpl();
ind1.setURI(SAFE_NS + "bozoUri");
ids.add(new SelfEditingIdentifierFactory.SelfEditing(ind1,
SelfEditingIdentifierFactory.NOT_BLACKLISTED));
ids.add(new SelfEditingIdentifierFactory.NetId("test223"));
ids.add(new HasAssociatedIndividual(ind1.getURI()));
IndividualImpl ind2 = new IndividualImpl();
ind2.setURI(SELFEDITOR_URI);
ids.add(new SelfEditingIdentifierFactory.SelfEditing(ind2,
SelfEditingIdentifierFactory.NOT_BLACKLISTED));
ids.add(new HasAssociatedIndividual(ind2.getURI()));
}
// ----------------------------------------------------------------------

View file

@ -20,9 +20,9 @@ import com.hp.hpl.jena.rdf.model.impl.RDFDefaultErrorHandler;
import edu.cornell.mannlib.vitro.testing.AbstractTestClass;
import edu.cornell.mannlib.vitro.webapp.auth.identifier.ArrayIdentifierBundle;
import edu.cornell.mannlib.vitro.webapp.auth.identifier.HasAssociatedIndividual;
import edu.cornell.mannlib.vitro.webapp.auth.identifier.Identifier;
import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle;
import edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingIdentifierFactory;
import edu.cornell.mannlib.vitro.webapp.auth.policy.SelfEditingPolicy;
import edu.cornell.mannlib.vitro.webapp.auth.policy.bean.PropertyRestrictionPolicyHelper;
import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.Authorization;
@ -88,7 +88,7 @@ public class SelfEditingPolicySetupTest extends AbstractTestClass {
PropertyRestrictionPolicyHelper.setBean(ctx,
PropertyRestrictionPolicyHelperStub
.getInstance(new String[] { ADMIN_NS }));
policy = new SelfEditingPolicy(ctx);
Assert.assertNotNull(policy);
@ -96,8 +96,7 @@ public class SelfEditingPolicySetupTest extends AbstractTestClass {
seIndividual.setURI(SELFEDITOR_URI);
ids = new ArrayIdentifierBundle();
ids.add(new SelfEditingIdentifierFactory.SelfEditing(seIndividual,
SelfEditingIdentifierFactory.NOT_BLACKLISTED));
ids.add(new HasAssociatedIndividual(SELFEDITOR_URI));
// setLoggerLevel(SelfEditingPolicySetupTest.class, Level.DEBUG);
}
@ -125,16 +124,8 @@ public class SelfEditingPolicySetupTest extends AbstractTestClass {
@Test
public void noSelfEditorIdentifier() {
ids.clear();
ids.add(new Identifier() { /* empty identifier */ });
assertAddObjectPropStmt(SELFEDITOR_URI, SAFE_PREDICATE, SAFE_RESOURCE,
Authorization.INCONCLUSIVE);
}
@Test
public void blacklistedSelfEditor() {
ids.clear();
ids.add(new SelfEditingIdentifierFactory.SelfEditing(seIndividual,
"Don't like this guy."));
ids.add(new Identifier() { /* empty identifier */
});
assertAddObjectPropStmt(SELFEDITOR_URI, SAFE_PREDICATE, SAFE_RESOURCE,
Authorization.INCONCLUSIVE);
}