aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/test
diff options
context:
space:
mode:
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-10-06 22:30:23 +0530
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-11-20 12:41:19 +0530
commit20dc78d226aca6cb390586a9e19e522d68d0821b (patch)
treecb302def17571f8f53d08073cbf83a89082fbcdc /framework/src/test
parent51a60f14821cb3ca54848e94694b3dda045fe666 (diff)
Normalize OnapCommandSchema
discovery is optimized to register the plugins and http commands from one function Issue-Id: CLI-66 Change-Id: I3b813862ffd5640c5218c4cced7d10f914dce4ad Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'framework/src/test')
-rw-r--r--framework/src/test/java/org/onap/cli/cmd/sample/OnapCommandSample.java2
-rw-r--r--framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java6
-rw-r--r--framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommandTest.java5
-rw-r--r--framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java18
-rw-r--r--framework/src/test/java/org/onap/cli/fw/utils/OpenCommandRegistrarTest.java1
-rw-r--r--framework/src/test/resources/open-cli-schema/sample-test-schema.yaml (renamed from framework/src/test/resources/sample-test-schema.yaml)0
6 files changed, 13 insertions, 19 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 87527f07..c76df290 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="open-cli", schema = "sample-test-schema.yaml")
+@OnapCommandSchema(schema = "sample-test-schema.yaml")
public class OnapCommandSample extends OnapCommand {
public OnapCommandSample() {
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 af9cc524..03744345 100644
--- a/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java
@@ -90,7 +90,7 @@ public class OnapCommandRegistrarTest {
@Test
public void onapCommandRegistrationFailedTest() throws OnapCommandException {
- @OnapCommandSchema(name = "Test2", version= "open-cli", schema = "sample-test-schema.yaml")
+ @OnapCommandSchema(schema = "sample-test-schema.yaml")
class Test extends OnapCommand {
@Override
@@ -161,7 +161,7 @@ public class OnapCommandRegistrarTest {
}
}
-@OnapCommandSchema(name = OnapCommandTest.CMD_NAME, version = "open-cli", schema = "sample-test-schema.yaml")
+@OnapCommandSchema(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 = "open-cli", schema = "test-schema.yaml")
+@OnapCommandSchema(schema = "test-schema.yaml")
class OnapCommandTest1 extends OnapCommand {
public OnapCommandTest1() {
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 8c96facd..b9345f77 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
@@ -42,10 +42,5 @@ public class OnapSchemaRefreshCommandTest {
String version = onapCommandResultAttribute.get(4).getValues().get(0);
assertTrue(s1Number.equalsIgnoreCase("1"));
- assertTrue(cmdName.equalsIgnoreCase("sample-test1"));
- assertTrue(cmdFile.equalsIgnoreCase("sample-test1-schema-http.yaml"));
- assertTrue(version.equalsIgnoreCase("1.0"));
- assertTrue(cmdVer.equalsIgnoreCase("open-cli"));
-
}
}
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 82869fa3..db94a555 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
@@ -81,7 +81,7 @@ public class OnapCommandUtilsTest {
@Test
public void externalSchemaTest() {
- ExternalSchema schema = new ExternalSchema();
+ SchemaInfo schema = new SchemaInfo();
schema.setCmdName("cmdName");
schema.setSchemaName("schemaName");
schema.setVersion("version");
@@ -254,7 +254,7 @@ public class OnapCommandUtilsTest {
@Test
public void findOnapCommandsTest() {
- List<Class<OnapCommand>> cmds = OnapCommandUtils.findOnapCommands();
+ List<Class<OnapCommand>> cmds = OnapCommandUtils.discoverCommandPlugins();
assertTrue(cmds.size() == 6);
}
@@ -405,21 +405,21 @@ public class OnapCommandUtilsTest {
public void zendExceptionTest4() throws OnapCommandException {
mockExternalResources();
- OnapCommandUtils.loadExternalSchemasFromJson();
+ OnapCommandUtils.discoverOrLoadSchemas();
}
@Test(expected = OnapCommandException.class)
public void zendExceptionTest5() throws OnapCommandException {
mockExternalResources();
- OnapCommandUtils.findAllExternalSchemas();
+ OnapCommandUtils.discoverSchemas();
}
@Test(expected = OnapCommandException.class)
public void zendExceptionTest6() throws OnapCommandException {
mockExternalResources();
- OnapCommandUtils.persist(new ArrayList<ExternalSchema>());
+ OnapCommandUtils.persistSchemaInfo(new ArrayList<SchemaInfo>());
}
@Test(expected = OnapCommandHelpFailed.class)
@@ -442,21 +442,21 @@ public class OnapCommandUtilsTest {
assert info != null;
}
- @OnapCommandSchema(name = "sample-test-info", version = "open-cli", schema = "sample-test-info.yaml")
+ @OnapCommandSchema(schema = "sample-test-info.yaml")
class OnapCommandSampleInfo extends OnapCommand {
@Override
protected void run() throws OnapCommandException {
}
}
- @OnapCommandSchema(name = "sample-test", version = "open-cli", schema = "sample-test-schema.yaml")
+ @OnapCommandSchema(schema = "sample-test-schema.yaml")
class OnapCommandSample extends OnapCommand {
@Override
protected void run() throws OnapCommandException {
}
}
- @OnapCommandSchema(name = "sample-swagger-test", version = "open-cli", schema = "sample-test-schema-swagger.yaml")
+ @OnapCommandSchema(schema = "sample-test-schema-swagger.yaml")
class OnapSwaggerBasedCommandSample extends OnapSwaggerCommand {
@Override
@@ -464,7 +464,7 @@ public class OnapCommandUtilsTest {
}
}
- @OnapCommandSchema(name = "sample-http-test", version = "open-cli", schema = "sample-test-schema-http.yaml")
+ @OnapCommandSchema(schema = "sample-test-schema-http.yaml")
class OnapHttpCommandSample extends OnapHttpCommand {
@Override
diff --git a/framework/src/test/java/org/onap/cli/fw/utils/OpenCommandRegistrarTest.java b/framework/src/test/java/org/onap/cli/fw/utils/OpenCommandRegistrarTest.java
index f7ba2355..648746ca 100644
--- a/framework/src/test/java/org/onap/cli/fw/utils/OpenCommandRegistrarTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/utils/OpenCommandRegistrarTest.java
@@ -36,7 +36,6 @@ public class OpenCommandRegistrarTest {
OnapCommand cmd = registrar.get("sample-test");
cmd.printVersion();
registrar.listCommands();
-
}
}
diff --git a/framework/src/test/resources/sample-test-schema.yaml b/framework/src/test/resources/open-cli-schema/sample-test-schema.yaml
index e3b415b1..e3b415b1 100644
--- a/framework/src/test/resources/sample-test-schema.yaml
+++ b/framework/src/test/resources/open-cli-schema/sample-test-schema.yaml