From: <mik...@us...> - 2008-10-15 16:54:49
|
Revision: 1097 http://omc.svn.sourceforge.net/omc/?rev=1097&view=rev Author: mike-brasher Date: 2008-10-15 16:51:54 +0000 (Wed, 15 Oct 2008) Log Message: ----------- Added exception for missing namespaces for CMPIBroker.new_instance() swig method. Fixed embedded instances tests failures on pegasus. Modified Paths: -------------- cmpi-bindings/trunk/install.sh cmpi-bindings/trunk/swig/cmpi_callbacks.i cmpi-bindings/trunk/test/python/TestMethod.py cmpi-bindings/trunk/test/python/TestMethod_Test.py cmpi-bindings/trunk/test/python/install.sh Added Paths: ----------- cmpi-bindings/trunk/test/python/TestMethodPegasus.mof Modified: cmpi-bindings/trunk/install.sh =================================================================== --- cmpi-bindings/trunk/install.sh 2008-10-15 05:48:20 UTC (rev 1096) +++ cmpi-bindings/trunk/install.sh 2008-10-15 16:51:54 UTC (rev 1097) @@ -37,6 +37,8 @@ exit 1 fi +PEGASUS_PROVIDER_DIR=$PEGASUS_HOME/lib + if [ "$1" = "op" ]; then if [ ! -d "$PEGASUS_PROVIDER_DIR" ]; then echo "Please define PEGASUS_PROVIDER_DIR" Modified: cmpi-bindings/trunk/swig/cmpi_callbacks.i =================================================================== --- cmpi-bindings/trunk/swig/cmpi_callbacks.i 2008-10-15 05:48:20 UTC (rev 1096) +++ cmpi-bindings/trunk/swig/cmpi_callbacks.i 2008-10-15 16:51:54 UTC (rev 1097) @@ -252,7 +252,23 @@ { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIInstance* result; + CMPIString* ns; + const char* str; + /* Raise exception if no namespace */ + + if (!(ns = CMGetNameSpace(path, &st)) || st.rc || + !(str = CMGetCharsPtr(ns, NULL)) || *str == '\0') + { + CMSetStatusWithChars($self, &st, CMPI_RC_ERR_FAILED, + "object path has no namespace"); + _raise_ex(&st); +printf("EXCEPTION..................................................\n"); + return NULL; + } + +printf("NAMESPACE[%s]\n", str); + result = CMNewInstance($self, path, &st); RAISE_IF(st); Modified: cmpi-bindings/trunk/test/python/TestMethod.py =================================================================== --- cmpi-bindings/trunk/test/python/TestMethod.py 2008-10-15 05:48:20 UTC (rev 1096) +++ cmpi-bindings/trunk/test/python/TestMethod.py 2008-10-15 16:51:54 UTC (rev 1097) @@ -747,6 +747,8 @@ for kn, val in g_insts.items(): inst = pywbem.CIMInstance('Test_Method', properties={'id':kn, 'p_str':val[0], 'p_sint32':val[1]}) + inst.path = pywbem.CIMInstanceName('Test_Method', + namespace="root/cimv2", keybindings={'id':kn}) insts.append(inst) out_params = [pywbem.CIMParameter('insts', 'instance', value=insts)] Added: cmpi-bindings/trunk/test/python/TestMethodPegasus.mof =================================================================== --- cmpi-bindings/trunk/test/python/TestMethodPegasus.mof (rev 0) +++ cmpi-bindings/trunk/test/python/TestMethodPegasus.mof 2008-10-15 16:51:54 UTC (rev 1097) @@ -0,0 +1,277 @@ +class Test_MethodBase +{ +}; + +[ Description("Class with several methods to test method provider capabilities.")] +class Test_Method : Test_MethodBase +{ + [Key, Description("Unique identifier for this instance.")] + string id; + + string p_str; + sint32 p_sint32; + + sint8 genRand_sint8( + [in] sint8 min, + [in] sint8 max, + [in(false), out] boolean success + ); + sint16 genRand_sint16( + [in] sint16 min, + [in] sint16 max, + [in(false), out] boolean success + ); + sint32 genRand_sint32( + [in] sint32 min, + [in] sint32 max, + [in(false), out] boolean success + ); + sint64 genRand_sint64( + [in] sint64 min, + [in] sint64 max, + [in(false), out] boolean success + ); + uint8 genRand_uint8( + [in] uint8 min, + [in] uint8 max, + [in(false), out] boolean success + ); + uint16 genRand_uint16( + [in] uint16 min, + [in] uint16 max, + [in(false), out] boolean success + ); + uint32 genRand_uint32( + [in] uint32 min, + [in] uint32 max, + [in(false), out] boolean success + ); + uint64 genRand_uint64( + [in] uint64 min, + [in] uint64 max, + [in(false), out] boolean success + ); + real32 genRand_real32( + [in] real32 min, + [in] real32 max, + [in(false), out] boolean success + ); + real64 genRand_real64( + [in] real64 min, + [in] real64 max, + [in(false), out] boolean success + ); + + boolean genRandList_sint8( + [in, out, required] sint8 lo, + [in, out, required] sint8 hi, + [in, required] sint32 nelems, + [in(false), out] sint8 nlist[] + ); + boolean genRandList_sint16( + [in, out, required] sint16 lo, + [in, out, required] sint16 hi, + [in, required] sint32 nelems, + [in(false), out] sint16 nlist [] + ); + boolean genRandList_sint32( + [in, out, required] sint32 lo, + [in, out, required] sint32 hi, + [in, required] sint32 nelems, + [in(false), out] sint32 nlist [] + ); + boolean genRandList_sint64( + [in, out, required] sint64 lo, + [in, out, required] sint64 hi, + [in, required] sint32 nelems, + [in(false), out] sint64 nlist [] + ); + boolean genRandList_uint8( + [in, out, required] uint8 lo, + [in, out, required] uint8 hi, + [in, required] sint32 nelems, + [in(false), out] uint8 nlist [] + ); + boolean genRandList_uint16( + [in, out, required] uint16 lo, + [in, out, required] uint16 hi, + [in, required] sint32 nelems, + [in(false), out] uint16 nlist [] + ); + boolean genRandList_uint32( + [in, out, required] uint32 lo, + [in, out, required] uint32 hi, + [in, required] sint32 nelems, + [in(false), out] uint32 nlist [] + ); + boolean genRandList_uint64( + [in, out, required] uint64 lo, + [in, out, required] uint64 hi, + [in, required] sint32 nelems, + [in(false), out] uint64 nlist [] + ); + boolean genRandList_real32( + [in, out, required] real32 lo, + [in, out, required] real32 hi, + [in, required] sint32 nelems, + [in(false), out] real32 nlist [] + ); + boolean genRandList_real64( + [in, out, required] real64 lo, + [in, out, required] real64 hi, + [in, required] sint32 nelems, + [in(false), out] real64 nlist [] + ); + + boolean minmedmax_sint8( + [in, required] sint8 numlist[], + [in(false), out] sint8 min, + [in(false), out] sint8 max, + [in(false), out] sint8 med + ); + boolean minmedmax_sint16( + [in, required] sint16 numlist[], + [in(false), out] sint16 min, + [in(false), out] sint16 max, + [in(false), out] sint16 med + ); + boolean minmedmax_sint32( + [in, required] sint32 numlist[], + [in(false), out] sint32 min, + [in(false), out] sint32 max, + [in(false), out] sint32 med + ); + boolean minmedmax_sint64( + [in, required] sint64 numlist[], + [in(false), out] sint64 min, + [in(false), out] sint64 max, + [in(false), out] sint64 med + ); + boolean minmedmax_uint8( + [in, required] uint8 numlist[], + [in(false), out] uint8 min, + [in(false), out] uint8 max, + [in(false), out] uint8 med + ); + boolean minmedmax_uint16( + [in, required] uint16 numlist[], + [in(false), out] uint16 min, + [in(false), out] uint16 max, + [in(false), out] uint16 med + ); + boolean minmedmax_uint32( + [in, required] uint32 numlist[], + [in(false), out] uint32 min, + [in(false), out] uint32 max, + [in(false), out] uint32 med + ); + boolean minmedmax_uint64( + [in, required] uint64 numlist[], + [in(false), out] uint64 min, + [in(false), out] uint64 max, + [in(false), out] uint64 med + ); + boolean minmedmax_real32( + [in, required] real32 numlist[], + [in(false), out] real32 min, + [in(false), out] real32 max, + [in(false), out] real32 med + ); + boolean minmedmax_real64( + [in, required] real64 numlist[], + [in(false), out] real64 min, + [in(false), out] real64 max, + [in(false), out] real64 med + ); + + boolean strSplit( + [in, required] string str, + [in] string sep, + [in(false), out] sint32 nelems, + [in(false), out] string elems[] + ); + string strCat( + [in, required] string strs[], + [in] string sep + ); + + datetime getDate( + [in, required] string datestr + ); + boolean getDates( + [in, required] string datestrs[], + [in(false), out] sint32 nelems, + [in(false), out] datetime elems[] + ); + + char16 mkUniChar( + [in, required] sint8 c + ); + boolean mkUniCharArray( + [in, required] sint8 inArr[], + [in(false), out] char16 outArr[] + ); + string mkUniStr_sint8( + [in, required] sint8 cArr[] + ); + string mkUniStr_char16( + [in, required] char16 cArr[] + ); + + string getStrProp(); + + [ Description("Set the value of p_str. Return the previous value of " + "p_str.")] + string setStrProp( + [in, required] string value + ); + + sint32 getIntProp(); + + [ Description("Set the value of p_sint32. Return the previous value of " + "p_sint32.")] + sint32 setIntProp( + [in, required] sint32 value + ); + + [ Description("Return the instance name of any instance of Test_MethodBase") ] + sint32 getObjectPath( + [in(false), out] Test_MethodBase REF path + ); + + [ Description("Return instance names of all instances of Test_MethodBase") ] + sint32 getObjectPaths( + [in(false), out] Test_MethodBase REF paths[] + ); + + [ Description("Delete the specified instance of Test_MethodBase") ] + sint32 delObject( + [in, required] Test_MethodBase REF path + ); + + [ Description("Delete the specified instances of Test_MethodBase") ] + sint32 delObjects( + [in, required] Test_MethodBase REF paths[] + ); + + [ Description("Return number of instances of Test_MethodBase") ] + sint32 numInsts(); + + [ Description("Create the specified instance of Test_MethodBase") ] + sint32 createObject( + [in, required, EmbeddedInstance("Test_MethodBase")] string inst + ); + + [ Description("Create the specified instances of Test_MethodBase") ] + sint32 createObjects( + [in, required, EmbeddedInstance("Test_MethodBase")] string insts[] + ); + + [ Description("Return the number of instances") ] + sint32 numInsts(); + + [ Description("Retrieve instances of Test_MethodBase as an instance list output parameter") ] + sint32 getObjects( + [in(false), out, required, EmbeddedInstance("Test_MethodBase")] string insts[] + ); +}; Modified: cmpi-bindings/trunk/test/python/TestMethod_Test.py =================================================================== --- cmpi-bindings/trunk/test/python/TestMethod_Test.py 2008-10-15 05:48:20 UTC (rev 1096) +++ cmpi-bindings/trunk/test/python/TestMethod_Test.py 2008-10-15 16:51:54 UTC (rev 1097) @@ -540,15 +540,15 @@ insts = outs['insts'] self.assertEquals(len(insts), 2) insts.sort() + self.assertEquals(insts[0]['id'], 'one') self.assertEquals(insts[0]['p_str'], 'str1') self.assertEquals(insts[0]['p_sint32'], 1) - self.assertEquals(insts[0]['id'], 'two') + + self.assertEquals(insts[1]['id'], 'two') self.assertEquals(insts[1]['p_str'], 'str2') self.assertEquals(insts[1]['p_sint32'], 2) - - def get_unit_test(): return TestMethods Modified: cmpi-bindings/trunk/test/python/install.sh =================================================================== --- cmpi-bindings/trunk/test/python/install.sh 2008-10-15 05:48:20 UTC (rev 1096) +++ cmpi-bindings/trunk/test/python/install.sh 2008-10-15 16:51:54 UTC (rev 1097) @@ -44,10 +44,10 @@ __install TestAtomProvider.py /usr/lib/pycim if [ "$1" = "op" ]; then - cimmof TestMethod.mof + cimmof TestMethodPegasus.mof cimmof -n root/PG_InterOp TestMethod.peg.reg cimmof TestAssoc.mof - cimmof -n root/PG_InterOp TestAssocProvider-peg.reg + cimmof -n root/PG_InterOp TestAssocProvider.peg.reg cimmof TestAtom.mof cimmof -n root/PG_InterOp TestAtomProvider.peg.reg cimmof UpcallAtom.mof This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |