You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by lm...@apache.org on 2014/02/14 05:44:54 UTC

git commit: adding a verification that the expected alias value was set

Updated Branches:
  refs/heads/master 38f2c1433 -> ca2e1596c


adding a verification that the expected alias value was set

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

Branch: refs/heads/master
Commit: ca2e1596c5f0ebc798d1f8d93bccbf452e29c149
Parents: 38f2c14
Author: Larry McCay <lm...@hortonworks.com>
Authored: Thu Feb 13 23:44:21 2014 -0500
Committer: Larry McCay <lm...@hortonworks.com>
Committed: Thu Feb 13 23:44:21 2014 -0500

----------------------------------------------------------------------
 .../java/org/apache/hadoop/gateway/util/KnoxCLITest.java     | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/ca2e1596/gateway-server/src/test/java/org/apache/hadoop/gateway/util/KnoxCLITest.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/test/java/org/apache/hadoop/gateway/util/KnoxCLITest.java b/gateway-server/src/test/java/org/apache/hadoop/gateway/util/KnoxCLITest.java
index 95c3e37..e50e04a 100644
--- a/gateway-server/src/test/java/org/apache/hadoop/gateway/util/KnoxCLITest.java
+++ b/gateway-server/src/test/java/org/apache/hadoop/gateway/util/KnoxCLITest.java
@@ -22,6 +22,8 @@ import static org.junit.Assert.*;
 import java.io.ByteArrayOutputStream;
 import java.io.PrintStream;
 
+import org.apache.hadoop.gateway.services.security.AliasService;
+
 import org.apache.hadoop.gateway.services.GatewayServices;
 import org.apache.hadoop.gateway.services.security.MasterService;
 import org.apache.hadoop.gateway.services.security.impl.CLIMasterService;
@@ -88,6 +90,8 @@ public class KnoxCLITest {
     assertTrue(outContent.toString(), outContent.toString().contains("alias1 has been successfully " +
         "created."));
 
+	AliasService as = cli.getGatewayServices().getService(GatewayServices.ALIAS_SERVICE);
+
     outContent.reset();
     String[] clusterCreateArgs = {"create-alias", "alias2", "--value", "testvalue1", "--cluster", "test", 
         "--master", "master"};
@@ -106,6 +110,10 @@ public class KnoxCLITest {
     assertFalse(outContent.toString(), outContent.toString().contains("alias2"));
     assertTrue(outContent.toString(), outContent.toString().contains("alias1"));
 
+	char[] passwordChars = as.getPasswordFromAliasForCluster("test", "alias2");
+	assertNotNull(passwordChars);
+	assertTrue(new String(passwordChars), "testvalue1".equals(new String(passwordChars)));
+
     outContent.reset();
     String[] args1 = {"list-alias", "--cluster", "test", "--master", "master"};
     cli = new KnoxCLI();