Author: fmui
Date: Mon Oct  6 19:25:12 2014
New Revision: 1629741

URL: http://svn.apache.org/r1629741
Log:
TCK: extended property definition test

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=1629741&r1=1629740&r2=1629741&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
 Mon Oct  6 19:25:12 2014
@@ -75,7 +75,10 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.data.RepositoryCapabilities;
 import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
 import 
org.apache.chemistry.opencmis.commons.definitions.DocumentTypeDefinition;
+import 
org.apache.chemistry.opencmis.commons.definitions.PropertyDecimalDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
+import 
org.apache.chemistry.opencmis.commons.definitions.PropertyIntegerDefinition;
+import 
org.apache.chemistry.opencmis.commons.definitions.PropertyStringDefinition;
 import 
org.apache.chemistry.opencmis.commons.definitions.RelationshipTypeDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
 import org.apache.chemistry.opencmis.commons.enums.Action;
@@ -3447,6 +3450,45 @@ public abstract class AbstractSessionTes
                             addResult(results, f);
                         }
                     }
+
+                    // data type specific tests
+                    if (propDef instanceof PropertyStringDefinition) {
+                        PropertyStringDefinition stringPropDef = 
(PropertyStringDefinition) propDef;
+
+                        if (stringPropDef.getMaxLength() != null) {
+                            if (stringPropDef.getMaxLength().signum() == 0) {
+                                f = createResult(WARNING, "Max length is 0!");
+                                addResult(results, f);
+                            } else if (stringPropDef.getMaxLength().signum() 
== -1) {
+                                f = createResult(FAILURE, "Max length is 
negative!");
+                                addResult(results, f);
+                            }
+                        }
+                    } else if (propDef instanceof PropertyIntegerDefinition) {
+                        PropertyIntegerDefinition intPropDef = 
(PropertyIntegerDefinition) propDef;
+
+                        if (intPropDef.getMinValue() != null & 
intPropDef.getMaxValue() != null) {
+                            if 
(intPropDef.getMinValue().compareTo(intPropDef.getMaxValue()) == 0) {
+                                f = createResult(WARNING, "Min and max values 
are equal!");
+                                addResult(results, f);
+                            } else if 
(intPropDef.getMinValue().compareTo(intPropDef.getMaxValue()) == 1) {
+                                f = createResult(FAILURE, "Min value is 
greater than max value!");
+                                addResult(results, f);
+                            }
+                        }
+                    } else if (propDef instanceof PropertyDecimalDefinition) {
+                        PropertyDecimalDefinition decPropDef = 
(PropertyDecimalDefinition) propDef;
+
+                        if (decPropDef.getMinValue() != null & 
decPropDef.getMaxValue() != null) {
+                            if 
(decPropDef.getMinValue().compareTo(decPropDef.getMaxValue()) == 0) {
+                                f = createResult(WARNING, "Min and max values 
are equal!");
+                                addResult(results, f);
+                            } else if 
(decPropDef.getMinValue().compareTo(decPropDef.getMaxValue()) == 1) {
+                                f = createResult(FAILURE, "Min value is 
greater than max value!");
+                                addResult(results, f);
+                            }
+                        }
+                    }
                 }
             }
 


Reply via email to