Beispiel #1
0
 @Test
 public void shouldFindPropertyForNodeUsingPropertyName() throws Exception {
   AbstractJcrNode altima = cache.findJcrNode(null, path("/Cars/Hybrid/Nissan Altima"));
   AbstractJcrItem altimaModel =
       cache.findJcrProperty(altima.nodeId, altima.path(), name("vehix:model"));
   assertThat(altimaModel.isNode(), is(false));
   javax.jcr.Node altimaModelParent = altimaModel.getParent();
   assertThat(altima, is(sameInstance(altimaModelParent)));
 }
Beispiel #2
0
 @Test
 public void shouldFindNodeItemUsingStartingNodeAndRelativePath() throws Exception {
   AbstractJcrNode hybrid = cache.findJcrNode(null, path("/Cars/Hybrid"));
   AbstractJcrItem highlander =
       cache.findJcrItem(hybrid.nodeId, hybrid.path(), path("../Hybrid/Toyota Highlander"));
   assertThat(highlander.isNode(), is(true));
   // Make sure this is the same as if we find it directly ...
   AbstractJcrNode highlander2 = cache.findJcrNode(null, path("/Cars/Hybrid/Toyota Highlander"));
   assertThat((AbstractJcrNode) highlander, is(sameInstance(highlander2)));
 }
Beispiel #3
0
 @Test
 public void shouldFindPropertyItemUsingStartingNodeAndRelativePath() throws Exception {
   AbstractJcrNode hybrid = cache.findJcrNode(null, path("/Cars/Hybrid"));
   AbstractJcrItem altimaModel =
       cache.findJcrItem(
           hybrid.nodeId, hybrid.path(), path("../Hybrid/Nissan Altima/vehix:model"));
   assertThat(altimaModel.isNode(), is(false));
   javax.jcr.Node altimaModelParent = altimaModel.getParent();
   javax.jcr.Node altima = cache.findJcrNode(null, path("/Cars/Hybrid/Nissan Altima"));
   assertThat(altima, is(sameInstance(altimaModelParent)));
 }