Skip to content

Commit

Permalink
fixed test-cases...
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-kumar committed Mar 2, 2024
1 parent 77440bb commit a6b99da
Show file tree
Hide file tree
Showing 12 changed files with 602 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class BusdoxLocatorTest {

@Test
public void simple() throws LookupException {
assertEquals(busdoxLocator.lookup("9908:991825827").getHost(),
"B-770c6f5843e9e302de47ae4026307076.iso6523-actorid-upis.edelivery.tech.ec.europa.eu");
assertEquals(busdoxLocator.lookup("0192:991825827").getHost(),
"B-9823154777831486f5f30f7f41385a2a.iso6523-actorid-upis.edelivery.tech.ec.europa.eu");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ public void documentIdentifiers() throws Exception {
@Test
public void rejectNoLongerActiveEndpoints() throws Exception {
ServiceMetadata result = reader.parseServiceMetadata(new FetcherResponse(
getClass().getResourceAsStream("/busdox-servicemetadata-9908-923829644.xml"))).getContent();
getClass().getResourceAsStream("/busdox-servicemetadata-0192-923829644-1.xml"))).getContent();

ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:www.cenbii.eu:profile:bii05:ver2.0");
ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:fdc:peppol.eu:2017:poacc:billing:01:1.0");
ServiceInformation<Endpoint> serviceInformation = result.getServiceInformation();

try {
serviceInformation.getEndpoint(processIdentifier, TransportProfile.PEPPOL_AS2_1_0);
serviceInformation.getEndpoint(processIdentifier, TransportProfile.PEPPOL_AS4_2_0);
fail("Expected exception.");
} catch (EndpointNotFoundException e) {
// Expected
Expand All @@ -60,10 +60,10 @@ public void rejectNoLongerActiveEndpoints() throws Exception {
@Test
public void processActiveEndpoints() throws Exception {
ServiceMetadata result = reader.parseServiceMetadata(new FetcherResponse(
getClass().getResourceAsStream("/busdox-servicemetadata-9908-923829644.xml"))).getContent();
getClass().getResourceAsStream("/busdox-servicemetadata-0192-923829644-2.xml"))).getContent();


ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:www.cenbii.eu:profile:bii05:ver2.0");
ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:fdc:peppol.eu:2017:poacc:billing:01:1.0");
ServiceInformation<Endpoint> serviceInformation = result.getServiceInformation();

assertNotNull(serviceInformation.getEndpoint(processIdentifier, TransportProfile.PEPPOL_AS4_2_0));
Expand All @@ -72,13 +72,13 @@ public void processActiveEndpoints() throws Exception {
@Test
public void rejectNotYetActiveEndpoints() throws Exception {
ServiceMetadata result = reader.parseServiceMetadata(new FetcherResponse(
getClass().getResourceAsStream("/busdox-servicemetadata-9908-923829644.xml"))).getContent();
getClass().getResourceAsStream("/busdox-servicemetadata-0192-923829644-3.xml"))).getContent();

ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:www.cenbii.eu:profile:bii05:ver2.0");
ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:fdc:peppol.eu:2017:poacc:billing:01:1.0");
ServiceInformation<Endpoint> serviceInformation = result.getServiceInformation();

try {
serviceInformation.getEndpoint(processIdentifier, TransportProfile.PEPPOL_AS2_2_0);
serviceInformation.getEndpoint(processIdentifier, TransportProfile.PEPPOL_AS4_2_0);
fail("Expected exception.");
} catch (EndpointNotFoundException e) {
// Expected
Expand All @@ -89,9 +89,9 @@ public void rejectNotYetActiveEndpoints() throws Exception {
public void missingBothServiceActivationDateAndServiceExpirationDate() throws Exception {
// Still valid : CANNOT reject messages if both ServiceActivationDate and ServiceExpirationDate values are missing
ServiceMetadata result = reader.parseServiceMetadata(new FetcherResponse(
getClass().getResourceAsStream("/busdox-servicemetadata-9908-12345678.xml"))).getContent();
getClass().getResourceAsStream("/busdox-servicemetadata-0192-12345678-3.xml"))).getContent();

ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:www.cenbii.eu:profile:bii05:ver2.0");
ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:fdc:peppol.eu:2017:poacc:billing:01:1.0");
ServiceInformation<Endpoint> serviceInformation = result.getServiceInformation();

assertNotNull(serviceInformation.getEndpoint(processIdentifier, TransportProfile.PEPPOL_AS4_2_0));
Expand All @@ -100,35 +100,35 @@ public void missingBothServiceActivationDateAndServiceExpirationDate() throws Ex
@Test
public void missingServiceActivationDateButServiceExpirationDateIsValid() throws Exception {
ServiceMetadata result = reader.parseServiceMetadata(new FetcherResponse(
getClass().getResourceAsStream("/busdox-servicemetadata-9908-12345678.xml"))).getContent();
getClass().getResourceAsStream("/busdox-servicemetadata-0192-12345678-1.xml"))).getContent();

ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:www.cenbii.eu:profile:bii05:ver2.0");
ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:fdc:peppol.eu:2017:poacc:billing:01:1.0");
ServiceInformation<Endpoint> serviceInformation = result.getServiceInformation();

assertNotNull(serviceInformation.getEndpoint(processIdentifier, TransportProfile.PEPPOL_AS2_1_0));
assertNotNull(serviceInformation.getEndpoint(processIdentifier, TransportProfile.PEPPOL_AS4_2_0));
}

@Test
public void missingServiceExpirationDateButServiceActivationDateIsValid() throws Exception {
ServiceMetadata result = reader.parseServiceMetadata(new FetcherResponse(
getClass().getResourceAsStream("/busdox-servicemetadata-9908-12345678.xml"))).getContent();
getClass().getResourceAsStream("/busdox-servicemetadata-0192-12345678-2.xml"))).getContent();

ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:www.cenbii.eu:profile:bii05:ver2.0");
ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:fdc:peppol.eu:2017:poacc:billing:01:1.0");
ServiceInformation<Endpoint> serviceInformation = result.getServiceInformation();

assertNotNull(serviceInformation.getEndpoint(processIdentifier, TransportProfile.PEPPOL_AS2_2_0));
assertNotNull(serviceInformation.getEndpoint(processIdentifier, TransportProfile.PEPPOL_AS4_2_0));
}

