Search in sources :

Example 1 with ServiceMetadataPublisherServiceForParticipantType

use of com.helger.peppol.smlclient.participant.ServiceMetadataPublisherServiceForParticipantType in project peppol-commons by phax.

the class SMLFuncTest method testManageBusinessIdentifierDoubleDelete.

@Test(expected = NotFoundFault.class)
public void testManageBusinessIdentifierDoubleDelete() throws Exception {
    final ManageParticipantIdentifierServiceCaller aPIClient = new ManageParticipantIdentifierServiceCaller(SML_INFO);
    aPIClient.setSSLSocketFactory(createConfiguredSSLSocketFactory(SML_INFO, false));
    final IParticipantIdentifier aBusinessIdentifierCreate = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme(TEST_BUSINESS_IDENTIFIER1);
    final ServiceMetadataPublisherServiceForParticipantType aServiceMetadataPublisherServiceForBusiness = new ServiceMetadataPublisherServiceForParticipantType();
    // Explicit constructor call needed for type conversion
    aServiceMetadataPublisherServiceForBusiness.setParticipantIdentifier(new SimpleParticipantIdentifier(aBusinessIdentifierCreate));
    aServiceMetadataPublisherServiceForBusiness.setServiceMetadataPublisherID(m_aServiceMetadataPublisher.getServiceMetadataPublisherID());
    aPIClient.create(aServiceMetadataPublisherServiceForBusiness);
    final ParticipantIdentifierPageType aResult = aPIClient.list("", m_aServiceMetadataPublisher.getServiceMetadataPublisherID());
    assertNotNull(aResult);
    final List<ParticipantIdentifierType> aBusinessIdentifiers = aResult.getParticipantIdentifier();
    assertEquals(1, aBusinessIdentifiers.size());
    final ParticipantIdentifierType aBusinessIdentifierRead = aBusinessIdentifiers.get(0);
    assertEquals(aBusinessIdentifierCreate.getScheme(), aBusinessIdentifierRead.getScheme());
    assertEquals(aBusinessIdentifierCreate.getValue(), aBusinessIdentifierRead.getValue());
    aPIClient.deleteList(aBusinessIdentifiers);
    aPIClient.deleteList(aBusinessIdentifiers);
    m_aSMClient.delete(m_aServiceMetadataPublisher.getServiceMetadataPublisherID());
}
Also used : ParticipantIdentifierPageType(com.helger.peppol.smlclient.participant.ParticipantIdentifierPageType) ServiceMetadataPublisherServiceForParticipantType(com.helger.peppol.smlclient.participant.ServiceMetadataPublisherServiceForParticipantType) ParticipantIdentifierType(com.helger.xsds.peppol.id1.ParticipantIdentifierType) ManageParticipantIdentifierServiceCaller(com.helger.peppol.smlclient.ManageParticipantIdentifierServiceCaller) SimpleParticipantIdentifier(com.helger.peppolid.simple.participant.SimpleParticipantIdentifier) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier) Test(org.junit.Test)

Example 2 with ServiceMetadataPublisherServiceForParticipantType

use of com.helger.peppol.smlclient.participant.ServiceMetadataPublisherServiceForParticipantType in project peppol-commons by phax.

the class ManageParticipantIdentifierServiceCaller method create.

/**
 * Creates a new participant identifier for the SMP given by the ID.
 *
 * @param sSMPID
 *        Identifies the SMP to create the identifier for. Example:
 *        <code>test-smp-0000000001</code>
 * @param aIdentifier
 *        The identifier to be created. May not be <code>null</code>.
 * @throws BadRequestFault
 *         Is thrown if the request sent to the service was not well-formed.
 * @throws InternalErrorFault
 *         Is thrown if an internal error happened on the service.
 * @throws UnauthorizedFault
 *         Is thrown if the user was not authorized.
 * @throws NotFoundFault
 *         Is thrown if the service meta data publisher was not found.
 */
public void create(@Nonnull @Nonempty final String sSMPID, @Nonnull final IParticipantIdentifier aIdentifier) throws BadRequestFault, InternalErrorFault, UnauthorizedFault, NotFoundFault {
    ValueEnforcer.notEmpty(sSMPID, "SMPID");
    ValueEnforcer.notNull(aIdentifier, "Identifier");
    final ServiceMetadataPublisherServiceForParticipantType aSMPParticpantService = new ServiceMetadataPublisherServiceForParticipantType();
    aSMPParticpantService.setServiceMetadataPublisherID(sSMPID);
    // Constructor call needed for type conversion
    aSMPParticpantService.setParticipantIdentifier(new SimpleParticipantIdentifier(aIdentifier));
    create(aSMPParticpantService);
}
Also used : ServiceMetadataPublisherServiceForParticipantType(com.helger.peppol.smlclient.participant.ServiceMetadataPublisherServiceForParticipantType) SimpleParticipantIdentifier(com.helger.peppolid.simple.participant.SimpleParticipantIdentifier)

Example 3 with ServiceMetadataPublisherServiceForParticipantType

use of com.helger.peppol.smlclient.participant.ServiceMetadataPublisherServiceForParticipantType in project peppol-commons by phax.

the class SMLFuncTest method testManageBusinessIdentifier.

