Search in sources :

Example 1 with ParticipantIdentifierPageType

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

the class ManageParticipantIdentifierServiceCaller method deleteList.

/**
 * Deletes a list of participant identifiers
 *
 * @param aParticipantIdentifiers
 *        The list of participant identifiers. May neither be
 *        <code>null</code> nor empty nor may it contain <code>null</code>
 *        values.
 * @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 a business identifier could not be found and therefore
 *         deleted.
 * @throws UnauthorizedFault
 *         Is thrown if the user was not authorized.
 */
public void deleteList(@Nonnull @Nonempty final Iterable<? extends ParticipantIdentifierType> aParticipantIdentifiers) throws BadRequestFault, InternalErrorFault, NotFoundFault, UnauthorizedFault {
    ValueEnforcer.notEmptyNoNullValue(aParticipantIdentifiers, "ParticipantIdentifiers");
    if (LOGGER.isInfoEnabled())
        LOGGER.info("Trying to delete multiple participants " + _toString2(aParticipantIdentifiers));
    final ParticipantIdentifierPageType deleteListIn = new ParticipantIdentifierPageType();
    for (final ParticipantIdentifierType aPI : aParticipantIdentifiers) {
        // Constructor call needed for type conversion
        deleteListIn.addParticipantIdentifier(aPI.clone());
    }
    createWSPort().deleteList(deleteListIn);
}
Also used : ParticipantIdentifierPageType(com.helger.peppol.smlclient.participant.ParticipantIdentifierPageType) ParticipantIdentifierType(com.helger.xsds.peppol.id1.ParticipantIdentifierType)

Example 2 with ParticipantIdentifierPageType

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

the class SMLFuncTest method testManageBusinessIdentifierListWithTwoElement.

@Test
public void testManageBusinessIdentifierListWithTwoElement() throws Exception {
    final ManageParticipantIdentifierServiceCaller aPIClient = new ManageParticipantIdentifierServiceCaller(SML_INFO);
    aPIClient.setSSLSocketFactory(createConfiguredSSLSocketFactory(SML_INFO, false));
    final ICommonsMap<String, IParticipantIdentifier> aBusinessIdentifiersCreate = new CommonsHashMap<>();
    IParticipantIdentifier aBusinessIdentifierCreate1 = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme(TEST_BUSINESS_IDENTIFIER1);
    IParticipantIdentifier aBusinessIdentifierCreate2 = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme(TEST_BUSINESS_IDENTIFIER2);
    aBusinessIdentifiersCreate.put(aBusinessIdentifierCreate1.getValue(), aBusinessIdentifierCreate1);
    aBusinessIdentifiersCreate.put(aBusinessIdentifierCreate2.getValue(), aBusinessIdentifierCreate2);
    aPIClient.createList(aBusinessIdentifiersCreate.values(), SMP_ID);
    final ParticipantIdentifierPageType aResult = aPIClient.list("", m_aServiceMetadataPublisher.getServiceMetadataPublisherID());
    assertNotNull(aResult);
    final List<ParticipantIdentifierType> aBusinessIdentifiers = aResult.getParticipantIdentifier();
    assertEquals(2, aBusinessIdentifiers.size());
    final ParticipantIdentifierType aBusinessIdentifierRead1 = aBusinessIdentifiers.get(0);
    aBusinessIdentifierCreate1 = aBusinessIdentifiersCreate.get(aBusinessIdentifierRead1.getValue());
    final ParticipantIdentifierType aBusinessIdentifierRead2 = aBusinessIdentifiers.get(1);
    aBusinessIdentifierCreate2 = aBusinessIdentifiersCreate.get(aBusinessIdentifierRead2.getValue());
    assertEquals(aBusinessIdentifierCreate1.getScheme(), aBusinessIdentifierRead1.getScheme());
    assertEquals(aBusinessIdentifierCreate1.getValue(), aBusinessIdentifierRead1.getValue());
    assertEquals(aBusinessIdentifierCreate2.getScheme(), aBusinessIdentifierRead2.getScheme());
    assertEquals(aBusinessIdentifierCreate2.getValue(), aBusinessIdentifierRead2.getValue());
    aPIClient.deleteList(aBusinessIdentifiers);
    m_aSMClient.delete(m_aServiceMetadataPublisher.getServiceMetadataPublisherID());
}
Also used : ParticipantIdentifierPageType(com.helger.peppol.smlclient.participant.ParticipantIdentifierPageType) CommonsHashMap(com.helger.commons.collection.impl.CommonsHashMap) ParticipantIdentifierType(com.helger.xsds.peppol.id1.ParticipantIdentifierType) ManageParticipantIdentifierServiceCaller(com.helger.peppol.smlclient.ManageParticipantIdentifierServiceCaller) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier) Test(org.junit.Test)

