You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by re...@apache.org on 2024/09/24 15:20:40 UTC
(jackrabbit-filevault) branch master updated: JCRVLT-784: BinaryPropertiesIT.exportBinary: improve diagnostics when entry is missing (#354)
This is an automated email from the ASF dual-hosted git repository.
reschke pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault.git
The following commit(s) were added to refs/heads/master by this push:
new 6c63c463 JCRVLT-784: BinaryPropertiesIT.exportBinary: improve diagnostics when entry is missing (#354)
6c63c463 is described below
commit 6c63c463180b04fd7c994be8263a8195aa8a8431
Author: Julian Reschke <ju...@gmx.de>
AuthorDate: Tue Sep 24 17:20:36 2024 +0200
JCRVLT-784: BinaryPropertiesIT.exportBinary: improve diagnostics when entry is missing (#354)
---
.../packaging/integration/BinaryPropertiesIT.java | 34 ++++++++++++++++------
1 file changed, 25 insertions(+), 9 deletions(-)
diff --git a/vault-core-it/vault-core-integration-tests/src/main/java/org/apache/jackrabbit/vault/packaging/integration/BinaryPropertiesIT.java b/vault-core-it/vault-core-integration-tests/src/main/java/org/apache/jackrabbit/vault/packaging/integration/BinaryPropertiesIT.java
index 446960bd..8a09e727 100644
--- a/vault-core-it/vault-core-integration-tests/src/main/java/org/apache/jackrabbit/vault/packaging/integration/BinaryPropertiesIT.java
+++ b/vault-core-it/vault-core-integration-tests/src/main/java/org/apache/jackrabbit/vault/packaging/integration/BinaryPropertiesIT.java
@@ -228,25 +228,41 @@ public class BinaryPropertiesIT extends IntegrationTestBase {
return packMgr.assemble(admin, opts, tmpFile);
}
+ private void getArchiveContents(List<String> list, String path, Archive.Entry entry) {
+ String fullname = path + entry.getName();
+ list.add(fullname);
+ for (Archive.Entry en : entry.getChildren()) {
+ getArchiveContents(list, fullname + "/", en);
+ }
+ }
+
+ private void checkExistingMember(Archive archive, String member, List<String> existing) throws IOException {
+ String message = "Member '" + member + "' missing (present are: " + existing + ")";
+ assertNotNull(message, archive.getEntry(member));
+ }
+
@Test
public void exportBinary() throws RepositoryException, IOException, PackageException {
String nodePath = binaryNodePath;
try (VaultPackage pkg = assemblePackage(exportBinaryNodePath)) {
+ List<String> present = new ArrayList<>();
+ getArchiveContents(present, "[root]", pkg.getArchive().getRoot());
+
if (useBinaryReferences) {
// make sure that only non-reference binaries are in dedicated artifacts
assertNull(pkg.getArchive().getEntry("jcr_root" + binaryNodePath + "/" + BIG_BINARY_PROPERTY + ".binary"));
assertNull(pkg.getArchive().getEntry("jcr_root" + binaryNodePath + "/" + BIG_BINARY_MV_PROPERTY + "[0].binary"));
assertNull(pkg.getArchive().getEntry("jcr_root" + binaryNodePath + "/" + BIG_BINARY_MV_PROPERTY + "[1].binary"));
- assertNotNull(pkg.getArchive().getEntry("jcr_root"+ binaryNodePath + "/" + SMALL_BINARY_PROPERTY + ".binary"));
- assertNotNull(pkg.getArchive().getEntry("jcr_root"+ binaryNodePath + "/" + SMALL_BINARY_MV_PROPERTY + "[0].binary"));
- assertNotNull(pkg.getArchive().getEntry("jcr_root"+ binaryNodePath + "/" + SMALL_BINARY_MV_PROPERTY + "[1].binary"));
+ checkExistingMember(pkg.getArchive(), "jcr_root"+ binaryNodePath + "/" + SMALL_BINARY_PROPERTY + ".binary", present);
+ checkExistingMember(pkg.getArchive(), "jcr_root"+ binaryNodePath + "/" + SMALL_BINARY_MV_PROPERTY + "[0].binary", present);
+ checkExistingMember(pkg.getArchive(), "jcr_root"+ binaryNodePath + "/" + SMALL_BINARY_MV_PROPERTY + "[1].binary", present);
} else {
- assertNotNull(pkg.getArchive().getEntry("jcr_root" + binaryNodePath + "/" + BIG_BINARY_PROPERTY + ".binary"));
- assertNotNull(pkg.getArchive().getEntry("jcr_root" + binaryNodePath + "/" + BIG_BINARY_MV_PROPERTY + "[0].binary"));
- assertNotNull(pkg.getArchive().getEntry("jcr_root" + binaryNodePath + "/" + BIG_BINARY_MV_PROPERTY + "[1].binary"));
- assertNotNull(pkg.getArchive().getEntry("jcr_root"+ binaryNodePath + "/" + SMALL_BINARY_PROPERTY + ".binary"));
- assertNotNull(pkg.getArchive().getEntry("jcr_root"+ binaryNodePath + "/" + SMALL_BINARY_MV_PROPERTY + "[0].binary"));
- assertNotNull(pkg.getArchive().getEntry("jcr_root"+ binaryNodePath + "/" + SMALL_BINARY_MV_PROPERTY + "[1].binary"));
+ checkExistingMember(pkg.getArchive(), "jcr_root" + binaryNodePath + "/" + BIG_BINARY_PROPERTY + ".binary", present);
+ checkExistingMember(pkg.getArchive(), "jcr_root" + binaryNodePath + "/" + BIG_BINARY_MV_PROPERTY + "[0].binary", present);
+ checkExistingMember(pkg.getArchive(), "jcr_root" + binaryNodePath + "/" + BIG_BINARY_MV_PROPERTY + "[1].binary", present);
+ checkExistingMember(pkg.getArchive(), "jcr_root"+ binaryNodePath + "/" + SMALL_BINARY_PROPERTY + ".binary", present);
+ checkExistingMember(pkg.getArchive(), "jcr_root"+ binaryNodePath + "/" + SMALL_BINARY_MV_PROPERTY + "[0].binary", present);
+ checkExistingMember(pkg.getArchive(), "jcr_root"+ binaryNodePath + "/" + SMALL_BINARY_MV_PROPERTY + "[1].binary", present);
}
clean(nodePath);
pkg.extract(admin, getDefaultOptions());