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());
}
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);
}
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());
}
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);
}
Aggregations