summaryrefslogtreecommitdiffstats
path: root/profiles
diff options
context:
space:
mode:
Diffstat (limited to 'profiles')
-rw-r--r--profiles/http/src/test/java/org/onap/cli/fw/http/HttpInputOutputTest.java6
-rw-r--r--profiles/http/src/test/java/org/onap/cli/fw/http/OnapHttpConnectionTest.java7
-rw-r--r--profiles/http/src/test/java/org/onap/cli/fw/http/auth/OnapAuthClientCommandBasedTest.java17
-rw-r--r--profiles/http/src/test/java/org/onap/cli/fw/http/utils/OnapCommandUtilsTest.java40
-rw-r--r--profiles/snmp/src/test/java/org/onap/cli/fw/snmp/cmd/OnapSnmpCommandTest.java22
5 files changed, 68 insertions, 24 deletions
diff --git a/profiles/http/src/test/java/org/onap/cli/fw/http/HttpInputOutputTest.java b/profiles/http/src/test/java/org/onap/cli/fw/http/HttpInputOutputTest.java
index 7a7a31c7..597a3280 100644
--- a/profiles/http/src/test/java/org/onap/cli/fw/http/HttpInputOutputTest.java
+++ b/profiles/http/src/test/java/org/onap/cli/fw/http/HttpInputOutputTest.java
@@ -43,9 +43,9 @@ public class HttpInputOutputTest {
inp.setReqHeaders(new HashMap<String, String>());
inp.setReqQueries(new HashMap<String, String>());
- assertTrue(
- "\nURL: uri\nMethod: method\nRequest Queries: {}\nRequest Body: body\nRequest Headers: {}\nRequest Cookies: {}\nbinaryData=false\nContext={}"
- .equals(inp.toString()));
+ String msg = "\nURL: uri\nMethod: method\nRequest Queries: {}\nRequest Body: body\nRequest Headers: "
+ + "{}\nRequest Cookies: {}\nbinaryData=false\nContext={}";
+ assertTrue(msg.equals(inp.toString()));
}
@Test
diff --git a/profiles/http/src/test/java/org/onap/cli/fw/http/OnapHttpConnectionTest.java b/profiles/http/src/test/java/org/onap/cli/fw/http/OnapHttpConnectionTest.java
index fe29936a..fab02ff2 100644
--- a/profiles/http/src/test/java/org/onap/cli/fw/http/OnapHttpConnectionTest.java
+++ b/profiles/http/src/test/java/org/onap/cli/fw/http/OnapHttpConnectionTest.java
@@ -22,6 +22,10 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
+import mockit.Invocation;
+import mockit.Mock;
+import mockit.MockUp;
+
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpUriRequest;
@@ -34,9 +38,6 @@ import org.onap.cli.fw.http.connect.HttpResult;
import org.onap.cli.fw.http.connect.OnapHttpConnection;
import org.onap.cli.fw.http.error.OnapCommandHttpFailure;
-import mockit.Invocation;
-import mockit.Mock;
-import mockit.MockUp;
public class OnapHttpConnectionTest {
HttpInput inp = null;
diff --git a/profiles/http/src/test/java/org/onap/cli/fw/http/auth/OnapAuthClientCommandBasedTest.java b/profiles/http/src/test/java/org/onap/cli/fw/http/auth/OnapAuthClientCommandBasedTest.java
index d3059449..174c066c 100644
--- a/profiles/http/src/test/java/org/onap/cli/fw/http/auth/OnapAuthClientCommandBasedTest.java
+++ b/profiles/http/src/test/java/org/onap/cli/fw/http/auth/OnapAuthClientCommandBasedTest.java
@@ -33,14 +33,16 @@ public class OnapAuthClientCommandBasedTest {
@Before
public void setup() throws OnapCommandProductVersionInvalid, OnapCommandException {
- OnapCommandRegistrar.getRegistrar().setEnabledProductVersion(OnapCommandConfig.getPropertyValue(OnapCommandConstants.OPEN_CLI_PRODUCT_NAME));
+ OnapCommandRegistrar.getRegistrar().setEnabledProductVersion(
+ OnapCommandConfig.getPropertyValue(OnapCommandConstants.OPEN_CLI_PRODUCT_NAME));
}
@Test
public void yesCatalogYesAuthTest() throws OnapCommandException {
try {
OnapHttpCommand cmd = getCommand("sample-test-schema-yes-auth-yes-catalog.yaml");
- cmd.getParametersMap().get(OnapCommandHttpConstants.DEAFULT_PARAMETER_HOST_URL).setValue("http://localhost:8080");
+ cmd.getParametersMap().get(OnapCommandHttpConstants.DEAFULT_PARAMETER_HOST_URL)
+ .setValue("http://localhost:8080");
cmd.getParametersMap().get(OnapCommandHttpConstants.DEAFULT_PARAMETER_USERNAME).setValue("test");
cmd.getParametersMap().get(OnapCommandHttpConstants.DEAFULT_PARAMETER_PASSWORD).setValue("password");
@@ -55,7 +57,8 @@ public class OnapAuthClientCommandBasedTest {
public void yesCatalogNoAuthTest() throws OnapCommandException {
try {
OnapHttpCommand cmd = getCommand("sample-test-schema-no-auth-yes-catalog.yaml");
- cmd.getParametersMap().get(OnapCommandHttpConstants.DEAFULT_PARAMETER_HOST_URL).setValue("http://localhost:8080");
+ cmd.getParametersMap().get(OnapCommandHttpConstants.DEAFULT_PARAMETER_HOST_URL)
+ .setValue("http://localhost:8080");
cmd.execute();
} catch (OnapCommandException e) {
@@ -68,7 +71,8 @@ public class OnapAuthClientCommandBasedTest {
public void noCatalogYesAuthTest() throws OnapCommandException {
try {
OnapHttpCommand cmd = getCommand("sample-test-schema-yes-auth-no-catalog.yaml");
- cmd.getParametersMap().get(OnapCommandHttpConstants.DEAFULT_PARAMETER_HOST_URL).setValue("http://localhost:8080");
+ cmd.getParametersMap().get(OnapCommandHttpConstants.DEAFULT_PARAMETER_HOST_URL)
+ .setValue("http://localhost:8080");
cmd.getParametersMap().get(OnapCommandHttpConstants.DEAFULT_PARAMETER_USERNAME).setValue("test");
cmd.getParametersMap().get(OnapCommandHttpConstants.DEAFULT_PARAMETER_PASSWORD).setValue("password");
@@ -109,7 +113,8 @@ public class OnapAuthClientCommandBasedTest {
protected void processRequest() throws OnapCommandException {
if (!this.getService().isModeDirect()) {
String url = this.authClient.getServiceUrl();
- assert url.equals(this.getParametersMap().get(OnapCommandHttpConstants.DEAFULT_PARAMETER_HOST_URL).getValue() + "/");
+ assert url.equals(this.getParametersMap().get(OnapCommandHttpConstants.DEAFULT_PARAMETER_HOST_URL)
+ .getValue() + "/");
}
}
};
@@ -118,4 +123,4 @@ public class OnapAuthClientCommandBasedTest {
return cmd;
}
- }
+}
diff --git a/profiles/http/src/test/java/org/onap/cli/fw/http/utils/OnapCommandUtilsTest.java b/profiles/http/src/test/java/org/onap/cli/fw/http/utils/OnapCommandUtilsTest.java
index 13b2db42..6e03e74b 100644
--- a/profiles/http/src/test/java/org/onap/cli/fw/http/utils/OnapCommandUtilsTest.java
+++ b/profiles/http/src/test/java/org/onap/cli/fw/http/utils/OnapCommandUtilsTest.java
@@ -101,7 +101,11 @@ public class OnapCommandUtilsTest {
public void populateOutputsTest() throws OnapCommandException {
HttpResult output = new HttpResult();
output.setBody(
- "{\"serviceName\":\"test\",\"version\":\"v1\",\"url\":\"/api/test/v1\",\"protocol\":\"REST\",\"visualRange\":\"1\",\"lb_policy\":\"hash\",\"nodes\":[{\"ip\":\"127.0.0.1\",\"port\":\"8012\",\"ttl\":0,\"nodeId\":\"test_127.0.0.1_8012\",\"expiration\":\"2017-02-10T05:33:25Z\",\"created_at\":\"2017-02-10T05:33:25Z\",\"updated_at\":\"2017-02-10T05:33:25Z\"}],\"status\":\"1\"}");
+ "{\"serviceName\":\"test\",\"version\":\"v1\",\"url\":\"/api/test/v1\",\"protocol\":\"REST\","
+ + "\"visualRange\":\"1\",\"lb_policy\":\"hash\",\"nodes\":[{\"ip\":\"127.0.0.1\",\"port\":\"8012\","
+ + "\"ttl\":0,\"nodeId\":\"test_127.0.0.1_8012\",\"expiration\":\"2017-02-10T05:33:25Z\","
+ + "\"created_at\":\"2017-02-10T05:33:25Z\",\"updated_at\":\"2017-02-10T05:33:25Z\"}],"
+ + "\"status\":\"1\"}");
Map<String, String> mapHead = new HashMap<>();
mapHead.put("head1", "value1");
output.setRespHeaders(mapHead);
@@ -120,7 +124,8 @@ public class OnapCommandUtilsTest {
input1 = OnapCommandHttpUtils.populateOutputs(params, output);
} catch (OnapCommandHttpInvalidResponseBody e) {
assertEquals(
- "0x3004::Http response body does not have json entry {$.serviceName, Missing property in path $['{$']",
+ "0x3004::Http response body does not have json entry {$.serviceName, "
+ + "Missing property in path $['{$']",
e.getMessage());
}
output.setBody("{}");
@@ -140,8 +145,35 @@ public class OnapCommandUtilsTest {
@Test
public void testJsonEmptyCheck() throws OnapCommandHttpInvalidRequestBody {
- String sample = "{\"request\":{\"method\":\"\",\"uri\":\"/onboarding-api/v1.0/vendor-license-models/cf2d907d998e44698ce3b4cded5f66a7/versions/2.0/license-agreements\",\"headers\":{\"Authorization\":\"Basic Y3MwMDA4OmRlbW8xMjM0NTYh\",\"X-FromAppId\":\"onap-cli\",\"Accept\":\"application/json\",\"USER_ID\":\"cs0008\",\"X-TransactionId\":\"req-66a37478-d840-44f8-b436-56f4a3b6f640\",\"Content-Type\":\"application/json\"},\"json\":null},\"response\":{\"status\":200,\"json\":{\"listCount\":2,\"results\":[{\"name\":\"sf\",\"description\":\"sdfgdf\",\"licenseTerm\":{\"choice\":\"Fixed_Term\",\"other\":null},\"id\":\"1e2edfccaca847f896070d0fac26667a\",\"featureGroupsIds\":[\"3a2fb75b52a54e9c8093e7c154210f9e\"]},{\"name\":\"kanag-cli-la\",\"description\":\"kanag cli la\",\"licenseTerm\":{\"choice\":\"Fixed_Term\",\"other\":\"\"},\"id\":\"77e151d0503b45ecb7e40f5f5f1a887e\",\"featureGroupsIds\":[\"3a2fb75b52a54e9c8093e7c154210f9e\"]}]}}}";
- String result = "{\"request\":{\"uri\":\"/onboarding-api/v1.0/vendor-license-models/cf2d907d998e44698ce3b4cded5f66a7/versions/2.0/license-agreements\",\"headers\":{\"Authorization\":\"Basic Y3MwMDA4OmRlbW8xMjM0NTYh\",\"X-FromAppId\":\"onap-cli\",\"Accept\":\"application/json\",\"USER_ID\":\"cs0008\",\"X-TransactionId\":\"req-66a37478-d840-44f8-b436-56f4a3b6f640\",\"Content-Type\":\"application/json\"}},\"response\":{\"status\":200,\"json\":{\"listCount\":2,\"results\":[{\"name\":\"sf\",\"description\":\"sdfgdf\",\"licenseTerm\":{\"choice\":\"Fixed_Term\"},\"id\":\"1e2edfccaca847f896070d0fac26667a\",\"featureGroupsIds\":[\"3a2fb75b52a54e9c8093e7c154210f9e\"]},{\"name\":\"kanag-cli-la\",\"description\":\"kanag cli la\",\"licenseTerm\":{\"choice\":\"Fixed_Term\"},\"id\":\"77e151d0503b45ecb7e40f5f5f1a887e\",\"featureGroupsIds\":[\"3a2fb75b52a54e9c8093e7c154210f9e\"]}]}}}";
+ String sample = "{\"request\":{\"method\":\"\",\"uri\":\"/onboarding-api/v1.0/"
+ + "vendor-license-models/cf2d907d998e44698ce3b4cded5f66a7/versions/2.0/license-agreements\","
+ + "\"headers\":{\"Authorization\":\"Basic Y3MwMDA4OmRlbW8xMjM0NTYh\",\"X-FromAppId\":\"onap-cli\","
+ + "\"Accept\":\"application/json\",\"USER_ID\":\"cs0008\","
+ + "\"X-TransactionId\":\"req-66a37478-d840-44f8-b436-56f4a3b6f640\","
+ + "\"Content-Type\":\"application/json\"},\"json\":null},"
+ + "\"response\":{\"status\":200,\"json\":{\"listCount\":2,"
+ + "\"results\":[{\"name\":\"sf\",\"description\":\"sdfgdf\","
+ + "\"licenseTerm\":{\"choice\":\"Fixed_Term\",\"other\":null},"
+ + "\"id\":\"1e2edfccaca847f896070d0fac26667a\","
+ + "\"featureGroupsIds\":[\"3a2fb75b52a54e9c8093e7c154210f9e\"]},"
+ + "{\"name\":\"kanag-cli-la\",\"description\":\"kanag cli la\","
+ + "\"licenseTerm\":{\"choice\":\"Fixed_Term\",\"other\":\"\"},"
+ + "\"id\":\"77e151d0503b45ecb7e40f5f5f1a887e\","
+ + "\"featureGroupsIds\":[\"3a2fb75b52a54e9c8093e7c154210f9e\"]}]}}}";
+ String result = "{\"request\":{\"uri\":"
+ + "\"/onboarding-api/v1.0/vendor-license-models/cf2d907d998e44698ce3b4cded5f66a7/"
+ + "versions/2.0/license-agreements\",\"headers\":"
+ + "{\"Authorization\":\"Basic Y3MwMDA4OmRlbW8xMjM0NTYh\","
+ + "\"X-FromAppId\":\"onap-cli\",\"Accept\":\"application/json\","
+ + "\"USER_ID\":\"cs0008\",\"X-TransactionId\":\"req-66a37478-d840-44f8-b436-56f4a3b6f640\","
+ + "\"Content-Type\":\"application/json\"}},\"response\":{\"status\":200,"
+ + "\"json\":{\"listCount\":2,\"results\":[{\"name\":\"sf\","
+ + "\"description\":\"sdfgdf\",\"licenseTerm\":{\"choice\":\"Fixed_Term\"},"
+ + "\"id\":\"1e2edfccaca847f896070d0fac26667a\",\"featureGroupsIds\":"
+ + "[\"3a2fb75b52a54e9c8093e7c154210f9e\"]},{\"name\":\"kanag-cli-la\","
+ + "\"description\":\"kanag cli la\",\"licenseTerm\":{\"choice\":\"Fixed_Term\"},"
+ + "\"id\":\"77e151d0503b45ecb7e40f5f5f1a887e\",\"featureGroupsIds\":"
+ + "[\"3a2fb75b52a54e9c8093e7c154210f9e\"]}]}}}";
assertEquals(result, OnapCommandHttpUtils.normalizeJson(sample));
}
}
diff --git a/profiles/snmp/src/test/java/org/onap/cli/fw/snmp/cmd/OnapSnmpCommandTest.java b/profiles/snmp/src/test/java/org/onap/cli/fw/snmp/cmd/OnapSnmpCommandTest.java
index 00c985d5..2fd83f9d 100644
--- a/profiles/snmp/src/test/java/org/onap/cli/fw/snmp/cmd/OnapSnmpCommandTest.java
+++ b/profiles/snmp/src/test/java/org/onap/cli/fw/snmp/cmd/OnapSnmpCommandTest.java
@@ -16,11 +16,22 @@
package org.onap.cli.fw.snmp.cmd;
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
import mockit.Mock;
import mockit.MockUp;
-import org.junit.*;
+
+import org.junit.Test;
import org.onap.cli.fw.error.OnapCommandException;
-import org.onap.cli.fw.error.OnapCommandInvalidParameterValue;
import org.onap.cli.fw.input.OnapCommandParameter;
import org.onap.cli.fw.input.OnapCommandParameterType;
import org.onap.cli.fw.output.OnapCommandResult;
@@ -34,10 +45,6 @@ import org.snmp4j.smi.OID;
import org.snmp4j.smi.OctetString;
import org.snmp4j.smi.VariableBinding;
-import java.io.IOException;
-import java.util.*;
-
-import static org.junit.Assert.*;
public class OnapSnmpCommandTest {
@@ -91,7 +98,6 @@ public class OnapSnmpCommandTest {
snmpCmd.run();
OnapCommandResult result = snmpCmd.getResult();
- assertEquals("snmp", result.getRecordsMap().get("system-desc")
- .getValues().get(0));
+ assertEquals("snmp", result.getRecordsMap().get("system-desc").getValues().get(0));
}
} \ No newline at end of file