Skip to content

Commit

Permalink
Rename function to IsInsideExternalXtfResource
Browse files Browse the repository at this point in the history
  • Loading branch information
domi-b committed Feb 26, 2024
1 parent a14dda6 commit 8806b17
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
import java.util.List;
import java.util.Map;

public final class IsInsideExternalDatasetResourceIoxPlugin extends BaseIsInsideFunction {
public final class IsInsideExternalXtfResourceIoxPlugin extends BaseIsInsideFunction {
private static final Map<ValidAreaKey, Geometry> VALID_AREA_CACHE = new HashMap<>();
private static final String QUALIFIED_ILI_NAME = "GeoW_FunctionsExt.IsInsideExternalDatasetResource";
private static final String QUALIFIED_ILI_NAME = "GeoW_FunctionsExt.IsInsideExternalXtfResource";

@Override
public String getQualifiedIliName() {
Expand Down
2 changes: 1 addition & 1 deletion src/model/GeoW_FunctionsExt.ili
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ MODEL GeoW_FunctionsExt
!!@ fn.param = "TransferFile: Qualifizierter Name der Transferdatei-Ressource. DatasetName: Qualifizierter Name des Attributes aus dem Transfermodell, in welchem die Objekte zur Prüfung bereitliegen. Objects: Objekt(e), über die TID identifiziert, welche zur Prüfung beigezogen werden. TestObject: Objekt, welches zu prüfen ist. TestObjectgeometry: Geometriefeld, bezogen auf das unter Testobject übergebene Objekt";
!!@ fn.return = "Boolean";
!!@ fn.since = "2023-12-20";
FUNCTION IsInsideExternalDatasetResource (TransferFile: TEXT; DatasetName: TEXT; Objects: TEXT; TestObject: OBJECT OF ANYCLASS; TestObjectgeometry: TEXT): BOOLEAN;
FUNCTION IsInsideExternalXtfResource (TransferFile: TEXT; DatasetName: TEXT; Objects: TEXT; TestObject: OBJECT OF ANYCLASS; TestObjectgeometry: TEXT): BOOLEAN;

!!@ fn.description = "Prüft, ob ein Objekt innerhalb der Geometrie eines anderen Objektes liegt.";
!!@ fn.param = "ReferenceObject: Referenzobjekt oder -geometrie, innerhalb welcher das TestObject liegen muss. ReferenceGeometryAttr: Pfad zum Geometrieattribut vom Referenzobjekt oder UNDEFINED. TestObject: Objekt, welches zu prüfen ist. TestObjectgeometry: Geometriefeld, bezogen auf das unter Testobject übergebene Objekt";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ MODEL TestSuite

CLASS IsInsideSOKantonsgrenze EXTENDS ConstraintTestClass =
testAttributeIsInsideSOKantonsgrenze : CHKoord;
MANDATORY CONSTRAINT IsInsideSOKantonsgrenze: GeoW_FunctionsExt.IsInsideExternalDatasetResource("IsInsideExternalDatasetResource/ch.so.agi.av.hoheitsgrenzen_excerpt.xtf", "SO_Hoheitsgrenzen_Publikation_20170626.Hoheitsgrenzen.Kantonsgrenze.Geometrie", "fubar", THIS, "testAttributeIsInsideCHBaseGeometrie") == expected;
MANDATORY CONSTRAINT IsInsideSOKantonsgrenze: GeoW_FunctionsExt.IsInsideExternalXtfResource("IsInsideExternalXtfResource/ch.so.agi.av.hoheitsgrenzen_excerpt.xtf", "SO_Hoheitsgrenzen_Publikation_20170626.Hoheitsgrenzen.Kantonsgrenze.Geometrie", "fubar", THIS, "testAttributeIsInsideSOKantonsgrenze") == expected;
END IsInsideSOKantonsgrenze;

CLASS InvalidConstraints =
geometryAttribute : CHKoord;
MANDATORY CONSTRAINT MalformedDatasetName: GeoW_FunctionsExt.IsInsideExternalDatasetResource("IsInsideExternalDatasetResource/ch.so.agi.av.hoheitsgrenzen_excerpt.xtf", "DatasetNameWithoutQualifiedAttribute", "fubar", THIS, "geometryAttribute");
MANDATORY CONSTRAINT NonExistentTransferFile: GeoW_FunctionsExt.IsInsideExternalDatasetResource("NotExistingFile.xtf", "SO_Hoheitsgrenzen_Publikation_20170626.Hoheitsgrenzen.Kantonsgrenze.Geometrie", "fubar", THIS, "geometryAttribute");
MANDATORY CONSTRAINT NonExistentTransferIds: GeoW_FunctionsExt.IsInsideExternalDatasetResource("IsInsideExternalDatasetResource/ch.so.agi.av.hoheitsgrenzen_excerpt.xtf", "SO_Hoheitsgrenzen_Publikation_20170626.Hoheitsgrenzen.Kantonsgrenze.Geometrie", "9999,100000000", THIS, "geometryAttribute");
MANDATORY CONSTRAINT MalformedDatasetName: GeoW_FunctionsExt.IsInsideExternalXtfResource("IsInsideExternalXtfResource/ch.so.agi.av.hoheitsgrenzen_excerpt.xtf", "DatasetNameWithoutQualifiedAttribute", "fubar", THIS, "geometryAttribute");
MANDATORY CONSTRAINT NonExistentTransferFile: GeoW_FunctionsExt.IsInsideExternalXtfResource("NotExistingFile.xtf", "SO_Hoheitsgrenzen_Publikation_20170626.Hoheitsgrenzen.Kantonsgrenze.Geometrie", "fubar", THIS, "geometryAttribute");
MANDATORY CONSTRAINT NonExistentTransferIds: GeoW_FunctionsExt.IsInsideExternalXtfResource("IsInsideExternalXtfResource/ch.so.agi.av.hoheitsgrenzen_excerpt.xtf", "SO_Hoheitsgrenzen_Publikation_20170626.Hoheitsgrenzen.Kantonsgrenze.Geometrie", "9999,100000000", THIS, "geometryAttribute");
END InvalidConstraints;

END FunctionTestTopic;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

public final class IsInsideExternalDatasetResourceIoxPluginTest {
private static final String TEST_DATA = "IsInsideExternalDatasetResource/TestData.xtf";
public final class IsInsideExternalXtfResourceIoxPluginTest {
private static final String TEST_DATA = "IsInsideExternalXtfResource/TestData.xtf";
private ValidationTestHelper vh;

@BeforeEach
void setUp() {
vh = new ValidationTestHelper();
vh.addFunction(new IsInsideExternalDatasetResourceIoxPlugin());
vh.addFunction(new IsInsideExternalXtfResourceIoxPlugin());
}

@Test
void isInsideResourceDataset() throws Ili2cFailure, IoxException {
vh.runValidation(new String[]{TEST_DATA}, new String[]{"IsInsideExternalDatasetResource/MandatoryConstraintThis.ili"});
void isInsideExternalXtfResource() throws Ili2cFailure, IoxException {
vh.runValidation(new String[]{TEST_DATA}, new String[]{"IsInsideExternalXtfResource/MandatoryConstraintThis.ili"});

Assert.equals(6, vh.getErrs().size());
AssertionHelper.assertLogEventsContainMessage(vh.getErrs(), "TestSuite.FunctionTestTopic.InvalidConstraints.MalformedDatasetName: Unable to evaluate GeoW_FunctionsExt.IsInsideExternalDatasetResource. Expected qualified attribute name but got <DatasetNameWithoutQualifiedAttribute>.");
AssertionHelper.assertLogEventsContainMessage(vh.getErrs(), "TestSuite.FunctionTestTopic.InvalidConstraints.NonExistentTransferFile: Unable to evaluate GeoW_FunctionsExt.IsInsideExternalDatasetResource. Could not find Transferfile <NotExistingFile.xtf> in resources.");
AssertionHelper.assertLogEventsContainMessage(vh.getErrs(), "TestSuite.FunctionTestTopic.InvalidConstraints.NonExistentTransferIds: Unable to evaluate GeoW_FunctionsExt.IsInsideExternalDatasetResource. Could not find objects with TID <100000000, 9999> in transfer file");
AssertionHelper.assertLogEventsContainMessage(vh.getErrs(), "TestSuite.FunctionTestTopic.InvalidConstraints.MalformedDatasetName: Unable to evaluate GeoW_FunctionsExt.IsInsideExternalXtfResource. Expected qualified attribute name but got <DatasetNameWithoutQualifiedAttribute>.");
AssertionHelper.assertLogEventsContainMessage(vh.getErrs(), "TestSuite.FunctionTestTopic.InvalidConstraints.NonExistentTransferFile: Unable to evaluate GeoW_FunctionsExt.IsInsideExternalXtfResource. Could not find Transferfile <NotExistingFile.xtf> in resources.");
AssertionHelper.assertLogEventsContainMessage(vh.getErrs(), "TestSuite.FunctionTestTopic.InvalidConstraints.NonExistentTransferIds: Unable to evaluate GeoW_FunctionsExt.IsInsideExternalXtfResource. Could not find objects with TID <100000000, 9999> in transfer file");
AssertionHelper.assertLogEventsContainMessage(vh.getErrs(), "Mandatory Constraint TestSuite.FunctionTestTopic.InvalidConstraints.MalformedDatasetName is not true.");
AssertionHelper.assertLogEventsContainMessage(vh.getErrs(), "Mandatory Constraint TestSuite.FunctionTestTopic.InvalidConstraints.NonExistentTransferFile is not true.");
AssertionHelper.assertLogEventsContainMessage(vh.getErrs(), "Mandatory Constraint TestSuite.FunctionTestTopic.InvalidConstraints.NonExistentTransferIds is not true.");
Expand Down

0 comments on commit 8806b17

Please sign in to comment.