diff --git a/config/alfresco/templates/webscripts/org/alfresco/cmis/atomentry.lib.atom.ftl b/config/alfresco/templates/webscripts/org/alfresco/cmis/atomentry.lib.atom.ftl index e0ee1461d9..cf4c6e7e1d 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/cmis/atomentry.lib.atom.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/cmis/atomentry.lib.atom.ftl @@ -35,6 +35,7 @@ ${xmldate(node.properties.modified)} ${absurl(url.context)}${node.icon16} +${node.nodeRef} [/@entry] [/#macro] @@ -83,6 +84,7 @@ ${xmldate(node.properties.modified)} ${absurl(url.context)}${node.icon16} +${node.nodeRef} [/@entry] [/#macro] @@ -112,6 +114,7 @@ ${xmldate(node.properties.modified)} [#-- TODO: the edit link refers to the updatable node resource, allowing updates on PWCs without checkin --] ${absurl(url.context)}${node.icon16} +${node.nodeRef} [/@entry] [/#macro] @@ -149,6 +152,7 @@ ${xmldate(node.properties.modified)} ${absurl(url.context)}${node.icon16} +${node.nodeRef} [/@entry] [/#macro] @@ -224,6 +228,7 @@ ${absurl(url.context)}${node.icon16} +${node.nodeRef} [/@entry] [/#macro] diff --git a/source/java/org/alfresco/repo/cmis/rest/test/BaseCMISWebScriptTest.java b/source/java/org/alfresco/repo/cmis/rest/test/BaseCMISWebScriptTest.java index 7406421ce2..8f7fc1eb43 100644 --- a/source/java/org/alfresco/repo/cmis/rest/test/BaseCMISWebScriptTest.java +++ b/source/java/org/alfresco/repo/cmis/rest/test/BaseCMISWebScriptTest.java @@ -34,6 +34,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.xml.namespace.QName; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.dom.DOMSource; import javax.xml.validation.Validator; @@ -43,6 +44,7 @@ import junit.framework.Test; import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.repo.cmis.rest.xsd.CMISValidator; import org.alfresco.repo.web.scripts.BaseWebScriptTest; +import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.util.Base64; import org.alfresco.web.scripts.Format; import org.alfresco.web.scripts.TestWebScriptServer.GetRequest; @@ -58,6 +60,7 @@ import org.apache.abdera.ext.cmis.CMISObject; import org.apache.abdera.ext.cmis.CMISRepositoryInfo; import org.apache.abdera.i18n.iri.IRI; import org.apache.abdera.model.Collection; +import org.apache.abdera.model.Element; import org.apache.abdera.model.Entry; import org.apache.abdera.model.Feed; import org.apache.abdera.model.Link; @@ -613,5 +616,20 @@ public class BaseCMISWebScriptTest extends BaseWebScriptTest Entry testFolder = createFolder(childrenLink.getHref(), name + " " + System.currentTimeMillis()); return testFolder; } + + // + // Alfresco specific helpers + // + + protected NodeRef getNodeRef(Entry entry) + { + NodeRef nodeRef = null; + Element element = entry.getFirstChild(new QName("http://www.alfresco.org", "noderef")); + if (element != null) + { + nodeRef = new NodeRef(element.getText()); + } + return nodeRef; + } } diff --git a/source/java/org/alfresco/repo/cmis/rest/test/CMISCustomTypeTest.java b/source/java/org/alfresco/repo/cmis/rest/test/CMISCustomTypeTest.java index 9a15a1d6fc..4857b6b68c 100644 --- a/source/java/org/alfresco/repo/cmis/rest/test/CMISCustomTypeTest.java +++ b/source/java/org/alfresco/repo/cmis/rest/test/CMISCustomTypeTest.java @@ -24,6 +24,21 @@ */ package org.alfresco.repo.cmis.rest.test; +import java.io.Serializable; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.model.FileFolderService; +import org.alfresco.service.cmr.model.FileInfo; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.namespace.QName; +import org.alfresco.web.scripts.TestWebScriptServer.GetRequest; +import org.apache.abdera.i18n.iri.IRI; +import org.apache.abdera.model.Entry; /** @@ -31,25 +46,80 @@ package org.alfresco.repo.cmis.rest.test; * * @author davidc */ -public class CMISCustomTypeTest extends CMISTest +public class CMISCustomTypeTest extends BaseCMISWebScriptTest { + private static String TEST_NAMESPACE = "http://www.alfresco.org/model/aiim"; + @Override protected void setUp() throws Exception { - // Uncomment to change default behaviour of tests + // Uncomment to change default behaviour of tests + setCustomContext("classpath:cmis/cmis-test-context.xml"); setDefaultRunAs("admin"); -// RemoteServer server = new RemoteServer(); -// server.username = "admin"; -// server.password = "admin"; -// setRemoteServer(server); +// RemoteServer server = new RemoteServer(); +// server.username = "admin"; +// server.password = "admin"; +// setRemoteServer(server); // setArgsAsHeaders(false); // setValidateResponse(false); // setListener(new CMISTestListener(System.out)); // setTraceReqRes(true); + +// initServer("classpath:wcm/wcm-jbpm-context.xml"); +// +// this.authenticationService = (AuthenticationService)getServer().getApplicationContext().getBean("AuthenticationService"); +// this.authenticationComponent = (AuthenticationComponent)getServer().getApplicationContext().getBean("authenticationComponent"); +// this.personService = (PersonService)getServer().getApplicationContext().getBean("PersonService"); +// +// this.authenticationComponent.setSystemUserAsCurrentUser(); +// +// // Create users +// createUser(USER_ONE); +// createUser(USER_TWO); +// createUser(USER_THREE); +// createUser(USER_FOUR); +// +// // Do tests as user one +// this.authenticationComponent.setCurrentUser(USER_ONE); +// super.setUp(); } + public void testX() + throws Exception + { + IRI rootHREF = getRootChildrenCollection(getWorkspace(getRepository())); + sendRequest(new GetRequest(rootHREF.toString()), 200, getAtomValidator()); + } + + + public void testCreateSubType() + throws Exception + { + final Entry testFolder = createTestFolder("testCreateSubType"); + final NodeRef testFolderRef = getNodeRef(testFolder); + + // create node + // TODO: For now create item via Alfresco foundation APIs + // When multi-valued props supported, move to pure CMIS Create + AuthenticationUtil.runAs(new RunAsWork() + { + @SuppressWarnings("synthetic-access") + public Object doWork() throws Exception + { + FileFolderService fileFolderService = (FileFolderService)getServer().getApplicationContext().getBean("FileFolderService"); + NodeService nodeService = (NodeService)getServer().getApplicationContext().getBean("NodeService"); + FileInfo file = fileFolderService.create(testFolderRef, "createSubType", QName.createQName(TEST_NAMESPACE, "content")); + Map props = new HashMap(); + props.put(QName.createQName(TEST_NAMESPACE, "Title"), "createSubTypeTitle"); + props.put(QName.createQName(TEST_NAMESPACE, "Authors"), (Serializable)Arrays.asList(new String[] { "Dave", "Fred" })); + nodeService.addProperties(file.getNodeRef(), props); + return null; + } + }, getDefaultRunAs()); + } + } diff --git a/source/java/org/alfresco/repo/cmis/rest/test/CMISWithHeadersTest.java b/source/java/org/alfresco/repo/cmis/rest/test/CMISWithHeadersTest.java index beb855ffe7..d33caf2881 100644 --- a/source/java/org/alfresco/repo/cmis/rest/test/CMISWithHeadersTest.java +++ b/source/java/org/alfresco/repo/cmis/rest/test/CMISWithHeadersTest.java @@ -25,7 +25,6 @@ package org.alfresco.repo.cmis.rest.test; - /** * CMIS API Test Harness * diff --git a/source/java/org/alfresco/repo/cmis/ws/DMAbstractServicePort.java b/source/java/org/alfresco/repo/cmis/ws/DMAbstractServicePort.java index 2ef59e1af4..d240b11fc5 100644 --- a/source/java/org/alfresco/repo/cmis/ws/DMAbstractServicePort.java +++ b/source/java/org/alfresco/repo/cmis/ws/DMAbstractServicePort.java @@ -25,7 +25,9 @@ package org.alfresco.repo.cmis.ws; import java.io.Serializable; +import java.math.BigDecimal; import java.math.BigInteger; +import java.util.Collection; import java.util.Date; import java.util.GregorianCalendar; import java.util.HashMap; @@ -358,67 +360,169 @@ public class DMAbstractServicePort return result; } - private void addBooleanProperty(CmisPropertiesType properties, PropertyFilter filter, String name, Map alfrescoProperties) + protected void addBooleanProperty(CmisPropertiesType properties, PropertyFilter filter, String name, Map alfrescoProperties) { Serializable value = alfrescoProperties.get(name); if (filter.allow(name) && value != null) { - CmisPropertyBoolean propBoolean = new CmisPropertyBoolean (); - propBoolean.setName(PropertyUtil.getCMISPropertyName(name)); - propBoolean.setValue((Boolean) value); - properties.getProperty().add(propBoolean); + if (value instanceof Collection) + { + long index = 0; + for (Object multiValue : (Collection)value) + { + CmisPropertyBoolean propBoolean = new CmisPropertyBoolean (); + propBoolean.setIndex(BigInteger.valueOf(index++)); + propBoolean.setName(PropertyUtil.getCMISPropertyName(name)); + propBoolean.setValue((Boolean) multiValue); + properties.getProperty().add(propBoolean); + } + } + else + { + CmisPropertyBoolean propBoolean = new CmisPropertyBoolean (); + propBoolean.setName(PropertyUtil.getCMISPropertyName(name)); + propBoolean.setValue((Boolean) value); + properties.getProperty().add(propBoolean); + } } } - private void addDateTimeProperty(CmisPropertiesType properties, PropertyFilter filter, String name, Map alfrescoProperties) + protected void addDateTimeProperty(CmisPropertiesType properties, PropertyFilter filter, String name, Map alfrescoProperties) { Serializable value = alfrescoProperties.get(name); if (filter.allow(name) && value != null) { - CmisPropertyDateTime propDateTime = new CmisPropertyDateTime(); - propDateTime.setName(PropertyUtil.getCMISPropertyName(name)); - propDateTime.setValue(convert((Date) value)); - properties.getProperty().add(propDateTime); + if (value instanceof Collection) + { + long index = 0; + for (Object multiValue : (Collection)value) + { + CmisPropertyDateTime propDateTime = new CmisPropertyDateTime(); + propDateTime.setIndex(BigInteger.valueOf(index++)); + propDateTime.setName(PropertyUtil.getCMISPropertyName(name)); + propDateTime.setValue(convert((Date) multiValue)); + properties.getProperty().add(propDateTime); + } + } + else + { + CmisPropertyDateTime propDateTime = new CmisPropertyDateTime(); + propDateTime.setName(PropertyUtil.getCMISPropertyName(name)); + propDateTime.setValue(convert((Date) value)); + properties.getProperty().add(propDateTime); + } } } - private void addIDProperty(CmisPropertiesType properties, PropertyFilter filter, String name, Map alfrescoProperties) + protected void addIDProperty(CmisPropertiesType properties, PropertyFilter filter, String name, Map alfrescoProperties) { Serializable value = alfrescoProperties.get(name); if (filter.allow(name) && value != null) { - CmisPropertyId propID = new CmisPropertyId(); - propID.setName(PropertyUtil.getCMISPropertyName(name)); - propID.setValue(value.toString()); - properties.getProperty().add(propID); + if (value instanceof Collection) + { + long index = 0; + for (Object multiValue : (Collection)value) + { + CmisPropertyId propID = new CmisPropertyId(); + propID.setIndex(BigInteger.valueOf(index++)); + propID.setName(PropertyUtil.getCMISPropertyName(name)); + propID.setValue(multiValue.toString()); + properties.getProperty().add(propID); + } + } + else + { + CmisPropertyId propID = new CmisPropertyId(); + propID.setName(PropertyUtil.getCMISPropertyName(name)); + propID.setValue(value.toString()); + properties.getProperty().add(propID); + } } } - private void addIntegerProperty(CmisPropertiesType properties, PropertyFilter filter, String name, Map alfrescoProperties) + protected void addIntegerProperty(CmisPropertiesType properties, PropertyFilter filter, String name, Map alfrescoProperties) { Serializable value = alfrescoProperties.get(name); if (filter.allow(name) && value != null) { - CmisPropertyInteger propInteger = new CmisPropertyInteger(); - propInteger.setName(PropertyUtil.getCMISPropertyName(name)); - propInteger.setValue(BigInteger.valueOf((Long) value)); - properties.getProperty().add(propInteger); + if (value instanceof Collection) + { + long index = 0; + for (Object multiValue : (Collection)value) + { + CmisPropertyInteger propInteger = new CmisPropertyInteger(); + propInteger.setIndex(BigInteger.valueOf(index++)); + propInteger.setName(PropertyUtil.getCMISPropertyName(name)); + propInteger.setValue(BigInteger.valueOf((Long) multiValue)); + properties.getProperty().add(propInteger); + } + } + else + { + CmisPropertyInteger propInteger = new CmisPropertyInteger(); + propInteger.setName(PropertyUtil.getCMISPropertyName(name)); + propInteger.setValue(BigInteger.valueOf((Long) value)); + properties.getProperty().add(propInteger); + } } } - private void addStringProperty(CmisPropertiesType properties, PropertyFilter filter, String name, Map alfrescoProperties) + protected void addDecimalProperty(CmisPropertiesType properties, PropertyFilter filter, String name, Map alfrescoProperties) { Serializable value = alfrescoProperties.get(name); if (filter.allow(name) && value != null) { - CmisPropertyString propString = new CmisPropertyString(); - propString.setName(PropertyUtil.getCMISPropertyName(name)); - propString.setValue(value.toString()); - properties.getProperty().add(propString); + if (value instanceof Collection) + { + long index = 0; + for (Object multiValue : (Collection)value) + { + CmisPropertyDecimal propDecimal = new CmisPropertyDecimal(); + propDecimal.setIndex(BigInteger.valueOf(index++)); + propDecimal.setName(PropertyUtil.getCMISPropertyName(name)); + propDecimal.setValue(BigDecimal.valueOf((Long) multiValue)); + properties.getProperty().add(propDecimal); + } + } + else + { + CmisPropertyDecimal propDecimal = new CmisPropertyDecimal(); + propDecimal.setName(PropertyUtil.getCMISPropertyName(name)); + propDecimal.setValue(BigDecimal.valueOf((Long) value)); + properties.getProperty().add(propDecimal); + } } } - private void addStringProperty(CmisPropertiesType properties, PropertyFilter filter, String name, String value) + protected void addStringProperty(CmisPropertiesType properties, PropertyFilter filter, String name, Map alfrescoProperties) + { + Serializable value = alfrescoProperties.get(name); + if (filter.allow(name) && value != null) + { + if (value instanceof Collection) + { + long index = 0; + for (Object multiValue : (Collection)value) + { + CmisPropertyString propString = new CmisPropertyString(); + propString.setIndex(BigInteger.valueOf(index++)); + propString.setName(PropertyUtil.getCMISPropertyName(name)); + propString.setValue(multiValue.toString()); + properties.getProperty().add(propString); + } + } + else + { + CmisPropertyString propString = new CmisPropertyString(); + propString.setName(PropertyUtil.getCMISPropertyName(name)); + propString.setValue(value.toString()); + properties.getProperty().add(propString); + } + } + } + + protected void addStringProperty(CmisPropertiesType properties, PropertyFilter filter, String name, String value) { if (filter.allow(name) && value != null) { @@ -429,15 +533,30 @@ public class DMAbstractServicePort } } - private void addURIProperty(CmisPropertiesType properties, PropertyFilter filter, String name, Map alfrescoProperties) + protected void addURIProperty(CmisPropertiesType properties, PropertyFilter filter, String name, Map alfrescoProperties) { Serializable value = alfrescoProperties.get(name); if (filter.allow(name) && value != null) { - CmisPropertyUri propString = new CmisPropertyUri(); - propString.setName(PropertyUtil.getCMISPropertyName(name)); - propString.setValue(value.toString()); - properties.getProperty().add(propString); + if (value instanceof Collection) + { + long index = 0; + for (Object multiValue : (Collection)value) + { + CmisPropertyUri propString = new CmisPropertyUri(); + propString.setIndex(BigInteger.valueOf(index++)); + propString.setName(PropertyUtil.getCMISPropertyName(name)); + propString.setValue(multiValue.toString()); + properties.getProperty().add(propString); + } + } + else + { + CmisPropertyUri propString = new CmisPropertyUri(); + propString.setName(PropertyUtil.getCMISPropertyName(name)); + propString.setValue(value.toString()); + properties.getProperty().add(propString); + } } } diff --git a/source/java/org/alfresco/repo/cmis/ws/DMDiscoveryServicePort.java b/source/java/org/alfresco/repo/cmis/ws/DMDiscoveryServicePort.java index 2f68f98177..8611fe2b54 100755 --- a/source/java/org/alfresco/repo/cmis/ws/DMDiscoveryServicePort.java +++ b/source/java/org/alfresco/repo/cmis/ws/DMDiscoveryServicePort.java @@ -24,8 +24,14 @@ */ package org.alfresco.repo.cmis.ws; +import java.io.Serializable; +import java.util.Map; + +import org.alfresco.cmis.CMISPropertyTypeEnum; import org.alfresco.cmis.search.CMISQueryOptions; import org.alfresco.cmis.search.CMISResultSet; +import org.alfresco.cmis.search.CMISResultSetColumn; +import org.alfresco.cmis.search.CMISResultSetMetaData; import org.alfresco.cmis.search.CMISResultSetRow; import org.alfresco.repo.cmis.PropertyFilter; @@ -67,16 +73,71 @@ public class DMDiscoveryServicePort extends DMAbstractServicePort implements Dis options.setMaxItems(parameters.getPageSize().intValue()); } + // execute query CMISResultSet resultSet = cmisQueryService.query(options); + CMISResultSetMetaData metaData = resultSet.getMetaData(); + CMISResultSetColumn[] columns = metaData.getColumns(); + PropertyFilter filter = new PropertyFilter(); + + // build query response QueryResponse response = new QueryResponse(); - response.setHasMoreItems(resultSet.hasMore()); + + // for each row... for (CMISResultSetRow row : resultSet) { + CmisPropertiesType properties = new CmisPropertiesType(); + Map values = row.getValues(); + + // for each column... + for (CMISResultSetColumn column : columns) + { + CMISPropertyTypeEnum type = column.getPropertyType(); + if (type == CMISPropertyTypeEnum.BOOLEAN) + { + addBooleanProperty(properties, filter, column.getName(), values); + } + else if (type == CMISPropertyTypeEnum.DATETIME) + { + addDateTimeProperty(properties, filter, column.getName(), values); + } + else if (type == CMISPropertyTypeEnum.DECIMAL) + { + addDecimalProperty(properties, filter, column.getName(), values); + } + else if (type == CMISPropertyTypeEnum.ID) + { + addIDProperty(properties, filter, column.getName(), values); + } + else if (type == CMISPropertyTypeEnum.INTEGER) + { + addIntegerProperty(properties, filter, column.getName(), values); + } + else if (type == CMISPropertyTypeEnum.STRING) + { + addStringProperty(properties, filter, column.getName(), values); + } + else if (type == CMISPropertyTypeEnum.URI) + { + addURIProperty(properties, filter, column.getName(), values); + } + else if (type == CMISPropertyTypeEnum.XML) + { + // TODO: + throw new UnsupportedOperationException(); + } + else if (type == CMISPropertyTypeEnum.HTML) + { + // TODO: + throw new UnsupportedOperationException(); + } + } + CmisObjectType object = new CmisObjectType(); - object.setProperties(getPropertiesType(row.getValues(), new PropertyFilter())); + object.setProperties(properties); response.getObject().add(object); } - + + response.setHasMoreItems(resultSet.hasMore()); return response; } diff --git a/source/java/org/alfresco/repo/cmis/ws/PropertyUtil.java b/source/java/org/alfresco/repo/cmis/ws/PropertyUtil.java index 8f1ba00448..f749b766fc 100755 --- a/source/java/org/alfresco/repo/cmis/ws/PropertyUtil.java +++ b/source/java/org/alfresco/repo/cmis/ws/PropertyUtil.java @@ -63,7 +63,7 @@ public class PropertyUtil cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CONTENT_STREAM_FILENAME, new Pair("ContentStreamFilename", true)); cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_VERSION_LABEL, new Pair("VersionLabel", true)); cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CHECKIN_COMMENT, new Pair("checkinComment", false)); - cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CONTENT_STREAM_URI, new Pair("contentStreamURI", true)); + cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CONTENT_STREAM_URI, new Pair("contentStreamUri", true)); cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY, new Pair("VersionSeriesCheckedOutBy", true)); cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_PARENT_ID, new Pair("ParentId", true)); cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CONTENT_STREAM_ALLOWED, new Pair("ContentStreamAllowed", true)); @@ -82,7 +82,9 @@ public class PropertyUtil */ public static String getCMISPropertyName(String internalName) { - return cmisToRepoPropertiesNamesMapping.get(internalName).getFirst(); + return internalName; + // TODO: remove the above mapping + //return cmisToRepoPropertiesNamesMapping.get(internalName).getFirst(); } /** diff --git a/source/java/org/alfresco/repo/web/scripts/BaseWebScriptTest.java b/source/java/org/alfresco/repo/web/scripts/BaseWebScriptTest.java index 2dd8c51622..e215e03db4 100644 --- a/source/java/org/alfresco/repo/web/scripts/BaseWebScriptTest.java +++ b/source/java/org/alfresco/repo/web/scripts/BaseWebScriptTest.java @@ -60,11 +60,16 @@ import org.apache.commons.httpclient.params.HttpClientParams; */ public abstract class BaseWebScriptTest extends TestCase { + // Test Listener private WebScriptTestListener listener = null; private boolean traceReqRes = false; - /** Local / Remote Server access */ + // Local Server access + private static String customContext = null; + private static TestWebScriptServer server = null; + + // Remote Server access private String defaultRunAs = null; private RemoteServer remoteServer = null; private HttpClient httpClient = null; @@ -144,7 +149,17 @@ public abstract class BaseWebScriptTest extends TestCase this.getWriter().println(log); } } - + + + /** + * Sets custom context for Test Web Script Server (in-process only) + * @param customContext + */ + public static void setCustomContext(String customContext) + { + BaseWebScriptTest.customContext = customContext; + } + /** * Sets Test Listener * @@ -186,7 +201,7 @@ public abstract class BaseWebScriptTest extends TestCase } /** - * Set Local Run As User + * Set Default Local Run As User * * @param localRunAs */ @@ -194,7 +209,17 @@ public abstract class BaseWebScriptTest extends TestCase { this.defaultRunAs = localRunAs; } - + + /** + * Get Default Local Run As User + * + * @return localRunAs + */ + public String getDefaultRunAs() + { + return defaultRunAs; + } + @Override protected void setUp() throws Exception { @@ -208,31 +233,22 @@ public abstract class BaseWebScriptTest extends TestCase } } - /** Test web script server */ - private static TestWebScriptServer server = null; - protected static TestWebScriptServer getServer() { if (BaseWebScriptTest.server == null) { - BaseWebScriptTest.server = TestWebScriptRepoServer.getTestServer(); + if (BaseWebScriptTest.customContext == null) + { + BaseWebScriptTest.server = TestWebScriptRepoServer.getTestServer(); + } + else + { + BaseWebScriptTest.server = TestWebScriptRepoServer.getTestServer(customContext); + } } return BaseWebScriptTest.server; } - protected static TestWebScriptServer initServer() - { - return getServer(); - } - - protected static TestWebScriptServer initServer(String appendTestConfigLocation) - { - if (BaseWebScriptTest.server == null) - { - BaseWebScriptTest.server = TestWebScriptRepoServer.getTestServer(appendTestConfigLocation); - } - return BaseWebScriptTest.server; - } /** * Is Log Enabled? diff --git a/source/java/org/alfresco/repo/web/scripts/wcm/sandbox/AssetTest.java b/source/java/org/alfresco/repo/web/scripts/wcm/sandbox/AssetTest.java index 5eb19b58d2..99f3936c19 100644 --- a/source/java/org/alfresco/repo/web/scripts/wcm/sandbox/AssetTest.java +++ b/source/java/org/alfresco/repo/web/scripts/wcm/sandbox/AssetTest.java @@ -85,10 +85,9 @@ public class AssetTest extends BaseWebScriptTest { @Override protected void setUp() throws Exception { + setCustomContext(SUBMIT_CONFIG_LOCATION); super.setUp(); - initServer(SUBMIT_CONFIG_LOCATION); - this.authenticationService = (AuthenticationService)getServer().getApplicationContext().getBean("AuthenticationService"); this.authenticationComponent = (AuthenticationComponent)getServer().getApplicationContext().getBean("authenticationComponent"); this.personService = (PersonService)getServer().getApplicationContext().getBean("PersonService"); diff --git a/source/test-resources/cmis/cmis-test-context.xml b/source/test-resources/cmis/cmis-test-context.xml new file mode 100644 index 0000000000..bfb3ede03e --- /dev/null +++ b/source/test-resources/cmis/cmis-test-context.xml @@ -0,0 +1,14 @@ + + + + + + + + + cmis/cmisCustomModel.xml + + + + + \ No newline at end of file diff --git a/source/test-resources/cmis/cmisCustomModel.xml b/source/test-resources/cmis/cmisCustomModel.xml new file mode 100644 index 0000000000..087c5572dd --- /dev/null +++ b/source/test-resources/cmis/cmisCustomModel.xml @@ -0,0 +1,292 @@ + + + + + AIIM Content Model + Dr. Q + 1.0 + + + + + + + + + + + + + + + 0 + 100 + + + + 0 + 100 + + + + 0 + 25 + + + + 0 + 50 + + + + 0 + 25 + + + + 0 + 60 + + + + 0 + 40 + + + + 0 + 30 + + + + 0 + 25 + + + + + + Business Process Management (BPM) + Content/Knowledge Organization + Digital Asset Management (DAM) + Document Management + Email Archiving + Findability/Information Organization and Access (IOA) + Records Management + Web Content Management (WCM) + Other + + + true + + + + + + Disaster Recovery + Green Computing + Imaging + Security + Service Oriented Architecture(SOA) + Software as a Service(SaaS) + Standards + Usability + Other + + + true + + + + + + Energy + Financial Services + Federal Government + Health Services + Email Archiving + Manufacturing + State and Local Government + Other + + + true + + + + + + Planning + Requirements + Design + Development + Deployment + Ongoing Maintenance + N/A + + + true + + + + + + AIIM Content + cm:content + + aiim:properties + + + + + + + AIIM Properties + + + AIIM Title + d:text + true + + false + false + true + + + + + + + AIIM Sub Title + d:text + false + + false + false + true + + + + + + + AIIM Authors + d:text + false + true + + false + false + true + + + + + + + AIIM Publication Date + d:date + true + + false + false + true + + + + AIIM Keywords + d:text + false + true + + false + false + true + + + + + + + AIIM Source Rep + d:text + true + Alfresco + + false + false + true + + + + + + + AIIM Info Man Topic + d:text + false + true + Other + + false + false + true + + + + + + + + AIIM IT Topic + d:text + false + true + Other + + false + false + true + + + + + + + + AIIM Industry + d:text + false + true + Other + + false + false + true + + + + + + + + AIIM Life Cycle Stage + d:text + false + true + N/A + + false + false + true + + + + + + + + + + + \ No newline at end of file diff --git a/source/test/java/org/alfresco/repo/cmis/ws/DMDiscoveryServiceTest.java b/source/test/java/org/alfresco/repo/cmis/ws/DMDiscoveryServiceTest.java index 79dab002b4..36c2eeaecc 100755 --- a/source/test/java/org/alfresco/repo/cmis/ws/DMDiscoveryServiceTest.java +++ b/source/test/java/org/alfresco/repo/cmis/ws/DMDiscoveryServiceTest.java @@ -35,7 +35,7 @@ public class DMDiscoveryServiceTest extends AbstractServiceTest public final static String SERVICE_WSDL_LOCATION = CmisServiceTestHelper.ALFRESCO_URL + "/cmis/DiscoveryService?wsdl"; public final static QName SERVICE_NAME = new QName("http://www.cmis.org/ns/1.0", "DiscoveryService"); - public final static String STATEMENT = "SELECT * FROM DOCUMENT"; + public final static String STATEMENT = "SELECT * FROM aiim_content"; public DMDiscoveryServiceTest() {