Skip to content

Commit a6d4dcb

Browse files
committed
[3.0.6] - 2023-09-19
Added test coverage
1 parent 3e9e18e commit a6d4dcb

File tree

22 files changed

+89
-20
lines changed

22 files changed

+89
-20
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [3.0.6] - 2023-09-19
11+
1012
### Added
1113

1214
- method FreemarkerDocProcessConfig.fullProcess() with minimal parameters, generating the document and returning xml data.

fj-doc-base-json/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.fugerit.java</groupId>
99
<artifactId>fj-doc</artifactId>
10-
<version>3.0.5</version>
10+
<version>3.0.6</version>
1111
</parent>
1212

1313
<name>fj-doc-base-json</name>

fj-doc-base-yaml/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.fugerit.java</groupId>
99
<artifactId>fj-doc</artifactId>
10-
<version>3.0.5</version>
10+
<version>3.0.6</version>
1111
</parent>
1212

1313
<name>fj-doc-base-yaml</name>

fj-doc-base/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.fugerit.java</groupId>
99
<artifactId>fj-doc</artifactId>
10-
<version>3.0.5</version>
10+
<version>3.0.6</version>
1111
</parent>
1212

1313
<name>fj-doc-base</name>

fj-doc-freemarker/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.fugerit.java</groupId>
99
<artifactId>fj-doc</artifactId>
10-
<version>3.0.5</version>
10+
<version>3.0.6</version>
1111
</parent>
1212

1313
<name>fj-doc-freemarker</name>

fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/process/FreemarkerDocProcessConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ public MiniFilterChain getChainCache(String id) throws Exception {
102102
MiniFilterChain chain = null;
103103
if ( this.docProcessConfig.getKeys().contains( id ) ) {
104104
chain = this.docProcessConfig.getChain(id);
105-
} else if ( this.defaultChain != null ) {
106-
chain = this.defaultChain.newDefaultChain(id);
105+
} else if ( this.getDefaultChain() != null ) {
106+
chain = this.getDefaultChain().newDefaultChain(id);
107107
this.setChain(id, chain);
108108
}
109109
return chain;

fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreemarkerDocProcessConfig.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@
77
import java.io.Reader;
88

99
import org.fugerit.java.core.cfg.ConfigException;
10+
import org.fugerit.java.core.function.SafeFunction;
1011
import org.fugerit.java.core.lang.helpers.ClassHelper;
1112
import org.fugerit.java.doc.base.config.DocConfig;
13+
import org.fugerit.java.doc.base.config.DocOutput;
1214
import org.fugerit.java.doc.base.process.DocProcessContext;
15+
import org.fugerit.java.doc.base.process.DocProcessData;
1316
import org.fugerit.java.doc.freemarker.config.FreeMarkerConfigStep;
17+
import org.fugerit.java.doc.freemarker.html.FreeMarkerHtmlTypeHandlerUTF8;
1418
import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfig;
1519
import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfigFacade;
1620
import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfigValidator;
@@ -69,6 +73,7 @@ public void testConfigRead002() {
6973
FreemarkerDocProcessConfigFacade.loadConfigSafe( "cl://fj_doc_test/freemarker-doc-process_alt.xml" );
7074
Assert.assertNotNull( config );
7175
this.templateTesting(config);
76+
log.info( "keys : {}", config.getKeys() );
7277
}
7378

7479
@Test
@@ -100,4 +105,24 @@ public void testNewSimpleConfigVersion() {
100105
}
101106
}
102107

108+
@Test
109+
public void testProcess() {
110+
SafeFunction.apply( () -> {
111+
FreemarkerDocProcessConfig config = FreemarkerDocProcessConfigFacade.newSimpleConfig( "simple-config-003", "/fj_doc_test/template/" );
112+
// test full process
113+
try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() ) {
114+
DocProcessData data = config.fullProcess( "test_02" ,
115+
DocProcessContext.newContext(), FreeMarkerHtmlTypeHandlerUTF8.HANDLER, DocOutput.newOutput(baos) );
116+
Assert.assertNotEquals( 0 , data.getCurrentXmlData().length() );
117+
}
118+
// test process 1
119+
try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() ) {
120+
DocProcessData data = new DocProcessData();
121+
config.process( "test_02" , DocProcessContext.newContext(), data, FreeMarkerHtmlTypeHandlerUTF8.HANDLER, DocOutput.newOutput(baos) );
122+
Assert.assertNotEquals( 0 , data.getCurrentXmlData().length() );
123+
}
124+
} );
125+
}
126+
127+
103128
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<doc
3+
xmlns="http://javacoredoc.fugerit.org"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://javacoredoc.fugerit.org https://www.fugerit.org/data/java/doc/xsd/doc-2-0.xsd" >
6+
7+
<!--
8+
Sample Apache FreeMarker template for Fugerit Doc.
9+
Note : this example has no intention of being a guid to FreeMarker
10+
(In case check FreeMarker documentation https://freemarker.apache.org/docs/index.html)
11+
-->
12+
13+
<meta>
14+
15+
<!-- Margin for document : left;right;top;bottom -->
16+
<info name="margins">10;10;10;30</info>
17+
18+
<!-- id table to be used for xlsx output -->
19+
<info name="excel-table-id">excel-table=print</info>
20+
<info name="excel-width-multiplier">450</info>
21+
<!-- id table to be used for xsv output -->
22+
<info name="csv-table-id">excel-table</info>
23+
24+
<!-- you need to escape free marker expression for currentPage -->
25+
<footer-ext>
26+
<para align="right">${r"${currentPage}"} / ${r"${pageCount}"}</para>
27+
</footer-ext>
28+
29+
</meta>
30+
31+
<body>
32+
33+
<table columns="3" colwidths="30;30;40" width="100" id="excel-table" padding="2">
34+
<row>
35+
<cell align="center" border-color="#ee0000" border-width="1"><para style="bold">Name</para></cell>
36+
<cell align="center"><para style="bold">Surname</para></cell>
37+
<cell align="center"><para style="bold">Title</para></cell>
38+
</row>
39+
</table>
40+
</body>
41+
42+
</doc>

fj-doc-lib-autodoc/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.fugerit.java</groupId>
99
<artifactId>fj-doc</artifactId>
10-
<version>3.0.5</version>
10+
<version>3.0.6</version>
1111
</parent>
1212

1313
<name>fj-doc-lib-autodoc</name>

fj-doc-lib-simpletable-import/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.fugerit.java</groupId>
99
<artifactId>fj-doc</artifactId>
10-
<version>3.0.5</version>
10+
<version>3.0.6</version>
1111
</parent>
1212

1313
<name>fj-doc-lib-simpletable-import</name>

0 commit comments

Comments
 (0)