KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > services > jcr > api > comparing > IdenticalItemsTest


1 /*
2  * Copyright 2001-2003 The eXo platform SARL All rights reserved.
3  * Please look at license.txt in info directory for more license detail.
4  */

5
6 package org.exoplatform.services.jcr.api.comparing;
7
8
9 import javax.jcr.*;
10 import org.exoplatform.services.jcr.BaseTest;
11
12 /**
13  * Created y the eXo platform team
14  * User: Benjamin Mestrallet
15  * Date: 13 ao�t 2004
16  */

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