commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <oliver.he...@oliver-heger.de>
Subject Re: [CONFIGURATION] FileChangedReloadingStrategy not working for SubnodeConfiguration with a CombinedConfiguration parent
Date Fri, 17 Oct 2008 17:19:39 GMT
Brian Pugh schrieb:
> Hi,
> 
> I'm somewhat new to configuration and have run into what appears to be a bug (but maybe
I'm just doing something wrong).  I'm hoping to either confirm that this is a bug (in which
case I'll enter a JIRA) or get some insight on what I'm doing wrong.
> 
> I'm trying to use an Combined configuration that consists of two XMLConfigurations. 
I want to then get a SubnodeConfiguration from the combined configuration.  The XMLConfigurations
have the FileChangedReloadingStrategy set, the combined configuration has the setForceReloadCheck
flag set and the subnodeconfiguration was obtained passing in the true flag to the configurationAt
method.  However, I don't seem to see changes that are made to the two underlying files. 
It does work if I operate on the combined configuration or if a subnodeconfiguration has an
XMLConfiguration as its parent, but if a subnode configuration has a combined configuration
as the parent, the changes are not detected.  
> 
> Below is some code that shows how I'm using the various configurations and the various
scenarios I described above.  The last assertion fails because the change to the file is not
detected when the subnodeconfiguration has a parent that is a combinedconfiguration.  Any
help or insight would be greatly appreciated!
> 
Unfortunately I have to confirm that this is a bug: the reloading check 
obviously does not work in the constellation you describe.

So it would be great if you could create a ticket in Jira.

Thanks
Oliver

> 
>  @Test
>   public void testSubnodeReadload() throws ConfigurationException {
>     XMLConfiguration xmlConfiguration = new XMLConfiguration("service.xml");
>     FileChangedReloadingStrategy fileReloadStrategy = new FileChangedReloadingStrategy();
>     fileReloadStrategy.setRefreshDelay(1000);
>     xmlConfiguration.setReloadingStrategy(fileReloadStrategy);
>     XMLConfiguration config2 = new XMLConfiguration("environment.xml");
>     FileChangedReloadingStrategy fileReloadStrategy2 = new FileChangedReloadingStrategy();
>     fileReloadStrategy2.setRefreshDelay(1000);
>     xmlConfiguration.setReloadingStrategy(fileReloadStrategy2);
> 
>     CombinedConfiguration combinedConfig = new CombinedConfiguration();
>     combinedConfig.setForceReloadCheck(true);
>     combinedConfig.addConfiguration(xmlConfiguration);
>     combinedConfig.addConfiguration(config2);
>     int queue0threads2 = xmlConfiguration.getInt("messaging-new.queue(0).threads");
>     assert 2 == queue0threads2;
> 
>     //change the value in service.xml to 4
>     int queue0threads4 = xmlConfiguration.getInt("messaging-new.queue(0).threads");
>     assert 4 == queue0threads4;
> 
> 
>     SubnodeConfiguration subConfigHier = xmlConfiguration.configurationAt("messaging-new.queue(0)",
true);
>     int queue0threadsCombinedSub4 = subConfigHier.getInt("threads");
>     assert queue0threadsCombinedSub4 == 4;
> 
>     //change the value service.xml to 8
>     int queue0threadsCombinedSub8 = subConfigHier.getInt("threads");
>     assert queue0threadsCombinedSub8 == 8;
> 
> 
>     SubnodeConfiguration subNodeConfigParentIsCombinedConfig = combinedConfig.configurationAt("messaging-new.queue(0)",
true);
>     int queue0threadsSub8 = subNodeConfigParentIsCombinedConfig.getInt("threads");
>     assert queue0threadsSub8 == 8;
> 
>     //change the value service.xml file to 16
>     int queue0threadsSub16 = subNodeConfigParentIsCombinedConfig.getInt("threads");
>     assert queue0threadsSub16 == 16;         //THIS TEST FAILS
> 
>   }
> 
> 
> 
> 
> 
>       


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message