grpc-orin3-provider 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +28 -1
- data/README.md +18 -21
- data/Rakefile +42 -0
- data/gen/Design.ORiN3.Common/V1/orin3_common_pb.rb +23 -0
- data/gen/Design.ORiN3.Common/V1/orin3_common_remote_engine_pb.rb +25 -0
- data/gen/Design.ORiN3.Provider/V1/orin3_object_type_pb.rb +23 -0
- data/gen/Design.ORiN3.Provider/V1/orin3_value_type_pb.rb +23 -0
- data/gen/Message.ORiN3.Provider/V1/orin3_base_object_pb.rb +39 -0
- data/gen/Message.ORiN3.Provider/V1/{orin3baseobject_services_pb.rb → orin3_base_object_services_pb.rb} +3 -3
- data/gen/Message.ORiN3.Provider/V1/orin3_child_creator_pb.rb +39 -0
- data/gen/Message.ORiN3.Provider/V1/{orin3childcreator_services_pb.rb → orin3_child_creator_services_pb.rb} +3 -3
- data/gen/Message.ORiN3.Provider/V1/orin3_child_pb.rb +28 -0
- data/gen/Message.ORiN3.Provider/V1/{orin3child_services_pb.rb → orin3_child_services_pb.rb} +3 -3
- data/gen/Message.ORiN3.Provider/V1/orin3_common_type_pb.rb +79 -0
- data/gen/Message.ORiN3.Provider/V1/orin3_controller_creator_pb.rb +28 -0
- data/gen/Message.ORiN3.Provider/V1/{orin3controllercreator_services_pb.rb → orin3_controller_creator_services_pb.rb} +3 -3
- data/gen/Message.ORiN3.Provider/V1/orin3_executable_pb.rb +28 -0
- data/gen/Message.ORiN3.Provider/V1/{orin3executable_services_pb.rb → orin3_executable_services_pb.rb} +3 -3
- data/gen/Message.ORiN3.Provider/V1/orin3_file_pb.rb +41 -0
- data/gen/Message.ORiN3.Provider/V1/{orin3file_services_pb.rb → orin3_file_services_pb.rb} +3 -3
- data/gen/Message.ORiN3.Provider/V1/orin3_job_pb.rb +32 -0
- data/gen/Message.ORiN3.Provider/V1/{orin3job_services_pb.rb → orin3_job_services_pb.rb} +3 -3
- data/gen/Message.ORiN3.Provider/V1/orin3_parent_pb.rb +31 -0
- data/gen/Message.ORiN3.Provider/V1/{orin3parent_services_pb.rb → orin3_parent_services_pb.rb} +3 -3
- data/gen/Message.ORiN3.Provider/V1/orin3_resource_opener_pb.rb +30 -0
- data/gen/Message.ORiN3.Provider/V1/{orin3resourceopener_services_pb.rb → orin3_resource_opener_services_pb.rb} +3 -3
- data/gen/Message.ORiN3.Provider/V1/orin3_root_object_pb.rb +44 -0
- data/gen/Message.ORiN3.Provider/V1/{orin3rootobject_services_pb.rb → orin3_root_object_services_pb.rb} +3 -3
- data/gen/Message.ORiN3.Provider/V1/orin3_stream_pb.rb +28 -0
- data/gen/Message.ORiN3.Provider/V1/{orin3stream_services_pb.rb → orin3_stream_services_pb.rb} +3 -3
- data/gen/Message.ORiN3.Provider/V1/orin3_variable_pb.rb +31 -0
- data/gen/Message.ORiN3.Provider/V1/{orin3variable_services_pb.rb → orin3_variable_services_pb.rb} +3 -3
- data/gen/Message.ORiN3.RemoteEngine/V1/orin3_remote_engine_pb.rb +40 -0
- data/gen/Message.ORiN3.RemoteEngine/V1/orin3_remote_engine_services_pb.rb +32 -0
- data/lib/grpc/client/orin3/message_client_error.rb +23 -0
- data/lib/grpc/client/orin3/provider/orin3_base_object.rb +145 -0
- data/lib/grpc/client/orin3/provider/orin3_child_creator.rb +104 -0
- data/lib/grpc/client/orin3/provider/orin3_controller.rb +68 -0
- data/lib/grpc/client/orin3/provider/orin3_file.rb +146 -0
- data/lib/grpc/client/orin3/provider/orin3_job.rb +86 -0
- data/lib/grpc/client/orin3/provider/orin3_module.rb +30 -0
- data/lib/grpc/client/orin3/provider/orin3_resource_opener.rb +50 -0
- data/lib/grpc/client/orin3/provider/orin3_root_object.rb +108 -0
- data/lib/grpc/client/orin3/provider/orin3_stream.rb +48 -0
- data/lib/grpc/client/orin3/provider/orin3_variable.rb +500 -0
- data/lib/grpc/client/orin3/remoteengine/orin3_remote_engine.rb +158 -0
- data/lib/grpc/orin3/provider/date_time_converter.rb +25 -0
- data/lib/grpc/orin3/provider/orin3_binary_converter.rb +686 -0
- data/lib/grpc/orin3/provider/version.rb +1 -1
- data/lib/grpc/orin3/provider.rb +160 -99
- data/testsemiauto/test_with_mock_provider.rb +908 -0
- data/testsemiauto/test_with_test_provider.rb +200 -0
- data/testsemiauto/testdata/file.txt +1 -0
- metadata +51 -28
- data/gen/Message.ORiN3.Common/V1/orin3common_pb.rb +0 -77
- data/gen/Message.ORiN3.Provider/V1/orin3baseobject_pb.rb +0 -38
- data/gen/Message.ORiN3.Provider/V1/orin3child_pb.rb +0 -28
- data/gen/Message.ORiN3.Provider/V1/orin3childcreator_pb.rb +0 -38
- data/gen/Message.ORiN3.Provider/V1/orin3controllercreator_pb.rb +0 -28
- data/gen/Message.ORiN3.Provider/V1/orin3executable_pb.rb +0 -28
- data/gen/Message.ORiN3.Provider/V1/orin3file_pb.rb +0 -41
- data/gen/Message.ORiN3.Provider/V1/orin3job_pb.rb +0 -32
- data/gen/Message.ORiN3.Provider/V1/orin3parent_pb.rb +0 -31
- data/gen/Message.ORiN3.Provider/V1/orin3resourceopener_pb.rb +0 -30
- data/gen/Message.ORiN3.Provider/V1/orin3rootobject_pb.rb +0 -44
- data/gen/Message.ORiN3.Provider/V1/orin3stream_pb.rb +0 -28
- data/gen/Message.ORiN3.Provider/V1/orin3variable_pb.rb +0 -30
@@ -0,0 +1,908 @@
|
|
1
|
+
require 'logger'
|
2
|
+
require 'minitest/autorun'
|
3
|
+
require 'minitest/hooks/default'
|
4
|
+
require 'minitest/autorun'
|
5
|
+
require 'uri'
|
6
|
+
require_relative '../lib/grpc/orin3/provider'
|
7
|
+
require 'json'
|
8
|
+
|
9
|
+
$logger = Logger.new(STDOUT)
|
10
|
+
$logger.formatter = proc do |severity, datetime, progname, msg|
|
11
|
+
"[#{datetime}] #{severity}: #{msg}\n"
|
12
|
+
end
|
13
|
+
|
14
|
+
module ORiN3
|
15
|
+
include Grpc::Client::ORiN3
|
16
|
+
include Grpc::Client::ORiN3::Provider
|
17
|
+
end
|
18
|
+
|
19
|
+
class ORiN3ProviderTest < Minitest::Test
|
20
|
+
include Minitest::Hooks
|
21
|
+
|
22
|
+
def before_all
|
23
|
+
puts "......................."
|
24
|
+
$logger.info "* before_all called."
|
25
|
+
@controllers = {}
|
26
|
+
@variables = {}
|
27
|
+
|
28
|
+
$logger.info "* wakeup mock provider."
|
29
|
+
id = "643D12C8-DCFC-476C-AA15-E8CA004F48E8"
|
30
|
+
@version = "[1.0.0,2.0.0)"
|
31
|
+
channel = GRPC::Core::Channel.new("localhost:7103", nil, :this_channel_is_insecure)
|
32
|
+
remote_engine = ORiN3::RemoteEngine.new(channel)
|
33
|
+
result = remote_engine.wakeup_provider(id, @version, "0.0.0.0", 0)
|
34
|
+
$logger.info "* wakeup mock provider done. [uri=#{result.provider_information.endpoints[0].uri}]"
|
35
|
+
|
36
|
+
uri = URI.parse(result.provider_information.endpoints[0].uri)
|
37
|
+
provider_channerl = GRPC::Core::Channel.new("#{uri.host}:#{uri.port}", nil, :this_channel_is_insecure)
|
38
|
+
@root = ORiN3::ORiN3RootObject.attach(provider_channerl)
|
39
|
+
$logger.info "* attached to mock provider."
|
40
|
+
|
41
|
+
$logger.info "Root.name: #{@root.name}"
|
42
|
+
$logger.info "Root.type_name: #{@root.type_name}"
|
43
|
+
$logger.info "Root.option: #{@root.option}"
|
44
|
+
$logger.info "Root.created_datetime: #{@root.created_datetime.getlocal}"
|
45
|
+
$logger.info "Root.orin3_object_type: #{@root.orin3_object_type}"
|
46
|
+
$logger.info "Root.id: #{@root.id}"
|
47
|
+
$logger.info "* before_all finished."
|
48
|
+
end
|
49
|
+
|
50
|
+
def after_all
|
51
|
+
puts "......................."
|
52
|
+
$logger.info "* after_all called."
|
53
|
+
after_all_core
|
54
|
+
$logger.info "* after_all finished."
|
55
|
+
end
|
56
|
+
|
57
|
+
def setup
|
58
|
+
puts "......................."
|
59
|
+
$logger.info "* setup called."
|
60
|
+
end
|
61
|
+
|
62
|
+
def teardown
|
63
|
+
$logger.info "* teardown called."
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.get_constant_name(value, namespace)
|
67
|
+
namespace.constants.each do |const_name|
|
68
|
+
return const_name if namespace.const_get(const_name) == value
|
69
|
+
end
|
70
|
+
nil # 見つからなければ nil を返す
|
71
|
+
end
|
72
|
+
|
73
|
+
def after_all_core
|
74
|
+
@root.shutdown
|
75
|
+
end
|
76
|
+
|
77
|
+
def create_or_get_controller(name)
|
78
|
+
if @controllers.key?(name)
|
79
|
+
return @controllers[name]
|
80
|
+
end
|
81
|
+
controller = @root.create_controller(name,
|
82
|
+
"ORiN3.Provider.ORiNConsortium.Mock.O3Object.Controller.GeneralPurposeController, ORiN3.Provider.ORiNConsortium.Mock",
|
83
|
+
"{ \"@Version\":\"1.0.0\" }")
|
84
|
+
$logger.info "Controller created. [name=#{controller.name}]"
|
85
|
+
@controllers[name] = controller
|
86
|
+
return controller
|
87
|
+
end
|
88
|
+
|
89
|
+
def create_or_get_variable(parent, name, option, value_type)
|
90
|
+
if @variables.key?(name)
|
91
|
+
return @variables[name]
|
92
|
+
end
|
93
|
+
option_string = "{ \"@Version\":\"1.0.0\" }"
|
94
|
+
if !option.nil?
|
95
|
+
parsed_data = JSON.parse(option_string)
|
96
|
+
# 動的に要素を追加
|
97
|
+
option.each do |key, value|
|
98
|
+
parsed_data[key] = value
|
99
|
+
end
|
100
|
+
option_string = JSON.generate(parsed_data)
|
101
|
+
end
|
102
|
+
|
103
|
+
hash = {}
|
104
|
+
hash[:ORIN3_BOOL] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.BoolVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
105
|
+
hash[:ORIN3_UINT8] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.UInt8Variable, ORiN3.Provider.ORiNConsortium.Mock"
|
106
|
+
hash[:ORIN3_UINT16] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.UInt16Variable, ORiN3.Provider.ORiNConsortium.Mock"
|
107
|
+
hash[:ORIN3_UINT32] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.UInt32Variable, ORiN3.Provider.ORiNConsortium.Mock"
|
108
|
+
hash[:ORIN3_UINT64] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.UInt64Variable, ORiN3.Provider.ORiNConsortium.Mock"
|
109
|
+
hash[:ORIN3_INT8] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.Int8Variable, ORiN3.Provider.ORiNConsortium.Mock"
|
110
|
+
hash[:ORIN3_INT16] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.Int16Variable, ORiN3.Provider.ORiNConsortium.Mock"
|
111
|
+
hash[:ORIN3_INT32] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.Int32Variable, ORiN3.Provider.ORiNConsortium.Mock"
|
112
|
+
hash[:ORIN3_INT64] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.Int64Variable, ORiN3.Provider.ORiNConsortium.Mock"
|
113
|
+
hash[:ORIN3_FLOAT] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.FloatVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
114
|
+
hash[:ORIN3_DOUBLE] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.DoubleVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
115
|
+
hash[:ORIN3_STRING] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.StringVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
116
|
+
hash[:ORIN3_DATETIME] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.DateTimeVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
117
|
+
|
118
|
+
hash[:ORIN3_NULLABLE_BOOL] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.NullableBoolVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
119
|
+
hash[:ORIN3_NULLABLE_UINT8] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.NullableUInt8Variable, ORiN3.Provider.ORiNConsortium.Mock"
|
120
|
+
hash[:ORIN3_NULLABLE_UINT16] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.NullableUInt16Variable, ORiN3.Provider.ORiNConsortium.Mock"
|
121
|
+
hash[:ORIN3_NULLABLE_UINT32] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.NullableUInt32Variable, ORiN3.Provider.ORiNConsortium.Mock"
|
122
|
+
hash[:ORIN3_NULLABLE_UINT64] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.NullableUInt64Variable, ORiN3.Provider.ORiNConsortium.Mock"
|
123
|
+
hash[:ORIN3_NULLABLE_INT8] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.NullableInt8Variable, ORiN3.Provider.ORiNConsortium.Mock"
|
124
|
+
hash[:ORIN3_NULLABLE_INT16] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.NullableInt16Variable, ORiN3.Provider.ORiNConsortium.Mock"
|
125
|
+
hash[:ORIN3_NULLABLE_INT32] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.NullableInt32Variable, ORiN3.Provider.ORiNConsortium.Mock"
|
126
|
+
hash[:ORIN3_NULLABLE_INT64] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.NullableInt64Variable, ORiN3.Provider.ORiNConsortium.Mock"
|
127
|
+
hash[:ORIN3_NULLABLE_FLOAT] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.NullableFloatVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
128
|
+
hash[:ORIN3_NULLABLE_DOUBLE] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.NullableDoubleVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
129
|
+
hash[:ORIN3_NULLABLE_DATETIME] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.NullableDateTimeVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
130
|
+
|
131
|
+
hash[:ORIN3_BOOL_ARRAY] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.BoolArrayVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
132
|
+
hash[:ORIN3_UINT8_ARRAY] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.UInt8ArrayVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
133
|
+
hash[:ORIN3_UINT16_ARRAY] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.UInt16ArrayVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
134
|
+
hash[:ORIN3_UINT32_ARRAY] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.UInt32ArrayVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
135
|
+
hash[:ORIN3_UINT64_ARRAY] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.UInt64ArrayVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
136
|
+
hash[:ORIN3_INT8_ARRAY] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.Int8ArrayVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
137
|
+
hash[:ORIN3_INT16_ARRAY] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.Int16ArrayVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
138
|
+
hash[:ORIN3_INT32_ARRAY] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.Int32ArrayVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
139
|
+
hash[:ORIN3_INT64_ARRAY] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.Int64ArrayVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
140
|
+
hash[:ORIN3_FLOAT_ARRAY] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.FloatArrayVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
141
|
+
hash[:ORIN3_DOUBLE_ARRAY] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.DoubleArrayVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
142
|
+
hash[:ORIN3_STRING_ARRAY] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.StringArrayVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
143
|
+
hash[:ORIN3_DATETIME_ARRAY] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.DateTimeArrayVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
144
|
+
|
145
|
+
hash[:ORIN3_NULLABLE_BOOL_ARRAY] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.NullableBoolArrayVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
146
|
+
hash[:ORIN3_NULLABLE_UINT8_ARRAY] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.NullableUInt8ArrayVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
147
|
+
hash[:ORIN3_NULLABLE_UINT16_ARRAY] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.NullableUInt16ArrayVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
148
|
+
hash[:ORIN3_NULLABLE_UINT32_ARRAY] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.NullableUInt32ArrayVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
149
|
+
hash[:ORIN3_NULLABLE_UINT64_ARRAY] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.NullableUInt64ArrayVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
150
|
+
hash[:ORIN3_NULLABLE_INT8_ARRAY] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.NullableInt8ArrayVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
151
|
+
hash[:ORIN3_NULLABLE_INT16_ARRAY] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.NullableInt16ArrayVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
152
|
+
hash[:ORIN3_NULLABLE_INT32_ARRAY] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.NullableInt32ArrayVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
153
|
+
hash[:ORIN3_NULLABLE_INT64_ARRAY] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.NullableInt64ArrayVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
154
|
+
hash[:ORIN3_NULLABLE_FLOAT_ARRAY] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.NullableFloatArrayVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
155
|
+
hash[:ORIN3_NULLABLE_DOUBLE_ARRAY] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.NullableDoubleArrayVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
156
|
+
hash[:ORIN3_NULLABLE_DATETIME_ARRAY] = "ORiN3.Provider.ORiNConsortium.Mock.O3Object.Variable.NullableDateTimeArrayVariable, ORiN3.Provider.ORiNConsortium.Mock"
|
157
|
+
variable = parent.create_variable(name, hash[value_type], option_string, value_type)
|
158
|
+
$logger.info "Variable created. [name=#{variable.name}]"
|
159
|
+
@variables[name] = variable
|
160
|
+
$logger.info "Variable.name: #{variable.name}"
|
161
|
+
$logger.info "Variable.type_name: #{variable.type_name}"
|
162
|
+
$logger.info "Variable.option: #{variable.option}"
|
163
|
+
$logger.info "Variable.created_datetime: #{variable.created_datetime.getlocal}"
|
164
|
+
$logger.info "Variable.orin3_object_type: #{variable.orin3_object_type}"
|
165
|
+
$logger.info "Variable.value_type: #{variable.value_type}"
|
166
|
+
$logger.info "Variable.id: #{variable.id}"
|
167
|
+
return variable
|
168
|
+
end
|
169
|
+
|
170
|
+
UINT8_MIN = 0
|
171
|
+
UINT8_MAX = 255
|
172
|
+
UINT16_MIN = 0
|
173
|
+
UINT16_MAX = 65535
|
174
|
+
UINT32_MIN = 0
|
175
|
+
UINT32_MAX = 4_294_967_295
|
176
|
+
UINT64_MIN = 0
|
177
|
+
UINT64_MAX = 18_446_744_073_709_551_615
|
178
|
+
INT8_MIN = -128
|
179
|
+
INT8_MAX = 127
|
180
|
+
INT16_MIN = -32768
|
181
|
+
INT16_MAX = 32767
|
182
|
+
INT32_MIN = -2_147_483_648
|
183
|
+
INT32_MAX = 2_147_483_647
|
184
|
+
INT64_MIN = -9_223_372_036_854_775_808
|
185
|
+
INT64_MAX = 9_223_372_036_854_775_807
|
186
|
+
FLOAT_MIN = -3.40282347E+38
|
187
|
+
FLOAT_MAX = 3.40282347E+38
|
188
|
+
DOUBLE_MIN = -1.7976931348623157e+308
|
189
|
+
DOUBLE_MAX = 1.7976931348623157e+308
|
190
|
+
|
191
|
+
TAG_TEST_DATA = [
|
192
|
+
{ name: "TAG_TEST_DATA", type: ORiN3BinaryConverter::DataType::Nil, value: { nil: nil } },
|
193
|
+
{ name: "TAG_TEST_DATA", type: ORiN3BinaryConverter::DataType::Bool, value: { true: false, false: true } },
|
194
|
+
{ name: "TAG_TEST_DATA", type: ORiN3BinaryConverter::DataType::UInt8, value: { min: UINT8_MIN, common: 1, max: UINT8_MAX } },
|
195
|
+
{ name: "TAG_TEST_DATA", type: ORiN3BinaryConverter::DataType::UInt16, value: { min: UINT16_MIN, common: 1, max: UINT16_MAX } },
|
196
|
+
{ name: "TAG_TEST_DATA", type: ORiN3BinaryConverter::DataType::UInt32, value: { min: UINT32_MIN, common: 1, max: UINT32_MAX } },
|
197
|
+
{ name: "TAG_TEST_DATA", type: ORiN3BinaryConverter::DataType::UInt64, value: { min: UINT64_MIN, common: 1, max: UINT64_MAX } },
|
198
|
+
{ name: "TAG_TEST_DATA", type: ORiN3BinaryConverter::DataType::Int8, value: { min: INT8_MIN, common: 1, max: INT8_MAX } },
|
199
|
+
{ name: "TAG_TEST_DATA", type: ORiN3BinaryConverter::DataType::Int16, value: { min: INT16_MIN, common: 1, max: INT16_MAX } },
|
200
|
+
{ name: "TAG_TEST_DATA", type: ORiN3BinaryConverter::DataType::Int32, value: { min: INT32_MIN, common: 1, max: INT32_MAX } },
|
201
|
+
{ name: "TAG_TEST_DATA", type: ORiN3BinaryConverter::DataType::Int64, value: { min: INT64_MIN, common: 1, max: INT32_MAX } },
|
202
|
+
{ name: "TAG_TEST_DATA", type: ORiN3BinaryConverter::DataType::Float, value: { common1: 0.0, common: 1.0 } },
|
203
|
+
{ name: "TAG_TEST_DATA", type: ORiN3BinaryConverter::DataType::Double, value: { min: DOUBLE_MIN, common: 1.0, max: DOUBLE_MAX } },
|
204
|
+
{ name: "TAG_TEST_DATA", type: ORiN3BinaryConverter::DataType::DateTime, value: { common: Time.utc(1, 1, 1, 0, 0, 0), common2: Time.utc(9999, 12, 31, 23, 59, 59) } },
|
205
|
+
{ name: "TAG_TEST_DATA", type: ORiN3BinaryConverter::DataType::String, value: { common: "abc𩸽123", empty: "" } },
|
206
|
+
# Array
|
207
|
+
{ name: "TAG_TEST_DATA_ARRAY", type: ORiN3BinaryConverter::DataType::BoolArray, value: { common: [ false, true ] } },
|
208
|
+
{ name: "TAG_TEST_DATA_ARRAY", type: ORiN3BinaryConverter::DataType::BoolArray, value: { common: [] } },
|
209
|
+
{ name: "TAG_TEST_DATA_ARRAY", type: ORiN3BinaryConverter::DataType::UInt8Array, value: { common: [ UINT8_MIN, 1, UINT8_MAX ] } },
|
210
|
+
{ name: "TAG_TEST_DATA_ARRAY", type: ORiN3BinaryConverter::DataType::UInt8Array, value: { common: [] } },
|
211
|
+
{ name: "TAG_TEST_DATA_ARRAY", type: ORiN3BinaryConverter::DataType::UInt16Array, value: { common: [ UINT16_MIN, 1, UINT16_MAX ] } },
|
212
|
+
{ name: "TAG_TEST_DATA_ARRAY", type: ORiN3BinaryConverter::DataType::UInt16Array, value: { common: [] } },
|
213
|
+
{ name: "TAG_TEST_DATA_ARRAY", type: ORiN3BinaryConverter::DataType::UInt32Array, value: { common: [ UINT32_MIN, 1, UINT32_MAX ] } },
|
214
|
+
{ name: "TAG_TEST_DATA_ARRAY", type: ORiN3BinaryConverter::DataType::UInt32Array, value: { common: [] } },
|
215
|
+
{ name: "TAG_TEST_DATA_ARRAY", type: ORiN3BinaryConverter::DataType::UInt64Array, value: { common: [ UINT64_MIN, 1, UINT64_MAX ] } },
|
216
|
+
{ name: "TAG_TEST_DATA_ARRAY", type: ORiN3BinaryConverter::DataType::UInt64Array, value: { common: [] } },
|
217
|
+
{ name: "TAG_TEST_DATA_ARRAY", type: ORiN3BinaryConverter::DataType::Int8Array, value: { common: [ INT8_MIN, 0, INT8_MAX ] } },
|
218
|
+
{ name: "TAG_TEST_DATA_ARRAY", type: ORiN3BinaryConverter::DataType::Int8Array, value: { common: [] } },
|
219
|
+
{ name: "TAG_TEST_DATA_ARRAY", type: ORiN3BinaryConverter::DataType::Int16Array, value: { common: [ INT16_MIN, 0, INT16_MAX ] } },
|
220
|
+
{ name: "TAG_TEST_DATA_ARRAY", type: ORiN3BinaryConverter::DataType::Int16Array, value: { common: [] } },
|
221
|
+
{ name: "TAG_TEST_DATA_ARRAY", type: ORiN3BinaryConverter::DataType::Int32Array, value: { common: [ INT32_MIN, 0, INT32_MAX ] } },
|
222
|
+
{ name: "TAG_TEST_DATA_ARRAY", type: ORiN3BinaryConverter::DataType::Int32Array, value: { common: [] } },
|
223
|
+
{ name: "TAG_TEST_DATA_ARRAY", type: ORiN3BinaryConverter::DataType::Int64Array, value: { common: [ INT64_MIN, 0, INT32_MAX ] } },
|
224
|
+
{ name: "TAG_TEST_DATA_ARRAY", type: ORiN3BinaryConverter::DataType::Int64Array, value: { common: [] } },
|
225
|
+
{ name: "TAG_TEST_DATA_ARRAY", type: ORiN3BinaryConverter::DataType::FloatArray, value: { common: [ 0.0, 1.0 ] } },
|
226
|
+
{ name: "TAG_TEST_DATA_ARRAY", type: ORiN3BinaryConverter::DataType::FloatArray, value: { common: [] } },
|
227
|
+
{ name: "TAG_TEST_DATA_ARRAY", type: ORiN3BinaryConverter::DataType::DoubleArray, value: { common: [ DOUBLE_MIN, 0.0, DOUBLE_MAX ] } },
|
228
|
+
{ name: "TAG_TEST_DATA_ARRAY", type: ORiN3BinaryConverter::DataType::DoubleArray, value: { common: [] } },
|
229
|
+
{ name: "TAG_TEST_DATA_ARRAY", type: ORiN3BinaryConverter::DataType::DateTimeArray, value: { common: [ Time.utc(1, 1, 1, 0, 0, 0), Time.utc(9999, 12, 31, 23, 59, 59) ] } },
|
230
|
+
{ name: "TAG_TEST_DATA_ARRAY", type: ORiN3BinaryConverter::DataType::DateTimeArray, value: { common: [] } },
|
231
|
+
{ name: "TAG_TEST_DATA_ARRAY", type: ORiN3BinaryConverter::DataType::StringArray, value: { common: [ "abc", "𩸽" ] } },
|
232
|
+
#{ name: "TAG_TEST_DATA_ARRAY", type: ORiN3BinaryConverter::DataType::StringArray, value: { common: [ "abc", "𩸽", nil ] } }, # stringのnullの扱いに問題あり
|
233
|
+
{ name: "TAG_TEST_DATA_ARRAY", type: ORiN3BinaryConverter::DataType::StringArray, value: { common: [] } },
|
234
|
+
# NullableArray
|
235
|
+
{ name: "TAG_TEST_DATA_NULLABLE_ARRAY", type: ORiN3BinaryConverter::DataType::NullableBoolArray, value: { common: [ false, nil, true ] } },
|
236
|
+
{ name: "TAG_TEST_DATA_NULLABLE_ARRAY", type: ORiN3BinaryConverter::DataType::NullableBoolArray, value: { common: [] } },
|
237
|
+
{ name: "TAG_TEST_DATA_NULLABLE_ARRAY", type: ORiN3BinaryConverter::DataType::NullableUInt8Array, value: { common: [ UINT8_MIN, 1, nil, UINT8_MAX ] } },
|
238
|
+
{ name: "TAG_TEST_DATA_NULLABLE_ARRAY", type: ORiN3BinaryConverter::DataType::NullableUInt8Array, value: { common: [] } },
|
239
|
+
{ name: "TAG_TEST_DATA_NULLABLE_ARRAY", type: ORiN3BinaryConverter::DataType::NullableUInt16Array, value: { common: [ UINT16_MIN, 1, nil, UINT16_MAX ] } },
|
240
|
+
{ name: "TAG_TEST_DATA_NULLABLE_ARRAY", type: ORiN3BinaryConverter::DataType::NullableUInt16Array, value: { common: [] } },
|
241
|
+
{ name: "TAG_TEST_DATA_NULLABLE_ARRAY", type: ORiN3BinaryConverter::DataType::NullableUInt32Array, value: { common: [ UINT32_MIN, 1, nil, UINT32_MAX ] } },
|
242
|
+
{ name: "TAG_TEST_DATA_NULLABLE_ARRAY", type: ORiN3BinaryConverter::DataType::NullableUInt32Array, value: { common: [] } },
|
243
|
+
{ name: "TAG_TEST_DATA_NULLABLE_ARRAY", type: ORiN3BinaryConverter::DataType::NullableUInt64Array, value: { common: [ UINT64_MIN, 1, nil, UINT64_MAX ] } },
|
244
|
+
{ name: "TAG_TEST_DATA_NULLABLE_ARRAY", type: ORiN3BinaryConverter::DataType::NullableUInt64Array, value: { common: [] } },
|
245
|
+
{ name: "TAG_TEST_DATA_NULLABLE_ARRAY", type: ORiN3BinaryConverter::DataType::NullableInt8Array, value: { common: [ INT8_MIN, 0, nil, INT8_MAX ] } },
|
246
|
+
{ name: "TAG_TEST_DATA_NULLABLE_ARRAY", type: ORiN3BinaryConverter::DataType::NullableInt8Array, value: { common: [] } },
|
247
|
+
{ name: "TAG_TEST_DATA_NULLABLE_ARRAY", type: ORiN3BinaryConverter::DataType::NullableInt16Array, value: { common: [ INT16_MIN, 0, nil, INT16_MAX ] } },
|
248
|
+
{ name: "TAG_TEST_DATA_NULLABLE_ARRAY", type: ORiN3BinaryConverter::DataType::NullableInt16Array, value: { common: [] } },
|
249
|
+
{ name: "TAG_TEST_DATA_NULLABLE_ARRAY", type: ORiN3BinaryConverter::DataType::NullableInt32Array, value: { common: [ INT32_MIN, 0, nil, INT32_MAX ] } },
|
250
|
+
{ name: "TAG_TEST_DATA_NULLABLE_ARRAY", type: ORiN3BinaryConverter::DataType::NullableInt32Array, value: { common: [] } },
|
251
|
+
{ name: "TAG_TEST_DATA_NULLABLE_ARRAY", type: ORiN3BinaryConverter::DataType::NullableInt64Array, value: { common: [ INT64_MIN, 0, nil, INT32_MAX ] } },
|
252
|
+
{ name: "TAG_TEST_DATA_NULLABLE_ARRAY", type: ORiN3BinaryConverter::DataType::NullableInt64Array, value: { common: [] } },
|
253
|
+
{ name: "TAG_TEST_DATA_NULLABLE_ARRAY", type: ORiN3BinaryConverter::DataType::NullableFloatArray, value: { common: [ 0.0, nil, 1.0 ] } },
|
254
|
+
{ name: "TAG_TEST_DATA_NULLABLE_ARRAY", type: ORiN3BinaryConverter::DataType::NullableFloatArray, value: { common: [] } },
|
255
|
+
{ name: "TAG_TEST_DATA_NULLABLE_ARRAY", type: ORiN3BinaryConverter::DataType::NullableDoubleArray, value: { common: [ DOUBLE_MIN, 0.0, nil, DOUBLE_MAX ] } },
|
256
|
+
{ name: "TAG_TEST_DATA_NULLABLE_ARRAY", type: ORiN3BinaryConverter::DataType::NullableDoubleArray, value: { common: [] } },
|
257
|
+
{ name: "TAG_TEST_DATA_NULLABLE_ARRAY", type: ORiN3BinaryConverter::DataType::NullableDateTimeArray, value: { common: [ Time.utc(1, 1, 1, 0, 0, 0), nil, Time.utc(9999, 12, 31, 23, 59, 59) ] } },
|
258
|
+
{ name: "TAG_TEST_DATA_NULLABLE_ARRAY", type: ORiN3BinaryConverter::DataType::NullableDateTimeArray, value: { common: [] } },
|
259
|
+
]
|
260
|
+
|
261
|
+
TAG_TEST_DATA.each do |data|
|
262
|
+
name = get_constant_name(data[:type], ORiN3BinaryConverter::DataType)
|
263
|
+
define_method("test_tag_#{name}") do
|
264
|
+
$logger.info "* test_tag_#{name} called."
|
265
|
+
controller = create_or_get_controller(data[:name])
|
266
|
+
data[:value].each do |key, value|
|
267
|
+
tag_name ="#{name}_#{key}"
|
268
|
+
controller.set_tag(tag_name, value, data[:type])
|
269
|
+
tag = controller.get_tag(tag_name)
|
270
|
+
$logger.info "name: #{tag_name}, data type: #{tag.class.name}, value: #{tag}"
|
271
|
+
if value.nil?
|
272
|
+
assert_nil tag
|
273
|
+
else
|
274
|
+
assert_equal value, tag
|
275
|
+
end
|
276
|
+
end
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
TAG_NIL_TEST_DATA = [
|
281
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::Bool },
|
282
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::UInt8 },
|
283
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::UInt16 },
|
284
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::UInt32 },
|
285
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::UInt64 },
|
286
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::Int8 },
|
287
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::Int16 },
|
288
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::Int32 },
|
289
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::Int64 },
|
290
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::Float },
|
291
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::Double },
|
292
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::DateTime },
|
293
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::BoolArray },
|
294
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::UInt8Array },
|
295
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::UInt16Array },
|
296
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::UInt32Array },
|
297
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::UInt64Array },
|
298
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::Int8Array },
|
299
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::Int16Array },
|
300
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::Int32Array },
|
301
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::Int64Array },
|
302
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::FloatArray },
|
303
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::DoubleArray },
|
304
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::DateTimeArray },
|
305
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::StringArray },
|
306
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableBoolArray },
|
307
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableUInt8Array },
|
308
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableUInt16Array },
|
309
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableUInt32Array },
|
310
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableUInt64Array },
|
311
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableInt8Array },
|
312
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableInt16Array },
|
313
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableInt32Array },
|
314
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableInt64Array },
|
315
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableFloatArray },
|
316
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableDoubleArray },
|
317
|
+
{ name: "TAG_NIL_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableDateTimeArray },
|
318
|
+
]
|
319
|
+
|
320
|
+
TAG_NIL_TEST_DATA.each do |data|
|
321
|
+
name = get_constant_name(data[:type], ORiN3BinaryConverter::DataType)
|
322
|
+
define_method("test_tag_nil_#{name}") do
|
323
|
+
$logger.info "* test_tag_nil_#{name} called."
|
324
|
+
controller = create_or_get_controller(data[:name])
|
325
|
+
exception = assert_raises(Grpc::Client::ORiN3::MessageClientError) do
|
326
|
+
controller.set_tag("tag_name", nil, data[:type])
|
327
|
+
end
|
328
|
+
$logger.info "Exception message: #{exception.message}"
|
329
|
+
assert_includes exception.message, "Value is nil."
|
330
|
+
end
|
331
|
+
end
|
332
|
+
|
333
|
+
TAG_NIL_TEST_DATA2 = [
|
334
|
+
{ name: "TAG_NIL_TEST_DATA2", type: ORiN3BinaryConverter::DataType::BoolArray },
|
335
|
+
{ name: "TAG_NIL_TEST_DATA2", type: ORiN3BinaryConverter::DataType::UInt8Array },
|
336
|
+
{ name: "TAG_NIL_TEST_DATA2", type: ORiN3BinaryConverter::DataType::UInt16Array },
|
337
|
+
{ name: "TAG_NIL_TEST_DATA2", type: ORiN3BinaryConverter::DataType::UInt32Array },
|
338
|
+
{ name: "TAG_NIL_TEST_DATA2", type: ORiN3BinaryConverter::DataType::UInt64Array },
|
339
|
+
{ name: "TAG_NIL_TEST_DATA2", type: ORiN3BinaryConverter::DataType::Int8Array },
|
340
|
+
{ name: "TAG_NIL_TEST_DATA2", type: ORiN3BinaryConverter::DataType::Int16Array },
|
341
|
+
{ name: "TAG_NIL_TEST_DATA2", type: ORiN3BinaryConverter::DataType::Int32Array },
|
342
|
+
{ name: "TAG_NIL_TEST_DATA2", type: ORiN3BinaryConverter::DataType::Int64Array },
|
343
|
+
{ name: "TAG_NIL_TEST_DATA2", type: ORiN3BinaryConverter::DataType::FloatArray },
|
344
|
+
{ name: "TAG_NIL_TEST_DATA2", type: ORiN3BinaryConverter::DataType::DoubleArray },
|
345
|
+
{ name: "TAG_NIL_TEST_DATA2", type: ORiN3BinaryConverter::DataType::DateTimeArray },
|
346
|
+
]
|
347
|
+
|
348
|
+
TAG_NIL_TEST_DATA2.each do |data|
|
349
|
+
name = get_constant_name(data[:type], ORiN3BinaryConverter::DataType)
|
350
|
+
define_method("test_tag_nil2_#{name}") do
|
351
|
+
$logger.info "* test_tag_nil2_#{name} called."
|
352
|
+
controller = create_or_get_controller(data[:name])
|
353
|
+
exception = assert_raises(Grpc::Client::ORiN3::MessageClientError) do
|
354
|
+
controller.set_tag("tag_name", [ nil ], data[:type])
|
355
|
+
end
|
356
|
+
$logger.info "Exception message: #{exception.message}"
|
357
|
+
assert_includes exception.message, "Value is nil."
|
358
|
+
end
|
359
|
+
end
|
360
|
+
|
361
|
+
TAG_RUBY_TYPE_TEST_DATA = [
|
362
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::Bool, ruby_type: String },
|
363
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::UInt8, ruby_type: String },
|
364
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::UInt16, ruby_type: String },
|
365
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::UInt32, ruby_type: String },
|
366
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::UInt64, ruby_type: String },
|
367
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::Int8, ruby_type: String },
|
368
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::Int16, ruby_type: String },
|
369
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::Int32, ruby_type: String },
|
370
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::Int64, ruby_type: String },
|
371
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::Float, ruby_type: String },
|
372
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::Double, ruby_type: String },
|
373
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::DateTime, ruby_type: String },
|
374
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::String, ruby_type: Time },
|
375
|
+
]
|
376
|
+
|
377
|
+
TAG_RUBY_TYPE_TEST_DATA.each do |data|
|
378
|
+
name = get_constant_name(data[:type], ORiN3BinaryConverter::DataType)
|
379
|
+
define_method("test_tag_ruby_type_#{name}") do
|
380
|
+
$logger.info "* test_tag_ruby_type_#{name} called."
|
381
|
+
controller = create_or_get_controller(data[:name])
|
382
|
+
exception = assert_raises(Grpc::Client::ORiN3::MessageClientError) do
|
383
|
+
controller.set_tag("tag_name", data[:ruby_type].new, data[:type])
|
384
|
+
end
|
385
|
+
$logger.info "Exception message: #{exception.message}"
|
386
|
+
assert_includes exception.message, "Value is not"
|
387
|
+
end
|
388
|
+
end
|
389
|
+
|
390
|
+
TAG_RUBY_TYPE_TEST_DATA2 = [
|
391
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::BoolArray, ruby_type: String },
|
392
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::UInt8Array, ruby_type: String },
|
393
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::UInt16Array, ruby_type: String },
|
394
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::UInt32Array, ruby_type: String },
|
395
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::UInt64Array, ruby_type: String },
|
396
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::Int8Array, ruby_type: String },
|
397
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::Int16Array, ruby_type: String },
|
398
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::Int32Array, ruby_type: String },
|
399
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::Int64Array, ruby_type: String },
|
400
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::FloatArray, ruby_type: String },
|
401
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::DoubleArray, ruby_type: String },
|
402
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::DateTimeArray, ruby_type: String },
|
403
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::StringArray, ruby_type: Time },
|
404
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableBoolArray, ruby_type: String },
|
405
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableUInt8Array, ruby_type: String },
|
406
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableUInt16Array, ruby_type: String },
|
407
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableUInt32Array, ruby_type: String },
|
408
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableUInt64Array, ruby_type: String },
|
409
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableInt8Array, ruby_type: String },
|
410
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableInt16Array, ruby_type: String },
|
411
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableInt32Array, ruby_type: String },
|
412
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableInt64Array, ruby_type: String },
|
413
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableFloatArray, ruby_type: String },
|
414
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableDoubleArray, ruby_type: String },
|
415
|
+
{ name: "TAG_RUBY_TYPE_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableDateTimeArray, ruby_type: String },
|
416
|
+
]
|
417
|
+
|
418
|
+
TAG_RUBY_TYPE_TEST_DATA2.each do |data|
|
419
|
+
name = get_constant_name(data[:type], ORiN3BinaryConverter::DataType)
|
420
|
+
define_method("test_tag_ruby_type2_#{name}") do
|
421
|
+
$logger.info "* test_tag_ruby_type2_#{name} called."
|
422
|
+
controller = create_or_get_controller(data[:name])
|
423
|
+
exception = assert_raises(Grpc::Client::ORiN3::MessageClientError) do
|
424
|
+
controller.set_tag("tag_name", [ data[:ruby_type].new ], data[:type])
|
425
|
+
end
|
426
|
+
$logger.info "Exception message: #{exception.message}"
|
427
|
+
assert_includes exception.message, "Value is not"
|
428
|
+
end
|
429
|
+
end
|
430
|
+
|
431
|
+
TAG_RANGE_TEST_DATA = [
|
432
|
+
{ name: "TAG_RANGE_TEST_DATA", type: ORiN3BinaryConverter::DataType::UInt8, values: [ UINT8_MIN - 1, UINT8_MAX + 1 ] },
|
433
|
+
{ name: "TAG_RANGE_TEST_DATA", type: ORiN3BinaryConverter::DataType::UInt16, values: [ UINT16_MIN - 1, UINT16_MAX + 1 ] },
|
434
|
+
{ name: "TAG_RANGE_TEST_DATA", type: ORiN3BinaryConverter::DataType::UInt32, values: [ UINT32_MIN - 1, UINT32_MAX + 1 ] },
|
435
|
+
{ name: "TAG_RANGE_TEST_DATA", type: ORiN3BinaryConverter::DataType::UInt64, values: [ UINT64_MIN - 1, UINT64_MAX + 1 ] },
|
436
|
+
{ name: "TAG_RANGE_TEST_DATA", type: ORiN3BinaryConverter::DataType::Int8, values: [ INT8_MIN - 1, INT8_MAX + 1 ] },
|
437
|
+
{ name: "TAG_RANGE_TEST_DATA", type: ORiN3BinaryConverter::DataType::Int16, values: [ INT16_MIN - 1, INT16_MAX + 1 ] },
|
438
|
+
{ name: "TAG_RANGE_TEST_DATA", type: ORiN3BinaryConverter::DataType::Int32, values: [ INT32_MIN - 1, INT32_MAX + 1 ] },
|
439
|
+
{ name: "TAG_RANGE_TEST_DATA", type: ORiN3BinaryConverter::DataType::Int64, values: [ INT64_MIN - 1, INT64_MAX + 1 ] },
|
440
|
+
{ name: "TAG_RANGE_TEST_DATA", type: ORiN3BinaryConverter::DataType::UInt8Array, values: [ [ UINT8_MIN - 1 ], [ UINT8_MAX + 1 ] ] },
|
441
|
+
{ name: "TAG_RANGE_TEST_DATA", type: ORiN3BinaryConverter::DataType::UInt16Array, values: [ [ UINT16_MIN - 1 ], [ UINT16_MAX + 1 ] ] },
|
442
|
+
{ name: "TAG_RANGE_TEST_DATA", type: ORiN3BinaryConverter::DataType::UInt32Array, values: [ [ UINT32_MIN - 1 ], [ UINT32_MAX + 1 ] ] },
|
443
|
+
{ name: "TAG_RANGE_TEST_DATA", type: ORiN3BinaryConverter::DataType::UInt64Array, values: [ [ UINT64_MIN - 1 ], [ UINT64_MAX + 1 ] ] },
|
444
|
+
{ name: "TAG_RANGE_TEST_DATA", type: ORiN3BinaryConverter::DataType::Int8Array, values: [ [ INT8_MIN - 1, INT8_MAX + 1 ] ] },
|
445
|
+
{ name: "TAG_RANGE_TEST_DATA", type: ORiN3BinaryConverter::DataType::Int16Array, values: [ [ INT16_MIN - 1, INT16_MAX + 1 ] ] },
|
446
|
+
{ name: "TAG_RANGE_TEST_DATA", type: ORiN3BinaryConverter::DataType::Int32Array, values: [ [ INT32_MIN - 1, INT32_MAX + 1 ] ] },
|
447
|
+
{ name: "TAG_RANGE_TEST_DATA", type: ORiN3BinaryConverter::DataType::Int64Array, values: [ [ INT64_MIN - 1, INT64_MAX + 1 ] ] },
|
448
|
+
{ name: "TAG_RANGE_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableUInt8Array, values: [ [ UINT8_MIN - 1 ], [ UINT8_MAX + 1 ] ] },
|
449
|
+
{ name: "TAG_RANGE_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableUInt16Array, values: [ [ UINT16_MIN - 1 ], [ UINT16_MAX + 1 ] ] },
|
450
|
+
{ name: "TAG_RANGE_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableUInt32Array, values: [ [ UINT32_MIN - 1 ], [ UINT32_MAX + 1 ] ] },
|
451
|
+
{ name: "TAG_RANGE_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableUInt64Array, values: [ [ UINT64_MIN - 1 ], [ UINT64_MAX + 1 ] ] },
|
452
|
+
{ name: "TAG_RANGE_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableInt8Array, values: [ [ INT8_MIN - 1, INT8_MAX + 1 ] ] },
|
453
|
+
{ name: "TAG_RANGE_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableInt16Array, values: [ [ INT16_MIN - 1, INT16_MAX + 1 ] ] },
|
454
|
+
{ name: "TAG_RANGE_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableInt32Array, values: [ [ INT32_MIN - 1, INT32_MAX + 1 ] ] },
|
455
|
+
{ name: "TAG_RANGE_TEST_DATA", type: ORiN3BinaryConverter::DataType::NullableInt64Array, values: [ [ INT64_MIN - 1, INT64_MAX + 1 ] ] },
|
456
|
+
]
|
457
|
+
|
458
|
+
TAG_RANGE_TEST_DATA.each do |data|
|
459
|
+
name = get_constant_name(data[:type], ORiN3BinaryConverter::DataType)
|
460
|
+
define_method("test_tag_range_#{name}") do
|
461
|
+
$logger.info "* test_tag_range_#{name} called."
|
462
|
+
controller = create_or_get_controller(data[:name])
|
463
|
+
data[:values].each do |value|
|
464
|
+
exception = assert_raises(Grpc::Client::ORiN3::MessageClientError) do
|
465
|
+
controller.set_tag("tag_name", value, data[:type])
|
466
|
+
end
|
467
|
+
$logger.info "Exception message: #{exception.message}"
|
468
|
+
assert_includes exception.message, "out of range"
|
469
|
+
end
|
470
|
+
end
|
471
|
+
end
|
472
|
+
|
473
|
+
TAG_WITHOUT_TYPE_TEST_DATA = [
|
474
|
+
{ name: "TAG_WITHOUT_TYPE_TEST_DATA", type: "Nil", value: { nil: nil } },
|
475
|
+
{ name: "TAG_WITHOUT_TYPE_TEST_DATA", type: "Bool", value: { true: false, false: true } },
|
476
|
+
{ name: "TAG_WITHOUT_TYPE_TEST_DATA", type: "Integer", value: { min: -9_223_372_036_854_775_808, common: 0, max: 9_223_372_036_854_775_807 } },
|
477
|
+
{ name: "TAG_WITHOUT_TYPE_TEST_DATA", type: "String", value: { common: "あいうえお𩸽abc" } },
|
478
|
+
{ name: "TAG_WITHOUT_TYPE_TEST_DATA", type: "BoolArray", value: { common: [ false, true ] } },
|
479
|
+
{ name: "TAG_WITHOUT_TYPE_TEST_DATA", type: "NullableBoolArray", value: { common: [ false, nil, true ] } },
|
480
|
+
{ name: "TAG_WITHOUT_TYPE_TEST_DATA", type: "IntegerArray", value: { common: [ -9_223_372_036_854_775_808, 0, 9_223_372_036_854_775_807 ] } },
|
481
|
+
{ name: "TAG_WITHOUT_TYPE_TEST_DATA", type: "NullableIntegerArray", value: { common: [ -9_223_372_036_854_775_808, 0, nil, 9_223_372_036_854_775_807 ] } },
|
482
|
+
]
|
483
|
+
|
484
|
+
TAG_WITHOUT_TYPE_TEST_DATA.each do |data|
|
485
|
+
name = data[:type]
|
486
|
+
define_method("test_tag_without_type_#{name}") do
|
487
|
+
$logger.info "* test_tag_without_type_#{name} called."
|
488
|
+
controller = create_or_get_controller(data[:name])
|
489
|
+
data[:value].each do |key, value|
|
490
|
+
tag_name ="#{name}_#{key}"
|
491
|
+
controller.set_tag(tag_name, value)
|
492
|
+
tag = controller.get_tag(tag_name)
|
493
|
+
$logger.info "name: #{tag_name}, data type: #{tag.class.name}, value: #{tag}"
|
494
|
+
if value.nil?
|
495
|
+
assert_nil tag
|
496
|
+
else
|
497
|
+
assert_equal value, tag
|
498
|
+
end
|
499
|
+
end
|
500
|
+
end
|
501
|
+
end
|
502
|
+
|
503
|
+
def test_tag_management
|
504
|
+
$logger.info "* test_tag_management called."
|
505
|
+
controller = create_or_get_controller("test_tag_management")
|
506
|
+
|
507
|
+
keys = controller.get_tag_keys
|
508
|
+
assert_equal 0, keys.length
|
509
|
+
|
510
|
+
controller.set_tag("hoge", 1)
|
511
|
+
keys = controller.get_tag_keys
|
512
|
+
assert_equal 1, keys.length
|
513
|
+
assert_equal "hoge", keys[0]
|
514
|
+
|
515
|
+
controller.set_tag("fuga", 2)
|
516
|
+
keys = controller.get_tag_keys
|
517
|
+
assert_equal 2, keys.length
|
518
|
+
assert_equal true, keys.include?("hoge")
|
519
|
+
assert_equal true, keys.include?("fuga")
|
520
|
+
assert_equal 1, controller.get_tag("hoge")
|
521
|
+
assert_equal 2, controller.get_tag("fuga")
|
522
|
+
|
523
|
+
controller.remove_tag("hoge")
|
524
|
+
keys = controller.get_tag_keys
|
525
|
+
assert_equal 1, keys.length
|
526
|
+
assert_equal true, keys.include?("fuga")
|
527
|
+
assert_equal 2, controller.get_tag("fuga")
|
528
|
+
|
529
|
+
controller.set_tag("fuga", 10)
|
530
|
+
keys = controller.get_tag_keys
|
531
|
+
assert_equal 1, keys.length
|
532
|
+
assert_equal true, keys.include?("fuga")
|
533
|
+
assert_equal 10, controller.get_tag("fuga")
|
534
|
+
|
535
|
+
controller.set_tag("fuga", "abc")
|
536
|
+
keys = controller.get_tag_keys
|
537
|
+
assert_equal 1, keys.length
|
538
|
+
assert_equal true, keys.include?("fuga")
|
539
|
+
assert_equal "abc", controller.get_tag("fuga")
|
540
|
+
|
541
|
+
controller.remove_tag("fuga")
|
542
|
+
keys = controller.get_tag_keys
|
543
|
+
assert_equal 0, keys.length
|
544
|
+
end
|
545
|
+
|
546
|
+
VARIABLE_TEST_DATA = [
|
547
|
+
{ name: "ORIN3_BOOL", type: :ORIN3_BOOL, value: [ true, false, true ] },
|
548
|
+
{ name: "ORIN3_UINT8", type: :ORIN3_UINT8, value: [ UINT8_MIN, 1, UINT8_MAX ] },
|
549
|
+
{ name: "ORIN3_UINT16", type: :ORIN3_UINT16, value: [ UINT16_MIN, 1, UINT16_MAX ] },
|
550
|
+
{ name: "ORIN3_UINT32", type: :ORIN3_UINT32, value: [ UINT32_MIN, 1, UINT32_MAX ] },
|
551
|
+
{ name: "ORIN3_UINT64", type: :ORIN3_UINT64, value: [ UINT64_MIN, 1, UINT64_MAX ] },
|
552
|
+
{ name: "ORIN3_INT8", type: :ORIN3_INT8, value: [ INT8_MIN, 1, INT8_MAX ] },
|
553
|
+
{ name: "ORIN3_INT16", type: :ORIN3_INT16, value: [ INT16_MIN, 1, INT16_MAX ] },
|
554
|
+
{ name: "ORIN3_INT32", type: :ORIN3_INT32, value: [ INT32_MIN, 1, INT32_MAX ] },
|
555
|
+
{ name: "ORIN3_INT64", type: :ORIN3_INT64, value: [ INT64_MIN, 1, INT64_MAX ] },
|
556
|
+
{ name: "ORIN3_FLOAT", type: :ORIN3_FLOAT, value: [ 0.0, 1.0 ] },
|
557
|
+
{ name: "ORIN3_DOUBLE", type: :ORIN3_DOUBLE, value: [ DOUBLE_MIN, 1.0, DOUBLE_MAX ] },
|
558
|
+
{ name: "ORIN3_DATETIME", type: :ORIN3_DATETIME, value: [ Time.utc(1, 1, 1, 0, 0, 0), Time.utc(9999, 12, 31, 23, 59, 59) ] },
|
559
|
+
{ name: "ORIN3_STRING", type: :ORIN3_STRING, value: [ "123456", nil, "abc𩸽123" ] },
|
560
|
+
|
561
|
+
{ name: "ORIN3_NULLABLE_BOOL", type: :ORIN3_NULLABLE_BOOL, value: [ nil, false, true ] },
|
562
|
+
{ name: "ORIN3_NULLABLE_UINT8", type: :ORIN3_NULLABLE_UINT8, value: [ UINT8_MIN, 1, nil, UINT8_MAX ] },
|
563
|
+
{ name: "ORIN3_NULLABLE_UINT16", type: :ORIN3_NULLABLE_UINT16, value: [ UINT16_MIN, 1, nil, UINT16_MAX ] },
|
564
|
+
{ name: "ORIN3_NULLABLE_UINT32", type: :ORIN3_NULLABLE_UINT32, value: [ UINT32_MIN, 1, nil, UINT32_MAX ] },
|
565
|
+
{ name: "ORIN3_NULLABLE_UINT64", type: :ORIN3_NULLABLE_UINT64, value: [ UINT64_MIN, 1, nil, UINT64_MAX ] },
|
566
|
+
{ name: "ORIN3_NULLABLE_INT8", type: :ORIN3_NULLABLE_INT8, value: [ INT8_MIN, 1, nil, INT8_MAX ] },
|
567
|
+
{ name: "ORIN3_NULLABLE_INT16", type: :ORIN3_NULLABLE_INT16, value: [ INT16_MIN, 1, nil, INT16_MAX ] },
|
568
|
+
{ name: "ORIN3_NULLABLE_INT32", type: :ORIN3_NULLABLE_INT32, value: [ INT32_MIN, 1, nil, INT32_MAX ] },
|
569
|
+
{ name: "ORIN3_NULLABLE_INT64", type: :ORIN3_NULLABLE_INT64, value: [ INT64_MIN, 1, nil, INT64_MAX ] },
|
570
|
+
{ name: "ORIN3_NULLABLE_FLOAT", type: :ORIN3_NULLABLE_FLOAT, value: [ 0.0, nil, 1.0 ] },
|
571
|
+
{ name: "ORIN3_NULLABLE_DOUBLE", type: :ORIN3_NULLABLE_DOUBLE, value: [ DOUBLE_MIN, 1.0, nil, DOUBLE_MAX ] },
|
572
|
+
{ name: "ORIN3_NULLABLE_DATETIME", type: :ORIN3_NULLABLE_DATETIME, value: [ Time.utc(1, 1, 1, 0, 0, 0), nil, Time.utc(9999, 12, 31, 23, 59, 59) ] },
|
573
|
+
|
574
|
+
{ name: "ORIN3_BOOL_ARRAY", type: :ORIN3_BOOL_ARRAY, value: [[ true, false, true ], [ false, true, false ]] },
|
575
|
+
{ name: "ORIN3_UINT8_ARRAY", type: :ORIN3_UINT8_ARRAY, value: [[ UINT8_MIN, 1, UINT8_MAX ], [ UINT8_MAX, UINT8_MIN, 1 ]] },
|
576
|
+
{ name: "ORIN3_UINT16_ARRAY", type: :ORIN3_UINT16_ARRAY, value: [[ UINT16_MIN, 1, UINT16_MAX ], [ UINT16_MAX, UINT16_MIN, 1 ]] },
|
577
|
+
{ name: "ORIN3_UINT32_ARRAY", type: :ORIN3_UINT32_ARRAY, value: [[ UINT32_MIN, 1, UINT32_MAX ], [ UINT32_MAX, UINT32_MIN, 1 ]] },
|
578
|
+
{ name: "ORIN3_UINT64_ARRAY", type: :ORIN3_UINT64_ARRAY, value: [[ UINT64_MIN, 1, UINT64_MAX ], [ UINT64_MAX, UINT64_MIN, 1 ]] },
|
579
|
+
{ name: "ORIN3_INT8_ARRAY", type: :ORIN3_INT8_ARRAY, value: [[ INT8_MIN, 1, INT8_MAX ], [ INT8_MAX, INT8_MIN, 1 ]] },
|
580
|
+
{ name: "ORIN3_INT16_ARRAY", type: :ORIN3_INT16_ARRAY, value: [[ INT16_MIN, 1, INT16_MAX ], [ INT16_MAX, INT16_MIN, 1 ]] },
|
581
|
+
{ name: "ORIN3_INT32_ARRAY", type: :ORIN3_INT32_ARRAY, value: [[ INT32_MIN, 1, INT32_MAX ], [ INT32_MAX, INT32_MIN, 1 ]] },
|
582
|
+
{ name: "ORIN3_INT64_ARRAY", type: :ORIN3_INT64_ARRAY, value: [[ INT64_MIN, 1, INT64_MAX ], [ INT64_MAX, INT64_MIN, 1 ]] },
|
583
|
+
{ name: "ORIN3_FLOAT_ARRAY", type: :ORIN3_FLOAT_ARRAY, value: [[ 0.0, 1.0 ], [ 2.0, 3.0 ]] },
|
584
|
+
{ name: "ORIN3_DOUBLE_ARRAY", type: :ORIN3_DOUBLE_ARRAY, value: [[ DOUBLE_MIN, 1.0, DOUBLE_MAX ], [ DOUBLE_MAX, DOUBLE_MIN, 1.0 ]] },
|
585
|
+
{ name: "ORIN3_DATETIME_ARRAY", type: :ORIN3_DATETIME_ARRAY, value: [[ Time.utc(1, 1, 1, 0, 0, 0), Time.utc(9999, 12, 31, 23, 59, 59) ], [ Time.utc(9999, 12, 31, 23, 59, 59), Time.utc(1, 1, 1, 0, 0, 0) ]] },
|
586
|
+
{ name: "ORIN3_STRING_ARRAY", type: :ORIN3_STRING_ARRAY, value: [[ "123456", nil, "abc𩸽123" ], [ "abc𩸽123", "123456", nil ]] },
|
587
|
+
|
588
|
+
{ name: "ORIN3_NULLABLE_BOOL_ARRAY", type: :ORIN3_NULLABLE_BOOL_ARRAY, value: [[ true, false, true ], [ nil, nil, nil ], [ false, nil, false ]] },
|
589
|
+
{ name: "ORIN3_NULLABLE_UINT8_ARRAY", type: :ORIN3_NULLABLE_UINT8_ARRAY, value: [[ UINT8_MIN, 1, UINT8_MAX ], [ nil, nil, nil ], [ UINT8_MAX, UINT8_MIN, nil ]] },
|
590
|
+
{ name: "ORIN3_NULLABLE_UINT16_ARRAY", type: :ORIN3_NULLABLE_UINT16_ARRAY, value: [[ UINT16_MIN, 1, UINT16_MAX ], [ nil, nil, nil ], [ UINT16_MAX, UINT16_MIN, nil ]] },
|
591
|
+
{ name: "ORIN3_NULLABLE_UINT32_ARRAY", type: :ORIN3_NULLABLE_UINT32_ARRAY, value: [[ UINT32_MIN, 1, UINT32_MAX ], [ nil, nil, nil ], [ UINT32_MAX, UINT32_MIN, nil ]] },
|
592
|
+
{ name: "ORIN3_NULLABLE_UINT64_ARRAY", type: :ORIN3_NULLABLE_UINT64_ARRAY, value: [[ UINT64_MIN, 1, UINT64_MAX ], [ nil, nil, nil ], [ UINT64_MAX, UINT64_MIN, nil ]] },
|
593
|
+
{ name: "ORIN3_NULLABLE_INT8_ARRAY", type: :ORIN3_NULLABLE_INT8_ARRAY, value: [[ INT8_MIN, 1, INT8_MAX ], [ nil, nil, nil] , [ INT8_MAX, INT8_MIN, nil ]] },
|
594
|
+
{ name: "ORIN3_NULLABLE_INT16_ARRAY", type: :ORIN3_NULLABLE_INT16_ARRAY, value: [[ INT16_MIN, 1, INT16_MAX ], [ nil, nil, nil ], [ INT16_MAX, INT16_MIN, nil ]] },
|
595
|
+
{ name: "ORIN3_NULLABLE_INT32_ARRAY", type: :ORIN3_NULLABLE_INT32_ARRAY, value: [[ INT32_MIN, 1, INT32_MAX ], [ nil, nil, nil ], [ INT32_MAX, INT32_MIN, nil ]] },
|
596
|
+
{ name: "ORIN3_NULLABLE_INT64_ARRAY", type: :ORIN3_NULLABLE_INT64_ARRAY, value: [[ INT64_MIN, 1, INT64_MAX ], [ nil, nil, nil ], [ INT64_MAX, INT64_MIN, nil ]] },
|
597
|
+
{ name: "ORIN3_NULLABLE_FLOAT_ARRAY", type: :ORIN3_NULLABLE_FLOAT_ARRAY, value: [[ 0.0, 1.0 ], [ nil, nil ], [ 2.0, nil ]] },
|
598
|
+
{ name: "ORIN3_NULLABLE_DOUBLE_ARRAY", type: :ORIN3_NULLABLE_DOUBLE_ARRAY, value: [[ DOUBLE_MIN, 1.0, DOUBLE_MAX ], [ nil, nil, nil ], [ DOUBLE_MAX, DOUBLE_MIN, nil ]] },
|
599
|
+
{ name: "ORIN3_NULLABLE_DATETIME_ARRAY", type: :ORIN3_NULLABLE_DATETIME_ARRAY, value: [[ Time.utc(1, 1, 1, 0, 0, 0), Time.utc(9999, 12, 31, 23, 59, 59) ], [ nil, nil ], [ Time.utc(9999, 12, 31, 23, 59, 59), nil ]] },
|
600
|
+
]
|
601
|
+
|
602
|
+
VARIABLE_TEST_DATA.each do |data|
|
603
|
+
name = data[:name]
|
604
|
+
define_method("test_variable_#{name}") do
|
605
|
+
$logger.info "* test_variable_#{name} called."
|
606
|
+
parent = create_or_get_controller("test_variable")
|
607
|
+
if two_dimensional_array?(data[:value])
|
608
|
+
length = data[:value][0].length
|
609
|
+
option = {}
|
610
|
+
option["Element Count"] = length
|
611
|
+
variable = create_or_get_variable(parent, "test_variable_#{name}", option, data[:type])
|
612
|
+
else
|
613
|
+
variable = create_or_get_variable(parent, "test_variable_#{name}", nil, data[:type])
|
614
|
+
end
|
615
|
+
data[:value].each do |it|
|
616
|
+
variable.set_value(it)
|
617
|
+
if it.nil?
|
618
|
+
assert_nil variable.get_value
|
619
|
+
else
|
620
|
+
assert_equal it, variable.get_value
|
621
|
+
end
|
622
|
+
end
|
623
|
+
end
|
624
|
+
end
|
625
|
+
|
626
|
+
VARIABLE_RANGE_TEST_DATA = [
|
627
|
+
{ name: "ORIN3_UINT8", type: :ORIN3_UINT8, value: [ UINT8_MIN - 1, UINT8_MAX + 1 ] },
|
628
|
+
{ name: "ORIN3_UINT16", type: :ORIN3_UINT16, value: [ UINT16_MIN - 1, UINT16_MAX + 1 ] },
|
629
|
+
{ name: "ORIN3_UINT32", type: :ORIN3_UINT32, value: [ UINT32_MIN - 1, UINT32_MAX + 1 ] },
|
630
|
+
{ name: "ORIN3_UINT64", type: :ORIN3_UINT64, value: [ UINT64_MIN - 1, UINT64_MAX + 1 ] },
|
631
|
+
{ name: "ORIN3_INT8", type: :ORIN3_INT8, value: [ INT8_MIN - 1, INT8_MAX + 1 ] },
|
632
|
+
{ name: "ORIN3_INT16", type: :ORIN3_INT16, value: [ INT16_MIN - 1, INT16_MAX + 1 ] },
|
633
|
+
{ name: "ORIN3_INT32", type: :ORIN3_INT32, value: [ INT32_MIN - 1, INT32_MAX + 1 ] },
|
634
|
+
{ name: "ORIN3_INT64", type: :ORIN3_INT64, value: [ INT64_MIN - 1, INT64_MAX + 1 ] },
|
635
|
+
|
636
|
+
{ name: "ORIN3_NULLABLE_UINT8", type: :ORIN3_NULLABLE_UINT8, value: [ UINT8_MIN - 1, UINT8_MAX + 1 ] },
|
637
|
+
{ name: "ORIN3_NULLABLE_UINT16", type: :ORIN3_NULLABLE_UINT16, value: [ UINT16_MIN - 1, UINT16_MAX + 1 ] },
|
638
|
+
{ name: "ORIN3_NULLABLE_UINT32", type: :ORIN3_NULLABLE_UINT32, value: [ UINT32_MIN - 1, UINT32_MAX + 1 ] },
|
639
|
+
{ name: "ORIN3_NULLABLE_UINT64", type: :ORIN3_NULLABLE_UINT64, value: [ UINT64_MIN - 1, UINT64_MAX + 1 ] },
|
640
|
+
{ name: "ORIN3_NULLABLE_INT8", type: :ORIN3_NULLABLE_INT8, value: [ INT8_MIN - 1, INT8_MAX + 1 ] },
|
641
|
+
{ name: "ORIN3_NULLABLE_INT16", type: :ORIN3_NULLABLE_INT16, value: [ INT16_MIN - 1, INT16_MAX + 1 ] },
|
642
|
+
{ name: "ORIN3_NULLABLE_INT32", type: :ORIN3_NULLABLE_INT32, value: [ INT32_MIN - 1, INT32_MAX + 1 ] },
|
643
|
+
{ name: "ORIN3_NULLABLE_INT64", type: :ORIN3_NULLABLE_INT64, value: [ INT64_MIN - 1, INT64_MAX + 1 ] },
|
644
|
+
|
645
|
+
{ name: "ORIN3_UINT8_ARRAY", type: :ORIN3_UINT8_ARRAY, value: [[ UINT8_MIN - 1 ], [ UINT8_MAX + 1 ]] },
|
646
|
+
{ name: "ORIN3_UINT16_ARRAY", type: :ORIN3_UINT16_ARRAY, value: [[ UINT16_MIN - 1 ], [ UINT16_MAX + 1 ]] },
|
647
|
+
{ name: "ORIN3_UINT32_ARRAY", type: :ORIN3_UINT32_ARRAY, value: [[ UINT32_MIN - 1 ], [ UINT32_MAX + 1 ]] },
|
648
|
+
{ name: "ORIN3_UINT64_ARRAY", type: :ORIN3_UINT64_ARRAY, value: [[ UINT64_MIN - 1 ], [ UINT64_MAX + 1 ]] },
|
649
|
+
{ name: "ORIN3_INT8_ARRAY", type: :ORIN3_INT8_ARRAY, value: [[ INT8_MIN - 1 ], [ INT8_MAX + 1 ]] },
|
650
|
+
{ name: "ORIN3_INT16_ARRAY", type: :ORIN3_INT16_ARRAY, value: [[ INT16_MIN - 1 ], [ INT16_MAX + 1 ]] },
|
651
|
+
{ name: "ORIN3_INT32_ARRAY", type: :ORIN3_INT32_ARRAY, value: [[ INT32_MIN - 1 ], [ INT32_MAX + 1 ]] },
|
652
|
+
{ name: "ORIN3_INT64_ARRAY", type: :ORIN3_INT64_ARRAY, value: [[ INT64_MIN - 1 ], [ INT64_MAX + 1 ]] },
|
653
|
+
|
654
|
+
{ name: "ORIN3_NULLABLE_UINT8_ARRAY", type: :ORIN3_NULLABLE_UINT8_ARRAY, value: [[ UINT8_MIN - 1 ], [ UINT8_MAX + 1 ]] },
|
655
|
+
{ name: "ORIN3_NULLABLE_UINT16_ARRAY", type: :ORIN3_NULLABLE_UINT16_ARRAY, value: [[ UINT16_MIN - 1 ], [ UINT16_MAX + 1 ]] },
|
656
|
+
{ name: "ORIN3_NULLABLE_UINT32_ARRAY", type: :ORIN3_NULLABLE_UINT32_ARRAY, value: [[ UINT32_MIN - 1 ], [ UINT32_MAX + 1 ]] },
|
657
|
+
{ name: "ORIN3_NULLABLE_UINT64_ARRAY", type: :ORIN3_NULLABLE_UINT64_ARRAY, value: [[ UINT64_MIN - 1 ], [ UINT64_MAX + 1 ]] },
|
658
|
+
{ name: "ORIN3_NULLABLE_INT8_ARRAY", type: :ORIN3_NULLABLE_INT8_ARRAY, value: [[ INT8_MIN - 1 ], [ INT8_MAX + 1 ]] },
|
659
|
+
{ name: "ORIN3_NULLABLE_INT16_ARRAY", type: :ORIN3_NULLABLE_INT16_ARRAY, value: [[ INT16_MIN - 1 ], [ INT16_MAX + 1 ]] },
|
660
|
+
{ name: "ORIN3_NULLABLE_INT32_ARRAY", type: :ORIN3_NULLABLE_INT32_ARRAY, value: [[ INT32_MIN - 1 ], [ INT32_MAX + 1 ]] },
|
661
|
+
{ name: "ORIN3_NULLABLE_INT64_ARRAY", type: :ORIN3_NULLABLE_INT64_ARRAY, value: [[ INT64_MIN - 1 ], [ INT64_MAX + 1 ]] },
|
662
|
+
]
|
663
|
+
|
664
|
+
VARIABLE_RANGE_TEST_DATA.each do |data|
|
665
|
+
name = data[:name]
|
666
|
+
define_method("test_variable_range_#{name}") do
|
667
|
+
$logger.info "* test_variable_range_#{name} called."
|
668
|
+
parent = create_or_get_controller("test_variable_range")
|
669
|
+
if two_dimensional_array?(data[:value])
|
670
|
+
length = data[:value][0].length
|
671
|
+
option = {}
|
672
|
+
option["Element Count"] = length
|
673
|
+
variable = create_or_get_variable(parent, "test_variable_range_#{name}", option, data[:type])
|
674
|
+
else
|
675
|
+
variable = create_or_get_variable(parent, "test_variable_range_#{name}", nil, data[:type])
|
676
|
+
end
|
677
|
+
data[:value].each do |it|
|
678
|
+
exception = assert_raises(Grpc::Client::ORiN3::MessageClientError) do
|
679
|
+
variable.set_value(it)
|
680
|
+
end
|
681
|
+
$logger.info "Exception message: #{exception.message}"
|
682
|
+
assert_includes exception.message, "out of range"
|
683
|
+
end
|
684
|
+
end
|
685
|
+
end
|
686
|
+
|
687
|
+
VARIABLE_DATA_TYPE_TEST_DATA = [
|
688
|
+
{ name: "ORIN3_BOOL", type: :ORIN3_BOOL, is_array: false, ruby_type: String },
|
689
|
+
{ name: "ORIN3_UINT8", type: :ORIN3_UINT8, is_array: false, ruby_type: String },
|
690
|
+
{ name: "ORIN3_UINT16", type: :ORIN3_UINT16, is_array: false, ruby_type: String },
|
691
|
+
{ name: "ORIN3_UINT32", type: :ORIN3_UINT32, is_array: false, ruby_type: String },
|
692
|
+
{ name: "ORIN3_UINT64", type: :ORIN3_UINT64, is_array: false, ruby_type: String },
|
693
|
+
{ name: "ORIN3_INT8", type: :ORIN3_INT8, is_array: false, ruby_type: String },
|
694
|
+
{ name: "ORIN3_INT16", type: :ORIN3_INT16, is_array: false, ruby_type: String },
|
695
|
+
{ name: "ORIN3_INT32", type: :ORIN3_INT32, is_array: false, ruby_type: String },
|
696
|
+
{ name: "ORIN3_INT64", type: :ORIN3_INT64, is_array: false, ruby_type: String },
|
697
|
+
{ name: "ORIN3_FLOAT", type: :ORIN3_FLOAT, is_array: false, ruby_type: String },
|
698
|
+
{ name: "ORIN3_DOUBLE", type: :ORIN3_DOUBLE, is_array: false, ruby_type: String },
|
699
|
+
{ name: "ORIN3_DATETIME", type: :ORIN3_DATETIME, is_array: false, ruby_type: String },
|
700
|
+
{ name: "ORIN3_STRING", type: :ORIN3_STRING, is_array: false, ruby_type: Time },
|
701
|
+
|
702
|
+
{ name: "ORIN3_NULLABLE_BOOL", type: :ORIN3_NULLABLE_BOOL, is_array: false, ruby_type: String },
|
703
|
+
{ name: "ORIN3_NULLABLE_UINT8", type: :ORIN3_NULLABLE_UINT8, is_array: false, ruby_type: String },
|
704
|
+
{ name: "ORIN3_NULLABLE_UINT16", type: :ORIN3_NULLABLE_UINT16, is_array: false, ruby_type: String },
|
705
|
+
{ name: "ORIN3_NULLABLE_UINT32", type: :ORIN3_NULLABLE_UINT32, is_array: false, ruby_type: String },
|
706
|
+
{ name: "ORIN3_NULLABLE_UINT64", type: :ORIN3_NULLABLE_UINT64, is_array: false, ruby_type: String },
|
707
|
+
{ name: "ORIN3_NULLABLE_INT8", type: :ORIN3_NULLABLE_INT8, is_array: false, ruby_type: String},
|
708
|
+
{ name: "ORIN3_NULLABLE_INT16", type: :ORIN3_NULLABLE_INT16, is_array: false, ruby_type: String },
|
709
|
+
{ name: "ORIN3_NULLABLE_INT32", type: :ORIN3_NULLABLE_INT32, is_array: false, ruby_type: String },
|
710
|
+
{ name: "ORIN3_NULLABLE_INT64", type: :ORIN3_NULLABLE_INT64, is_array: false, ruby_type: String },
|
711
|
+
{ name: "ORIN3_NULLABLE_FLOAT", type: :ORIN3_NULLABLE_FLOAT, is_array: false, ruby_type: String },
|
712
|
+
{ name: "ORIN3_NULLABLE_DOUBLE", type: :ORIN3_NULLABLE_DOUBLE, is_array: false, ruby_type: String },
|
713
|
+
{ name: "ORIN3_NULLABLE_DATETIME", type: :ORIN3_NULLABLE_DATETIME, is_array: false, ruby_type: String },
|
714
|
+
|
715
|
+
{ name: "ORIN3_BOOL_ARRAY", type: :ORIN3_BOOL_ARRAY, is_array: true, ruby_type: String },
|
716
|
+
{ name: "ORIN3_UINT8_ARRAY", type: :ORIN3_UINT8_ARRAY, is_array: true, ruby_type: String },
|
717
|
+
{ name: "ORIN3_UINT16_ARRAY", type: :ORIN3_UINT16_ARRAY, is_array: true, ruby_type: String },
|
718
|
+
{ name: "ORIN3_UINT32_ARRAY", type: :ORIN3_UINT32_ARRAY, is_array: true, ruby_type: String },
|
719
|
+
{ name: "ORIN3_UINT64_ARRAY", type: :ORIN3_UINT64_ARRAY, is_array: true, ruby_type: String },
|
720
|
+
{ name: "ORIN3_INT8_ARRAY", type: :ORIN3_INT8_ARRAY, is_array: true, ruby_type: String },
|
721
|
+
{ name: "ORIN3_INT16_ARRAY", type: :ORIN3_INT16_ARRAY, is_array: true, ruby_type: String },
|
722
|
+
{ name: "ORIN3_INT32_ARRAY", type: :ORIN3_INT32_ARRAY, is_array: true, ruby_type: String },
|
723
|
+
{ name: "ORIN3_INT64_ARRAY", type: :ORIN3_INT64_ARRAY, is_array: true, ruby_type: String },
|
724
|
+
{ name: "ORIN3_FLOAT_ARRAY", type: :ORIN3_FLOAT_ARRAY, is_array: true, ruby_type: String },
|
725
|
+
{ name: "ORIN3_DOUBLE_ARRAY", type: :ORIN3_DOUBLE_ARRAY, is_array: true, ruby_type: String },
|
726
|
+
{ name: "ORIN3_DATETIME_ARRAY", type: :ORIN3_DATETIME_ARRAY, is_array: true, ruby_type: String },
|
727
|
+
{ name: "ORIN3_STRING_ARRAY", type: :ORIN3_STRING_ARRAY, is_array: true, ruby_type: Time},
|
728
|
+
|
729
|
+
{ name: "ORIN3_NULLABLE_BOOL_ARRAY", type: :ORIN3_NULLABLE_BOOL_ARRAY, is_array: true, ruby_type: String },
|
730
|
+
{ name: "ORIN3_NULLABLE_UINT8_ARRAY", type: :ORIN3_NULLABLE_UINT8_ARRAY, is_array: true, ruby_type: String },
|
731
|
+
{ name: "ORIN3_NULLABLE_UINT16_ARRAY", type: :ORIN3_NULLABLE_UINT16_ARRAY, is_array: true, ruby_type: String },
|
732
|
+
{ name: "ORIN3_NULLABLE_UINT32_ARRAY", type: :ORIN3_NULLABLE_UINT32_ARRAY, is_array: true, ruby_type: String },
|
733
|
+
{ name: "ORIN3_NULLABLE_UINT64_ARRAY", type: :ORIN3_NULLABLE_UINT64_ARRAY, is_array: true, ruby_type: String },
|
734
|
+
{ name: "ORIN3_NULLABLE_INT8_ARRAY", type: :ORIN3_NULLABLE_INT8_ARRAY, is_array: true, ruby_type: String },
|
735
|
+
{ name: "ORIN3_NULLABLE_INT16_ARRAY", type: :ORIN3_NULLABLE_INT16_ARRAY, is_array: true, ruby_type: String },
|
736
|
+
{ name: "ORIN3_NULLABLE_INT32_ARRAY", type: :ORIN3_NULLABLE_INT32_ARRAY, is_array: true, ruby_type: String },
|
737
|
+
{ name: "ORIN3_NULLABLE_INT64_ARRAY", type: :ORIN3_NULLABLE_INT64_ARRAY, is_array: true, ruby_type: String },
|
738
|
+
{ name: "ORIN3_NULLABLE_FLOAT_ARRAY", type: :ORIN3_NULLABLE_INT64_ARRAY, is_array: true, ruby_type: String },
|
739
|
+
{ name: "ORIN3_NULLABLE_DOUBLE_ARRAY", type: :ORIN3_NULLABLE_INT64_ARRAY, is_array: true, ruby_type: String },
|
740
|
+
{ name: "ORIN3_NULLABLE_DATETIME_ARRAY", type: :ORIN3_NULLABLE_INT64_ARRAY, is_array: true, ruby_type: String },
|
741
|
+
]
|
742
|
+
|
743
|
+
VARIABLE_DATA_TYPE_TEST_DATA.each do |data|
|
744
|
+
name = data[:name]
|
745
|
+
define_method("test_variable_data_type_#{name}") do
|
746
|
+
$logger.info "* test_variable_data_type_#{name} called."
|
747
|
+
parent = create_or_get_controller("test_variable_data_type")
|
748
|
+
variable = create_or_get_variable(parent, "test_variable_data_type_#{name}", nil, data[:type])
|
749
|
+
exception = assert_raises(Grpc::Client::ORiN3::MessageClientError) do
|
750
|
+
if data[:is_array]
|
751
|
+
variable.set_value([data[:ruby_type].new])
|
752
|
+
else
|
753
|
+
variable.set_value(data[:ruby_type].new)
|
754
|
+
end
|
755
|
+
end
|
756
|
+
$logger.info "Exception message: #{exception.message}"
|
757
|
+
assert_includes exception.message, "Value is not"
|
758
|
+
end
|
759
|
+
end
|
760
|
+
|
761
|
+
VARIABLE_NIL_TEST_DATA = [
|
762
|
+
{ name: "ORIN3_BOOL", type: :ORIN3_BOOL },
|
763
|
+
{ name: "ORIN3_UINT8", type: :ORIN3_UINT8 },
|
764
|
+
{ name: "ORIN3_UINT16", type: :ORIN3_UINT16 },
|
765
|
+
{ name: "ORIN3_UINT32", type: :ORIN3_UINT32 },
|
766
|
+
{ name: "ORIN3_UINT64", type: :ORIN3_UINT64 },
|
767
|
+
{ name: "ORIN3_INT8", type: :ORIN3_INT8 },
|
768
|
+
{ name: "ORIN3_INT16", type: :ORIN3_INT16 },
|
769
|
+
{ name: "ORIN3_INT32", type: :ORIN3_INT32 },
|
770
|
+
{ name: "ORIN3_INT64", type: :ORIN3_INT64 },
|
771
|
+
{ name: "ORIN3_FLOAT", type: :ORIN3_FLOAT },
|
772
|
+
{ name: "ORIN3_DOUBLE", type: :ORIN3_DOUBLE },
|
773
|
+
{ name: "ORIN3_DATETIME", type: :ORIN3_DATETIME },
|
774
|
+
|
775
|
+
{ name: "ORIN3_BOOL_ARRAY", type: :ORIN3_BOOL_ARRAY },
|
776
|
+
{ name: "ORIN3_UINT8_ARRAY", type: :ORIN3_UINT8_ARRAY },
|
777
|
+
{ name: "ORIN3_UINT16_ARRAY", type: :ORIN3_UINT16_ARRAY },
|
778
|
+
{ name: "ORIN3_UINT32_ARRAY", type: :ORIN3_UINT32_ARRAY },
|
779
|
+
{ name: "ORIN3_UINT64_ARRAY", type: :ORIN3_UINT64_ARRAY },
|
780
|
+
{ name: "ORIN3_INT8_ARRAY", type: :ORIN3_INT8_ARRAY },
|
781
|
+
{ name: "ORIN3_INT16_ARRAY", type: :ORIN3_INT16_ARRAY },
|
782
|
+
{ name: "ORIN3_INT32_ARRAY", type: :ORIN3_INT32_ARRAY },
|
783
|
+
{ name: "ORIN3_INT64_ARRAY", type: :ORIN3_INT64_ARRAY },
|
784
|
+
{ name: "ORIN3_FLOAT_ARRAY", type: :ORIN3_FLOAT_ARRAY },
|
785
|
+
{ name: "ORIN3_DOUBLE_ARRAY", type: :ORIN3_DOUBLE_ARRAY },
|
786
|
+
{ name: "ORIN3_DATETIME_ARRAY", type: :ORIN3_DATETIME_ARRAY },
|
787
|
+
{ name: "ORIN3_STRING_ARRAY", type: :ORIN3_STRING_ARRAY },
|
788
|
+
|
789
|
+
{ name: "ORIN3_NULLABLE_BOOL_ARRAY", type: :ORIN3_NULLABLE_BOOL_ARRAY },
|
790
|
+
{ name: "ORIN3_NULLABLE_UINT8_ARRAY", type: :ORIN3_NULLABLE_UINT8_ARRAY },
|
791
|
+
{ name: "ORIN3_NULLABLE_UINT16_ARRAY", type: :ORIN3_NULLABLE_UINT16_ARRAY },
|
792
|
+
{ name: "ORIN3_NULLABLE_UINT32_ARRAY", type: :ORIN3_NULLABLE_UINT32_ARRAY },
|
793
|
+
{ name: "ORIN3_NULLABLE_UINT64_ARRAY", type: :ORIN3_NULLABLE_UINT64_ARRAY },
|
794
|
+
{ name: "ORIN3_NULLABLE_INT8_ARRAY", type: :ORIN3_NULLABLE_INT8_ARRAY },
|
795
|
+
{ name: "ORIN3_NULLABLE_INT16_ARRAY", type: :ORIN3_NULLABLE_INT16_ARRAY },
|
796
|
+
{ name: "ORIN3_NULLABLE_INT32_ARRAY", type: :ORIN3_NULLABLE_INT32_ARRAY },
|
797
|
+
{ name: "ORIN3_NULLABLE_INT64_ARRAY", type: :ORIN3_NULLABLE_INT64_ARRAY },
|
798
|
+
{ name: "ORIN3_NULLABLE_FLOAT_ARRAY", type: :ORIN3_NULLABLE_INT64_ARRAY },
|
799
|
+
{ name: "ORIN3_NULLABLE_DOUBLE_ARRAY", type: :ORIN3_NULLABLE_INT64_ARRAY },
|
800
|
+
{ name: "ORIN3_NULLABLE_DATETIME_ARRAY", type: :ORIN3_NULLABLE_INT64_ARRAY },
|
801
|
+
{ name: "ORIN3_NULLABLE_STRING_ARRAY", type: :ORIN3_NULLABLE_INT64_ARRAY },
|
802
|
+
]
|
803
|
+
|
804
|
+
VARIABLE_NIL_TEST_DATA.each do |data|
|
805
|
+
name = data[:name]
|
806
|
+
define_method("test_variable_nil_#{name}") do
|
807
|
+
$logger.info "* test_variable_nil_#{name} called."
|
808
|
+
parent = create_or_get_controller("test_variable_nil_data")
|
809
|
+
variable = create_or_get_variable(parent, "test_variable_nil_#{name}", nil, data[:type])
|
810
|
+
exception = assert_raises(Grpc::Client::ORiN3::MessageClientError) do
|
811
|
+
variable.set_value(nil)
|
812
|
+
end
|
813
|
+
$logger.info "Exception message: #{exception.message}"
|
814
|
+
assert_includes exception.message, "Value is nil"
|
815
|
+
end
|
816
|
+
end
|
817
|
+
|
818
|
+
VARIABLE_NIL2_TEST_DATA = [
|
819
|
+
{ name: "ORIN3_BOOL_ARRAY", type: :ORIN3_BOOL_ARRAY },
|
820
|
+
{ name: "ORIN3_UINT8_ARRAY", type: :ORIN3_UINT8_ARRAY },
|
821
|
+
{ name: "ORIN3_UINT16_ARRAY", type: :ORIN3_UINT16_ARRAY },
|
822
|
+
{ name: "ORIN3_UINT32_ARRAY", type: :ORIN3_UINT32_ARRAY },
|
823
|
+
{ name: "ORIN3_UINT64_ARRAY", type: :ORIN3_UINT64_ARRAY },
|
824
|
+
{ name: "ORIN3_INT8_ARRAY", type: :ORIN3_INT8_ARRAY },
|
825
|
+
{ name: "ORIN3_INT16_ARRAY", type: :ORIN3_INT16_ARRAY },
|
826
|
+
{ name: "ORIN3_INT32_ARRAY", type: :ORIN3_INT32_ARRAY },
|
827
|
+
{ name: "ORIN3_INT64_ARRAY", type: :ORIN3_INT64_ARRAY },
|
828
|
+
{ name: "ORIN3_FLOAT_ARRAY", type: :ORIN3_FLOAT_ARRAY },
|
829
|
+
{ name: "ORIN3_DOUBLE_ARRAY", type: :ORIN3_DOUBLE_ARRAY },
|
830
|
+
{ name: "ORIN3_DATETIME_ARRAY", type: :ORIN3_DATETIME_ARRAY },
|
831
|
+
]
|
832
|
+
|
833
|
+
VARIABLE_NIL2_TEST_DATA.each do |data|
|
834
|
+
name = data[:name]
|
835
|
+
define_method("test_variable_nil2_#{name}") do
|
836
|
+
$logger.info "* test_variable_nil2_#{name} called."
|
837
|
+
parent = create_or_get_controller("test_variable_nil2_data")
|
838
|
+
variable = create_or_get_variable(parent, "test_variable_nil2_#{name}", nil, data[:type])
|
839
|
+
exception = assert_raises(Grpc::Client::ORiN3::MessageClientError) do
|
840
|
+
variable.set_value([ nil ])
|
841
|
+
end
|
842
|
+
$logger.info "Exception message: #{exception.message}"
|
843
|
+
assert_includes exception.message, "Value contains nil."
|
844
|
+
end
|
845
|
+
end
|
846
|
+
|
847
|
+
VARIABLE_ARRAY_TEST_DATA = [
|
848
|
+
{ name: "ORIN3_BOOL_ARRAY", type: :ORIN3_BOOL_ARRAY },
|
849
|
+
{ name: "ORIN3_UINT8_ARRAY", type: :ORIN3_UINT8_ARRAY },
|
850
|
+
{ name: "ORIN3_UINT16_ARRAY", type: :ORIN3_UINT16_ARRAY },
|
851
|
+
{ name: "ORIN3_UINT32_ARRAY", type: :ORIN3_UINT32_ARRAY },
|
852
|
+
{ name: "ORIN3_UINT64_ARRAY", type: :ORIN3_UINT64_ARRAY },
|
853
|
+
{ name: "ORIN3_INT8_ARRAY", type: :ORIN3_INT8_ARRAY },
|
854
|
+
{ name: "ORIN3_INT16_ARRAY", type: :ORIN3_INT16_ARRAY },
|
855
|
+
{ name: "ORIN3_INT32_ARRAY", type: :ORIN3_INT32_ARRAY },
|
856
|
+
{ name: "ORIN3_INT64_ARRAY", type: :ORIN3_INT64_ARRAY },
|
857
|
+
{ name: "ORIN3_FLOAT_ARRAY", type: :ORIN3_FLOAT_ARRAY },
|
858
|
+
{ name: "ORIN3_DOUBLE_ARRAY", type: :ORIN3_DOUBLE_ARRAY },
|
859
|
+
{ name: "ORIN3_DATETIME_ARRAY", type: :ORIN3_DATETIME_ARRAY },
|
860
|
+
{ name: "ORIN3_STRING_ARRAY", type: :ORIN3_STRING_ARRAY },
|
861
|
+
|
862
|
+
{ name: "ORIN3_NULLABLE_BOOL_ARRAY", type: :ORIN3_NULLABLE_BOOL_ARRAY },
|
863
|
+
{ name: "ORIN3_NULLABLE_UINT8_ARRAY", type: :ORIN3_NULLABLE_UINT8_ARRAY },
|
864
|
+
{ name: "ORIN3_NULLABLE_UINT16_ARRAY", type: :ORIN3_NULLABLE_UINT16_ARRAY },
|
865
|
+
{ name: "ORIN3_NULLABLE_UINT32_ARRAY", type: :ORIN3_NULLABLE_UINT32_ARRAY },
|
866
|
+
{ name: "ORIN3_NULLABLE_UINT64_ARRAY", type: :ORIN3_NULLABLE_UINT64_ARRAY },
|
867
|
+
{ name: "ORIN3_NULLABLE_INT8_ARRAY", type: :ORIN3_NULLABLE_INT8_ARRAY },
|
868
|
+
{ name: "ORIN3_NULLABLE_INT16_ARRAY", type: :ORIN3_NULLABLE_INT16_ARRAY },
|
869
|
+
{ name: "ORIN3_NULLABLE_INT32_ARRAY", type: :ORIN3_NULLABLE_INT32_ARRAY },
|
870
|
+
{ name: "ORIN3_NULLABLE_INT64_ARRAY", type: :ORIN3_NULLABLE_INT64_ARRAY },
|
871
|
+
{ name: "ORIN3_NULLABLE_FLOAT_ARRAY", type: :ORIN3_NULLABLE_INT64_ARRAY },
|
872
|
+
{ name: "ORIN3_NULLABLE_DOUBLE_ARRAY", type: :ORIN3_NULLABLE_INT64_ARRAY },
|
873
|
+
{ name: "ORIN3_NULLABLE_DATETIME_ARRAY", type: :ORIN3_NULLABLE_INT64_ARRAY },
|
874
|
+
{ name: "ORIN3_NULLABLE_STRING_ARRAY", type: :ORIN3_NULLABLE_INT64_ARRAY },
|
875
|
+
]
|
876
|
+
|
877
|
+
VARIABLE_ARRAY_TEST_DATA.each do |data|
|
878
|
+
name = data[:name]
|
879
|
+
define_method("test_variable_array_#{name}") do
|
880
|
+
$logger.info "* test_variable_array_#{name} called."
|
881
|
+
parent = create_or_get_controller("test_variable_array_data")
|
882
|
+
variable = create_or_get_variable(parent, "test_variable_array_#{name}", nil, data[:type])
|
883
|
+
exception = assert_raises(Grpc::Client::ORiN3::MessageClientError) do
|
884
|
+
variable.set_value(0)
|
885
|
+
end
|
886
|
+
$logger.info "Exception message: #{exception.message}"
|
887
|
+
assert_includes exception.message, "Value is not Array."
|
888
|
+
end
|
889
|
+
end
|
890
|
+
|
891
|
+
def test_dictionary
|
892
|
+
$logger.info "* test_dictionary called."
|
893
|
+
controller = create_or_get_controller("test_dictionary")
|
894
|
+
controller.connect
|
895
|
+
job = controller.create_job("job",
|
896
|
+
"ORiN3.Provider.ORiNConsortium.Mock.O3Object.Job.DataRegenerationJob, ORiN3.Provider.ORiNConsortium.Mock",
|
897
|
+
"{ \"@Version\":\"1.0.0\", \"Interval\":500 }")
|
898
|
+
job.start({ "RepeatCount" => ORiN3BinaryConverter.serialize(3, ORiN3BinaryConverter::DataType::Int32) })
|
899
|
+
puts job.get_standard_output
|
900
|
+
puts job.get_standard_error
|
901
|
+
job.stop
|
902
|
+
puts job.get_result
|
903
|
+
end
|
904
|
+
|
905
|
+
def two_dimensional_array?(target)
|
906
|
+
target.is_a?(Array) && target.all? { |e| e.is_a?(Array) }
|
907
|
+
end
|
908
|
+
end
|