View Javadoc
1   /*
2    * PluginFileTest.java
3    * JUnit based test
4    *
5    * Created on 7 mai 2006, 19:55
6    */
7   package fr.paris.lutece.portal.service.plugin;
8   
9   import fr.paris.lutece.portal.service.includes.PageIncludeEntry;
10  import fr.paris.lutece.portal.service.init.LuteceInitException;
11  import fr.paris.lutece.portal.service.util.AppPropertiesService;
12  import fr.paris.lutece.test.LuteceTestCase;
13  
14  import junit.framework.*;
15  
16  import java.util.List;
17  
18  
19  /**
20   *
21   * @author Pierre
22   */
23  public class PluginFileTest extends LuteceTestCase
24  {
25      public PluginFileTest( String testName )
26      {
27          super( testName );
28      }
29  
30      public static Test suite(  )
31      {
32          TestSuite suite = new TestSuite( PluginFileTest.class );
33  
34          return suite;
35      }
36  
37      /**
38       * Test of getName method, of class fr.paris.lutece.portal.service.PluginFile.
39       */
40      public void testLoad(  ) throws LuteceInitException
41      {
42          System.out.println( "load" );
43  
44          PluginFile instance = new PluginFile(  );
45  
46          //TODO path en dur...
47          String strFilename = getResourcesDir(  ) + "../test-classes/plugin-test.xml";
48          instance.load( strFilename );
49  
50          assertNotNull( instance.getParams(  ) );
51          assertEquals( AppPropertiesService.getProperty( "lutece.encoding" ),
52              instance.getParams(  ).get( "test_properties" ) );
53  
54          List<PageIncludeEntry> includes = instance.getPageIncludes(  );
55          assertEquals( 3, includes.size(  ) );
56  
57          for ( PageIncludeEntry anInclude : includes )
58          {
59              if ( anInclude.getId(  ).contains( "disabled" ) )
60              {
61                  assertFalse( anInclude.isEnabled(  ) );
62              }
63              else
64              {
65                  assertTrue( anInclude.isEnabled(  ) );
66              }
67          }
68      }
69  }