summaryrefslogtreecommitdiffstats
path: root/framework/src/test/java/org/onap
diff options
context:
space:
mode:
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-09-30 22:48:55 +0530
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-11-14 14:39:25 +0530
commit74f654c7cc41908d0109f60c7554f329f0b29daf (patch)
treed6346121d296db3da12b2b0b3a36f07f76a3857c /framework/src/test/java/org/onap
parentd39f12c5af170277b2c3daf8cff86553e3a0d2ec (diff)
Migrate auth logic into http command
Login/Logout logic is moved into http command as this framework would be enhanced to support other command types like ssh Issue-Id: CLI-66 Change-Id: I33936f8871dfa4c000f8fcabb9cf17e96fc71e0b Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'framework/src/test/java/org/onap')
-rw-r--r--framework/src/test/java/org/onap/cli/fw/ad/OnapAuthClientCommandBasedTest.java19
-rw-r--r--framework/src/test/java/org/onap/cli/fw/cmd/OnapSwaggerCommandTest.java2
2 files changed, 10 insertions, 11 deletions
diff --git a/framework/src/test/java/org/onap/cli/fw/ad/OnapAuthClientCommandBasedTest.java b/framework/src/test/java/org/onap/cli/fw/ad/OnapAuthClientCommandBasedTest.java
index 77ef680d..e6054127 100644
--- a/framework/src/test/java/org/onap/cli/fw/ad/OnapAuthClientCommandBasedTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/ad/OnapAuthClientCommandBasedTest.java
@@ -21,18 +21,17 @@ import static org.junit.Assert.fail;
import org.junit.Test;
import org.onap.cli.fw.OnapCommand;
import org.onap.cli.fw.OnapCommandRegistrar;
+import org.onap.cli.fw.cmd.OnapHttpCommand;
import org.onap.cli.fw.conf.Constants;
import org.onap.cli.fw.conf.OnapCommandConfg;
import org.onap.cli.fw.error.OnapCommandException;
public class OnapAuthClientCommandBasedTest {
- OnapCommand cmd;
-
@Test
public void internalCommandTest() {
try {
- cmd = OnapCommandRegistrar.getRegistrar().get("sample-test");
+ OnapCommand cmd = OnapCommandRegistrar.getRegistrar().get("sample-test");
cmd.getService().setName(OnapCommandConfg.getInternalCmd());
cmd.execute();
@@ -45,7 +44,7 @@ public class OnapAuthClientCommandBasedTest {
@Test
public void yesCatalogYesAuthTest() throws OnapCommandException {
try {
- cmd = getCommand("sample-test-schema-yes-auth-yes-catalog.yaml");
+ OnapHttpCommand cmd = getCommand("sample-test-schema-yes-auth-yes-catalog.yaml");
cmd.getParametersMap().get(Constants.DEAFULT_PARAMETER_HOST_URL).setValue("http://localhost:8080");
cmd.getParametersMap().get(Constants.DEAFULT_PARAMETER_USERNAME).setValue("test");
cmd.getParametersMap().get(Constants.DEAFULT_PARAMETER_PASS_WORD).setValue("password");
@@ -60,7 +59,7 @@ public class OnapAuthClientCommandBasedTest {
@Test
public void yesCatalogNoAuthTest() throws OnapCommandException {
try {
- cmd = getCommand("sample-test-schema-no-auth-yes-catalog.yaml");
+ OnapHttpCommand cmd = getCommand("sample-test-schema-no-auth-yes-catalog.yaml");
cmd.getParametersMap().get(Constants.DEAFULT_PARAMETER_HOST_URL).setValue("http://localhost:8080");
cmd.execute();
@@ -73,7 +72,7 @@ public class OnapAuthClientCommandBasedTest {
@Test
public void noCatalogYesAuthTest() throws OnapCommandException {
try {
- cmd = getCommand("sample-test-schema-yes-auth-no-catalog.yaml");
+ OnapHttpCommand cmd = getCommand("sample-test-schema-yes-auth-no-catalog.yaml");
cmd.getParametersMap().get(Constants.DEAFULT_PARAMETER_HOST_URL).setValue("http://localhost:8080");
cmd.getParametersMap().get(Constants.DEAFULT_PARAMETER_USERNAME).setValue("test");
cmd.getParametersMap().get(Constants.DEAFULT_PARAMETER_PASS_WORD).setValue("password");
@@ -88,7 +87,7 @@ public class OnapAuthClientCommandBasedTest {
@Test
public void noCatalogNoAuthTest() throws OnapCommandException {
try {
- cmd = getCommand("sample-test-schema-no-auth-no-catalog.yaml");
+ OnapHttpCommand cmd = getCommand("sample-test-schema-no-auth-no-catalog.yaml");
cmd.getParametersMap().get(Constants.DEAFULT_PARAMETER_HOST_URL).setValue("http://localhost:8080");
cmd.execute();
@@ -98,10 +97,10 @@ public class OnapAuthClientCommandBasedTest {
}
}
- private OnapCommand getCommand(String yaml) throws OnapCommandException {
- OnapCommand cmd = new OnapCommand() {
+ private OnapHttpCommand getCommand(String yaml) throws OnapCommandException {
+ OnapHttpCommand cmd = new OnapHttpCommand() {
@Override
- protected void run() throws OnapCommandException {
+ protected void processRequest() throws OnapCommandException {
if (!this.getService().isModeDirect()) {
String url = this.authClient.getServiceUrl();
assert url.equals(this.getParametersMap().get(Constants.DEAFULT_PARAMETER_HOST_URL).getValue() + "/");
diff --git a/framework/src/test/java/org/onap/cli/fw/cmd/OnapSwaggerCommandTest.java b/framework/src/test/java/org/onap/cli/fw/cmd/OnapSwaggerCommandTest.java
index 628b9a42..47e3e050 100644
--- a/framework/src/test/java/org/onap/cli/fw/cmd/OnapSwaggerCommandTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/cmd/OnapSwaggerCommandTest.java
@@ -55,7 +55,7 @@ public class OnapSwaggerCommandTest {
swagger.initializeResult(obj1);
}
- @Test(expected = NullPointerException.class)
+ @Test
public void initializeResultTest3() throws OnapCommandException {
OnapSwaggerCommandImpl swagger = new OnapSwaggerCommandImpl();
swagger.initializeSchema("onap-test-schema.yaml");