Skip to content

Update plugins and dependencies, migrate to JUnit5 and fix issues #164

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

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
2ba6de0
00-Release-1.5.x
Adrian-Devries Apr 24, 2025
106ca82
01-RenewPOM
Adrian-Devries Apr 24, 2025
6a06fb7
02-AddVersionPlugin
Adrian-Devries Apr 24, 2025
04a236e
03-UpdatePlugins
Adrian-Devries Apr 24, 2025
20ba488
04-UpdateDependencies
Adrian-Devries Apr 24, 2025
a1965e7
05-AddOtherPlugins
Adrian-Devries Apr 24, 2025
adb4eff
06-FixCompilationWarningsMain
Adrian-Devries Apr 24, 2025
d22b03c
07-FixCompilationWarningsTest
Adrian-Devries Apr 24, 2025
3756a70
08-FixUndeclaredDependencies
Adrian-Devries Apr 24, 2025
386661c
09-FixJavadocWarnings
Adrian-Devries Apr 24, 2025
d88934e
10-OptimizeImports
Adrian-Devries Apr 24, 2025
1952ea6
11-FixClassStructureIssues
Adrian-Devries Apr 24, 2025
76c331a
12-FixCodeMaturityIssues
Adrian-Devries Apr 24, 2025
7a81f0c
13-FixCodeStyleIssues
Adrian-Devries Apr 24, 2025
46fdd70
14-FixDeclarationRedundancyIssues
Adrian-Devries Apr 24, 2025
d622da7
15-FixJavaLanguageLevelMigrationIssues
Adrian-Devries Apr 24, 2025
70a98f0
16-FixJavadocIssues
Adrian-Devries Apr 24, 2025
d999718
17-FixMemoryIssues
Adrian-Devries Apr 24, 2025
b5bd901
18-FixPerformanceIssues
Adrian-Devries Apr 24, 2025
64b8450
19-FixProbableBugs
Adrian-Devries Apr 24, 2025
12905e1
20-FixResourceManagementIssues
Adrian-Devries Apr 24, 2025
852f69f
21-FixVerboseOrRedundantCodeConstructs#1
Adrian-Devries Apr 24, 2025
55a31b2
22-FixVisibilityIssues
Adrian-Devries Apr 24, 2025
65184ae
23-FixVerboseOrRedundantCodeConstructs#2
Adrian-Devries Apr 24, 2025
7d99b83
24-FixGrammar
Adrian-Devries Apr 24, 2025
2466f9c
25-FixTypos
Adrian-Devries Apr 24, 2025
24509aa
26-AddAndApplyOpenRewrite
Adrian-Devries Apr 24, 2025
b323b6c
FixResourceManagementIssues#2
Adrian-Devries Apr 25, 2025
b2ba92c
FixResourceManagementIssues
Adrian-Devries Apr 25, 2025
07240d7
28-KeepCompatibilityToJDK8
Adrian-Devries Apr 27, 2025
a6238b6
29-UpdatePluginsAndDependencies
Adrian-Devries Apr 28, 2025
2cfad06
30-UpdatePluginsAndDependencies#2
Adrian-Devries May 4, 2025
2425e91
31-UpdatePluginsAndDependencies#3
Adrian-Devries May 9, 2025
68371eb
32-UpdatePluginsAndDependencies#4
Adrian-Devries May 16, 2025
983d214
33-UpdatePluginsAndDependencies#5
Adrian-Devries May 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,700 changes: 1,044 additions & 656 deletions pom.xml

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions src/main/java/de/kosit/validationtool/api/Check.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

package de.kosit.validationtool.api;

import org.w3c.dom.Document;

import java.util.List;
import java.util.stream.Collectors;

import org.w3c.dom.Document;

