[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-libeufin] 12/25: Local test of XML validation.
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-libeufin] 12/25: Local test of XML validation. |
Date: |
Fri, 20 Sep 2019 19:32:50 +0200 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository libeufin.
commit c4d1dd6f3296f6e5520113d6d5e88c7e74c54551
Author: Marcello Stanisci <address@hidden>
AuthorDate: Sun Sep 15 20:05:40 2019 +0200
Local test of XML validation.
---
src/main/java/tech/libeufin/XMLManagement.java | 6 ++++++
src/test/java/XMLManagementTest.java | 7 ++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/main/java/tech/libeufin/XMLManagement.java
b/src/main/java/tech/libeufin/XMLManagement.java
index 640d165..7e1bed9 100644
--- a/src/main/java/tech/libeufin/XMLManagement.java
+++ b/src/main/java/tech/libeufin/XMLManagement.java
@@ -41,10 +41,16 @@ public class XMLManagement {
}
}
+ /**
+ *
+ * @param xmlDoc the XML document to validate
+ * @return true when validation passes, false otherwise
+ */
public boolean validate(Source xmlDoc){
try{
this.validator.validate(xmlDoc);
} catch (SAXException e) {
+ System.out.println("Validation did not pass " + e);
return false;
} catch (IOException e) {
System.out.println("Could not pass XML to validator.");
diff --git a/src/test/java/XMLManagementTest.java
b/src/test/java/XMLManagementTest.java
index 50daed3..c87fb9f 100644
--- a/src/test/java/XMLManagementTest.java
+++ b/src/test/java/XMLManagementTest.java
@@ -1,6 +1,8 @@
import org.junit.Test;
import tech.libeufin.XMLManagement;
-
+import java.io.File;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
import static org.junit.Assert.*;
public class XMLManagementTest {
@@ -8,5 +10,8 @@ public class XMLManagementTest {
@Test
public void XMLManagementTest(){
XMLManagement xm = new XMLManagement();
+ ClassLoader classLoader = this.getClass().getClassLoader();
+ Source ebics_hev_sample = new
StreamSource(classLoader.getResourceAsStream("ebics_hev.xsd"));
+ assertTrue(xm.validate(ebics_hev_sample));
}
}
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [GNUnet-SVN] [taler-libeufin] 04/25: Instructions for running under MS Windows., (continued)
- [GNUnet-SVN] [taler-libeufin] 04/25: Instructions for running under MS Windows., gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 08/25: Drafting XSD import from disk, and XML validation., gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 02/25: instructions for running the sandbox, gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 09/25: load xsd from resources, gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 07/25: Test stub., gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 06/25: readme, gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 05/25: Copyright header., gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 01/25: Import initial project structure., gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 10/25: fix resource loading, gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 03/25: AGPL license, gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 12/25: Local test of XML validation.,
gnunet <=
- [GNUnet-SVN] [taler-libeufin] 11/25: import sample hev, gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 14/25: Test with XML imported from string., gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 13/25: fix test, gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 15/25: Abstracting string conversion to "stream"., gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 16/25: Introducing the converters:, gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 20/25: Server responds with ebicsHEVResponse., gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 18/25: method to get (XML) strings from JAXB objects., gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 23/25: Translating getLogger() into Kotlin., gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 19/25: Importing JAXB scaffolding to reflect ebics "hev" types., gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 21/25: Fix resource loading from JAR., gnunet, 2019/09/20