-
Notifications
You must be signed in to change notification settings - Fork 9
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
Resolve object for paths ending in association #134
Open
domi-b
wants to merge
1
commit into
claeis:master
Choose a base branch
from
GeoWerkstatt:association-path
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+96
−24
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
INTERLIS 2.4; | ||
|
||
MODEL ModelA (en) AT "http://www.interlis.ch/ili2c/tests/" VERSION "2024-10-01" = | ||
TOPIC TopicA = | ||
CLASS ClassA1 = | ||
Attr : BOOLEAN; | ||
END ClassA1; | ||
|
||
CLASS ClassB1 = | ||
Code: TEXT*10; | ||
END ClassB1; | ||
|
||
ASSOCIATION Assoc1 = | ||
AssocA -- {0..*} ClassA1; | ||
AssocB -<> {1} ClassB1; | ||
END Assoc1; | ||
|
||
CONSTRAINTS OF ClassA1 = | ||
MANDATORY CONSTRAINT IsOfClassAShouldFail : INTERLIS.isOfClass(THIS->AssocB, >ClassA1); | ||
MANDATORY CONSTRAINT IsOfClassB : INTERLIS.isOfClass(THIS->AssocB, >ClassB1); | ||
|
||
MANDATORY CONSTRAINT CodeLength : INTERLIS.len(THIS->AssocB->Code) >= 3; | ||
END; | ||
END TopicA; | ||
END ModelA. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ili:transfer xmlns:ili="http://www.interlis.ch/xtf/2.4/INTERLIS" | ||
xmlns:geom="http://www.interlis.ch/geometry/1.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:ModelA="http://www.interlis.ch/xtf/2.4/ModelA"> | ||
<ili:headersection> | ||
<ili:models> | ||
<ili:model>ModelA</ili:model> | ||
</ili:models> | ||
<ili:sender>ili2gpkg-5.0.1-447c03f22b8f346a44ada86c553d10110872fd40</ili:sender> | ||
</ili:headersection> | ||
<ili:datasection> | ||
<ModelA:TopicA ili:bid="basket_1"> | ||
<ModelA:ClassB1 ili:tid="obj_b1"> | ||
<ModelA:Code>abc</ModelA:Code> | ||
</ModelA:ClassB1> | ||
<ModelA:ClassB1 ili:tid="obj_b2"> | ||
<ModelA:Code>xyz</ModelA:Code> | ||
</ModelA:ClassB1> | ||
<ModelA:ClassA1 ili:tid="obj_a1"> | ||
<ModelA:AssocB ili:ref="obj_b2"></ModelA:AssocB> | ||
<ModelA:Attr>true</ModelA:Attr> | ||
</ModelA:ClassA1> | ||
</ModelA:TopicA> | ||
</ili:datasection> | ||
</ili:transfer> |
32 changes: 32 additions & 0 deletions
32
src/test/java/ch/interlis/iox_j/validator/AssociationPathTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package ch.interlis.iox_j.validator; | ||
|
||
import ch.interlis.ili2c.metamodel.TransferDescription; | ||
import ch.interlis.iox.IoxException; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import java.io.File; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class AssociationPathTest { | ||
private static final String TEST_DIR = "src/test/data/validator"; | ||
private static final String ILI_FILE = TEST_DIR + "/AssociationPath.ili"; | ||
private static final String XTF_FILE = TEST_DIR + "/AssociationPath.xtf"; | ||
|
||
private TransferDescription td; | ||
|
||
@Before | ||
public void setUp() { | ||
td = ValidatorTestHelper.compileIliFile(ILI_FILE); | ||
} | ||
|
||
@Test | ||
public void testAssociationPath() throws IoxException { | ||
File xtfFile = new File(XTF_FILE); | ||
LogCollector logger = ValidatorTestHelper.validateObjectsFromXtf24(td, xtfFile); | ||
|
||
assertEquals(1, logger.getErrs().size()); | ||
assertEquals("Mandatory Constraint ModelA.TopicA.ClassA1.IsOfClassAShouldFail is not true.", logger.getErrs().get(0).getEventMsg()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PP: Sollte auch einfacher gehen.
PP: Könnte auch gleich für die Refoid so gemacht werden.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Objects.equals
gibt es leider erst ab Java 7 😞