[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-libeufin] 10/25: fix resource loading
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-libeufin] 10/25: fix resource loading |
Date: |
Fri, 20 Sep 2019 19:32:48 +0200 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository libeufin.
commit bd76da3d301dbb104d6912581f147f35170264b9
Author: Marcello Stanisci <address@hidden>
AuthorDate: Sun Sep 15 19:26:08 2019 +0200
fix resource loading
---
src/main/java/tech/libeufin/XMLManagement.java | 20 ++--
src/main/resources/ebics_hev.xsd | 135 +++++++++++++++++++++++++
src/test/java/XMLManagementTest.java | 6 +-
3 files changed, 145 insertions(+), 16 deletions(-)
diff --git a/src/main/java/tech/libeufin/XMLManagement.java
b/src/main/java/tech/libeufin/XMLManagement.java
index 0d883d2..640d165 100644
--- a/src/main/java/tech/libeufin/XMLManagement.java
+++ b/src/main/java/tech/libeufin/XMLManagement.java
@@ -25,25 +25,19 @@ public class XMLManagement {
* Load all the XSDs from disk.
*/
public XMLManagement(){
- ClassLoader classLoader = ClassLoader.getSystemClassLoader();
+ ClassLoader classLoader = this.getClass().getClassLoader();
File ebics_hev_file = new
File(classLoader.getResource("ebics_hev.xsd").getFile());
- // other schemas in other similar lines ..
-
- /* Ideally, there will be a method that return some "iterable"
- * object for all the files in the resources directory. */
-
- Source schemas[] = {
- new StreamSource(ebics_hev_file)
+ Source schemas[] = {new StreamSource(ebics_hev_file)
// other StreamSources for other schemas here ..
};
- SchemaFactory sf =
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
- try{
- this.bundle = sf.newSchema(schemas;
+ try {
+ SchemaFactory sf =
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ this.bundle = sf.newSchema(schemas);
this.validator = this.bundle.newValidator();
- } catch (IOException e){
- System.out.println("Could not import all XSDs from disk" + "(" + e
+ ")");
+ } catch (SAXException e) {
+ System.out.println("SAX exception shall never happen here " + "("
+ e + ")");
}
}
diff --git a/src/main/resources/ebics_hev.xsd b/src/main/resources/ebics_hev.xsd
new file mode 100755
index 0000000..8ee8458
--- /dev/null
+++ b/src/main/resources/ebics_hev.xsd
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ebics="http://www.ebics.org/H000"
targetNamespace="http://www.ebics.org/H000" elementFormDefault="qualified"
attributeFormDefault="unqualified" version="1.0">
+ <xs:annotation>
+ <xs:documentation xml:lang="de">ebics_hev.xsd ist das
EBICS-Protokollschema entweder für Anfragen oder Rückmeldungen der Bank zu
unterstützten EBICS-Versionen.</xs:documentation>
+ <xs:documentation xml:lang="en">ebics_hev.xsd is the
appropriate EBICS protocol schema either for requests or responses according
the EBICS versions supported by a bank.</xs:documentation>
+ </xs:annotation>
+ <xs:simpleType name="HostIDType">
+ <xs:annotation>
+ <xs:documentation xml:lang="de">Datentyp für die
Host-ID.</xs:documentation>
+ <xs:documentation xml:lang="en">Dataype for
Host-ID.</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:maxLength value="35"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="OrderTBaseType">
+ <xs:annotation>
+ <xs:documentation xml:lang="de">Datentyp für allgemeine
Auftragsarten (Grundtyp).</xs:documentation>
+ <xs:documentation xml:lang="en">Datatype for general
order types (basic type).</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:length value="3"/>
+ <xs:pattern value="HEV"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="ReturnCodeType">
+ <xs:annotation>
+ <xs:documentation xml:lang="de">Datentyp für
Antwortcodes.</xs:documentation>
+ <xs:documentation xml:lang="en">Datatype for the return
code</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:length value="6"/>
+ <xs:pattern value="\d{6}"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="ReportTextType">
+ <xs:annotation>
+ <xs:documentation xml:lang="de">Datentyp für den
Erklärungstext zum Antwortcode.</xs:documentation>
+ <xs:documentation xml:lang="en">Datatype for report
text with respect to the return code</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:normalizedString">
+ <xs:maxLength value="256"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="VersionNumberType">
+ <xs:annotation>
+ <xs:documentation xml:lang="de">Datentyp für eine
Versionsnummer</xs:documentation>
+ <xs:documentation xml:lang="en">Datatype for a release
number </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:length value="5"/>
+ <xs:pattern value="[0-9]{2}[.][0-9]{2}"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="ProtocolVersionType">
+ <xs:annotation>
+ <xs:documentation xml:lang="de">Datentyp für
Versionsnummer des EBICS-schemas</xs:documentation>
+ <xs:documentation xml:lang="en">Datatype for
release-number of the EBICS scheme</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:length value="4"/>
+ <xs:pattern value="H\d{3}"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:complexType name="SystemReturnCodeType">
+ <xs:annotation>
+ <xs:documentation xml:lang="de">Datentyp für technische
Fehler.</xs:documentation>
+ <xs:documentation xml:lang="en">Datatype for technical
error</xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element name="ReturnCode"
type="ebics:ReturnCodeType">
+ <xs:annotation>
+ <xs:documentation
xml:lang="de">Rückmeldung des Ausführungsstatus mit einer eindeutigen
Fehlernummer.</xs:documentation>
+ <xs:documentation
xml:lang="en">Confirmation of the carried out status with a unique error
code.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="ReportText"
type="ebics:ReportTextType">
+ <xs:annotation>
+ <xs:documentation
xml:lang="de">Klartext der Rückmeldung des Ausführungsstatus.</xs:documentation>
+ <xs:documentation xml:lang="en">Clear
text of the response (carried out status).</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="HEVRequestDataType">
+ <xs:annotation>
+ <xs:documentation xml:lang="de">Datentyp für die
Request-Daten</xs:documentation>
+ <xs:documentation xml:lang="en">Data type for Request
data</xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element name="HostID" type="ebics:HostIDType"/>
+ <xs:any namespace="##other" processContents="lax"
minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="HEVResponseDataType">
+ <xs:annotation>
+ <xs:documentation xml:lang="en">Datentyp für die
Response-Daten</xs:documentation>
+ <xs:documentation xml:lang="en">Data type for Request
data</xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element name="SystemReturnCode"
type="ebics:SystemReturnCodeType"/>
+ <xs:element name="VersionNumber" minOccurs="0"
maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation xml:lang="de">Von der
Bank unterstützte EBICS-Versionen, z.B. 2.4</xs:documentation>
+ <xs:documentation
xml:lang="en">EBICS-releases supported by the bank, e.g. 2.4</xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension
base="ebics:VersionNumberType">
+ <xs:attribute
name="ProtocolVersion" type="ebics:ProtocolVersionType" use="required">
+ <xs:annotation>
+
<xs:documentation xml:lang="de">der EBICS-Version eindeutig zugeordnete
Schema-Version, z.B. H003</xs:documentation>
+
<xs:documentation xml:lang="en">EBICS-scheme-version, e.g. H003, well-defined
for EBICS-release-Version</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:any namespace="##other" processContents="lax"
minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:element name="ebicsHEVRequest" type="ebics:HEVRequestDataType">
+ <xs:annotation>
+ <xs:documentation
xml:lang="de">Requestdaten</xs:documentation>
+ <xs:documentation xml:lang="en">request
data</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="ebicsHEVResponse" type="ebics:HEVResponseDataType">
+ <xs:annotation>
+ <xs:documentation
xml:lang="de">Responsedaten</xs:documentation>
+ <xs:documentation xml:lang="en">response
data</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+</xs:schema>
diff --git a/src/test/java/XMLManagementTest.java
b/src/test/java/XMLManagementTest.java
index dbecf8e..50daed3 100644
--- a/src/test/java/XMLManagementTest.java
+++ b/src/test/java/XMLManagementTest.java
@@ -1,12 +1,12 @@
import org.junit.Test;
+import tech.libeufin.XMLManagement;
+
import static org.junit.Assert.*;
public class XMLManagementTest {
@Test
public void XMLManagementTest(){
- XMLManagement xmlm = new XMLManagement();
- xmlm.printtheline();
- assertEquals(4, 4);
+ XMLManagement xm = new XMLManagement();
}
}
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [GNUnet-SVN] [taler-libeufin] branch master created (now 62598ec), gnunet, 2019/09/20
- [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 <=
- [GNUnet-SVN] [taler-libeufin] 03/25: AGPL license, gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 12/25: Local test of XML validation., gnunet, 2019/09/20
- [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