Package org.apache.commons.configuration2.interpol

Examples of org.apache.commons.configuration2.interpol.Lookup


     * Tests whether the map with prefix lookups is cloned, too.
     */
    @Test
    public void testClonePrefixLookups()
    {
        Lookup look = EasyMock.createMock(Lookup.class);
        Map<String, Lookup> lookups = Collections.singletonMap("test", look);
        params.setPrefixLookups(lookups);
        BasicBuilderParameters clone = params.clone();
        Map<?, ?> map = (Map<?, ?>) params.getParameters().get("prefixLookups");
        map.clear();
View Full Code Here


     * Tests whether the collection with default lookups can be cloned, too.
     */
    @Test
    public void testCloneDefaultLookups()
    {
        Lookup look = EasyMock.createMock(Lookup.class);
        Collection<Lookup> looks = Collections.singleton(look);
        params.setDefaultLookups(looks);
        BasicBuilderParameters clone = params.clone();
        Collection<?> defLooks =
                (Collection<?>) params.getParameters().get("defaultLookups");
View Full Code Here

     * installed.
     */
    @Test
    public void testInstallInterpolator()
    {
        Lookup prefixLookup = EasyMock.createMock(Lookup.class);
        Lookup defLookup = EasyMock.createMock(Lookup.class);
        EasyMock.replay(prefixLookup, defLookup);
        Map<String, Lookup> prefixLookups = new HashMap<String, Lookup>();
        prefixLookups.put("test", prefixLookup);
        List<Lookup> defLookups = new ArrayList<Lookup>();
        defLookups.add(defLookup);
View Full Code Here

     * {@code ConfigurationInterpolator}.
     */
    @Test
    public void testSetPrefixLookupsExistingInterpolator()
    {
        Lookup look = EasyMock.createMock(Lookup.class);
        EasyMock.replay(look);
        AbstractConfiguration config =
                new TestConfigurationImpl(new PropertiesConfiguration());
        int count = config.getInterpolator().getLookups().size();
        Map<String, Lookup> lookups = new HashMap<String, Lookup>();
View Full Code Here

     * {@code ConfigurationInterpolator} exists yet.
     */
    @Test
    public void testSetPrefixLookupsNoInterpolator()
    {
        Lookup look = EasyMock.createMock(Lookup.class);
        EasyMock.replay(look);
        AbstractConfiguration config =
                new TestConfigurationImpl(new PropertiesConfiguration());
        config.setInterpolator(null);
        config.setPrefixLookups(Collections.singletonMap("test", look));
View Full Code Here

     * {@code ConfigurationInterpolator}.
     */
    @Test
    public void testSetDefaultLookupsExistingInterpolator()
    {
        Lookup look = EasyMock.createMock(Lookup.class);
        EasyMock.replay(look);
        AbstractConfiguration config =
                new TestConfigurationImpl(new PropertiesConfiguration());
        config.getInterpolator().addDefaultLookup(
                new ConfigurationLookup(new PropertiesConfiguration()));
View Full Code Here

     * {@code ConfigurationInterpolator} exists yet.
     */
    @Test
    public void testSetDefaultLookupsNoInterpolator()
    {
        Lookup look = EasyMock.createMock(Lookup.class);
        EasyMock.replay(look);
        AbstractConfiguration config =
                new TestConfigurationImpl(new PropertiesConfiguration());
        config.setInterpolator(null);
        config.setDefaultLookups(Collections.singleton(look));
View Full Code Here

    @Test
    public void testLocalLookupsInInterpolatorAreInherited() {
        BaseConfiguration config = new BaseConfiguration();
        ConfigurationInterpolator interpolator = config.getInterpolator();
        interpolator.registerLookup("brackets", new Lookup(){

            @Override
            public String lookup(String key) {
                return "(" + key +")";
            }
View Full Code Here

    @Before
    public void setUp() throws Exception
    {
        // any concrete class will do
        PropertiesConfiguration c = new PropertiesConfiguration();
        new FileHandler(c).load(ConfigurationAssert
                .getTestFile("test.properties"));
        sync = new SynchronizerTestImpl();
        c.setSynchronizer(sync);
        config = c;
    }
View Full Code Here

    @Before
    public void setUp() throws Exception
    {
        CompositeConfiguration cc = new CompositeConfiguration();
        PropertiesConfiguration pc = new PropertiesConfiguration();
        FileHandler handler = new FileHandler(pc);
        handler.setFileName(testProperties);
        handler.load();
        cc.addConfiguration(pc);
        conf = cc;
        nonStringTestHolder.setConfiguration(conf);
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration2.interpol.Lookup

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.