You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fg...@apache.org on 2009/06/16 15:39:23 UTC

svn commit: r785214 - in /incubator/chemistry/trunk/chemistry: chemistry-api/src/main/java/org/apache/chemistry/ chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/ chemistry-atompub-server/src/main/java/org/apache/chemistry/ato...

Author: fguillaume
Date: Tue Jun 16 13:39:22 2009
New Revision: 785214

URL: http://svn.apache.org/viewvc?rev=785214&view=rev
Log:
Improved test framework, can now test the same code directly in mem or with AtomPub client+server plugged together

Added:
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISChildrenCollection.java   (with props)
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java   (contents, props changed)
      - copied, changed from r784710, incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISCollectionForChildren.java
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISParentsCollection.java   (with props)
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISTypesCollection.java   (contents, props changed)
      - copied, changed from r784710, incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISCollectionForTypes.java
    incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicHelper.java   (contents, props changed)
      - copied, changed from r783849, incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/RepositoryCreationHelper.java
    incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java   (with props)
    incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/java/org/apache/chemistry/test/TestSimpleDirect.java   (with props)
Removed:
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISCollectionForChildren.java
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISCollectionForTypes.java
    incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/RepositoryCreationHelper.java
Modified:
    incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Repository.java
    incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPObject.java
    incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPObjectEntry.java
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISProvider.java
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISWorkspaceManager.java
    incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java
    incubator/chemistry/trunk/chemistry/chemistry-tests/pom.xml
    incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/MainServlet.java
    incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/java/org/apache/chemistry/test/TestAtomPubClientServer.java

Modified: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Repository.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Repository.java?rev=785214&r1=785213&r2=785214&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Repository.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Repository.java Tue Jun 16 13:39:22 2009
@@ -16,8 +16,10 @@
  */
 package org.apache.chemistry;
 
+import java.io.Serializable;
 import java.util.Collection;
 import java.util.List;