Example 3 with ParticipantIdentifierPageType

use of com.helger.peppol.smlclient.participant.ParticipantIdentifierPageType 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 4 with ParticipantIdentifierPageType

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

the class SMLFuncTest method testManageBusinessIdentifierListWithOneElement.

@Test
public void testManageBusinessIdentifierListWithOneElement() throws Exception {
    final ManageParticipantIdentifierServiceCaller aPIClient = new ManageParticipantIdentifierServiceCaller(SML_INFO);
    aPIClient.setSSLSocketFactory(createConfiguredSSLSocketFactory(SML_INFO, false));
    final ICommonsList<IParticipantIdentifier> aRecipientBusinessIdentifiers = new CommonsArrayList<>();
    final IParticipantIdentifier aBusinessIdentifierCreate1 = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme(TEST_BUSINESS_IDENTIFIER1);
    aRecipientBusinessIdentifiers.add(aBusinessIdentifierCreate1);
    aPIClient.createList(aRecipientBusinessIdentifiers, SMP_ID);
    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(aBusinessIdentifierCreate1.getScheme(), aBusinessIdentifierRead.getScheme());
    assertEquals(aBusinessIdentifierCreate1.getValue(), aBusinessIdentifierRead.getValue());
    aPIClient.deleteList(aBusinessIdentifiers);
    m_aSMClient.delete(m_aServiceMetadataPublisher.getServiceMetadataPublisherID());
}
Also used : ParticipantIdentifierPageType(com.helger.peppol.smlclient.participant.ParticipantIdentifierPageType) ParticipantIdentifierType(com.helger.xsds.peppol.id1.ParticipantIdentifierType) ManageParticipantIdentifierServiceCaller(com.helger.peppol.smlclient.ManageParticipantIdentifierServiceCaller) CommonsArrayList(com.helger.commons.collection.impl.CommonsArrayList) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier) Test(org.junit.Test)

Example 5 with ParticipantIdentifierPageType

use of com.helger.peppol.smlclient.participant.ParticipantIdentifierPageType 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)

Aggregations

ParticipantIdentifierPageType (com.helger.peppol.smlclient.participant.ParticipantIdentifierPageType)7 IParticipantIdentifier (com.helger.peppolid.IParticipantIdentifier)6 ParticipantIdentifierType (com.helger.xsds.peppol.id1.ParticipantIdentifierType)6 ManageParticipantIdentifierServiceCaller (com.helger.peppol.smlclient.ManageParticipantIdentifierServiceCaller)5 Test (org.junit.Test)5 SimpleParticipantIdentifier (com.helger.peppolid.simple.participant.SimpleParticipantIdentifier)3 CommonsArrayList (com.helger.commons.collection.impl.CommonsArrayList)2 ServiceMetadataPublisherServiceForParticipantType (com.helger.peppol.smlclient.participant.ServiceMetadataPublisherServiceForParticipantType)2 CommonsHashMap (com.helger.commons.collection.impl.CommonsHashMap)1