04-17-2012 01:10 PM
public class AlfrescoTest {
private String alfrescoUser = "svcROIWeb";
private String alfrescoPassword = "*******";
private String alfrescoRoot = "/Sites/roiweb-file-share";
private Session getSession(String connectionString) {
Session session = null;
// default factory implementation
SessionFactory factory = SessionFactoryImpl.newInstance();
Map<String, String> parameters = new HashMap<String, String>();
// user credentials
parameters.put(SessionParameter.USER, alfrescoUser);
parameters.put(SessionParameter.PASSWORD, alfrescoPassword);
// connection settings
System.out.println("ATOMPUB_URL = "+connectionString);
parameters.put(SessionParameter.ATOMPUB_URL, connectionString);
parameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
// get repositories
List<Repository> repositories = factory.getRepositories(parameters);
session = repositories.get(0).createSession();
return session;
}
@Test
public void testGetDoc() {
System.out.println("Testing documents added with CMIS…");
getDoc("workspace://SpacesStore/ce05803c-858f-43bb-bedf-8df0849a79f9", "http://alfserver:8080/alfresco/service/cmis");
getDoc("workspace://SpacesStore/ce05803c-858f-43bb-bedf-8df0849a79f9", "http://alfserver:8080/alfresco/cmisatom");
System.out.println("Testing documents added with Alfresco Share…");
getDoc("workspace://SpacesStore/f6d3c572-30ae-4755-9944-71ca25331620", "http://alfserver:8080/alfresco/service/cmis");
getDoc("workspace://SpacesStore/f6d3c572-30ae-4755-9944-71ca25331620", "http://alfserver:8080/alfresco/cmisatom");
System.out.println("Testing documents added with WebDav…");
getDoc("workspace://SpacesStore/67f20d6b-5e3f-4c44-a10e-74e1872eb73e", "http://alfserver:8080/alfresco/service/cmis");
getDoc("workspace://SpacesStore/67f20d6b-5e3f-4c44-a10e-74e1872eb73e", "http://alfserver:8080/alfresco/cmisatom");
}
public void getDoc(String objectId, String repoUrl) {
try {
Session session = getSession(repoUrl);
System.out.println("Searching for document: "+objectId);
CmisObject obj = session.getObject(objectId);
if(obj instanceof Document) {
Document doc = (Document)obj;
printProps(doc);
}
} catch(CmisRuntimeException e) {
e.printStackTrace();
System.out.println(e.getErrorContent());
}
System.out.println("—————————————————");
}
private void printProps(CmisObject obj) {
List<Property<?>> props = obj.getProperties();
for(Property<?> property : props) {
System.out.println("\t"+property.getId()+" = "+property.getValueAsString());
}
}
}
Testing documents added with CMIS…
ATOMPUB_URL = http://lnxvmalft01:8080/alfresco/service/cmis
Searching for document: workspace://SpacesStore/ce05803c-858f-43bb-bedf-8df0849a79f9
cmis:isLatestMajorVersion = true
cmis:contentStreamLength = 44
cmis:contentStreamId = store://2012/4/13/9/30/87091928-7af5-4072-bbc3-1d69b35bf796.bin
cmis:versionSeriesCheckedOutBy = null
cmis:objectTypeId = cmis:document
cmis:versionSeriesCheckedOutId = null
cmis:name = Test Text Document.txt
cmis:contentStreamMimeType = text/plain
cmis:versionSeriesId = workspace://SpacesStore/ce05803c-858f-43bb-bedf-8df0849a79f9
cmis:creationDate = Mon Apr 09 08:25:34 CDT 2012
cmis:changeToken = null
cmis:versionLabel = 12.0
cmis:isLatestVersion = true
cmis:isVersionSeriesCheckedOut = false
cmis:lastModifiedBy = svcROIWeb
cmis:createdBy = svcROIWeb
cmis:checkinComment = Checked in via ROiWeb Portal by Lukas VanNoord
cmis:objectId = workspace://SpacesStore/ce05803c-858f-43bb-bedf-8df0849a79f9
cmis:isImmutable = false
cmis:isMajorVersion = true
cmis:baseTypeId = cmis:document
alfcmis:nodeRef = null
cmis:contentStreamFileName = Test Text Document.txt
cmis:lastModificationDate = Fri Apr 13 09:30:07 CDT 2012
—————————————————
ATOMPUB_URL = http://lnxvmalft01:8080/alfresco/cmisatom
Searching for document: workspace://SpacesStore/ce05803c-858f-43bb-bedf-8df0849a79f9
cmis:isLatestMajorVersion = false
cmis:contentStreamLength = 44
cmis:contentStreamId = store://2012/4/13/9/30/87091928-7af5-4072-bbc3-1d69b35bf796.bin
cmis:objectTypeId = cmis:document
cmis:versionSeriesCheckedOutBy = null
cmis:versionSeriesCheckedOutId = null
cmis:name = Test Text Document.txt
cmis:contentStreamMimeType = text/plain
cmis:versionSeriesId = workspace://SpacesStore/ce05803c-858f-43bb-bedf-8df0849a79f9
cmis:creationDate = Mon Apr 09 08:25:34 CDT 2012
cmis:changeToken = null
cmis:versionLabel = 1.0
cmis:isLatestVersion = true
cmis:isVersionSeriesCheckedOut = false
cmis:lastModifiedBy = svcROIWeb
cmis:createdBy = svcROIWeb
cmis:checkinComment = Initial Version
cmis:objectId = workspace://SpacesStore/ce05803c-858f-43bb-bedf-8df0849a79f9;1.0
cmis:isMajorVersion = true
cmis:isImmutable = false
alfcmis:nodeRef = workspace://SpacesStore/ce05803c-858f-43bb-bedf-8df0849a79f9
cmis:baseTypeId = cmis:document
cmis:lastModificationDate = Fri Apr 13 09:30:07 CDT 2012
cmis:contentStreamFileName = Test Text Document.txt
—————————————————
Testing documents added with Alfresco Share…
ATOMPUB_URL = http://lnxvmalft01:8080/alfresco/service/cmis
Searching for document: workspace://SpacesStore/f6d3c572-30ae-4755-9944-71ca25331620
cmis:isLatestMajorVersion = false
cmis:contentStreamLength = 43
cmis:contentStreamId = store://2012/4/10/12/25/5c3dbdc1-5e1f-4387-aaad-5c5d129a3433.bin
cmis:versionSeriesCheckedOutBy = null
cmis:objectTypeId = cmis:document
cmis:versionSeriesCheckedOutId = null
cmis:name = Test Share Document.txt
cmis:contentStreamMimeType = text/plain
cmis:versionSeriesId = workspace://SpacesStore/f6d3c572-30ae-4755-9944-71ca25331620
cmis:creationDate = Tue Apr 10 12:25:40 CDT 2012
cmis:changeToken = null
cmis:versionLabel = 0.1
cmis:isLatestVersion = true
cmis:isVersionSeriesCheckedOut = false
cmis:lastModifiedBy = svcROIWeb
cmis:createdBy = svcROIWeb
cmis:checkinComment = null
cmis:objectId = workspace://SpacesStore/f6d3c572-30ae-4755-9944-71ca25331620
cmis:isImmutable = false
cmis:isMajorVersion = false
cmis:baseTypeId = cmis:document
alfcmis:nodeRef = null
cmis:contentStreamFileName = Test Share Document.txt
cmis:lastModificationDate = Tue Apr 10 12:25:40 CDT 2012
—————————————————
ATOMPUB_URL = http://lnxvmalft01:8080/alfresco/cmisatom
Searching for document: workspace://SpacesStore/f6d3c572-30ae-4755-9944-71ca25331620
org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException: Internal Server Error
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:416)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.read(AbstractAtomPubService.java:488)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.getObjectInternal(AbstractAtomPubService.java:713)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.getObject(ObjectServiceImpl.java:429)
at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObject(SessionImpl.java:383)
at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObject(SessionImpl.java:361)
at AlfrescoTest.getDoc(AlfrescoTest.java:70)
at AlfrescoTest.testGetDoc(AlfrescoTest.java:58)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
<html><head><title>Apache Tomcat/6.0.26 - Error report</title><style><!–H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}–></style> </head><body><h1>HTTP Status 500 - Object Info not found for: workspace://SpacesStore/f6d3c572-30ae-4755-9944-71ca25331620;1.0</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>Object Info not found for: workspace://SpacesStore/f6d3c572-30ae-4755-9944-71ca25331620;1.0</u></p><p><b>description</b> <u>The server encountered an internal error (Object Info not found for: workspace://SpacesStore/f6d3c572-30ae-4755-9944-71ca25331620;1.0) that prevented it from fulfilling this request.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/6.0.26</h3></body></html>
—————————————————
Testing documents added with WebDav…
ATOMPUB_URL = http://lnxvmalft01:8080/alfresco/service/cmis
Searching for document: workspace://SpacesStore/67f20d6b-5e3f-4c44-a10e-74e1872eb73e
cmis:isLatestMajorVersion = false
cmis:contentStreamLength = 43
cmis:contentStreamId = store://2012/4/17/11/17/ed038f93-893c-45b1-b727-361ce6891dc7.bin
cmis:versionSeriesCheckedOutBy = null
cmis:objectTypeId = cmis:document
cmis:versionSeriesCheckedOutId = null
cmis:name = Test WebDav Document.txt
cmis:contentStreamMimeType = text/plain
cmis:versionSeriesId = workspace://SpacesStore/67f20d6b-5e3f-4c44-a10e-74e1872eb73e
cmis:creationDate = Tue Apr 17 11:17:55 CDT 2012
cmis:changeToken = null
cmis:versionLabel = 0.1
cmis:isLatestVersion = true
cmis:isVersionSeriesCheckedOut = false
cmis:lastModifiedBy = ljvannoo
cmis:createdBy = ljvannoo
cmis:checkinComment = null
cmis:objectId = workspace://SpacesStore/67f20d6b-5e3f-4c44-a10e-74e1872eb73e
cmis:isImmutable = false
cmis:isMajorVersion = false
cmis:baseTypeId = cmis:document
alfcmis:nodeRef = null
cmis:contentStreamFileName = Test WebDav Document.txt
cmis:lastModificationDate = Tue Apr 17 11:17:55 CDT 2012
—————————————————
ATOMPUB_URL = http://lnxvmalft01:8080/alfresco/cmisatom
Searching for document: workspace://SpacesStore/67f20d6b-5e3f-4c44-a10e-74e1872eb73e
org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException: Internal Server Error
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:416)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.read(AbstractAtomPubService.java:488)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.getObjectInternal(AbstractAtomPubService.java:713)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.getObject(ObjectServiceImpl.java:429)
at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObject(SessionImpl.java:383)
at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObject(SessionImpl.java:361)
at AlfrescoTest.getDoc(AlfrescoTest.java:70)
at AlfrescoTest.testGetDoc(AlfrescoTest.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
<html><head><title>Apache Tomcat/6.0.26 - Error report</title><style><!–H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}–></style> </head><body><h1>HTTP Status 500 - Object Info not found for: workspace://SpacesStore/67f20d6b-5e3f-4c44-a10e-74e1872eb73e;1.0</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>Object Info not found for: workspace://SpacesStore/67f20d6b-5e3f-4c44-a10e-74e1872eb73e;1.0</u></p><p><b>description</b> <u>The server encountered an internal error (Object Info not found for: workspace://SpacesStore/67f20d6b-5e3f-4c44-a10e-74e1872eb73e;1.0) that prevented it from fulfilling this request.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/6.0.26</h3></body></html>
—————————————————
04-19-2012 08:58 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.