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
7       extends PlexusTestCase
8   {
9       public void testBasic()
10          throws Exception
11      {
12          // we have plexus.xml with two configSources, so the container should use the "chained" case,
13          // which is ChainedConfigurationSource with 3 elem in list: the plexusDefaultConfig source,
14          // and the two user provided, in this order: ADummyConfigurationSource, AnotherDummyConfigurationSource
15  
16          ConfigurationSource cs = ( (MutablePlexusContainer) getContainer() ).getConfigurationSource();
17  
18          assertNotNull( cs );
19  
20          assertEquals( ChainedConfigurationSource.class.getName(), cs.getClass().getName() );
21  
22          ChainedConfigurationSource ccs = (ChainedConfigurationSource) cs;
23  
24          // we have 3 config sources overall
25          assertEquals( 3, ccs.getConfigurationSources().size() );
26  
27          // and the last in the source list is container source
28          assertEquals( ContainerConfigurationSource.class.getName(), ccs
29              .getConfigurationSources().get( 2 ).getClass().getName() );
30  
31      }
32  
33  }