additional minimum test, require toolchains.xml only for release, not for any build

This commit is contained in:
jstaerk
2023-01-12 09:08:31 +01:00
parent 6259ee6f2a
commit 1bd17ff8c5
5 changed files with 165 additions and 62 deletions

View File

@@ -155,26 +155,6 @@
<target>8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<goals>
<goal>toolchain</goal>
</goals>
</execution>
</executions>
<configuration>
<toolchains>
<jdk>
<version>8</version>
<vendor>adopt</vendor>
</jdk>
</toolchains>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
@@ -241,6 +221,41 @@
</build>
<profiles>
<profile> <!-- enforce building binaries with Java 1.8 for Maven Central, otherwise using them e.g. as jar will throw a version exception-->
<id>release-sign-artifacts</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<goals>
<goal>toolchain</goal>
</goals>
</execution>
</executions>
<configuration>
<toolchains>
<jdk>
<version>8</version>
<vendor>adopt</vendor>
</jdk>
</toolchains>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<mailingLists>
<mailingList>
<name>User List</name>

View File

@@ -41,7 +41,7 @@ public class ProfilesMinimumBasicWLTest extends TestCase {
final String TARGET_PDF_FX_MINIMUM = "./target/testout-Minimum.pdf";
public void testMinimumExport() {
public void testMinimumCreditNote() {
String ownNumber = "NUMFACTURE";
String ownBIC = "COBADEFFXXX";
String ownIBAN = "DE88200800000970375700";
@@ -95,4 +95,58 @@ public class ProfilesMinimumBasicWLTest extends TestCase {
}
public void testMinimumInvoice() {
String ownNumber = "NUMFACTURE";
String ownBIC = "COBADEFFXXX";
String ownIBAN = "DE88200800000970375700";
String ownOrgName = "ME";
// the writing part
try (InputStream SOURCE_PDF = this.getClass()
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20190610_507blanko.pdf");
IZUGFeRDExporter ze = new ZUGFeRDExporterFromA1().setZUGFeRDVersion(2).setProfile("Minimum").load(SOURCE_PDF)) {
/***
* this is a classical example of a french invoice (very low profile, siret number) and an attempt to answer stackoverflow (!)
* https://stackoverflow.com/questions/72450066/creating-a-min-basic-and-basic-wl-factur-x-using-mustang
*/
TradeParty recipient = new TradeParty().setName("Client").setCountry("FR");
String siret="0815";
String sirenTypeCode="0002";
recipient.setLegalOrganisation(new LegalOrganisation(siret,sirenTypeCode));
Invoice i = new Invoice()
.setIssueDate(new Date())
.setDueDate(new Date())
.setSender(
new TradeParty().setName(ownOrgName).setCountry("FR")
.addBankDetails(new BankDetails(ownIBAN)))
.setRecipient(recipient)
.setNumber(ownNumber).setTotalPrepaidAmount(new BigDecimal("1"))
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), new BigDecimal(123), new BigDecimal(1)));
ze.setTransaction(i);
ze.export(TARGET_PDF_FX_MINIMUM);
// check for pdf-a schema extension
// assertFalse(pdfContent.indexOf("<zf:ConformanceLevel>EN 16931</zf:ConformanceLevel>") == -1);
// assertFalse(pdfContent.indexOf("<pdfaSchema:prefix>zf</pdfaSchema:prefix>") == -1);
// assertFalse(pdfContent.indexOf("urn:zugferd:pdfa:CrossIndustryDocument:invoice:2p0#") == -1);
} catch (IOException e) {
fail("IOException should not happen in testMinimumExport");
}
// now check the contents (like MustangReaderTest)
ZUGFeRDImporter zi = new ZUGFeRDImporter(TARGET_PDF_FX_MINIMUM);
// Reading ZUGFeRD
assertEquals("145.37",zi.getAmount());
// assertEquals(zi.getBIC(), ownBIC);
// assertEquals(zi.getIBAN(), ownIBAN);
assertEquals(ownOrgName, zi.getHolder());
// assertEquals(zi.getForeignReference(), ownNumber);
}
}