You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ds...@apache.org on 2017/09/19 17:00:56 UTC
[geode] branch develop updated: GEODE-3626: Fix relative path
support for snapshots
This is an automated email from the ASF dual-hosted git repository.
dschneider pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/develop by this push:
new 280877a GEODE-3626: Fix relative path support for snapshots
280877a is described below
commit 280877a4a9a5a6ca933ed9b8d3bc0ab851bcff88
Author: Nick Reich <nr...@pivotal.io>
AuthorDate: Mon Sep 18 09:18:28 2017 -0700
GEODE-3626: Fix relative path support for snapshots
---
.../cache/snapshot/RegionSnapshotServiceImpl.java | 2 +-
.../cli/commands/ImportDataIntegrationTest.java | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/RegionSnapshotServiceImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/RegionSnapshotServiceImpl.java
index 0246d60..a22b5ad 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/RegionSnapshotServiceImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/RegionSnapshotServiceImpl.java
@@ -333,7 +333,7 @@ public class RegionSnapshotServiceImpl<K, V> implements RegionSnapshotService<K,
throw new IllegalArgumentException("Failure to export snapshot: "
+ snapshot.getCanonicalPath() + " is not a valid .gfd file");
}
- File directory = snapshot.getParentFile();
+ File directory = snapshot.getAbsoluteFile().getParentFile();
if (directory == null) {
throw new IllegalArgumentException("Failure to export snapshot: "
+ snapshot.getCanonicalPath() + " is not a valid location");
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ImportDataIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ImportDataIntegrationTest.java
index cdc5159..f776d1b 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ImportDataIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ImportDataIntegrationTest.java
@@ -19,7 +19,9 @@ package org.apache.geode.management.internal.cli.commands;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
+import java.nio.file.Files;
import java.nio.file.Path;
+import java.nio.file.Paths;
import java.util.stream.IntStream;
import org.junit.Before;
@@ -85,6 +87,22 @@ public class ImportDataIntegrationTest {
}
@Test
+ public void testExportImportRelativePath() throws Exception {
+ String exportCommand = buildBaseExportCommand()
+ .addOption(CliStrings.EXPORT_DATA__FILE, SNAPSHOT_FILE).getCommandString();
+ gfsh.executeAndVerifyCommand(exportCommand);
+
+ loadRegion("");
+
+ String importCommand = buildBaseImportCommand()
+ .addOption(CliStrings.IMPORT_DATA__FILE, SNAPSHOT_FILE).getCommandString();
+ gfsh.executeAndVerifyCommand(importCommand);
+ Files.deleteIfExists(Paths.get(SNAPSHOT_FILE));
+ assertThat(gfsh.getGfshOutput()).contains("Data imported from file");
+ validateImport("value");
+ }
+
+ @Test
public void testParallelExportImport() throws Exception {
String exportCommand =
buildBaseExportCommand().addOption(CliStrings.EXPORT_DATA__DIR, snapshotDir.toString())
--
To stop receiving notification emails like this one, please contact
['"commits@geode.apache.org" <co...@geode.apache.org>'].