jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r155823 - in incubator/jackrabbit/trunk/contrib/jcr-rmi/src: java/org/apache/jackrabbit/rmi/client/ java/org/apache/jackrabbit/rmi/server/ test/org/apache/jackrabbit/test/rmi/
Date Tue, 01 Mar 2005 20:57:36 GMT
Author: jukka
Date: Tue Mar  1 12:57:34 2005
New Revision: 155823

URL: http://svn.apache.org/viewcvs?view=rev&rev=155823
Log:
Refactored the JCR-RMI test code and added brief documentation.
Added test cases for Philipp's Query functionality.

Added:
    incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteAdapterTest.java
Removed:
    incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteItemDefTest.java
    incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteItemTest.java
    incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteLockTest.java
    incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteNamespaceRegistryTest.java
    incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteNodeDefTest.java
    incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteNodeTest.java
    incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteNodeTypeManagerTest.java
    incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteNodeTypeTest.java
    incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemotePropertyDefTest.java
    incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemotePropertyTest.java
    incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteRepositoryTest.java
    incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteSessionTest.java
    incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteTestHelper.java
    incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteWorkspaceTest.java
Modified:
    incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientAdapterFactory.java
    incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java
    incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java
    incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java
    incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/TestAll.java

Modified: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientAdapterFactory.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientAdapterFactory.java?view=diff&r1=155822&r2=155823
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientAdapterFactory.java
(original)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientAdapterFactory.java
Tue Mar  1 12:57:34 2005
@@ -24,6 +24,7 @@
 import javax.jcr.Session;
 import javax.jcr.Workspace;
 import javax.jcr.lock.Lock;
+import javax.jcr.nodetype.ItemDef;
 import javax.jcr.nodetype.NodeDef;
 import javax.jcr.nodetype.NodeType;
 import javax.jcr.nodetype.NodeTypeManager;
@@ -34,6 +35,7 @@
 import javax.jcr.query.Row;
 
 import org.apache.jackrabbit.rmi.remote.RemoteItem;
+import org.apache.jackrabbit.rmi.remote.RemoteItemDef;
 import org.apache.jackrabbit.rmi.remote.RemoteLock;
 import org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry;
 import org.apache.jackrabbit.rmi.remote.RemoteNode;
@@ -146,6 +148,15 @@
      */
     public NodeType getNodeType(RemoteNodeType remote) {
         return new ClientNodeType(remote, this);
+    }
+
+    /**
+     * Creates and returns a {@link ClientItemDef ClientItemDef} instance.
+     *
+     * {@inheritDoc}
+     */
+    public ItemDef getItemDef(RemoteItemDef remote) {
+        return new ClientItemDef(remote, this);
     }
 
     /**

Modified: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java?view=diff&r1=155822&r2=155823
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java
(original)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java
Tue Mar  1 12:57:34 2005
@@ -24,6 +24,7 @@
 import javax.jcr.Session;
 import javax.jcr.Workspace;
 import javax.jcr.lock.Lock;
+import javax.jcr.nodetype.ItemDef;
 import javax.jcr.nodetype.NodeDef;
 import javax.jcr.nodetype.NodeType;
 import javax.jcr.nodetype.NodeTypeManager;
@@ -34,6 +35,7 @@
 import javax.jcr.query.Row;
 
 import org.apache.jackrabbit.rmi.remote.RemoteItem;
+import org.apache.jackrabbit.rmi.remote.RemoteItemDef;
 import org.apache.jackrabbit.rmi.remote.RemoteLock;
 import org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry;
 import org.apache.jackrabbit.rmi.remote.RemoteNode;
@@ -155,6 +157,20 @@
      * @return local node type adapter
      */
     NodeType getNodeType(RemoteNodeType remote);
