Skip to content

Commit

Permalink
0.5.3 (2022-11-21)
Browse files Browse the repository at this point in the history
+ fj-doc-base fixed xsd version comparison (before was a normal string
comparison)
+ fj-doc-mod-fop Fixed legacy compatibility of FopConfigClassLoader see
[0.5.2](#7)
  • Loading branch information
daneeldeveloper committed Nov 21, 2022
1 parent 879bcfb commit 54ea102
Show file tree
Hide file tree
Showing 12 changed files with 161 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docgen/parameters.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title" : "Venus (Fugerit Document Generation Framework)",
"name": "Venus",
"version" : "0.5.2",
"version" : "0.5.3",
"date" : "21/11/2022",
"organization" : {
"name" : "Fugerit Org",
Expand Down
7 changes: 6 additions & 1 deletion docgen/release-notes.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
0.5.2 (2022-11-21)
0.5.3 (2022-11-21)
------------------
+ fj-doc-base fixed xsd version comparison (before was a normal string comparison)
+ fj-doc-mod-fop Fixed legacy compatibility of FopConfigClassLoader see [0.5.2](https://github.com/fugerit-org/fj-doc/issues/7)

0.5.2 (2022-11-21)
------------------
+ fj-doc-sample semplified. (Reduced to only one test facade.)
+ Introduce new FopPrtTypeHandler config attribute 'fop-config-mode' (previous mode is deprecated) see [0.5.2](https://github.com/fugerit-org/fj-doc/issues/7)
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>0.5.2</version>
<version>0.5.3</version>
</parent>

<name>fj-doc-base</name>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package org.fugerit.java.doc.base.config;

import java.io.Serializable;

public final class DocVersion implements Serializable, Comparable<DocVersion> {

/**
*
*/
private static final long serialVersionUID = -8717045616792106442L;

public static final DocVersion VERSION_1_0 = DocVersion.newVersion( "1-0" );
public static final DocVersion VERSION_1_1 = DocVersion.newVersion( "1-1" );
public static final DocVersion VERSION_1_2 = DocVersion.newVersion( "1-2" );
public static final DocVersion VERSION_1_3 = DocVersion.newVersion( "1-3" );
public static final DocVersion VERSION_1_4 = DocVersion.newVersion( "1-4" );
public static final DocVersion VERSION_1_5 = DocVersion.newVersion( "1-5" );
public static final DocVersion VERSION_1_6 = DocVersion.newVersion( "1-6" );
public static final DocVersion VERSION_1_7 = DocVersion.newVersion( "1-7" );
public static final DocVersion VERSION_1_8 = DocVersion.newVersion( "1-8" );
public static final DocVersion VERSION_1_9 = DocVersion.newVersion( "1-9" );
public static final DocVersion VERSION_1_10 = DocVersion.newVersion( "1-10" );

public static final DocVersion CURRENT_VERSION = VERSION_1_10;

public static final String VERSION_SEPARATOR ="-";

private int major;

private int minor;

private DocVersion( String version ) {
String[] split = version.split( VERSION_SEPARATOR );
this.major = Integer.parseInt( split[0] );
this.minor = Integer.parseInt( split[1] );
}

public int getMajor() {
return major;
}

public int getMinor() {
return minor;
}

public String stringVersion() {
return this.getMajor()+VERSION_SEPARATOR+this.getMinor();
}

@Override
public String toString() {
return this.stringVersion();
}

@Override
public int compareTo(DocVersion o) {
return compare( this , o );
}

public static int compare( String v1, String v2 ) {
return compare( newVersion( v1 ) , newVersion( v2 ) );
}

public static int compare( DocVersion v1, DocVersion v2 ) {
int res = v1.getMajor() - v2.getMajor();
if ( res == 0 ) {
res = v1.getMinor() - v2.getMinor();
}
return res;
}

public static DocVersion newVersion( String version ) {
return new DocVersion(version);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ The Apache Software Foundation (http://www.apache.org/).
import org.fugerit.java.core.xml.sax.XMLValidatorSAX;
import org.fugerit.java.core.xml.sax.dh.DefaultHandlerComp;
import org.fugerit.java.core.xml.sax.er.ByteArrayEntityResolver;
import org.fugerit.java.doc.base.config.DocVersion;
import org.fugerit.java.doc.base.model.DocBase;
import org.fugerit.java.doc.base.model.DocContainer;
import org.fugerit.java.doc.base.model.DocElement;
Expand All @@ -60,7 +61,7 @@ The Apache Software Foundation (http://www.apache.org/).
*/
public class DocFacade {

public static final String CURRENT_VERSION = "1-10";
public static final String CURRENT_VERSION = DocVersion.CURRENT_VERSION.stringVersion();

private static Logger logger = LoggerFactory.getLogger( DocFacade.class );

Expand Down Expand Up @@ -146,8 +147,12 @@ public static DocBase parse( Reader is, DocHelper docHelper, Properties params )
DocBase docBase = dch.getDocBase();
is.close();
String xsdVersion = docBase.getXsdVersion();
if ( StringUtils.isNotEmpty( xsdVersion ) && xsdVersion.compareTo( CURRENT_VERSION ) > 0 ) {
logger.warn( "Document version {} is higher than maximum version supported by this release od fj-doc {}, some feature may be not supported.", xsdVersion, CURRENT_VERSION );
try {
if ( StringUtils.isNotEmpty( xsdVersion ) && DocVersion.compare( xsdVersion, CURRENT_VERSION ) > 0 ) {
logger.warn( "Document version {} is higher than maximum version supported by this release od fj-doc {}, some feature may be not supported.", xsdVersion, CURRENT_VERSION );
}
} catch (Exception e) {
logger.warn( "Failed to check xsd version : {} (current version: {})", xsdVersion, CURRENT_VERSION );
}
return docBase;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package test.org.fugerit.java.doc.base.config;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.fugerit.java.doc.base.config.DocVersion;
import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class TestDocVersion {

private static final Logger logger = LoggerFactory.getLogger( TestDocVersion.class );

private void testCompareWorker( int expected, DocVersion v1, DocVersion v2 ) {
int result = DocVersion.compare( v1, v2 );
logger.info( "Test compare {} to {} , expected:{}, result:{}", v1, v2, expected, result );
Assert.assertEquals( "Wrong compare result", expected, result );
}

@Test
public void testCompareMajorThan01() {
this.testCompareWorker( 9, DocVersion.VERSION_1_10, DocVersion.VERSION_1_1 );
}

@Test
public void testCompareMinorThan01() {
this.testCompareWorker( -2, DocVersion.VERSION_1_1, DocVersion.VERSION_1_3 );
}

@Test
public void testCompareEqual01() {
this.testCompareWorker( 0, DocVersion.VERSION_1_5, DocVersion.VERSION_1_5 );
}

@Test
public void testSort() {
List<DocVersion> list = new ArrayList<DocVersion>();
list.add( DocVersion.VERSION_1_8 );
list.add( DocVersion.VERSION_1_2 );
list.add( DocVersion.VERSION_1_10 );
list.add( DocVersion.VERSION_1_9 );
logger.info( "list pre sort : {}", list );
Collections.sort( list );
logger.info( "list post sort : {}", list );
Assert.assertEquals( "Version list sort", "[1-2, 1-8, 1-9, 1-10]", String.valueOf( list ) );
}

}
13 changes: 13 additions & 0 deletions fj-doc-base/src/test/resources/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="INFO">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>
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>0.5.2</version>
<version>0.5.3</version>
</parent>

<name>fj-doc-freemarker</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>0.5.2</version>
<version>0.5.3</version>
</parent>

<name>fj-doc-mod-fop</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>0.5.2</version>
<version>0.5.3</version>
</parent>

<name>fj-doc-mod-poi</name>
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>0.5.2</version>
<version>0.5.3</version>
</parent>

<name>fj-doc-sample</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>0.5.2</version>
<version>0.5.3</version>
<packaging>pom</packaging>

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

0 comments on commit 54ea102

Please sign in to comment.