jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r306651 - in /incubator/jackrabbit/trunk/src: java/org/apache/jackrabbit/core/ java/org/apache/jackrabbit/core/nodetype/virtual/ java/org/apache/jackrabbit/core/observation/ java/org/apache/jackrabbit/core/version/ test/org/apache/jackrabbi...
Date Thu, 06 Oct 2005 14:15:57 GMT
Author: mreutegg
Date: Thu Oct  6 07:15:36 2005
New Revision: 306651

URL: http://svn.apache.org/viewcvs?rev=306651&view=rev
Log:
JCR-187: it is not possible to register an event listener which listens to mixin nodetypes

Added:
    incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/observation/MixinTest.java
  (with props)
Modified:
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/virtual/VirtualNodeTypeStateManager.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventFilter.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventState.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventStateCollection.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java
    incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/observation/TestAll.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java?rev=306651&r1=306650&r2=306651&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java Thu Oct 
6 07:15:36 2005
@@ -824,6 +824,15 @@
     }
 
     /**
+     * Returns the <code>QName</code>s of this node's mixin types.
+     *
+     * @return a set of the <code>QName</code>s of this node's mixin types.
+     */
+    public Set getMixinTypeNames() {
+        return ((NodeState) state).getMixinTypeNames();
+    }
+
+    /**
      * Returns the effective (i.e. merged and resolved) node type representation
      * of this node's primary and mixin node types.
      *

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/virtual/VirtualNodeTypeStateManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/virtual/VirtualNodeTypeStateManager.java?rev=306651&r1=306650&r2=306651&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/virtual/VirtualNodeTypeStateManager.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/virtual/VirtualNodeTypeStateManager.java
Thu Oct  6 07:15:36 2005
@@ -178,6 +178,7 @@
                 node.internalGetUUID(),
                 node.getPrimaryPath().getNameElement(),
                 (NodeTypeImpl) parent.getPrimaryNodeType(),
+                parent.getMixinTypeNames(),
                 node.getSession()
         ));
 
@@ -189,6 +190,7 @@
                     node.getPrimaryPath(),
                     prop.getPrimaryPath().getNameElement(),
                     (NodeTypeImpl) node.getPrimaryNodeType(),
+                    node.getMixinTypeNames(),
                     node.getSession()
             ));
         }
@@ -216,6 +218,7 @@
                 node.internalGetUUID(),
                 node.getPrimaryPath().getNameElement(),
                 (NodeTypeImpl) parent.getPrimaryNodeType(),
+                parent.getMixinTypeNames(),
                 node.getSession()
         ));
         NodeIterator niter = node.getNodes();

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventFilter.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventFilter.java?rev=306651&r1=306650&r2=306651&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventFilter.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventFilter.java
Thu Oct  6 07:15:36 2005
@@ -185,7 +185,8 @@
             boolean match = false;
             for (int i = 0; i < nodeTypes.length && !match; i++) {
                 match |= eventState.getNodeType().getQName().equals(nodeTypes[i].getQName())
-                    || eventState.getNodeType().isDerivedFrom(nodeTypes[i].getQName());
+                        || eventState.getMixinNames().contains(nodeTypes[i].getQName())
+                        || eventState.getNodeType().isDerivedFrom(nodeTypes[i].getQName());
             }
             if (!match) {
                 return true;

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventState.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventState.java?rev=306651&r1=306650&r2=306651&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventState.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventState.java
Thu Oct  6 07:15:36 2005
@@ -24,6 +24,7 @@
 
 import javax.jcr.Session;
 import javax.jcr.observation.Event;
+import java.util.Set;
 
 /**
  * The <code>EventState</code> class encapsulates the session
@@ -65,6 +66,11 @@
     private final NodeTypeImpl nodeType;
 
     /**
+     * Set of mixin QNames assigned to the parent node.
+     */
+    private final Set mixins;
+
+    /**
      * The session that caused this event.
      */
     private final Session session;
@@ -94,6 +100,7 @@
      * @param childPath  the relative path of the child item associated with
      *                   this event.
      * @param nodeType   the node type of the parent node.