+
+    /**
+     * Factory method for creating a local adapter for a remote item
+     * definition. Note that before calling this method, the client may want to
+     * introspect the remote item definition to determine whether to use the
+     * {@link #getNodeDef(RemoteNodeDef) getNodeDef} or
+     * {@link #getPropertyDef(RemotePropertyDef) getPropertyDef} method
+     * instead, as the adapter returned by this method will only cover
+     * the {@link ItemDef ItemDef} base interface.
+     *
+     * @param remote remote item definition
+     * @return local item definition adapter
+     */
+    ItemDef getItemDef(RemoteItemDef remote);
 
     /**
      * Factory method for creating a local adapter for a remote node

Modified: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java?view=diff&r1=155822&r2=155823
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java
(original)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java
Tue Mar  1 12:57:34 2005
@@ -26,6 +26,7 @@
 import javax.jcr.Session;
 import javax.jcr.Workspace;
 import javax.jcr.lock.Lock;
+import javax.jcr.nodetype.ItemDef;
 import javax.jcr.nodetype.NodeDef;
 import javax.jcr.nodetype.NodeType;
 import javax.jcr.nodetype.NodeTypeManager;
@@ -36,6 +37,7 @@
 import javax.jcr.query.Row;
 
 import org.apache.jackrabbit.rmi.remote.RemoteItem;
+import org.apache.jackrabbit.rmi.remote.RemoteItemDef;
 import org.apache.jackrabbit.rmi.remote.RemoteLock;
 import org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry;
 import org.apache.jackrabbit.rmi.remote.RemoteNode;
@@ -161,6 +163,21 @@
      * @throws RemoteException on RMI errors
      */
     RemoteNodeType getRemoteNodeType(NodeType type) throws RemoteException;
