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 org.apache.commons.logging.Log;
26  import org.apache.commons.logging.LogFactory;
27  import org.junit.Ignore;
28  import org.junit.Test;
29  
30  import java.io.File;
31  
32  /**
33   * JRSTGeneratorTest.
34   *
35   * Created: 31 oct. 06 11:14:19
36   *
37   * @author poussin
38   * @version $Revision$
39   *
40   * Last update: $Date$
41   * by : $Author$
42   */
43  public class JRSTGeneratorTest extends JRSTAbstractTest {
44  
45      /** to use log facility, just put in your code: log.info("..."); */
46      protected static Log log = LogFactory.getLog(JRSTGeneratorTest.class);
47  
48      public static File getResourcesTestPath() {
49          return getTestFile("test.rst");
50      }
51  
52      // Not implemented
53      @Ignore
54      @Test
55      public void testRstToRst() throws Exception {
56          
57          if (log.isInfoEnabled()) {
58              log.info("Testing RST to RST (test.rst)...");
59          }
60  
61          String test1 = getOutputTestPath("jrst-RstToRst.rst");
62          new JRSTTestGenerator("rst", getResourcesTestPath(), new File(test1), JRST.Overwrite.ALLTIME);
63      }
64  
65      @Test
66      public void testRstToHtml() throws Exception {
67          
68          if (log.isInfoEnabled()) {
69              log.info("Testing RST to HTML (test.rst)...");
70          }
71  
72          String test1 = getOutputTestPath("jrst-RstToHtml.html");
73          new JRSTTestGenerator("html", getResourcesTestPath(), new File(test1), JRST.Overwrite.ALLTIME);
74      }
75  
76      @Test
77      public void testRstToHtml2() throws Exception {
78  
79          if (log.isInfoEnabled()) {
80              log.info("Testing RST to HTML (docDeveloppeur.rst) ...");
81          }
82  
83          String test1 = getOutputTestPath("jrst-RstToHtml2.html");
84          new JRSTTestGenerator("html", getTestFile("docDeveloppeur.rst"), new File(test1), JRST.Overwrite.ALLTIME);
85      }
86  
87  
88      @Test
89      public void testRstToDocbook() throws Exception {
90          
91          if (log.isInfoEnabled()) {
92              log.info("Testing RST to Docbook (test.rst)...");
93          }
94  
95          String test1 = getOutputTestPath("jrst-RstToDocbook.dbk");
96          new JRSTTestGenerator("docbook", getResourcesTestPath(), new File(test1), JRST.Overwrite.ALLTIME);
97      }
98      
99      @Test
100     public void testRstToXdoc() throws Exception {
101         
102         if (log.isInfoEnabled()) {
103             log.info("Testing RST to Xdoc (test.rst)...");
104         }
105         
106         String test1 = getOutputTestPath("jrst-RstToXdoc.xdoc");
107         new JRSTTestGenerator("xdoc", getResourcesTestPath(), new File(test1), JRST.Overwrite.ALLTIME);
108     }
109 
110     /**
111      * This test is not working.
112      * 
113      * @throws Exception
114      */
115     @Ignore
116     public void testRstToXdoc2() throws Exception {
117         
118         if (log.isInfoEnabled()) {
119             log.info("Testing RST to Xdoc (test2.rst)...");
120         }
121         
122         String test1 = getOutputTestPath("jrst-RstToXdoc2.xdoc");
123         new JRSTTestGenerator("xdoc", getTestFile("test2.rst"), new File(test1), JRST.Overwrite.ALLTIME);
124     }
125     
126     @Test
127     public void testRstToXdoc3() throws Exception {
128         
129         if (log.isInfoEnabled()) {
130             log.info("Testing RST to Xdoc (test3.rst) ...");
131         }
132         
133         String test1 = getOutputTestPath("jrst-RstToXdoc3.xdoc");
134         new JRSTTestGenerator("xdoc", getTestFile("test3.rst"), new File(test1), JRST.Overwrite.ALLTIME);
135     }
136     
137     @Test
138     public void testRstToXdoc4() throws Exception {
139         
140         if (log.isInfoEnabled()) {
141             log.info("Testing RST to Xdoc (test4.rst) ...");
142         }
143         
144         String test1 = getOutputTestPath("jrst-RstToXdoc4.xdoc");
145         new JRSTTestGenerator("xdoc", getTestFile("test4.rst"), new File(test1), JRST.Overwrite.ALLTIME);
146     }
147     
148     @Test
149     public void testRstToXdocJrstSite() throws Exception {
150         
151         if (log.isInfoEnabled()) {
152             log.info("Testing RST to Xdoc (frEntier.rst) ...");
153         }
154         
155         String test1 = getOutputTestPath("jrst-RstToXdocJrstSite.xdoc");
156         new JRSTTestGenerator("xdoc", getTestFile("frEntier.rst"), new File(test1), JRST.Overwrite.ALLTIME);
157     }
158 
159 
160     @Test
161     public void testRstToPDF() throws Exception {
162         
163         if (log.isInfoEnabled()) {
164             log.info("Testing RST to PDF (test.rst) ...");
165         }
166 
167         String test1 = getOutputTestPath("jrst-RstToPDF.pdf");
168         new JRSTTestGenerator("pdf", getResourcesTestPath(), new File(test1), JRST.Overwrite.ALLTIME);
169     }
170 
171     @Test
172     public void testRstToPDF2() throws Exception {
173 
174         if (log.isInfoEnabled()) {
175             log.info("Testing RST to PDF (docDeveloppeur.rst) ...");
176         }
177 
178         String test1 = getOutputTestPath("jrst-RstToPDF2.pdf");
179         new JRSTTestGenerator("pdf", getTestFile("docDeveloppeur.rst"), new File(test1), JRST.Overwrite.ALLTIME);
180     }
181 }