You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by je...@apache.org on 2013/08/23 10:53:50 UTC
svn commit: r1516753 [6/8] - in
/chemistry/opencmis/trunk/chemistry-opencmis-server:
chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/
chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis...
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/TypeValidationTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/TypeValidationTest.java?rev=1516753&r1=1516752&r2=1516753&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/TypeValidationTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/TypeValidationTest.java Fri Aug 23 08:53:49 2013
@@ -76,8 +76,7 @@ public class TypeValidationTest extends
private static final String STRING_PROP_TYPE_SUPER = "StringPropSuper";
private static final String STRING_PROP_TYPE_SUB = "StringPropSub";
private static final BindingsObjectFactory FACTORY = new BindingsObjectFactoryImpl();
- static TypeDefinitionFactory typeFactory = DocumentTypeCreationHelper.getTypeDefinitionFactory();
-
+ static TypeDefinitionFactory typeFactory = DocumentTypeCreationHelper.getTypeDefinitionFactory();
private static List<PropertyData<?>> createPropertiesWithNameAndTypeId(String typeId) {
List<PropertyData<?>> properties = new ArrayList<PropertyData<?>>();
@@ -432,10 +431,11 @@ public class TypeValidationTest extends
TypeDefinition primaryType = buildTypeWithStringProp();
TypeDefinition secondaryType1 = buildTypeWithIntegerProp();
TypeDefinition secondaryType2 = buildTypeWithDecimalProp();
-
+
String unknownPropertyId = "UnknownProperty";
- List<PropertyData<?>> properties = createPropertiesWithSecondaryTypes(MY_DOC_TYPE, Arrays.asList(INT_DOC_TYPE, DECIMAL_DOC_TYPE));
-
+ List<PropertyData<?>> properties = createPropertiesWithSecondaryTypes(MY_DOC_TYPE,
+ Arrays.asList(INT_DOC_TYPE, DECIMAL_DOC_TYPE));
+
// add unknown property
properties.add(FACTORY.createPropertyStringData(unknownPropertyId, "SomeValue"));
Properties props = FACTORY.createPropertiesData(properties);
@@ -450,18 +450,18 @@ public class TypeValidationTest extends
}
}
- private static List<PropertyData<?>> createPropertiesWithSecondaryTypes(String typeIdPrimary, List<String> secondaryTypeIds) {
+ private static List<PropertyData<?>> createPropertiesWithSecondaryTypes(String typeIdPrimary,
+ List<String> secondaryTypeIds) {
List<PropertyData<?>> properties = new ArrayList<PropertyData<?>>();
properties.add(FACTORY.createPropertyIdData(PropertyIds.NAME, "Document_1"));
properties.add(FACTORY.createPropertyIdData(PropertyIds.OBJECT_TYPE_ID, typeIdPrimary));
properties.add(FACTORY.createPropertyIdData(PropertyIds.OBJECT_TYPE_ID, secondaryTypeIds));
properties.add(FACTORY.createPropertyBooleanData("BooleanProp", true));
properties.add(FACTORY.createPropertyIntegerData(INT_PROP_TYPE, BigInteger.valueOf(0)));
- properties.add(FACTORY.createPropertyDecimalData(DECIMAL_PROP_TYPE, BigDecimal.valueOf(0.5)));
+ properties.add(FACTORY.createPropertyDecimalData(DECIMAL_PROP_TYPE, BigDecimal.valueOf(0.5)));
return properties;
}
-
/**
* create sample type
*
@@ -471,11 +471,12 @@ public class TypeValidationTest extends
// always add CMIS default types
try {
- MutableDocumentTypeDefinition cmisType;
- cmisType = (MutableDocumentTypeDefinition) typeFactory.createChildTypeDefinition(DocumentTypeCreationHelper.getCmisDocumentType(), MY_DOC_TYPE);
+ MutableDocumentTypeDefinition cmisType;
+ cmisType = (MutableDocumentTypeDefinition) typeFactory.createChildTypeDefinition(
+ DocumentTypeCreationHelper.getCmisDocumentType(), MY_DOC_TYPE);
cmisType.setDisplayName("Document Type for Validation");
cmisType.setDescription("InMemory test type definition " + MY_DOC_TYPE);
-
+
// create a boolean property definition
PropertyDefinition<Boolean> prop = PropertyCreationHelper.createBooleanDefinition("BooleanProp",
@@ -499,8 +500,8 @@ public class TypeValidationTest extends
"Sample Decimal Property", Updatability.READONLY);
cmisType.addPropertyDefinition(prop3);
- prop3 = PropertyCreationHelper.createDecimalDefinition("DecimalPropMV", "Sample Decimal multi-value Property",
- Updatability.READONLY);
+ prop3 = PropertyCreationHelper.createDecimalDefinition("DecimalPropMV",
+ "Sample Decimal multi-value Property", Updatability.READONLY);
cmisType.addPropertyDefinition(prop3);
PropertyHtmlDefinitionImpl prop4 = PropertyCreationHelper.createHtmlDefinition("HtmlProp",
@@ -531,8 +532,8 @@ public class TypeValidationTest extends
"Sample String Property", Updatability.READONLY);
cmisType.addPropertyDefinition(prop7);
- PropertyUriDefinitionImpl prop8 = PropertyCreationHelper.createUriDefinition("UriProp", "Sample Uri Property",
- Updatability.READONLY);
+ PropertyUriDefinitionImpl prop8 = PropertyCreationHelper.createUriDefinition("UriProp",
+ "Sample Uri Property", Updatability.READONLY);
cmisType.addPropertyDefinition(prop8);
prop8 = PropertyCreationHelper.createUriDefinition("UriPropMV", "Sample Uri multi-value Property",
@@ -557,8 +558,9 @@ public class TypeValidationTest extends
private static DocumentTypeDefinition buildTypeWithStringProp() {
try {
- MutableDocumentTypeDefinition cmisType;
- cmisType = (MutableDocumentTypeDefinition) typeFactory.createChildTypeDefinition(DocumentTypeCreationHelper.getCmisDocumentType(), STRING_DOC_TYPE);
+ MutableDocumentTypeDefinition cmisType;
+ cmisType = (MutableDocumentTypeDefinition) typeFactory.createChildTypeDefinition(
+ DocumentTypeCreationHelper.getCmisDocumentType(), STRING_DOC_TYPE);
cmisType.setDisplayName("String Document Type for Validation");
cmisType.setDescription("InMemory test type definition " + STRING_DOC_TYPE);
@@ -576,8 +578,9 @@ public class TypeValidationTest extends
private static DocumentTypeDefinition buildTypeWithIntegerProp() {
try {
- MutableDocumentTypeDefinition cmisType;
- cmisType = (MutableDocumentTypeDefinition) typeFactory.createChildTypeDefinition(DocumentTypeCreationHelper.getCmisDocumentType(), INT_DOC_TYPE);
+ MutableDocumentTypeDefinition cmisType;
+ cmisType = (MutableDocumentTypeDefinition) typeFactory.createChildTypeDefinition(
+ DocumentTypeCreationHelper.getCmisDocumentType(), INT_DOC_TYPE);
cmisType.setDisplayName("Int Document Type for Validation");
cmisType.setDescription("InMemory test type definition " + INT_DOC_TYPE);
@@ -597,8 +600,9 @@ public class TypeValidationTest extends
private static DocumentTypeDefinition buildTypeWithDecimalProp() {
try {
- MutableDocumentTypeDefinition cmisType;
- cmisType = (MutableDocumentTypeDefinition) typeFactory.createChildTypeDefinition(DocumentTypeCreationHelper.getCmisDocumentType(), DECIMAL_DOC_TYPE);
+ MutableDocumentTypeDefinition cmisType;
+ cmisType = (MutableDocumentTypeDefinition) typeFactory.createChildTypeDefinition(
+ DocumentTypeCreationHelper.getCmisDocumentType(), DECIMAL_DOC_TYPE);
cmisType.setDisplayName("Decimal Type for Validation");
cmisType.setDescription("InMemory test type definition " + DECIMAL_DOC_TYPE);
@@ -618,8 +622,9 @@ public class TypeValidationTest extends
public static DocumentTypeDefinition buildTypeWithPickList(Cardinality cardinality) {
try {
- MutableDocumentTypeDefinition cmisType;
- cmisType = (MutableDocumentTypeDefinition) typeFactory.createChildTypeDefinition(DocumentTypeCreationHelper.getCmisDocumentType(), PICK_LIST_DOC_TYPE);
+ MutableDocumentTypeDefinition cmisType;
+ cmisType = (MutableDocumentTypeDefinition) typeFactory.createChildTypeDefinition(
+ DocumentTypeCreationHelper.getCmisDocumentType(), PICK_LIST_DOC_TYPE);
cmisType.setDisplayName("PickList Type for Validation");
cmisType.setDescription("InMemory test type definition " + PICK_LIST_DOC_TYPE);
@@ -656,8 +661,9 @@ public class TypeValidationTest extends
public static DocumentTypeDefinition buildTypeWithMultiPickList() {
try {
- MutableDocumentTypeDefinition cmisType;
- cmisType = (MutableDocumentTypeDefinition) typeFactory.createChildTypeDefinition(DocumentTypeCreationHelper.getCmisDocumentType(), PICK_LIST_DOC_TYPE);
+ MutableDocumentTypeDefinition cmisType;
+ cmisType = (MutableDocumentTypeDefinition) typeFactory.createChildTypeDefinition(
+ DocumentTypeCreationHelper.getCmisDocumentType(), PICK_LIST_DOC_TYPE);
cmisType.setDisplayName("MDocument Type for Validation");
cmisType.setDescription("PickList test type definition " + PICK_LIST_DOC_TYPE);
@@ -697,14 +703,16 @@ public class TypeValidationTest extends
public static DocumentTypeDefinition buildTypeWithHierachicalPickList(Cardinality cardinality) {
try {
- MutableDocumentTypeDefinition cmisType;
- cmisType = (MutableDocumentTypeDefinition) typeFactory.createChildTypeDefinition(DocumentTypeCreationHelper.getCmisDocumentType(), PICK_LIST_DOC_TYPE);
+ MutableDocumentTypeDefinition cmisType;
+ cmisType = (MutableDocumentTypeDefinition) typeFactory.createChildTypeDefinition(
+ DocumentTypeCreationHelper.getCmisDocumentType(), PICK_LIST_DOC_TYPE);
cmisType.setDisplayName("PickList Type for Validation");
cmisType.setDescription("InMemory test type definition " + PICK_LIST_DOC_TYPE);
// create a String property definition
- // Create a two-level pick list with an outer property list state and an
+ // Create a two-level pick list with an outer property list state
+ // and an
// inner
// list of city
PropertyStringDefinitionImpl propDef = PropertyCreationHelper.createStringDefinition(PICK_LIST_PROP_DEF,
@@ -764,28 +772,30 @@ public class TypeValidationTest extends
tm.initTypeSystem(null, true); // create CMIS default types
// create super type
- MutableDocumentTypeDefinition cmisSuperType;
- cmisSuperType = (MutableDocumentTypeDefinition) typeFactory.createChildTypeDefinition(DocumentTypeCreationHelper.getCmisDocumentType(), DOC_TYPE_SUPER);
+ MutableDocumentTypeDefinition cmisSuperType;
+ cmisSuperType = (MutableDocumentTypeDefinition) typeFactory.createChildTypeDefinition(
+ DocumentTypeCreationHelper.getCmisDocumentType(), DOC_TYPE_SUPER);
cmisSuperType.setDisplayName("Document Type With a child");
cmisSuperType.setDescription("InMemory test type definition " + DOC_TYPE_SUPER);
// create a String property definition
- PropertyStringDefinitionImpl propDef = PropertyCreationHelper.createStringDefinition(STRING_PROP_TYPE_SUPER,
- "Sample String Property SuperType", Updatability.READONLY);
+ PropertyStringDefinitionImpl propDef = PropertyCreationHelper.createStringDefinition(
+ STRING_PROP_TYPE_SUPER, "Sample String Property SuperType", Updatability.READONLY);
propDef.setMaxLength(BigInteger.valueOf(10));
cmisSuperType.addPropertyDefinition(propDef);
tm.addTypeDefinition(cmisSuperType, false);
// create sub type
- MutableDocumentTypeDefinition cmisSubType;
- cmisSubType = (MutableDocumentTypeDefinition) typeFactory.createChildTypeDefinition(cmisSuperType, DOC_TYPE_SUB);
+ MutableDocumentTypeDefinition cmisSubType;
+ cmisSubType = (MutableDocumentTypeDefinition) typeFactory.createChildTypeDefinition(cmisSuperType,
+ DOC_TYPE_SUB);
cmisSubType.setDisplayName("Document Type With a parent");
cmisSubType.setDescription("InMemory test type definition " + DOC_TYPE_SUB);
// create a String property definition
- propDef = PropertyCreationHelper.createStringDefinition(STRING_PROP_TYPE_SUB, "Sample String Property Subtype",
- Updatability.READONLY);
+ propDef = PropertyCreationHelper.createStringDefinition(STRING_PROP_TYPE_SUB,
+ "Sample String Property Subtype", Updatability.READONLY);
propDef.setMaxLength(BigInteger.valueOf(20));
cmisSubType.addPropertyDefinition(propDef);
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/UnitTestTypeSystemCreator.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/UnitTestTypeSystemCreator.java?rev=1516753&r1=1516752&r2=1516753&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/UnitTestTypeSystemCreator.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/UnitTestTypeSystemCreator.java Fri Aug 23 08:53:49 2013
@@ -61,7 +61,7 @@ public class UnitTestTypeSystemCreator i
public static final String FOLDER_TYPE = "FolderType";
public static final String SECONDARY_TYPE = "MySecondaryType";
public static final String SECONDARY_TYPE_2 = "MySecondaryType2";
-
+
public static final String PROP_ID_BOOLEAN = "BooleanProp";
public static final String PROP_ID_DATETIME = "DateTimeProp";
public static final String PROP_ID_DECIMAL = "DecimalProp";
@@ -86,7 +86,7 @@ public class UnitTestTypeSystemCreator i
* the required types for testing
*/
@Override
- public List<TypeDefinition> createTypesList() {
+ public List<TypeDefinition> createTypesList() {
return singletonTypes;
}
@@ -109,107 +109,111 @@ public class UnitTestTypeSystemCreator i
* @return typesMap map filled with created types
*/
private static List<TypeDefinition> buildTypesList() {
- TypeDefinitionFactory typeFactory = DocumentTypeCreationHelper.getTypeDefinitionFactory();
+ TypeDefinitionFactory typeFactory = DocumentTypeCreationHelper.getTypeDefinitionFactory();
List<TypeDefinition> typesList = new LinkedList<TypeDefinition>();
try {
- MutableTypeDefinition cmisType1;
- cmisType1 = typeFactory.createChildTypeDefinition(DocumentTypeCreationHelper.getCmisDocumentType(), LEVEL1_TYPE);
+ MutableTypeDefinition cmisType1;
+ cmisType1 = typeFactory.createChildTypeDefinition(DocumentTypeCreationHelper.getCmisDocumentType(),
+ LEVEL1_TYPE);
cmisType1.setDisplayName("Document type with inherited properties, Level 2");
cmisType1.setDescription("Builtin InMemory type definition " + LEVEL1_TYPE);
- cmisType1 = typeFactory.createChildTypeDefinition(DocumentTypeCreationHelper.getCmisDocumentType(), "MyDocType1");
+ cmisType1 = typeFactory.createChildTypeDefinition(DocumentTypeCreationHelper.getCmisDocumentType(),
+ "MyDocType1");
cmisType1.setDisplayName("My Type 1 Level 1");
cmisType1.setDescription("Builtin InMemory type definition MyDocType1");
typesList.add(cmisType1);
- MutableTypeDefinition cmisType2;
- cmisType2 = typeFactory.createChildTypeDefinition(DocumentTypeCreationHelper.getCmisDocumentType(), "MyDocType2");
+ MutableTypeDefinition cmisType2;
+ cmisType2 = typeFactory.createChildTypeDefinition(DocumentTypeCreationHelper.getCmisDocumentType(),
+ "MyDocType2");
cmisType2.setDisplayName("My Type 2 Level 1");
cmisType2.setDescription("Builtin InMemory type definition MyDocType2");
typesList.add(cmisType2);
- MutableTypeDefinition cmisType11;
+ MutableTypeDefinition cmisType11;
cmisType11 = typeFactory.createChildTypeDefinition(cmisType1, "MyDocType1.1");
cmisType11.setDisplayName("My Type 3 Level 2");
cmisType11.setDescription("Builtin InMemory type definition MyDocType1.1");
typesList.add(cmisType11);
- MutableTypeDefinition cmisType111;
+ MutableTypeDefinition cmisType111;
cmisType111 = typeFactory.createChildTypeDefinition(cmisType11, "MyDocType1.1.1");
cmisType111.setDisplayName("My Type 4 Level 3");
cmisType111.setDescription("Builtin InMemory type definition MyDocType1.1.1");
typesList.add(cmisType111);
- MutableTypeDefinition cmisType112;
+ MutableTypeDefinition cmisType112;
cmisType112 = typeFactory.createChildTypeDefinition(cmisType11, "MyDocType1.1.2");
cmisType112.setDisplayName("My Type 5 Level 3");
cmisType112.setDescription("Builtin InMemory type definition MyDocType1.1.2");
typesList.add(cmisType112);
- MutableTypeDefinition cmisType12;
+ MutableTypeDefinition cmisType12;
cmisType12 = typeFactory.createChildTypeDefinition(cmisType1, "MyDocType1.2");
cmisType12.setDisplayName("My Type 6 Level 2");
cmisType12.setDescription("Builtin InMemory type definition MyDocType1.2");
typesList.add(cmisType12);
- MutableTypeDefinition cmisType21;
+ MutableTypeDefinition cmisType21;
cmisType21 = typeFactory.createChildTypeDefinition(cmisType2, "MyDocType2.1");
cmisType21.setDisplayName("My Type 7 Level 2");
cmisType21.setDescription("Builtin InMemory type definition MyDocType2.1");
typesList.add(cmisType21);
- MutableTypeDefinition cmisType22;
+ MutableTypeDefinition cmisType22;
cmisType22 = typeFactory.createChildTypeDefinition(cmisType2, "MyDocType2.2");
cmisType22.setDisplayName("My Type 8 Level 2");
cmisType22.setDescription("Builtin InMemory type definition MyDocType2.2");
typesList.add(cmisType22);
- MutableTypeDefinition cmisType23;
+ MutableTypeDefinition cmisType23;
cmisType23 = typeFactory.createChildTypeDefinition(cmisType2, "MyDocType2.3");
cmisType23.setDisplayName("My Type 9 Level 2");
cmisType23.setDescription("Builtin InMemory type definition MyDocType2.3");
typesList.add(cmisType23);
- MutableTypeDefinition cmisType24;
+ MutableTypeDefinition cmisType24;
cmisType24 = typeFactory.createChildTypeDefinition(cmisType2, "MyDocType2.4");
cmisType24.setDisplayName("My Type 10 Level 2");
cmisType24.setDescription("Builtin InMemory type definition MyDocType2.4");
typesList.add(cmisType24);
- MutableTypeDefinition cmisType25;
+ MutableTypeDefinition cmisType25;
cmisType25 = typeFactory.createChildTypeDefinition(cmisType2, "MyDocType2.5");
cmisType25.setDisplayName("My Type 11 Level 2");
cmisType25.setDescription("Builtin InMemory type definition MyDocType2.5");
typesList.add(cmisType25);
- MutableTypeDefinition cmisType26;
+ MutableTypeDefinition cmisType26;
cmisType26 = typeFactory.createChildTypeDefinition(cmisType2, "MyDocType2.6");
cmisType26.setDisplayName("My Type 12 Level 2");
cmisType26.setDescription("Builtin InMemory type definition MyDocType2.6");
typesList.add(cmisType26);
- MutableTypeDefinition cmisType27;
+ MutableTypeDefinition cmisType27;
cmisType27 = typeFactory.createChildTypeDefinition(cmisType2, "MyDocType2.7");
cmisType27.setDisplayName("My Type 13 Level 2");
cmisType27.setDescription("Builtin InMemory type definition MyDocType2.7");
typesList.add(cmisType27);
- MutableTypeDefinition cmisType28;
+ MutableTypeDefinition cmisType28;
cmisType28 = typeFactory.createChildTypeDefinition(cmisType2, "MyDocType2.8");
cmisType28.setDisplayName("My Type 14 Level 2");
cmisType28.setDescription("Builtin InMemory type definition MyDocType2.8");
typesList.add(cmisType28);
- MutableTypeDefinition cmisType29;
+ MutableTypeDefinition cmisType29;
cmisType29 = typeFactory.createChildTypeDefinition(cmisType2, "MyDocType2.9");
cmisType29.setDisplayName("My Type 15 Level 2");
cmisType29.setDescription("Builtin InMemory type definition MyDocType2.9");
typesList.add(cmisType29);
// create a complex type with properties
- MutableDocumentTypeDefinition cmisComplexType;
- cmisComplexType = typeFactory.createDocumentTypeDefinition(CmisVersion.CMIS_1_1, DocumentTypeCreationHelper.getCmisDocumentType().getId());
+ MutableDocumentTypeDefinition cmisComplexType;
+ cmisComplexType = typeFactory.createDocumentTypeDefinition(CmisVersion.CMIS_1_1, DocumentTypeCreationHelper
+ .getCmisDocumentType().getId());
cmisComplexType.setId(COMPLEX_TYPE);
cmisComplexType.setDisplayName("Complex type with properties, Level 1");
cmisComplexType.setDescription("Builtin InMemory type definition ComplexType");
@@ -236,27 +240,32 @@ public class UnitTestTypeSystemCreator i
"Sample Decimal Property", Updatability.READONLY);
cmisComplexType.addPropertyDefinition(prop3);
- prop3 = PropertyCreationHelper.createDecimalMultiDefinition(PROP_ID_DECIMAL_MULTI_VALUE, "Sample Decimal multi-value Property", Updatability.READONLY);
+ prop3 = PropertyCreationHelper.createDecimalMultiDefinition(PROP_ID_DECIMAL_MULTI_VALUE,
+ "Sample Decimal multi-value Property", Updatability.READONLY);
cmisComplexType.addPropertyDefinition(prop3);
PropertyHtmlDefinitionImpl prop4 = PropertyCreationHelper.createHtmlDefinition(PROP_ID_HTML,
"Sample Html Property", Updatability.READONLY);
cmisComplexType.addPropertyDefinition(prop4);
- prop4 = PropertyCreationHelper.createHtmlMultiDefinition(PROP_ID_HTML_MULTI_VALUE, "Sample Html multi-value Property", Updatability.READONLY);
+ prop4 = PropertyCreationHelper.createHtmlMultiDefinition(PROP_ID_HTML_MULTI_VALUE,
+ "Sample Html multi-value Property", Updatability.READONLY);
cmisComplexType.addPropertyDefinition(prop4);
- PropertyIdDefinitionImpl prop5 = PropertyCreationHelper.createIdDefinition(PROP_ID_ID, "Sample Id Property", Updatability.READONLY);
+ PropertyIdDefinitionImpl prop5 = PropertyCreationHelper.createIdDefinition(PROP_ID_ID,
+ "Sample Id Property", Updatability.READONLY);
cmisComplexType.addPropertyDefinition(prop5);
- prop5 = PropertyCreationHelper.createIdMultiDefinition(PROP_ID_ID_MULTI_VALUE, "Sample Id Html multi-value Property", Updatability.READONLY);
+ prop5 = PropertyCreationHelper.createIdMultiDefinition(PROP_ID_ID_MULTI_VALUE,
+ "Sample Id Html multi-value Property", Updatability.READONLY);
cmisComplexType.addPropertyDefinition(prop5);
PropertyIntegerDefinitionImpl prop6 = PropertyCreationHelper.createIntegerDefinition(PROP_ID_INT,
"Sample Int Property", Updatability.READONLY);
cmisComplexType.addPropertyDefinition(prop6);
- prop6 = PropertyCreationHelper.createIntegerMultiDefinition(PROP_ID_INT_MULTI_VALUE, "Sample Int multi-value Property", Updatability.READONLY);
+ prop6 = PropertyCreationHelper.createIntegerMultiDefinition(PROP_ID_INT_MULTI_VALUE,
+ "Sample Int multi-value Property", Updatability.READONLY);
cmisComplexType.addPropertyDefinition(prop6);
PropertyStringDefinitionImpl prop7 = PropertyCreationHelper.createStringDefinition(PROP_ID_STRING,
@@ -267,10 +276,12 @@ public class UnitTestTypeSystemCreator i
"Sample String multi-value Property", Updatability.READONLY);
cmisComplexType.addPropertyDefinition(prop7);
- PropertyUriDefinitionImpl prop8 = PropertyCreationHelper.createUriDefinition(PROP_ID_URI, "Sample Uri Property", Updatability.READONLY);
+ PropertyUriDefinitionImpl prop8 = PropertyCreationHelper.createUriDefinition(PROP_ID_URI,
+ "Sample Uri Property", Updatability.READONLY);
cmisComplexType.addPropertyDefinition(prop8);
- prop8 = PropertyCreationHelper.createUriMultiDefinition(PROP_ID_URI_MULTI_VALUE, "Sample Uri multi-value Property", Updatability.READONLY);
+ prop8 = PropertyCreationHelper.createUriMultiDefinition(PROP_ID_URI_MULTI_VALUE,
+ "Sample Uri multi-value Property", Updatability.READONLY);
cmisComplexType.addPropertyDefinition(prop8);
PropertyStringDefinitionImpl prop9 = PropertyCreationHelper.createStringDefinition("PickListProp",
@@ -296,18 +307,19 @@ public class UnitTestTypeSystemCreator i
typesList.add(cmisComplexType);
// create a type hierarchy with inherited properties
- MutableDocumentTypeDefinition cmisDocTypeTopLevel;
- cmisDocTypeTopLevel = typeFactory.createDocumentTypeDefinition(CmisVersion.CMIS_1_1, DocumentTypeCreationHelper.getCmisDocumentType().getId());
+ MutableDocumentTypeDefinition cmisDocTypeTopLevel;
+ cmisDocTypeTopLevel = typeFactory.createDocumentTypeDefinition(CmisVersion.CMIS_1_1,
+ DocumentTypeCreationHelper.getCmisDocumentType().getId());
cmisDocTypeTopLevel.setId(TOPLEVEL_TYPE);
cmisDocTypeTopLevel.setDisplayName("Document type with properties, Level 1");
cmisDocTypeTopLevel.setDescription("Builtin InMemory type definition " + TOPLEVEL_TYPE);
- MutableTypeDefinition cmisDocTypeLevel1;
+ MutableTypeDefinition cmisDocTypeLevel1;
cmisDocTypeLevel1 = typeFactory.createChildTypeDefinition(cmisDocTypeTopLevel, LEVEL1_TYPE);
cmisDocTypeLevel1.setDisplayName("Document type with inherited properties, Level 2");
- cmisDocTypeLevel1 .setDescription("Builtin InMemory type definition " + LEVEL1_TYPE);
+ cmisDocTypeLevel1.setDescription("Builtin InMemory type definition " + LEVEL1_TYPE);
- MutableTypeDefinition cmisDocTypeLevel2;
+ MutableTypeDefinition cmisDocTypeLevel2;
cmisDocTypeLevel2 = typeFactory.createChildTypeDefinition(cmisDocTypeLevel1, LEVEL2_TYPE);
cmisDocTypeLevel2.setDisplayName("Document type with inherited properties, Level 3");
cmisDocTypeLevel2.setDescription("Builtin InMemory type definition " + LEVEL2_TYPE);
@@ -325,11 +337,13 @@ public class UnitTestTypeSystemCreator i
cmisDocTypeLevel2.addPropertyDefinition(propLevel2);
// create a versioned type with properties
- MutableDocumentTypeDefinition cmisVersionedType;
- cmisVersionedType = (MutableDocumentTypeDefinition) typeFactory.createChildTypeDefinition(DocumentTypeCreationHelper.getCmisDocumentType(), VERSIONED_TYPE);
+ MutableDocumentTypeDefinition cmisVersionedType;
+ cmisVersionedType = (MutableDocumentTypeDefinition) typeFactory.createChildTypeDefinition(
+ DocumentTypeCreationHelper.getCmisDocumentType(), VERSIONED_TYPE);
cmisVersionedType.setDisplayName("Versioned Type");
cmisVersionedType.setDescription("Builtin InMemory type definition " + VERSIONED_TYPE);
- cmisVersionedType.setIsVersionable(true); // make it a versionable type;
+ cmisVersionedType.setIsVersionable(true); // make it a versionable
+ // type;
// create a single String property definition
PropertyStringDefinitionImpl prop1 = PropertyCreationHelper.createStringDefinition(VERSION_PROPERTY_ID,
@@ -340,40 +354,44 @@ public class UnitTestTypeSystemCreator i
// create a folder type
// create a complex type with properties
- MutableFolderTypeDefinition cmisFolderType;
- cmisFolderType = typeFactory.createFolderTypeDefinition(CmisVersion.CMIS_1_1, DocumentTypeCreationHelper.getCmisFolderType().getId());
+ MutableFolderTypeDefinition cmisFolderType;
+ cmisFolderType = typeFactory.createFolderTypeDefinition(CmisVersion.CMIS_1_1, DocumentTypeCreationHelper
+ .getCmisFolderType().getId());
cmisFolderType.setId(FOLDER_TYPE);
cmisFolderType.setDisplayName("Folder type with properties");
cmisFolderType.setDescription("InMemory test type definition " + FOLDER_TYPE);
// create a two property definitions for folder
- prop6 = PropertyCreationHelper.createIntegerDefinition(PROP_ID_INT, "Sample Folder Int Property", Updatability.READONLY);
+ prop6 = PropertyCreationHelper.createIntegerDefinition(PROP_ID_INT, "Sample Folder Int Property",
+ Updatability.READONLY);
cmisFolderType.addPropertyDefinition(prop6);
- prop7 = PropertyCreationHelper.createStringDefinition(PROP_ID_STRING,
- "Sample Folder String Property", Updatability.READONLY);
+ prop7 = PropertyCreationHelper.createStringDefinition(PROP_ID_STRING, "Sample Folder String Property",
+ Updatability.READONLY);
cmisFolderType.addPropertyDefinition(prop7);
// CMIS 1.1 create a secondary type
- MutableSecondaryTypeDefinition cmisSecondaryType;
- cmisSecondaryType = typeFactory.createSecondaryTypeDefinition(CmisVersion.CMIS_1_1, DocumentTypeCreationHelper.getCmisSecondaryType().getId());
+ MutableSecondaryTypeDefinition cmisSecondaryType;
+ cmisSecondaryType = typeFactory.createSecondaryTypeDefinition(CmisVersion.CMIS_1_1,
+ DocumentTypeCreationHelper.getCmisSecondaryType().getId());
cmisSecondaryType.setId(SECONDARY_TYPE);
cmisSecondaryType.setDisplayName("MySecondaryType");
cmisSecondaryType.setDescription("Builtin InMemory type definition " + SECONDARY_TYPE);
DocumentTypeCreationHelper.setDefaultTypeCapabilities(cmisSecondaryType);
cmisSecondaryType.setIsFileable(false);
-
+
// create a single String property definition
PropertyStringDefinitionImpl propS1 = PropertyCreationHelper.createStringDefinition(SECONDARY_STRING_PROP,
"Secondary String Property", Updatability.READWRITE);
cmisSecondaryType.addPropertyDefinition(propS1);
- PropertyIntegerDefinitionImpl propS2 = PropertyCreationHelper.createIntegerDefinition(SECONDARY_INTEGER_PROP,
- "Secondary Integer Property", Updatability.READWRITE);
+ PropertyIntegerDefinitionImpl propS2 = PropertyCreationHelper.createIntegerDefinition(
+ SECONDARY_INTEGER_PROP, "Secondary Integer Property", Updatability.READWRITE);
propS2.setIsRequired(true);
cmisSecondaryType.addPropertyDefinition(propS2);
-
- MutableSecondaryTypeDefinition cmisSecondaryType2;
- cmisSecondaryType2 = typeFactory.createSecondaryTypeDefinition(CmisVersion.CMIS_1_1, DocumentTypeCreationHelper.getCmisSecondaryType().getId());
+
+ MutableSecondaryTypeDefinition cmisSecondaryType2;
+ cmisSecondaryType2 = typeFactory.createSecondaryTypeDefinition(CmisVersion.CMIS_1_1,
+ DocumentTypeCreationHelper.getCmisSecondaryType().getId());
cmisSecondaryType2.setId(SECONDARY_TYPE_2);
cmisSecondaryType2.setDisplayName("MySecondaryType-2");
cmisSecondaryType2.setDescription("Builtin InMemory type definition " + SECONDARY_TYPE_2);
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/VersionTestTypeSystemCreator.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/VersionTestTypeSystemCreator.java?rev=1516753&r1=1516752&r2=1516753&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/VersionTestTypeSystemCreator.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/VersionTestTypeSystemCreator.java Fri Aug 23 08:53:49 2013
@@ -40,7 +40,7 @@ public class VersionTestTypeSystemCreato
* the required types for testing
*/
@Override
- public List<TypeDefinition> createTypesList() {
+ public List<TypeDefinition> createTypesList() {
return singletonTypes;
}
@@ -59,21 +59,23 @@ public class VersionTestTypeSystemCreato
/**
* create root types and a collection of sample types
- *
+ *
* @return typesMap map filled with created types
*/
private static List<TypeDefinition> buildTypesList() {
- TypeDefinitionFactory typeFactory = DocumentTypeCreationHelper.getTypeDefinitionFactory();
+ TypeDefinitionFactory typeFactory = DocumentTypeCreationHelper.getTypeDefinitionFactory();
// always add CMIS default types
List<TypeDefinition> typesList = new LinkedList<TypeDefinition>();
try {
// create a complex type with properties
- MutableDocumentTypeDefinition cmisComplexType;
- cmisComplexType = (MutableDocumentTypeDefinition) typeFactory.createChildTypeDefinition(DocumentTypeCreationHelper.getCmisDocumentType(), VERSION_TEST_DOCUMENT_TYPE_ID);
+ MutableDocumentTypeDefinition cmisComplexType;
+ cmisComplexType = (MutableDocumentTypeDefinition) typeFactory.createChildTypeDefinition(
+ DocumentTypeCreationHelper.getCmisDocumentType(), VERSION_TEST_DOCUMENT_TYPE_ID);
cmisComplexType.setDisplayName("VersionedType");
cmisComplexType.setDescription("InMemory test type definition " + VERSION_TEST_DOCUMENT_TYPE_ID);
- cmisComplexType.setIsVersionable(true); // make it a versionable type;
+ cmisComplexType.setIsVersionable(true); // make it a versionable
+ // type;
// create a boolean property definition
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/VersioningTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/VersioningTest.java?rev=1516753&r1=1516752&r2=1516753&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/VersioningTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/VersioningTest.java Fri Aug 23 08:53:49 2013
@@ -87,7 +87,7 @@ public class VersioningTest extends Abst
* thread local context that can be accessed from everywhere
* RuntimeContext.attachCfg(ctx);
*/
- ((DummyCallContext) fTestCallContext).put(CallContext.USERNAME, user);
+ ((DummyCallContext) fTestCallContext).put(CallContext.USERNAME, user);
}
@Test
@@ -141,7 +141,7 @@ public class VersioningTest extends Abst
assertTrue(e instanceof CmisUpdateConflictException);
}
// version and version series should be checked out now
-// assertTrue(isCheckedOut(docId));
+ // assertTrue(isCheckedOut(docId));
assertTrue(isCheckedOut(pwcId));
// Set a new content and modify property
@@ -157,9 +157,9 @@ public class VersioningTest extends Abst
// Neither the version nor the version series should be checked out any
// longer:
assertFalse(isCheckedOut(idHolder.getValue()));
-// assertFalse(isCheckedOut(docId));
- ContentStream retrievedContent = fObjSvc.getContentStream(fRepositoryId, idHolder.getValue(), null, BigInteger
- .valueOf(-1) /* offset */, BigInteger.valueOf(-1) /* length */, null);
+ // assertFalse(isCheckedOut(docId));
+ ContentStream retrievedContent = fObjSvc.getContentStream(fRepositoryId, idHolder.getValue(), null,
+ BigInteger.valueOf(-1) /* offset */, BigInteger.valueOf(-1) /* length */, null);
assertTrue(fCreator.verifyContent(fCreator.createAlternateContent(), retrievedContent));
assertTrue(fCreator.verifyProperty(idHolder.getValue(), VersionTestTypeSystemCreator.PROPERTY_ID,
PROP_VALUE_NEW));
@@ -189,7 +189,7 @@ public class VersioningTest extends Abst
ContentStream altContent = fCreator.createAlternateContent();
Properties newProps = fCreator.getUpdatePropertyList(VersionTestTypeSystemCreator.PROPERTY_ID, PROP_VALUE_NEW);
idHolder = new Holder<String>(pwcId);
-// assertTrue(isCheckedOut(docId));
+ // assertTrue(isCheckedOut(docId));
assertTrue(isCheckedOut(pwcId));
// Test check-in and pass content and properties
@@ -198,9 +198,9 @@ public class VersioningTest extends Abst
// Neither the version nor the version series should be checked out any
// longer:
assertFalse(isCheckedOut(idHolder.getValue()));
-// assertFalse(isCheckedOut(docId));
- ContentStream retrievedContent = fObjSvc.getContentStream(fRepositoryId, idHolder.getValue(), null, BigInteger
- .valueOf(-1) /* offset */, BigInteger.valueOf(-1) /* length */, null);
+ // assertFalse(isCheckedOut(docId));
+ ContentStream retrievedContent = fObjSvc.getContentStream(fRepositoryId, idHolder.getValue(), null,
+ BigInteger.valueOf(-1) /* offset */, BigInteger.valueOf(-1) /* length */, null);
// New content and property should be set
assertTrue(fCreator.verifyContent(fCreator.createAlternateContent(), retrievedContent));
@@ -263,8 +263,8 @@ public class VersioningTest extends Abst
// Because nothing was changed we should have a new version with
// identical content
- ContentStream retrievedContent = fObjSvc.getContentStream(fRepositoryId, pwcHolder.getValue(), null, BigInteger
- .valueOf(-1) /* offset */, BigInteger.valueOf(-1) /* length */, null);
+ ContentStream retrievedContent = fObjSvc.getContentStream(fRepositoryId, pwcHolder.getValue(), null,
+ BigInteger.valueOf(-1) /* offset */, BigInteger.valueOf(-1) /* length */, null);
assertTrue(fCreator.verifyContent(retrievedContent, fCreator.createContent()));
assertTrue(fCreator.verifyProperty(idHolder.getValue(), VersionTestTypeSystemCreator.PROPERTY_ID, PROP_VALUE));
}
@@ -307,8 +307,8 @@ public class VersioningTest extends Abst
// verify that the old content and properties are still valid
assertTrue(fCreator.verifyProperty(idOfLastVersion, VersionTestTypeSystemCreator.PROPERTY_ID, PROP_VALUE));
- ContentStream retrievedContent = fObjSvc.getContentStream(fRepositoryId, idOfLastVersion, null, BigInteger
- .valueOf(-1) /* offset */, BigInteger.valueOf(-1) /* length */, null);
+ ContentStream retrievedContent = fObjSvc.getContentStream(fRepositoryId, idOfLastVersion, null,
+ BigInteger.valueOf(-1) /* offset */, BigInteger.valueOf(-1) /* length */, null);
assertTrue(fCreator.verifyContent(retrievedContent, fCreator.createContent()));
}
@@ -333,7 +333,7 @@ public class VersioningTest extends Abst
ContentStream altContent = fCreator.createAlternateContent();
Properties newProps = fCreator.getUpdatePropertyList(VersionTestTypeSystemCreator.PROPERTY_ID, PROP_VALUE_NEW);
idHolder = new Holder<String>(pwcId);
-// assertTrue(isCheckedOut(docId));
+ // assertTrue(isCheckedOut(docId));
assertTrue(isCheckedOut(pwcId));
// Test check-in and pass content and properties
@@ -367,7 +367,7 @@ public class VersioningTest extends Abst
ContentStream altContent = fCreator.createAlternateContent();
Properties newProps = fCreator.getUpdatePropertyList(VersionTestTypeSystemCreator.PROPERTY_ID, PROP_VALUE_NEW);
idHolder = new Holder<String>(pwcId);
-// assertTrue(isCheckedOut(docId));
+ // assertTrue(isCheckedOut(docId));
assertTrue(isCheckedOut(pwcId));
// Test check-in and pass content and properties
@@ -380,8 +380,8 @@ public class VersioningTest extends Abst
ObjectData objData = fVerSvc.getObjectOfLatestVersion(fRepositoryId, docId, docId, isMajor, "*", false,
IncludeRelationships.NONE, null, false, false, null);
checkVersionProperties(verId, versioningState, objData.getProperties().getProperties(), checkinComment);
- ContentStream retrievedContent = fObjSvc.getContentStream(fRepositoryId, objData.getId(), null, BigInteger
- .valueOf(-1) /* offset */, BigInteger.valueOf(-1) /* length */, null);
+ ContentStream retrievedContent = fObjSvc.getContentStream(fRepositoryId, objData.getId(), null,
+ BigInteger.valueOf(-1) /* offset */, BigInteger.valueOf(-1) /* length */, null);
assertTrue(fCreator.verifyContent(retrievedContent, fCreator.createAlternateContent()));
// get latest non-major version, must be the same as before
@@ -525,11 +525,10 @@ public class VersioningTest extends Abst
PropertyId pdid = (PropertyId) props.get(PropertyIds.VERSION_SERIES_ID);
assertNotNull(pdid);
String sVal = pdid.getFirstValue();
-// if (typeDef.isVersionable()) // need not be
-// assertFalse(docId.equals(sVal));
-// else
-// assertEquals(docId, sVal);
-
+ // if (typeDef.isVersionable()) // need not be
+ // assertFalse(docId.equals(sVal));
+ // else
+ // assertEquals(docId, sVal);
pdb = (PropertyBoolean) props.get(PropertyIds.IS_VERSION_SERIES_CHECKED_OUT);
assertNotNull(pdb);
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/AbstractQueryConditionProcessor.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/AbstractQueryConditionProcessor.java?rev=1516753&r1=1516752&r2=1516753&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/AbstractQueryConditionProcessor.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/AbstractQueryConditionProcessor.java Fri Aug 23 08:53:49 2013
@@ -34,149 +34,199 @@ import org.slf4j.LoggerFactory;
public abstract class AbstractQueryConditionProcessor implements PredicateWalkerBase {
private static final Logger LOG = LoggerFactory.getLogger(ProcessQueryTest.class);
-
+
protected abstract void onStartProcessing(Tree whereNode);
+
protected abstract void onStopProcessing();
// Compare operators
- protected void onPreEquals(Tree eqNode, Tree leftNode, Tree rightNode) {
+ protected void onPreEquals(Tree eqNode, Tree leftNode, Tree rightNode) {
}
+
protected abstract void onEquals(Tree eqNode, Tree leftNode, Tree rightNode);
- protected void onPostEquals(Tree eqNode, Tree leftNode, Tree rightNode) {
+
+ protected void onPostEquals(Tree eqNode, Tree leftNode, Tree rightNode) {
}
- protected void onPreNotEquals(Tree neNode, Tree leftNode, Tree rightNode) {
+ protected void onPreNotEquals(Tree neNode, Tree leftNode, Tree rightNode) {
}
+
protected abstract void onNotEquals(Tree neNode, Tree leftNode, Tree rightNode);
- protected void onPostNotEquals(Tree neNode, Tree leftNode, Tree rightNode) {
+
+ protected void onPostNotEquals(Tree neNode, Tree leftNode, Tree rightNode) {
}
-
- protected void onPreGreaterThan(Tree gtNode, Tree leftNode, Tree rightNode) {
+
+ protected void onPreGreaterThan(Tree gtNode, Tree leftNode, Tree rightNode) {
}
+
protected abstract void onGreaterThan(Tree gtNode, Tree leftNode, Tree rightNode);
- protected void onPostGreaterThan(Tree gtNode, Tree leftNode, Tree rightNode) {
+
+ protected void onPostGreaterThan(Tree gtNode, Tree leftNode, Tree rightNode) {
}
- protected void onPreGreaterOrEquals(Tree geNode, Tree leftNode, Tree rightNode) {
+ protected void onPreGreaterOrEquals(Tree geNode, Tree leftNode, Tree rightNode) {
}
+
protected abstract void onGreaterOrEquals(Tree geNode, Tree leftNode, Tree rightNode);
- protected void onPostGreaterOrEquals(Tree geNode, Tree leftNode, Tree rightNode) {
+
+ protected void onPostGreaterOrEquals(Tree geNode, Tree leftNode, Tree rightNode) {
}
- protected void onPreLessThan(Tree ltNode, Tree leftNode, Tree rightNode) {
+ protected void onPreLessThan(Tree ltNode, Tree leftNode, Tree rightNode) {
}
+
protected abstract void onLessThan(Tree ltNode, Tree leftNode, Tree rightNode);
- protected void onPostLessThan(Tree ltNode, Tree leftNode, Tree rightNode) {
+
+ protected void onPostLessThan(Tree ltNode, Tree leftNode, Tree rightNode) {
}
- protected void onPreLessOrEquals(Tree leqNode, Tree leftNode, Tree rightNode) {
+ protected void onPreLessOrEquals(Tree leqNode, Tree leftNode, Tree rightNode) {
}
+
protected abstract void onLessOrEquals(Tree leqNode, Tree leftNode, Tree rightNode);
- protected void onPostLessOrEquals(Tree leqNode, Tree leftNode, Tree rightNode) {
+
+ protected void onPostLessOrEquals(Tree leqNode, Tree leftNode, Tree rightNode) {
}
// Boolean operators
protected abstract void onNot(Tree opNode, Tree leftNode);
+
protected void onPostNot(Tree opNode, Tree leftNode) {
}
+
protected void onPreAnd(Tree opNode, Tree leftNode, Tree rightNode) {
}
+
protected abstract void onAnd(Tree opNode, Tree leftNode, Tree rightNode);
+
protected void onPostAnd(Tree opNode, Tree leftNode, Tree rightNode) {
}
+
protected void onPreOr(Tree opNode, Tree leftNode, Tree rightNode) {
}
+
protected abstract void onOr(Tree opNode, Tree leftNode, Tree rightNode);
+
protected void onPostOr(Tree opNode, Tree leftNode, Tree rightNode) {
}
// Multi-value:
- protected void onPreIn(Tree node, Tree colNode, Tree listNode) {
+ protected void onPreIn(Tree node, Tree colNode, Tree listNode) {
}
+
protected abstract void onIn(Tree node, Tree colNode, Tree listNode);
- protected void onPostIn(Tree node, Tree colNode, Tree listNode) {
+
+ protected void onPostIn(Tree node, Tree colNode, Tree listNode) {
}
- protected void onPreNotIn(Tree node, Tree colNode, Tree listNode) {
+ protected void onPreNotIn(Tree node, Tree colNode, Tree listNode) {
}
+
protected abstract void onNotIn(Tree node, Tree colNode, Tree listNode);
- protected void onPostNotIn(Tree node, Tree colNode, Tree listNode) {
+
+ protected void onPostNotIn(Tree node, Tree colNode, Tree listNode) {
}
- protected void onPreInAny(Tree node, Tree colNode, Tree listNode) {
+ protected void onPreInAny(Tree node, Tree colNode, Tree listNode) {
}
+
protected abstract void onInAny(Tree node, Tree colNode, Tree listNode);
- protected void onPostInAny(Tree node, Tree colNode, Tree listNode) {
+
+ protected void onPostInAny(Tree node, Tree colNode, Tree listNode) {
}
- protected void onPreNotInAny(Tree node, Tree colNode, Tree listNode) {
+ protected void onPreNotInAny(Tree node, Tree colNode, Tree listNode) {
}
+
protected abstract void onNotInAny(Tree node, Tree literalNode, Tree colNode);
- protected void onPostNotInAny(Tree node, Tree colNode, Tree listNode) {
+
+ protected void onPostNotInAny(Tree node, Tree colNode, Tree listNode) {
}
-
+
protected void onPreEqAny(Tree node, Tree literalNode, Tree colNode) {
}
+
protected abstract void onEqAny(Tree node, Tree literalNode, Tree colNode);
- protected void onPostEqAny(Tree node, Tree literalNode, Tree colNode) {
+
+ protected void onPostEqAny(Tree node, Tree literalNode, Tree colNode) {
}
// Null comparisons:
protected abstract void onIsNull(Tree nullNode, Tree colNode);
+
protected void onPostIsNull(Tree nullNode, Tree colNode) {
}
protected abstract void onIsNotNull(Tree notNullNode, Tree colNode);
+
protected void onPostIsNotNull(Tree notNullNode, Tree colNode) {
}
-
+
// String matching:
protected void onPreIsLike(Tree node, Tree colNode, Tree stringNode) {
}
+
protected abstract void onIsLike(Tree node, Tree colNode, Tree stringNode);
+
protected void onPostIsLike(Tree node, Tree colNode, Tree stringNode) {
}
protected void onPreIsNotLike(Tree node, Tree colNode, Tree stringNode) {
}
+
protected abstract void onIsNotLike(Tree node, Tree colNode, Tree stringNode);
+
protected void onPostIsNotLike(Tree node, Tree colNode, Tree stringNode) {
}
protected abstract void onInFolder(Tree node, Tree colNode, Tree paramNode);
+
protected void onBetweenInFolder(Tree node, Tree colNode, Tree paramNode) {
}
+
protected void onPostInFolder(Tree node, Tree colNode, Tree paramNode) {
}
protected abstract void onInTree(Tree node, Tree colNode, Tree paramNode);
+
protected void onBetweenInTree(Tree node, Tree colNode, Tree paramNode) {
}
+
protected void onPostInTree(Tree node, Tree colNode, Tree paramNode) {
}
-
+
protected abstract void onScore(Tree node);
+
protected abstract void onColNode(Tree node);
-
+
protected void onPreTextAnd(Tree node, List<Tree> conjunctionNodes) {
}
+
protected abstract void onTextAnd(Tree node, List<Tree> conjunctionNodes, int index);
+
protected void onPostTextAnd(Tree node, List<Tree> conjunctionNodes) {
}
+
protected void onPreTextOr(Tree node, List<Tree> termNodes) {
}
+
protected abstract void onTextOr(Tree node, List<Tree> termNodes, int index);
+
protected void onPostTextOr(Tree node, List<Tree> termNodes) {
}
+
protected abstract void onTextMinus(Tree node, Tree notNode);
- protected void onPostTextMinus(Tree node, Tree notNode) {
+
+ protected void onPostTextMinus(Tree node, Tree notNode) {
}
+
protected abstract void onTextWord(String word);
+
protected abstract void onTextPhrase(String phrase);
// Base interface called from query parser
@Override
- public Boolean walkPredicate(Tree whereNode) {
+ public Boolean walkPredicate(Tree whereNode) {
if (null != whereNode) {
onStartProcessing(whereNode);
evalWhereNode(whereNode);
@@ -333,7 +383,7 @@ public abstract class AbstractQueryCondi
evalWhereNode(typeNode);
onBetweenContains(node, typeNode, textSearchNode);
}
- onContains(node, typeNode, textSearchNode);
+ onContains(node, typeNode, textSearchNode);
break;
case CmisQlStrictLexer.IN_FOLDER:
if (node.getChildCount() == 1) {
@@ -384,14 +434,14 @@ public abstract class AbstractQueryCondi
}
}
- protected void onPreContains(Tree node, Tree typeNode, Tree searchExprNode) {
+ protected void onPreContains(Tree node, Tree typeNode, Tree searchExprNode) {
}
-
+
protected void onContains(Tree node, Tree typeNode, Tree searchExprNode) {
- evalTextSearchNode(typeNode, searchExprNode);
+ evalTextSearchNode(typeNode, searchExprNode);
}
-
- protected void onBetweenContains(Tree node, Tree typeNode, Tree searchExprNode) {
+
+ protected void onBetweenContains(Tree node, Tree typeNode, Tree searchExprNode) {
}
protected void evalTextSearchNode(Tree typeNode, Tree node) {
@@ -402,7 +452,7 @@ public abstract class AbstractQueryCondi
case TextSearchLexer.TEXT_AND:
List<Tree> children = getChildrenAsList(node);
onPreTextAnd(node, children);
- int i=0;
+ int i = 0;
for (Tree child : children) {
evalTextSearchNode(typeNode, child);
onTextAnd(node, children, i++);
@@ -412,7 +462,7 @@ public abstract class AbstractQueryCondi
case TextSearchLexer.TEXT_OR:
children = getChildrenAsList(node);
onPreTextOr(node, children);
- int j=0;
+ int j = 0;
for (Tree child : children) {
evalTextSearchNode(typeNode, child);
onTextOr(node, children, j++);
@@ -432,7 +482,7 @@ public abstract class AbstractQueryCondi
break;
}
}
-
+
// helper functions that are needed by most query tree walkers
protected Object getLiteral(Tree node) {
@@ -448,9 +498,10 @@ public abstract class AbstractQueryCondi
return Long.parseLong(text);
}
case CmisQlStrictLexer.STRING_LIT:
- return text.substring(1, text.length()-1);
+ return text.substring(1, text.length() - 1);
case CmisQlStrictLexer.TIME_LIT:
- GregorianCalendar gc = CalendarHelper.fromString(text.substring(text.indexOf('\'')+1, text.lastIndexOf('\'')));
+ GregorianCalendar gc = CalendarHelper.fromString(text.substring(text.indexOf('\'') + 1,
+ text.lastIndexOf('\'')));
return gc;
default:
throw new RuntimeException("Unknown literal. " + node);
@@ -460,17 +511,17 @@ public abstract class AbstractQueryCondi
protected Object onLiteral(Tree node) {
return getLiteral(node);
}
-
+
protected String onId(Tree node) {
return node.getText();
}
-
+
protected String onTextLiteral(Tree node) {
int type = node.getType();
String text = node.getText();
switch (type) {
case TextSearchLexer.TEXT_SEARCH_PHRASE_STRING_LIT:
- return StringUtil.unescape(text.substring(1, text.length()-1), null);
+ return StringUtil.unescape(text.substring(1, text.length() - 1), null);
case TextSearchLexer.TEXT_SEARCH_WORD_LIT:
return StringUtil.unescape(text, null);
default:
@@ -480,17 +531,17 @@ public abstract class AbstractQueryCondi
protected List<Object> onLiteralList(Tree node) {
List<Object> res = new ArrayList<Object>(node.getChildCount());
- for (int i=0; i<node.getChildCount(); i++) {
- Tree literal = node.getChild(i);
+ for (int i = 0; i < node.getChildCount(); i++) {
+ Tree literal = node.getChild(i);
res.add(getLiteral(literal));
}
return res;
}
-
+
protected List<Tree> getChildrenAsList(Tree node) {
List<Tree> res = new ArrayList<Tree>(node.getChildCount());
- for (int i=0; i<node.getChildCount(); i++) {
- Tree childNnode = node.getChild(i);
+ for (int i = 0; i < node.getChildCount(); i++) {
+ Tree childNnode = node.getChild(i);
res.add(childNnode);
}
return res;
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/AbstractQueryTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/AbstractQueryTest.java?rev=1516753&r1=1516752&r2=1516753&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/AbstractQueryTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/AbstractQueryTest.java Fri Aug 23 08:53:49 2013
@@ -66,35 +66,37 @@ public abstract class AbstractQueryTest
predicateWalker = pw;
}
- protected QueryUtilStrict traverseStatement(String statement) throws UnsupportedEncodingException, IOException, RecognitionException {
- QueryUtilStrict queryUtil= new QueryUtilStrict(statement, typeManager, predicateWalker);
+ protected QueryUtilStrict traverseStatement(String statement) throws UnsupportedEncodingException, IOException,
+ RecognitionException {
+ QueryUtilStrict queryUtil = new QueryUtilStrict(statement, typeManager, predicateWalker);
queryUtil.processStatement();
return queryUtil;
}
protected QueryUtilStrict traverseStatementAndCatchExc(String statement) {
- QueryUtilStrict queryUtil= new QueryUtilStrict(statement, typeManager, predicateWalker);
+ QueryUtilStrict queryUtil = new QueryUtilStrict(statement, typeManager, predicateWalker);
queryUtil.processStatementUsingCmisExceptions();
return queryUtil;
}
protected CmisQueryWalker getWalker(String statement) throws RecognitionException {
- QueryUtilStrict queryUtil= new QueryUtilStrict(statement, typeManager, predicateWalker);
+ QueryUtilStrict queryUtil = new QueryUtilStrict(statement, typeManager, predicateWalker);
queryUtil.processStatementUsingCmisExceptions();
queryObj = queryUtil.getQueryObject();
return queryUtil.getWalker();
}
-
+
// Helper to create some types for testing
- protected List<TypeDefinition> createTypes() {
- TypeDefinitionFactory typeFactory = DocumentTypeCreationHelper.getTypeDefinitionFactory();
+ protected List<TypeDefinition> createTypes() {
+ TypeDefinitionFactory typeFactory = DocumentTypeCreationHelper.getTypeDefinitionFactory();
List<TypeDefinition> typeDefs = new ArrayList<TypeDefinition>();
try {
// First test type
- MutableTypeDefinition cmisType;
- cmisType = typeFactory.createChildTypeDefinition(DocumentTypeCreationHelper.getCmisDocumentType(), MY_DOC_TYPE);
+ MutableTypeDefinition cmisType;
+ cmisType = typeFactory.createChildTypeDefinition(DocumentTypeCreationHelper.getCmisDocumentType(),
+ MY_DOC_TYPE);
cmisType.setId(MY_DOC_TYPE);
cmisType.setDisplayName("Document Type for Validation");
@@ -116,7 +118,8 @@ public abstract class AbstractQueryTest
myType = cmisType;
// add another type definition with exactly the same properties
- cmisType = typeFactory.createChildTypeDefinition(DocumentTypeCreationHelper.getCmisDocumentType(), MY_DOC_TYPE_COPY);
+ cmisType = typeFactory.createChildTypeDefinition(DocumentTypeCreationHelper.getCmisDocumentType(),
+ MY_DOC_TYPE_COPY);
cmisType.setDisplayName("Document Type for Duplicated");
// add same properties
@@ -126,21 +129,20 @@ public abstract class AbstractQueryTest
typeDefs.add(cmisType);
myTypeCopy = cmisType;
-
// Second test type
- cmisType = typeFactory.createChildTypeDefinition(DocumentTypeCreationHelper.getCmisDocumentType(), BOOK_TYPE);
+ cmisType = typeFactory.createChildTypeDefinition(DocumentTypeCreationHelper.getCmisDocumentType(),
+ BOOK_TYPE);
cmisType.setDisplayName("Book Document Type");
-
prop2 = PropertyCreationHelper.createStringDefinition(TITLE_PROP, "Title of Book", Updatability.READWRITE);
cmisType.addPropertyDefinition(prop2);
- prop2 = PropertyCreationHelper.createStringDefinition(AUTHOR_PROP, "Author of Book", Updatability.READWRITE);
+ prop2 = PropertyCreationHelper
+ .createStringDefinition(AUTHOR_PROP, "Author of Book", Updatability.READWRITE);
cmisType.addPropertyDefinition(prop2);
- prop3 = PropertyCreationHelper.createIntegerDefinition(ISBN_PROP,
- "ISBN of Book", Updatability.READWRITE);
+ prop3 = PropertyCreationHelper.createIntegerDefinition(ISBN_PROP, "ISBN of Book", Updatability.READWRITE);
cmisType.addPropertyDefinition(prop3);
PropertyDateTimeDefinitionImpl prop4 = PropertyCreationHelper.createDateTimeDefinition(PUB_DATE_PROP,
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/EvalQueryTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/EvalQueryTest.java?rev=1516753&r1=1516752&r2=1516753&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/EvalQueryTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/EvalQueryTest.java Fri Aug 23 08:53:49 2013
@@ -1003,7 +1003,8 @@ public class EvalQueryTest extends Abstr
public void testNotSetProperties() {
log.debug("Start testNotSetProperties...");
// PROP_ID_ID is not set property
- String statement = "SELECT cmis:name, " + PROP_ID_ID + " FROM " + COMPLEX_TYPE + " WHERE " + PROP_ID_INT + "= 100";
+ String statement = "SELECT cmis:name, " + PROP_ID_ID + " FROM " + COMPLEX_TYPE + " WHERE " + PROP_ID_INT
+ + "= 100";
ObjectList res = doQuery(statement);
assertEquals(1, res.getObjects().size());
assertTrue(resultContains("epsilon", res));
@@ -1016,7 +1017,7 @@ public class EvalQueryTest extends Abstr
assertTrue(resultContainsNotSetPropertyValue(PROP_ID_ID, res.getObjects().get(0)));
log.debug("...Stop testNotSetProperties.");
}
-
+
@Test
public void testSecondaryTypes() {
log.debug("Start testSecondaryTypes...");
@@ -1057,7 +1058,8 @@ public class EvalQueryTest extends Abstr
assertTrue(resultContainsProperty(UnitTestTypeSystemCreator.SECONDARY_STRING_PROP, res));
assertTrue(resultContainsProperty(UnitTestTypeSystemCreator.SECONDARY_INTEGER_PROP, res));
- // Test a query with secondary types matching only one document not having this secondary type
+ // Test a query with secondary types matching only one document not
+ // having this secondary type
statement = "SELECT * FROM " + COMPLEX_TYPE + " LEFT JOIN " + SECONDARY_TYPE + " ON " + COMPLEX_TYPE
+ ".cmis:objectId = " + SECONDARY_TYPE + ".cmis:objectId WHERE cmis:name = 'alpha'";
res = doQuery(statement);
@@ -1068,7 +1070,7 @@ public class EvalQueryTest extends Abstr
assertTrue(resultContainsProperty(PropertyIds.OBJECT_TYPE_ID, res));
assertTrue(resultContainsProperty(UnitTestTypeSystemCreator.SECONDARY_STRING_PROP, res));
assertTrue(resultContainsProperty(UnitTestTypeSystemCreator.SECONDARY_INTEGER_PROP, res));
-
+
log.debug("...Stop testSecondaryJoin.");
}