use of javax.mail.internet.MimeMultipart in project rest.li by linkedin.
the class TestMIMEIntegrationReader method testMultipleAbnormalBodies.
@Test(dataProvider = "multipleAbnormalBodies")
public void testMultipleAbnormalBodies(final int chunkSize, final List<MimeBodyPart> bodyPartList) throws Exception {
MimeMultipart multiPartMimeBody = new MimeMultipart();
//Add your body parts
for (final MimeBodyPart bodyPart : bodyPartList) {
multiPartMimeBody.addBodyPart(bodyPart);
}
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
multiPartMimeBody.writeTo(byteArrayOutputStream);
final ByteString requestPayload = ByteString.copy(byteArrayOutputStream.toByteArray());
executeRequestAndAssert(trimTrailingCRLF(requestPayload), chunkSize, multiPartMimeBody);
}
use of javax.mail.internet.MimeMultipart in project rest.li by linkedin.
the class TestMIMEIntegrationReader method testAllTypesOfBodiesDataSource.
@Test(dataProvider = "allTypesOfBodiesDataSource")
public void testAllTypesOfBodiesDataSource(final int chunkSize, final List<MimeBodyPart> bodyPartList) throws Exception {
MimeMultipart multiPartMimeBody = new MimeMultipart();
//Add your body parts
for (final MimeBodyPart bodyPart : bodyPartList) {
multiPartMimeBody.addBodyPart(bodyPart);
}
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
multiPartMimeBody.writeTo(byteArrayOutputStream);
final ByteString requestPayload = ByteString.copy(byteArrayOutputStream.toByteArray());
executeRequestAndAssert(trimTrailingCRLF(requestPayload), chunkSize, multiPartMimeBody);
}
use of javax.mail.internet.MimeMultipart in project rest.li by linkedin.
the class TestMIMEIntegrationReader method testMultipleNormalBodiesDataSource.
@Test(dataProvider = "multipleNormalBodiesDataSource")
public void testMultipleNormalBodiesDataSource(final int chunkSize, final List<MimeBodyPart> bodyPartList) throws Exception {
MimeMultipart multiPartMimeBody = new MimeMultipart();
//Add your body parts
for (final MimeBodyPart bodyPart : bodyPartList) {
multiPartMimeBody.addBodyPart(bodyPart);
}
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
multiPartMimeBody.writeTo(byteArrayOutputStream);
final ByteString requestPayload = ByteString.copy(byteArrayOutputStream.toByteArray());
executeRequestAndAssert(trimTrailingCRLF(requestPayload), chunkSize, multiPartMimeBody);
}
use of javax.mail.internet.MimeMultipart in project rest.li by linkedin.
the class TestMIMEIntegrationReader method testEachSingleBodyDataSourceMultipleTimes.
@Test(dataProvider = "eachSingleBodyDataSource")
public void testEachSingleBodyDataSourceMultipleTimes(final int chunkSize, final MimeBodyPart bodyPart) throws Exception {
MimeMultipart multiPartMimeBody = new MimeMultipart();
//Add your body parts
multiPartMimeBody.addBodyPart(bodyPart);
multiPartMimeBody.addBodyPart(bodyPart);
multiPartMimeBody.addBodyPart(bodyPart);
multiPartMimeBody.addBodyPart(bodyPart);
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
multiPartMimeBody.writeTo(byteArrayOutputStream);
final ByteString requestPayload = ByteString.copy(byteArrayOutputStream.toByteArray());
executeRequestAndAssert(trimTrailingCRLF(requestPayload), chunkSize, multiPartMimeBody);
}
use of javax.mail.internet.MimeMultipart in project rest.li by linkedin.
the class TestMIMEReader method testStackOverflow.
///////////////////////////////////////////////////////////////////////////////////////
//Special test to make sure we don't stack overflow.
//Have tons of small parts that are all read in at once due to the huge chunk size.
@Test
public void testStackOverflow() throws Exception {
MimeMultipart multiPartMimeBody = new MimeMultipart();
_testTimeout = 600000;
//does not lead to a stack overflow.
for (int i = 0; i < 5000; i++) {
multiPartMimeBody.addBodyPart(TINY_DATA_SOURCE);
}
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
multiPartMimeBody.writeTo(byteArrayOutputStream);
final ByteString requestPayload = ByteString.copy(byteArrayOutputStream.toByteArray());
executeRequestAndAssert(trimTrailingCRLF(requestPayload), Integer.MAX_VALUE, multiPartMimeBody);
}
Aggregations