Author: nzamosenchuk
Date: 2009-11-09 10:36:10 -0500 (Mon, 09 Nov 2009)
New Revision: 521
Modified:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoaderTest.java
Log:
EXOJCR-204: Test in now based on abstract class
Modified:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoaderTest.java
===================================================================
---
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoaderTest.java 2009-11-09
15:34:11 UTC (rev 520)
+++
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoaderTest.java 2009-11-09
15:36:10 UTC (rev 521)
@@ -18,8 +18,6 @@
*/
package org.exoplatform.services.jcr.impl.storage.jbosscache;
-import junit.framework.TestCase;
-
import org.exoplatform.services.jcr.access.AccessControlList;
import org.exoplatform.services.jcr.core.NamespaceAccessor;
import org.exoplatform.services.jcr.datamodel.InternalQName;
@@ -32,9 +30,7 @@
import org.exoplatform.services.jcr.impl.core.observation.ObservationManagerRegistry;
import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
-import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
-import org.jboss.cache.Modification.ModificationType;
import java.util.ArrayList;
import java.util.HashMap;
@@ -53,7 +49,7 @@
* @version $Id: ObservationCacheLoaderTest.java 34360 2009-07-22 23:58:59Z aheritier $
*
*/
-public class ObservationCacheLoaderTest extends TestCase
+public class ObservationCacheLoaderTest extends AbstractCacheLoaderTest
{
private ObservationCacheLoader loader;
@@ -99,6 +95,25 @@
});
}
+ public void testFilterByUUID() throws Exception
+ {
+ QPath node1path = QPath.parse("[]:1[]node:1");
+ NodeData newNode =
+ new TransientNodeData(node1path, Constants.SYSTEM_UUID, 1,
Constants.NT_UNSTRUCTURED, new InternalQName[0], 0,
+ Constants.ROOT_UUID, new AccessControlList());
+ DummyListener listener = new DummyListener();
+ registry.addEventListener(listener, new ListenerCriteria(Event.NODE_ADDED, null,
true,
+ new String[]{Constants.ROOT_UUID}, null, false, "asd"));
+
+ List<Modification> modifications = new ArrayList<Modification>();
+ modifications.add(addNode(newNode));
+ loader.put(modifications);
+ assertEquals(1, listener.eventList.size());
+ Event event = listener.eventList.get(0);
+ assertEquals(Event.NODE_ADDED, event.getType());
+ assertEquals(lf.createJCRPath(node1path).getAsString(false), event.getPath());
+ }
+
public void testAddNode() throws Exception
{
QPath node1path = QPath.parse("[]:1[]node:1");
@@ -174,7 +189,7 @@
assertEquals(Event.PROPERTY_CHANGED, event.getType());
assertEquals(lf.createJCRPath(prop1path).getAsString(false), event.getPath());
}
-
+
public void testRemoveProperty() throws Exception
{
QPath prop1path = QPath.parse("[]:1[]node:1[]property:1");
@@ -194,47 +209,6 @@
assertEquals(lf.createJCRPath(prop1path).getAsString(false), event.getPath());
}
- public Modification addNode(NodeData data)
- {
- String fqn = "/" + JBossCacheStorage.NODES + "/" +
data.getIdentifier();
- return new Modification(ModificationType.PUT_KEY_VALUE, Fqn.fromString(fqn),
(Object)JBossCacheStorage.ITEM_DATA,
- (Object)data);
- }
-
- public Modification removeNode(NodeData data)
- {
- String fqn = "/" + JBossCacheStorage.NODES + "/" +
data.getIdentifier();
- return new Modification(ModificationType.REMOVE_NODE, Fqn.fromString(fqn),
(Object)JBossCacheStorage.ITEM_DATA,
- (Object)data);
- }
-
- public Modification addProperty(PropertyData data)
- {
- String fqn = "/" + JBossCacheStorage.PROPS + "/" +
data.getIdentifier();
- return new Modification(ModificationType.PUT_KEY_VALUE, Fqn.fromString(fqn),
(Object)JBossCacheStorage.ITEM_DATA,
- (Object)data);
- }
-
- public Modification updateProperty(PropertyData data)
- {
- String fqn = "/" + JBossCacheStorage.PROPS + "/" +
data.getIdentifier();
- Modification modification =
- new Modification(ModificationType.PUT_KEY_VALUE, Fqn.fromString(fqn),
(Object)JBossCacheStorage.ITEM_DATA,
- (Object)data);
- modification.setOldValue(data);
- return modification;
- }
-
- public Modification removeProperty(PropertyData data)
- {
- String fqn = "/" + JBossCacheStorage.PROPS + "/" +
data.getIdentifier();
- Modification modification =
- new Modification(ModificationType.REMOVE_NODE, Fqn.fromString(fqn),
(Object)JBossCacheStorage.ITEM_DATA,
- (Object)data);
- modification.setOldValue(data);
- return modification;
- }
-
@Override
protected void tearDown() throws Exception
{