Repository: apache/fluo
Issue: Stop accumulo classpath value from being shortened

While working on #214, I discovered that the Accumulo classpath was being shortened when fluo.properties was used to create FluoConfiguration.  This is due to the properties file being loaded into a PropertiesConfiguration object that did not have `setDelimiterParsingDisable()` set to true.

This bug needs to be fixed for the alpha release as it causes iterators to not be loaded into Fluo when running on YARN.


Changed files:
modules/api/src/main/java/io/fluo/api/config/FluoConfiguration.java, modules/cluster/src/main/java/io/fluo/cluster/InitializeTool.java, modules/api/src/test/java/io/fluo/api/config/FluoConfigurationTest.java

diff --git a/modules/api/src/main/java/io/fluo/api/config/FluoConfiguration.java b/modules/api/src/main/java/io/fluo/api/config/FluoConfiguration.java
index cddf6604..82bfc6b7 100644
--- a/modules/api/src/main/java/io/fluo/api/config/FluoConfiguration.java
+++ b/modules/api/src/main/java/io/fluo/api/config/FluoConfiguration.java
@@ -112,7 +112,11 @@ public class FluoConfiguration extends CompositeConfiguration {
   public FluoConfiguration(File propertiesFile) {
     this();
     try {
-      addConfiguration(new PropertiesConfiguration(propertiesFile));
+      PropertiesConfiguration config = new PropertiesConfiguration();
+      // disabled to prevent accumulo classpath value from being shortened
+      config.setDelimiterParsingDisabled(true);
+      config.load(propertiesFile);
+      addConfiguration(config);
     } catch (ConfigurationException e) {
       throw new IllegalArgumentException(e);
     }
diff --git a/modules/api/src/test/java/io/fluo/api/config/FluoConfigurationTest.java b/modules/api/src/test/java/io/fluo/api/config/FluoConfigurationTest.java
index c1ca9754..59bb8838 100644
--- a/modules/api/src/test/java/io/fluo/api/config/FluoConfigurationTest.java
+++ b/modules/api/src/test/java/io/fluo/api/config/FluoConfigurationTest.java
@@ -15,6 +15,7 @@
  */
 package io.fluo.api.config;
 
+import java.io.File;
 import java.util.NoSuchElementException;
 
 import org.junit.Assert;
@@ -70,7 +71,7 @@ public class FluoConfigurationTest {
   @Test
   public void testSetGet() {
     FluoConfiguration config = new FluoConfiguration();
-    Assert.assertEquals("path", config.setAccumuloClasspath("path").getAccumuloClasspath());
+    Assert.assertEquals("path1,path2", config.setAccumuloClasspath("path1,path2").getAccumuloClasspath());
     Assert.assertEquals("instance", config.setAccumuloInstance("instance").getAccumuloInstance());
     Assert.assertEquals("pass", config.setAccumuloPassword("pass").getAccumuloPassword());
     Assert.assertEquals("table", config.setAccumuloTable("table").getAccumuloTable());
@@ -144,4 +145,19 @@ public class FluoConfigurationTest {
     config.setAccumuloTable("table");
     Assert.assertTrue(config.hasRequiredMiniFluoProps());
   }
+  
+  @Test
+  public void testLoadingPropsFile() {
+    File propsFile = new File("../distribution/src/main/config/fluo.properties");
+    Assert.assertTrue(propsFile.exists());
+    
+    FluoConfiguration config = new FluoConfiguration(propsFile);
+    // make sure classpath contains comma.  otherwise it was shortened
+    Assert.assertTrue(config.getAccumuloClasspath().contains(","));
+    // check for values set in prop file
+    Assert.assertEquals("localhost", config.getZookeepers());
+    Assert.assertEquals("", config.getAccumuloUser());
+    Assert.assertEquals("", config.getAccumuloPassword());
+    Assert.assertEquals("", config.getAccumuloTable());
+  }
 }
diff --git a/modules/cluster/src/main/java/io/fluo/cluster/InitializeTool.java b/modules/cluster/src/main/java/io/fluo/cluster/InitializeTool.java
index 97a891b7..81f71191 100644
--- a/modules/cluster/src/main/java/io/fluo/cluster/InitializeTool.java
+++ b/modules/cluster/src/main/java/io/fluo/cluster/InitializeTool.java
@@ -47,6 +47,8 @@ public class InitializeTool {
     options.validateConfig();
 
     Logging.init("init", options.getConfigDir(), options.getLogOutput());
+    
+    log.info("Initalizing Fluo using the following properties file: "+options.getFluoProps());
 
     FluoConfiguration config = new FluoConfiguration(new File(options.getFluoProps()));
     if (!config.hasRequiredAdminProps()) {