chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1475980 - in /chemistry/opencmis/trunk: chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/ chemistry-opencmis-client/chemistry-opencmis-client-impl/src/...
Date Thu, 25 Apr 2013 21:46:14 GMT
Author: fmui
Date: Thu Apr 25 21:46:13 2013
New Revision: 1475980

URL: http://svn.apache.org/r1475980
Log:
several optimizations 

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractPortProvider.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractTransientCmisObject.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/DocumentImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/WSConverter.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/AllowableActionsImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/AbstractXMLConverterTest.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/ObjectConvertTest.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareRepository.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractPortProvider.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractPortProvider.java?rev=1475980&r1=1475979&r2=1475980&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractPortProvider.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractPortProvider.java
Thu Apr 25 21:46:13 2013
@@ -24,9 +24,12 @@ import java.math.BigInteger;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Collections;
+import java.util.EnumMap;
 import java.util.HashMap;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.locks.ReentrantLock;
 
 import javax.xml.namespace.QName;
 import javax.xml.parsers.DocumentBuilder;
@@ -82,6 +85,8 @@ public abstract class AbstractPortProvid
 
     private static final Logger LOG = LoggerFactory.getLogger(AbstractPortProvider.class);
 
+    private static final int PORT_CACHE_SIZE = 5;
+
     protected static final int CHUNK_SIZE = (64 * 1024) - 1;
 
     protected enum CmisWebSerivcesService {
@@ -198,6 +203,10 @@ public abstract class AbstractPortProvid
     protected boolean useClientCompression;
     protected String acceptLanguage;
 
+    private ReentrantLock portObjectLock = new ReentrantLock();
+    private EnumMap<CmisWebSerivcesService, LinkedList<BindingProvider>> portObjectCache
= new EnumMap<CmisWebSerivcesService, LinkedList<BindingProvider>>(
+            CmisWebSerivcesService.class);
+
     public BindingSession getSession() {
         return session;
     }
@@ -318,6 +327,46 @@ public abstract class AbstractPortProvid
                 Integer statusCode = (Integer) bp.getResponseContext().get(MessageContext.HTTP_RESPONSE_CODE);
                 authProvider.putResponseHeaders(url, statusCode == null ? -1 : statusCode,
headers);
             }
+
+            CmisWebSerivcesService service = null;
+
+            if (portObject instanceof RepositoryServicePort) {
+                service = CmisWebSerivcesService.REPOSITORY_SERVICE;
+            } else if (portObject instanceof NavigationServicePort) {
+                service = CmisWebSerivcesService.NAVIGATION_SERVICE;
+            } else if (portObject instanceof ObjectServicePort) {
+                service = CmisWebSerivcesService.OBJECT_SERVICE;
+            } else if (portObject instanceof VersioningServicePort) {
+                service = CmisWebSerivcesService.VERSIONING_SERVICE;
+            } else if (portObject instanceof DiscoveryServicePort) {
+                service = CmisWebSerivcesService.DISCOVERY_SERVICE;
+            } else if (portObject instanceof MultiFilingServicePort) {
+                service = CmisWebSerivcesService.MULTIFILING_SERVICE;
+            } else if (portObject instanceof RelationshipServicePort) {
+                service = CmisWebSerivcesService.RELATIONSHIP_SERVICE;
+            } else if (portObject instanceof PolicyServicePort) {
+                service = CmisWebSerivcesService.POLICY_SERVICE;
+            } else if (portObject instanceof ACLServicePort) {
+                service = CmisWebSerivcesService.ACL_SERVICE;
+            }
+
+            if (service == null) {
+                return;
+            }
+
+            portObjectLock.lock();
+            try {
+                LinkedList<BindingProvider> queue = portObjectCache.get(service);
+                if (queue == null) {
+                    throw new CmisRuntimeException("This is a bug!");
+                }
+
+                if (queue.size() < PORT_CACHE_SIZE) {
+                    queue.push(bp);
+                }
+            } finally {
+                portObjectLock.unlock();
+            }
         }
     }
 
