You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(26) |
Dec
(13) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(5) |
Feb
(16) |
Mar
(5) |
Apr
(5) |
May
(13) |
Jun
(12) |
Jul
(1) |
Aug
(2) |
Sep
(13) |
Oct
(6) |
Nov
(1) |
Dec
(29) |
2008 |
Jan
(2) |
Feb
(2) |
Mar
(2) |
Apr
(57) |
May
(35) |
Jun
(45) |
Jul
(132) |
Aug
(87) |
Sep
(141) |
Oct
(86) |
Nov
(17) |
Dec
(2) |
2009 |
Jan
(3) |
Feb
(2) |
Mar
(3) |
Apr
(3) |
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
2010 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <kk...@us...> - 2008-10-16 12:01:12
|
Revision: 1103 http://omc.svn.sourceforge.net/omc/?rev=1103&view=rev Author: kkaempf Date: 2008-10-16 12:01:07 +0000 (Thu, 16 Oct 2008) Log Message: ----------- testing environment for Ruby providers Modified Paths: -------------- cmpi-bindings/trunk/test/ruby/TestAtomProvider.sfcb.reg cmpi-bindings/trunk/test/ruby/setup.sh Added Paths: ----------- cmpi-bindings/trunk/test/ruby/TestAssocProvider.sfcb.reg cmpi-bindings/trunk/test/ruby/TestMethod.sfcb.reg cmpi-bindings/trunk/test/ruby/test_association_provider.rb cmpi-bindings/trunk/test/ruby/test_instance_provider.rb cmpi-bindings/trunk/test/ruby/test_method_provider.rb Removed Paths: ------------- cmpi-bindings/trunk/test/ruby/test_atom_provider.rb Added: cmpi-bindings/trunk/test/ruby/TestAssocProvider.sfcb.reg =================================================================== --- cmpi-bindings/trunk/test/ruby/TestAssocProvider.sfcb.reg (rev 0) +++ cmpi-bindings/trunk/test/ruby/TestAssocProvider.sfcb.reg 2008-10-16 12:01:07 UTC (rev 1103) @@ -0,0 +1,17 @@ +[TestAssoc_Group] + provider: TestAssociationProvider + location: rbCmpiProvider + type: instance + namespace: root/cimv2 + +[TestAssoc_User] + provider: TestAssociationProvider + location: rbCmpiProvider + type: instance + namespace: root/cimv2 + +[TestAssoc_MemberOfGroup] + provider: TestAssociationProvider + location: rbCmpiProvider + type: instance association + namespace: root/cimv2 Modified: cmpi-bindings/trunk/test/ruby/TestAtomProvider.sfcb.reg =================================================================== --- cmpi-bindings/trunk/test/ruby/TestAtomProvider.sfcb.reg 2008-10-16 12:00:31 UTC (rev 1102) +++ cmpi-bindings/trunk/test/ruby/TestAtomProvider.sfcb.reg 2008-10-16 12:01:07 UTC (rev 1103) @@ -1,5 +1,5 @@ [Test_Atom] - provider: TestAtomProvider + provider: TestInstanceProvider location: rbCmpiProvider type: instance namespace: root/cimv2 Added: cmpi-bindings/trunk/test/ruby/TestMethod.sfcb.reg =================================================================== --- cmpi-bindings/trunk/test/ruby/TestMethod.sfcb.reg (rev 0) +++ cmpi-bindings/trunk/test/ruby/TestMethod.sfcb.reg 2008-10-16 12:01:07 UTC (rev 1103) @@ -0,0 +1,5 @@ +[Test_Method] + provider: TestMethodProvider + location: rbCmpiProvider + type: instance method + namespace: root/cimv2 Modified: cmpi-bindings/trunk/test/ruby/setup.sh =================================================================== --- cmpi-bindings/trunk/test/ruby/setup.sh 2008-10-16 12:00:31 UTC (rev 1102) +++ cmpi-bindings/trunk/test/ruby/setup.sh 2008-10-16 12:01:07 UTC (rev 1103) @@ -39,9 +39,10 @@ ## Install Ruby providers: ## -__install TestMethod.rb /usr/lib/rbcim -__install TestAssocProvider.rb /usr/lib/rbcim -__install TestAtomProvider.rb /usr/lib/rbcim +__install test_method_provider.rb /usr/lib/rbcim +__install Test_Atom.rb /usr/lib/rbcim +__install test_association_provider.rb /usr/lib/rbcim +__install test_instance_provider.rb /usr/lib/rbcim if [ "$1" = "op" ]; then cimmof ../python/TestMethod.mof Added: cmpi-bindings/trunk/test/ruby/test_association_provider.rb =================================================================== --- cmpi-bindings/trunk/test/ruby/test_association_provider.rb (rev 0) +++ cmpi-bindings/trunk/test/ruby/test_association_provider.rb 2008-10-16 12:01:07 UTC (rev 1103) @@ -0,0 +1,24 @@ +# +# Ruby Provider for Associations +# +# Instruments the CIM class Test_Assoc +# + +module Cmpi + + # Instrument the CIM class TestAssoc + # + # + + class TestAssociationProvider < AssociationProvider +# require 'Test_Assoc' + include InstanceProviderIF + + # create new provider instance -> check with .mof file + def initialize broker + super + end + + end + +end Deleted: cmpi-bindings/trunk/test/ruby/test_atom_provider.rb =================================================================== --- cmpi-bindings/trunk/test/ruby/test_atom_provider.rb 2008-10-16 12:00:31 UTC (rev 1102) +++ cmpi-bindings/trunk/test/ruby/test_atom_provider.rb 2008-10-16 12:01:07 UTC (rev 1103) @@ -1,53 +0,0 @@ -# -# Ruby Provider for TestAtom -# -# Instruments the CIM class Test_Atom -# - -module Cmpi - - STDERR.puts "This is test_atom_provider.rb" - # Instrument the CIM class TestAtom - # - # Model an atom, For use with CIMOM and RbWbem Provider - # - - class TestAtomProvider < InstanceProvider - require 'Test_Atom' - - # create new provider instance -> check with .mof file - def initialize broker - @instances = {} - super - end - - # use i.e. 'include MethodProviderIF' to implement multiple MIs - def create_instance context, result, reference, newinst - STDERR.puts "TestAtomProvider.create_instance: #{reference}" - STDERR.puts "TestAtomProvider.create_instance: #{reference.key_count} keys" - reference.keys do |value,name| - STDERR.puts "Key #{name} = #{value}" - end - @instances[reference.to_s] = Test_Atom.new reference.get_key_at(0)[0]._value - result.return_objectpath reference - result.done - end - - def get_instance context, result, objname, plist - - plist = plist.join(',') if plist.respond_to? :join - - STDERR.puts "TestAtomProvider.get_instance: #{objname}: #{plist}" - instance = @instances[objname] - result.return_instance instance if instance - result.done - end - - def delete_instance context, result, objname - STDERR.puts "TestAtomProvider.delete_instance: #{objname}" - @instances.delete objname - end - - end - -end Copied: cmpi-bindings/trunk/test/ruby/test_instance_provider.rb (from rev 1090, cmpi-bindings/trunk/test/ruby/test_atom_provider.rb) =================================================================== --- cmpi-bindings/trunk/test/ruby/test_instance_provider.rb (rev 0) +++ cmpi-bindings/trunk/test/ruby/test_instance_provider.rb 2008-10-16 12:01:07 UTC (rev 1103) @@ -0,0 +1,55 @@ +# +# Ruby Provider for TestAtom +# +# Instruments the CIM class Test_Atom +# + +module Cmpi + + # Instrument the CIM class TestAtom + # + # Model an atom, For use with CIMOM and RbWbem Provider + # + + class TestInstanceProvider < InstanceProvider + require 'Test_Atom' + + # create new provider instance -> check with .mof file + def initialize broker + @instances = {} + super + end + + # use i.e. 'include MethodProviderIF' to implement multiple MIs + def create_instance context, result, reference, newinst + STDERR.puts "TestAtomProvider.create_instance: #{reference}" + STDERR.puts "TestAtomProvider.create_instance: #{reference.key_count} keys" + reference.keys do |value,name| + STDERR.puts "Key #{name} = #{value}" + end + @instances[reference.to_s] = Test_Atom.new reference.get_key_at(0)[0]._value + result.return_objectpath reference + result.done + true + end + + def get_instance context, result, objname, plist + + plist = plist.join(',') if plist.respond_to? :join + + STDERR.puts "TestAtomProvider.get_instance: #{objname}: #{plist}" + instance = @instances[objname] + result.return_instance instance if instance + result.done + true + end + + def delete_instance context, result, objname + STDERR.puts "TestAtomProvider.delete_instance: #{objname}" + @instances.delete objname + true + end + + end + +end Property changes on: cmpi-bindings/trunk/test/ruby/test_instance_provider.rb ___________________________________________________________________ Added: svn:mergeinfo + Added: cmpi-bindings/trunk/test/ruby/test_method_provider.rb =================================================================== --- cmpi-bindings/trunk/test/ruby/test_method_provider.rb (rev 0) +++ cmpi-bindings/trunk/test/ruby/test_method_provider.rb 2008-10-16 12:01:07 UTC (rev 1103) @@ -0,0 +1,21 @@ +# +# Ruby Provider for Methods +# +# Instruments the CIM class Test_Method +# + +module Cmpi + + # Instrument the CIM class TestMethod + # + + class TestMethodProvider < MethodProvider + include InstanceProviderIF + # create new provider instance -> check with .mof file + def initialize broker + super broker + end + + end + +end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kk...@us...> - 2008-10-16 12:01:02
|
Revision: 1102 http://omc.svn.sourceforge.net/omc/?rev=1102&view=rev Author: kkaempf Date: 2008-10-16 12:00:31 +0000 (Thu, 16 Oct 2008) Log Message: ----------- make Ruby bindings complete target_ruby.c: load providers on-demand, do proper exception handling cmpi_rbwbem_bindings.rb: provide interface classes for all MIs Modified Paths: -------------- cmpi-bindings/trunk/src/target_ruby.c cmpi-bindings/trunk/swig/ruby/cmpi_rbwbem_bindings.rb Modified: cmpi-bindings/trunk/src/target_ruby.c =================================================================== --- cmpi-bindings/trunk/src/target_ruby.c 2008-10-16 11:59:07 UTC (rev 1101) +++ cmpi-bindings/trunk/src/target_ruby.c 2008-10-16 12:00:31 UTC (rev 1102) @@ -28,6 +28,9 @@ /* * create_mi (called from rb_protect) * load Ruby provider and create provider instance + * + * Converts ProviderName to provider_name and + * tries to load this from /usr/lib/rbcim * * I args : pointer to array of 2 values * values[0] = classname (String) @@ -39,7 +42,7 @@ { VALUE *values = (VALUE *)args; - _SBLIM_TRACE(1,("Ruby: %s.new ...", StringValuePtr(values[0]))); +/* _SBLIM_TRACE(1,("Ruby: %s.new ...", StringValuePtr(values[0]))); */ return rb_funcall2(_TARGET_MODULE, rb_intern("create_provider"), 2, values); } @@ -115,8 +118,7 @@ CMPIString *trace = get_exc_trace(broker); _SBLIM_TRACE(1,("<%d> Ruby: import '%s' failed: %s", getpid(), RB_BINDINGS_FILE, CMGetCharPtr(trace))); -/* _CMPI_SETFAIL(<CMPIString *>); */ - abort(); + _CMPI_SETFAIL(trace); return -1; } _TARGET_MODULE = rb_const_get(rb_cModule, rb_intern(RB_BINDINGS_MODULE)); @@ -136,6 +138,7 @@ /* * local (per MI) Ruby initializer * keeps track of reference count + * */ static int @@ -174,10 +177,6 @@ st->msg = trace; } } - else - { - _SBLIM_TRACE(1,("Ruby: cmpi at %p", hdl->instance)); - } exit: _SBLIM_TRACE(1,("Initialize() %s", (error == 0)? "succeeded":"failed")); return error; @@ -186,7 +185,7 @@ /* * call_provider - * + * Call function 'opname' with nargs arguments within managed interface hdl->instance */ static int @@ -218,12 +217,18 @@ va_end(vargs); } - + + /* call the Ruby function + * possible results: + * i nonzero: Exception raised + * result == nil: not (or badly) implemented + * result == true: success + * result == Array: pair of CMPIStatus rc(int) and msg(string) + */ result = rb_protect(call_mi, (VALUE)args, &i); - free( args ); - if (i) + if (i) /* exception ? */ { CMPIString *trace = get_exc_trace(hdl->broker); char* str = fmtstr("Ruby: calling '%s' failed: %s", opname, CMGetCharPtr(trace)); @@ -232,7 +237,40 @@ st->msg = hdl->broker->eft->newString(hdl->broker, str, NULL); return 1; } + + if (NIL_P(result)) /* not or wrongly implemented */ + { + st->rc = CMPI_RC_ERR_NOT_SUPPORTED; + return 1; + } + if (result != Qtrue) + { + VALUE resulta = rb_check_array_type(result); + VALUE rc, msg; + if (NIL_P(resulta)) + { + char* str = fmtstr("Ruby: calling '%s' returned unknown result", opname); + st->rc = CMPI_RC_ERR_FAILED; + st->msg = hdl->broker->eft->newString(hdl->broker, str, NULL); + return 1; + } + + rc = rb_ary_entry(resulta, 0); + msg = rb_ary_entry(resulta, 1); + if (!FIXNUM_P(rc)) + { + char* str = fmtstr("Ruby: calling '%s' returned non-numeric rc code", opname); + st->rc = CMPI_RC_ERR_FAILED; + st->msg = hdl->broker->eft->newString(hdl->broker, str, NULL); + return 1; + } + st->rc = FIX2LONG(rc); + st->msg = hdl->broker->eft->newString(hdl->broker, StringValuePtr(msg), NULL); + return 1; + } + + /* all is fine */ st->rc = CMPI_RC_OK; return 0; } Modified: cmpi-bindings/trunk/swig/ruby/cmpi_rbwbem_bindings.rb =================================================================== --- cmpi-bindings/trunk/swig/ruby/cmpi_rbwbem_bindings.rb 2008-10-16 11:59:07 UTC (rev 1101) +++ cmpi-bindings/trunk/swig/ruby/cmpi_rbwbem_bindings.rb 2008-10-16 12:00:31 UTC (rev 1102) @@ -15,6 +15,7 @@ # def self.create_provider classname, broker $:.unshift RBCIMPATH # add to load path + # CamelCase -> under_score underscore = classname. gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). @@ -22,69 +23,152 @@ tr("-", "_"). downcase STDERR.puts "create_provider #{classname}: #{underscore}" + + begin # load implementation - require underscore - + require underscore + rescue Exception + STDERR.puts "Loading /usr/lib/rbcim/#{underscore}.rb failed: #{$!.message}" + raise + end $:.shift # take load path away Cmpi.const_get(classname).new broker end + def not_implemented klass, name + STDERR.puts "#{klass}.#{name}: not implemented" + nil + end + # define MI provider interfaces as modules # so they can be used as mixins + # + # Typing information about interface function parameters + # + # context : CMPIContext + # result : CMPIResult + # reference : CMPIObjectPath + # properties : Array of String + # + + + # Instance provider interface + # + # Typing information about interface function parameters + # + # newinst : CMPIInstance + # module InstanceProviderIF def create_instance context, result, reference, newinst end - def get_instance context, result, objname, plist + def enum_instance_names context, result, reference end - def delete_instance context, result, objname + def enum_instances context, result, reference, properties end - def method_missing method, *args - STDERR.puts "InstanceProvider.#{method}: not implemented" + def get_instance context, result, reference, properties end + def set_instance context, result, reference, newinst, properties + end + def delete_instance context, result, reference + end + # query : String + # lang : String + def exec_query context, result, reference, query, lang + end end + # Method provider interface + # module MethodProviderIF - def method_missing method, *args - STDERR.puts "MethodProvider.#{method}: not implemented" + # method : String + # inargs : CMPIArgs + # outargs : CMPIArgs + def invoke_method context, result, reference, method, inargs, outargs end end + # Association provider interface + # + # Typing information about interface function parameters + # + # assoc_class : String + # result_class : String + # role : String + # result_role : String + # module AssociationProviderIF - def method_missing method, *args - STDERR.puts "AssociationProvider.#{method}: not implemented" + def associator_names context, result, reference, assoc_class, result_class, role, result_role end + def associators context, result, reference, assoc_class, result_class, role, result_role, properties + end + def reference_names context, result, reference, result_class, role + end + def references context, result, reference, result_class, role, properties + end end + + # Indication provider interface + # + # Typing information about interface function parameters + # + # filter : CMPISelectExp + # class_name : String + # owner : String + # first_activation : Bool + # last_activation : Bool + # module IndicationProviderIF - def method_missing method, *args - STDERR.puts "IndicationProvider.#{method}: not implemented" + def authorize_filter context, filter, class_name, reference, owner end + def activate_filter context, filter, class_name, reference, first_activation + end + def deactivate_filter context, filter, class_name, reference, last_activation + end + def must_poll context, filter, class_name, reference + end + def enable_indications context + end + def disable_indications context + end end - # now define MI classes, so they can be derived from + # now define MI classes, so implementations can be derived from them class InstanceProvider include InstanceProviderIF def initialize broker @broker = broker end + def self.method_missing method, *args + not_implemented self.class, self.method + end end class MethodProvider include MethodProviderIF def initialize broker @broker = broker end + def self.method_missing method, *args + not_implemented self.class, self.method + end end class AssociationProvider include AssociationProviderIF def initialize broker @broker = broker end + def self.method_missing method, *args + not_implemented self.class, self.method + end end class IndicationProvider include IndicationProviderIF def initialize broker @broker = broker end + def self.method_missing method, *args + not_implemented self.class, self.method + end end end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kk...@us...> - 2008-10-16 11:59:26
|
Revision: 1101 http://omc.svn.sourceforge.net/omc/?rev=1101&view=rev Author: kkaempf Date: 2008-10-16 11:59:07 +0000 (Thu, 16 Oct 2008) Log Message: ----------- Small optimization: move thread locking outside of string2target / proplist2target Modified Paths: -------------- cmpi-bindings/trunk/src/cmpi_provider.c Modified: cmpi-bindings/trunk/src/cmpi_provider.c =================================================================== --- cmpi-bindings/trunk/src/cmpi_provider.c 2008-10-15 23:58:06 UTC (rev 1100) +++ cmpi-bindings/trunk/src/cmpi_provider.c 2008-10-16 11:59:07 UTC (rev 1101) @@ -87,6 +87,8 @@ /* * string2target * char* -> Target_Type + * + * *must* be called within TARGET_THREAD_BEGIN_BLOCK/TARGET_THREAD_END_BLOCK */ static Target_Type @@ -97,10 +99,7 @@ if (s == NULL) return Target_Null; - TARGET_THREAD_BEGIN_BLOCK; - obj = Target_String(s); - TARGET_THREAD_END_BLOCK; return obj; } @@ -109,6 +108,8 @@ /* * proplist2target * char** -> Target_Type + * + * *must* be called within TARGET_THREAD_BEGIN_BLOCK/TARGET_THREAD_END_BLOCK */ static Target_Type @@ -116,11 +117,9 @@ { Target_Type pl; - TARGET_THREAD_BEGIN_BLOCK; if (cplist == NULL) { Target_INCREF(Target_Void); - TARGET_THREAD_END_BLOCK; return Target_Void; } @@ -129,7 +128,6 @@ { Target_Append(pl, Target_String(*cplist)); } - TARGET_THREAD_END_BLOCK; return pl; } @@ -372,9 +370,9 @@ _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); _result = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0); _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - TARGET_THREAD_END_BLOCK; _properties = proplist2target(properties); + TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "enum_instances", 4, _context, _result, @@ -414,9 +412,9 @@ _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - TARGET_THREAD_END_BLOCK; _properties = proplist2target(properties); + TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "get_instance", 4, _context, _result, @@ -509,9 +507,9 @@ _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); _newinst = SWIG_NewPointerObj((void*) newinstance, SWIGTYPE_p__CMPIInstance, 0); - TARGET_THREAD_END_BLOCK; plist = proplist2target(properties); + TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "set_instance", 5, _context, _result, @@ -590,9 +588,9 @@ _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - TARGET_THREAD_END_BLOCK; _query = string2target(query); _lang = string2target(language); + TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "exec_query", 5, _context, @@ -645,7 +643,6 @@ _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); - TARGET_THREAD_END_BLOCK; _assocClass = Target_Null; _resultClass = Target_Null; _role = Target_Null; @@ -666,6 +663,7 @@ { _resultRole = string2target(resultRole); } + TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "associator_names", 7, _ctx, @@ -716,7 +714,6 @@ _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); - TARGET_THREAD_END_BLOCK; _props = proplist2target(properties); _assocClass = Target_Null; _resultClass = Target_Null; @@ -738,6 +735,7 @@ { _resultRole = string2target(resultRole); } + TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "associators", 8, _ctx, @@ -783,7 +781,6 @@ _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); - TARGET_THREAD_END_BLOCK; _resultClass = Target_Null; _role = Target_Null; if (role != NULL) @@ -794,6 +791,7 @@ { _resultClass = string2target(resultClass); } + TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "reference_names", 5, _ctx, @@ -839,7 +837,6 @@ _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); - TARGET_THREAD_END_BLOCK; _role = Target_Null; _resultClass = Target_Null; if (role != NULL) @@ -851,6 +848,7 @@ _resultClass = string2target(resultClass); } _props = proplist2target(properties); + TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "references", 6, _ctx, @@ -896,9 +894,9 @@ _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); _in = SWIG_NewPointerObj((void*) in, SWIGTYPE_p__CMPIArgs, 0); _out = SWIG_NewPointerObj((void*) out, SWIGTYPE_p__CMPIArgs, 0); - TARGET_THREAD_END_BLOCK; _method = string2target(method); + TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "invoke_method", 6, _ctx, _rslt, @@ -940,10 +938,10 @@ _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); _filter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); _classPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); - TARGET_THREAD_END_BLOCK; _className = string2target(className); _owner = string2target(owner); + TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "authorize_filter", 5, _ctx, _filter, @@ -984,9 +982,9 @@ _filter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); _classPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); _firstActivation = Target_Bool(firstActivation); - TARGET_THREAD_END_BLOCK; _className = string2target(className); + TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "activate_filter", 5, _ctx, _filter, @@ -1027,9 +1025,9 @@ _filter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); _classPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); _lastActivation = Target_Bool(lastActivation); - TARGET_THREAD_END_BLOCK; _className = string2target(className); + TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "deactivate_filter", 5, _ctx, _filter, @@ -1072,9 +1070,9 @@ //Target_Type _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); _filter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); _classPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); - TARGET_THREAD_END_BLOCK; _className = string2target(className); + TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "must_poll", 4, _ctx, //_rslt, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-10-15 23:58:15
|
Revision: 1100 http://omc.svn.sourceforge.net/omc/?rev=1100&view=rev Author: bartw Date: 2008-10-15 23:58:06 +0000 (Wed, 15 Oct 2008) Log Message: ----------- a bit of cleanup Modified Paths: -------------- cmpi-bindings/trunk/test/python/TestIndications.py Modified: cmpi-bindings/trunk/test/python/TestIndications.py =================================================================== --- cmpi-bindings/trunk/test/python/TestIndications.py 2008-10-15 23:34:36 UTC (rev 1099) +++ cmpi-bindings/trunk/test/python/TestIndications.py 2008-10-15 23:58:06 UTC (rev 1100) @@ -147,7 +147,7 @@ global _shutdown global _insts_received global _num_to_send - print inst['IndicationTime'], inst['Description'] + sys.stdout.write('.'); sys.stdout.flush() _lock.acquire() _insts_received+= 1 if _num_to_send == _insts_received: @@ -162,15 +162,16 @@ subcop = createSubscription(conn) time.sleep(1) conn.InvokeMethod('reset_indication_count', 'Test_UpcallAtom') + print 'Waiting for %s indications...' % _num_to_send countsent,outs = conn.InvokeMethod('send_indications', 'Test_UpcallAtom', num_to_send=_num_to_send) numsent,outs = conn.InvokeMethod('get_indication_send_count', 'Test_UpcallAtom') deleteSubscription(conn, subcop) if (countsent != numsent): - print("send_indications NumSent(%d) doesn't match get_indication_send_count NumSent(%d)"%(countsent, numsent)); + print("\nsend_indications NumSent(%d) doesn't match get_indication_send_count NumSent(%d)\n"%(countsent, numsent)); sys.exit(1) - for i in xrange(10): + for i in xrange(20): _lock.acquire() if _shutdown: reactor.stop() @@ -184,7 +185,10 @@ thread = threading.Thread(target=threadfunc) thread.start() reactor.run() + print '' if _num_to_send != _insts_received: print 'Expected %s exceptions, got %s' % (_num_to_send, _insts_received) sys.exit(1) + else: + print 'Tests passed' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-10-15 23:34:42
|
Revision: 1099 http://omc.svn.sourceforge.net/omc/?rev=1099&view=rev Author: bartw Date: 2008-10-15 23:34:36 +0000 (Wed, 15 Oct 2008) Log Message: ----------- some improvements for Indication Test Modified Paths: -------------- cmpi-bindings/trunk/test/python/TestIndications.py Modified: cmpi-bindings/trunk/test/python/TestIndications.py =================================================================== --- cmpi-bindings/trunk/test/python/TestIndications.py 2008-10-15 22:58:23 UTC (rev 1098) +++ cmpi-bindings/trunk/test/python/TestIndications.py 2008-10-15 23:34:36 UTC (rev 1099) @@ -20,7 +20,7 @@ from lib import wbem_connection _port = 5309 -_lock = threading.RLock() +_num_to_send = pywbem.Uint16(42) class CIMListener(resource.Resource): """ CIM Listener @@ -123,6 +123,9 @@ #log.startLogging(sys.stdout) +_lock = threading.RLock() +_shutdown = False +_insts_received = 0 if __name__ == '__main__': parser = optparse.OptionParser() @@ -140,30 +143,48 @@ conn = wbem_connection.WBEMConnFromOptions(parser) def cb(inst): + global _lock + global _shutdown + global _insts_received + global _num_to_send print inst['IndicationTime'], inst['Description'] + _lock.acquire() + _insts_received+= 1 + if _num_to_send == _insts_received: + _shutdown = True + _lock.release() + cl = CIMListener(callback=cb, http_port=5309) def threadfunc(): time.sleep(1) numrcv = 0 subcop = createSubscription(conn) - num_to_send = pywbem.Uint16(7) time.sleep(1) conn.InvokeMethod('reset_indication_count', 'Test_UpcallAtom') countsent,outs = conn.InvokeMethod('send_indications', - 'Test_UpcallAtom', num_to_send=num_to_send) + 'Test_UpcallAtom', num_to_send=_num_to_send) numsent,outs = conn.InvokeMethod('get_indication_send_count', 'Test_UpcallAtom') deleteSubscription(conn, subcop) if (countsent != numsent): print("send_indications NumSent(%d) doesn't match get_indication_send_count NumSent(%d)"%(countsent, numsent)); sys.exit(1) - time.sleep(4) + for i in xrange(10): + _lock.acquire() + if _shutdown: + reactor.stop() + _lock.release() + if not reactor.running: + break + time.sleep(.5) if reactor.running: reactor.stop() - #self.fail("number received(%d) doesn't match number sent(%d)"%(numrcv,numsent)); thread = threading.Thread(target=threadfunc) thread.start() reactor.run() + if _num_to_send != _insts_received: + print 'Expected %s exceptions, got %s' % (_num_to_send, _insts_received) + sys.exit(1) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-10-15 22:58:33
|
Revision: 1098 http://omc.svn.sourceforge.net/omc/?rev=1098&view=rev Author: bartw Date: 2008-10-15 22:58:23 +0000 (Wed, 15 Oct 2008) Log Message: ----------- working on automating indication tests Modified Paths: -------------- cmpi-bindings/trunk/test/python/UpcallAtomTest.py Added Paths: ----------- cmpi-bindings/trunk/test/python/TestIndications.py cmpi-bindings/trunk/test/python/deploy.mof Removed Paths: ------------- cmpi-bindings/trunk/test/python/UpcallAtomIndListener.py Added: cmpi-bindings/trunk/test/python/TestIndications.py =================================================================== --- cmpi-bindings/trunk/test/python/TestIndications.py (rev 0) +++ cmpi-bindings/trunk/test/python/TestIndications.py 2008-10-15 22:58:23 UTC (rev 1098) @@ -0,0 +1,169 @@ +#!/usr/bin/python +# +# Simple indication receiver using Twisted Python. HTTP post requests +# are listened for on port 5988 and port 5899 using SSL. +# +# Requires Twisted Python and +# + +import sys +import optparse +from twisted.internet import reactor, ssl +from twisted.web import server, resource +import pywbem +import threading +from socket import getfqdn + +from twisted.python import log + +import time +from lib import wbem_connection + +_port = 5309 +_lock = threading.RLock() + +class CIMListener(resource.Resource): + """ CIM Listener + """ + + isLeaf = 1 + + + def __init__(self, callback, http_port=5988): + self.callback = callback + self.http_port = http_port + + site = server.Site(self) + + reactor.listenTCP(self.http_port, site) + + def stop(self): + reactor.stop() + + def run(self): + reactor.run() + + def render_POST(self, request): + tt = pywbem.parse_cim(pywbem.xml_to_tupletree(request.content.read())) + insts = [x[1] for x in tt[2][2][0][2][2]] + for inst in insts: + self.callback(inst) + return '' + +def createFilter( ch, query='select * from CIM_ProcessIndication', + ns='root/interop', + querylang='WQL', + src_ns='root/cimv2', + in_name=None): + name = in_name or 'cimfilter%s'%time.time() + filterinst=pywbem.CIMInstance('CIM_IndicationFilter') + filterinst['CreationClassName']='CIM_IndicationFilter' + filterinst['SystemCreationClassName']='CIM_ComputerSystem' + filterinst['SystemName']=getfqdn() + filterinst['Name']=name + filterinst['Query']=query + filterinst['QueryLanguage']=querylang + filterinst['SourceNamespace']=src_ns + cop = pywbem.CIMInstanceName('CIM_IndicationFilter') + cop.keybindings = { 'CreationClassName':'CIM_IndicationFilter', + 'SystemClassName':'CIM_ComputerSystem', + 'SystemName':getfqdn(), + 'Name':name } + cop.namespace=ns + filterinst.path = cop + filtercop = ch.CreateInstance(filterinst) + return filtercop + +def createDest( ch, destination='http://localhost:%s' % _port, + ns='root/interop', + in_name=None): + name = in_name or 'cimlistener%s'%time.time() + destinst=pywbem.CIMInstance('CIM_ListenerDestinationCIMXML') + destinst['CreationClassName']='CIM_ListenerDestinationCIMXML' + destinst['SystemCreationClassName']='CIM_ComputerSystem' + destinst['SystemName']=getfqdn() + destinst['Name']=name + destinst['Destination']=destination + cop = pywbem.CIMInstanceName('CIM_ListenerDestinationCIMXML') + cop.keybindings = { 'CreationClassName':'CIM_ListenerDestinationCIMXML', + 'SystemClassName':'CIM_ComputerSystem', + 'SystemName':getfqdn(), + 'Name':name } + cop.namespace=ns + destinst.path = cop + destcop = ch.CreateInstance(destinst) + return destcop + +def createSubscription(ch, ns='root/interop'): + replace_ns = ch.default_namespace + ch.default_namespace=ns + indfilter=createFilter(ch) + indhandler=createDest(ch) + subinst=pywbem.CIMInstance('CIM_IndicationSubscription') + subinst['Filter']=indfilter + subinst['Handler']=indhandler + cop = pywbem.CIMInstanceName('CIM_IndicationSubscription') + cop.keybindings = { 'Filter':indfilter, + 'Handler':indhandler } + cop.namespace=ns + subinst.path = cop + subcop = ch.CreateInstance(subinst) + ch.default_namespace=replace_ns + return subcop + + +def deleteSubscription(ch, subcop): + indfilter = subcop['Filter'] + indhandler= subcop['Handler'] + ch.DeleteInstance(subcop) + ch.DeleteInstance(indfilter) + ch.DeleteInstance(indhandler) + +# end indication support methods + +#log.startLogging(sys.stdout) + + +if __name__ == '__main__': + parser = optparse.OptionParser() + wbem_connection.getWBEMConnParserOptions(parser) + parser.add_option('--verbose', '', action='store_true', default=False, + help='Show verbose output') + parser.add_option('--level', + '-l', + action='store', + type='int', + dest='dbglevel', + help='Indicate the level of debugging statements to display (default=2)', + default=2) + _g_opts, _g_args = parser.parse_args() + conn = wbem_connection.WBEMConnFromOptions(parser) + + def cb(inst): + print inst['IndicationTime'], inst['Description'] + cl = CIMListener(callback=cb, http_port=5309) + + def threadfunc(): + time.sleep(1) + numrcv = 0 + subcop = createSubscription(conn) + num_to_send = pywbem.Uint16(7) + time.sleep(1) + conn.InvokeMethod('reset_indication_count', 'Test_UpcallAtom') + countsent,outs = conn.InvokeMethod('send_indications', + 'Test_UpcallAtom', num_to_send=num_to_send) + numsent,outs = conn.InvokeMethod('get_indication_send_count', + 'Test_UpcallAtom') + deleteSubscription(conn, subcop) + if (countsent != numsent): + print("send_indications NumSent(%d) doesn't match get_indication_send_count NumSent(%d)"%(countsent, numsent)); + sys.exit(1) + time.sleep(4) + if reactor.running: + reactor.stop() + #self.fail("number received(%d) doesn't match number sent(%d)"%(numrcv,numsent)); + + thread = threading.Thread(target=threadfunc) + thread.start() + reactor.run() + Property changes on: cmpi-bindings/trunk/test/python/TestIndications.py ___________________________________________________________________ Added: svn:executable + * Deleted: cmpi-bindings/trunk/test/python/UpcallAtomIndListener.py =================================================================== --- cmpi-bindings/trunk/test/python/UpcallAtomIndListener.py 2008-10-15 16:51:54 UTC (rev 1097) +++ cmpi-bindings/trunk/test/python/UpcallAtomIndListener.py 2008-10-15 22:58:23 UTC (rev 1098) @@ -1,109 +0,0 @@ -#!/usr/bin/python -# -# Simple indication receiver using Twisted Python. HTTP post requests -# are listened for on port 5988 and port 5899 using SSL. -# -# Requires Twisted Python and -# - -import sys -from twisted.internet import reactor -from twisted.web import server, resource -import pywbem -import threading -import os - -from twisted.internet import ssl, reactor -from twisted.python import log - -from time import sleep - -class CIMListener(resource.Resource): - """ CIM Listener - """ - - isLeaf = 1 - - class ServerContextFactory(object): - def __init__(self, cert, key): - self.cert = cert - self.key = key - - def getContext(self): - """Create an SSL context with a dodgy certificate.""" - - from OpenSSL import SSL - ctx = SSL.Context(SSL.SSLv23_METHOD) - ctx.use_certificate_file(self.cert) - ctx.use_privatekey_file(self.key) - return ctx - - def __init__(self, callback, - http_port=5988, https_port=5989, - ssl_key=None, ssl_cert=None): - self.callback = callback - self.http_port = http_port - self.https_port = https_port - self.ssl_key = ssl_key - self.ssl_cert = ssl_cert - - site = server.Site(self) - - if self.http_port and self.http_port > 0: - reactor.listenTCP(self.http_port, site) - if self.https_port and self.https_port > 0: - reactor.listenSSL(self.https_port, site, - self.ServerContextFactory(cert=ssl_cert, key=ssl_key)) - - def start(self): - ''' doesn't work''' - thread = threading.Thread(target=reactor.run) - thread.start() - - def stop(self): - reactor.stop() - - def run(self): - reactor.run() - - def render_POST(self, request): - tt = pywbem.parse_cim(pywbem.xml_to_tupletree(request.content.read())) - insts = [x[1] for x in tt[2][2][0][2][2]] - for inst in insts: - self.callback(inst) - return '' - - -#log.startLogging(sys.stdout) - - -rcv_count=0 - -if __name__ == '__main__': - global rcv_count - rcv_count = 0 - - killval = sys.argv[1] - filename = sys.argv[2] - print - print "killval=",killval - - cl=None - - def update_file(): - global rcv_count - fd = open(filename, 'w') - fd.write('%s'%rcv_count) - fd.close - - def cb(inst): - global rcv_count - rcv_count+=1 - update_file() - print inst['IndicationTime'], inst['Description'] - if inst['Description']==killval: - cl.stop() - - update_file() - cl = CIMListener(cb, https_port=None) - cl.run() Modified: cmpi-bindings/trunk/test/python/UpcallAtomTest.py =================================================================== --- cmpi-bindings/trunk/test/python/UpcallAtomTest.py 2008-10-15 16:51:54 UTC (rev 1097) +++ cmpi-bindings/trunk/test/python/UpcallAtomTest.py 2008-10-15 22:58:23 UTC (rev 1098) @@ -11,93 +11,18 @@ import signal import sys +import threading + + conn = None #This test requires the usage of elementtree _g_opts = None _g_args = None -_g_cwd = None - -# start indication support methods -def createFilter( ch, query='select * from CIM_ProcessIndication', - ns='root/interop', - querylang='WQL', - src_ns='root/cimv2', - in_name=None): - name = in_name or 'cimfilter%s'%time.time() - filterinst=pywbem.CIMInstance('CIM_IndicationFilter') - filterinst['CreationClassName']='CIM_IndicationFilter' - filterinst['SystemCreationClassName']='CIM_ComputerSystem' - filterinst['SystemName']=getfqdn() - filterinst['Name']=name - filterinst['Query']=query - filterinst['QueryLanguage']=querylang - filterinst['SourceNamespace']=src_ns - cop = pywbem.CIMInstanceName('CIM_IndicationFilter') - cop.keybindings = { 'CreationClassName':'CIM_IndicationFilter', - 'SystemClassName':'CIM_ComputerSystem', - 'SystemName':getfqdn(), - 'Name':name } - cop.namespace=ns - filterinst.path = cop - filtercop = ch.CreateInstance(filterinst) - return filtercop - -def createDest( ch, destination='http://localhost:5988', - ns='root/interop', - in_name=None): - name = in_name or 'cimlistener%s'%time.time() - destinst=pywbem.CIMInstance('CIM_ListenerDestinationCIMXML') - destinst['CreationClassName']='CIM_ListenerDestinationCIMXML' - destinst['SystemCreationClassName']='CIM_ComputerSystem' - destinst['SystemName']=getfqdn() - destinst['Name']=name - destinst['Destination']=destination - cop = pywbem.CIMInstanceName('CIM_ListenerDestinationCIMXML') - cop.keybindings = { 'CreationClassName':'CIM_ListenerDestinationCIMXML', - 'SystemClassName':'CIM_ComputerSystem', - 'SystemName':getfqdn(), - 'Name':name } - cop.namespace=ns - destinst.path = cop - destcop = ch.CreateInstance(destinst) - return destcop - -def createSubscription(ch, ns='root/interop'): - replace_ns = ch.default_namespace - ch.default_namespace=ns - indfilter=createFilter(ch) - indhandler=createDest(ch) - subinst=pywbem.CIMInstance('CIM_IndicationSubscription') - subinst['Filter']=indfilter - subinst['Handler']=indhandler - cop = pywbem.CIMInstanceName('CIM_IndicationSubscription') - cop.keybindings = { 'Filter':indfilter, - 'Handler':indhandler } - cop.namespace=ns - subinst.path = cop - subcop = ch.CreateInstance(subinst) - ch.default_namespace=replace_ns - return subcop - - -def deleteSubscription(ch, subcop): - indfilter = subcop['Filter'] - indhandler= subcop['Handler'] - ch.DeleteInstance(subcop) - ch.DeleteInstance(indfilter) - ch.DeleteInstance(indhandler) - -# end indication support methods - - - - - ################################################################################ class UpcallAtomTest(unittest.TestCase): @@ -128,50 +53,12 @@ self.assertEquals(rv, 'Success!') self.assertFalse(outs) - def test_b_indications(self): - global _g_cwd - dir=_g_cwd - listenername=dir+'/UpcallAtomIndListener.py' - outputname=dir+'/IndCount.txt' - listenpid=Popen([listenername, "6", outputname]).pid - numrcv = 0 - self.subcop = createSubscription(self.conn) - num_to_send = pywbem.Uint16(7) - time.sleep(1) - self.conn.InvokeMethod('reset_indication_count', 'Test_UpcallAtom') - countsent,outs = self.conn.InvokeMethod('send_indications', 'Test_UpcallAtom', num_to_send=num_to_send) - numsent,outs = self.conn.InvokeMethod('get_indication_send_count', 'Test_UpcallAtom') - deleteSubscription(self.conn, self.subcop) - if (countsent != numsent): - self.fail("send_indications NumSent(%d) doesn't match get_indication_send_count NumSent(%d)"%(countsent, numsent)); - time.sleep(1) - fd=open(outputname, 'r') - countstr=fd.read() - fd.close() - numrcv=int(countstr) - if (numrcv != numsent): - for i in xrange(10): - time.sleep(1) - fd=open(outputname, 'r') - countstr=fd.read() - numrcv=int(countstr) - print "read IndCount: ",numrcv - fd.close() - if (numrcv == numsent): - break; - self.fail("number received(%d) doesn't match number sent(%d)"%(numrcv,numsent)); - os.remove(outputname) - os.kill(listenpid, signal.SIGTERM) - def get_unit_test(): return UpcallAtomTest if __name__ == '__main__': - global _g_cwd - _g_cwd=sys.path[0] - print "Current Working Directory: ",_g_cwd parser = optparse.OptionParser() wbem_connection.getWBEMConnParserOptions(parser) parser.add_option('--verbose', '', action='store_true', default=False, Added: cmpi-bindings/trunk/test/python/deploy.mof =================================================================== --- cmpi-bindings/trunk/test/python/deploy.mof (rev 0) +++ cmpi-bindings/trunk/test/python/deploy.mof 2008-10-15 22:58:23 UTC (rev 1098) @@ -0,0 +1,7 @@ +#pragma namespace("root/cimv2") +#pragma include("TestAssoc.mof") +#pragma include("TestAtom.mof") +#pragma include("TestMethod.mof") +#pragma include("UpcallAtom.mof") +//#pragma include("UpcallAtom-peg.mof") + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <np...@us...> - 2008-10-15 05:48:26
|
Revision: 1096 http://omc.svn.sourceforge.net/omc/?rev=1096&view=rev Author: npaxton Date: 2008-10-15 05:48:20 +0000 (Wed, 15 Oct 2008) Log Message: ----------- get indications working as standalone test... requires new internalIndicationFix.patch Modified Paths: -------------- cmpi-bindings/trunk/test/python/UpcallAtom.sfcb.reg cmpi-bindings/trunk/test/python/UpcallAtomProvider.py cmpi-bindings/trunk/test/python/UpcallAtomTest.py Added Paths: ----------- cmpi-bindings/trunk/test/python/UpcallAtomIndListener.py Modified: cmpi-bindings/trunk/test/python/UpcallAtom.sfcb.reg =================================================================== --- cmpi-bindings/trunk/test/python/UpcallAtom.sfcb.reg 2008-10-14 20:49:31 UTC (rev 1095) +++ cmpi-bindings/trunk/test/python/UpcallAtom.sfcb.reg 2008-10-15 05:48:20 UTC (rev 1096) @@ -9,9 +9,3 @@ location: pyCmpiProvider type: indication namespace: root/cimv2 - -#[UpcallAtom_Indication_Handler] -# provider: UpcallAtomProvider -# location: pyCmpiProvider -# type: instance method -# namespace: root/cimv2 Added: cmpi-bindings/trunk/test/python/UpcallAtomIndListener.py =================================================================== --- cmpi-bindings/trunk/test/python/UpcallAtomIndListener.py (rev 0) +++ cmpi-bindings/trunk/test/python/UpcallAtomIndListener.py 2008-10-15 05:48:20 UTC (rev 1096) @@ -0,0 +1,109 @@ +#!/usr/bin/python +# +# Simple indication receiver using Twisted Python. HTTP post requests +# are listened for on port 5988 and port 5899 using SSL. +# +# Requires Twisted Python and +# + +import sys +from twisted.internet import reactor +from twisted.web import server, resource +import pywbem +import threading +import os + +from twisted.internet import ssl, reactor +from twisted.python import log + +from time import sleep + +class CIMListener(resource.Resource): + """ CIM Listener + """ + + isLeaf = 1 + + class ServerContextFactory(object): + def __init__(self, cert, key): + self.cert = cert + self.key = key + + def getContext(self): + """Create an SSL context with a dodgy certificate.""" + + from OpenSSL import SSL + ctx = SSL.Context(SSL.SSLv23_METHOD) + ctx.use_certificate_file(self.cert) + ctx.use_privatekey_file(self.key) + return ctx + + def __init__(self, callback, + http_port=5988, https_port=5989, + ssl_key=None, ssl_cert=None): + self.callback = callback + self.http_port = http_port + self.https_port = https_port + self.ssl_key = ssl_key + self.ssl_cert = ssl_cert + + site = server.Site(self) + + if self.http_port and self.http_port > 0: + reactor.listenTCP(self.http_port, site) + if self.https_port and self.https_port > 0: + reactor.listenSSL(self.https_port, site, + self.ServerContextFactory(cert=ssl_cert, key=ssl_key)) + + def start(self): + ''' doesn't work''' + thread = threading.Thread(target=reactor.run) + thread.start() + + def stop(self): + reactor.stop() + + def run(self): + reactor.run() + + def render_POST(self, request): + tt = pywbem.parse_cim(pywbem.xml_to_tupletree(request.content.read())) + insts = [x[1] for x in tt[2][2][0][2][2]] + for inst in insts: + self.callback(inst) + return '' + + +#log.startLogging(sys.stdout) + + +rcv_count=0 + +if __name__ == '__main__': + global rcv_count + rcv_count = 0 + + killval = sys.argv[1] + filename = sys.argv[2] + print + print "killval=",killval + + cl=None + + def update_file(): + global rcv_count + fd = open(filename, 'w') + fd.write('%s'%rcv_count) + fd.close + + def cb(inst): + global rcv_count + rcv_count+=1 + update_file() + print inst['IndicationTime'], inst['Description'] + if inst['Description']==killval: + cl.stop() + + update_file() + cl = CIMListener(cb, https_port=None) + cl.run() Property changes on: cmpi-bindings/trunk/test/python/UpcallAtomIndListener.py ___________________________________________________________________ Added: svn:executable + * Modified: cmpi-bindings/trunk/test/python/UpcallAtomProvider.py =================================================================== --- cmpi-bindings/trunk/test/python/UpcallAtomProvider.py 2008-10-14 20:49:31 UTC (rev 1095) +++ cmpi-bindings/trunk/test/python/UpcallAtomProvider.py 2008-10-15 05:48:20 UTC (rev 1096) @@ -24,82 +24,6 @@ logger.log_debug(msg) -# start indication support methods -''' -def _createFilter(ch, query='select * from CIM_ProcessIndication', - ns='root/interop', - querylang='WQL', - src_ns='root/cimv2', - in_name=None): - name = in_name or 'cimfilter%s'%time.time() - filterinst=pywbem.CIMInstance('CIM_IndicationFilter') - filterinst['CreationClassName']='CIM_IndicationFilter' - filterinst['SystemCreationClassName']='CIM_ComputerSystem' - filterinst['SystemName']=getfqdn() - filterinst['Name']=name - filterinst['Query']=query - filterinst['QueryLanguage']=querylang - filterinst['SourceNamespace']=src_ns - cop = pywbem.CIMInstanceName('CIM_IndicationFilter') - cop.keybindings = { 'CreationClassName':'CIM_IndicationFilter', - 'SystemClassName':'CIM_ComputerSystem', - 'SystemName':getfqdn(), - 'Name':name } - cop.namespace=ns - filterinst.path = cop - filtercop = ch.CreateInstance(cop, filterinst) - return filtercop - -def _createDest(ch, destination='http://localhost:5988', - ns='root/interop', - in_name=None): - name = in_name or 'cimlistener%s'%time.time() - destinst=pywbem.CIMInstance('CIM_ListenerDestinationCIMXML') - destinst['CreationClassName']='CIM_ListenerDestinationCIMXML' - destinst['SystemCreationClassName']='CIM_ComputerSystem' - destinst['SystemName']=getfqdn() - print "destname=",name - destinst['Name']=name - destinst['Destination']=destination - cop = pywbem.CIMInstanceName('CIM_ListenerDestinationCIMXML') - cop.keybindings = { 'CreationClassName':'CIM_ListenerDestinationCIMXML', - 'SystemClassName':'CIM_ComputerSystem', - 'SystemName':getfqdn(), - 'Name':name } - cop.namespace=ns - destinst.path = cop - destcop = ch.CreateInstance(cop, destinst) - return destcop - -def _createSubscription(ch, ns='root/interop'): - replace_ns = ch.default_namespace - ch.default_namespace=ns - indfilter=_createFilter(ch) - indhandler=_createDest(ch) - subinst=pywbem.CIMInstance('CIM_IndicationSubscription') - subinst['Filter']=indfilter - subinst['Handler']=indhandler - cop = pywbem.CIMInstanceName('CIM_IndicationSubscription') - cop.keybindings = { 'Filter':indfilter, - 'Handler':indhandler } - cop.namespace=ns - subinst.path = cop - subcop = ch.CreateInstance(cop, subinst) - ch.default_namespace=replace_ns - return subcop - - -def _deleteSubscription(ch, subcop): - indfilter = subcop['Filter'] - indhandler= subcop['Handler'] - ch.DeleteInstance(subcop) - ch.DeleteInstance(indfilter) - ch.DeleteInstance(indhandler) -''' -# end indication support methods - - - ################################################################################ _atoms = {'Hydrogen': 1, Modified: cmpi-bindings/trunk/test/python/UpcallAtomTest.py =================================================================== --- cmpi-bindings/trunk/test/python/UpcallAtomTest.py 2008-10-14 20:49:31 UTC (rev 1095) +++ cmpi-bindings/trunk/test/python/UpcallAtomTest.py 2008-10-15 05:48:20 UTC (rev 1096) @@ -7,17 +7,21 @@ import os import time from socket import getfqdn +from subprocess import Popen +import signal +import sys + conn = None #This test requires the usage of elementtree _g_opts = None _g_args = None +_g_cwd = None - # start indication support methods def createFilter( ch, query='select * from CIM_ProcessIndication', ns='root/interop', @@ -119,25 +123,45 @@ else: print('') - ''' def test_a_upcalls_all(self): rv,outs = self.conn.InvokeMethod('test_all_upcalls', 'Test_UpcallAtom') self.assertEquals(rv, 'Success!') self.assertFalse(outs) - ''' def test_b_indications(self): + global _g_cwd + dir=_g_cwd + listenername=dir+'/UpcallAtomIndListener.py' + outputname=dir+'/IndCount.txt' + listenpid=Popen([listenername, "6", outputname]).pid numrcv = 0 self.subcop = createSubscription(self.conn) num_to_send = pywbem.Uint16(7) + time.sleep(1) self.conn.InvokeMethod('reset_indication_count', 'Test_UpcallAtom') countsent,outs = self.conn.InvokeMethod('send_indications', 'Test_UpcallAtom', num_to_send=num_to_send) numsent,outs = self.conn.InvokeMethod('get_indication_send_count', 'Test_UpcallAtom') deleteSubscription(self.conn, self.subcop) if (countsent != numsent): self.fail("send_indications NumSent(%d) doesn't match get_indication_send_count NumSent(%d)"%(countsent, numsent)); + time.sleep(1) + fd=open(outputname, 'r') + countstr=fd.read() + fd.close() + numrcv=int(countstr) if (numrcv != numsent): + for i in xrange(10): + time.sleep(1) + fd=open(outputname, 'r') + countstr=fd.read() + numrcv=int(countstr) + print "read IndCount: ",numrcv + fd.close() + if (numrcv == numsent): + break; self.fail("number received(%d) doesn't match number sent(%d)"%(numrcv,numsent)); + os.remove(outputname) + os.kill(listenpid, signal.SIGTERM) def get_unit_test(): @@ -145,6 +169,9 @@ if __name__ == '__main__': + global _g_cwd + _g_cwd=sys.path[0] + print "Current Working Directory: ",_g_cwd parser = optparse.OptionParser() wbem_connection.getWBEMConnParserOptions(parser) parser.add_option('--verbose', '', action='store_true', default=False, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <np...@us...> - 2008-10-14 20:49:39
|
Revision: 1095 http://omc.svn.sourceforge.net/omc/?rev=1095&view=rev Author: npaxton Date: 2008-10-14 20:49:31 +0000 (Tue, 14 Oct 2008) Log Message: ----------- pull indication helper functions outside of class for independent use Modified Paths: -------------- cmpi-bindings/trunk/test/python/UpcallAtomTest.py Modified: cmpi-bindings/trunk/test/python/UpcallAtomTest.py =================================================================== --- cmpi-bindings/trunk/test/python/UpcallAtomTest.py 2008-10-14 20:29:02 UTC (rev 1094) +++ cmpi-bindings/trunk/test/python/UpcallAtomTest.py 2008-10-14 20:49:31 UTC (rev 1095) @@ -15,89 +15,91 @@ _g_opts = None _g_args = None -################################################################################ -class UpcallAtomTest(unittest.TestCase): - global conn +# start indication support methods +def createFilter( ch, query='select * from CIM_ProcessIndication', + ns='root/interop', + querylang='WQL', + src_ns='root/cimv2', + in_name=None): + name = in_name or 'cimfilter%s'%time.time() + filterinst=pywbem.CIMInstance('CIM_IndicationFilter') + filterinst['CreationClassName']='CIM_IndicationFilter' + filterinst['SystemCreationClassName']='CIM_ComputerSystem' + filterinst['SystemName']=getfqdn() + filterinst['Name']=name + filterinst['Query']=query + filterinst['QueryLanguage']=querylang + filterinst['SourceNamespace']=src_ns + cop = pywbem.CIMInstanceName('CIM_IndicationFilter') + cop.keybindings = { 'CreationClassName':'CIM_IndicationFilter', + 'SystemClassName':'CIM_ComputerSystem', + 'SystemName':getfqdn(), + 'Name':name } + cop.namespace=ns + filterinst.path = cop + filtercop = ch.CreateInstance(filterinst) + return filtercop - # start indication support methods - def _createFilter(self, - ch, query='select * from CIM_ProcessIndication', - ns='root/interop', - querylang='WQL', - src_ns='root/cimv2', - in_name=None): - name = in_name or 'cimfilter%s'%time.time() - filterinst=pywbem.CIMInstance('CIM_IndicationFilter') - filterinst['CreationClassName']='CIM_IndicationFilter' - filterinst['SystemCreationClassName']='CIM_ComputerSystem' - filterinst['SystemName']=getfqdn() - filterinst['Name']=name - filterinst['Query']=query - filterinst['QueryLanguage']=querylang - filterinst['SourceNamespace']=src_ns - cop = pywbem.CIMInstanceName('CIM_IndicationFilter') - cop.keybindings = { 'CreationClassName':'CIM_IndicationFilter', - 'SystemClassName':'CIM_ComputerSystem', - 'SystemName':getfqdn(), - 'Name':name } - cop.namespace=ns - filterinst.path = cop - filtercop = ch.CreateInstance(filterinst) - return filtercop +def createDest( ch, destination='http://localhost:5988', + ns='root/interop', + in_name=None): + name = in_name or 'cimlistener%s'%time.time() + destinst=pywbem.CIMInstance('CIM_ListenerDestinationCIMXML') + destinst['CreationClassName']='CIM_ListenerDestinationCIMXML' + destinst['SystemCreationClassName']='CIM_ComputerSystem' + destinst['SystemName']=getfqdn() + destinst['Name']=name + destinst['Destination']=destination + cop = pywbem.CIMInstanceName('CIM_ListenerDestinationCIMXML') + cop.keybindings = { 'CreationClassName':'CIM_ListenerDestinationCIMXML', + 'SystemClassName':'CIM_ComputerSystem', + 'SystemName':getfqdn(), + 'Name':name } + cop.namespace=ns + destinst.path = cop + destcop = ch.CreateInstance(destinst) + return destcop - def _createDest(self, - ch, destination='http://localhost:5988', - ns='root/interop', - in_name=None): - name = in_name or 'cimlistener%s'%time.time() - destinst=pywbem.CIMInstance('CIM_ListenerDestinationCIMXML') - destinst['CreationClassName']='CIM_ListenerDestinationCIMXML' - destinst['SystemCreationClassName']='CIM_ComputerSystem' - destinst['SystemName']=getfqdn() - destinst['Name']=name - destinst['Destination']=destination - cop = pywbem.CIMInstanceName('CIM_ListenerDestinationCIMXML') - cop.keybindings = { 'CreationClassName':'CIM_ListenerDestinationCIMXML', - 'SystemClassName':'CIM_ComputerSystem', - 'SystemName':getfqdn(), - 'Name':name } - cop.namespace=ns - destinst.path = cop - destcop = ch.CreateInstance(destinst) - return destcop +def createSubscription(ch, ns='root/interop'): + replace_ns = ch.default_namespace + ch.default_namespace=ns + indfilter=createFilter(ch) + indhandler=createDest(ch) + subinst=pywbem.CIMInstance('CIM_IndicationSubscription') + subinst['Filter']=indfilter + subinst['Handler']=indhandler + cop = pywbem.CIMInstanceName('CIM_IndicationSubscription') + cop.keybindings = { 'Filter':indfilter, + 'Handler':indhandler } + cop.namespace=ns + subinst.path = cop + subcop = ch.CreateInstance(subinst) + ch.default_namespace=replace_ns + return subcop - def _createSubscription(self, ch, ns='root/interop'): - replace_ns = ch.default_namespace - ch.default_namespace=ns - indfilter=self._createFilter(ch) - indhandler=self._createDest(ch) - subinst=pywbem.CIMInstance('CIM_IndicationSubscription') - subinst['Filter']=indfilter - subinst['Handler']=indhandler - cop = pywbem.CIMInstanceName('CIM_IndicationSubscription') - cop.keybindings = { 'Filter':indfilter, - 'Handler':indhandler } - cop.namespace=ns - subinst.path = cop - subcop = ch.CreateInstance(subinst) - ch.default_namespace=replace_ns - return subcop +def deleteSubscription(ch, subcop): + indfilter = subcop['Filter'] + indhandler= subcop['Handler'] + ch.DeleteInstance(subcop) + ch.DeleteInstance(indfilter) + ch.DeleteInstance(indhandler) - def _deleteSubscription(self, ch, subcop): - indfilter = subcop['Filter'] - indhandler= subcop['Handler'] - ch.DeleteInstance(subcop) - ch.DeleteInstance(indfilter) - ch.DeleteInstance(indhandler) +# end indication support methods - # end indication support methods + +################################################################################ +class UpcallAtomTest(unittest.TestCase): + + global conn + + def setUp(self): unittest.TestCase.setUp(self) self.conn = conn @@ -116,20 +118,22 @@ print('\t -- %s --' % msg) else: print('') - + + ''' def test_a_upcalls_all(self): rv,outs = self.conn.InvokeMethod('test_all_upcalls', 'Test_UpcallAtom') self.assertEquals(rv, 'Success!') self.assertFalse(outs) + ''' def test_b_indications(self): numrcv = 0 - self.subcop = self._createSubscription(self.conn) + self.subcop = createSubscription(self.conn) num_to_send = pywbem.Uint16(7) self.conn.InvokeMethod('reset_indication_count', 'Test_UpcallAtom') countsent,outs = self.conn.InvokeMethod('send_indications', 'Test_UpcallAtom', num_to_send=num_to_send) numsent,outs = self.conn.InvokeMethod('get_indication_send_count', 'Test_UpcallAtom') - self._deleteSubscription(self.conn, self.subcop) + deleteSubscription(self.conn, self.subcop) if (countsent != numsent): self.fail("send_indications NumSent(%d) doesn't match get_indication_send_count NumSent(%d)"%(countsent, numsent)); if (numrcv != numsent): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <np...@us...> - 2008-10-14 20:29:09
|
Revision: 1094 http://omc.svn.sourceforge.net/omc/?rev=1094&view=rev Author: npaxton Date: 2008-10-14 20:29:02 +0000 (Tue, 14 Oct 2008) Log Message: ----------- fix some cut-n-paste problems in Associators and References (inst->instname) Modified Paths: -------------- cmpi-bindings/trunk/swig/python/cmpi_pywbem_bindings.py Modified: cmpi-bindings/trunk/swig/python/cmpi_pywbem_bindings.py =================================================================== --- cmpi-bindings/trunk/swig/python/cmpi_pywbem_bindings.py 2008-10-14 20:22:11 UTC (rev 1093) +++ cmpi-bindings/trunk/swig/python/cmpi_pywbem_bindings.py 2008-10-14 20:29:02 UTC (rev 1094) @@ -275,7 +275,7 @@ while e and e.hasNext(): data = e.next() assert(data.type == cmpi.CMPI_ref) - piname=self.proxy.cmpi2pywbem_inst(data.value.ref) + piname=self.proxy.cmpi2pywbem_instname(data.value.ref) yield piname def References(self, path, resultClass=None, role=None, props=None): @@ -294,7 +294,7 @@ while e and e.hasNext(): data = e.next() assert(data.type == cmpi.CMPI_ref) - piname=self.proxy.cmpi2pywbem_inst(data.value.ref) + piname=self.proxy.cmpi2pywbem_instname(data.value.ref) yield piname def InvokeMethod(self, path, method, **params): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-10-14 20:22:16
|
Revision: 1093 http://omc.svn.sourceforge.net/omc/?rev=1093&view=rev Author: bartw Date: 2008-10-14 20:22:11 +0000 (Tue, 14 Oct 2008) Log Message: ----------- prime key values Modified Paths: -------------- pybase/trunk/OMC_UnixProcess.py Modified: pybase/trunk/OMC_UnixProcess.py =================================================================== --- pybase/trunk/OMC_UnixProcess.py 2008-10-14 19:23:22 UTC (rev 1092) +++ pybase/trunk/OMC_UnixProcess.py 2008-10-14 20:22:11 UTC (rev 1093) @@ -521,7 +521,7 @@ except: pass ''' - ux(ElementName= model['Name']) + ux(ElementName= pname) ux(HealthState= pywbem.Uint16(0)) ux(OperationalStatus= [pywbem.Uint16(0)]) return model @@ -769,6 +769,7 @@ logger = env.get_logger() logger.log_debug('Entering %s.enum_instances()' \ % self.__class__.__name__) + model.path.update(PartComponent=None, GroupComponent=None) for lp in LinuxProcess.procs(): model['PartComponent'] = lp.get_instance_name( model.path.namespace) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <np...@us...> - 2008-10-14 19:23:27
|
Revision: 1092 http://omc.svn.sourceforge.net/omc/?rev=1092&view=rev Author: npaxton Date: 2008-10-14 19:23:22 +0000 (Tue, 14 Oct 2008) Log Message: ----------- Further work on standalone indications test Modified Paths: -------------- cmpi-bindings/trunk/test/python/UpcallAtom.mof cmpi-bindings/trunk/test/python/UpcallAtom.sfcb.reg cmpi-bindings/trunk/test/python/UpcallAtomProvider.py cmpi-bindings/trunk/test/python/UpcallAtomTest.py Modified: cmpi-bindings/trunk/test/python/UpcallAtom.mof =================================================================== --- cmpi-bindings/trunk/test/python/UpcallAtom.mof 2008-10-14 18:13:58 UTC (rev 1091) +++ cmpi-bindings/trunk/test/python/UpcallAtom.mof 2008-10-14 19:23:22 UTC (rev 1092) @@ -8,6 +8,8 @@ ); [Description("Send an export_indication")] uint16 send_indications( + // number of indications to send + [in] uint16 num_to_send //return number of indications sent ); [Description("Reset indication count")] @@ -19,46 +21,9 @@ // return number of indications sent since last reset ); }; + + [ Indication ] class UpcallAtom_Indication : CIM_ProcessIndication { }; -//class UpcallAtom_Indication_Handler : CIM_ListenerDestination -//{ -//}; - - - - - - -// Filter Instance -//INSTANCE OF CIM_IndicationFilter as $filter -//{ -// SystemCreationClassName = "OMC_UnitaryComputerSystem"; -// SystemName = "127.0.0.1"; -// CreationClassName = "CIM_IndicationFilter"; -// Name = "/UpcallAtom_Indication_Handler"; -// SourceNamespace = "root/cimv2"; -// Query = "select * from UpcallAtom_Indication"; -// QueryLanguage = "wql1"; -//}; - -// Listener Destination Instance -//INSTANCE OF UpcallAtom_Indication_Handler as $dest -//{ -// SystemCreationClassName = "Linux_ComputerSystem"; -// SystemName = "npaxton1.provo.novell.com"; -// CreationClassName = "UpcallAtom_Indication_Handler"; -// Name = "/UpcallAtom_Indication_Handler"; -//}; - -// Subscription Instance Tie together the indication filter -// and the indication handler -//INSTANCE OF CIM_IndicationSubscription -//{ -// Filter=$filter; -// Handler=$dest; -// AlertOnStateChange=false; -//}; - Modified: cmpi-bindings/trunk/test/python/UpcallAtom.sfcb.reg =================================================================== --- cmpi-bindings/trunk/test/python/UpcallAtom.sfcb.reg 2008-10-14 18:13:58 UTC (rev 1091) +++ cmpi-bindings/trunk/test/python/UpcallAtom.sfcb.reg 2008-10-14 19:23:22 UTC (rev 1092) @@ -1,8 +1,8 @@ [Test_UpcallAtom] provider: UpcallAtomProvider location: pyCmpiProvider - type: method indication - namespace: root/cimv2 root/interop + type: method + namespace: root/cimv2 [UpcallAtom_Indication] provider: UpcallAtomProvider Modified: cmpi-bindings/trunk/test/python/UpcallAtomProvider.py =================================================================== --- cmpi-bindings/trunk/test/python/UpcallAtomProvider.py 2008-10-14 18:13:58 UTC (rev 1091) +++ cmpi-bindings/trunk/test/python/UpcallAtomProvider.py 2008-10-14 19:23:22 UTC (rev 1092) @@ -17,14 +17,7 @@ _inst_paths = [] _indication_count = 0 -_indication_names = { "jon": False, - "norm": False, - "matt": False, - "bart": False, - "kenny": False, - "brad": False } - def log_debug(msg, logger=None): print msg if logger is not None: @@ -32,7 +25,7 @@ # start indication support methods - +''' def _createFilter(ch, query='select * from CIM_ProcessIndication', ns='root/interop', querylang='WQL', @@ -102,7 +95,7 @@ ch.DeleteInstance(subcop) ch.DeleteInstance(indfilter) ch.DeleteInstance(indhandler) - +''' # end indication support methods @@ -417,6 +410,32 @@ # raise pywbem.CIM_ERR_ACCESS_DENIED return + + +############################################################################## +def enable_indications(env): + """Enable indications. + Arguments: + env -- Provider Environment (pycimmb.ProviderEnvironment) + """ + + logger = env.get_logger() + logger.log_debug('Entering enable_indications()' ) + #just fall through for success + + +############################################################################## +def disable_indications(env): + """Disable indications. + Arguments: + env -- Provider Environment (pycimmb.ProviderEnvironment) + """ + + logger = env.get_logger() + logger.log_debug('Entering disable_indications()' ) + #just fall through for success + + ################################################################################ class UpcallAtomProvider(CIMProvider2): """Instrument the CIM class UpcallAtom @@ -826,74 +845,92 @@ rval = "Success!" # TODO (type pywbem.Sint32) return (rval, out_params) + + +################################################################################ +#### INDICATION TEST METHODS +################################################################################ + def cim_method_reset_indication_count(self, env, object_name): + global _indication_count _indication_count = 0 - return (pywbem.Uint16(0), {}) + rval = pywbem.Uint16(_indication_count) + return (rval, {}) + +################################################################################ def cim_method_get_indication_send_count(self, env, object_name): + global _indication_count rval = pywbem.Uint16(_indication_count) return (rval, {}) - def cim_method_send_indications(self, env, object_name): +################################################################################ + def cim_method_send_indications(self, env, object_name, param_num_to_send): """ Method to test the upcalls to the cimom handle for DeliverIndications. return number of indications sent """ + global _indication_count + subcop=None + ch = env.get_cimom_handle() + ch.default_namespace = "root/cimv2" + logger = env.get_logger() + cur_ind_count = 0 + try: - try: - global _indication_names,_indication_count + + alert_ind = pywbem.CIMInstance("UpcallAtom_Indication") + alert_ind['AlertType'] = pywbem.Uint16(2) + alert_ind['PerceivedSeverity'] = pywbem.Uint16(1) + alert_ind['ProbableCause'] = pywbem.Uint16(1) + alert_ind['SystemName'] = socket.getfqdn() + + for x in xrange(param_num_to_send): cimtime = pywbem.CIMDateTime.now() - ch = env.get_cimom_handle() - ch.default_namespace = "root/cimv2" - logger = env.get_logger() + alert_ind['Description'] = "%s"%x + alert_ind['IndicationTime'] = cimtime + + try: + print '### Exporting indication. pid:',os.getpid() + ch.DeliverIndication(ch.default_namespace, alert_ind) + print '### Done exporting indication' + _indication_count += 1 + cur_ind_count += 1 + except pywbem.CIMError, arg: + print '### Caught exception exporting indication' + raise + except: + raise - subcop=_createSubscription(ch) + out_params = {} + rval = pywbem.Uint16(cur_ind_count) + return (rval, out_params) - for name in _indication_names: - alert_ind = pywbem.CIMInstance("UpcallAtom_Indication") - alert_ind['AlertType'] = pywbem.Uint16(2) - alert_ind['Description'] = name - alert_ind['PerceivedSeverity'] = pywbem.Uint16(1) - alert_ind['PorbablyCause'] = pywbem.Uint16(1) - alert_ind['IndicationTime'] = cimtime - alert_ind['SystemName'] = socket.getfqdn() - - try: - print '### Exporting indication. pid:',os.getpid() - ch.DeliverIndication(ch.default_namespace, alert_ind) - print '### Done exporting indication' - except pywbem.CIMError, arg: - print '### Caught exception exporting indication' - raise +## end of class UpcallAtomProvider - indcount = len(_indication_names) - ''' - st = time.time() - while _indication_count < indcount: - time.sleep(.01) - if (time.time() - st) > 10.00: - raise "Only received %d. expected %d" % (_indication_count, indcount) - for name,received in _indication_names.items(): - if not received: - raise "Indication Not received for: %s" % str(name) - ''' - except: - raise - finally: - if subcop is not None: - _deleteSubscription(ch, subcop) +################################################################################ +class UpcallAtomIndicationProvider(CIMProvider2): + """Instrument the CIM class UpcallAtom - out_params = {} - rval = pywbem.Uint16(indcount) - return (rval, out_params) + Testing up-calls into the CIMOM from a provider + + """ + def __init__ (self, env): + print '#### UpcallAtomProvider CTOR' + logger = env.get_logger() + log_debug('Initializing provider %s from %s' \ + % (self.__class__.__name__, __file__), logger) -## end of class UpcallAtomProvider +## end of class UpcallAtomIndicationProvider + def get_providers(env): upcallatom_prov = UpcallAtomProvider(env) - return {'Test_UpcallAtom': upcallatom_prov} + upcallatom_ind_prov = UpcallAtomIndicationProvider(env) + return {'Test_UpcallAtom': upcallatom_prov, \ + 'UpcallAtom_Indication':upcallatom_ind_prov } Modified: cmpi-bindings/trunk/test/python/UpcallAtomTest.py =================================================================== --- cmpi-bindings/trunk/test/python/UpcallAtomTest.py 2008-10-14 18:13:58 UTC (rev 1091) +++ cmpi-bindings/trunk/test/python/UpcallAtomTest.py 2008-10-14 19:23:22 UTC (rev 1092) @@ -5,6 +5,8 @@ import unittest import optparse import os +import time +from socket import getfqdn conn = None @@ -18,6 +20,84 @@ global conn + + + # start indication support methods + def _createFilter(self, + ch, query='select * from CIM_ProcessIndication', + ns='root/interop', + querylang='WQL', + src_ns='root/cimv2', + in_name=None): + name = in_name or 'cimfilter%s'%time.time() + filterinst=pywbem.CIMInstance('CIM_IndicationFilter') + filterinst['CreationClassName']='CIM_IndicationFilter' + filterinst['SystemCreationClassName']='CIM_ComputerSystem' + filterinst['SystemName']=getfqdn() + filterinst['Name']=name + filterinst['Query']=query + filterinst['QueryLanguage']=querylang + filterinst['SourceNamespace']=src_ns + cop = pywbem.CIMInstanceName('CIM_IndicationFilter') + cop.keybindings = { 'CreationClassName':'CIM_IndicationFilter', + 'SystemClassName':'CIM_ComputerSystem', + 'SystemName':getfqdn(), + 'Name':name } + cop.namespace=ns + filterinst.path = cop + filtercop = ch.CreateInstance(filterinst) + return filtercop + + def _createDest(self, + ch, destination='http://localhost:5988', + ns='root/interop', + in_name=None): + name = in_name or 'cimlistener%s'%time.time() + destinst=pywbem.CIMInstance('CIM_ListenerDestinationCIMXML') + destinst['CreationClassName']='CIM_ListenerDestinationCIMXML' + destinst['SystemCreationClassName']='CIM_ComputerSystem' + destinst['SystemName']=getfqdn() + destinst['Name']=name + destinst['Destination']=destination + cop = pywbem.CIMInstanceName('CIM_ListenerDestinationCIMXML') + cop.keybindings = { 'CreationClassName':'CIM_ListenerDestinationCIMXML', + 'SystemClassName':'CIM_ComputerSystem', + 'SystemName':getfqdn(), + 'Name':name } + cop.namespace=ns + destinst.path = cop + destcop = ch.CreateInstance(destinst) + return destcop + + def _createSubscription(self, ch, ns='root/interop'): + replace_ns = ch.default_namespace + ch.default_namespace=ns + indfilter=self._createFilter(ch) + indhandler=self._createDest(ch) + subinst=pywbem.CIMInstance('CIM_IndicationSubscription') + subinst['Filter']=indfilter + subinst['Handler']=indhandler + cop = pywbem.CIMInstanceName('CIM_IndicationSubscription') + cop.keybindings = { 'Filter':indfilter, + 'Handler':indhandler } + cop.namespace=ns + subinst.path = cop + subcop = ch.CreateInstance(subinst) + ch.default_namespace=replace_ns + return subcop + + + def _deleteSubscription(self, ch, subcop): + indfilter = subcop['Filter'] + indhandler= subcop['Handler'] + ch.DeleteInstance(subcop) + ch.DeleteInstance(indfilter) + ch.DeleteInstance(indhandler) + + # end indication support methods + + + def setUp(self): unittest.TestCase.setUp(self) self.conn = conn @@ -25,6 +105,7 @@ self._verbose = _g_opts.verbose self._dbgPrint() + def tearDown(self): unittest.TestCase.tearDown(self) @@ -43,11 +124,16 @@ def test_b_indications(self): numrcv = 0 + self.subcop = self._createSubscription(self.conn) + num_to_send = pywbem.Uint16(7) self.conn.InvokeMethod('reset_indication_count', 'Test_UpcallAtom') - countsent,outs = self.conn.InvokeMethod('send_indications', 'Test_UpcallAtom') + countsent,outs = self.conn.InvokeMethod('send_indications', 'Test_UpcallAtom', num_to_send=num_to_send) numsent,outs = self.conn.InvokeMethod('get_indication_send_count', 'Test_UpcallAtom') - self.assertEqual(countsent, numsent) - self.assertEqual(numrcv, numsent) + self._deleteSubscription(self.conn, self.subcop) + if (countsent != numsent): + self.fail("send_indications NumSent(%d) doesn't match get_indication_send_count NumSent(%d)"%(countsent, numsent)); + if (numrcv != numsent): + self.fail("number received(%d) doesn't match number sent(%d)"%(numrcv,numsent)); def get_unit_test(): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mgf...@us...> - 2008-10-14 18:14:03
|
Revision: 1091 http://omc.svn.sourceforge.net/omc/?rev=1091&view=rev Author: mgfritch Date: 2008-10-14 18:13:58 +0000 (Tue, 14 Oct 2008) Log Message: ----------- - Added obsoletes tag on old VM Builder packages Modified Paths: -------------- contrib/xen-vm-builder/trunk/sblim-cmpi-xenvm-builder.spec Modified: contrib/xen-vm-builder/trunk/sblim-cmpi-xenvm-builder.spec =================================================================== --- contrib/xen-vm-builder/trunk/sblim-cmpi-xenvm-builder.spec 2008-10-14 00:10:53 UTC (rev 1090) +++ contrib/xen-vm-builder/trunk/sblim-cmpi-xenvm-builder.spec 2008-10-14 18:13:58 UTC (rev 1091) @@ -28,6 +28,7 @@ # setting it to "no" AutoReqProv: yes Requires: sblim-sfcb cim-schema sblim-cmpiutil sblim-cmpi-base xen-tools +Obsoletes: novell-zenworks-vmbuilder-cimproviders novell-zenworks-vmbuilder-cli novell-zenworks-vmbuilder-zosjob Source0: %{tarname}-%{version}.tar.gz #Source1: %{tarname}-mof.tar.bz2 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <np...@us...> - 2008-10-14 00:11:00
|
Revision: 1090 http://omc.svn.sourceforge.net/omc/?rev=1090&view=rev Author: npaxton Date: 2008-10-14 00:10:53 +0000 (Tue, 14 Oct 2008) Log Message: ----------- converting test to client script Modified Paths: -------------- cmpi-bindings/trunk/test/python/UpcallAtom.mof cmpi-bindings/trunk/test/python/UpcallAtomProvider.py Added Paths: ----------- cmpi-bindings/trunk/test/python/UpcallAtomTest.py Modified: cmpi-bindings/trunk/test/python/UpcallAtom.mof =================================================================== --- cmpi-bindings/trunk/test/python/UpcallAtom.mof 2008-10-13 20:22:56 UTC (rev 1089) +++ cmpi-bindings/trunk/test/python/UpcallAtom.mof 2008-10-14 00:10:53 UTC (rev 1090) @@ -2,8 +2,8 @@ class Test_UpcallAtom { - [Description("Kickoff the method provider test")] - string starttest( + [Description("Kickoff the upcall test")] + string test_all_upcalls( //return a string array of log messages ); [Description("Send an export_indication")] Modified: cmpi-bindings/trunk/test/python/UpcallAtomProvider.py =================================================================== --- cmpi-bindings/trunk/test/python/UpcallAtomProvider.py 2008-10-13 20:22:56 UTC (rev 1089) +++ cmpi-bindings/trunk/test/python/UpcallAtomProvider.py 2008-10-14 00:10:53 UTC (rev 1090) @@ -25,7 +25,12 @@ "brad": False } +def log_debug(msg, logger=None): + print msg + if logger is not None: + logger.log_debug(msg) + # start indication support methods def _createFilter(ch, query='select * from CIM_ProcessIndication', @@ -52,7 +57,7 @@ filtercop = ch.CreateInstance(cop, filterinst) return filtercop -def _createDest(ch, destination='http://localhost:5998', +def _createDest(ch, destination='http://localhost:5988', ns='root/interop', in_name=None): name = in_name or 'cimlistener%s'%time.time() @@ -158,18 +163,18 @@ #Date Property elif prop == 'dateprop': if str(instance[prop]) != str(time): - logger.log_debug("DateProp NOT EQUAL") + log_debug("DateProp NOT EQUAL", logger) return false #Name or stringProp elif prop == 'name' or prop == 'stringprop': if instance['name'] not in _atoms or \ instance['stringProp'] not in _atoms: - logger.log_debug("Atom name NOT FOUND: %s" & instance['name']) + log_debug("Atom name NOT FOUND: %s" & instance['name'], logger) return false #boolProp elif prop == 'boolprop': if instance[prop] != False: - logger.log_debug("False NOT EQUAL False") + log_debug("False NOT EQUAL False", logger) return false #All values not in lists elif (instance.properties[prop].type == types.get(prop)) and \ @@ -177,10 +182,10 @@ type(instance.properties[prop].value) != type([]): if prop == 'uint8prop': if pywbem.Uint8(atoms_value) != instance[prop]: - logger.log_debug("%s Error: %s" % (prop, instance[prop])) + log_debug("%s Error: %s" % (prop, instance[prop]), logger) return false elif atoms_value != value: - logger.log_debug("%s == %s"%(atoms_value,value)) + log_debug("%s == %s"%(atoms_value,value), logger) return false #All list values elif type(instance.properties[prop].value) == type([]) and \ @@ -188,18 +193,18 @@ if prop == 'stringpropa': if value[0] != 'proton' and value[1] != 'electron' \ and value[2] != 'neutron': - logger.log_debug("String Array NOT EQUAL") + log_debug("String Array NOT EQUAL", logger) return false elif prop == 'uint8': for val in instance.properties[prop].value: if pywbem.uint8(atoms_value) != val: - logger.log_debug("Uint8 Values NOT EQUAL") + log_debug("Uint8 Values NOT EQUAL", logger) return false else: for a_prop in instance.properties[prop].value: if a_prop != atoms_value: - logger.log_debug("%s NOT EQUAL %s" % (atoms_value\ - , value)) + log_debug("%s NOT EQUAL %s" % (atoms_value\ + , value), logger) return false else: print '!! instance.properties[prop].type:', str(instance.properties[prop].type) @@ -207,10 +212,10 @@ print '!! type(instance.properties[prop].value):', str(type(instance.properties[prop].value)) print "!! prop:",prop print "!! Test Atom %s NOT EQUAL %s" % (atoms_value, value) - logger.log_debug("%s NOT EQUAL %s" % (atoms_value, value)) + log_debug("%s NOT EQUAL %s" % (atoms_value, value), logger) return False else: - logger.log_debug("Instance of TestAtom not Found: %s" % (instance['Name'])) + log_debug("Instance of TestAtom not Found: %s" % (instance['Name']), logger) return false return True @@ -365,10 +370,10 @@ print '#### Python firstActivation: %d' % firstActivation logger = env.get_logger() - logger.log_debug('#### Python activate_filter called. filter: %s' % filter) - logger.log_debug('#### Python firstActivation: %d' % firstActivation) + log_debug('#### Python activate_filter called. filter: %s' % filter, logger) + log_debug('#### Python firstActivation: %d' % firstActivation, logger) if firstActivation: # and not theIndicationThread - logger.log_debug('#### Got first activation') + log_debug('#### Got first activation', logger) # do thread setup here # theIndicationThread = MainMonitorThread(...) # theIndicationThread.start() @@ -387,10 +392,10 @@ print '#### Python lastActivation: %d' % lastActivation logger = env.get_logger() - logger.log_debug('#### Python deactivate_filter called. filter: %s' % filter) - logger.log_debug('#### Python lastActivation: %d' % lastActivation) + log_debug('#### Python deactivate_filter called. filter: %s' % filter, logger) + log_debug('#### Python lastActivation: %d' % lastActivation, logger) if lastActivation == 1: # and theIndicationThread - logger.log_debug('#### Got last deactivation') + log_debug('#### Got last deactivation', logger) # do thread teardown here # theIndicationThread.shutdown() # theIndicationThread = None @@ -406,8 +411,8 @@ print '#### Python authorize_filter called. filter: %s' % filter print '#### Python authorize_filter owner: %s' % owner logger = env.get_logger() - logger.log_debug('#### Python authorize_filter called. filter: %s' % filter) - logger.log_debug('#### Python authorize_filter owner: %s' % owner) + log_debug('#### Python authorize_filter called. filter: %s' % filter, logger) + log_debug('#### Python authorize_filter owner: %s' % owner, logger) # if not authorized # raise pywbem.CIM_ERR_ACCESS_DENIED return @@ -423,22 +428,22 @@ def __init__ (self, env): print '#### UpcallAtomProvider CTOR' logger = env.get_logger() - logger.log_debug('Initializing provider %s from %s' \ - % (self.__class__.__name__, __file__)) + log_debug('Initializing provider %s from %s' \ + % (self.__class__.__name__, __file__), logger) # If you will be filtering instances yourself according to # property_list, role, result_role, and result_class_name # parameters, set self.filter_results to False # self.filter_results = False - def cim_method_starttest(self, env, object_name): - """Implements UpcallAtom.starttest() + def cim_method_test_all_upcalls(self, env, object_name): + """Implements UpcallAtom.test_all_upcalls() Kickoff the method provider test Keyword arguments: env -- Provider Environment (pycimmb.ProviderEnvironment) object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName - specifying the object on which the method starttest() + specifying the object on which the method test_all_upcalls() should be invoked. method -- A pywbem.CIMMethod representing the method meta-data @@ -466,8 +471,8 @@ ch = env.get_cimom_handle() ch.default_namespace = "root/cimv2" logger = env.get_logger() - logger.log_debug('Entering %s.cim_method_starttest()' \ - % self.__class__.__name__) + log_debug('Entering %s.cim_method_test_all_upcalls()' \ + % self.__class__.__name__, logger) # ch methods =['AssociatorNames', 'Associators', 'References', 'ReferenceNames' @@ -475,7 +480,7 @@ # 'EnumerateInstanceNames', 'EnumerateInstances', 'InvokeMethod', # 'DeliverIndication' ] - print "####### test_1_context #######" + log_debug("####### test_1_context #######", logger) ## Test context if not isinstance(env.ctx['CMPIInvocationFlags'], pywbem.Uint32): raise pywbem.CIMError(pywbem.CIM_ERR_FAILED, @@ -512,38 +517,50 @@ try: user_list = ch.EnumerateInstanceNames(ch.default_namespace, "TestAssoc_User") if user_list: - print "####### test_1A_associatorNames #######" + log_debug("####### test_1A_associatorNames #######", logger) # NOTE: AssociatorNames upcall is currently broken in sfcb # This test will get no assoc_names, but will not fail # Use the first entry user_entry=user_list.next() + log_debug(" >>>>> Using: %s"%user_entry, logger) assoc_names = ch.AssociatorNames(user_entry,\ assocClass="TestAssoc_MemberOfGroup") #AssocNames #TestAssoc_User has an association through TestAssoc_MemberOfGroup # to TestAssoc_Group for name in assoc_names: - if name.classname.lower() != 'TestAssoc_Group': - raise "AssociatorName Error: %s" %str(name) + if name.classname.lower() != 'testassoc_group': + raise "AssociatorName Error: %s: %s != %s" %(str(name), name.classname.lower(), 'testassoc_group') - print "####### test_1B_associators #######" + log_debug("####### test_1B_associators #######", logger) # NOTE: Associators upcall is currently broken in sfcb # This test will get no assocs, but will not fail + log_debug("####### test_1B_associators : pre-call #######", logger) assocs = ch.Associators(user_entry,\ assocClass="TestAssoc_MemberOfGroup") #Assocs + log_debug("####### test_1B_associators : post-call #######", logger) #TestAssoc_User has an association through TestAssoc_MemberOfGroup # to TestAssoc_Group - for assoc in assocs: - name = assoc.path - if name.classname.lower() != 'TestAssoc_Group': - raise "Associator Error: %s" %str(name) + if assocs: + log_debug("#*)$*%)# Got assocs ") + for assoc in assocs: + log_debug("Got an assoc") + log_debug(" ", logger) + log_debug(" >>> assoc: %s"%str(assoc), logger) + log_debug(" ", logger) + name = assoc.path + log_debug(" ", logger) + log_debug(" >>> name: "%str(name), logger) + log_debug(" ", logger) + if assoc.classname.lower() != 'testassoc_group': + raise "Associator Error: %s" %str(assoc) # #InvokeMethod # - print "####### test_1C_InvokeMethod #######" + log_debug( "####### test_1C_InvokeMethod #######", logger) try: - logger.log_debug("**** Testing InvokeMethod ****") + log_debug("**** Testing InvokeMethod ****", logger) new_instance = pywbem.CIMInstance('Test_Method') new_instance['id'] = 'One' @@ -559,7 +576,7 @@ #temporary workaround to known provider init bug #must invoke the method provider too, then start over - (numinsts,outArgs) = ch.InvokeMethod('Test_Method', 'numinsts') + (numinsts,outArgs) = ch.InvokeMethod(cop, 'numinsts') except pywbem.CIMError, arg: print "exception: %s" %arg @@ -573,9 +590,9 @@ except pywbem.CIMError, arg: - logger.log_debug("**** CIMError: ch.InvokeMethod ****") + log_debug("**** CIMError: ch.InvokeMethod ****", logger) #ReferenceNames - print "####### test_1D_referenceNames #######" + log_debug("####### test_1D_referenceNames #######", logger) # NOTE: ReferenceNames upcall is currently broken in sfcb # This test will get no refs, but will not fail try: @@ -589,10 +606,10 @@ raise "**** ReferenceNames returned were incorrect ****" except pywbem.CIMError, arg: - logger.log_debug("**** CIMError: ch.ReferenceNames ****") + log_debug("**** CIMError: ch.ReferenceNames ****", logger) #Reference - print "####### test_1E_references #######" + log_debug( "####### test_1E_references #######", logger) # NOTE: References upcall is currently broken in sfcb # This test will get no refs, but will not fail try: @@ -606,7 +623,7 @@ raise "**** References returned were incorrect ****" except pywbem.CIMError, arg: - logger.log_debug("**** CIMError: ch.Reference ****") + log_debug("**** CIMError: ch.Reference ****", logger) #DeliverIndication # Separate test for indications @@ -618,7 +635,7 @@ ################################################################################ # #test_2_create_instance - print "####### test_2_create_instance #######" + log_debug( "####### test_2_create_instance #######", logger) try: insts = _setup(ch, time, env) for inst in insts: @@ -633,7 +650,7 @@ #test_3_enum_instances #Test enumeration of instances and then compare them with the local # storage dictionary - print "####### test_3_enum_instances #######" + log_debug("####### test_3_enum_instances #######", logger) insts = _setup(ch, time, env) ta_list = ch.EnumerateInstances(ch.default_namespace, 'Test_Atom') @@ -663,7 +680,7 @@ ################################################################################ #test_4_enum_instance_names #Test enumeration of names - print "####### test_4_enum_instance_names ########" + log_debug( "####### test_4_enum_instance_names ########", logger) insts = _setup(ch, time, env) try: @@ -697,7 +714,7 @@ ################################################################################ #test_5_get_instance_with_property_list - print "####### test_5_get_instance_with_property_list ########" + log_debug("####### test_5_get_instance_with_property_list ########", logger) rinst= _create_test_instance(ch, 'Carbon', 6, time) if not rinst: @@ -786,7 +803,7 @@ ################################################################################ #test_7_delete - print "######## test_7_delete #######" + log_debug("######## test_7_delete #######", logger) #Testing the delete upcall for TestAtom insts = _setup(ch, time, env) @@ -806,7 +823,7 @@ _cleanup(ch, delobjs=False) #cuz they're already deleted, that's what this test is out_params = {} - rval = "Finished testing Upcalls..." # TODO (type pywbem.Sint32) + rval = "Success!" # TODO (type pywbem.Sint32) return (rval, out_params) def cim_method_reset_indication_count(self, env, object_name): @@ -823,6 +840,7 @@ Method to test the upcalls to the cimom handle for DeliverIndications. return number of indications sent """ + subcop=None try: try: global _indication_names,_indication_count @@ -852,6 +870,7 @@ raise indcount = len(_indication_names) + ''' st = time.time() while _indication_count < indcount: time.sleep(.01) @@ -861,10 +880,12 @@ for name,received in _indication_names.items(): if not received: raise "Indication Not received for: %s" % str(name) + ''' except: raise finally: - _deleteSubscription(ch, subcop) + if subcop is not None: + _deleteSubscription(ch, subcop) out_params = {} rval = pywbem.Uint16(indcount) Added: cmpi-bindings/trunk/test/python/UpcallAtomTest.py =================================================================== --- cmpi-bindings/trunk/test/python/UpcallAtomTest.py (rev 0) +++ cmpi-bindings/trunk/test/python/UpcallAtomTest.py 2008-10-14 00:10:53 UTC (rev 1090) @@ -0,0 +1,80 @@ +#!/usr/bin/env python + +import pywbem +from lib import wbem_connection +import unittest +import optparse +import os + +conn = None + +#This test requires the usage of elementtree + +_g_opts = None +_g_args = None + +################################################################################ +class UpcallAtomTest(unittest.TestCase): + + global conn + + def setUp(self): + unittest.TestCase.setUp(self) + self.conn = conn + self.conn.debug = True + self._verbose = _g_opts.verbose + self._dbgPrint() + + def tearDown(self): + unittest.TestCase.tearDown(self) + + + def _dbgPrint(self, msg=''): + if self._verbose: + if len(msg): + print('\t -- %s --' % msg) + else: + print('') + + def test_a_upcalls_all(self): + rv,outs = self.conn.InvokeMethod('test_all_upcalls', 'Test_UpcallAtom') + self.assertEquals(rv, 'Success!') + self.assertFalse(outs) + + def test_b_indications(self): + numrcv = 0 + self.conn.InvokeMethod('reset_indication_count', 'Test_UpcallAtom') + countsent,outs = self.conn.InvokeMethod('send_indications', 'Test_UpcallAtom') + numsent,outs = self.conn.InvokeMethod('get_indication_send_count', 'Test_UpcallAtom') + self.assertEqual(countsent, numsent) + self.assertEqual(numrcv, numsent) + + +def get_unit_test(): + return UpcallAtomTest + + +if __name__ == '__main__': + parser = optparse.OptionParser() + wbem_connection.getWBEMConnParserOptions(parser) + parser.add_option('--verbose', '', action='store_true', default=False, + help='Show verbose output') + parser.add_option('--op', '', action='store_true', default=False, + help='Use OpenPegasus UDS Connection') + parser.add_option('--level', + '-l', + action='store', + type='int', + dest='dbglevel', + help='Indicate the level of debugging statements to display (default=2)', + default=2) + _g_opts, _g_args = parser.parse_args() + + if _g_opts.op: + conn = pywbem.PegasusUDSConnection() + else: + conn = wbem_connection.WBEMConnFromOptions(parser) + + suite = unittest.makeSuite(UpcallAtomTest) + unittest.TextTestRunner(verbosity=_g_opts.dbglevel).run(suite) + Property changes on: cmpi-bindings/trunk/test/python/UpcallAtomTest.py ___________________________________________________________________ Added: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-10-13 20:23:01
|
Revision: 1089 http://omc.svn.sourceforge.net/omc/?rev=1089&view=rev Author: bartw Date: 2008-10-13 20:22:56 +0000 (Mon, 13 Oct 2008) Log Message: ----------- move SWIG_NewPointerObj() calls back inside TARGET_THREAD_*_BLOCK guards Modified Paths: -------------- cmpi-bindings/trunk/swig/cmpi_types.i Modified: cmpi-bindings/trunk/swig/cmpi_types.i =================================================================== --- cmpi-bindings/trunk/swig/cmpi_types.i 2008-10-13 19:05:22 UTC (rev 1088) +++ cmpi-bindings/trunk/swig/cmpi_types.i 2008-10-13 20:22:56 UTC (rev 1089) @@ -805,9 +805,8 @@ RAISE_IF(st); return result; } - tdata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 1); - TARGET_THREAD_BEGIN_BLOCK; + tdata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 1); #if defined (SWIGPYTHON) result = PyTuple_New(2); PyTuple_SetItem(result, 0, tdata); @@ -947,9 +946,8 @@ RAISE_IF(st); return result; } - tdata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 1); - TARGET_THREAD_BEGIN_BLOCK; + tdata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 1); #if defined (SWIGPYTHON) result = PyTuple_New(2); PyTuple_SetItem(result, 0, tdata); @@ -1199,9 +1197,8 @@ RAISE_IF(st); return result; } - tdata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 1); - TARGET_THREAD_BEGIN_BLOCK; + tdata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 1); #if defined (SWIGPYTHON) result = PyTuple_New(2); PyTuple_SetItem(result, 0, tdata); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-10-13 19:05:30
|
Revision: 1088 http://omc.svn.sourceforge.net/omc/?rev=1088&view=rev Author: bartw Date: 2008-10-13 19:05:22 +0000 (Mon, 13 Oct 2008) Log Message: ----------- fixed classname Modified Paths: -------------- cmpi-bindings/trunk/test/python/TestMethod.py Modified: cmpi-bindings/trunk/test/python/TestMethod.py =================================================================== --- cmpi-bindings/trunk/test/python/TestMethod.py 2008-10-10 23:34:20 UTC (rev 1087) +++ cmpi-bindings/trunk/test/python/TestMethod.py 2008-10-13 19:05:22 UTC (rev 1088) @@ -745,7 +745,7 @@ insts = [] for kn, val in g_insts.items(): - inst = pywbem.CIMInstance('TestMethod', + inst = pywbem.CIMInstance('Test_Method', properties={'id':kn, 'p_str':val[0], 'p_sint32':val[1]}) insts.append(inst) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <np...@us...> - 2008-10-10 23:34:26
|
Revision: 1087 http://omc.svn.sourceforge.net/omc/?rev=1087&view=rev Author: npaxton Date: 2008-10-10 23:34:20 +0000 (Fri, 10 Oct 2008) Log Message: ----------- Indications support (local, expecting impossible local indication consumer... needs refactor to client); modify InvokeMethod; add context test Modified Paths: -------------- cmpi-bindings/trunk/test/python/UpcallAtom.mof cmpi-bindings/trunk/test/python/UpcallAtomProvider.py Modified: cmpi-bindings/trunk/test/python/UpcallAtom.mof =================================================================== --- cmpi-bindings/trunk/test/python/UpcallAtom.mof 2008-10-10 23:08:07 UTC (rev 1086) +++ cmpi-bindings/trunk/test/python/UpcallAtom.mof 2008-10-10 23:34:20 UTC (rev 1087) @@ -7,9 +7,17 @@ //return a string array of log messages ); [Description("Send an export_indication")] - string send_indication( - //return a string array of log messages + uint16 send_indications( + //return number of indications sent ); + [Description("Reset indication count")] + uint16 reset_indication_count( + // return 0 + ); + [Description("Get number of indications sent")] + uint16 get_indication_send_count( + // return number of indications sent since last reset + ); }; [ Indication ] class UpcallAtom_Indication : CIM_ProcessIndication Modified: cmpi-bindings/trunk/test/python/UpcallAtomProvider.py =================================================================== --- cmpi-bindings/trunk/test/python/UpcallAtomProvider.py 2008-10-10 23:08:07 UTC (rev 1086) +++ cmpi-bindings/trunk/test/python/UpcallAtomProvider.py 2008-10-10 23:34:20 UTC (rev 1087) @@ -12,6 +12,7 @@ import os,time,socket import pywbem from pywbem.cim_provider2 import CIMProvider2 +from socket import getfqdn _inst_paths = [] @@ -22,6 +23,86 @@ "bart": False, "kenny": False, "brad": False } + + + +# start indication support methods + +def _createFilter(ch, query='select * from CIM_ProcessIndication', + ns='root/interop', + querylang='WQL', + src_ns='root/cimv2', + in_name=None): + name = in_name or 'cimfilter%s'%time.time() + filterinst=pywbem.CIMInstance('CIM_IndicationFilter') + filterinst['CreationClassName']='CIM_IndicationFilter' + filterinst['SystemCreationClassName']='CIM_ComputerSystem' + filterinst['SystemName']=getfqdn() + filterinst['Name']=name + filterinst['Query']=query + filterinst['QueryLanguage']=querylang + filterinst['SourceNamespace']=src_ns + cop = pywbem.CIMInstanceName('CIM_IndicationFilter') + cop.keybindings = { 'CreationClassName':'CIM_IndicationFilter', + 'SystemClassName':'CIM_ComputerSystem', + 'SystemName':getfqdn(), + 'Name':name } + cop.namespace=ns + filterinst.path = cop + filtercop = ch.CreateInstance(cop, filterinst) + return filtercop + +def _createDest(ch, destination='http://localhost:5998', + ns='root/interop', + in_name=None): + name = in_name or 'cimlistener%s'%time.time() + destinst=pywbem.CIMInstance('CIM_ListenerDestinationCIMXML') + destinst['CreationClassName']='CIM_ListenerDestinationCIMXML' + destinst['SystemCreationClassName']='CIM_ComputerSystem' + destinst['SystemName']=getfqdn() + print "destname=",name + destinst['Name']=name + destinst['Destination']=destination + cop = pywbem.CIMInstanceName('CIM_ListenerDestinationCIMXML') + cop.keybindings = { 'CreationClassName':'CIM_ListenerDestinationCIMXML', + 'SystemClassName':'CIM_ComputerSystem', + 'SystemName':getfqdn(), + 'Name':name } + cop.namespace=ns + destinst.path = cop + destcop = ch.CreateInstance(cop, destinst) + return destcop + +def _createSubscription(ch, ns='root/interop'): + replace_ns = ch.default_namespace + ch.default_namespace=ns + indfilter=_createFilter(ch) + indhandler=_createDest(ch) + subinst=pywbem.CIMInstance('CIM_IndicationSubscription') + subinst['Filter']=indfilter + subinst['Handler']=indhandler + cop = pywbem.CIMInstanceName('CIM_IndicationSubscription') + cop.keybindings = { 'Filter':indfilter, + 'Handler':indhandler } + cop.namespace=ns + subinst.path = cop + subcop = ch.CreateInstance(cop, subinst) + ch.default_namespace=replace_ns + return subcop + + +def _deleteSubscription(ch, subcop): + indfilter = subcop['Filter'] + indhandler= subcop['Handler'] + ch.DeleteInstance(subcop) + ch.DeleteInstance(indfilter) + ch.DeleteInstance(indhandler) + +# end indication support methods + + + + ################################################################################ _atoms = {'Hydrogen': 1, 'Helium': 2, @@ -35,24 +116,6 @@ 'Neon': 10 } ################################################################################ -# Note: consume_indication is called on OpenPegasus because this is an -# indication consumer in that environment. -def consume_indication(env, destinationPath, indicationInstance): - print '#### consume_indication called. pid:',os.getpid() - global _indication_names,_indication_count - if indicationInstance['Description'] in _indication_names.keys(): - print '#### consume_indication: My Indication :-)!' - _indication_names[indicationInstance['Description']] = True - _indication_count += 1 - - -################################################################################ -# Note: handle_indication is called on OpenWBEM because this is an -# indication handler in that environment. -def handle_indication(env, ns, handlerInstance, indicationInstance): - consume_indication(env, None, indicationInstance) - -################################################################################ def _compare_values(instance, time, logger): log = "Entering _compare_values: " types = {'boolprop': 'boolean', @@ -264,6 +327,9 @@ ################################################################################ def _setup(ch, time, env): + global _inst_paths + if len(_inst_paths): + raise '_inst_paths was not empty (%d elements) calling into setup: %s'%(len(_inst_paths),_inst_paths) insts = [] log = '' logger = env.get_logger() @@ -280,13 +346,17 @@ return insts ################################################################################ -def _cleanup(ch): +def _cleanup(ch, delobjs=True): global _inst_paths - for ipath in _inst_paths: - try: - ch.DeleteInstance(ipath) - except pywbem.CIMError,arg: - raise '#### Delete Instance failed' + + if delobjs: + for ipath in _inst_paths: + try: + ch.DeleteInstance(ipath) + except pywbem.CIMError,arg: + raise '#### Delete Instance failed on %s: %s'%(ipath, arg) + except: + raise _inst_paths = [] ############################################################################## @@ -303,7 +373,14 @@ # theIndicationThread = MainMonitorThread(...) # theIndicationThread.start() + ''' + #start an irecv thread here to count the indications received back + global indThread + indThread=IndThread() + indThread.start() + ''' + ############################################################################## def deactivate_filter(env, filter, namespace, classes, lastActivation): print '#### Python deactivate_filter called. filter: %s' % filter @@ -318,6 +395,12 @@ # theIndicationThread.shutdown() # theIndicationThread = None + ''' + #delete the irecv thread + global indThread + indThread.stop() + ''' + ############################################################################## def authorize_filter(env, filter, namespace, classes, owner): print '#### Python authorize_filter called. filter: %s' % filter @@ -375,6 +458,7 @@ CIM_ERR_FAILED (some other unspecified error occurred) """ + global _inst_paths log = [] insts = [] time = pywbem.CIMDateTime.now() @@ -390,42 +474,68 @@ # 'CreateInstance', 'DeleteInstance', 'GetInstance', 'ModifyInstance', # 'EnumerateInstanceNames', 'EnumerateInstances', 'InvokeMethod', # 'DeliverIndication' ] - #test_1_upcalls - print "####### test_1_upcalls #######" - #Written to test associators of Linux_UnixProcess class + + print "####### test_1_context #######" + ## Test context + if not isinstance(env.ctx['CMPIInvocationFlags'], pywbem.Uint32): + raise pywbem.CIMError(pywbem.CIM_ERR_FAILED, + 'context is broken (1): ' + `env.ctx`) + + oldlen = len(env.ctx) + env.ctx['foo'] = 'bar' + if env.ctx['foo'] != 'bar': + raise pywbem.CIMError(pywbem.CIM_ERR_FAILED, + 'context is broken (2): ' + `env.ctx`) + + if oldlen + 1 != len(env.ctx): + raise pywbem.CIMError(pywbem.CIM_ERR_FAILED, + 'context is broken (3): ' + `env.ctx`) + + if not 'foo' in env.ctx: + raise pywbem.CIMError(pywbem.CIM_ERR_FAILED, + 'context is broken (4): ' + `env.ctx`) + + if 'foobar' in env.ctx: + raise pywbem.CIMError(pywbem.CIM_ERR_FAILED, + 'context is broken (5): ' + `env.ctx`) + + env.ctx.update(foobar='foobar') + if env.ctx['foobar'] != 'foobar': + raise pywbem.CIMError(pywbem.CIM_ERR_FAILED, + 'context is broken (6): ' + `env.ctx`) + + ## end context tests + + + #Written to test associators of TestAssoc_User/TestAssoc_Group/TestAssoc_MemberOfGroup classes # try: - print "####### test_1A_associatorNames #######" - # NOTE: AssociatorNames upcall is currently broken in sfcb - # This test will get no assoc_names, but will not fail - proc_list = ch.EnumerateInstanceNames(ch.default_namespace, "Linux_UnixProcess") - if proc_list: + user_list = ch.EnumerateInstanceNames(ch.default_namespace, "TestAssoc_User") + if user_list: + print "####### test_1A_associatorNames #######" + # NOTE: AssociatorNames upcall is currently broken in sfcb + # This test will get no assoc_names, but will not fail + # Use the first entry - proc_entry=proc_list.next() - assoc_names = ch.AssociatorNames(proc_entry,\ - assocClass="Linux_OSProcess") #AssocNames - #Linux_UnixProcess has an association through Linux_OSProcess - #1. Linux_OperatingSystem + user_entry=user_list.next() + assoc_names = ch.AssociatorNames(user_entry,\ + assocClass="TestAssoc_MemberOfGroup") #AssocNames + #TestAssoc_User has an association through TestAssoc_MemberOfGroup + # to TestAssoc_Group for name in assoc_names: - if name['CSCreationClassName'] != 'Linux_ComputerSystem' \ - and name['CreationClassName'] != 'Linux_OperatingSystem': + if name.classname.lower() != 'TestAssoc_Group': raise "AssociatorName Error: %s" %str(name) - print "####### test_1B_associators #######" - # NOTE: Associators upcall is currently broken in sfcb - # This test will get no assocs, but will not fail - proc_list = ch.EnumerateInstanceNames(ch.default_namespace, "Linux_UnixProcess") - if proc_list: - # Use the first entry - proc_entry=proc_list.next() - assocs = ch.Associators(proc_entry,\ - assocClass="Linux_OSProcess") #Assocs - #Linux_UnixProcess has an association through Linux_OSProcess - #1. Linux_OperatingSystem - for assoc in assoc_names: + print "####### test_1B_associators #######" + # NOTE: Associators upcall is currently broken in sfcb + # This test will get no assocs, but will not fail + assocs = ch.Associators(user_entry,\ + assocClass="TestAssoc_MemberOfGroup") #Assocs + #TestAssoc_User has an association through TestAssoc_MemberOfGroup + # to TestAssoc_Group + for assoc in assocs: name = assoc.path - if name['CSCreationClassName'] != 'Linux_ComputerSystem' \ - and name['CreationClassName'] != 'Linux_OperatingSystem': + if name.classname.lower() != 'TestAssoc_Group': raise "Associator Error: %s" %str(name) # @@ -514,7 +624,7 @@ for inst in insts: rval = _compare_values(inst, time, logger) if not rval: - raise "Return Value is false" + raise "Object compare failed: Return Value is false" _cleanup(ch) except pywbem.CIMError, arg: raise "**** CreateInstance Failed ****" @@ -603,10 +713,8 @@ if inst: for prop in inst.properties.keys(): - if prop not in propertylist: - raise "Property Not Found in PropertyList: %s" % prop - #print "Property Not Found in PropertyList: %s" % prop - #continue + if prop not in propertylist and prop not in inst.keys(): + raise "Property %s Not Found in PropertyList: %s... checking: %s" % (prop, propertylist, inst.properties.keys()) _cleanup(ch) ################################################################################ @@ -696,53 +804,70 @@ if arg[0] != pywbem.CIM_ERR_NOT_FOUND: raise 'Unexpected exception on delete: %s' % str(arg) - + _cleanup(ch, delobjs=False) #cuz they're already deleted, that's what this test is out_params = {} rval = "Finished testing Upcalls..." # TODO (type pywbem.Sint32) return (rval, out_params) - def cim_method_send_indication(self, env, object_name): + def cim_method_reset_indication_count(self, env, object_name): + _indication_count = 0 + return (pywbem.Uint16(0), {}) + + def cim_method_get_indication_send_count(self, env, object_name): + rval = pywbem.Uint16(_indication_count) + return (rval, {}) + + + def cim_method_send_indications(self, env, object_name): """ Method to test the upcalls to the cimom handle for DeliverIndications. + return number of indications sent """ - global _indication_names,_indication_count - cimtime = pywbem.CIMDateTime.now() - ch = env.get_cimom_handle() - ch.default_namespace = "root/cimv2" - logger = env.get_logger() + try: + try: + global _indication_names,_indication_count + cimtime = pywbem.CIMDateTime.now() + ch = env.get_cimom_handle() + ch.default_namespace = "root/cimv2" + logger = env.get_logger() + subcop=_createSubscription(ch) - for name in _indication_names: - alert_ind = pywbem.CIMInstance("UpcallAtom_Indication") - alert_ind['AlertType'] = pywbem.Uint16(2) - alert_ind['Description'] = name - alert_ind['PerceivedSeverity'] = pywbem.Uint16(1) - alert_ind['PorbablyCause'] = pywbem.Uint16(1) - alert_ind['IndicationTime'] = cimtime - alert_ind['SystemName'] = socket.getfqdn() - - try: - print '### Exporting indication. pid:',os.getpid() - ch.DeliverIndication(ch.default_namespace, alert_ind) - print '### Done exporting indication' - except pywbem.CIMError, arg: - print '### Caught exception exporting indication' - raise + for name in _indication_names: + alert_ind = pywbem.CIMInstance("UpcallAtom_Indication") + alert_ind['AlertType'] = pywbem.Uint16(2) + alert_ind['Description'] = name + alert_ind['PerceivedSeverity'] = pywbem.Uint16(1) + alert_ind['PorbablyCause'] = pywbem.Uint16(1) + alert_ind['IndicationTime'] = cimtime + alert_ind['SystemName'] = socket.getfqdn() + + try: + print '### Exporting indication. pid:',os.getpid() + ch.DeliverIndication(ch.default_namespace, alert_ind) + print '### Done exporting indication' + except pywbem.CIMError, arg: + print '### Caught exception exporting indication' + raise - indcount = len(_indication_names) - st = time.time() - while _indication_count < indcount: - time.sleep(.01) - if (time.time() - st) > 10.00: - raise "Only received %d. expected %d" % (_indication_count, indcount) + indcount = len(_indication_names) + st = time.time() + while _indication_count < indcount: + time.sleep(.01) + if (time.time() - st) > 10.00: + raise "Only received %d. expected %d" % (_indication_count, indcount) - for name,received in _indication_names.items(): - if not received: - raise "Indication Not received for: %s" % str(name) + for name,received in _indication_names.items(): + if not received: + raise "Indication Not received for: %s" % str(name) + except: + raise + finally: + _deleteSubscription(ch, subcop) out_params = {} - rval = "Sending indication finished..." # + rval = pywbem.Uint16(indcount) return (rval, out_params) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <np...@us...> - 2008-10-10 23:08:18
|
Revision: 1086 http://omc.svn.sourceforge.net/omc/?rev=1086&view=rev Author: npaxton Date: 2008-10-10 23:08:07 +0000 (Fri, 10 Oct 2008) Log Message: ----------- remove context tests and put into UpcallAtom provider Modified Paths: -------------- cmpi-bindings/trunk/test/python/TestAtomProvider.py Modified: cmpi-bindings/trunk/test/python/TestAtomProvider.py =================================================================== --- cmpi-bindings/trunk/test/python/TestAtomProvider.py 2008-10-10 22:55:21 UTC (rev 1085) +++ cmpi-bindings/trunk/test/python/TestAtomProvider.py 2008-10-10 23:08:07 UTC (rev 1086) @@ -98,36 +98,6 @@ #for atom in self.storage.keys(): #print "Key = %s " %str(atom) - ## Test context - if not isinstance(env.ctx['CMPIInvocationFlags'], pywbem.Uint32): - raise pywbem.CIMError(pywbem.CIM_ERR_FAILED, - 'context is broken: ' + `env.ctx`) - - oldlen = len(env.ctx) - env.ctx['foo'] = 'bar' - if env.ctx['foo'] != 'bar': - raise pywbem.CIMError(pywbem.CIM_ERR_FAILED, - 'context is broken: ' + `env.ctx`) - - if oldlen + 1 != len(env.ctx): - raise pywbem.CIMError(pywbem.CIM_ERR_FAILED, - 'context is broken: ' + `env.ctx`) - - if not 'foo' in env.ctx: - raise pywbem.CIMError(pywbem.CIM_ERR_FAILED, - 'context is broken: ' + `env.ctx`) - - if 'foobar' in env.ctx: - raise pywbem.CIMError(pywbem.CIM_ERR_FAILED, - 'context is broken: ' + `env.ctx`) - - env.ctx.update(foobar='foobar') - if env.ctx['foobar'] != 'foobar': - raise pywbem.CIMError(pywbem.CIM_ERR_FAILED, - 'context is broken: ' + `env.ctx`) - - ## end context tests - for key in self.storage.keys(): #print "***** HELLO ***** " #logger.log_debug("************ ENUM_INSTANCES ********") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <np...@us...> - 2008-10-10 22:55:27
|
Revision: 1085 http://omc.svn.sourceforge.net/omc/?rev=1085&view=rev Author: npaxton Date: 2008-10-10 22:55:21 +0000 (Fri, 10 Oct 2008) Log Message: ----------- modify InvokeMethod to require a CIMInstanceName or CIMClassName, with namespace, or will fail... gets rid of TODO on default namespace Modified Paths: -------------- cmpi-bindings/trunk/swig/python/cmpi_pywbem_bindings.py Modified: cmpi-bindings/trunk/swig/python/cmpi_pywbem_bindings.py =================================================================== --- cmpi-bindings/trunk/swig/python/cmpi_pywbem_bindings.py 2008-10-10 21:18:59 UTC (rev 1084) +++ cmpi-bindings/trunk/swig/python/cmpi_pywbem_bindings.py 2008-10-10 22:55:21 UTC (rev 1085) @@ -298,21 +298,14 @@ yield piname def InvokeMethod(self, path, method, **params): - if isinstance(path, pywbem.StringTypes): - # path is a String type: convert to CIMClassName - objpath = pywbem.CIMClassName(path, namespace=ns) - elif isinstance(path, pywbem.CIMInstanceName): - if path.namespace is None: - # TODO: Where does default namespace come from? - # will likely either have to pass in a ns, or make - # path always be an objectpath and not support just a - # string for a classname (to creata a CIMClassName) - ns = 'root/cimv2' - path.namespace = ns - objpath = path - else: - raise pywbem.CIMError(pywbem.CIM_INVALIDPARAMETER) - cop = self.proxy.pywbem2cmpi_instname(objpath) + if not isinstance(path, pywbem.CIMClassName) and \ + not isinstance(path, pywbem.CIMInstanceName): + # invalid parameter + raise pywbem.CIMError(pywbem.CIM_ERR_INVALID_PARAMETER) + if path.namespace is None: + # must have namespace + raise pywbem.CIMError(pywbem.CIM_ERR_INVALID_NAMESPACE) + cop = self.proxy.pywbem2cmpi_instname(path) inargs=self.proxy.pywbem2cmpi_args(params) poutargs = self.broker.new_args() rc=self.broker.invokeMethod(self.ctx, cop, method, inargs, poutargs) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-10-10 21:19:03
|
Revision: 1084 http://omc.svn.sourceforge.net/omc/?rev=1084&view=rev Author: bartw Date: 2008-10-10 21:18:59 +0000 (Fri, 10 Oct 2008) Log Message: ----------- renamed reg file Added Paths: ----------- cmpi-bindings/trunk/test/python/TestAssocProvider.peg.reg Removed Paths: ------------- cmpi-bindings/trunk/test/python/TestAssocProvider-peg.reg Deleted: cmpi-bindings/trunk/test/python/TestAssocProvider-peg.reg =================================================================== --- cmpi-bindings/trunk/test/python/TestAssocProvider-peg.reg 2008-10-10 20:32:03 UTC (rev 1083) +++ cmpi-bindings/trunk/test/python/TestAssocProvider-peg.reg 2008-10-10 21:18:59 UTC (rev 1084) @@ -1,47 +0,0 @@ -// Provider registration for TestAssoc -instance of PG_ProviderModule -{ - Name = "TestAssocProvider-Module"; - InterfaceType = "CMPI"; - InterfaceVersion = "2.0.0"; - Location = "pyCmpiProvider"; - Vendor = "Novell"; - Version = "1.0.0"; -}; - -instance of PG_Provider -{ - Name = "TestAssocProvider"; - ProviderModuleName = "TestAssocProvider-Module"; -}; - -instance of PG_ProviderCapabilities -{ - CapabilityID = "TestAssocProvider-Capability1"; - ProviderModuleName = "TestAssocProvider-Module"; - ProviderName = "TestAssocProvider"; - ClassName = "TestAssoc_User"; - Namespaces = {"root/cimv2"}; - ProviderType = {2}; // Instance -}; - -instance of PG_ProviderCapabilities -{ - CapabilityID = "TestAssocProvider-Capability2"; - ProviderModuleName = "TestAssocProvider-Module"; - ProviderName = "TestAssocProvider"; - ClassName = "TestAssoc_Group"; - Namespaces = {"root/cimv2"}; - ProviderType = {2}; // Instance -}; - -instance of PG_ProviderCapabilities -{ - CapabilityID = "TestAssocProvider-Capability3"; - ProviderModuleName = "TestAssocProvider-Module"; - ProviderName = "TestAssocProvider"; - ClassName = "TestAssoc_MemberOfGroup"; - Namespaces = {"root/cimv2"}; - ProviderType = {2,3}; // Instance/Association -}; - Copied: cmpi-bindings/trunk/test/python/TestAssocProvider.peg.reg (from rev 1078, cmpi-bindings/trunk/test/python/TestAssocProvider-peg.reg) =================================================================== --- cmpi-bindings/trunk/test/python/TestAssocProvider.peg.reg (rev 0) +++ cmpi-bindings/trunk/test/python/TestAssocProvider.peg.reg 2008-10-10 21:18:59 UTC (rev 1084) @@ -0,0 +1,47 @@ +// Provider registration for TestAssoc +instance of PG_ProviderModule +{ + Name = "TestAssocProvider-Module"; + InterfaceType = "CMPI"; + InterfaceVersion = "2.0.0"; + Location = "pyCmpiProvider"; + Vendor = "Novell"; + Version = "1.0.0"; +}; + +instance of PG_Provider +{ + Name = "TestAssocProvider"; + ProviderModuleName = "TestAssocProvider-Module"; +}; + +instance of PG_ProviderCapabilities +{ + CapabilityID = "TestAssocProvider-Capability1"; + ProviderModuleName = "TestAssocProvider-Module"; + ProviderName = "TestAssocProvider"; + ClassName = "TestAssoc_User"; + Namespaces = {"root/cimv2"}; + ProviderType = {2}; // Instance +}; + +instance of PG_ProviderCapabilities +{ + CapabilityID = "TestAssocProvider-Capability2"; + ProviderModuleName = "TestAssocProvider-Module"; + ProviderName = "TestAssocProvider"; + ClassName = "TestAssoc_Group"; + Namespaces = {"root/cimv2"}; + ProviderType = {2}; // Instance +}; + +instance of PG_ProviderCapabilities +{ + CapabilityID = "TestAssocProvider-Capability3"; + ProviderModuleName = "TestAssocProvider-Module"; + ProviderName = "TestAssocProvider"; + ClassName = "TestAssoc_MemberOfGroup"; + Namespaces = {"root/cimv2"}; + ProviderType = {2,3}; // Instance/Association +}; + Property changes on: cmpi-bindings/trunk/test/python/TestAssocProvider.peg.reg ___________________________________________________________________ Added: svn:mergeinfo + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-10-10 20:32:11
|
Revision: 1083 http://omc.svn.sourceforge.net/omc/?rev=1083&view=rev Author: bartw Date: 2008-10-10 20:32:03 +0000 (Fri, 10 Oct 2008) Log Message: ----------- preserve exception stack trace when converting the exception Modified Paths: -------------- cmpi-bindings/trunk/swig/python/cmpi_pywbem_bindings.py Modified: cmpi-bindings/trunk/swig/python/cmpi_pywbem_bindings.py =================================================================== --- cmpi-bindings/trunk/swig/python/cmpi_pywbem_bindings.py 2008-10-10 20:17:28 UTC (rev 1082) +++ cmpi-bindings/trunk/swig/python/cmpi_pywbem_bindings.py 2008-10-10 20:32:03 UTC (rev 1083) @@ -38,6 +38,7 @@ import pywbem import types import syslog +import sys ##============================================================================== ## @@ -76,8 +77,11 @@ try: return self.meth(*args, **kwds) except cmpi.CMPIException,e: - raise _exception_to_error(e) + exc_class, exc, tb = sys.exc_info() + new_exc = _exception_to_error(e) + raise new_exc.__class__, new_exc, tb + ##============================================================================== ## ## ExceptionClassWrapper @@ -713,6 +717,9 @@ if pinst.property_list is not None: cinst.set_property_filter(pinst.property_list) for prop in pinst.properties.values(): + # if pinst.property_list and \ + # prop.name.lower() not in pinst.property_list: + # continue data, _type = self.pywbem2cmpi_value(prop.value, _type=prop.type) ctype = _pywbem2cmpi_typemap[_type] if isinstance(prop.value, list): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <np...@us...> - 2008-10-10 20:17:34
|
Revision: 1082 http://omc.svn.sourceforge.net/omc/?rev=1082&view=rev Author: npaxton Date: 2008-10-10 20:17:28 +0000 (Fri, 10 Oct 2008) Log Message: ----------- fix pegasus registration for upcall atom Modified Paths: -------------- cmpi-bindings/trunk/test/python/UpcallAtom.peg.reg Modified: cmpi-bindings/trunk/test/python/UpcallAtom.peg.reg =================================================================== --- cmpi-bindings/trunk/test/python/UpcallAtom.peg.reg 2008-10-10 20:16:45 UTC (rev 1081) +++ cmpi-bindings/trunk/test/python/UpcallAtom.peg.reg 2008-10-10 20:17:28 UTC (rev 1082) @@ -2,16 +2,16 @@ instance of PG_ProviderModule { Name = "UpcallAtom_Module"; - Location = "/usr/lib/pycim/UpcallAtomProvider.py"; - Vendor = "Novell"; - Version = "1.0.0"; - InterfaceType = "Python"; - InterfaceVersion = "1.0.0"; + InterfaceType = "CMPI"; + InterfaceVersion = "2.0.0"; + Location = "pyCmpiProvider"; + Vendor = "OMC"; + Version = "0.1.0"; }; instance of PG_Provider { - Name = "UpcallAtom_Provider"; + Name = "UpcallAtomProvider"; ProviderModuleName = "UpcallAtom_Module"; }; @@ -19,8 +19,8 @@ { CapabilityID = "UpcallAtom-Prov-1"; ProviderModuleName = "UpcallAtom_Module"; - ProviderName = "UpcallAtom_Provider"; - ClassName = "UpcallAtom"; + ProviderName = "UpcallAtomProvider"; + ClassName = "Test_UpcallAtom"; ProviderType = { 5 }; // Method Namespaces = {"root/cimv2"}; SupportedProperties = NULL; @@ -31,7 +31,7 @@ { CapabilityID = "UpcallAtom-Prov-2"; ProviderModuleName = "UpcallAtom_Module"; - ProviderName = "UpcallAtom_Provider"; + ProviderName = "UpcallAtomProvider"; ClassName = "UpcallAtom_Indication"; ProviderType = { 4 }; // Indication Namespaces = {"root/cimv2"}; @@ -39,13 +39,3 @@ SupportedMethods = NULL; }; -instance of PG_ConsumerCapabilities -{ - CapabilityID = "UpcallAtom-Consumer"; - ProviderModuleName = "UpcallAtom_Module"; - ProviderName = "UpcallAtom_Provider"; - ProviderType = { 6 }; // Indication Consumer/Handler - Destinations = {"/UpcallAtom"}; -}; - - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <np...@us...> - 2008-10-10 20:16:49
|
Revision: 1081 http://omc.svn.sourceforge.net/omc/?rev=1081&view=rev Author: npaxton Date: 2008-10-10 20:16:45 +0000 (Fri, 10 Oct 2008) Log Message: ----------- Add UpcallAtom to install.sh Modified Paths: -------------- cmpi-bindings/trunk/test/python/install.sh Modified: cmpi-bindings/trunk/test/python/install.sh =================================================================== --- cmpi-bindings/trunk/test/python/install.sh 2008-10-09 17:27:29 UTC (rev 1080) +++ cmpi-bindings/trunk/test/python/install.sh 2008-10-10 20:16:45 UTC (rev 1081) @@ -50,13 +50,17 @@ cimmof -n root/PG_InterOp TestAssocProvider-peg.reg cimmof TestAtom.mof cimmof -n root/PG_InterOp TestAtomProvider.peg.reg + cimmof UpcallAtom.mof + cimmof -n root/PG_Interop UpcallAtom.peg.reg else __install TestMethod.mof /var/lib/sfcb/stage/mofs/root/cimv2 __install TestAssoc.mof /var/lib/sfcb/stage/mofs/root/cimv2 __install TestAtom.mof /var/lib/sfcb/stage/mofs/root/cimv2 + __install UpcallAtom.mof /var/lib/sfcb/stage/mofs/root/cimv2 __install TestAssocProvider.sfcb.reg /var/lib/sfcb/stage/regs __install TestMethod.sfcb.reg /var/lib/sfcb/stage/regs __install TestAtomProvider.sfcb.reg /var/lib/sfcb/stage/regs + __install UpcallAtom.sfcb.reg /var/lib/sfcb/stage/regs sfcbrepos -f fi This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mik...@us...> - 2008-10-09 17:27:31
|
Revision: 1080 http://omc.svn.sourceforge.net/omc/?rev=1080&view=rev Author: mike-brasher Date: 2008-10-09 17:27:29 +0000 (Thu, 09 Oct 2008) Log Message: ----------- Fixed ISO compiler warnings (illegal mixed declartions) Modified Paths: -------------- cmpi-bindings/trunk/src/cmpi_provider.c cmpi-bindings/trunk/src/target_perl.c Modified: cmpi-bindings/trunk/src/cmpi_provider.c =================================================================== --- cmpi-bindings/trunk/src/cmpi_provider.c 2008-10-09 17:26:31 UTC (rev 1079) +++ cmpi-bindings/trunk/src/cmpi_provider.c 2008-10-09 17:27:29 UTC (rev 1080) @@ -92,10 +92,11 @@ static Target_Type string2target(const char *s) { + Target_Type obj; + if (s == NULL) return Target_Null; - Target_Type obj; TARGET_THREAD_BEGIN_BLOCK; obj = Target_String(s); @@ -113,6 +114,8 @@ static Target_Type proplist2target(const char** cplist) { + Target_Type pl; + TARGET_THREAD_BEGIN_BLOCK; if (cplist == NULL) { @@ -120,7 +123,6 @@ TARGET_THREAD_END_BLOCK; return Target_Void; } - Target_Type pl; pl = Target_Array(); for (; (cplist!=NULL && *cplist != NULL); ++cplist) @@ -138,6 +140,8 @@ { va_list ap; int len; + char* str; + va_start(ap, fmt); len = vsnprintf(NULL, 0, fmt, ap); va_end(ap); @@ -145,7 +149,7 @@ { return NULL; } - char* str = (char*)malloc(len+1); + str = (char*)malloc(len+1); if (str == NULL) { return NULL; @@ -247,8 +251,9 @@ const CMPIContext * context, CMPIBoolean terminating) { + CMPIStatus st; _SBLIM_TRACE(1,("Cleanup() called for Instance provider %s", ((ProviderMIHandle *)self->hdl)->miName)); - CMPIStatus st = Cleanup((ProviderMIHandle*)self->hdl, context, terminating); + st = Cleanup((ProviderMIHandle*)self->hdl, context, terminating); return st; } @@ -262,8 +267,9 @@ const CMPIContext * context, CMPIBoolean terminating) { + CMPIStatus st; _SBLIM_TRACE(1,("Cleanup() called for Association provider %s", ((ProviderMIHandle *)self->hdl)->miName)); - CMPIStatus st = Cleanup((ProviderMIHandle*)self->hdl, context, terminating); + st = Cleanup((ProviderMIHandle*)self->hdl, context, terminating); return st; } @@ -277,8 +283,9 @@ const CMPIContext * context, CMPIBoolean terminating) { + CMPIStatus st; _SBLIM_TRACE(1,("Cleanup() called for Method provider %s", ((ProviderMIHandle *)self->hdl)->miName)); - CMPIStatus st = Cleanup((ProviderMIHandle*)self->hdl, context, terminating); + st = Cleanup((ProviderMIHandle*)self->hdl, context, terminating); return st; } @@ -292,8 +299,9 @@ const CMPIContext * context, CMPIBoolean terminating) { + CMPIStatus st; _SBLIM_TRACE(1,("Cleanup() called for Indication provider %s", ((ProviderMIHandle *)self->hdl)->miName)); - CMPIStatus st = Cleanup((ProviderMIHandle*)self->hdl, context, terminating); + st = Cleanup((ProviderMIHandle*)self->hdl, context, terminating); return st; } @@ -309,6 +317,10 @@ const CMPIResult * result, const CMPIObjectPath * reference) { + Target_Type _context; + Target_Type _result; + Target_Type _reference; + CMPIStatus status = {CMPI_RC_OK, NULL}; _SBLIM_TRACE(1,("EnumInstancesNames() called, context %p, result %p, reference %p", context, result, reference)); @@ -316,9 +328,9 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); - Target_Type _result = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0); - Target_Type _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + _result = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0); + _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "enum_instance_names", 3, @@ -344,6 +356,11 @@ const CMPIObjectPath * reference, const char ** properties) { + Target_Type _context; + Target_Type _result; + Target_Type _reference; + Target_Type _properties; + CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations */ /* char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); Our current CIM namespace */ @@ -352,11 +369,11 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); - Target_Type _result = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0); - Target_Type _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + _result = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0); + _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); TARGET_THREAD_END_BLOCK; - Target_Type _properties = proplist2target(properties); + _properties = proplist2target(properties); call_provider((ProviderMIHandle*)self->hdl, &status, "enum_instances", 4, _context, @@ -382,6 +399,11 @@ const CMPIObjectPath * reference, const char ** properties) { + Target_Type _context; + Target_Type _result; + Target_Type _reference; + Target_Type _properties; + CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations */ _SBLIM_TRACE(1,("GetInstance() called, context %p, results %p, reference %p, properties %p", context, results, reference, properties)); @@ -389,11 +411,11 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); - Target_Type _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); - Target_Type _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); + _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); TARGET_THREAD_END_BLOCK; - Target_Type _properties = proplist2target(properties); + _properties = proplist2target(properties); call_provider((ProviderMIHandle*)self->hdl, &status, "get_instance", 4, _context, @@ -419,7 +441,13 @@ const CMPIObjectPath * reference, const CMPIInstance * newinstance) { + Target_Type _context; + Target_Type _result; + Target_Type _reference; + Target_Type _newinst; + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; /* Return status of CIM operations. */ + /* Creating new instances is not supported for this class. */ @@ -428,10 +456,10 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); - Target_Type _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); - Target_Type _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - Target_Type _newinst = SWIG_NewPointerObj((void*) newinstance, SWIGTYPE_p__CMPIInstance, 0); + _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); + _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + _newinst = SWIG_NewPointerObj((void*) newinstance, SWIGTYPE_p__CMPIInstance, 0); TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "create_instance", 4, @@ -462,6 +490,12 @@ const CMPIInstance * newinstance, const char ** properties) { + Target_Type _context; + Target_Type _result; + Target_Type _reference; + Target_Type _newinst; + Target_Type plist; + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; /* Return status of CIM operations. */ /* Modifying existing instances is not supported for this class. */ @@ -471,12 +505,12 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); - Target_Type _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); - Target_Type _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - Target_Type _newinst = SWIG_NewPointerObj((void*) newinstance, SWIGTYPE_p__CMPIInstance, 0); + _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); + _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + _newinst = SWIG_NewPointerObj((void*) newinstance, SWIGTYPE_p__CMPIInstance, 0); TARGET_THREAD_END_BLOCK; - Target_Type plist = proplist2target(properties); + plist = proplist2target(properties); call_provider((ProviderMIHandle*)self->hdl, &status, "set_instance", 5, _context, @@ -501,6 +535,10 @@ const CMPIResult * results, const CMPIObjectPath * reference) { + Target_Type _context; + Target_Type _result; + Target_Type _reference; + CMPIStatus status = {CMPI_RC_OK, NULL}; _SBLIM_TRACE(1,("DeleteInstance() called, context %p, results %p, reference %p", context, results, reference)); @@ -508,9 +546,9 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); - Target_Type _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); - Target_Type _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); + _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "delete_instance", 3, @@ -536,6 +574,12 @@ const char * query, const char * language) { + Target_Type _context; + Target_Type _result; + Target_Type _reference; + Target_Type _query; + Target_Type _lang; + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; /* Return status of CIM operations. */ _SBLIM_TRACE(1,("ExecQuery() called, context %p, results %p, reference %p, query %s, language %s", context, results, reference, query, language)); @@ -543,12 +587,12 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); - Target_Type _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); - Target_Type _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); + _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); TARGET_THREAD_END_BLOCK; - Target_Type _query = string2target(query); - Target_Type _lang = string2target(language); + _query = string2target(query); + _lang = string2target(language); call_provider((ProviderMIHandle*)self->hdl, &status, "exec_query", 5, _context, @@ -583,6 +627,14 @@ const char* role, const char* resultRole) { + Target_Type _ctx; + Target_Type _rslt; + Target_Type _objName ; + Target_Type _assocClass; + Target_Type _resultClass; + Target_Type _role; + Target_Type _resultRole; + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; _SBLIM_TRACE(1,("associatorNames() called, ctx %p, rslt %p, objName %p, assocClass %s, resultClass %s, role %s, resultRole %s", ctx, rslt, objName, assocClass, resultClass, role, resultRole)); @@ -590,14 +642,14 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - Target_Type _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); - Target_Type _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); + _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); + _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); TARGET_THREAD_END_BLOCK; - Target_Type _assocClass = Target_Null; - Target_Type _resultClass = Target_Null; - Target_Type _role = Target_Null; - Target_Type _resultRole = Target_Null; + _assocClass = Target_Null; + _resultClass = Target_Null; + _role = Target_Null; + _resultRole = Target_Null; if (assocClass != NULL) { _assocClass = string2target(assocClass); @@ -645,6 +697,15 @@ const char* resultRole, const char** properties) { + Target_Type _ctx; + Target_Type _rslt; + Target_Type _objName; + Target_Type _props; + Target_Type _assocClass; + Target_Type _resultClass; + Target_Type _role; + Target_Type _resultRole; + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; _SBLIM_TRACE(1,("associators() called, ctx %p, rslt %p, objName %p, assocClass %s, resultClass %s, role %s, resultRole %s", ctx, rslt, objName, assocClass, resultClass, role, resultRole)); @@ -652,15 +713,15 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - Target_Type _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); - Target_Type _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); + _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); + _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); TARGET_THREAD_END_BLOCK; - Target_Type _props = proplist2target(properties); - Target_Type _assocClass = Target_Null; - Target_Type _resultClass = Target_Null; - Target_Type _role = Target_Null; - Target_Type _resultRole = Target_Null; + _props = proplist2target(properties); + _assocClass = Target_Null; + _resultClass = Target_Null; + _role = Target_Null; + _resultRole = Target_Null; if (assocClass != NULL) { _assocClass = string2target(assocClass); @@ -706,6 +767,12 @@ const char* resultClass, const char* role) { + Target_Type _ctx; + Target_Type _rslt; + Target_Type _objName; + Target_Type _resultClass; + Target_Type _role; + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; _SBLIM_TRACE(1,("referenceNames() called, ctx %p, rslt %p, objName %p, resultClass %s, role %s", ctx, rslt, objName, resultClass, role)); @@ -713,12 +780,12 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - Target_Type _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); - Target_Type _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); + _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); + _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); TARGET_THREAD_END_BLOCK; - Target_Type _resultClass = Target_Null; - Target_Type _role = Target_Null; + _resultClass = Target_Null; + _role = Target_Null; if (role != NULL) { _role = string2target(role); @@ -755,6 +822,13 @@ const char* role, const char** properties) { + Target_Type _ctx; + Target_Type _rslt; + Target_Type _objName; + Target_Type _role; + Target_Type _resultClass; + Target_Type _props; + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; _SBLIM_TRACE(1,("references() called, ctx %p, rslt %p, objName %p, resultClass %s, role %s, properties %p", ctx, rslt, objName, resultClass, role, properties)); @@ -762,12 +836,12 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - Target_Type _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); - Target_Type _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); + _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); + _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); TARGET_THREAD_END_BLOCK; - Target_Type _role = Target_Null; - Target_Type _resultClass = Target_Null; + _role = Target_Null; + _resultClass = Target_Null; if (role != NULL) { _role = string2target(role); @@ -776,7 +850,7 @@ { _resultClass = string2target(resultClass); } - Target_Type _props = proplist2target(properties); + _props = proplist2target(properties); call_provider((ProviderMIHandle*)self->hdl, &status, "references", 6, _ctx, @@ -803,6 +877,13 @@ const CMPIArgs* in, CMPIArgs* out) { + Target_Type _ctx; + Target_Type _rslt; + Target_Type _objName; + Target_Type _in; + Target_Type _out; + Target_Type _method; + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; _SBLIM_TRACE(1,("invokeMethod() called, ctx %p, rslt %p, objName %p, method %s, in %p, out %p", ctx, rslt, objName, method, in, out)); @@ -810,13 +891,13 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - Target_Type _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); - Target_Type _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); - Target_Type _in = SWIG_NewPointerObj((void*) in, SWIGTYPE_p__CMPIArgs, 0); - Target_Type _out = SWIG_NewPointerObj((void*) out, SWIGTYPE_p__CMPIArgs, 0); + _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); + _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); + _in = SWIG_NewPointerObj((void*) in, SWIGTYPE_p__CMPIArgs, 0); + _out = SWIG_NewPointerObj((void*) out, SWIGTYPE_p__CMPIArgs, 0); TARGET_THREAD_END_BLOCK; - Target_Type _method = string2target(method); + _method = string2target(method); call_provider((ProviderMIHandle*)self->hdl, &status, "invoke_method", 6, _ctx, @@ -843,6 +924,12 @@ const CMPIObjectPath* classPath, const char* owner) { + Target_Type _ctx; + Target_Type _filter; + Target_Type _classPath; + Target_Type _className; + Target_Type _owner; + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; _SBLIM_TRACE(1,("authorizeFilter() called, ctx %p, filter %p, className %s, classPath %p, owner %s", ctx, filter, className, classPath, owner)); @@ -850,12 +937,12 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - Target_Type _filter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); - Target_Type _classPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); + _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + _filter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); + _classPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); TARGET_THREAD_END_BLOCK; - Target_Type _className = string2target(className); - Target_Type _owner = string2target(owner); + _className = string2target(className); + _owner = string2target(owner); call_provider((ProviderMIHandle*)self->hdl, &status, "authorize_filter", 5, _ctx, @@ -882,18 +969,23 @@ CMPIBoolean firstActivation) { CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + Target_Type _ctx; + Target_Type _filter; + Target_Type _classPath; + Target_Type _firstActivation; + Target_Type _className; _SBLIM_TRACE(1,("activateFilter() called, ctx %p, filter %p, className %s, classPath %p, firstActivation %d", ctx, filter, className, classPath, firstActivation)); TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - Target_Type _filter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); - Target_Type _classPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); - Target_Type _firstActivation = Target_Bool(firstActivation); + _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + _filter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); + _classPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); + _firstActivation = Target_Bool(firstActivation); TARGET_THREAD_END_BLOCK; - Target_Type _className = string2target(className); + _className = string2target(className); call_provider((ProviderMIHandle*)self->hdl, &status, "activate_filter", 5, _ctx, @@ -920,18 +1012,23 @@ CMPIBoolean lastActivation) { CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + Target_Type _ctx; + Target_Type _filter; + Target_Type _classPath; + Target_Type _lastActivation; + Target_Type _className; _SBLIM_TRACE(1,("deActivateFilter() called, ctx %p, filter %p, className %s, classPath %p, lastActivation %d", ctx, filter, className, classPath, lastActivation)); TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - Target_Type _filter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); - Target_Type _classPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); - Target_Type _lastActivation = Target_Bool(lastActivation); + _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + _filter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); + _classPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); + _lastActivation = Target_Bool(lastActivation); TARGET_THREAD_END_BLOCK; - Target_Type _className = string2target(className); + _className = string2target(className); call_provider((ProviderMIHandle*)self->hdl, &status, "deactivate_filter", 5, _ctx, @@ -959,6 +1056,10 @@ const char* className, const CMPIObjectPath* classPath) { + Target_Type _ctx; + Target_Type _className; + Target_Type _filter; + Target_Type _classPath; CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; //_SBLIM_TRACE(1,("mustPoll() called, ctx %p, rslt %p, filter %p, className %s, classPath %p", ctx, rslt, filter, className, classPath)); @@ -967,12 +1068,12 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); //Target_Type _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); - Target_Type _filter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); - Target_Type _classPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); + _filter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); + _classPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); TARGET_THREAD_END_BLOCK; - Target_Type _className = string2target(className); + _className = string2target(className); call_provider((ProviderMIHandle*)self->hdl, &status, "must_poll", 4, _ctx, @@ -995,6 +1096,7 @@ CMPIIndicationMI* self, const CMPIContext* ctx) { + Target_Type _ctx; CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; _SBLIM_TRACE(1,("enableIndications() called, ctx %p", ctx)); @@ -1002,7 +1104,7 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "enable_indications", 1, _ctx); @@ -1022,6 +1124,7 @@ CMPIIndicationMI* self, const CMPIContext* ctx) { + Target_Type _ctx; CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; _SBLIM_TRACE(1,("disableIndications() called, ctx %p", ctx)); @@ -1029,7 +1132,7 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "disable_indications", 1, _ctx); @@ -1113,14 +1216,16 @@ CMPI##ptype##MI* _Generic_Create_##ptype##MI(const CMPIBroker* broker, \ const CMPIContext* context, const char* miname, CMPIStatus* st)\ { \ + CMPI##ptype##MI *mi; \ + ProviderMIHandle *hdl; \ _SBLIM_TRACE(1, ("\n>>>>> in FACTORY: CMPI"#ptype"MI* _Generic_Create_"#ptype"MI... miname=%s", miname)); \ - ProviderMIHandle *hdl = (ProviderMIHandle*)malloc(sizeof(ProviderMIHandle)); \ + hdl = (ProviderMIHandle*)malloc(sizeof(ProviderMIHandle)); \ if (hdl) { \ hdl->instance = Target_Null; \ hdl->miName = strdup(miname); \ hdl->broker = broker; \ } \ - CMPI##ptype##MI *mi= (CMPI##ptype##MI*)malloc(sizeof(CMPI##ptype##MI)); \ + mi= (CMPI##ptype##MI*)malloc(sizeof(CMPI##ptype##MI)); \ if (mi) { \ mi->hdl = hdl; \ mi->ft = &ptype##MIFT__; \ Modified: cmpi-bindings/trunk/src/target_perl.c =================================================================== --- cmpi-bindings/trunk/src/target_perl.c 2008-10-09 17:26:31 UTC (rev 1079) +++ cmpi-bindings/trunk/src/target_perl.c 2008-10-09 17:27:29 UTC (rev 1080) @@ -37,6 +37,7 @@ { int error; char *embedding[] = { "", "-e", "0" }; + extern void SWIG_init(PerlInterpreter* my_perl, CV* cv); if (_TARGET_INIT) { @@ -49,8 +50,6 @@ perl_construct(_TARGET_INIT); perl_parse(_TARGET_INIT, NULL, 3, embedding, NULL); perl_run(_TARGET_INIT); - - extern void SWIG_init(PerlInterpreter* my_perl, CV* cv); SWIG_init(_TARGET_INIT, NULL); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mik...@us...> - 2008-10-09 17:26:37
|
Revision: 1079 http://omc.svn.sourceforge.net/omc/?rev=1079&view=rev Author: mike-brasher Date: 2008-10-09 17:26:31 +0000 (Thu, 09 Oct 2008) Log Message: ----------- Fixed ISO compiler errors (illegal mixed declarations) Modified Paths: -------------- cmpi-bindings/trunk/swig/cmpi_types.i Modified: cmpi-bindings/trunk/swig/cmpi_types.i =================================================================== --- cmpi-bindings/trunk/swig/cmpi_types.i 2008-10-08 17:46:22 UTC (rev 1078) +++ cmpi-bindings/trunk/swig/cmpi_types.i 2008-10-09 17:26:31 UTC (rev 1079) @@ -459,6 +459,7 @@ SV* #endif get_key_at(int index) { + Target_Type tdata; CMPIString *s = NULL; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData data = CMGetKeyAt($self, index, &s, &st); @@ -470,7 +471,7 @@ } TARGET_THREAD_BEGIN_BLOCK; - Target_Type tdata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 1); + tdata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 1); #if defined (SWIGPYTHON) result = PyTuple_New(2); PyTuple_SetItem(result, 0, tdata); @@ -793,16 +794,18 @@ #endif get_property_at(int index) { + Target_Type tdata; + Target_Type result; CMPIString *s = NULL; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData data = CMGetPropertyAt($self, index, &s, &st); - Target_Type result = Target_Null; + result = Target_Null; if (st.rc) { RAISE_IF(st); return result; } - Target_Type tdata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 1); + tdata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 1); TARGET_THREAD_BEGIN_BLOCK; #if defined (SWIGPYTHON) @@ -932,17 +935,19 @@ #endif get_arg_at(int index) { + Target_Type tdata; + Target_Type result; CMPIString *s = NULL; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData data = CMGetArgAt($self, index, &s, &st); - Target_Type result = Target_Null; + result = Target_Null; if (st.rc) { RAISE_IF(st); return result; } - Target_Type tdata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 1); + tdata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 1); TARGET_THREAD_BEGIN_BLOCK; #if defined (SWIGPYTHON) @@ -1182,17 +1187,19 @@ SV* #endif get_entry_at(int index) { + Target_Type tdata; + Target_Type result; CMPIString *s = NULL; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData data = CMGetContextEntryAt($self, index, &s, &st); - Target_Type result = Target_Null; + result = Target_Null; if (st.rc) { RAISE_IF(st); return result; } - Target_Type tdata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 1); + tdata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 1); TARGET_THREAD_BEGIN_BLOCK; #if defined (SWIGPYTHON) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |