summaryrefslogtreecommitdiffstats
path: root/framework/src/test/java
diff options
context:
space:
mode:
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-10-04 18:25:24 +0530
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-11-20 12:22:36 +0530
commit864eafac295bb9cc4c0b4315aa7c262eb214ccc6 (patch)
tree287aa928fa718059199164f6a7019d23642b79ba /framework/src/test/java
parent3387ffb892b85a20ae44ec58a41e1f3f2cb084f0 (diff)
Remove default_parameter section and use is_includ
Issue-Id: CLI-66 Change-Id: I24a3bc4d133d4d69fd6522091f20f88edd6c2f19 Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'framework/src/test/java')
-rw-r--r--framework/src/test/java/org/onap/cli/cmd/sample/OnapCommandSample.java2
-rw-r--r--framework/src/test/java/org/onap/cli/cmd/sample/OnapCommandSampleTest.java20
-rw-r--r--framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java22
-rw-r--r--framework/src/test/java/org/onap/cli/fw/ad/OnapAuthClientCommandBasedTest.java6
-rw-r--r--framework/src/test/java/org/onap/cli/fw/cmd/OnapHttpCommandTest.java10
-rw-r--r--framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommandTest.java2
-rw-r--r--framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java4
-rw-r--r--framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java20
8 files changed, 44 insertions, 42 deletions
diff --git a/framework/src/test/java/org/onap/cli/cmd/sample/OnapCommandSample.java b/framework/src/test/java/org/onap/cli/cmd/sample/OnapCommandSample.java
index 16c92185..87527f07 100644
--- a/framework/src/test/java/org/onap/cli/cmd/sample/OnapCommandSample.java
+++ b/framework/src/test/java/org/onap/cli/cmd/sample/OnapCommandSample.java
@@ -25,7 +25,7 @@ import org.onap.cli.fw.error.OnapCommandExecutionFailed;
* This command helps to test the Command functionalities.
*
*/
-@OnapCommandSchema(name = "sample-test", version="cli-1.0", schema = "sample-test-schema.yaml")
+@OnapCommandSchema(name = "sample-test", version="open-cli", schema = "sample-test-schema.yaml")
public class OnapCommandSample extends OnapCommand {
public OnapCommandSample() {
diff --git a/framework/src/test/java/org/onap/cli/cmd/sample/OnapCommandSampleTest.java b/framework/src/test/java/org/onap/cli/cmd/sample/OnapCommandSampleTest.java
index fc3e772d..51ed776f 100644
--- a/framework/src/test/java/org/onap/cli/cmd/sample/OnapCommandSampleTest.java
+++ b/framework/src/test/java/org/onap/cli/cmd/sample/OnapCommandSampleTest.java
@@ -37,10 +37,10 @@ import org.onap.cli.fw.output.OnapCommandResultAttribute;
public class OnapCommandSampleTest {
@Test
public void sampleTestVersion() {
-
+
try {
-
- OnapCommand sample = OnapCommandRegistrar.getRegistrar().get("sample-test");
+
+ OnapCommand sample = OnapCommandRegistrar.getRegistrar().get("sample-test");
List<OnapCommandParameter> parameters = new ArrayList();
OnapCommandParameter v = new OnapCommandParameter();
@@ -75,9 +75,9 @@ public class OnapCommandSampleTest {
@Test
public void sampleTest() {
-
+
try {
- OnapCommand sample = OnapCommandRegistrar.getRegistrar().get("sample-test");
+ OnapCommand sample = OnapCommandRegistrar.getRegistrar().get("sample-test");
List<OnapCommandParameter> parameters = new ArrayList();
OnapCommandParameter v = new OnapCommandParameter();
v.setName(Constants.DEFAULT_PARAMETER_VERSION);
@@ -100,7 +100,7 @@ public class OnapCommandSampleTest {
t.setValue("true");
parameters.add(t);
OnapCommandParameter a = new OnapCommandParameter();
- a.setName(Constants.DEFAULT_PARAMETER_OUTPUT_NO_AUTH);
+ a.setName(Constants.DEFAULT_PARAMETER_NO_AUTH);
a.setValue("true");
parameters.add(a);
OnapCommandParameter d = new OnapCommandParameter();
@@ -113,7 +113,7 @@ public class OnapCommandSampleTest {
parameters.add(m);
sample.setParameters(parameters);
sample.execute();
-
+
//validate whether output attributes default value got initialized as part of execute()
OnapCommandResultAttribute attr = sample.getResult().getRecordsMap().get("output-1");
String attrValue = attr.getValues().get(0);
@@ -122,8 +122,8 @@ public class OnapCommandSampleTest {
attrValue = attr.getValues().get(0);
assertEquals(attrValue, "test");
} catch (IllegalArgumentException e){
- fail("Failed to replace the output default value on output-1");
- } catch (OnapCommandException e) {
+ fail("Failed to replace the output default value on output-1");
+ } catch (OnapCommandException e) {
}
}
@@ -154,7 +154,7 @@ public class OnapCommandSampleTest {
t.setValue("true");
parameters.add(t);
OnapCommandParameter a = new OnapCommandParameter();
- a.setName(Constants.DEFAULT_PARAMETER_OUTPUT_NO_AUTH);
+ a.setName(Constants.DEFAULT_PARAMETER_NO_AUTH);
a.setValue("true");
parameters.add(a);
OnapCommandParameter d = new OnapCommandParameter();
diff --git a/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java b/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java
index d34f89c2..af9cc524 100644
--- a/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java
@@ -60,8 +60,8 @@ public class OnapCommandRegistrarTest {
public void registerTest() throws OnapCommandException {
OnapCommand test = new OnapCommandTest();
Class<OnapCommand> cmd = (Class<OnapCommand>) test.getClass();
- registerar.register("test", "cli-1.0", cmd);
- OnapCommand cc = registerar.get("test");
+ registerar.register("Test", "open-cli", cmd);
+ OnapCommand cc = registerar.get("Test");
assertTrue(cmd == cc.getClass());
}
@@ -70,8 +70,8 @@ public class OnapCommandRegistrarTest {
public void cmdTestSchema() throws OnapCommandException {
OnapCommand test = new OnapCommandTest();
Class<OnapCommand> cmd = (Class<OnapCommand>) test.getClass();
- registerar.register("test", "cli-1.0", cmd);
- OnapCommand cc = registerar.get("test");
+ registerar.register("Test", "open-cli", cmd);
+ OnapCommand cc = registerar.get("Test");
}
@Test
@@ -90,7 +90,7 @@ public class OnapCommandRegistrarTest {
@Test
public void onapCommandRegistrationFailedTest() throws OnapCommandException {
- @OnapCommandSchema(name = "Test2", version= "cli-1.0", schema = "sample-test-schema.yaml")
+ @OnapCommandSchema(name = "Test2", version= "open-cli", schema = "sample-test-schema.yaml")
class Test extends OnapCommand {
@Override
@@ -103,7 +103,7 @@ public class OnapCommandRegistrarTest {
OnapCommand com = new Test();
Class<OnapCommand> cmd = (Class<OnapCommand>) com.getClass();
try {
- registerar.register("Test2", "cli-1.0", cmd);
+ registerar.register("Test2", "open-cli", cmd);
registerar.get("Test2");
fail("This should have thrown an exception");
} catch (OnapCommandRegistrationFailed e) {
@@ -116,7 +116,7 @@ public class OnapCommandRegistrarTest {
OnapCommand test = new OnapCommandTest1();
Class<OnapCommand> cmd = (Class<OnapCommand>) test.getClass();
registerar = new OnapCommandRegistrar();
- registerar.register("test1", "cli-1.0", cmd);
+ registerar.register("test1", "open-cli", cmd);
String help = registerar.getHelp();
assertNotNull(help);
}
@@ -149,8 +149,8 @@ public class OnapCommandRegistrarTest {
OnapCommandRegistrar.getRegistrar().setInteractiveMode(false);
assertTrue(!OnapCommandRegistrar.getRegistrar().isInteractiveMode());
- OnapCommandRegistrar.getRegistrar().setEnabledProductVersion("cli-1.0");
- assertEquals("cli-1.0", OnapCommandRegistrar.getRegistrar().getEnabledProductVersion());
+ OnapCommandRegistrar.getRegistrar().setEnabledProductVersion("open-cli");
+ assertEquals("open-cli", OnapCommandRegistrar.getRegistrar().getEnabledProductVersion());
OnapCommandRegistrar.getRegistrar().getAvailableProductVersions();
assertTrue(OnapCommandRegistrar.getRegistrar().listCommandsForEnabledProductVersion().contains("schema-refresh"));
@@ -161,7 +161,7 @@ public class OnapCommandRegistrarTest {
}
}
-@OnapCommandSchema(name = OnapCommandTest.CMD_NAME, version = "cli-1.0", schema = "sample-test-schema.yaml")
+@OnapCommandSchema(name = OnapCommandTest.CMD_NAME, version = "open-cli", schema = "sample-test-schema.yaml")
class OnapCommandTest extends OnapCommand {
public OnapCommandTest() {
@@ -176,7 +176,7 @@ class OnapCommandTest extends OnapCommand {
}
-@OnapCommandSchema(name = OnapCommandTest1.CMD_NAME, version = "cli-1.0", schema = "test-schema.yaml")
+@OnapCommandSchema(name = OnapCommandTest1.CMD_NAME, version = "open-cli", schema = "test-schema.yaml")
class OnapCommandTest1 extends OnapCommand {
public OnapCommandTest1() {
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 e6054127..a2a25bc2 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
@@ -32,7 +32,7 @@ public class OnapAuthClientCommandBasedTest {
public void internalCommandTest() {
try {
OnapCommand cmd = OnapCommandRegistrar.getRegistrar().get("sample-test");
- cmd.getService().setName(OnapCommandConfg.getInternalCmd());
+ cmd.getInfo().setService(OnapCommandConfg.getProductName());
cmd.execute();
} catch (OnapCommandException e) {
@@ -47,7 +47,7 @@ public class OnapAuthClientCommandBasedTest {
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");
+ cmd.getParametersMap().get(Constants.DEAFULT_PARAMETER_PASSWORD).setValue("password");
cmd.execute();
} catch (OnapCommandException e) {
@@ -75,7 +75,7 @@ public class OnapAuthClientCommandBasedTest {
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");
+ cmd.getParametersMap().get(Constants.DEAFULT_PARAMETER_PASSWORD).setValue("password");
cmd.execute();
} catch (OnapCommandException e) {
diff --git a/framework/src/test/java/org/onap/cli/fw/cmd/OnapHttpCommandTest.java b/framework/src/test/java/org/onap/cli/fw/cmd/OnapHttpCommandTest.java
index 7552cacb..3fced8ab 100644
--- a/framework/src/test/java/org/onap/cli/fw/cmd/OnapHttpCommandTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/cmd/OnapHttpCommandTest.java
@@ -16,18 +16,20 @@
package org.onap.cli.fw.cmd;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.junit.Ignore;
import org.junit.Test;
import org.onap.cli.fw.error.OnapCommandException;
import org.onap.cli.fw.http.HttpInput;
import org.onap.cli.fw.input.OnapCommandParameter;
import org.onap.cli.fw.input.ParameterType;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
public class OnapHttpCommandTest {
+ @Ignore
@Test(expected = OnapCommandException.class)
public void runTest() throws OnapCommandException {
OnapCommandParameter param1 = new OnapCommandParameter();
diff --git a/framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommandTest.java b/framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommandTest.java
index b0aa2119..8c96facd 100644
--- a/framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommandTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommandTest.java
@@ -45,7 +45,7 @@ public class OnapSchemaRefreshCommandTest {
assertTrue(cmdName.equalsIgnoreCase("sample-test1"));
assertTrue(cmdFile.equalsIgnoreCase("sample-test1-schema-http.yaml"));
assertTrue(version.equalsIgnoreCase("1.0"));
- assertTrue(cmdVer.equalsIgnoreCase("cli-1.0"));
+ assertTrue(cmdVer.equalsIgnoreCase("open-cli"));
}
}
diff --git a/framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java b/framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java
index d8745989..62a61d86 100644
--- a/framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java
@@ -118,8 +118,8 @@ public class ValidateSchemaTest {
List<String> errorList4 = OnapCommandUtils.loadSchema(cmd2, "schema-validate-invalid.yaml", true, true);
OnapHttpCommand onapHttpCommand = new OnapHttpCommand();
- errorList4.addAll(OnapCommandUtils.loadHTTPSchemaSection(onapHttpCommand,
- "schema-validate-invalid.yaml", true));
+ errorList4.addAll(OnapCommandUtils.loadHttpSchema(onapHttpCommand,
+ "schema-validate-invalid.yaml", true, true));
assertTrue(errorList4.size() > 0);
OnapCommand cmd5 = new OnapCommand() {
diff --git a/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java b/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java
index 096c6ff3..faf8394a 100644
--- a/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java
@@ -176,10 +176,8 @@ public class OnapCommandUtilsTest {
com.setValue("value");
}
- OnapCredentials cre = OnapCommandUtils.fromParameters(cmd.getParameters());
- assertTrue(cre != null);
Map<String, OnapCommandParameter> map = OnapCommandUtils.getInputMap(cmd.getParameters());
- assertTrue(map.size() == 16);
+ assertTrue(map.size() == 15);
}
@Test
@@ -189,7 +187,7 @@ public class OnapCommandUtilsTest {
assertTrue("sample-test".equals(cmd.getName()));
Map<String, OnapCommandParameter> map = OnapCommandUtils.getInputMap(cmd.getParameters());
- assertTrue(map.size() == 11);
+ assertTrue(map.size() == 7);
}
@Test
@@ -219,7 +217,7 @@ public class OnapCommandUtilsTest {
OnapHttpCommand cmd = new OnapHttpCommandSample();
cmd.setName("sample-test-http");
try {
- OnapCommandUtils.loadHTTPSchemaSection(cmd, "sample-test-schema.yaml", false);
+ OnapCommandUtils.loadHttpSchema(cmd, "sample-test-schema.yaml", true, false);
} catch (OnapCommandParameterNameConflict | OnapCommandParameterOptionConflict
| OnapCommandInvalidParameterType | OnapCommandInvalidPrintDirection
| OnapCommandInvalidResultAttributeScope | OnapCommandSchemaNotFound | OnapCommandInvalidSchema
@@ -233,7 +231,7 @@ public class OnapCommandUtilsTest {
OnapHttpCommand cmd = new OnapHttpCommandSample();
cmd.setName("sample-create-http");
try {
- OnapCommandUtils.loadHTTPSchemaSection(cmd, "sample-test-schema-http.yaml", true);
+ OnapCommandUtils.loadHttpSchema(cmd, "sample-test-schema-http.yaml", true, true);
assertTrue(cmd.getSuccessStatusCodes().size() == 2);
} catch (OnapCommandParameterNameConflict | OnapCommandParameterOptionConflict
| OnapCommandInvalidParameterType | OnapCommandInvalidPrintDirection
@@ -251,6 +249,8 @@ public class OnapCommandUtilsTest {
String actualResult = OnapCommandUtils.help(cmd);
String expectedHelp = FileUtil.loadResource("sample-cmd-test-help.txt");
+
+ //mrkanag compare the result
}
@Test
@@ -443,21 +443,21 @@ public class OnapCommandUtilsTest {
assert info != null;
}
- @OnapCommandSchema(name = "sample-test-info", version = "cli-1.0", schema = "sample-test-info.yaml")
+ @OnapCommandSchema(name = "sample-test-info", version = "open-cli", schema = "sample-test-info.yaml")
class OnapCommandSampleInfo extends OnapCommand {
@Override
protected void run() throws OnapCommandException {
}
}
- @OnapCommandSchema(name = "sample-test", version = "cli-1.0", schema = "sample-test-schema.yaml")
+ @OnapCommandSchema(name = "sample-test", version = "open-cli", schema = "sample-test-schema.yaml")
class OnapCommandSample extends OnapCommand {
@Override
protected void run() throws OnapCommandException {
}
}
- @OnapCommandSchema(name = "sample-swagger-test", version = "cli-1.0", schema = "sample-test-schema-swagger.yaml")
+ @OnapCommandSchema(name = "sample-swagger-test", version = "open-cli", schema = "sample-test-schema-swagger.yaml")
class OnapSwaggerBasedCommandSample extends OnapSwaggerCommand {
@Override
@@ -465,7 +465,7 @@ public class OnapCommandUtilsTest {
}
}
- @OnapCommandSchema(name = "sample-http-test", version = "cli-1.0", schema = "sample-test-schema-http.yaml")
+ @OnapCommandSchema(name = "sample-http-test", version = "open-cli", schema = "sample-test-schema-http.yaml")
class OnapHttpCommandSample extends OnapHttpCommand {
@Override