use of com.helger.phase4.model.pmode.leg.PModeLeg in project phase4 by phax.
the class AbstractAS4Client method setValuesFromPMode.
public final void setValuesFromPMode(@Nullable final IPMode aPMode, @Nullable final PModeLeg aLeg) {
if (aPMode != null) {
final PModeReceptionAwareness aRA = aPMode.getReceptionAwareness();
if (aRA != null && aRA.isRetryDefined()) {
m_aHttpRetrySettings.setMaxRetries(aRA.getMaxRetries());
m_aHttpRetrySettings.setDurationBeforeRetry(Duration.ofMillis(aRA.getRetryIntervalMS()));
} else {
// 0 means "no retries"
m_aHttpRetrySettings.setMaxRetries(0);
}
}
if (aLeg != null) {
signingParams().setFromPMode(aLeg.getSecurity());
cryptParams().setFromPMode(aLeg.getSecurity());
}
}
use of com.helger.phase4.model.pmode.leg.PModeLeg in project phase4 by phax.
the class ENTSOGCompatibilityValidatorTest 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 ENTSOGCompatibilityValidatorTest method testValidatePModeSecurityNoX509SignatureAlgorithm.
@Test
public void testValidatePModeSecurityNoX509SignatureAlgorithm() {
final PModeLegSecurity aSecurityLeg = m_aPMode.getLeg1().getSecurity();
aSecurityLeg.setX509SignatureAlgorithm(null);
m_aPMode.setLeg1(new PModeLeg(PModeLegProtocol.createForDefaultSoapVersion("http://test.example.org"), null, PModeLegErrorHandling.createUndefined(), null, aSecurityLeg));
VALIDATOR.validatePMode(m_aPMode, m_aErrorList);
assertTrue(m_aErrorList.containsAny(x -> x.getErrorText(LOCALE).contains("X509SignatureAlgorithm is missing")));
}
use of com.helger.phase4.model.pmode.leg.PModeLeg in project phase4 by phax.
the class ENTSOGCompatibilityValidatorTest method testValidatePModeSecurityWrongWSSVersion.
@SuppressWarnings("deprecation")
@Test
public void testValidatePModeSecurityWrongWSSVersion() {
final PModeLegSecurity aSecurityLeg = m_aPMode.getLeg1().getSecurity();
aSecurityLeg.setWSSVersion(EWSSVersion.WSS_10);
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.WSSVersion must use the value WSS_111 instead of WSS_10")));
}
use of com.helger.phase4.model.pmode.leg.PModeLeg in project phase4 by phax.
the class ENTSOGCompatibilityValidatorTest method testValidatePModeProtocolSOAP11NotAllowed.
@Test
public void testValidatePModeProtocolSOAP11NotAllowed() {
m_aPMode.setLeg1(new PModeLeg(new PModeLegProtocol("https://test.com", ESoapVersion.SOAP_11), null, null, null, null));
VALIDATOR.validatePMode(m_aPMode, m_aErrorList);
assertTrue(m_aErrorList.containsAny(x -> x.getErrorText(LOCALE).contains("SoapVersion '1.1' is unsupported")));
}
Aggregations