You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by ma...@apache.org on 2017/09/03 20:06:04 UTC

oodt git commit: Fix ZK test with new Avro layer in FM.

Repository: oodt
Updated Branches:
  refs/heads/development 9b0b61ec0 -> 4382d9d0f


Fix ZK test with new Avro layer in FM.


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

Branch: refs/heads/development
Commit: 4382d9d0fa477fd9f4f65c8a01221364565c0321
Parents: 9b0b61e
Author: Chris Mattmann <ma...@apache.org>
Authored: Sun Sep 3 13:06:01 2017 -0700
Committer: Chris Mattmann <ma...@apache.org>
Committed: Sun Sep 3 13:06:01 2017 -0700

----------------------------------------------------------------------
 core/pom.xml                                    |  4 +--
 .../oodt/cas/filemgr/system/FileManager.java    | 31 ++++++++++++++------
 .../TestDistributedXmlRpcFileManager.java       | 13 ++++++--
 3 files changed, 35 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oodt/blob/4382d9d0/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index 91f95ce..ba8e69b 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -429,12 +429,12 @@ the License.
       <dependency>
         <groupId>org.apache.solr</groupId>
         <artifactId>solr-core</artifactId>
-        <version>6.2.1</version>
+        <version>1.3.0</version>
       </dependency>
       <dependency>
         <groupId>org.apache.solr</groupId>
         <artifactId>solr-solrj</artifactId>
-        <version>6.2.1</version>
+        <version>1.3.0</version>
       </dependency>
       <dependency>
         <groupId>org.apache.tika</groupId>

http://git-wip-us.apache.org/repos/asf/oodt/blob/4382d9d0/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/FileManager.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/FileManager.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/FileManager.java
index 6e706ab..fc080e4 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/FileManager.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/FileManager.java
@@ -39,6 +39,9 @@ import org.apache.oodt.cas.filemgr.versioning.VersioningUtils;
 import org.apache.oodt.cas.metadata.Metadata;
 import org.apache.oodt.cas.metadata.exceptions.MetExtractionException;
 import org.apache.oodt.commons.date.DateUtils;
+import org.apache.oodt.config.Component;
+import org.apache.oodt.config.ConfigurationManager;
+import org.apache.oodt.config.ConfigurationManagerFactory;
 
 //JDK imports
 import java.util.*;
