Merge from SEAMIST3

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10734 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2008-09-04 11:24:01 +00:00
parent d2619d5ea9
commit 385ea356c4
27 changed files with 526 additions and 187 deletions

View File

@@ -18,12 +18,12 @@
<jaxws:outInterceptors>
<ref local="saajOutInterceptor" />
<ref local="wss4jOutInterceptor" />
<!-- <ref local="wss4jOutInterceptor" /> -->
</jaxws:outInterceptors>
<jaxws:outFaultInterceptors>
<ref local="saajOutInterceptor" />
<ref local="wss4jOutInterceptor" />
<!-- <ref local="wss4jOutInterceptor" /> -->
</jaxws:outFaultInterceptors>
<jaxws:properties>
@@ -44,12 +44,12 @@
<jaxws:outInterceptors>
<ref local="saajOutInterceptor" />
<ref local="wss4jOutInterceptor" />
<!-- <ref local="wss4jOutInterceptor" /> -->
</jaxws:outInterceptors>
<jaxws:outFaultInterceptors>
<ref local="saajOutInterceptor" />
<ref local="wss4jOutInterceptor" />
<!-- <ref local="wss4jOutInterceptor" /> -->
</jaxws:outFaultInterceptors>
<jaxws:properties>
@@ -70,12 +70,12 @@
<jaxws:outInterceptors>
<ref local="saajOutInterceptor" />
<ref local="wss4jOutInterceptor" />
<!-- <ref local="wss4jOutInterceptor" /> -->
</jaxws:outInterceptors>
<jaxws:outFaultInterceptors>
<ref local="saajOutInterceptor" />
<ref local="wss4jOutInterceptor" />
<!-- <ref local="wss4jOutInterceptor" /> -->
</jaxws:outFaultInterceptors>
<jaxws:properties>

View File