+
+    /**
+     * Returns a remote adapter for the given local item definition.
+     * This method will return an adapter that implements <i>only</i> the
+     * {@link ItemDef ItemDef} interface. The caller may want to introspect
+     * the local item definition to determine whether to use either the
+     * {@link #getRemoteNodeDef(NodeDef) getRemoteNodeDef} or the
+     * {@link #getRemotePropertyDef(PropertyDef) getRemotePropertyDef}
+     * method instead.
+     *
+     * @param def local item definition
+     * @return remote item definition adapter
+     * @throws RemoteException on RMI errors
+     */
+    RemoteItemDef getRemoteItemDef(ItemDef def) throws RemoteException;
 
     /**
      * Returns a remote adapter for the given local node definition.

Modified: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java?view=diff&r1=155822&r2=155823
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java
(original)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java
Tue Mar  1 12:57:34 2005
@@ -26,6 +26,7 @@
 import javax.jcr.Session;
 import javax.jcr.Workspace;
 import javax.jcr.lock.Lock;
+import javax.jcr.nodetype.ItemDef;
 import javax.jcr.nodetype.NodeDef;
 import javax.jcr.nodetype.NodeType;
 import javax.jcr.nodetype.NodeTypeManager;
@@ -36,6 +37,7 @@
 import javax.jcr.query.Row;
 
 import org.apache.jackrabbit.rmi.remote.RemoteItem;
+import org.apache.jackrabbit.rmi.remote.RemoteItemDef;
 import org.apache.jackrabbit.rmi.remote.RemoteLock;
 import org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry;
 import org.apache.jackrabbit.rmi.remote.RemoteNode;
@@ -144,6 +146,15 @@
     public RemoteNodeType getRemoteNodeType(NodeType type)
             throws RemoteException {
         return new ServerNodeType(type, this);
+    }
+
+    /**
+     * Creates a {@link ServerItemDef ServerItemDef} instance.
+     * {@inheritDoc}
+     */
+    public RemoteItemDef getRemoteItemDef(ItemDef def)
+            throws RemoteException {
+        return new ServerItemDef(def, this);
     }
 
     /**

Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteAdapterTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteAdapterTest.java?view=auto&rev=155823
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteAdapterTest.java
(added)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteAdapterTest.java
Tue Mar  1 12:57:34 2005
@@ -0,0 +1,479 @@
+/*
+ * 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.test.rmi;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.jcr.Item;
+import javax.jcr.NamespaceRegistry;
+import javax.jcr.Node;
+import javax.jcr.Property;
+import javax.jcr.Repository;
+import javax.jcr.Session;
+import javax.jcr.Workspace;
+import javax.jcr.lock.Lock;
+import javax.jcr.nodetype.ItemDef;
+import javax.jcr.nodetype.NodeDef;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.NodeTypeManager;
+import javax.jcr.nodetype.PropertyDef;
+import javax.jcr.query.Query;
+import javax.jcr.query.QueryManager;
+import javax.jcr.query.QueryResult;
+import javax.jcr.query.Row;
+
+import junit.framework.TestCase;
+
+import org.apache.jackrabbit.rmi.client.ClientAdapterFactory;
+import org.apache.jackrabbit.rmi.client.LocalAdapterFactory;
+import org.apache.jackrabbit.rmi.remote.RemoteItem;
+import org.apache.jackrabbit.rmi.remote.RemoteItemDef;
+import org.apache.jackrabbit.rmi.remote.RemoteLock;
+import org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry;
+import org.apache.jackrabbit.rmi.remote.RemoteNode;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeDef;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager;
+import org.apache.jackrabbit.rmi.remote.RemoteProperty;
+import org.apache.jackrabbit.rmi.remote.RemotePropertyDef;
+import org.apache.jackrabbit.rmi.remote.RemoteQuery;
+import org.apache.jackrabbit.rmi.remote.RemoteQueryManager;
+import org.apache.jackrabbit.rmi.remote.RemoteQueryResult;
+import org.apache.jackrabbit.rmi.remote.RemoteRepository;
+import org.apache.jackrabbit.rmi.remote.RemoteRow;
+import org.apache.jackrabbit.rmi.remote.RemoteSession;
+import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
+import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory;
+import org.apache.jackrabbit.rmi.server.ServerAdapterFactory;
+import org.easymock.MockControl;
+
+/**
+ * Tests for the adapter classes of JCR-RMI. These tests use reflection
+ * to invoke all methods of an adapter object and to verify that the
+ * corresponding methods of the underlying object get called by the adapter.
+ */
+public class RemoteAdapterTest extends TestCase {
+
+    /** Factory for creating remote test adapters. */
+    private RemoteAdapterFactory remoteFactory;
+
+    /** Factory for creating local test adapters. */
+    private LocalAdapterFactory localFactory;
+
+    /** Map of method names to method descriptions. */
+    private Map methods;
+
+    /** Mock controller. */
+    private MockControl control;
+
+    /** Mock object. */
+    private Object mock;
+
+    /**
+     * Prepares the automated test suite to adapters of the given interface.
+     *
+     * @param iface adapter interface
+     * @throws Exception on errors
+     */
+    private void prepareTests(Class iface) throws Exception {
+        remoteFactory = new ServerAdapterFactory();
+        localFactory = new ClientAdapterFactory();
+
+        methods = new HashMap();
+        Method[] m = iface.getDeclaredMethods();
+        for (int i = 0; i < m.length; i++) {
+            methods.put(m[i].getName(), m[i]);
+        }
+
+        control = MockControl.createControl(iface);
+        mock = control.getMock();
+    }
+
+    /**
+     * Removes the identified method from the automatic tests.
+     *
+     * @param name method name
+     */
+    private void ignoreMethod(String name) {
+        methods.remove(name);
+    }
+
+    /**
+     * Returns a parameter array for the given method.
+     *
+     * @param method method description
+     * @return parameter array
+     */
+    private Object[] getParameters(Method method) {
+        Class[] types = method.getParameterTypes();
+        Object[] parameters = new Object[types.length];
+        for (int i = 0; i < types.length; i++) {
+            if (!types[i].isPrimitive()) {
+                parameters[i] = null;
+            } else if ("int".equals(types[i].getName())) {
+                parameters[i] = new Integer(0);
+            } else if ("boolean".equals(types[i].getName())) {
+                parameters[i] = new Boolean(false);
+            } else {
+                System.out.println(types[i].getName());
+                parameters[i] = null;
+            }
+        }
+        return parameters;
+    }
+
+    /**
+     * Sets the expected return value for the given method.
+     *
+     * @param method method description
+     * @param control mock controller
+     */
+    private void setReturnValue(Method method, MockControl control) {
+        Class type = method.getReturnType();
+        if (!type.isPrimitive()) {
+            control.setReturnValue(null);
+        } else if ("void".equals(type.getName())) {
+            control.setVoidCallable();
+        } else if ("int".equals(type.getName())) {
+            control.setReturnValue((int) 0);
+        } else if ("long".equals(type.getName())) {
+            control.setReturnValue((long) 0);
+        } else if ("boolean".equals(type.getName())) {
+            control.setReturnValue(false);
+        } else {
+            System.out.println(type.getName());
+            control.setReturnValue(null);
+        }
+    }
+
+    /**
+     * Runs the automatic test suite on the given adapter instance.
+     *
+     * @param adapter adapter instance
+     * @throws Exception on errors
+     */
+    private void runTests(Object adapter) throws Exception {
+        Iterator iterator = methods.values().iterator();
+        while (iterator.hasNext()) {
+            Method method = (Method) iterator.next();
+            Object[] parameters = getParameters(method);
+
+            method.invoke(mock, parameters);
+            setReturnValue(method, control);
+            control.replay();
+
+            method.invoke(adapter, parameters);
+            control.verify();
+
+            control.reset();
+        }
+    }
+
+    /**
+     * Tests Repository adapters.
+     *
+     * @throws Exception on errors
+     */
+    public void testRepository() throws Exception {
+        prepareTests(Repository.class);
+
+        Repository repository = (Repository) mock;
+        RemoteRepository remote = remoteFactory.getRemoteRepository(repository);
+        Repository local = localFactory.getRepository(remote);
+
+        runTests(local);
+    }
+
+    /**
+     * Tests Session adapters.
+     *
+     * @throws Exception on errors
+     */
+    public void testSession() throws Exception {
+        prepareTests(Session.class);
+        ignoreMethod("getRepository");           // implemented locally
+        ignoreMethod("importXML");               // wrapped stream
+        ignoreMethod("getImportContentHandler"); // implemented locally
+        ignoreMethod("exportSysView");           // multiple methods
+        ignoreMethod("exportDocView");           // multiple method
+
+        Session session = (Session) mock;
+        RemoteSession remote = remoteFactory.getRemoteSession(session);
+        Session local = localFactory.getSession(null, remote);
+
+        runTests(local);
+    }
+
+    /**
+     * Tests Item adapters.
+     *
+     * @throws Exception on errors
+     */
+    public void testItem() throws Exception {
+        prepareTests(Item.class);
+        ignoreMethod("accept");     // implemented in subclasses
+        ignoreMethod("getSession"); // implemented locally
+        ignoreMethod("isNode");     // implemented in subclasses
+        ignoreMethod("isSame");     // implemented locally
+
+        Item item = (Item) mock;
+        RemoteItem remote = remoteFactory.getRemoteItem(item);
+        Item local = localFactory.getItem(null, remote);
+
+        runTests(local);
+    }
+
+    /**
+     * Tests Node adapters.
+     *
+     * @throws Exception on errors
+     */
+    public void testNode() throws Exception {
+        prepareTests(Node.class);
+        ignoreMethod("cancelMerge");              // TODO
+        ignoreMethod("doneMerge");                // TODO
+        ignoreMethod("checkin");                  // TODO
+        ignoreMethod("restore");                  // multiple methods
+        ignoreMethod("getVersionHistory");        // TODO
+        ignoreMethod("getBaseVersion");           // TODO
+        ignoreMethod("setProperty");              // multiple methods
+
+        Node node = (Node) mock;
+        RemoteNode remote = remoteFactory.getRemoteNode(node);
+        Node local = localFactory.getNode(null, remote);
+
+        runTests(local);
+    }
+
+    /**
+     * Tests Property adapters.
+     *
+     * @throws Exception on errors
+     */
+    public void testProperty() throws Exception {
+        prepareTests(Property.class);
+        ignoreMethod("getBoolean");  // implemented locally
+        ignoreMethod("getLong");     // implemented locally
+        ignoreMethod("getDouble");   // implemented locally
+        ignoreMethod("getDate");     // implemented locally
+        ignoreMethod("getString");   // implemented locally
+        ignoreMethod("getStream");   // implemented locally
+        ignoreMethod("getNode");     // implemented locally
+        ignoreMethod("setValue");    // multiple methods
+
+        Property property = (Property) mock;
+        RemoteProperty remote = remoteFactory.getRemoteProperty(property);
+        Property local = localFactory.getProperty(null, remote);
+
+        runTests(local);
+    }
+
+    /**
+     * Tests Lock adapters.
+     *
+     * @throws Exception on errors
+     */
+    public void testLock() throws Exception {
+        prepareTests(Lock.class);
+        ignoreMethod("getNode"); // implemented locally
+
+        Lock lock = (Lock) mock;
+        RemoteLock remote = remoteFactory.getRemoteLock(lock);
+        Lock local = localFactory.getLock(null, remote);
+
+        runTests(local);
+    }
+
+    /**
+     * Tests Workspace adapters.
+     *
+     * @throws Exception on errors
+     */
+    public void testWorkspace() throws Exception {
+        prepareTests(Workspace.class);
+        ignoreMethod("getObservationManager");   // TODO
+        ignoreMethod("restore");                 // TODO
+        ignoreMethod("getSession");              // implemented locally
+        ignoreMethod("copy");                    // multiple methods
+        ignoreMethod("importXML");               // wrapped stream
+        ignoreMethod("getImportContentHandler"); // implemented locally
+
+        Workspace workspace = (Workspace) mock;
+        RemoteWorkspace remote = remoteFactory.getRemoteWorkspace(workspace);
+        Workspace local = localFactory.getWorkspace(null, remote);
+
+        runTests(local);
+    }
+
+    /**
+     * Tests NamespaceRegistry adapters.
+     *
+     * @throws Exception on errors
+     */
+    public void testNamespaceRegistry() throws Exception {
+        prepareTests(NamespaceRegistry.class);
+
+        NamespaceRegistry registry = (NamespaceRegistry) mock;
+        RemoteNamespaceRegistry remote =
+            remoteFactory.getRemoteNamespaceRegistry(registry);
+        NamespaceRegistry local = localFactory.getNamespaceRegistry(remote);
+
+        runTests(local);
+    }
+
+    /**
+     * Tests NodeTypeManager adapters.
+     *
+     * @throws Exception on errors
+     */
+    public void testNodeTypeManager() throws Exception {
+        prepareTests(NodeTypeManager.class);
+
+        NodeTypeManager manager = (NodeTypeManager) mock;
+        RemoteNodeTypeManager remote =
+            remoteFactory.getRemoteNodeTypeManager(manager);
+        NodeTypeManager local = localFactory.getNodeTypeManager(remote);
+
+        runTests(local);
+    }
+
+    /**
+     * Tests NodeType adapters.
+     *
+     * @throws Exception on errors
+     */
+    public void testNodeType() throws Exception {
+        prepareTests(NodeType.class);
+        ignoreMethod("canSetProperty"); // wrapped Value object
+
+        NodeType type = (NodeType) mock;
+        RemoteNodeType remote = remoteFactory.getRemoteNodeType(type);
+        NodeType local = localFactory.getNodeType(remote);
+
+        runTests(local);
+    }
+
+    /**
+     * Tests ItemDef adapters.
+     *
+     * @throws Exception on errors
+     */
+    public void testItemDef() throws Exception {
+        prepareTests(ItemDef.class);
+
+        ItemDef def = (ItemDef) mock;
+        RemoteItemDef remote = remoteFactory.getRemoteItemDef(def);
+        ItemDef local = localFactory.getItemDef(remote);
+
+        runTests(local);
+    }
+
+    /**
+     * Tests NodeDef adapters.
+     *
+     * @throws Exception on errors
+     */
+    public void testNodeDef() throws Exception {
+        prepareTests(NodeDef.class);
+
+        NodeDef def = (NodeDef) mock;
+        RemoteNodeDef remote = remoteFactory.getRemoteNodeDef(def);
+        NodeDef local = localFactory.getNodeDef(remote);
+
+        runTests(local);
+    }
+
+    /**
+     * Tests PropertyDef adapters.
+     *
+     * @throws Exception on errors
+     */
+    public void testPropertyDef() throws Exception {
+        prepareTests(PropertyDef.class);
+
+        PropertyDef def = (PropertyDef) mock;
+        RemotePropertyDef remote = remoteFactory.getRemotePropertyDef(def);
+        PropertyDef local = localFactory.getPropertyDef(remote);
+
+        runTests(local);
+    }
+
+    /**
+     * Tests QueryManager adapters.
+     *
+     * @throws Exception on errors
+     */
+    public void testQueryManager() throws Exception {
+        prepareTests(QueryManager.class);
+        ignoreMethod("getQuery");   // TODO
+
+        QueryManager manager = (QueryManager) mock;
+        RemoteQueryManager remote = remoteFactory.getRemoteQueryManager(manager);
+        QueryManager local = localFactory.getQueryManager(null, remote);
+
+        runTests(local);
+    }
+
+    /**
+     * Tests Query adapters.
+     *
+     * @throws Exception on errors
+     */
+    public void testQuery() throws Exception {
+        prepareTests(Query.class);
+
+        Query query = (Query) mock;
+        RemoteQuery remote = remoteFactory.getRemoteQuery(query);
+        Query local = localFactory.getQuery(null, remote);
+
+        runTests(local);
+    }
+
+    /**
+     * Tests QueryResult adapters.
+     *
+     * @throws Exception on errors
+     */
+    public void testQueryResult() throws Exception {
+        prepareTests(QueryResult.class);
+
+        QueryResult result = (QueryResult) mock;
+        RemoteQueryResult remote = remoteFactory.getRemoteQueryResult(result);
+        QueryResult local = localFactory.getQueryResult(null, remote);
+
+        runTests(local);
+    }
+
+    /**
+     * Tests Row adapters.
+     *
+     * @throws Exception on errors
+     */
+    public void testRow() throws Exception {
+        prepareTests(Row.class);
+
+        Row row = (Row) mock;
+        RemoteRow remote = remoteFactory.getRemoteRow(row);
+        Row local = localFactory.getRow(remote);
+
+        runTests(local);
+    }
+
+}

