switch to new profiles (the old ones did not work)

This commit is contained in:
Jochen Stärk
2020-09-24 21:59:03 +02:00
parent 5144758c2f
commit d1b16f6b4d
22 changed files with 192 additions and 122 deletions

View File

@@ -56,7 +56,7 @@ public class BackwardCompatibilityTest extends TestCase implements IExportableTr
try (InputStream SOURCE_PDF = this.getClass()
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20190610_507blanko.pdf");
IZUGFeRDExporter ze = new ZUGFeRDExporterFromA1().setZUGFeRDVersion(1).setProfile(Profiles.EN16931).load(SOURCE_PDF)) {
IZUGFeRDExporter ze = new ZUGFeRDExporterFromA1().setZUGFeRDVersion(1).setProfile("EN16931").load(SOURCE_PDF)) {
ze.setTransaction(this);
ze.disableAutoClose(true);
@@ -96,7 +96,7 @@ public class BackwardCompatibilityTest extends TestCase implements IExportableTr
try (InputStream SOURCE_PDF = this.getClass()
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20190610_507blanko.pdf");
IZUGFeRDExporter ze = new ZUGFeRDExporterFromA1().setZUGFeRDVersion(2).setProfile(Profiles.EN16931).load(SOURCE_PDF)) {
IZUGFeRDExporter ze = new ZUGFeRDExporterFromA1().setZUGFeRDVersion(2).setProfile("EN16931").load(SOURCE_PDF)) {
ze.setTransaction(this);
ze.disableAutoClose(true);
@@ -134,7 +134,7 @@ public class BackwardCompatibilityTest extends TestCase implements IExportableTr
try (InputStream SOURCE_PDF = this.getClass()
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20190610_507blanko.pdf");
IZUGFeRDExporter ze = new ZUGFeRDExporterFromA1().setZUGFeRDVersion(2).setProfile(Profiles.EN16931).load(SOURCE_PDF)) {
IZUGFeRDExporter ze = new ZUGFeRDExporterFromA1().setZUGFeRDVersion(2).setProfile("EN16931").load(SOURCE_PDF)) {
ze.setTransaction(this);
ze.disableAutoClose(true);

View File

@@ -43,6 +43,7 @@ public class IExportableTransactionImpl implements IExportableTransaction {
private String currency;
private String paymentTermDescription;
private String referenceNumber;
private Profile profile;
@Override
public String getNumber() {
@@ -149,7 +150,6 @@ public class IExportableTransactionImpl implements IExportableTransaction {
return referenceNumber;
}
public IExportableTransactionImpl setNumber(String number) {
this.number = number;
return this;

View File

@@ -31,13 +31,13 @@ import java.nio.charset.StandardCharsets;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class MustangReaderWriterCustomXMLTest extends TestCase {
/**
* Create the test case
*
* @param testName name of the test case
*/
public MustangReaderWriterCustomXMLTest(String testName) {
super(testName);
}
@@ -58,7 +58,7 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
try {
InputStream SOURCE_PDF = this.getClass().getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505blanko.pdf");
IZUGFeRDExporter zea1 = new ZUGFeRDExporterFromA1().setProducer("My Application").setCreator("Test").setProfile(Profiles.EN16931)
IZUGFeRDExporter zea1 = new ZUGFeRDExporterFromA1().setProducer("My Application").setCreator("Test").setProfile(Profiles.getByName("EN16931"))
.load(SOURCE_PDF);
final byte[] UTF8ByteOrderMark = new byte[]{(byte) 0xef, (byte) 0xbb, (byte) 0xbf};
@@ -301,7 +301,7 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
.setProducer("My Application")
.setCreator("Test")
.setZUGFeRDVersion(1)
.setProfile(Profiles.BASIC)
.setProfile(Profiles.getByName("BASIC",1))
.load(SOURCE_PDF);
/* we have much more information than just in the basic profile (comfort or extended) but it's perfectly valid to provide more information, just not less. */
String ownZUGFeRDXML = "<rsm:CrossIndustryDocument xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:ram=\"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:12\" xmlns:udt=\"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15\" xmlns:rsm=\"urn:ferd:CrossIndustryDocument:invoice:1p0\">\n"

View File

@@ -150,6 +150,7 @@ public class MustangReaderWriterEdgeTest extends MustangReaderTestCase {
return "AB321";
}
/**
* Create the test case
*

View File

@@ -358,7 +358,7 @@ public class MustangReaderWriterTest extends MustangReaderTestCase {
try (InputStream SOURCE_PDF = this.getClass()
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20190610_507blanko.pdf");
IZUGFeRDExporter ze = new ZUGFeRDExporterFromA1().setZUGFeRDVersion(2).setProfile(Profiles.EN16931).load(SOURCE_PDF)) {
IZUGFeRDExporter ze = new ZUGFeRDExporterFromA1().setZUGFeRDVersion(2).setProfile(Profiles.getByName("EN16931")).load(SOURCE_PDF)) {
ze.setTransaction(this);
ze.disableAutoClose(true);
@@ -402,7 +402,7 @@ public class MustangReaderWriterTest extends MustangReaderTestCase {
try (InputStream SOURCE_PDF = this.getClass()
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20190610_507blanko.pdf");
IZUGFeRDExporter ze = new ZUGFeRDExporterFromA1().setZUGFeRDVersion(1).setProfile(Profiles.COMFORT).load(SOURCE_PDF)) {
IZUGFeRDExporter ze = new ZUGFeRDExporterFromA1().setZUGFeRDVersion(1).setProfile(Profiles.getByName("COMFORT",1)).load(SOURCE_PDF)) {
ze.setTransaction(this);
ze.disableAutoClose(true);
@@ -430,7 +430,7 @@ public class MustangReaderWriterTest extends MustangReaderTestCase {
try (InputStream SOURCE_PDF = this.getClass()
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20171118_506blanko.pdf");
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1().setZUGFeRDVersion(2).setProfile(Profiles.EN16931).load(SOURCE_PDF)) {
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1().setZUGFeRDVersion(2).setProfile(Profiles.getByName("EN16931")).load(SOURCE_PDF)) {
ByteArrayOutputStream result = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int length;

View File

@@ -134,7 +134,7 @@ public class ZF2PushTest extends TestCase {
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505blanko.pdf");
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1().setProducer("My Application")
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).setProfile("EXTENDED").ignorePDFAErrors()
.load(SOURCE_PDF)) {
// ze.setTransaction(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname,"teststr", "55232","teststadt","DE")).setOwnTaxID("4711").setOwnVATID("DE0815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number)
// .addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)).addAllowance(new Allowance().setPercent(new BigDecimal(50)))));

View File

@@ -168,7 +168,7 @@ public class ZF2Test extends MustangReaderTestCase {
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505PDFA3.pdf");
ZUGFeRDExporterFromA3 ze = new ZUGFeRDExporterFromA3().setProducer("My Application")
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).setProfile(Profiles.EN16931)
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).setProfile("EN16931")
.load(SOURCE_PDF)) {
ze.setTransaction(this);