diff options
author | 2017-10-13 13:09:41 +0530 | |
---|---|---|
committer | 2017-11-20 14:07:58 +0530 | |
commit | 5502b8f9c9fe2432ee768bf97e1ef5b551d4cbc5 (patch) | |
tree | b505a0e3dbd39832ad547249adfa02117235cad5 /framework/src/test/java/org | |
parent | 81f15e39c42a2d86d590bbf1622bbd32434ad584 (diff) |
Add schema type for plugins like http
Issue-Id: CLI-66
Change-Id: I3756ccce8682644822850fd2621d9356bad74dc8
Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'framework/src/test/java/org')
3 files changed, 15 insertions, 59 deletions
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 8a69ae61..339a0f66 100644 --- a/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java +++ b/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java @@ -25,6 +25,7 @@ import java.io.File; import java.net.URL; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.onap.cli.fw.error.OnapCommandException; import org.onap.cli.fw.error.OnapCommandHelpFailed; @@ -57,24 +58,6 @@ public class OnapCommandRegistrarTest { } @Test - public void registerTest() throws OnapCommandException { - OnapCommand test = new OnapCommandTest(); - Class<OnapCommand> cmd = (Class<OnapCommand>) test.getClass(); - registerar.register("Test", "open-cli", cmd); - OnapCommand cc = registerar.get("Test"); - assertTrue(cmd == cc.getClass()); - - } - - @Test - public void cmdTestSchema() throws OnapCommandException { - OnapCommand test = new OnapCommandTest(); - Class<OnapCommand> cmd = (Class<OnapCommand>) test.getClass(); - registerar.register("Test", "open-cli", cmd); - OnapCommand cc = registerar.get("Test"); - } - - @Test public void oclipCommandNotFoundTest() throws OnapCommandException { try { registerar = OnapCommandRegistrar.getRegistrar(); @@ -88,40 +71,6 @@ public class OnapCommandRegistrarTest { } @Test - public void oclipCommandRegistrationFailedTest() throws OnapCommandException { - - @OnapCommandSchema(schema = "sample-test-schema.yaml") - class Test extends OnapCommand { - - @Override - protected void run() throws OnapCommandException { - - } - - } - - OnapCommand com = new Test(); - Class<OnapCommand> cmd = (Class<OnapCommand>) com.getClass(); - try { - registerar.register("Test2", "open-cli", cmd); - registerar.get("Test2"); - fail("This should have thrown an exception"); - } catch (OnapCommandRegistrationFailed e) { - assertEquals("0x2002", e.getErrorCode()); - } - } - - @Test(expected = OnapCommandHelpFailed.class) - public void helpTestException() throws OnapCommandException { - OnapCommand test = new OnapCommandTest1(); - Class<OnapCommand> cmd = (Class<OnapCommand>) test.getClass(); - registerar = new OnapCommandRegistrar(); - registerar.register("test1", "open-cli", cmd); - String help = registerar.getHelp(); - assertNotNull(help); - } - - @Test public void helpTest() throws OnapCommandException { String help = registerar.getHelp(); assertNotNull(help); 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 a2a25bc2..9c733c94 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 @@ -18,6 +18,7 @@ package org.onap.cli.fw.ad; import static org.junit.Assert.fail; +import org.junit.Before; import org.junit.Test; import org.onap.cli.fw.OnapCommand; import org.onap.cli.fw.OnapCommandRegistrar; @@ -25,9 +26,15 @@ 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; +import org.onap.cli.fw.error.OnapCommandProductVersionInvalid; public class OnapAuthClientCommandBasedTest { + @Before + public void setup() throws OnapCommandProductVersionInvalid, OnapCommandException { + OnapCommandRegistrar.getRegistrar().setEnabledProductVersion(OnapCommandConfg.getProductName()); + } + @Test public void internalCommandTest() { try { @@ -37,7 +44,7 @@ public class OnapAuthClientCommandBasedTest { cmd.execute(); } catch (OnapCommandException e) { fail("Internal command failed to run"); - e.printStackTrace(); + e.printStackTrace(System.out); } } @@ -52,7 +59,7 @@ public class OnapAuthClientCommandBasedTest { cmd.execute(); } catch (OnapCommandException e) { fail("External command Yes Auth Yes Catalog failed to run"); - e.printStackTrace(); + e.printStackTrace(System.out); } } @@ -64,8 +71,8 @@ public class OnapAuthClientCommandBasedTest { cmd.execute(); } catch (OnapCommandException e) { - fail("External command Yes Auth No Catalog failed to run"); - e.printStackTrace(); + fail("External command Yes Auth No Catalog failed to run " + e.getMessage()); + e.printStackTrace(System.out); } } @@ -80,7 +87,7 @@ public class OnapAuthClientCommandBasedTest { cmd.execute(); } catch (OnapCommandException e) { fail("External command Yes Auth No Catalog failed to run"); - e.printStackTrace(); + e.printStackTrace(System.out); } } @@ -93,7 +100,7 @@ public class OnapAuthClientCommandBasedTest { cmd.execute(); } catch (OnapCommandException e) { fail("External command No Auth No Catalog failed to run"); - e.printStackTrace(); + e.printStackTrace(System.out); } } 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 e874dc96..419c4edc 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 @@ -255,7 +255,7 @@ public class OnapCommandUtilsTest { @Test public void findOnapCommandsTest() { List<Class<OnapCommand>> cmds = OnapCommandUtils.discoverCommandPlugins(); - assertTrue(cmds.size() == 6); + assertTrue(cmds.size() == 7); } @Test |