This is an automated email from the ASF dual-hosted git repository.
btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
The following commit(s) were added to refs/heads/master by this push:
new e35214d JAMES-2684 returning absolute path of exported file
e35214d is described below
commit e35214d4371b209a003964c898dc4ad658409cc0
Author: Tran Tien Duc <[email protected]>
AuthorDate: Mon Apr 1 11:40:19 2019 +0700
JAMES-2684 returning absolute path of exported file
---
.../export/file/LocalFileBlobExportMechanism.java | 2 +-
.../export/file/LocalFileBlobExportMechanismTest.java | 5 +++--
.../methods/integration/DeletedMessagesVaultTest.java | 19 ++++++++++---------
3 files changed, 14 insertions(+), 12 deletions(-)
diff --git
a/server/blob/blob-export-file/src/main/java/org/apache/james/blob/export/file/LocalFileBlobExportMechanism.java
b/server/blob/blob-export-file/src/main/java/org/apache/james/blob/export/file/LocalFileBlobExportMechanism.java
index c432575..5982c5b 100644
---
a/server/blob/blob-export-file/src/main/java/org/apache/james/blob/export/file/LocalFileBlobExportMechanism.java
+++
b/server/blob/blob-export-file/src/main/java/org/apache/james/blob/export/file/LocalFileBlobExportMechanism.java
@@ -90,7 +90,7 @@ public class LocalFileBlobExportMechanism implements
BlobExportMechanism {
File file = fileSystem.getFile(fileURL);
FileUtils.copyToFile(blobStore.read(blobId), file);
- return fileURL;
+ return file.getAbsolutePath();
} catch (IOException e) {
throw new BlobExportException("Error while copying blob to file",
e);
}
diff --git
a/server/blob/blob-export-file/src/test/java/org/apache/james/blob/export/file/LocalFileBlobExportMechanismTest.java
b/server/blob/blob-export-file/src/test/java/org/apache/james/blob/export/file/LocalFileBlobExportMechanismTest.java
index f1485b9..b824afa 100644
---
a/server/blob/blob-export-file/src/test/java/org/apache/james/blob/export/file/LocalFileBlobExportMechanismTest.java
+++
b/server/blob/blob-export-file/src/test/java/org/apache/james/blob/export/file/LocalFileBlobExportMechanismTest.java
@@ -25,6 +25,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.io.ByteArrayInputStream;
+import java.io.FileInputStream;
import java.net.InetAddress;
import java.nio.charset.StandardCharsets;
@@ -116,9 +117,9 @@ class LocalFileBlobExportMechanismTest {
.element(0)
.satisfies(sentMail -> {
try {
- String fileUrl =
sentMail.getMsg().getHeader(LocalFileBlobExportMechanism.CORRESPONDING_FILE_HEADER)[0];
+ String absoluteUrl =
sentMail.getMsg().getHeader(LocalFileBlobExportMechanism.CORRESPONDING_FILE_HEADER)[0];
-
assertThat(fileSystem.getResource(fileUrl)).hasSameContentAs(new
ByteArrayInputStream(BLOB_CONTENT));
+ assertThat(new
FileInputStream(absoluteUrl)).hasSameContentAs(new
ByteArrayInputStream(BLOB_CONTENT));
} catch (Exception e) {
throw new RuntimeException(e);
}
diff --git
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/DeletedMessagesVaultTest.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/DeletedMessagesVaultTest.java
index b57c559..6c76951 100644
---
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/DeletedMessagesVaultTest.java
+++
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/DeletedMessagesVaultTest.java
@@ -37,6 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.is;
+import java.io.FileInputStream;
import java.io.IOException;
import java.util.List;
import java.util.stream.Collectors;
@@ -466,7 +467,7 @@ public abstract class DeletedMessagesVaultTest {
String fileLocation =
exportAndGetFileLocationFromLastMail(EXPORT_ALL_HOMER_MESSAGES_TO_BART,
bartAccessToken);
- try (ZipAssert zipAssert =
assertThatZip(fileSystem.getResource(fileLocation))) {
+ try (ZipAssert zipAssert = assertThatZip(new
FileInputStream(fileLocation))) {
zipAssert.hasEntriesSize(1)
.allSatisfies(entry -> entry.hasName(messageIdOfHomer +
".eml"));
}
@@ -489,7 +490,7 @@ public abstract class DeletedMessagesVaultTest {
String fileLocation =
exportAndGetFileLocationFromLastMail(EXPORT_ALL_HOMER_MESSAGES_TO_BART,
bartAccessToken);
- try (ZipAssert zipAssert =
assertThatZip(fileSystem.getResource(fileLocation))) {
+ try (ZipAssert zipAssert = assertThatZip(new
FileInputStream(fileLocation))) {
zipAssert.hasEntriesSize(1)
.allSatisfies(entry -> entry.hasName(messageIdOfHomer +
".eml"));
}
@@ -514,7 +515,7 @@ public abstract class DeletedMessagesVaultTest {
String fileLocation =
exportAndGetFileLocationFromLastMail(EXPORT_ALL_HOMER_MESSAGES_TO_BART,
bartAccessToken);
- try (ZipAssert zipAssert =
assertThatZip(fileSystem.getResource(fileLocation))) {
+ try (ZipAssert zipAssert = assertThatZip(new
FileInputStream(fileLocation))) {
zipAssert.hasEntriesSize(1)
.allSatisfies(entry -> entry.hasName(messageIdOfHomer +
".eml"));
}
@@ -543,7 +544,7 @@ public abstract class DeletedMessagesVaultTest {
"}");
String fileLocation =
exportAndGetFileLocationFromLastMail(exportRequest, bartAccessToken);
- try (ZipAssert zipAssert =
assertThatZip(fileSystem.getResource(fileLocation))) {
+ try (ZipAssert zipAssert = assertThatZip(new
FileInputStream(fileLocation))) {
zipAssert.containsOnlyEntriesMatching(hasName(firstMessageIdOfHomer + ".eml"));
}
}
@@ -567,7 +568,7 @@ public abstract class DeletedMessagesVaultTest {
"}");
String fileLocation =
exportAndGetFileLocationFromLastMail(exportRequest, bartAccessToken);
- try (ZipAssert zipAssert =
assertThatZip(fileSystem.getResource(fileLocation))) {
+ try (ZipAssert zipAssert = assertThatZip(new
FileInputStream(fileLocation))) {
zipAssert.hasNoEntry();
}
}
@@ -576,7 +577,7 @@ public abstract class DeletedMessagesVaultTest {
public void vaultExportShouldExportEmptyZipWhenVaultIsEmpty() throws
Exception {
String fileLocation =
exportAndGetFileLocationFromLastMail(EXPORT_ALL_HOMER_MESSAGES_TO_BART,
bartAccessToken);
- try (ZipAssert zipAssert =
assertThatZip(fileSystem.getResource(fileLocation))) {
+ try (ZipAssert zipAssert = assertThatZip(new
FileInputStream(fileLocation))) {
zipAssert.hasNoEntry();
}
}
@@ -592,8 +593,8 @@ public abstract class DeletedMessagesVaultTest {
String fileLocationFirstExport =
exportAndGetFileLocationFromLastMail(EXPORT_ALL_HOMER_MESSAGES_TO_BART,
bartAccessToken);
String fileLocationSecondExport =
exportAndGetFileLocationFromLastMail(EXPORT_ALL_HOMER_MESSAGES_TO_BART,
bartAccessToken);
- try (ZipAssert zipAssert =
assertThatZip(fileSystem.getResource(fileLocationFirstExport))) {
-
zipAssert.hasSameContentWith(fileSystem.getResource(fileLocationSecondExport));
+ try (ZipAssert zipAssert = assertThatZip(new
FileInputStream(fileLocationFirstExport))) {
+ zipAssert.hasSameContentWith(new
FileInputStream(fileLocationSecondExport));
}
}
@@ -603,8 +604,8 @@ public abstract class DeletedMessagesVaultTest {
WAIT_TWO_MINUTES.until(() ->
listMessageIdsForAccount(shareeAccessToken).size() == currentNumberOfMessages +
1);
String exportingMessageId = getLastMessageId(shareeAccessToken);
- return exportedFileLocationFromMailHeader(exportingMessageId,
shareeAccessToken);
+ return exportedFileLocationFromMailHeader(exportingMessageId,
shareeAccessToken);
}
private String exportedFileLocationFromMailHeader(String messageId,
AccessToken accessToken) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]