diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/search/indexing/AdditionalURIsForContextNodesTest.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/search/indexing/AdditionalURIsForContextNodesTest.java index 26e87f7c8..1fd0b272c 100644 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/search/indexing/AdditionalURIsForContextNodesTest.java +++ b/webapp/test/edu/cornell/mannlib/vitro/webapp/search/indexing/AdditionalURIsForContextNodesTest.java @@ -16,6 +16,62 @@ import com.hp.hpl.jena.rdf.model.ModelFactory; public class AdditionalURIsForContextNodesTest { + @Test + public void testPositionChanges(){ + String n3 = + " . \n" + + " . \n" + + " . \n" + + " . \n" + + " . \n" + + " . \n" + + " . \n" + + + " . \n" + + " . \n" + + " . \n" + + " . \n" + + " . \n" + + + " . \n" + + " . \n" + + " . \n" + + " . \n" + + " . \n" + + " . \n" + + + " . \n" + + " . \n" + + " . \n" + + " . \n" + + " . \n" + + " . \n" + + + " . \n" + + " . \n" + + " . \n" + + " . \n" + + " . \n" + + " . \n" + + " . \n" + + " . \n" ; + + //make a test model with an person, an authorship context node and a book + OntModel model = ModelFactory.createOntologyModel(); + model.read( new StringReader(n3), null, "N3"); + + //make an AdditionalURIsForContextNodesTest object with that model + AdditionalURIsForContextNodes uriFinder = new AdditionalURIsForContextNodes( model ); + + //if the person changes then the org needs to be updated + List uris = uriFinder.findAdditionalURIsToIndex( "http://caruso-laptop.mannlib.cornell.edu:8090/vivo/individual/n932"); + assertTrue("did not find org for context node", uris.contains("http://caruso-laptop.mannlib.cornell.edu:8090/vivo/individual/n5423" )); + + //if the org changes then the person needs to be updated + uris = uriFinder.findAdditionalURIsToIndex( "http://caruso-laptop.mannlib.cornell.edu:8090/vivo/individual/n5423"); + assertTrue("did not find person for context node", uris.contains("http://caruso-laptop.mannlib.cornell.edu:8090/vivo/individual/n932" )); + } + @Test public void testPersonOnOrgChange() { @@ -61,5 +117,7 @@ public class AdditionalURIsForContextNodesTest { assertTrue("did not find person for context node", uris.contains("http://vivo.scripps.edu/individual/n14979" )); } + + }