summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIanHowell <ian.howell@att.com>2018-05-21 14:17:56 -0500
committerIanHowell <ian.howell@att.com>2018-05-21 14:17:59 -0500
commit39e271cdff2b4c1e1d1d09dd129d791e1f4bbc88 (patch)
tree7e56a3c63415004673e3fde8eca0d5a8809fd5b1
parentee51fce2672cd41a0c9ec630365e0b9fd62f22b6 (diff)
Fix a bug in the CmAgent JUnit
Issue-ID: AAF-223 Change-Id: Ida4ae9c3ae644c137a576beebe94c9083939aab5 Signed-off-by: IanHowell <ian.howell@att.com>
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/cm/CmAgent.java13
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_CmAgent.java11
2 files changed, 19 insertions, 5 deletions
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/cm/CmAgent.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/cm/CmAgent.java
index f900a1f4..bcc156c8 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/cm/CmAgent.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/cm/CmAgent.java
@@ -79,9 +79,12 @@ public class CmAgent {
private static ErrMessage errMsg;
private static Map<String,PlaceArtifact> placeArtifact;
private static RosettaEnv env;
+
+ private static boolean doExit;
public static void main(String[] args) {
int exitCode = 0;
+ doExit = true;
try {
AAFSSO aafsso = new AAFSSO(args);
if(aafsso.loginOnly()) {
@@ -93,7 +96,9 @@ public class CmAgent {
env = new RosettaEnv(access.getProperties());
Deque<String> cmds = new ArrayDeque<String>();
for(String p : args) {
- if(p.indexOf('=')<0) {
+ if("-noexit".equalsIgnoreCase(p)) {
+ doExit = false;
+ } else if(p.indexOf('=') < 0) {
cmds.add(p);
}
}
@@ -110,7 +115,9 @@ public class CmAgent {
System.out.println(" showpass <mechID> [<machine>]");
System.out.println(" check <mechID> [<machine>]");
System.out.println(" genkeypair");
- System.exit(1);
+ if (doExit) {
+ System.exit(1);
+ }
}
TIMEOUT = Integer.parseInt(env.getProperty(Config.AAF_CONN_TIMEOUT, "5000"));
@@ -183,7 +190,7 @@ public class CmAgent {
} catch (Exception e) {
e.printStackTrace();
}
- if(exitCode!=0) {
+ if(exitCode != 0 && doExit) {
System.exit(exitCode);
}
}
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_CmAgent.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_CmAgent.java
index 34ccf57b..fbeb360f 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_CmAgent.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_CmAgent.java
@@ -56,54 +56,61 @@ public class JU_CmAgent {
String[] args;
args = new String[] {
"-login",
- "-noexit",
+ "-noExit",
};
CmAgent.main(args);
inStream.reset();
args = new String[] {
- "noexit=true",
+ "-noExit",
};
CmAgent.main(args);
inStream.reset();
args = new String[] {
"place",
+ "-noExit",
};
CmAgent.main(args);
inStream.reset();
args = new String[] {
+ "-noExit",
"create"
};
CmAgent.main(args);
inStream.reset();
args = new String[] {
+ "-noExit",
"read"
};
CmAgent.main(args);
inStream.reset();
args = new String[] {
+ "-noExit",
"copy"
};
CmAgent.main(args);
inStream.reset();
args = new String[] {
+ "-noExit",
"update"
};
CmAgent.main(args);
inStream.reset();
args = new String[] {
+ "-noExit",
"delete"
};
CmAgent.main(args);
inStream.reset();
args = new String[] {
+ "-noExit",
"showpass"
};
CmAgent.main(args);