Search in sources :

Example 6 with ManageParticipantIdentifierServiceCaller

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);
}
Also used : PeppolParticipantIdentifier(com.helger.peppolid.peppol.participant.PeppolParticipantIdentifier) UnauthorizedFault(com.helger.peppol.smlclient.participant.UnauthorizedFault) ManageParticipantIdentifierServiceCaller(com.helger.peppol.smlclient.ManageParticipantIdentifierServiceCaller) Test(org.junit.Test)

Example 7 with ManageParticipantIdentifierServiceCaller

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"));
    }
}
Also used : PeppolParticipantIdentifier(com.helger.peppolid.peppol.participant.PeppolParticipantIdentifier) UnauthorizedFault(com.helger.peppol.smlclient.participant.UnauthorizedFault) ManageParticipantIdentifierServiceCaller(com.helger.peppol.smlclient.ManageParticipantIdentifierServiceCaller) Test(org.junit.Test)

Example 8 with ManageParticipantIdentifierServiceCaller

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"));
    }
}
Also used : PeppolParticipantIdentifier(com.helger.peppolid.peppol.participant.PeppolParticipantIdentifier) BadRequestFault(com.helger.peppol.smlclient.participant.BadRequestFault) ManageParticipantIdentifierServiceCaller(com.helger.peppol.smlclient.ManageParticipantIdentifierServiceCaller) Test(org.junit.Test)

Example 9 with ManageParticipantIdentifierServiceCaller

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);
}
Also used : PeppolParticipantIdentifier(com.helger.peppolid.peppol.participant.PeppolParticipantIdentifier) ManageParticipantIdentifierServiceCaller(com.helger.peppol.smlclient.ManageParticipantIdentifierServiceCaller) Test(org.junit.Test)

Example 10 with ManageParticipantIdentifierServiceCaller

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);
}
Also used : PeppolParticipantIdentifier(com.helger.peppolid.peppol.participant.PeppolParticipantIdentifier) ManageParticipantIdentifierServiceCaller(com.helger.peppol.smlclient.ManageParticipantIdentifierServiceCaller) Test(org.junit.Test)

Aggregations

ManageParticipantIdentifierServiceCaller (com.helger.peppol.smlclient.ManageParticipantIdentifierServiceCaller)23 Test (org.junit.Test)16 IParticipantIdentifier (com.helger.peppolid.IParticipantIdentifier)13 UnauthorizedFault (com.helger.peppol.smlclient.participant.UnauthorizedFault)6 PeppolParticipantIdentifier (com.helger.peppolid.peppol.participant.PeppolParticipantIdentifier)6 ParticipantIdentifierPageType (com.helger.peppol.smlclient.participant.ParticipantIdentifierPageType)5 ParticipantIdentifierType (com.helger.xsds.peppol.id1.ParticipantIdentifierType)5 ISMLInfo (com.helger.peppol.sml.ISMLInfo)4 ManageServiceMetadataServiceCaller (com.helger.peppol.smlclient.ManageServiceMetadataServiceCaller)4 IIdentifierFactory (com.helger.peppolid.factory.IIdentifierFactory)4 ISMPParticipantMigrationManager (com.helger.phoss.smp.domain.pmigration.ISMPParticipantMigrationManager)4 ISMPSettings (com.helger.phoss.smp.settings.ISMPSettings)4 BadRequestFault (com.helger.peppol.smlclient.participant.BadRequestFault)3 ISMPServiceGroupManager (com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroupManager)3 IMicroDocument (com.helger.xml.microdom.IMicroDocument)3 CommonsArrayList (com.helger.commons.collection.impl.CommonsArrayList)2 PDTToString (com.helger.commons.datetime.PDTToString)2 CMimeType (com.helger.commons.mime.CMimeType)2 MimeType (com.helger.commons.mime.MimeType)2 BasicAuthClientCredentials (com.helger.http.basicauth.BasicAuthClientCredentials)2