use of com.helger.phase4.messaging.mime.AS4MimeMessage in project phase4 by phax.
the class AS4CEFOneWayFuncTest method testAS4_TA06.
/**
* Prerequisite:<br>
* SMSH and RMSH are configured to exchange AS4 messages according to the
* e-SENS profile (One-Way/Push MEP). Producer submits a Message with metadata
* information and XML payload to the SMSH.<br>
* <br>
* Predicate: <br>
* The SMSH generates an AS4 message with a gzip compressed payload.
*
* @throws Exception
* In case of error
*/
@Test
public void testAS4_TA06() throws Exception {
final ICommonsList<WSS4JAttachment> aAttachments = new CommonsArrayList<>();
aAttachments.add(WSS4JAttachment.createOutgoingFileAttachment(Phase4OutgoingAttachment.builder().data(ClassPathResource.getAsFile(AS4TestConstants.ATTACHMENT_SHORTXML_XML)).mimeType(CMimeType.APPLICATION_XML).compression(EAS4CompressionMode.GZIP).build(), s_aResMgr));
final AS4MimeMessage aMsg = MimeMessageCreator.generateMimeMessage(m_eSoapVersion, createTestSignedUserMessage(m_eSoapVersion, m_aPayload, aAttachments, s_aResMgr), aAttachments);
final String sResponse = sendMimeMessage(new HttpMimeMessageEntity(aMsg), true, null);
assertTrue(sResponse.contains(AS4TestConstants.RECEIPT_ASSERTCHECK));
assertTrue(sResponse.contains(AS4TestConstants.NON_REPUDIATION_INFORMATION));
}
use of com.helger.phase4.messaging.mime.AS4MimeMessage in project phase4 by phax.
the class AS4CEFOneWayFuncTest method testAS4_TA19.
/**
* Prerequisite:<br>
* eSENS_TA14.<br>
* The SMSH is simulated to send a compressed then encrypted AS4 message to
* the RMSH.<br>
* <br>
* Predicate: <br>
* The RMSH sends back an AS4 non-repudiation receipt.
*
* @throws Exception
* In case of error
*/
@Test
public void testAS4_TA19() throws Exception {
final ICommonsList<WSS4JAttachment> aAttachments = new CommonsArrayList<>();
aAttachments.add(WSS4JAttachment.createOutgoingFileAttachment(Phase4OutgoingAttachment.builder().data(ClassPathResource.getAsFile(AS4TestConstants.ATTACHMENT_SHORTXML_XML)).mimeTypeXML().build(), s_aResMgr));
final AS4UserMessage aMsg = MockMessages.createUserMessageNotSigned(m_eSoapVersion, null, aAttachments);
final AS4MimeMessage aMimeMsg = AS4Encryptor.encryptMimeMessage(m_eSoapVersion, aMsg.getAsSoapDocument(), aAttachments, m_aCryptoFactory, false, s_aResMgr, m_aCryptParams);
final String sResponse = sendMimeMessage(new HttpMimeMessageEntity(aMimeMsg), true, null);
assertTrue(sResponse.contains(AS4TestConstants.RECEIPT_ASSERTCHECK));
}
use of com.helger.phase4.messaging.mime.AS4MimeMessage in project phase4 by phax.
the class AS4CEFOneWayFuncTest method testAS4_TA21.
/**
* Prerequisite:<br>
* SMSH and RMSH are configured to exchange AS4 messages according to the
* e-SENS profile (One-Way/Push MEP). The SMSH sends an AS4 message with a
* compressed then encrypted and signed payload to the RMSH.<br>
* <br>
* Predicate: <br>
* The RMSH sends back an AS4 non-repudiation receipt.
*
* @throws Exception
* In case of error
*/
@Test
public void testAS4_TA21() throws Exception {
final ICommonsList<WSS4JAttachment> aAttachments = new CommonsArrayList<>();
aAttachments.add(WSS4JAttachment.createOutgoingFileAttachment(Phase4OutgoingAttachment.builder().data(ClassPathResource.getAsFile(AS4TestConstants.ATTACHMENT_SHORTXML_XML)).mimeTypeXML().compressionGZIP().build(), s_aResMgr));
final AS4UserMessage aMsg = MockMessages.createUserMessageNotSigned(m_eSoapVersion, null, aAttachments);
final Document aDoc = AS4Signer.createSignedMessage(m_aCryptoFactory, aMsg.getAsSoapDocument(null), m_eSoapVersion, aMsg.getMessagingID(), aAttachments, s_aResMgr, false, AS4SigningParams.createDefault());
final AS4MimeMessage aMimeMsg = AS4Encryptor.encryptMimeMessage(m_eSoapVersion, aDoc, aAttachments, m_aCryptoFactory, false, s_aResMgr, m_aCryptParams);
final String sResponse = sendMimeMessage(new HttpMimeMessageEntity(aMimeMsg), true, null);
assertTrue(sResponse.contains(AS4TestConstants.RECEIPT_ASSERTCHECK));
assertTrue(sResponse.contains(AS4TestConstants.NON_REPUDIATION_INFORMATION));
}
use of com.helger.phase4.messaging.mime.AS4MimeMessage in project phase4 by phax.
the class AS4CEFOneWayFuncTest method testAS4_TA09.
/**
* Prerequisite:<br>
* SMSH and RMSH are configured to exchange AS4 messages according to the
* e-SENS profile (One-Way/Push MEP). The SMSH is simulated to send an AS4
* message without property "MimeType" present to the RMSH.<br>
* <br>
* Predicate: <br>
* The RMSH sends a synchronous ebMS error response.
*
* @throws Exception
* In case of error
*/
@Test
public void testAS4_TA09() throws Exception {
final ICommonsList<WSS4JAttachment> aAttachments = new CommonsArrayList<>();
aAttachments.add(WSS4JAttachment.createOutgoingFileAttachment(Phase4OutgoingAttachment.builder().data(ClassPathResource.getAsFile(AS4TestConstants.ATTACHMENT_SHORTXML_XML)).mimeTypeXML().compressionGZIP().build(), s_aResMgr));
final Document aDoc = createTestSignedUserMessage(m_eSoapVersion, m_aPayload, aAttachments, s_aResMgr);
final NodeList aNL = aDoc.getElementsByTagName("eb:PartProperties");
aNL.item(0).removeChild(aNL.item(0).getFirstChild());
final AS4MimeMessage aMsg = MimeMessageCreator.generateMimeMessage(m_eSoapVersion, aDoc, aAttachments);
sendMimeMessage(new HttpMimeMessageEntity(aMsg), false, EEbmsError.EBMS_VALUE_INCONSISTENT.getErrorCode());
}
use of com.helger.phase4.messaging.mime.AS4MimeMessage in project phase4 by phax.
the class AS4eSENSCEFOneWayFuncTest method testEsens_TA06.
/**
* Prerequisite:<br>
* SMSH and RMSH are configured to exchange AS4 messages according to the
* e-SENS profile. (One-Way/Push MEP) Producer submits a message to the SMSH
* with metadata information, an XML payload (leading business document) and
* other payloads (XML and non XML). SMSH generates an AS4 message to send to
* the RMSH.<br>
* <br>
* Predicate: <br>
* In the AS4 message created by the SMSH, the compressed payloads are carried
* in separate MIME parts and the soap body is empty.
*
* @throws Exception
* In case of error
*/
@Test
public void testEsens_TA06() throws Exception {
// same stuff as TA05 only one step further
final ICommonsList<WSS4JAttachment> aAttachments = new CommonsArrayList<>();
aAttachments.add(WSS4JAttachment.createOutgoingFileAttachment(Phase4OutgoingAttachment.builder().data(ClassPathResource.getAsFile(AS4TestConstants.ATTACHMENT_SHORTXML_XML)).mimeTypeXML().compressionGZIP().build(), s_aResMgr));
aAttachments.add(WSS4JAttachment.createOutgoingFileAttachment(Phase4OutgoingAttachment.builder().data(ClassPathResource.getAsFile(AS4TestConstants.ATTACHMENT_TEST_IMG_JPG)).mimeType(CMimeType.IMAGE_JPG).compressionGZIP().build(), s_aResMgr));
aAttachments.add(WSS4JAttachment.createOutgoingFileAttachment(Phase4OutgoingAttachment.builder().data(ClassPathResource.getAsFile(AS4TestConstants.ATTACHMENT_SHORTXML2_XML)).mimeTypeXML().compressionGZIP().build(), s_aResMgr));
final AS4MimeMessage aMsg = MimeMessageCreator.generateMimeMessage(m_eSoapVersion, createTestSignedUserMessage(m_eSoapVersion, m_aPayload, aAttachments, s_aResMgr), aAttachments);
final Multipart aMultipart = (Multipart) aMsg.getContent();
// 3 attachments + 1 Main/Bodypart
assertTrue(aMultipart.getCount() == 4);
}
Aggregations