View Javadoc
1   package org.codehaus.plexus.configuration.source;
2   
3   import org.codehaus.plexus.MutablePlexusContainer;
4   import org.codehaus.plexus.PlexusTestCase;
5   
6   public class ExtendingConfigurationSourceTest extends PlexusTestCase {
7       public void testBasic() throws Exception {
8           // we have plexus.xml with two configSources, so the container should use the "chained" case,
9           // which is ChainedConfigurationSource with 3 elem in list: the plexusDefaultConfig source,
10          // and the two user provided, in this order: ADummyConfigurationSource, AnotherDummyConfigurationSource
11  
12          ConfigurationSource cs = ((MutablePlexusContainer) getContainer()).getConfigurationSource();
13  
14          assertNotNull(cs);
15  
16          assertEquals(ChainedConfigurationSource.class.getName(), cs.getClass().getName());
17  
18          ChainedConfigurationSource ccs = (ChainedConfigurationSource) cs;
19  
20          // we have 3 config sources overall
21          assertEquals(3, ccs.getConfigurationSources().size());
22  
23          // and the last in the source list is container source
24          assertEquals(
25                  ContainerConfigurationSource.class.getName(),
26                  ccs.getConfigurationSources().get(2).getClass().getName());
27      }
28  }