use of com.helger.phase4.model.pmode.leg.PModeLeg in project phase4 by phax.
the class PeppolPMode method createPeppolPMode.
/**
* One-Way Version of the PEPPOL pmode uses one-way push
*
* @param sInitiatorID
* Initiator ID. May neither be <code>null</code> nor empty.
* @param sResponderID
* Responder ID. May neither be <code>null</code> nor empty.
* @param sAddress
* Endpoint address URL. May be <code>null</code>.
* @param aPModeIDProvider
* PMode ID provider. May not be <code>null</code>.
* @param bPersist
* <code>true</code> to persist the PMode in the PModeManager,
* <code>false</code> to have it only in memory.
* @return New PMode and never <code>null</code>.
*/
@Nonnull
public static PMode createPeppolPMode(@Nonnull @Nonempty final String sInitiatorID, @Nonnull @Nonempty final String sResponderID, @Nullable final String sAddress, @Nonnull final IPModeIDProvider aPModeIDProvider, final boolean bPersist) {
final PModeParty aInitiator = createParty(sInitiatorID, CAS4.DEFAULT_INITIATOR_URL);
final PModeParty aResponder = createParty(sResponderID, CAS4.DEFAULT_RESPONDER_URL);
final PMode aPMode = new PMode(aPModeIDProvider.getPModeID(sInitiatorID, sResponderID), aInitiator, aResponder, DEFAULT_AGREEMENT_ID, EMEP.ONE_WAY, EMEPBinding.PUSH, generatePModeLeg(sAddress), (PModeLeg) null, (PModePayloadService) null, generatePModeReceptionAwareness());
if (bPersist) {
// Ensure it is stored
MetaAS4Manager.getPModeMgr().createOrUpdatePMode(aPMode);
}
return aPMode;
}
use of com.helger.phase4.model.pmode.leg.PModeLeg in project phase4 by phax.
the class PeppolCompatibilityValidatorTest method testValidatePModeSecurityNoX509SignatureCertificate.
@Test
@Ignore("The X509 certificate is always null, as it is received from the SMP")
public void testValidatePModeSecurityNoX509SignatureCertificate() {
final PModeLegSecurity aSecurityLeg = m_aPMode.getLeg1().getSecurity();
aSecurityLeg.setX509SignatureCertificate(null);
m_aPMode.setLeg1(new PModeLeg(PModeLegProtocol.createForDefaultSoapVersion("http://test.example.org"), null, null, null, aSecurityLeg));
VALIDATOR.validatePMode(m_aPMode, m_aErrorList);
assertTrue(m_aErrorList.containsAny(x -> x.getErrorText(LOCALE).contains("X509SignatureCertificate is missing")));
}
use of com.helger.phase4.model.pmode.leg.PModeLeg in project phase4 by phax.
the class PeppolCompatibilityValidatorTest method testValidatePModeErrorHandlingReportProcessErrorNotifyConsumerMandatory.
@Test
public void testValidatePModeErrorHandlingReportProcessErrorNotifyConsumerMandatory() {
final PModeLegErrorHandling aErrorHandler = PModeLegErrorHandling.createUndefined();
m_aPMode.setLeg1(new PModeLeg(PModeLegProtocol.createForDefaultSoapVersion("http://test.example.org"), null, aErrorHandler, null, null));
VALIDATOR.validatePMode(m_aPMode, m_aErrorList);
assertTrue(m_aErrorList.containsAny(x -> x.getErrorText(LOCALE).contains("ErrorHandling.Report.ProcessErrorNotifyConsumer is missing")));
}
use of com.helger.phase4.model.pmode.leg.PModeLeg in project phase4 by phax.
the class PeppolCompatibilityValidatorTest method testValidatePModeSecurityResponsePatternWrongBoolean.
@Test
public void testValidatePModeSecurityResponsePatternWrongBoolean() {
final PModeLegSecurity aSecurityLeg = m_aPMode.getLeg1().getSecurity();
aSecurityLeg.setSendReceipt(true);
aSecurityLeg.setSendReceiptReplyPattern(EPModeSendReceiptReplyPattern.CALLBACK);
m_aPMode.setLeg1(new PModeLeg(PModeLegProtocol.createForDefaultSoapVersion("http://test.example.org"), null, null, null, aSecurityLeg));
VALIDATOR.validatePMode(m_aPMode, m_aErrorList);
assertTrue(m_aErrorList.containsAny(x -> x.getErrorText(LOCALE).contains("Security.SendReceiptReplyPattern must use the value RESPONSE instead of CALLBACK")));
}
use of com.helger.phase4.model.pmode.leg.PModeLeg in project phase4 by phax.
the class PeppolCompatibilityValidatorTest method testValidatePModeErrorHandlingMandatory.
// Error Handling
@Test
public void testValidatePModeErrorHandlingMandatory() {
m_aPMode.setLeg1(new PModeLeg(PModeLegProtocol.createForDefaultSoapVersion("http://test.example.org"), null, null, null, null));
VALIDATOR.validatePMode(m_aPMode, m_aErrorList);
assertTrue(m_aErrorList.containsAny(x -> x.getErrorText(LOCALE).contains("PMode.Leg[1].ErrorHandling is missing")));
}
Aggregations