Package org.apache.commons.configuration2.builder

Examples of org.apache.commons.configuration2.builder.FileBasedBuilderParametersImpl


    public void testDetermineConfigurationClassNoExtension()
            throws ConfigurationException
    {
        ConfigurationDeclaration decl = setUpDecl();
        BuilderParameters params =
                new FileBasedBuilderParametersImpl()
                        .setPath("C:\\Test\\someTestConfiguration");
        FileExtensionConfigurationBuilderProvider provider = setUpProvider();
        assertEquals(
                "Wrong class",
                DEF_CLASS,
View Full Code Here


    public void testDetermineConfigurationClassExtensionNoMatch()
            throws ConfigurationException
    {
        ConfigurationDeclaration decl = setUpDecl();
        BuilderParameters params =
                new FileBasedBuilderParametersImpl()
                        .setPath("C:\\Test\\someTestConfiguration.properties");
        FileExtensionConfigurationBuilderProvider provider = setUpProvider();
        assertEquals(
                "Wrong class",
                DEF_CLASS,
View Full Code Here

    @Test
    public void testDeterminieConfigurationClassNoFileName()
            throws ConfigurationException
    {
        ConfigurationDeclaration decl = setUpDecl();
        BuilderParameters params = new FileBasedBuilderParametersImpl();
        FileExtensionConfigurationBuilderProvider provider = setUpProvider();
        assertEquals(
                "Wrong class",
                DEF_CLASS,
                provider.determineConfigurationClass(decl,
View Full Code Here

    public void testDetermineConfigurationClassExtensionMatch()
            throws ConfigurationException
    {
        ConfigurationDeclaration decl = setUpDecl();
        BuilderParameters params =
                new FileBasedBuilderParametersImpl()
                        .setPath("C:\\Test\\someTestConfiguration." + EXT);
        FileExtensionConfigurationBuilderProvider provider = setUpProvider();
        assertEquals(
                "Wrong class",
                MATCH_CLASS,
View Full Code Here

    public void testDetermineConfigurationClassMatchCase()
            throws ConfigurationException
    {
        ConfigurationDeclaration decl = setUpDecl();
        BuilderParameters params =
                new FileBasedBuilderParametersImpl()
                        .setPath("C:\\Test\\someTestConfiguration."
                                + EXT.toUpperCase(Locale.ENGLISH));
        FileExtensionConfigurationBuilderProvider provider = setUpProvider();
        assertEquals(
                "Wrong class",
View Full Code Here

                .combined()
                .setDefinitionBuilder(new ConstantConfigurationBuilder(defConf))
                .registerChildDefaultsHandler(
                        FileBasedBuilderProperties.class,
                        new CopyObjectDefaultHandler(
                                new FileBasedBuilderParametersImpl()
                                        .setReloadingDetectorFactory(detectorFactory))));
        CombinedConfiguration config = builder.getConfiguration();
        assertEquals("Wrong initial value (1)", 0,
                config.getInt(testProperty(1)));
        assertEquals("Wrong initial value (2)", 0,
View Full Code Here

                                new BasicBuilderParameters()
                                        .setSynchronizer(sync)))
                .registerChildDefaultsHandler(
                        FileBasedBuilderProperties.class,
                        new CopyObjectDefaultHandler(
                                new FileBasedBuilderParametersImpl()
                                        .setReloadingDetectorFactory(detectorFactory))));

        assertEquals("Wrong initial value", "100", builder.getConfiguration()
                .getString("/property[@name='config']/@value"));
View Full Code Here

     * Tests extended cloning functionality.
     */
    @Test
    public void testClone()
    {
        FileBasedBuilderParametersImpl managedParams =
                new FileBasedBuilderParametersImpl();
        managedParams.setFileName("test.xml");
        params.setManagedBuilderParameters(managedParams);
        params.setFilePattern("somePattern");
        MultiFileBuilderParametersImpl clone = params.clone();
        assertEquals("Wrong pattern", params.getFilePattern(),
                clone.getFilePattern());
        assertNotSame("Managed parameters not cloned",
                params.getManagedBuilderParameters(),
                clone.getManagedBuilderParameters());
        assertEquals("Wrong file name", managedParams.getFileHandler()
                .getFileName(),
                ((FileBasedBuilderParametersImpl) clone
                        .getManagedBuilderParameters()).getFileHandler()
                        .getFileName());
    }
View Full Code Here

        builder.configure(new CombinedBuilderParametersImpl()
                .setDefinitionBuilder(
                        new FileBasedConfigurationBuilder<XMLConfiguration>(
                                XMLConfiguration.class))
                .setDefinitionBuilderParameters(
                        new FileBasedBuilderParametersImpl().setFile(testFile)));
        builder.getConfiguration();
        CombinedReloadingController rc =
                (CombinedReloadingController) builder.getReloadingController();
        assertTrue("Got sub reloading controllers", rc.getSubControllers()
                .isEmpty());
View Full Code Here

    {
        File testFile =
                ConfigurationAssert
                        .getTestFile("testDigesterConfiguration.xml");
        ReloadingCombinedConfigurationBuilder confBuilder =
                builder.configure(new FileBasedBuilderParametersImpl()
                        .setFile(testFile));
        assertSame("Wrong configured builder instance", builder, confBuilder);
        builder.getConfiguration();
        CombinedReloadingController rc =
                (CombinedReloadingController) builder.getReloadingController();
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration2.builder.FileBasedBuilderParametersImpl

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.