summaryrefslogtreecommitdiffstats
path: root/main/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/test')
-rw-r--r--main/src/test/java/org/onap/cli/main/OnapCliMainTest.java49
-rw-r--r--main/src/test/java/org/onap/cli/main/OnapCommandSampleTest.java4
-rw-r--r--main/src/test/java/org/onap/cli/main/utils/OnapCliUtilsTest.java140
-rw-r--r--main/src/test/resources/META-INF/services/org.onap.cli.fw.cmd.OnapCommand (renamed from main/src/test/resources/META-INF/services/org.onap.cli.fw.OnapCommand)0
-rw-r--r--main/src/test/resources/open-cli-schema/sample-create-schema.yaml73
-rw-r--r--main/src/test/resources/open-cli-schema/sample-test-schema.yaml (renamed from main/src/test/resources/sample-test-schema.yaml)0
6 files changed, 74 insertions, 192 deletions
diff --git a/main/src/test/java/org/onap/cli/main/OnapCliMainTest.java b/main/src/test/java/org/onap/cli/main/OnapCliMainTest.java
index 9d3b036c..f7401904 100644
--- a/main/src/test/java/org/onap/cli/main/OnapCliMainTest.java
+++ b/main/src/test/java/org/onap/cli/main/OnapCliMainTest.java
@@ -18,21 +18,12 @@ package org.onap.cli.main;
import static org.junit.Assert.fail;
-import java.io.File;
import java.io.IOException;
-import java.net.URL;
-import java.net.URLClassLoader;
-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.OnapCommand;
-import org.onap.cli.fw.OnapCommandRegistrar;
import org.onap.cli.fw.error.OnapCommandException;
import org.onap.cli.fw.error.OnapCommandHelpFailed;
-import org.onap.cli.main.utils.OnapCliArgsParser;
+import org.onap.cli.fw.registrar.OnapCommandRegistrar;
import jline.console.ConsoleReader;
import mockit.Invocation;
@@ -73,44 +64,6 @@ public class OnapCliMainTest {
this.handle(new String[] { "sample-test", "--help" });
}
- @Ignore
- @Test
- public void testHandleProfile() {
- this.handle(new String[] { "-c", "test" });
- }
-
- @Ignore
- @Test
- public void testAAICustomerList() {
- this.handle(new String[] { "customer-list", "-u", "AAI", "-p", "AAI", "-m", "https://192.168.17.12:8443" });
- }
-
- @Ignore
- @Test
- public void testAAICloudList() {
- this.handle(new String[] { "cloud-list", "-u", "AAI", "-p", "AAI", "-m", "https://192.168.17.12:8443" });
- }
-
- @Test
- public void testHelpSampleCreateCommand() throws OnapCommandException {
- ClassLoader cl = ClassLoader.getSystemClassLoader();
- URL[] urls = ((URLClassLoader) cl).getURLs();
- for (URL url : urls) {
- if (url.getPath().contains("main/target/test-classes")) {
- File file = new File(url.getPath() + "data");
- if (!file.exists()) {
- file.mkdirs();
- }
- break;
- }
- }
- this.handle(new String[] { "sample-create", "--help" });
- OnapCommand cmd = OnapCommandRegistrar.getRegistrar().get("sample-create");
- List<String> args = new ArrayList<>(Arrays.asList(new String[] { "sample-create", "--service-name", "test-service", "-i", "ip1", "-i",
- "ip2", "-o", "port1=value1", "-o", "port2=value2" }));
- OnapCliArgsParser.populateParams(cmd.getParameters(), args);
- }
-
@Test
public void testHelpSampleCommandShort() {
this.handle(new String[] { "sample-test", "-h" });
diff --git a/main/src/test/java/org/onap/cli/main/OnapCommandSampleTest.java b/main/src/test/java/org/onap/cli/main/OnapCommandSampleTest.java
index fcaa8236..3ec63ae6 100644
--- a/main/src/test/java/org/onap/cli/main/OnapCommandSampleTest.java
+++ b/main/src/test/java/org/onap/cli/main/OnapCommandSampleTest.java
@@ -16,9 +16,9 @@
package org.onap.cli.main;
-import org.onap.cli.fw.OnapCommand;
-import org.onap.cli.fw.OnapCommandSchema;
+import org.onap.cli.fw.cmd.OnapCommand;
import org.onap.cli.fw.error.OnapCommandException;
+import org.onap.cli.fw.schema.OnapCommandSchema;
/**
* This command helps to test the Command functionalities.
diff --git a/main/src/test/java/org/onap/cli/main/utils/OnapCliUtilsTest.java b/main/src/test/java/org/onap/cli/main/utils/OnapCliUtilsTest.java
index ad1a7ccc..eb2ca294 100644
--- a/main/src/test/java/org/onap/cli/main/utils/OnapCliUtilsTest.java
+++ b/main/src/test/java/org/onap/cli/main/utils/OnapCliUtilsTest.java
@@ -16,19 +16,21 @@
package org.onap.cli.main.utils;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
import org.junit.Assert;
import org.junit.Test;
import org.onap.cli.fw.error.OnapCommandException;
import org.onap.cli.fw.input.OnapCommandParameter;
-import org.onap.cli.fw.input.ParameterType;
+import org.onap.cli.fw.input.OnapCommandParameterType;
import org.onap.cli.main.error.OnapCliArgumentValueMissing;
import org.onap.cli.main.error.OnapCliInvalidArgument;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
public class OnapCliUtilsTest {
@Test
@@ -36,25 +38,25 @@ public class OnapCliUtilsTest {
OnapCommandParameter param1 = new OnapCommandParameter();
param1.setLongOption("host-username");
param1.setName("host-username");
- param1.setParameterType(ParameterType.STRING);
+ param1.setParameterType(OnapCommandParameterType.STRING);
OnapCommandParameter param2 = new OnapCommandParameter();
param2.setLongOption("host-password");
param2.setName("host-password");
- param2.setParameterType(ParameterType.STRING);
+ param2.setParameterType(OnapCommandParameterType.STRING);
OnapCommandParameter param3 = new OnapCommandParameter();
param3.setLongOption("host-url");
param3.setName("host-url");
- param3.setParameterType(ParameterType.STRING);
+ param3.setParameterType(OnapCommandParameterType.STRING);
OnapCommandParameter param4 = new OnapCommandParameter();
param4.setLongOption("string-param");
param4.setName("string-param");
- param4.setParameterType(ParameterType.STRING);
+ param4.setParameterType(OnapCommandParameterType.STRING);
OnapCommandParameter param5 = new OnapCommandParameter();
param5.setLongOption("long-opt");
param5.setName("long-opt");
- param5.setParameterType(ParameterType.STRING);
+ param5.setParameterType(OnapCommandParameterType.STRING);
- List<OnapCommandParameter> paramslist = new ArrayList<>();
+ Set<OnapCommandParameter> paramslist = new HashSet<>();
paramslist.add(param1);
paramslist.add(param2);
paramslist.add(param3);
@@ -78,13 +80,13 @@ public class OnapCliUtilsTest {
public void testpositionalargs() throws OnapCommandException {
OnapCommandParameter paramargs = new OnapCommandParameter();
paramargs.setName("http://localhost:8082/file.txt");
- List<OnapCommandParameter> paramslist = new ArrayList<>();
+ Set<OnapCommandParameter> paramslist = new HashSet<>();
paramslist.add(paramargs);
String[] args = new String[] { "positional-args", "http://localhost:8082/file.txt" };
- paramargs.setParameterType(ParameterType.STRING);
+ paramargs.setParameterType(OnapCommandParameterType.STRING);
OnapCliArgsParser.populateParams(paramslist, Arrays.asList(args));
List<String> expectedList = Arrays.asList(args);
- Assert.assertEquals("positional-args", expectedList.get(1), paramslist.get(0).getValue());
+ Assert.assertEquals("positional-args", expectedList.get(1), paramslist.iterator().next().getValue());
}
@Test
@@ -92,14 +94,14 @@ public class OnapCliUtilsTest {
OnapCommandParameter boolparam = new OnapCommandParameter();
boolparam.setLongOption("bool");
boolparam.setName("bool-param");
- List<OnapCommandParameter> paramslist = new ArrayList<>();
+ Set<OnapCommandParameter> paramslist = new HashSet<>();
paramslist.add(boolparam);
String[] args = new String[] { "sample-create", "--bool" };
- boolparam.setParameterType(ParameterType.BOOL);
+ boolparam.setParameterType(OnapCommandParameterType.BOOL);
OnapCliArgsParser.populateParams(paramslist, Arrays.asList(args));
List<String> expectedList = Arrays.asList(args);
- Assert.assertNotNull(expectedList.get(1), paramslist.get(0).getValue());
+ Assert.assertNotNull(expectedList.get(1), paramslist.iterator().next().getValue());
}
@@ -108,14 +110,14 @@ public class OnapCliUtilsTest {
OnapCommandParameter boolparam = new OnapCommandParameter();
boolparam.setShortOption("b");
boolparam.setName("bool-param");
- List<OnapCommandParameter> paramslist = new ArrayList<>();
+ Set<OnapCommandParameter> paramslist = new HashSet<>();
paramslist.add(boolparam);
String[] args = new String[] { "sample-create", "-b", };
- boolparam.setParameterType(ParameterType.BOOL);
+ boolparam.setParameterType(OnapCommandParameterType.BOOL);
OnapCliArgsParser.populateParams(paramslist, Arrays.asList(args));
List<String> expectedList = Arrays.asList(args);
- Assert.assertNotNull(expectedList.get(1), paramslist.get(0).getValue());
+ Assert.assertNotNull(expectedList.get(1), paramslist.iterator().next().getValue());
}
@Test
@@ -123,14 +125,14 @@ public class OnapCliUtilsTest {
OnapCommandParameter boolparam = new OnapCommandParameter();
boolparam.setLongOption("text-param");
boolparam.setName("text-param");
- List<OnapCommandParameter> paramslist = new ArrayList<>();
+ Set<OnapCommandParameter> paramslist = new HashSet<>();
paramslist.add(boolparam);
String[] args = new String[] { "sample-create", "--text-param" , "text"};
- boolparam.setParameterType(ParameterType.TEXT);
+ boolparam.setParameterType(OnapCommandParameterType.TEXT);
OnapCliArgsParser.populateParams(paramslist, Arrays.asList(args));
List<String> expectedList = Arrays.asList(args);
- Assert.assertNotNull(expectedList.get(1), paramslist.get(0).getValue());
+ Assert.assertNotNull(expectedList.get(1), paramslist.iterator().next().getValue());
}
@@ -139,14 +141,14 @@ public class OnapCliUtilsTest {
OnapCommandParameter boolparam = new OnapCommandParameter();
boolparam.setShortOption("e");
boolparam.setName("text-param");
- List<OnapCommandParameter> paramslist = new ArrayList<>();
+ Set<OnapCommandParameter> paramslist = new HashSet<>();
paramslist.add(boolparam);
String[] args = new String[] { "sample-create", "-e" , "text"};
- boolparam.setParameterType(ParameterType.TEXT);
+ boolparam.setParameterType(OnapCommandParameterType.TEXT);
OnapCliArgsParser.populateParams(paramslist, Arrays.asList(args));
List<String> expectedList = Arrays.asList(args);
- Assert.assertNotNull(expectedList.get(1), paramslist.get(0).getValue());
+ Assert.assertNotNull(expectedList.get(1), paramslist.iterator().next().getValue());
}
@Test
@@ -154,14 +156,14 @@ public class OnapCliUtilsTest {
OnapCommandParameter jsonparam = new OnapCommandParameter();
jsonparam.setShortOption("j");
jsonparam.setName("json-param");
- List<OnapCommandParameter> paramslist = new ArrayList<>();
+ Set<OnapCommandParameter> paramslist = new HashSet<>();
paramslist.add(jsonparam);
File resourcesDirectory = new File("src/test/resources/sampletest.json");
String[] args = new String[] { "sample-create", "-j", "file:" + resourcesDirectory };
- jsonparam.setParameterType(ParameterType.JSON);
+ jsonparam.setParameterType(OnapCommandParameterType.JSON);
OnapCliArgsParser.populateParams(paramslist, Arrays.asList(args));
List<String> expectedList = Arrays.asList(args);
- Assert.assertNotNull(expectedList.get(1), paramslist.get(0).getValue());
+ Assert.assertNotNull(expectedList.get(1), paramslist.iterator().next().getValue());
}
@Test
@@ -169,14 +171,14 @@ public class OnapCliUtilsTest {
OnapCommandParameter jsonparam = new OnapCommandParameter();
jsonparam.setLongOption("json-param");
jsonparam.setName("json-param");
- List<OnapCommandParameter> paramslist = new ArrayList<>();
+ Set<OnapCommandParameter> paramslist = new HashSet<>();
paramslist.add(jsonparam);
File resourcesDirectory = new File("src/test/resources/sampletest.json");
String[] args = new String[] { "sample-create", "--json-param", "file:" + resourcesDirectory };
- jsonparam.setParameterType(ParameterType.JSON);
+ jsonparam.setParameterType(OnapCommandParameterType.JSON);
OnapCliArgsParser.populateParams(paramslist, Arrays.asList(args));
List<String> expectedList = Arrays.asList(args);
- Assert.assertNotNull(expectedList.get(1), paramslist.get(0).getValue());
+ Assert.assertNotNull(expectedList.get(1), paramslist.iterator().next().getValue());
}
@Test
@@ -185,25 +187,25 @@ public class OnapCliUtilsTest {
OnapCommandParameter param1 = new OnapCommandParameter();
param1.setShortOption("u");
param1.setName("host-username");
- param1.setParameterType(ParameterType.STRING);
+ param1.setParameterType(OnapCommandParameterType.STRING);
OnapCommandParameter param2 = new OnapCommandParameter();
param2.setShortOption("p");
param2.setName("host-password");
- param2.setParameterType(ParameterType.STRING);
+ param2.setParameterType(OnapCommandParameterType.STRING);
OnapCommandParameter param3 = new OnapCommandParameter();
param3.setShortOption("r");
param3.setName("host-url");
- param3.setParameterType(ParameterType.STRING);
+ param3.setParameterType(OnapCommandParameterType.STRING);
OnapCommandParameter param4 = new OnapCommandParameter();
param4.setShortOption("c");
param4.setName("string-param");
- param4.setParameterType(ParameterType.STRING);
+ param4.setParameterType(OnapCommandParameterType.STRING);
OnapCommandParameter param5 = new OnapCommandParameter();
param5.setShortOption("l");
param5.setName("long-opt");
- param5.setParameterType(ParameterType.STRING);
+ param5.setParameterType(OnapCommandParameterType.STRING);
- List<OnapCommandParameter> paramslist = new ArrayList<>();
+ Set<OnapCommandParameter> paramslist = new HashSet<>();
paramslist.add(param1);
paramslist.add(param2);
paramslist.add(param3);
@@ -230,14 +232,14 @@ public class OnapCliUtilsTest {
arrayval.setName("node-ip");
String[] args = new String[] { "sample-create", "--node-ip", "{}" };
- List<OnapCommandParameter> paramslist = new ArrayList<>();
+ Set<OnapCommandParameter> paramslist = new HashSet<>();
paramslist.add(arrayval);
- arrayval.setParameterType(ParameterType.ARRAY);
+ arrayval.setParameterType(OnapCommandParameterType.ARRAY);
OnapCliArgsParser.populateParams(paramslist, Arrays.asList(args));
List<String> expectedList = Arrays.asList(args);
- Assert.assertNotNull(expectedList.get(1), paramslist.get(0).getValue());
+ Assert.assertNotNull(expectedList.get(1), paramslist.iterator().next().getValue());
}
@Test
@@ -245,15 +247,15 @@ public class OnapCliUtilsTest {
OnapCommandParameter param1 = new OnapCommandParameter();
param1.setLongOption("map");
param1.setName("MAP");
- param1.setParameterType(ParameterType.MAP);
- List<OnapCommandParameter> paramslist = new ArrayList<>();
+ param1.setParameterType(OnapCommandParameterType.MAP);
+ Set<OnapCommandParameter> paramslist = new HashSet<>();
paramslist.add(param1);
- param1.setParameterType(ParameterType.MAP);
+ param1.setParameterType(OnapCommandParameterType.MAP);
OnapCliArgsParser.populateParams(paramslist,
Arrays.asList("show", "--map", "param1=value1", "--map", "param2=value2"));
- Assert.assertEquals("{\"param1\":\"value1\",\"param2\":\"value2\"}", paramslist.get(0).getValue().toString());
+ Assert.assertEquals("{\"param1\":\"value1\",\"param2\":\"value2\"}", paramslist.iterator().next().getValue().toString());
}
@Test(expected = OnapCliInvalidArgument.class)
@@ -261,13 +263,13 @@ public class OnapCliUtilsTest {
OnapCommandParameter param1 = new OnapCommandParameter();
param1.setLongOption("map");
param1.setName("MAP");
- param1.setParameterType(ParameterType.MAP);
- List<OnapCommandParameter> paramslist = new ArrayList<>();
+ param1.setParameterType(OnapCommandParameterType.MAP);
+ Set<OnapCommandParameter> paramslist = new HashSet<>();
paramslist.add(param1);
- param1.setParameterType(ParameterType.MAP);
+ param1.setParameterType(OnapCommandParameterType.MAP);
OnapCliArgsParser.populateParams(paramslist, Arrays.asList("show", "--map", "param1=value1", "--map", "param2"));
- Assert.assertEquals("{\"param1\":\"value1\",\"param2\"}", paramslist.get(0).getValue().toString());
+ Assert.assertEquals("{\"param1\":\"value1\",\"param2\"}", paramslist.iterator().next().getValue().toString());
}
@Test(expected = OnapCliInvalidArgument.class)
@@ -275,26 +277,26 @@ public class OnapCliUtilsTest {
OnapCommandParameter param1 = new OnapCommandParameter();
param1.setShortOption("o");
param1.setName("node-port");
- param1.setParameterType(ParameterType.MAP);
- List<OnapCommandParameter> paramslist = new ArrayList<>();
+ param1.setParameterType(OnapCommandParameterType.MAP);
+ Set<OnapCommandParameter> paramslist = new HashSet<>();
paramslist.add(param1);
- param1.setParameterType(ParameterType.MAP);
+ param1.setParameterType(OnapCommandParameterType.MAP);
OnapCliArgsParser.populateParams(paramslist, Arrays.asList("show", "-o", "param1=value1", "-o", "param2"));
- Assert.assertEquals("{\"param1\":\"value1\",\"param2\"}", paramslist.get(0).getValue().toString());
+ Assert.assertEquals("{\"param1\":\"value1\",\"param2\"}", paramslist.iterator().next().getValue().toString());
}
@Test(expected = OnapCliInvalidArgument.class)
public void testpositionalargsfails() throws OnapCommandException {
OnapCommandParameter paramargs = new OnapCommandParameter();
paramargs.setName("http://localhost:8082/file.txt");
- List<OnapCommandParameter> paramslist = new ArrayList<>();
+ Set<OnapCommandParameter> paramslist = new HashSet<>();
paramslist.add(paramargs);
String[] args = new String[] { "positional-args", "http://localhost:8082/file.txt",
"http://localhost:8082/file.txt" };
- paramargs.setParameterType(ParameterType.STRING);
+ paramargs.setParameterType(OnapCommandParameterType.STRING);
OnapCliArgsParser.populateParams(paramslist, Arrays.asList(args));
List<String> expectedList = Arrays.asList(args);
- Assert.assertEquals("positional-args", expectedList.get(1), paramslist.get(0).getValue());
+ Assert.assertEquals("positional-args", expectedList.get(1), paramslist.iterator().next().getValue());
}
@Test(expected = OnapCliInvalidArgument.class)
@@ -302,14 +304,14 @@ public class OnapCliUtilsTest {
OnapCommandParameter boolparam = new OnapCommandParameter();
boolparam.setShortOption("b");
boolparam.setName("bool-param");
- List<OnapCommandParameter> paramslist = new ArrayList<>();
+ Set<OnapCommandParameter> paramslist = new HashSet<>();
paramslist.add(boolparam);
String[] args = new String[] { "sample-create", "-b", "-b", "-h" };
- boolparam.setParameterType(ParameterType.BOOL);
+ boolparam.setParameterType(OnapCommandParameterType.BOOL);
OnapCliArgsParser.populateParams(paramslist, Arrays.asList(args));
List<String> expectedList = Arrays.asList(args);
- Assert.assertEquals("true", paramslist.get(0).getValue());
+ Assert.assertEquals("true", paramslist.iterator().next().getValue());
}
@Test(expected = OnapCliInvalidArgument.class)
@@ -317,14 +319,14 @@ public class OnapCliUtilsTest {
OnapCommandParameter boolparam = new OnapCommandParameter();
boolparam.setShortOption("bool");
boolparam.setName("bool-param");
- List<OnapCommandParameter> paramslist = new ArrayList<>();
+ Set<OnapCommandParameter> paramslist = new HashSet<>();
paramslist.add(boolparam);
String[] args = new String[] { "sample-create", "--bool", "--bool", "--help" };
- boolparam.setParameterType(ParameterType.BOOL);
+ boolparam.setParameterType(OnapCommandParameterType.BOOL);
OnapCliArgsParser.populateParams(paramslist, Arrays.asList(args));
List<String> expectedList = Arrays.asList(args);
- Assert.assertEquals("true", paramslist.get(0).getValue());
+ Assert.assertEquals("true", paramslist.iterator().next().getValue());
}
@Test(expected = OnapCliArgumentValueMissing.class)
@@ -332,14 +334,14 @@ public class OnapCliUtilsTest {
OnapCommandParameter jsonparam = new OnapCommandParameter();
jsonparam.setLongOption("json-param");
jsonparam.setName("json-param");
- List<OnapCommandParameter> paramslist = new ArrayList<>();
+ Set<OnapCommandParameter> paramslist = new HashSet<>();
paramslist.add(jsonparam);
File resourcesDirectory = new File("src/test/resources/sampletest.json");
String[] args = new String[] { "sample-create", "--json-param", "file:" + resourcesDirectory, "--json-param" };
- jsonparam.setParameterType(ParameterType.JSON);
+ jsonparam.setParameterType(OnapCommandParameterType.JSON);
OnapCliArgsParser.populateParams(paramslist, Arrays.asList(args));
List<String> expectedList = Arrays.asList(args);
- Assert.assertEquals("--json-param", paramslist.get(0).getValue());
+ Assert.assertEquals("--json-param", paramslist.iterator().next().getValue());
}
@@ -348,14 +350,14 @@ public class OnapCliUtilsTest {
OnapCommandParameter jsonparam = new OnapCommandParameter();
jsonparam.setShortOption("j");
jsonparam.setName("json-param");
- List<OnapCommandParameter> paramslist = new ArrayList<>();
+ Set<OnapCommandParameter> paramslist = new HashSet<>();
paramslist.add(jsonparam);
File resourcesDirectory = new File("src/test/resources/sampletest.json");
String[] args = new String[] { "sample-create", "-j", "file:" + resourcesDirectory, "-j" };
- jsonparam.setParameterType(ParameterType.JSON);
+ jsonparam.setParameterType(OnapCommandParameterType.JSON);
OnapCliArgsParser.populateParams(paramslist, Arrays.asList(args));
List<String> expectedList = Arrays.asList(args);
- Assert.assertEquals("--json-param", paramslist.get(0).getValue());
+ Assert.assertEquals("--json-param", paramslist.iterator().next().getValue());
}
} \ No newline at end of file
diff --git a/main/src/test/resources/META-INF/services/org.onap.cli.fw.OnapCommand b/main/src/test/resources/META-INF/services/org.onap.cli.fw.cmd.OnapCommand
index 16dd879a..16dd879a 100644
--- a/main/src/test/resources/META-INF/services/org.onap.cli.fw.OnapCommand
+++ b/main/src/test/resources/META-INF/services/org.onap.cli.fw.cmd.OnapCommand
diff --git a/main/src/test/resources/open-cli-schema/sample-create-schema.yaml b/main/src/test/resources/open-cli-schema/sample-create-schema.yaml
deleted file mode 100644
index 05f93cda..00000000
--- a/main/src/test/resources/open-cli-schema/sample-create-schema.yaml
+++ /dev/null
@@ -1,73 +0,0 @@
-open_cli_schema_version: 1.0
-name: sample-create
-description: Sample create into Onap
-info:
- product: open-cli
- service: test
- type: cmd
- author: Kanagaraj Manickam kanagaraj.manickam@huawei.com
-
-parameters:
- - name: service-name
- description: Oclip service name
- type: string
- short_option: x
- long_option: service-name
- is_optional: false
- - name: node-ip
- description: Oclip service running node IP
- type: array
- short_option: i
- long_option: node-ip
- - name: node-port
- description: Oclip service running node port
- type: map
- short_option: o
- long_option: node-port
-results:
- direction: portrait
- attributes:
- - name: name
- description: Oclip service name
- scope: short
- type: string
- - name: version
- description: Oclip service version
- scope: short
- type: string
- - name: url
- description: Oclip service base url
- scope: short
- type: url
- - name: status
- description: Oclip service status
- scope: short
- type: digit
- - name: nodes
- description: Oclip service running nodes
- scope: long
- type: string
- - name: location
- description: Oclip service location
- scope: long
- type: url
-http:
- request:
- uri: /services
- method: POST
- body: '{"serviceName":"${service-name}","nodeIp":"${node-ip}","nodePort":"${node-port}"}'
- headers:
- queries:
- success_codes:
- - 201
- - 200
- result_map:
- name: $b{$.serviceName}
- version: $b{$.version}
- url: $b{$.url}
- status: $b{$.status}
- nodes: $b{$.nodes[*].ip}:$b{$.nodes[*].port}
- location: $h{Location}
-
- sample_response:
- body: {"serviceName":"test","version":"v1","url":"/api/test/v1","protocol":"REST","visualRange":"1","lb_policy":"hash","nodes":[{"ip":"127.0.0.1","port":"8012","ttl":0,"nodeId":"test_127.0.0.1_8012","expiration":"2017-02-10T05:33:25Z","created_at":"2017-02-10T05:33:25Z","updated_at":"2017-02-10T05:33:25Z"}],"status":"1"} \ No newline at end of file
diff --git a/main/src/test/resources/sample-test-schema.yaml b/main/src/test/resources/open-cli-schema/sample-test-schema.yaml
index 584eec87..584eec87 100644
--- a/main/src/test/resources/sample-test-schema.yaml
+++ b/main/src/test/resources/open-cli-schema/sample-test-schema.yaml