@@ -562,6 +611,21 @@ public abstract class AbstractPortProvid
      */
     protected BindingProvider createPortObjectFromServiceHolder(CmisServiceHolder serviceHolder,
             WebServiceFeature... features) {
+        portObjectLock.lock();
+        try {
+            LinkedList<BindingProvider> queue = portObjectCache.get(serviceHolder.getService());
+            if (queue == null) {
+                queue = new LinkedList<BindingProvider>();
+                portObjectCache.put(serviceHolder.getService(), queue);
+            }
+
+            if (!queue.isEmpty()) {
+                return queue.pop();
+            }
+        } finally {
+            portObjectLock.unlock();
+        }
+
         return (BindingProvider) serviceHolder.getServiceObject().getPort(serviceHolder.getService().getPortClass(),
                 features);
     }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java?rev=1475980&r1=1475979&r2=1475980&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
Thu Apr 25 21:46:13 2013
@@ -21,9 +21,9 @@ package org.apache.chemistry.opencmis.cl
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.EnumSet;
 import java.util.GregorianCalendar;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -330,7 +330,7 @@ public abstract class AbstractCmisObject
             String changeToken = getChangeToken();
             Holder<String> changeTokenHolder = new Holder<String>(changeToken);
 
-            Set<Updatability> updatebility = new HashSet<Updatability>();
+            Set<Updatability> updatebility = EnumSet.noneOf(Updatability.class);
             updatebility.add(Updatability.READWRITE);
 
             // check if checked out

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractTransientCmisObject.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractTransientCmisObject.java?rev=1475980&r1=1475979&r2=1475980&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractTransientCmisObject.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractTransientCmisObject.java
Thu Apr 25 21:46:13 2013
@@ -23,6 +23,7 @@ import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.EnumSet;
 import java.util.GregorianCalendar;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -467,7 +468,7 @@ public abstract class AbstractTransientC
     }
 
     protected Properties prepareProperties() {
-        Set<Updatability> updatebility = new HashSet<Updatability>();
+        Set<Updatability> updatebility = EnumSet.noneOf(Updatability.class);
         updatebility.add(Updatability.READWRITE);
 
         // check if checked out

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/DocumentImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/DocumentImpl.java?rev=1475980&r1=1475979&r2=1475980&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/DocumentImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/DocumentImpl.java
Thu Apr 25 21:46:13 2013
@@ -21,8 +21,8 @@ package org.apache.chemistry.opencmis.cl
 import java.io.IOException;
 import java.math.BigInteger;
 import java.util.ArrayList;
+import java.util.EnumSet;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -266,7 +266,7 @@ public class DocumentImpl extends Abstra
 
             ObjectFactory of = getObjectFactory();
 
-            Set<Updatability> updatebility = new HashSet<Updatability>();
+            Set<Updatability> updatebility = EnumSet.noneOf(Updatability.class);
             updatebility.add(Updatability.READWRITE);
             updatebility.add(Updatability.WHENCHECKEDOUT);
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java?rev=1475980&r1=1475979&r2=1475980&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java
Thu Apr 25 21:46:13 2013
@@ -21,8 +21,8 @@ package org.apache.chemistry.opencmis.cl
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.EnumSet;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -94,8 +94,8 @@ public class SessionImpl implements Sess
     private static final OperationContext DEFAULT_CONTEXT = new OperationContextImpl(null,
false, true, false,
             IncludeRelationships.NONE, null, true, null, true, 100);
 
-    private static final Set<Updatability> CREATE_UPDATABILITY = new HashSet<Updatability>();
-    private static final Set<Updatability> CREATE_AND_CHECKOUT_UPDATABILITY = new HashSet<Updatability>();
+    private static final Set<Updatability> CREATE_UPDATABILITY = EnumSet.noneOf(Updatability.class);
+    private static final Set<Updatability> CREATE_AND_CHECKOUT_UPDATABILITY = EnumSet.noneOf(Updatability.class);
 
     static {
         CREATE_UPDATABILITY.add(Updatability.ONCREATE);
@@ -1007,7 +1007,7 @@ public class SessionImpl implements Sess
             }
         }
 
