From 9ca4c7ad150a17d67f4668ead81048193b3ca227 Mon Sep 17 00:00:00 2001 From: Philip Helger Date: Fri, 23 Aug 2024 16:31:26 +0200 Subject: [PATCH] Some minor post processing to #177 --- .../pure/binding/xpath/IPSXPathVariables.java | 8 ++++---- .../pure/binding/xpath/PSXPathVariables.java | 12 ++++++------ .../pure/supplementary/Issue177Test.java | 5 +++++ .../external/issues/github177/schematron.sch | 19 ++++++++++++++++++- 4 files changed, 33 insertions(+), 11 deletions(-) diff --git a/ph-schematron-pure/src/main/java/com/helger/schematron/pure/binding/xpath/IPSXPathVariables.java b/ph-schematron-pure/src/main/java/com/helger/schematron/pure/binding/xpath/IPSXPathVariables.java index 5d98ba016..22e764201 100644 --- a/ph-schematron-pure/src/main/java/com/helger/schematron/pure/binding/xpath/IPSXPathVariables.java +++ b/ph-schematron-pure/src/main/java/com/helger/schematron/pure/binding/xpath/IPSXPathVariables.java @@ -23,8 +23,8 @@ import javax.xml.xpath.XPathExpression; import com.helger.commons.annotation.ReturnsMutableCopy; -import com.helger.commons.collection.impl.ICommonsMap; -import com.helger.commons.collection.impl.ICommonsSet; +import com.helger.commons.collection.impl.ICommonsOrderedMap; +import com.helger.commons.collection.impl.ICommonsOrderedSet; import com.helger.commons.lang.ICloneable; /** @@ -39,7 +39,7 @@ public interface IPSXPathVariables extends ICloneable , Serial */ @Nonnull @ReturnsMutableCopy - ICommonsMap getAll (); + ICommonsOrderedMap getAll (); /** * @return All contained variable names. Never null. @@ -47,7 +47,7 @@ public interface IPSXPathVariables extends ICloneable , Serial */ @Nonnull @ReturnsMutableCopy - ICommonsSet getAllNames (); + ICommonsOrderedSet getAllNames (); /** * @param sName diff --git a/ph-schematron-pure/src/main/java/com/helger/schematron/pure/binding/xpath/PSXPathVariables.java b/ph-schematron-pure/src/main/java/com/helger/schematron/pure/binding/xpath/PSXPathVariables.java index 1e88df731..0e20cf1ac 100644 --- a/ph-schematron-pure/src/main/java/com/helger/schematron/pure/binding/xpath/PSXPathVariables.java +++ b/ph-schematron-pure/src/main/java/com/helger/schematron/pure/binding/xpath/PSXPathVariables.java @@ -27,8 +27,8 @@ import com.helger.commons.annotation.Nonempty; import com.helger.commons.annotation.ReturnsMutableCopy; import com.helger.commons.collection.impl.CommonsLinkedHashMap; -import com.helger.commons.collection.impl.ICommonsMap; -import com.helger.commons.collection.impl.ICommonsSet; +import com.helger.commons.collection.impl.ICommonsOrderedMap; +import com.helger.commons.collection.impl.ICommonsOrderedSet; import com.helger.commons.state.EChange; import com.helger.commons.string.StringHelper; import com.helger.commons.string.ToStringGenerator; @@ -43,12 +43,12 @@ public class PSXPathVariables implements IPSXPathVariables { @Nonnull @ReturnsMutableCopy - private static ICommonsMap _createMap () + private static ICommonsOrderedMap _createMap () { return new CommonsLinkedHashMap <> (); } - private final ICommonsMap m_aMap; + private final ICommonsOrderedMap m_aMap; public PSXPathVariables () { @@ -137,14 +137,14 @@ public EChange removeAll (@Nullable final Iterable aVars) @Nonnull @ReturnsMutableCopy - public ICommonsMap getAll () + public ICommonsOrderedMap getAll () { return m_aMap.getClone (); } @Nonnull @ReturnsMutableCopy - public ICommonsSet getAllNames () + public ICommonsOrderedSet getAllNames () { return m_aMap.copyOfKeySet (); } diff --git a/ph-schematron-pure/src/test/java/com/helger/schematron/pure/supplementary/Issue177Test.java b/ph-schematron-pure/src/test/java/com/helger/schematron/pure/supplementary/Issue177Test.java index 07da7fe38..da3719304 100644 --- a/ph-schematron-pure/src/test/java/com/helger/schematron/pure/supplementary/Issue177Test.java +++ b/ph-schematron-pure/src/test/java/com/helger/schematron/pure/supplementary/Issue177Test.java @@ -34,6 +34,11 @@ import com.helger.schematron.svrl.SVRLMarshaller; import com.helger.schematron.svrl.jaxb.SchematronOutputType; +/** + * Test for GitHub issue 177 + * + * @author Bertrand Lorentz + */ public final class Issue177Test { private static final Logger LOGGER = LoggerFactory.getLogger (Issue177Test.class); diff --git a/ph-schematron-pure/src/test/resources/external/issues/github177/schematron.sch b/ph-schematron-pure/src/test/resources/external/issues/github177/schematron.sch index 4d5403058..562085695 100644 --- a/ph-schematron-pure/src/test/resources/external/issues/github177/schematron.sch +++ b/ph-schematron-pure/src/test/resources/external/issues/github177/schematron.sch @@ -4,7 +4,24 @@ - error message + error message 1 + + + + + + + + error message 2 + + + + + + + + + error message 3