reactivated a test

This commit is contained in:
Jochen Stärk
2019-04-21 18:09:15 +02:00
parent 9a3a32a91c
commit 015a530222
3 changed files with 17 additions and 12 deletions

View File

@@ -52,11 +52,13 @@ public class XMPSchemaPDFAExtensions extends PDFAExtensionSchema {
public final String prefix_pdfaProperty = "pdfaProperty";
public String namespace = null;
public String prefix = null;
protected ZUGFeRDExporter exporter;
protected void setZUGFeRDVersion(int ver) {
namespace = ZUGFeRDExporter.getNamespaceForVersion(ver);
prefix = ZUGFeRDExporter.getPrefixForVersion(ver);
namespace = exporter.getNamespaceForVersion(ver);
prefix = exporter.getPrefixForVersion(ver);
}
@@ -87,14 +89,16 @@ public class XMPSchemaPDFAExtensions extends PDFAExtensionSchema {
return li;
}
public XMPSchemaPDFAExtensions(XMPMetadata metadata, int ZFVersion) {
public XMPSchemaPDFAExtensions(ZUGFeRDExporter ze, XMPMetadata metadata, int ZFVersion) {
super(metadata);
exporter=ze;
setZUGFeRDVersion(ZFVersion);
attachExtensions(metadata, true);
}
public XMPSchemaPDFAExtensions(XMPMetadata metadata, int ZFVersion, boolean withZF) {
public XMPSchemaPDFAExtensions(ZUGFeRDExporter ze, XMPMetadata metadata, int ZFVersion, boolean withZF) {
super(metadata);
exporter=ze;
setZUGFeRDVersion(ZFVersion);
attachExtensions(metadata, withZF);
}

View File

@@ -55,7 +55,7 @@ public class ZUGFeRDExporter implements Closeable {
public static final int DefaultZUGFeRDVersion = 1;
private static boolean isFacturX = false;
private boolean isFacturX = false;
/**
* To use the ZUGFeRD exporter, implement IZUGFeRDExportableTransaction in
@@ -133,7 +133,7 @@ public class ZUGFeRDExporter implements Closeable {
additionalXMLs.put(filename, xml);
}
public static String getNamespaceForVersion(int ver) {
public String getNamespaceForVersion(int ver) {
if (isFacturX) {
return "urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#";
} else if (ver == 1) {
@@ -146,7 +146,7 @@ public class ZUGFeRDExporter implements Closeable {
}
}
public static String getPrefixForVersion(int ver) {
public String getPrefixForVersion(int ver) {
if (isFacturX) {
return "fx";
} else {
@@ -154,7 +154,7 @@ public class ZUGFeRDExporter implements Closeable {
}
}
public static String getFilenameForVersion(int ver) {
public String getFilenameForVersion(int ver) {
if (isFacturX) {
return "factur-x.xml";
} else {
@@ -498,13 +498,13 @@ public class ZUGFeRDExporter implements Closeable {
if (attachZUGFeRDHeaders) {
XMPSchemaZugferd zf = new XMPSchemaZugferd(metadata, profile,
ZUGFeRDExporter.getNamespaceForVersion(ZFVersion), ZUGFeRDExporter.getPrefixForVersion(ZFVersion),
ZUGFeRDExporter.getFilenameForVersion(ZFVersion));
getNamespaceForVersion(ZFVersion), getPrefixForVersion(ZFVersion),
getFilenameForVersion(ZFVersion));
metadata.addSchema(zf);
}
XMPSchemaPDFAExtensions pdfaex = new XMPSchemaPDFAExtensions(metadata, ZFVersion, attachZUGFeRDHeaders);
XMPSchemaPDFAExtensions pdfaex = new XMPSchemaPDFAExtensions(this, metadata, ZFVersion, attachZUGFeRDHeaders);
pdfaex.setZUGFeRDVersion(ZFVersion);
metadata.addSchema(pdfaex);

View File

@@ -506,6 +506,7 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
assertEquals(zi.getForeignReference(), getNumber());
}
public void testFXExport() throws Exception {
final String TARGET_PDF = "./target/testout-MustangGnuaccountingBeispielRE-20171118_506fx.pdf";
@@ -514,7 +515,7 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
try (InputStream SOURCE_PDF = this.getClass()
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20171118_506blanko.pdf");
ZUGFeRDExporter ze = new ZUGFeRDExporterFromA1Factory().setZUGFeRDVersion(2).setZUGFeRDConformanceLevel(ZUGFeRDConformanceLevel.EN16931).load(SOURCE_PDF)) {
ZUGFeRDExporter ze = new ZUGFeRDExporterFromA1Factory().setZUGFeRDVersion(2).setZUGFeRDConformanceLevel(ZUGFeRDConformanceLevel.EN16931).load(SOURCE_PDF)) {
ze.setFacturX();
ze.PDFattachZugferdFile(this);
ze.disableAutoClose(true);