-        Set<Updatability> updatebility = new HashSet<Updatability>();
+        Set<Updatability> updatebility = EnumSet.noneOf(Updatability.class);
         updatebility.add(Updatability.READWRITE);
 
         return getBinding().getObjectService().bulkUpdateProperties(getRepositoryId(), objectIdsAndChangeTokens,

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java?rev=1475980&r1=1475979&r2=1475980&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java
Thu Apr 25 21:46:13 2013
@@ -25,9 +25,9 @@ import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.EnumSet;
 import java.util.GregorianCalendar;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -501,7 +501,7 @@ public final class JSONConverter {
             List<Object> canCreateJson = getList(creatablePropertyTypesJson
                     .get(JSON_CAP_CREATABLE_PROPERTY_TYPES_CANCREATE));
             if (canCreateJson != null) {
-                Set<PropertyType> canCreate = new HashSet<PropertyType>();
+                Set<PropertyType> canCreate = EnumSet.noneOf(PropertyType.class);
 
                 for (Object o : canCreateJson) {
                     try {
@@ -1924,7 +1924,7 @@ public final class JSONConverter {
         }
 
         AllowableActionsImpl result = new AllowableActionsImpl();
-        Set<Action> allowableActions = new HashSet<Action>();
+        Set<Action> allowableActions = EnumSet.noneOf(Action.class);
 
         for (Action action : Action.values()) {
             Boolean value = getBoolean(json, action.value());

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/WSConverter.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/WSConverter.java?rev=1475980&r1=1475979&r2=1475980&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/WSConverter.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/WSConverter.java
Thu Apr 25 21:46:13 2013
@@ -31,7 +31,6 @@ import java.util.ArrayList;
 import java.util.EnumSet;
 import java.util.GregorianCalendar;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -405,7 +404,7 @@ public final class WSConverter {
             result.setCreatablePropertyTypes(target);
 
             if (creatablePropertyTypes.getCanCreate().size() > 0) {
-                Set<PropertyType> propertyTypeSet = new HashSet<PropertyType>();
+                Set<PropertyType> propertyTypeSet = EnumSet.noneOf(PropertyType.class);
                 target.setCanCreate(propertyTypeSet);
                 for (EnumPropertyType propType : creatablePropertyTypes.getCanCreate()) {
                     PropertyType propertyType = convert(PropertyType.class, propType);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java?rev=1475980&r1=1475979&r2=1475980&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java
Thu Apr 25 21:46:13 2013
@@ -23,9 +23,9 @@ import static org.apache.chemistry.openc
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.ArrayList;
+import java.util.EnumSet;
 import java.util.GregorianCalendar;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
@@ -1337,7 +1337,7 @@ public class XMLConverter {
                 if (isTag(name, TAG_CAP_CREATABLE_PROPERTY_TYPES_CANCREATE)) {
                     Set<PropertyType> ptSet = target.canCreate();
                     if (ptSet == null) {
-                        ptSet = new HashSet<PropertyType>();
+                        ptSet = EnumSet.noneOf(PropertyType.class);
                         target.setCanCreate(ptSet);
                     }
 
@@ -2309,7 +2309,7 @@ public class XMLConverter {
 
                     Set<Action> actions = target.getAllowableActions();
                     if (actions == null) {
-                        actions = new HashSet<Action>();
+                        actions = EnumSet.noneOf(Action.class);
                         target.setAllowableActions(actions);
                     }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/AllowableActionsImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/AllowableActionsImpl.java?rev=1475980&r1=1475979&r2=1475980&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/AllowableActionsImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/AllowableActionsImpl.java
Thu Apr 25 21:46:13 2013
@@ -18,7 +18,7 @@
  */
 package org.apache.chemistry.opencmis.commons.impl.dataobjects;
 
-import java.util.HashSet;
+import java.util.EnumSet;
 import java.util.Set;
 
 import org.apache.chemistry.opencmis.commons.data.AllowableActions;
@@ -31,7 +31,7 @@ public class AllowableActionsImpl extend
 
     private static final long serialVersionUID = 1L;
 
-    private Set<Action> allowableActions = new HashSet<Action>();
+    private Set<Action> allowableActions = EnumSet.noneOf(Action.class);
 
     public Set<Action> getAllowableActions() {
         return allowableActions;

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/AbstractXMLConverterTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/AbstractXMLConverterTest.java?rev=1475980&r1=1475979&r2=1475980&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/AbstractXMLConverterTest.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/AbstractXMLConverterTest.java
Thu Apr 25 21:46:13 2013
@@ -525,6 +525,17 @@ public abstract class AbstractXMLConvert
             }
 
             return;
+        } else if (expected instanceof Set<?>) {
+            Set<?> expectedSet = (Set<?>) expected;
+            Set<?> actualSet = (Set<?>) actual;
+
+            assertEquals(name + ".length", expectedSet.size(), actualSet.size());
+
+            for (Object item : expectedSet) {
+                assertTrue(name + ".contains[" + item + "]", actualSet.contains(item));
+            }
+
+            return;
         }
 
         for (Method m : expected.getClass().getMethods()) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/ObjectConvertTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/ObjectConvertTest.java?rev=1475980&r1=1475979&r2=1475980&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/ObjectConvertTest.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/ObjectConvertTest.java
Thu Apr 25 21:46:13 2013
@@ -24,6 +24,7 @@ import java.io.ByteArrayOutputStream;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
@@ -55,14 +56,15 @@ public class ObjectConvertTest extends A
     public void testObjectData() throws Exception {
         // run the test a few times with different values
         for (int i = 0; i < 10; i++) {
-            ObjectDataImpl data = createObjectData(true);
+            ObjectDataImpl data10 = createObjectData(true, CmisVersion.CMIS_1_0);
+            assertObjectData10(data10, true);
 
-            assertObjectData10(data, true);
-            assertObjectData11(data, true);
+            ObjectDataImpl data11 = createObjectData(true, CmisVersion.CMIS_1_1);
+            assertObjectData11(data11, true);
         }
     }
 
-    protected ObjectDataImpl createObjectData(boolean addRelationships) {
+    protected ObjectDataImpl createObjectData(boolean addRelationships, CmisVersion cmisVersion)
{
         ObjectDataImpl result = new ObjectDataImpl();
 
         // properties
@@ -99,8 +101,11 @@ public class ObjectConvertTest extends A
 
         // allowable actions
         AllowableActionsImpl allowableActions = new AllowableActionsImpl();
-        HashSet<Action> actions = new HashSet<Action>();
+        Set<Action> actions = new HashSet<Action>();
         for (Action action : Action.values()) {
+            if (action == Action.CAN_CREATE_ITEM && cmisVersion == CmisVersion.CMIS_1_0)
{
+                continue;
+            }
             actions.add(action);
         }
         allowableActions.setAllowableActions(actions);
@@ -110,7 +115,7 @@ public class ObjectConvertTest extends A
         if (addRelationships) {
             List<ObjectData> relationships = new ArrayList<ObjectData>();
             for (int i = 0; i < randomInt(4) + 1; i++) {
-                relationships.add(createObjectData(false));
+                relationships.add(createObjectData(false, cmisVersion));
             }
             result.setRelationships(relationships);
         }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareRepository.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareRepository.java?rev=1475980&r1=1475979&r2=1475980&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareRepository.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareRepository.java
Thu Apr 25 21:46:13 2013
@@ -31,6 +31,7 @@ import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.EnumSet;
 import java.util.GregorianCalendar;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -1870,7 +1871,7 @@ public class FileShareRepository {
         boolean isFolder = file.isDirectory();
         boolean isRoot = root.equals(file);
 
-        Set<Action> aas = new HashSet<Action>();
+        Set<Action> aas = EnumSet.noneOf(Action.class);
 
         addAction(aas, Action.CAN_GET_OBJECT_PARENTS, !isRoot);
         addAction(aas, Action.CAN_GET_PROPERTIES, true);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java?rev=1475980&r1=1475979&r2=1475980&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java
Thu Apr 25 21:46:13 2013
@@ -160,6 +160,8 @@ public abstract class AbstractSessionTes
             }
         } catch (Error err) {
             addResult(createResult(UNEXPECTED_EXCEPTION, "Error: " + err, err, true));
+        } finally {
+            testFolder = null;
         }
     }
 



Mime
View raw message