You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by zj...@apache.org on 2018/01/18 08:08:00 UTC

zeppelin git commit: ZEPPELIN-2742. Unify Zeppelin's Config Storage

Repository: zeppelin
Updated Branches:
  refs/heads/master 635373209 -> fbb35f92a


ZEPPELIN-2742. Unify Zeppelin's Config Storage

### What is this PR for?

This PR is for unifying the config storage of zeppelin. Currently we store it as local file, this PR introduce an interface `ConfigStorage` and one implementation based on hadoop filesystem api. User could add others in future.

### What type of PR is it?
[ Improvement  | Refactoring]

### Todos
* [ ] - Task

### What is the Jira issue?
* https://issues.apache.org/jira/browse/ZEPPELIN-2742

### How should this be tested?
Unit test is added and manually tested

### Screenshots (if appropriate)

### Questions:
* Does the licenses files need update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No

Author: Jeff Zhang <zj...@apache.org>

Closes #2712 from zjffdu/ZEPPELIN-2742 and squashes the following commits:

a06a99d [Jeff Zhang] address comments
fedd329 [Jeff Zhang] ZEPPELIN-2742. Unify Zeppelin's Storage Layer


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

Branch: refs/heads/master
Commit: fbb35f92ada1361148c63ad42bf6a5a231328b1a
Parents: 6353732
Author: Jeff Zhang <zj...@apache.org>
Authored: Fri Jan 12 12:47:27 2018 +0800
Committer: Jeff Zhang <zj...@apache.org>
Committed: Thu Jan 18 16:07:47 2018 +0800

----------------------------------------------------------------------
 .../zeppelin/conf/ZeppelinConfiguration.java    |  21 ++-
 .../org/apache/zeppelin/user/Credentials.java   | 180 ------------------
 .../zeppelin/user/CredentialsInfoSaving.java    |  40 ----
 .../org/apache/zeppelin/user/Encryptor.java     |  80 --------
 .../apache/zeppelin/user/CredentialsTest.java   |  40 ----
 .../org/apache/zeppelin/user/EncryptorTest.java |  41 -----
 .../apache/zeppelin/server/ZeppelinServer.java  |   6 +-
 zeppelin-zengine/pom.xml                        |   3 -
 .../interpreter/InterpreterSettingManager.java  | 139 +++++++-------
 .../zeppelin/notebook/FileSystemStorage.java    |  13 +-
 .../notebook/NotebookAuthorization.java         |  53 ++----
 .../apache/zeppelin/storage/ConfigStorage.java  |  78 ++++++++
 .../storage/FileSystemConfigStorage.java        | 122 ++++++++++++
 .../org/apache/zeppelin/user/Credentials.java   | 184 +++++++++++++++++++
 .../zeppelin/user/CredentialsInfoSaving.java    |  40 ++++
 .../org/apache/zeppelin/user/Encryptor.java     |  77 ++++++++
 .../conf/ZeppelinConfigurationTest.java         |   8 +
 .../interpreter/InterpreterFactoryTest.java     |   1 +
 .../launcher/SparkInterpreterLauncherTest.java  |  20 +-
 .../apache/zeppelin/user/CredentialsTest.java   |  40 ++++
 .../org/apache/zeppelin/user/EncryptorTest.java |  41 +++++
 21 files changed, 717 insertions(+), 510 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fbb35f92/zeppelin-interpreter/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java
----------------------------------------------------------------------
diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java
index 748bb8d..17e3e5b 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java
@@ -253,6 +253,10 @@ public class ZeppelinConfiguration extends XMLConfiguration {
     return getBooleanValue(propertyName, defaultValue);
   }
 
+  public String getZeppelinHome() {
+    return getString(ConfVars.ZEPPELIN_HOME);
+  }
+
   public boolean useSsl() {
     return getBoolean(ConfVars.ZEPPELIN_SSL);
   }
