use of com.helger.peppol.smlclient.ManageParticipantIdentifierServiceCaller in project peppol-commons by phax.
the class WildcardFuncTest method testCreateDeleteWildcard.
@Test
public void testCreateDeleteWildcard() throws Exception {
final ManageParticipantIdentifierServiceCaller aPIClient = new ManageParticipantIdentifierServiceCaller(SML_INFO);
aPIClient.setSSLSocketFactory(createConfiguredSSLSocketFactory(SML_INFO, false));
final PeppolParticipantIdentifier aPI = new PeppolParticipantIdentifier(WILDCARD_ACTORID_ALLOWED_SCHEME, "*");
aPIClient.create(SMP_ID, aPI);
// try to delete with un-authorized user!
try {
final ManageParticipantIdentifierServiceCaller unAuthorizedClient = new ManageParticipantIdentifierServiceCaller(SML_INFO);
unAuthorizedClient.setSSLSocketFactory(createConfiguredSSLSocketFactory(SML_INFO, false));
unAuthorizedClient.delete(SMP_ID, aPI);
fail("The user does not own the identifier : *");
} catch (final UnauthorizedFault e) {
assertTrue(e.getMessage(), e.getMessage().contains("The user does not own the identifier."));
}
aPIClient.delete(SMP_ID, aPI);
}
use of com.helger.peppol.smlclient.ManageParticipantIdentifierServiceCaller in project peppol-commons by phax.
the class WildcardFuncTest method testCreateWildcardUnauthorizedFault_WrongUser.
@Test
public void testCreateWildcardUnauthorizedFault_WrongUser() throws Exception {
try {
final ManageParticipantIdentifierServiceCaller aPIClient = new ManageParticipantIdentifierServiceCaller(SML_INFO);
aPIClient.setSSLSocketFactory(createConfiguredSSLSocketFactory(SML_INFO, false));
aPIClient.create(UNAUTHRIZED_SML_ID, new PeppolParticipantIdentifier(WILDCARD_ACTORID_ALLOWED_SCHEME, WILDCARD_PI));
fail("The user should not be authorized to insert PI when wildcard is on for scheme.");
} catch (final UnauthorizedFault e) {
assertTrue(e.getMessage(), e.getMessage().contains("The user is not allowed to register ParticipantIdentifiers for this scheme"));
}
}
use of com.helger.peppol.smlclient.ManageParticipantIdentifierServiceCaller in project peppol-commons by phax.
the class WildcardFuncTest method testCreateWildcardBadRequestFault_MustBeWildcard.
@Test
public void testCreateWildcardBadRequestFault_MustBeWildcard() throws Exception {
try {
final ManageParticipantIdentifierServiceCaller aPIClient = new ManageParticipantIdentifierServiceCaller(SML_INFO);
aPIClient.setSSLSocketFactory(createConfiguredSSLSocketFactory(SML_INFO, false));
aPIClient.create(SMP_ID, new PeppolParticipantIdentifier(WILDCARD_ACTORID_ALLOWED_SCHEME, WILDCARD_PI));
fail("User should not be allowed to register wild card for this scheme : " + BUSINESS_IDENTIFIER_SCHEME);
} catch (final BadRequestFault e) {
assertTrue(e.getMessage().contains("Only ParticipantIdentifier Wildcards can be registered for this scheme"));
}
}
use of com.helger.peppol.smlclient.ManageParticipantIdentifierServiceCaller in project peppol-commons by phax.
the class DNSRegistrationFuncTest method testVerifyParticipantIdentifierInDNS.
// PI
@Test
public void testVerifyParticipantIdentifierInDNS() throws Exception {
// @Before creates new SMP!
// create PI
final ManageParticipantIdentifierServiceCaller client = new ManageParticipantIdentifierServiceCaller(SML_INFO);
final PeppolParticipantIdentifier aPI = new PeppolParticipantIdentifier(PI_SCHEME, PI_VALUE);
client.create(SMP_ID, aPI);
// verify PI in DNS
final String host = _DNSLookupPI(aPI);
assertEquals(SMP_ID + "." + SML_INFO.getPublisherDNSZone(), host);
// delete PI
client.delete(SMP_ID, aPI);
final String deletedHost = _DNSLookupPI(aPI);
assertNull(deletedHost);
}
use of com.helger.peppol.smlclient.ManageParticipantIdentifierServiceCaller in project peppol-commons by phax.
the class DNSRegistrationFuncTest method testVerifyWildcardInDNS.
// WildCard PI
@Test
public void testVerifyWildcardInDNS() throws Exception {
// @Before creates new SMP!
final ManageParticipantIdentifierServiceCaller client = new ManageParticipantIdentifierServiceCaller(SML_INFO);
final PeppolParticipantIdentifier aPI = new PeppolParticipantIdentifier(PI_WILDCARD_SCHEME, "*");
client.create(SMP_ID, aPI);
// verify that PI can be found in Wildcard domain.
final String piHost = _DNSLookupPI(new PeppolParticipantIdentifier(PI_WILDCARD_SCHEME, PI_VALUE));
assertEquals(SMP_ID + "." + SML_INFO.getPublisherDNSZone(), piHost);
// verify that Wildcard can be found
final String wildHost = _DNSLookupPI(aPI);
assertEquals(SMP_ID + "." + SML_INFO.getPublisherDNSZone(), wildHost);
// delete wildcard
client.delete(SMP_ID, aPI);
// verify deleted
final String deletedHost = _DNSLookupPI(aPI);
assertNull(deletedHost);
}
Aggregations