Examples of ReloadingController


Examples of org.apache.commons.configuration.reloading.ReloadingController

     * @return the new {@code ReloadingController}
     */
    private ReloadingController createReloadingController()
    {
        ReloadingDetector ctrlDetector = createReloadingDetectorForController();
        ReloadingController ctrl = new ReloadingController(ctrlDetector);
        connectToReloadingController(ctrl);
        return ctrl;
    }
View Full Code Here

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

    {
        ReloadingDetector detector =
                EasyMock.createNiceMock(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);
        Configuration configuration = builder.getConfiguration();

        builder.connectToReloadingController(controller);
        controller.checkForReloading(null);
        assertTrue("Not in reloading state", controller.isInReloadingState());
        assertNotSame("No new configuration created", configuration,
                builder.getConfiguration());
        assertFalse("Still in reloading state", controller.isInReloadingState());
    }
View Full Code Here

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

     * @return the new {@code ReloadingController}
     */
    private ReloadingController createReloadingController()
    {
        ReloadingDetector ctrlDetector = createReloadingDetectorForController();
        ReloadingController ctrl = new ReloadingController(ctrlDetector);
        connectToReloadingController(ctrl);
        return ctrl;
    }
View Full Code Here

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

    {
        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);
        BuilderEventListenerImpl builderListener =
                new BuilderEventListenerImpl();
        builder.addEventListener(ConfigurationBuilderEvent.ANY, builderListener);

        ReloadingBuilderSupportListener listener =
                ReloadingBuilderSupportListener.connect(builder, controller);
        assertNotNull("No listener returned", listener);
        controller.checkForReloading(null);
        builderListener.nextEvent(ConfigurationBuilderEvent.RESET);
        builderListener.assertNoMoreEvents();
    }
View Full Code Here

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

    @SuppressWarnings("unchecked")
    @Test
    public void testResetReloadingStateOnResultCreation()
            throws ConfigurationException
    {
        ReloadingController controller =
                EasyMock.createMock(ReloadingController.class);
        controller.addEventListener(EasyMock.eq(ReloadingEvent.ANY),
                EasyMock.anyObject(EventListener.class));
        controller.resetReloadingState();
        EasyMock.replay(controller);
        BasicConfigurationBuilder<Configuration> builder =
                new BasicConfigurationBuilder<Configuration>(
                        PropertiesConfiguration.class);
View Full Code Here

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

        @Override
        protected FileBasedConfigurationBuilder<XMLConfiguration> createManagedBuilder(
                String fileName, Map<String, Object> params)
                throws ConfigurationException
        {
            final ReloadingController ctrl =
                    EasyMock.createMock(ReloadingController.class);
            reloadingControllers.add(ctrl);
            return new ReloadingFileBasedConfigurationBuilder<XMLConfiguration>(
                    getResultClass(), params)
            {
View Full Code Here

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

        CombinedReloadingController rc =
                (CombinedReloadingController) builder.getReloadingController();
        Collection<ReloadingController> subControllers = rc.getSubControllers();
        assertEquals("Wrong number of sub controllers", 1,
                subControllers.size());
        ReloadingController subctrl =
                ((ReloadingControllerSupport) builder.getDefinitionBuilder())
                        .getReloadingController();
        assertSame("Wrong sub controller", subctrl, subControllers.iterator()
                .next());
    }
View Full Code Here

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

            assertEquals("Wrong property", "no", config.getString(key));
            ConfigurationBuilder<? extends Configuration> childBuilder =
                    builder.getNamedBuilder("clientConfig");
            assertTrue("Not a reloading builder",
                    childBuilder instanceof ReloadingControllerSupport);
            ReloadingController ctrl =
                    ((ReloadingControllerSupport) childBuilder)
                            .getReloadingController();
            ctrl.checkForReloading(null); // initialize reloading
            BuilderEventListenerImpl l = new BuilderEventListenerImpl();
            childBuilder.addEventListener(ConfigurationBuilderEvent.RESET, l);
            reloadConfig.setProperty(key, "yes");
            handler.save();

            int attempts = 10;
            boolean changeDetected;
            do
            {
                changeDetected = ctrl.checkForReloading(null);
                if (!changeDetected)
                {
                    Thread.sleep(1000);
                    handler.save(outFile);
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.