summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAnas Nashif <nashif@intel.com>2007-08-03 12:40:05 +0000
committerAnas Nashif <nashif@intel.com>2007-08-03 12:40:05 +0000
commitdc09b03a2a705364b054fcaf7c65afd7f6583a81 (patch)
treec0af8dc4f35ca83d100f17dde6dbd4be98b584fb /tests
parent0288eff339ef36e57c0bd86d274f7f8b02664d87 (diff)
downloadwsmancli-dc09b03a2a705364b054fcaf7c65afd7f6583a81.tar.gz
wsmancli-dc09b03a2a705364b054fcaf7c65afd7f6583a81.tar.xz
wsmancli-dc09b03a2a705364b054fcaf7c65afd7f6583a81.zip
treat warnings as errors and fixed them
Diffstat (limited to 'tests')
-rw-r--r--tests/cunit/enumeration.c41
-rw-r--r--tests/cunit/identify.c23
-rwxr-xr-xtests/cunit/invoke.c14
-rw-r--r--tests/cunit/pull.c100
-rw-r--r--tests/cunit/transfer_get.c8
-rwxr-xr-xtests/cunit/transfer_put.c12
-rw-r--r--tests/interop/interop.c470
7 files changed, 322 insertions, 346 deletions
diff --git a/tests/cunit/enumeration.c b/tests/cunit/enumeration.c
index bb9f6c4..a062af5 100644
--- a/tests/cunit/enumeration.c
+++ b/tests/cunit/enumeration.c
@@ -50,7 +50,6 @@
-static int _debug = 0;
static char *filters1[] = {
@@ -76,17 +75,6 @@ static char *filters3[] = {
NULL, NULL,
};
-static char *filters4[] = {
- NULL, // "/s:Envelope/s:Body/wsen:EnumerateResponse/wsman:Items[1]/p:OMC_InitdService[1]/p:SystemName",
- "%s",
- NULL, NULL,
-};
-
-static char *filters5[] = {
- "/s:Envelope/s:Body/s:EnumerateResponse/wsman:EndOfSequence",
- "",
- NULL, NULL,
-};
static char *filters[] = {
"/s:Envelope/s:Body/s:EnumerateResponse/s:EnumerationContext",
NULL,
@@ -96,8 +84,8 @@ static char *filters[] = {
static TestData tests[] = {
{
- "Enumeration with non existent Resource URI.",
- "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystemxx",
+ "Enumeration with non existent Resource URI.",
+ "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystemxx",
NULL,
NULL,
NULL,
@@ -127,12 +115,12 @@ static TestData tests[] = {
{
"Enumeration (Count Estimation).",
"http://schema.omc-project.org/wbem/wscim/1/cim-schema/2/OMC_InitdService",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
NULL,
200,
FLAG_ENUMERATION_COUNT_ESTIMATION,
@@ -140,7 +128,7 @@ static TestData tests[] = {
filters3,
},
{
- "Enumeration (Optimized)",
+ "Enumeration (Optimized)",
"http://schema.omc-project.org/wbem/wscim/1/cim-schema/2/OMC_InitdService",
NULL,
NULL,
@@ -154,7 +142,7 @@ static TestData tests[] = {
200,
},
{
- "Enumeration (EPR)",
+ "Enumeration (EPR)",
"http://schema.omc-project.org/wbem/wscim/1/cim-schema/2/OMC_InitdService",
NULL,
NULL,
@@ -168,7 +156,7 @@ static TestData tests[] = {
200,
},
{
- "Enumeration (ObjEPR)",
+ "Enumeration (ObjEPR)",
"http://schema.omc-project.org/wbem/wscim/1/cim-schema/2/OMC_InitdService",
NULL,
NULL,
@@ -182,7 +170,7 @@ static TestData tests[] = {
200,
},
{
- "Enumeration (Optimized/EPR/Count Estimation)",
+ "Enumeration (Optimized/EPR/Count Estimation)",
"http://schema.omc-project.org/wbem/wscim/1/cim-schema/2/OMC_InitdService",
NULL,
NULL,
@@ -257,10 +245,9 @@ client_opt_t *options;
-static void enumeration_test() {
+static void enumeration_test(void) {
char *enumContext = NULL;
static int i = 0;
- int num;
char *selectors = NULL;
@@ -282,7 +269,7 @@ static void enumeration_test() {
CU_ASSERT_TRUE(wsmc_get_response_code(cl) == tests[i].final_status);
if (wsmc_get_response_code(cl) != tests[i].final_status) {
if (verbose) {
- printf("\nExpected = %ld\nReturned = %ld ",
+ printf("\nExpected = %d\nReturned = %ld ",
tests[i].final_status, wsmc_get_response_code(cl));
}
goto RETURN;
diff --git a/tests/cunit/identify.c b/tests/cunit/identify.c
index ac53ad9..213cede 100644
--- a/tests/cunit/identify.c
+++ b/tests/cunit/identify.c
@@ -53,11 +53,11 @@
static TestData tests[] = {
{
- "Testing Identify Request, check protocol version",
- NULL,
- NULL,
- NULL,
- NULL,
+ "Testing Identify Request, check protocol version",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
"/s:Envelope/s:Body/wsmid:IdentifyResponse/wsmid:ProtocolVersion",
XML_NS_WS_MAN,
"/s:Envelope/s:Body/wsmid:IdentifyResponse/wsmid:ProductVersion",
@@ -67,11 +67,11 @@ static TestData tests[] = {
0
},
{
- "Testing Identify Request, check product vendor",
- NULL,
- NULL,
- NULL,
- NULL,
+ "Testing Identify Request, check product vendor",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
"/s:Envelope/s:Body/wsmid:IdentifyResponse/wsmid:ProductVendor",
"Openwsman Project",
NULL,
@@ -91,8 +91,7 @@ client_opt_t *options;
-static void
-identify_test() {
+static void identify_test(void) {
WsXmlDocH response;
static int i = 0;
diff --git a/tests/cunit/invoke.c b/tests/cunit/invoke.c
index e7e8cde..6660ae8 100755
--- a/tests/cunit/invoke.c
+++ b/tests/cunit/invoke.c
@@ -53,10 +53,10 @@ TestData invoke_tests[] = {
NULL,
NULL,
"/s:Envelope/s:Body/s:Fault/s:Code/s:Subcode/s:Value",
- "wsman:InvalidSelectors",
+ "wsman:InvalidSelectors",
"/s:Envelope/s:Body/s:Fault/s:Detail/wsman:FaultDetail",
"http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/InsufficientSelectors",
- 400,
+ 400,
0,
0
},
@@ -65,13 +65,13 @@ TestData invoke_tests[] = {
"Custom Method with non existent Resource URI.",
"http://schema.omc-project.org/wbem/wscim/1/cim-schema/2/OMC_InitdServicex",
"ServiceStatus",
- NULL,
+ NULL,
NULL,
"/s:Envelope/s:Body/s:Fault/s:Code/s:Subcode/s:Value",
- "wsa:DestinationUnreachable",
+ "wsa:DestinationUnreachable",
"/s:Envelope/s:Body/s:Fault/s:Detail/wsman:FaultDetail",
"http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/InvalidResourceURI",
- 400,
+ 400,
0,
0
},
@@ -183,7 +183,7 @@ static int ntests = sizeof (invoke_tests) / sizeof (invoke_tests[0]);
extern WsManClient *cl;
client_opt_t *options;
-static void invoke_test() {
+static void invoke_test(void) {
WsXmlDocH doc;
char *xpf = NULL;
char *xpd = NULL;
@@ -216,7 +216,7 @@ static void invoke_test() {
if (wsmc_get_response_code(cl) !=
invoke_tests[i].final_status) {
if (verbose) {
- printf("\nExpected = %ld\nReturned = %ld ",
+ printf("\nExpected = %d\nReturned = %ld ",
invoke_tests[i].final_status,
wsmc_get_response_code(cl));
}
diff --git a/tests/cunit/pull.c b/tests/cunit/pull.c
index aaa95d3..1e5956b 100644
--- a/tests/cunit/pull.c
+++ b/tests/cunit/pull.c
@@ -48,22 +48,14 @@
#include "common.h"
-static char *filters2[] = {
- "/s:Envelope/s:Body/wsen:PullResponse/wsman:Items/wsa:EndpointReference/wsa:Address",
- NULL,
- NULL, NULL,
-};
-
-
-
static TestData pull_tests[] = {
{
- "Pull. Enumeration with non existent Resource URI.",
- "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystemxx",
- NULL,
- NULL,
- NULL,
+ "Pull. Enumeration with non existent Resource URI.",
+ "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystemxx",
+ NULL,
+ NULL,
+ NULL,
"/s:Envelope/s:Body/s:Fault/s:Code/s:Subcode/s:Value",
"wsa:DestinationUnreachable",
"/s:Envelope/s:Body/s:Fault/s:Detail/wsman:FaultDetail",
@@ -73,58 +65,58 @@ static TestData pull_tests[] = {
0
},
{
- "Pull. Enumeration (Optimized)",
- "http://schema.omc-project.org/wbem/wscim/1/cim-schema/2/OMC_InitdService",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ "Pull. Enumeration (Optimized)",
+ "http://schema.omc-project.org/wbem/wscim/1/cim-schema/2/OMC_InitdService",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
200,
FLAG_ENUMERATION_OPTIMIZATION,
0
},
{
- "Pull. Enumeration (Optimized/EPR/Count)",
- "http://schema.omc-project.org/wbem/wscim/1/cim-schema/2/OMC_InitdService",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ "Pull. Enumeration (Optimized/EPR/Count)",
+ "http://schema.omc-project.org/wbem/wscim/1/cim-schema/2/OMC_InitdService",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
200,
FLAG_ENUMERATION_OPTIMIZATION | FLAG_ENUMERATION_ENUM_EPR |
FLAG_ENUMERATION_COUNT_ESTIMATION ,
10
},
{
- "Pull. Enumeration (Optimized/EPR)",
- "http://schema.omc-project.org/wbem/wscim/1/cim-schema/2/OMC_InitdService",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ "Pull. Enumeration (Optimized/EPR)",
+ "http://schema.omc-project.org/wbem/wscim/1/cim-schema/2/OMC_InitdService",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
200,
FLAG_ENUMERATION_OPTIMIZATION | FLAG_ENUMERATION_ENUM_EPR,
10
},
{
- "Pull. Enumeration (Optimized/ObjEPR)",
- "http://schema.omc-project.org/wbem/wscim/1/cim-schema/2/OMC_InitdService",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ "Pull. Enumeration (Optimized/ObjEPR)",
+ "http://schema.omc-project.org/wbem/wscim/1/cim-schema/2/OMC_InitdService",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
200,
FLAG_ENUMERATION_OPTIMIZATION | FLAG_ENUMERATION_ENUM_OBJ_AND_EPR,
10
@@ -132,9 +124,9 @@ static TestData pull_tests[] = {
{
"Pull. Enumeration with valid Resource URI and Items Count Estimation.",
"http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem",
- NULL,
- NULL,
- NULL,
+ NULL,
+ NULL,
+ NULL,
"/s:Envelope/s:Header/wsman:TotalItemsCountEstimate",
NULL,
NULL,
@@ -153,7 +145,7 @@ extern WsManClient *cl;
client_opt_t *options;
-static void pull_test() {
+static void pull_test(void) {
char *enumContext = NULL;
static int i = 0;
char *xp = NULL;
@@ -174,7 +166,7 @@ static void pull_test() {
pull_tests[i].final_status);
if (wsmc_get_response_code(cl) != pull_tests[i].final_status) {
if (verbose) {
- printf("\nExpected = %ld\nReturned = %ld ",
+ printf("\nExpected = %d\nReturned = %ld ",
pull_tests[i].final_status,
wsmc_get_response_code(cl));
}
diff --git a/tests/cunit/transfer_get.c b/tests/cunit/transfer_get.c
index 1867e29..54d5516 100644
--- a/tests/cunit/transfer_get.c
+++ b/tests/cunit/transfer_get.c
@@ -66,13 +66,13 @@ TestData get_tests[] = {
"Transfer Get with non existent Resource URI.",
"http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystemxx",
NULL,
- NULL,
+ NULL,
NULL,
"/s:Envelope/s:Body/s:Fault/s:Code/s:Subcode/s:Value",
- "wsa:DestinationUnreachable",
+ "wsa:DestinationUnreachable",
"/s:Envelope/s:Body/s:Fault/s:Detail/wsman:FaultDetail",
"http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/InvalidResourceURI",
- 400,
+ 400,
0,
0
},
@@ -158,7 +158,7 @@ static int ntests = sizeof (get_tests) / sizeof (get_tests[0]);
extern WsManClient *cl;
client_opt_t *options;
-static void transfer_get_test() {
+static void transfer_get_test(void) {
WsXmlDocH doc;
char *xpf = NULL;
char *xpd = NULL;
diff --git a/tests/cunit/transfer_put.c b/tests/cunit/transfer_put.c
index 21b62c7..87f5263 100755
--- a/tests/cunit/transfer_put.c
+++ b/tests/cunit/transfer_put.c
@@ -56,7 +56,7 @@ TestData put_tests[] = {
"wsman:InvalidSelectors",
"/s:Envelope/s:Body/s:Fault/s:Detail/wsman:FaultDetail",
"http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/InsufficientSelectors",
- 400,
+ 400,
0,
0
},
@@ -65,13 +65,13 @@ TestData put_tests[] = {
"Transfer Put with non existent Resource URI.",
"http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystemxx",
NULL,
- NULL,
+ NULL,
NULL,
"/s:Envelope/s:Body/s:Fault/s:Code/s:Subcode/s:Value",
- "wsa:DestinationUnreachable",
+ "wsa:DestinationUnreachable",
"/s:Envelope/s:Body/s:Fault/s:Detail/wsman:FaultDetail",
"http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/InvalidResourceURI",
- 400,
+ 400,
0,
0
},
@@ -168,7 +168,7 @@ static int ntests = sizeof (put_tests) / sizeof (put_tests[0]);
extern WsManClient *cl;
client_opt_t *options;
-static void transfer_put_test() {
+static void transfer_put_test(void) {
WsXmlDocH doc;
char *xpf = NULL;
char *xpd = NULL;
@@ -200,7 +200,7 @@ static void transfer_put_test() {
if (wsmc_get_response_code(cl) !=
put_tests[i].final_status) {
if (verbose) {
- printf("\nExpected = %ld, Returned = %ld ",
+ printf("\nExpected = %d, Returned = %ld ",
put_tests[i].final_status,
wsmc_get_response_code(cl));
// ws_xml_dump_node_tree(stdout, ws_xml_get_doc_root(doc));
diff --git a/tests/interop/interop.c b/tests/interop/interop.c
index d75e928..d24668d 100644
--- a/tests/interop/interop.c
+++ b/tests/interop/interop.c
@@ -17,6 +17,7 @@
#include "wsman-client-api.h"
#include "wsman-client-transport.h"
#include "wsman-debug.h"
+#include "wsman-xml-api.h"
#define DESC "Description"
static char *file = NULL;
@@ -24,170 +25,167 @@ static char *endpoint = NULL;
static int debug_level = -1;
typedef enum {
- INTEROP_IDENTIFY = 0
+ INTEROP_IDENTIFY = 0
} InteropTest;
-static set_props(client_opt_t *op, char *k, char *v)
+static void set_props(client_opt_t *op, char *k, char *v)
{
- op->properties = hash_create(HASHCOUNT_T_MAX, 0, 0);
+ op->properties = hash_create(HASHCOUNT_T_MAX, 0, 0);
- if ( !hash_alloc_insert(op->properties, k, v)) {
- fprintf(stderr, "hash_alloc_insert failed");
- }
- //op->properties = h;
+ if ( !hash_alloc_insert(op->properties, k, v)) {
+ fprintf(stderr, "hash_alloc_insert failed");
+ }
+ //op->properties = h;
}
static void
wsman_add_selectors_list_from_node( WsXmlNodeH input, client_opt_t *options)
{
- hash_t *h = hash_create(HASHCOUNT_T_MAX, 0, 0);
-
- WsXmlNodeH node = ws_xml_get_child(input, 0, NULL, WSM_SELECTOR_SET);
- if ( node )
- {
- WsXmlNodeH selector;
- int index = 0;
- while( (selector = ws_xml_get_child(node, index++, NULL, WSM_SELECTOR)) )
- {
- char* attrVal = ws_xml_find_attr_value(selector, NULL, WSM_NAME);
- if ( attrVal == NULL )
- attrVal = ws_xml_find_attr_value(selector, NULL, WSM_NAME);
-
- if ( attrVal )
- {
- if (!hash_alloc_insert(h, attrVal, ws_xml_get_node_text(selector))) {
- error("hash_alloc_insert failed");
- }
- }
- }
- }
- if (!hash_isempty(h))
- options->selectors = h;
+ hash_t *h = hash_create(HASHCOUNT_T_MAX, 0, 0);
+
+ WsXmlNodeH node = ws_xml_get_child(input, 0, NULL, WSM_SELECTOR_SET);
+ if ( node )
+ {
+ WsXmlNodeH selector;
+ int index = 0;
+ while( (selector = ws_xml_get_child(node, index++, NULL, WSM_SELECTOR)) )
+ {
+ char* attrVal = ws_xml_find_attr_value(selector, NULL, WSM_NAME);
+ if ( attrVal == NULL )
+ attrVal = ws_xml_find_attr_value(selector, NULL, WSM_NAME);
+
+ if ( attrVal )
+ {
+ if (!hash_alloc_insert(h, attrVal, ws_xml_get_node_text(selector))) {
+ error("hash_alloc_insert failed");
+ }
+ }
+ }
+ }
+ if (!hash_isempty(h))
+ options->selectors = h;
}
static int pull_items(WsManClient *cl, WsXmlDocH doc, void *data)
{
-
- if (!doc) {
- return 0;
- }
-
- xml_parser_doc_dump(stdout, doc);
-
- return 1;
+ if (!doc) {
+ return 0;
+ }
+ ws_xml_dump_doc(stdout, doc);
+ return 1;
}
static int run_interop_test (WsManClient *cl, WsXmlNodeH scenario, InteropTest id)
{
- WsXmlDocH response;
- client_opt_t *options = wsmc_options_init();
- wsmc_set_action_option(options,FLAG_DUMP_REQUEST );
- if (id == 0) { // 6.1 Identify
- response = wsmc_action_identify(cl, options);
- xml_parser_doc_dump(stdout, response);
- }else if (id == 2) { // 6.2 Get
-
- WsXmlNodeH input = ws_xml_get_child(scenario, 0, NULL, "Input");
- WsXmlNodeH r = ws_xml_get_child(input, 0, NULL, "ResourceURI");
- wsman_add_selectors_list_from_node(input, options);
- char *resource_uri = ws_xml_get_node_text(r);
- response = wsmc_action_get(cl, resource_uri, options);
- xml_parser_doc_dump(stdout, response);
- }else if (id == 3) { // 6.3 Get failure - invalid resoure URI
-
- WsXmlNodeH input = ws_xml_get_child(scenario, 0, NULL, "Input");
- WsXmlNodeH r = ws_xml_get_child(input, 0, NULL, "ResourceURI");
- wsman_add_selectors_list_from_node(input, options);
- char *resource_uri = ws_xml_get_node_text(r);
- response = wsmc_action_get(cl, resource_uri, options);
- xml_parser_doc_dump(stdout, response);
- }else if (id == 4) { // 6.4 Get failure (MaxEnvelop exceeded)
-
- WsXmlNodeH input = ws_xml_get_child(scenario, 0, NULL, "Input");
- WsXmlNodeH r = ws_xml_get_child(input, 0, NULL, "ResourceURI");
- wsman_add_selectors_list_from_node(input, options);
- char *resource_uri = ws_xml_get_node_text(r);
- response = wsmc_action_get(cl, resource_uri, options);
- xml_parser_doc_dump(stdout, response);
- }else if (id == 5) { // 6.5 Get failure - invalid selectors
-
- WsXmlNodeH input = ws_xml_get_child(scenario, 0, NULL, "Input");
- WsXmlNodeH r = ws_xml_get_child(input, 0, NULL, "ResourceURI");
- wsman_add_selectors_list_from_node(input, options);
- char *resource_uri = ws_xml_get_node_text(r);
- response = wsmc_action_get(cl, resource_uri, options);
- xml_parser_doc_dump(stdout, response);
- }else if (id == 8) { // 7.1 Enumerate"
-
- WsXmlNodeH input = ws_xml_get_child(scenario, 0, NULL, "Input");
- WsXmlNodeH r = ws_xml_get_child(input, 0, NULL, "ResourceURI");
- char *resource_uri = ws_xml_get_node_text(r);
- wsenum_enumerate_and_pull(cl, resource_uri , options, pull_items, NULL );
- }else if (id == 9) { // 7.2 Optimized Enumerate
-
- wsmc_set_action_option(options, FLAG_ENUMERATION_OPTIMIZATION);
- WsXmlNodeH input = ws_xml_get_child(scenario, 0, NULL, "Input");
- WsXmlNodeH r = ws_xml_get_child(input, 0, NULL, "ResourceURI");
- char *resource_uri = ws_xml_get_node_text(r);
- wsenum_enumerate_and_pull(cl, resource_uri , options, pull_items, NULL );
- }else if (id == 10) { // 7.3 Enumerate failure
-
- /*
- WsXmlNodeH input = ws_xml_get_child(scenario, 0, NULL, "Input");
- WsXmlNodeH r = ws_xml_get_child(input, 0, NULL, "ResourceURI");
- char *resource_uri = ws_xml_get_node_text(r);
- WsXmlDocH e = wsenum_enumerate(cl, resource_uri , options );
- char *enumContext = wsenum_get_enum_context(e);
- if (enumContext) {
- response = wsenum_pull(cl, resource_uri, enumContext, options);
- xml_parser_doc_dump(stdout, response);
- WsXmlDocH response2 = wsenum_pull(cl, resource_uri, "xxxx", options);
- if (response2)
- xml_parser_doc_dump(stdout, response2);
- }
- */
-
- }else if (id == 11) { // 7.4 Enumerate ObjectAndEPR
-
- wsmc_set_action_option(options, FLAG_ENUMERATION_ENUM_EPR);
- WsXmlNodeH input = ws_xml_get_child(scenario, 0, NULL, "Input");
- WsXmlNodeH r = ws_xml_get_child(input, 0, NULL, "ResourceURI");
- char *resource_uri = ws_xml_get_node_text(r);
- wsenum_enumerate_and_pull(cl, resource_uri , options, pull_items, NULL );
- }else if (id == 16) { // 7.9 Enumerate Polymorphism
-
- wsmc_set_action_option(options, FLAG_POLYMORPHISM_NONE);
- WsXmlNodeH input = ws_xml_get_child(scenario, 0, NULL, "Input");
- WsXmlNodeH r = ws_xml_get_child(input, 0, NULL, "ResourceURI");
- char *resource_uri = ws_xml_get_node_text(r);
- wsenum_enumerate_and_pull(cl, resource_uri , options, pull_items, NULL );
- }else if (id == 17) { // 8.1 Invoke
-
- WsXmlNodeH input = ws_xml_get_child(scenario, 0, NULL, "Input");
- WsXmlNodeH r = ws_xml_get_child(input, 0, NULL, "ResourceURI");
- WsXmlNodeH m = ws_xml_get_child(input, 0, NULL, "MethodName");
- char *resource_uri = ws_xml_get_node_text(r);
- char *method = ws_xml_get_node_text(m);
- wsman_add_selectors_list_from_node(input, options);
- response = wsmc_action_invoke(cl, resource_uri, options, method, NULL);
- xml_parser_doc_dump(stdout, response);
- }else if (id == 18) { // 9.1 Put
-
- WsXmlNodeH input = ws_xml_get_child(scenario, 0, NULL, "Input");
- WsXmlNodeH r = ws_xml_get_child(input, 0, NULL, "ResourceURI");
- WsXmlNodeH k = ws_xml_get_child(input, 0, NULL, "PropertyName");
- WsXmlNodeH v = ws_xml_get_child(input, 0, NULL, "NewValue");
- printf("%s=%s\n", ws_xml_get_node_text(k), ws_xml_get_node_text(v) );
- char *resource_uri = ws_xml_get_node_text(r);
- wsman_add_selectors_list_from_node(input, options);
- set_props(options, ws_xml_get_node_text(k), ws_xml_get_node_text(v) );
-
- response = wsmc_action_get_and_put(cl, resource_uri, options);
- xml_parser_doc_dump(stdout, response);
- }
-
- return 0;
+ WsXmlDocH response;
+ client_opt_t *options = wsmc_options_init();
+ wsmc_set_action_option(options,FLAG_DUMP_REQUEST );
+ if (id == 0) { // 6.1 Identify
+ response = wsmc_action_identify(cl, options);
+ ws_xml_dump_doc(stdout, response);
+ }else if (id == 2) { // 6.2 Get
+
+ WsXmlNodeH input = ws_xml_get_child(scenario, 0, NULL, "Input");
+ WsXmlNodeH r = ws_xml_get_child(input, 0, NULL, "ResourceURI");
+ wsman_add_selectors_list_from_node(input, options);
+ char *resource_uri = ws_xml_get_node_text(r);
+ response = wsmc_action_get(cl, resource_uri, options);
+ ws_xml_dump_doc(stdout, response);
+ } else if (id == 3) { // 6.3 Get failure - invalid resoure URI
+
+ WsXmlNodeH input = ws_xml_get_child(scenario, 0, NULL, "Input");
+ WsXmlNodeH r = ws_xml_get_child(input, 0, NULL, "ResourceURI");
+ wsman_add_selectors_list_from_node(input, options);
+ char *resource_uri = ws_xml_get_node_text(r);
+ response = wsmc_action_get(cl, resource_uri, options);
+ ws_xml_dump_doc(stdout, response);
+ } else if (id == 4) { // 6.4 Get failure (MaxEnvelop exceeded)
+
+ WsXmlNodeH input = ws_xml_get_child(scenario, 0, NULL, "Input");
+ WsXmlNodeH r = ws_xml_get_child(input, 0, NULL, "ResourceURI");
+ wsman_add_selectors_list_from_node(input, options);
+ char *resource_uri = ws_xml_get_node_text(r);
+ response = wsmc_action_get(cl, resource_uri, options);
+ ws_xml_dump_doc(stdout, response);
+ } else if (id == 5) { // 6.5 Get failure - invalid selectors
+
+ WsXmlNodeH input = ws_xml_get_child(scenario, 0, NULL, "Input");
+ WsXmlNodeH r = ws_xml_get_child(input, 0, NULL, "ResourceURI");
+ wsman_add_selectors_list_from_node(input, options);
+ char *resource_uri = ws_xml_get_node_text(r);
+ response = wsmc_action_get(cl, resource_uri, options);
+ ws_xml_dump_doc(stdout, response);
+ } else if (id == 8) { // 7.1 Enumerate"
+
+ WsXmlNodeH input = ws_xml_get_child(scenario, 0, NULL, "Input");
+ WsXmlNodeH r = ws_xml_get_child(input, 0, NULL, "ResourceURI");
+ char *resource_uri = ws_xml_get_node_text(r);
+ wsmc_action_enumerate_and_pull(cl, resource_uri , options, pull_items, NULL );
+ } else if (id == 9) { // 7.2 Optimized Enumerate
+
+ wsmc_set_action_option(options, FLAG_ENUMERATION_OPTIMIZATION);
+ WsXmlNodeH input = ws_xml_get_child(scenario, 0, NULL, "Input");
+ WsXmlNodeH r = ws_xml_get_child(input, 0, NULL, "ResourceURI");
+ char *resource_uri = ws_xml_get_node_text(r);
+ wsmc_action_enumerate_and_pull(cl, resource_uri , options, pull_items, NULL );
+ } else if (id == 10) { // 7.3 Enumerate failure
+
+ /*
+ WsXmlNodeH input = ws_xml_get_child(scenario, 0, NULL, "Input");
+ WsXmlNodeH r = ws_xml_get_child(input, 0, NULL, "ResourceURI");
+ char *resource_uri = ws_xml_get_node_text(r);
+ WsXmlDocH e = wsenum_enumerate(cl, resource_uri , options );
+ char *enumContext = wsenum_get_enum_context(e);
+ if (enumContext) {
+ response = wsenum_pull(cl, resource_uri, enumContext, options);
+ xml_parser_doc_dump(stdout, response);
+ WsXmlDocH response2 = wsenum_pull(cl, resource_uri, "xxxx", options);
+ if (response2)
+ xml_parser_doc_dump(stdout, response2);
+ }
+ */
+
+ }else if (id == 11) { // 7.4 Enumerate ObjectAndEPR
+
+ wsmc_set_action_option(options, FLAG_ENUMERATION_ENUM_EPR);
+ WsXmlNodeH input = ws_xml_get_child(scenario, 0, NULL, "Input");
+ WsXmlNodeH r = ws_xml_get_child(input, 0, NULL, "ResourceURI");
+ char *resource_uri = ws_xml_get_node_text(r);
+ wsmc_action_enumerate_and_pull(cl, resource_uri , options, pull_items, NULL );
+ }else if (id == 16) { // 7.9 Enumerate Polymorphism
+
+ wsmc_set_action_option(options, FLAG_POLYMORPHISM_NONE);
+ WsXmlNodeH input = ws_xml_get_child(scenario, 0, NULL, "Input");
+ WsXmlNodeH r = ws_xml_get_child(input, 0, NULL, "ResourceURI");
+ char *resource_uri = ws_xml_get_node_text(r);
+ wsmc_action_enumerate_and_pull(cl, resource_uri , options, pull_items, NULL );
+ }else if (id == 17) { // 8.1 Invoke
+
+ WsXmlNodeH input = ws_xml_get_child(scenario, 0, NULL, "Input");
+ WsXmlNodeH r = ws_xml_get_child(input, 0, NULL, "ResourceURI");
+ WsXmlNodeH m = ws_xml_get_child(input, 0, NULL, "MethodName");
+ char *resource_uri = ws_xml_get_node_text(r);
+ char *method = ws_xml_get_node_text(m);
+ wsman_add_selectors_list_from_node(input, options);
+ response = wsmc_action_invoke(cl, resource_uri, options, method, NULL);
+ ws_xml_dump_doc(stdout, response);
+ }else if (id == 18) { // 9.1 Put
+
+ WsXmlNodeH input = ws_xml_get_child(scenario, 0, NULL, "Input");
+ WsXmlNodeH r = ws_xml_get_child(input, 0, NULL, "ResourceURI");
+ WsXmlNodeH k = ws_xml_get_child(input, 0, NULL, "PropertyName");
+ WsXmlNodeH v = ws_xml_get_child(input, 0, NULL, "NewValue");
+ printf("%s=%s\n", ws_xml_get_node_text(k), ws_xml_get_node_text(v) );
+ char *resource_uri = ws_xml_get_node_text(r);
+ wsman_add_selectors_list_from_node(input, options);
+ set_props(options, ws_xml_get_node_text(k), ws_xml_get_node_text(v) );
+
+ response = wsmc_action_get_and_put(cl, resource_uri, options);
+ ws_xml_dump_doc(stdout, response);
+ }
+
+ return 0;
}
@@ -196,95 +194,95 @@ static int run_interop_test (WsManClient *cl, WsXmlNodeH scenario, InteropTest i
int main(int argc, char** argv)
{
- WsManClient *cl;
-
- WsXmlDocH doc;
- client_opt_t *options;
- char retval = 0;
- u_error_t *error = NULL;
-
- u_option_entry_t opt[] = {
- { "interop-file", 'f', U_OPTION_ARG_STRING, &file,
- "Interop file", "<file>" },
- { "endpoint", 'u', U_OPTION_ARG_STRING, &endpoint,
- "Endpoint in form of a URL", "<uri>" },
- { "debug", 'd', U_OPTION_ARG_INT, &debug_level,
- "Set the verbosity of debugging output.", "1-6" },
- { NULL }
- };
-
- u_option_context_t *opt_ctx;
- opt_ctx = u_option_context_new("");
- u_option_context_set_ignore_unknown_options(opt_ctx, FALSE);
- u_option_context_add_main_entries(opt_ctx, opt, "interop");
- retval = u_option_context_parse(opt_ctx, &argc, &argv, &error);
-
- u_option_context_free(opt_ctx);
-
- if (error) {
- if (error->message)
- printf ("%s\n", error->message);
- u_error_free(error);
- return 1;
- }
- u_error_free(error);
-
-
- u_uri_t *uri;
- if (endpoint) {
- u_uri_parse((const char *)endpoint, &uri);
- }
- if (!endpoint || !uri) {
- fprintf(stderr, "endpoint option required\n");
- return 1;
- }
- wsman_debug_set_level(debug_level);
-
- cl = wsmc_create( uri->host,
- uri->port,
- uri->path,
- uri->scheme,
- uri->user,
- uri->pwd);
- wsmc_transport_init(cl, NULL);
- options = wsmc_options_init();
-
- if (file == NULL) {
- fprintf(stderr, "Interop file required\n");
- return 1;
- }
- doc = wsmc_read_file(cl, file, "UTF-8", 0);
- //xml_parser_doc_dump(stdout, doc);
-
-
- //WsXmlNodeH node = ws_xml_get_soap_element(doc, "WSManInteropScenarios");
-
- WsXmlNodeH node;
- if (doc != NULL)
- node = ws_xml_get_doc_root(doc);
-
- WsXmlNodeH scenario;
- int index = 0;
- int test_id = 0;
- while( (scenario = ws_xml_get_child(node, index++, NULL, "Scenario")) ) {
- WsXmlAttrH desc = ws_xml_get_node_attr(scenario, 0);
- char *attr_val = ws_xml_get_attr_value(desc);
- WsXmlAttrH supported = ws_xml_get_node_attr(scenario, 1);
- if (strcmp(ws_xml_get_attr_value(supported), "true") == 0 && test_id == 18 ) {
- if (desc) {
- if (attr_val)
- printf("%s (%d)\n\n", attr_val, test_id );
- }
- run_interop_test(cl, scenario, test_id);
- } else {
- if (desc) {
- if (attr_val)
- printf("%s: Not Supported (%d)\n\n", attr_val, test_id );
- }
- }
- test_id++;
- }
-
- return 0;
+ WsManClient *cl;
+
+ WsXmlDocH doc;
+ client_opt_t *options;
+ char retval = 0;
+ u_error_t *error = NULL;
+
+ u_option_entry_t opt[] = {
+ { "interop-file", 'f', U_OPTION_ARG_STRING, &file,
+ "Interop file", "<file>" },
+ { "endpoint", 'u', U_OPTION_ARG_STRING, &endpoint,
+ "Endpoint in form of a URL", "<uri>" },
+ { "debug", 'd', U_OPTION_ARG_INT, &debug_level,
+ "Set the verbosity of debugging output.", "1-6" },
+ { NULL }
+ };
+
+ u_option_context_t *opt_ctx;
+ opt_ctx = u_option_context_new("");
+ u_option_context_set_ignore_unknown_options(opt_ctx, FALSE);
+ u_option_context_add_main_entries(opt_ctx, opt, "interop");
+ retval = u_option_context_parse(opt_ctx, &argc, &argv, &error);
+
+ u_option_context_free(opt_ctx);
+
+ if (error) {
+ if (error->message)
+ printf ("%s\n", error->message);
+ u_error_free(error);
+ return 1;
+ }
+ u_error_free(error);
+
+
+ u_uri_t *uri;
+ if (endpoint) {
+ u_uri_parse((const char *)endpoint, &uri);
+ }
+ if (!endpoint || !uri) {
+ fprintf(stderr, "endpoint option required\n");
+ return 1;
+ }
+ wsman_debug_set_level(debug_level);
+
+ cl = wsmc_create( uri->host,
+ uri->port,
+ uri->path,
+ uri->scheme,
+ uri->user,
+ uri->pwd);
+ wsmc_transport_init(cl, NULL);
+ options = wsmc_options_init();
+
+ if (file == NULL) {
+ fprintf(stderr, "Interop file required\n");
+ return 1;
+ }
+ doc = wsmc_read_file(cl, file, "UTF-8", 0);
+ //xml_parser_doc_dump(stdout, doc);
+
+
+ //WsXmlNodeH node = ws_xml_get_soap_element(doc, "WSManInteropScenarios");
+
+ WsXmlNodeH node = NULL;
+ if (doc != NULL)
+ node = ws_xml_get_doc_root(doc);
+
+ WsXmlNodeH scenario;
+ int index = 0;
+ int test_id = 0;
+ while( (scenario = ws_xml_get_child(node, index++, NULL, "Scenario")) ) {
+ WsXmlAttrH desc = ws_xml_get_node_attr(scenario, 0);
+ char *attr_val = ws_xml_get_attr_value(desc);
+ WsXmlAttrH supported = ws_xml_get_node_attr(scenario, 1);
+ if (strcmp(ws_xml_get_attr_value(supported), "true") == 0 && test_id == 18 ) {
+ if (desc) {
+ if (attr_val)
+ printf("%s (%d)\n\n", attr_val, test_id );
+ }
+ run_interop_test(cl, scenario, test_id);
+ } else {
+ if (desc) {
+ if (attr_val)
+ printf("%s: Not Supported (%d)\n\n", attr_val, test_id );
+ }
+ }
+ test_id++;
+ }
+
+ return 0;
}