Skip to content

Commit

Permalink
[3.0.6] - 2023-09-19
Browse files Browse the repository at this point in the history
Added test coverage
  • Loading branch information
fugerit79 committed Sep 19, 2023
1 parent 3e9e18e commit a6d4dcb
Show file tree
Hide file tree
Showing 22 changed files with 89 additions and 20 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [3.0.6] - 2023-09-19

### Added

- method FreemarkerDocProcessConfig.fullProcess() with minimal parameters, generating the document and returning xml data.
Expand Down
2 changes: 1 addition & 1 deletion fj-doc-base-json/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc</artifactId>
<version>3.0.5</version>
<version>3.0.6</version>
</parent>

<name>fj-doc-base-json</name>
Expand Down
2 changes: 1 addition & 1 deletion fj-doc-base-yaml/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc</artifactId>
<version>3.0.5</version>
<version>3.0.6</version>
</parent>

<name>fj-doc-base-yaml</name>
Expand Down
2 changes: 1 addition & 1 deletion fj-doc-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc</artifactId>
<version>3.0.5</version>
<version>3.0.6</version>
</parent>

<name>fj-doc-base</name>
Expand Down
2 changes: 1 addition & 1 deletion fj-doc-freemarker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc</artifactId>
<version>3.0.5</version>
<version>3.0.6</version>
</parent>

<name>fj-doc-freemarker</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ public MiniFilterChain getChainCache(String id) throws Exception {
MiniFilterChain chain = null;
if ( this.docProcessConfig.getKeys().contains( id ) ) {
chain = this.docProcessConfig.getChain(id);
} else if ( this.defaultChain != null ) {
chain = this.defaultChain.newDefaultChain(id);
} else if ( this.getDefaultChain() != null ) {
chain = this.getDefaultChain().newDefaultChain(id);
this.setChain(id, chain);
}
return chain;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
import java.io.Reader;

import org.fugerit.java.core.cfg.ConfigException;
import org.fugerit.java.core.function.SafeFunction;
import org.fugerit.java.core.lang.helpers.ClassHelper;
import org.fugerit.java.doc.base.config.DocConfig;
import org.fugerit.java.doc.base.config.DocOutput;
import org.fugerit.java.doc.base.process.DocProcessContext;
import org.fugerit.java.doc.base.process.DocProcessData;
import org.fugerit.java.doc.freemarker.config.FreeMarkerConfigStep;
import org.fugerit.java.doc.freemarker.html.FreeMarkerHtmlTypeHandlerUTF8;
import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfig;
import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfigFacade;
import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfigValidator;
Expand Down Expand Up @@ -69,6 +73,7 @@ public void testConfigRead002() {
FreemarkerDocProcessConfigFacade.loadConfigSafe( "cl://fj_doc_test/freemarker-doc-process_alt.xml" );
Assert.assertNotNull( config );
this.templateTesting(config);
log.info( "keys : {}", config.getKeys() );
}

@Test
Expand Down Expand Up @@ -100,4 +105,24 @@ public void testNewSimpleConfigVersion() {
}
}

@Test
public void testProcess() {
SafeFunction.apply( () -> {
FreemarkerDocProcessConfig config = FreemarkerDocProcessConfigFacade.newSimpleConfig( "simple-config-003", "/fj_doc_test/template/" );
// test full process
try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() ) {
DocProcessData data = config.fullProcess( "test_02" ,
DocProcessContext.newContext(), FreeMarkerHtmlTypeHandlerUTF8.HANDLER, DocOutput.newOutput(baos) );
Assert.assertNotEquals( 0 , data.getCurrentXmlData().length() );
}
// test process 1
try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() ) {
DocProcessData data = new DocProcessData();
config.process( "test_02" , DocProcessContext.newContext(), data, FreeMarkerHtmlTypeHandlerUTF8.HANDLER, DocOutput.newOutput(baos) );
Assert.assertNotEquals( 0 , data.getCurrentXmlData().length() );
}
} );
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<doc
xmlns="http://javacoredoc.fugerit.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://javacoredoc.fugerit.org https://www.fugerit.org/data/java/doc/xsd/doc-2-0.xsd" >

