Package org.apache.commons.configuration2.reloading

Examples of org.apache.commons.configuration2.reloading.ReloadingDetector


     * occurs.
     */
    @Test
    public void testResetBuilderOnReloadingEvent()
    {
        ReloadingDetector detector =
                EasyMock.createMock(ReloadingDetector.class);
        EasyMock.expect(detector.isReloadingRequired()).andReturn(Boolean.TRUE);
        EasyMock.replay(detector);
        ReloadingController controller = new ReloadingController(detector);
        BasicConfigurationBuilder<Configuration> builder =
                new BasicConfigurationBuilder<Configuration>(
                        PropertiesConfiguration.class);
View Full Code Here


     */
    @Test
    public void testCreateReloadingDetectoryCustomFactory()
            throws ConfigurationException
    {
        ReloadingDetector detector =
                EasyMock.createMock(ReloadingDetector.class);
        ReloadingDetectorFactory factory =
                EasyMock.createMock(ReloadingDetectorFactory.class);
        FileHandler handler = new FileHandler();
        FileBasedBuilderParametersImpl params =
View Full Code Here

     */
    @Test
    public void testReloadingDetectorIsReloadingRequired()
            throws ConfigurationException
    {
        ReloadingDetector detector =
                EasyMock.createMock(ReloadingDetector.class);
        EasyMock.expect(detector.isReloadingRequired()).andReturn(Boolean.TRUE);
        EasyMock.expect(detector.isReloadingRequired())
                .andReturn(Boolean.FALSE);
        EasyMock.replay(detector);
        ReloadingFileBasedConfigurationBuilderTestImpl builder =
                new ReloadingFileBasedConfigurationBuilderTestImpl(detector);
        builder.getConfiguration();
        ReloadingDetector ctrlDetector =
                builder.getReloadingController().getDetector();
        assertTrue("Wrong result (1)", ctrlDetector.isReloadingRequired());
        assertFalse("Wrong result (2)", ctrlDetector.isReloadingRequired());
        assertSame("Wrong file handler", builder.getFileHandler(),
                builder.getHandlerForDetector());
        EasyMock.verify(detector);
    }
View Full Code Here

     */
    @Test
    public void testReloadingDetectorReloadingPerformed()
            throws ConfigurationException
    {
        ReloadingDetector detector =
                EasyMock.createMock(ReloadingDetector.class);
        detector.reloadingPerformed();
        EasyMock.replay(detector);
        ReloadingFileBasedConfigurationBuilderTestImpl builder =
                new ReloadingFileBasedConfigurationBuilderTestImpl(detector);
        builder.getConfiguration();
        ReloadingDetector ctrlDetector =
                builder.getReloadingController().getDetector();
        ctrlDetector.reloadingPerformed();
        EasyMock.verify(detector);
    }
View Full Code Here

    public void testReloadingDetectorNoFileHandler()
    {
        ReloadingFileBasedConfigurationBuilder<PropertiesConfiguration> builder =
                new ReloadingFileBasedConfigurationBuilder<PropertiesConfiguration>(
                        PropertiesConfiguration.class);
        ReloadingDetector ctrlDetector =
                builder.getReloadingController().getDetector();
        ctrlDetector.reloadingPerformed();
        assertFalse("Wrong result", ctrlDetector.isReloadingRequired());
    }
View Full Code Here

     */
    @Test
    public void testResetReloadingStateInGetConfiguration()
            throws ConfigurationException
    {
        ReloadingDetector detector =
                EasyMock.createMock(ReloadingDetector.class);
        EasyMock.expect(detector.isReloadingRequired()).andReturn(Boolean.TRUE);
        detector.reloadingPerformed();
        EasyMock.replay(detector);
        ReloadingFileBasedConfigurationBuilderTestImpl builder =
                new ReloadingFileBasedConfigurationBuilderTestImpl(detector);
        PropertiesConfiguration config1 = builder.getConfiguration();
        builder.getReloadingController().checkForReloading(null);
View Full Code Here

     * controller.
     */
    @Test
    public void testReloadingControllerEvents() throws ConfigurationException
    {
        ReloadingDetector detector =
                EasyMock.createMock(ReloadingDetector.class);
        EasyMock.expect(detector.isReloadingRequired()).andReturn(Boolean.TRUE);
        ReloadingFileBasedConfigurationBuilderTestImpl builder =
                new ReloadingFileBasedConfigurationBuilderTestImpl(detector);
        EasyMock.replay(detector);
        BuilderEventListenerImpl listener = new BuilderEventListenerImpl();
        builder.addEventListener(ConfigurationBuilderEvent.RESET, listener);
View Full Code Here

            config.addConfiguration(new BaseHierarchicalConfiguration());
        }
        config.getConfiguration(0).addProperty(KEY_CONCURRENT, TEST_NAME);

        // Set a single synchronizer for all involved configurations
        Synchronizer sync = new ReadWriteSynchronizer();
        config.setSynchronizer(sync);
        for (Configuration c : config.getConfigurations())
        {
            c.setSynchronizer(sync);
        }
View Full Code Here

     * @since 2.0
     */
    @Override
    public final Synchronizer getSynchronizer()
    {
        Synchronizer sync = synchronizer;
        return (sync != null) ? sync : NoOpSynchronizer.INSTANCE;
    }
View Full Code Here

            config.addConfiguration(new BaseHierarchicalConfiguration());
        }
        config.getConfiguration(0).addProperty(KEY_CONCURRENT, TEST_NAME);

        // Set a single synchronizer for all involved configurations
        Synchronizer sync = new ReadWriteSynchronizer();
        config.setSynchronizer(sync);
        for (Configuration c : config.getConfigurations())
        {
            c.setSynchronizer(sync);
        }
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration2.reloading.ReloadingDetector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.