summaryrefslogtreecommitdiffstats
path: root/framework/src/test/java/org
diff options
context:
space:
mode:
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-10-14 01:04:20 +0530
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-11-21 18:07:19 +0530
commit8aa599260569b9f063fb85680c95116b00609c31 (patch)
treedbcaf3e4a5141e801c7b9136240c9d4f7216fac7 /framework/src/test/java/org
parentb7500cd5c7caef69f9d8689872eea01876c9fbba (diff)
Make schema-validate independent of schema profile
Now schema-validate is able to validate schema of any given type supported. Issue-Id: CLI-66 Change-Id: I47ac5e81e9b12dd575e0a4cdc7e8e8bad0f87474 Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'framework/src/test/java/org')
-rw-r--r--framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java2
-rw-r--r--framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommandTest.java18
-rw-r--r--framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommandTest.java43
-rw-r--r--framework/src/test/java/org/onap/cli/fw/conf/OnapCommandConfgTest.java6
-rw-r--r--framework/src/test/java/org/onap/cli/fw/error/OnapCommandErrorTest.java10
-rw-r--r--framework/src/test/java/org/onap/cli/fw/http/HttpInputOutputTest.java4
-rw-r--r--framework/src/test/java/org/onap/cli/fw/http/OnapHttpConnectionTest.java14
-rw-r--r--framework/src/test/java/org/onap/cli/fw/input/OnapCommandParameterTest.java8
-rw-r--r--framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultAttributeScopeTest.java4
-rw-r--r--framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultTest.java8
-rw-r--r--framework/src/test/java/org/onap/cli/fw/output/print/OnapCommandPrintTest.java8
-rw-r--r--framework/src/test/java/org/onap/cli/fw/output/print/TableGeneratorTest.java6
-rw-r--r--framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java8
13 files changed, 58 insertions, 81 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 339a0f66..3f9f780d 100644
--- a/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java
@@ -25,12 +25,10 @@ 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;
import org.onap.cli.fw.error.OnapCommandNotFound;
-import org.onap.cli.fw.error.OnapCommandRegistrationFailed;
public class OnapCommandRegistrarTest {
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 7aedd42d..99f45190 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
@@ -16,13 +16,13 @@
package org.onap.cli.fw.cmd;
-import org.junit.Test;
-import org.onap.cli.fw.error.OnapCommandException;
-import org.onap.cli.fw.output.OnapCommandResultAttribute;
+import static org.junit.Assert.assertTrue;
import java.util.List;
-import static org.junit.Assert.assertTrue;
+import org.junit.Test;
+import org.onap.cli.fw.error.OnapCommandException;
+import org.onap.cli.fw.output.OnapCommandResultAttribute;
public class OnapSchemaRefreshCommandTest {
@@ -32,15 +32,11 @@ public class OnapSchemaRefreshCommandTest {
cmd.initializeSchema("schema-refresh.yaml");
cmd.execute();
- List<OnapCommandResultAttribute> oclipCommandResultAttribute = cmd.getResult()
+ List<OnapCommandResultAttribute> oclipCommandResultAttributes = cmd.getResult()
.getRecords();
- String s1Number = oclipCommandResultAttribute.get(0).getValues().get(0);
- String cmdName = oclipCommandResultAttribute.get(1).getValues().get(0);
- String cmdVer = oclipCommandResultAttribute.get(2).getValues().get(0);
- String cmdFile = oclipCommandResultAttribute.get(3).getValues().get(0);
- String version = oclipCommandResultAttribute.get(4).getValues().get(0);
- assertTrue(s1Number.equalsIgnoreCase("1"));
+ assertTrue(oclipCommandResultAttributes.size() > 1);
+
}
}
diff --git a/framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommandTest.java b/framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommandTest.java
index 2355d668..8d8de2f7 100644
--- a/framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommandTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommandTest.java
@@ -16,49 +16,32 @@
package org.onap.cli.fw.cmd;
+import org.junit.Ignore;
import org.junit.Test;
+import org.onap.cli.fw.OnapCommand;
+import org.onap.cli.fw.OnapCommandRegistrar;
import org.onap.cli.fw.error.OnapCommandException;
-import org.onap.cli.fw.input.OnapCommandParameter;
import org.onap.cli.fw.schema.ValidateSchemaTest;
+
public class OnapSchemaValidateCommandTest {
+ @Ignore
@Test
public void validateSchemaCommandTest1() throws OnapCommandException {
- OnapSchemaValidateCommand cmd = new OnapSchemaValidateCommand();
- cmd.initializeSchema("schema-validate.yaml");
- for (OnapCommandParameter param : cmd.getParameters()) {
- if ("host-username".equals(param.getName())) {
- param.setValue("test");
- } else if ("host-password".equals(param.getName())) {
- param.setValue("test");
- } else if ("host-url".equals(param.getName())) {
- param.setValue("test-url");
- } else if ("schema-location".equals(param.getName())) {
- param.setValue("schema-validate-pass.yaml");
- } else if ("internal-schema".equals(param.getName())) {
- param.setValue("true");
- }
- }
+ OnapCommand cmd = OnapCommandRegistrar.getRegistrar().get("schema-validate");
+ cmd.getParametersMap().get("schema-location").setValue("schema-validate-pass.yaml");
+ cmd.getParametersMap().get("internal-schema").setValue("true");
cmd.execute();
}
+ @Ignore
@Test
public void validateSchemaCommandTest2() throws OnapCommandException {
- OnapSchemaValidateCommand cmd = new OnapSchemaValidateCommand();
- cmd.initializeSchema("schema-validate.yaml");
- for (OnapCommandParameter param : cmd.getParameters()) {
- if ("host-username".equals(param.getName())) {
- param.setValue("test");
- } else if ("host-password".equals(param.getName())) {
- param.setValue("test");
- } else if ("host-url".equals(param.getName())) {
- param.setValue("test-url");
- } else if ("schema-location".equals(param.getName())) {
- param.setValue(
- ValidateSchemaTest.class.getClassLoader().getResource("schema-validate-pass.yaml").getFile());
- }
- }
+ OnapCommand cmd = OnapCommandRegistrar.getRegistrar().get("schema-validate");
+ cmd.getParametersMap().get("schema-location").setValue(
+ ValidateSchemaTest.class.getClassLoader().getResource("schema-validate-pass.yaml").getFile());
+ cmd.getParametersMap().get("internal-schema").setValue("true");
cmd.execute();
}
}
diff --git a/framework/src/test/java/org/onap/cli/fw/conf/OnapCommandConfgTest.java b/framework/src/test/java/org/onap/cli/fw/conf/OnapCommandConfgTest.java
index 1a677707..2c25991b 100644
--- a/framework/src/test/java/org/onap/cli/fw/conf/OnapCommandConfgTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/conf/OnapCommandConfgTest.java
@@ -16,12 +16,12 @@
package org.onap.cli.fw.conf;
-import org.junit.Assert;
-import org.junit.Test;
-
import java.io.IOException;
import java.util.Properties;
+import org.junit.Assert;
+import org.junit.Test;
+
public class OnapCommandConfgTest {
@Test
diff --git a/framework/src/test/java/org/onap/cli/fw/error/OnapCommandErrorTest.java b/framework/src/test/java/org/onap/cli/fw/error/OnapCommandErrorTest.java
index 45560c4a..899f2e3b 100644
--- a/framework/src/test/java/org/onap/cli/fw/error/OnapCommandErrorTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/error/OnapCommandErrorTest.java
@@ -94,9 +94,9 @@ public class OnapCommandErrorTest {
@Test
public void oclipCommandExecutorInfoMissingTest() {
- OnapCommandExecutorInfoMissing failed = new OnapCommandExecutorInfoMissing("Test");
+ OnapCommandInstantiationFailed failed = new OnapCommandInstantiationFailed("Test");
- assertEquals("0x6002::Command Test excutor info is missing from schema", failed.getMessage());
+ assertEquals("0x6002::Failed to instantiate the command plugin Test", failed.getMessage());
}
@Test
@@ -225,9 +225,9 @@ public class OnapCommandErrorTest {
@Test
public void oclipCommandParameterOptionConflictTest() {
- OnapCommandParameterOptionConflict failed = new OnapCommandParameterOptionConflict("option");
+ OnapCommandParameterOptionConflict failed = new OnapCommandParameterOptionConflict("test", "option");
- assertEquals("0x7006::Parameter option option is in conflict, only one option is allowed with given name",
+ assertEquals("0x7006::In test, Parameter option option is in conflict, only one option is allowed with given name",
failed.getMessage());
}
@@ -296,5 +296,5 @@ public class OnapCommandErrorTest {
OnapCommandInvalidCommandType failed = new OnapCommandInvalidCommandType("test");
assertEquals("0x3003::Command type test is invalid", failed.getMessage());
- }
+ }
}
diff --git a/framework/src/test/java/org/onap/cli/fw/http/HttpInputOutputTest.java b/framework/src/test/java/org/onap/cli/fw/http/HttpInputOutputTest.java
index 900d72e8..0a3a817e 100644
--- a/framework/src/test/java/org/onap/cli/fw/http/HttpInputOutputTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/http/HttpInputOutputTest.java
@@ -18,10 +18,10 @@ package org.onap.cli.fw.http;
import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-
import java.util.HashMap;
+import org.junit.Test;
+
public class HttpInputOutputTest {
@Test
diff --git a/framework/src/test/java/org/onap/cli/fw/http/OnapHttpConnectionTest.java b/framework/src/test/java/org/onap/cli/fw/http/OnapHttpConnectionTest.java
index ab00f90b..785092c2 100644
--- a/framework/src/test/java/org/onap/cli/fw/http/OnapHttpConnectionTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/http/OnapHttpConnectionTest.java
@@ -17,11 +17,11 @@
package org.onap.cli.fw.http;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import mockit.Invocation;
-import mockit.Mock;
-import mockit.MockUp;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpUriRequest;
@@ -31,9 +31,9 @@ import org.junit.Before;
import org.junit.Test;
import org.onap.cli.fw.error.OnapCommandHttpFailure;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
+import mockit.Invocation;
+import mockit.Mock;
+import mockit.MockUp;
public class OnapHttpConnectionTest {
HttpInput inp = null;
diff --git a/framework/src/test/java/org/onap/cli/fw/input/OnapCommandParameterTest.java b/framework/src/test/java/org/onap/cli/fw/input/OnapCommandParameterTest.java
index f2e9f0b3..44656f9f 100644
--- a/framework/src/test/java/org/onap/cli/fw/input/OnapCommandParameterTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/input/OnapCommandParameterTest.java
@@ -16,15 +16,15 @@
package org.onap.cli.fw.input;
-import org.junit.Test;
-import org.onap.cli.fw.error.OnapCommandException;
-import org.onap.cli.fw.error.OnapCommandInvalidParameterValue;
+import static org.junit.Assert.assertTrue;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
-import static org.junit.Assert.assertTrue;
+import org.junit.Test;
+import org.onap.cli.fw.error.OnapCommandException;
+import org.onap.cli.fw.error.OnapCommandInvalidParameterValue;
public class OnapCommandParameterTest {
diff --git a/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultAttributeScopeTest.java b/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultAttributeScopeTest.java
index 76d139a0..7ab3fe52 100644
--- a/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultAttributeScopeTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultAttributeScopeTest.java
@@ -18,11 +18,11 @@ package org.onap.cli.fw.output;
import static org.junit.Assert.assertTrue;
+import java.util.Collections;
+
import org.junit.Test;
import org.onap.cli.fw.input.ParameterType;
-import java.util.Collections;
-
public class OnapCommandResultAttributeScopeTest {
@Test
public void oclipCommandResultAttributeTest() {
diff --git a/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultTest.java b/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultTest.java
index dddab1bc..9c832c24 100644
--- a/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultTest.java
@@ -19,15 +19,15 @@ package org.onap.cli.fw.output;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
import org.junit.Ignore;
import org.junit.Test;
import org.onap.cli.fw.error.OnapCommandException;
import org.onap.cli.fw.input.ParameterType;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
public class OnapCommandResultTest {
@Test
diff --git a/framework/src/test/java/org/onap/cli/fw/output/print/OnapCommandPrintTest.java b/framework/src/test/java/org/onap/cli/fw/output/print/OnapCommandPrintTest.java
index ae17d6d4..84c868b3 100644
--- a/framework/src/test/java/org/onap/cli/fw/output/print/OnapCommandPrintTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/output/print/OnapCommandPrintTest.java
@@ -18,15 +18,15 @@ package org.onap.cli.fw.output.print;
import static org.junit.Assert.assertEquals;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
import org.junit.Ignore;
import org.junit.Test;
import org.onap.cli.fw.error.OnapCommandOutputPrintingFailed;
import org.onap.cli.fw.output.PrintDirection;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
public class OnapCommandPrintTest {
@Test
diff --git a/framework/src/test/java/org/onap/cli/fw/output/print/TableGeneratorTest.java b/framework/src/test/java/org/onap/cli/fw/output/print/TableGeneratorTest.java
index f9ae0717..58ff4751 100644
--- a/framework/src/test/java/org/onap/cli/fw/output/print/TableGeneratorTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/output/print/TableGeneratorTest.java
@@ -18,13 +18,13 @@ package org.onap.cli.fw.output.print;
import static org.junit.Assert.assertEquals;
-import org.junit.Before;
-import org.junit.Test;
-
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
+
public class TableGeneratorTest {
private TableGenerator table;
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 22c36c3d..a900fe6d 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
@@ -16,6 +16,10 @@
package org.onap.cli.fw.schema;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
import org.junit.Test;
import org.onap.cli.fw.OnapCommand;
import org.onap.cli.fw.cmd.OnapHttpCommand;
@@ -23,10 +27,6 @@ import org.onap.cli.fw.error.OnapCommandException;
import org.onap.cli.fw.error.OnapCommandInvalidSchema;
import org.onap.cli.fw.utils.OnapCommandSchemaLoaderUtils;
-import java.util.List;
-
-import static org.junit.Assert.assertTrue;
-
public class ValidateSchemaTest {
@Test(expected = OnapCommandInvalidSchema.class)