@@ -4,14 +4,21 @@
[#-- ATOM Entry for Document --]
[#-- --]
[#macro contentLink node]
${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}/content.${node.properties.name}
[/#macro]
[#macro document node propfilter="*"]
<author><name>${node.properties.creator!""}</name></author>
<content type="${node.mimetype}" src="${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}/content"/>
<content type="${node.mimetype}" src="[@contentLink node/]"/>
<id>urn:uuid:${node.id}</id>
<link rel="self" href="${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}"/>
<link rel="enclosure" href="${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}/content" type="${node.mimetype}"/>
<link rel="enclosure" href="[@contentLink node/]" type="${node.mimetype}"/>
<link rel="edit" href="${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}"/>
<link rel="edit-media" href="${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}/content" type="${node.mimetype}"/>
<link rel="edit-media" href="[@contentLink node/]" type="${node.mimetype}"/>
[@documentCMISLinks node=node/]
<published>${xmldate(node.properties.created)}</published>
<summary>${node.properties.description!node.properties.title!cropContent(node, 50)}</summary>
@@ -27,7 +34,7 @@
<link rel="cmis-relationships" href="${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}/associations"/>
<link rel="cmis-parents" href="${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}/parents"/>
<link rel="cmis-allversions" href="${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}/versions"/>
<link rel="cmis-stream" href="${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}/content" type="${node.mimetype}"/>
<link rel="cmis-stream" href="[@contentLink node/]" type="${node.mimetype}"/>
<link rel="cmis-type" href="${absurl(url.serviceContext)}/api/type/${cmistypeid(node)}"/>
[/#macro]
@@ -54,7 +61,7 @@
[@filter propfilter "VERSION_LABEL"][@prop "versionLabel" cmisproperty(node, "VERSION_LABEL")!"" "String"/][/@filter]
[@filter propfilter "VERSION_SERIES_CHECKED_OUT_BY"][@prop "versionSeriesCheckedOutBy" cmisproperty(node, "VERSION_SERIES_CHECKED_OUT_BY")!"" "String"/][/@filter]
[@filter propfilter "CHECKIN_COMMENT"][@prop "checkinComment" cmisproperty(node, "CHECKIN_COMMENT")!"" "String"/][/@filter]
[@filter propfilter "CONTENT_STREAM_URI"][@prop "contentStreamURI" absurl(url.serviceContext) + "/api/node/" + node.nodeRef.storeRef.protocol + "/" + node.nodeRef.storeRef.identifier + "/" + node.nodeRef.id + "/content" "String"/][/@filter]
[@filter propfilter "CONTENT_STREAM_URI"][@prop "contentStreamURI" absurl(url.serviceContext) + "/api/node/" + node.nodeRef.storeRef.protocol + "/" + node.nodeRef.storeRef.identifier + "/" + node.nodeRef.id + "/content." + node.properties.name "String"/][/@filter]
</cmis:properties>
[/#macro]
@@ -65,10 +72,10 @@
[#macro version node version propfilter="*"]
<author><name>${node.properties.creator}</name></author>
<content type="${node.mimetype}" src="${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}/content"/>
<content type="${node.mimetype}" src="[@contentLink node/]"/>
<id>urn:uuid:${node.id}</id>
<link rel="self" href="${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}"/>
<link rel="enclosure" href="${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}/content" type="${node.mimetype}"/>
<link rel="enclosure" href="[@contentLink node/]" type="${node.mimetype}"/>
[@documentCMISLinks node=node/]
<published>${xmldate(node.properties.created)}</published>
<summary>${node.properties.description!node.properties.title!cropContent(node.properties.content, 50)}</summary>
@@ -86,12 +93,12 @@
[#macro pwc node propfilter="*"]
<author><name>${node.properties.creator}</name></author>
<content type="${node.mimetype}" src="${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}/content"/>
<content type="${node.mimetype}" src="[@contentLink node/]"/>
<id>urn:uuid:${node.id}</id>
<link rel="self" href="${absurl(url.serviceContext)}/api/pwc/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}"/>
<link rel="enclosure" href="${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}/content" type="${node.mimetype}"/>
<link rel="enclosure" href="[@contentLink node/]" type="${node.mimetype}"/>
<link rel="edit" href="${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}"/>
<link rel="edit-media" href="${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}/content" type="${node.mimetype}"/>
<link rel="edit-media" href="[@contentLink node/]" type="${node.mimetype}"/>
[@documentCMISLinks node=node/]
<published>${xmldate(node.properties.created)}</published>
<summary>${node.properties.description!node.properties.title!cropContent(node.properties.content, 50)}</summary>
@@ -160,21 +167,33 @@
[#if row.nodes??]
[#assign node = row.nodes?first]
<author><name>${node.properties.creator!""}</name></author>
<content type="${node.mimetype}" src="${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}/content"/>
<content type="${node.mimetype}" src="[@contentLink node/]"/>
<id>urn:uuid:${node.id}</id>
<link rel="self" href="${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}"/>
<title>${node.name}</title>
<updated>${xmldate(node.properties.modified)}</updated>
[/#if]
[#assign values = row.values]
[#if values?size &gt; 0]
<cmis:properties>
[#-- TODO: spec issue: baseType to become formal property --]
[#if node??]
[#if node.isDocument]
[@prop "baseType" "document" "String"/]
[#else]
[@prop "baseType" "folder" "String"/]
[/#if]
[/#if]
[#assign values = row.values]
[#list values?keys as colname]
[#assign coltype = row.getColumnType(colname)]
[#if values[colname]??]
[@prop colname values[colname] coltype/]
[#else]
[@propnull colname coltype/]
[/#if]
[/#list]
</cmis:properties>
[/#if]
[#-- TODO: custom ns <alf:icon>${absurl(url.context)}${node.icon16}</alf:icon> --]
[/#macro]
@@ -235,7 +254,7 @@
[#macro propdefCMISProps propdef]
<cmis:property cmis:id="${propdef.propertyId}">
<cmis:propertyName>${propdef.propertyName}</cmis:propertyName>
<cmis:propertyName>${propdef.propertyNameREST}</cmis:propertyName>
<cmis:propertyId>${propdef.propertyId}</cmis:propertyId>
<cmis:displayName>[#if propdef.displayName??]${propdef.displayName?xml}[/#if]</cmis:displayName>
<cmis:description>[#if propdef.description??]${propdef.description?xml}[/#if]</cmis:description>
@@ -283,6 +302,24 @@
[/#if]
[/#macro]
[#macro propnull name type]
[#if type == "String"]
<cmis:propertyString cmis:name="${name}"></cmis:propertyString>
[#elseif type == "Integer"]
<cmis:propertyInteger cmis:name="${name}"></cmis:propertyInteger>
[#elseif type == "Decimal"]
<cmis:propertyDecimal cmis:name="${name}"></cmis:propertyDecimal>
[#elseif type == "Boolean"]
<cmis:propertyBoolean cmis:name="${name}"></cmis:propertyBoolean>
[#elseif type == "DateTime"]
<cmis:propertyDateTime cmis:name="${name}"></cmis:propertyDateTime>
[#elseif type == "URI"]
<cmis:propertyURI cmis:name="${name}"></cmis:propertyString>
[#elseif type == "ID"]
<cmis:propertyID cmis:name="${name}"/>
[#-- TODO: remaining property types --]
[/#if]
[/#macro]
[#-- TODO: spec issue 40 --]
[#macro cmisBaseType rootType]

View File

@@ -3,17 +3,30 @@ script:
// process query statement
// <?xml version="1.0"?>
// <query xmlns="http://www.cmis.org/CMIS/2008/05">
// <statement>object_id1</statement >
// <statement>SELECT name FROM DOCUMENT_OBJECT_TYPE</statement>
// <searchAllVersions>false</searchAllVersions>
// <pageSize>0</pageSize>
// <skipCount>0</skipCount>
// <returnAllowableActions>false</returnAllowableActions>
// </query>
// XML parsing need to be moved to Java
function ltrim(str){
return str.replace(/^\s+/, '');
}
default xml namespace = 'http://www.cmis.org/2008/05';
var cmisQuery = new XML(query);
// regex to match an XML declaration
var xmlDeclaration = /^<\?xml version[^>]+?>/;
// remove xml declaration and leading whitespace
query = ltrim(query.replace(xmlDeclaration, ''));
// need to move the XML declaration if it exists
var cmisQuery = new XML(query);
// extract query statement
model.statement = cmisQuery.statement.toString();
if (model.statement == null || model.statement.length == 0)

View File

@@ -0,0 +1,89 @@
script:
{
// ensure atom entry is posted
if (entry === null)
{
status.code = 400;
status.message = "Expected atom entry";
status.redirect = true;
break script;
}
// locate parent node
var pathSegments = url.match.split("/");
var reference = [ url.templateArgs.store_type, url.templateArgs.store_id ].concat(url.templateArgs.id.split("/"));
model.parent = cmis.findNode(pathSegments[2], reference);
if (model.parent === null)
{
status.code = 404;
status.message = "Repository " + pathSegments[2] + " " + reference.join("/") + " not found";
status.redirect = true;
break script;
}
// pull apart atom entry
// TODO: creation of file/folder sub-types
// TODO: cmis properties
var id = entry.id;
var name = (slug !== null) ? slug : entry.title;
var title = entry.title;
var description = entry.summary;
var updated = entry.updated;
var author = (entry.author !== null) ? entry.author.name : null;
var cmisProperties = entry.getExtension(atom.names.cmis_properties);
var objectType = (cmisProperties !== null) ? cmisProperties.objectType : null;
// create the item
// TODO: author/updated/id
if (objectType === null || objectType.toLowerCase() == "document")
{
// TODO: objectTypeId to Alfresco content type
var node = model.parent.createFile(name);
node.properties.title = title;
node.properties.description = description;
// write entry content
if (entry.content != null)
{
if (entry.contentType !== null && entry.contentType == "MEDIA")
{
node.properties.content.write(entry.contentStream);
}
else
{
node.content = entry.content;
}
node.properties.content.encoding = "UTF-8";
node.properties.content.mimetype = atom.toMimeType(entry);
}
node.save();
model.node = node;
// TODO: versioningState argument (CheckedOut/CheckedInMinor/CheckedInMajor)
}
else if (objectType.toLowerCase() == "folder")
{
// TODO: objectTypeId to Alfresco content type
var node = model.parent.createFolder(name);
node.properties.title = title;
node.properties.description = description;
node.save();
model.node = node;
}
else
{
status.code = 400;
status.message = "CMIS object type " + objectType + " not understood";
status.redirect = true;
break script;
}
// setup for 201 Created response
// TODO: set Content-Location
status.code = 201;
status.location = url.server + url.serviceContext + "/api/node/" + node.nodeRef.storeRef.protocol + "/" + node.nodeRef.storeRef.identifier + "/" + node.nodeRef.id;
status.redirect = true;
}

View File

@@ -0,0 +1,30 @@
[#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
[#import "/org/alfresco/cmis/atomfeed.lib.atom.ftl" as feedLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#import "/org/alfresco/paging.lib.atom.ftl" as pagingLib/]
[#compress]
<?xml version="1.0" encoding="UTF-8"?>
<feed [@nsLib.feedNS/]>
[@feedLib.node node]
[@pagingLib.links cursor/]
[/@feedLib.node]
[#list results as child]
<entry>
[#if child.isDocument]
[@entryLib.document child filter/]
[#else]
[@entryLib.folder child filter/]
[/#if]
</entry>
[/#list]
[@feedLib.hasMore cursor/]
[@pagingLib.opensearch cursor/]
</feed>
[/#compress]

View File

@@ -0,0 +1,9 @@
<webscript>
<shortname>Retrieve tree of descendants</shortname>
<description>Retrieve descendants</description>
<url>/api/node/{store_type}/{store_id}/{id}/descendants?types={types}&amp;filter={filter?}&amp;depth={depth?}</url>
<url>/api/path/{store_type}/{store_id}/{id}/descendants?types={types}&amp;filter={filter?}&amp;depth={depth?}</url>
<authentication>guest</authentication>
<format default="atomfeed">argument</format>
<family>CMIS</family>
</webscript>

View File

@@ -0,0 +1,37 @@
script:
{
// locate node
var pathSegments = url.match.split("/");
var reference = [ url.templateArgs.store_type, url.templateArgs.store_id ].concat(url.templateArgs.id.split("/"));
model.node = cmis.findNode(pathSegments[2], reference);
if (model.node === null)
{
status.code = 404;
status.message = "Repository " + pathSegments[2] + " " + reference.join("/") + " not found";
status.redirect = true;
break script;
}
// handle filters
model.types = cmis.findArg(args.types, headers["CMIS-types"]) === null ? cmis.defaultTypesFilter : cmis.findArg(args.types, headers["CMIS-types"]);
if (!cmis.isValidTypesFilter(model.types))
{
status.code = 400;
status.message = "Types filter '" + model.types + "' unknown";
status.redirect = true;
break script;
}
// property filter
model.filter = cmis.findArg(args.filter, headers["CMIS-filter"]);
if (model.filter === null)
{
model.filter = "*";
}
// TODO: retrieve descendants instead
// retrieve children
var page = paging.createPageOrWindow(args, headers);
var paged = cmis.queryChildren(model.node, model.types, page);
model.results = paged.results;
model.cursor = paged.cursor;
}

View File

@@ -0,0 +1,91 @@
// TODO: consolidate with children.post.atomentry.js
script:
{
// ensure atom entry is posted
if (entry === null)
{
status.code = 400;
status.message = "Expected atom entry";
status.redirect = true;
break script;
}
// locate parent node
var pathSegments = url.match.split("/");
var reference = [ url.templateArgs.store_type, url.templateArgs.store_id ].concat(url.templateArgs.id.split("/"));
model.parent = cmis.findNode(pathSegments[2], reference);
if (model.parent === null)
{
status.code = 404;
status.message = "Repository " + pathSegments[2] + " " + reference.join("/") + " not found";
status.redirect = true;
break script;
}
// pull apart atom entry
// TODO: creation of file/folder sub-types
// TODO: cmis properties
var id = entry.id;
var name = (slug !== null) ? slug : entry.title;
var title = entry.title;
var description = entry.summary;
var updated = entry.updated;
var author = (entry.author !== null) ? entry.author.name : null;
var cmisProperties = entry.getExtension(atom.names.cmis_properties);
var objectType = (cmisProperties !== null) ? cmisProperties.objectType : null;
// create the item
// TODO: author/updated/id
if (objectType === null || objectType.toLowerCase() == "document")
{
// TODO: objectTypeId to Alfresco content type
var node = model.parent.createFile(name);
node.properties.title = title;
node.properties.description = description;
// write entry content
if (entry.content != null)
{
if (entry.contentType !== null && entry.contentType == "MEDIA")
{
node.properties.content.write(entry.contentStream);
}
else
{
node.content = entry.content;
}
node.properties.content.encoding = "UTF-8";
node.properties.content.mimetype = atom.toMimeType(entry);
}
node.save();
model.node = node;
// TODO: versioningState argument (CheckedOut/CheckedInMinor/CheckedInMajor)
}
else if (objectType.toLowerCase() == "folder")
{
// TODO: objectTypeId to Alfresco content type
var node = model.parent.createFolder(name);
node.properties.title = title;
node.properties.description = description;
node.save();
model.node = node;
}
else
{
status.code = 400;
status.message = "CMIS object type " + objectType + " not understood";
status.redirect = true;
break script;
}
// setup for 201 Created response
// TODO: set Content-Location
status.code = 201;
status.location = url.server + url.serviceContext + "/api/node/" + node.nodeRef.storeRef.protocol + "/" + node.nodeRef.storeRef.identifier + "/" + node.nodeRef.id;
status.redirect = true;
}

View File

@@ -0,0 +1,16 @@
[#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress]
<?xml version="1.0" encoding="UTF-8"?>
<entry [@nsLib.entryNS/]>
[#if node.isDocument]
[@entryLib.document node=node/]
[#else]
[@entryLib.folder node=node/]
[/#if]
</entry>
[/#compress]

View File

@@ -0,0 +1,9 @@
<webscript>
<shortname>Create folder or document</shortname>
<description></description>
<url>/api/node/{store_type}/{store_id}/{id}/descendants</url>
<url>/api/path/{store_type}/{store_id}/{id}/descendants</url>
<authentication>user</authentication>
<format default="atomentry"/>
<family>CMIS</family>
</webscript>

View File

@@ -0,0 +1,9 @@
script:
{
// TODO: Handle direct posting of media
status.code = 400;
status.message = "Posting of media resource not supported";
status.redirect = true;
break script;
}

View File

@@ -46,18 +46,13 @@ script:
var content = entry.content;
if (content !== null)
{
if (!model.node.isDocument)
if (model.node.isDocument)
{
status.code = 400;
status.message = "Cannot update content on folder " + pathSegments[2] + " " + reference.join("/");
status.redirect = true;
break script;
model.node.content = content;
model.node.properties.content.encoding = "UTF-8";
model.node.properties.content.mimetype = atom.toMimeType(entry);
updated = true;
}
model.node.content = content;
model.node.properties.content.encoding = "UTF-8";
model.node.properties.content.mimetype = atom.toMimeType(entry);
updated = true;
}
// only save if an update actually occurred

View File

@@ -55,6 +55,7 @@ public class BaseCMISWebScriptTest extends BaseWebScriptTest
{
private CMISValidator cmisValidator = new CMISValidator();
private boolean argsAsHeaders = false;
private boolean validateResponse = true;
/**
* Pass URL arguments as headers
@@ -65,7 +66,17 @@ public class BaseCMISWebScriptTest extends BaseWebScriptTest
{
this.argsAsHeaders = argsAsHeaders;
}
/**
* Validate Response
*
* @param validateResponse
*/
protected void setValidateResponse(boolean validateResponse)
{
this.validateResponse = validateResponse;
}
/**
* Determines if URL arguments are passed as headers
*
@@ -125,14 +136,17 @@ public class BaseCMISWebScriptTest extends BaseWebScriptTest
protected void assertValidXML(String xml, Validator validator)
throws IOException, ParserConfigurationException
{
try
if (validateResponse)
{
Document document = cmisValidator.getDocumentBuilder().parse(new InputSource(new StringReader(xml)));
validator.validate(new DOMSource(document));
}
catch (SAXException e)
{
fail(cmisValidator.toString(e, xml));
try
{
Document document = cmisValidator.getDocumentBuilder().parse(new InputSource(new StringReader(xml)));
validator.validate(new DOMSource(document));
}
catch (SAXException e)
{
fail(cmisValidator.toString(e, xml));
}
}
}

View File

@@ -27,6 +27,7 @@ package org.alfresco.repo.cmis.rest;
import java.io.StringReader;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -63,31 +64,27 @@ import org.apache.commons.logging.LogFactory;
*/
public class CMISTest extends BaseCMISWebScriptTest
{
// test context
protected static boolean remote = false;
// Alfresco
protected static String repositoryUrl = "http://localhost:8080/alfresco/service/api/repository";
protected static boolean validateResponse = true;
protected static String username = "admin";
protected static String password = "admin";
protected static boolean argsAsHeaders = false;
// Logger
private static final Log logger = LogFactory.getLog(CMISTest.class);
private AbderaService abdera;
// test context
private String repositoryUrl = "http://localhost:8080/alfresco/service/api/repository";
// cached responses
private AbderaService abdera;
private static Service service = null;
private static String fulltextCapability = null;
private static Entry testsFolder = null;
private static Entry testRunFolder = null;
/**
* Sets the Repository "service" URL
*
* @param repositoryUrl repository service url
*/
public void setRepositoryUrl(String repositoryUrl)
{
this.repositoryUrl = repositoryUrl;
}
@Override
protected void setUp()
@@ -99,8 +96,21 @@ public class CMISTest extends BaseCMISWebScriptTest
abderaImpl.registerExtensionFactory(new CMISExtensionFactory());
abdera = abderaImpl;
// setup user
setDefaultRunAs("admin");
if (remote)
{
RemoteServer server = new RemoteServer();
server.username = username;
server.password = password;
setRemoteServer(server);
}
else
{
// setup user
setDefaultRunAs("admin");
}
setArgsAsHeaders(argsAsHeaders);
setValidateResponse(validateResponse);
super.setUp();
@@ -120,7 +130,7 @@ public class CMISTest extends BaseCMISWebScriptTest
service = abdera.parseService(new StringReader(xml), null);
assertNotNull(service);
Workspace workspace = service.getWorkspaces().get(0);
Workspace workspace = getWorkspace(service);
CMISRepositoryInfo repoInfo = workspace.getExtension(CMISConstants.REPOSITORY_INFO);
assertNotNull(repoInfo);
CMISCapabilities capabilities = repoInfo.getCapabilities();
@@ -131,36 +141,55 @@ public class CMISTest extends BaseCMISWebScriptTest
return service;
}
private IRI getRootCollection(Service service)
private Workspace getWorkspace(Service service)
{
Collection root = service.getCollection("Main Repository", "root collection");
return service.getWorkspaces().get(0);
}
private Collection getCMISCollection(Workspace workspace, String collectionId)
{
List<Collection> collections = workspace.getCollections();
for (Collection collection : collections)
{
String id = collection.getAttributeValue(CMISConstants.COLLECTION_TYPE);
if (id != null && id.equals(collectionId))
{
return collection;
}
}
return null;
}
private IRI getRootCollection(Workspace workspace)
{
Collection root = getCMISCollection(workspace, "root");
assertNotNull(root);
IRI rootHREF = root.getHref();
assertNotNull(rootHREF);
return rootHREF;
}
private IRI getCheckedOutCollection(Service service)
private IRI getCheckedOutCollection(Workspace workspace)
{
Collection root = service.getCollection("Main Repository", "checkedout collection");
Collection root = getCMISCollection(workspace, "checkedout");
assertNotNull(root);
IRI rootHREF = root.getHref();
assertNotNull(rootHREF);
return rootHREF;
}
private IRI getTypesCollection(Service service)
private IRI getTypesCollection(Workspace workspace)
{
Collection root = service.getCollection("Main Repository", "type collection");
Collection root = getCMISCollection(workspace, "types");
assertNotNull(root);
IRI rootHREF = root.getHref();
assertNotNull(rootHREF);
return rootHREF;
}
private IRI getQueryCollection(Service service)
private IRI getQueryCollection(Workspace workspace)
{
Collection root = service.getCollection("Main Repository", "query collection");
Collection root = getCMISCollection(workspace, "query");
assertNotNull(root);
IRI rootHREF = root.getHref();
assertNotNull(rootHREF);
@@ -241,7 +270,7 @@ public class CMISTest extends BaseCMISWebScriptTest
if (testRunFolder == null)
{
Service service = getRepository();
IRI rootFolderHREF = getRootCollection(service);
IRI rootFolderHREF = getRootCollection(getWorkspace(service));
testsFolder = createTestsFolder(rootFolderHREF);
Link testsChildrenLink = testsFolder.getLink(CMISConstants.REL_CHILDREN);
testRunFolder = createFolder(testsChildrenLink.getHref(), "Test Run " + System.currentTimeMillis());
@@ -293,7 +322,7 @@ public class CMISTest extends BaseCMISWebScriptTest
public void testRepository()
throws Exception
{
IRI rootHREF = getRootCollection(getRepository());
IRI rootHREF = getRootCollection(getWorkspace(getRepository()));
sendRequest(new GetRequest(rootHREF.toString()), 200, getAtomValidator());
}
@@ -316,7 +345,22 @@ public class CMISTest extends BaseCMISWebScriptTest
Entry entry = feedFolderAfter.getEntry(document.getId().toString());
assertNotNull(entry);
}
public void testCreateDocument2()
throws Exception
{
Entry testFolder = createTestFolder("testCreateDocument2");
Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN);
assertNotNull(childrenLink);
String createFile = loadString("/cmis/rest/createdocument2.atomentry.xml");
Response res = sendRequest(new PostRequest(childrenLink.getHref().toString(), createFile, Format.ATOM.mimetype()), 201, getAtomValidator());
String xml = res.getContentAsString();
Entry entry = abdera.parseEntry(new StringReader(xml), null);
Response documentContentRes = sendRequest(new GetRequest(entry.getContentSrc().toString()), 200);
String resContent = documentContentRes.getContentAsString();
assertEquals("1", resContent);
}
public void testCreateDocumentBase64()
throws Exception
{
@@ -400,7 +444,7 @@ public class CMISTest extends BaseCMISWebScriptTest
assertNotNull(documentRes);
String documentXML = documentRes.getContentAsString();
assertNotNull(documentXML);
IRI checkedoutHREF = getCheckedOutCollection(getRepository());
IRI checkedoutHREF = getCheckedOutCollection(getWorkspace(getRepository()));
Response pwcRes = sendRequest(new PostRequest(checkedoutHREF.toString(), documentXML, Format.ATOMENTRY.mimetype()), 201, getAtomValidator());
assertNotNull(pwcRes);
Entry pwc = abdera.parseEntry(new StringReader(pwcRes.getContentAsString()), null);
@@ -529,7 +573,7 @@ public class CMISTest extends BaseCMISWebScriptTest
assertNotNull(parentsToRoot.getEntries().get(1).getLink(CMISConstants.REL_PARENT));
assertEquals(testsFolder.getId(), parentsToRoot.getEntries().get(2).getId());
assertNotNull(parentsToRoot.getEntries().get(2).getLink(CMISConstants.REL_PARENT));
Feed root = getFeed(getRootCollection(getRepository()));
Feed root = getFeed(getRootCollection(getWorkspace(getRepository())));
assertEquals(root.getId(), parentsToRoot.getEntries().get(3).getId());
assertNull(parentsToRoot.getEntries().get(3).getLink(CMISConstants.REL_PARENT));
}
@@ -563,7 +607,7 @@ public class CMISTest extends BaseCMISWebScriptTest
assertNotNull(parentsToRoot.getEntries().get(1).getLink(CMISConstants.REL_PARENT));
assertEquals(testsFolder.getId(), parentsToRoot.getEntries().get(2).getId());
assertNotNull(parentsToRoot.getEntries().get(2).getLink(CMISConstants.REL_PARENT));
Feed root = getFeed(getRootCollection(getRepository()));
Feed root = getFeed(getRootCollection(getWorkspace(getRepository())));
assertEquals(root.getId(), parentsToRoot.getEntries().get(3).getId());
assertNull(parentsToRoot.getEntries().get(3).getLink(CMISConstants.REL_PARENT));
}
@@ -640,7 +684,7 @@ public class CMISTest extends BaseCMISWebScriptTest
// retrieve checkouts within scope of test checkout folder
Service repository = getRepository();
assertNotNull(repository);
IRI checkedoutHREF = getCheckedOutCollection(getRepository());
IRI checkedoutHREF = getCheckedOutCollection(getWorkspace(getRepository()));
Map<String, String> args = new HashMap<String, String>();
args.put("folderId", scopeId);
Feed checkedout = getFeed(new IRI(checkedoutHREF.toString()), args);
@@ -664,7 +708,7 @@ public class CMISTest extends BaseCMISWebScriptTest
assertNotNull(documentXML);
// checkout
IRI checkedoutHREF = getCheckedOutCollection(getRepository());
IRI checkedoutHREF = getCheckedOutCollection(getWorkspace(getRepository()));
Response pwcRes = sendRequest(new PostRequest(checkedoutHREF.toString(), documentXML, Format.ATOMENTRY.mimetype()), 201, getAtomValidator());
assertNotNull(pwcRes);
String pwcXml = pwcRes.getContentAsString();
@@ -703,7 +747,7 @@ public class CMISTest extends BaseCMISWebScriptTest
assertNotNull(xml);
// checkout
IRI checkedoutHREF = getCheckedOutCollection(getRepository());
IRI checkedoutHREF = getCheckedOutCollection(getWorkspace(getRepository()));
Response pwcRes = sendRequest(new PostRequest(checkedoutHREF.toString(), xml, Format.ATOMENTRY.mimetype()), 201, getAtomValidator());
assertNotNull(pwcRes);
String pwcXml = pwcRes.getContentAsString();
@@ -748,7 +792,7 @@ public class CMISTest extends BaseCMISWebScriptTest
assertNotNull(xml);
// checkout
IRI checkedoutHREF = getCheckedOutCollection(getRepository());
IRI checkedoutHREF = getCheckedOutCollection(getWorkspace(getRepository()));
Response pwcRes = sendRequest(new PostRequest(checkedoutHREF.toString(), xml, Format.ATOMENTRY.mimetype()), 201, getAtomValidator());
assertNotNull(pwcRes);
Entry pwc = abdera.parseEntry(new StringReader(pwcRes.getContentAsString()), null);
@@ -841,7 +885,7 @@ public class CMISTest extends BaseCMISWebScriptTest
assertNotNull(xml);
// checkout
IRI checkedoutHREF = getCheckedOutCollection(getRepository());
IRI checkedoutHREF = getCheckedOutCollection(getWorkspace(getRepository()));
Response pwcRes = sendRequest(new PostRequest(checkedoutHREF.toString(), xml, Format.ATOMENTRY.mimetype()), 201, getAtomValidator());
assertNotNull(pwcRes);
Entry pwc = abdera.parseEntry(new StringReader(pwcRes.getContentAsString()), null);
@@ -903,7 +947,7 @@ public class CMISTest extends BaseCMISWebScriptTest
String xml = documentRes.getContentAsString();
assertNotNull(xml);
IRI checkedoutHREF = getCheckedOutCollection(getRepository());
IRI checkedoutHREF = getCheckedOutCollection(getWorkspace(getRepository()));
for (int i = 0; i < NUMBER_OF_VERSIONS; i++)
{
// checkout
@@ -948,7 +992,7 @@ public class CMISTest extends BaseCMISWebScriptTest
public void testGetAllTypeDefinitions()
throws Exception
{
IRI typesHREF = getTypesCollection(getRepository());
IRI typesHREF = getTypesCollection(getWorkspace(getRepository()));
Feed types = getFeed(typesHREF);
assertNotNull(types);
Feed typesWithProps = getFeed(typesHREF);
@@ -966,7 +1010,7 @@ public class CMISTest extends BaseCMISWebScriptTest
public void testGetHierarchyTypeDefinitions()
throws Exception
{
IRI typesHREF = getTypesCollection(getRepository());
IRI typesHREF = getTypesCollection(getWorkspace(getRepository()));
Map<String, String> args = new HashMap<String, String>();
args.put("type", "FOLDER_OBJECT_TYPE");
args.put("includePropertyDefinitions", "true");
@@ -1027,14 +1071,14 @@ public class CMISTest extends BaseCMISWebScriptTest
throws Exception
{
// retrieve query collection
IRI queryHREF = getQueryCollection(getRepository());
IRI queryHREF = getQueryCollection(getWorkspace(getRepository()));
// retrieve test folder for query
Entry testFolder = createTestFolder("testQuery");
CMISProperties testFolderProps = testFolder.getExtension(CMISConstants.PROPERTIES);
Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN);
// create documents query
// create documents to query
Entry document1 = createDocument(childrenLink.getHref(), "apple1");
assertNotNull(document1);
CMISProperties document1Props = document1.getExtension(CMISConstants.PROPERTIES);
@@ -1046,20 +1090,22 @@ public class CMISTest extends BaseCMISWebScriptTest
assertNotNull(document2Props);
Entry document3 = createDocument(childrenLink.getHref(), "banana1");
assertNotNull(document3);
// TODO: query based on query capabilities
// retrieve query request document
String queryDoc = loadString("/cmis/rest/query.cmissqlquery.xml");
// TODO: Enable XSD Validation when cmis:propertyXXX mapping is sorted in spec
{
// construct structured query
String query = "SELECT OBJECT_ID, OBJECT_TYPE_ID, NAME FROM DOCUMENT_OBJECT_TYPE " +
String query = "SELECT * FROM DOCUMENT_OBJECT_TYPE " +
"WHERE IN_FOLDER('" + testFolderProps.getObjectId() + "') " +
"AND NAME = 'apple1'";
String queryReq = queryDoc.replace("${STATEMENT}", query);
queryReq = queryReq.replace("${PAGESIZE}", "5");
// issue structured query
Response queryRes = sendRequest(new PostRequest(queryHREF.toString(), queryReq.getBytes(), "application/cmisrequest+xml;type=query"), 200, getAtomValidator());
Response queryRes = sendRequest(new PostRequest(queryHREF.toString(), queryReq.getBytes(), "application/cmisrequest+xml;type=query"), 200);
assertNotNull(queryRes);
Feed queryFeed = abdera.parseFeed(new StringReader(queryRes.getContentAsString()), null);
assertNotNull(queryFeed);
@@ -1080,7 +1126,7 @@ public class CMISTest extends BaseCMISWebScriptTest
queryReq = queryReq.replace("${PAGESIZE}", "5");
// issue fulltext query
Response queryRes = sendRequest(new PostRequest(queryHREF.toString(), queryReq.getBytes(), "application/cmisrequest+xml;type=query"), 200, getAtomValidator());
Response queryRes = sendRequest(new PostRequest(queryHREF.toString(), queryReq.getBytes(), "application/cmisrequest+xml;type=query"), 200);
assertNotNull(queryRes);
Feed queryFeed = abdera.parseFeed(new StringReader(queryRes.getContentAsString()), null);
assertNotNull(queryFeed);
@@ -1097,13 +1143,13 @@ public class CMISTest extends BaseCMISWebScriptTest
// construct fulltext and structured query
String query = "SELECT OBJECT_ID, OBJECT_TYPE_ID, NAME FROM DOCUMENT_OBJECT_TYPE " +
"WHERE IN_FOLDER('" + testFolderProps.getObjectId() + "') " +
"AND NAME = 'apple1'" +
"AND NAME = 'apple1' " +
"AND CONTAINS('test content')";
String queryReq = queryDoc.replace("${STATEMENT}", query);
queryReq = queryReq.replace("${PAGESIZE}", "5");
// issue structured query
Response queryRes = sendRequest(new PostRequest(queryHREF.toString(), queryReq.getBytes(), "application/cmisrequest+xml;type=query"), 200, getAtomValidator());
Response queryRes = sendRequest(new PostRequest(queryHREF.toString(), queryReq.getBytes(), "application/cmisrequest+xml;type=query"), 200);
assertNotNull(queryRes);
Feed queryFeed = abdera.parseFeed(new StringReader(queryRes.getContentAsString()), null);
assertNotNull(queryFeed);

View File

@@ -35,29 +35,6 @@ import junit.textui.TestRunner;
*/
public class TestRemoteCMIS extends CMISTest
{
// remote CMIS server
private static String repositoryUrl = "http://localhost:8080/alfresco/service/api/repository";
private static String username = "admin";
private static String password = "admin";
private static boolean argsAsHeaders = false;
@Override
protected void setUp() throws Exception
{
if (repositoryUrl != null)
{
setRepositoryUrl(repositoryUrl);
RemoteServer server = new RemoteServer();
server.username = username;
server.password = password;
setRemoteServer(server);
}
setArgsAsHeaders(argsAsHeaders);
super.setUp();
}
/**
* Execute Unit Tests as client to remote CMIS Server
@@ -70,6 +47,8 @@ public class TestRemoteCMIS extends CMISTest
*/
public static void main(String[] args)
{
remote = true;
if (args.length > 0)
{
repositoryUrl = args[0];
@@ -88,7 +67,7 @@ public class TestRemoteCMIS extends CMISTest
String params = "both";
if (args.length > 2)
{
String[] paramSegment = args[1].split("=");
String[] paramSegment = args[2].split("=");
if (paramSegment[0].equalsIgnoreCase("params"))
{
params = paramSegment[1].toLowerCase();

View File

@@ -1,57 +0,0 @@
package org.alfresco.repo.cmis.ws;
import java.util.HashMap;
import java.util.Map;
import org.alfresco.cmis.dictionary.CMISMapping;
/**
* Mappings of CMIS properties to names in response
*
* @author Dmitry Lazurkin
*
*/
public class CMISPropNamesMapping
{
private static Map<String, String> cmisPropertiesNamesMapping = new HashMap<String, String>();
static
{
cmisPropertiesNamesMapping.put(CMISMapping.PROP_IS_IMMUTABLE, "isImmutable");
cmisPropertiesNamesMapping.put(CMISMapping.PROP_IS_LATEST_VERSION, "isLatestVersion");
cmisPropertiesNamesMapping.put(CMISMapping.PROP_IS_MAJOR_VERSION, "isMajorVersion");
cmisPropertiesNamesMapping.put(CMISMapping.PROP_IS_LATEST_MAJOR_VERSION, "isLatestMajorVersion");
cmisPropertiesNamesMapping.put(CMISMapping.PROP_VERSION_SERIES_IS_CHECKED_OUT, "versionSeriesIsCheckedOut");
cmisPropertiesNamesMapping.put(CMISMapping.PROP_CREATION_DATE, "creationDate");
cmisPropertiesNamesMapping.put(CMISMapping.PROP_LAST_MODIFICATION_DATE, "lastModificationDate");
cmisPropertiesNamesMapping.put(CMISMapping.PROP_OBJECT_ID, "objectID");
cmisPropertiesNamesMapping.put(CMISMapping.PROP_VERSION_SERIES_ID, "versionSeriesID");
cmisPropertiesNamesMapping.put(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID, "versionSeriesCheckedOutID");
cmisPropertiesNamesMapping.put(CMISMapping.PROP_CONTENT_STREAM_LENGTH, "contentStreamLength");
cmisPropertiesNamesMapping.put(CMISMapping.PROP_NAME, "name");
cmisPropertiesNamesMapping.put(CMISMapping.PROP_OBJECT_TYPE_ID, "objectTypeID");
cmisPropertiesNamesMapping.put(CMISMapping.PROP_CREATED_BY, "createdBy");
cmisPropertiesNamesMapping.put(CMISMapping.PROP_LAST_MODIFIED_BY, "lastModifiedBy");
cmisPropertiesNamesMapping.put(CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE, "contentStreamMimeType");
cmisPropertiesNamesMapping.put(CMISMapping.PROP_CONTENT_STREAM_FILENAME, "contentStreamFileName");
cmisPropertiesNamesMapping.put(CMISMapping.PROP_VERSION_LABEL, "versionLabel");
cmisPropertiesNamesMapping.put(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY, "versionSeriesCheckedOutBy");
cmisPropertiesNamesMapping.put(CMISMapping.PROP_CHECKIN_COMMENT, "checkinComment");
cmisPropertiesNamesMapping.put(CMISMapping.PROP_CONTENT_STREAM_URI, "contentStreamURI");
cmisPropertiesNamesMapping.put(CMISMapping.PROP_PARENT, "parent");
}
/**
* Get property name in response
*
* @param internalName internal property name
* @return property name in response
*/
public static String getResponsePropertyName(String internalName)
{
//return cmisPropertiesNamesMapping.get(internalName);
return internalName;
}
}

View File

@@ -36,6 +36,7 @@ import javax.xml.datatype.XMLGregorianCalendar;
import org.alfresco.cmis.CMISService;
import org.alfresco.cmis.dictionary.CMISDictionaryService;
import org.alfresco.cmis.dictionary.CMISMapping;
import org.alfresco.cmis.property.CMISPropertyNameMapping;
import org.alfresco.cmis.property.CMISPropertyService;
import org.alfresco.cmis.search.CMISQueryService;
import org.alfresco.error.AlfrescoRuntimeException;
@@ -107,7 +108,7 @@ public class DMAbstractServicePort
if (filter.allow(name) && value != null)
{
PropertyBooleanType propBoolean = new PropertyBooleanType();
propBoolean.setName(CMISPropNamesMapping.getResponsePropertyName(name));
propBoolean.setName(CMISPropertyNameMapping.getWebServiceName(name));
propBoolean.setValue((Boolean) value);
properties.getPropertyBoolean().add(propBoolean);
}
@@ -119,7 +120,7 @@ public class DMAbstractServicePort
if (filter.allow(name) && value != null)
{
PropertyDateTimeType propDateTime = new PropertyDateTimeType();
propDateTime.setName(CMISPropNamesMapping.getResponsePropertyName(name));
propDateTime.setName(CMISPropertyNameMapping.getWebServiceName(name));
propDateTime.setValue(convert((Date) value));
properties.getPropertyDateTime().add(propDateTime);
}
@@ -131,7 +132,7 @@ public class DMAbstractServicePort
if (filter.allow(name) && value != null)
{
PropertyIDType propID = new PropertyIDType();
propID.setName(CMISPropNamesMapping.getResponsePropertyName(name));
propID.setName(CMISPropertyNameMapping.getWebServiceName(name));
propID.setValue(value.toString());
properties.getPropertyID().add(propID);
}
@@ -143,7 +144,7 @@ public class DMAbstractServicePort
if (filter.allow(name) && value != null)
{
PropertyIntegerType propInteger = new PropertyIntegerType();
propInteger.setName(CMISPropNamesMapping.getResponsePropertyName(name));
propInteger.setName(CMISPropertyNameMapping.getWebServiceName(name));
propInteger.setValue(BigInteger.valueOf((Long) value));
properties.getPropertyInteger().add(propInteger);
}
@@ -155,7 +156,7 @@ public class DMAbstractServicePort
if (filter.allow(name) && value != null)
{
PropertyStringType propString = new PropertyStringType();
propString.setName(CMISPropNamesMapping.getResponsePropertyName(name));
propString.setName(CMISPropertyNameMapping.getWebServiceName(name));
propString.setValue(value.toString());
properties.getPropertyString().add(propString);
}
@@ -178,7 +179,7 @@ public class DMAbstractServicePort
if (filter.allow(name) && value != null)
{
PropertyURIType propString = new PropertyURIType();
propString.setName(CMISPropNamesMapping.getResponsePropertyName(name));
propString.setName(CMISPropertyNameMapping.getWebServiceName(name));
propString.setValue(value.toString());
properties.getPropertyURI().add(propString);
}

View File

@@ -205,7 +205,7 @@ public class DMRepositoryServicePort extends DMAbstractServicePort implements Re
objectTypeDefinitionType.setObjectTypeID(typeDefinition.getObjectTypeId().getTypeId());
objectTypeDefinitionType.setObjectTypeQueryName(typeDefinition.getObjectTypeQueryName());
objectTypeDefinitionType.setObjectTypeDisplayName(typeDefinition.getObjectTypeDisplayName());
objectTypeDefinitionType.setParentTypeID(typeDefinition.getParentTypeId().getTypeId());
objectTypeDefinitionType.setParentTypeID(typeDefinition.getParentTypeId() == null ? null : typeDefinition.getParentTypeId().getTypeId());
objectTypeDefinitionType.setRootTypeQueryName(typeDefinition.getRootTypeQueryName());
objectTypeDefinitionType.setDescription(typeDefinition.getDescription());
objectTypeDefinitionType.setCreatable(typeDefinition.isCreatable());

View File

@@ -43,6 +43,9 @@ public interface CMISConstants
{
public static final String CMIS_200805_NS = "http://www.cmis.org/2008/05";
// CMIS Service Document
public static final QName COLLECTION_TYPE = new QName(CMIS_200805_NS, "collectionType");
// CMIS Repository Info
public static final QName REPOSITORY_INFO = new QName(CMIS_200805_NS, "repositoryInfo");
public static final QName REPOSITORY_ID = new QName(CMIS_200805_NS, "repositoryId");

View File

@@ -4,6 +4,6 @@
<summary>${NAME} (summary)</summary>
<content type="html">test content ${NAME}</content>
<cmis:properties>
<cmis:propertyString cmis:name="baseType">document</cmis:propertyString>
<cmis:propertyString cmis:name="objectType">document</cmis:propertyString>
</cmis:properties>
</entry>

View File

@@ -0,0 +1,8 @@
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:cmis="http://www.cmis.org/2008/05" xmlns:app="http://www.w3.org/2007/app">
<title type="text">onesentence.txt</title>
<content type="text/plain">MQ==&#xd;</content>
<cmis:properties>
<cmis:propertyString cmis:name="objectType">Document</cmis:propertyString>
<cmis:propertyString cmis:name="DocumentTitle">onesentence.txt</cmis:propertyString>
</cmis:properties>
</entry>

View File

@@ -14,6 +14,6 @@
aXQgc2hvdWxkIGJlIGJhc2U2NCBlbmNvZGVkIGluIHRoZSBhdG9tIGVudHJ5Lg==
</content>
<cmis:properties>
<cmis:propertyString cmis:name="baseType">document</cmis:propertyString>
<cmis:propertyString cmis:name="objectType">document</cmis:propertyString>
</cmis:properties>
</entry>

View File

@@ -3,6 +3,6 @@
<title>${NAME}</title>
<summary>${NAME} (summary)</summary>
<cmis:properties>
<cmis:propertyString cmis:name="baseType">folder</cmis:propertyString>
<cmis:propertyString cmis:name="objectType">folder</cmis:propertyString>
</cmis:properties>
</entry>

View File

@@ -28,6 +28,7 @@ import javax.transaction.UserTransaction;
import org.alfresco.cmis.CMISService;
import org.alfresco.cmis.dictionary.CMISMapping;
import org.alfresco.cmis.property.CMISPropertyNameMapping;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.node.integrity.IntegrityChecker;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
@@ -115,13 +116,13 @@ public class BaseServicePortTest extends AbstractDependencyInjectionSpringContex
@Override
protected String[] getConfigLocations()
{
return new String[] { "classpath:alfresco/application-context.xml", "classpath:alfresco/test-cmis-context.xml" };
return new String[] { "classpath:alfresco/application-context.xml", "classpath:test-cmis-context.xml" };
}
protected String getPropertyIDValue(PropertiesType properties, String propertyName)
{
String result = null;
String realPropertyName = CMISPropNamesMapping.getResponsePropertyName(propertyName);
String realPropertyName = CMISPropertyNameMapping.getWebServiceName(propertyName);
for (PropertyIDType property : properties.getPropertyID())
{
@@ -138,7 +139,7 @@ public class BaseServicePortTest extends AbstractDependencyInjectionSpringContex
protected String getPropertyStringValue(PropertiesType properties, String propertyName)
{
String result = null;
String realPropertyName = CMISPropNamesMapping.getResponsePropertyName(propertyName);
String realPropertyName = CMISPropertyNameMapping.getWebServiceName(propertyName);
for (PropertyStringType property : properties.getPropertyString())
{
@@ -155,7 +156,7 @@ public class BaseServicePortTest extends AbstractDependencyInjectionSpringContex
protected boolean getPropertyBooleanValue(PropertiesType properties, String propertyName)
{
boolean result = false;
String realPropertyName = CMISPropNamesMapping.getResponsePropertyName(propertyName);
String realPropertyName = CMISPropertyNameMapping.getWebServiceName(propertyName);
for (PropertyBooleanType property : properties.getPropertyBoolean())
{

View File

@@ -68,4 +68,11 @@ public class DMRepositoryServicePortTest extends BaseServicePortTest
assertTrue(capabilities.isCapabilityMultifiling() && capabilities.isCapabilityPWCUpdatable());
assertFalse(capabilities.isCapabilityUnfiling() && capabilities.isCapabilityVersionSpecificFiling());
}
public void testGetTypeDefinition() throws Exception
{
List<RepositoryType> repositories = repositoryServicePort.getRepositories();
repositoryServicePort.getTypeDefinition(repositories.get(0).getRepositoryID(), "DOCUMENT_OBJECT_TYPE");
}
}