/**
* Main validator interface for checking incoming files.
*
Expand All @@ -29,8 +29,8 @@
public interface Check {

/**
* Checks an incoming xml {@link Input Inputs}. The result-{@link Document} is readonly. To change the this document
* you need to copy the nodes into an new {@link Document}.
* Checks an incoming xml {@link Input Inputs}. The result-{@link Document} is readonly. To change this document you
* need to copy the nodes into a new {@link Document}.
*
* @param input the resource / xml file to validate.
* @return a result-{@link Document} (readonly)
Expand All @@ -51,9 +51,9 @@ default Document check(final Input input) {

/**
* Checks an incoming xml files in batch mode. Processing is sequential. The result-{@link Document Documents} are
* readonly. To change the this document you need to copy them into new {@link Document Documents}.
*
*
* readonly. To change this document you need to copy them into new {@link Document Documents}.
*
*
* @param input list of xml {@link Input Inputs}
* @return list of result-{@link Document Documents} (readonly)
*/
Expand Down
19 changes: 9 additions & 10 deletions src/main/java/de/kosit/validationtool/api/CheckConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,21 @@

package de.kosit.validationtool.api;

import java.net.URI;
import java.util.List;
import java.util.Map;

import de.kosit.validationtool.impl.ContentRepository;
import de.kosit.validationtool.impl.Scenario;
import de.kosit.validationtool.impl.xml.ProcessorProvider;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

import de.kosit.validationtool.impl.ContentRepository;
import de.kosit.validationtool.impl.Scenario;
import de.kosit.validationtool.impl.xml.ProcessorProvider;
import java.net.URI;
import java.util.List;
import java.util.Map;

