Skip to content

Commit

Permalink
Merge branch 'master' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
claeis committed Dec 6, 2023
2 parents a83faf2 + 29d2dcc commit 68a706c
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 16 deletions.
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ allprojects {
compileJava.options.encoding = 'US-ASCII'
}

version '1.13.3'+System.getProperty('release','-SNAPSHOT')
version '1.14.0'+System.getProperty('release','-SNAPSHOT')

configurations {
deployerJars
Expand All @@ -24,9 +24,9 @@ configurations {
dependencies {
compile group: 'ch.ehi', name: 'ehibasics', version: '1.4.1'
compile group: 'ch.interlis', name: 'iox-api', version: '1.0.4'
compile group: 'ch.interlis', name: 'iox-ili', version: '1.21.18'
compile group: 'ch.interlis', name: 'ili2c-tool', version: "5.3.2"
compile group: 'ch.interlis', name: 'ili2c-core', version: "5.3.2"
compile group: 'ch.interlis', name: 'iox-ili', version: '1.22.0'
compile group: 'ch.interlis', name: 'ili2c-tool', version: "5.4.0"
compile group: 'ch.interlis', name: 'ili2c-core', version: "5.4.0"
testCompile group: 'junit', name: 'junit', version: '4.12'
deployerJars "org.apache.maven.wagon:wagon-ftp:3.3.3"
deployerJars "org.apache.maven.wagon:wagon-ssh:3.3.3"
Expand Down
21 changes: 16 additions & 5 deletions docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
ilivalidator 1.14.0 (2023-12-06)
--------------------------------
- ILI2.4 Constraints zu Domains (#378)
- ILI2.4 validate generic coords with concrete domain (#354)
- ILI2.4 Add (BASKET) support for UNIQUE and SET CONSTRAINTS (#379)
- ILI2.4 Evaluation Expressions with +,-,*,/,=> (#380)
- Xtf24Reader: read reference attributes (#395)
- supply runtime paramters at cmdline (#383)
- ili2c-5.4.0
- iox-ili-1.22.0

ilivalidator 1.13.3 (2023-04-24)
--------------------------------
- fix UNIQUE mixed case INTERLIS.UUIDOID (ilivalidator#371)
- fix references with mixed case INTERLIS.UUIDOID (ilivalidator#370)
- log/report JRE Version (ilivalidator#369)
- fix UNIQUE mixed case INTERLIS.UUIDOID (#371)
- fix references with mixed case INTERLIS.UUIDOID (#370)
- log/report JRE Version (#369)
- iox-ili-1.21.18

ilivalidator 1.13.2 (2023-02-22)
--------------------------------
- Validator: PlausibilityConstraint: add calculated value to log (ilivalidator#367)
- Validator: PlausibilityConstraint: add calculated value to log (#367)
- Validator: fix LIST OF / BAG OF NumericType
- Validator: fix xtflog duplicate coord shows different coordinates in <message> and <geometry> (ilivalidator#353)
- Validator: fix xtflog duplicate coord shows different coordinates in <message> and <geometry> (#353)
- iox-ili-1.21.17

ilivalidator 1.13.1 (2023-01-23)
Expand Down
3 changes: 3 additions & 0 deletions docs/ilivalidator.rst
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,9 @@ Optionen:
| ``--multiplicityOff`` | Schaltet die Prüfung der Multiplizität generell aus. |
| | |
+---------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ``--runtimeParams param=value`` | Definiert Werte für Laufzeitparameter (RunTimeParameterDef). Mehrere Laufzeitparameter werden durch Semikolon ‚;‘ getrennt. Als Parametername muss der qualifizierte Namen verwendet werden. |
| | Beispiel: ``--runtimeParams ModelA.Param1=testValue1;ModelB.Param2=testValue2`` |
+---------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ``--singlePass`` | Schaltet alle Prüfungen aus, die nicht unmittelbar beim Ersten Lesen der Objekte ausgeführt werden können. |
| | |
+---------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Expand Down
4 changes: 4 additions & 0 deletions src/org/interlis2/validator/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ static public void main(String args[]){
}else if(arg.equals("--metaConfig")) {
argi++;
settings.setValue(Validator.SETTING_META_CONFIGFILE, args[argi]);
}else if(arg.equals("--runtimeParams")) {
argi++;
settings.setValue(Validator.SETTING_RUNTIME_PARAMETERS, args[argi]);
}else if(arg.equals("--forceTypeValidation")){
settings.setValue(Validator.SETTING_FORCE_TYPE_VALIDATION,Validator.TRUE);
}else if(arg.equals("--disableAreaValidation")){
Expand Down Expand Up @@ -167,6 +170,7 @@ static public void main(String args[]){
System.err.println("--dataset The requested Dataset ID to be updated");
System.err.println("--skipPolygonBuilding skip polygon building (only ITF).");
System.err.println("--allowItfAreaHoles allow empty holes (unassigned inner boundaries) in ITF AREA attributes.");
System.err.println("--runtimeParams param=value define values of runtime parameters.");
System.err.println("--singlePass skip any validations that require a second pass.");
System.err.println("--log file text file, that receives validation results.");
System.err.println("--logtime include timestamps in logfile.");
Expand Down
48 changes: 47 additions & 1 deletion src/org/interlis2/validator/Validator.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

Expand All @@ -20,6 +21,7 @@
import ch.interlis.ili2c.Ili2cException;
import ch.interlis.ili2c.Ili2cFailure;
import ch.interlis.ili2c.gui.UserSettings;
import ch.interlis.ili2c.metamodel.GraphicParameterDef;
import ch.interlis.ili2c.metamodel.Model;
import ch.interlis.ili2c.metamodel.TransferDescription;
import ch.interlis.ilirepository.Dataset;
Expand Down Expand Up @@ -337,7 +339,31 @@ public boolean validate(
}
td.setActualRuntimeParameter(ch.interlis.ili2c.metamodel.RuntimeParameters.MINIMAL_RUNTIME_SYSTEM01_RUNTIME_SYSTEM_NAME, Main.APP_NAME);
td.setActualRuntimeParameter(ch.interlis.ili2c.metamodel.RuntimeParameters.MINIMAL_RUNTIME_SYSTEM01_RUNTIME_SYSTEM_VERSION, Main.getVersion());

String rtTxt=settings.getValue(SETTING_RUNTIME_PARAMETERS);
if(rtTxt!=null) {
String rtv[]=rtTxt.split(";");
for(String rt:rtv) {
String kv[]=rt.split("=");
if(kv.length==2) {
if(kv[0]!=null) {
if(td.getElement(kv[0])==null) {
EhiLogger.logAdaption("unknown runtime parameter <"+kv[0]+">; ignored");
}else {
if(kv[1]!=null) {
EhiLogger.logState("runtime parameter "+kv[0]+" <"+kv[1]+">");
td.setActualRuntimeParameter(kv[0], kv[1]);
}
}
}else {
EhiLogger.logError("strange runtime parameter syntax <"+rt+">");
return false;
}
}else {
EhiLogger.logError("strange runtime parameter syntax <"+rt+">");
return false;
}
}
}
// process data files
EhiLogger.logState("validate data...");
ch.interlis.iox_j.validator.Validator validator=null;
Expand Down Expand Up @@ -464,6 +490,22 @@ public boolean validate(
}
return ret;
}
private List<GraphicParameterDef> getRuntimeParameters(TransferDescription td) {
List<GraphicParameterDef> ret=new ArrayList<GraphicParameterDef>();
for(Iterator modelIt=td.iterator();modelIt.hasNext();) {
Object modelo=modelIt.next();
if(modelo instanceof Model) {
for(Iterator paramIt=((Model)modelo).iterator();paramIt.hasNext();) {
Object paramo=paramIt.next();
if(paramo instanceof GraphicParameterDef) {
ret.add((GraphicParameterDef)paramo);
}
}
}
}
return ret;
}

private Settings readMetaConfig(File metaConfigFile,OutParam<String> baseConfig) throws IOException {
Settings settings=new Settings();
ValidationConfig config = IniFileReader.readFile(metaConfigFile);
Expand Down Expand Up @@ -757,6 +799,10 @@ public static boolean isItfFilename(String filename)
/** Assume that all objects are known to the validator. "true", "false". Default "false".
*/
public static final String SETTING_ALLOW_ITF_AREA_HOLES = "org.interlis2.validator.allowitfareaholes";
/** Define runtime parameters. Qualified ili-name equals value; semicolon separated.
* e.g. RuntimeSystem23.JobId1=test1;RuntimeSystem23.JobId2=test2
*/
public static final String SETTING_RUNTIME_PARAMETERS = "org.interlis2.validator.runtimeParameters";
/** Name of the data file (XTF format) that receives the validation results.
*/
public static final String SETTING_XTFLOG = "org.interlis2.validator.xtflog";
Expand Down
11 changes: 11 additions & 0 deletions test/data/runtimeParameter/RuntimeSystem23.ili
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ MODEL RuntimeSystem23

IMPORTS MinimalRuntimeSystem01;

PARAMETER
JobId : TEXT*150;

TOPIC TopicA =
CLASS ClassA =
attrA : TEXT;
Expand All @@ -20,5 +23,13 @@ MODEL RuntimeSystem23
END ClassB;
END TopicB;

TOPIC TopicC =
CLASS ClassC =
attrA : TEXT;
MANDATORY CONSTRAINT attrA==PARAMETER JobId;
END ClassC;
END TopicC;


END RuntimeSystem23.

5 changes: 5 additions & 0 deletions test/data/runtimeParameter/SimpleA.xtf
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,10 @@
<attrA>test/data/runtimeParameter/SimpleA.xtf</attrA>
</RuntimeSystem23.TopicB.ClassB>
</RuntimeSystem23.TopicB>
<RuntimeSystem23.TopicC BID="b3">
<RuntimeSystem23.TopicC.ClassC TID="o3">
<attrA>test1</attrA>
</RuntimeSystem23.TopicC.ClassC>
</RuntimeSystem23.TopicC>
</DATASECTION>
</TRANSFER>
9 changes: 3 additions & 6 deletions test/src/org/interlis2/validator/ValidatorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@

import static org.junit.Assert.*;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;

import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import ch.ehi.basics.logging.EhiLogger;
import ch.ehi.basics.settings.Settings;
import ch.interlis.iom.IomObject;
import ch.interlis.iom_j.xtf.XtfReader;
import ch.interlis.iom_j.xtf.XtfStartTransferEvent;
import ch.interlis.iox.EndBasketEvent;
import ch.interlis.iox.EndTransferEvent;
import ch.interlis.iox.IoxEvent;
Expand Down Expand Up @@ -101,15 +98,13 @@ public void xtfOkWithSettings() {
public void xtfInvalidPlaceholderSettingFail() {
Settings settings=new Settings();
settings.setValue(Validator.SETTING_ILIDIRS, "%ILI_DIR;http://models.interlis.ch/;%JAR_DIR/ilimodels");
EhiLogger.getInstance().setTraceFilter(false);
boolean ret=Validator.runValidation("test/data/Beispiel2a.xtf", settings);
assertFalse(ret);
}
@Test
public void xtfValidPlaceholderSettingOk() {
Settings settings=new Settings();
settings.setValue(Validator.SETTING_ILIDIRS, "%ITF_DIR;http://models.interlis.ch/;%JAR_DIR/ilimodels");
EhiLogger.getInstance().setTraceFilter(false);
boolean ret=Validator.runValidation("test/data/Beispiel2a.xtf", settings);
assertTrue(ret);
}
Expand Down Expand Up @@ -260,7 +255,9 @@ public void ili2cFail() {
}
@Test
public void xtfRuntimeParameterOk() {
boolean ret=Validator.runValidation("test/data/runtimeParameter/SimpleA.xtf", null);
Settings settings=new Settings();
settings.setValue(Validator.SETTING_RUNTIME_PARAMETERS, "RuntimeSystem23.JobId=test1;RuntimeSystem23.JobId2=test2");
boolean ret=Validator.runValidation("test/data/runtimeParameter/SimpleA.xtf", settings);
assertTrue(ret);
}

Expand Down

0 comments on commit 68a706c

Please sign in to comment.