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

@@ -1,6 +1,7 @@
- allow Bank credentials without BIC
- allow minimum profile without delivery date
- allow prepaid amount in invoice class
- toolchain.xml now only required on `mvn release:release` not already on `mvn package`
2.6.0 "Joyeux Noël"
=======

View File

@@ -100,26 +100,6 @@
</archive>
</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-compiler-plugin</artifactId>
@@ -199,6 +179,43 @@
</plugin>
</plugins>
</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, triggered automatically on mvn release:release (hopefully) and requires an according
~/.m2/toolchains.xml file, @see doc/development_documentation.md -->
<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>
<licenses>
<license>
<name>Apache License, Version 2.0</name>

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);
}
}

View File

@@ -165,26 +165,6 @@
</archive>
</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-compiler-plugin</artifactId>
@@ -299,7 +279,43 @@
</developer>
</developers>
<profiles>
<profile>
<profile> <!-- enforce building binaries with Java 1.8 for Maven Central, otherwise using them e.g. as jar will
throw a version exception, triggered automatically on mvn release:release (hopefully) and requires an according
~/.m2/toolchains.xml file, @see doc/development_documentation.md -->
<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>
<profile> <!-- build the intermediate XSLT files from schematron takes 30min+ and is only required if there actually is a change in the schematron,
-> invoke manually with commandline -P generateXSLTFromSchematron on demand -->
<id>generateXSLTFromSchematron</id>
<activation>
<activeByDefault>false</activeByDefault>