Modified: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/TestAll.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/TestAll.java?view=diff&r1=155822&r2=155823
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/TestAll.java
(original)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/TestAll.java
Tue Mar  1 12:57:34 2005
@@ -6,7 +6,7 @@
  * 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
+ *      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,
@@ -24,25 +24,21 @@
  */
 public class TestAll {
 
+    /** This class cannot be instantiated. */
+    private TestAll() {
+    }
+
+    /**
+     * Returns the JCR-RMI test suite.
+     *
+     * @return JCR-RMI test suite
+     */
     public static Test suite() {
         TestSuite suite = new TestSuite("Tests for org.apache.jackrabbit.rmi");
         //$JUnit-BEGIN$
-        suite.addTestSuite(RemoteRepositoryTest.class);
-        suite.addTestSuite(RemoteSessionTest.class);
-        suite.addTestSuite(RemoteWorkspaceTest.class);
-        suite.addTestSuite(RemoteItemTest.class);
-        suite.addTestSuite(RemoteNodeTest.class);
-        suite.addTestSuite(RemotePropertyTest.class);
-        suite.addTestSuite(RemoteNamespaceRegistryTest.class);
-        // .nodetype
-        suite.addTestSuite(RemoteItemDefTest.class);
-        suite.addTestSuite(RemoteNodeDefTest.class);
-        suite.addTestSuite(RemotePropertyDefTest.class);
-        suite.addTestSuite(RemoteNodeTypeTest.class);
-        suite.addTestSuite(RemoteNodeTypeManagerTest.class);
-        // .lock
-        suite.addTestSuite(RemoteLockTest.class);
+        suite.addTestSuite(RemoteAdapterTest.class);
         //$JUnit-END$
         return suite;
     }
+
 }



Mime
View raw message