Arnaud Fontenoy created CMIS-552:
------------------------------------

             Summary: Dotcmis, searching just after deleting and creating
                 Key: CMIS-552
                 URL: https://issues.apache.org/jira/browse/CMIS-552
             Project: Chemistry
          Issue Type: Bug
         Environment: dotcmis, .net 4.0, alfresco
            Reporter: Arnaud Fontenoy


I try to integrate dotcmis and alfresco into my application.
When creating my unit tests, I face this issue :
- I set up my test environment by deleting "myfolder" if any
- I create back myfolder and put a document into it

then I try to find the document :
- The first time (when myfolder does not exist before), Search returns 0 results
- Next times, when myfolder exists before and is deleted by my test setup, I 
get an exception :
<html><head><title>Apache Chemistry OpenCMIS - runtime 
error</title><style><!--H1 
{font-size:24px;line-height:normal;font-weight:bold;background-color:#f0f0f0;color:#003366;border-bottom:1px
 solid #3c78b5;padding:2px;} BODY 
{font-family:Verdana,arial,sans-serif;color:black;font-size:14px;} HR 
{color:#3c78b5;height:1px;}--></style></head><body><h1>HTTP Status 500 - 
<!--exception-->runtime<!--/exception--></h1><p><!--message-->Node does not 
exist: missing://missing/missing(null)<!--/message--></p><hr 
noshade='noshade'/><!--stacktrace--><pre>
org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException: Node 
does not exist: missing://missing/missing(null)
        at 
org.alfresco.opencmis.AlfrescoCmisExceptionInterceptor.invoke(AlfrescoCmisExceptionInterceptor.java:80)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at 
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at $Proxy261.query(Unknown Source)
        at 
org.apache.chemistry.opencmis.server.support.CmisServiceWrapper.query(CmisServiceWrapper.java:1031)
        at 
org.apache.chemistry.opencmis.server.impl.atompub.DiscoveryService.query(DiscoveryService.java:126)
        at sun.reflect.GeneratedMethodAccessor899.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at 
org.apache.chemistry.opencmis.server.shared.Dispatcher.dispatch(Dispatcher.java:83)
        at 
org.apache.chemistry.opencmis.server.impl.atompub.CmisAtomPubServlet.dispatch(CmisAtomPubServlet.java:218)
        at 
org.apache.chemistry.opencmis.server.impl.atompub.CmisAtomPubServlet.service(CmisAtomPubServlet.java:167)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at 
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861)
        at 
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
        at 
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584)
        at java.lang.Thread.run(Thread.java:662)
Caused by: org.alfresco.service.cmr.repository.InvalidNodeRefException: Node 
does not exist: missing://missing/missing(null)
        at 
org.alfresco.repo.node.db.DbNodeServiceImpl.getNodePairNotNull(DbNodeServiceImpl.java:176)
        at 
org.alfresco.repo.node.db.DbNodeServiceImpl.getType(DbNodeServiceImpl.java:753)
        at sun.reflect.GeneratedMethodAccessor259.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at 
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at 
org.alfresco.repo.tenant.MultiTNodeServiceInterceptor.invoke(MultiTNodeServiceInterceptor.java:104)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at 
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at $Proxy8.getType(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor259.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at 
org.alfresco.repo.service.StoreRedirectorProxyFactory$RedirectorInvocationHandler.invoke(StoreRedirectorProxyFactory.java:215)
        at $Proxy9.getType(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor259.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at 
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at 
org.alfresco.repo.tagging.TagScopePropertyMethodInterceptor.invoke(TagScopePropertyMethodInterceptor.java:152)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at 
org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterceptor.java:305)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at 
org.alfresco.repo.tagging.TagScopePropertyMethodInterceptor.invoke(TagScopePropertyMethodInterceptor.java:152)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at 
org.alfresco.repo.tagging.TagScopePropertyMethodInterceptor.invoke(TagScopePropertyMethodInterceptor.java:152)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at 
org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterceptor.java:305)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at 
org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:269)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at 
org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterceptor.java:305)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at 
org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:269)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at 
org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:269)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at 
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at $Proxy8.getType(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor259.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at 
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at 
org.alfresco.repo.audit.DisableAuditableBehaviourInterceptor.invoke(DisableAuditableBehaviourInterceptor.java:113)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at 
net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:80)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at 
org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:46)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at 
org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:147)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at 
org.alfresco.repo.transaction.RetryingTransactionInterceptor$1.execute(RetryingTransactionInterceptor.java:69)
        at 