+import java.util.Map;
 
 /**
  * A CMIS Repository.
@@ -25,6 +27,13 @@
 public interface Repository extends RepositoryEntry {
 
     /**
+     * Gets a new connection to this repository.
+     *
+     * @return the connection
+     */
+    Connection getConnection(Map<String, Serializable> parameters);
+
+    /**
      * Gets a new connection using the SPI for this repository.
      * <p>
      * The SPI is a connection providing access to lower-level features.

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPObject.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPObject.java?rev=785214&r1=785213&r2=785214&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPObject.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPObject.java Tue Jun 16 13:39:22 2009
@@ -28,11 +28,11 @@
 import org.apache.chemistry.Folder;
 import org.apache.chemistry.Policy;
 import org.apache.chemistry.Property;
+import org.apache.chemistry.PropertyDefinition;
 import org.apache.chemistry.Relationship;
 import org.apache.chemistry.RelationshipDirection;
 import org.apache.chemistry.Type;
 import org.apache.chemistry.atompub.CMIS;
-import org.apache.chemistry.atompub.client.connector.Connector;
 import org.apache.chemistry.atompub.client.connector.Request;
 import org.apache.chemistry.atompub.client.connector.Response;
 import org.apache.chemistry.atompub.client.stax.ReadContext;
@@ -102,8 +102,11 @@
             return null;
         }
         APPObjectEntry e = (APPObjectEntry) entry.connection.getConnector().getObject(
-                new ReadContext(entry.getConnection()), href);
-        Type t = entry.getConnection().getRepository().getType(e.getTypeId());
+                new ReadContext(entry.connection), href);
+        if (e == null) {
+            return null; // no parent
+        }
+        Type t = entry.connection.getRepository().getType(e.getTypeId());
         APPFolder f = new APPFolder(e, t);
         return f;
     }
@@ -151,13 +154,23 @@
     }
 
     public Property getProperty(String name) {
-        // TODO Auto-generated method stub
-        throw new UnsupportedOperationException();
+        PropertyDefinition propertyDefinition = getType().getPropertyDefinition(
+                name);
+        if (propertyDefinition == null) {
+            throw new IllegalArgumentException(name);
+        }
+        // TODO deal with unfetched properties
+        return entry.getProperty(name);
     }
 
     public Serializable getValue(String name) {
-        // TODO Auto-generated method stub
-        throw new UnsupportedOperationException();
+        PropertyDefinition propertyDefinition = getType().getPropertyDefinition(
+                name);
+        if (propertyDefinition == null) {
+            throw new IllegalArgumentException(name);
+        }
+        // TODO deal with unfetched properties
+        return entry.getValue(name);
     }
 
     public void save() {

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPObjectEntry.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPObjectEntry.java?rev=785214&r1=785213&r2=785214&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPObjectEntry.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPObjectEntry.java Tue Jun 16 13:39:22 2009
@@ -108,6 +108,11 @@
         return p == null ? null : p.getValue();
     }
 
+    // not in API
+    public XmlProperty getProperty(String name) {
+        return properties.get(name);
+    }
+
     public Map<String, Serializable> getValues() {
         Map<String, Serializable> map = new HashMap<String, Serializable>();
         for (Entry<String, XmlProperty> e : properties.entrySet()) {

Added: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISChildrenCollection.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISChildrenCollection.java?rev=785214&view=auto
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISChildrenCollection.java (added)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISChildrenCollection.java Tue Jun 16 13:39:22 2009
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ *
+ * Authors:
+ *     Florent Guillaume, Nuxeo
+ */
+package org.apache.chemistry.atompub.server;
+
+import java.util.List;
+
+import org.apache.abdera.protocol.server.RequestContext;
+import org.apache.abdera.protocol.server.context.ResponseContextException;
+import org.apache.chemistry.ObjectEntry;
+import org.apache.chemistry.ObjectId;
+import org.apache.chemistry.Repository;
+import org.apache.chemistry.SPI;
+
+/**
+* CMIS Collection for the children of an object.
+ */
+public class CMISChildrenCollection extends CMISObjectsCollection {
+
+    public CMISChildrenCollection(String type, String id, Repository repository) {
+        super(type, "children", id, repository);
+    }
+
+    @Override
+    public Iterable<ObjectEntry> getEntries(RequestContext request)
+            throws ResponseContextException {
+        SPI spi = repository.getSPI(); // TODO XXX connection leak
+        boolean[] hasMoreItems = new boolean[1];
+        ObjectId objectId = spi.newObjectId(id);
+        List<ObjectEntry> children = spi.getChildren(objectId, null, null,
+                false, false, 0, 0, null, hasMoreItems);
+        return children;
+    }
+
+}

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISChildrenCollection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISChildrenCollection.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISChildrenCollection.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java (from r784710, incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISCollectionForChildren.java)
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java?p2=incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java&p1=incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISCollectionForChildren.java&r1=784710&r2=785214&rev=785214&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISCollectionForChildren.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java Tue Jun 16 13:39:22 2009
@@ -39,7 +39,6 @@
 import org.apache.abdera.protocol.server.context.ResponseContextException;
 import org.apache.chemistry.BaseType;
 import org.apache.chemistry.ObjectEntry;
-import org.apache.chemistry.ObjectId;
 import org.apache.chemistry.Property;
 import org.apache.chemistry.Repository;
 import org.apache.chemistry.ReturnVersion;
@@ -49,13 +48,13 @@
 import org.apache.chemistry.atompub.abdera.ObjectElement;
 
 /**
- * CMIS Collection for the children of a Folder.
+ * CMIS Collection for object entries.
  */
