ZF 2.1.1 schema files
This commit is contained in:
84
library/src/test/java/org/mustangproject/ZUGFeRD/XRTest.java
Normal file
84
library/src/test/java/org/mustangproject/ZUGFeRD/XRTest.java
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
|
||||||
|
/** **********************************************************************
|
||||||
|
*
|
||||||
|
* Copyright 2019 Jochen Staerk
|
||||||
|
*
|
||||||
|
* Use is subject to license terms.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy
|
||||||
|
* of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
*
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
*********************************************************************** */
|
||||||
|
package org.mustangproject.ZUGFeRD;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import library.src.main.java.org.mustangproject.Contact;
|
||||||
|
import library.src.main.java.org.mustangproject.Invoice;
|
||||||
|
import library.src.main.java.org.mustangproject.Item;
|
||||||
|
import library.src.main.java.org.mustangproject.Product;
|
||||||
|
import org.junit.FixMethodOrder;
|
||||||
|
import org.junit.runners.MethodSorters;
|
||||||
|
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
import junit.framework.Test;
|
||||||
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||||
|
public class ZF2PushTest extends TestCase {
|
||||||
|
final String TARGET_PDF = "./target/testout-ZF2Push.pdf";
|
||||||
|
|
||||||
|
public void testPushExport() {
|
||||||
|
|
||||||
|
// the writing part
|
||||||
|
|
||||||
|
String orgname="Test company";
|
||||||
|
String number="123";
|
||||||
|
String amountStr="1.00";
|
||||||
|
BigDecimal amount=new BigDecimal(amountStr);
|
||||||
|
try (InputStream SOURCE_PDF = this.getClass()
|
||||||
|
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505PDFA3.pdf");
|
||||||
|
|
||||||
|
ZUGFeRDExporter ze = new ZUGFeRDExporterFromA3Factory().setProducer("My Application")
|
||||||
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
|
||||||
|
.load(SOURCE_PDF)) {
|
||||||
|
|
||||||
|
ze.PDFattachZugferdFile(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setOwnOrganisationName(orgname).setOwnStreet("teststr").setOwnZIP("55232").setOwnLocation("teststadt").setOwnCountry("DE").setOwnTaxID("4711").setOwnVATID("0815").setRecipient(new Contact("Franz Müller", "0177123456", "fmueller@test.com", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number).addItem(new Item(new Product("Testprodukt","","C62",new BigDecimal(0)),amount,new BigDecimal(1.0))));
|
||||||
|
String theXML = new String(ze.getProvider().getXML());
|
||||||
|
assertTrue(theXML.contains("<rsm:CrossIndustryInvoice"));
|
||||||
|
ze.export(TARGET_PDF);
|
||||||
|
} catch (IOException e) {
|
||||||
|
fail("IOException should not be raised in testEdgeExport");
|
||||||
|
}
|
||||||
|
|
||||||
|
// now check the contents (like MustangReaderTest)
|
||||||
|
ZUGFeRDImporter zi = new ZUGFeRDImporter(TARGET_PDF);
|
||||||
|
|
||||||
|
assertFalse(zi.getUTF8().contains("EUR"));
|
||||||
|
|
||||||
|
// Reading ZUGFeRD
|
||||||
|
assertEquals(amountStr, zi.getAmount());
|
||||||
|
assertEquals(zi.getHolder(), orgname);
|
||||||
|
assertEquals(zi.getForeignReference(), number);
|
||||||
|
try {
|
||||||
|
assertEquals(zi.getVersion(), 2);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -92,13 +92,6 @@
|
|||||||
<version>2.6.3</version>
|
<version>2.6.3</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<!-- for commandline options -->
|
|
||||||
<groupId>com.sanityinc</groupId>
|
|
||||||
<artifactId>jargs</artifactId>
|
|
||||||
<version>2.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.riversun</groupId>
|
<groupId>org.riversun</groupId>
|
||||||
<artifactId>bigdoc</artifactId>
|
<artifactId>bigdoc</artifactId>
|
||||||
|
|||||||
@@ -9107,7 +9107,7 @@
|
|||||||
</pattern>
|
</pattern>
|
||||||
<pattern>
|
<pattern>
|
||||||
<rule context="/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedTradeProduct/ram:DesignatedProductClassification/ram:ClassCode">
|
<rule context="/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedTradeProduct/ram:DesignatedProductClassification/ram:ClassCode">
|
||||||
<let name="codeValue5" value="."/>
|
<let name="codeValue5" value="@listID"/>
|
||||||
<assert test="document('FACTUR-X_EN16931_codedb.xml')//cl[@id=5]/enumeration[@value=$codeValue5]">
|
<assert test="document('FACTUR-X_EN16931_codedb.xml')//cl[@id=5]/enumeration[@value=$codeValue5]">
|
||||||
Value of 'ram:ClassCode' is not allowed.</assert>
|
Value of 'ram:ClassCode' is not allowed.</assert>
|
||||||
</rule>
|
</rule>
|
||||||
|
|||||||
@@ -19688,7 +19688,7 @@
|
|||||||
</pattern>
|
</pattern>
|
||||||
<pattern>
|
<pattern>
|
||||||
<rule context="/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedTradeProduct/ram:DesignatedProductClassification/ram:ClassCode">
|
<rule context="/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedTradeProduct/ram:DesignatedProductClassification/ram:ClassCode">
|
||||||
<let name="codeValue7" value="."/>
|
<let name="codeValue7" value="@listID"/>
|
||||||
<assert test="document('FACTUR-X_EXTENDED_codedb.xml')//cl[@id=7]/enumeration[@value=$codeValue7]">
|
<assert test="document('FACTUR-X_EXTENDED_codedb.xml')//cl[@id=7]/enumeration[@value=$codeValue7]">
|
||||||
Value of 'ram:ClassCode' is not allowed.</assert>
|
Value of 'ram:ClassCode' is not allowed.</assert>
|
||||||
<assert test="@listID">
|
<assert test="@listID">
|
||||||
|
|||||||
Reference in New Issue
Block a user