chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sklev...@apache.org
Subject svn commit: r960876 - in /incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime: ./ atom/ webservices/
Date Tue, 06 Jul 2010 11:29:21 GMT
Author: sklevenz
Date: Tue Jul  6 11:29:21 2010
New Revision: 960876

URL: http://svn.apache.org/viewvc?rev=960876&view=rev
Log:
Acl unit test class introduced. 
 - inactive for InMemory repository which does not support ACL yet.

Added:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractWriteAclT.java
  (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/atom/WriteAclAtomPubIT.java
  (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/webservices/WriteAclWebServicesIT.java
  (with props)
Modified:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractReadOnlyTypeIT.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractSessionTest.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/Fixture.java

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractReadOnlyTypeIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractReadOnlyTypeIT.java?rev=960876&r1=960875&r2=960876&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractReadOnlyTypeIT.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractReadOnlyTypeIT.java
Tue Jul  6 11:29:21 2010
@@ -117,7 +117,7 @@ public abstract class AbstractReadOnlyTy
 
         for (ObjectType ot1 : pc) {
             ObjectType ot2 = this.session.getTypeDefinition(ot1.getId());
-            Assert.assertEquals(ot1, ot2);
+            Assert.assertEquals(ot1.getId(), ot2.getId());
         }
     }
 
@@ -132,7 +132,7 @@ public abstract class AbstractReadOnlyTy
         ItemIterable<ObjectType> pcc = pc.skipTo(0).getPage(2);
         for (ObjectType ot1 : pcc) {
             ObjectType ot2 = this.session.getTypeDefinition(ot1.getId());
-            Assert.assertEquals(ot1, ot2);
+            Assert.assertEquals(ot1.getId(), ot2.getId());
         }
     }
 

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractSessionTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractSessionTest.java?rev=960876&r1=960875&r2=960876&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractSessionTest.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractSessionTest.java
Tue Jul  6 11:29:21 2010
@@ -81,11 +81,16 @@ public abstract class AbstractSessionTes
     }
 
     /**
-     * test session
+     * default test session
      */
     protected Session session = null;
 
     /**
+     * 2nd test session
+     */
+    protected Session session2 = null;
+
+    /**
      * Test Fixture
      */
     protected Fixture fixture = null;
@@ -101,6 +106,8 @@ public abstract class AbstractSessionTes
         SessionFactory factory = this.fixture.getSessionFactory();
         this.session = factory.createSession(this.fixture.getParamter());
         this.fixture.setUpTestData(this.session);
