Search in sources :

Example 1 with NotFoundFault

use of com.helger.peppol.smlclient.smp.NotFoundFault in project peppol-commons by phax.

the class SMLFuncTest method cleanup.

@Before
public void cleanup() throws Exception {
    m_aSMClient = new ManageServiceMetadataServiceCaller(SML_INFO);
    m_aSMClient.setSSLSocketFactory(createConfiguredSSLSocketFactory(SML_INFO, false));
    try {
        m_aSMClient.delete(SMP_ID);
    } catch (final NotFoundFault e) {
    // This is fine, since we are just cleaning
    }
    m_aServiceMetadataPublisher = _createSMPData(m_aSMClient, SMP_ID);
}
Also used : ManageServiceMetadataServiceCaller(com.helger.peppol.smlclient.ManageServiceMetadataServiceCaller) NotFoundFault(com.helger.peppol.smlclient.smp.NotFoundFault) Before(org.junit.Before)

Example 2 with NotFoundFault

use of com.helger.peppol.smlclient.smp.NotFoundFault in project peppol-commons by phax.

the class SMLFuncTest method testCreateExistingBusinessIdentifierUnauthorized.

@Test(expected = BadRequestFault.class)
public void testCreateExistingBusinessIdentifierUnauthorized() throws Exception {
    final ManageParticipantIdentifierServiceCaller aPIClientOld = new ManageParticipantIdentifierServiceCaller(SML_INFO);
    aPIClientOld.setSSLSocketFactory(createConfiguredSSLSocketFactory(SML_INFO, false));
    final ManageServiceMetadataServiceCaller aClient2 = new ManageServiceMetadataServiceCaller(SML_INFO);
    aClient2.setSSLSocketFactory(createConfiguredSSLSocketFactory(SML_INFO, false));
    try {
        aClient2.delete(SMP_ID2);
    } catch (final NotFoundFault e) {
    // This is fine, since we are just cleaning
    }
    _createSMPData(aClient2, SMP_ID2);
    final ManageParticipantIdentifierServiceCaller aPIClientNew = new ManageParticipantIdentifierServiceCaller(SML_INFO);
    aPIClientNew.setSSLSocketFactory(createConfiguredSSLSocketFactory(SML_INFO, false));
    aPIClientOld.create(SMP_ID, PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme(TEST_BUSINESS_IDENTIFIER1));
    aPIClientNew.create(SMP_ID, PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme(TEST_BUSINESS_IDENTIFIER1));
}
Also used : ManageServiceMetadataServiceCaller(com.helger.peppol.smlclient.ManageServiceMetadataServiceCaller) NotFoundFault(com.helger.peppol.smlclient.smp.NotFoundFault) ManageParticipantIdentifierServiceCaller(com.helger.peppol.smlclient.ManageParticipantIdentifierServiceCaller) Test(org.junit.Test)

Example 3 with NotFoundFault

use of com.helger.peppol.smlclient.smp.NotFoundFault in project peppol-commons by phax.

the class WildcardFuncTest method initialize.

@Before
public void initialize() throws Exception {
    m_aSMClient = new ManageServiceMetadataServiceCaller(SML_INFO);
    m_aSMClient.setSSLSocketFactory(createConfiguredSSLSocketFactory(SML_INFO, false));
    try {
        m_aSMClient.delete(SMP_ID);
    } catch (final NotFoundFault e) {
    // This is fine, since we are just cleaning
    }
    // Create SMP
    final ServiceMetadataPublisherServiceType aServiceMetadataCreate = new ServiceMetadataPublisherServiceType();
    aServiceMetadataCreate.setServiceMetadataPublisherID(SMP_ID);
    final PublisherEndpointType aEndpoint = new PublisherEndpointType();
    aEndpoint.setLogicalAddress(ADDRESS_LOGICAL);
    aEndpoint.setPhysicalAddress(ADDRESS_PHYSICAL);
    aServiceMetadataCreate.setPublisherEndpoint(aEndpoint);
    m_aSMClient.create(aServiceMetadataCreate);
}
Also used : ManageServiceMetadataServiceCaller(com.helger.peppol.smlclient.ManageServiceMetadataServiceCaller) PublisherEndpointType(com.helger.peppol.smlclient.smp.PublisherEndpointType) ServiceMetadataPublisherServiceType(com.helger.peppol.smlclient.smp.ServiceMetadataPublisherServiceType) NotFoundFault(com.helger.peppol.smlclient.smp.NotFoundFault) Before(org.junit.Before)

