Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable recursive XSD adding text output compare (as JavaFX is not working) #10

Open
wants to merge 33 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
d1ece58
Adding a test case with recursive grammar causing the existing progra…
svanteschubert Mar 28, 2023
1f30f05
Resolving loop during load and compare by unique element handling (co…
svanteschubert Mar 28, 2023
22a7771
Added second newer grammar for complex comparison test!
svanteschubert Mar 28, 2023
e948579
Adding first milestone with element & attribute comparison for adding…
svanteschubert Mar 28, 2023
8ae13a6
Updated regression test to write current output ./target directory wi…
svanteschubert Apr 5, 2023
59ad475
Tweaking output and update for regression tests
svanteschubert Apr 5, 2023
6e68746
Adding to Files.writeString StandardOpenOption.TRUNCATE_EXISTING
svanteschubert Apr 5, 2023
2252e6b
Adding command line options
svanteschubert Apr 5, 2023
a0d18aa
Refactored the command-line into an own class without changing it by …
svanteschubert Apr 5, 2023
e8386d5
Now activating TextReport interface
svanteschubert Apr 5, 2023
b1aa6bc
Activating SingleLineChangeTextReport - now only its content has to b…
svanteschubert Apr 5, 2023
d235749
SingleLine output for each XSD change is activated
svanteschubert Apr 5, 2023
9df3d12
Added regression test for single line per change report and removed d…
svanteschubert Apr 5, 2023
6b01fd2
Minor Refactoring of method names
svanteschubert Apr 5, 2023
cd9ff4c
Joining duplicated fixedValue and fixedDefault facet
svanteschubert Apr 6, 2023
03aa7d7
Adding XSDs of the FR/DE Factur-x profiles (comparison with D22B trig…
svanteschubert Apr 13, 2023
ecb390e
Adding the Dangerous Report for XSD changes being likely critical for…
svanteschubert Apr 13, 2023
9eac408
Mandatory elements within a xsd:choice become optional (single child …
svanteschubert Apr 13, 2023
7d032c9
Adding report for extension and restriction
svanteschubert Apr 14, 2023
f38874a
Added facets xs:maxInclusive xs:maxExcluisve xs:minInclusive xs:minEx…
svanteschubert Apr 16, 2023
e4d50fe
Extending tests
svanteschubert Apr 16, 2023
7c39053
Adding change detection of compositor (xs:sequence, xs:choice, xs:all)
svanteschubert Apr 17, 2023
ea191ce
Improving the output of comparisons: Stating no semantic change if a …
svanteschubert Apr 17, 2023
e95897c
Reducing memory foot-print by 1) removing XPath property and creating…
svanteschubert Apr 18, 2023
4dd9af5
Adding comparison of element content
svanteschubert Apr 19, 2023
99df93e
Renamed uncefact xml xsd folder to draft instead date to ease compare…
svanteschubert Apr 25, 2023
f31d062
Added update of uncefact xml draft of 20230424 - after dos2unix norma…
svanteschubert Apr 25, 2023
4a2adab
Adjusted test references with new XSD D22B draft - after test directo…
svanteschubert Apr 25, 2023
f511016
Updating the reports on enumerations: A new enumeration (a subset of …
svanteschubert May 5, 2023
51db2e2
Exchanging XSD files from UN/CEFACT from D22B draft to final XSD D22B…
svanteschubert Jan 16, 2024
01ade9c
Refactoring: Moving Factur-X to Factur-X 1.0.06 folder and renaming t…
svanteschubert Jan 16, 2024
448cbf0
Adding draft version of Factur-X 1.0.07 for QA comparison
svanteschubert Jan 16, 2024
161dd01
Adding regression test files from the output of comparison of 1.0.07
svanteschubert Jan 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.idea/
target/
buid/

**/*.iml
build/
logs/
**/*.iml
4 changes: 0 additions & 4 deletions application.yml

This file was deleted.

240 changes: 240 additions & 0 deletions assets/linux/xsd-compare.xpm

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions lombok.config
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
config.stopBubbling = true
lombok.addLombokGeneratedAnnotation = true
81 changes: 65 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,12 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.12.0</version>
<version>5.2.3</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand All @@ -77,14 +72,19 @@
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.12.2</version>
</dependency>

<!-- JavaFX -->
<dependency>
<groupId>com.github.yoep</groupId>
<artifactId>spring-boot-starter-javafx</artifactId>
<version>${spring-boot-starter-javafx.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
Expand Down Expand Up @@ -139,7 +139,7 @@
<plugin>
<groupId>io.github.fvarrui</groupId>
<artifactId>javapackager</artifactId>
<version>1.1.0</version>
<version>1.7.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -165,7 +165,7 @@
</plugin>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<version>3.1.0</version>
<executions>
<execution>
<goals>
Expand All @@ -184,10 +184,18 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<systemPropertyVariables>
<!-- see https://cwiki.apache.org/confluence/display/MAVEN/Maven+Properties+Guide -->
<xsd.compare.base.dir>${project.basedir}</xsd.compare.base.dir>
</systemPropertyVariables>
</configuration>
</plugin>
<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
<configuration>
<finalName>xsd-compare</finalName>
<keepDependenciesWithProvidedScope>false</keepDependenciesWithProvidedScope>
Expand All @@ -200,23 +208,64 @@
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.handlers</resource>
</transformer>
<transformer implementation="org.springframework.boot.maven.PropertiesMergingResourceTransformer">
<transformer
implementation="org.springframework.boot.maven.PropertiesMergingResourceTransformer">
<resource>META-INF/spring.factories</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.schemas</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>${start-class}</mainClass>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer">
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>${start-class}</Main-Class>
<X-Compile-Source-JDK>${maven.compiler.source}</X-Compile-Source-JDK>
<X-Compile-Target-JDK>${maven.compiler.target}</X-Compile-Target-JDK>
</manifestEntries>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>-->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it has to do with the new packaging plugin, but running the bundled jar doesn't seem to be working.

➜  xsd-compare git:(feature/recursive_xsd) ✗ java -jar ./target/xsd-compare-0.0.9-SNAPSHOT-jar-with-dependencies.jar --gui
usage: java -jar xsd-compare-jar-with-dependencies.jar <opts> <old-xsd-grammar> <new-xsd-grammar>

options:
                --ui: omits the GUI and returns only a text result for comparision (default).
                --gui: starts a JavaFX GUI front-end for comparison.
                --multi or -m: multiple lines indented per change sorted by XSD change. (default).
                --single or -s: one single line for each change with XPath in the start, harder to read but easier for compare the output with other tools.
                --extensions-only  or -e: one single line for each extension of the grammar sorted by type. Restrictions/limitations are being neglected.
                --restrictions-only  or -r: one single line for each new restrictions, requirements or limitations of the new grammar sorted by type. Extensions are being neglected.
                --help or -h: this help text.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may try to get packaging and frontend to work before my patch. At least did not work for me. Thanks for your help!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am usually testing/starting directly from the IDE and not triggering by commandline the JAR, but tested it once manually, when I was added the functionality (at least the xsd-compare-0.0.9-SNAPSHOT-jar-with-dependencies.jar)
Calling the following is showing me the options:
java -jar xsd-compare-0.0.9-SNAPSHOT-jar-with-dependencies.jar

With the former way, I had problems with the manifest...

You might considere to increase the JDK baseline to JDK 17 (or at least play around / test it ) for the JavaFX part?

Where are you hanging? Perhaps you start on a branch from scretch without any funcationality of mine from your latest commit before my PullRequest. Updating the pom.xml (not trivial - I have realized) :-)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there are any question/remarks left to answer, please give me a ping, Yoep!
All the best,
Svante

<configuration>
<archive>
<index>true</index>
<manifest>
<mainClass>${start-class}</mainClass>
<!-- does not compile with the following:
<vmArgs>
<param>-Dsun.awt.disablegrab=true</param>
<param>-XX:+UseG1GC</param>
</vmArgs>-->
</manifest>
<manifestEntries>
<version>${project.version}</version>
</manifestEntries>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>single</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.github.fvarrui</groupId>
Expand Down
103 changes: 101 additions & 2 deletions src/main/java/com/compare/xsd/XsdCompareStarter.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,106 @@
package com.compare.xsd;

import com.compare.xsd.comparison.TextReport;
import com.compare.xsd.comparison.XsdComparer;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class XsdCompareStarter {
public static void main(String[] args) {
XsdCompareApplication.main(args);
public static void main( String[] args ) throws Exception {
System.exit(run(args));
}

@SuppressWarnings("deprecation")
public static int run( String[] args ) throws Exception {
final List<String> fileNames = new ArrayList<String>();

boolean gui = false;
/** For instance, the SingleLineChangeTextReport creates only a single text line for every XSD change
* this harder to read, but assists to compare the result with other XSD comparison tools */
TextReport.implementation reportType = TextReport.implementation.MULTI_LINE_CHANGE;

for (int i = 0; i < args.length; i++) {
args[i] = args[i].trim();
if (args[i].equalsIgnoreCase("-h")
|| args[i].equalsIgnoreCase("-help")
|| args[i].equalsIgnoreCase("-?")) {
usage();
return -1;
}
else if (args[i].equalsIgnoreCase("-single")
|| args[i].equalsIgnoreCase("-s")
|| args[i].equalsIgnoreCase("--single")
|| args[i].equalsIgnoreCase("--s")) reportType = TextReport.implementation.SINGLE_LINE;
else if (args[i].equalsIgnoreCase("-multi")
|| args[i].equalsIgnoreCase("-m")
|| args[i].equalsIgnoreCase("--multi")
|| args[i].equalsIgnoreCase("--m")) reportType = TextReport.implementation.MULTI_LINE_CHANGE;
else if (args[i].equalsIgnoreCase("--extensions-only")
|| args[i].equalsIgnoreCase("-e")
|| args[i].equalsIgnoreCase("-extensions-only")
|| args[i].equalsIgnoreCase("--e")) reportType = TextReport.implementation.ONLY_EXTENSIONS;
else if (args[i].equalsIgnoreCase("--restrictions-only")
|| args[i].equalsIgnoreCase("-r")
|| args[i].equalsIgnoreCase("-restrictions-only")
|| args[i].equalsIgnoreCase("--r")) reportType = TextReport.implementation.ONLY_RESTRICTIONS;
else if (args[i].equalsIgnoreCase("-gui")
|| args[i].equalsIgnoreCase("-g")
|| args[i].equalsIgnoreCase("--gui")
|| args[i].equalsIgnoreCase("--g")) gui = true;
else if (args[i].equalsIgnoreCase("-ui")
|| args[i].equalsIgnoreCase("-u")
|| args[i].equalsIgnoreCase("--ui")
|| args[i].equalsIgnoreCase("--u")) gui = false;

/* usually the version number was added ot manifest during build
} else if (args[i].equalsIgnoreCase("-version") || args[i].equalsIgnoreCase("-v")) {
printVersion();
return -1;
}*/

else {
if( args[i].charAt(0)=='-' ) {
System.err.println("Unrecognized option: " + args[i]);
usage();
return -1;
}
fileNames.add(args[i]);
}
}
if(fileNames.size() != 2){
usage();
}else{
String currentDir = System.getProperty("user.dir") + File.separator;
if(gui){
String[] guiArgs = {currentDir + fileNames.get(0), currentDir + fileNames.get(1)};
XsdCompareApplication.main(guiArgs);
}else {
XsdComparer comparer = new XsdComparer(currentDir + fileNames.get(0), currentDir + fileNames.get(1), TextReport.implementation.SINGLE_LINE);
System.out.println(comparer.compareAsString());
}
return 0;
}
return -1;
}


/** Prints the usage screen. */
private static void usage() {
System.out.println(USAGE_UI);
}

private static final String USAGE_UI =
"usage: java -jar xsd-compare-jar-with-dependencies.jar <opts> <old-xsd-grammar> <new-xsd-grammar>\n\n" +
"options:\n" +
"\t\t--ui: omits the GUI and returns only a text result for comparision (default).\n" +
"\t\t--gui: starts a JavaFX GUI front-end for comparison.\n" +
"\t\t--multi or -m: multiple lines indented per change sorted by XSD change. (default).\n" +
"\t\t--single or -s: one single line for each change with XPath in the start, harder to read but easier for compare the output with other tools.\n" +
"\t\t--extensions-only or -e: one single line for each extension of the grammar sorted by type. Restrictions/limitations are being neglected.\n" +
"\t\t--restrictions-only or -r: one single line for each new restrictions, requirements or limitations of the new grammar sorted by type. Extensions are being neglected.\n" +
"\t\t--help or -h: this help text.\n";
// + "\t\t-version : display version number.\n";

}
Loading