@@ -417,7 +421,7 @@ public class ZeppelinConfiguration extends XMLConfiguration {
   }
 
   public String getInterpreterSettingPath() {
-    return getRelativeDir(String.format("%s/interpreter.json", getConfDir()));
+    return getConfigFSDir() + "/interpreter.json";
   }
 
   public String getHeliumConfPath() {
@@ -441,7 +445,7 @@ public class ZeppelinConfiguration extends XMLConfiguration {
   }
 
   public String getNotebookAuthorizationPath() {
-    return getRelativeDir(String.format("%s/notebook-authorization.json", getConfDir()));
+    return getConfigFSDir() + "/notebook-authorization.json";
   }
 
   public Boolean credentialsPersist() {
@@ -509,6 +513,16 @@ public class ZeppelinConfiguration extends XMLConfiguration {
     return getRelativeDir(ConfVars.ZEPPELIN_CONF_DIR);
   }
 
+  public String getConfigFSDir() {
+    String fsConfigDir = getString(ConfVars.ZEPPELIN_CONFIG_FS_DIR);
+    if (StringUtils.isBlank(fsConfigDir)) {
+      LOG.warn(ConfVars.ZEPPELIN_CONFIG_FS_DIR.varName + " is not specified, fall back to local " +
+          "conf directory " + ConfVars.ZEPPELIN_CONF_DIR.varName);
+      return "file://" + getConfDir();
+    }
+    return fsConfigDir;
+  }
+
   public List<String> getAllowedOrigins()
   {
     if (getString(ConfVars.ZEPPELIN_ALLOWED_ORIGINS).isEmpty()) {
@@ -693,6 +707,9 @@ public class ZeppelinConfiguration extends XMLConfiguration {
     // Decide when new note is created, interpreter settings will be binded automatically or not.
     ZEPPELIN_NOTEBOOK_AUTO_INTERPRETER_BINDING("zeppelin.notebook.autoInterpreterBinding", true),
     ZEPPELIN_CONF_DIR("zeppelin.conf.dir", "conf"),
+    ZEPPELIN_CONFIG_FS_DIR("zeppelin.config.fs.dir", ""),
+    ZEPPELIN_CONFIG_STORAGE_CLASS("zeppelin.config.storage.class",
+        "org.apache.zeppelin.storage.FileSystemConfigStorage"),
     ZEPPELIN_DEP_LOCALREPO("zeppelin.dep.localrepo", "local-repo"),
     ZEPPELIN_HELIUM_REGISTRY("zeppelin.helium.registry", "helium," + HELIUM_PACKAGE_DEFAULT_URL),
     ZEPPELIN_HELIUM_NODE_INSTALLER_URL("zeppelin.helium.node.installer.url",

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fbb35f92/zeppelin-interpreter/src/main/java/org/apache/zeppelin/user/Credentials.java
----------------------------------------------------------------------
diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/user/Credentials.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/user/Credentials.java
deleted file mode 100644
index d345e3c..0000000
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/user/Credentials.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
-* 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.zeppelin.user;
-
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import org.apache.zeppelin.common.JsonSerializable;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.*;
-import java.nio.file.Files;
-import java.nio.file.attribute.PosixFilePermission;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import static java.nio.file.attribute.PosixFilePermission.OWNER_READ;
-import static java.nio.file.attribute.PosixFilePermission.OWNER_WRITE;
-
-/**
- * Class defining credentials for data source authorization
- */
-public class Credentials {
-  private static final Logger LOG = LoggerFactory.getLogger(Credentials.class);
-
-  private Map<String, UserCredentials> credentialsMap;
-  private Gson gson;
-  private Boolean credentialsPersist = true;
-  File credentialsFile;
-
-  private Encryptor encryptor;
-
-  /**
-   * Wrapper fro user credentials. It can load credentials from a file if credentialsPath is
-   * supplied, and will encrypt the file if an encryptKey is supplied.
-   *
-   * @param credentialsPersist
-   * @param credentialsPath
-   * @param encryptKey
-   */
-  public Credentials(Boolean credentialsPersist, String credentialsPath, String encryptKey) {
-    if (encryptKey != null) {
-      this.encryptor = new Encryptor(encryptKey);
-    }
-
-    this.credentialsPersist = credentialsPersist;
-    if (credentialsPath != null) {
-      credentialsFile = new File(credentialsPath);
-    }
-    credentialsMap = new HashMap<>();
-
-    if (credentialsPersist) {
-      GsonBuilder builder = new GsonBuilder();
-      builder.setPrettyPrinting();
-      gson = builder.create();
-      loadFromFile();
-    }
-  }
-
-  public UserCredentials getUserCredentials(String username) {
-    UserCredentials uc = credentialsMap.get(username);
-    if (uc == null) {
-      uc = new UserCredentials();
-    }
-    return uc;
-  }
-
-  public void putUserCredentials(String username, UserCredentials uc) throws IOException {
-    credentialsMap.put(username, uc);
-    saveCredentials();
-  }
-
-  public UserCredentials removeUserCredentials(String username) throws IOException {
-    UserCredentials uc;
-    uc = credentialsMap.remove(username);
-    saveCredentials();
-    return uc;
-  }
-
-  public boolean removeCredentialEntity(String username, String entity) throws IOException {
-    UserCredentials uc = credentialsMap.get(username);
-    if (uc != null && uc.existUsernamePassword(entity) == false) {
-      return false;
-    }
-
-    uc.removeUsernamePassword(entity);
-    saveCredentials();
-    return true;
-  }
-
-  public void saveCredentials() throws IOException {
-    if (credentialsPersist) {
-      saveToFile();
-    }
-  }
-
-  private void loadFromFile() {
-    LOG.info(credentialsFile.getAbsolutePath());
-    if (!credentialsFile.exists()) {
-      // nothing to read
-      return;
-    }
-
-    try {
-      FileInputStream fis = new FileInputStream(credentialsFile);
-      InputStreamReader isr = new InputStreamReader(fis);
-      BufferedReader bufferedReader = new BufferedReader(isr);
-      StringBuilder sb = new StringBuilder();
-      String line;
-      while ((line = bufferedReader.readLine()) != null) {
-        sb.append(line);
-      }
-      isr.close();
-      fis.close();
-
-      String json = sb.toString();
-
-      if (encryptor != null) {
-        json = encryptor.decrypt(json);
-      }
-
-      CredentialsInfoSaving info = CredentialsInfoSaving.fromJson(json);
-      this.credentialsMap = info.credentialsMap;
-    } catch (IOException e) {
-      LOG.error("Error loading credentials file", e);
-      e.printStackTrace();
-    }
-  }
-
-  private void saveToFile() throws IOException {
-    String jsonString;
-
-    synchronized (credentialsMap) {
-      CredentialsInfoSaving info = new CredentialsInfoSaving();
-      info.credentialsMap = credentialsMap;
-      jsonString = gson.toJson(info);
-    }
-
-    try {
-      if (!credentialsFile.exists()) {
-        credentialsFile.createNewFile();
-
-        Set<PosixFilePermission> permissions = EnumSet.of(OWNER_READ, OWNER_WRITE);
-        Files.setPosixFilePermissions(credentialsFile.toPath(), permissions);
-      }
-
-      FileOutputStream fos = new FileOutputStream(credentialsFile, false);
-      OutputStreamWriter out = new OutputStreamWriter(fos);
-
-      if (encryptor != null) {
-        jsonString = encryptor.encrypt(jsonString);
-      }
-
-      out.append(jsonString);
-      out.close();
-      fos.close();
-    } catch (IOException e) {
-      LOG.error("Error saving credentials file", e);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fbb35f92/zeppelin-interpreter/src/main/java/org/apache/zeppelin/user/CredentialsInfoSaving.java
----------------------------------------------------------------------
diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/user/CredentialsInfoSaving.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/user/CredentialsInfoSaving.java
deleted file mode 100644
index 48bb24d..0000000
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/user/CredentialsInfoSaving.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.zeppelin.user;
-
-import com.google.gson.Gson;
-import org.apache.zeppelin.common.JsonSerializable;
-
-import java.util.Map;
-
-/**
- * Helper class to save credentials
- */
-public class CredentialsInfoSaving implements JsonSerializable {
-  private static final Gson gson = new Gson();
-
-  public Map<String, UserCredentials> credentialsMap;
-
-  public String toJson() {
-    return gson.toJson(this);
-  }
-
-  public static CredentialsInfoSaving fromJson(String json) {
-    return gson.fromJson(json, CredentialsInfoSaving.class);
-  }
-}

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fbb35f92/zeppelin-interpreter/src/main/java/org/apache/zeppelin/user/Encryptor.java
----------------------------------------------------------------------
diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/user/Encryptor.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/user/Encryptor.java
deleted file mode 100644
index cf04b37..0000000
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/user/Encryptor.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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.zeppelin.user;
-
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.nio.charset.Charset;
-import java.util.Arrays;
-
-import org.bouncycastle.crypto.BufferedBlockCipher;
-import org.bouncycastle.crypto.InvalidCipherTextException;
-import org.bouncycastle.crypto.engines.AESEngine;
-import org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher;
-import org.bouncycastle.crypto.paddings.ZeroBytePadding;
-import org.bouncycastle.crypto.params.KeyParameter;
-import org.bouncycastle.util.encoders.Base64;
-
-/**
- * Encrypt/decrypt arrays of bytes!
- */
-public class Encryptor {
-  private final BufferedBlockCipher encryptCipher;
-  private final BufferedBlockCipher decryptCipher;
-
-  public Encryptor(String encryptKey) {
-    encryptCipher = new PaddedBufferedBlockCipher(new AESEngine(), new ZeroBytePadding());
-    encryptCipher.init(true, new KeyParameter(encryptKey.getBytes()));
-
-    decryptCipher = new PaddedBufferedBlockCipher(new AESEngine(), new ZeroBytePadding());
-    decryptCipher.init(false, new KeyParameter(encryptKey.getBytes()));
-  }
-
-
-  public String encrypt(String inputString) throws IOException {
-    byte[] input = inputString.getBytes();
-    byte[] result = new byte[encryptCipher.getOutputSize(input.length)];
-    int size = encryptCipher.processBytes(input, 0, input.length, result, 0);
-
-    try {
-      size += encryptCipher.doFinal(result, size);
-
-      byte[] out = new byte[size];
-      System.arraycopy(result, 0, out, 0, size);
-      return new String(Base64.encode(out));
-    } catch (InvalidCipherTextException e) {
-      throw new IOException("Cannot encrypt: " + e.getMessage(), e);
-    }
-  }
-
-  public String decrypt(String base64Input) throws IOException {
-    byte[] input = Base64.decode(base64Input);
-    byte[] result = new byte[decryptCipher.getOutputSize(input.length)];
-    int size = decryptCipher.processBytes(input, 0, input.length, result, 0);
-
-    try {
-      size += decryptCipher.doFinal(result, size);
-
-      byte[] out = new byte[size];
-      System.arraycopy(result, 0, out, 0, size);
-      return new String(out);
-    } catch (InvalidCipherTextException e) {
-      throw new IOException("Cannot decrypt: " + e.getMessage(), e);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fbb35f92/zeppelin-interpreter/src/test/java/org/apache/zeppelin/user/CredentialsTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/user/CredentialsTest.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/user/CredentialsTest.java
deleted file mode 100644
index 4516bea..0000000
--- a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/user/CredentialsTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.zeppelin.user;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-import java.io.IOException;
-
-public class CredentialsTest {
-
-  @Test
-  public void testDefaultProperty() throws IOException {
-    Credentials credentials = new Credentials(false, null, null);
-    UserCredentials userCredentials = new UserCredentials();
-    UsernamePassword up1 = new UsernamePassword("user2", "password");
-    userCredentials.putUsernamePassword("hive(vertica)", up1);
-    credentials.putUserCredentials("user1", userCredentials);
-    UserCredentials uc2 = credentials.getUserCredentials("user1");
-    UsernamePassword up2 = uc2.getUsernamePassword("hive(vertica)");
-    assertEquals(up1.getUsername(), up2.getUsername());
-    assertEquals(up1.getPassword(), up2.getPassword());
-  }
-}

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fbb35f92/zeppelin-interpreter/src/test/java/org/apache/zeppelin/user/EncryptorTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/user/EncryptorTest.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/user/EncryptorTest.java
deleted file mode 100644
index 9950be6..0000000
--- a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/user/EncryptorTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.zeppelin.user;
-
-import java.io.IOException;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-
-public class EncryptorTest {
-
-  @Test
-  public void testEncryption() throws IOException {
-    Encryptor encryptor = new Encryptor("foobar1234567890");
-
-    String input = "test";
-
-    String encrypted = encryptor.encrypt(input);
-    assertNotEquals(input, encrypted);
-
-    String decrypted = encryptor.decrypt(encrypted);
-    assertEquals(input, decrypted);
-  }
-}

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fbb35f92/zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java b/zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java
index f8625c2..9f3f607 100644
--- a/zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java
+++ b/zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java
@@ -53,6 +53,8 @@ import org.apache.zeppelin.scheduler.SchedulerFactory;
 import org.apache.zeppelin.search.LuceneSearch;
 import org.apache.zeppelin.search.SearchService;
 import org.apache.zeppelin.socket.NotebookServer;
+import org.apache.zeppelin.storage.ConfigStorage;
+import org.apache.zeppelin.storage.FileSystemConfigStorage;
 import org.apache.zeppelin.user.Credentials;
 import org.apache.zeppelin.utils.SecurityUtils;
 import org.eclipse.jetty.http.HttpVersion;
@@ -82,6 +84,7 @@ public class ZeppelinServer extends Application {
   private final InterpreterSettingManager interpreterSettingManager;
   private SchedulerFactory schedulerFactory;
   private InterpreterFactory replFactory;
+  private ConfigStorage configStorage;
   private SearchService noteSearchService;
   private NotebookRepoSync notebookRepo;
   private NotebookAuthorization notebookAuthorization;
@@ -126,7 +129,7 @@ public class ZeppelinServer extends Application {
     this.replFactory = new InterpreterFactory(interpreterSettingManager);
     this.notebookRepo = new NotebookRepoSync(conf);
     this.noteSearchService = new LuceneSearch();
-    this.notebookAuthorization = NotebookAuthorization.init(conf);
+    this.notebookAuthorization = NotebookAuthorization.getInstance();
     this.credentials = new Credentials(
         conf.credentialsPersist(),
         conf.getCredentialsPath(),
@@ -134,6 +137,7 @@ public class ZeppelinServer extends Application {
     notebook = new Notebook(conf,
         notebookRepo, schedulerFactory, replFactory, interpreterSettingManager, notebookWsServer,
             noteSearchService, notebookAuthorization, credentials);
+    this.configStorage = ConfigStorage.getInstance(conf);
 
     ZeppelinServer.helium = new Helium(
         conf.getHeliumConfPath(),

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fbb35f92/zeppelin-zengine/pom.xml
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/pom.xml b/zeppelin-zengine/pom.xml
index a549372..b68152f 100644
--- a/zeppelin-zengine/pom.xml
+++ b/zeppelin-zengine/pom.xml
@@ -316,9 +316,6 @@
           <systemProperties>
             <java.io.tmpdir>${project.build.directory}/tmp</java.io.tmpdir>
           </systemProperties>
-          <environmentVariables>
-            <!--<ZEPPELIN_HOME>..</ZEPPELIN_HOME>-->
-          </environmentVariables>
         </configuration>
       </plugin>
     </plugins>

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fbb35f92/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java
index 42f82fa..a6583cb 100644
--- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java
@@ -44,18 +44,20 @@ import org.apache.zeppelin.resource.Resource;
 import org.apache.zeppelin.resource.ResourcePool;
 import org.apache.zeppelin.resource.ResourceSet;
 import org.apache.zeppelin.util.ReflectionUtils;
+import org.apache.zeppelin.storage.ConfigStorage;
+import org.apache.zeppelin.storage.FileSystemConfigStorage;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.sonatype.aether.repository.Authentication;
+import org.sonatype.aether.RepositoryException;
 import org.sonatype.aether.repository.Proxy;
 import org.sonatype.aether.repository.RemoteRepository;
+import org.sonatype.aether.repository.Authentication;
 
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
-import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Type;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -75,6 +77,7 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
+
 /**
  * InterpreterSettingManager is the component which manage all the interpreter settings.
  * (load/create/update/remove/get)
@@ -90,7 +93,6 @@ public class InterpreterSettingManager {
 
   private final ZeppelinConfiguration conf;
   private final Path interpreterDirPath;
-  private final Path interpreterSettingPath;
 
   /**
    * This is only InterpreterSetting templates with default name and properties
@@ -123,6 +125,9 @@ public class InterpreterSettingManager {
   private DependencyResolver dependencyResolver;
   private LifecycleManager lifecycleManager;
   private RecoveryStorage recoveryStorage;
+  private ConfigStorage configStorage;
+
+
 
   public InterpreterSettingManager(ZeppelinConfiguration zeppelinConfiguration,
                                    AngularObjectRegistryListener angularObjectRegistryListener,
@@ -133,22 +138,21 @@ public class InterpreterSettingManager {
     this(zeppelinConfiguration, new InterpreterOption(),
         angularObjectRegistryListener,
         remoteInterpreterProcessListener,
-        appEventListener);
+        appEventListener,
+        ConfigStorage.getInstance(zeppelinConfiguration));
   }
 
-  @VisibleForTesting
   public InterpreterSettingManager(ZeppelinConfiguration conf,
                                    InterpreterOption defaultOption,
                                    AngularObjectRegistryListener angularObjectRegistryListener,
                                    RemoteInterpreterProcessListener
                                          remoteInterpreterProcessListener,
-                                   ApplicationEventListener appEventListener) throws IOException {
+                                   ApplicationEventListener appEventListener,
+                                   ConfigStorage configStorage) throws IOException {
     this.conf = conf;
     this.defaultOption = defaultOption;
     this.interpreterDirPath = Paths.get(conf.getInterpreterDir());
     LOGGER.debug("InterpreterRootPath: {}", interpreterDirPath);
-    this.interpreterSettingPath = Paths.get(conf.getInterpreterSettingPath());
-    LOGGER.debug("InterpreterSettingPath: {}", interpreterSettingPath);
     this.dependencyResolver = new DependencyResolver(
         conf.getString(ConfVars.ZEPPELIN_INTERPRETER_LOCALREPO));
     this.interpreterRepositories = dependencyResolver.getRepos();
@@ -159,18 +163,18 @@ public class InterpreterSettingManager {
     this.angularObjectRegistryListener = angularObjectRegistryListener;
     this.remoteInterpreterProcessListener = remoteInterpreterProcessListener;
     this.appEventListener = appEventListener;
-
     this.recoveryStorage = ReflectionUtils.createClazzInstance(conf.getRecoveryStorageClass(),
         new Class[] {ZeppelinConfiguration.class, InterpreterSettingManager.class},
         new Object[] {conf, this});
     this.recoveryStorage.init();
     LOGGER.info("Using RecoveryStorage: " + this.recoveryStorage.getClass().getName());
-
     this.lifecycleManager = ReflectionUtils.createClazzInstance(conf.getLifecycleManagerClass(),
         new Class[] {ZeppelinConfiguration.class},
         new Object[] {conf});
     LOGGER.info("Using LifecycleManager: " + this.lifecycleManager.getClass().getName());
 
+    this.configStorage = configStorage;
+
     init();
   }
 
@@ -190,10 +194,11 @@ public class InterpreterSettingManager {
   /**
    * Load interpreter setting from interpreter-setting.json
    */
-  private void loadFromFile() {
-    if (!Files.exists(interpreterSettingPath)) {
+  private void loadFromFile() throws IOException {
+    InterpreterInfoSaving infoSaving =
+        configStorage.loadInterpreterSettings();
+    if (infoSaving == null) {
       // nothing to read
-      LOGGER.warn("Interpreter Setting file {} doesn't exist", interpreterSettingPath);
       for (InterpreterSetting interpreterSettingTemplate : interpreterSettingTemplates.values()) {
         InterpreterSetting interpreterSetting = new InterpreterSetting(interpreterSettingTemplate);
         initInterpreterSetting(interpreterSetting);
@@ -202,71 +207,65 @@ public class InterpreterSettingManager {
       return;
     }
 
-    try {
-      InterpreterInfoSaving infoSaving = InterpreterInfoSaving.loadFromFile(interpreterSettingPath);
-      //TODO(zjffdu) still ugly (should move all to InterpreterInfoSaving)
-      for (InterpreterSetting savedInterpreterSetting : infoSaving.interpreterSettings.values()) {
-        savedInterpreterSetting.setProperties(InterpreterSetting.convertInterpreterProperties(
-            savedInterpreterSetting.getProperties()
-        ));
-        initInterpreterSetting(savedInterpreterSetting);
-
-        InterpreterSetting interpreterSettingTemplate =
-            interpreterSettingTemplates.get(savedInterpreterSetting.getGroup());
-        // InterpreterSettingTemplate is from interpreter-setting.json which represent the latest
-        // InterpreterSetting, while InterpreterSetting is from interpreter.json which represent
-        // the user saved interpreter setting
-        if (interpreterSettingTemplate != null) {
-          savedInterpreterSetting.setInterpreterDir(interpreterSettingTemplate.getInterpreterDir());
-          // merge properties from interpreter-setting.json and interpreter.json
-          Map<String, InterpreterProperty> mergedProperties =
-              new HashMap<>(InterpreterSetting.convertInterpreterProperties(
-                  interpreterSettingTemplate.getProperties()));
-          Map<String, InterpreterProperty> savedProperties = InterpreterSetting
-              .convertInterpreterProperties(savedInterpreterSetting.getProperties());
-          for (Map.Entry<String, InterpreterProperty> entry : savedProperties.entrySet()) {
-            // only merge properties whose value is not empty
-            if (entry.getValue().getValue() != null && !
-                StringUtils.isBlank(entry.getValue().toString())) {
-              mergedProperties.put(entry.getKey(), entry.getValue());
-            }
+    //TODO(zjffdu) still ugly (should move all to InterpreterInfoSaving)
+    for (InterpreterSetting savedInterpreterSetting : infoSaving.interpreterSettings.values()) {
+      savedInterpreterSetting.setProperties(InterpreterSetting.convertInterpreterProperties(
+          savedInterpreterSetting.getProperties()
+      ));
+      initInterpreterSetting(savedInterpreterSetting);
+
+      InterpreterSetting interpreterSettingTemplate =
+          interpreterSettingTemplates.get(savedInterpreterSetting.getGroup());
+      // InterpreterSettingTemplate is from interpreter-setting.json which represent the latest
+      // InterpreterSetting, while InterpreterSetting is from interpreter.json which represent
+      // the user saved interpreter setting
+      if (interpreterSettingTemplate != null) {
+        savedInterpreterSetting.setInterpreterDir(interpreterSettingTemplate.getInterpreterDir());
+        // merge properties from interpreter-setting.json and interpreter.json
+        Map<String, InterpreterProperty> mergedProperties =
+            new HashMap<>(InterpreterSetting.convertInterpreterProperties(
+                interpreterSettingTemplate.getProperties()));
+        Map<String, InterpreterProperty> savedProperties = InterpreterSetting
+            .convertInterpreterProperties(savedInterpreterSetting.getProperties());
+        for (Map.Entry<String, InterpreterProperty> entry : savedProperties.entrySet()) {
+          // only merge properties whose value is not empty
+          if (entry.getValue().getValue() != null && !
+              StringUtils.isBlank(entry.getValue().toString())) {
+            mergedProperties.put(entry.getKey(), entry.getValue());
           }
-          savedInterpreterSetting.setProperties(mergedProperties);
-          // merge InterpreterInfo
-          savedInterpreterSetting.setInterpreterInfos(
-              interpreterSettingTemplate.getInterpreterInfos());
-          savedInterpreterSetting.setInterpreterRunner(
-              interpreterSettingTemplate.getInterpreterRunner());
-        } else {
-          LOGGER.warn("No InterpreterSetting Template found for InterpreterSetting: "
-              + savedInterpreterSetting.getGroup());
         }
+        savedInterpreterSetting.setProperties(mergedProperties);
+        // merge InterpreterInfo
+        savedInterpreterSetting.setInterpreterInfos(
+            interpreterSettingTemplate.getInterpreterInfos());
+        savedInterpreterSetting.setInterpreterRunner(
+            interpreterSettingTemplate.getInterpreterRunner());
+      } else {
+        LOGGER.warn("No InterpreterSetting Template found for InterpreterSetting: "
+            + savedInterpreterSetting.getGroup());
+      }
 
-        // Overwrite the default InterpreterSetting we registered from InterpreterSetting Templates
-        // remove it first
-        for (InterpreterSetting setting : interpreterSettings.values()) {
-          if (setting.getName().equals(savedInterpreterSetting.getName())) {
-            interpreterSettings.remove(setting.getId());
-          }
+      // Overwrite the default InterpreterSetting we registered from InterpreterSetting Templates
+      // remove it first
+      for (InterpreterSetting setting : interpreterSettings.values()) {
+        if (setting.getName().equals(savedInterpreterSetting.getName())) {
+          interpreterSettings.remove(setting.getId());
         }
-        savedInterpreterSetting.postProcessing();
-        LOGGER.info("Create Interpreter Setting {} from interpreter.json",
-            savedInterpreterSetting.getName());
-        interpreterSettings.put(savedInterpreterSetting.getId(), savedInterpreterSetting);
       }
+      savedInterpreterSetting.postProcessing();
+      LOGGER.info("Create Interpreter Setting {} from interpreter.json",
+          savedInterpreterSetting.getName());
+      interpreterSettings.put(savedInterpreterSetting.getId(), savedInterpreterSetting);
+    }
 
-      interpreterBindings.putAll(infoSaving.interpreterBindings);
+    interpreterBindings.putAll(infoSaving.interpreterBindings);
 
-      if (infoSaving.interpreterRepositories != null) {
-        for (RemoteRepository repo : infoSaving.interpreterRepositories) {
-          if (!dependencyResolver.getRepos().contains(repo)) {
-            this.interpreterRepositories.add(repo);
-          }
+    if (infoSaving.interpreterRepositories != null) {
+      for (RemoteRepository repo : infoSaving.interpreterRepositories) {
+        if (!dependencyResolver.getRepos().contains(repo)) {
+          this.interpreterRepositories.add(repo);
         }
       }
-    } catch (IOException e) {
-      LOGGER.error("Fail to load interpreter setting configuration file: "
-              + interpreterSettingPath, e);
     }
   }
 
@@ -276,7 +275,7 @@ public class InterpreterSettingManager {
       info.interpreterBindings = interpreterBindings;
       info.interpreterSettings = interpreterSettings;
       info.interpreterRepositories = interpreterRepositories;
-      info.saveToFile(interpreterSettingPath);
+      configStorage.save(info);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fbb35f92/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/FileSystemStorage.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/FileSystemStorage.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/FileSystemStorage.java
index 6f3d3f9..75c0bc3 100644
--- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/FileSystemStorage.java
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/FileSystemStorage.java
@@ -40,6 +40,8 @@ public class FileSystemStorage {
   private FileSystemStorage(ZeppelinConfiguration zConf) throws IOException {
     this.zConf = zConf;
     this.hadoopConf = new Configuration();
+    // disable checksum for local file system. because interpreter.json may be updated by
+    // no hadoop filesystem api
     this.hadoopConf.set("fs.file.impl", RawLocalFileSystem.class.getName());
     this.isSecurityEnabled = UserGroupInformation.isSecurityEnabled();
 
@@ -74,6 +76,16 @@ public class FileSystemStorage {
     return fs.makeQualified(path);
   }
 
+  public boolean exists(final Path path) throws IOException {
+    return callHdfsOperation(new HdfsOperation<Boolean>() {
+
+      @Override
+      public Boolean call() throws IOException {
+        return fs.exists(path);
+      }
+    });
+  }
+
   public void tryMkDir(final Path dir) throws IOException {
     callHdfsOperation(new HdfsOperation<Void>() {
       @Override
@@ -149,7 +161,6 @@ public class FileSystemStorage {
 
   public synchronized <T> T callHdfsOperation(final HdfsOperation<T> func) throws IOException {
     if (isSecurityEnabled) {
-      UserGroupInformation.getLoginUser().reloginFromKeytab();
       try {
         return UserGroupInformation.getCurrentUser().doAs(new PrivilegedExceptionAction<T>() {
           @Override

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fbb35f92/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/NotebookAuthorization.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/NotebookAuthorization.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/NotebookAuthorization.java
index 5cf8192..f73b49e 100644
--- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/NotebookAuthorization.java
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/NotebookAuthorization.java
@@ -35,6 +35,7 @@ import java.util.Set;
 import org.apache.commons.lang.StringUtils;
 import org.apache.zeppelin.conf.ZeppelinConfiguration;
 import org.apache.zeppelin.conf.ZeppelinConfiguration.ConfVars;
+import org.apache.zeppelin.storage.ConfigStorage;
 import org.apache.zeppelin.user.AuthenticationInfo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -61,8 +62,8 @@ public class NotebookAuthorization {
    */
   private static Map<String, Set<String>> userRoles = new HashMap<>();
   private static ZeppelinConfiguration conf;
-  private static Gson gson;
-  private static String filePath;
+
+  private static ConfigStorage configStorage;
 
   private NotebookAuthorization() {}
 
@@ -70,11 +71,8 @@ public class NotebookAuthorization {
     if (instance == null) {
       instance = new NotebookAuthorization();
       conf = config;
-      filePath = conf.getNotebookAuthorizationPath();
-      GsonBuilder builder = new GsonBuilder();
-      builder.setPrettyPrinting();
-      gson = builder.create();
       try {
+        configStorage = ConfigStorage.getInstance(config);
         loadFromFile();
       } catch (IOException e) {
         LOG.error("Error loading NotebookAuthorization", e);
@@ -93,26 +91,10 @@ public class NotebookAuthorization {
   }
 
   private static void loadFromFile() throws IOException {
-    File settingFile = new File(filePath);
-    LOG.info(settingFile.getAbsolutePath());
-    if (!settingFile.exists()) {
-      // nothing to read
-      return;
-    }
-    FileInputStream fis = new FileInputStream(settingFile);
-    InputStreamReader isr = new InputStreamReader(fis);
-    BufferedReader bufferedReader = new BufferedReader(isr);
-    StringBuilder sb = new StringBuilder();
-    String line;
-    while ((line = bufferedReader.readLine()) != null) {
-      sb.append(line);
+    NotebookAuthorizationInfoSaving info = configStorage.loadNotebookAuthorization();
+    if (info != null) {
+      authInfo = info.authInfo;
     }
-    isr.close();
-    fis.close();
-
-    String json = sb.toString();
-    NotebookAuthorizationInfoSaving info = NotebookAuthorizationInfoSaving.fromJson(json);
-    authInfo = info.authInfo;
   }
   
   public void setRoles(String user, Set<String> roles) {
@@ -133,27 +115,14 @@ public class NotebookAuthorization {
   }
   
   private void saveToFile() {
-    String jsonString;
-
     synchronized (authInfo) {
       NotebookAuthorizationInfoSaving info = new NotebookAuthorizationInfoSaving();
       info.authInfo = authInfo;
-      jsonString = gson.toJson(info);
-    }
-
-    try {
-      File settingFile = new File(filePath);
-      if (!settingFile.exists()) {
-        settingFile.createNewFile();
+      try {
+        configStorage.save(info);
+      } catch (IOException e) {
+        LOG.error("Error saving notebook authorization file", e);
       }
-
-      FileOutputStream fos = new FileOutputStream(settingFile, false);
-      OutputStreamWriter out = new OutputStreamWriter(fos);
-      out.append(jsonString);
-      out.close();
-      fos.close();
-    } catch (IOException e) {
-      LOG.error("Error saving notebook authorization file: " + e.getMessage());
     }
   }
   

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fbb35f92/zeppelin-zengine/src/main/java/org/apache/zeppelin/storage/ConfigStorage.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/storage/ConfigStorage.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/storage/ConfigStorage.java
new file mode 100644
index 0000000..3dc935f
--- /dev/null
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/storage/ConfigStorage.java
@@ -0,0 +1,78 @@
+/*
+ * 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.zeppelin.storage;
+
+import org.apache.zeppelin.conf.ZeppelinConfiguration;
+import org.apache.zeppelin.helium.HeliumConf;
+import org.apache.zeppelin.interpreter.InterpreterInfoSaving;
+import org.apache.zeppelin.notebook.NotebookAuthorizationInfoSaving;
+import org.apache.zeppelin.user.Credentials;
+import org.apache.zeppelin.user.CredentialsInfoSaving;
+import org.apache.zeppelin.util.ReflectionUtils;
+
+import java.io.IOException;
+
+/**
+ * Interface for storing zeppelin configuration.
+ *
+ * 1. interpreter-setting.json
+ * 2. helium.json
+ * 3. notebook-authorization.json
+ * 4. credentials.json
+ *
+ */
+public abstract class ConfigStorage {
+
+  private static ConfigStorage instance;
+
+  protected ZeppelinConfiguration zConf;
+
+  public static synchronized ConfigStorage getInstance(ZeppelinConfiguration zConf)
+      throws IOException {
+    if (instance == null) {
+      instance = createConfigStorage(zConf);
+    }
+    return instance;
+  }
+
+  private static ConfigStorage createConfigStorage(ZeppelinConfiguration zConf) throws IOException {
+    String configStorageClass =
+        zConf.getString(ZeppelinConfiguration.ConfVars.ZEPPELIN_CONFIG_STORAGE_CLASS);
+    return ReflectionUtils.createClazzInstance(configStorageClass,
+        new Class[] {ZeppelinConfiguration.class}, new Object[] {zConf});
+  }
+
+
+  public ConfigStorage(ZeppelinConfiguration zConf) {
+    this.zConf = zConf;
+  }
+
+  public abstract void save(InterpreterInfoSaving settingInfos) throws IOException;
+
+  public abstract InterpreterInfoSaving loadInterpreterSettings() throws IOException;
+
+  public abstract void save(NotebookAuthorizationInfoSaving authorizationInfoSaving)
+      throws IOException;
+
+  public abstract NotebookAuthorizationInfoSaving loadNotebookAuthorization() throws IOException;
+
+  public abstract String loadCredentials() throws IOException;
+
+  public abstract void saveCredentials(String credentials) throws IOException;
+}

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fbb35f92/zeppelin-zengine/src/main/java/org/apache/zeppelin/storage/FileSystemConfigStorage.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/storage/FileSystemConfigStorage.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/storage/FileSystemConfigStorage.java
new file mode 100644
index 0000000..2460e4d
--- /dev/null
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/storage/FileSystemConfigStorage.java
@@ -0,0 +1,122 @@
+/*
+ * 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.zeppelin.storage;
+
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import org.apache.hadoop.fs.Path;
+import org.apache.zeppelin.conf.ZeppelinConfiguration;
+import org.apache.zeppelin.helium.HeliumConf;
+import org.apache.zeppelin.interpreter.InterpreterInfoSaving;
+import org.apache.zeppelin.interpreter.InterpreterSetting;
+import org.apache.zeppelin.notebook.FileSystemStorage;
+import org.apache.zeppelin.notebook.NotebookAuthorizationInfoSaving;
+import org.apache.zeppelin.user.CredentialsInfoSaving;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+
+/**
+ * It could be used either local file system or hadoop distributed file system,
+ * because FileSystem support both local file system and hdfs.
+ *
+ */
+public class FileSystemConfigStorage extends ConfigStorage {
+
+  private static final Logger LOGGER = LoggerFactory.getLogger(FileSystemConfigStorage.class);
+
+  private FileSystemStorage fs;
+  private Path interpreterSettingPath;
+  private Path authorizationPath;
+  private Path credentialPath;
+
+  public FileSystemConfigStorage(ZeppelinConfiguration zConf) throws IOException {
+    super(zConf);
+    this.fs = FileSystemStorage.get(zConf);
+    this.fs.tryMkDir(new Path(zConf.getConfigFSDir()));
+    this.interpreterSettingPath = fs.makeQualified(new Path(zConf.getInterpreterSettingPath()));
+    this.authorizationPath = fs.makeQualified(new Path(zConf.getNotebookAuthorizationPath()));
+    this.credentialPath = fs.makeQualified(new Path(zConf.getCredentialsPath()));
+  }
+
+  @Override
+  public void save(InterpreterInfoSaving settingInfos) throws IOException {
+    LOGGER.info("Save Interpreter Settings to " + interpreterSettingPath);
+    fs.writeFile(settingInfos.toJson(), interpreterSettingPath, false);
+  }
+
+  @Override
+  public InterpreterInfoSaving loadInterpreterSettings() throws IOException {
+    if (!fs.exists(interpreterSettingPath)) {
+      LOGGER.warn("Interpreter Setting file {} is not existed", interpreterSettingPath);
+      return null;
+    }
+    LOGGER.info("Load Interpreter Setting from file: " + interpreterSettingPath);
+    String json = fs.readFile(interpreterSettingPath);
+    //TODO(zjffdu) This kind of post processing is ugly.
+    JsonParser jsonParser = new JsonParser();
+    JsonObject jsonObject = jsonParser.parse(json).getAsJsonObject();
+    InterpreterInfoSaving infoSaving = InterpreterInfoSaving.fromJson(json);
+    for (InterpreterSetting interpreterSetting : infoSaving.interpreterSettings.values()) {
+      // Always use separate interpreter process
+      // While we decided to turn this feature on always (without providing
+      // enable/disable option on GUI).
+      // previously created setting should turn this feature on here.
+      interpreterSetting.getOption();
+      interpreterSetting.convertPermissionsFromUsersToOwners(
+          jsonObject.getAsJsonObject("interpreterSettings")
+              .getAsJsonObject(interpreterSetting.getId()));
+    }
+    return infoSaving;
+  }
+
+  public void save(NotebookAuthorizationInfoSaving authorizationInfoSaving) throws IOException {
+    LOGGER.info("Save notebook authorization to file: " + authorizationPath);
+    fs.writeFile(authorizationInfoSaving.toJson(), authorizationPath, false);
+  }
+
+  @Override
+  public NotebookAuthorizationInfoSaving loadNotebookAuthorization() throws IOException {
+    if (!fs.exists(authorizationPath)) {
+      LOGGER.warn("Interpreter Setting file {} is not existed", authorizationPath);
+      return null;
+    }
+    LOGGER.info("Load notebook authorization from file: " + authorizationPath);
+    String json = this.fs.readFile(authorizationPath);
+    return NotebookAuthorizationInfoSaving.fromJson(json);
+  }
+
+  @Override
+  public String loadCredentials() throws IOException {
+    if (!fs.exists(credentialPath)) {
+      LOGGER.warn("Credential file {} is not existed", authorizationPath);
+      return null;
+    }
+    LOGGER.info("Load Credential from file: " + authorizationPath);
+    return this.fs.readFile(credentialPath);
+  }
+
+  @Override
+  public void saveCredentials(String credentials) throws IOException {
+    LOGGER.info("Save Credentials to file: " + credentialPath);
+    fs.writeFile(credentials, credentialPath, false);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fbb35f92/zeppelin-zengine/src/main/java/org/apache/zeppelin/user/Credentials.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/user/Credentials.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/user/Credentials.java
new file mode 100644
index 0000000..61f7fff
--- /dev/null
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/user/Credentials.java
@@ -0,0 +1,184 @@
+/*
+* 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.zeppelin.user;
+
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.nio.file.Files;
+import java.nio.file.attribute.PosixFilePermission;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import static java.nio.file.attribute.PosixFilePermission.OWNER_READ;
+import static java.nio.file.attribute.PosixFilePermission.OWNER_WRITE;
+
+/**
+ * Class defining credentials for data source authorization
+ */
+public class Credentials {
+  private static final Logger LOG = LoggerFactory.getLogger(Credentials.class);
+
+  private Map<String, UserCredentials> credentialsMap;
+  private Gson gson;
+  private Boolean credentialsPersist = true;
+  File credentialsFile;
+
+  private Encryptor encryptor;
+  
+  /**
+   * Wrapper fro user credentials. It can load credentials from a file if credentialsPath is
+   * supplied, and will encrypt the file if an encryptKey is supplied.
+   *
+   * @param credentialsPersist
+   * @param credentialsPath
+   * @param encryptKey
+   */
+  public Credentials(Boolean credentialsPersist, String credentialsPath, String encryptKey) {
+    if (encryptKey != null) {
+      this.encryptor = new Encryptor(encryptKey);
+    }
+
+    this.credentialsPersist = credentialsPersist;
+    if (credentialsPath != null) {
+      credentialsFile = new File(credentialsPath);
+    }
+    credentialsMap = new HashMap<>();
+
+    if (credentialsPersist) {
+      GsonBuilder builder = new GsonBuilder();
+      builder.setPrettyPrinting();
+      gson = builder.create();
+      loadFromFile();
+    }
+  }
+
+  public UserCredentials getUserCredentials(String username) {
+    UserCredentials uc = credentialsMap.get(username);
+    if (uc == null) {
+      uc = new UserCredentials();
+    }
+    return uc;
+  }
+
+  public void putUserCredentials(String username, UserCredentials uc) throws IOException {
+    credentialsMap.put(username, uc);
+    saveCredentials();
+  }
+
+  public UserCredentials removeUserCredentials(String username) throws IOException {
+    UserCredentials uc;
+    uc = credentialsMap.remove(username);
+    saveCredentials();
+    return uc;
+  }
+
+  public boolean removeCredentialEntity(String username, String entity) throws IOException {
+    UserCredentials uc = credentialsMap.get(username);
+    if (uc != null && uc.existUsernamePassword(entity) == false) {
+      return false;
+    }
+
+    uc.removeUsernamePassword(entity);
+    saveCredentials();
+    return true;
+  }
+
+  public void saveCredentials() throws IOException {
+    if (credentialsPersist) {
+      saveToFile();
+    }
+  }
+
+  private void loadFromFile() {
+    LOG.info(credentialsFile.getAbsolutePath());
+    if (!credentialsFile.exists()) {
+      // nothing to read
+      return;
+    }
+
+    try {
+      FileInputStream fis = new FileInputStream(credentialsFile);
+      InputStreamReader isr = new InputStreamReader(fis);
+      BufferedReader bufferedReader = new BufferedReader(isr);
+      StringBuilder sb = new StringBuilder();
+      String line;
+      while ((line = bufferedReader.readLine()) != null) {
+        sb.append(line);
+      }
+      isr.close();
+      fis.close();
+
+      String json = sb.toString();
+
+      if (encryptor != null) {
+        json = encryptor.decrypt(json);
+      }
+
+      CredentialsInfoSaving info = CredentialsInfoSaving.fromJson(json);
+      this.credentialsMap = info.credentialsMap;
+    } catch (IOException e) {
+      LOG.error("Error loading credentials file", e);
+      e.printStackTrace();
+    }
+  }
+
+  private void saveToFile() throws IOException {
+    String jsonString;
+
+    synchronized (credentialsMap) {
+      CredentialsInfoSaving info = new CredentialsInfoSaving();
+      info.credentialsMap = credentialsMap;
+      jsonString = gson.toJson(info);
+    }
+
+    try {
+      if (!credentialsFile.exists()) {
+        credentialsFile.createNewFile();
+
+        Set<PosixFilePermission> permissions = EnumSet.of(OWNER_READ, OWNER_WRITE);
+        Files.setPosixFilePermissions(credentialsFile.toPath(), permissions);
+      }
+
+      FileOutputStream fos = new FileOutputStream(credentialsFile, false);
+      OutputStreamWriter out = new OutputStreamWriter(fos);
+
+      if (encryptor != null) {
+        jsonString = encryptor.encrypt(jsonString);
+      }
+
+      out.append(jsonString);
+      out.close();
+      fos.close();
+    } catch (IOException e) {
+      LOG.error("Error saving credentials file", e);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fbb35f92/zeppelin-zengine/src/main/java/org/apache/zeppelin/user/CredentialsInfoSaving.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/user/CredentialsInfoSaving.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/user/CredentialsInfoSaving.java
new file mode 100644
index 0000000..48bb24d
--- /dev/null
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/user/CredentialsInfoSaving.java
@@ -0,0 +1,40 @@
+/*
+ * 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.zeppelin.user;
+
+import com.google.gson.Gson;
+import org.apache.zeppelin.common.JsonSerializable;
+
+import java.util.Map;
+
+/**
+ * Helper class to save credentials
+ */
+public class CredentialsInfoSaving implements JsonSerializable {
+  private static final Gson gson = new Gson();
+
+  public Map<String, UserCredentials> credentialsMap;
+
+  public String toJson() {
+    return gson.toJson(this);
+  }
+
+  public static CredentialsInfoSaving fromJson(String json) {
+    return gson.fromJson(json, CredentialsInfoSaving.class);
+  }
+}

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fbb35f92/zeppelin-zengine/src/main/java/org/apache/zeppelin/user/Encryptor.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/user/Encryptor.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/user/Encryptor.java
new file mode 100644
index 0000000..ee24090
--- /dev/null
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/user/Encryptor.java
@@ -0,0 +1,77 @@
+/*
+ * 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.zeppelin.user;
+
+import org.bouncycastle.crypto.BufferedBlockCipher;
+import org.bouncycastle.crypto.InvalidCipherTextException;
+import org.bouncycastle.crypto.engines.AESEngine;
+import org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher;
+import org.bouncycastle.crypto.paddings.ZeroBytePadding;
+import org.bouncycastle.crypto.params.KeyParameter;
+import org.bouncycastle.util.encoders.Base64;
+
+import java.io.IOException;
+
+/**
+ * Encrypt/decrypt arrays of bytes!
+ */
+public class Encryptor {
+  private final BufferedBlockCipher encryptCipher;
+  private final BufferedBlockCipher decryptCipher;
+
+  public Encryptor(String encryptKey) {
+    encryptCipher = new PaddedBufferedBlockCipher(new AESEngine(), new ZeroBytePadding());
+    encryptCipher.init(true, new KeyParameter(encryptKey.getBytes()));
+
+    decryptCipher = new PaddedBufferedBlockCipher(new AESEngine(), new ZeroBytePadding());
+    decryptCipher.init(false, new KeyParameter(encryptKey.getBytes()));
+  }
+
+
+  public String encrypt(String inputString) throws IOException {
+    byte[] input = inputString.getBytes();
+    byte[] result = new byte[encryptCipher.getOutputSize(input.length)];
+    int size = encryptCipher.processBytes(input, 0, input.length, result, 0);
+
+    try {
+      size += encryptCipher.doFinal(result, size);
+
+      byte[] out = new byte[size];
+      System.arraycopy(result, 0, out, 0, size);
+      return new String(Base64.encode(out));
+    } catch (InvalidCipherTextException e) {
+      throw new IOException("Cannot encrypt: " + e.getMessage(), e);
+    }
+  }
+
+  public String decrypt(String base64Input) throws IOException {
+    byte[] input = Base64.decode(base64Input);
+    byte[] result = new byte[decryptCipher.getOutputSize(input.length)];
+    int size = decryptCipher.processBytes(input, 0, input.length, result, 0);
+
+    try {
+      size += decryptCipher.doFinal(result, size);
+
+      byte[] out = new byte[size];
+      System.arraycopy(result, 0, out, 0, size);
+      return new String(out);
+    } catch (InvalidCipherTextException e) {
+      throw new IOException("Cannot decrypt: " + e.getMessage(), e);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fbb35f92/zeppelin-zengine/src/test/java/org/apache/zeppelin/conf/ZeppelinConfigurationTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/conf/ZeppelinConfigurationTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/conf/ZeppelinConfigurationTest.java
index 17d6ad3..2b50427 100644
--- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/conf/ZeppelinConfigurationTest.java
+++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/conf/ZeppelinConfigurationTest.java
@@ -92,4 +92,12 @@ public class ZeppelinConfigurationTest {
     boolean isIt = conf.isNotebookPublic();
     assertTrue(isIt);
   }
+
+  @Test
+  public void getPathTest() throws ConfigurationException {
+    System.setProperty(ConfVars.ZEPPELIN_HOME.getVarName(), "/usr/lib/zeppelin");
+    ZeppelinConfiguration conf = new ZeppelinConfiguration(this.getClass().getResource("/zeppelin-site.xml"));
+    Assert.assertEquals("/usr/lib/zeppelin", conf.getZeppelinHome());
+    Assert.assertEquals("/usr/lib/zeppelin/conf", conf.getConfDir());
+  }
 }

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fbb35f92/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java
index 0a762d8..760bdf0 100644
--- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java
+++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java
@@ -39,6 +39,7 @@ public class InterpreterFactoryTest extends AbstractInterpreterTest {
     assertTrue(interpreterFactory.getInterpreter("user1", "note1", "") instanceof RemoteInterpreter);
     RemoteInterpreter remoteInterpreter = (RemoteInterpreter) interpreterFactory.getInterpreter("user1", "note1", "");
     // EchoInterpreter is the default interpreter because mock1 is the default interpreter group
+
     assertEquals(EchoInterpreter.class.getName(), remoteInterpreter.getClassName());
 
     assertTrue(interpreterFactory.getInterpreter("user1", "note1", "test") instanceof RemoteInterpreter);

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fbb35f92/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/launcher/SparkInterpreterLauncherTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/launcher/SparkInterpreterLauncherTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/launcher/SparkInterpreterLauncherTest.java
index a3e6a9b..eb44809 100644
--- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/launcher/SparkInterpreterLauncherTest.java
+++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/launcher/SparkInterpreterLauncherTest.java
@@ -47,8 +47,8 @@ public class SparkInterpreterLauncherTest {
     assertTrue( client instanceof RemoteInterpreterManagedProcess);
     RemoteInterpreterManagedProcess interpreterProcess = (RemoteInterpreterManagedProcess) client;
     assertEquals("spark", interpreterProcess.getInterpreterSettingName());
-    assertEquals(".//interpreter/spark", interpreterProcess.getInterpreterDir());
-    assertEquals(".//local-repo/groupId", interpreterProcess.getLocalRepoDir());
+    assertTrue(interpreterProcess.getInterpreterDir().endsWith("/interpreter/spark"));
+    assertTrue(interpreterProcess.getLocalRepoDir().endsWith("/local-repo/groupId"));
     assertEquals(zConf.getInterpreterRemoteRunnerPath(), interpreterProcess.getInterpreterRunner());
     assertEquals(2, interpreterProcess.getEnv().size());
     assertEquals("/user/spark", interpreterProcess.getEnv().get("SPARK_HOME"));
@@ -72,8 +72,8 @@ public class SparkInterpreterLauncherTest {
     assertTrue( client instanceof RemoteInterpreterManagedProcess);
     RemoteInterpreterManagedProcess interpreterProcess = (RemoteInterpreterManagedProcess) client;
     assertEquals("spark", interpreterProcess.getInterpreterSettingName());
-    assertEquals(".//interpreter/spark", interpreterProcess.getInterpreterDir());
-    assertEquals(".//local-repo/groupId", interpreterProcess.getLocalRepoDir());
+    assertTrue(interpreterProcess.getInterpreterDir().endsWith("/interpreter/spark"));
+    assertTrue(interpreterProcess.getLocalRepoDir().endsWith("/local-repo/groupId"));
     assertEquals(zConf.getInterpreterRemoteRunnerPath(), interpreterProcess.getInterpreterRunner());
     assertEquals(2, interpreterProcess.getEnv().size());
     assertEquals("/user/spark", interpreterProcess.getEnv().get("SPARK_HOME"));
@@ -98,8 +98,8 @@ public class SparkInterpreterLauncherTest {
     assertTrue( client instanceof RemoteInterpreterManagedProcess);
     RemoteInterpreterManagedProcess interpreterProcess = (RemoteInterpreterManagedProcess) client;
     assertEquals("spark", interpreterProcess.getInterpreterSettingName());
-    assertEquals(".//interpreter/spark", interpreterProcess.getInterpreterDir());
-    assertEquals(".//local-repo/groupId", interpreterProcess.getLocalRepoDir());
+    assertTrue(interpreterProcess.getInterpreterDir().endsWith("/interpreter/spark"));
+    assertTrue(interpreterProcess.getLocalRepoDir().endsWith("/local-repo/groupId"));
     assertEquals(zConf.getInterpreterRemoteRunnerPath(), interpreterProcess.getInterpreterRunner());
     assertEquals(2, interpreterProcess.getEnv().size());
     assertEquals("/user/spark", interpreterProcess.getEnv().get("SPARK_HOME"));
@@ -123,8 +123,8 @@ public class SparkInterpreterLauncherTest {
     assertTrue( client instanceof RemoteInterpreterManagedProcess);
     RemoteInterpreterManagedProcess interpreterProcess = (RemoteInterpreterManagedProcess) client;
     assertEquals("spark", interpreterProcess.getInterpreterSettingName());
-    assertEquals(".//interpreter/spark", interpreterProcess.getInterpreterDir());
-    assertEquals(".//local-repo/groupId", interpreterProcess.getLocalRepoDir());
+    assertTrue(interpreterProcess.getInterpreterDir().endsWith("/interpreter/spark"));
+    assertTrue(interpreterProcess.getLocalRepoDir().endsWith("/local-repo/groupId"));
     assertEquals(zConf.getInterpreterRemoteRunnerPath(), interpreterProcess.getInterpreterRunner());
     assertEquals(3, interpreterProcess.getEnv().size());
     assertEquals("/user/spark", interpreterProcess.getEnv().get("SPARK_HOME"));
@@ -151,8 +151,8 @@ public class SparkInterpreterLauncherTest {
     assertTrue( client instanceof RemoteInterpreterManagedProcess);
     RemoteInterpreterManagedProcess interpreterProcess = (RemoteInterpreterManagedProcess) client;
     assertEquals("spark", interpreterProcess.getInterpreterSettingName());
-    assertEquals(".//interpreter/spark", interpreterProcess.getInterpreterDir());
-    assertEquals(".//local-repo/groupId", interpreterProcess.getLocalRepoDir());
+    assertTrue(interpreterProcess.getInterpreterDir().endsWith("/interpreter/spark"));
+    assertTrue(interpreterProcess.getLocalRepoDir().endsWith("/local-repo/groupId"));
     assertEquals(zConf.getInterpreterRemoteRunnerPath(), interpreterProcess.getInterpreterRunner());
     assertEquals(3, interpreterProcess.getEnv().size());
     assertEquals("/user/spark", interpreterProcess.getEnv().get("SPARK_HOME"));

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fbb35f92/zeppelin-zengine/src/test/java/org/apache/zeppelin/user/CredentialsTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/user/CredentialsTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/user/CredentialsTest.java
new file mode 100644
index 0000000..84a1244
--- /dev/null
+++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/user/CredentialsTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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.zeppelin.user;
+
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+
+public class CredentialsTest {
+
+  @Test
+  public void testDefaultProperty() throws IOException {
+    Credentials credentials = new Credentials(false, null, null);
+    UserCredentials userCredentials = new UserCredentials();
+    UsernamePassword up1 = new UsernamePassword("user2", "password");
+    userCredentials.putUsernamePassword("hive(vertica)", up1);
+    credentials.putUserCredentials("user1", userCredentials);
+    UserCredentials uc2 = credentials.getUserCredentials("user1");
+    UsernamePassword up2 = uc2.getUsernamePassword("hive(vertica)");
+    assertEquals(up1.getUsername(), up2.getUsername());
+    assertEquals(up1.getPassword(), up2.getPassword());
+  }
+}

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fbb35f92/zeppelin-zengine/src/test/java/org/apache/zeppelin/user/EncryptorTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/user/EncryptorTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/user/EncryptorTest.java
new file mode 100644
index 0000000..9950be6
--- /dev/null
+++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/user/EncryptorTest.java
@@ -0,0 +1,41 @@
+/*
+ * 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.zeppelin.user;
+
+import java.io.IOException;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
+public class EncryptorTest {
+
+  @Test
+  public void testEncryption() throws IOException {
+    Encryptor encryptor = new Encryptor("foobar1234567890");
+
+    String input = "test";
+
+    String encrypted = encryptor.encrypt(input);
+    assertNotEquals(input, encrypted);
+
+    String decrypted = encryptor.decrypt(encrypted);
+    assertEquals(input, decrypted);
+  }
+}