chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1492139 - /chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java
Date Wed, 12 Jun 2013 10:49:39 GMT
Author: fmui
Date: Wed Jun 12 10:49:38 2013
New Revision: 1492139

URL: http://svn.apache.org/r1492139
Log:
TCK: added query name check

Modified:
    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-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=1492139&r1=1492138&r2=1492139&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
Wed Jun 12 10:49:38 2013
@@ -2010,6 +2010,45 @@ public abstract class AbstractSessionTes
 
     // --- type checks ---
 
+    protected CmisTestResult checkQueryName(String queryName, boolean isRequired, String
message) {
+        List<CmisTestResult> results = new ArrayList<CmisTestResult>();
+
+        CmisTestResult f;
+
+        if (queryName == null || queryName.length() == 0) {
+            addResult(results, createResult(isRequired ? FAILURE : WARNING, "Query name is
not set!"));
+        } else {
+            f = createResult(FAILURE, "Query name contains invalid character: ' '");
+            addResult(results, assertIsTrue(queryName.indexOf(' ') < 0, null, f));
+
+            f = createResult(FAILURE, "Query name contains invalid character: ','");
+            addResult(results, assertIsTrue(queryName.indexOf(',') < 0, null, f));
+
+            f = createResult(FAILURE, "Query name contains invalid character: '\"'");
+            addResult(results, assertIsTrue(queryName.indexOf('"') < 0, null, f));
+
+            f = createResult(FAILURE, "Query name contains invalid character: '''");
+            addResult(results, assertIsTrue(queryName.indexOf('\'') < 0, null, f));
+
+            f = createResult(FAILURE, "Query name contains invalid character: '\\'");
+            addResult(results, assertIsTrue(queryName.indexOf('\\') < 0, null, f));
+
+            f = createResult(FAILURE, "Query name contains invalid character: '.'");
+            addResult(results, assertIsTrue(queryName.indexOf('.') < 0, null, f));
+
+            f = createResult(FAILURE, "Query name contains invalid character: '('");
+            addResult(results, assertIsTrue(queryName.indexOf('(') < 0, null, f));
+
+            f = createResult(FAILURE, "Query name contains invalid character: ')'");
+            addResult(results, assertIsTrue(queryName.indexOf(')') < 0, null, f));
+        }
+
+        CmisTestResultImpl result = createResult(getWorst(results), message);
+        result.getChildren().addAll(results);
+
+        return (result.getStatus().getLevel() <= OK.getLevel() ? null : result);
+    }
+
     protected CmisTestResult checkTypeDefinition(Session session, TypeDefinition type, String
message) {
         List<CmisTestResult> results = new ArrayList<CmisTestResult>();
 
@@ -2031,8 +2070,9 @@ public abstract class AbstractSessionTes
             // f = createResult(FAILURE, "Local namespace is not set!");
             // addResult(results, assertStringNotEmpty(type.(), null, f));
 
-            f = createResult(FAILURE, "Query name is not set!");
-            addResult(results, assertStringNotEmpty(type.getQueryName(), null, f));
+            boolean isQueryNameRequired = Boolean.TRUE.equals(type.isQueryable());
+            addResult(results,
+                    checkQueryName(type.getQueryName(), isQueryNameRequired, "Type Query
Name: " + type.getQueryName()));
 
             if ((type.getId() != null) && (type.getBaseTypeId() != null)) {
                 if (type.getBaseTypeId().value().equals(type.getId())) {
@@ -3259,6 +3299,10 @@ public abstract class AbstractSessionTes
                         addResult(results, f);
                     }
 
+                    boolean isPropertyQueryNameRequired = Boolean.TRUE.equals(queryable);
+                    checkQueryName(propDef.getQueryName(), isPropertyQueryNameRequired, "Property
Query Name: "
+                            + propDef.getQueryName());
+
                     if ((orderable != null) && !orderable.equals(propDef.isOrderable()))
{
                         f = createResult(FAILURE,
                                 "Orderable: expected: " + orderable + " / actual: " + propDef.isOrderable());



Mime
View raw message