mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-25 16:55:39 +00:00
Resolve "Make engine version configurable"
This commit is contained in:
parent
94f872c752
commit
6fba84f31b
5 changed files with 81 additions and 10 deletions
|
|
@ -58,10 +58,6 @@ import net.sf.saxon.s9api.Processor;
|
|||
@Slf4j
|
||||
public class DefaultCheck implements Check {
|
||||
|
||||
private static final String ENGINE_NAME = "KoSIT Prüftool";
|
||||
|
||||
private static final String ENGINE_VERSION = "1.0.0";
|
||||
|
||||
@Getter
|
||||
private final ScenarioRepository repository;
|
||||
|
||||
|
|
@ -99,10 +95,10 @@ public class DefaultCheck implements Check {
|
|||
protected static CreateReportInput createReport() {
|
||||
final CreateReportInput type = new CreateReportInput();
|
||||
final EngineType e = new EngineType();
|
||||
e.setName(ENGINE_NAME);
|
||||
e.setName(EngineInformation.getName());
|
||||
type.setEngine(e);
|
||||
type.setTimestamp(ObjectFactory.createTimestamp());
|
||||
type.setFrameworkVersion(ENGINE_VERSION);
|
||||
type.setFrameworkVersion(EngineInformation.getFrameworkVersion());
|
||||
return type;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,58 @@
|
|||
package de.kosit.validationtool.impl;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* Hält statische Informatione über diesen Validator.
|
||||
*
|
||||
* @author Andreas Penski
|
||||
*/
|
||||
public class EngineInformation {
|
||||
|
||||
private static final Properties PROPERTIES;
|
||||
|
||||
static {
|
||||
PROPERTIES = new Properties();
|
||||
try ( final InputStream input = EngineInformation.class.getClassLoader().getResourceAsStream("app-info.properties") ) {
|
||||
if (input != null) {
|
||||
PROPERTIES.load(input);
|
||||
}
|
||||
} catch (final IOException e) {
|
||||
throw new IllegalStateException("Can not engine information", e);
|
||||
}
|
||||
}
|
||||
|
||||
private EngineInformation() {
|
||||
// hide
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt die Versions-Nummer des Validators zurück.
|
||||
*
|
||||
* @return die Version
|
||||
*/
|
||||
public static String getVersion() {
|
||||
return PROPERTIES.getProperty("project_version");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt den Namen der Engine zurück.
|
||||
*
|
||||
* @return der Name
|
||||
*/
|
||||
public static String getName() {
|
||||
return PROPERTIES.getProperty("engine_name");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt die Versions-Nummer des verwendeten Frameworks zurück. Diese ist relevant um Scenario-Konfiguration und
|
||||
* Validator-Versionen aufeinander abzustimmen.
|
||||
*
|
||||
* @return die Framework-Version
|
||||
*/
|
||||
public static String getFrameworkVersion() {
|
||||
return PROPERTIES.getProperty("framework_version");
|
||||
}
|
||||
}
|
||||
9
src/main/resources/app-info.properties
Normal file
9
src/main/resources/app-info.properties
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# do not edit this file
|
||||
# this properties are overriden by build process
|
||||
project_version=${project.version}
|
||||
framework_version=1.0.0
|
||||
engine_name=KoSIT Prüftool
|
||||
build_timestamp=${build.timestamp}
|
||||
build_number=${build.number}
|
||||
build_revision=${build.revision}
|
||||
build_branch=${build.branch}
|
||||
Loading…
Add table
Add a link
Reference in a new issue