Package org.apache.commons.configuration2.builder

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


     * @throws ConfigurationException if an error occurs
     */
    private static void checkTestConfiguration(FileHandler handler)
            throws ConfigurationException
    {
        XMLConfiguration config = new XMLConfiguration();
        FileHandler h2 = new FileHandler(config, handler);
        h2.load();
        assertEquals("Wrong content", "value", config.getString("element"));
    }
View Full Code Here


     *
     * @return the new parameters object
     */
    public BasicBuilderParameters basic()
    {
        return new BasicBuilderParameters();
    }
View Full Code Here

    protected void initializeParameterObjects(ConfigurationDeclaration decl,
            Collection<BuilderParameters> params) throws Exception
    {
        // we know that the first object is the combined builder parameters
        // object
        BasicBuilderParameters basicParams =
                (BasicBuilderParameters) params.iterator().next();
        setUpBasicParameters(decl.getConfigurationBuilder()
                .getConfigurationUnderConstruction(), basicParams);
        // now properties set explicitly can be overridden
        super.initializeParameterObjects(decl, params);
View Full Code Here

     * Tests whether a basic parameters object can be created.
     */
    @Test
    public void testBasic()
    {
        BasicBuilderParameters basic = new Parameters().basic();
        assertNotNull("No result object", basic);
    }
View Full Code Here

     * properties defined in the parameters object if necessary.
     */
    @Test
    public void testInterpolatorFromParameters() throws ConfigurationException
    {
        BasicBuilderParameters params =
                new MultiFileBuilderParametersImpl().setFilePattern(PATTERN)
                        .setPrefixLookups(
                                Collections.singletonMap(
                                        DefaultLookups.SYSTEM_PROPERTIES
                                                .getPrefix(),
View Full Code Here

     * Tests whether exceptions when creating configurations can be suppressed.
     */
    @Test
    public void testFileNotFoundAllowFailOnInit() throws ConfigurationException
    {
        BasicBuilderParameters params = createTestBuilderParameters(null);
        MultiFileConfigurationBuilder<XMLConfiguration> builder =
                new MultiFileConfigurationBuilder<XMLConfiguration>(
                        XMLConfiguration.class, params.getParameters(), true);
        switchToConfig("unknown configuration ID");
        XMLConfiguration config = builder.getConfiguration();
        assertTrue("Got content", config.isEmpty());
    }
View Full Code Here

     * Tests whether a missing file name pattern causes an exception.
     */
    @Test(expected = ConfigurationException.class)
    public void testNoPattern() throws ConfigurationException
    {
        BasicBuilderParameters params =
                new MultiFileBuilderParametersImpl()
                        .setInterpolator(createInterpolator());
        MultiFileConfigurationBuilder<XMLConfiguration> builder =
                new MultiFileConfigurationBuilder<XMLConfiguration>(
                        XMLConfiguration.class, params.getParameters(), true);
        switchToConfig(1);
        builder.getConfiguration();
    }
View Full Code Here

     * Tests whether the ConfigurationInterpolator is reset, too.
     */
    @Test
    public void testInterpolatorReset()
    {
        BasicBuilderParameters params =
                new MultiFileBuilderParametersImpl().setFilePattern(PATTERN);
        MultiFileConfigurationBuilder<XMLConfiguration> builder =
                new MultiFileConfigurationBuilder<XMLConfiguration>(
                        XMLConfiguration.class);
        builder.configure(params);
View Full Code Here

    public void testRecursiveInterpolation() throws ConfigurationException
    {
        DynamicCombinedConfiguration config =
                new DynamicCombinedConfiguration();
        config.setKeyPattern(PATTERN_VAR);
        BasicBuilderParameters params = createTestBuilderParameters(null);
        ConfigurationInterpolator ci = new ConfigurationInterpolator();
        ci.addDefaultLookup(new ConfigurationLookup(config));
        params.setInterpolator(ci);
        MultiFileConfigurationBuilder<XMLConfiguration> builder =
                new MultiFileConfigurationBuilder<XMLConfiguration>(
                        XMLConfiguration.class, null, true);
        builder.configure(params);
        BuilderConfigurationWrapperFactory wrapFactory =
View Full Code Here

     */
    @Test
    public void testInitWithParameters() throws ConfigurationException
    {
        ExpressionEngine engine = new XPathExpressionEngine();
        BasicBuilderParameters params =
                createTestBuilderParameters(new XMLBuilderParametersImpl()
                        .setExpressionEngine(engine));
        ReloadingMultiFileConfigurationBuilder<XMLConfiguration> builder =
                new ReloadingMultiFileConfigurationBuilder<XMLConfiguration>(
                        XMLConfiguration.class, params.getParameters());
        switchToConfig(1);
        XMLConfiguration config = builder.getConfiguration();
        assertSame("Expression engine not set", engine,
                config.getExpressionEngine());
    }
View Full Code Here

TOP

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

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.