Repository: knox
Updated Branches:
  refs/heads/master 3760da52f -> 2190ce463


KNOX-1646 - Fix test assumptions

Signed-off-by: Kevin Risden <[email protected]>


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

Branch: refs/heads/master
Commit: 2190ce463f099230ad6388a526705c69469d05c2
Parents: 3760da5
Author: Kevin Risden <[email protected]>
Authored: Fri Nov 30 13:12:59 2018 -0500
Committer: Kevin Risden <[email protected]>
Committed: Fri Nov 30 13:13:03 2018 -0500

----------------------------------------------------------------------
 .../apache/knox/gateway/util/KnoxCLITest.java   | 37 ++++++++------------
 1 file changed, 15 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/2190ce46/gateway-server/src/test/java/org/apache/knox/gateway/util/KnoxCLITest.java
----------------------------------------------------------------------
diff --git 
a/gateway-server/src/test/java/org/apache/knox/gateway/util/KnoxCLITest.java 
b/gateway-server/src/test/java/org/apache/knox/gateway/util/KnoxCLITest.java
index 42dbc63..f82593f 100644
--- a/gateway-server/src/test/java/org/apache/knox/gateway/util/KnoxCLITest.java
+++ b/gateway-server/src/test/java/org/apache/knox/gateway/util/KnoxCLITest.java
@@ -703,7 +703,7 @@ public class KnoxCLITest {
     KnoxCLI cli = new KnoxCLI();
     cli.setConf( config );
     String[] gwCreateArgs = {"create-cert", "--hostname", "hostname1", 
"--master", "master"};
-    int rc = 0;
+    int rc;
     rc = cli.run(gwCreateArgs);
     assertEquals(0, rc);
     assertTrue(outContent.toString(StandardCharsets.UTF_8.name()), 
outContent.toString(StandardCharsets.UTF_8.name()).contains("gateway-identity 
has been successfully " +
@@ -711,7 +711,6 @@ public class KnoxCLITest {
 
     outContent.reset();
     String[] gwCreateArgs2 = {"export-cert", "--type", "PEM"};
-    rc = 0;
     rc = cli.run(gwCreateArgs2);
     assertEquals(0, rc);
     assertTrue(outContent.toString(StandardCharsets.UTF_8.name()), 
outContent.toString(StandardCharsets.UTF_8.name()).contains("Certificate 
gateway-identity has been successfully exported to"));
@@ -720,49 +719,43 @@ public class KnoxCLITest {
     // case insensitive
     outContent.reset();
     String[] gwCreateArgs2_6 = {"export-cert", "--type", "pem"};
-    rc = 0;
     rc = cli.run(gwCreateArgs2_6);
     assertEquals(0, rc);
     assertTrue(outContent.toString(StandardCharsets.UTF_8.name()), 
outContent.toString(StandardCharsets.UTF_8.name()).contains("Certificate 
gateway-identity has been successfully exported to"));
     assertTrue(outContent.toString(StandardCharsets.UTF_8.name()), 
outContent.toString(StandardCharsets.UTF_8.name()).contains("gateway-identity.pem"));
 
-    // pkcs12
     outContent.reset();
-    String[] gwCreateArgs2_7 = {"export-cert", "--type", "pkcs12"};
-    rc = 0;
-    rc = cli.run(gwCreateArgs2_7);
+    String[] gwCreateArgs2_5 = {"export-cert"};
+    rc = cli.run(gwCreateArgs2_5);
     assertEquals(0, rc);
     assertTrue(outContent.toString(StandardCharsets.UTF_8.name()), 
outContent.toString(StandardCharsets.UTF_8.name()).contains("Certificate 
gateway-identity has been successfully exported to"));
-    assertTrue(outContent.toString(StandardCharsets.UTF_8.name()), 
outContent.toString(StandardCharsets.UTF_8.name()).contains("gateway-identity.pkcs12"));
+    assertTrue(outContent.toString(StandardCharsets.UTF_8.name()), 
outContent.toString(StandardCharsets.UTF_8.name()).contains("gateway-identity.pem"));
 
-    // jceks
     outContent.reset();
-    String[] gwCreateArgs2_8 = {"export-cert", "--type", "jceks"};
-    rc = 0;
-    rc = cli.run(gwCreateArgs2_8);
+    String[] gwCreateArgs3 = {"export-cert", "--type", "JKS"};
+    rc = cli.run(gwCreateArgs3);
     assertEquals(0, rc);
     assertTrue(outContent.toString(StandardCharsets.UTF_8.name()), 
outContent.toString(StandardCharsets.UTF_8.name()).contains("Certificate 
gateway-identity has been successfully exported to"));
-    assertTrue(outContent.toString(StandardCharsets.UTF_8.name()), 
outContent.toString(StandardCharsets.UTF_8.name()).contains("gateway-identity.jceks"));
+    assertTrue(outContent.toString(StandardCharsets.UTF_8.name()), 
outContent.toString(StandardCharsets.UTF_8.name()).contains("gateway-client-trust.jks"));
 
+    // pkcs12
     outContent.reset();
-    String[] gwCreateArgs2_5 = {"export-cert"};
-    rc = 0;
-    rc = cli.run(gwCreateArgs2_5);
+    String[] gwCreateArgs2_7 = {"export-cert", "--type", "pkcs12"};
+    rc = cli.run(gwCreateArgs2_7);
     assertEquals(0, rc);
     assertTrue(outContent.toString(StandardCharsets.UTF_8.name()), 
outContent.toString(StandardCharsets.UTF_8.name()).contains("Certificate 
gateway-identity has been successfully exported to"));
-    assertTrue(outContent.toString(StandardCharsets.UTF_8.name()), 
outContent.toString(StandardCharsets.UTF_8.name()).contains("gateway-identity.pem"));
+    assertTrue(outContent.toString(StandardCharsets.UTF_8.name()), 
outContent.toString(StandardCharsets.UTF_8.name()).contains("gateway-client-trust.pkcs12"));
 
+    // jceks
     outContent.reset();
-    String[] gwCreateArgs3 = {"export-cert", "--type", "JKS"};
-    rc = 0;
-    rc = cli.run(gwCreateArgs3);
+    String[] gwCreateArgs2_8 = {"export-cert", "--type", "jceks"};
+    rc = cli.run(gwCreateArgs2_8);
     assertEquals(0, rc);
     assertTrue(outContent.toString(StandardCharsets.UTF_8.name()), 
outContent.toString(StandardCharsets.UTF_8.name()).contains("Certificate 
gateway-identity has been successfully exported to"));
-    assertTrue(outContent.toString(StandardCharsets.UTF_8.name()), 
outContent.toString(StandardCharsets.UTF_8.name()).contains("gateway-client-trust.jks"));
+    assertTrue(outContent.toString(StandardCharsets.UTF_8.name()), 
outContent.toString(StandardCharsets.UTF_8.name()).contains("gateway-client-trust.jceks"));
 
     outContent.reset();
     String[] gwCreateArgs4 = {"export-cert", "--type", "invalid"};
-    rc = 0;
     rc = cli.run(gwCreateArgs4);
     assertEquals(0, rc);
     assertTrue(outContent.toString(StandardCharsets.UTF_8.name()), 
outContent.toString(StandardCharsets.UTF_8.name()).contains("Invalid type for 
export file provided."));

Reply via email to