本文整理汇总了Java中com.helger.commons.collection.impl.ICommonsList.add方法的典型用法代码示例。如果您正苦于以下问题:Java ICommonsList.add方法的具体用法?Java ICommonsList.add怎么用?Java ICommonsList.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.helger.commons.collection.impl.ICommonsList
的用法示例。
在下文中一共展示了ICommonsList.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testUserMessageOneAttachmentMimeSuccess
import com.helger.commons.collection.impl.ICommonsList; //导入方法依赖的package包/类
@Test
public void testUserMessageOneAttachmentMimeSuccess () throws Exception
{
final ICommonsList <WSS4JAttachment> aAttachments = new CommonsArrayList <> ();
final AS4ResourceManager aResMgr = s_aResMgr;
aAttachments.add (WSS4JAttachment.createOutgoingFileAttachment (ClassPathResource.getAsFile (AS4TestConstants.TEST_SOAP_BODY_PAYLOAD_XML),
CMimeType.APPLICATION_XML,
null,
aResMgr));
final MimeMessage aMsg = MimeMessageCreator.generateMimeMessage (m_eSOAPVersion,
MockMessages.testUserMessageSoapNotSigned (m_eSOAPVersion,
null,
aAttachments),
aAttachments);
final String sResponse = sendMimeMessage (new HttpMimeMessageEntity (aMsg), true, null);
assertTrue (sResponse.contains (AS4TestConstants.RECEIPT_ASSERTCHECK));
}
示例2: _convertExpressionList
import com.helger.commons.collection.impl.ICommonsList; //导入方法依赖的package包/类
@Nonnull
private static STXExpressionList _convertExpressionList (@Nonnull final STXNode aNode)
{
_expectNodeType (aNode, ParserSTXTreeConstants.JJTEXPR);
final int nChildCount = aNode.jjtGetNumChildren ();
if (nChildCount == 0)
_throwUnexpectedChildrenCount (aNode, "Expected at least 1 child!");
final ICommonsList <ISTXExpression> aExpressions = new CommonsArrayList<> ();
for (int i = 0; i < nChildCount; ++i)
{
final STXNode aChildNode = aNode.jjtGetChild (i);
aExpressions.add (_convertExpressionSingle (aChildNode));
}
final STXExpressionList ret = new STXExpressionList (aExpressions);
return ret;
}
示例3: testUserMessageOneAttachmentEncryptedMimeSuccess
import com.helger.commons.collection.impl.ICommonsList; //导入方法依赖的package包/类
@Test
public void testUserMessageOneAttachmentEncryptedMimeSuccess () throws Exception
{
final ICommonsList <WSS4JAttachment> aAttachments = new CommonsArrayList <> ();
final AS4ResourceManager aResMgr = s_aResMgr;
aAttachments.add (WSS4JAttachment.createOutgoingFileAttachment (ClassPathResource.getAsFile (AS4TestConstants.TEST_SOAP_BODY_PAYLOAD_XML),
CMimeType.APPLICATION_XML,
null,
aResMgr));
final MimeMessage aMsg = new EncryptionCreator (AS4CryptoFactory.DEFAULT_INSTANCE).encryptMimeMessage (m_eSOAPVersion,
MockMessages.testUserMessageSoapNotSigned (m_eSOAPVersion,
null,
aAttachments),
false,
aAttachments,
s_aResMgr,
ECryptoAlgorithmCrypt.ENCRPYTION_ALGORITHM_DEFAULT);
final String sResponse = sendMimeMessage (new HttpMimeMessageEntity (aMsg), true, null);
assertTrue (sResponse.contains (AS4TestConstants.RECEIPT_ASSERTCHECK));
}
示例4: eSENS_TA04
import com.helger.commons.collection.impl.ICommonsList; //导入方法依赖的package包/类
/**
* Prerequisite:<br>
* SMSH and RMSH are configured to exchange AS4 messages according to the
* e-SENS profile. (One-Way/Push MEP) SMSH is simulated to produce
* uncompressed payloads. The SMSH sends the AS4 message to the RMSH.<br>
* <br>
* Predicate: <br>
* The RMSH returns a non-repudiation receipt and delivers the message to the
* consumer. <br>
* <br>
* k Goal: Do not throw an error if a uncompressed payload gets sent, also
* check if compressed payloads are acceptable aswell.
*
* @throws Exception
* In case of error
*/
@Test
public void eSENS_TA04 () throws Exception
{
final ICommonsList <WSS4JAttachment> aAttachments = new CommonsArrayList <> ();
aAttachments.add (WSS4JAttachment.createOutgoingFileAttachment (ClassPathResource.getAsFile (AS4TestConstants.ATTACHMENT_SHORTXML_XML),
CMimeType.APPLICATION_XML,
null,
s_aResMgr));
final MimeMessage aMsg = MimeMessageCreator.generateMimeMessage (m_eSOAPVersion,
testSignedUserMessage (m_eSOAPVersion,
m_aPayload,
aAttachments,
new AS4ResourceManager ()),
aAttachments);
final String sResponse = sendMimeMessage (new HttpMimeMessageEntity (aMsg), true, null);
assertTrue (sResponse.contains (AS4TestConstants.RECEIPT_ASSERTCHECK));
assertTrue (sResponse.contains (AS4TestConstants.NON_REPUDIATION_INFORMATION));
}
示例5: AS4_TA15
import com.helger.commons.collection.impl.ICommonsList; //导入方法依赖的package包/类
/**
* Prerequisite:<br>
* SMSH and RMSH are configured to exchange AS4 messages according to the
* e-SENS profile (One-Way/Push MEP). SMSH sends an AS4 User Message with a
* compressed payload to the RMSH.<br>
* <br>
* Predicate: <br>
* The RMSH delivers the message with decompressed payload to the consumer.
*
* @throws Exception
* In case of error
*/
@Test
public void AS4_TA15 () throws Exception
{
final ICommonsList <WSS4JAttachment> aAttachments = new CommonsArrayList <> ();
aAttachments.add (WSS4JAttachment.createOutgoingFileAttachment (ClassPathResource.getAsFile (AS4TestConstants.ATTACHMENT_SHORTXML_XML),
CMimeType.APPLICATION_XML,
EAS4CompressionMode.GZIP,
s_aResMgr));
final Document aDoc = testSignedUserMessage (m_eSOAPVersion, m_aPayload, aAttachments, new AS4ResourceManager ());
final MimeMessage aMsg = MimeMessageCreator.generateMimeMessage (m_eSOAPVersion, aDoc, aAttachments);
sendMimeMessage (new HttpMimeMessageEntity (aMsg), true, null);
// How to check message if it is decompressed hmm?
}
示例6: testUserMessageFinalRecipientButNoOriginalSender
import com.helger.commons.collection.impl.ICommonsList; //导入方法依赖的package包/类
@Test
public void testUserMessageFinalRecipientButNoOriginalSender () throws Exception
{
final Ebms3MessageProperties aEbms3MessageProperties = new Ebms3MessageProperties ();
final ICommonsList <Ebms3Property> aEbms3Properties = MockEbmsHelper.getEBMSProperties ();
aEbms3Properties.removeIf (prop -> prop.getName ().equals (CAS4.ORIGINAL_SENDER));
assertEquals (1, aEbms3Properties.size ());
aEbms3Properties.add (_createRandomProperty ());
aEbms3MessageProperties.setProperty (aEbms3Properties);
m_aEbms3UserMessage.setMessageProperties (aEbms3MessageProperties);
final Document aDoc = UserMessageCreator.getUserMessageAsAS4UserMessage (m_eSOAPVersion, m_aEbms3UserMessage)
.setMustUnderstand (true)
.getAsSOAPDocument (m_aPayload);
sendPlainMessage (new HttpXMLEntity (aDoc, m_eSOAPVersion),
false,
"originalSender property is empty or not existant but mandatory");
}
示例7: eSENS_TA05
import com.helger.commons.collection.impl.ICommonsList; //导入方法依赖的package包/类
/**
* 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 an XML payload to the SMSH. SMSH generates an AS4 message
* to send to the RMSH.<br>
* <br>
* Predicate: <br>
* In the AS4 message created by the SMSH, the compressed payload is carried
* in a separate MIME part and the soap body is empty. <br>
* <br>
* Goal:"Due to the mandatory use of the AS4 compression feature in this
* profile (see section 2.2.3.3), XML payloads MAY be converted to binary
* data, which is carried in separate MIME parts and not in the SOAP Body.
* Compliant AS4 message always have an empty SOAP Body. "
*
* @throws Exception
* In case of error
*/
@Test
public void eSENS_TA05 () throws Exception
{
final ICommonsList <WSS4JAttachment> aAttachments = new CommonsArrayList <> ();
aAttachments.add (WSS4JAttachment.createOutgoingFileAttachment (ClassPathResource.getAsFile (AS4TestConstants.ATTACHMENT_SHORTXML_XML),
CMimeType.APPLICATION_XML,
EAS4CompressionMode.GZIP,
s_aResMgr));
final MimeMessage aMsg = MimeMessageCreator.generateMimeMessage (m_eSOAPVersion,
testSignedUserMessage (m_eSOAPVersion,
m_aPayload,
aAttachments,
new AS4ResourceManager ()),
aAttachments);
final String sResponse = sendMimeMessage (new HttpMimeMessageEntity (aMsg), true, null);
assertTrue (sResponse.contains (AS4TestConstants.RECEIPT_ASSERTCHECK));
assertTrue (sResponse.contains (AS4TestConstants.NON_REPUDIATION_INFORMATION));
}
示例8: testUserMessageWithCompressedAttachmentSuccessful
import com.helger.commons.collection.impl.ICommonsList; //导入方法依赖的package包/类
@Category (IHolodeckTests.class)
@Test
public void testUserMessageWithCompressedAttachmentSuccessful () throws Exception
{
final ICommonsList <WSS4JAttachment> aAttachments = new CommonsArrayList <> ();
aAttachments.add (WSS4JAttachment.createOutgoingFileAttachment (ClassPathResource.getAsFile (AS4TestConstants.TEST_SOAP_BODY_PAYLOAD_XML),
CMimeType.APPLICATION_XML,
EAS4CompressionMode.GZIP,
s_aResMgr));
final MimeMessage aMsg = MimeMessageCreator.generateMimeMessage (m_eSOAPVersion,
MockMessages.testUserMessageSoapNotSigned (m_eSOAPVersion,
null,
aAttachments),
aAttachments);
sendMimeMessage (new HttpMimeMessageEntity (aMsg), true, null);
}
示例9: _convertSimpleForClause
import com.helger.commons.collection.impl.ICommonsList; //导入方法依赖的package包/类
@Nonnull
private static ICommonsList <STXVarNameAndExpression> _convertSimpleForClause (@Nonnull final STXNode aNode)
{
_expectNodeType (aNode, ParserSTXTreeConstants.JJTSIMPLEFORCLAUSE);
final int nChildCount = aNode.jjtGetNumChildren ();
if (nChildCount < 2)
_throwUnexpectedChildrenCount (aNode, "Expected at least 2 children!");
if ((nChildCount % 2) != 0)
_throwUnexpectedChildrenCount (aNode, "Expected an even number of children!");
final ICommonsList <STXVarNameAndExpression> ret = new CommonsArrayList<> ();
for (int i = 0; i < nChildCount; i += 2)
{
final ParserQName aVarName = _convertVarName (aNode.jjtGetChild (i));
final ISTXExpression aExpression = _convertExpressionSingle (aNode.jjtGetChild (i + 1));
ret.add (new STXVarNameAndExpression (aVarName, aExpression));
}
return ret;
}
示例10: AS4_TA18
import com.helger.commons.collection.impl.ICommonsList; //导入方法依赖的package包/类
/**
* Prerequisite:<br>
* eSENS_TA13<br>
* Simulated SMSH sends a signed AS4 User Message with a signed then
* compressed payload to the RMSH.<br>
* <br>
* Predicate: <br>
* The SMSH receives a WS-Security SOAP Fault.
*
* @throws Exception
* In case of error
*/
@Test
public void AS4_TA18 () throws Exception
{
// signed then compressed
// Should return an error because the uncompressed attachment was signed and
// not the compressed one
ICommonsList <WSS4JAttachment> aAttachments = new CommonsArrayList <> ();
aAttachments.add (WSS4JAttachment.createOutgoingFileAttachment (ClassPathResource.getAsFile (AS4TestConstants.ATTACHMENT_SHORTXML_XML),
CMimeType.APPLICATION_XML,
null,
s_aResMgr));
final Document aDoc = testSignedUserMessage (m_eSOAPVersion, m_aPayload, aAttachments, new AS4ResourceManager ());
aAttachments = new CommonsArrayList <> ();
aAttachments.add (WSS4JAttachment.createOutgoingFileAttachment (ClassPathResource.getAsFile (AS4TestConstants.ATTACHMENT_SHORTXML_XML),
CMimeType.APPLICATION_XML,
EAS4CompressionMode.GZIP,
s_aResMgr));
final MimeMessage aMsg = MimeMessageCreator.generateMimeMessage (m_eSOAPVersion, aDoc, aAttachments);
sendMimeMessage (new HttpMimeMessageEntity (aMsg), false, EEbmsError.EBMS_VALUE_INCONSISTENT.getErrorCode ());
}
示例11: testUserMessageDifferentPropertiesValues
import com.helger.commons.collection.impl.ICommonsList; //导入方法依赖的package包/类
@Test
public void testUserMessageDifferentPropertiesValues () throws Exception
{
final Ebms3MessageProperties aEbms3MessageProperties = new Ebms3MessageProperties ();
final ICommonsList <Ebms3Property> aEbms3Properties = new CommonsArrayList <> ();
aEbms3Properties.add (_createRandomProperty ());
aEbms3MessageProperties.setProperty (aEbms3Properties);
m_aEbms3UserMessage.setMessageProperties (aEbms3MessageProperties);
final Document aDoc = UserMessageCreator.getUserMessageAsAS4UserMessage (m_eSOAPVersion, m_aEbms3UserMessage)
.setMustUnderstand (true)
.getAsSOAPDocument (m_aPayload);
sendPlainMessage (new HttpXMLEntity (aDoc, m_eSOAPVersion), false, "");
}
示例12: testWrongAttachmentIDShouldFail
import com.helger.commons.collection.impl.ICommonsList; //导入方法依赖的package包/类
@Test
public void testWrongAttachmentIDShouldFail () throws Exception
{
final ICommonsList <WSS4JAttachment> aAttachments = new CommonsArrayList <> ();
final AS4ResourceManager aResMgr = s_aResMgr;
aAttachments.add (WSS4JAttachment.createOutgoingFileAttachment (ClassPathResource.getAsFile (AS4TestConstants.ATTACHMENT_TEST_XML_GZ),
CMimeType.APPLICATION_GZIP,
null,
aResMgr));
final Document aDoc = SignedMessageCreator.createSignedMessage (AS4CryptoFactory.DEFAULT_INSTANCE,
MockMessages.testUserMessageSoapNotSigned (m_eSOAPVersion,
null,
aAttachments),
m_eSOAPVersion,
aAttachments,
s_aResMgr,
false,
ECryptoAlgorithmSign.SIGN_ALGORITHM_DEFAULT,
ECryptoAlgorithmSignDigest.SIGN_DIGEST_ALGORITHM_DEFAULT);
final NodeList nList = aDoc.getElementsByTagName ("eb:PartInfo");
for (int i = 0; i < nList.getLength (); i++)
{
final Node nNode = nList.item (i);
final Element aElement = (Element) nNode;
if (aElement.hasAttribute ("href"))
aElement.setAttribute ("href", UserMessageCreator.PREFIX_CID + "invalid" + i);
}
final MimeMessage aMsg = MimeMessageCreator.generateMimeMessage (m_eSOAPVersion, aDoc, aAttachments);
sendMimeMessage (new HttpMimeMessageEntity (aMsg), false, EEbmsError.EBMS_VALUE_INCONSISTENT.getErrorCode ());
}
示例13: testUserMessageSoapNotSigned
import com.helger.commons.collection.impl.ICommonsList; //导入方法依赖的package包/类
public static Document testUserMessageSoapNotSigned (@Nonnull final ESOAPVersion eSOAPVersion,
@Nullable final Node aPayload,
@Nullable final ICommonsList <WSS4JAttachment> aAttachments)
{
// Add properties
final ICommonsList <Ebms3Property> aEbms3Properties = new CommonsArrayList <> ();
aEbms3Properties.add (MessageHelperMethods.createEbms3Property ("ProcessInst", "PurchaseOrder:123456"));
aEbms3Properties.add (MessageHelperMethods.createEbms3Property ("ContextID", "987654321"));
final Ebms3MessageInfo aEbms3MessageInfo = MessageHelperMethods.createEbms3MessageInfo ();
final Ebms3PayloadInfo aEbms3PayloadInfo = UserMessageCreator.createEbms3PayloadInfo (aPayload, aAttachments);
final Ebms3CollaborationInfo aEbms3CollaborationInfo = UserMessageCreator.createEbms3CollaborationInfo ("NewPurchaseOrder",
"MyServiceTypes",
"QuoteToCollect",
"4321",
"pmode-twoway",
MockEbmsHelper.DEFAULT_AGREEMENT);
final Ebms3PartyInfo aEbms3PartyInfo = UserMessageCreator.createEbms3PartyInfo (CAS4.DEFAULT_SENDER_URL,
"1234",
CAS4.DEFAULT_RESPONDER_URL,
"5678");
final Ebms3MessageProperties aEbms3MessageProperties = UserMessageCreator.createEbms3MessageProperties (aEbms3Properties);
final AS4UserMessage aDoc = UserMessageCreator.createUserMessage (aEbms3MessageInfo,
aEbms3PayloadInfo,
aEbms3CollaborationInfo,
aEbms3PartyInfo,
aEbms3MessageProperties,
eSOAPVersion)
.setMustUnderstand (true);
return aDoc.getAsSOAPDocument (aPayload);
}
示例14: receiveUserMessageWithMimeAsResponseSuccess
import com.helger.commons.collection.impl.ICommonsList; //导入方法依赖的package包/类
@Test
public void receiveUserMessageWithMimeAsResponseSuccess () throws Exception
{
final ICommonsList <WSS4JAttachment> aAttachments = new CommonsArrayList <> ();
final AS4ResourceManager aResMgr = s_aResMgr;
aAttachments.add (WSS4JAttachment.createOutgoingFileAttachment (ClassPathResource.getAsFile (AS4TestConstants.TEST_SOAP_BODY_PAYLOAD_XML),
CMimeType.APPLICATION_XML,
null,
aResMgr));
final Document aDoc = _modifyUserMessage (m_aPMode.getID (), null, null, _defaultProperties (), aAttachments);
final MimeMessage aMimeMsg = MimeMessageCreator.generateMimeMessage (m_eSOAPVersion, aDoc, aAttachments);
final String sResponse = sendMimeMessage (new HttpMimeMessageEntity (aMimeMsg), true, null);
assertTrue (sResponse.contains (AS4TestConstants.USERMESSAGE_ASSERTCHECK));
assertFalse (sResponse.contains (AS4TestConstants.RECEIPT_ASSERTCHECK));
assertTrue (sResponse.contains (m_aPMode.getLeg2 ()
.getSecurity ()
.getX509SignatureAlgorithm ()
.getAlgorithmURI ()));
// Checking if he adds the attachment to the response message, the mock spi
// just adds the xml that gets sent in the original message and adds it to
// the response
assertTrue (sResponse.contains (m_aPMode.getLeg2 ()
.getSecurity ()
.getX509EncryptionAlgorithm ()
.getAlgorithmURI ()));
}
示例15: emptyUserMessage
import com.helger.commons.collection.impl.ICommonsList; //导入方法依赖的package包/类
@Nullable
@SuppressFBWarnings ("NP_NONNULL_PARAM_VIOLATION")
public static Document emptyUserMessage (@Nonnull final ESOAPVersion eSOAPVersion,
@Nullable final Node aPayload,
@Nullable final ICommonsList <WSS4JAttachment> aAttachments)
{
// Add properties
final ICommonsList <Ebms3Property> aEbms3Properties = new CommonsArrayList <> ();
final Ebms3Property aEbms3PropertyProcess = new Ebms3Property ();
aEbms3Properties.add (aEbms3PropertyProcess);
// Use an empty message info by purpose
final Ebms3MessageInfo aEbms3MessageInfo = MessageHelperMethods.createEbms3MessageInfo ();
final Ebms3PayloadInfo aEbms3PayloadInfo = UserMessageCreator.createEbms3PayloadInfo (aPayload, aAttachments);
final Ebms3CollaborationInfo aEbms3CollaborationInfo = UserMessageCreator.createEbms3CollaborationInfo (null,
null,
null,
null,
null,
null);
final Ebms3PartyInfo aEbms3PartyInfo = UserMessageCreator.createEbms3PartyInfo ("", "", "", "");
final Ebms3MessageProperties aEbms3MessageProperties = UserMessageCreator.createEbms3MessageProperties (aEbms3Properties);
final AS4UserMessage aDoc = UserMessageCreator.createUserMessage (aEbms3MessageInfo,
aEbms3PayloadInfo,
aEbms3CollaborationInfo,
aEbms3PartyInfo,
aEbms3MessageProperties,
eSOAPVersion)
.setMustUnderstand (true);
return aDoc.getAsSOAPDocument (aPayload);
}