@Test
public void missingServiceActivationDateAndInvalidServiceExpirationDate() throws Exception {
ServiceMetadata result = reader.parseServiceMetadata(new FetcherResponse(
getClass().getResourceAsStream("/busdox-servicemetadata-9908-98765432.xml"))).getContent();
getClass().getResourceAsStream("/busdox-servicemetadata-0192-98765432-3.xml"))).getContent();

ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:www.cenbii.eu:profile:bii05:ver2.0");
ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:fdc:peppol.eu:2017:poacc:billing:01:1.0");
ServiceInformation<Endpoint> serviceInformation = result.getServiceInformation();

try {
serviceInformation.getEndpoint(processIdentifier, TransportProfile.PEPPOL_AS2_1_0);
serviceInformation.getEndpoint(processIdentifier, TransportProfile.PEPPOL_AS4_2_0);
fail("Expected exception.");
} catch (EndpointNotFoundException e) {
// Expected
Expand All @@ -138,13 +138,13 @@ public void missingServiceActivationDateAndInvalidServiceExpirationDate() throws
@Test
public void missingServiceExpirationDateAndInvalidServiceActivationDate() throws Exception {
ServiceMetadata result = reader.parseServiceMetadata(new FetcherResponse(
getClass().getResourceAsStream("/busdox-servicemetadata-9908-98765432.xml"))).getContent();
getClass().getResourceAsStream("/busdox-servicemetadata-0192-98765432-2.xml"))).getContent();

ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:www.cenbii.eu:profile:bii05:ver2.0");
ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:fdc:peppol.eu:2017:poacc:billing:01:1.0");
ServiceInformation<Endpoint> serviceInformation = result.getServiceInformation();

