use of com.helger.xsds.peppol.id1.ParticipantIdentifierType in project peppol-commons by phax.
the class SMPClientTest method testCRUDServiceGroup.
@Test
public void testCRUDServiceGroup() throws SMPClientException {
final String sContent = "Test";
final String sElement = "TestElement";
final String sExtensionXML = "<" + sElement + ">" + sContent + "</" + sElement + ">";
final SMPClient aSMPClient = new SMPClient(SMP_URI);
final ServiceGroupType aServiceGroupCreate = aSMPClient.saveServiceGroup(MockSMPClientConfig.getParticipantID(), SMP_CREDENTIALS);
aServiceGroupCreate.setExtension(SMPExtensionConverter.convert(sExtensionXML));
aSMPClient.saveServiceGroup(aServiceGroupCreate, SMP_CREDENTIALS);
final ParticipantIdentifierType aServiceGroupID = aServiceGroupCreate.getParticipantIdentifier();
final ServiceGroupType aServiceGroupRead = aSMPClient.getServiceGroup(SimpleParticipantIdentifier.wrap(aServiceGroupID));
assertNotNull(aServiceGroupRead);
assertNotNull(aServiceGroupRead.getExtension());
assertNotNull(aServiceGroupRead.getExtension().getAny());
assertEquals(sContent, aServiceGroupRead.getExtension().getAny().getTextContent());
assertEquals(sElement, aServiceGroupRead.getExtension().getAny().getLocalName());
aSMPClient.deleteServiceGroup(MockSMPClientConfig.getParticipantID(), SMP_CREDENTIALS);
}
use of com.helger.xsds.peppol.id1.ParticipantIdentifierType 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);
}
use of com.helger.xsds.peppol.id1.ParticipantIdentifierType 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());
}
use of com.helger.xsds.peppol.id1.ParticipantIdentifierType 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());
}
use of com.helger.xsds.peppol.id1.ParticipantIdentifierType 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());
}
Aggregations