@@ -74,8 +77,19 @@ public class FileManager {
 
     /* whether or not to expand a product instance into met */
     private boolean expandProductMet;
+    
+    /** Configuration Manager instance which will handle the configuration aspect in distributed/standalone manner */
+    private ConfigurationManager configurationManager;
 
     public FileManager() throws Exception {
+        List<String> propertiesFiles = new ArrayList<>();
+  
+        // set up the configuration, if there is any
+        if (System.getProperty("org.apache.oodt.cas.filemgr.properties") != null) {
+          propertiesFiles.add(System.getProperty("org.apache.oodt.cas.filemgr.properties"));
+        }
+      
+        configurationManager = ConfigurationManagerFactory.getConfigurationManager(Component.FILE_MANAGER, propertiesFiles);
         LOG.log(Level.INFO, "File Manager started by "
                 + System.getProperty("user.name", "unknown"));
     }
@@ -1080,16 +1094,15 @@ public class FileManager {
     }
 
     public void loadConfiguration() throws FileNotFoundException, IOException {
-        // set up the configuration, if there is any
-        if (System.getProperty("org.apache.oodt.cas.filemgr.properties") != null) {
-            String configFile = System
-                    .getProperty("org.apache.oodt.cas.filemgr.properties");
-            LOG.log(Level.INFO,
-                    "Loading File Manager Configuration Properties from: [" + configFile
-                            + "]");
-            System.getProperties().load(new FileInputStream(new File(configFile)));
+        
+        try{
+          this.configurationManager.loadConfiguration();
         }
-
+        catch(Exception e){
+          e.printStackTrace();
+          throw new IOException(e.getLocalizedMessage());
+        }
+        
         String metaFactory = null, dataFactory = null;
 
         metaFactory = System.getProperty("filemgr.catalog.factory",

http://git-wip-us.apache.org/repos/asf/oodt/blob/4382d9d0/filemgr/src/test/java/org/apache/oodt/cas/filemgr/system/distributed/TestDistributedXmlRpcFileManager.java
----------------------------------------------------------------------
diff --git a/filemgr/src/test/java/org/apache/oodt/cas/filemgr/system/distributed/TestDistributedXmlRpcFileManager.java b/filemgr/src/test/java/org/apache/oodt/cas/filemgr/system/distributed/TestDistributedXmlRpcFileManager.java
index 938a89b..bb4ad61 100644
--- a/filemgr/src/test/java/org/apache/oodt/cas/filemgr/system/distributed/TestDistributedXmlRpcFileManager.java
+++ b/filemgr/src/test/java/org/apache/oodt/cas/filemgr/system/distributed/TestDistributedXmlRpcFileManager.java
@@ -22,8 +22,10 @@ import org.apache.oodt.cas.filemgr.metadata.CoreMetKeys;
 import org.apache.oodt.cas.filemgr.metadata.ProductMetKeys;
 import org.apache.oodt.cas.filemgr.structs.Product;
 import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
+import org.apache.oodt.cas.filemgr.system.AvroFileManagerServer;
 import org.apache.oodt.cas.filemgr.system.XmlRpcFileManager;
 import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
+import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerServer;
 import org.apache.oodt.cas.metadata.Metadata;
 import org.apache.oodt.cas.metadata.SerializableMetadata;
 import org.apache.oodt.cas.metadata.util.PathUtils;
@@ -61,13 +63,15 @@ public class TestDistributedXmlRpcFileManager extends AbstractDistributedConfigu
     private static final String CONF_PUBLISHER_XML = "distributed/config/config-publisher.xml";
     private static final String TRANSFER_SERVICE_FACTORY_CLASS = "org.apache.oodt.cas.filemgr.datatransfer.LocalDataTransferFactory";
 
-    private XmlRpcFileManager fileManager;
+    private XmlRpcFileManagerServer fileManager;
 
     @Before
     public void setUpTest() throws Exception {
         System.setProperty("org.apache.oodt.cas.cli.action.spring.config", "../config/src/main/resources/cmd-line-actions.xml");
         System.setProperty("org.apache.oodt.cas.cli.option.spring.config", "../config/src/main/resources/cmd-line-options.xml");
         System.setProperty(ENABLE_DISTRIBUTED_CONFIGURATION, "true");
+        System.setProperty("filemgr.client", "org.apache.oodt.cas.filemgr.system.rpc.XmlRpcFileManagerClientFactory");
+        System.setProperty("filemgr.server", "org.apache.oodt.cas.filemgr.system.rpc.XmlRpcFileManagerServerFactory");
 
         ConfigPublisher.main(new String[]{
                 "-connectString", zookeeper.getConnectString(),
@@ -76,8 +80,12 @@ public class TestDistributedXmlRpcFileManager extends AbstractDistributedConfigu
         });
 
         try {
-            fileManager = new XmlRpcFileManager(FM_PORT);
+            fileManager = new XmlRpcFileManagerServer(FM_PORT);
+            if(!fileManager.startUp()){
+              throw new Exception("File Manager startup failed.");
+            }
         } catch (Exception e) {
+            e.printStackTrace();
             fail(e.getMessage());
         }
 
@@ -188,6 +196,7 @@ public class TestDistributedXmlRpcFileManager extends AbstractDistributedConfigu
             prodMet.addMetadata(CoreMetKeys.PRODUCT_TYPE, "GenericFile");
             ingester.ingest(new URL("http://localhost:" + FM_PORT), new File(refUrl.getFile()), prodMet);
         } catch (Exception e) {
+            e.printStackTrace();
             fail(e.getMessage());
         }
     }