-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ 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
1 parent
879bcfb
commit 54ea102
Showing
12 changed files
with
161 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
fj-doc-base/src/main/java/org/fugerit/java/doc/base/config/DocVersion.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
fj-doc-base/src/test/java/test/org/fugerit/java/doc/base/config/TestDocVersion.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ) ); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters