mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged BRANCHES/DEV/BELARUS/HEAD-2010_03_17 to HEAD:
19460: CMIS: Test for Custom and Multi-valued properties 19498: CMIS: TCK tests were extended to support PolicyService testing git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19516 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,24 +0,0 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
|
||||||
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
|
|
||||||
|
|
||||||
<beans>
|
|
||||||
|
|
||||||
<bean id="alfresco.test.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
|
|
||||||
<property name="models">
|
|
||||||
<list>
|
|
||||||
<value>cmis/cmisCustomModel.xml</value>
|
|
||||||
</list>
|
|
||||||
</property>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="testCmisChangeLogService" class="org.alfresco.cmis.CMISChangeLogService" parent="CMISChangeLogService">
|
|
||||||
<property name="auditingService" ref="auditingService" />
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="auditingService" class="org.alfresco.service.cmr.audit.AuditService" parent="AuditService">
|
|
||||||
<replaced-method name="isAuditEnabled" replacer="auditingEnabledReplacer" />
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="auditingEnabledReplacer" class="org.alfresco.cmis.changelog.CMISChangeLogServiceTest" />
|
|
||||||
|
|
||||||
</beans>
|
|
@@ -35,10 +35,27 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
|
|||||||
|
|
||||||
public class CMISCustomTypeTest extends TestCase
|
public class CMISCustomTypeTest extends TestCase
|
||||||
{
|
{
|
||||||
|
private static final String FILTER_ANY = "*";
|
||||||
|
|
||||||
|
private static final String CMIS_TYPE_BASE_FOLDER = "cmis:folder";
|
||||||
|
private static final String CMIS_TYPE_BASE_DOCUMENT = "cmis:document";
|
||||||
|
|
||||||
|
private static final String CMISCUSTOM_TYPE_DOCUMENT = "D:cmiscustom:document";
|
||||||
|
private static final String CMISCUSTOM_TYPE_FOLDER = "F:cmiscustom:folder";
|
||||||
|
|
||||||
|
private static final String CMIS_NAME = "cmis:name";
|
||||||
|
private static final String CMIS_OBJECT_ID = "cmis:objectId";
|
||||||
|
private static final String CMIS_OBJECT_TYPE_ID = "cmis:objectTypeId";
|
||||||
|
|
||||||
|
private static final String CMISCUSTOM_DOCPROP_STRING = "cmiscustom:docprop_string";
|
||||||
|
private static final String CMISCUSTOM_DOCPROP_BOOLEAN_MULTI = "cmiscustom:docprop_boolean_multi";
|
||||||
|
private static final String CMISCUSTOM_FOLDERPROP_STRING = "cmiscustom:folderprop_string";
|
||||||
|
|
||||||
private static final String USERNAME = "admin";
|
private static final String USERNAME = "admin";
|
||||||
private static final String PASSWORD = "admin";
|
private static final String PASSWORD = "admin";
|
||||||
|
|
||||||
private static ApplicationContext applicationContext;
|
private static ApplicationContext applicationContext = new ClassPathXmlApplicationContext(new String[] { "classpath:alfresco/application-context.xml",
|
||||||
|
"classpath:alfresco/cmis-ws-context.xml" });
|
||||||
private static AuthenticationService authenticationService;
|
private static AuthenticationService authenticationService;
|
||||||
|
|
||||||
private static String folderId;
|
private static String folderId;
|
||||||
@@ -53,43 +70,25 @@ public class CMISCustomTypeTest extends TestCase
|
|||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception
|
protected void setUp() throws Exception
|
||||||
{
|
{
|
||||||
if (null == applicationContext)
|
if (null == authenticationService)
|
||||||
{
|
{
|
||||||
applicationContext = new ClassPathXmlApplicationContext(new String[] { "classpath:alfresco/application-context.xml", "classpath:alfresco/cmis-ws-context.xml",
|
|
||||||
"classpath:cmis/cmis-test-context.xml" });
|
|
||||||
ServiceRegistry serviceRegistry = (ServiceRegistry) applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
|
ServiceRegistry serviceRegistry = (ServiceRegistry) applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
|
||||||
authenticationService = serviceRegistry.getAuthenticationService();
|
authenticationService = serviceRegistry.getAuthenticationService();
|
||||||
}
|
|
||||||
|
|
||||||
authenticationService.authenticate(USERNAME, PASSWORD.toCharArray());
|
|
||||||
|
|
||||||
if (null == propertiesUtil)
|
|
||||||
{
|
|
||||||
propertiesUtil = (PropertyUtil) applicationContext.getBean("propertiesUtils");
|
propertiesUtil = (PropertyUtil) applicationContext.getBean("propertiesUtils");
|
||||||
}
|
|
||||||
if (repositoryServicePort == null)
|
|
||||||
{
|
|
||||||
repositoryServicePort = (RepositoryServicePort) applicationContext.getBean("dmRepositoryService");
|
repositoryServicePort = (RepositoryServicePort) applicationContext.getBean("dmRepositoryService");
|
||||||
}
|
|
||||||
if (objectServicePort == null)
|
|
||||||
{
|
|
||||||
objectServicePort = (ObjectServicePort) applicationContext.getBean("dmObjectService");
|
objectServicePort = (ObjectServicePort) applicationContext.getBean("dmObjectService");
|
||||||
}
|
|
||||||
if (navigationServicePort == null)
|
|
||||||
{
|
|
||||||
navigationServicePort = (NavigationServicePort) applicationContext.getBean("dmNavigationService");
|
navigationServicePort = (NavigationServicePort) applicationContext.getBean("dmNavigationService");
|
||||||
}
|
|
||||||
if (discoveryServicePort == null)
|
|
||||||
{
|
|
||||||
discoveryServicePort = (DiscoveryServicePort) applicationContext.getBean("dmDiscoveryService");
|
discoveryServicePort = (DiscoveryServicePort) applicationContext.getBean("dmDiscoveryService");
|
||||||
}
|
}
|
||||||
|
authenticationService.authenticate(USERNAME, PASSWORD.toCharArray());
|
||||||
|
|
||||||
repositoryId = repositoryId == null ? repositoryServicePort.getRepositories(null).get(0).getRepositoryId() : repositoryId;
|
repositoryId = repositoryId == null ? repositoryServicePort.getRepositories(null).get(0).getRepositoryId() : repositoryId;
|
||||||
if (folderId == null)
|
if (folderId == null)
|
||||||
{
|
{
|
||||||
String rootFolderId = repositoryServicePort.getRepositoryInfo(repositoryId, null).getRootFolderId();
|
String rootFolderId = repositoryServicePort.getRepositoryInfo(repositoryId, null).getRootFolderId();
|
||||||
// TODO: orderBy
|
// TODO: orderBy
|
||||||
// TODO: renditionFilter
|
// TODO: renditionFilter
|
||||||
CmisObjectInFolderListType response = navigationServicePort.getChildren(repositoryId, folderId, "*", "", false, EnumIncludeRelationships.NONE, "", false,
|
CmisObjectInFolderListType response = navigationServicePort.getChildren(repositoryId, rootFolderId, FILTER_ANY, null, false, EnumIncludeRelationships.NONE, "", false,
|
||||||
BigInteger.ZERO, BigInteger.ZERO, null);
|
BigInteger.ZERO, BigInteger.ZERO, null);
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
assertNotNull(response.getObjects());
|
assertNotNull(response.getObjects());
|
||||||
@@ -98,16 +97,16 @@ public class CMISCustomTypeTest extends TestCase
|
|||||||
assertNotNull(cmisObjectType);
|
assertNotNull(cmisObjectType);
|
||||||
assertNotNull(cmisObjectType.getObject());
|
assertNotNull(cmisObjectType.getObject());
|
||||||
assertNotNull(cmisObjectType.getObject().getProperties());
|
assertNotNull(cmisObjectType.getObject().getProperties());
|
||||||
CmisPropertyString propertyString = (CmisPropertyString) getCmisProperty(cmisObjectType.getObject().getProperties(), "Name");
|
CmisPropertyString propertyString = (CmisPropertyString) getCmisProperty(cmisObjectType.getObject().getProperties(), CMIS_NAME);
|
||||||
if (propertyString != null && propertyString.getValue() != null && propertyString.getValue().size() > 0 && "CMIS Tests".equals(propertyString.getValue().get(0)))
|
if (propertyString != null && propertyString.getValue() != null && propertyString.getValue().size() > 0 && "CMIS Tests".equals(propertyString.getValue().get(0)))
|
||||||
{
|
{
|
||||||
folderId = ((CmisPropertyId) getCmisProperty(cmisObjectType.getObject().getProperties(), "ObjectId")).getValue().get(0);
|
folderId = ((CmisPropertyId) getCmisProperty(cmisObjectType.getObject().getProperties(), CMIS_OBJECT_ID)).getValue().get(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (folderId == null)
|
if (folderId == null)
|
||||||
{
|
{
|
||||||
folderId = createTestFolder(repositoryId, "CMIS Tests", rootFolderId, false);
|
folderId = createTestFolder(repositoryId, "CMISTests(" + System.currentTimeMillis() + ")", rootFolderId, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,14 +120,14 @@ public class CMISCustomTypeTest extends TestCase
|
|||||||
|
|
||||||
public void testCreateFolder() throws Exception
|
public void testCreateFolder() throws Exception
|
||||||
{
|
{
|
||||||
String folderId1 = createTestFolder(repositoryId, "testCreateCustomFolder" + System.currentTimeMillis(), folderId, true);
|
String folderId1 = createTestFolder(repositoryId, ("testCreateCustomFolder(" + System.currentTimeMillis() + ")"), folderId, true);
|
||||||
assertNotNull(folderId1);
|
assertNotNull(folderId1);
|
||||||
|
|
||||||
CmisPropertiesType propertiesObject = objectServicePort.getProperties(repositoryId, folderId1, "*", null);
|
CmisPropertiesType propertiesObject = objectServicePort.getProperties(repositoryId, folderId1, FILTER_ANY, null);
|
||||||
assertNotNull(propertiesObject);
|
assertNotNull(propertiesObject);
|
||||||
CmisPropertyId objectTypeId = (CmisPropertyId) getCmisProperty(propertiesObject, "ObjectTypeId");
|
CmisPropertyId objectTypeId = (CmisPropertyId) getCmisProperty(propertiesObject, CMIS_OBJECT_TYPE_ID);
|
||||||
assertTrue(objectTypeId != null && objectTypeId.getValue() != null && objectTypeId.getValue().size() == 1 && "F/cmiscustom_folder".equals(objectTypeId.getValue().get(0)));
|
assertTrue(objectTypeId != null && objectTypeId.getValue() != null && objectTypeId.getValue().size() == 1 && CMISCUSTOM_TYPE_FOLDER.equals(objectTypeId.getValue().get(0)));
|
||||||
CmisPropertyString customProp = (CmisPropertyString) getCmisProperty(propertiesObject, "cmiscustom_folderprop_string");
|
CmisPropertyString customProp = (CmisPropertyString) getCmisProperty(propertiesObject, CMISCUSTOM_FOLDERPROP_STRING);
|
||||||
assertTrue(customProp != null && customProp.getValue() != null && customProp.getValue().size() == 1 && "custom string".equals(customProp.getValue().get(0)));
|
assertTrue(customProp != null && customProp.getValue() != null && customProp.getValue().size() == 1 && "custom string".equals(customProp.getValue().get(0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,22 +136,23 @@ public class CMISCustomTypeTest extends TestCase
|
|||||||
String documentId = createTestDocument(repositoryId, "testCreateCustomDocument" + System.currentTimeMillis(), folderId, true);
|
String documentId = createTestDocument(repositoryId, "testCreateCustomDocument" + System.currentTimeMillis(), folderId, true);
|
||||||
assertNotNull(documentId);
|
assertNotNull(documentId);
|
||||||
|
|
||||||
CmisPropertiesType propertiesObject = objectServicePort.getProperties(repositoryId, documentId, "*", null);
|
CmisPropertiesType propertiesObject = objectServicePort.getProperties(repositoryId, documentId, FILTER_ANY, null);
|
||||||
assertNotNull(propertiesObject);
|
assertNotNull(propertiesObject);
|
||||||
|
|
||||||
CmisPropertyId objectTypeId = (CmisPropertyId) getCmisProperty(propertiesObject, "ObjectTypeId");
|
CmisPropertyId objectTypeId = (CmisPropertyId) getCmisProperty(propertiesObject, CMIS_OBJECT_TYPE_ID);
|
||||||
assertTrue(objectTypeId != null && objectTypeId.getValue() != null && objectTypeId.getValue().size() == 1 && "D/cmiscustom_document".equals(objectTypeId.getValue().get(0)));
|
assertTrue(objectTypeId != null && objectTypeId.getValue() != null && objectTypeId.getValue().size() == 1
|
||||||
CmisPropertyString customProp = (CmisPropertyString) getCmisProperty(propertiesObject, "cmiscustom_docprop_string");
|
&& CMISCUSTOM_TYPE_DOCUMENT.equals(objectTypeId.getValue().get(0)));
|
||||||
|
CmisPropertyString customProp = (CmisPropertyString) getCmisProperty(propertiesObject, CMISCUSTOM_DOCPROP_STRING);
|
||||||
assertTrue(customProp != null && customProp.getValue() != null && customProp.getValue().size() == 1 && "custom string".equals(customProp.getValue().get(0)));
|
assertTrue(customProp != null && customProp.getValue() != null && customProp.getValue().size() == 1 && "custom string".equals(customProp.getValue().get(0)));
|
||||||
|
|
||||||
CmisPropertyBoolean propertyMulti = (CmisPropertyBoolean) getCmisProperty(propertiesObject, "cmiscustom_docprop_boolean_multi");
|
CmisPropertyBoolean propertyMulti = (CmisPropertyBoolean) getCmisProperty(propertiesObject, CMISCUSTOM_DOCPROP_BOOLEAN_MULTI);
|
||||||
assertTrue(propertyMulti != null && propertyMulti.getValue() != null && propertyMulti.getValue().size() == 2 && propertyMulti.getValue().get(0)
|
assertTrue(propertyMulti != null && propertyMulti.getValue() != null && propertyMulti.getValue().size() == 2 && propertyMulti.getValue().get(0)
|
||||||
&& !propertyMulti.getValue().get(1));
|
&& !propertyMulti.getValue().get(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testUpdate() throws Exception
|
public void testUpdate() throws Exception
|
||||||
{
|
{
|
||||||
String documentId = createTestDocument(repositoryId, "testUpdateCustomDocument" + System.currentTimeMillis(), folderId, true);
|
String documentId = createTestDocument(repositoryId, ("testUpdateCustomDocument (" + System.currentTimeMillis() + ").txt"), folderId, true);
|
||||||
assertNotNull(documentId);
|
assertNotNull(documentId);
|
||||||
|
|
||||||
Holder<String> holder = new Holder<String>(documentId);
|
Holder<String> holder = new Holder<String>(documentId);
|
||||||
@@ -160,37 +160,38 @@ public class CMISCustomTypeTest extends TestCase
|
|||||||
String newName = "Updated Title " + System.currentTimeMillis();
|
String newName = "Updated Title " + System.currentTimeMillis();
|
||||||
String customProp = "custom " + System.currentTimeMillis();
|
String customProp = "custom " + System.currentTimeMillis();
|
||||||
CmisPropertyString cmisPropertyString = new CmisPropertyString();
|
CmisPropertyString cmisPropertyString = new CmisPropertyString();
|
||||||
cmisPropertyString.setPropertyDefinitionId("Name");
|
cmisPropertyString.setPropertyDefinitionId(CMIS_NAME);
|
||||||
cmisPropertyString.getValue().add(newName);
|
cmisPropertyString.getValue().add(newName);
|
||||||
properties.getProperty().add(cmisPropertyString);
|
properties.getProperty().add(cmisPropertyString);
|
||||||
cmisPropertyString = new CmisPropertyString();
|
cmisPropertyString = new CmisPropertyString();
|
||||||
cmisPropertyString.setPropertyDefinitionId("cmiscustom_docprop_string");
|
cmisPropertyString.setPropertyDefinitionId(CMISCUSTOM_DOCPROP_STRING);
|
||||||
cmisPropertyString.getValue().add(customProp);
|
cmisPropertyString.getValue().add(customProp);
|
||||||
properties.getProperty().add(cmisPropertyString);
|
properties.getProperty().add(cmisPropertyString);
|
||||||
CmisPropertyBoolean cmisPropertymulti = new CmisPropertyBoolean();
|
CmisPropertyBoolean cmisPropertymulti = new CmisPropertyBoolean();
|
||||||
cmisPropertymulti.setPropertyDefinitionId("cmiscustom_docprop_boolean_multi");
|
cmisPropertymulti.setPropertyDefinitionId(CMISCUSTOM_DOCPROP_BOOLEAN_MULTI);
|
||||||
cmisPropertymulti.getValue().add(false);
|
cmisPropertymulti.getValue().add(false);
|
||||||
cmisPropertymulti.getValue().add(true);
|
cmisPropertymulti.getValue().add(true);
|
||||||
properties.getProperty().add(cmisPropertymulti);
|
properties.getProperty().add(cmisPropertymulti);
|
||||||
objectServicePort.updateProperties(repositoryId, holder, null, properties, null);
|
objectServicePort.updateProperties(repositoryId, holder, null, properties, null);
|
||||||
|
|
||||||
CmisPropertiesType propertiesObject = objectServicePort.getProperties(repositoryId, documentId, "*", null);
|
CmisPropertiesType propertiesObject = objectServicePort.getProperties(repositoryId, documentId, FILTER_ANY, null);
|
||||||
assertNotNull(propertiesObject);
|
assertNotNull(propertiesObject);
|
||||||
|
|
||||||
CmisPropertyId objectTypeId = (CmisPropertyId) getCmisProperty(propertiesObject, "ObjectTypeId");
|
CmisPropertyId objectTypeId = (CmisPropertyId) getCmisProperty(propertiesObject, CMIS_OBJECT_TYPE_ID);
|
||||||
assertTrue(objectTypeId != null && objectTypeId.getValue() != null && objectTypeId.getValue().size() == 1 && "D/cmiscustom_document".equals(objectTypeId.getValue().get(0)));
|
assertTrue(objectTypeId != null && objectTypeId.getValue() != null && objectTypeId.getValue().size() == 1
|
||||||
CmisPropertyString propertyString = (CmisPropertyString) getCmisProperty(propertiesObject, "Name");
|
&& CMISCUSTOM_TYPE_DOCUMENT.equals(objectTypeId.getValue().get(0)));
|
||||||
|
CmisPropertyString propertyString = (CmisPropertyString) getCmisProperty(propertiesObject, CMIS_NAME);
|
||||||
assertTrue(propertyString != null && propertyString.getValue() != null && propertyString.getValue().size() == 1 && newName.equals(propertyString.getValue().get(0)));
|
assertTrue(propertyString != null && propertyString.getValue() != null && propertyString.getValue().size() == 1 && newName.equals(propertyString.getValue().get(0)));
|
||||||
propertyString = (CmisPropertyString) getCmisProperty(propertiesObject, "cmiscustom_docprop_string");
|
propertyString = (CmisPropertyString) getCmisProperty(propertiesObject, CMISCUSTOM_DOCPROP_STRING);
|
||||||
assertTrue(propertyString != null && propertyString.getValue() != null && propertyString.getValue().size() == 1 && customProp.equals(propertyString.getValue().get(0)));
|
assertTrue(propertyString != null && propertyString.getValue() != null && propertyString.getValue().size() == 1 && customProp.equals(propertyString.getValue().get(0)));
|
||||||
CmisPropertyBoolean propertyMulti = (CmisPropertyBoolean) getCmisProperty(propertiesObject, "cmiscustom_docprop_boolean_multi");
|
CmisPropertyBoolean propertyMulti = (CmisPropertyBoolean) getCmisProperty(propertiesObject, CMISCUSTOM_DOCPROP_BOOLEAN_MULTI);
|
||||||
assertTrue(propertyMulti != null && propertyMulti.getValue() != null && propertyMulti.getValue().size() == 2 && !propertyMulti.getValue().get(0)
|
assertTrue(propertyMulti != null && propertyMulti.getValue() != null && propertyMulti.getValue().size() == 2 && !propertyMulti.getValue().get(0)
|
||||||
&& propertyMulti.getValue().get(1));
|
&& propertyMulti.getValue().get(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDelete() throws Exception
|
public void testDelete() throws Exception
|
||||||
{
|
{
|
||||||
String documentId = createTestDocument(repositoryId, "testDeleteCustomDocument" + System.currentTimeMillis(), folderId, true);
|
String documentId = createTestDocument(repositoryId, ("testDeleteCustomDocument(" + System.currentTimeMillis() + ").txt"), folderId, true);
|
||||||
assertNotNull(documentId);
|
assertNotNull(documentId);
|
||||||
assertTrue(isObjectInFolder(repositoryId, documentId, folderId));
|
assertTrue(isObjectInFolder(repositoryId, documentId, folderId));
|
||||||
Holder<CmisExtensionType> extensions = new Holder<CmisExtensionType>();
|
Holder<CmisExtensionType> extensions = new Holder<CmisExtensionType>();
|
||||||
@@ -200,17 +201,19 @@ public class CMISCustomTypeTest extends TestCase
|
|||||||
|
|
||||||
public void testQuery() throws Exception
|
public void testQuery() throws Exception
|
||||||
{
|
{
|
||||||
String folderId1 = createTestFolder(repositoryId, "testQueryCustom" + System.currentTimeMillis(), folderId, false);
|
String folderId1 = createTestFolder(repositoryId, ("testQueryCustom(" + System.currentTimeMillis() + ")"), folderId, false);
|
||||||
String documentId1 = createTestDocument(repositoryId, "apple1", folderId1, false);
|
String documentId1 = createTestDocument(repositoryId, "apple1.txt", folderId1, false);
|
||||||
assertNotNull(documentId1);
|
assertNotNull(documentId1);
|
||||||
String doc2name = "name" + System.currentTimeMillis();
|
String doc2name = "name(" + System.currentTimeMillis() + ").txt";
|
||||||
String documentId2 = createTestDocument(repositoryId, doc2name, folderId1, true);
|
String documentId2 = createTestDocument(repositoryId, doc2name, folderId1, true);
|
||||||
assertNotNull(documentId2);
|
assertNotNull(documentId2);
|
||||||
String documentId3 = createTestDocument(repositoryId, "banana1", folderId1, true);
|
String documentId3 = createTestDocument(repositoryId, "banana1.txt", folderId1, true);
|
||||||
assertNotNull(documentId3);
|
assertNotNull(documentId3);
|
||||||
|
|
||||||
String query = "SELECT ObjectId, Name, ObjectTypeId, cmiscustom_docprop_string, cmiscustom_docprop_boolean_multi FROM cmiscustom_document " + "WHERE IN_FOLDER('"
|
CmisTypeDefinitionType typeDefinition = repositoryServicePort.getTypeDefinition(repositoryId, CMISCUSTOM_TYPE_DOCUMENT, null);
|
||||||
+ folderId1 + "') " + "AND cmiscustom_docprop_string = 'custom string' ";
|
|
||||||
|
String query = "SELECT " + CMIS_OBJECT_ID + ", " + CMIS_NAME + ", " + CMIS_OBJECT_TYPE_ID + ", " + CMISCUSTOM_DOCPROP_STRING + ", " + CMISCUSTOM_DOCPROP_BOOLEAN_MULTI
|
||||||
|
+ " FROM " + typeDefinition.getQueryName() + " WHERE IN_FOLDER('" + folderId1 + "') AND " + CMISCUSTOM_DOCPROP_STRING + "='custom string'";
|
||||||
Query queryType = new Query();
|
Query queryType = new Query();
|
||||||
queryType.setRepositoryId(repositoryId);
|
queryType.setRepositoryId(repositoryId);
|
||||||
queryType.setStatement(query);
|
queryType.setStatement(query);
|
||||||
@@ -227,7 +230,7 @@ public class CMISCustomTypeTest extends TestCase
|
|||||||
CmisObjectType objectType2 = null;
|
CmisObjectType objectType2 = null;
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
CmisPropertyId cmisPropertyId = (CmisPropertyId) getCmisProperty(response.getObjects().getObjects().get(i).getProperties(), "ObjectId");
|
CmisPropertyId cmisPropertyId = (CmisPropertyId) getCmisProperty(response.getObjects().getObjects().get(i).getProperties(), CMIS_OBJECT_ID);
|
||||||
if (documentId2.equals(cmisPropertyId.getValue().get(0)))
|
if (documentId2.equals(cmisPropertyId.getValue().get(0)))
|
||||||
{
|
{
|
||||||
objectType1 = response.getObjects().getObjects().get(i);
|
objectType1 = response.getObjects().getObjects().get(i);
|
||||||
@@ -240,25 +243,27 @@ public class CMISCustomTypeTest extends TestCase
|
|||||||
assertNotNull(objectType1);
|
assertNotNull(objectType1);
|
||||||
assertNotNull(objectType2);
|
assertNotNull(objectType2);
|
||||||
|
|
||||||
CmisPropertyId objectTypeId = (CmisPropertyId) getCmisProperty(objectType1.getProperties(), "ObjectTypeId");
|
CmisPropertyId objectTypeId = (CmisPropertyId) getCmisProperty(objectType1.getProperties(), CMIS_OBJECT_TYPE_ID);
|
||||||
assertTrue(objectTypeId != null && objectTypeId.getValue() != null && objectTypeId.getValue().size() == 1 && "D/cmiscustom_document".equals(objectTypeId.getValue().get(0)));
|
assertTrue(objectTypeId != null && objectTypeId.getValue() != null && objectTypeId.getValue().size() == 1
|
||||||
CmisPropertyString propertyString = (CmisPropertyString) getCmisProperty(objectType1.getProperties(), "Name");
|
&& CMISCUSTOM_TYPE_DOCUMENT.equals(objectTypeId.getValue().get(0)));
|
||||||
|
CmisPropertyString propertyString = (CmisPropertyString) getCmisProperty(objectType1.getProperties(), CMIS_NAME);
|
||||||
assertTrue(propertyString != null && propertyString.getValue() != null && propertyString.getValue().size() == 1 && doc2name.equals(propertyString.getValue().get(0)));
|
assertTrue(propertyString != null && propertyString.getValue() != null && propertyString.getValue().size() == 1 && doc2name.equals(propertyString.getValue().get(0)));
|
||||||
propertyString = (CmisPropertyString) getCmisProperty(objectType1.getProperties(), "cmiscustom_docprop_string");
|
propertyString = (CmisPropertyString) getCmisProperty(objectType1.getProperties(), CMISCUSTOM_DOCPROP_STRING);
|
||||||
assertTrue(propertyString != null && propertyString.getValue() != null && propertyString.getValue().size() == 1 && "custom string".equals(propertyString.getValue().get(0)));
|
assertTrue(propertyString != null && propertyString.getValue() != null && propertyString.getValue().size() == 1 && "custom string".equals(propertyString.getValue().get(0)));
|
||||||
|
|
||||||
CmisPropertyBoolean propertyBoolean = (CmisPropertyBoolean) getCmisProperty(objectType1.getProperties(), "cmiscustom_docprop_boolean_multi");
|
CmisPropertyBoolean propertyBoolean = (CmisPropertyBoolean) getCmisProperty(objectType1.getProperties(), CMISCUSTOM_DOCPROP_BOOLEAN_MULTI);
|
||||||
assertTrue(propertyBoolean != null && propertyBoolean.getValue() != null && propertyBoolean.getValue().size() == 2 && propertyBoolean.getValue().get(0)
|
assertTrue(propertyBoolean != null && propertyBoolean.getValue() != null && propertyBoolean.getValue().size() == 2 && propertyBoolean.getValue().get(0)
|
||||||
&& !propertyBoolean.getValue().get(1));
|
&& !propertyBoolean.getValue().get(1));
|
||||||
|
|
||||||
objectTypeId = (CmisPropertyId) getCmisProperty(objectType2.getProperties(), "ObjectTypeId");
|
objectTypeId = (CmisPropertyId) getCmisProperty(objectType2.getProperties(), CMIS_OBJECT_TYPE_ID);
|
||||||
assertTrue(objectTypeId != null && objectTypeId.getValue() != null && objectTypeId.getValue().size() == 1 && "D/cmiscustom_document".equals(objectTypeId.getValue().get(0)));
|
assertTrue(objectTypeId != null && objectTypeId.getValue() != null && objectTypeId.getValue().size() == 1
|
||||||
propertyString = (CmisPropertyString) getCmisProperty(objectType2.getProperties(), "Name");
|
&& CMISCUSTOM_TYPE_DOCUMENT.equals(objectTypeId.getValue().get(0)));
|
||||||
assertTrue(propertyString != null && propertyString.getValue() != null && propertyString.getValue().size() == 1 && "banana1".equals(propertyString.getValue().get(0)));
|
propertyString = (CmisPropertyString) getCmisProperty(objectType2.getProperties(), CMIS_NAME);
|
||||||
propertyString = (CmisPropertyString) getCmisProperty(objectType2.getProperties(), "cmiscustom_docprop_string");
|
assertTrue(propertyString != null && propertyString.getValue() != null && propertyString.getValue().size() == 1 && "banana1.txt".equals(propertyString.getValue().get(0)));
|
||||||
|
propertyString = (CmisPropertyString) getCmisProperty(objectType2.getProperties(), CMISCUSTOM_DOCPROP_STRING);
|
||||||
assertTrue(propertyString != null && propertyString.getValue() != null && propertyString.getValue().size() == 1 && "custom string".equals(propertyString.getValue().get(0)));
|
assertTrue(propertyString != null && propertyString.getValue() != null && propertyString.getValue().size() == 1 && "custom string".equals(propertyString.getValue().get(0)));
|
||||||
|
|
||||||
propertyBoolean = (CmisPropertyBoolean) getCmisProperty(objectType2.getProperties(), "cmiscustom_docprop_boolean_multi");
|
propertyBoolean = (CmisPropertyBoolean) getCmisProperty(objectType2.getProperties(), CMISCUSTOM_DOCPROP_BOOLEAN_MULTI);
|
||||||
assertTrue(propertyBoolean != null && propertyBoolean.getValue() != null && propertyBoolean.getValue().size() == 2 && propertyBoolean.getValue().get(0)
|
assertTrue(propertyBoolean != null && propertyBoolean.getValue() != null && propertyBoolean.getValue().size() == 2 && propertyBoolean.getValue().get(0)
|
||||||
&& !propertyBoolean.getValue().get(1));
|
&& !propertyBoolean.getValue().get(1));
|
||||||
}
|
}
|
||||||
@@ -279,8 +284,8 @@ public class CMISCustomTypeTest extends TestCase
|
|||||||
{
|
{
|
||||||
// TODO: orderBy
|
// TODO: orderBy
|
||||||
// TODO: renditionsFilter
|
// TODO: renditionsFilter
|
||||||
CmisObjectInFolderListType response = navigationServicePort.getChildren(repositoryId, folderId, "*", "", false, EnumIncludeRelationships.NONE, "", false, BigInteger.ZERO,
|
CmisObjectInFolderListType response = navigationServicePort.getChildren(repositoryId, folderId, FILTER_ANY, null, false, EnumIncludeRelationships.NONE, "", false,
|
||||||
BigInteger.ZERO, null);
|
BigInteger.ZERO, BigInteger.ZERO, null);
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
assertNotNull(response.getObjects());
|
assertNotNull(response.getObjects());
|
||||||
for (CmisObjectInFolderType cmisObjectType : response.getObjects())
|
for (CmisObjectInFolderType cmisObjectType : response.getObjects())
|
||||||
@@ -288,7 +293,7 @@ public class CMISCustomTypeTest extends TestCase
|
|||||||
assertNotNull(cmisObjectType);
|
assertNotNull(cmisObjectType);
|
||||||
assertNotNull(cmisObjectType.getObject());
|
assertNotNull(cmisObjectType.getObject());
|
||||||
assertNotNull(cmisObjectType.getObject().getProperties());
|
assertNotNull(cmisObjectType.getObject().getProperties());
|
||||||
CmisPropertyId propertyId = (CmisPropertyId) getCmisProperty(cmisObjectType.getObject().getProperties(), "ObjectId");
|
CmisPropertyId propertyId = (CmisPropertyId) getCmisProperty(cmisObjectType.getObject().getProperties(), CMIS_OBJECT_ID);
|
||||||
if (propertyId != null && propertyId.getValue() != null && propertyId.getValue().size() > 0 && objectId.equals(propertyId.getValue().get(0)))
|
if (propertyId != null && propertyId.getValue() != null && propertyId.getValue().size() > 0 && objectId.equals(propertyId.getValue().get(0)))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@@ -301,24 +306,24 @@ public class CMISCustomTypeTest extends TestCase
|
|||||||
{
|
{
|
||||||
CmisPropertiesType properties = new CmisPropertiesType();
|
CmisPropertiesType properties = new CmisPropertiesType();
|
||||||
CmisPropertyString cmisPropertyString = new CmisPropertyString();
|
CmisPropertyString cmisPropertyString = new CmisPropertyString();
|
||||||
cmisPropertyString.setPropertyDefinitionId("Name");
|
cmisPropertyString.setPropertyDefinitionId(CMIS_NAME);
|
||||||
cmisPropertyString.getValue().add(name);
|
cmisPropertyString.getValue().add(name);
|
||||||
properties.getProperty().add(cmisPropertyString);
|
properties.getProperty().add(cmisPropertyString);
|
||||||
if (custom)
|
if (custom)
|
||||||
{
|
{
|
||||||
cmisPropertyString = new CmisPropertyString();
|
cmisPropertyString = new CmisPropertyString();
|
||||||
cmisPropertyString.setPropertyDefinitionId("cmiscustom_docprop_string");
|
cmisPropertyString.setPropertyDefinitionId(CMISCUSTOM_DOCPROP_STRING);
|
||||||
cmisPropertyString.getValue().add("custom string");
|
cmisPropertyString.getValue().add("custom string");
|
||||||
properties.getProperty().add(cmisPropertyString);
|
properties.getProperty().add(cmisPropertyString);
|
||||||
CmisPropertyBoolean cmisPropertyBoolean = new CmisPropertyBoolean();
|
CmisPropertyBoolean cmisPropertyBoolean = new CmisPropertyBoolean();
|
||||||
cmisPropertyBoolean.setPropertyDefinitionId("cmiscustom_docprop_boolean_multi");
|
cmisPropertyBoolean.setPropertyDefinitionId(CMISCUSTOM_DOCPROP_BOOLEAN_MULTI);
|
||||||
cmisPropertyBoolean.getValue().add(true);
|
cmisPropertyBoolean.getValue().add(true);
|
||||||
cmisPropertyBoolean.getValue().add(false);
|
cmisPropertyBoolean.getValue().add(false);
|
||||||
properties.getProperty().add(cmisPropertyBoolean);
|
properties.getProperty().add(cmisPropertyBoolean);
|
||||||
}
|
}
|
||||||
CmisPropertyId idProperty = new CmisPropertyId();
|
CmisPropertyId idProperty = new CmisPropertyId();
|
||||||
idProperty.setPropertyDefinitionId(CMISDictionaryModel.PROP_OBJECT_TYPE_ID);
|
idProperty.setPropertyDefinitionId(CMISDictionaryModel.PROP_OBJECT_TYPE_ID);
|
||||||
idProperty.getValue().add(custom ? "D/cmiscustom_document" : "document");
|
idProperty.getValue().add(custom ? CMISCUSTOM_TYPE_DOCUMENT : CMIS_TYPE_BASE_DOCUMENT);
|
||||||
properties.getProperty().add(idProperty);
|
properties.getProperty().add(idProperty);
|
||||||
|
|
||||||
CmisContentStreamType cmisStream = new CmisContentStreamType();
|
CmisContentStreamType cmisStream = new CmisContentStreamType();
|
||||||
@@ -335,19 +340,19 @@ public class CMISCustomTypeTest extends TestCase
|
|||||||
{
|
{
|
||||||
CmisPropertiesType properties = new CmisPropertiesType();
|
CmisPropertiesType properties = new CmisPropertiesType();
|
||||||
CmisPropertyString cmisPropertyString = new CmisPropertyString();
|
CmisPropertyString cmisPropertyString = new CmisPropertyString();
|
||||||
cmisPropertyString.setPropertyDefinitionId("Name");
|
cmisPropertyString.setPropertyDefinitionId(CMIS_NAME);
|
||||||
cmisPropertyString.getValue().add(name);
|
cmisPropertyString.getValue().add(name);
|
||||||
properties.getProperty().add(cmisPropertyString);
|
properties.getProperty().add(cmisPropertyString);
|
||||||
if (custom)
|
if (custom)
|
||||||
{
|
{
|
||||||
cmisPropertyString = new CmisPropertyString();
|
cmisPropertyString = new CmisPropertyString();
|
||||||
cmisPropertyString.setPropertyDefinitionId("cmiscustom_folderprop_string");
|
cmisPropertyString.setPropertyDefinitionId(CMISCUSTOM_FOLDERPROP_STRING);
|
||||||
cmisPropertyString.getValue().add("custom string");
|
cmisPropertyString.getValue().add("custom string");
|
||||||
properties.getProperty().add(cmisPropertyString);
|
properties.getProperty().add(cmisPropertyString);
|
||||||
}
|
}
|
||||||
CmisPropertyId idProperty = new CmisPropertyId();
|
CmisPropertyId idProperty = new CmisPropertyId();
|
||||||
idProperty.setPropertyDefinitionId(CMISDictionaryModel.PROP_OBJECT_TYPE_ID);
|
idProperty.setPropertyDefinitionId(CMISDictionaryModel.PROP_OBJECT_TYPE_ID);
|
||||||
idProperty.getValue().add(custom ? "F/cmiscustom_folder" : "folder");
|
idProperty.getValue().add(custom ? CMISCUSTOM_TYPE_FOLDER : CMIS_TYPE_BASE_FOLDER);
|
||||||
properties.getProperty().add(idProperty);
|
properties.getProperty().add(idProperty);
|
||||||
Holder<CmisExtensionType> extensions = new Holder<CmisExtensionType>();
|
Holder<CmisExtensionType> extensions = new Holder<CmisExtensionType>();
|
||||||
Holder<String> result = new Holder<String>();
|
Holder<String> result = new Holder<String>();
|
||||||
|
Reference in New Issue
Block a user