Skip to content

Commit 229e262

Browse files
author
eugenp
committed
small FOP cleanup
1 parent c6cc467 commit 229e262

File tree

2 files changed

+967
-448
lines changed

2 files changed

+967
-448
lines changed

apache-fop/src/test/java/org/baeldung/java/ApacheFOPHeroldTest.java

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,43 @@
2828
import org.w3c.dom.Document;
2929

3030
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+
3248
private String style1 = "src/test/resources/docbook-xsl/fo/docbook.xsl";
3349
private String output_prefix = "src/test/resources/";
3450
private String xmlFile = "src/test/resources/input.xml";
3551

3652
@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+
}
4460
}
4561

46-
private void fromHTMLTOXMLUsingHerold(String input) throws Exception {
62+
// UTIL
63+
64+
private void fromHTMLTOXMLUsingHerold(final String input) throws Exception {
4765
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");
5068
script = mgr.parseScript(profileFile);
5169
final DocBookTransformer transformer = new DocBookTransformer();
5270
transformer.setScript(script);
@@ -83,10 +101,9 @@ private Transformer createTransformer(final String styleFile) throws Exception {
83101
return transformer;
84102
}
85103

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);
88106
return url.openStream();
89107
}
90108

91109
}
92-

0 commit comments

Comments
 (0)