Return-Path: X-Original-To: apmail-incubator-connectors-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-connectors-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9FE097DD4 for ; Wed, 3 Aug 2011 16:51:24 +0000 (UTC) Received: (qmail 46871 invoked by uid 500); 3 Aug 2011 16:51:24 -0000 Delivered-To: apmail-incubator-connectors-dev-archive@incubator.apache.org Received: (qmail 46844 invoked by uid 500); 3 Aug 2011 16:51:23 -0000 Mailing-List: contact connectors-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: connectors-dev@incubator.apache.org Delivered-To: mailing list connectors-dev@incubator.apache.org Received: (qmail 46836 invoked by uid 99); 3 Aug 2011 16:51:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Aug 2011 16:51:23 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of daddywri@gmail.com designates 209.85.216.47 as permitted sender) Received: from [209.85.216.47] (HELO mail-qw0-f47.google.com) (209.85.216.47) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Aug 2011 16:51:18 +0000 Received: by qwh5 with SMTP id 5so632851qwh.6 for ; Wed, 03 Aug 2011 09:50:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=zOoYTOVkRhyjlUaGLaIEn4EHCexSowBQ+1EshbjHA7M=; b=PemQbxgGVozxAuNUGDk6hZ6+stZAOajMg6B+68ljGUZuVI3nD+dc1y1GhRX9dc/hr+ l91iOfy8P2fpYL6MXQn3LdmyHsG6rzwb/9CU3wUnhmRsF6mCG7O8730H8aXGhVbtCIEt Cy/lNfAWogkRQvLJX4keMyxt87r90b4s9uKS8= MIME-Version: 1.0 Received: by 10.229.101.143 with SMTP id c15mr5550342qco.36.1312390258070; Wed, 03 Aug 2011 09:50:58 -0700 (PDT) Received: by 10.229.81.11 with HTTP; Wed, 3 Aug 2011 09:50:58 -0700 (PDT) In-Reply-To: References: Date: Wed, 3 Aug 2011 12:50:58 -0400 Message-ID: Subject: Re: CMIS Connector - Tests From: Karl Wright To: connectors-dev@incubator.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable The ConfigParams class is, I believe, derived from the Configuration class. So, you can create a ConfigParams object instead of a Configuration object if you want to use the API in the manner you describe. The reason your commented-out code doesn't work is because the setParameter() method isn't doing quite what you are expecting. It's creating a node named "_PARAMETER_" with a "name" attribute and a value area, and you are creating nodes named by the parameter name. Karl On Wed, Aug 3, 2011 at 12:41 PM, Piergiorgio Lucidi wrote: > I'm trying to implement tests but I found a problem to set all the needed > parameters to the CMIS Repository Connector that needs: an username, a > password and the endpoint (url). > > I need to know how to create the configuration nodes for the connector, i= n > the connector code I managed the configuration parameters in this way in = the > processConfigurationPost method: > > =A0public String processConfigurationPost(IThreadContext threadContext, >> =A0 =A0 =A0 IPostParameters variableContext, ConfigParams parameters) >> =A0 =A0 =A0 throws ManifoldCFException { >> =A0 =A0 String username =3D variableContext.getParameter(CONFIG_PARAM_US= ERNAME); >> =A0 =A0 if (StringUtils.isNotEmpty(username)) >> =A0 =A0 =A0 parameters.setParameter(CONFIG_PARAM_USERNAME, username); >> =A0 =A0 String password =3D variableContext.getParameter(CONFIG_PARAM_PA= SSWORD); >> =A0 =A0 if (StringUtils.isNotEmpty(password)) >> =A0 =A0 =A0 parameters.setParameter(CONFIG_PARAM_PASSWORD, password); >> =A0 =A0 String endpoint =3D variableContext.getParameter(CONFIG_PARAM_EN= DPOINT); >> =A0 =A0 if (StringUtils.isNotEmpty(endpoint) && endpoint.length() > 0) >> =A0 =A0 =A0 parameters.setParameter(CONFIG_PARAM_ENDPOINT, endpoint); >> =A0 =A0 String repositoryId =3D variableContext >> =A0 =A0 =A0 =A0 .getParameter(CONFIG_PARAM_REPOSITORY_ID); >> =A0 =A0 if (StringUtils.isNotEmpty(repositoryId)) >> =A0 =A0 =A0 parameters.setParameter(CONFIG_PARAM_REPOSITORY_ID, reposito= ryId); >> =A0 =A0 return null; >> =A0 } > > > Now I have to setup the same parameters inside my test class APISanityTes= t > that doesn't like the following snippet, it works only if CMIS parameters > are commented as the following: > > =A0@Test >> =A0 public void sanityCheck() >> =A0 =A0 throws Exception >> =A0 { >> =A0 =A0 try >> =A0 =A0 { >> =A0 =A0 =A0 // Hey, we were able to install the file system connector et= c. >> =A0 =A0 =A0 // Now, create a local test job and run it. >> =A0 =A0 =A0 IThreadContext tc =3D ThreadContextFactory.make(); >> =A0 =A0 =A0 int i; >> =A0 =A0 =A0 IJobManager jobManager =3D JobManagerFactory.make(tc); >> =A0 =A0 =A0 // Create a basic file system connection, and save it. >> =A0 =A0 =A0 ConfigurationNode connectionObject; >> =A0 =A0 =A0 ConfigurationNode child; >> =A0 =A0 =A0 Configuration requestObject; >> =A0 =A0 =A0 Configuration result; >> >> =A0 =A0 =A0 connectionObject =3D new ConfigurationNode("repositoryconnec= tion"); >> >> =A0 =A0 =A0 child =3D new ConfigurationNode("name"); >> =A0 =A0 =A0 child.setValue("CMIS Connection"); >> =A0 =A0 =A0 connectionObject.addChild(connectionObject.getChildCount(),c= hild); >> >> =A0 =A0 =A0 child =3D new ConfigurationNode("class_name"); >> =A0 =A0 =A0 child.setValue( >> "org.apache.manifoldcf.crawler.connectors.cmis.CmisRepositoryConnector")= ; >> =A0 =A0 =A0 connectionObject.addChild(connectionObject.getChildCount(),c= hild); >> >> =A0 =A0 =A0 child =3D new ConfigurationNode("description"); >> =A0 =A0 =A0 child.setValue("CMIS Connection"); >> =A0 =A0 =A0 connectionObject.addChild(connectionObject.getChildCount(),c= hild); >> =A0 =A0 =A0 child =3D new ConfigurationNode("max_connections"); >> =A0 =A0 =A0 child.setValue("10"); >> =A0 =A0 =A0 connectionObject.addChild(connectionObject.getChildCount(),c= hild); >> >> =A0 =A0 =A0 //setting the CMIS specific parameters >> // =A0 =A0 =A0child =3D new ConfigurationNode("username"); >> // =A0 =A0 =A0child.setValue(CMIS_USERNAME); >> // =A0 =A0 =A0connectionObject.addChild(connectionObject.getChildCount()= ,child); >> // >> // =A0 =A0 =A0child =3D new ConfigurationNode("password"); >> // =A0 =A0 =A0child.setValue(CMIS_PASSWORD); >> // =A0 =A0 =A0connectionObject.addChild(connectionObject.getChildCount()= ,child); >> // >> // =A0 =A0 =A0child =3D new ConfigurationNode("endpoint"); >> // =A0 =A0 =A0child.setValue(CMIS_ENDPOINT_TEST_SERVER); >> // =A0 =A0 =A0connectionObject.addChild(connectionObject.getChildCount()= ,child); >> =A0 =A0 =A0 requestObject =3D new Configuration(); >> =A0 =A0 =A0 requestObject.addChild(0,connectionObject); >> >> =A0 =A0 =A0 result =3D performAPIPutOperationViaNodes( >> "repositoryconnections/CMIS%20Connection",201,requestObject); > > > How can I set the username, password and endpoint for the CMIS Repository > Connector parameters in this test class? > > Thank you. > > Piergiorgio > > > 2011/8/2 Karl Wright > >> Thanks for the status report. =A0I hope to see your patch soon! >> >> Also, FWIW, once the documentation is also done I'd like to consider >> solidifying the 0.3 release. =A0It's got a lot of good stuff in it and I >> think as soon as we've finished off the new CMIS connector in all >> dimensions we should go ahead. =A0Thoughts, anyone? >> >> Karl >> >> >> On Tue, Aug 2, 2011 at 5:00 AM, Piergiorgio Lucidi >> wrote: >> > Yesterday I started to work on end-to-end integration test for the CMI= S >> > Connector and now I have a full running OpenCMIS test server integrate= d >> with >> > the ManifoldCF Maven build process. >> > >> > Now I have to implement: >> > - a setup method to create the test documents in the CMIS server >> > - a null output connector using the ManifoldCF api >> > - tests using the ManifoldCF api to create a mock configuration agains= t >> the >> > test CMIS server >> > >> > I'll let you know when it works. >> > >> > Regards, >> > Piergiorgio >> > >> > 2011/7/29 Piergiorgio Lucidi >> > >> >> Hi Karl, >> >> >> >> thank you for the details and as soon as I finish a first version of >> >> integration and/or unit test I will create a new ticket in the CMIS >> >> Component to release the patch. >> >> >> >> I hope to release this new patch soon. >> >> I'll let you know during the next week. >> >> >> >> Piergiorgio >> >> >> >> >> >> 2011/7/28 Karl Wright >> >> >> >>> The tests/filesystem/src/test/java area are end-to-end tests >> >>> principally designed to test the filesystem connector. =A0(They also >> >>> involve other connectors because, obviously, an end-to-end test is n= ot >> >>> going going to work without them. =A0This is why they are at the roo= t >> >>> level.) >> >>> >> >>> There are also unit tests you can use as models under >> >>> connectors/filesystem/connector/src/test/.... =A0These tests use onl= y >> >>> the filesystem connector, no others. >> >>> >> >>> If you would be so kind as to create a ticket to cover your test wor= k, >> >>> that would be great. >> >>> >> >>> Also, another workitem I've been meaning to get to but haven't >> >>> involves the conversion of a python-based HTML browser and Javascrip= t >> >>> engine I wrote for MetaCarta into a Java equivalent. =A0This would a= llow >> >>> direct testing of the UI components of the framework and connectors. >> >>> The python sources are in: >> >>> >> >>> legacy-tests/VirtualBrowser.py >> >>> and >> >>> legacy-tests/Javascript.py >> >>> >> >>> You may not have time to get that far for a while, but I thought you= 'd >> >>> want to know where my thoughts were headed. ;-) >> >>> >> >>> Karl >> >>> >> >>> On Thu, Jul 28, 2011 at 2:03 PM, Piergiorgio Lucidi >> >>> wrote: >> >>> > I'm starting to think a way to implement tests for the CMIS >> Connector, >> >>> > probably I can use the Apache Chemistry (OpenCMIS) local binding t= o >> >>> create a >> >>> > mock of a CMIS Server (an InMemory repository), but I have to chec= k >> this >> >>> > possibility because I'm not sure that all the features are now >> >>> implemented. >> >>> > >> >>> > Anyway I saw some test classes for the filesystem connector at the >> >>> following >> >>> > package: >> >>> > >> >>> > tests/filesystem/src/test/java >> >>> > >> >>> > Could you please confirm that these classes could be taken as an >> example >> >>> for >> >>> > tests? >> >>> > Or do I need to take a look at other classes? >> >>> > >> >>> > Thank you. >> >>> > Piergiorgio >> >>> > >> >>> > -- >> >>> > Piergiorgio Lucidi >> >>> > Web: http://about.me/piergiorgiolucidi >> >>> > >> >>> >> >> >> >> >> >> >> >> -- >> >> Piergiorgio Lucidi >> >> Web: http://about.me/piergiorgiolucidi >> >> >> >> >> > >> > >> > -- >> > Piergiorgio Lucidi >> > Web: http://about.me/piergiorgiolucidi >> > >> > > > > -- > Piergiorgio Lucidi > Web: http://about.me/piergiorgiolucidi >