+     * @param mixins     mixins assigned to the parent node.
      * @param session    the {@link javax.jcr.Session} that caused this event.
      */
     private EventState(int type,
@@ -102,6 +109,7 @@
                        String childUUID,
                        Path.PathElement childPath,
                        NodeTypeImpl nodeType,
+                       Set mixins,
                        Session session) {
         int mask = (Event.PROPERTY_ADDED | Event.PROPERTY_CHANGED | Event.PROPERTY_REMOVED);
         if ((type & mask) > 0) {
@@ -119,6 +127,7 @@
         this.childUUID = childUUID;
         this.childRelPath = childPath;
         this.nodeType = nodeType;
+        this.mixins = mixins;
         this.session = session;
     }
 
@@ -135,6 +144,7 @@
      * @param childUUID  the uuid of the child node associated with this event.
      * @param childPath  the relative path of the child node that was added.
      * @param nodeType   the node type of the parent node.
+     * @param mixins     mixins assigned to the parent node.
      * @param session    the session that added the node.
      * @return an <code>EventState</code> instance.
      */
@@ -143,6 +153,7 @@
                                             String childUUID,
                                             Path.PathElement childPath,
                                             NodeTypeImpl nodeType,
+                                            Set mixins,
                                             Session session) {
         return new EventState(Event.NODE_ADDED,
                 parentUUID,
@@ -150,6 +161,7 @@
                 childUUID,
                 childPath,
                 nodeType,
+                mixins,
                 session);
     }
 
@@ -164,6 +176,7 @@
      * @param childUUID  the uuid of the child node associated with this event.
      * @param childPath  the relative path of the child node that was removed.
      * @param nodeType   the node type of the parent node.
+     * @param mixins     mixins assigned to the parent node.
      * @param session    the session that removed the node.
      * @return an <code>EventState</code> instance.
      */
@@ -172,6 +185,7 @@
                                               String childUUID,
                                               Path.PathElement childPath,
                                               NodeTypeImpl nodeType,
+                                              Set mixins,
                                               Session session) {
         return new EventState(Event.NODE_REMOVED,
                 parentUUID,
@@ -179,6 +193,7 @@
                 childUUID,
                 childPath,
                 nodeType,
+                mixins,
                 session);
     }
 
@@ -192,6 +207,7 @@
      *                   this <code>EventState</code>.
      * @param childPath  the relative path of the property that was added.
      * @param nodeType   the node type of the parent node.
+     * @param mixins     mixins assigned to the parent node.
      * @param session    the session that added the property.
      * @return an <code>EventState</code> instance.
      */
@@ -199,6 +215,7 @@
                                            Path parentPath,
                                            Path.PathElement childPath,
                                            NodeTypeImpl nodeType,
+                                           Set mixins,
                                            Session session) {
         return new EventState(Event.PROPERTY_ADDED,
                 parentUUID,
@@ -206,6 +223,7 @@
                 null,
                 childPath,
                 nodeType,
+                mixins,
                 session);
     }
 
@@ -219,6 +237,7 @@
      *                   this <code>EventState</code>.
      * @param childPath  the relative path of the property that was removed.
      * @param nodeType   the node type of the parent node.
+     * @param mixins     mixins assigned to the parent node.
      * @param session    the session that removed the property.
      * @return an <code>EventState</code> instance.
      */
@@ -226,6 +245,7 @@
                                              Path parentPath,
                                              Path.PathElement childPath,
                                              NodeTypeImpl nodeType,
+                                             Set mixins,
                                              Session session) {
         return new EventState(Event.PROPERTY_REMOVED,
                 parentUUID,
@@ -233,6 +253,7 @@
                 null,
                 childPath,
                 nodeType,
+                mixins,
                 session);
     }
 
@@ -246,6 +267,7 @@
      *                   this <code>EventState</code>.
      * @param childPath  the relative path of the property that changed.
      * @param nodeType   the node type of the parent node.
+     * @param mixins     mixins assigned to the parent node.
      * @param session    the session that changed the property.
      * @return an <code>EventState</code> instance.
      */
@@ -253,6 +275,7 @@
                                              Path parentPath,
                                              Path.PathElement childPath,
                                              NodeTypeImpl nodeType,
+                                             Set mixins,
                                              Session session) {
         return new EventState(Event.PROPERTY_CHANGED,
                 parentUUID,
@@ -260,6 +283,7 @@
                 null,
                 childPath,
                 nodeType,
+                mixins,
                 session);
     }
 
