uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Torsten Zesch" <ze...@tk.informatik.tu-darmstadt.de>
Subject Set configuration parameters of a collection reader before it is initialized
Date Thu, 01 Nov 2007 17:40:31 GMT
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 =

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?


// a map that contains the configuration parameters
Map<String,Object> configParameters = new HashMap<String, Object>() {{
// fill the map with some parameters

try {
    XMLInputSource xmlInput = new XMLInputSource(descriptorFileReader);
    ResourceSpecifier specifier =

    CollectionReader reader =

    for (String key : configParameters.keySet()) {
        reader.setConfigParameterValue(key, configParameters.get(key));
    // testing the reader
// a lot of catches

View raw message