Skip to content

Commit

Permalink
Improved tests
Browse files Browse the repository at this point in the history
  • Loading branch information
phax committed Jul 13, 2024
1 parent c4c3fc7 commit 47c9e38
Showing 1 changed file with 52 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import com.helger.smpclient.IgnoredNaptrTest;
import com.helger.smpclient.exception.SMPClientBadResponseException;
import com.helger.smpclient.exception.SMPClientException;
import com.helger.smpclient.exception.SMPClientParticipantNotFoundException;
import com.helger.smpclient.peppol.marshal.SMPMarshallerServiceMetadataType;
import com.helger.smpclient.url.BDXLURLProvider;
import com.helger.smpclient.url.PeppolURLProvider;
Expand Down Expand Up @@ -110,6 +111,27 @@ public void testGetSMPHostURI_Peppol_WithBOM () throws SMPClientException, SMPDN
assertNotNull (aSMPClient.getServiceGroupOrNull (aPI));
}

@Test
public void testGetSMPHostURI_Peppol_NonExisting () throws SMPClientException, SMPDNSResolutionException
{
final IParticipantIdentifier aPI = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme ("9915:denbledsinngibtssichernicht");

// Peppol URL provider
final SMPClientReadOnly aSMPClient = new SMPClientReadOnly (PeppolURLProvider.INSTANCE, aPI, ESML.DIGIT_TEST);
assertEquals ("http://B-898acc4769bdc1fb7a6670103686edd6.iso6523-actorid-upis.acc.edelivery.tech.ec.europa.eu/",
aSMPClient.getSMPHostURI ());

try
{
aSMPClient.getServiceGroup (aPI);
fail ();
}
catch (final SMPClientParticipantNotFoundException ex)
{
// No such participant
}
}

@Test
public void testInvalidTrustStore () throws SMPDNSResolutionException,
SMPClientException,
Expand Down Expand Up @@ -141,23 +163,6 @@ public void testInvalidTrustStore () throws SMPDNSResolutionException,
}
}

@Test
@Ignore ("Failed with timeout on 2021-05-02")
public void testIssue2303 () throws Exception
{
final IParticipantIdentifier aPI = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme ("9925:be0887290276");

// PEPPOL URL provider
final SMPClientReadOnly aSMPClient = new SMPClientReadOnly (PeppolURLProvider.INSTANCE, aPI, ESML.DIGIT_PRODUCTION);
assertEquals ("http://B-c9f280672264cdb82eac528c265ed029.iso6523-actorid-upis.edelivery.tech.ec.europa.eu/",
aSMPClient.getSMPHostURI ());

aSMPClient.setXMLSchemaValidation (true);
final SignedServiceMetadataType aSM = aSMPClient.getServiceMetadataOrNull (aPI,
EPredefinedDocumentTypeIdentifier.INVOICE_EN16931_PEPPOL_V30);
assertNotNull (aSM);
}

@Test
public void testActivationDate ()
{
Expand Down Expand Up @@ -379,6 +384,26 @@ public void testReceiverHasRevokedAPCert () throws Exception
assertSame (EPeppolCertificateCheckResult.REVOKED, eCertCheckResult);
}

@Test
public void testPeppolReportingProductionEndpoints () throws SMPClientException, SMPDNSResolutionException
{
final IParticipantIdentifier aReceiverID = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme ("9925:be0848934496");
final SMPClientReadOnly aSMPClient = new SMPClientReadOnly (PeppolURLProvider.INSTANCE,
aReceiverID,
ESML.DIGIT_PRODUCTION);
aSMPClient.setSecureValidation (false);

// EUSR
SignedServiceMetadataType aSM = aSMPClient.getServiceMetadataOrNull (aReceiverID,
EPredefinedDocumentTypeIdentifier.ENDUSERSTATISTICSREPORT_FDC_PEPPOL_EU_EDEC_TRNS_END_USER_STATISTICS_REPORT_1_1);
assertNotNull (aSM);

// TSR
aSM = aSMPClient.getServiceMetadataOrNull (aReceiverID,
EPredefinedDocumentTypeIdentifier.TRANSACTIONSTATISTICSREPORT_FDC_PEPPOL_EU_EDEC_TRNS_TRANSACTION_STATISTICS_REPORTING_1_0);
assertNotNull (aSM);
}

@Test
public void testIssue43 () throws Exception
{
Expand All @@ -402,22 +427,19 @@ public void testIssue43 () throws Exception
}

@Test
public void testPeppolReportingEndpoints () throws SMPClientException, SMPDNSResolutionException
// @Ignore ("Failed with timeout on 2021-05-02")
public void testIssue2303 () throws Exception
{
final IParticipantIdentifier aReceiverID = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme ("9925:be0848934496");
final SMPClientReadOnly aSMPClient = new SMPClientReadOnly (PeppolURLProvider.INSTANCE,
aReceiverID,
ESML.DIGIT_PRODUCTION);
aSMPClient.setSecureValidation (false);
final IParticipantIdentifier aPI = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme ("9925:be0887290276");

// EUSR
SignedServiceMetadataType aSM = aSMPClient.getServiceMetadataOrNull (aReceiverID,
EPredefinedDocumentTypeIdentifier.ENDUSERSTATISTICSREPORT_FDC_PEPPOL_EU_EDEC_TRNS_END_USER_STATISTICS_REPORT_1_1);
assertNotNull (aSM);
// PEPPOL URL provider
final SMPClientReadOnly aSMPClient = new SMPClientReadOnly (PeppolURLProvider.INSTANCE, aPI, ESML.DIGIT_PRODUCTION);
assertEquals ("http://B-c9f280672264cdb82eac528c265ed029.iso6523-actorid-upis.edelivery.tech.ec.europa.eu/",
aSMPClient.getSMPHostURI ());

// TSR
aSM = aSMPClient.getServiceMetadataOrNull (aReceiverID,
EPredefinedDocumentTypeIdentifier.TRANSACTIONSTATISTICSREPORT_FDC_PEPPOL_EU_EDEC_TRNS_TRANSACTION_STATISTICS_REPORTING_1_0);
aSMPClient.setXMLSchemaValidation (true);
final SignedServiceMetadataType aSM = aSMPClient.getServiceMetadataOrNull (aPI,
EPredefinedDocumentTypeIdentifier.INVOICE_EN16931_PEPPOL_V30);
assertNotNull (aSM);
}
}

0 comments on commit 47c9e38

Please sign in to comment.