mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merge from SEAMIST3
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10735 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -0,0 +1,269 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.repo.cmis.rest.test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.validation.Validator;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.repo.cmis.rest.xsd.CMISValidator;
|
||||
import org.alfresco.repo.web.scripts.BaseWebScriptTest;
|
||||
import org.alfresco.web.scripts.TestWebScriptServer.Request;
|
||||
import org.alfresco.web.scripts.TestWebScriptServer.Response;
|
||||
import org.w3c.dom.Document;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
|
||||
/**
|
||||
* Base CMIS Web Script Test
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public class BaseCMISWebScriptTest extends BaseWebScriptTest
|
||||
{
|
||||
private CMISValidator cmisValidator = new CMISValidator();
|
||||
private boolean argsAsHeaders = false;
|
||||
private boolean validateResponse = true;
|
||||
|
||||
/**
|
||||
* Pass URL arguments as headers
|
||||
*
|
||||
* @param argsAsHeaders
|
||||
*/
|
||||
protected void setArgsAsHeaders(boolean argsAsHeaders)
|
||||
{
|
||||
this.argsAsHeaders = argsAsHeaders;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate Response
|
||||
*
|
||||
* @param validateResponse
|
||||
*/
|
||||
protected void setValidateResponse(boolean validateResponse)
|
||||
{
|
||||
this.validateResponse = validateResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if URL arguments are passed as headers
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
protected boolean getArgsAsHeaders()
|
||||
{
|
||||
return argsAsHeaders;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets CMIS Validator
|
||||
*
|
||||
* @return CMIS Validator
|
||||
*/
|
||||
protected CMISValidator getCMISValidator()
|
||||
{
|
||||
return cmisValidator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets CMIS App Validator
|
||||
*
|
||||
* @return CMIS App Validator
|
||||
*
|
||||
* @throws SAXException
|
||||
* @throws IOException
|
||||
*/
|
||||
protected Validator getAppValidator()
|
||||
throws IOException, SAXException
|
||||
{
|
||||
return getCMISValidator().getAppValidator();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets CMIS Atom Validator
|
||||
*
|
||||
* @return CMIS App Validator
|
||||
*
|
||||
* @throws SAXException
|
||||
* @throws IOException
|
||||
*/
|
||||
protected Validator getAtomValidator()
|
||||
throws IOException, SAXException
|
||||
{
|
||||
return getCMISValidator().getCMISAtomValidator();
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts XML complies with specified Validator
|
||||
*
|
||||
* @param xml xml to assert
|
||||
* @param validator validator to assert with
|
||||
* @throws IOException
|
||||
* @throws ParserConfigurationException
|
||||
*/
|
||||
protected void assertValidXML(String xml, Validator validator)
|
||||
throws IOException, ParserConfigurationException
|
||||
{
|
||||
if (validateResponse)
|
||||
{
|
||||
try
|
||||
{
|
||||
Document document = cmisValidator.getDocumentBuilder().parse(new InputSource(new StringReader(xml)));
|
||||
validator.validate(new DOMSource(document));
|
||||
}
|
||||
catch (SAXException e)
|
||||
{
|
||||
fail(cmisValidator.toString(e, xml));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load text from file specified by class path
|
||||
*
|
||||
* @param classPath XML file
|
||||
* @return XML
|
||||
* @throws IOException
|
||||
*/
|
||||
protected String loadString(String classPath)
|
||||
throws IOException
|
||||
{
|
||||
InputStream input = getClass().getResourceAsStream(classPath);
|
||||
if (input == null)
|
||||
{
|
||||
throw new IOException(classPath + " not found.");
|
||||
}
|
||||
|
||||
InputStreamReader reader = new InputStreamReader(input, "UTF-8");
|
||||
StringWriter writer = new StringWriter();
|
||||
|
||||
try
|
||||
{
|
||||
char[] buffer = new char[4096];
|
||||
int bytesRead = -1;
|
||||
while ((bytesRead = reader.read(buffer)) != -1)
|
||||
{
|
||||
writer.write(buffer, 0, bytesRead);
|
||||
}
|
||||
writer.flush();
|
||||
}
|
||||
finally
|
||||
{
|
||||
reader.close();
|
||||
writer.close();
|
||||
}
|
||||
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Request to Test Web Script Server (as admin)
|
||||
*
|
||||
* @param req
|
||||
* @param expectedStatus
|
||||
* @return response
|
||||
* @throws IOException
|
||||
*/
|
||||
protected Response sendRequest(Request req, int expectedStatus, Validator responseValidator)
|
||||
throws IOException
|
||||
{
|
||||
return sendRequest(req, expectedStatus, responseValidator, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Request
|
||||
*
|
||||
* @param req
|
||||
* @param expectedStatus
|
||||
* @param asUser
|
||||
* @return response
|
||||
* @throws IOException
|
||||
*/
|
||||
protected Response sendRequest(Request req, int expectedStatus, Validator responseValidator, String asUser)
|
||||
throws IOException
|
||||
{
|
||||
Response res = sendRequest(req, expectedStatus, asUser);
|
||||
if (responseValidator != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Validate response according to validator
|
||||
String resXML = res.getContentAsString();
|
||||
assertValidXML(resXML, responseValidator);
|
||||
}
|
||||
catch (ParserConfigurationException e)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Failed to validate", e);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Request to Test Web Script Server
|
||||
* @param req
|
||||
* @param expectedStatus
|
||||
* @param asUser
|
||||
* @return response
|
||||
* @throws IOException
|
||||
*/
|
||||
protected Response sendRequest(Request req, int expectedStatus, String asUser)
|
||||
throws IOException
|
||||
{
|
||||
if (argsAsHeaders)
|
||||
{
|
||||
Map<String, String> args = req.getArgs();
|
||||
if (args != null)
|
||||
{
|
||||
Map<String, String> headers = req.getHeaders();
|
||||
if (headers == null)
|
||||
{
|
||||
headers = new HashMap<String, String>();
|
||||
}
|
||||
for (Map.Entry<String, String> arg : args.entrySet())
|
||||
{
|
||||
headers.put("CMIS-" + arg.getKey(), arg.getValue());
|
||||
}
|
||||
|
||||
req = new Request(req);
|
||||
req.setArgs(null);
|
||||
req.setHeaders(headers);
|
||||
}
|
||||
}
|
||||
|
||||
return super.sendRequest(req, expectedStatus, asUser);
|
||||
}
|
||||
|
||||
}
|
1289
source/java/org/alfresco/repo/cmis/rest/test/CMISTest.java
Normal file
1289
source/java/org/alfresco/repo/cmis/rest/test/CMISTest.java
Normal file
File diff suppressed because it is too large
Load Diff
259
source/java/org/alfresco/repo/cmis/rest/test/CMISTestRunner.java
Normal file
259
source/java/org/alfresco/repo/cmis/rest/test/CMISTestRunner.java
Normal file
@@ -0,0 +1,259 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.repo.cmis.rest.test;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestResult;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.alfresco.repo.cmis.rest.test.CMISTest.CMISTestListener;
|
||||
import org.alfresco.repo.web.scripts.BaseWebScriptTest.RemoteServer;
|
||||
import org.alfresco.repo.web.scripts.BaseWebScriptTest.WebScriptTestListener;
|
||||
import org.alfresco.util.CachingDateFormat;
|
||||
|
||||
|
||||
/**
|
||||
* CMIS Test Runner
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public class CMISTestRunner
|
||||
{
|
||||
private String match = null;
|
||||
private WebScriptTestListener listener = new CMISTestListener(System.out);
|
||||
private boolean traceReqRes = false;
|
||||
private String serviceUrl = null;
|
||||
private String userpass = null;
|
||||
private String arguments = "url";
|
||||
private boolean validateResponse = true;
|
||||
|
||||
|
||||
/**
|
||||
* @param match test name to execute (* for wildcards)
|
||||
*/
|
||||
public void setMatch(String match)
|
||||
{
|
||||
this.match = match;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param listener test listener
|
||||
*/
|
||||
public void setListener(WebScriptTestListener listener)
|
||||
{
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param traceReqRes true => trace requests / responses
|
||||
*/
|
||||
public void setTraceReqRes(boolean traceReqRes)
|
||||
{
|
||||
this.traceReqRes = traceReqRes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param serviceUrl cmis service document url
|
||||
*/
|
||||
public void setServiceUrl(String serviceUrl)
|
||||
{
|
||||
this.serviceUrl = serviceUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param userpass user name / password
|
||||
*/
|
||||
public void setUserPass(String userpass)
|
||||
{
|
||||
this.userpass = userpass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param arguments "url" => url arguments, "headers" => request headers, "both" => url & headers
|
||||
*/
|
||||
public void setArguments(String arguments)
|
||||
{
|
||||
this.arguments = arguments;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param validateResponse true => test response against CMIS XSDs
|
||||
*/
|
||||
public void setValidateResponse(boolean validateResponse)
|
||||
{
|
||||
this.validateResponse = validateResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the names of CMIS tests
|
||||
*
|
||||
* @param match * for wildcard
|
||||
* @return array of test names
|
||||
*/
|
||||
public String[] getTestNames(String match)
|
||||
{
|
||||
List<String> namesList = new ArrayList<String>();
|
||||
TestSuite allSuite = new TestSuite(CMISTest.class);
|
||||
for (int i = 0; i < allSuite.countTestCases(); i++)
|
||||
{
|
||||
CMISTest test = (CMISTest)allSuite.testAt(i);
|
||||
if (match == null || match.equals("*") || test.getName().matches(match.replace("*", "[A-Za-z0-9]*")))
|
||||
{
|
||||
namesList.add(test.getName());
|
||||
}
|
||||
}
|
||||
String[] names = new String[namesList.size()];
|
||||
namesList.toArray(names);
|
||||
return names;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute CMIS Tests
|
||||
*/
|
||||
public void execute()
|
||||
{
|
||||
RemoteServer server = null;
|
||||
if (serviceUrl != null)
|
||||
{
|
||||
server = new RemoteServer();
|
||||
if (userpass != null)
|
||||
{
|
||||
String[] credentials = userpass.split("/");
|
||||
server.username = credentials[0];
|
||||
if (credentials.length > 1)
|
||||
{
|
||||
server.password = credentials[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// dump test parameters
|
||||
if (listener != null)
|
||||
{
|
||||
Calendar today = Calendar.getInstance();
|
||||
SimpleDateFormat df = CachingDateFormat.getDateFormat("yyyy-MM-dd HH:mm:ss.SSS", true);
|
||||
listener.addLog(null, "Test Started at " + df.format(today.getTime()));
|
||||
listener.addLog(null, "Service URL: " + (serviceUrl == null ? "[not set]" : serviceUrl));
|
||||
listener.addLog(null, "User: " + (userpass == null ? "[not set]" : userpass));
|
||||
listener.addLog(null, "Args: " + (arguments == null ? "[not set]" : arguments));
|
||||
listener.addLog(null, "Validate Responses: " + validateResponse);
|
||||
listener.addLog(null, "Trace Requests/Responses: " + traceReqRes);
|
||||
listener.addLog(null, "Tests: " + (match == null ? "*" : match));
|
||||
listener.addLog(null, "");
|
||||
}
|
||||
|
||||
// execute cmis tests with url arguments
|
||||
if (arguments.equals("both") || arguments.equals("url"))
|
||||
{
|
||||
executeSuite(match, server, false);
|
||||
}
|
||||
|
||||
// execute cmis tests with headers
|
||||
if (arguments.equals("both") || arguments.equals("headers"))
|
||||
{
|
||||
executeSuite(match, server, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute suite of CMIS Tests
|
||||
*
|
||||
* @param match tests to execute (* for wildcard)
|
||||
* @param server remote server
|
||||
* @param argsAsHeaders arguments passed in Headers
|
||||
*/
|
||||
private void executeSuite(String match, RemoteServer server, boolean argsAsHeaders)
|
||||
{
|
||||
TestSuite allSuite = new TestSuite(CMISTest.class);
|
||||
TestSuite suite = new TestSuite();
|
||||
for (int i = 0; i < allSuite.countTestCases(); i++)
|
||||
{
|
||||
CMISTest test = (CMISTest)allSuite.testAt(i);
|
||||
if (match == null || match.equals("*") || test.getName().matches(match.replace("*", "[A-Za-z0-9]*")))
|
||||
{
|
||||
if (listener != null)
|
||||
{
|
||||
test.setListener(listener);
|
||||
test.setTraceReqRes(traceReqRes);
|
||||
}
|
||||
if (server != null)
|
||||
{
|
||||
test.setServiceUrl(serviceUrl);
|
||||
if (server != null)
|
||||
{
|
||||
test.setRemoteServer(server);
|
||||
}
|
||||
}
|
||||
test.setArgsAsHeaders(argsAsHeaders);
|
||||
test.setValidateResponse(validateResponse);
|
||||
suite.addTest(test);
|
||||
}
|
||||
}
|
||||
TestResult result = new TestResult();
|
||||
if (listener != null)
|
||||
{
|
||||
result.addListener(listener);
|
||||
}
|
||||
suite.run(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute CMIS Tests from command-line
|
||||
*
|
||||
* url={serviceUrl}
|
||||
* user={userpass}
|
||||
* args={"url"|"headers"|"both"}
|
||||
*/
|
||||
public static void main(String[] args)
|
||||
{
|
||||
CMISTestRunner runner = new CMISTestRunner();
|
||||
|
||||
for (String arg : args)
|
||||
{
|
||||
String[] argSegment = arg.split("=");
|
||||
if (argSegment[0].equals("url"))
|
||||
{
|
||||
runner.setServiceUrl(argSegment[1]);
|
||||
}
|
||||
else if (argSegment[0].equals("user"))
|
||||
{
|
||||
runner.setUserPass(argSegment[1]);
|
||||
}
|
||||
else if (argSegment[0].equalsIgnoreCase("args"))
|
||||
{
|
||||
runner.setArguments(argSegment[1].toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
// execute
|
||||
runner.execute();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.repo.cmis.rest.test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
|
||||
import org.alfresco.repo.cmis.rest.test.CMISTest.CMISTestListener;
|
||||
import org.alfresco.repo.web.scripts.BaseWebScriptTest.WebScriptTestListener;
|
||||
import org.alfresco.web.scripts.AbstractWebScript;
|
||||
import org.alfresco.web.scripts.WebScriptRequest;
|
||||
import org.alfresco.web.scripts.WebScriptResponse;
|
||||
|
||||
/**
|
||||
* Execute CMIS Tests
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public class CMISTestRunnerWebScript extends AbstractWebScript
|
||||
{
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.web.scripts.WebScript#execute(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.WebScriptResponse)
|
||||
*/
|
||||
public void execute(WebScriptRequest req, WebScriptResponse res)
|
||||
throws IOException
|
||||
{
|
||||
// setup CMIS tests
|
||||
PrintStream printStream = new PrintStream(res.getOutputStream());
|
||||
WebScriptTestListener testListener = new CMISTestListener(printStream);
|
||||
CMISTestRunner runner = new CMISTestRunner();
|
||||
runner.setListener(testListener);
|
||||
|
||||
// process test parameters
|
||||
String serviceUrl = req.getParameter("url");
|
||||
if (serviceUrl != null && serviceUrl.length() > 0)
|
||||
{
|
||||
runner.setServiceUrl(serviceUrl);
|
||||
}
|
||||
String userpass = req.getParameter("user");
|
||||
if (userpass != null && userpass.length() > 0)
|
||||
{
|
||||
runner.setUserPass(userpass);
|
||||
}
|
||||
String args = req.getParameter("args");
|
||||
if (args != null && args.length() > 0)
|
||||
{
|
||||
runner.setArguments(args);
|
||||
}
|
||||
String validate = req.getParameter("validate");
|
||||
if (validate != null && validate.length() > 0)
|
||||
{
|
||||
runner.setValidateResponse(Boolean.valueOf(validate));
|
||||
}
|
||||
String trace = req.getParameter("trace");
|
||||
if (trace != null && trace.length() > 0)
|
||||
{
|
||||
runner.setTraceReqRes(Boolean.valueOf(trace));
|
||||
}
|
||||
String match = req.getParameter("tests");
|
||||
if (match != null && match.length() > 0)
|
||||
{
|
||||
runner.setMatch(match);
|
||||
}
|
||||
|
||||
// execute tests
|
||||
runner.execute();
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.repo.cmis.rest.test;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* CMIS API Test Harness
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public class CMISWithHeadersTest extends CMISTest
|
||||
{
|
||||
|
||||
@Override
|
||||
protected void setUp()
|
||||
throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
setArgsAsHeaders(true);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:cmis="http://www.cmis.org/2008/05">
|
||||
<title>Updated Title ${NAME}</title>
|
||||
<content>updated content ${NAME}</content>
|
||||
</entry>
|
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:cmis="http://www.cmis.org/2008/05"/>
|
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:cmis="http://www.cmis.org/2008/05">
|
||||
<title>${NAME}</title>
|
||||
<summary>${NAME} (summary)</summary>
|
||||
<content type="text/html">${CONTENT}</content>
|
||||
<cmis:object>
|
||||
<cmis:properties>
|
||||
<cmis:propertyString cmis:name="ObjectTypeId"><cmis:value>document</cmis:value></cmis:propertyString>
|
||||
</cmis:properties>
|
||||
</cmis:object>
|
||||
</entry>
|
@@ -0,0 +1,10 @@
|
||||
<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==
</content>
|
||||
<cmis:object>
|
||||
<cmis:properties>
|
||||
<cmis:propertyString cmis:name="ObjectTypeId"><cmis:value>document</cmis:value></cmis:propertyString>
|
||||
<cmis:propertyString cmis:name="DocumentTitle"><cmis:value>onesentence.txt</cmis:value></cmis:propertyString>
|
||||
</cmis:properties>
|
||||
</cmis:object>
|
||||
</entry>
|
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:cmis="http://www.cmis.org/2008/05">
|
||||
<title>${NAME}</title>
|
||||
<summary>${NAME} (summary)</summary>
|
||||
<content type="text/plain">
|
||||
VGhpcyBtZXRob2QgZm9sbG93cyB0aGUgQXRvbSBQdWJsaXNoaW5nIG1vZGVsIHdoZXJlIHRoZSBl
|
||||
bnRyeSBkb2N1bWVudCwgYXRvbSBvciBjbWlzLCBpcyBwb3N0ZWQgdG8gdGhlIHJvb3Qgb3Igc3Bl
|
||||
Y2lmaWMgZm9sZGVyIFVSSS4gIEZvciB1bmZpbGVkIGRvY3VtZW50cywgcG9zdCB0aGUgZG9jdW1l
|
||||
bnQgdG8gdGhlIHVuZmlsZWQgY29sbGVjdGlvbi4gICBUaGUgZG9jdW1lbnQgd2lsbCBiZSBjcmVh
|
||||
dGVkIGluIHRoZSBmb2xkZXIgcG9zdGVkLiBJZiB0aGUgZG9jdW1lbnQgaXMgcG9zdGVkIHRvIHRo
|
||||
ZSByb290IGNvbGxlY3Rpb24gYW5kIGEgZm9sZGVyIHByb3BlcnR5IGlzIHNwZWNpZmllZCwgdGhl
|
||||
biB0aGUgcmVwb3NpdG9yeSB3aWxsIGNyZWF0ZSB0aGUgZG9jdW1lbnQgaW4gdGhlIHNwZWNpZmll
|
||||
ZCBmb2xkZXIuICBJZiB0aGUgY29udGVudCBzdHJlYW0gaXMgc3BlY2lmaWVkIG9uIGNyZWF0ZSwg
|
||||
aXQgc2hvdWxkIGJlIGJhc2U2NCBlbmNvZGVkIGluIHRoZSBhdG9tIGVudHJ5Lg==
|
||||
</content>
|
||||
<cmis:object>
|
||||
<cmis:properties>
|
||||
<cmis:propertyString cmis:name="ObjectTypeId"><cmis:value>document</cmis:value></cmis:propertyString>
|
||||
</cmis:properties>
|
||||
</cmis:object>
|
||||
</entry>
|
@@ -0,0 +1 @@
|
||||
This method follows the Atom Publishing model where the entry document, atom or cmis, is posted to the root or specific folder URI. For unfiled documents, post the document to the unfiled collection. The document will be created in the folder posted. If the document is posted to the root collection and a folder property is specified, then the repository will create the document in the specified folder. If the content stream is specified on create, it should be base64 encoded in the atom entry.
|
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:cmis="http://www.cmis.org/2008/05">
|
||||
<title>${NAME}</title>
|
||||
<summary>${NAME} (summary)</summary>
|
||||
<cmis:object>
|
||||
<cmis:properties>
|
||||
<cmis:propertyString cmis:name="ObjectTypeId"><cmis:value>folder</cmis:value></cmis:propertyString>
|
||||
</cmis:properties>
|
||||
</cmis:object>
|
||||
</entry>
|
@@ -0,0 +1,4 @@
|
||||
<cmis:query xmlns:cmis="http://www.cmis.org/2008/05" >
|
||||
<cmis:statement><![CDATA[${STATEMENT}]]></cmis:statement>
|
||||
<cmis:pageSize>${PAGESIZE}</cmis:pageSize>
|
||||
</cmis:query>
|
@@ -0,0 +1,4 @@
|
||||
<cmis:query xmlns:cmis="http://www.cmis.org/2008/05" >
|
||||
<cmis:statement><![CDATA[${STATEMENT}]]></cmis:statement>
|
||||
<cmis:pageSize>${PAGESIZE}</cmis:pageSize>
|
||||
</cmis:query>
|
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:cmis="http://www.cmis.org/2008/05">
|
||||
<title>Updated Title ${NAME}</title>
|
||||
<content>updated content ${NAME}</content>
|
||||
</entry>
|
Reference in New Issue
Block a user