genprovider 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/CHANGELOG +8 -0
  2. data/CHANGELOG~ +4 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE +58 -0
  5. data/README.rdoc +50 -0
  6. data/Rakefile +6 -0
  7. data/bin/genprovider +256 -0
  8. data/bin/regprovider +105 -0
  9. data/features/003-create.feature +10 -0
  10. data/features/004-modify.feature +9 -0
  11. data/features/005-delete.feature +7 -0
  12. data/features/datatypes.feature +13 -0
  13. data/features/ensure-format.feature +28 -0
  14. data/features/have-instances.feature +19 -0
  15. data/features/mof/trivial.mof +20 -0
  16. data/features/registration.feature +12 -0
  17. data/features/run-genprovider.feature +10 -0
  18. data/features/show-context.feature +9 -0
  19. data/features/step_definitions/genprovider.rb +52 -0
  20. data/features/step_definitions/mof.rb +3 -0
  21. data/features/step_definitions/registration.rb +21 -0
  22. data/features/step_definitions/wbemcli.rb +58 -0
  23. data/features/support/env.rb +20 -0
  24. data/genprovider.gemspec +36 -0
  25. data/lib/genprovider/class.rb +200 -0
  26. data/lib/genprovider/classinfo.rb +88 -0
  27. data/lib/genprovider/output.rb +104 -0
  28. data/lib/genprovider/provider.rb +721 -0
  29. data/lib/genprovider/rdoc.rb +149 -0
  30. data/lib/genprovider/registration.rb +22 -0
  31. data/lib/genprovider/testcase.rb +139 -0
  32. data/lib/genprovider/version.rb +3 -0
  33. data/lib/genprovider.rb +35 -0
  34. data/samples/mof/LMI_Embedded.mof +6 -0
  35. data/samples/mof/RCP_ArrayDataTypes.mof +27 -0
  36. data/samples/mof/RCP_ClassMethod.mof +7 -0
  37. data/samples/mof/RCP_ComplexMethod.mof +14 -0
  38. data/samples/mof/RCP_IndicationGenerator.mof +13 -0
  39. data/samples/mof/RCP_PassCData.mof +10 -0
  40. data/samples/mof/RCP_ShowContext.mof +11 -0
  41. data/samples/mof/RCP_SimpleClass.mof +7 -0
  42. data/samples/mof/RCP_SimpleDataTypes.mof +27 -0
  43. data/samples/mof/RCP_SimpleMethod.mof +9 -0
  44. data/samples/mof/qualifiers.mof +20 -0
  45. data/samples/provider/lmi_embedded.rb +148 -0
  46. data/samples/provider/rcp_array_data_types.rb +219 -0
  47. data/samples/provider/rcp_class_method.rb +54 -0
  48. data/samples/provider/rcp_complex_method.rb +170 -0
  49. data/samples/provider/rcp_pass_c_data.rb +130 -0
  50. data/samples/provider/rcp_show_context.rb +134 -0
  51. data/samples/provider/rcp_simple_class.rb +124 -0
  52. data/samples/provider/rcp_simple_data_types.rb +152 -0
  53. data/samples/provider/rcp_simple_method.rb +143 -0
  54. data/samples/registration/LMI_Embedded.registration +7 -0
  55. data/samples/registration/RCP_ArrayDataTypes.registration +7 -0
  56. data/samples/registration/RCP_ClassMethod.registration +8 -0
  57. data/samples/registration/RCP_ComplexMethod.registration +8 -0
  58. data/samples/registration/RCP_PassCData.registration +7 -0
  59. data/samples/registration/RCP_ShowContext.registration +7 -0
  60. data/samples/registration/RCP_SimpleDataTypes.registration +7 -0
  61. data/samples/registration/RCP_SimpleMethod.registration +8 -0
  62. data/samples/sfcb.reg/RCP_ComputerSystem.reg +5 -0
  63. data/samples/sfcb.reg/RCP_OSProcess.reg +5 -0
  64. data/samples/sfcb.reg/RCP_OperatingSystem.reg +5 -0
  65. data/samples/sfcb.reg/RCP_PhysicalMemory.reg +5 -0
  66. data/samples/sfcb.reg/RCP_Processor.reg +5 -0
  67. data/samples/sfcb.reg/RCP_RunningOS.reg +5 -0
  68. data/samples/sfcb.reg/RCP_SimpleClass.reg +5 -0
  69. data/samples/sfcb.reg/RCP_UnixProcess.reg +5 -0
  70. data/sfcbd +4 -0
  71. data/stress.sh +4 -0
  72. data/tasks/clean.rake +4 -0
  73. data/tasks/doc.rake +16 -0
  74. data/tasks/features.rake +8 -0
  75. data/tasks/prepstage.rake +16 -0
  76. data/tasks/registration.rake +10 -0
  77. data/tasks/sfcb.rake +3 -0
  78. data/tasks/test.rake +10 -0
  79. data/test/env.rb +23 -0
  80. data/test/helper.rb +23 -0
  81. data/test/mkreg.rb +32 -0
  82. data/test/mof/RCP_ClassMethod.rb +15 -0
  83. data/test/mof/RCP_ComplexMethod.rb +16 -0
  84. data/test/mof/RCP_SimpleMethod.rb +15 -0
  85. data/test/registration.rb +37 -0
  86. data/test/sfcb.rb +94 -0
  87. data/test/test_lmi_embedded.rb +64 -0
  88. data/test/test_rcp_array_data_types.rb +140 -0
  89. data/test/test_rcp_class_method.rb +31 -0
  90. data/test/test_rcp_complex_method.rb +68 -0
  91. data/test/test_rcp_simple_data_types.rb +66 -0
  92. data/test/test_rcp_simple_method.rb +47 -0
  93. data/valgrind +8 -0
  94. metadata +288 -0
