From uima-user-return-779-apmail-incubator-uima-user-archive=incubator.apache.org@incubator.apache.org Thu Nov 01 17:41:22 2007 Return-Path: Delivered-To: apmail-incubator-uima-user-archive@locus.apache.org Received: (qmail 8764 invoked from network); 1 Nov 2007 17:41:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Nov 2007 17:41:22 -0000 Received: (qmail 34632 invoked by uid 500); 1 Nov 2007 17:41:09 -0000 Delivered-To: apmail-incubator-uima-user-archive@incubator.apache.org Received: (qmail 34618 invoked by uid 500); 1 Nov 2007 17:41:09 -0000 Mailing-List: contact uima-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: uima-user@incubator.apache.org Delivered-To: mailing list uima-user@incubator.apache.org Received: (qmail 34609 invoked by uid 99); 1 Nov 2007 17:41:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Nov 2007 10:41:09 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [130.83.174.24] (HELO lnx130.hrz.tu-darmstadt.de) (130.83.174.24) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Nov 2007 17:41:12 +0000 Received: from callisto.tk.informatik.tu-darmstadt.de (callisto.tk.informatik.tu-darmstadt.de [130.83.163.139]) by lnx130.hrz.tu-darmstadt.de (8.13.4/8.12.10) with ESMTP id lA1Heata032538 for ; Thu, 1 Nov 2007 18:40:36 +0100 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Set configuration parameters of a collection reader before it is initialized Date: Thu, 1 Nov 2007 18:40:31 +0100 Message-ID: <0DBCCB475CDE864F8F6086D69BFC5D9FF06786@CALLISTO.ntdom.tk.informatik.tu-darmstadt.de> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Set configuration parameters of a collection reader before it is initialized thread-index: AcgcrkxNvI/jOyXRStut6d2gNuVUMA== From: "Torsten Zesch" To: X-TUD-HRZ-MailScanner: Found to be clean X-TUD-HRZ-MailScanner-SpamCheck: X-MailScanner-From: zesch@tk.informatik.tu-darmstadt.de X-Virus-Checked: Checked by ClamAV on apache.org Hi all, I have written a CollectionReader that reads from a database. I added the database connection parameters as mandatory parameters to the descriptor. They are initialized with the correct values for the production database. Now, I want to write some unit tests that connect to a (always available) test database, as the production database might not be available at testing time. I tried it with the code below, but the the reader's initialize() method is already called when CollectionReader reader =3D UIMAFramework.produceCollectionReader(specifier); is executed. That means, the test will fail before it had the chance to reconfigure the parameters. Is there any way to set the configuration parameters of a collection reader before it is actually initialized? Thanks, Torsten // a map that contains the configuration parameters Map configParameters =3D new HashMap() {{ // fill the map with some parameters ... =20 try { XMLInputSource xmlInput =3D new = XMLInputSource(descriptorFileReader); ResourceSpecifier specifier =3D UIMAFramework.getXMLParser().parseResourceSpecifier(xmlInput); CollectionReader reader =3D UIMAFramework.produceCollectionReader(specifier); for (String key : configParameters.keySet()) { reader.setConfigParameterValue(key, configParameters.get(key)); } reader.reconfigure(); =20 // testing the reader ... =20 } // a lot of catches