+
+        this.session2 = factory.createSession(this.fixture.getParamter());
     }
 
     @After

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractWriteAclT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractWriteAclT.java?rev=960876&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractWriteAclT.java
(added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractWriteAclT.java
Tue Jul  6 11:29:21 2010
@@ -0,0 +1,102 @@
+/*
+ * 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.  The ASF licenses this file
+ * to you 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.chemistry.opencmis.fit.runtime;
+
+import static org.junit.Assert.assertNotNull;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.chemistry.opencmis.client.api.Document;
+import org.apache.chemistry.opencmis.client.api.ObjectId;
+import org.apache.chemistry.opencmis.client.api.OperationContext;
+import org.apache.chemistry.opencmis.client.api.Property;
+import org.apache.chemistry.opencmis.commons.PropertyIds;
+import org.apache.chemistry.opencmis.commons.data.Ace;
+import org.apache.chemistry.opencmis.commons.data.Acl;
+import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
+import org.apache.chemistry.opencmis.commons.enums.VersioningState;
+import org.junit.Test;
+
+public abstract class AbstractWriteAclT extends AbstractSessionTest {
+
+    /**
+     * Bug Scenario:
+     * 
+     * - create file - apply ACL - read file by 2nd session - read properties <-
+     * side effect with caching? - read ACL -> didn't work
+     */
+    @Test
+    public void createFileApplyAclAndGetAclFromNewSession() {
+        this.session.getDefaultContext().setIncludeAcls(true);
+        this.session2.getDefaultContext().setIncludeAcls(true);      
+        
+        ObjectId parentId = this.session.createObjectId(this.fixture.getTestRootId());
+        String folderName = UUID.randomUUID().toString();
+        String typeId = FixtureData.DOCUMENT_TYPE_ID.value();
+
+        // properties
+        Map<String, Object> properties = new HashMap<String, Object>();
+        properties.put(PropertyIds.NAME, folderName);
+        properties.put(PropertyIds.OBJECT_TYPE_ID, typeId);
+
+        // permissions
+        List<Ace> aces = new ArrayList<Ace>();
+        ArrayList<String> permissions = new ArrayList<String>();
+        permissions.add("cmis:read");
+        aces.add(this.session.getObjectFactory().createAce("everyone", permissions));
+
+        // create document
+        ObjectId id = this.session.createDocument(properties, parentId, null, VersioningState.NONE,
null, null, null);
+        assertNotNull(id);
+
+        // get document for id
+        Document doc = (Document) this.session.getObject(id);
+        assertNotNull(doc);
+
+        // apply acl (not supported by InMemory?)
+        Acl acl = doc.applyAcl(aces, null, AclPropagation.PROPAGATE);
+        assertNotNull(acl);
+
+        // read & check acls
+         Acl acl2 = doc.getAcl();
+         assertNotNull(acl2);
+
+        /*
+         * Session 2
+         */
+
+        // get document for id
+        Document doc2 = (Document) this.session2.getObject(id);
+        assertNotNull(doc2);
+
+        // read properties (required to reproduce the bug)
+        List<Property<?>> pl2 = doc2.getProperties();
+        assertNotNull(pl2);
+
+        // read & check acls
+        Acl acl3 = doc2.getAcl();
+        assertNotNull(acl3);
+
+    }
+
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractWriteAclT.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/Fixture.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/Fixture.java?rev=960876&r1=960875&r2=960876&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/Fixture.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/Fixture.java
Tue Jul  6 11:29:21 2010
@@ -190,4 +190,8 @@ public class Fixture {
         return this.testData.getTestRootId();
     }
 
+    public void setConnectionPath(String path) {
+        this.connectionPath = path;
+    }
+
 }

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/atom/WriteAclAtomPubIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/atom/WriteAclAtomPubIT.java?rev=960876&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/atom/WriteAclAtomPubIT.java
(added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/atom/WriteAclAtomPubIT.java
Tue Jul  6 11:29:21 2010
@@ -0,0 +1,33 @@
+/*
+ * 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.  The ASF licenses this file
+ * to you 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.chemistry.opencmis.fit.runtime.atom;
+
+import org.apache.chemistry.opencmis.fit.runtime.AbstractWriteAclT;
+import org.apache.chemistry.opencmis.fit.runtime.Fixture;
+import org.junit.Ignore;
+
+@Ignore
+public class WriteAclAtomPubIT extends AbstractWriteAclT {
+
+    @Override
+    public void initFixture(Fixture fixture) {
+        this.fixture.enableAtomPub();
+    }
+
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/atom/WriteAclAtomPubIT.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/webservices/WriteAclWebServicesIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/webservices/WriteAclWebServicesIT.java?rev=960876&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/webservices/WriteAclWebServicesIT.java
(added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/webservices/WriteAclWebServicesIT.java
Tue Jul  6 11:29:21 2010
@@ -0,0 +1,33 @@
+/*
+ * 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.  The ASF licenses this file
+ * to you 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.chemistry.opencmis.fit.runtime.webservices;
+
+import org.apache.chemistry.opencmis.fit.runtime.AbstractWriteAclT;
+import org.apache.chemistry.opencmis.fit.runtime.Fixture;
+import org.junit.Ignore;
+
+@Ignore
+public class WriteAclWebServicesIT extends AbstractWriteAclT {
+
+    @Override
+    public void initFixture(Fixture fixture) {
+        this.fixture.enableWebServices();
+    }
+
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/webservices/WriteAclWebServicesIT.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message