chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Piergiorgio Lucidi <piergiorgioluc...@gmail.com>
Subject Re: CMIS and Lucene
Date Mon, 15 Aug 2011 17:09:46 GMT
I finished the integration test implementation using the latest OpenCMIS
InMemory Repository and it works fine in Apache ManifoldCF.

When does this new fix for the InMemory Repository will be available as
artifact in the public Maven repository?

Thank you.
Piergiorgio

2011/8/4 Piergiorgio Lucidi <piergiorgiolucidi@gmail.com>

> Hi Jens,
>
> 2011/8/4 Jens Hübel <jhuebel@opentext.com>
>
>> Hi Piergiorgio,
>>
>> you are right. I could reproduce the problem. There is a bug in the query
>> implementation of the InMemory server if you query for predefined properties
>> like cmis:name, cmis:createdBy, etc. :-(
>>
>> I have fixed this, so hopefully this works for you now if you take the
>> latest build. I have created CMIS-413 for this (
>> https://issues.apache.org/jira/browse/CMIS-414). Please reopen if you
>> still have issues.
>>
>
> Great! Thank you very much for fixing this issue, I'll let you know soon if
> it works for my integration test for ManifoldCF :)
>
>
>>
>> One more note: Your test code is quite fragile if you use a fixed name for
>> your test document/folder. This implementation does not allow multiple
>> objects with the same name in one folder. This means unless you restart the
>> server your code will work only once. I recommend you using a random UUID as
>> name or something like that. In the default configuration the InMemory
>> creates a tree of document and folders by default. So it might not be
>> necessary to create objects at all (use the Workbench to take a look at
>> that). If you really need this reproducible behavior there is an option to
>> run the server using the local binding in the same Java VM. Then you can
>> restart the server with each test. The InMemory JUnit tests use this
>> mechanism. I do not recommend this however, because you bypass the whole
>> protocol layer for AtomPub/SOAP. This leaves many issues undetected a client
>> may see in a real connection later (and of course you lose the option to
>> switch to another CMIS server just by changing configuration).
>>
>> Jens
>>
>
> Thanks for your suggestion!
>
> Now I would like to use the AtomPub protocol deployed using Maven, but I
> found a problem to configure Jetty with the latest version of the InMemory
> webapp, because there aren't anymore two dependencies: jsr250 and jsr181.
>
> Florian suggested a solution based on taking a look at the OpenCMIS code,
> I'll let you know about this :-P
>
> Now I'm finishing to implement the integration test code using the public
> Alfresco CMIS server and then I can start to integrate the latest version of
> the OpenCMIS InMemory server.
>
> Thank you all guys for your support.
>
> Piergiorgio
>
>
>>
>>
>> -----Original Message-----
>> From: Piergiorgio Lucidi [mailto:piergiorgiolucidi@gmail.com]
>> Sent: Mittwoch, 3. August 2011 14:48
>> To: dev@chemistry.apache.org
>> Subject: Re: CMIS and Lucene
>>
>> Hi Jens,
>>
>> here the code of my integration test that is used to create some content
>> in
>> the InMemory Repository, the OpenCMIS server is running because it is
>> bootstrapped by Jetty / Maven. The CMIS Repository Connector works fine
>> with
>> Alfresco 3.4d Community, but I would like to have the OpenCMIS server in
>> the
>> test suite.
>>
>> In the following snippet I started to initialize the test environment with
>> a
>> new folder with a new content, here I don't have any problem, it works
>> with
>> the InMemory Repository:
>>
>>  private Session getCmisClientSession(){
>> >     // default factory implementation
>> >     SessionFactory factory = SessionFactoryImpl.newInstance();
>> >     Map<String, String> parameters = new HashMap<String, String>();
>> >     // user credentials
>> >     parameters.put(SessionParameter.USER, "dummyuser");
>> >     parameters.put(SessionParameter.PASSWORD, "dummysecret");
>> >     // connection settings
>> >     parameters.put(SessionParameter.ATOMPUB_URL,
>> CMIS_ENDPOINT_TEST_SERVER
>> > );
>> >     parameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB
>> > .value());
>> >     // create session
>> >     return factory.getRepositories(parameters).get(0).createSession();
>> >   }
>> >  @Before
>> >   public void createTestArea()
>> >     throws Exception
>> >   {
>> >     try
>> >     {
>> >       Session session = getCmisClientSession();
>> >       //creating a new folder
>> >       Folder root = session.getRootFolder();
>> >       Map<String, Object> folderProperties = new HashMap<String,
>> > Object>();
>> >       folderProperties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
>> >       folderProperties.put(PropertyIds.NAME, "testdata");
>> >
>> >       Folder newFolder = root.createFolder(folderProperties);
>> >       //create a new content in the folder
>> >       String name = "testdata1.txt";
>> >       // properties
>> >       // (minimal set: name and object type id)
>> >       Map<String, Object> contentProperties = new HashMap<String,
>> > Object>();
>> >       contentProperties.put(PropertyIds.OBJECT_TYPE_ID,
>> "cmis:document");
>> >       contentProperties.put(PropertyIds.NAME, name);
>> >
>> >       // content
>> >       byte[] content = "CMIS Testdata One".getBytes();
>> >       InputStream stream = new ByteArrayInputStream(content);
>> >       ContentStream contentStream = new ContentStreamImpl(name,
>> newBigInteger(content),
>> > "text/plain", stream);
>> >
>> >        // create a major version
>> >       Document newContent1 = newFolder.createDocument(contentProperties,
>> > contentStream, null);
>>
>>
>> But if I try to search the new content in the InMemory Repository, in the
>> same way I implemented in the CMIS Repository Connector:
>>
>>  ItemIterable<QueryResult> results = session.query("SELECT * FROM
>> > cmis:folder WHERE cmis:name='testdata'", false);
>> >       for (QueryResult result : results) {
>> >         String id = result.getPropertyValueById(PropertyIds.OBJECT_ID);
>> >       }
>>
>>
>>
>> It returns the following exception:
>>
>>  org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException:
>> null
>> > at
>> >
>> org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(
>> > AbstractAtomPubService.java:450)
>> > at
>> >
>> org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(
>> > AbstractAtomPubService.java:568)
>> > at
>> >
>> org.apache.chemistry.opencmis.client.bindings.spi.atompub.DiscoveryServiceImpl.query(
>> > DiscoveryServiceImpl.java:141)
>> > at org.apache.chemistry.opencmis.client.runtime.SessionImpl$3.fetchPage(
>> > SessionImpl.java:557)
>> > at
>> >
>> org.apache.chemistry.opencmis.client.runtime.util.AbstractIterator.getCurrentPage(
>> > AbstractIterator.java:132)
>> > at
>> >
>> org.apache.chemistry.opencmis.client.runtime.util.CollectionIterator.hasNext(
>> > CollectionIterator.java:48)
>> > at org.apache.manifoldcf.cmis_tests.APISanityTest.createTestArea(
>> > APISanityTest.java:139)
>> > 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.RunBefores.evaluate(
>> > RunBefores.java:27)
>> > at org.junit.internal.runners.statements.RunAfters.evaluate(
>> > RunAfters.java:31)
>> > at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(
>> > BlockJUnit4ClassRunner.java:79)
>> > at org.junit.runners.BlockJUnit4ClassRunner.runChild(
>> > BlockJUnit4ClassRunner.java:71)
>> > at org.junit.runners.BlockJUnit4ClassRunner.runChild(
>> > BlockJUnit4ClassRunner.java:49)
>> > 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)
>>
>>
>> Let me know if you have any hints!
>>
>> Thank you again for your support.
>>
>> Regards,
>>
>> Piergiorgio
>>
>> 2011/8/3 Jens Hübel <jhuebel@opentext.com>
>>
>> > Hi Pergiorio,
>> >
>> > do you have a code piece that I can take a look at? What is your client
>> > API? Do you connect to Chemistry client API
>> (chemistry-opencmis-client-api)?
>> > Or perhaps you can grab the query sent from the log file?
>> >
>> > Thanks Jens
>> >
>> >
>> > -----Original Message-----
>> > From: Piergiorgio Lucidi [mailto:piergiorgiolucidi@gmail.com]
>> > Sent: Mittwoch, 3. August 2011 13:22
>> > To: dev@chemistry.apache.org
>> > Subject: Re: CMIS and Lucene
>> >
>> > Hi Jens,
>> >
>> > I contributed to the Apache ManifoldCF (ex Lucene Connector Framework)
>> > project implementing the CMIS Connector using OpenCMIS 0.4.0.
>> >
>> > Now I'm working on integration test trying to use the OpenCMIS InMemory
>> > Repository that is available from Apache Chemistry ;)
>> >
>> > I have some problems because now I'm finishing my test implementation
>> but
>> > it
>> > seems that I can't execute queries on the InMemory Repository, it
>> returns a
>> > null string in the convertStatusCode method.
>> >
>> > The CMIS Repository Connector that I implemented for ManifoldCF has a
>> job
>> > parameter that is the CMIS Query, this parameter is used by agents to
>> > select
>> > all the contents that needs to be indexed on the Output Connector (for
>> > example Apache Solr).
>> > Without a query feature exposed by the InMemory Repository I can't test
>> the
>> > connector in the right way.
>> >
>> > I tried to use the latest version of the InMemory Repository
>> > (0.5.0-SNAPSHOT) but with the same result.
>> >
>> > Have you got any ideas to solve this problem?
>> > Thank you for your support.
>> >
>> > Regards,
>> > Piergiorgio
>> >
>> >
>> > 2011/8/3 Jens Hübel <jhuebel@opentext.com>
>> >
>> > > Hi Chemistries,
>> > >
>> > >
>> > >
>> > > is anyone of us already involved in the Lucene project?
>> > >
>> > >
>> > >
>> > > Reading this here
>> > > http://search-lucene.com/m/wI38e1K3BWJ&subj=Re+CMIS+Connector+Tests
>> > >
>> > >
>> > >
>> > > I think it would make sense to give them an introduction to what we
>> have.
>> > >
>> > >
>> > >
>> > > if I understand this correctly one of the options they discuss is to
>> > create
>> > > an InMemory mock server. It does not make much sense to duplicate what
>> we
>> > > already have (and if we need getContentChanges() for that I am happy
>> to
>> > > implement this).
>> > >
>> > >
>> > >
>> > > Jens
>> > >
>> > >
>> > >
>> > >
>> >
>> >
>> > --
>> > Piergiorgio Lucidi
>> > Web: http://about.me/piergiorgiolucidi
>> >
>>
>>
>>
>> --
>> Piergiorgio Lucidi
>> Web: http://about.me/piergiorgiolucidi
>>
>
>
>
> --
> Piergiorgio Lucidi
> Web: http://about.me/piergiorgiolucidi
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message