@Test
public void testManageBusinessIdentifier() throws Exception {
    final ManageParticipantIdentifierServiceCaller aPIClient = new ManageParticipantIdentifierServiceCaller(SML_INFO);
    aPIClient.setSSLSocketFactory(createConfiguredSSLSocketFactory(SML_INFO, false));
    final IParticipantIdentifier aBusinessIdentifierCreate = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme(TEST_BUSINESS_IDENTIFIER1);
    final ServiceMetadataPublisherServiceForParticipantType saSrviceMetadataPublisherServiceForBusiness = new ServiceMetadataPublisherServiceForParticipantType();
    // Explicit constructor call needed for type conversion
    saSrviceMetadataPublisherServiceForBusiness.setParticipantIdentifier(new SimpleParticipantIdentifier(aBusinessIdentifierCreate));
    saSrviceMetadataPublisherServiceForBusiness.setServiceMetadataPublisherID(m_aServiceMetadataPublisher.getServiceMetadataPublisherID());
    aPIClient.create(saSrviceMetadataPublisherServiceForBusiness);
    final ParticipantIdentifierPageType aResult = aPIClient.list("", m_aServiceMetadataPublisher.getServiceMetadataPublisherID());
    assertNotNull(aResult);
    final List<ParticipantIdentifierType> aBusinessIdentifiers = aResult.getParticipantIdentifier();
    assertEquals(1, aBusinessIdentifiers.size());
    final ParticipantIdentifierType aBusinessIdentifierRead = aBusinessIdentifiers.get(0);
    assertEquals(aBusinessIdentifierCreate.getScheme(), aBusinessIdentifierRead.getScheme());
    assertEquals(aBusinessIdentifierCreate.getValue(), aBusinessIdentifierRead.getValue());
    aPIClient.deleteList(aBusinessIdentifiers);
    m_aSMClient.delete(m_aServiceMetadataPublisher.getServiceMetadataPublisherID());
}
Also used : ParticipantIdentifierPageType(com.helger.peppol.smlclient.participant.ParticipantIdentifierPageType) ServiceMetadataPublisherServiceForParticipantType(com.helger.peppol.smlclient.participant.ServiceMetadataPublisherServiceForParticipantType) ParticipantIdentifierType(com.helger.xsds.peppol.id1.ParticipantIdentifierType) ManageParticipantIdentifierServiceCaller(com.helger.peppol.smlclient.ManageParticipantIdentifierServiceCaller) SimpleParticipantIdentifier(com.helger.peppolid.simple.participant.SimpleParticipantIdentifier) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier) Test(org.junit.Test)

Example 4 with ServiceMetadataPublisherServiceForParticipantType

use of com.helger.peppol.smlclient.participant.ServiceMetadataPublisherServiceForParticipantType in project peppol-commons by phax.

the class ManageParticipantIdentifierServiceCaller method delete.

/**
 * Deletes a given participant identifier. <br>
 * This is a workaround for a bug in CIPA SMK 3.0 which requires the SMP ID.
 * Previously it was never needed!
 *
 * @param sSMPID
 *        The id of the service meta data. May neither be <code>null</code>
 *        nor empty.
 * @param aIdentifier
 *        The business identifier to delete. May not be <code>null</code>.
 * @throws BadRequestFault
 *         Is thrown if the request sent to the service was not well-formed.
 * @throws InternalErrorFault
 *         Is thrown if an internal error happened on the service.
 * @throws NotFoundFault
 *         Is thrown if the business identifier could not be found and
 *         therefore deleted.
 * @throws UnauthorizedFault
 *         Is thrown if the user was not authorized.
 */
public void delete(@Nonnull @Nonempty final String sSMPID, @Nonnull final IParticipantIdentifier aIdentifier) throws BadRequestFault, InternalErrorFault, NotFoundFault, UnauthorizedFault {
    ValueEnforcer.notNull(aIdentifier, "Identifier");
    final ServiceMetadataPublisherServiceForParticipantType aSMPParticpantService = new ServiceMetadataPublisherServiceForParticipantType();
    aSMPParticpantService.setServiceMetadataPublisherID(sSMPID);
    // Constructor call needed for type conversion
    aSMPParticpantService.setParticipantIdentifier(new SimpleParticipantIdentifier(aIdentifier));
    delete(aSMPParticpantService);
}
Also used : ServiceMetadataPublisherServiceForParticipantType(com.helger.peppol.smlclient.participant.ServiceMetadataPublisherServiceForParticipantType) SimpleParticipantIdentifier(com.helger.peppolid.simple.participant.SimpleParticipantIdentifier)

Aggregations

ServiceMetadataPublisherServiceForParticipantType (com.helger.peppol.smlclient.participant.ServiceMetadataPublisherServiceForParticipantType)4 SimpleParticipantIdentifier (com.helger.peppolid.simple.participant.SimpleParticipantIdentifier)4 ManageParticipantIdentifierServiceCaller (com.helger.peppol.smlclient.ManageParticipantIdentifierServiceCaller)2 ParticipantIdentifierPageType (com.helger.peppol.smlclient.participant.ParticipantIdentifierPageType)2 IParticipantIdentifier (com.helger.peppolid.IParticipantIdentifier)2 ParticipantIdentifierType (com.helger.xsds.peppol.id1.ParticipantIdentifierType)2 Test (org.junit.Test)2