<!--
Sample Apache FreeMarker template for Fugerit Doc.
Note : this example has no intention of being a guid to FreeMarker
(In case check FreeMarker documentation https://freemarker.apache.org/docs/index.html)
-->

<meta>

<!-- Margin for document : left;right;top;bottom -->
<info name="margins">10;10;10;30</info>

<!-- id table to be used for xlsx output -->
<info name="excel-table-id">excel-table=print</info>
<info name="excel-width-multiplier">450</info>
<!-- id table to be used for xsv output -->
<info name="csv-table-id">excel-table</info>

<!-- you need to escape free marker expression for currentPage -->
<footer-ext>
<para align="right">${r"${currentPage}"} / ${r"${pageCount}"}</para>
</footer-ext>

</meta>

<body>

<table columns="3" colwidths="30;30;40" width="100" id="excel-table" padding="2">
<row>
<cell align="center" border-color="#ee0000" border-width="1"><para style="bold">Name</para></cell>
<cell align="center"><para style="bold">Surname</para></cell>
<cell align="center"><para style="bold">Title</para></cell>
</row>
</table>
</body>

</doc>
2 changes: 1 addition & 1 deletion fj-doc-lib-autodoc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc</artifactId>
<version>3.0.5</version>
<version>3.0.6</version>
</parent>

<name>fj-doc-lib-autodoc</name>
Expand Down
2 changes: 1 addition & 1 deletion fj-doc-lib-simpletable-import/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc</artifactId>
<version>3.0.5</version>
<version>3.0.6</version>
</parent>

<name>fj-doc-lib-simpletable-import</name>
Expand Down
2 changes: 1 addition & 1 deletion fj-doc-lib-simpletable/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc</artifactId>
<version>3.0.5</version>
<version>3.0.6</version>
</parent>

<name>fj-doc-lib-simpletable</name>
Expand Down
2 changes: 1 addition & 1 deletion fj-doc-mod-fop/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc</artifactId>
<version>3.0.5</version>
<version>3.0.6</version>
</parent>

<name>fj-doc-mod-fop</name>
Expand Down
2 changes: 1 addition & 1 deletion fj-doc-mod-opencsv/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc</artifactId>
<version>3.0.5</version>
<version>3.0.6</version>
</parent>

<name>fj-doc-mod-opencsv</name>
Expand Down
2 changes: 1 addition & 1 deletion fj-doc-mod-poi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc</artifactId>
<version>3.0.5</version>
<version>3.0.6</version>
</parent>

<name>fj-doc-mod-poi</name>
Expand Down
2 changes: 1 addition & 1 deletion fj-doc-playground-quarkus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc</artifactId>
<version>3.0.5</version>
<version>3.0.6</version>
</parent>
<artifactId>fj-doc-playground-quarkus</artifactId>
<properties>
Expand Down
2 changes: 1 addition & 1 deletion fj-doc-sample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc</artifactId>
<version>3.0.5</version>
<version>3.0.6</version>
</parent>

<name>fj-doc-sample</name>
Expand Down
2 changes: 1 addition & 1 deletion fj-doc-tool/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc</artifactId>
<version>3.0.5</version>
<version>3.0.6</version>
</parent>

<name>fj-doc-tool</name>
Expand Down
2 changes: 1 addition & 1 deletion fj-doc-val-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc</artifactId>
<version>3.0.5</version>
<version>3.0.6</version>
</parent>

<name>fj-doc-val-core</name>
Expand Down
2 changes: 1 addition & 1 deletion fj-doc-val-pdfbox/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc</artifactId>
<version>3.0.5</version>
<version>3.0.6</version>
</parent>

<name>fj-doc-val-pdfbox</name>
Expand Down
2 changes: 1 addition & 1 deletion fj-doc-val-poi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc</artifactId>
<version>3.0.5</version>
<version>3.0.6</version>
</parent>

<name>fj-doc-val-poi</name>
Expand Down
2 changes: 1 addition & 1 deletion fj-doc-val/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc</artifactId>
<version>3.0.5</version>
<version>3.0.6</version>
</parent>

<name>fj-doc-val</name>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<artifactId>fj-doc</artifactId>

<version>3.0.5</version>
<version>3.0.6</version>
<packaging>pom</packaging>

<name>fj-doc</name>
Expand Down

0 comments on commit a6d4dcb

Please sign in to comment.