|
28 | 28 | import org.w3c.dom.Document; |
29 | 29 |
|
30 | 30 | public class ApacheFOPHeroldTest { |
31 | | - private String[] inputUrls = { "http://inprogress.baeldung.com/?p=1430","http://www.baeldung.com/spring-events" }; |
| 31 | + private String[] inputUrls = {// @formatter:off |
| 32 | + // "http://www.baeldung.com/2011/10/20/bootstraping-a-web-application-with-spring-3-1-and-java-based-configuration-part-1/", |
| 33 | + // "http://www.baeldung.com/2011/10/25/building-a-restful-web-service-with-spring-3-1-and-java-based-configuration-part-2/", |
| 34 | + "http://www.baeldung.com/2011/10/31/securing-a-restful-web-service-with-spring-security-3-1-part-3/", |
| 35 | + // "http://www.baeldung.com/spring-security-basic-authentication", |
| 36 | + // "http://www.baeldung.com/spring-security-digest-authentication", |
| 37 | + //"http://www.baeldung.com/2011/11/20/basic-and-digest-authentication-for-a-restful-service-with-spring-security-3-1/", |
| 38 | + //"http://www.baeldung.com/spring-httpmessageconverter-rest", |
| 39 | + //"http://www.baeldung.com/2011/11/06/restful-web-service-discoverability-part-4/", |
| 40 | + //"http://www.baeldung.com/2011/11/13/rest-service-discoverability-with-spring-part-5/", |
| 41 | + //"http://www.baeldung.com/2013/01/11/etags-for-rest-with-spring/", |
| 42 | + //"http://www.baeldung.com/2012/01/18/rest-pagination-in-spring/", |
| 43 | + //"http://www.baeldung.com/2013/01/31/exception-handling-for-rest-with-spring-3-2/", |
| 44 | + //"http://www.baeldung.com/rest-versioning", |
| 45 | + //"http://www.baeldung.com/2013/01/18/testing-rest-with-multiple-mime-types/" |
| 46 | + }; // @formatter:on |
| 47 | + |
32 | 48 | private String style1 = "src/test/resources/docbook-xsl/fo/docbook.xsl"; |
33 | 49 | private String output_prefix = "src/test/resources/"; |
34 | 50 | private String xmlFile = "src/test/resources/input.xml"; |
35 | 51 |
|
36 | 52 | @Test |
37 | | - public void whenTransformFromHeroldToPDF_thenCorrect() throws Exception{ |
38 | | - int len = inputUrls.length; |
39 | | - for (int i = 0; i < len; i++) { |
40 | | - fromHTMLTOXMLUsingHerold(inputUrls[i]); |
41 | | - final Document fo = fromXMLFileToFO(); |
42 | | - fromFODocumentToPDF(fo, output_prefix + i + ".pdf"); |
43 | | - } |
| 53 | + public void whenTransformFromHeroldToPDF_thenCorrect() throws Exception { |
| 54 | + final int len = inputUrls.length; |
| 55 | + for (int i = 0; i < len; i++) { |
| 56 | + fromHTMLTOXMLUsingHerold(inputUrls[i]); |
| 57 | + final Document fo = fromXMLFileToFO(); |
| 58 | + fromFODocumentToPDF(fo, output_prefix + i + ".pdf"); |
| 59 | + } |
44 | 60 | } |
45 | 61 |
|
46 | | - private void fromHTMLTOXMLUsingHerold(String input) throws Exception { |
| 62 | + // UTIL |
| 63 | + |
| 64 | + private void fromHTMLTOXMLUsingHerold(final String input) throws Exception { |
47 | 65 | Script script; |
48 | | - TrafoScriptManager mgr = new TrafoScriptManager(); |
49 | | - File profileFile = new File("src/test/resources/default.her"); |
| 66 | + final TrafoScriptManager mgr = new TrafoScriptManager(); |
| 67 | + final File profileFile = new File("src/test/resources/default.her"); |
50 | 68 | script = mgr.parseScript(profileFile); |
51 | 69 | final DocBookTransformer transformer = new DocBookTransformer(); |
52 | 70 | transformer.setScript(script); |
@@ -83,10 +101,9 @@ private Transformer createTransformer(final String styleFile) throws Exception { |
83 | 101 | return transformer; |
84 | 102 | } |
85 | 103 |
|
86 | | - private InputStream getInputStream(String input) throws IOException { |
87 | | - URL url = new URL(input); |
| 104 | + private InputStream getInputStream(final String input) throws IOException { |
| 105 | + final URL url = new URL(input); |
88 | 106 | return url.openStream(); |
89 | 107 | } |
90 | 108 |
|
91 | 109 | } |
92 | | - |
|
0 commit comments