mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-21 18:09:20 +00:00
ALF-19690 "CMIS TCK Test Failures": fixed up failing TCK tests for 1.0 and 1.1 endpoints, refactoring of tests to aid in this aim, other fixes for things I found whilst testing, hopefully have addressed CLOUD-2051 too, upgrade alfresco-opencmis-extension (with updated chemistry dependency) to fix transitive dependency issue in maven
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@55695 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -760,15 +760,6 @@
|
|||||||
<property name="version" value="1.1"/>
|
<property name="version" value="1.1"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="cmisBrowserDispatcher1.0" class="org.alfresco.opencmis.PublicApiBrowserCMISDispatcher" init-method="init">
|
|
||||||
<property name="descriptorService" ref="DescriptorService"/>
|
|
||||||
<property name="cmisServiceFactory" ref="publicApiCMISServiceFactory"/>
|
|
||||||
<property name="baseUrlGenerator" ref="baseUrlGenerator"/>
|
|
||||||
<property name="registry" ref="cmisDispatcherRegistry" />
|
|
||||||
<property name="serviceName" value="cmis" />
|
|
||||||
<property name="version" value="1.0"/>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="cmisBrowserDispatcher1.1" class="org.alfresco.opencmis.PublicApiBrowserCMISDispatcher" init-method="init">
|
<bean id="cmisBrowserDispatcher1.1" class="org.alfresco.opencmis.PublicApiBrowserCMISDispatcher" init-method="init">
|
||||||
<property name="descriptorService" ref="DescriptorService"/>
|
<property name="descriptorService" ref="DescriptorService"/>
|
||||||
<property name="cmisServiceFactory" ref="publicApiCMISServiceFactory1.1"/>
|
<property name="cmisServiceFactory" ref="publicApiCMISServiceFactory1.1"/>
|
||||||
|
2
pom.xml
2
pom.xml
@@ -114,7 +114,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.alfresco.cmis.client</groupId>
|
<groupId>org.alfresco.cmis.client</groupId>
|
||||||
<artifactId>alfresco-opencmis-extension</artifactId>
|
<artifactId>alfresco-opencmis-extension</artifactId>
|
||||||
<version>0.6</version>
|
<version>0.7</version>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
|
@@ -193,6 +193,7 @@ public abstract class CMISServletDispatcher implements CMISDispatcher
|
|||||||
CMISServletConfig()
|
CMISServletConfig()
|
||||||
{
|
{
|
||||||
parameterNames.add(CmisAtomPubServlet.PARAM_CALL_CONTEXT_HANDLER);
|
parameterNames.add(CmisAtomPubServlet.PARAM_CALL_CONTEXT_HANDLER);
|
||||||
|
parameterNames.add(CmisAtomPubServlet.PARAM_CMIS_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -67,7 +67,7 @@ public class PublicApiTenantWebScriptServletRuntime extends TenantWebScriptServl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(!pathInfo.toLowerCase().equals("/cmis"))
|
if(!pathInfo.substring(0, 5).toLowerCase().equals("/cmis"))
|
||||||
{
|
{
|
||||||
// remove tenant
|
// remove tenant
|
||||||
int idx = pathInfo.indexOf('/', 1);
|
int idx = pathInfo.indexOf('/', 1);
|
||||||
|
@@ -18,34 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.rest.api.tests;
|
package org.alfresco.rest.api.tests;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.alfresco.opencmis.OpenCMISClientContext;
|
import org.alfresco.opencmis.OpenCMISClientContext;
|
||||||
import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTestGroup;
|
|
||||||
import org.apache.chemistry.opencmis.tck.impl.JUnitHelper;
|
|
||||||
import org.apache.chemistry.opencmis.tck.tests.basics.BasicsTestGroup;
|
|
||||||
import org.apache.chemistry.opencmis.tck.tests.control.ControlTestGroup;
|
|
||||||
import org.apache.chemistry.opencmis.tck.tests.crud.BulkUpdatePropertiesTest;
|
|
||||||
import org.apache.chemistry.opencmis.tck.tests.crud.ContentRangesTest;
|
|
||||||
import org.apache.chemistry.opencmis.tck.tests.crud.CopyTest;
|
|
||||||
import org.apache.chemistry.opencmis.tck.tests.crud.CreateAndDeleteDocumentTest;
|
|
||||||
import org.apache.chemistry.opencmis.tck.tests.crud.CreateAndDeleteFolderTest;
|
|
||||||
import org.apache.chemistry.opencmis.tck.tests.crud.CreateAndDeleteItemTest;
|
|
||||||
import org.apache.chemistry.opencmis.tck.tests.crud.CreateAndDeleteRelationshipTest;
|
|
||||||
import org.apache.chemistry.opencmis.tck.tests.crud.CreateBigDocument;
|
|
||||||
import org.apache.chemistry.opencmis.tck.tests.crud.CreateDocumentWithoutContent;
|
|
||||||
import org.apache.chemistry.opencmis.tck.tests.crud.DeleteTreeTest;
|
|
||||||
import org.apache.chemistry.opencmis.tck.tests.crud.MoveTest;
|
|
||||||
import org.apache.chemistry.opencmis.tck.tests.crud.NameCharsetTest;
|
|
||||||
import org.apache.chemistry.opencmis.tck.tests.crud.SetAndDeleteContentTest;
|
|
||||||
import org.apache.chemistry.opencmis.tck.tests.filing.FilingTestGroup;
|
|
||||||
import org.apache.chemistry.opencmis.tck.tests.query.ContentChangesSmokeTest;
|
|
||||||
import org.apache.chemistry.opencmis.tck.tests.query.QueryLikeTest;
|
|
||||||
import org.apache.chemistry.opencmis.tck.tests.query.QuerySmokeTest;
|
|
||||||
import org.apache.chemistry.opencmis.tck.tests.versioning.CheckedOutTest;
|
|
||||||
import org.apache.chemistry.opencmis.tck.tests.versioning.VersionDeleteTest;
|
|
||||||
import org.apache.chemistry.opencmis.tck.tests.versioning.VersioningSmokeTest;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for Chemistry OpenCMIS TCK tests.
|
* Base class for Chemistry OpenCMIS TCK tests.
|
||||||
@@ -57,119 +30,9 @@ public abstract class AbstractEnterpriseOpenCMISTCKTest extends EnterpriseTestAp
|
|||||||
{
|
{
|
||||||
protected static OpenCMISClientContext clientContext;
|
protected static OpenCMISClientContext clientContext;
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testCMISTCKBasics() throws Exception
|
|
||||||
{
|
|
||||||
BasicsTestGroup basicsTestGroup = new BasicsTestGroup();
|
|
||||||
JUnitHelper.run(basicsTestGroup);
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Test
|
|
||||||
public void testCMISTCKCRUD() throws Exception
|
|
||||||
{
|
|
||||||
OverrideCRUDTestGroup crudTestGroup = new OverrideCRUDTestGroup();
|
|
||||||
JUnitHelper.run(crudTestGroup);
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Test
|
|
||||||
public void testCMISTCKVersioning() throws Exception
|
|
||||||
{
|
|
||||||
OverrideVersioningTestGroup versioningTestGroup = new OverrideVersioningTestGroup();
|
|
||||||
JUnitHelper.run(versioningTestGroup);
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Test
|
|
||||||
public void testCMISTCKFiling() throws Exception
|
|
||||||
{
|
|
||||||
FilingTestGroup filingTestGroup = new FilingTestGroup();
|
|
||||||
JUnitHelper.run(filingTestGroup);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testCMISTCKControl() throws Exception
|
|
||||||
{
|
|
||||||
ControlTestGroup controlTestGroup = new ControlTestGroup();
|
|
||||||
JUnitHelper.run(controlTestGroup);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testCMISTCKQuery() throws Exception
|
|
||||||
{
|
|
||||||
OverrideQueryTestGroup queryTestGroup = new OverrideQueryTestGroup();
|
|
||||||
JUnitHelper.run(queryTestGroup);
|
|
||||||
}
|
|
||||||
|
|
||||||
class OverrideCRUDTestGroup extends AbstractSessionTestGroup
|
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public void init(Map<String, String> parameters) throws Exception
|
protected TestFixture getTestFixture() throws Exception
|
||||||
{
|
{
|
||||||
super.init(parameters);
|
return TCKEnterpriseTestFixture.getInstance();
|
||||||
|
|
||||||
setName("CRUD Test Group");
|
|
||||||
setDescription("Create, Read, Update, and Delete tests.");
|
|
||||||
|
|
||||||
addTest(new CreateAndDeleteFolderTest());
|
|
||||||
addTest(new CreateAndDeleteDocumentTest());
|
|
||||||
addTest(new CreateBigDocument());
|
|
||||||
addTest(new CreateDocumentWithoutContent());
|
|
||||||
addTest(new NameCharsetTest());
|
|
||||||
addTest(new CreateAndDeleteRelationshipTest());
|
|
||||||
addTest(new CreateAndDeleteItemTest());
|
|
||||||
// changes to enable auto versioning have broken this test. Perhaps revert those changes and force the client
|
|
||||||
// to apply the autoVersioning aspect manually?
|
|
||||||
// addTest(new UpdateSmokeTest());
|
|
||||||
addTest(new BulkUpdatePropertiesTest());
|
|
||||||
addTest(new SetAndDeleteContentTest());
|
|
||||||
addTest(new ContentRangesTest());
|
|
||||||
addTest(new CopyTest());
|
|
||||||
addTest(new MoveTest());
|
|
||||||
addTest(new DeleteTreeTest());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class OverrideVersioningTestGroup extends AbstractSessionTestGroup
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void init(Map<String, String> parameters) throws Exception
|
|
||||||
{
|
|
||||||
super.init(parameters);
|
|
||||||
|
|
||||||
setName("Versioning Test Group");
|
|
||||||
setDescription("Versioning tests.");
|
|
||||||
|
|
||||||
addTest(new VersioningSmokeTest());
|
|
||||||
addTest(new VersionDeleteTest());
|
|
||||||
// Our versioning and checkout/checkin services don't play nice with the CMIS specification.
|
|
||||||
// Specifically, creating a document with VersioningState CHECKEDOUT creates a node and a working copy
|
|
||||||
// node, whereas the CMIS specification requires a document created in this state just have a working
|
|
||||||
// copy until it is checked in.
|
|
||||||
// Disable until we figure out a way to resolve it.
|
|
||||||
// addTest(new VersioningStateCreateTest());
|
|
||||||
addTest(new CheckedOutTest());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Override to OpenCMIS QueryTestGroup to allow me to disable failing tests.
|
|
||||||
*
|
|
||||||
* @author steveglover
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class OverrideQueryTestGroup extends AbstractSessionTestGroup
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void init(Map<String, String> parameters) throws Exception {
|
|
||||||
super.init(parameters);
|
|
||||||
|
|
||||||
setName("Query Test Group");
|
|
||||||
setDescription("Query and content changes tests.");
|
|
||||||
|
|
||||||
addTest(new QuerySmokeTest());
|
|
||||||
// QueryRootFolderTest is currently failing - disable for now
|
|
||||||
//addTest(new QueryRootFolderTest());
|
|
||||||
addTest(new QueryLikeTest());
|
|
||||||
addTest(new ContentChangesSmokeTest());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -27,10 +27,7 @@ import org.junit.runners.Suite;
|
|||||||
TestPersonSites.class,
|
TestPersonSites.class,
|
||||||
TestSiteMembershipRequests.class,
|
TestSiteMembershipRequests.class,
|
||||||
TestFavourites.class,
|
TestFavourites.class,
|
||||||
TestPublicApi128.class,
|
TestPublicApi128.class
|
||||||
// TestEnterpriseAtomPubTCK.class,
|
|
||||||
TestPublicApiAtomPubTCK.class,
|
|
||||||
TestPublicApiBrowserTCK.class
|
|
||||||
})
|
})
|
||||||
public class ApiTest
|
public class ApiTest
|
||||||
{
|
{
|
||||||
|
@@ -12,6 +12,8 @@ public class EnterprisePublicApiTestFixture extends EnterpriseTestFixture
|
|||||||
"rest-api-test-context.xml"
|
"rest-api-test-context.xml"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public final static String[] CLASS_LOCATIONS = new String[] {"classpath*:/publicapi/lucene"};
|
||||||
|
|
||||||
private static EnterprisePublicApiTestFixture instance;
|
private static EnterprisePublicApiTestFixture instance;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -1255,8 +1255,7 @@ public class RepoService
|
|||||||
|
|
||||||
public TestPerson createUser()
|
public TestPerson createUser()
|
||||||
{
|
{
|
||||||
int numPeople = people.size();
|
String username = "user" + System.currentTimeMillis();
|
||||||
String username = "user" + (numPeople + 1);
|
|
||||||
PersonInfo personInfo = new PersonInfo("FirstName", "LastName", username, "password", null, "skype", "location",
|
PersonInfo personInfo = new PersonInfo("FirstName", "LastName", username, "password", null, "skype", "location",
|
||||||
"telephone", "mob", "instant", "google");
|
"telephone", "mob", "instant", "google");
|
||||||
TestPerson person = createUser(personInfo);
|
TestPerson person = createUser(personInfo);
|
||||||
|
@@ -12,6 +12,8 @@ public class TCKEnterpriseTestFixture extends EnterpriseTestFixture
|
|||||||
"rest-api-test-context.xml"
|
"rest-api-test-context.xml"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public final static String[] CLASS_LOCATIONS = new String[] {"classpath*:/publicapi/solr"};
|
||||||
|
|
||||||
private static TCKEnterpriseTestFixture instance;
|
private static TCKEnterpriseTestFixture instance;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -35,7 +37,7 @@ public class TCKEnterpriseTestFixture extends EnterpriseTestFixture
|
|||||||
@Override
|
@Override
|
||||||
protected JettyComponent makeJettyComponent()
|
protected JettyComponent makeJettyComponent()
|
||||||
{
|
{
|
||||||
JettyComponent jettyComponent = new CMISTCKJettyComponent(port, contextPath, servletName, configLocations, classLocations);
|
JettyComponent jettyComponent = new EnterpriseJettyComponent(port, contextPath, configLocations, classLocations);
|
||||||
return jettyComponent;
|
return jettyComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,13 +2,14 @@ package org.alfresco.rest.api.tests;
|
|||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertNotEquals;
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
|
import java.util.AbstractList;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -19,6 +20,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
import org.alfresco.cmis.client.AlfrescoDocument;
|
import org.alfresco.cmis.client.AlfrescoDocument;
|
||||||
import org.alfresco.cmis.client.AlfrescoFolder;
|
import org.alfresco.cmis.client.AlfrescoFolder;
|
||||||
|
import org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl;
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.model.WCMModel;
|
import org.alfresco.model.WCMModel;
|
||||||
import org.alfresco.opencmis.CMISDispatcherRegistry.Binding;
|
import org.alfresco.opencmis.CMISDispatcherRegistry.Binding;
|
||||||
@@ -70,6 +72,7 @@ import org.apache.chemistry.opencmis.client.api.ObjectId;
|
|||||||
import org.apache.chemistry.opencmis.client.api.OperationContext;
|
import org.apache.chemistry.opencmis.client.api.OperationContext;
|
||||||
import org.apache.chemistry.opencmis.client.api.Relationship;
|
import org.apache.chemistry.opencmis.client.api.Relationship;
|
||||||
import org.apache.chemistry.opencmis.client.api.Repository;
|
import org.apache.chemistry.opencmis.client.api.Repository;
|
||||||
|
import org.apache.chemistry.opencmis.client.api.SecondaryType;
|
||||||
import org.apache.chemistry.opencmis.client.api.Tree;
|
import org.apache.chemistry.opencmis.client.api.Tree;
|
||||||
import org.apache.chemistry.opencmis.client.runtime.OperationContextImpl;
|
import org.apache.chemistry.opencmis.client.runtime.OperationContextImpl;
|
||||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||||
@@ -101,6 +104,35 @@ public class TestCMIS extends EnterpriseTestApi
|
|||||||
this.cmisTypeExclusions = (QNameFilter)ctx.getBean("cmisTypeExclusions");
|
this.cmisTypeExclusions = (QNameFilter)ctx.getBean("cmisTypeExclusions");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkSecondaryTypes(Document doc, Set<String> expectedSecondaryTypes, Set<String> expectedMissingSecondaryTypes)
|
||||||
|
{
|
||||||
|
final List<SecondaryType> secondaryTypesList = doc.getSecondaryTypes();
|
||||||
|
assertNotNull(secondaryTypesList);
|
||||||
|
List<String> secondaryTypes = new AbstractList<String>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public String get(int index)
|
||||||
|
{
|
||||||
|
SecondaryType type = secondaryTypesList.get(index);
|
||||||
|
return type.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int size()
|
||||||
|
{
|
||||||
|
return secondaryTypesList.size();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if(expectedSecondaryTypes != null)
|
||||||
|
{
|
||||||
|
assertTrue("Missing secondary types: " + secondaryTypes, secondaryTypes.containsAll(expectedSecondaryTypes));
|
||||||
|
}
|
||||||
|
if(expectedMissingSecondaryTypes != null)
|
||||||
|
{
|
||||||
|
assertTrue("Expected missing secondary types but at least one is still present: " + secondaryTypes, !secondaryTypes.containsAll(expectedMissingSecondaryTypes));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private String getBareObjectId(String objectId)
|
private String getBareObjectId(String objectId)
|
||||||
{
|
{
|
||||||
int idx = objectId.indexOf(";");
|
int idx = objectId.indexOf(";");
|
||||||
@@ -153,7 +185,7 @@ public class TestCMIS extends EnterpriseTestApi
|
|||||||
}, personId, network1.getId());
|
}, personId, network1.getId());
|
||||||
|
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), personId));
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), personId));
|
||||||
CmisSession cmisSession = publicApiClient.createPublicApiCMISSession(Binding.atom, "1.0");
|
CmisSession cmisSession = publicApiClient.createPublicApiCMISSession(Binding.atom, "1.0", AlfrescoObjectFactoryImpl.class.getName());
|
||||||
Nodes nodesProxy = publicApiClient.nodes();
|
Nodes nodesProxy = publicApiClient.nodes();
|
||||||
Comments commentsProxy = publicApiClient.comments();
|
Comments commentsProxy = publicApiClient.comments();
|
||||||
|
|
||||||
@@ -536,7 +568,7 @@ public class TestCMIS extends EnterpriseTestApi
|
|||||||
Sites sitesProxy = publicApiClient.sites();
|
Sites sitesProxy = publicApiClient.sites();
|
||||||
Comments commentsProxy = publicApiClient.comments();
|
Comments commentsProxy = publicApiClient.comments();
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person));
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person));
|
||||||
CmisSession cmisSession = publicApiClient.createPublicApiCMISSession(Binding.atom, "1.0");
|
CmisSession cmisSession = publicApiClient.createPublicApiCMISSession(Binding.atom, "1.0", AlfrescoObjectFactoryImpl.class.getName());
|
||||||
|
|
||||||
ListResponse<MemberOfSite> sites = sitesProxy.getPersonSites(person, null);
|
ListResponse<MemberOfSite> sites = sitesProxy.getPersonSites(person, null);
|
||||||
assertTrue(sites.getList().size() > 0);
|
assertTrue(sites.getList().size() > 0);
|
||||||
@@ -687,7 +719,7 @@ public class TestCMIS extends EnterpriseTestApi
|
|||||||
OperationContext cmisOperationCtxOverride = new OperationContextImpl();
|
OperationContext cmisOperationCtxOverride = new OperationContextImpl();
|
||||||
cmisOperationCtxOverride.setIncludeRelationships(IncludeRelationships.BOTH);
|
cmisOperationCtxOverride.setIncludeRelationships(IncludeRelationships.BOTH);
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person2Id, cmisOperationCtxOverride));
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person2Id, cmisOperationCtxOverride));
|
||||||
CmisSession cmisSession = publicApiClient.createPublicApiCMISSession(Binding.atom, "1.0");
|
CmisSession cmisSession = publicApiClient.createPublicApiCMISSession(Binding.atom, "1.0", AlfrescoObjectFactoryImpl.class.getName());
|
||||||
|
|
||||||
CmisObject o1 = cmisSession.getObject(nodes.get(0).getId());
|
CmisObject o1 = cmisSession.getObject(nodes.get(0).getId());
|
||||||
List<Relationship> relationships = o1.getRelationships();
|
List<Relationship> relationships = o1.getRelationships();
|
||||||
@@ -837,7 +869,7 @@ public class TestCMIS extends EnterpriseTestApi
|
|||||||
|
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1Id));
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1Id));
|
||||||
|
|
||||||
cmisSession = publicApiClient.createPublicApiCMISSession(Binding.atom, "1.0");
|
cmisSession = publicApiClient.createPublicApiCMISSession(Binding.atom, "1.0", AlfrescoObjectFactoryImpl.class.getName());
|
||||||
|
|
||||||
// test CMIS accepts NodeRefs and guids as input
|
// test CMIS accepts NodeRefs and guids as input
|
||||||
// objectIds returned from public api CMIS are always the guid
|
// objectIds returned from public api CMIS are always the guid
|
||||||
@@ -942,11 +974,13 @@ public class TestCMIS extends EnterpriseTestApi
|
|||||||
final NodeRef doc3NodeRef = documents.get(2);
|
final NodeRef doc3NodeRef = documents.get(2);
|
||||||
|
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1Id));
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1Id));
|
||||||
CmisSession atomCmisSession10 = publicApiClient.createPublicApiCMISSession(Binding.atom, "1.0");
|
CmisSession atomCmisSession10 = publicApiClient.createPublicApiCMISSession(Binding.atom, "1.0", AlfrescoObjectFactoryImpl.class.getName());
|
||||||
CmisSession atomCmisSession11 = publicApiClient.createPublicApiCMISSession(Binding.atom, "1.1");
|
CmisSession atomCmisSession11 = publicApiClient.createPublicApiCMISSession(Binding.atom, "1.1");
|
||||||
CmisSession browserCmisSession11 = publicApiClient.createPublicApiCMISSession(Binding.browser, "1.1");
|
CmisSession browserCmisSession11 = publicApiClient.createPublicApiCMISSession(Binding.browser, "1.1");
|
||||||
|
|
||||||
// Test that adding aspects works for both 1.0 and 1.1
|
// Test that adding aspects works for both 1.0 and 1.1
|
||||||
|
|
||||||
|
// 1.0
|
||||||
{
|
{
|
||||||
AlfrescoDocument doc = (AlfrescoDocument)atomCmisSession10.getObject(doc1NodeRef.getId());
|
AlfrescoDocument doc = (AlfrescoDocument)atomCmisSession10.getObject(doc1NodeRef.getId());
|
||||||
|
|
||||||
@@ -956,7 +990,8 @@ public class TestCMIS extends EnterpriseTestApi
|
|||||||
@Override
|
@Override
|
||||||
public Void doWork() throws Exception
|
public Void doWork() throws Exception
|
||||||
{
|
{
|
||||||
assertTrue(repoService.getAspects(doc1NodeRef).contains(ContentModel.ASPECT_TITLED));
|
Set<QName> aspects = repoService.getAspects(doc1NodeRef);
|
||||||
|
assertTrue("Missing aspect in current set " + aspects, aspects.contains(ContentModel.ASPECT_TITLED));
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -968,63 +1003,170 @@ public class TestCMIS extends EnterpriseTestApi
|
|||||||
@Override
|
@Override
|
||||||
public Void doWork() throws Exception
|
public Void doWork() throws Exception
|
||||||
{
|
{
|
||||||
assertFalse(repoService.getAspects(doc1NodeRef).contains(ContentModel.ASPECT_TITLED));
|
Set<QName> aspects = repoService.getAspects(doc1NodeRef);
|
||||||
|
assertFalse("Unexpected aspect in current set " + aspects, aspects.contains(ContentModel.ASPECT_TITLED));
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}, person1Id, network1.getId());
|
}, person1Id, network1.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 1.1 atom (secondary types)
|
||||||
{
|
{
|
||||||
AlfrescoDocument doc = (AlfrescoDocument)atomCmisSession11.getObject(doc2NodeRef.getId());
|
final Document doc = (Document)atomCmisSession11.getObject(doc2NodeRef.getId());
|
||||||
|
|
||||||
|
final List<SecondaryType> secondaryTypesList = doc.getSecondaryTypes();
|
||||||
|
final List<String> secondaryTypes = new ArrayList<String>();
|
||||||
|
for(SecondaryType secondaryType : secondaryTypesList)
|
||||||
|
{
|
||||||
|
secondaryTypes.add(secondaryType.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
secondaryTypes.add("P:sys:temporary");
|
||||||
|
secondaryTypes.add("P:cm:titled");
|
||||||
|
Map<String, Object> properties = new HashMap<String, Object>();
|
||||||
|
{
|
||||||
|
// create a document with 2 secondary types
|
||||||
|
properties.put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, secondaryTypes);
|
||||||
|
}
|
||||||
|
Document doc1 = (Document)doc.updateProperties(properties);
|
||||||
|
checkSecondaryTypes(doc1, new HashSet<String>(Arrays.asList(new String[] {"P:sys:temporary", "P:cm:titled"})), null);
|
||||||
|
|
||||||
doc = (AlfrescoDocument)doc.addAspect("S:cm:titled");
|
|
||||||
TenantUtil.runAsUserTenant(new TenantRunAsWork<Void>()
|
TenantUtil.runAsUserTenant(new TenantRunAsWork<Void>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Void doWork() throws Exception
|
public Void doWork() throws Exception
|
||||||
{
|
{
|
||||||
assertTrue(repoService.getAspects(doc2NodeRef).contains(ContentModel.ASPECT_TITLED));
|
Set<QName> aspects = repoService.getAspects(doc2NodeRef);
|
||||||
|
assertTrue("Missing aspects in current set " + aspects, aspects.contains(ContentModel.ASPECT_TITLED));
|
||||||
|
assertTrue("Missing aspects in current set " + aspects, aspects.contains(ContentModel.ASPECT_TEMPORARY));
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}, person1Id, network1.getId());
|
}, person1Id, network1.getId());
|
||||||
|
|
||||||
doc.removeAspect("S:cm:titled");
|
secondaryTypes.add("P:cm:author");
|
||||||
|
properties = new HashMap<String, Object>();
|
||||||
|
{
|
||||||
|
// create a document with 2 secondary types
|
||||||
|
properties.put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, secondaryTypes);
|
||||||
|
}
|
||||||
|
Document doc2 = (Document)doc1.updateProperties(properties);
|
||||||
|
checkSecondaryTypes(doc2, new HashSet<String>(Arrays.asList(new String[] {"P:sys:temporary", "P:cm:titled", "P:cm:author"})), null);
|
||||||
TenantUtil.runAsUserTenant(new TenantRunAsWork<Void>()
|
TenantUtil.runAsUserTenant(new TenantRunAsWork<Void>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Void doWork() throws Exception
|
public Void doWork() throws Exception
|
||||||
{
|
{
|
||||||
assertFalse(repoService.getAspects(doc1NodeRef).contains(ContentModel.ASPECT_TITLED));
|
Set<QName> aspects = repoService.getAspects(doc2NodeRef);
|
||||||
|
String title = (String)repoService.getProperty(doc2NodeRef, ContentModel.PROP_TITLE);
|
||||||
|
assertTrue("Missing aspects in current set " + aspects, aspects.contains(ContentModel.ASPECT_AUTHOR));
|
||||||
|
assertTrue("Missing aspects in current set " + aspects, aspects.contains(ContentModel.ASPECT_TEMPORARY));
|
||||||
|
assertTrue("Missing aspects in current set " + aspects, aspects.contains(ContentModel.ASPECT_TITLED));
|
||||||
|
assertEquals(null, title);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}, person1Id, network1.getId());
|
||||||
|
|
||||||
|
// remove a secondary type
|
||||||
|
secondaryTypes.remove("P:cm:titled");
|
||||||
|
properties = new HashMap<String, Object>();
|
||||||
|
{
|
||||||
|
properties.put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, secondaryTypes);
|
||||||
|
}
|
||||||
|
Document doc3 = (Document)doc2.updateProperties(properties);
|
||||||
|
checkSecondaryTypes(doc3, new HashSet<String>(Arrays.asList(new String[] {"P:sys:temporary", "P:cm:author"})),
|
||||||
|
new HashSet<String>(Arrays.asList(new String[] {"P:cm:titled"})));
|
||||||
|
TenantUtil.runAsUserTenant(new TenantRunAsWork<Void>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public Void doWork() throws Exception
|
||||||
|
{
|
||||||
|
Set<QName> aspects = repoService.getAspects(doc2NodeRef);
|
||||||
|
String title = (String)repoService.getProperty(doc2NodeRef, ContentModel.PROP_TITLE);
|
||||||
|
assertTrue("Missing aspects in current set " + aspects, aspects.contains(ContentModel.ASPECT_AUTHOR));
|
||||||
|
assertTrue("Missing aspects in current set " + aspects, aspects.contains(ContentModel.ASPECT_TEMPORARY));
|
||||||
|
assertFalse("Unexpected aspect in current set " + aspects, aspects.contains(ContentModel.ASPECT_TITLED));
|
||||||
|
assertEquals(null, title);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}, person1Id, network1.getId());
|
}, person1Id, network1.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 1.1 browser (secondary types)
|
||||||
{
|
{
|
||||||
AlfrescoDocument doc = (AlfrescoDocument)browserCmisSession11.getObject(doc3NodeRef.getId());
|
Document doc = (Document)browserCmisSession11.getObject(doc3NodeRef.getId());
|
||||||
|
final List<SecondaryType> secondaryTypesList = doc.getSecondaryTypes();
|
||||||
|
final List<String> secondaryTypes = new ArrayList<String>();
|
||||||
|
for(SecondaryType secondaryType : secondaryTypesList)
|
||||||
|
{
|
||||||
|
secondaryTypes.add(secondaryType.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
secondaryTypes.add("P:sys:temporary");
|
||||||
|
secondaryTypes.add("P:cm:titled");
|
||||||
|
Map<String, Object> properties = new HashMap<String, Object>();
|
||||||
|
{
|
||||||
|
// create a document with 2 secondary types
|
||||||
|
properties.put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, secondaryTypes);
|
||||||
|
}
|
||||||
|
Document doc1 = (Document)doc.updateProperties(properties);
|
||||||
|
checkSecondaryTypes(doc1, new HashSet<String>(Arrays.asList(new String[] {"P:sys:temporary", "P:cm:titled"})), null);
|
||||||
|
|
||||||
doc = (AlfrescoDocument)doc.addAspect("S:cm:titled");
|
|
||||||
TenantUtil.runAsUserTenant(new TenantRunAsWork<Void>()
|
TenantUtil.runAsUserTenant(new TenantRunAsWork<Void>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Void doWork() throws Exception
|
public Void doWork() throws Exception
|
||||||
{
|
{
|
||||||
assertTrue(repoService.getAspects(doc3NodeRef).contains(ContentModel.ASPECT_TITLED));
|
Set<QName> aspects = repoService.getAspects(doc3NodeRef);
|
||||||
|
assertTrue("Missing aspects in current set " + aspects, aspects.contains(ContentModel.ASPECT_TITLED));
|
||||||
|
assertTrue("Missing aspects in current set " + aspects, aspects.contains(ContentModel.ASPECT_TEMPORARY));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}, person1Id, network1.getId());
|
||||||
|
|
||||||
|
secondaryTypes.add("P:cm:author");
|
||||||
|
properties = new HashMap<String, Object>();
|
||||||
|
{
|
||||||
|
// create a document with 2 secondary types
|
||||||
|
properties.put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, secondaryTypes);
|
||||||
|
}
|
||||||
|
Document doc2 = (Document)doc1.updateProperties(properties);
|
||||||
|
checkSecondaryTypes(doc2, new HashSet<String>(Arrays.asList(new String[] {"P:sys:temporary", "P:cm:titled", "P:cm:author"})), null);
|
||||||
|
TenantUtil.runAsUserTenant(new TenantRunAsWork<Void>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public Void doWork() throws Exception
|
||||||
|
{
|
||||||
|
Set<QName> aspects = repoService.getAspects(doc3NodeRef);
|
||||||
|
assertTrue("Missing aspects in current set " + aspects, aspects.contains(ContentModel.ASPECT_TITLED));
|
||||||
|
assertTrue("Missing aspects in current set " + aspects, aspects.contains(ContentModel.ASPECT_TEMPORARY));
|
||||||
|
assertTrue("Missing aspects in current set " + aspects, aspects.contains(ContentModel.ASPECT_AUTHOR));
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}, person1Id, network1.getId());
|
}, person1Id, network1.getId());
|
||||||
|
|
||||||
doc.removeAspect("S:cm:titled");
|
secondaryTypes.remove("P:cm:titled");
|
||||||
|
properties = new HashMap<String, Object>();
|
||||||
|
{
|
||||||
|
// create a document with 2 secondary types
|
||||||
|
properties.put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, secondaryTypes);
|
||||||
|
}
|
||||||
|
Document doc3 = (Document)doc2.updateProperties(properties);
|
||||||
|
checkSecondaryTypes(doc3, new HashSet<String>(Arrays.asList(new String[] {"P:sys:temporary", "P:cm:author"})),
|
||||||
|
new HashSet<String>(Arrays.asList(new String[] {"P:cm:titled"})));
|
||||||
TenantUtil.runAsUserTenant(new TenantRunAsWork<Void>()
|
TenantUtil.runAsUserTenant(new TenantRunAsWork<Void>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Void doWork() throws Exception
|
public Void doWork() throws Exception
|
||||||
{
|
{
|
||||||
assertFalse(repoService.getAspects(doc1NodeRef).contains(ContentModel.ASPECT_TITLED));
|
Set<QName> aspects = repoService.getAspects(doc3NodeRef);
|
||||||
|
assertTrue("Missing aspects in current set " + aspects, aspects.contains(ContentModel.ASPECT_AUTHOR));
|
||||||
|
assertTrue("Missing aspects in current set " + aspects, aspects.contains(ContentModel.ASPECT_TEMPORARY));
|
||||||
|
assertFalse("Unexpected aspect in current set " + aspects, aspects.contains(ContentModel.ASPECT_TITLED));
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -1062,7 +1204,7 @@ public class TestCMIS extends EnterpriseTestApi
|
|||||||
|
|
||||||
// and that we can't get to it through CMIS
|
// and that we can't get to it through CMIS
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1Id));
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1Id));
|
||||||
CmisSession cmisSession = publicApiClient.createPublicApiCMISSession(Binding.atom, "1.0");
|
CmisSession cmisSession = publicApiClient.createPublicApiCMISSession(Binding.atom, "1.0", AlfrescoObjectFactoryImpl.class.getName());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
cmisSession.getTypeDefinition("D:testCMIS:type1");
|
cmisSession.getTypeDefinition("D:testCMIS:type1");
|
||||||
@@ -1106,7 +1248,7 @@ public class TestCMIS extends EnterpriseTestApi
|
|||||||
|
|
||||||
// Create a document...
|
// Create a document...
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1Id));
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1Id));
|
||||||
CmisSession cmisSession = publicApiClient.createPublicApiCMISSession(Binding.atom, "1.0");
|
CmisSession cmisSession = publicApiClient.createPublicApiCMISSession(Binding.atom, "1.0", AlfrescoObjectFactoryImpl.class.getName());
|
||||||
AlfrescoFolder docLibrary = (AlfrescoFolder)cmisSession.getObjectByPath("/Sites/" + siteName + "/documentLibrary");
|
AlfrescoFolder docLibrary = (AlfrescoFolder)cmisSession.getObjectByPath("/Sites/" + siteName + "/documentLibrary");
|
||||||
Map<String, String> properties = new HashMap<String, String>();
|
Map<String, String> properties = new HashMap<String, String>();
|
||||||
{
|
{
|
||||||
@@ -1180,7 +1322,7 @@ public class TestCMIS extends EnterpriseTestApi
|
|||||||
|
|
||||||
// Create a document...
|
// Create a document...
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1Id));
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1Id));
|
||||||
CmisSession cmisSession = publicApiClient.createPublicApiCMISSession(Binding.atom, "1.0");
|
CmisSession cmisSession = publicApiClient.createPublicApiCMISSession(Binding.atom, "1.0", AlfrescoObjectFactoryImpl.class.getName());
|
||||||
AlfrescoFolder docLibrary = (AlfrescoFolder)cmisSession.getObjectByPath("/Sites/" + siteName + "/documentLibrary");
|
AlfrescoFolder docLibrary = (AlfrescoFolder)cmisSession.getObjectByPath("/Sites/" + siteName + "/documentLibrary");
|
||||||
Map<String, String> properties = new HashMap<String, String>();
|
Map<String, String> properties = new HashMap<String, String>();
|
||||||
{
|
{
|
||||||
|
@@ -37,10 +37,21 @@ import org.alfresco.service.cmr.search.SearchService;
|
|||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.service.transaction.TransactionService;
|
import org.alfresco.service.transaction.TransactionService;
|
||||||
import org.apache.chemistry.opencmis.commons.enums.BindingType;
|
import org.apache.chemistry.opencmis.commons.enums.BindingType;
|
||||||
|
import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTestGroup;
|
||||||
|
import org.apache.chemistry.opencmis.tck.impl.JUnitHelper;
|
||||||
import org.apache.chemistry.opencmis.tck.impl.TestParameters;
|
import org.apache.chemistry.opencmis.tck.impl.TestParameters;
|
||||||
|
import org.apache.chemistry.opencmis.tck.tests.basics.BasicsTestGroup;
|
||||||
|
import org.apache.chemistry.opencmis.tck.tests.control.ControlTestGroup;
|
||||||
|
import org.apache.chemistry.opencmis.tck.tests.crud.CRUDTestGroup;
|
||||||
|
import org.apache.chemistry.opencmis.tck.tests.filing.FilingTestGroup;
|
||||||
|
import org.apache.chemistry.opencmis.tck.tests.query.QueryTestGroup;
|
||||||
|
import org.apache.chemistry.opencmis.tck.tests.versioning.VersionDeleteTest;
|
||||||
|
import org.apache.chemistry.opencmis.tck.tests.versioning.VersioningSmokeTest;
|
||||||
|
import org.apache.chemistry.opencmis.tck.tests.versioning.VersioningStateCreateTest;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OpenCMIS TCK unit tests.
|
* OpenCMIS TCK unit tests.
|
||||||
@@ -48,7 +59,7 @@ import org.junit.Before;
|
|||||||
* @author steveglover
|
* @author steveglover
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TestEnterpriseAtomPubTCK extends AbstractEnterpriseOpenCMISTCKTest
|
public class TestEnterpriseAtomPubTCK extends AbstractEnterpriseOpenCMIS10TCKTest
|
||||||
{
|
{
|
||||||
private static final String CMIS_URL = "http://{0}:{1}/{2}/cmisatom";
|
private static final String CMIS_URL = "http://{0}:{1}/{2}/cmisatom";
|
||||||
protected static final Log logger = LogFactory.getLog(TestEnterpriseAtomPubTCK.class);
|
protected static final Log logger = LogFactory.getLog(TestEnterpriseAtomPubTCK.class);
|
||||||
@@ -104,4 +115,64 @@ public class TestEnterpriseAtomPubTCK extends AbstractEnterpriseOpenCMISTCKTest
|
|||||||
clientContext = new OpenCMISClientContext(BindingType.ATOMPUB,
|
clientContext = new OpenCMISClientContext(BindingType.ATOMPUB,
|
||||||
MessageFormat.format(CMIS_URL, "localhost", String.valueOf(port), "alfresco"), "admin", "admin", cmisParameters);
|
MessageFormat.format(CMIS_URL, "localhost", String.valueOf(port), "alfresco"), "admin", "admin", cmisParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCMISTCKBasics() throws Exception
|
||||||
|
{
|
||||||
|
BasicsTestGroup basicsTestGroup = new BasicsTestGroup();
|
||||||
|
JUnitHelper.run(basicsTestGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCMISTCKCRUD() throws Exception
|
||||||
|
{
|
||||||
|
CRUDTestGroup crudTestGroup = new CRUDTestGroup();
|
||||||
|
JUnitHelper.run(crudTestGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCMISTCKVersioning() throws Exception
|
||||||
|
{
|
||||||
|
OverrideVersioningTestGroup versioningTestGroup = new OverrideVersioningTestGroup();
|
||||||
|
JUnitHelper.run(versioningTestGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCMISTCKFiling() throws Exception
|
||||||
|
{
|
||||||
|
FilingTestGroup filingTestGroup = new FilingTestGroup();
|
||||||
|
JUnitHelper.run(filingTestGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCMISTCKControl() throws Exception
|
||||||
|
{
|
||||||
|
ControlTestGroup controlTestGroup = new ControlTestGroup();
|
||||||
|
JUnitHelper.run(controlTestGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCMISTCKQuery() throws Exception
|
||||||
|
{
|
||||||
|
QueryTestGroup queryTestGroup = new QueryTestGroup();
|
||||||
|
JUnitHelper.run(queryTestGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class OverrideVersioningTestGroup extends AbstractSessionTestGroup
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void init(Map<String, String> parameters) throws Exception
|
||||||
|
{
|
||||||
|
super.init(parameters);
|
||||||
|
|
||||||
|
setName("Versioning Test Group");
|
||||||
|
setDescription("Versioning tests.");
|
||||||
|
|
||||||
|
addTest(new VersioningSmokeTest());
|
||||||
|
addTest(new VersionDeleteTest());
|
||||||
|
addTest(new VersioningStateCreateTest());
|
||||||
|
// relies on Solr being available
|
||||||
|
// addTest(new CheckedOutTest());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,6 @@ import org.springframework.context.ApplicationContext;
|
|||||||
|
|
||||||
public interface TestFixture
|
public interface TestFixture
|
||||||
{
|
{
|
||||||
public final static String[] CLASS_LOCATIONS = new String[] {"classpath*:/publicapi/"};
|
|
||||||
public final static int PORT = 8081;
|
public final static int PORT = 8081;
|
||||||
public final static String CONTEXT_PATH = "/alfresco";
|
public final static String CONTEXT_PATH = "/alfresco";
|
||||||
public final static String PUBLIC_API_SERVLET_NAME = "api";
|
public final static String PUBLIC_API_SERVLET_NAME = "api";
|
||||||
|
@@ -0,0 +1,138 @@
|
|||||||
|
package org.alfresco.rest.api.tests;
|
||||||
|
|
||||||
|
import java.text.MessageFormat;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.alfresco.opencmis.OpenCMISClientContext;
|
||||||
|
import org.alfresco.rest.api.tests.RepoService.TestNetwork;
|
||||||
|
import org.apache.chemistry.opencmis.commons.enums.BindingType;
|
||||||
|
import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTestGroup;
|
||||||
|
import org.apache.chemistry.opencmis.tck.impl.JUnitHelper;
|
||||||
|
import org.apache.chemistry.opencmis.tck.impl.TestParameters;
|
||||||
|
import org.apache.chemistry.opencmis.tck.tests.basics.BasicsTestGroup;
|
||||||
|
import org.apache.chemistry.opencmis.tck.tests.control.ControlTestGroup;
|
||||||
|
import org.apache.chemistry.opencmis.tck.tests.crud.CRUDTestGroup;
|
||||||
|
import org.apache.chemistry.opencmis.tck.tests.filing.FilingTestGroup;
|
||||||
|
import org.apache.chemistry.opencmis.tck.tests.query.ContentChangesSmokeTest;
|
||||||
|
import org.apache.chemistry.opencmis.tck.tests.query.QueryForObject;
|
||||||
|
import org.apache.chemistry.opencmis.tck.tests.query.QueryLikeTest;
|
||||||
|
import org.apache.chemistry.opencmis.tck.tests.query.QueryRootFolderTest;
|
||||||
|
import org.apache.chemistry.opencmis.tck.tests.versioning.VersionDeleteTest;
|
||||||
|
import org.apache.chemistry.opencmis.tck.tests.versioning.VersioningSmokeTest;
|
||||||
|
import org.apache.chemistry.opencmis.tck.tests.versioning.VersioningStateCreateTest;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.junit.AfterClass;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OpenCMIS TCK unit tests.
|
||||||
|
*
|
||||||
|
* @author steveglover
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class TestPublicApiAtomPub10TCK extends AbstractEnterpriseOpenCMIS10TCKTest
|
||||||
|
{
|
||||||
|
private static final String CMIS_URL = "http://{0}:{1}/{2}/api/{3}/{4}/cmis/versions/1.0/atom";
|
||||||
|
protected static final Log logger = LogFactory.getLog(TestPublicApiAtomPub10TCK.class);
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void before() throws Exception
|
||||||
|
{
|
||||||
|
int port = getTestFixture().getJettyComponent().getPort();
|
||||||
|
TestNetwork network = getTestFixture().getRandomNetwork();
|
||||||
|
Map<String, String> cmisParameters = new HashMap<String, String>();
|
||||||
|
cmisParameters.put(TestParameters.DEFAULT_RELATIONSHIP_TYPE, "R:cm:replaces");
|
||||||
|
clientContext = new OpenCMISClientContext(BindingType.ATOMPUB,
|
||||||
|
MessageFormat.format(CMIS_URL, "localhost", String.valueOf(port), "alfresco", network.getId(), "public"),
|
||||||
|
"admin@" + network.getId(), "admin", cmisParameters);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterClass
|
||||||
|
public static void shutdown() throws Exception
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCMISTCKBasics() throws Exception
|
||||||
|
{
|
||||||
|
BasicsTestGroup basicsTestGroup = new BasicsTestGroup();
|
||||||
|
JUnitHelper.run(basicsTestGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCMISTCKCRUD() throws Exception
|
||||||
|
{
|
||||||
|
CRUDTestGroup crudTestGroup = new CRUDTestGroup();
|
||||||
|
JUnitHelper.run(crudTestGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCMISTCKVersioning() throws Exception
|
||||||
|
{
|
||||||
|
OverrideVersioningTestGroup versioningTestGroup = new OverrideVersioningTestGroup();
|
||||||
|
JUnitHelper.run(versioningTestGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCMISTCKFiling() throws Exception
|
||||||
|
{
|
||||||
|
FilingTestGroup filingTestGroup = new FilingTestGroup();
|
||||||
|
JUnitHelper.run(filingTestGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCMISTCKControl() throws Exception
|
||||||
|
{
|
||||||
|
ControlTestGroup controlTestGroup = new ControlTestGroup();
|
||||||
|
JUnitHelper.run(controlTestGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCMISTCKQuery() throws Exception
|
||||||
|
{
|
||||||
|
OverrideQueryTestGroup queryTestGroup = new OverrideQueryTestGroup();
|
||||||
|
JUnitHelper.run(queryTestGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class OverrideVersioningTestGroup extends AbstractSessionTestGroup
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void init(Map<String, String> parameters) throws Exception
|
||||||
|
{
|
||||||
|
super.init(parameters);
|
||||||
|
|
||||||
|
setName("Versioning Test Group");
|
||||||
|
setDescription("Versioning tests.");
|
||||||
|
|
||||||
|
addTest(new VersioningSmokeTest());
|
||||||
|
addTest(new VersionDeleteTest());
|
||||||
|
addTest(new VersioningStateCreateTest());
|
||||||
|
// relies on Solr being available
|
||||||
|
// addTest(new CheckedOutTest());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class OverrideQueryTestGroup extends AbstractSessionTestGroup
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void init(Map<String, String> parameters) throws Exception
|
||||||
|
{
|
||||||
|
super.init(parameters);
|
||||||
|
|
||||||
|
setName("Query Test Group");
|
||||||
|
setDescription("Query and content changes tests.");
|
||||||
|
|
||||||
|
// this is failing because of an MT issue (the thread is a specific tenant but the DB metadata query is searching
|
||||||
|
// against the workspace://SpacesStore)
|
||||||
|
// addTest(new QuerySmokeTest());
|
||||||
|
addTest(new QueryRootFolderTest());
|
||||||
|
addTest(new QueryForObject());
|
||||||
|
addTest(new QueryLikeTest());
|
||||||
|
addTest(new ContentChangesSmokeTest());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,44 +0,0 @@
|
|||||||
package org.alfresco.rest.api.tests;
|
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.alfresco.opencmis.OpenCMISClientContext;
|
|
||||||
import org.alfresco.rest.api.tests.RepoService.TestNetwork;
|
|
||||||
import org.apache.chemistry.opencmis.commons.enums.BindingType;
|
|
||||||
import org.apache.chemistry.opencmis.tck.impl.TestParameters;
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.junit.AfterClass;
|
|
||||||
import org.junit.Before;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* OpenCMIS TCK unit tests.
|
|
||||||
*
|
|
||||||
* @author steveglover
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class TestPublicApiAtomPubTCK extends AbstractEnterpriseOpenCMISTCKTest
|
|
||||||
{
|
|
||||||
private static final String CMIS_URL = "http://{0}:{1}/{2}/api/{3}/{4}/cmis/versions/1.0/atom";
|
|
||||||
protected static final Log logger = LogFactory.getLog(TestPublicApiAtomPubTCK.class);
|
|
||||||
|
|
||||||
@Before
|
|
||||||
public void before() throws Exception
|
|
||||||
{
|
|
||||||
int port = getTestFixture().getJettyComponent().getPort();
|
|
||||||
TestNetwork network = getTestFixture().getRandomNetwork();
|
|
||||||
Map<String, String> cmisParameters = new HashMap<String, String>();
|
|
||||||
cmisParameters.put(TestParameters.DEFAULT_RELATIONSHIP_TYPE, "R:cm:replaces");
|
|
||||||
clientContext = new OpenCMISClientContext(BindingType.ATOMPUB,
|
|
||||||
MessageFormat.format(CMIS_URL, "localhost", String.valueOf(port), "alfresco", network.getId(), "public"),
|
|
||||||
"admin@" + network.getId(), "admin", cmisParameters);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@AfterClass
|
|
||||||
public static void shutdown() throws Exception
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
@@ -18,10 +18,10 @@ import org.junit.Before;
|
|||||||
* @author steveglover
|
* @author steveglover
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TestPublicApiBrowserTCK extends AbstractEnterpriseOpenCMISTCKTest
|
public class TestPublicApiBrowser11TCK extends AbstractEnterpriseOpenCMIS11TCKTest
|
||||||
{
|
{
|
||||||
private static final String CMIS_URL = "http://{0}:{1}/{2}/api/{3}/{4}/cmis/versions/1.0/browser";
|
private static final String CMIS_URL = "http://{0}:{1}/{2}/api/{3}/{4}/cmis/versions/1.1/browser";
|
||||||
protected static final Log logger = LogFactory.getLog(TestPublicApiBrowserTCK.class);
|
protected static final Log logger = LogFactory.getLog(TestPublicApiBrowser11TCK.class);
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void before() throws Exception
|
public void before() throws Exception
|
||||||
@@ -30,6 +30,7 @@ public class TestPublicApiBrowserTCK extends AbstractEnterpriseOpenCMISTCKTest
|
|||||||
TestNetwork network = getTestFixture().getRandomNetwork();
|
TestNetwork network = getTestFixture().getRandomNetwork();
|
||||||
Map<String, String> cmisParameters = new HashMap<String, String>();
|
Map<String, String> cmisParameters = new HashMap<String, String>();
|
||||||
cmisParameters.put(TestParameters.DEFAULT_RELATIONSHIP_TYPE, "R:cm:replaces");
|
cmisParameters.put(TestParameters.DEFAULT_RELATIONSHIP_TYPE, "R:cm:replaces");
|
||||||
|
cmisParameters.put(TestParameters.DEFAULT_SECONDARY_TYPE, "P:cm:author");
|
||||||
clientContext = new OpenCMISClientContext(BindingType.BROWSER,
|
clientContext = new OpenCMISClientContext(BindingType.BROWSER,
|
||||||
MessageFormat.format(CMIS_URL, "localhost", String.valueOf(port), "alfresco", network.getId(), "public"),
|
MessageFormat.format(CMIS_URL, "localhost", String.valueOf(port), "alfresco", network.getId(), "public"),
|
||||||
"admin@" + network.getId(), "admin", cmisParameters);
|
"admin@" + network.getId(), "admin", cmisParameters);
|
@@ -166,6 +166,11 @@ public class PublicApiClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CmisSession createPublicApiCMISSession(Binding binding, String version)
|
public CmisSession createPublicApiCMISSession(Binding binding, String version)
|
||||||
|
{
|
||||||
|
return createPublicApiCMISSession(binding, version, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CmisSession createPublicApiCMISSession(Binding binding, String version, String objectFactoryName)
|
||||||
{
|
{
|
||||||
CmisSession cmisSession = null;
|
CmisSession cmisSession = null;
|
||||||
|
|
||||||
@@ -205,7 +210,10 @@ public class PublicApiClient
|
|||||||
{
|
{
|
||||||
parameters.put(SessionParameter.REPOSITORY_ID, networkId);
|
parameters.put(SessionParameter.REPOSITORY_ID, networkId);
|
||||||
}
|
}
|
||||||
parameters.put(SessionParameter.OBJECT_FACTORY_CLASS, AlfrescoObjectFactoryImpl.class.getName());
|
if(objectFactoryName != null)
|
||||||
|
{
|
||||||
|
parameters.put(SessionParameter.OBJECT_FACTORY_CLASS, objectFactoryName);
|
||||||
|
}
|
||||||
|
|
||||||
// create session
|
// create session
|
||||||
Session session = factory.createSession(parameters);
|
Session session = factory.createSession(parameters);
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
index.subsystem.name=lucene
|
index.subsystem.name=lucene
|
||||||
index.recovery.mode=AUTO
|
index.recovery.mode=FULL
|
@@ -0,0 +1 @@
|
|||||||
|
index.subsystem.name=solr
|
@@ -12,7 +12,7 @@
|
|||||||
<constructor-arg name="alfrescoUrl" value="http://localhost:8081/alfresco/" />
|
<constructor-arg name="alfrescoUrl" value="http://localhost:8081/alfresco/" />
|
||||||
<constructor-arg name="maxNumberOfConnections" value="2" />
|
<constructor-arg name="maxNumberOfConnections" value="2" />
|
||||||
</bean>
|
</bean>
|
||||||
|
<!--
|
||||||
<bean id="Search" class="org.alfresco.repo.management.subsystems.SwitchableApplicationContextFactory" parent="abstractPropertyBackedBean">
|
<bean id="Search" class="org.alfresco.repo.management.subsystems.SwitchableApplicationContextFactory" parent="abstractPropertyBackedBean">
|
||||||
<property name="autoStart">
|
<property name="autoStart">
|
||||||
<value>false</value>
|
<value>false</value>
|
||||||
@@ -29,4 +29,5 @@
|
|||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
-->
|
||||||
</beans>
|
</beans>
|
Reference in New Issue
Block a user