use of com.helger.phase4.model.pmode.leg.PModeLeg in project phase4 by phax.
the class PeppolCompatibilityValidatorTest method testValidatePModeSecurityWrongX509EncryptionAlgorithm.
@Test
public void testValidatePModeSecurityWrongX509EncryptionAlgorithm() {
final PModeLegSecurity aSecurityLeg = m_aPMode.getLeg1().getSecurity();
aSecurityLeg.setX509EncryptionAlgorithm(ECryptoAlgorithmCrypt.AES_192_CBC);
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(ECryptoAlgorithmCrypt.AES_128_GCM.getID())));
}
use of com.helger.phase4.model.pmode.leg.PModeLeg in project phase4 by phax.
the class PeppolCompatibilityValidatorTest method testValidatePModeNoProtocol.
@Test
public void testValidatePModeNoProtocol() {
m_aPMode.setLeg1(new PModeLeg(null, null, null, null, null));
VALIDATOR.validatePMode(m_aPMode, m_aErrorList);
assertTrue(m_aErrorList.containsAny(x -> x.getErrorText(LOCALE).contains("Protocol is missing")));
}
use of com.helger.phase4.model.pmode.leg.PModeLeg in project phase4 by phax.
the class PeppolCompatibilityValidatorTest method testValidatePModeErrorHandlingReportAsResponseWrongValue.
@Test
public void testValidatePModeErrorHandlingReportAsResponseWrongValue() {
final PModeLegErrorHandling aErrorHandler = PModeLegErrorHandling.createUndefined();
aErrorHandler.setReportAsResponse(false);
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.AsResponse must be 'true'")));
}
use of com.helger.phase4.model.pmode.leg.PModeLeg in project phase4 by phax.
the class PeppolCompatibilityValidatorTest method testValidatePModeSecurityNoX509SignatureHashFunction.
@Test
public void testValidatePModeSecurityNoX509SignatureHashFunction() {
final PModeLegSecurity aSecurityLeg = m_aPMode.getLeg1().getSecurity();
aSecurityLeg.setX509SignatureHashFunction(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("X509SignatureHashFunction is missing")));
}
use of com.helger.phase4.model.pmode.leg.PModeLeg in project phase4 by phax.
the class CEFPMode method createCEFPMode.
/**
* One-Way Version of the CEF pmode uses one-way push
*
* @param sInitiatorID
* Initiator ID
* @param sResponderID
* Responder ID
* @param sResponderAddress
* Responder URL
* @param aPModeIDProvider
* PMode ID provider
* @param bPersist
* <code>true</code> to persist the PMode in the PModeManager,
* <code>false</code> to have it only in memory.
* @return New PMode
*/
@Nonnull
public static PMode createCEFPMode(@Nonnull @Nonempty final String sInitiatorID, @Nonnull @Nonempty final String sResponderID, @Nullable final String sResponderAddress, @Nonnull final IPModeIDProvider aPModeIDProvider, final boolean bPersist) {
final PModeParty aInitiator = PModeParty.createSimple(sInitiatorID, CAS4.DEFAULT_INITIATOR_URL);
final PModeParty aResponder = PModeParty.createSimple(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(sResponderAddress), (PModeLeg) null, (PModePayloadService) null, generatePModeReceptionAwareness());
if (bPersist) {
// Ensure it is stored
MetaAS4Manager.getPModeMgr().createOrUpdatePMode(aPMode);
}
return aPMode;
}
Aggregations