use of com.helger.peppol.smlclient.ManageParticipantIdentifierServiceCaller 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.peppol.smlclient.ManageParticipantIdentifierServiceCaller 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));
}
use of com.helger.peppol.smlclient.ManageParticipantIdentifierServiceCaller 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.peppol.smlclient.ManageParticipantIdentifierServiceCaller 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());
}
use of com.helger.peppol.smlclient.ManageParticipantIdentifierServiceCaller in project peppol-commons by phax.
the class WildcardFuncTest method testCreateWildcardUnauthorizedFault_WrongScheme.
@Test
public void testCreateWildcardUnauthorizedFault_WrongScheme() throws Exception {
try {
final ManageParticipantIdentifierServiceCaller aPIClient = new ManageParticipantIdentifierServiceCaller(SML_INFO);
aPIClient.setSSLSocketFactory(createConfiguredSSLSocketFactory(SML_INFO, false));
aPIClient.create(SMP_ID, new PeppolParticipantIdentifier(BUSINESS_IDENTIFIER_SCHEME, "*"));
fail("User should not be allowed to register wild card for this scheme : " + BUSINESS_IDENTIFIER_SCHEME);
} catch (final UnauthorizedFault e) {
assertTrue(e.getMessage().contains("The user is not allowed to register Wildcard for this scheme"));
}
}
Aggregations