aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src
diff options
context:
space:
mode:
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-08-11 10:41:29 +0530
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-08-11 10:44:08 +0530
commit5a0dadc2c7439719142db3c7e2200d12face4b45 (patch)
tree4c4434a5e5baa4020688f32b725fde02302ca7f5 /framework/src
parentfe2e261b250be6724c305d4c6f940ca35263596f (diff)
Migrate msb-url into host-url
CLI framework is being enhanced to support different service mode like direct and catalog and msb term is verfy specific to catalog mode. so its migrated to move to generic format CLI-29 Change-Id: I93f8354e2f32f7cae1660168ce403c76cca0587f Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'framework/src')
-rw-r--r--framework/src/main/java/org/onap/cli/fw/ad/OnapAuthClient.java14
-rw-r--r--framework/src/main/java/org/onap/cli/fw/ad/OnapCredentials.java16
-rw-r--r--framework/src/main/java/org/onap/cli/fw/conf/Constants.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java2
-rw-r--r--framework/src/main/resources/default_input_parameters.yaml8
-rw-r--r--framework/src/main/resources/onap.properties6
-rw-r--r--framework/src/main/resources/schema-validate.yaml2
-rw-r--r--framework/src/test/java/org/onap/cli/cmd/sample/OnapCommandSampleTest.java4
-rw-r--r--framework/src/test/java/org/onap/cli/fw/TestCommandValidate.java2
-rw-r--r--framework/src/test/java/org/onap/cli/fw/ad/OnapCredentialsTest.java2
-rw-r--r--framework/src/test/java/org/onap/cli/fw/cmd/OnapHttpCommandTest.java4
-rw-r--r--framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommandTest.java4
-rw-r--r--framework/src/test/java/org/onap/cli/fw/defaultParameter/TestDefaultParameterSection.java8
-rw-r--r--framework/src/test/resources/onap.properties6
-rw-r--r--framework/src/test/resources/sample-cmd-test-help.txt4
-rw-r--r--framework/src/test/resources/sample-test-include-exclude.yaml2
16 files changed, 43 insertions, 43 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/ad/OnapAuthClient.java b/framework/src/main/java/org/onap/cli/fw/ad/OnapAuthClient.java
index e6c69a11..e87ef0ae 100644
--- a/framework/src/main/java/org/onap/cli/fw/ad/OnapAuthClient.java
+++ b/framework/src/main/java/org/onap/cli/fw/ad/OnapAuthClient.java
@@ -45,7 +45,7 @@ public class OnapAuthClient {
public OnapAuthClient(OnapCredentials creds, boolean debug) throws OnapCommandHttpFailure {
this.creds = creds;
- this.http = new OnapHttpConnection(creds.getMsbUrl().startsWith("https"), debug);
+ this.http = new OnapHttpConnection(creds.getHostUrl().startsWith("https"), debug);
}
/**
@@ -136,13 +136,13 @@ public class OnapAuthClient {
*/
public String getServiceBasePath(OnapService srv) throws OnapCommandException {
if (srv.getName().equals(OnapCommandConfg.getApiGateway())) {
- return this.getMsbUrl();
+ return this.getApiGatewayUrl();
} else if (srv.isModeDirect()){
- return this.creds.getMsbUrl();
+ return this.creds.getHostUrl();
}
- HttpInput input = new HttpInput().setUri(this.creds.getMsbUrl()
+ HttpInput input = new HttpInput().setUri(this.creds.getHostUrl()
+ String.format(Constants.MSB_SERVICE_URI, srv.getName(), srv.getVersion()));
HttpResult result = this.http.get(input);
@@ -154,7 +154,7 @@ public class OnapAuthClient {
}
try {
- return this.creds.getMsbUrl() + JsonPath.read(result.getBody(), "url");
+ return this.creds.getHostUrl() + JsonPath.read(result.getBody(), "url");
} catch (Exception e) {
throw new OnapCommandExecutionFailed(e, srv.toString());
}
@@ -167,8 +167,8 @@ public class OnapAuthClient {
return this.getServiceBasePath(srv);
}
- private String getMsbUrl() {
- return this.creds.getMsbUrl() + Constants.MSB_URI;
+ private String getApiGatewayUrl() {
+ return this.creds.getHostUrl() + Constants.MSB_URI;
}
public String getAuthToken() {
diff --git a/framework/src/main/java/org/onap/cli/fw/ad/OnapCredentials.java b/framework/src/main/java/org/onap/cli/fw/ad/OnapCredentials.java
index 7c3c3ac0..02291b22 100644
--- a/framework/src/main/java/org/onap/cli/fw/ad/OnapCredentials.java
+++ b/framework/src/main/java/org/onap/cli/fw/ad/OnapCredentials.java
@@ -32,9 +32,9 @@ public class OnapCredentials {
private String password;
/*
- * Onap Service msb-url
+ * Onap Service host-url
*/
- private String msbUrl;
+ private String hostUrl;
/**
* Onap credentials with username and password.
@@ -43,14 +43,14 @@ public class OnapCredentials {
* user name
* @param password
* password
- * @param msbUrl
- * msb url
+ * @param hostUrl
+ * host url
*/
- public OnapCredentials(String username, String password, String msbUrl) {
+ public OnapCredentials(String username, String password, String hostUrl) {
super();
this.username = username;
this.password = password;
- this.msbUrl = msbUrl;
+ this.hostUrl = hostUrl;
}
public String getUsername() {
@@ -61,7 +61,7 @@ public class OnapCredentials {
return password;
}
- public String getMsbUrl() {
- return msbUrl;
+ public String getHostUrl() {
+ return hostUrl;
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/conf/Constants.java b/framework/src/main/java/org/onap/cli/fw/conf/Constants.java
index e487bbf2..d711ba25 100644
--- a/framework/src/main/java/org/onap/cli/fw/conf/Constants.java
+++ b/framework/src/main/java/org/onap/cli/fw/conf/Constants.java
@@ -94,7 +94,7 @@ public class Constants {
// Common parameters used across all commands.
public static final String DEAFULT_PARAMETER_USERNAME = "onap-username";
public static final String DEAFULT_PARAMETER_PASS_WORD = "onap-password";
- public static final String DEAFULT_PARAMETER_MSB_URL = "msb-url";
+ public static final String DEAFULT_PARAMETER_HOST_URL = "host-url";
public static final String DEFAULT_PARAMETER_HELP = "help";
public static final String DEFAULT_PARAMETER_VERSION = "version";
public static final String DEFAULT_PARAMETER_DEBUG = "debug";
diff --git a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java
index b4df2ace..9a425397 100644
--- a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java
+++ b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java
@@ -682,7 +682,7 @@ public class OnapCommandUtils {
return new OnapCredentials(paramMap.get(Constants.DEAFULT_PARAMETER_USERNAME),
paramMap.get(Constants.DEAFULT_PARAMETER_PASS_WORD),
- paramMap.get(Constants.DEAFULT_PARAMETER_MSB_URL));
+ paramMap.get(Constants.DEAFULT_PARAMETER_HOST_URL));
}
/**
diff --git a/framework/src/main/resources/default_input_parameters.yaml b/framework/src/main/resources/default_input_parameters.yaml
index 4f0d419c..3b7e198a 100644
--- a/framework/src/main/resources/default_input_parameters.yaml
+++ b/framework/src/main/resources/default_input_parameters.yaml
@@ -15,13 +15,13 @@ parameters:
default_value: ${ONAP_PASSWORD}
is_secured: true
is_optional: false
- - name: msb-url
+ - name: host-url
type: url
- description: Onap MSB url
+ description: Onap host url
short_option: m
- long_option: msb-url
+ long_option: host-url
is_optional: false
- default_value: ${ONAP_MSB_URL}
+ default_value: ${ONAP_HOST_URL}
- name: help
type: string
description: Onap command help message
diff --git a/framework/src/main/resources/onap.properties b/framework/src/main/resources/onap.properties
index b8f08d3b..47b02c8c 100644
--- a/framework/src/main/resources/onap.properties
+++ b/framework/src/main/resources/onap.properties
@@ -8,7 +8,7 @@ cli.api_gateway=msb
cli.auth_service=auth
# service section
-cli.exclude_params_internal_cmd=onap-username,onap-password,msb-url,no-auth
-cli.no_auth_disable_include_params_external_cmd=onap-username,onap-password,msb-url,no-auth
+cli.exclude_params_internal_cmd=onap-username,onap-password,host-url,no-auth
+cli.no_auth_disable_include_params_external_cmd=onap-username,onap-password,host-url,no-auth
cli.no_auth_enable_exclude_params_external_cmd=onap-username,onap-password,no-auth
-cli.no_auth_enable_include_params_external_cmd=msb-url \ No newline at end of file
+cli.no_auth_enable_include_params_external_cmd=host-url \ No newline at end of file
diff --git a/framework/src/main/resources/schema-validate.yaml b/framework/src/main/resources/schema-validate.yaml
index 06bb6563..66787912 100644
--- a/framework/src/main/resources/schema-validate.yaml
+++ b/framework/src/main/resources/schema-validate.yaml
@@ -9,7 +9,7 @@ default_parameters:
exclude:
- onap-username
- onap-password
- - msb-url
+ - host-url
- no-auth
parameters:
- name: schema-location
diff --git a/framework/src/test/java/org/onap/cli/cmd/sample/OnapCommandSampleTest.java b/framework/src/test/java/org/onap/cli/cmd/sample/OnapCommandSampleTest.java
index 9cf6bdf5..e50490f4 100644
--- a/framework/src/test/java/org/onap/cli/cmd/sample/OnapCommandSampleTest.java
+++ b/framework/src/test/java/org/onap/cli/cmd/sample/OnapCommandSampleTest.java
@@ -98,7 +98,7 @@ public class OnapCommandSampleTest {
d.setValue("true");
parameters.add(d);
OnapCommandParameter m = new OnapCommandParameter();
- m.setName(Constants.DEAFULT_PARAMETER_MSB_URL);
+ m.setName(Constants.DEAFULT_PARAMETER_HOST_URL);
m.setValue("http://localhost");
parameters.add(m);
sample.setParameters(parameters);
@@ -142,7 +142,7 @@ public class OnapCommandSampleTest {
d.setValue("true");
parameters.add(d);
OnapCommandParameter m = new OnapCommandParameter();
- m.setName(Constants.DEAFULT_PARAMETER_MSB_URL);
+ m.setName(Constants.DEAFULT_PARAMETER_HOST_URL);
m.setValue("http://localhost");
parameters.add(m);
sample.setParameters(parameters);
diff --git a/framework/src/test/java/org/onap/cli/fw/TestCommandValidate.java b/framework/src/test/java/org/onap/cli/fw/TestCommandValidate.java
index b8ac72ef..57847254 100644
--- a/framework/src/test/java/org/onap/cli/fw/TestCommandValidate.java
+++ b/framework/src/test/java/org/onap/cli/fw/TestCommandValidate.java
@@ -42,7 +42,7 @@ public class TestCommandValidate {
OnapCommandParameter noAuthParam = cmd.getParameters().stream().filter(p -> p.getName().equalsIgnoreCase("no-auth")).findFirst().get();
noAuthParam.setValue(true);
- OnapCommandParameter msbParam = cmd.getParameters().stream().filter(p -> p.getName().equalsIgnoreCase("msb-url")).findFirst().get();
+ OnapCommandParameter msbParam = cmd.getParameters().stream().filter(p -> p.getName().equalsIgnoreCase("host-url")).findFirst().get();
msbParam.setValue("localhost://msbip:msb:port");
cmd.validate();
}
diff --git a/framework/src/test/java/org/onap/cli/fw/ad/OnapCredentialsTest.java b/framework/src/test/java/org/onap/cli/fw/ad/OnapCredentialsTest.java
index a1987c08..cc431454 100644
--- a/framework/src/test/java/org/onap/cli/fw/ad/OnapCredentialsTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/ad/OnapCredentialsTest.java
@@ -26,7 +26,7 @@ public class OnapCredentialsTest {
public void credentialsTest() {
OnapCredentials cre = new OnapCredentials("test", "test123", "url");
assertTrue(cre.getUsername().equals("test") && cre.getPassword().equals("test123")
- && cre.getMsbUrl().equals("url"));
+ && cre.getHostUrl().equals("url"));
}
}
diff --git a/framework/src/test/java/org/onap/cli/fw/cmd/OnapHttpCommandTest.java b/framework/src/test/java/org/onap/cli/fw/cmd/OnapHttpCommandTest.java
index e7af1aa3..bfdb14a5 100644
--- a/framework/src/test/java/org/onap/cli/fw/cmd/OnapHttpCommandTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/cmd/OnapHttpCommandTest.java
@@ -39,8 +39,8 @@ public class OnapHttpCommandTest {
param2.setName("onap-password");
param2.setParameterType(ParameterType.STRING);
OnapCommandParameter param3 = new OnapCommandParameter();
- param3.setLongOption("msb-url");
- param3.setName("msb-url");
+ param3.setLongOption("host-url");
+ param3.setName("host-url");
param3.setParameterType(ParameterType.STRING);
OnapCommandParameter param4 = new OnapCommandParameter();
param4.setLongOption("string-param");
diff --git a/framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommandTest.java b/framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommandTest.java
index b70bf6f9..89c32c99 100644
--- a/framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommandTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommandTest.java
@@ -32,7 +32,7 @@ public class OnapSchemaValidateCommandTest {
param.setValue("test");
} else if ("onap-password".equals(param.getName())) {
param.setValue("test");
- } else if ("msb-url".equals(param.getName())) {
+ } else if ("host-url".equals(param.getName())) {
param.setValue("test-url");
} else if ("schema-location".equals(param.getName())) {
param.setValue("schema-validate-pass.yaml");
@@ -52,7 +52,7 @@ public class OnapSchemaValidateCommandTest {
param.setValue("test");
} else if ("onap-password".equals(param.getName())) {
param.setValue("test");
- } else if ("msb-url".equals(param.getName())) {
+ } else if ("host-url".equals(param.getName())) {
param.setValue("test-url");
} else if ("schema-location".equals(param.getName())) {
param.setValue(
diff --git a/framework/src/test/java/org/onap/cli/fw/defaultParameter/TestDefaultParameterSection.java b/framework/src/test/java/org/onap/cli/fw/defaultParameter/TestDefaultParameterSection.java
index 004bf7cf..da37f6f4 100644
--- a/framework/src/test/java/org/onap/cli/fw/defaultParameter/TestDefaultParameterSection.java
+++ b/framework/src/test/java/org/onap/cli/fw/defaultParameter/TestDefaultParameterSection.java
@@ -43,7 +43,7 @@ public class TestDefaultParameterSection {
List<String> parameters = cmd.getParameters().stream().map(p -> p.getName()).collect(Collectors.toList());
assertTrue(parameters.contains("onap-username"));
assertTrue(parameters.contains("onap-password"));
- assertTrue(parameters.contains("msb-url"));
+ assertTrue(parameters.contains("host-url"));
}
@Test
@@ -57,7 +57,7 @@ public class TestDefaultParameterSection {
List<String> parameters = cmd.getParameters().stream().map(p -> p.getName()).collect(Collectors.toList());
assertTrue(parameters.contains("onap-username"));
assertTrue(parameters.contains("onap-password"));
- assertTrue(parameters.contains("msb-url"));
+ assertTrue(parameters.contains("host-url"));
assertFalse(parameters.contains("long"));
assertFalse(parameters.contains("format"));
assertTrue(parameters.contains("debug"));
@@ -75,7 +75,7 @@ public class TestDefaultParameterSection {
assertTrue(parameters.contains("onap-username"));
assertTrue(parameters.contains("onap-password"));
- assertTrue(parameters.contains("msb-url"));
+ assertTrue(parameters.contains("host-url"));
}
@Test
@@ -90,7 +90,7 @@ public class TestDefaultParameterSection {
assertFalse(parameters.contains("onap-username"));
assertFalse(parameters.contains("onap-password"));
- assertTrue(parameters.contains("msb-url"));
+ assertTrue(parameters.contains("host-url"));
assertTrue(parameters.contains("debug"));
assertTrue(parameters.contains("long"));
assertTrue(parameters.contains("format"));
diff --git a/framework/src/test/resources/onap.properties b/framework/src/test/resources/onap.properties
index a6c991cd..b2b4fee8 100644
--- a/framework/src/test/resources/onap.properties
+++ b/framework/src/test/resources/onap.properties
@@ -8,7 +8,7 @@ cli.api_gateway=msb
cli.auth_service=auth
# service section
-cli.exclude_params_internal_cmd=onap-username,onap-password,msb-url,no-auth
-cli.no_auth_disable_include_params_external_cmd=onap-username,onap-password,msb-url,no-auth
+cli.exclude_params_internal_cmd=onap-username,onap-password,host-url,no-auth
+cli.no_auth_disable_include_params_external_cmd=onap-username,onap-password,host-url,no-auth
cli.no_auth_enable_exclude_params_external_cmd=onap-username,onap-password,no-auth
-cli.no_auth_enable_include_params_external_cmd=msb-url
+cli.no_auth_enable_include_params_external_cmd=host-url
diff --git a/framework/src/test/resources/sample-cmd-test-help.txt b/framework/src/test/resources/sample-cmd-test-help.txt
index d8ce1ef5..074e833e 100644
--- a/framework/src/test/resources/sample-cmd-test-help.txt
+++ b/framework/src/test/resources/sample-cmd-test-help.txt
@@ -5,7 +5,7 @@ Onap sample command to test the command features
Onap service: sample v1
Options:
-[-u | --onap-username] [-p | --onap-password] [-m | --msb-url]
+[-u | --onap-username] [-p | --onap-password] [-m | --host-url]
[-h | --help] [-v | --version] [-d | --debug]
[-f | --format] [-s | --long] [-t | --no-title]
[-a | --no-auth] [-b | --bool] [-x | --secure]
@@ -19,7 +19,7 @@ where,
-p | --onap-password Onap user password. It is of type STRING. By
default, it is read from environment variable
ONAP_PASSWORD. Secured.
--m | --msb-url Onap MSB url. It is of type URL. By default, it
+-m | --host-url Onap MSB url. It is of type URL. By default, it
is read from environment variable ONAP_MSB_URL.
-h | --help Onap command help message. It is of type STRING.
By default, it is false.
diff --git a/framework/src/test/resources/sample-test-include-exclude.yaml b/framework/src/test/resources/sample-test-include-exclude.yaml
index a1494bfe..7a14f262 100644
--- a/framework/src/test/resources/sample-test-include-exclude.yaml
+++ b/framework/src/test/resources/sample-test-include-exclude.yaml
@@ -3,7 +3,7 @@ default_parameters:
include:
- onap-username
- onap-password
- - msb-url
+ - host-url
- no-auth
exclude:
- long