accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [4/5] accumulo git commit: ACCUMULO-3815 Don't call getCanonicalPath on on accumulo home and confdir.
Date Thu, 14 May 2015 01:06:53 GMT
ACCUMULO-3815 Don't call getCanonicalPath on on accumulo home and confdir.

If we alter the passed-in paths, we might not grep the right thing.


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/25da2e3e
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/25da2e3e
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/25da2e3e

Branch: refs/heads/1.7
Commit: 25da2e3e960f2c2e983a1380d6d614824adca088
Parents: e622196
Author: Josh Elser <elserj@apache.org>
Authored: Wed May 13 20:54:08 2015 -0400
Committer: Josh Elser <elserj@apache.org>
Committed: Wed May 13 21:06:26 2015 -0400

----------------------------------------------------------------------
 .../standalone/StandaloneClusterControl.java    |  8 ++---
 .../StandaloneClusterControlTest.java           | 38 ++++++++++++++++++++
 2 files changed, 40 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/25da2e3e/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
----------------------------------------------------------------------
diff --git a/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
b/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
index 029cd4c..c652b0b 100644
--- a/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
+++ b/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
@@ -64,12 +64,8 @@ public class StandaloneClusterControl implements ClusterControl {
   public StandaloneClusterControl(String user, String accumuloHome, String accumuloConfDir)
{
     this.user = user;
     this.options = new RemoteShellOptions();
-    try {
-      this.accumuloHome = new File(accumuloHome).getCanonicalPath();
-      this.accumuloConfDir = new File(accumuloConfDir).getCanonicalPath();
-    } catch (IOException e) {
-      throw new RuntimeException("Failed to compute canonical path", e);
-    }
+    this.accumuloHome = accumuloHome;
+    this.accumuloConfDir = accumuloConfDir;
 
     File bin = new File(accumuloHome, "bin");
     this.startServerPath = new File(bin, START_SERVER_SCRIPT).getAbsolutePath();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/25da2e3e/minicluster/src/test/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControlTest.java
----------------------------------------------------------------------
diff --git a/minicluster/src/test/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControlTest.java
b/minicluster/src/test/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControlTest.java
new file mode 100644
index 0000000..b68a6e6
--- /dev/null
+++ b/minicluster/src/test/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControlTest.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.cluster.standalone;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class StandaloneClusterControlTest {
+
+  @Test
+  public void testPaths() {
+    String accumuloHome = "/usr/lib/accumulo", accumuloConfDir = "/etc/accumulo/conf";
+
+    StandaloneClusterControl control = new StandaloneClusterControl("accumulo", accumuloHome,
accumuloConfDir);
+
+    assertEquals(accumuloHome, control.accumuloHome);
+    assertEquals(accumuloConfDir, control.accumuloConfDir);
+
+    assertEquals(accumuloHome + "/bin/accumulo", control.accumuloPath);
+    assertEquals(accumuloHome + "/bin/start-server.sh", control.startServerPath);
+  }
+
+}


Mime
View raw message