1
0
mirror of https://github.com/sismics/docs.git synced 2025-12-18 20:21:41 +00:00

#177: import document from EML file (wip)

This commit is contained in:
Benjamin Gamard
2018-02-21 21:47:57 +01:00
parent 5d335049a2
commit d3a40ebca8
11 changed files with 9805 additions and 314 deletions

View File

@@ -602,4 +602,29 @@ public class TestDocumentResource extends BaseJerseyTest {
Assert.assertTrue(fileBytes.length > 0); // Images rendered from PDF differ in size from OS to OS due to font issues
Assert.assertEquals(MimeType.IMAGE_JPEG, MimeTypeUtil.guessMimeType(fileBytes, null));
}
/**
* Test EML import.
*
* @throws Exception e
*/
@Test
public void testEmlImport() throws Exception {
// Login document_eml
clientUtil.createUser("document_eml");
String documentEmlToken = clientUtil.login("document_eml");
// Import a document as EML
try (InputStream is = Resources.getResource("file/test_mail.eml").openStream()) {
StreamDataBodyPart streamDataBodyPart = new StreamDataBodyPart("file", is, "test_mail.eml");
try (FormDataMultiPart multiPart = new FormDataMultiPart()) {
target()
.register(MultiPartFeature.class)
.path("/document/eml").request()
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, documentEmlToken)
.put(Entity.entity(multiPart.bodyPart(streamDataBodyPart),
MediaType.MULTIPART_FORM_DATA_TYPE), JsonObject.class);
}
}
}
}

File diff suppressed because it is too large Load Diff