Author: areshetnyak
Date: 2009-11-23 06:10:55 -0500 (Mon, 23 Nov 2009)
New Revision: 803
Modified:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheRestartTest.java
Log:
EXOJCR-203 : The test JBossCacheRestartTest was changed.
Modified:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheRestartTest.java
===================================================================
---
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheRestartTest.java 2009-11-23
10:00:16 UTC (rev 802)
+++
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheRestartTest.java 2009-11-23
11:10:55 UTC (rev 803)
@@ -20,14 +20,18 @@
import org.exoplatform.services.jcr.access.AccessControlList;
import org.exoplatform.services.jcr.datamodel.InternalQName;
+import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
+import org.exoplatform.services.jcr.util.IdGenerator;
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
+import com.thoughtworks.xstream.core.ReferenceByIdMarshaller.IDGenerator;
+
/**
* Created by The eXo Platform SAS.
*
@@ -49,11 +53,30 @@
// add root (/)
initJCRRoot();
+ // add node (/node)
+ String node1id = IdGenerator.generate();
+ QPath node1path = QPath.parse("[]:1[]node:1");
+ conn.add(new TransientNodeData(node1path, node1id, 1, Constants.NT_UNSTRUCTURED,
new InternalQName[0], 0,
+ Constants.ROOT_UUID, new AccessControlList()));
+
+ PropertyData primaryType =
+ createProperty(node1path, node1id, Constants.JCR_PRIMARYTYPE,
Constants.NT_UNSTRUCTURED, false);
+ conn.add(primaryType);
+ conn.commit();
+
// check before stop
Node<Serializable, Object> rNode =
cache.getRoot().getChild(Fqn.fromElements(JBossCacheStorage.NODES, Constants.ROOT_UUID));
assertNotNull("Node expected", rNode);
checkNode(rNode, Constants.ROOT_UUID, Constants.ROOT_PATH);
+ Node<Serializable, Object> node1 =
cache.getRoot().getChild(Fqn.fromElements(JBossCacheStorage.NODES, node1id));
+ assertNotNull("Node '/node1' expected", node1);
+ checkNode(node1, node1id, node1path);
+
+ Node<Serializable, Object> prop1 =
cache.getRoot().getChild(Fqn.fromElements(JBossCacheStorage.PROPS,
primaryType.getIdentifier()));
+ assertNotNull("Property '/node1/jcr:primaryType' expected",
prop1);
+ checkProp(primaryType.getIdentifier(), primaryType.getQPath(), new
String(primaryType.getValues().get(0).getAsByteArray(),Constants.DEFAULT_ENCODING));
+
// stop cache
cache.stop();
cache.destroy();
@@ -65,5 +88,13 @@
rNode = cache.getRoot().getChild(Fqn.fromElements(JBossCacheStorage.NODES,
Constants.ROOT_UUID));
assertNotNull("Node expected", rNode);
checkNode(rNode, Constants.ROOT_UUID, Constants.ROOT_PATH);
+
+ node1 = cache.getRoot().getChild(Fqn.fromElements(JBossCacheStorage.NODES,
node1id));
+ assertNotNull("Node '/node1' expected", node1);
+ checkNode(node1, node1id, node1path);
+
+ prop1 = cache.getRoot().getChild(Fqn.fromElements(JBossCacheStorage.PROPS,
primaryType.getIdentifier()));
+ assertNotNull("Property '/node1/jcr:primaryType' expected",
prop1);
+ checkProp(primaryType.getIdentifier(), primaryType.getQPath(), new
String(primaryType.getValues().get(0).getAsByteArray(),Constants.DEFAULT_ENCODING));
}
}