/* **============================================================================== ** ** Open Management Infrastructure (OMI) ** ** Copyright (c) Microsoft Corporation ** ** Licensed under the Apache License, Version 2.0 (the "License"); you may not ** use this file except in compliance with the License. You may obtain a copy ** of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ** KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED ** WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, ** MERCHANTABLITY OR NON-INFRINGEMENT. ** ** See the Apache 2 License for the specific language governing permissions ** and limitations under the License. ** **============================================================================== */ #include #include #include #include #include #include #include #include #include "utils.h" #include using namespace std; /* Local data */ static Sock s = INVALID_SOCK; static const char* s_currentNamespace = ""; void SetupHelper(); void CleanupHelper(); NitsSetup(TestWsmanSetup) { s_currentNamespace = ""; SetupHelper(); if (INVALID_SOCK == s) { #if defined(_MSC_VER) s = SockConnectLocal(7778); #else s = SockConnectLocal(ut::getUnittestPortNumberWSMANHTTP()); #endif } } NitsEndSetup NitsCleanup(TestWsmanSetup) { if (INVALID_SOCK != s) Sock_Close(s); s = INVALID_SOCK; CleanupHelper(); } NitsEndCleanup static string _CreateRequestXML( const char* cn, const char* ns, const char* enumerationMode = 0, const char* maxEnvelopeSize = 0, bool specifyNamespace = true) { string res = "" "" "http://linux-22kv:22000/wsman" "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/"; res += cn; res += "" "" "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous" "" "http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate" ""; if (maxEnvelopeSize) { res += maxEnvelopeSize; } else { /* ATTN: try different sizes */ #if 0 res += "10240"; #else res += "102400"; #endif } res += "" "uuid:FEF3DF41-FFEC-4ABE-ADFC-A8305DAB71C9" ""; if (specifyNamespace) { res += ""; res += s_currentNamespace; res += ns; res += ""; } else { res += "value"; } res += "" "PT60.000S" "" "" "" "" "10"; if (enumerationMode) res += enumerationMode; res += "" ; return res; } static string _CreateInvokeRequestXML( const char* cn, const char* ns, const char* method, const char* params, const char* keys, bool specifyNamespace = true) { string res = "" "http://localhost:7778/wsman" "http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/"; res += cn; res += "" "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous" "http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/"; res += cn; res += "/"; res += method; res += "32768" "uuid:E8928068-D73B-4206-9E95-894088B96288" ""; if (specifyNamespace) { res += ""; res += s_currentNamespace; res += ns; res += ""; } else { res += "value"; } if (keys) res += keys; res += "PT60.000S" ""; res += params; res += ""; return res; } static string _CreateGetRequestXML( const char* cn, const char* ns, const char* keys, bool specifyNamespace = true) { string res = "" "http://localhost:7778/wsman" "" "http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/"; res += cn; res += "" "" "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous" "http://schemas.xmlsoap.org/ws/2004/09/transfer/Get" "" /* ATTN: remove? */ /*"327680"*/ "327680" "uuid:E8928068-D73B-4206-9E95-894088B96288" "" ""; if (specifyNamespace) { res += ""; res += s_currentNamespace; res += ns; res += ""; } else { res += "value"; } if (keys) res += keys; res += "PT60.000S" ""; return res; } static string _CreateDeleteRequestXML( const char* cn, const char* ns, const char* keys, bool specifyNamespace = true) { string res = "" "http://localhost:7778/wsman" "" "http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/"; res += cn; res += "" "" "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous" "http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete" "" "32768" "uuid:E8928068-D73B-4206-9E95-894088B96288" "" ""; if (specifyNamespace) { res += ""; res += s_currentNamespace; res += ns; res += ""; } else { res += "value"; } if (keys) res += keys; res += "PT60.000S" ""; return res; } static string _CreateCDATARequestXML( const char* ns) { string res = "" "http://localhost:7778/wsman" "" "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous" "" "" "uuid:e953e956-b44d-460e-a1af-4e484a5e5346" "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/TestClass_AllDMTFTypes" "PT30.0S" "32768" "" "" ""; res += ns; res += "" "" "" "" "" "/node/node[@attribue='']" "" "" "32000" "EnumerateObjectAndEPR" "" "" "" ""; return res; } static string _CreateCreateRequestXML( const char* cn, const char* ns, const char* props, bool specifyNamespace = true) { string res = "" "http://localhost:7778/wsman" "" "http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/"; res += cn; res += "" "" "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous" "http://schemas.xmlsoap.org/ws/2004/09/transfer/Create" "" "32768" "uuid:E8928068-D73B-4206-9E95-894088B96288" "" ""; if (specifyNamespace) { res += ""; res += s_currentNamespace; res += ns; res += ""; } else { res += "value"; } res += "PT60.000S"; res += props; res += ""; return res; } static string _CreateModifyRequestXML( const char* cn, const char* ns, const char* keys, const char* props, bool specifyNamespace = true) { string res = "" "http://localhost:7778/wsman" "" "http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/"; res += cn; res += "" "" "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous" "http://schemas.xmlsoap.org/ws/2004/09/transfer/Put" "" "32768" "uuid:E8928068-D73B-4206-9E95-894088B96288" "" ""; if (specifyNamespace) { res += ""; res += s_currentNamespace; res += ns; res += ""; } else { res += "value"; } if (keys) res += keys; res += "PT60.000S"; res += props; res += ""; return res; } NitsTestWithSetup(TestWSMAN_CDATARequest, TestWsmanSetup) { string r_b, r_h; // use utf16 encoding header SockSendRecvHTTP(s, true, _CreateCDATARequestXML("test/cpp").c_str(), r_h, r_b ); // send invalid xml; expecting http 500 back UT_ASSERT(r_h.find("500") != string::npos); } NitsEndTest NitsTestWithSetup(TestWSMANemptyRequest, TestWsmanSetup) { string r_b, r_h; SockSendRecvHTTP(s, false, "", r_h, r_b ); // send invalid xml; expecting http 500 back UT_ASSERT(r_h.find("500") != string::npos); } NitsEndTest NitsTestWithSetup(TestWSMANInvalidXML, TestWsmanSetup) { string r_b, r_h; SockSendRecvHTTP(s, false, "invalid xml", r_h, r_b ); // send invalid xml; expecting http 500 back UT_ASSERT(r_h.find("500") != string::npos); } NitsEndTest NitsTestWithSetup(TestWSMAN_NotSupportedEncoding, TestWsmanSetup) { string r_b, r_h; // use utf16 encoding header SockSendRecvHTTP(s, true, _CreateRequestXML("X_number", "test/cpp").c_str(), r_h, r_b ); // send not-supported encoding; expecting http 500 back //cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("500") != string::npos); } NitsEndTest NitsTestWithSetup(TestWSMAN_Fault_invalidNamespace, TestWsmanSetup) { string r_b, r_h; SockSendRecvHTTP(s, false, _CreateRequestXML("X_number", "invlaid/namespace").c_str(), r_h, r_b ); //cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; // send invalid request; expecting http 500 back UT_ASSERT(r_h.find("500") != string::npos); UT_ASSERT(!r_b.empty()); UT_ASSERT(r_b.find("wsa:DestinationUnreachable") != string::npos); UT_ASSERT(r_b.find("OMI:MI_Result:3") != string::npos); UT_ASSERT(r_b.find("The target namespace does not exist") != string::npos); UT_ASSERT(r_b.find(":OMI_Code xsi:type=\"cim:cimUnsignedInt\">3MI5MIEnumerateEPR").c_str(), r_h, r_b ); // cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(!r_b.empty()); /* expect EPR back */ UT_ASSERT(r_b.find("") != string::npos); UT_ASSERT(r_b.find("Name=\"InstanceID\">world<") != string::npos); UT_ASSERT(r_b.find("Name=\"InstanceID\">number<") != string::npos); /* regular properties shuld not be specified */ UT_ASSERT(r_b.find("World") == string::npos); UT_ASSERT(r_b.find("Huge Numbers") == string::npos); } NitsEndTest NitsTestWithSetup(TestWSMAN_Enumerate_XProfile_EPRAndObject, TestWsmanSetup) { string r_b, r_h; SockSendRecvHTTP(s, false, _CreateRequestXML("X_Profile", "interop", "EnumerateObjectAndEPR").c_str(), r_h, r_b ); // cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(!r_b.empty()); /* expect EPR back */ UT_ASSERT(r_b.find("") != string::npos); UT_ASSERT(r_b.find("Name=\"InstanceID\">world<") != string::npos); UT_ASSERT(r_b.find("Name=\"InstanceID\">number<") != string::npos); /* and regular properties */ UT_ASSERT(r_b.find("World") != string::npos); UT_ASSERT(r_b.find("Huge Numbers") != string::npos); } NitsEndTest NitsTestWithSetup(TestWSMAN_Enumerate_X_SingletonWithAllTypes, TestWsmanSetup) { string r_b, r_h; SockSendRecvHTTP(s, false, _CreateRequestXML("X_SingletonWithAllTypes", "test/cpp", 0, "640000").c_str(), r_h, r_b ); // cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(!r_b.empty()); // check data // (see X_SingletonWithAllTypes_Class_Provider.cpp to see how it was created) UT_ASSERT(r_b.find("id>1<") != string::npos); UT_ASSERT(r_b.find("b>TRUE<") != string::npos); UT_ASSERT(r_b.find("u8>172<") != string::npos); UT_ASSERT(r_b.find("u16>1745<") != string::npos); // inst.c16_value(1044); // in utf8 it's -48, -108 or 0xd0, 0x94 #if 0 UT_ASSERT(r_b.find("c16>\xd0\x94<") != string::npos); #else UT_ASSERT(r_b.find("c16>1044<") != string::npos); #endif UT_ASSERT(r_b.find("s8>-123<") != string::npos); UT_ASSERT(r_b.find("u16>1745<") != string::npos); UT_ASSERT(r_b.find("s16>-1746<") != string::npos); UT_ASSERT(r_b.find("u32>17567<") != string::npos); UT_ASSERT(r_b.find("s32>-17568<") != string::npos); UT_ASSERT(r_b.find("u64>18446744073709551613<") != string::npos); UT_ASSERT(r_b.find("s64>-9223372036854775805<") != string::npos); UT_ASSERT(r_b.find("s>string value<") != string::npos); /* due to truncation feature of float numbers, skip comparison of last digit */ UT_ASSERT(r_b.find("r32>32.3") != string::npos); UT_ASSERT(r_b.find("r64>64.646") != string::npos); UT_ASSERT(r_b.find("dt>2010-07-14T11:35:11.900675-00:07<") != string::npos); // person UT_ASSERT(r_b.find("Smith<") != string::npos); UT_ASSERT(r_b.find("First>John<") != string::npos); UT_ASSERT(r_b.find("Key>7<") != string::npos); UT_ASSERT(r_b.find("") != string::npos); // fourobjects UT_ASSERT(r_b.find("") != string::npos); // object UT_ASSERT(r_b.find("9000<") != string::npos); //UT_ASSERT(r_b.find("operation>?<") != string::npos); UT_ASSERT(r_b.find("right_operand xsi:nil=\"true\"/>") != string::npos); // test array values UT_ASSERT(r_b.find("bA>TRUE<") != string::npos); UT_ASSERT(r_b.find("bA>FALSE<") != string::npos); UT_ASSERT(r_b.find("u8A>0<") != string::npos); UT_ASSERT(r_b.find("u8A>255<") != string::npos); UT_ASSERT(r_b.find("u8A>128<") != string::npos); UT_ASSERT(r_b.find("s8A>0<") != string::npos); UT_ASSERT(r_b.find("s8A>127<") != string::npos); UT_ASSERT(r_b.find("s8A>-128<") != string::npos); UT_ASSERT(r_b.find("u16A>0<") != string::npos); UT_ASSERT(r_b.find("u16A>64000<") != string::npos); UT_ASSERT(r_b.find("s16A>0<") != string::npos); UT_ASSERT(r_b.find("s16A>-1216<") != string::npos); UT_ASSERT(r_b.find("s16A>258<") != string::npos); } NitsEndTest NitsTestWithSetup(TestWSMAN_Enumerate_X_HugeNumberConformsToProfile, TestWsmanSetup) { // Enumerate Assoc class and verify references are returned properly string r_b, r_h; SockSendRecvHTTP(s, false, _CreateRequestXML("X_HugeNumberConformsToProfile", "test/cpp").c_str(), r_h, r_b ); //cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(!r_b.empty()); // check data UT_ASSERT(r_b.find(":Profile>") != string::npos); UT_ASSERT(r_b.find("Name=\"InstanceID\">number<") != string::npos); UT_ASSERT(r_b.find("1000000") != string::npos); } NitsEndTest /* * Missing namespace will default to "interop" namespace */ NitsTestWithSetup(TestWSMAN_Enumerate_MissingNamespace, TestWsmanSetup) { string r_b, r_h; /* namespace param is missing - expecting error back */ SockSendRecvHTTP(s, false, _CreateRequestXML("CIM_NonExistClass", "interop", 0, 0, false).c_str(), r_h, r_b ); //cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("500") != string::npos); UT_ASSERT(r_b.find("OMI:MI_Result:5") != string::npos); UT_ASSERT(r_b.find("The specified class does not exist.") != string::npos); UT_ASSERT(r_b.find(":OMI_Code xsi:type=\"cim:cimUnsignedInt\">5MIIncludeSubClassProperties" ).c_str(), r_h, r_b ); //cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; //_PrintBuffer(r_h.c_str()); UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(!r_b.empty()); // check data: expecting three items and property 'Property0' // all should present UT_ASSERT(r_b.find("Number>1000000<") != string::npos); UT_ASSERT(r_b.find("Number>1000000000<") != string::npos); UT_ASSERT(r_b.find("Number>1000001<") != string::npos); UT_ASSERT(r_b.find("Property0>9<") != string::npos); UT_ASSERT(r_b.find("ExcludeSubClassProperties" ).c_str(), r_h, r_b ); //cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(!r_b.empty()); // check data: expecting three items and property 'Property0' // 3 instances are expected, but no sub-class properties/sub-class name UT_ASSERT(r_b.find("Number>1000000<") != string::npos); UT_ASSERT(r_b.find("Number>1000000000<") != string::npos); UT_ASSERT(r_b.find("Number>1000001<") != string::npos); UT_ASSERT(r_b.find("Property0>9<") == string::npos); UT_ASSERT(r_b.find("None" ).c_str(), r_h, r_b ); //cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(!r_b.empty()); // check data: expecting three items and property 'Property0' // only 2 instances are expected - exact class match UT_ASSERT(r_b.find("Number>1000000<") != string::npos); UT_ASSERT(r_b.find("Number>1000000000<") != string::npos); UT_ASSERT(r_b.find("Number>1000001<") == string::npos); UT_ASSERT(r_b.find("Property0>9<") == string::npos); UT_ASSERT(r_b.find("77", "").c_str(), r_h, r_b ); // cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(!r_b.empty()); // check data UT_ASSERT(r_b.find("ReturnValue>seventy seven<") != string::npos); } NitsTestWithSetup(TestWSMAN_Invoke_SmallNumber_SpellNumber, TestWsmanSetup) { TestWSMAN_Invoke_SmallNumber_SpellNumberHelper(); } NitsEndTest NitsTestWithSetup(TestWSMAN_Invoke_SmallNumber_SpellNumber1, TestWsmanSetup) { TestWSMAN_Invoke_SmallNumber_SpellNumberHelper(); } NitsEndTest /* * Missing namespace will default to "interop" namespace */ NitsTestWithSetup(TestWSMAN_Invoke_MissingNamespace, TestWsmanSetup) { string r_b, r_h; SockSendRecvHTTP(s, false, _CreateInvokeRequestXML("CIM_NonExistClass", "test/cpp", "spellNumber", "77", "", false).c_str(), r_h, r_b ); //cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("500") != string::npos); UT_ASSERT(!r_b.empty()); // check data UT_ASSERT(r_b.find("OMI:MI_Result:5") != string::npos); UT_ASSERT(r_b.find("The specified class does not exist.") != string::npos); UT_ASSERT(r_b.find(":OMI_Code xsi:type=\"cim:cimUnsignedInt\">5MI77", "").c_str(), r_h, r_b ); // cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(!r_b.empty()); // check data UT_ASSERT(r_b.find("ReturnValue>seventy seven<") != string::npos); } NitsEndTest NitsTestWithSetup(TestWSMAN_Invoke_TestEmbeddedObjectReturnKey20100609, TestWsmanSetup) { string r_b, r_h; SockSendRecvHTTP(s, false, _CreateInvokeRequestXML("TestEmbeddedOperations", "test/cpp", "TestEmbeddedObjectReturnKey20100609", "", "1").c_str(), r_h, r_b ); //cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; if (r_h.find("200") == string::npos) cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; // _PrintBuffer(r_h.c_str()); // send invalid request; expecting http 500 back UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(!r_b.empty()); // _PrintBuffer(r_b.c_str()); // check data UT_ASSERT(r_b.find("ObjectID>20100609<") != string::npos); UT_ASSERT(r_b.find("X_TestEmbeddedObjectNotReferenced") != string::npos); } NitsEndTest NitsTestWithSetup(TestWSMAN_Invoke_TestEmbeddedObjectReturnKey20100609_OOP, TestWsmanSetup) { string r_b, r_h; SockSendRecvHTTP(s, false, _CreateInvokeRequestXML("TestEmbeddedOperations", "oop/requestor/test/cpp", "TestEmbeddedObjectReturnKey20100609", "", "1").c_str(), r_h, r_b ); // cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; // send invalid request; expecting http 500 back UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(!r_b.empty()); // check data UT_ASSERT(r_b.find("ObjectID>20100609<") != string::npos); UT_ASSERT(r_b.find("X_TestEmbeddedObjectNotReferenced") != string::npos); } NitsEndTest NitsTestWithSetup(TestWSMAN_Invoke_TestEmbedded, TestWsmanSetup) { const char* c_embeddedInstance = "\ 101\ "; string r_b, r_h; SockSendRecvHTTP(s, false, _CreateInvokeRequestXML("TestEmbeddedOperations", "test/cpp", "TestEmbedded", c_embeddedInstance, "1").c_str(), r_h, r_b ); // cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(!r_b.empty()); // check data UT_ASSERT(r_b.find("Key>101<") != string::npos); UT_ASSERT(r_b.find("Species>test<") != string::npos); UT_ASSERT(r_b.find("MSFT_Animal") != string::npos); } NitsEndTest NitsTestWithSetup(TestWSMAN_Invoke_TestEmbeddedWithArray, TestWsmanSetup) { const char* c_embeddedInstance = "\ \ 101\ \ \ 102\ \ \ 103\ \ "; string r_b, r_h; SockSendRecvHTTP(s, false, _CreateInvokeRequestXML("TestEmbeddedOperations", "test/cpp", "TestEmbedded", c_embeddedInstance, "1").c_str(), r_h, r_b ); //cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(!r_b.empty()); // check data UT_ASSERT(r_b.find("Key>101<") != string::npos); UT_ASSERT(r_b.find("Key>102<") != string::npos); UT_ASSERT(r_b.find("Key>103<") != string::npos); UT_ASSERT(r_b.find("Species>test<") != string::npos); UT_ASSERT(r_b.find("MSFT_Animal") != string::npos); } NitsEndTest NitsTestWithSetup(TestWSMAN_Invoke_TestEmbeddedWithMultipleArrays, TestWsmanSetup) { const char* c_embeddedInstance = "\ \ 101\ \ \ 102\ \ \ 103\ \ \ \ 9000109\ \ \ some string\ 9000209\ \ \ 9000309\ +\ 1719\ \ "; string r_b, r_h; SockSendRecvHTTP(s, false, _CreateInvokeRequestXML("TestEmbeddedOperations", "test/cpp", "TestEmbedded", c_embeddedInstance, "1").c_str(), r_h, r_b ); //cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(!r_b.empty()); // check data UT_ASSERT(r_b.find("Key>101<") != string::npos); UT_ASSERT(r_b.find("Key>102<") != string::npos); UT_ASSERT(r_b.find("Key>103<") != string::npos); UT_ASSERT(r_b.find("Species>test<") != string::npos); UT_ASSERT(r_b.find("MSFT_Animal") != string::npos); UT_ASSERT(r_b.find("ReturnValue") != string::npos); UT_ASSERT(r_b.find("X_TestObject") != string::npos); UT_ASSERT(r_b.find("id>27000627<") != string::npos); UT_ASSERT(r_b.find("id>9000309<") != string::npos); UT_ASSERT(r_b.find("result>1719<") != string::npos); UT_ASSERT(r_b.find("str>some string<") != string::npos); } NitsEndTest NitsTestWithSetup(TestWSMAN_Invoke_TestAllTypesWithSingleItemArray, TestWsmanSetup) { const char* c_Params = "\ false\ 90\ 13\ 14\ -9\ "; string r_b, r_h; SockSendRecvHTTP(s, false, _CreateInvokeRequestXML("MSFT_Person", "test/cpp", "TestAllTypes", c_Params, "777").c_str(), r_h, r_b ); // cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(!r_b.empty()); // check data UT_ASSERT(r_b.find("u8A>2<") != string::npos); UT_ASSERT(r_b.find("u8A>27<") != string::npos); UT_ASSERT(r_b.find("u8>91<") != string::npos); UT_ASSERT(r_b.find("b>TRUE<") != string::npos); UT_ASSERT(r_b.find("s16A>1<") != string::npos); UT_ASSERT(r_b.find("s16A>-9<") != string::npos); } NitsEndTest /* verify array buffer re-allocation (16 items boundary)*/ NitsTestWithSetup(TestWSMAN_Invoke_TestAllTypesWith17ItemsArray, TestWsmanSetup) { const char* c_Params = "\ 1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 9\ 10\ 11\ 12\ 13\ 14\ 15\ 16\ 17\ "; string r_b, r_h; SockSendRecvHTTP(s, false, _CreateInvokeRequestXML("MSFT_Person", "test/cpp", "TestAllTypes", c_Params, "777").c_str(), r_h, r_b ); // cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(!r_b.empty()); // check data - number of elements and sum UT_ASSERT(r_b.find("u64A>17<") != string::npos); UT_ASSERT(r_b.find("u64A>153<") != string::npos); } NitsEndTest /* verify array two buffer re-allocations (16 items boundary)*/ NitsTestWithSetup(TestWSMAN_Invoke_TestAllTypesWith33ItemsArray, TestWsmanSetup) { const char* c_Params = "\ 1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 9\ 10\ 11\ 12\ 13\ 14\ 15\ 16\ 17\ 18\ 19\ 20\ 21\ 22\ 23\ 24\ 25\ 26\ 27\ 28\ 29\ 30\ 31\ 32\ 33\ "; string r_b, r_h; SockSendRecvHTTP(s, false, _CreateInvokeRequestXML("MSFT_Person", "test/cpp", "TestAllTypes", c_Params, "777").c_str(), r_h, r_b ); // cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(!r_b.empty()); // check data - number of elements and sum UT_ASSERT(r_b.find("u64A>33<") != string::npos); UT_ASSERT(r_b.find("u64A>561<") != string::npos); } NitsEndTest /* verify u64 type operations */ NitsTestWithSetup(TestWSMAN_Invoke_TestAllTypesU64Max, TestWsmanSetup) { /*u64 max is 18446744073709551615; expect it as sum of two items */ const char* c_Params = "\ 18446744073709551610\ 5\ "; string r_b, r_h; SockSendRecvHTTP(s, false, _CreateInvokeRequestXML("MSFT_Person", "test/cpp", "TestAllTypes", c_Params, "777").c_str(), r_h, r_b ); // cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(!r_b.empty()); // check data - number of elements and sum UT_ASSERT(r_b.find("u64A>2<") != string::npos); UT_ASSERT(r_b.find("u64A>18446744073709551615<") != string::npos); } NitsEndTest NitsTestWithSetup(TestWSMAN_Invoke_TestAllTypesStringArray, TestWsmanSetup) { /* unit-test expects exactly two strings and retunr 3 strings: substrings form first two plus '*'*/ const char* c_Params = "\ 123456\ abcdef\ "; string r_b, r_h; SockSendRecvHTTP(s, false, _CreateInvokeRequestXML("MSFT_Person", "test/cpp", "TestAllTypes", c_Params, "777").c_str(), r_h, r_b ); // cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(!r_b.empty()); // check data - number of elements and sum UT_ASSERT(r_b.find("sA>456<") != string::npos); UT_ASSERT(r_b.find("sA>def<") != string::npos); UT_ASSERT(r_b.find("sA>*<") != string::npos); } NitsEndTest NitsTestWithSetup(TestWSMAN_Invoke_TestAllTypesReference, TestWsmanSetup) { /* unit-test expects a reference parameter and returns reference to the same class with key++ */ const char* c_Params = "\ \ \ http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous\ \ \ \ http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/MSFT_Base\ \ \ 89\ \ \ \ "; string r_b, r_h; SockSendRecvHTTP(s, false, _CreateInvokeRequestXML("MSFT_Person", "test/cpp", "TestAllTypes", c_Params, "777").c_str(), r_h, r_b ); //cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(!r_b.empty()); // check data - number of elements and sum UT_ASSERT(r_b.find("Selector Name=\"Key\">90<") != string::npos); } NitsEndTest NitsTestWithSetup(TestWSMAN_Get_SmallNumber_17, TestWsmanSetup) { string r_b, r_h; SockSendRecvHTTP(s, false, _CreateGetRequestXML("X_smallNumber", "test/cpp", "17").c_str(), r_h, r_b ); //cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(!r_b.empty()); // _PrintBuffer(r_h.c_str()); // _PrintBuffer(r_b.c_str()); // check data - number of elements and sum UT_ASSERT(r_b.find("http://schemas.xmlsoap.org/ws/2004/09/transfer/GetResponse17<") != string::npos); UT_ASSERT(r_b.find("SpelledNumber>seventeen<") != string::npos); } NitsEndTest NitsTestWithSetup(TestWSMAN_Get_SmallNumber_NotFound, TestWsmanSetup) { string r_b, r_h; SockSendRecvHTTP(s, false, _CreateGetRequestXML("X_smallNumber", "test/cpp", "17000").c_str(), r_h, r_b ); //cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("500") != string::npos); UT_ASSERT(!r_b.empty()); // check data - number of elements and sum UT_ASSERT(r_b.find("CIM ERROR:NOT_FOUND") != string::npos); UT_ASSERT(r_b.find("Value>wsa:DestinationUnreachable<") != string::npos); UT_ASSERT(r_b.find("OMI:MI_Result:6") != string::npos); UT_ASSERT(r_b.find("The requested object cannot be found.") != string::npos); UT_ASSERT(r_b.find(":OMI_Code xsi:type=\"cim:cimUnsignedInt\">6MI9999").c_str(), r_h, r_b ); //cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("500") != string::npos); UT_ASSERT(!r_b.empty()); // check data for some CIM_Error type stuff UT_ASSERT(r_b.find("CIM_ERR_SERVER_IS_SHUTTING_DOWN") != string::npos); UT_ASSERT(r_b.find("This is a test CIM Error") != string::npos); UT_ASSERT(r_b.find("Value>wsman:InternalError<") != string::npos); UT_ASSERT(r_b.find("9998").c_str(), r_h, r_b ); //cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("500") != string::npos); UT_ASSERT(!r_b.empty()); // check data for some CIM_Error type stuff UT_ASSERT(r_b.find("CIM_ERR_SERVER_IS_SHUTTING_DOWN") != string::npos); UT_ASSERT(r_b.find("This is a test CIM Error") != string::npos); UT_ASSERT(r_b.find("Value>wsman:InternalError<") != string::npos); UT_ASSERT(r_b.find("17", false).c_str(), r_h, r_b ); //cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("500") != string::npos); UT_ASSERT(!r_b.empty()); // check data - number of elements and sum UT_ASSERT(r_b.find("OMI:MI_Result:5") != string::npos); UT_ASSERT(r_b.find("The specified class does not exist.") != string::npos); UT_ASSERT(r_b.find(":OMI_Code xsi:type=\"cim:cimUnsignedInt\">5MI7").c_str(), r_h, r_b ); //cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(!r_b.empty()); // check data - number of elements and sum UT_ASSERT(r_b.find("http://schemas.xmlsoap.org/ws/2004/09/transfer/DeleteResponse17").c_str(), r_h, r_b ); //cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("500") != string::npos); UT_ASSERT(!r_b.empty()); // check data - number of elements and sum UT_ASSERT(r_b.find("Value>wsa:DestinationUnreachable<") != string::npos); UT_ASSERT(r_b.find("OMI:MI_Result:6") != string::npos); UT_ASSERT(r_b.find("The requested object cannot be found.") != string::npos); UT_ASSERT(r_b.find(":OMI_Code xsi:type=\"cim:cimUnsignedInt\">6MI7", false).c_str(), r_h, r_b ); //cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("500") != string::npos); UT_ASSERT(!r_b.empty()); // check data - number of elements and sum UT_ASSERT(r_b.find("OMI:MI_Result:5") != string::npos); UT_ASSERT(r_b.find("The specified class does not exist.") != string::npos); UT_ASSERT(r_b.find(":OMI_Code xsi:type=\"cim:cimUnsignedInt\">5MI" " text" " "; SockSendRecvHTTP(s, false, _CreateCreateRequestXML("X_smallNumber", "test/cpp", props).c_str(), r_h, r_b ); //cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(!r_b.empty()); // check data - number of elements and sum UT_ASSERT(r_b.find("http://schemas.xmlsoap.org/ws/2004/09/transfer/CreateResponse10000<") != string::npos); UT_ASSERT(r_b.find("wxf:ResourceCreated>") != string::npos); } NitsEndTest NitsTestWithSetup(TestWSMAN_Create_SmallNumber_failed_invalid_prop, TestWsmanSetup) { /* invalid property set */ string r_b, r_h; const char* props = "" " text" " text" " "; SockSendRecvHTTP(s, false, _CreateCreateRequestXML("X_smallNumber", "test/cpp", props).c_str(), r_h, r_b ); //cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("500") != string::npos); UT_ASSERT(!r_b.empty()); // check data - number of elements and sum UT_ASSERT(r_b.find(">OMI:MI_Result:12The specified property does not exist.12MI" " 7" " "; SockSendRecvHTTP(s, false, _CreateCreateRequestXML("X_smallNumber", "test/cpp", props).c_str(), r_h, r_b ); //cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("500") != string::npos); UT_ASSERT(!r_b.empty()); /* when description is not specified, provider returns 'not-found' */ // check data - UT_ASSERT(r_b.find("OMI:MI_Result:6") != string::npos); UT_ASSERT(r_b.find("The requested object cannot be found.") != string::npos); UT_ASSERT(r_b.find(":OMI_Code xsi:type=\"cim:cimUnsignedInt\">6MI" " text" " "; SockSendRecvHTTP(s, false, _CreateCreateRequestXML("CIM_NonExistClass", "test/cpp", props, false).c_str(), r_h, r_b ); //cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("500") != string::npos); UT_ASSERT(!r_b.empty()); // check data - number of elements and sum UT_ASSERT(r_b.find("OMI:MI_Result:5") != string::npos); UT_ASSERT(r_b.find("The specified class does not exist.") != string::npos); UT_ASSERT(r_b.find(":OMI_Code xsi:type=\"cim:cimUnsignedInt\">5MI" " text" " "; const char* keys = "7"; SockSendRecvHTTP(s, false, _CreateModifyRequestXML("X_smallNumber", "test/cpp", keys, props).c_str(), r_h, r_b ); //cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(!r_b.empty()); // check data - number of elements and sum UT_ASSERT(r_b.find("http://schemas.xmlsoap.org/ws/2004/09/transfer/PutResponse10000<") != string::npos); UT_ASSERT(r_b.find("Description>text<") != string::npos); } NitsEndTest NitsTestWithSetup(TestWSMAN_Modify_ProviderPostsInstance, TestWsmanSetup) { string r_b, r_h; const char* props = "" " Monkey" " "; const char* keys = "1234"; SockSendRecvHTTP(s, false, _CreateModifyRequestXML("MSFT_Person", "test/c", keys, props).c_str(), r_h, r_b ); UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(!r_b.empty()); UT_ASSERT(r_b.find("http://schemas.xmlsoap.org/ws/2004/09/transfer/PutResponse1234<") != string::npos); UT_ASSERT(r_b.find("Species>Monkey<") != string::npos); } NitsEndTest NitsTestWithSetup(TestWSMAN_Modify_RelyOnGetForPostInstance, TestWsmanSetup) { string r_b, r_h; const char* props = "" " Monkey" " "; const char* keys = "1235"; SockSendRecvHTTP(s, false, _CreateModifyRequestXML("MSFT_Person", "test/c", keys, props).c_str(), r_h, r_b); UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(!r_b.empty()); UT_ASSERT(r_b.find("http://schemas.xmlsoap.org/ws/2004/09/transfer/PutResponse1235<") != string::npos); UT_ASSERT(r_b.find("Species>GetForModify<") != string::npos); } NitsEndTest NitsTestWithSetup(TestWSMAN_Modify_SmallNumber_failed_invalid_prop, TestWsmanSetup) { /* invalid property set */ string r_b, r_h; const char* props = "" " text" " text" " "; const char* keys = "7"; SockSendRecvHTTP(s, false, _CreateModifyRequestXML("X_smallNumber", "test/cpp", keys, props).c_str(), r_h, r_b ); //cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("500") != string::npos); UT_ASSERT(!r_b.empty()); // check data - number of elements and sum UT_ASSERT(r_b.find(">OMI:MI_Result:1212MI" " Seven" " "; const char* keys = "7"; SockSendRecvHTTP(s, false, _CreateModifyRequestXML("X_smallNumber", "test/cpp", keys, props).c_str(), r_h, r_b ); //cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("500") != string::npos); UT_ASSERT(!r_b.empty()); /* when description is not specified, provider returns 'not-found' */ // check data - UT_ASSERT(r_b.find("OMI:MI_Result:6") != string::npos); UT_ASSERT(r_b.find("The requested object cannot be found.") != string::npos); UT_ASSERT(r_b.find(":OMI_Code xsi:type=\"cim:cimUnsignedInt\">6MI \ http://localhost:7778/wsman \ http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous \ http://schemas.xmlsoap.org/ws/2004/09/transfer/Create \ uuid:cd965798-cc09-4b8f-b176-22d98390b34e \ http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/TestClass_AllDMTFTypes \ PT30.0S \ 32768 \ \ root/cimv2 \ v_Key \ 110 \ 12 \ 1true \ true \ 100" ; SockSendRecvHTTP(s, false, res.c_str(), r_h, r_b ); UT_ASSERT(r_h.find("500") != string::npos); /* Case 2: xsi:type ="" */ res = " \ http://localhost:7778/wsman \ http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous \ http://schemas.xmlsoap.org/ws/2004/09/transfer/Create \ uuid:cd965798-cc09-4b8f-b176-22d98390b34e \ http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/TestClass_AllDMTFTypes \ PT30.0S \ 32768 \ \ root/cimv2 \ v_Key \ 110 \ 12 \ 1true \ true \ 100" ; SockSendRecvHTTP(s, false, res.c_str(), r_h, r_b ); UT_ASSERT(r_h.find("500") != string::npos); /* Case 2: xsi:type ="_" */ res = " \ http://localhost:7778/wsman \ http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous \ http://schemas.xmlsoap.org/ws/2004/09/transfer/Create \ uuid:cd965798-cc09-4b8f-b176-22d98390b34e \ http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/TestClass_AllDMTFTypes \ PT30.0S \ 32768 \ \ root/cimv2 \ v_Key \ 110 \ 12 \ 1true \ true \ 100" ; SockSendRecvHTTP(s, false, res.c_str(), r_h, r_b ); UT_ASSERT(r_h.find("500") != string::npos); } NitsEndTest /* * Missing namespace will default to "interop" namespace */ NitsTestWithSetup(TestWSMAN_Modify_SmallNumber_MissingNamespace, TestWsmanSetup) { string r_b, r_h; const char* props = "" " text" " "; const char* keys = "7"; SockSendRecvHTTP(s, false, _CreateModifyRequestXML("CIM_NonExistClass", "test/cpp", keys, props, false).c_str(), r_h, r_b ); //cout << "resp header: " << r_h << endl << endl << "body: " << r_b << endl; UT_ASSERT(r_h.find("500") != string::npos); UT_ASSERT(!r_b.empty()); // check data - number of elements and sum UT_ASSERT(r_b.find("OMI:MI_Result:5") != string::npos); UT_ASSERT(r_b.find("The specified class does not exist.") != string::npos); UT_ASSERT(r_b.find(":OMI_Code xsi:type=\"cim:cimUnsignedInt\">5MIhttp://157.59.85.74:7778/wsmanhttp://schemas.dmtf.org/wbem/cim-xml/2/cim-schema/2/*http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2004/09/transfer/Get1048576uuid:B60F3103-A48A-408E-BC11-998452D82D2Fuuid:9802F98B-CD2D-4260-82AD-D6FCAB5E1B19uuid:48E05E94-2337-474E-8D6C-22484C00940A1test/cppInvalidClasstruetruetruetrue" , r_h, r_b, false ); NitsTraceExA(r_b.c_str(), NitsHere(), NitsAutomatic); UT_ASSERT(r_h.find("500") != string::npos); UT_ASSERT(r_b.find("http://schemas.xmlsoap.org/ws/2004/08/addressing/fault") != string::npos); UT_ASSERT(r_b.find("wsa:DestinationUnreachable") != string::npos); UT_ASSERT(r_b.find("OMI:MI_Result:5") != string::npos); UT_ASSERT(r_b.find("The specified class does not exist.") != string::npos); UT_ASSERT(r_b.find(":OMI_Code xsi:type=\"cim:cimUnsignedInt\">5MIhttp://157.59.85.74:7778/wsmanhttp://schemas.dmtf.org/wbem/cim-xml/2/cim-schema/2/*http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2004/09/transfer/Get1048576uuid:B60F3103-A48A-408E-BC11-998452D82D2Fuuid:9802F98B-CD2D-4260-82AD-D6FCAB5E1B19uuid:48E05E94-2337-474E-8D6C-22484C00940A1test/invalidX_HugeNumbertruetruetruetrue" , r_h, r_b, false ); NitsTraceExA(r_b.c_str(), NitsHere(), NitsAutomatic); UT_ASSERT(r_h.find("500") != string::npos); UT_ASSERT(r_b.find("http://schemas.xmlsoap.org/ws/2004/08/addressing/fault") != string::npos); UT_ASSERT(r_b.find("wsa:DestinationUnreachable") != string::npos); UT_ASSERT(r_b.find("OMI:MI_Result:3") != string::npos); UT_ASSERT(r_b.find("The target namespace does not exist.") != string::npos); UT_ASSERT(r_b.find(":OMI_Code xsi:type=\"cim:cimUnsignedInt\">3MIhttp://157.59.85.74:7778/wsmanhttp://schemas.dmtf.org/wbem/cim-xml/2/cim-schema/2/*http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2004/09/transfer/Get1048576uuid:B60F3103-A48A-408E-BC11-998452D82D2Fuuid:9802F98B-CD2D-4260-82AD-D6FCAB5E1B19uuid:48E05E94-2337-474E-8D6C-22484C00940A1test/cpptruetruetruetrue" , r_h, r_b, false ); NitsTraceExA(r_b.c_str(), NitsHere(), NitsAutomatic); UT_ASSERT(r_h.find("500") != string::npos); UT_ASSERT(r_b.find("http://schemas.xmlsoap.org/ws/2004/08/addressing/fault") != string::npos); UT_ASSERT(r_b.find("wsa:DestinationUnreachable") != string::npos); UT_ASSERT(r_b.find("OMI:MI_Result:5") != string::npos); UT_ASSERT(r_b.find("The specified class does not exist.") != string::npos); UT_ASSERT(r_b.find(":OMI_Code xsi:type=\"cim:cimUnsignedInt\">5MIhttp://157.59.85.74:7778/wsmanhttp://schemas.dmtf.org/wbem/ws-cim/1/cim-schema/2/*http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2004/09/transfer/Get1048576uuid:B60F3103-A48A-408E-BC11-998452D82D2Fuuid:9802F98B-CD2D-4260-82AD-D6FCAB5E1B19uuid:48E05E94-2337-474E-8D6C-22484C00940A1test/cppX_HugeNumbertruetruetruetrue" , r_h, r_b, false ); NitsTraceExA(r_b.c_str(), NitsHere(), NitsAutomatic); UT_ASSERT(r_h.find("500") != string::npos); UT_ASSERT(r_b.find("http://schemas.dmtf.org/wbem/wsman/1/wsman/fault") != string::npos); UT_ASSERT(r_b.find("wsman:UnsupportedFeature") != string::npos); UT_ASSERT(r_b.find("GetClass not Supported in WS-CIM format") != string::npos); } NitsEndTest NitsTestWithSetup(TestWSMAN_GetClass_X_HugeNumber_StandardRttiNonWinRMClient, TestWsmanSetup) { string r_b, r_h; SockSendRecvHTTP(s, false, "http://157.59.85.74:7778/wsmanhttp://schemas.dmtf.org/wbem/cim-xml/2/cim-schema/2/*http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2004/09/transfer/Get1048576uuid:B60F3103-A48A-408E-BC11-998452D82D2Fuuid:9802F98B-CD2D-4260-82AD-D6FCAB5E1B19uuid:48E05E94-2337-474E-8D6C-22484C00940A1test/cppX_HugeNumbertruetruetruetrue" , r_h, r_b, false ); NitsTraceExA(r_b.c_str(), NitsHere(), NitsAutomatic); UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(r_b.find("CLASSORIGIN") == string::npos); UT_ASSERT(r_b.find("DERIVATION") != string::npos); UT_ASSERT(r_b.find("PROPAGATED") != string::npos); UT_ASSERT(r_b.find("QUALIFIER") != string::npos); UT_ASSERT(r_b.find("http://schemas.xmlsoap.org/ws/2004/09/transfer/GetResponse") != string::npos); UT_ASSERT(r_b.find("trueX_SmallNumberX_SmallNumbertruetrueX_TestObjectX_TestObjecttruetruetruetruetruetruetrueX_TestObjecttruetrueX_TestObjecttruetrue") != string::npos); } NitsEndTest static char desiredStandardRttiErrorString[] = "177" "CIM::Interop" "true" "0" "123456789" "10..1" "2345678910" "1112" "CIM_Error.OtherErrorType" "" "CIM_Error.ErrorType" "" "" "CIM_Error.MessageCIM_Error.MessageArguments" "true" "" "" "CIM_Error.MessageIDCIM_Error.MessageArguments" "" "CIM_Error.MessageIDCIM_Error.Message" "" "0123456" "7.." "1213141516" "171812" "" "0" "12345678" "910111213141516" "1718192021222324" "2526272829303132" "3334353637383940" "4142434445464748" "4950515253545556" "5758596061626364" "6566676869707172" "7374757677787980" "8182838485868788" "8990919293949596" "979899100101102103104" "105106107108109110111112" "113114115116117118119120" "121122123124125126127128" "129130.." "12" "1920212223242526" "2728293031323334" "3536373839404142" "4344454647484950" "5152535455565758" "596061626356465" "6667686970717273" "7475767778798081" "8283848586878889" "9091929394959697" "9899100101102103104" "105106107108109110111" "112113114115116117118" "119120121122123124125" "126127128129130131132" "133134135136137138139" "140141142143144145146" "12" "CIM_Error.ProbableCauseDescription" "" "CIM_Error.ProbableCause" "" "" "CIM_Error.ErrorSourceFormat" "" "012" ".." "1214712" "CIM_Error.ErrorSource" "CIM_Error.OtherErrorSourceFormat0" "" "" "CIM_Error.ErrorSourceFormat" "" "1234" "567891011" "12131415161718" "19202122232425" "26272829.." "148149" "150151152153154155" "156157158159160161" "162163164165166167" "168169170171172173" "17417517612" "CIM_Error.CIMStatusCodeDescription" "" "CIM_Error.CIMStatusCode" ""; NitsTestWithSetup(TestWSMAN_GetClass_CIM_Error_StandardRtti, TestWsmanSetup) { string r_b, r_h; SockSendRecvHTTP(s, false, "http://157.59.86.37:7778/wsmanhttp://schemas.dmtf.org/wbem/cim-xml/2/cim-schema/2/*http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2004/09/transfer/Get1048576uuid:DFCFFC30-89CA-4C3F-8E8C-4DA843C58615uuid:3091788F-6729-47C1-8A9C-CF6F387170E7uuid:45B3AA8E-7853-4E1C-8437-FE5546D0D08E1root/testCIM_Errortruetruetrue110121true" , r_h, r_b, true ); NitsTraceExA(r_b.c_str(), NitsHere(), NitsAutomatic); UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(r_b.find("CLASSORIGIN") != string::npos); UT_ASSERT(r_b.find("DERIVATION") != string::npos); UT_ASSERT(r_b.find("QUALIFIER") != string::npos); UT_ASSERT(r_b.find("http://schemas.xmlsoap.org/ws/2004/09/transfer/GetResponse") != string::npos); UT_ASSERT(r_b.find(desiredStandardRttiErrorString) != string::npos); } NitsEndTest NitsTestWithSetup(TestWSMAN_GetClass_MSFT_Animal_StandardRtti, TestWsmanSetup) { string r_b, r_h; SockSendRecvHTTP(s, false, "http://157.59.86.37:7778/wsmanhttp://schemas.dmtf.org/wbem/cim-xml/2/cim-schema/2/*http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2004/09/transfer/Get1048576uuid:D3F422F5-574D-40CD-A610-FFF8FBDF5F83uuid:3091788F-6729-47C1-8A9C-CF6F387170E7uuid:18D51124-A440-45B1-B4B1-CC085A5F9A321root/testMSFT_Animaltruetruetrue110121true" , r_h, r_b, true ); NitsTraceExA(r_b.c_str(), NitsHere(), NitsAutomatic); UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(r_b.find("CLASSORIGIN") != string::npos); UT_ASSERT(r_b.find("DERIVATION") != string::npos); UT_ASSERT(r_b.find("PROPAGATED") != string::npos); UT_ASSERT(r_b.find("QUALIFIER") != string::npos); UT_ASSERT(r_b.find("http://schemas.xmlsoap.org/ws/2004/09/transfer/GetResponse") != string::npos); UT_ASSERT(r_b.find("true") != string::npos); } NitsEndTest static char desiredStandardRttiOOPErrorString[] = "" "177CIM::Interop" "true" "0123" "45678910" ".." "12345678" "9101112" "" "CIM_Error.OtherErrorType" "" "CIM_Error.ErrorType" "" "" "" "CIM_Error.MessageCIM_Error.MessageArguments" "true" "" "CIM_Error.MessageIDCIM_Error.MessageArguments" "" "CIM_Error.MessageID" "CIM_Error.Message" "" "0" "123456" "7.." "12" "13141516171812" "" "" "01234" "567891011" "12131415161718" "19202122232425" "26272829303132" "33343536373839" "40414243444546" "47484950515253" "54555657585960" "61626364656667" "68697071727374" "75767778798081" "82838485868788" "89909192939495" "96979899100101102" "103104105106107108" "109110111112113114" "115116117118119120" "121122123124125126" "127128129130.." "12" "19202122232425" "26272829303132" "33343536373839" "40414243444546" "47484950515253" "54555657585960" "6162635646566" "67686970717273" "74757677787980" "81828384858687" "88899091929394" "9596979899100101" "102103104105106107" "108109110111112113" "114115116117118119" "120121122123124125" "126127128129130131" "132133134135136137" "138139140141142143" "14414514612" "" "CIM_Error.ProbableCauseDescription" "" "" "CIM_Error.ProbableCause" "" "" "" "CIM_Error.ErrorSourceFormat" "" "0" "12.." "" "1214712" "CIM_Error.ErrorSource" "CIM_Error.OtherErrorSourceFormat0" "" "" "CIM_Error.ErrorSourceFormat" "" "1" "23456" "7891011" "1213141516" "1718192021" "2223242526" "272829.." "148" "149150151152153" "154155156157158" "159160161162163" "164165166167168" "169170171172173" "17417517612" "" "CIM_Error.CIMStatusCodeDescription" "" "" "CIM_Error.CIMStatusCode"; NitsTestWithSetup(TestWSMAN_GetClass_CIM_Error_StandardRtti_OOP, TestWsmanSetup) { string r_b, r_h; SockSendRecvHTTP(s, false, "http://157.59.86.37:7778/wsmanhttp://schemas.dmtf.org/wbem/cim-xml/2/cim-schema/2/*http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2004/09/transfer/Get1048576uuid:DFCFFC30-89CA-4C3F-8E8C-4DA843C58615uuid:3091788F-6729-47C1-8A9C-CF6F387170E7uuid:45B3AA8E-7853-4E1C-8437-FE5546D0D08E1oop/requestor/test/cCIM_Errortruetruetrue110121true" , r_h, r_b, true ); NitsTraceExA(r_b.c_str(), NitsHere(), NitsAutomatic); UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(r_b.find("CLASSORIGIN") != string::npos); UT_ASSERT(r_b.find("DERIVATION") != string::npos); UT_ASSERT(r_b.find("QUALIFIER") != string::npos); UT_ASSERT(r_b.find("http://schemas.xmlsoap.org/ws/2004/09/transfer/GetResponse") != string::npos); UT_ASSERT(r_b.find(desiredStandardRttiOOPErrorString) != string::npos); } NitsEndTest NitsTestWithSetup(TestWSMAN_GetClass_MSFT_Animal_StandardRtti_OOP, TestWsmanSetup) { string r_b, r_h; SockSendRecvHTTP(s, false, "http://157.59.86.37:7778/wsmanhttp://schemas.dmtf.org/wbem/cim-xml/2/cim-schema/2/*http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2004/09/transfer/Get1048576uuid:D3F422F5-574D-40CD-A610-FFF8FBDF5F83uuid:3091788F-6729-47C1-8A9C-CF6F387170E7uuid:18D51124-A440-45B1-B4B1-CC085A5F9A321oop/requestor/test/cMSFT_Animaltruetruetrue110121true" , r_h, r_b, true ); NitsTraceExA(r_b.c_str(), NitsHere(), NitsAutomatic); UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(r_b.find("CLASSORIGIN") != string::npos); UT_ASSERT(r_b.find("DERIVATION") != string::npos); UT_ASSERT(r_b.find("PROPAGATED") != string::npos); UT_ASSERT(r_b.find("QUALIFIER") != string::npos); UT_ASSERT(r_b.find("http://schemas.xmlsoap.org/ws/2004/09/transfer/GetResponse") != string::npos); UT_ASSERT(r_b.find("true") != string::npos); } NitsEndTest NitsTestWithSetup(TestWSMAN_GetClass_X_HugeNumber_StandardRtti, TestWsmanSetup) { string r_b, r_h; SockSendRecvHTTP(s, false, "http://157.59.85.74:7778/wsmanhttp://schemas.dmtf.org/wbem/cim-xml/2/cim-schema/2/*http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2004/09/transfer/Get1048576uuid:B60F3103-A48A-408E-BC11-998452D82D2Fuuid:9802F98B-CD2D-4260-82AD-D6FCAB5E1B19uuid:48E05E94-2337-474E-8D6C-22484C00940A1test/cppX_HugeNumbertruetruetruetrue" , r_h, r_b, true ); NitsTraceExA(r_b.c_str(), NitsHere(), NitsAutomatic); UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(r_b.find("CLASSORIGIN") != string::npos); UT_ASSERT(r_b.find("DERIVATION") != string::npos); UT_ASSERT(r_b.find("PROPAGATED") != string::npos); UT_ASSERT(r_b.find("QUALIFIER") != string::npos); UT_ASSERT(r_b.find("http://schemas.xmlsoap.org/ws/2004/09/transfer/GetResponse") != string::npos); UT_ASSERT(r_b.find("trueX_SmallNumberX_SmallNumbertruetrueX_TestObjectX_TestObjecttruetruetruetruetruetruetrueX_TestObjecttruetrueX_TestObjecttruetrue") != string::npos); } NitsEndTest NitsTestWithSetup(TestWSMAN_GetClass_X_HugeNumber_FullRttiNonWinRMClient, TestWsmanSetup) { string r_b, r_h; SockSendRecvHTTP(s, false, "http://157.59.85.74:7778/wsmanhttp://schemas.dmtf.org/wbem/cim-xml/2/cim-schema/2/*http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2004/09/transfer/Get1048576uuid:C9E3315D-B056-441D-A6C8-0E8D5CD5F73Fuuid:9802F98B-CD2D-4260-82AD-D6FCAB5E1B19uuid:3A1A4B66-9803-46AA-9044-DB92F46B6F051test/cppX_HugeNumbertruefalsetrue012true" , r_h, r_b, false ); NitsTraceExA(r_b.c_str(), NitsHere(), NitsAutomatic); UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(r_b.find("CLASSORIGIN") == string::npos); UT_ASSERT(r_b.find("DERIVATION") != string::npos); UT_ASSERT(r_b.find("PROPAGATED") == string::npos); UT_ASSERT(r_b.find("QUALIFIER") != string::npos); UT_ASSERT(r_b.find("http://schemas.xmlsoap.org/ws/2004/09/transfer/GetResponse") != string::npos); UT_ASSERT(r_b.find("X_SmallNumberX_SmallNumbertruetrueX_TestObjectX_TestObjecttruetruetruetruetruetruetrueX_TestObjecttruetrueX_TestObjecttruetrue") != string::npos); } NitsEndTest NitsTestWithSetup(TestWSMAN_GetClass_X_HugeNumber_FullRtti, TestWsmanSetup) { string r_b, r_h; SockSendRecvHTTP(s, false, "http://157.59.85.74:7778/wsmanhttp://schemas.dmtf.org/wbem/cim-xml/2/cim-schema/2/*http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2004/09/transfer/Get1048576uuid:C9E3315D-B056-441D-A6C8-0E8D5CD5F73Fuuid:9802F98B-CD2D-4260-82AD-D6FCAB5E1B19uuid:3A1A4B66-9803-46AA-9044-DB92F46B6F051test/cppX_HugeNumbertruefalsetrue012true" , r_h, r_b, true ); NitsTraceExA(r_b.c_str(), NitsHere(), NitsAutomatic); UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(r_b.find("CLASSORIGIN") != string::npos); UT_ASSERT(r_b.find("DERIVATION") != string::npos); UT_ASSERT(r_b.find("PROPAGATED") == string::npos); UT_ASSERT(r_b.find("QUALIFIER") != string::npos); UT_ASSERT(r_b.find("http://schemas.xmlsoap.org/ws/2004/09/transfer/GetResponse") != string::npos); UT_ASSERT(r_b.find("X_SmallNumberX_SmallNumbertruetrueX_TestObjectX_TestObjecttruetruetruetruetruetruetrueX_TestObjecttruetrueX_TestObjecttruetrue") != string::npos); } NitsEndTest NitsTestWithSetup(TestWSMAN_GetClass_X_HugeNumber_AllOptionsTurnedOff, TestWsmanSetup) { string r_b, r_h; SockSendRecvHTTP(s, false, "http://157.59.85.74:7778/wsmanhttp://schemas.dmtf.org/wbem/cim-xml/2/cim-schema/2/*http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2004/09/transfer/Get1048576uuid:E1675FFB-B761-402F-B9A0-DDA950E2D744uuid:E519A3F9-FAB7-4E0A-A34A-08CEE460A713uuid:C13B6D08-E35C-465A-BCC1-05122A00CE1B1test/cppX_HugeNumberfalsefalsefalsefalse012true" , r_h, r_b, true ); NitsTraceExA(r_b.c_str(), NitsHere(), NitsAutomatic); UT_ASSERT(r_h.find("200") != string::npos); UT_ASSERT(r_b.find("CLASSORIGIN") == string::npos); UT_ASSERT(r_b.find("DERIVATION") == string::npos); UT_ASSERT(r_b.find("PROPAGATED") == string::npos); UT_ASSERT(r_b.find("QUALIFIER") == string::npos); UT_ASSERT(r_b.find("http://schemas.xmlsoap.org/ws/2004/09/transfer/GetResponse") != string::npos); UT_ASSERT(r_b.find("") != string::npos); } NitsEndTest #ifndef DISABLE_INDICATION static string _CreateSubscribeRequestXML( const char* cn, const char* ns, string opTimeout, bool specifyNamespace = true ) { string res = "" "" "http://linux-22kv:22000/wsman" "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/"; res += cn; res += "" "" "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous" "" "http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe" "102400" "uuid:FEF3DF41-FFEC-4ABE-ADFC-A8305DAB71C9" ""; if (specifyNamespace) { res += ""; res += s_currentNamespace; res += ns; res += ""; } else { res += "value"; } res += "" ""; res += opTimeout; res += "" "" "" "" "http://linux-22kv:22000" "Select * from L_IndicationC3" ""; return res; } // // Good value example: PT5.000S (positive xs:duration) // // Bad examples: -PT5.000S (negative value) // 01:23:45 (xs:time not supported) // NitsTestWithSetup(TestWSMAN_Subscribe_Specifies_Invalid_OperationTimeout, TestWsmanSetup) { string r_b, r_h; SockSendRecvHTTP( s, false, _CreateSubscribeRequestXML("R_IndicationC3", "root/cimv2", "-PT5.000S", true).c_str(), r_h, r_b ); // Check for InternalError. This indicates a parsing error because the value is negative. UT_ASSERT(r_h.find("500") != string::npos); UT_ASSERT(r_b.find("http://schemas.dmtf.org/wbem/wsman/1/wsman/fault") != string::npos); UT_ASSERT(r_b.find("wsman:InternalError") != string::npos); r_b.clear(); r_h.clear(); SockSendRecvHTTP( s, false, _CreateSubscribeRequestXML("R_IndicationC3", "root/cimv2", "01:23:45", true).c_str(), r_h, r_b ); // Check for InvalidMessageInformationHeader. This means that xs:datetime is not supported UT_ASSERT(r_h.find("500") != string::npos); UT_ASSERT(r_b.find("http://schemas.xmlsoap.org/ws/2004/08/addressing/fault") != string::npos); UT_ASSERT(r_b.find("wsa:InvalidMessageInformationHeader") != string::npos); } NitsEndTest #endif