From 5a0dadc2c7439719142db3c7e2200d12face4b45 Mon Sep 17 00:00:00 2001 From: Kanagaraj Manickam k00365106 Date: Fri, 11 Aug 2017 10:41:29 +0530 Subject: 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 --- .../src/main/java/org/onap/cli/fw/ad/OnapAuthClient.java | 14 +++++++------- .../main/java/org/onap/cli/fw/ad/OnapCredentials.java | 16 ++++++++-------- .../src/main/java/org/onap/cli/fw/conf/Constants.java | 2 +- .../java/org/onap/cli/fw/utils/OnapCommandUtils.java | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) (limited to 'framework/src/main/java') 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)); } /** -- cgit 1.2.3-korg