use of com.helger.peppolid.IProcessIdentifier in project phase4 by phax.
the class Phase4PeppolServletMessageProcessorSPI method processAS4UserMessage.
@Nonnull
public AS4MessageProcessorResult processAS4UserMessage(@Nonnull final IAS4IncomingMessageMetadata aMessageMetadata, @Nonnull final HttpHeaderMap aHttpHeaders, @Nonnull final Ebms3UserMessage aUserMessage, @Nonnull final IPMode aSrcPMode, @Nullable final Node aPayload, @Nullable final ICommonsList<WSS4JAttachment> aIncomingAttachments, @Nonnull final IAS4MessageState aState, @Nonnull final ICommonsList<Ebms3Error> aProcessingErrorMessages) {
if (LOGGER.isDebugEnabled())
LOGGER.debug("Invoking processAS4UserMessage");
final String sMessageID = aUserMessage.getMessageInfo().getMessageId();
final String sService = aUserMessage.getCollaborationInfo().getServiceValue();
final String sAction = aUserMessage.getCollaborationInfo().getAction();
final String sConversationID = aUserMessage.getCollaborationInfo().getConversationId();
final String sLogPrefix = "[" + sMessageID + "] ";
final Locale aDisplayLocale = aState.getLocale();
// Debug log
if (LOGGER.isDebugEnabled()) {
if (aSrcPMode == null)
LOGGER.debug(sLogPrefix + " No Source PMode present");
else
LOGGER.debug(sLogPrefix + " Source PMode = " + aSrcPMode.getID());
LOGGER.debug(sLogPrefix + " AS4 Message ID = '" + sMessageID + "'");
LOGGER.debug(sLogPrefix + " AS4 Service = '" + sService + "'");
LOGGER.debug(sLogPrefix + " AS4 Action = '" + sAction + "'");
LOGGER.debug(sLogPrefix + " AS4 ConversationId = '" + sConversationID + "'");
// Log source properties
if (aUserMessage.getMessageProperties() != null && aUserMessage.getMessageProperties().hasPropertyEntries()) {
LOGGER.debug(sLogPrefix + " AS4 MessageProperties:");
for (final Ebms3Property p : aUserMessage.getMessageProperties().getProperty()) LOGGER.debug(sLogPrefix + " [" + p.getName() + "] = [" + p.getValue() + "]");
} else
LOGGER.debug(sLogPrefix + " No AS4 Mesage Properties present");
if (aPayload == null)
LOGGER.debug(sLogPrefix + " No SOAP Body Payload present");
else
LOGGER.debug(sLogPrefix + " SOAP Body Payload = " + XMLWriter.getNodeAsString(aPayload));
}
// Read all attachments
final ICommonsList<ReadAttachment> aReadAttachments = new CommonsArrayList<>();
if (aIncomingAttachments != null) {
int nAttachmentIndex = 0;
for (final IAS4Attachment aIncomingAttachment : aIncomingAttachments) {
final ReadAttachment a = new ReadAttachment();
a.m_sID = aIncomingAttachment.getId();
a.m_sMimeType = aIncomingAttachment.getMimeType();
a.m_sUncompressedMimeType = aIncomingAttachment.getUncompressedMimeType();
a.m_aCharset = aIncomingAttachment.getCharset();
a.m_eCompressionMode = aIncomingAttachment.getCompressionMode();
try (final InputStream aSIS = aIncomingAttachment.getSourceStream()) {
final NonBlockingByteArrayOutputStream aBAOS = new NonBlockingByteArrayOutputStream();
if (StreamHelper.copyInputStreamToOutputStreamAndCloseOS(aSIS, aBAOS).isSuccess()) {
a.m_aPayloadBytes = aBAOS.getBufferOrCopy();
}
} catch (final IOException | AS4DecompressException ex) {
// Fall through
}
if (a.m_aPayloadBytes == null) {
LOGGER.error(sLogPrefix + "Failed to decompress the payload");
aProcessingErrorMessages.add(EEbmsError.EBMS_DECOMPRESSION_FAILURE.getAsEbms3Error(aDisplayLocale, aState.getMessageID()));
return AS4MessageProcessorResult.createFailure(null);
}
// Read data as SBDH
// Hint for production systems: this may take a huge amount of memory,
// if the payload is large
final ErrorList aSBDHErrors = new ErrorList();
a.m_aSBDH = SBDHReader.standardBusinessDocument().setValidationEventHandler(new WrappedCollectingValidationEventHandler(aSBDHErrors)).read(a.m_aPayloadBytes);
if (a.m_aSBDH == null) {
if (aSBDHErrors.isEmpty()) {
final String sMsg = "Failed to read the provided SBDH document";
LOGGER.error(sLogPrefix + sMsg);
aProcessingErrorMessages.add(EEbmsError.EBMS_OTHER.getAsEbms3Error(aDisplayLocale, aState.getMessageID(), sMsg));
} else {
for (final IError aError : aSBDHErrors) {
final String sMsg = "Peppol SBDH Issue: " + aError.getAsString(aDisplayLocale);
LOGGER.error(sLogPrefix + sMsg);
aProcessingErrorMessages.add(EEbmsError.EBMS_OTHER.getAsEbms3Error(aDisplayLocale, aState.getMessageID(), sMsg));
}
}
return AS4MessageProcessorResult.createFailure(null);
}
aReadAttachments.add(a);
if (LOGGER.isDebugEnabled())
LOGGER.debug(sLogPrefix + "AS4 Attachment " + nAttachmentIndex + " with ID [" + a.m_sID + "] uses [" + a.m_sMimeType + (a.m_sUncompressedMimeType == null ? null : " - uncompressed " + a.m_sUncompressedMimeType) + "] and [" + StringHelper.getToString(a.m_aCharset, "no charset") + "] and length is " + (a.m_aPayloadBytes == null ? "<error>" : Integer.toString(a.m_aPayloadBytes.length)) + " bytes" + (a.m_eCompressionMode == null ? "" : " of compressed payload"));
nAttachmentIndex++;
}
}
if (aReadAttachments.size() != 1) {
// In Peppol there must be exactly one payload
final String sMsg = "In Peppol exactly one payload attachment is expected. This request has " + aReadAttachments.size() + " attachments";
LOGGER.error(sLogPrefix + sMsg);
return AS4MessageProcessorResult.createFailure(sMsg);
}
// The one and only
final ReadAttachment aReadAttachment = aReadAttachments.getFirst();
// Extract Peppol values from SBD
final PeppolSBDHDocument aPeppolSBD;
try {
if (LOGGER.isDebugEnabled())
LOGGER.debug(sLogPrefix + "Now evaluating the SBDH against Peppol rules");
final boolean bPerformValueChecks = Phase4PeppolServletConfiguration.isPerformSBDHValueChecks();
aPeppolSBD = new PeppolSBDHDocumentReader(SimpleIdentifierFactory.INSTANCE).setPerformValueChecks(bPerformValueChecks).extractData(aReadAttachment.standardBusinessDocument());
if (LOGGER.isDebugEnabled())
LOGGER.debug(sLogPrefix + "The provided SBDH is valid according to Peppol rules, with value checks being " + (bPerformValueChecks ? "enabled" : "disabled"));
} catch (final PeppolSBDHDocumentReadException ex) {
final String sMsg = "Failed to extract the Peppol data from SBDH. Technical details: " + ex.getClass().getName() + " - " + ex.getMessage();
LOGGER.error(sLogPrefix + sMsg);
return AS4MessageProcessorResult.createFailure(sMsg);
}
if (m_aHandlers.isEmpty()) {
LOGGER.error(sLogPrefix + "No SPI handler is present - the message is unhandled and discarded");
} else {
// Start consistency checks?
final Phase4PeppolReceiverCheckData aReceiverCheckData = m_aReceiverCheckData != null ? m_aReceiverCheckData : Phase4PeppolServletConfiguration.getAsReceiverCheckData();
if (aReceiverCheckData != null) {
if (LOGGER.isDebugEnabled())
LOGGER.debug("Performing check if the provided data is registered in our SMP");
try {
// Get the endpoint information required from the recipient
// Check if an endpoint is registered
final IParticipantIdentifier aReceiverID = aPeppolSBD.getReceiverAsIdentifier();
final IDocumentTypeIdentifier aDocTypeID = aPeppolSBD.getDocumentTypeAsIdentifier();
final IProcessIdentifier aProcessID = aPeppolSBD.getProcessAsIdentifier();
final EndpointType aReceiverEndpoint = _getReceiverEndpoint(sLogPrefix, aReceiverCheckData.getSMPClient(), aReceiverID, aDocTypeID, aProcessID);
if (aReceiverEndpoint == null) {
final String sMsg = "Failed to resolve SMP endpoint for provided receiver ID (" + (aReceiverID == null ? "null" : aReceiverID.getURIEncoded()) + ")/documentType ID (" + (aDocTypeID == null ? "null" : aDocTypeID.getURIEncoded()) + ")/process ID (" + (aProcessID == null ? "null" : aProcessID.getURIEncoded()) + ")/transport profile (" + m_aTransportProfile.getID() + ") - not handling incoming AS4 document";
LOGGER.error(sLogPrefix + sMsg);
return AS4MessageProcessorResult.createFailure(sMsg);
}
// Check if the message is for us
_checkIfReceiverEndpointURLMatches(sLogPrefix, aReceiverCheckData.getAS4EndpointURL(), aReceiverEndpoint);
// Get the recipient certificate from the SMP
_checkIfEndpointCertificateMatches(sLogPrefix, aReceiverCheckData.getAPCertificate(), aReceiverEndpoint);
} catch (final Phase4Exception ex) {
final String sMsg = "The addressing data contained in the SBDH could not be verified. Technical details: " + ex.getClass().getName() + " - " + ex.getMessage();
LOGGER.error(sLogPrefix + sMsg);
return AS4MessageProcessorResult.createFailure(sMsg);
}
} else {
LOGGER.info(sLogPrefix + "Endpoint checks for incoming AS4 messages are disabled");
}
for (final IPhase4PeppolIncomingSBDHandlerSPI aHandler : m_aHandlers) {
try {
if (LOGGER.isDebugEnabled())
LOGGER.debug(sLogPrefix + "Invoking Peppol handler " + aHandler);
aHandler.handleIncomingSBD(aMessageMetadata, aHttpHeaders.getClone(), aUserMessage.clone(), aReadAttachment.payloadBytes(), aReadAttachment.standardBusinessDocument(), aPeppolSBD, aState);
} catch (final Exception ex) {
LOGGER.error(sLogPrefix + "Error invoking Peppol handler " + aHandler, ex);
if (aHandler.exceptionTranslatesToAS4Error()) {
final String sMsg = "The incoming Peppol message could not be processed. Technical details: " + ex.getClass().getName() + " - " + ex.getMessage();
LOGGER.error(sLogPrefix + sMsg);
return AS4MessageProcessorResult.createFailure(sMsg);
}
}
}
}
return AS4MessageProcessorResult.createSuccess();
}
use of com.helger.peppolid.IProcessIdentifier in project phoss-smp by phax.
the class NiceNameHandler method readEntries.
@Nonnull
@ReturnsMutableCopy
public static ICommonsOrderedMap<String, NiceNameEntry> readEntries(@Nonnull final IReadableResource aRes, final boolean bReadProcIDs) {
if (LOGGER.isInfoEnabled())
LOGGER.info("Trying to read nice name entries from '" + aRes.getPath() + "'");
final ICommonsOrderedMap<String, NiceNameEntry> ret = new CommonsLinkedHashMap<>();
final IMicroDocument aDoc = MicroReader.readMicroXML(aRes);
if (aDoc != null && aDoc.getDocumentElement() != null) {
for (final IMicroElement eChild : aDoc.getDocumentElement().getAllChildElements("item")) {
final String sID = eChild.getAttributeValue("id");
final String sName = eChild.getAttributeValue("name");
final boolean bDeprecated = eChild.getAttributeValueAsBool("deprecated", false);
ICommonsList<IProcessIdentifier> aProcIDs = null;
if (bReadProcIDs) {
aProcIDs = new CommonsArrayList<>();
for (final IMicroElement eItem : eChild.getAllChildElements("procid")) aProcIDs.add(new SimpleProcessIdentifier(eItem.getAttributeValue("scheme"), eItem.getAttributeValue("value")));
}
ret.put(sID, new NiceNameEntry(sName, bDeprecated, aProcIDs));
}
}
return ret;
}
use of com.helger.peppolid.IProcessIdentifier in project phoss-smp by phax.
the class SMPServiceInformationTest method testMinimal.
@Test
public void testMinimal() {
final IParticipantIdentifier aPI = new SimpleParticipantIdentifier(PeppolIdentifierHelper.DEFAULT_PARTICIPANT_SCHEME, "0088:dummy");
final ISMPServiceGroup aSG = new SMPServiceGroup(CSecurity.USER_ADMINISTRATOR_ID, aPI, null);
final SMPEndpoint aEP = new SMPEndpoint("tp", "http://localhost/as2", false, (String) null, (XMLOffsetDateTime) null, (XMLOffsetDateTime) null, "cert", "sd", "tc", (String) null, (String) null);
assertEquals("tp", aEP.getTransportProfile());
assertEquals("http://localhost/as2", aEP.getEndpointReference());
assertFalse(aEP.isRequireBusinessLevelSignature());
assertNull(aEP.getMinimumAuthenticationLevel());
assertNull(aEP.getServiceActivationDateTime());
assertNull(aEP.getServiceExpirationDateTime());
assertEquals("cert", aEP.getCertificate());
assertEquals("sd", aEP.getServiceDescription());
assertEquals("tc", aEP.getTechnicalContactUrl());
assertNull(aEP.getTechnicalInformationUrl());
assertNull(aEP.getExtensionsAsString());
final IProcessIdentifier aProcessID = new SimpleProcessIdentifier(PeppolIdentifierHelper.DEFAULT_PROCESS_SCHEME, "testproc");
final SMPProcess aProcess = new SMPProcess(aProcessID, CollectionHelper.newList(aEP), (String) null);
assertEquals(aProcessID, aProcess.getProcessIdentifier());
assertEquals(1, aProcess.getAllEndpoints().size());
assertNull(aProcess.getExtensionsAsString());
final IDocumentTypeIdentifier aDocTypeID = new SimpleDocumentTypeIdentifier(PeppolIdentifierHelper.DOCUMENT_TYPE_SCHEME_BUSDOX_DOCID_QNS, "testdoctype");
final SMPServiceInformation aSI = new SMPServiceInformation(aSG, aDocTypeID, CollectionHelper.newList(aProcess), (String) null);
assertSame(aSG, aSI.getServiceGroup());
assertEquals(aDocTypeID, aSI.getDocumentTypeIdentifier());
assertEquals(1, aSI.getAllProcesses().size());
assertNull(aSI.getExtensionsAsString());
}
use of com.helger.peppolid.IProcessIdentifier in project phoss-smp by phax.
the class SMPServiceInformationManagerJDBC method mergeSMPServiceInformation.
@Nonnull
public ESuccess mergeSMPServiceInformation(@Nonnull final ISMPServiceInformation aSMPServiceInformation) {
ValueEnforcer.notNull(aSMPServiceInformation, "ServiceInformation");
final MutableBoolean aUpdated = new MutableBoolean(false);
final DBExecutor aExecutor = newExecutor();
final ESuccess eSuccess = aExecutor.performInTransaction(() -> {
// Simply delete the old one
final EChange eDeleted = _deleteSMPServiceInformationNoCallback(aSMPServiceInformation);
aUpdated.set(eDeleted.isChanged());
// Insert new processes
final IParticipantIdentifier aPID = aSMPServiceInformation.getServiceGroup().getParticipantIdentifier();
final IDocumentTypeIdentifier aDocTypeID = aSMPServiceInformation.getDocumentTypeIdentifier();
aExecutor.insertOrUpdateOrDelete("INSERT INTO smp_service_metadata (businessIdentifierScheme, businessIdentifier, documentIdentifierScheme, documentIdentifier, extension) VALUES (?, ?, ?, ?, ?)", new ConstantPreparedStatementDataProvider(aPID.getScheme(), aPID.getValue(), aDocTypeID.getScheme(), aDocTypeID.getValue(), aSMPServiceInformation.getExtensionsAsString()));
for (final ISMPProcess aProcess : aSMPServiceInformation.getAllProcesses()) {
final IProcessIdentifier aProcessID = aProcess.getProcessIdentifier();
aExecutor.insertOrUpdateOrDelete("INSERT INTO smp_process (businessIdentifierScheme, businessIdentifier, documentIdentifierScheme, documentIdentifier, processIdentifierType, processIdentifier, extension) VALUES (?, ?, ?, ?, ?, ?, ?)", new ConstantPreparedStatementDataProvider(aPID.getScheme(), aPID.getValue(), aDocTypeID.getScheme(), aDocTypeID.getValue(), aProcessID.getScheme(), aProcessID.getValue(), aProcess.getExtensionsAsString()));
// Insert new endpoints
for (final ISMPEndpoint aEndpoint : aProcess.getAllEndpoints()) {
aExecutor.insertOrUpdateOrDelete("INSERT INTO smp_endpoint (businessIdentifierScheme, businessIdentifier, documentIdentifierScheme, documentIdentifier, processIdentifierType, processIdentifier," + " certificate, endpointReference, minimumAuthenticationLevel, requireBusinessLevelSignature, serviceActivationDate, serviceDescription, serviceExpirationDate, technicalContactUrl, technicalInformationUrl, transportProfile," + " extension) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", new ConstantPreparedStatementDataProvider(aPID.getScheme(), aPID.getValue(), aDocTypeID.getScheme(), aDocTypeID.getValue(), aProcessID.getScheme(), aProcessID.getValue(), aEndpoint.getCertificate(), aEndpoint.getEndpointReference(), aEndpoint.getMinimumAuthenticationLevel(), Boolean.valueOf(aEndpoint.isRequireBusinessLevelSignature()), DBValueHelper.toTimestamp(aEndpoint.getServiceActivationDateTime()), aEndpoint.getServiceDescription(), DBValueHelper.toTimestamp(aEndpoint.getServiceExpirationDateTime()), aEndpoint.getTechnicalContactUrl(), aEndpoint.getTechnicalInformationUrl(), aEndpoint.getTransportProfile(), aEndpoint.getExtensionsAsString()));
}
}
});
if (eSuccess.isFailure())
return ESuccess.FAILURE;
// Callback outside of transaction
if (aUpdated.booleanValue()) {
AuditHelper.onAuditModifySuccess(SMPServiceInformation.OT, "set-all", aSMPServiceInformation.getID(), aSMPServiceInformation.getServiceGroupID(), aSMPServiceInformation.getDocumentTypeIdentifier().getURIEncoded(), aSMPServiceInformation.getAllProcesses(), aSMPServiceInformation.getExtensionsAsString());
m_aCBs.forEach(x -> x.onSMPServiceInformationUpdated(aSMPServiceInformation));
} else {
AuditHelper.onAuditCreateSuccess(SMPServiceInformation.OT, aSMPServiceInformation.getID(), aSMPServiceInformation.getServiceGroupID(), aSMPServiceInformation.getDocumentTypeIdentifier().getURIEncoded(), aSMPServiceInformation.getAllProcesses(), aSMPServiceInformation.getExtensionsAsString());
m_aCBs.forEach(x -> x.onSMPServiceInformationCreated(aSMPServiceInformation));
}
return ESuccess.SUCCESS;
}
use of com.helger.peppolid.IProcessIdentifier in project phoss-smp by phax.
the class SMPServiceInformationManagerXMLTest method testServiceRegistration.
@Test
public void testServiceRegistration() throws SMPServerException {
// Ensure the user is present
final IUser aTestUser = PhotonSecurityManager.getUserMgr().getUserOfID(CSecurity.USER_ADMINISTRATOR_ID);
assertNotNull(aTestUser);
final IIdentifierFactory aIdentifierFactory = SMPMetaManager.getIdentifierFactory();
final ISMPServiceGroupManager aServiceGroupMgr = SMPMetaManager.getServiceGroupMgr();
final ISMPServiceInformationManager aServiceInformationMgr = SMPMetaManager.getServiceInformationMgr();
assertEquals(0, aServiceInformationMgr.getSMPServiceInformationCount());
// Delete existing service group
final IParticipantIdentifier aPI = aIdentifierFactory.createParticipantIdentifier(PeppolIdentifierHelper.DEFAULT_PARTICIPANT_SCHEME, "0088:dummy");
aServiceGroupMgr.deleteSMPServiceGroupNoEx(aPI, true);
final ISMPServiceGroup aSG = aServiceGroupMgr.createSMPServiceGroup(aTestUser.getID(), aPI, null, true);
assertNotNull(aSG);
try {
final XMLOffsetDateTime aStartDT = PDTFactory.getCurrentXMLOffsetDateTime();
final XMLOffsetDateTime aEndDT = aStartDT.plusYears(1);
final IProcessIdentifier aProcessID = aIdentifierFactory.createProcessIdentifier(PeppolIdentifierHelper.DEFAULT_PROCESS_SCHEME, "testproc");
final IDocumentTypeIdentifier aDocTypeID = aIdentifierFactory.createDocumentTypeIdentifier(PeppolIdentifierHelper.DOCUMENT_TYPE_SCHEME_BUSDOX_DOCID_QNS, "testdoctype");
{
// Create a new service information
final SMPEndpoint aEP = new SMPEndpoint("tp", "http://localhost/as2", false, "minauth", aStartDT, aEndDT, "cert", "sd", "tc", "ti", "<extep />");
final SMPProcess aProcess = new SMPProcess(aProcessID, new CommonsArrayList<>(aEP), "<extproc />");
assertTrue(aServiceInformationMgr.mergeSMPServiceInformation(new SMPServiceInformation(aSG, aDocTypeID, new CommonsArrayList<>(aProcess), "<extsi />")).isSuccess());
assertEquals(1, aServiceInformationMgr.getSMPServiceInformationCount());
assertEquals(1, CollectionHelper.getFirstElement(aServiceInformationMgr.getAllSMPServiceInformation()).getProcessCount());
assertEquals(1, CollectionHelper.getFirstElement(aServiceInformationMgr.getAllSMPServiceInformation()).getAllProcesses().get(0).getEndpointCount());
}
{
// Replace endpoint URL with equal transport profile -> replace
final ISMPServiceInformation aSI = aServiceInformationMgr.getSMPServiceInformationOfServiceGroupAndDocumentType(aSG, aDocTypeID);
assertNotNull(aSI);
final ISMPProcess aProcess = aSI.getProcessOfID(aProcessID);
assertNotNull(aProcess);
aProcess.setEndpoint(new SMPEndpoint("tp", "http://localhost/as2-ver2", false, "minauth", aStartDT, aEndDT, "cert", "sd", "tc", "ti", "<extep />"));
assertTrue(aServiceInformationMgr.mergeSMPServiceInformation(aSI).isSuccess());
assertEquals(1, aServiceInformationMgr.getSMPServiceInformationCount());
assertEquals(1, CollectionHelper.getFirstElement(aServiceInformationMgr.getAllSMPServiceInformation()).getProcessCount());
assertEquals(1, CollectionHelper.getFirstElement(aServiceInformationMgr.getAllSMPServiceInformation()).getAllProcesses().get(0).getEndpointCount());
assertEquals("http://localhost/as2-ver2", CollectionHelper.getFirstElement(aServiceInformationMgr.getAllSMPServiceInformation()).getAllProcesses().get(0).getAllEndpoints().get(0).getEndpointReference());
}
{
// Add endpoint with different transport profile -> added to existing
// process
final ISMPServiceInformation aSI = aServiceInformationMgr.getSMPServiceInformationOfServiceGroupAndDocumentType(aSG, aDocTypeID);
assertNotNull(aSI);
final ISMPProcess aProcess = aSI.getProcessOfID(aProcessID);
assertNotNull(aProcess);
aProcess.addEndpoint(new SMPEndpoint("tp2", "http://localhost/as2-tp2", false, "minauth", aStartDT, aEndDT, "cert", "sd", "tc", "ti", "<extep />"));
assertTrue(aServiceInformationMgr.mergeSMPServiceInformation(aSI).isSuccess());
assertEquals(1, aServiceInformationMgr.getSMPServiceInformationCount());
assertEquals(1, CollectionHelper.getFirstElement(aServiceInformationMgr.getAllSMPServiceInformation()).getProcessCount());
assertEquals(2, CollectionHelper.getFirstElement(aServiceInformationMgr.getAllSMPServiceInformation()).getAllProcesses().get(0).getEndpointCount());
}
{
// Add endpoint with different process - add to existing
// serviceGroup+docType part
final ISMPServiceInformation aSI = aServiceInformationMgr.getSMPServiceInformationOfServiceGroupAndDocumentType(aSG, aDocTypeID);
assertNotNull(aSI);
final SMPEndpoint aEP = new SMPEndpoint("tp", "http://localhost/as2", false, "minauth", aStartDT, aEndDT, "cert", "sd", "tc", "ti", "<extep />");
aSI.addProcess(new SMPProcess(PeppolIdentifierFactory.INSTANCE.createProcessIdentifierWithDefaultScheme("testproc2"), new CommonsArrayList<>(aEP), "<extproc />"));
assertTrue(aServiceInformationMgr.mergeSMPServiceInformation(aSI).isSuccess());
assertEquals(1, aServiceInformationMgr.getSMPServiceInformationCount());
assertEquals(2, CollectionHelper.getFirstElement(aServiceInformationMgr.getAllSMPServiceInformation()).getProcessCount());
assertEquals(2, CollectionHelper.getFirstElement(aServiceInformationMgr.getAllSMPServiceInformation()).getAllProcesses().get(0).getEndpointCount());
assertEquals(1, CollectionHelper.getFirstElement(aServiceInformationMgr.getAllSMPServiceInformation()).getAllProcesses().get(1).getEndpointCount());
}
} finally {
aServiceGroupMgr.deleteSMPServiceGroup(aPI, true);
}
}
Aggregations