Example 4 with NotFoundFault

use of com.helger.peppol.smlclient.smp.NotFoundFault in project peppol-commons by phax.

the class DNSRegistrationFuncTest method deleteSMPAfterTests.

@After
public void deleteSMPAfterTests() throws Exception {
    LOGGER.info("Deleting an SMP");
    final ManageServiceMetadataServiceCaller manageServiceMetaData = new ManageServiceMetadataServiceCaller(SML_INFO);
    try {
        manageServiceMetaData.delete(SMP_ID);
        LOGGER.info("Deleted an SMP");
    } catch (final NotFoundFault e) {
    // this is ok
    } catch (final Exception ex) {
        LOGGER.error("Failed: " + ex.getMessage());
        throw ex;
    }
}
Also used : ManageServiceMetadataServiceCaller(com.helger.peppol.smlclient.ManageServiceMetadataServiceCaller) NotFoundFault(com.helger.peppol.smlclient.smp.NotFoundFault) After(org.junit.After)

Example 5 with NotFoundFault

use of com.helger.peppol.smlclient.smp.NotFoundFault in project peppol-commons by phax.

the class SMLFuncTest method testMigrate.

@Test
public void testMigrate() throws Exception {
    final ManageParticipantIdentifierServiceCaller aPIClientOld = new ManageParticipantIdentifierServiceCaller(SML_INFO);
    aPIClientOld.setSSLSocketFactory(createConfiguredSSLSocketFactory(SML_INFO, false));
    final ManageServiceMetadataServiceCaller aClient2 = new ManageServiceMetadataServiceCaller(SML_INFO);
    aClient2.setSSLSocketFactory(createConfiguredSSLSocketFactory(SML_INFO, false));
    try {
        aClient2.delete(SMP_ID2);
    } catch (final NotFoundFault e) {
    // This is fine, since we are just cleaning
    }
    _createSMPData(aClient2, SMP_ID2);
    final ManageParticipantIdentifierServiceCaller aPIClientNew = new ManageParticipantIdentifierServiceCaller(SML_INFO);
    aPIClientNew.setSSLSocketFactory(createConfiguredSSLSocketFactory(SML_INFO, false));
    final IParticipantIdentifier aPI = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme(TEST_BUSINESS_IDENTIFIER1);
    aPIClientOld.create(SMP_ID, aPI);
    final String sMigrationKey = aPIClientOld.prepareToMigrate(aPI, SMP_ID);
    assertNotNull(sMigrationKey);
    aPIClientNew.migrate(aPI, sMigrationKey, SMP_ID2);
    try {
        aPIClientOld.delete(SMP_ID, aPI);
        fail();
    } catch (final UnauthorizedFault e) {
    // This must happen.
    }
    // Should be able to delete, since New is now the owner
    aPIClientNew.delete(SMP_ID, aPI);
}
Also used : UnauthorizedFault(com.helger.peppol.smlclient.participant.UnauthorizedFault) ManageServiceMetadataServiceCaller(com.helger.peppol.smlclient.ManageServiceMetadataServiceCaller) NotFoundFault(com.helger.peppol.smlclient.smp.NotFoundFault) ManageParticipantIdentifierServiceCaller(com.helger.peppol.smlclient.ManageParticipantIdentifierServiceCaller) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier) Test(org.junit.Test)

Aggregations

ManageServiceMetadataServiceCaller (com.helger.peppol.smlclient.ManageServiceMetadataServiceCaller)5 NotFoundFault (com.helger.peppol.smlclient.smp.NotFoundFault)5 ManageParticipantIdentifierServiceCaller (com.helger.peppol.smlclient.ManageParticipantIdentifierServiceCaller)2 Before (org.junit.Before)2 Test (org.junit.Test)2 UnauthorizedFault (com.helger.peppol.smlclient.participant.UnauthorizedFault)1 PublisherEndpointType (com.helger.peppol.smlclient.smp.PublisherEndpointType)1 ServiceMetadataPublisherServiceType (com.helger.peppol.smlclient.smp.ServiceMetadataPublisherServiceType)1 IParticipantIdentifier (com.helger.peppolid.IParticipantIdentifier)1 After (org.junit.After)1