try {
serviceInformation.getEndpoint(processIdentifier, TransportProfile.PEPPOL_AS2_2_0);
serviceInformation.getEndpoint(processIdentifier, TransportProfile.PEPPOL_AS4_2_0);
fail("Expected exception.");
} catch (EndpointNotFoundException e) {
// Expected
Expand All @@ -156,7 +156,7 @@ public void inValidServiceExpirationDateAndServiceActivationDate() throws Except
ServiceMetadata result = reader.parseServiceMetadata(new FetcherResponse(
getClass().getResourceAsStream("/busdox-servicemetadata-9908-98765432.xml"))).getContent();

ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:www.cenbii.eu:profile:bii05:ver2.0");
ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:fdc:peppol.eu:2017:poacc:billing:01:1.0");
ServiceInformation<Endpoint> serviceInformation = result.getServiceInformation();

try {
Expand All @@ -170,9 +170,9 @@ public void inValidServiceExpirationDateAndServiceActivationDate() throws Except
@Test
public void serviceMetadata() throws Exception {
ServiceMetadata result = reader.parseServiceMetadata(new FetcherResponse(
getClass().getResourceAsStream("/busdox-servicemetadata-9908-923829644.xml"))).getContent();
getClass().getResourceAsStream("/busdox-servicemetadata-0192-923829644-2.xml"))).getContent();

ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:www.cenbii.eu:profile:bii05:ver2.0");
ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:fdc:peppol.eu:2017:poacc:billing:01:1.0");
ServiceInformation<Endpoint> serviceInformation = result.getServiceInformation();

try {
Expand All @@ -185,7 +185,7 @@ public void serviceMetadata() throws Exception {
assertEquals(
serviceInformation.getEndpoint(processIdentifier, TransportProfile.AS4)
.getCertificate().getSubjectDN().toString(),
"C=FI, O=Basware, OU=PEPPOL TEST AP, CN=POP000010"
"CN=POP000010, OU=PEPPOL TEST AP, O=Basware, C=FI"
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ public void bdxr201605DocumentIdentifers() throws Exception {
@Test
public void busdoxServiceMetadata() throws Exception {
ServiceMetadata result = reader.parseServiceMetadata(new FetcherResponse(
getClass().getResourceAsStream("/busdox-servicemetadata-9908-923829644.xml"))).getContent();
getClass().getResourceAsStream("/busdox-servicemetadata-0192-923829644-2.xml"))).getContent();

ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:www.cenbii.eu:profile:bii05:ver2.0");
ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:fdc:peppol.eu:2017:poacc:billing:01:1.0");
ServiceInformation<Endpoint> serviceInformation = result.getServiceInformation();

try {
Expand All @@ -77,7 +77,7 @@ public void busdoxServiceMetadata() throws Exception {
assertEquals(
serviceInformation.getEndpoint(processIdentifier, TransportProfile.AS4)
.getCertificate().getSubjectDN().toString(),
"C=FI, O=Basware, OU=PEPPOL TEST AP, CN=POP000010"
"CN=POP000010, OU=PEPPOL TEST AP, O=Basware, C=FI"
);
}

Expand All @@ -86,11 +86,11 @@ public void rejectNoLongerActiveEndpoints() throws Exception {
ServiceMetadata result = reader.parseServiceMetadata(new FetcherResponse(
getClass().getResourceAsStream("/busdox-servicemetadata-9908-923829644.xml"))).getContent();

ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:www.cenbii.eu:profile:bii05:ver2.0");
ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:fdc:peppol.eu:2017:poacc:billing:01:1.0");
ServiceInformation<Endpoint> serviceInformation = result.getServiceInformation();

try {
serviceInformation.getEndpoint(processIdentifier, TransportProfile.PEPPOL_AS2_1_0);
serviceInformation.getEndpoint(processIdentifier, TransportProfile.PEPPOL_AS4_2_0);
fail("Expected exception.");
} catch (EndpointNotFoundException e) {
// Expected
Expand All @@ -100,10 +100,10 @@ public void rejectNoLongerActiveEndpoints() throws Exception {
@Test
public void processActiveEndpoints() throws Exception {
ServiceMetadata result = reader.parseServiceMetadata(new FetcherResponse(
getClass().getResourceAsStream("/busdox-servicemetadata-9908-923829644.xml"))).getContent();
getClass().getResourceAsStream("/busdox-servicemetadata-0192-923829644-2.xml"))).getContent();


ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:www.cenbii.eu:profile:bii05:ver2.0");
ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:fdc:peppol.eu:2017:poacc:billing:01:1.0");
ServiceInformation<Endpoint> serviceInformation = result.getServiceInformation();

assertNotNull(serviceInformation.getEndpoint(processIdentifier, TransportProfile.PEPPOL_AS4_2_0));
Expand All @@ -114,11 +114,11 @@ public void rejectNotYetActiveEndpoints() throws Exception {
ServiceMetadata result = reader.parseServiceMetadata(new FetcherResponse(
getClass().getResourceAsStream("/busdox-servicemetadata-9908-923829644.xml"))).getContent();

ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:www.cenbii.eu:profile:bii05:ver2.0");
ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:fdc:peppol.eu:2017:poacc:billing:01:1.0");
ServiceInformation<Endpoint> serviceInformation = result.getServiceInformation();

try {
serviceInformation.getEndpoint(processIdentifier, TransportProfile.PEPPOL_AS2_2_0);
serviceInformation.getEndpoint(processIdentifier, TransportProfile.PEPPOL_AS4_2_0);
fail("Expected exception.");
} catch (EndpointNotFoundException e) {
// Expected
Expand All @@ -129,9 +129,9 @@ public void rejectNotYetActiveEndpoints() throws Exception {
public void missingBothServiceActivationDateAndServiceExpirationDate() throws Exception {
// Still valid : CANNOT reject messages if both ServiceActivationDate and ServiceExpirationDate values are missing
ServiceMetadata result = reader.parseServiceMetadata(new FetcherResponse(
getClass().getResourceAsStream("/busdox-servicemetadata-9908-12345678.xml"))).getContent();
getClass().getResourceAsStream("/busdox-servicemetadata-0192-12345678-3.xml"))).getContent();

ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:www.cenbii.eu:profile:bii05:ver2.0");
ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:fdc:peppol.eu:2017:poacc:billing:01:1.0");
ServiceInformation<Endpoint> serviceInformation = result.getServiceInformation();

assertNotNull(serviceInformation.getEndpoint(processIdentifier, TransportProfile.PEPPOL_AS4_2_0));
Expand All @@ -140,35 +140,35 @@ public void missingBothServiceActivationDateAndServiceExpirationDate() throws Ex
@Test
public void missingServiceActivationDateButServiceExpirationDateIsValid() throws Exception {
ServiceMetadata result = reader.parseServiceMetadata(new FetcherResponse(
getClass().getResourceAsStream("/busdox-servicemetadata-9908-12345678.xml"))).getContent();
getClass().getResourceAsStream("/busdox-servicemetadata-0192-12345678-1.xml"))).getContent();

ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:www.cenbii.eu:profile:bii05:ver2.0");
ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:fdc:peppol.eu:2017:poacc:billing:01:1.0");
ServiceInformation<Endpoint> serviceInformation = result.getServiceInformation();

assertNotNull(serviceInformation.getEndpoint(processIdentifier, TransportProfile.PEPPOL_AS2_1_0));
assertNotNull(serviceInformation.getEndpoint(processIdentifier, TransportProfile.PEPPOL_AS4_2_0));
}

@Test
public void missingServiceExpirationDateButServiceActivationDateIsValid() throws Exception {
ServiceMetadata result = reader.parseServiceMetadata(new FetcherResponse(
getClass().getResourceAsStream("/busdox-servicemetadata-9908-12345678.xml"))).getContent();
getClass().getResourceAsStream("/busdox-servicemetadata-0192-12345678-2.xml"))).getContent();

ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:www.cenbii.eu:profile:bii05:ver2.0");
ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:fdc:peppol.eu:2017:poacc:billing:01:1.0");
ServiceInformation<Endpoint> serviceInformation = result.getServiceInformation();

assertNotNull(serviceInformation.getEndpoint(processIdentifier, TransportProfile.PEPPOL_AS2_2_0));
assertNotNull(serviceInformation.getEndpoint(processIdentifier, TransportProfile.PEPPOL_AS4_2_0));
}

@Test
public void missingServiceActivationDateAndInvalidServiceExpirationDate() throws Exception {
ServiceMetadata result = reader.parseServiceMetadata(new FetcherResponse(
getClass().getResourceAsStream("/busdox-servicemetadata-9908-98765432.xml"))).getContent();

ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:www.cenbii.eu:profile:bii05:ver2.0");
ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:fdc:peppol.eu:2017:poacc:billing:01:1.0");
ServiceInformation<Endpoint> serviceInformation = result.getServiceInformation();

try {
serviceInformation.getEndpoint(processIdentifier, TransportProfile.PEPPOL_AS2_1_0);
serviceInformation.getEndpoint(processIdentifier, TransportProfile.PEPPOL_AS4_2_0);
fail("Expected exception.");
} catch (EndpointNotFoundException e) {
// Expected
Expand All @@ -180,11 +180,11 @@ public void missingServiceExpirationDateAndInvalidServiceActivationDate() throws
ServiceMetadata result = reader.parseServiceMetadata(new FetcherResponse(
getClass().getResourceAsStream("/busdox-servicemetadata-9908-98765432.xml"))).getContent();

ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:www.cenbii.eu:profile:bii05:ver2.0");
ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:fdc:peppol.eu:2017:poacc:billing:01:1.0");
ServiceInformation<Endpoint> serviceInformation = result.getServiceInformation();

try {
serviceInformation.getEndpoint(processIdentifier, TransportProfile.PEPPOL_AS2_2_0);
serviceInformation.getEndpoint(processIdentifier, TransportProfile.PEPPOL_AS4_2_0);
fail("Expected exception.");
} catch (EndpointNotFoundException e) {
// Expected
Expand All @@ -196,7 +196,7 @@ public void inValidServiceExpirationDateAndServiceActivationDate() throws Except
ServiceMetadata result = reader.parseServiceMetadata(new FetcherResponse(
getClass().getResourceAsStream("/busdox-servicemetadata-9908-98765432.xml"))).getContent();

ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:www.cenbii.eu:profile:bii05:ver2.0");
ProcessIdentifier processIdentifier = ProcessIdentifier.of("urn:fdc:peppol.eu:2017:poacc:billing:01:1.0");
ServiceInformation<Endpoint> serviceInformation = result.getServiceInformation();

try {
Expand Down
Loading

0 comments on commit a6b99da

Please sign in to comment.