-public class CMISCollectionForChildren extends CMISCollection<ObjectEntry> {
+public abstract class CMISObjectsCollection extends CMISCollection<ObjectEntry> {
 
-    public CMISCollectionForChildren(String type, String id,
+    public CMISObjectsCollection(String type, String name, String id,
             Repository repository) {
-        super(type, "children", id, repository);
+        super(type, name, id, repository);
     }
 
     /*
@@ -162,16 +161,7 @@
         return bool ? "true" : "false";
     }
 
-    @Override
-    public Iterable<ObjectEntry> getEntries(RequestContext request)
-            throws ResponseContextException {
-        SPI spi = repository.getSPI(); // TODO XXX connection leak
-        boolean[] hasMoreItems = new boolean[1];
-        ObjectId objectId = spi.newObjectId(id);
-        List<ObjectEntry> children = spi.getChildren(objectId, null, null,
-                false, false, 0, 0, null, hasMoreItems);
-        return children;
-    }
+    // getEntries is abstract, must be implemented
 
     @Override
     public ObjectEntry postEntry(String title, IRI id, String summary,

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISParentsCollection.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISParentsCollection.java?rev=785214&view=auto
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISParentsCollection.java (added)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISParentsCollection.java Tue Jun 16 13:39:22 2009
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ *
+ * Authors:
+ *     Florent Guillaume, Nuxeo
+ */
+package org.apache.chemistry.atompub.server;
+
+import java.util.Collection;
+
+import org.apache.abdera.protocol.server.RequestContext;
+import org.apache.abdera.protocol.server.context.ResponseContextException;
+import org.apache.chemistry.ObjectEntry;
+import org.apache.chemistry.ObjectId;
+import org.apache.chemistry.Repository;
+import org.apache.chemistry.SPI;
+
+public class CMISParentsCollection extends CMISObjectsCollection {
+
+    public CMISParentsCollection(String type, String id, Repository repository) {
+        super(type, "parents", id, repository);
+    }
+
+    @Override
+    public Iterable<ObjectEntry> getEntries(RequestContext request)
+            throws ResponseContextException {
+        SPI spi = repository.getSPI(); // TODO XXX connection leak
+        ObjectId objectId = spi.newObjectId(id);
+        Collection<ObjectEntry> parents = spi.getObjectParents(objectId, null, false, false);
+        return parents;
+    }
+
+}

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISParentsCollection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISParentsCollection.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISParentsCollection.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISProvider.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISProvider.java?rev=785214&r1=785213&r2=785214&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISProvider.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISProvider.java Tue Jun 16 13:39:22 2009
@@ -106,7 +106,7 @@
         SimpleWorkspaceInfo workspaceInfo = new SimpleWorkspaceInfo();
         workspaceInfo.setTitle(repository.getInfo().getName());
 
-        workspaceInfo.addCollection(new CMISCollectionForChildren(
+        workspaceInfo.addCollection(new CMISChildrenCollection(
                 CMIS.COL_ROOT_CHILDREN,
                 repository.getInfo().getRootFolderId().getId(), repository));
 
@@ -121,10 +121,10 @@
                 CMIS.COL_CHECKED_OUT, "checkedout", null, repository));
 
         CollectionInfo ci;
-        ci = new CMISCollectionForTypes(CMIS.COL_TYPES_CHILDREN, repository);
+        ci = new CMISTypesCollection(CMIS.COL_TYPES_CHILDREN, repository);
         workspaceInfo.addCollection(ci);
 
-        ci = new CMISCollectionForTypes(CMIS.COL_TYPES_DESCENDANTS, repository);
+        ci = new CMISTypesCollection(CMIS.COL_TYPES_DESCENDANTS, repository);
         workspaceInfo.addCollection(ci);
 
         workspaceInfo.addCollection(new CMISCollectionForOther(CMIS.COL_QUERY,

Copied: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISTypesCollection.java (from r784710, incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISCollectionForTypes.java)
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISTypesCollection.java?p2=incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISTypesCollection.java&p1=incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISCollectionForTypes.java&r1=784710&r2=785214&rev=785214&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISCollectionForTypes.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISTypesCollection.java Tue Jun 16 13:39:22 2009
@@ -39,9 +39,9 @@
 /**
  * CMIS Collection for the Types.
  */
-public class CMISCollectionForTypes extends CMISCollection<Type> {
+public class CMISTypesCollection extends CMISCollection<Type> {
 
-    public CMISCollectionForTypes(String type, Repository repository) {
+    public CMISTypesCollection(String type, Repository repository) {
         super(type, "types", null, repository);
     }
 

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISTypesCollection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISTypesCollection.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISWorkspaceManager.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISWorkspaceManager.java?rev=785214&r1=785213&r2=785214&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISWorkspaceManager.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISWorkspaceManager.java Tue Jun 16 13:39:22 2009
@@ -38,17 +38,22 @@
         String path = request.getTargetPath();
         String paths = path + '/';
         if (paths.startsWith("/types/") || paths.startsWith("/types?")) {
-            return new CMISCollectionForTypes(null, repository);
+            return new CMISTypesCollection(null, repository);
         }
         if (paths.startsWith("/children/")) {
             String id = request.getTarget().getParameter("objectid");
-            return new CMISCollectionForChildren(null, id, repository);
+            return new CMISChildrenCollection(null, id, repository);
+        }
+        if (paths.startsWith("/parents/")) {
+            String id = request.getTarget().getParameter("objectid");
+            return new CMISParentsCollection(null, id, repository);
         }
         if (paths.startsWith("/object/")) {
-            return new CMISCollectionForChildren(null, null, repository);
+            // TODO has a different feed type than children
+            return new CMISChildrenCollection(null, null, repository);
         }
         if (paths.startsWith("/file/")) {
-            return new CMISCollectionForChildren(null, null, repository);
+            return new CMISChildrenCollection(null, null, repository);
         }
         if (paths.startsWith("/unfiled/")) {
             return new CMISCollectionForOther(null, "unfiled", null, repository);

Modified: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java?rev=785214&r1=785213&r2=785214&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java Tue Jun 16 13:39:22 2009
@@ -249,7 +249,6 @@
         List<ObjectEntry> all = new ArrayList<ObjectEntry>(total);
         for (String id : ids) {
             SimpleData data = repository.datas.get(id);
-            // could build a full Object, but some implementations won't
             all.add(new SimpleObjectEntry(data, this));
         }
 
@@ -283,8 +282,15 @@
     public Collection<ObjectEntry> getObjectParents(ObjectId object,
             String filter, boolean includeAllowableActions,
             boolean includeRelationships) {
-        // TODO Auto-generated method stub
-        throw new UnsupportedOperationException();
+        // TODO includeAllowableActions and includeRelationships
+        // TODO filter
+        Set<String> ids = repository.parents.get(object.getId());
+        List<ObjectEntry> parents = new ArrayList<ObjectEntry>(ids.size());
+        for (String id : ids) {
+            SimpleData data = repository.datas.get(id);
+            parents.add(new SimpleObjectEntry(data, this));
+        }
+        return parents;
     }
 
     public Collection<ObjectEntry> getCheckedoutDocuments(ObjectId folder,

Modified: incubator/chemistry/trunk/chemistry/chemistry-tests/pom.xml
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tests/pom.xml?rev=785214&r1=785213&r2=785214&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tests/pom.xml (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tests/pom.xml Tue Jun 16 13:39:22 2009
@@ -79,7 +79,7 @@
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
-      <scope>test</scope>
+      <scope>compile</scope> <!-- override -->
     </dependency>
   </dependencies>
 

Copied: incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicHelper.java (from r783849, incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/RepositoryCreationHelper.java)
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicHelper.java?p2=incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicHelper.java&p1=incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/RepositoryCreationHelper.java&r1=783849&r2=785214&rev=785214&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/RepositoryCreationHelper.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicHelper.java Tue Jun 16 13:39:22 2009
@@ -1,4 +1,4 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -37,12 +37,12 @@
 import org.apache.chemistry.impl.simple.SimpleType;
 
 /**
- * Helpers to create a basic repository.
+ * Helpers to create a basic repository for use in tests.
  */
-public class RepositoryCreationHelper {
+public class BasicHelper {
 
     // Utility class
-    private RepositoryCreationHelper() {
+    private BasicHelper() {
     }
 
     public static final String TEST_FILE_CONTENT = "This is a test file.\nTesting, testing...\n";

Propchange: incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicHelper.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java?rev=785214&view=auto
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java (added)
+++ incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java Tue Jun 16 13:39:22 2009
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ *
+ * Authors:
+ *     Florent Guillaume, Nuxeo
+ */
+package org.apache.chemistry.test;
+
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.apache.chemistry.CMISObject;
+import org.apache.chemistry.Connection;
+import org.apache.chemistry.Folder;
+import org.apache.chemistry.Property;
+import org.apache.chemistry.Repository;
+import org.apache.chemistry.Type;
+
+/**
+ * Basic test on a repository created with {@link BasicHelper#makeRepository}.
+ */
+public abstract class BasicTestCase extends TestCase {
+
+    public static final String ROOT_TYPE_ID = "Root"; // not in the spec
+
+    public Repository repository;
+
+    public void testBasic() {
+        assertNotNull(repository);
+        Connection conn = repository.getConnection(null);
+        assertNotNull(conn);
+
+        Folder root = conn.getRootFolder();
+        assertNotNull(root);
+        Type rootType = root.getType();
+        assertNotNull(rootType);
+        assertEquals(ROOT_TYPE_ID, rootType.getId());
+        assertEquals(ROOT_TYPE_ID, root.getTypeId());
+        assertEquals("CMIS_Root_Folder", root.getName()); // from the spec
+        assertEquals(null, root.getParent());
+        Map<String, Property> props = root.getProperties();
+        assertNotNull(props);
+        assertTrue(props.size() > 0);
+
+        List<CMISObject> entries = root.getChildren(null);
+        assertEquals(1, entries.size());
+    }
+
+}

Propchange: incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/MainServlet.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/MainServlet.java?rev=785214&r1=785213&r2=785214&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/MainServlet.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/MainServlet.java Tue Jun 16 13:39:22 2009
@@ -50,7 +50,7 @@
     public static final String CMIS_SERVICE = "/repository";
 
     public static void main(String[] args) throws Exception {
-        Repository repository = RepositoryCreationHelper.makeRepository(ROOT_ID);
+        Repository repository = BasicHelper.makeRepository(ROOT_ID);
         Server server = new Server();
         Connector connector = new SocketConnector();
         connector.setHost(HOST);

Modified: incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/java/org/apache/chemistry/test/TestAtomPubClientServer.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/java/org/apache/chemistry/test/TestAtomPubClientServer.java?rev=785214&r1=785213&r2=785214&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/java/org/apache/chemistry/test/TestAtomPubClientServer.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/java/org/apache/chemistry/test/TestAtomPubClientServer.java Tue Jun 16 13:39:22 2009
@@ -16,17 +16,9 @@
  */
 package org.apache.chemistry.test;
 
-import java.util.List;
-
 import javax.servlet.Servlet;
 
-import junit.framework.TestCase;
-
-import org.apache.chemistry.CMISObject;
-import org.apache.chemistry.Connection;
-import org.apache.chemistry.Folder;
 import org.apache.chemistry.Repository;
-import org.apache.chemistry.atompub.client.APPRepository;
 import org.apache.chemistry.atompub.client.ContentManager;
 import org.apache.chemistry.atompub.client.connector.APPContentManager;
 import org.apache.chemistry.atompub.server.CMISServlet;
@@ -41,7 +33,7 @@
 /**
  * Tests the AtomPub client with the AtomPub server.
  */
-public class TestAtomPubClientServer extends TestCase {
+public class TestAtomPubClientServer extends BasicTestCase {
 
     private static final Log log = LogFactory.getLog(MainServlet.class);
 
@@ -55,10 +47,8 @@
 
     public Server server;
 
-    public String serverUrl;
-
-    public void startServer() throws Exception {
-        Repository repository = RepositoryCreationHelper.makeRepository(null);
+    public String startServer() throws Exception {
+        Repository repository = BasicHelper.makeRepository(null);
         server = new Server();
         Connector connector = new SocketConnector();
         connector.setHost(HOST);
@@ -69,8 +59,10 @@
         Context context = new Context(server, SERVLET_PATH, Context.SESSIONS);
         context.addServlet(servletHolder, "/*");
         server.start();
-        serverUrl = "http://" + HOST + ':' + PORT + SERVLET_PATH + CMIS_SERVICE;
+        String serverUrl = "http://" + HOST + ':' + PORT + SERVLET_PATH
+                + CMIS_SERVICE;
         log.info("CMIS server started, AtomPub service url: " + serverUrl);
+        return serverUrl;
     }
 
     public void stopServer() throws Exception {
@@ -81,7 +73,9 @@
 
     @Override
     public void setUp() throws Exception {
-        startServer();
+        String serverUrl = startServer();
+        ContentManager cm = new APPContentManager(serverUrl);
+        repository = cm.getDefaultRepository();
     }
 
     @Override
@@ -89,15 +83,4 @@
         stopServer();
     }
 
-    public void testBasic() {
-        ContentManager cm = new APPContentManager(serverUrl);
-
-        Repository repo = cm.getDefaultRepository();
-        Connection conn = ((APPRepository) repo).getConnection(null);
-
-        Folder root = conn.getRootFolder();
-        List<CMISObject> entries = root.getChildren(null);
-        assertEquals(1, entries.size());
-    }
-
 }

Added: incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/java/org/apache/chemistry/test/TestSimpleDirect.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/java/org/apache/chemistry/test/TestSimpleDirect.java?rev=785214&view=auto
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/java/org/apache/chemistry/test/TestSimpleDirect.java (added)
+++ incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/java/org/apache/chemistry/test/TestSimpleDirect.java Tue Jun 16 13:39:22 2009
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ *
+ * Authors:
+ *     Florent Guillaume, Nuxeo
+ */
+package org.apache.chemistry.test;
+
+/**
+ * Tests the simple implementation directly (no client/server).
+ */
+public class TestSimpleDirect extends BasicTestCase {
+
+    @Override
+    public void setUp() throws Exception {
+        repository = BasicHelper.makeRepository(null);
+    }
+
+}

Propchange: incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/java/org/apache/chemistry/test/TestSimpleDirect.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/java/org/apache/chemistry/test/TestSimpleDirect.java
------------------------------------------------------------------------------
    svn:keywords = Id