1 5 6 package org.exoplatform.services.jcr.api.comparing; 7 8 9 import javax.jcr.*; 10 import org.exoplatform.services.jcr.BaseTest; 11 12 17 public class IdenticalItemsTest extends BaseTest{ 18 19 public void tearDown() throws RepositoryException { 20 Node root = ticket.getRootNode(); 21 root.remove("childNode"); 22 ticket.save(); 23 } 24 25 public void testIsIdentical() throws RepositoryException { 26 Node root = ticket.getRootNode(); 27 Node file = root.addNode("childNode", "nt:folder").addNode("childNode2", "nt:file"); 28 Node contentNode = file.getNode("jcr:content"); 29 contentNode.setProperty("exo:content", new StringValue("this is the content")); 30 ticket.save(); 31 32 Ticket ticket2 = repository.login(credentials, WORKSPACE); 33 root = ticket2.getRootNode(); 34 Item contentNode2 = root.getNode("childNode/childNode2/jcr:content"); 35 36 assertTrue(contentNode2.isIdentical(contentNode)); 37 assertFalse(contentNode2.isIdentical(root)); 38 assertFalse(contentNode2.isIdentical(file)); 39 assertFalse(contentNode2.isIdentical(contentNode.getProperty("exo:content"))); 40 } 41 42 } 43 | Popular Tags |