summaryrefslogtreecommitdiffstats
path: root/controlloop/common/model-impl/rest/src/main
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2018-08-29 07:58:53 -0400
committerPamela Dragosh <pdragosh@research.att.com>2018-08-29 12:34:55 -0400
commit8279af376b435e1d7dd118a1955c5681edf3b847 (patch)
treef0e9f24028b8e96908184192f9e2813a2981938a /controlloop/common/model-impl/rest/src/main
parent17435998307f9f86ec5ebe55d6d36eceee1f1943 (diff)
Fix remaining checkstyle
Lots of formatting, missing javadoc, distance from use, imports must be explicit, ordering of methods. Fixed some abbreviation problems in classes and renamed JUnit tests to fix this. Issue-ID: POLICY-883 Change-Id: I8494f63d88d63c0232aca97f7bcc848816228fb1 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'controlloop/common/model-impl/rest/src/main')
-rw-r--r--controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java24
1 files changed, 22 insertions, 2 deletions
diff --git a/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java b/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java
index 52ce13ef9..39e0d8a7f 100644
--- a/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java
+++ b/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java
@@ -51,6 +51,17 @@ public class RESTManager {
}
}
+ /**
+ * Perform REST Post.
+ *
+ * @param url the url
+ * @param username the user name
+ * @param password the password
+ * @param headers any headers
+ * @param contentType what the content type is
+ * @param body body to send
+ * @return the response status code and the body
+ */
public Pair<Integer, String> post(String url, String username, String password,
Map<String, String> headers, String contentType, String body) {
@@ -77,7 +88,7 @@ public class RESTManager {
}
}
post.addHeader("Content-Type", contentType);
- if(authHeader != null) {
+ if (authHeader != null) {
post.setHeader(HttpHeaders.AUTHORIZATION, authHeader);
}
@@ -107,6 +118,15 @@ public class RESTManager {
}
}
+ /**
+ * Do a REST get.
+ *
+ * @param url URL
+ * @param username user name
+ * @param password password
+ * @param headers any headers to add
+ * @return a Pair for the response status and the body
+ */
public Pair<Integer, String> get(String url, String username, String password,
Map<String, String> headers) {
@@ -124,7 +144,7 @@ public class RESTManager {
get.addHeader(entry.getKey(), headers.get(entry.getKey()));
}
}
- if(authHeader != null) {
+ if (authHeader != null) {
get.setHeader(HttpHeaders.AUTHORIZATION, authHeader);
}