org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:388)
        at 
org.alfresco.repo.transaction.RetryingTransactionInterceptor.invoke(RetryingTransactionInterceptor.java:59)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at 
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at $Proxy8.getType(Unknown Source)
        at org.alfresco.opencmis.CMISConnector.getType(CMISConnector.java:772)
        at org.alfresco.opencmis.CMISConnector.query(CMISConnector.java:2052)
        at 
org.alfresco.opencmis.AlfrescoCmisServiceImpl.query(AlfrescoCmisServiceImpl.java:2101)
        at sun.reflect.GeneratedMethodAccessor900.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at 
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at 
org.alfresco.repo.transaction.RetryingTransactionInterceptor$1.execute(RetryingTransactionInterceptor.java:69)
        at 
org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:388)
        at 
org.alfresco.repo.transaction.RetryingTransactionInterceptor.invoke(RetryingTransactionInterceptor.java:59)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at 
org.alfresco.opencmis.AlfrescoCmisServiceInterceptor.invoke(AlfrescoCmisServiceInterceptor.java:90)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at 
org.alfresco.opencmis.AlfrescoCmisExceptionInterceptor.invoke(AlfrescoCmisExceptionInterceptor.java:50)
        ... 28 more

</pre><!--/stacktrace--><hr noshade='noshade'/></body></html>



When I go to Alfresco, the document exists.
It seems that the folder and document are not yet disponible for query, but why 
?
If I put in comment the test environment init, the document is found

Maybe I do something wrong but what ?

Here is my code :
[TestMethod()]
[DeploymentItem(@"Files\SearchTest_1", @"Files\SearchTest_1")]
public void SearchTest_2()
{
    string myfoldername = "myfolder";

    // Session creation
    var p = new Dictionary<String, String>();
    p[SessionParameter.User] = _userName;
    p[SessionParameter.Password] = _userPassword;
    p[SessionParameter.BindingType] = BindingType.AtomPub;
    p[SessionParameter.AtomPubUrl] = _serverUrl;

    var session = 
DotCMIS.Client.Impl.SessionFactory.NewInstance().GetRepositories(p)[0].CreateSession();
    session.DefaultContext.CacheEnabled = false;
    var operationContext = session.CreateOperationContext();
    operationContext.IncludeAcls = true;
            
    // Delete and create back folder and document
    // /*
    DotCMIS.Client.IFolder rootFolder = 
this._testSession.GetRootFolder(operationContext);
    DotCMIS.Client.IFolder myFolder = null;
    Dictionary<String, Object> properties = null;

    // Le dossier de destination des tests existe-t-il ?
    var myFolderExists = rootFolder.GetChildren(operationContext).Any(child => 
child.Name.Equals(myfoldername));
    if (myFolderExists)
    {
        myFolder = 
(DotCMIS.Client.IFolder)session.GetObjectByPath(String.Format(@"/{0}", 
myfoldername), operationContext);
        myFolder.DeleteTree(true, DotCMIS.Enums.UnfileObject.Delete, true);
    }

    properties = new Dictionary<String, Object>();
    properties[PropertyIds.Name] = myfoldername;
    properties[PropertyIds.ObjectTypeId] = "cmis:folder";
    myFolder = rootFolder.CreateFolder(properties);
    rootFolder.Refresh();

    myFolder = 
(DotCMIS.Client.IFolder)session.GetObjectByPath(String.Format(@"/{0}", 
myfoldername), operationContext);

    FileInfo sourceFile = new FileInfo(@"Files\SearchTest_1\SearchTest_1.pdf");
    properties = new Dictionary<String, Object>();

    properties[PropertyIds.ObjectTypeId] = "cmis:document";
    properties[PropertyIds.Name] = sourceFile.Name;

    using (var fileStream = sourceFile.OpenRead())
    {
        var contentStream = new DotCMIS.Data.Impl.ContentStream();
        contentStream.MimeType = "application/pdf";
        contentStream.Stream = fileStream;
        contentStream.Length = fileStream.Length;
        //this._testSession.CreateDocument(properties, 
this._testSession.CreateObjectId(myFolder.Id), contentStream, null);
        DotCMIS.Client.IDocument createdDocument = 
myFolder.CreateDocument(properties, contentStream, null);
    }

    // */

    // Recherche
    string query = @"SELECT * FROM cmis:document WHERE cmis:name = 
'SearchTest_1.pdf'";
    var results = this._testSession.Query(query, false, 
operationContext).ToArray();
    Assert.AreEqual(1, results.Length);
}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to