@@ -0,0 +1,124 @@
1
+ #
2
+ # Provider RCP_SimpleClass for class RCP_SimpleClass:CIM::Class
3
+ #
4
+ require 'syslog'
5
+
6
+ require 'cmpi/provider'
7
+
8
+ module Cmpi
9
+ #
10
+ # A simple class to detect memory leaks in cmpi-bindings
11
+ #
12
+ class RCP_SimpleClass < InstanceProvider
13
+
14
+ #
15
+ # Provider initialization
16
+ #
17
+ def initialize( name, broker, context )
18
+ @trace_file = STDERR
19
+ super broker
20
+ end
21
+
22
+ def cleanup( context, terminating )
23
+ @trace_file.puts "cleanup terminating? #{terminating}"
24
+ true
25
+ end
26
+
27
+ def self.typemap
28
+ {
29
+ "Name" => Cmpi::string,
30
+ }
31
+ end
32
+
33
+ private
34
+ #
35
+ # Iterator for names and instances
36
+ # yields references matching reference and properties
37
+ #
38
+ def each( context, reference, properties = nil, want_instance = false )
39
+ if want_instance
40
+ result = Cmpi::CMPIObjectPath.new reference.namespace, "RCP_SimpleClass"
41
+ result = Cmpi::CMPIInstance.new result
42
+ else
43
+ result = Cmpi::CMPIObjectPath.new reference.namespace, "RCP_SimpleClass"
44
+ end
45
+
46
+ # Set key properties
47
+
48
+ result.Name = "simple class" # string (-> RCP_SimpleClass)
49
+ unless want_instance
50
+ yield result
51
+ return
52
+ end
53
+
54
+ # Instance: Set non-key properties
55
+
56
+ yield result
57
+ end
58
+ public
59
+
60
+ def enum_instance_names( context, result, reference )
61
+ @trace_file.puts "enum_instance_names ref #{reference}"
62
+ each(context, reference) do |ref|
63
+ @trace_file.puts "ref #{ref}"
64
+ result.return_objectpath ref
65
+ end
66
+ result.done
67
+ true
68
+ end
69
+
70
+ def enum_instances( context, result, reference, properties )
71
+ @trace_file.puts "enum_instances ref #{reference}, props #{properties.inspect}"
72
+ each(context, reference, properties, true) do |instance|
73
+ @trace_file.puts "instance #{instance}"
74
+ result.return_instance instance
75
+ end
76
+ result.done
77
+ true
78
+ end
79
+
80
+ def get_instance( context, result, reference, properties )
81
+ @trace_file.puts "get_instance ref #{reference}, props #{properties.inspect}"
82
+ each(context, reference, properties, true) do |instance|
83
+ @trace_file.puts "instance #{instance}"
84
+ result.return_instance instance
85
+ break # only return first instance
86
+ end
87
+ result.done
88
+ true
89
+ end
90
+
91
+ def create_instance( context, result, reference, newinst )
92
+ @trace_file.puts "create_instance ref #{reference}, newinst #{newinst.inspect}"
93
+ # Create instance according to reference and newinst
94
+ result.return_objectpath reference
95
+ result.done
96
+ true
97
+ end
98
+
99
+ def set_instance( context, result, reference, newinst, properties )
100
+ @trace_file.puts "set_instance ref #{reference}, newinst #{newinst.inspect}, props #{properties.inspect}"
101
+ properties.each do |prop|
102
+ newinst.send "#{prop.name}=".to_sym, FIXME
103
+ end
104
+ result.return_instance newinst
105
+ result.done
106
+ true
107
+ end
108
+
109
+ def delete_instance( context, result, reference )
110
+ @trace_file.puts "delete_instance ref #{reference}"
111
+ result.done
112
+ true
113
+ end
114
+
115
+ # query : String
116
+ # lang : String
117
+ def exec_query( context, result, reference, query, lang )
118
+ @trace_file.puts "exec_query ref #{reference}, query #{query}, lang #{lang}"
119
+ result.done
120
+ true
121
+ end
122
+
123
+ end
124
+ end
@@ -0,0 +1,152 @@
1
+ #
2
+ # Provider RCP_SimpleDataTypes for class RCP_SimpleDataTypes:CIM::Class
3
+ #
4
+ require 'syslog'
5
+
6
+ require 'cmpi/provider'
7
+
8
+ module Cmpi
9
+ #
10
+ # A dummy class to represent various data types
11
+ #
12
+ class RCP_SimpleDataTypes < InstanceProvider
13
+
14
+ #
15
+ # Provider initialization
16
+ #
17
+ def initialize( name, broker, context )
18
+ @trace_file = STDERR
19
+ super broker
20
+ end
21
+
22
+ def cleanup( context, terminating )
23
+ @trace_file.puts "cleanup terminating? #{terminating}"
24
+ true
25
+ end
26
+
27
+ def self.typemap
28
+ {
29
+ "Name" => Cmpi::string,
30
+ "bool" => Cmpi::boolean,
31
+ "text" => Cmpi::string,
32
+ "char_16" => Cmpi::char16,
33
+ "unsigned_int_8" => Cmpi::uint8,
34
+ "unsigned_int_16" => Cmpi::uint16,
35
+ "unsigned_int_32" => Cmpi::uint32,
36
+ "unsigned_int_64" => Cmpi::uint64,
37
+ "byte" => Cmpi::sint8,
38
+ "short" => Cmpi::sint16,
39
+ "int" => Cmpi::sint32,
40
+ "long" => Cmpi::sint64,
41
+ "float" => Cmpi::real32,
42
+ "double" => Cmpi::real64,
43
+ "date_time" => Cmpi::dateTime,
44
+ }
45
+ end
46
+
47
+ private
48
+ #
49
+ # Iterator for names and instances
50
+ # yields references matching reference and properties
51
+ #
52
+ def each( context, reference, properties = nil, want_instance = false )
53
+ if want_instance
54
+ result = Cmpi::CMPIObjectPath.new reference.namespace, "RCP_SimpleDataTypes"
55
+ result = Cmpi::CMPIInstance.new result
56
+ else
57
+ result = Cmpi::CMPIObjectPath.new reference.namespace, "RCP_SimpleDataTypes"
58
+ end
59
+
60
+ # Set key properties
61
+
62
+ result.Name = "Sample"
63
+ unless want_instance
64
+ yield result
65
+ return
66
+ end
67
+
68
+ # Instance: Set non-key properties
69
+
70
+ result.bool = true
71
+ result.text = "This is new text"
72
+ result.char_16 = 65535
73
+ result.unsigned_int_8 = 123
74
+ result.unsigned_int_16 = 12345
75
+ result.unsigned_int_32 = 1234567890
76
+ result.unsigned_int_64 = 1234567891011121314
77
+ result.byte = -1
78
+ result.short = -1
79
+ result.int = -1
80
+ result.long = -1
81
+ result.float = 3.142592653
82
+ result.double = Math::PI
83
+ result.date_time = Time.now #0
84
+ yield result
85
+ end
86
+ public
87
+
88
+ def enum_instance_names( context, result, reference )
89
+ @trace_file.puts "enum_instance_names ref #{reference}"
90
+ each(context, reference) do |ref|
91
+ @trace_file.puts "ref #{ref}"
92
+ result.return_objectpath ref
93
+ end
94
+ result.done
95
+ true
96
+ end
97
+
98
+ def enum_instances( context, result, reference, properties )
99
+ @trace_file.puts "enum_instances ref #{reference}, props #{properties.inspect}"
100
+ each(context, reference, properties, true) do |instance|
101
+ @trace_file.puts "instance #{instance}"
102
+ result.return_instance instance
103
+ end
104
+ result.done
105
+ true
106
+ end
107
+
108
+ def get_instance( context, result, reference, properties )
109
+ @trace_file.puts "get_instance ref #{reference}, props #{properties.inspect}"
110
+ each(context, reference, properties, true) do |instance|
111
+ @trace_file.puts "instance #{instance}"
112
+ result.return_instance instance
113
+ break # only return first instance
114
+ end
115
+ result.done
116
+ true
117
+ end
118
+
119
+ def create_instance( context, result, reference, newinst )
120
+ @trace_file.puts "create_instance ref #{reference}, newinst #{newinst.inspect}"
121
+ # Create instance according to reference and newinst
122
+ result.return_objectpath reference
123
+ result.done
124
+ true
125
+ end
126
+
127
+ def set_instance( context, result, reference, newinst, properties )
128
+ @trace_file.puts "set_instance ref #{reference}, newinst #{newinst.inspect}, props #{properties.inspect}"
129
+ properties.each do |prop|
130
+ newinst.send "#{prop.name}=".to_sym, FIXME
131
+ end
132
+ result.return_instance newinst
133
+ result.done
134
+ true
135
+ end
136
+
137
+ def delete_instance( context, result, reference )
138
+ @trace_file.puts "delete_instance ref #{reference}"
139
+ result.done
140
+ true
141
+ end
142
+
143
+ # query : String
144
+ # lang : String
145
+ def exec_query( context, result, reference, query, lang )
146
+ @trace_file.puts "exec_query ref #{reference}, query #{query}, lang #{lang}"
147
+ result.done
148
+ true
149
+ end
150
+
151
+ end
152
+ end
@@ -0,0 +1,143 @@
1
+ #
2
+ # Provider RCP_SimpleMethod for class RCP_SimpleMethod:CIM::Class
3
+ #
4
+ require 'syslog'
5
+
6
+ require 'cmpi/provider'
7
+
8
+ module Cmpi
9
+ #
10
+ # A simple class to implement Method
11
+ #
12
+ class RCP_SimpleMethod < MethodProvider
13
+
14
+ include InstanceProviderIF
15
+ #
16
+ # Provider initialization
17
+ #
18
+ def initialize( name, broker, context )
19
+ @trace_file = STDERR
20
+ super broker
21
+ end
22
+
23
+ def cleanup( context, terminating )
24
+ @trace_file.puts "cleanup terminating? #{terminating}"
25
+ true
26
+ end
27
+
28
+ def self.typemap
29
+ {
30
+ "Name" => Cmpi::string,
31
+ }
32
+ end
33
+
34
+ # Methods
35
+
36
+ # RCP_SimpleMethod: ReturnTrue
37
+ #
38
+ def return_true_args; [[],[Cmpi::boolean, ]] end
39
+ #
40
+ # Input args
41
+ #
42
+ # Additional output args
43
+ #
44
+ def return_true( context, reference )
45
+ @trace_file.puts "return_true #{context}, #{reference}"
46
+ result = true # boolean
47
+ # function body goes here
48
+ return result
49
+ end
50
+
51
+
52
+ private
53
+ #
54
+ # Iterator for names and instances
55
+ # yields references matching reference and properties
56
+ #
57
+ def each( context, reference, properties = nil, want_instance = false )
58
+ if want_instance
59
+ result = Cmpi::CMPIObjectPath.new reference.namespace, "RCP_SimpleMethod"
60
+ result = Cmpi::CMPIInstance.new result
61
+ else
62
+ result = Cmpi::CMPIObjectPath.new reference.namespace, "RCP_SimpleMethod"
63
+ end
64
+
65
+ # Set key properties
66
+
67
+ result.Name = "Func" # string (-> RCP_SimpleMethod)
68
+ unless want_instance
69
+ yield result
70
+ return
71
+ end
72
+
73
+ # Instance: Set non-key properties
74
+
75
+ yield result
76
+ end
77
+ public
78
+
79
+ def enum_instance_names( context, result, reference )
80
+ @trace_file.puts "enum_instance_names ref #{reference}"
81
+ each(context, reference) do |ref|
82
+ @trace_file.puts "ref #{ref}"
83
+ result.return_objectpath ref
84
+ end
85
+ result.done
86
+ true
87
+ end
88
+
89
+ def enum_instances( context, result, reference, properties )
90
+ @trace_file.puts "enum_instances ref #{reference}, props #{properties.inspect}"
91
+ each(context, reference, properties, true) do |instance|
92
+ @trace_file.puts "instance #{instance}"
93
+ result.return_instance instance
94
+ end
95
+ result.done
96
+ true
97
+ end
98
+
99
+ def get_instance( context, result, reference, properties )
100
+ @trace_file.puts "get_instance ref #{reference}, props #{properties.inspect}"
101
+ each(context, reference, properties, true) do |instance|
102
+ @trace_file.puts "instance #{instance}"
103
+ result.return_instance instance
104
+ break # only return first instance
105
+ end
106
+ result.done
107
+ true
108
+ end
109
+
110
+ def create_instance( context, result, reference, newinst )
111
+ @trace_file.puts "create_instance ref #{reference}, newinst #{newinst.inspect}"
112
+ # Create instance according to reference and newinst
113
+ result.return_objectpath reference
114
+ result.done
115
+ true
116
+ end
117
+
118
+ def set_instance( context, result, reference, newinst, properties )
119
+ @trace_file.puts "set_instance ref #{reference}, newinst #{newinst.inspect}, props #{properties.inspect}"
120
+ properties.each do |prop|
121
+ newinst.send "#{prop.name}=".to_sym, FIXME
122
+ end
123
+ result.return_instance newinst
124
+ result.done
125
+ true
126
+ end
127
+
128
+ def delete_instance( context, result, reference )
129
+ @trace_file.puts "delete_instance ref #{reference}"
130
+ result.done
131
+ true
132
+ end
133
+
134
+ # query : String
135
+ # lang : String
136
+ def exec_query( context, result, reference, query, lang )
137
+ @trace_file.puts "exec_query ref #{reference}, query #{query}, lang #{lang}"
138
+ result.done
139
+ true
140
+ end
141
+
142
+ end
143
+ end
@@ -0,0 +1,7 @@
1
+ #
2
+ # Registration for provider LMI_Embedded of class LMI_Embedded
3
+ #
4
+ # Generated by 'genprovider' for use with cmpi-bindings-ruby
5
+ #
6
+ # Classname - Namespace - Providername - Libraryname - Capabilities ...
7
+ LMI_Embedded test/test LMI_Embedded rbCmpiProvider instance
@@ -0,0 +1,7 @@
1
+ #
2
+ # Registration for provider RCP_ArrayDataTypes of class RCP_ArrayDataTypes
3
+ #
4
+ # Generated by 'genprovider' for use with cmpi-bindings-ruby
5
+ #
6
+ # Classname - Namespace - Providername - Libraryname - Capabilities ...
7
+ RCP_ArrayDataTypes test/test RCP_ArrayDataTypes rbCmpiProvider instance
@@ -0,0 +1,8 @@
1
+ #
2
+ # Registration for provider RCP_ClassMethod of class
3
+ # RCP_ClassMethod
4
+ #
5
+ # Generated by 'genprovider' for use with cmpi-bindings-ruby
6
+ #
7
+ # Classname - Namespace - Providername - Libraryname - Capabilities ...
8
+ RCP_ClassMethod test/test RCP_ClassMethod rbCmpiProvider instance method
@@ -0,0 +1,8 @@
1
+ #
2
+ # Registration for provider RCP_ComplexMethod of class
3
+ # RCP_ComplexMethod
4
+ #
5
+ # Generated by 'genprovider' for use with cmpi-bindings-ruby
6
+ #
7
+ # Classname - Namespace - Providername - Libraryname - Capabilities ...
8
+ RCP_ComplexMethod test/test RCP_ComplexMethod rbCmpiProvider instance method
@@ -0,0 +1,7 @@
1
+ #
2
+ # Registration for provider RCP_PassCData of class RCP_PassCData
3
+ #
4
+ # Generated by 'genprovider' for use with cmpi-bindings-ruby
5
+ #
6
+ # Classname - Namespace - Providername - Libraryname - Capabilities ...
7
+ RCP_PassCData test/test RCP_PassCData rbCmpiProvider instance
@@ -0,0 +1,7 @@
1
+ #
2
+ # Registration for provider RCP_ShowContext of class RCP_ShowContext
3
+ #
4
+ # Generated by 'genprovider' for use with cmpi-bindings-ruby
5
+ #
6
+ # Classname - Namespace - Providername - Libraryname - Capabilities ...
7
+ RCP_ShowContext test/test RCP_ShowContext rbCmpiProvider instance
@@ -0,0 +1,7 @@
1
+ #
2
+ # Registration for provider RCP_SimpleDataTypes of class RCP_SimpleDataTypes
3
+ #
4
+ # Generated by 'genprovider' for use with cmpi-bindings-ruby
5
+ #
6
+ # Classname - Namespace - Providername - Libraryname - Capabilities ...
7
+ RCP_SimpleDataTypes test/test RCP_SimpleDataTypes rbCmpiProvider instance
@@ -0,0 +1,8 @@
1
+ #
2
+ # Registration for provider RCP_SimpleMethod of class
3
+ # RCP_SimpleMethod
4
+ #
5
+ # Generated by 'genprovider' for use with cmpi-bindings-ruby
6
+ #
7
+ # Classname - Namespace - Providername - Libraryname - Capabilities ...
8
+ RCP_SimpleMethod test/test RCP_SimpleMethod rbCmpiProvider instance method
@@ -0,0 +1,5 @@
1
+ [RCP_ComputerSystem]
2
+ location: rbCmpiProvider
3
+ provider: RCP_ComputerSystem
4
+ type: instance method
5
+ namespace: root/cimv2
@@ -0,0 +1,5 @@
1
+ [RCP_OSProcess]
2
+ location: rbCmpiProvider
3
+ provider: RCP_OSProcess
4
+ type: instance association
5
+ namespace: root/cimv2
@@ -0,0 +1,5 @@
1
+ [RCP_OperatingSystem]
2
+ location: rbCmpiProvider
3
+ provider: RCP_OperatingSystem
4
+ type: instance method
5
+ namespace: root/cimv2
@@ -0,0 +1,5 @@
1
+ [RCP_PhysicalMemory]
2
+ location: rbCmpiProvider
3
+ provider: RCP_PhysicalMemory
4
+ type: instance
5
+ namespace: root/cimv2
@@ -0,0 +1,5 @@
1
+ [RCP_Processor]
2
+ location: rbCmpiProvider
3
+ provider: RCP_Processor
4
+ type: instance
5
+ namespace: root/cimv2
@@ -0,0 +1,5 @@
1
+ [RCP_RunningOS]
2
+ location: rbCmpiProvider
3
+ provider: RCP_RunningOS
4
+ type: instance method
5
+ namespace: root/cimv2
@@ -0,0 +1,5 @@
1
+ [RCP_SimpleClass]
2
+ location: rbCmpiProvider
3
+ provider: RCP_SimpleClass
4
+ type: instance
5
+ namespace: root/cimv2
@@ -0,0 +1,5 @@
1
+ [RCP_UnixProcess]
2
+ location: rbCmpiProvider
3
+ provider: RCP_UnixProcess
4
+ type: instance method
5
+ namespace: root/cimv2
data/sfcbd ADDED
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ rm -f core*
3
+ export RUBY_PROVIDERS_DIR=`pwd`/samples/provider
4
+ sfcbd
data/stress.sh ADDED
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ for i in $(seq 1 10); do
3
+ wbemecn -noverify https://wsman:secret@localhost:5989/root/cimv2:RCP_SimpleClass
4
+ done
data/tasks/clean.rake ADDED
@@ -0,0 +1,4 @@
1
+ require 'rake/clean'
2
+ CLEAN.include("**/*~", "Gemfile.lock", "doc", ".yardoc", "pkg",
3
+ "generated", "tmp", "samples/provider/*.rdoc",
4
+ "samples/provider/*.registration")
data/tasks/doc.rake ADDED
@@ -0,0 +1,16 @@
1
+ task :doc do
2
+ begin
3
+ require 'yard'
4
+ YARD::Rake::YardocTask.new(:doc) do |t|
5
+ t.files = ['lib/**/*.rb']
6
+ t.options = ['--no-private']
7
+ end
8
+ rescue LoadError
9
+ STDERR.puts "Install yard if you want prettier docs"
10
+ require 'rdoc/task'
11
+ Rake::RDocTask.new(:doc) do |rdoc|
12
+ rdoc.rdoc_dir = "doc"
13
+ rdoc.title = "genprovider #{Genprovider::VERSION}"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,8 @@
1
+ require 'rake/clean'
2
+ require 'cucumber/rake/task'
3
+
4
+ Cucumber::Rake::Task.new do |t|
5
+ t.cucumber_opts = %w{--format pretty features}
6
+ end
7
+
8
+ CLEAN.include("generated", "*.out", "*.err")
@@ -0,0 +1,16 @@
1
+ directory "tmp"
2
+ directory "tmp/sfcb"
3
+
4
+ file "tmp/sfcb/sfcb.cfg" => ["tmp/sfcb", :mksfcb] do
5
+ $sfcb.mkcfg
6
+ end
7
+
8
+ task :mksfcb do
9
+ require_relative "../test/helper"
10
+ Helper.sfcb
11
+ puts "$sfcb #{$sfcb}"
12
+ end
13
+
14
+ task :prepstage => ["tmp/sfcb/sfcb.cfg"] do
15
+ puts "Prepare sfcb staging"
16
+ end
@@ -0,0 +1,10 @@
1
+ task :registration => [:prepstage] do |t|
2
+ puts "Register all providers"
3
+
4
+ require_relative "../test/registration"
5
+ Dir['samples/registration/*.registration'].each do |regname|
6
+ klass = File.basename regname, ".registration"
7
+ register_klass :klass => klass
8
+ end
9
+ mkrepos
10
+ end
data/tasks/sfcb.rake ADDED
@@ -0,0 +1,3 @@
1
+ task :sfcb => ["tmp/sfcb/sfcb.cfg", :registration] do
2
+ $sfcb.start
3
+ end
data/tasks/test.rake ADDED
@@ -0,0 +1,10 @@
1
+ require 'rake/testtask'
2
+
3
+ Rake::TestTask.new do |t|
4
+ t.libs = [".", "test"]
5
+ t.warning = true
6
+ t.verbose = true
7
+ t.test_files = FileList['test/test_*.rb']
8
+ end
9
+
10
+ task :test => [:registration, :sfcb]
data/test/env.rb ADDED
@@ -0,0 +1,23 @@
1
+ #
2
+ # test/env.rb
3
+ #
4
+
5
+ fdirname = File.dirname(__FILE__)
6
+
7
+ ##
8
+ # Assuming __FILE__ lives in test/
9
+ #
10
+
11
+ # establish parent for test data
12
+ TOPLEVEL = File.expand_path(File.join(fdirname,".."))
13
+
14
+ # use local version for testing
15
+ LIBDIR = File.join(TOPLEVEL, "lib")
16
+
17
+ # genprovider cli binary
18
+ GENPROVIDER = File.join(TOPLEVEL,"bin","genprovider")
19
+
20
+ NAMESPACE = "test/test"
21
+
22
+ TMPDIR = File.join(TOPLEVEL, "tmp")
23
+
data/test/helper.rb ADDED
@@ -0,0 +1,23 @@
1
+ #
2
+ # test/helper.rb
3
+ #
4
+
5
+ require_relative "./env"
6
+ require_relative "./sfcb"
7
+
8
+ class Helper
9
+ def self.sfcb
10
+ $sfcb ||= Sfcb.new :tmpdir => TMPDIR, :provider => "#{TOPLEVEL}/samples/provider"
11
+ end
12
+ def self.setup klass, namespace = "test/test"
13
+ self.sfcb
14
+ client = Sfcc::Cim::Client.connect(:uri => $sfcb.uri, :verify => false)
15
+ raise "Connection error" unless client
16
+ op = Sfcc::Cim::ObjectPath.new(namespace, klass, client)
17
+ return client, op
18
+ end
19
+ def self.teardown
20
+ $sfcb.stop
21
+ end
22
+ end
23
+