@@ -316,6 +340,16 @@
      */
     public NodeTypeImpl getNodeType() {
         return nodeType;
+    }
+
+    /**
+     * Returns a set of <code>QName</code>s which are the names of the mixins
+     * assigned to the parent node associated with this event.
+     *
+     * @return the mixin names as <code>QName</code>s.
+     */
+    public Set getMixinNames() {
+        return mixins;
     }
 
     /**

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventStateCollection.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventStateCollection.java?rev=306651&r1=306650&r2=306651&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventStateCollection.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventStateCollection.java
Thu Oct  6 07:15:36 2005
@@ -40,6 +40,7 @@
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Set;
 
 /**
  * The <code>EventStateCollection</code> class implements how {@link EventState}
@@ -148,6 +149,7 @@
                         }
 
                         NodeTypeImpl oldParentNodeType = getNodeType(oldParent, session);
+                        Set mixins = oldParent.getMixinTypeNames();
                         Path newPath = getPath(n.getId(), hmgr);
                         Path oldPath = getZombiePath(n.getId(), hmgr);
                         if (!oldPath.equals(newPath)) {
@@ -156,15 +158,18 @@
                                     n.getUUID(),
                                     oldPath.getNameElement(),
                                     oldParentNodeType,
+                                    mixins,
                                     session));
 
                             NodeState newParent = (NodeState) changes.get(new NodeId(newParentUUID));
                             NodeTypeImpl newParentNodeType = getNodeType(newParent, session);
+                            mixins = newParent.getMixinTypeNames();
                             events.add(EventState.childNodeAdded(newParentUUID,
                                     getParent(newPath),
                                     n.getUUID(),
                                     newPath.getNameElement(),
                                     newParentNodeType,
+                                    mixins,
                                     session));
                         } else {
                             log.error("Unable to calculate old path of moved node");
@@ -196,6 +201,7 @@
                             }
                             if (moved != null) {
                                 NodeTypeImpl nodeType = getNodeType(parent, session);
+                                Set mixins = parent.getMixinTypeNames();
                                 Path newPath = getPath(state.getId(), hmgr);
                                 Path parentPath = getParent(newPath);
                                 Path oldPath;
@@ -216,12 +222,14 @@
                                         n.getUUID(),
                                         oldPath.getNameElement(),
                                         nodeType,
+                                        mixins,
                                         session));
                                 events.add(EventState.childNodeAdded(parent.getUUID(),
                                         parentPath,
                                         n.getUUID(),
                                         newPath.getNameElement(),
                                         nodeType,
+                                        mixins,
                                         session));
                             }
                         }
@@ -231,6 +239,7 @@
                 // check if child nodes of modified node state have been reordered
                 List reordered = n.getReorderedChildNodeEntries();
                 NodeTypeImpl nodeType = getNodeType(n, session);
+                Set mixins = n.getMixinTypeNames();
                 if (reordered.size() > 0) {
                     // create a node removed and a node added event for every
                     // reorder
@@ -254,6 +263,7 @@
                                 child.getUUID(),
                                 removedElem,
                                 nodeType,
+                                mixins,
                                 session));
 
                         events.add(EventState.childNodeAdded(n.getUUID(),
@@ -261,6 +271,7 @@
                                 child.getUUID(),
                                 addedElem,
                                 nodeType,
+                                mixins,
                                 session));
                     }
                 }
@@ -269,10 +280,12 @@
                 Path path = getPath(state.getId(), hmgr);
                 NodeState parent = (NodeState) provider.getItemState(new NodeId(state.getParentUUID()));
                 NodeTypeImpl nodeType = getNodeType(parent, session);
+                Set mixins = parent.getMixinTypeNames();
                 events.add(EventState.propertyChanged(state.getParentUUID(),
                         getParent(path),
                         path.getNameElement(),
                         nodeType,
+                        mixins,
                         session));
             }
         }
@@ -290,22 +303,26 @@
                     parent = (NodeState) changes.get(parentId);
                 }
                 NodeTypeImpl nodeType = getNodeType(parent, session);
+                Set mixins = parent.getMixinTypeNames();
                 Path path = getPath(n.getId(), hmgr);
                 events.add(EventState.childNodeAdded(n.getParentUUID(),
                         getParent(path),
                         n.getUUID(),
                         path.getNameElement(),
                         nodeType,
+                        mixins,
                         session));
             } else {
                 // property created / set
                 NodeState n = (NodeState) changes.get(new NodeId(state.getParentUUID()));
                 NodeTypeImpl nodeType = getNodeType(n, session);
+                Set mixins = n.getMixinTypeNames();
                 Path path = getPath(state.getId(), hmgr);
                 events.add(EventState.propertyAdded(state.getParentUUID(),
                         getParent(path),
                         path.getNameElement(),
                         nodeType,
+                        mixins,
                         session));
             }
         }
@@ -316,12 +333,14 @@
                 NodeState n = (NodeState) state;
                 NodeState parent = (NodeState) provider.getItemState(new NodeId(n.getParentUUID()));
                 NodeTypeImpl nodeType = getNodeType(parent, session);
+                Set mixins = parent.getMixinTypeNames();
                 Path path = getZombiePath(state.getId(), hmgr);
                 events.add(EventState.childNodeRemoved(n.getParentUUID(),
                         getParent(path),
                         n.getUUID(),
                         path.getNameElement(),
                         nodeType,
+                        mixins,
                         session));
             } else {
                 // property removed
@@ -330,11 +349,13 @@
                     NodeState n = (NodeState) changes.get(new NodeId(state.getParentUUID()));
                     // node state exists -> only property removed
                     NodeTypeImpl nodeType = getNodeType(n, session);
+                    Set mixins = n.getMixinTypeNames();
                     Path path = getZombiePath(state.getId(), hmgr);
                     events.add(EventState.propertyRemoved(state.getParentUUID(),
                             getParent(path),
                             path.getNameElement(),
                             nodeType,
+                            mixins,
                             session));
                 } catch (NoSuchItemStateException e) {
                     // node removed as well -> do not create an event

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java?rev=306651&r1=306650&r2=306651&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java
Thu Oct  6 07:15:36 2005
@@ -605,6 +605,7 @@
                     labelNode.getPrimaryPath(),
                     Path.PathElement.fromString(label.toString()),
                     (NodeTypeImpl) labelNode.getPrimaryNodeType(),
+                    labelNode.getMixinTypeNames(),
                     labelNode.getSession()
             ));
         } else if (v == null) {
@@ -614,6 +615,7 @@
                     labelNode.getPrimaryPath(),
                     Path.PathElement.fromString(label.toString()),
                     (NodeTypeImpl) labelNode.getPrimaryNodeType(),
+                    labelNode.getMixinTypeNames(),
                     labelNode.getSession()
             ));
         } else {
@@ -623,6 +625,7 @@
                     labelNode.getPrimaryPath(),
                     Path.PathElement.fromString(label.toString()),
                     (NodeTypeImpl) labelNode.getPrimaryNodeType(),
+                    labelNode.getMixinTypeNames(),
                     labelNode.getSession()
             ));
         }
@@ -652,6 +655,7 @@
                 node.internalGetUUID(),
                 node.getPrimaryPath().getNameElement(),
                 (NodeTypeImpl) parent.getPrimaryNodeType(),
+                parent.getMixinTypeNames(),
                 node.getSession()
         ));
 
@@ -663,6 +667,7 @@
                     node.getPrimaryPath(),
                     prop.getPrimaryPath().getNameElement(),
                     (NodeTypeImpl) node.getPrimaryNodeType(),
+                    node.getMixinTypeNames(),
                     node.getSession()
             ));
         }
@@ -693,6 +698,7 @@
                 node.internalGetUUID(),
                 node.getPrimaryPath().getNameElement(),
                 (NodeTypeImpl) parent.getPrimaryNodeType(),
+                parent.getMixinTypeNames(),
                 node.getSession()
         ));
         if (recursive) {

Added: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/observation/MixinTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/observation/MixinTest.java?rev=306651&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/observation/MixinTest.java
(added)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/observation/MixinTest.java
Thu Oct  6 07:15:36 2005
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core.observation;
+
+import org.apache.jackrabbit.test.api.observation.AbstractObservationTest;
+import org.apache.jackrabbit.test.api.observation.EventResult;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Node;
+import javax.jcr.observation.Event;
+import javax.jcr.observation.EventListener;
+
+/**
+ * Tests if observation event filtering works based on mixin type names.
+ */
+public class MixinTest extends AbstractObservationTest {
+
+    /**
+     * Tests event filtering with a single mixin type name.
+     */
+    public void testSingleMixin() throws RepositoryException {
+        testRootNode.addNode(nodeName1, testNodeType).addMixin(mixReferenceable);
+        testRootNode.addNode(nodeName2, testNodeType);
+        testRootNode.addNode(nodeName3, testNodeType).addMixin(mixReferenceable);
+        testRootNode.save();
+
+        EventResult propertyAddedListener = new EventResult(log);
+        addEventListener(propertyAddedListener, new String[]{mixReferenceable}, Event.PROPERTY_ADDED);
+
+        testRootNode.getNode(nodeName1).setProperty(propertyName1, "test");
+        testRootNode.getNode(nodeName2).setProperty(propertyName1, "test");
+        testRootNode.getNode(nodeName3).setProperty(propertyName1, "test");
+        testRootNode.save();
+
+        removeEventListener(propertyAddedListener);
+        Event[] added = propertyAddedListener.getEvents(DEFAULT_WAIT_TIMEOUT);
+        checkPropertyAdded(added, new String[]{nodeName1 + "/" + propertyName1,
+                                               nodeName3 + "/" + propertyName1});
+    }
+
+    /**
+     * Tests event filtering with multiple mixin type name.
+     */
+    public void testMultipleMixin() throws RepositoryException {
+        testRootNode.addNode(nodeName1, testNodeType).addMixin(mixReferenceable);
+        testRootNode.addNode(nodeName2, testNodeType).addMixin(mixLockable);
+        testRootNode.addNode(nodeName3, testNodeType).addMixin(mixReferenceable);
+        testRootNode.save();
+
+        EventResult propertyAddedListener = new EventResult(log);
+        addEventListener(propertyAddedListener, new String[]{mixReferenceable, mixLockable},
Event.PROPERTY_ADDED);
+
+        testRootNode.getNode(nodeName1).setProperty(propertyName1, "test");
+        testRootNode.getNode(nodeName2).setProperty(propertyName1, "test");
+        testRootNode.getNode(nodeName3).setProperty(propertyName1, "test");
+        testRootNode.save();
+
+        removeEventListener(propertyAddedListener);
+        Event[] added = propertyAddedListener.getEvents(DEFAULT_WAIT_TIMEOUT);
+        checkPropertyAdded(added, new String[]{nodeName1 + "/" + propertyName1,
+                                               nodeName2 + "/" + propertyName1,
+                                               nodeName3 + "/" + propertyName1});
+    }
+
+    /**
+     * Tests event filtering on nodes with multiple mixins applied.
+     */
+    public void testMultipleMixinOnNode() throws RepositoryException {
+        Node node1 = testRootNode.addNode(nodeName1, testNodeType);
+        node1.addMixin(mixReferenceable);
+        node1.addMixin(mixLockable);
+        Node node2 = testRootNode.addNode(nodeName2, testNodeType);
+        Node node3 = testRootNode.addNode(nodeName3, testNodeType);
+        node3.addMixin(mixLockable);
+        node3.addMixin(mixReferenceable);
+        testRootNode.save();
+
+        EventResult propertyAddedListener = new EventResult(log);
+        addEventListener(propertyAddedListener, new String[]{mixReferenceable}, Event.PROPERTY_ADDED);
+
+        node1.setProperty(propertyName1, "test");
+        node2.setProperty(propertyName1, "test");
+        node3.setProperty(propertyName1, "test");
+        testRootNode.save();
+
+        removeEventListener(propertyAddedListener);
+        Event[] added = propertyAddedListener.getEvents(DEFAULT_WAIT_TIMEOUT);
+        checkPropertyAdded(added, new String[]{nodeName1 + "/" + propertyName1,
+                                               nodeName3 + "/" + propertyName1});
+    }
+
+    /**
+     * Registers an <code>EventListener</code> for events of the specified
+     * type(s).
+     *
+     * @param listener  the <code>EventListener</code>.
+     * @param mixins    the names of mixin types to filter.
+     * @param eventType the event types
+     * @throws RepositoryException if registration fails.
+     */
+    protected void addEventListener(EventListener listener, String[] mixins, int eventType)
+            throws RepositoryException {
+        if (obsMgr != null) {
+            obsMgr.addEventListener(listener,
+                    eventType,
+                    superuser.getRootNode().getPath(),
+                    true,
+                    null,
+                    mixins,
+                    false);
+        } else {
+            throw new IllegalStateException("ObservationManager not available.");
+        }
+    }
+}

Propchange: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/observation/MixinTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/observation/TestAll.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/observation/TestAll.java?rev=306651&r1=306650&r2=306651&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/observation/TestAll.java
(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/observation/TestAll.java
Thu Oct  6 07:15:36 2005
@@ -37,6 +37,7 @@
         TestSuite suite = new TestSuite("Observation tests");
 
         suite.addTestSuite(ReorderTest.class);
+        suite.addTestSuite(MixinTest.class);
 
         return suite;
     }



Mime
View raw message