View Javadoc
1   /*
2    * #%L
3    * JRst :: Api
4    * %%
5    * Copyright (C) 2004 - 2010 CodeLutin
6    * %%
7    * This program is free software: you can redistribute it and/or modify
8    * it under the terms of the GNU Lesser General Public License as 
9    * published by the Free Software Foundation, either version 3 of the 
10   * License, or (at your option) any later version.
11   * 
12   * This program is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   * GNU General Lesser Public License for more details.
16   * 
17   * You should have received a copy of the GNU General Lesser Public 
18   * License along with this program.  If not, see
19   * <http://www.gnu.org/licenses/lgpl-3.0.html>.
20   * #L%
21   */
22  
23  package org.nuiton.jrst;
24  
25  import java.io.File;
26  import org.apache.commons.logging.Log;
27  import org.apache.commons.logging.LogFactory;
28  import org.junit.Assert;
29  import org.junit.Test;
30  import org.nuiton.util.Resource;
31  
32  /**
33   *
34   * @author chemit
35   */
36  public class JRSTTest extends JRSTAbstractTest {
37  
38      /** to use log facility, just put in your code: log.info("..."); */
39      protected static Log log = LogFactory.getLog(JRSTTest.class);
40  
41      /**
42       * Test que les ressources sont bien dans le classpath.
43       * 
44       * Test du cas particulier de la dependance docbook-xsl.
45       */
46      @Test
47      public void testResources() {
48          Assert.assertNotNull(Resource.getURL(JRST.RST_2_XHTML));
49          Assert.assertNotNull(Resource.getURL(JRST.RST_2_XDOC));
50          Assert.assertNotNull(Resource.getURL(JRST.RST_2_DOCBOOK));
51          Assert.assertNotNull(Resource.getURL(JRST.DOCBOOK_2_XHTML));
52          Assert.assertNotNull(Resource.getURL(JRST.DOCBOOK_2_JAVAHELP));
53          Assert.assertNotNull(Resource.getURL(JRST.DOCBOOK_2_HTMLHELP));
54          Assert.assertNotNull(Resource.getURL(JRST.DOCBOOK_2_FO));
55      }
56  
57      @Test
58      public void generateXml() throws Exception {
59  
60          File in = getTestFile("test.rst");
61          File out = getOutputTestFile("jrst-RstToXml.xml");
62  
63          generate(JRST.TYPE_XML, in, out, JRST.Overwrite.ALLTIME);
64      }
65  
66      @Test
67      public void generateSimpleXml() throws Exception {
68  
69          File in = getTestFile("test.rst");
70          File out = getOutputTestFile("jrst-RstToSimpleXml.xml");
71  
72          generate(JRST.TYPE_XML, in, out, JRST.Overwrite.ALLTIME);
73      }
74  }