Hello,
I'm having some troubles writing a JUnit to test my changes to Advanced
Search in Nuxeo 5.3 with QueryModelService.
In Nuxeo the search works fine, but in the JUnit test when I initialize the
DocumentModel of my advanced search to pass to the constructor of
QueryModel, I receive a ClientException saying that my DocType for the
advanced search is not a registered core type.

The code is the following:

        final QueryModelService queryModelService = (QueryModelService)
Framework.getRuntime().getComponent(QueryModelService.NAME);
        final QueryModel advanceSearch =
initializeStatefulQueryModel(queryModelService.getQueryModelDescriptor("ADVANCED_SEARCH"));
        final QueryModelDescriptor desc = advanceSearch.getDescriptor();
        final DocumentModel search = advanceSearch.getDocumentModel();
        search.setProperty("expediente_advanced_search", "eas_denominacion",
"Prueba");

        final String query = desc.getQuery(search);
        final DocumentModelList list = session.query(query);
        Assert.assertEquals(1, list.size());
        Assert.assertEquals("test-id-3", list.get(0).getName());
    }

    protected QueryModel initializeStatefulQueryModel(final
QueryModelDescriptor descriptor)
    throws ClientException
{
final DocumentModel documentModel =
session.createDocumentModel(descriptor.getDocType()); // CLIENT EXCEPTION
HERE
return new QueryModel(descriptor, documentModel);
}


I thought something is missing in the deployBundle, but I'm already
deploying the org.nuxeo.ecm.platform.search.api as well al my project and I
have no idea abouth anything else to add...

well, long story short, I have no idea about what's the problem here.

Thanks in advance,

Gianluca Ferrario
_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm

Reply via email to