/**
* Zentrale Konfigration einer Prüf-Instanz.
*
* Zentrale Konfiguration einer Prüf-Instanz.
*
* @author Andreas Penski
* @deprecated since 1.3.0 use {@link Configuration} instead. Will be removed in 2.0
*/
Expand All @@ -43,7 +42,7 @@
public class CheckConfiguration implements Configuration {

/**
* URL, die auf die scenerio.xml Datei zeigt.
* URL, die auf die scenario.xml Datei zeigt.
*/
private final URI scenarioDefinition;

Expand Down
12 changes: 6 additions & 6 deletions src/main/java/de/kosit/validationtool/api/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@

package de.kosit.validationtool.api;

import java.net.URI;
import java.util.List;
import java.util.Map;

import de.kosit.validationtool.config.ConfigurationBuilder;
import de.kosit.validationtool.config.ConfigurationLoader;
import de.kosit.validationtool.impl.ContentRepository;
import de.kosit.validationtool.impl.Scenario;

import java.net.URI;
import java.util.List;
import java.util.Map;

/**
* Configuration of the actual {@link Check} instance. This is an interface and can be implemented by custom
* configuration classes. There are two implementations supported out of the box:
Expand All @@ -35,7 +35,7 @@
* {@link Check}</li>
* </ol>
* <p>
* Both methods can be used via convinience methods. See below.
* Both methods can be used via convenience methods. See below.
*
* @author Andreas Penski
*/
Expand Down Expand Up @@ -103,7 +103,7 @@ static ConfigurationLoader load(final URI scenarioDefinition) {
}

/**
* Loads an XML based scenario definition from the file with an specific repository / source location specified via
* Loads an XML based scenario definition from the file with a specific repository / source location specified via
* URIs.
*
* @param scenarioDefinition the XML file with scenario definition
Expand Down
13 changes: 6 additions & 7 deletions src/main/java/de/kosit/validationtool/api/Input.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@

package de.kosit.validationtool.api;

import java.io.IOException;

import javax.xml.transform.Source;
import java.io.IOException;

/**
* An input for the validator.
Expand All @@ -30,28 +29,28 @@ public interface Input {

/**
* The name of the input for document identification
*
*
* @return the name
*/
String getName();

/**
* The hashcode for document identification
*
*
* @return the computed hashcode
*/
byte[] getHashCode();

/**
* The digest algorithm used for computing the {@link #getHashCode()}
*
* @return the name of the digest algorith
*
* @return the name of the digest algorithm
*/
String getDigestAlgorithm();

/**
* Creates a new {@link Source } for this input which carries the actual data
*
*
* @return an open {@link Source}
* @throws IOException on I/O while opening the source
*/
Expand Down
73 changes: 35 additions & 38 deletions src/main/java/de/kosit/validationtool/api/InputFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,18 @@

package de.kosit.validationtool.api;

import static org.apache.commons.lang3.StringUtils.isNotEmpty;
import de.kosit.validationtool.impl.input.ByteArrayInput;
import de.kosit.validationtool.impl.input.ResourceInput;
import de.kosit.validationtool.impl.input.SourceInput;
import de.kosit.validationtool.impl.input.StreamHelper;
import de.kosit.validationtool.impl.input.XdmNodeInput;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import net.sf.saxon.s9api.XdmNode;
import org.apache.commons.lang3.StringUtils;

import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
Expand All @@ -28,49 +38,35 @@
import java.nio.file.Path;
import java.util.UUID;

import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;

import org.apache.commons.lang3.StringUtils;

import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

import de.kosit.validationtool.impl.input.ByteArrayInput;
import de.kosit.validationtool.impl.input.ResourceInput;
import de.kosit.validationtool.impl.input.SourceInput;
import de.kosit.validationtool.impl.input.StreamHelper;
import de.kosit.validationtool.impl.input.XdmNodeInput;

import net.sf.saxon.s9api.XdmNode;
import static org.apache.commons.lang3.StringUtils.isNotEmpty;

/**
* Service zum Einlesen des Test-Objekts in den Speicher. Beim Einlesen wird gleichzeitig eine Prüfsumme ermittelt und
* mit dem Ergebnis mitgeführt.
*
*
* @author Andreas Penski
*/
@Getter
@Slf4j
public class InputFactory {

static final String DEFAULT_ALGORITH = "SHA-256";
static final String DEFAULT_ALGORITHM = "SHA-256";

/**
* Pseudo hashcode algorithm name, which indicates, thate the hashcode of the {@link Input} is actually the name.
* Pseudo hashcode algorithm name, which indicates that the hashcode of the {@link Input} is actually the name.
*/
static final String PSEUDO_NAME_ALGORITHM = "NAME";

private static final String MESSAGE_OPEN_STREAM_ERROR = "Can not open stream from";

@Getter
private final String algorithm;

InputFactory() {
this(null);
}

InputFactory(final String specifiedAlgorithm) {
this.algorithm = isNotEmpty(specifiedAlgorithm) ? specifiedAlgorithm : DEFAULT_ALGORITH;
this.algorithm = isNotEmpty(specifiedAlgorithm) ? specifiedAlgorithm : DEFAULT_ALGORITHM;
// check validity
StreamHelper.createDigest(this.algorithm);
}
Expand All @@ -83,11 +79,11 @@ public class InputFactory {
* @return ein Prüf-Eingabe-Objekt
*/
public static Input read(final Path path) {
return read(path, DEFAULT_ALGORITH);
return read(path, DEFAULT_ALGORITHM);
}

/**
* Liest einen Prüfling von der übergebenen URL. Es wird ein definierter Algorithmis zur Ermittlung der Prüfsumme
* Liest einen Prüfling von der übergebenen URL. Es wird ein definierter Algorithmus zur Ermittlung der Prüfsumme
* genutzt.
*
* @param path der Prüflings
Expand All @@ -107,7 +103,7 @@ public static Input read(final Path path, final String digestAlgorithm) {
* @return ein Prüf-Eingabe-Objekt
*/
public static Input read(final File file) {
return read(file, DEFAULT_ALGORITH);
return read(file, DEFAULT_ALGORITHM);
}

/**
Expand All @@ -118,11 +114,11 @@ public static Input read(final File file) {
* @return ein Prüf-Eingabe-Objekt
*/
public static Input read(final URI uri) {
return read(uri, DEFAULT_ALGORITH);
return read(uri, DEFAULT_ALGORITHM);
}

/**
* Liest einen Prüfling von der übergebenen URL. Es wird ein definierter Algorithmis zur Ermittlung der Prüfsumme
* Liest einen Prüfling von der übergebenen URL. Es wird ein definierter Algorithmus zur Ermittlung der Prüfsumme
* genutzt.
*
* @param uri URI des Prüflings
Expand All @@ -145,13 +141,13 @@ public static Input read(final URI uri, final String digestAlgorithm) {
* @return ein Prüf-Eingabe-Objekt
*/
public static Input read(final URL url) {
return read(url, DEFAULT_ALGORITH);
return read(url, DEFAULT_ALGORITHM);
}

/**
* Liest einen Prüfling von der übergebenen URL. Es wird ein definierter Algorithmus zur Ermittlung der Prüfsumme
* genutzt.
*
*
* @param url URL des Prüflings
* @param digestAlgorithm der Prüfsummenalgorithmus
* @return ein Prüf-Eingabe-Objekt
Expand All @@ -173,28 +169,29 @@ public static Input read(final URL url, final String digestAlgorithm) {
* Reads a test document from a {@link Source}. Note: computing the hashcode is only supported for
* {@link StreamSource}. You can not directly use other {@link Source Soures}. You need to supply the hashcode for
* identification then.
*
*
* @param source source
* @return an {@link Input}
*/
public static Input read(final Source source) {
if (source instanceof StreamSource) {
return read(source, source.getSystemId(), DEFAULT_ALGORITH);
return read(source, source.getSystemId(), DEFAULT_ALGORITHM);
}
final String name = UUID.randomUUID().toString();
return read(source, name, PSEUDO_NAME_ALGORITHM, name.getBytes());
}

/**
* Reads a test document from a {@link Source} using a specified digest algorithm.
*
* <p>
* Note: computing the hashcode is only supported for {@link StreamSource}. You can not directly use other
* {@link Source Soures}. You need to supply the hashcode for identification then.
*
* @param source source
* @param name the digest algorithm
* @return an {@link Input}
*/
@SuppressWarnings("unused")
public static Input read(final Source source, final String name) {
checkNotEmpty(name);
return read(source, name, PSEUDO_NAME_ALGORITHM, name.getBytes());
Expand Down Expand Up @@ -222,7 +219,7 @@ public static Input read(final Source source, final String name, final String di
}

/**
* Liest einen Prüfling von der übergebenen URL. Es wird ein definierter Algorithmis zur Ermittlung der Prüfsumme
* Liest einen Prüfling von der übergebenen URL. Es wird ein definierter Algorithmus zur Ermittlung der Prüfsumme
* genutzt.
*
* @param file der Prüflings
Expand All @@ -240,19 +237,19 @@ public static Input read(final File file, final String digestAlgorithm) {
}

/**
* Liest einen Prüfling von der übergebenen byte-Sequenz. Es wird ein definierter Algorithmis zur Ermittlung der
* Liest einen Prüfling von der übergebenen byte-Sequenz. Es wird ein definierter Algorithmus zur Ermittlung der
* Prüfsumme genutzt.
*
* @param input URL des Prüflings
* @return ein Prüf-Eingabe-Objekt
*/
public static Input read(final byte[] input, final String name) {
checkNull(input);
return read(input, name, DEFAULT_ALGORITH);
return read(input, name, DEFAULT_ALGORITHM);
}

/**
* Liest einen Prüfling von der übergebenen byte-Sequenz. Es wird ein definierter Algorithmis zur Ermittlung der
* Liest einen Prüfling von der übergebenen byte-Sequenz. Es wird ein definierter Algorithmus zur Ermittlung der
* Prüfsumme genutzt.
*
* @param input URL des Prüflings
Expand All @@ -279,13 +276,13 @@ private static void checkNull(final Object input) {

/**
* Liest einen Prüfling vom übergebenen {@link InputStream}.
*
*
* @param inputStream der {@link InputStream}
* @param name der Name/Bezeichner des Prüflings
* @return einen Prüfling in eingelesener Form
*/
public static Input read(final InputStream inputStream, final String name) {
return read(inputStream, name, DEFAULT_ALGORITH);
return read(inputStream, name, DEFAULT_ALGORITHM);
}

/**
Expand All @@ -304,7 +301,7 @@ public static Input read(final InputStream inputStream, final String name, final
/**
* Reads a saxon {@link XdmNode} with a given name. Hashcode identification is based on the name of the supplied
* input. Now real hashcode is computed.
*
*
* @param node the node to read
* @param name the name of the {@link Input}
* @return an {@link Input} to validate
Expand Down
Loading