forked from piersharding/ruby-sapnwrfc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_mystruc.rb
executable file
·52 lines (45 loc) · 1.5 KB
/
test_mystruc.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/ruby
$KCODE = 'u'
$:.unshift(File.dirname(__FILE__) + '/lib')
$:.unshift(File.dirname(__FILE__) + '/ext/nwsaprfc')
$:.unshift(File.dirname(__FILE__) + '/../lib')
$:.unshift(File.dirname(__FILE__) + '/../ext/nwsaprfc')
require 'sapnwrfc'
$TEST_FILE = ENV.has_key?('SAP_YML') ? ENV['SAP_YML'] : 'sap.yml'
$ITER = 100
require 'test/unit'
require 'test/unit/assertions'
class SAPDeepTest < Test::Unit::TestCase
def setup
#SAP_LOGGER.warn "Current DIR: #{Dir.pwd}\n"
if FileTest.exists?($TEST_FILE)
SAPNW::Base.config_location = $TEST_FILE
else
SAPNW::Base.config_location = 'test/' + $TEST_FILE
end
SAPNW::Base.load_config
#SAP_LOGGER.warn "program: #{$0}\n"
end
def test_BASIC_00010_Test_Deep
begin
assert(conn = SAPNW::Base.rfc_connect)
attrib = conn.connection_attributes
SAP_LOGGER.warn "Connection Attributes: #{attrib.inspect}\n"
fds = conn.discover("Z_MY_NESTED_STRUCT")
$ITER.times do |iter|
SAP_LOGGER.warn "Parameters: #{fds.parameters.keys.inspect}\n"
fs = fds.new_function_call
fs.IMPORT_ELEMENT = { 'OTYPE' => "AA", 'FIRST' => "The first desc", 'CAPABILITIES' => { 'OBJID' => "1", 'TEXT' => "The short text1" } }
fs.invoke
SAP_LOGGER.warn "EXPORT_ELEMENT: #{fs.EXPORT_ELEMENT.inspect}\n"
GC.start unless iter % 50
end
assert(conn.close)
rescue SAPNW::RFC::FunctionCallException => e
SAP_LOGGER.warn "FunctionCallException: #{e.error.inspect}\n"
raise "gone"
end
end
def teardown
end
end