oodt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mattm...@apache.org
Subject [50/52] [abbrv] oodt git commit: Added cleaning up directories created when testing file manager
Date Wed, 30 Aug 2017 16:40:19 GMT
Added cleaning up directories created when testing file manager


Project: http://git-wip-us.apache.org/repos/asf/oodt/repo
Commit: http://git-wip-us.apache.org/repos/asf/oodt/commit/57e54465
Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/57e54465
Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/57e54465

Branch: refs/heads/master
Commit: 57e544658f0716395c78b3c0cdaa3875b1c2cdff
Parents: c437106
Author: Imesha Sudasingha <imesha.sudasingha@gmail.com>
Authored: Sat Aug 12 12:21:29 2017 +0530
Committer: Imesha Sudasingha <imesha.sudasingha@gmail.com>
Committed: Sat Aug 12 12:21:29 2017 +0530

----------------------------------------------------------------------
 .../TestDistributedXmlRpcFileManager.java       | 31 +++++++++++++++++++-
 .../distributed/config/filemgr.properties       |  2 +-
 2 files changed, 31 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oodt/blob/57e54465/filemgr/src/test/java/org/apache/oodt/cas/filemgr/config/distributed/TestDistributedXmlRpcFileManager.java
----------------------------------------------------------------------
diff --git a/filemgr/src/test/java/org/apache/oodt/cas/filemgr/config/distributed/TestDistributedXmlRpcFileManager.java
b/filemgr/src/test/java/org/apache/oodt/cas/filemgr/config/distributed/TestDistributedXmlRpcFileManager.java
index 3dd158b..19a8e56 100644
--- a/filemgr/src/test/java/org/apache/oodt/cas/filemgr/config/distributed/TestDistributedXmlRpcFileManager.java
+++ b/filemgr/src/test/java/org/apache/oodt/cas/filemgr/config/distributed/TestDistributedXmlRpcFileManager.java
@@ -26,6 +26,7 @@ import org.apache.oodt.cas.filemgr.system.XmlRpcFileManager;
 import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
 import org.apache.oodt.cas.metadata.Metadata;
 import org.apache.oodt.cas.metadata.SerializableMetadata;
+import org.apache.oodt.cas.metadata.util.PathUtils;
 import org.apache.oodt.config.distributed.cli.ConfigPublisher;
 import org.apache.oodt.config.test.AbstractDistributedConfigurationTest;
 import org.junit.After;
@@ -44,7 +45,16 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-// TODO: 8/10/17 Cleanup Dirs once done
+/**
+ * Tests the {@link XmlRpcFileManager} with distributed configuration management enabled.
This test will first publish
+ * the required configuration to zookeeper through {@link ConfigPublisher} and will start
the {@link XmlRpcFileManager}
+ * which will first download and store published files locally. Then the correct functionality
of {@link
+ * XmlRpcFileManager} is tested by using those downloaded configuration files for configuration.
+ * <p>
+ * This class is adapted from {@link org.apache.oodt.cas.filemgr.system.TestXmlRpcFileManager}
class
+ *
+ * @author Imesha Sudasingha
+ */
 public class TestDistributedXmlRpcFileManager extends AbstractDistributedConfigurationTest
{
 
     private static final int FM_PORT = 9001;
@@ -194,8 +204,27 @@ public class TestDistributedXmlRpcFileManager extends AbstractDistributedConfigu
                 "-a", "clear"
         });
 
+        String luceneIdx = System.getProperty("org.apache.oodt.cas.filemgr.catalog.lucene.idxPath");
+        if (luceneIdx != null) {
+            luceneIdx = PathUtils.replaceEnvVariables(luceneIdx);
+            deleteAllFiles(luceneIdx);
+        }
+
         System.clearProperty("org.apache.oodt.cas.cli.action.spring.config");
         System.clearProperty("org.apache.oodt.cas.cli.option.spring.config");
         System.clearProperty(ENABLE_DISTRIBUTED_CONFIGURATION);
     }
+
+    private void deleteAllFiles(String startDir) {
+        File startDirFile = new File(startDir);
+        File[] delFiles = startDirFile.listFiles();
+
+        if (delFiles != null && delFiles.length > 0) {
+            for (File delFile : delFiles) {
+                delFile.delete();
+            }
+        }
+
+        startDirFile.delete();
+    }
 }

http://git-wip-us.apache.org/repos/asf/oodt/blob/57e54465/filemgr/src/test/resources/distributed/config/filemgr.properties
----------------------------------------------------------------------
diff --git a/filemgr/src/test/resources/distributed/config/filemgr.properties b/filemgr/src/test/resources/distributed/config/filemgr.properties
index 2ca5096..9317129 100644
--- a/filemgr/src/test/resources/distributed/config/filemgr.properties
+++ b/filemgr/src/test/resources/distributed/config/filemgr.properties
@@ -63,7 +63,7 @@ org.apache.oodt.cas.filemgr.catalog.science.jdbc.pass=
 org.apache.oodt.cas.filemgr.catalog.science.jdbc.driver=org.hsqldb.jdbc.JDBCDriver
 
 # lucene catalog configuration
-org.apache.oodt.cas.filemgr.catalog.lucene.idxPath=target/tmp
+org.apache.oodt.cas.filemgr.catalog.lucene.idxPath=[FILEMGR_HOME]/target/tmp
 org.apache.oodt.cas.filemgr.catalog.lucene.pageSize=20
 org.apache.oodt.cas.filemgr.catalog.lucene.commitLockTimeout.seconds=60
 org.apache.oodt.cas.filemgr.catalog.lucene.writeLockTimeout.seconds=60


Mime
View raw message