summaryrefslogtreecommitdiffstats
path: root/profiles/http/src/main/java/org
diff options
context:
space:
mode:
authorsubhash kumar singh <subhash.kumar.singh@huawei.com>2018-03-13 10:43:36 +0000
committersubhash kumar singh <subhash.kumar.singh@huawei.com>2018-03-13 10:44:57 +0000
commit8c08476d0b6bffa3230a0e34ff29586eefed38e0 (patch)
tree50df9a90f3cbbe4ea6824e1a95b774e0f2d0465c /profiles/http/src/main/java/org
parenta59f5607eaf196e032990b3ca962f2378e45fa52 (diff)
Enable feature to disable mock for verify
Enable feature to disable mock for verify so that real environment can be used. Issue-ID: CLI-74 Change-Id: Ibaa15b7c93fcf077e3f28e9f7e96b1b8a68ad5c0 Signed-off-by: subhash kumar singh <subhash.kumar.singh@huawei.com>
Diffstat (limited to 'profiles/http/src/main/java/org')
-rw-r--r--profiles/http/src/main/java/org/onap/cli/fw/http/cmd/OnapHttpCommand.java16
-rw-r--r--profiles/http/src/main/java/org/onap/cli/fw/http/conf/OnapCommandHttpConstants.java1
2 files changed, 13 insertions, 4 deletions
diff --git a/profiles/http/src/main/java/org/onap/cli/fw/http/cmd/OnapHttpCommand.java b/profiles/http/src/main/java/org/onap/cli/fw/http/cmd/OnapHttpCommand.java
index 9477cfa9..6574552e 100644
--- a/profiles/http/src/main/java/org/onap/cli/fw/http/cmd/OnapHttpCommand.java
+++ b/profiles/http/src/main/java/org/onap/cli/fw/http/cmd/OnapHttpCommand.java
@@ -68,6 +68,8 @@ public class OnapHttpCommand extends OnapCommand {
boolean shouldVerify = false;
+ boolean mockingEnabled;
+
public OnapHttpCommand() {
super.addDefaultSchemas(OnapCommandHttpConstants.DEFAULT_PARAMETER_HTTP_FILE_NAME);
}
@@ -176,17 +178,23 @@ public class OnapHttpCommand extends OnapCommand {
if (contextOpt.isPresent()) {
OnapCommandParameter context = contextOpt.get();
- String mockedFile = ((Map<String, String>)context.getValue()).get(OnapCommandConstants.VERIFY_MOCO);
+ Map<String, String> map = (Map<String, String>) context.getValue();
+
+ mockingEnabled = map.containsKey(OnapCommandHttpConstants.VERIFY_DISABLE_MOCKING)
+ && map.get(OnapCommandHttpConstants.VERIFY_DISABLE_MOCKING).equals("true") ? false : true;
- mocoServer = new MocoServer(mockedFile);
- mocoServer.start();
+ if (mockingEnabled) {
+ String mockedFile = ((Map<String, String>) context.getValue()).get(OnapCommandConstants.VERIFY_MOCO);
+ mocoServer = new MocoServer(mockedFile);
+ mocoServer.start();
+ }
}
}
}
@Override
protected void postRun() throws OnapCommandException {
- if (shouldVerify) {
+ if (shouldVerify && mockingEnabled) {
mocoServer.stop();
}
}
diff --git a/profiles/http/src/main/java/org/onap/cli/fw/http/conf/OnapCommandHttpConstants.java b/profiles/http/src/main/java/org/onap/cli/fw/http/conf/OnapCommandHttpConstants.java
index 185582cb..18dde339 100644
--- a/profiles/http/src/main/java/org/onap/cli/fw/http/conf/OnapCommandHttpConstants.java
+++ b/profiles/http/src/main/java/org/onap/cli/fw/http/conf/OnapCommandHttpConstants.java
@@ -108,6 +108,7 @@ public class OnapCommandHttpConstants {
public static final String VERIFY_RESPONSE = "response";
public static final String VERIFY_CONTENT_TYPE = "Content-Type";
public static final String VERIFY_CONTENT_TYPE_VALUE = APPLICATION_JSON;
+ public static final String VERIFY_DISABLE_MOCKING = "DISABLE_MOCKING";
}