summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-fw/src/main/java/org/openecomp/portalsdk/core/onboarding/rest
diff options
context:
space:
mode:
authorChristopher Lott (cl778h) <clott@research.att.com>2017-08-31 15:16:38 -0400
committerChristopher Lott (cl778h) <clott@research.att.com>2017-08-31 15:42:50 -0400
commit7f535078ef80a7b7efa3e3325bfccb994fbd00e8 (patch)
tree66d908df2eb7cf0b048f754eac6b44619255eb8a /ecomp-sdk/epsdk-fw/src/main/java/org/openecomp/portalsdk/core/onboarding/rest
parent224487bc124df7988442a60d72d4aa106697306b (diff)
Rename packages to org.onap in 1.4.0-SNAPSHOT
19 - remove openecomp 72 - remediate Sonar scan issues 79 - removed unwanted left menu under Report 90 - apply approved license text Issue: PORTAL-19, PORTAL-72, PORTAL-79, PORTAL-90 Change-Id: I41a0ef5fba623d2242574bd15f2d9fb8029a496c Signed-off-by: Christopher Lott (cl778h) <clott@research.att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-fw/src/main/java/org/openecomp/portalsdk/core/onboarding/rest')
-rw-r--r--ecomp-sdk/epsdk-fw/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/FavoritesClient.java51
-rw-r--r--ecomp-sdk/epsdk-fw/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/FunctionalMenuClient.java54
-rw-r--r--ecomp-sdk/epsdk-fw/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/RestWebServiceClient.java511
3 files changed, 0 insertions, 616 deletions
diff --git a/ecomp-sdk/epsdk-fw/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/FavoritesClient.java b/ecomp-sdk/epsdk-fw/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/FavoritesClient.java
deleted file mode 100644
index eed49f2a..00000000
--- a/ecomp-sdk/epsdk-fw/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/FavoritesClient.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*-
- * ================================================================================
- * ECOMP Portal SDK
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ================================================================================
- */
-package org.openecomp.portalsdk.core.onboarding.rest;
-
-/**
- * Provides a convenience method for fetching the favorites for a user from the
- * ECOMP Portal.
- */
-public class FavoritesClient {
-
- /**
- * Fetches the favorites data from portal
- *
- * @param userId
- * userId value that it should be using to fetch the
- * data
- * @param appName
- * Application name for logging etc.
- * @param requestId
- * 128-bit UUID value to uniquely identify the transaction; if null, a new one is generated.
- * @param appUserName
- * REST API user-name
- * @param appPassword
- * REST API decrypted password
- * @return JSON with favorites
- * @throws Exception
- * on any failure
- */
- public static String getFavorites(String userId, String appName, String requestId, String appUserName,
- String appPassword) throws Exception {
- return RestWebServiceClient.getInstance().getPortalContent("/getFavorites", userId, appName, requestId, appUserName,
- appPassword,true);
- }
-} \ No newline at end of file
diff --git a/ecomp-sdk/epsdk-fw/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/FunctionalMenuClient.java b/ecomp-sdk/epsdk-fw/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/FunctionalMenuClient.java
deleted file mode 100644
index 90cbdcb4..00000000
--- a/ecomp-sdk/epsdk-fw/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/FunctionalMenuClient.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-
- * ================================================================================
- * ECOMP Portal SDK
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ================================================================================
- */
-package org.openecomp.portalsdk.core.onboarding.rest;
-
-/**
- * Provides a convenience method for fetching the functional menu for a user
- * from the ECOMP Portal via UEB.
- */
-public class FunctionalMenuClient {
-
- /**
- * Fetches the functional menu data from the configured ECOMP Portal
- * instance.
- *
- * @param userId
- * userId for the user to whom the menu will be shown
- * @param appName
- * Application name for logging etc.
- * @param requestId
- * 128-bit UUID value to uniquely identify the transaction; if
- * null, a new one is generated.
- * @param appUserName
- * REST API user name, used by Portal to authenticate the request
- * @param appPassword
- * REST API password (in the clear, not encrypted), used by
- * Portal to authenticate the request
- * @return JSON with functional menu
- * @throws Exception
- * on any failure
- */
- public static String getFunctionalMenu(String userId, String appName, String requestId, String appUserName,
- String appPassword) throws Exception {
- return RestWebServiceClient.getInstance().getPortalContent("/functionalMenuItemsForUser", userId, appName,
- requestId, appUserName, appPassword,true);
- }
-
-} \ No newline at end of file
diff --git a/ecomp-sdk/epsdk-fw/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/RestWebServiceClient.java b/ecomp-sdk/epsdk-fw/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/RestWebServiceClient.java
deleted file mode 100644
index 44177466..00000000
--- a/ecomp-sdk/epsdk-fw/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/RestWebServiceClient.java
+++ /dev/null
@@ -1,511 +0,0 @@
-/*-
- * ================================================================================
- * ECOMP Portal SDK
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ================================================================================
- */
-package org.openecomp.portalsdk.core.onboarding.rest;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.Base64;
-import java.util.UUID;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.openecomp.portalsdk.core.onboarding.util.PortalApiConstants;
-import org.openecomp.portalsdk.core.onboarding.util.PortalApiProperties;
-
-/**
- * Simple REST client for GET-ing content from and POST-ing content , Delete to the
- * Portal application.
- */
-public class RestWebServiceClient {
-
- private final Log logger = LogFactory.getLog(RestWebServiceClient.class);
-
- /**
- * Singleton instance
- */
- private static RestWebServiceClient instance = null;
-
- /**
- * Constructor is private. Clients should obtain an instance via
- * getInstance().
- */
- private RestWebServiceClient() {
- }
-
- /**
- * Gets the static instance of RestWebServiceClient; creates it if
- * necessary. Synchronized to be thread safe.
- *
- * @return Static instance of RestWebServiceClient.
- */
- public static synchronized RestWebServiceClient getInstance() {
- if (instance == null)
- instance = new RestWebServiceClient();
- return instance;
- }
-
- /**
- * Convenience method that fetches the URL for the Portal REST API endpoint
- * and the application UEB key, then calls
- * {@link #get(String, String, String, String, String, String, String)} to
- * access the Portal's REST endpoint.
- *
- * @param restPath
- * Partial path of the endpoint; e.g., "/specialRestService"
- * @param userId
- * userId for the user originating the request
- * @param appName
- * Application Name for logging.
- * @param requestId
- * 128-bit UUID value to uniquely identify the transaction.
- * @param appUserName
- * REST API user name for Portal to authenticate the request
- * @param appPassword
- * REST API password (in the clear, not encrypted) for Portal to
- * authenticate the request
- * @return Content from REST endpoint
- * @throws Exception
- * on any failure
- */
- public String getPortalContent(String restPath,String userId, String appName, String requestId, String appUserName, String appPassword, boolean isBasicAuth) throws Exception {
- String restURL = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REST_URL);
-
- if (restURL == null) {
- // should never happen
- String msg = "getPortalContent: failed to get property " + PortalApiConstants.ECOMP_REST_URL;
- logger.error(msg);
- throw new Exception(msg);
- }
- String appUebKey = PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY);
-
- if (appUebKey == null) {
- // should never happen
- String msg = "getPortalContent: failed to get property " + PortalApiConstants.UEB_APP_KEY;
-
- logger.error(msg);
- throw new Exception(msg);
- }
- final String restEndpointUrl = restURL + restPath;
- if(isBasicAuth)
- {
- return get(restEndpointUrl, userId,appName, requestId, appUebKey, appUserName, appPassword,isBasicAuth);
- }
- return get(restEndpointUrl, userId,appName, requestId, appUebKey, appUserName, appPassword);
- }
-
-
- /**
- * Makes a call to a Portal REST API using the specified URL and parameters.
- *
- * @param url
- * Complete URL of the REST endpoint.
- * @param loginId
- * User that it should be fetching the data
- * @param appName
- * Application name for logging; if null or empty, defaulted to
- * Unknown.
- * @param requestId
- * 128-bit UUID value to uniquely identify the transaction; if
- * null or empty, one is generated.
- * @param appUebKey
- * Unique key for the application, used by Portal to authenticate
- * the request
- * @param appUserName
- * REST API user name, used by Portal to authenticate the request
- * @param appPassword
- * REST API password, used by Portal to authenticate the request
- * @return Content from REST endpoint
- * @throws Exception
- * On any failure; e.g., unknown host.
- */
-
- public String get(String url, String loginId, String appName, String requestId, String appUebKey,
- String appUserName, String appPassword) throws Exception {
- return get(url, loginId, appName,requestId, appUebKey, appUserName, appPassword, false);
- }
-
-
- /**
- * Makes a call to a Portal REST API using the specified URL and parameters.
- *
- * @param url
- * Complete URL of the REST endpoint.
- * @param loginId
- * User that it should be fetching the data
- * @param appName
- * Application name for logging; if null or empty, defaulted to
- * Unknown.
- * @param requestId
- * 128-bit UUID value to uniquely identify the transaction; if
- * null or empty, one is generated.
- * @param appUebKey
- * Unique key for the application, used by Portal to authenticate
- * the request
- * @param appUserName
- * REST API user name, used by Portal to authenticate the request
- * @param appPassword
- * REST API password, used by Portal to authenticate the request
- * @return Content from REST endpoint
- * @throws Exception
- * On any failure; e.g., unknown host.
- */
- public String get(String url, String loginId, String appName, String requestId, String appUebKey,
- String appUserName, String appPassword, Boolean useBasicAuth) throws Exception {
-
- logger.debug("RestWebServiceClient.get (" + url + ") operation is started.");
-
- if (appName == null || appName.trim().length() == 0)
- appName = "Unknown";
- if (requestId == null || requestId.trim().length() == 0)
- requestId = UUID.randomUUID().toString();
-
- URL obj = new URL(url);
- // Create the connection object
- HttpURLConnection con = (HttpURLConnection) obj.openConnection();
- con.setRequestMethod("GET");
-
- con.setConnectTimeout(3000);
- // if the portal property is set then gets the timeout value from portal properties
- if(PortalApiProperties.getProperty(PortalApiConstants.EXT_REQUEST_CONNECTION_TIMEOUT)!= null){
- con.setConnectTimeout(Integer.parseInt(PortalApiProperties.getProperty(PortalApiConstants.EXT_REQUEST_CONNECTION_TIMEOUT)));
- }
- con.setReadTimeout(8000);
- if(PortalApiProperties.getProperty(PortalApiConstants.EXT_REQUEST_READ_TIMEOUT)!= null){
- con.setReadTimeout(Integer.parseInt(PortalApiProperties.getProperty(PortalApiConstants.EXT_REQUEST_READ_TIMEOUT)));
- }
-
- // add request header
- con.setRequestProperty("uebkey", appUebKey);
- con.setRequestProperty("LoginId", loginId);
- con.setRequestProperty("user-agent", appName);
- con.setRequestProperty("X-ECOMP-RequestID", requestId);
- con.setRequestProperty("username", appUserName);
- con.setRequestProperty("password", appPassword);
-
- if(useBasicAuth){
- String encoding = Base64.getEncoder().encodeToString((appUserName + ":" + appPassword).getBytes());
- con.setRequestProperty("Authorization", "Basic "+ encoding);
- }
-
- int responseCode = con.getResponseCode();
- logger.debug("get: received response code '" + responseCode + "' while getting the '" + url + "' for user: "
- + loginId);
-
- StringBuffer sb = new StringBuffer();
- BufferedReader in = null;
- try {
- in = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8"));
- String inputLine = null;
- while ((inputLine = in.readLine()) != null)
- sb.append(inputLine);
- } finally {
- try {
- if (in != null)
- in.close();
- } catch (IOException ex) {
- logger.error("get: failed to close reader", ex);
- }
- }
-
- final String response = sb.toString();
- if (logger.isDebugEnabled())
- logger.debug("get: url " + url + " yielded " + response);
- return response;
- }
-
- /**
- * Convenience method that fetches the URL for the Portal REST API endpoint
- * and the application UEB key, then calls
- * {@link #post(String, String, String, String, String, String, String, String, String)}
- * to access the Portal's REST endpoint.
- *
- * @param restPath
- * Partial path of the endpoint; e.g., "/specialRestService"
- * @param userId
- * ID for the user originating the request
- * @param appName
- * Application Name for logging.
- * @param requestId
- * 128-bit UUID value to uniquely identify the transaction.
- * @param appUserName
- * REST API user name for Portal to authenticate the request;
- * ignored if null
- * @param appPassword
- * REST API password (in the clear, not encrypted) for Portal to
- * authenticate the request; ignored if null
- * @param contentType
- * content type for header
- * @param content
- * String to post
- * @return Content from REST endpoint
- * @throws Exception
- * on any failure
- */
- public String postPortalContent(String restPath, String userId, String appName, String requestId,
- String appUserName, String appPassword, String contentType, String content, boolean isBasicAuth) throws Exception {
- String restURL = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REST_URL);
-
-
- if (restURL == null) {
- // should never happen
- String msg = "getPortalContent: failed to get property " + PortalApiConstants.ECOMP_REST_URL;
-
- logger.error(msg);
- throw new Exception(msg);
- }
- String appUebKey = PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY);
-
- if (appUebKey == null) {
- // should never happen
- String msg = "getPortalContent: failed to get property " + PortalApiConstants.UEB_APP_KEY;
-
- logger.error(msg);
- throw new Exception(msg);
- }
- final String separator = restURL.endsWith("/") || restPath.startsWith("/") ? "" : "/";
- final String restEndpointUrl = restURL + separator + restPath;
- return post(restEndpointUrl, userId, appName, requestId, appUebKey, appUserName, appPassword, contentType,
- content,isBasicAuth);
- }
-
- /**
- * Makes a POST call to a Portal REST API using the specified URL and
- * parameters.
- *
- * @param url
- * Complete URL of the REST endpoint.
- * @param loginId
- * User who is fetching the data
- * @param appName
- * Application name for logging; if null or empty, defaulted to
- * Unknown.
- * @param requestId
- * 128-bit UUID value to uniquely identify the transaction; if
- * null or empty, one is generated.
- * @param appUebKey
- * Unique key for the application, used by Portal to authenticate
- * the request
- * @param appUserName
- * REST API user name used by Portal to authenticate the request;
- * ignored if null
- * @param appPassword
- * REST API password used by Portal to authenticate the request;
- * ignored if null
- * @param contentType
- * MIME header
- * @param content
- * Content to POST
- * @return Any content read from the endpoint
- * @throws Exception
- * On any error
- */
- public String post(String url, String loginId, String appName, String requestId, String appUebKey,
- String appUserName, String appPassword, String contentType, String content, boolean isBasicAuth) throws Exception {
-
- if (logger.isDebugEnabled())
- logger.debug("RestWebServiceClient.post to URL " + url);
- if (appName == null || appName.trim().length() == 0)
- appName = "Unknown";
- if (requestId == null || requestId.trim().length() == 0)
- requestId = UUID.randomUUID().toString();
-
- URL obj = new URL(url);
- // Create the connection object
- HttpURLConnection con = (HttpURLConnection) obj.openConnection();
- con.setRequestMethod("POST");
-
- con.setConnectTimeout(3000);
- // if the portal property is set then gets the timeout value from portal properties
- if(PortalApiProperties.getProperty(PortalApiConstants.EXT_REQUEST_CONNECTION_TIMEOUT)!= null){
- con.setConnectTimeout(Integer.parseInt(PortalApiProperties.getProperty(PortalApiConstants.EXT_REQUEST_CONNECTION_TIMEOUT)));
- }
- con.setReadTimeout(15000);
- if(PortalApiProperties.getProperty(PortalApiConstants.EXT_REQUEST_READ_TIMEOUT)!= null){
- con.setReadTimeout(Integer.parseInt(PortalApiProperties.getProperty(PortalApiConstants.EXT_REQUEST_READ_TIMEOUT)));
- }
-
- // add request header
- con.setRequestProperty("uebkey", appUebKey);
- if (appUserName != null)
- con.setRequestProperty("username", appUserName);
- if (appPassword != null)
- con.setRequestProperty("password", appPassword);
- con.setRequestProperty("LoginId", loginId);
- con.setRequestProperty("user-agent", appName);
- con.setRequestProperty("X-ECOMP-RequestID", requestId);
- con.setRequestProperty("Content-Type", contentType);
- if(isBasicAuth){
- String encoding = Base64.getEncoder().encodeToString((appUserName + ":" + appPassword).getBytes());
- con.setRequestProperty("Authorization", "Basic "+ encoding);
- }
-
- con.setDoInput(true);
- con.setDoOutput(true);
- if( content != null)
- {
- con.getOutputStream().write(content.getBytes());
- }
- con.getOutputStream().flush();
- con.getOutputStream().close();
-
- int responseCode = con.getResponseCode();
- logger.debug("Response Code : " + responseCode);
-
- StringBuffer sb = new StringBuffer();
- InputStreamReader in = null;
- char[] buf = new char[8196];
- int bytes;
- try {
- in = new InputStreamReader(con.getInputStream(), "UTF-8");
- while ((bytes = in.read(buf)) > 0)
- sb.append(new String(buf, 0, bytes));
- } finally {
- try {
- if (in != null)
- in.close();
- } catch (IOException ex) {
- logger.warn("get: failed to close reader", ex);
- }
- }
-
- return sb.toString();
- }
-
-
- public String deletePortalContent(String restPath, String userId, String appName, String requestId,
- String appUserName, String appPassword, String contentType, String content, boolean isBasicAuth) throws Exception {
- String restURL = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REST_URL);
-
- if (restURL == null) {
- // should never happen
- String msg = "getPortalContent: failed to get property " + PortalApiConstants.ECOMP_REST_URL;
-
- logger.error(msg);
- throw new Exception(msg);
- }
- String appUebKey = PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY);
-
- if (appUebKey == null) {
- // should never happen
- String msg = "getPortalContent: failed to get property " + PortalApiConstants.UEB_APP_KEY;
-
- logger.error(msg);
- throw new Exception(msg);
- }
- final String separator = restURL.endsWith("/") || restPath.startsWith("/") ? "" : "/";
- final String restEndpointUrl = restURL + separator + restPath;
- return delete(restEndpointUrl, userId, appName, requestId, appUebKey, appUserName, appPassword, contentType,
- content,isBasicAuth);
- }
-
- public String delete(String url, String loginId, String appName, String requestId, String appUebKey,
- String appUserName, String appPassword, String contentType, String content,boolean isBasicAuth) throws Exception {
-
- if (logger.isDebugEnabled())
- logger.debug("RestWebServiceClient.post to URL " + url);
- if (appName == null || appName.trim().length() == 0)
- appName = "Unknown";
- if (requestId == null || requestId.trim().length() == 0)
- requestId = UUID.randomUUID().toString();
-
- URL obj = new URL(url);
- // Create the connection object
- HttpURLConnection con = (HttpURLConnection) obj.openConnection();
- con.setRequestMethod("DELETE");
- con.setConnectTimeout(3000);
- // if the portal property is set then gets the timeout value from portal properties
- if(PortalApiProperties.getProperty(PortalApiConstants.EXT_REQUEST_CONNECTION_TIMEOUT)!= null){
- con.setConnectTimeout(Integer.parseInt(PortalApiProperties.getProperty(PortalApiConstants.EXT_REQUEST_CONNECTION_TIMEOUT)));
- }
- con.setReadTimeout(15000);
- if(PortalApiProperties.getProperty(PortalApiConstants.EXT_REQUEST_READ_TIMEOUT)!= null){
- con.setReadTimeout(Integer.parseInt(PortalApiProperties.getProperty(PortalApiConstants.EXT_REQUEST_READ_TIMEOUT)));
- }
- // add request header
- con.setRequestProperty("uebkey", appUebKey);
- if (appUserName != null)
- con.setRequestProperty("username", appUserName);
- if (appPassword != null)
- con.setRequestProperty("password", appPassword);
- con.setRequestProperty("LoginId", loginId);
- con.setRequestProperty("user-agent", appName);
- con.setRequestProperty("X-ECOMP-RequestID", requestId);
- con.setRequestProperty("Content-Type", contentType);
- if(isBasicAuth){
- String encoding = Base64.getEncoder().encodeToString((appUserName + ":" + appPassword).getBytes());
- con.setRequestProperty("Authorization", "Basic "+ encoding);
- }
-
- con.setDoInput(true);
- con.setDoOutput(true);
- if( content != null)
- {
- con.getOutputStream().write(content.getBytes());
- }
- con.getOutputStream().flush();
- con.getOutputStream().close();
-
- int responseCode = con.getResponseCode();
- logger.debug("Response Code : " + responseCode);
-
- StringBuffer sb = new StringBuffer();
- InputStreamReader in = null;
- char[] buf = new char[8196];
- int bytes;
- try {
- in = new InputStreamReader(con.getInputStream(), "UTF-8");
- while ((bytes = in.read(buf)) > 0)
- sb.append(new String(buf, 0, bytes));
- } finally {
- try {
- if (in != null)
- in.close();
- } catch (IOException ex) {
- logger.warn("get: failed to close reader", ex);
- }
- }
-
- return sb.toString();
- }
-
-
- /**
- * Basic unit test for the client to call Portal app on localhost.
- *
- * @param args
- * Ignored
- * @throws Exception
- */
- public static void main(String[] args) throws Exception {
- RestWebServiceClient client = RestWebServiceClient.getInstance();
- final String getUrl = "http://www.ecomp.openecomp.org:8080/ecompportal/auxapi/analytics";
- String get = client.get(getUrl, "userId", "appName", null, "appUebKey", "appUserName", "appPassword", null);
- System.out.println("Get result:\n" + get);
- final String postUrl = "http://www.ecomp.openecomp.org:8080/ecompportal/auxapi/storeAnalytics";
- final String content = " { " + " \"action\" : \"test1\", " + " \"page\" : \"test2\", "
- + " \"function\" : \"test3\", " + " \"userid\" : \"ab1234\" " + "}";
- String post = client.post(postUrl, "userId", "appName", null, "appUebKey", "appUserName", "appPassword",
- "application/json", content, true);
- System.out.println("Post result:\n" + post);
- }
-}