chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1033421 - in /incubator/chemistry/opencmis/trunk: chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/ chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/...
Date Wed, 10 Nov 2010 11:55:00 GMT
Author: fmui
Date: Wed Nov 10 11:55:00 2010
New Revision: 1033421

URL: http://svn.apache.org/viewvc?rev=1033421&view=rev
Log:
- added local binding where it was missing
- added HTTPS check to TCK

Added:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/SecurityTest.java
  (with props)
Modified:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/CmisBindingHelper.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/enums/BindingType.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/BasicsTestGroup.java

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/CmisBindingHelper.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/CmisBindingHelper.java?rev=1033421&r1=1033420&r2=1033421&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/CmisBindingHelper.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/CmisBindingHelper.java
Wed Nov 10 11:55:00 2010
@@ -49,6 +49,8 @@ public class CmisBindingHelper {
             return createAtomPubBinding(parameters);
         case WEBSERVICES:
             return createWebServiceBinding(parameters);
+        case LOCAL:
+            return createLocalBinding(parameters);
         case CUSTOM:
             return createCustomBinding(parameters);
         default:
@@ -85,4 +87,14 @@ public class CmisBindingHelper {
 
         return binding;
     }
+
+    /**
+     * Creates a local provider.
+     */
+    private static CmisBinding createLocalBinding(Map<String, String> parameters) {
+        CmisBindingFactory factory = CmisBindingFactory.newInstance();
+        CmisBinding binding = factory.createCmisLocalBinding(parameters);
+
+        return binding;
+    }
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/enums/BindingType.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/enums/BindingType.java?rev=1033421&r1=1033420&r2=1033421&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/enums/BindingType.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/enums/BindingType.java
Wed Nov 10 11:55:00 2010
@@ -23,7 +23,7 @@ package org.apache.chemistry.opencmis.co
  */
 public enum BindingType {
 
-    WEBSERVICES("webservices"), ATOMPUB("atompub"), CUSTOM("custom");
+    WEBSERVICES("webservices"), ATOMPUB("atompub"), LOCAL("local"), CUSTOM("custom");
 
     private final String value;
 

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/BasicsTestGroup.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/BasicsTestGroup.java?rev=1033421&r1=1033420&r2=1033421&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/BasicsTestGroup.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/BasicsTestGroup.java
Wed Nov 10 11:55:00 2010
@@ -33,6 +33,7 @@ public class BasicsTestGroup extends Abs
 
         setName("Basics Test Group");
 
+        addTest(new SecurityTest());
         addTest(new RepositoryInfoTest());
         addTest(new RootFolderTest());
         addTest(new TypesTest());

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/SecurityTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/SecurityTest.java?rev=1033421&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/SecurityTest.java
(added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/SecurityTest.java
Wed Nov 10 11:55:00 2010
@@ -0,0 +1,71 @@
+/*
+ * 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.tck.tests.basics;
+
+import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.WARNING;
+
+import java.util.Map;
+
+import org.apache.chemistry.opencmis.client.api.Session;
+import org.apache.chemistry.opencmis.commons.SessionParameter;
+import org.apache.chemistry.opencmis.commons.enums.BindingType;
+import org.apache.chemistry.opencmis.tck.CmisTestResult;
+import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTest;
+
+public class SecurityTest extends AbstractSessionTest {
+    @Override
+    public void init(Map<String, String> parameters) {
+        super.init(parameters);
+        setName("Security Test");
+    }
+
+    @Override
+    public void run(Session session) throws Exception {
+        CmisTestResult f;
+
+        BindingType binding = getBinding();
+
+        addResult(createInfoResult("Binding: " + binding));
+
+        f = createResult(WARNING, "HTTPS is not used. Credentials might be transfered as
plain text!");
+
+        switch (binding) {
+        case ATOMPUB:
+            if (!isHttpsUrl(getParameters().get(SessionParameter.ATOMPUB_URL))) {
+                addResult(f);
+            }
+            break;
+        case WEBSERVICES:
+            if (!isHttpsUrl(getParameters().get(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE)))
{
+                addResult(f);
+            }
+            break;
+        default:
+            // nothing to do
+        }
+    }
+
+    private boolean isHttpsUrl(String url) {
+        if (url == null) {
+            return false;
+        }
+
+        return url.trim().toLowerCase().startsWith("https://");
+    }
+}

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



Mime
View raw message