cancel
Showing results for 
Search instead for 
Did you mean: 

Nuxeo IDE Unit test: Cannot find MailMessage Type!

karl_harris_
Star Collaborator
Star Collaborator

I am trying to implement a version of the code outlined in this blog. My goal is to read a .msg (a mail message saved from Outlook) file placed in Nuxeo via webDAV and store it, within Nuxeo, in a Nuxeo JSF readable and indexable format using the MailMessage document type.

I have a unit test class with the following annotations in front of the class definition:

@RunWith(FeaturesRunner.class) @Features(PlatformFeature.class) @Deploy({ "org.nuxeo.ecm.platform.mail", "org.nuxeo.ecm.platform.mail.web", "org.nuxeo.ecm.platform.mail.types", "org.nuxeo.ecm.platform.mimetype.api", "org.nuxeo.ecm.platform.mimetype.core", "org.nuxeo.ecm.platform.mail.core.types.contrib" }) @RepositoryConfig(type=BackendType.H2, user = "Administrator", init=DefaultRepositoryInit.class)

The unit test links remotely with Eclipse Debug and I can control the test. As I work through the code I find the, mail services are running and I can create a document structure containing workspaces and folders.

I am creating a Folder Document Type to contain a MailMessage for testing. Following code sequence does NOT find a MailMessage document type (docType is null).

        DocumentType docType = getSession().getTypeManager().getDocumentType(
                typeName);
        if (docType == null) {
            throw new ClientException(typeName
                    + " is not a registered core type");
        }

Going into the "getDocumentType" method reveals the MailMessage document type is not on the HashMap that is checked. All the parameters (typeName) and the getSession and getTypeManager method calls are correct and/or return the correct values.

It appears the @Deploys are not deploying the MailMessage documentTypes. However could my problem be with trying to store a MailMessage document type in a Folder document type?

Question: Can I store MailMessages into a Folder document type or do I need to create a MailFolder to hold MailMessages? If I need a MailFolder is there any reason why I cannot create a MailMessage in a Folder document type using custom setup and custom code? (eg allowing MailMessages to be children in a Folder document type and using the techniques mention in the blog above)

I am using Nuxeo v5.6 using Eclipse Juno for remote debugging.

Thanks,

Karl

2 REPLIES 2

Vladimir_Pasqui
Star Collaborator
Star Collaborator

Hi,

karl_harris_
Star Collaborator
Star Collaborator

First Thank You Vladimir for your reply.

Turning on logging, which i found out requires a log4j.properties/xml file in /src/test/resources directory, revealed I did not have a Maven dependency set up for org.nuxeo.ecm.platform.mail.types along with several other bundles. Adding the dependency(s) to the .pom file fixed the issue of the missing document type.

Karl

Getting started

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.