te3270-jruby 0.1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/ChangeLog +2 -0
- data/Gemfile +11 -0
- data/Guardfile +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +88 -0
- data/Rakefile +6 -0
- data/ext/mkrf_conf.rb +19 -0
- data/lib/te3270/accessors.rb +30 -0
- data/lib/te3270/emulator_factory.rb +21 -0
- data/lib/te3270/emulators/extra.rb +224 -0
- data/lib/te3270/emulators/quick3270.rb +206 -0
- data/lib/te3270/function_keys.rb +78 -0
- data/lib/te3270/screen_factory.rb +51 -0
- data/lib/te3270/version.rb +4 -0
- data/lib/te3270.rb +166 -0
- data/spec/lib/te3270/accessors_spec.rb +50 -0
- data/spec/lib/te3270/emulators/extra_spec.rb +182 -0
- data/spec/lib/te3270/emulators/quick3270_spec.rb +146 -0
- data/spec/lib/te3270/screen_factory_spec.rb +48 -0
- data/spec/lib/te3270_spec.rb +98 -0
- data/spec/spec_helper.rb +67 -0
- data/te3270.gemspec +29 -0
- metadata +132 -0
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class ScreenFactoryScreen
|
4
|
+
include TE3270
|
5
|
+
end
|
6
|
+
|
7
|
+
class WorldSuper
|
8
|
+
attr_reader :super_called
|
9
|
+
def on(screen_class, &block)
|
10
|
+
@super_called = true
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class World < WorldSuper
|
15
|
+
include TE3270::ScreenFactory
|
16
|
+
end
|
17
|
+
|
18
|
+
describe TE3270::ScreenFactory do
|
19
|
+
|
20
|
+
let(:world) { World.new }
|
21
|
+
|
22
|
+
it 'should create a new screen object' do
|
23
|
+
emulator = double('platform')
|
24
|
+
world.instance_variable_set('@emulator', emulator)
|
25
|
+
world.on(ScreenFactoryScreen).should be_instance_of ScreenFactoryScreen
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should create a new screen object and execute a block' do
|
29
|
+
emulator = double('platform')
|
30
|
+
world.instance_variable_set('@emulator', emulator)
|
31
|
+
world.on(ScreenFactoryScreen) do |page|
|
32
|
+
page.should be_instance_of ScreenFactoryScreen
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should raise an error when an @emulator instance variable does not exist' do
|
37
|
+
expect { world.on(ScreenFactoryScreen) }.to raise_error("@emulator instance variable must be available to use the ScreenFactory methods")
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should pass control to super if passed a class that does not include TE3270' do
|
41
|
+
class NoTE
|
42
|
+
end
|
43
|
+
emulator = double('platform')
|
44
|
+
world.instance_variable_set('@emulator', emulator)
|
45
|
+
world.on(NoTE)
|
46
|
+
world.super_called.should be true
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class TEScreenObject
|
4
|
+
include TE3270
|
5
|
+
|
6
|
+
attr_reader :initialize_screen
|
7
|
+
|
8
|
+
def initialize_screen
|
9
|
+
@initialize_screen = true
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe TE3270 do
|
14
|
+
let(:platform) { double('platform') }
|
15
|
+
let(:screen_object) { TEScreenObject.new platform }
|
16
|
+
|
17
|
+
before(:each) do
|
18
|
+
screen_object.stub(:platform).and_return platform
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "interacting with the platform" do
|
22
|
+
it 'should use the platform to connect to an emulator' do
|
23
|
+
platform.should_receive(:connect)
|
24
|
+
screen_object.connect
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should use the platform to disconnect from an emulator' do
|
28
|
+
platform.should_receive(:disconnect)
|
29
|
+
screen_object.disconnect
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should use the platform to send keys to the screen' do
|
33
|
+
platform.should_receive(:send_keys).with('<Clear>')
|
34
|
+
screen_object.send_keys(TE3270.Clear)
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should use the platform to wait for a string to appear on the screen' do
|
38
|
+
platform.should_receive(:wait_for_string).with('The String', 2, 4)
|
39
|
+
screen_object.wait_for_string('The String', 2, 4)
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should use the platform to wait for the host to be quiet' do
|
43
|
+
platform.should_receive(:wait_for_host).with(4)
|
44
|
+
screen_object.wait_for_host(4)
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'should default to five seconds when waiting for the host' do
|
48
|
+
platform.should_receive(:wait_for_host).with(5)
|
49
|
+
screen_object.wait_for_host
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'should use the platform to wait until the cursor at a specific position' do
|
53
|
+
platform.should_receive(:wait_until_cursor_at).with(10, 10)
|
54
|
+
screen_object.wait_until_cursor_at(10, 10)
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'should use the platform to take a screenshot of the screen' do
|
58
|
+
platform.should_receive(:screenshot).with('image.png')
|
59
|
+
screen_object.screenshot('image.png')
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'should use the platform to get the text for the entire screen' do
|
63
|
+
platform.should_receive(:text).and_return('123abc')
|
64
|
+
screen_object.text.should == '123abc'
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe "module functionality" do
|
69
|
+
it 'should know the function keys' do
|
70
|
+
TE3270.Clear.should == '<Clear>'
|
71
|
+
TE3270.Pf24.should == '<Pf24>'
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'should call initialize_screen if it exists' do
|
75
|
+
screen_object.initialize_screen.should be true
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'should create an emulator and connect to terminal' do
|
79
|
+
TE3270::Emulators::Extra.should_receive(:new).and_return(platform)
|
80
|
+
platform.should_receive(:connect)
|
81
|
+
TE3270.emulator_for :extra
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'should accept a block when creating an emulator' do
|
85
|
+
WIN32OLE.stub(:new).and_return extra_system
|
86
|
+
extra_sessions.should_receive(:Open).with('blah.edp').and_return(extra_session)
|
87
|
+
TE3270.emulator_for :extra do |emulator|
|
88
|
+
emulator.session_file = 'blah.edp'
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'should allow one to disconnect using the module' do
|
93
|
+
platform.should_receive(:disconnect)
|
94
|
+
TE3270.disconnect(platform)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
|
+
|
3
|
+
if RUBY_PLATFORM == "java"
|
4
|
+
require 'te3270'
|
5
|
+
require 'jruby-win32ole'
|
6
|
+
else
|
7
|
+
require 'te3270'
|
8
|
+
require 'win32ole'
|
9
|
+
require 'win32/screenshot'
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
def extra_system
|
14
|
+
@extra_system ||= double('system')
|
15
|
+
@extra_system.stub(:Sessions).and_return extra_sessions
|
16
|
+
@extra_system.stub(:Version).and_return("0")
|
17
|
+
@extra_system
|
18
|
+
end
|
19
|
+
|
20
|
+
def extra_sessions
|
21
|
+
@extra_sessions ||= double('sessions')
|
22
|
+
@extra_sessions.stub(:Count).and_return 0
|
23
|
+
@extra_sessions.stub(:Open).and_return extra_session
|
24
|
+
@extra_sessions
|
25
|
+
end
|
26
|
+
|
27
|
+
def extra_session
|
28
|
+
@extra_session ||= double('session')
|
29
|
+
@extra_session.stub(:Screen).and_return extra_screen
|
30
|
+
@extra_session.stub(:WindowState=)
|
31
|
+
@extra_session.stub(:Visible=)
|
32
|
+
@extra_session
|
33
|
+
end
|
34
|
+
|
35
|
+
def extra_screen
|
36
|
+
@extra_screen ||= double('screen')
|
37
|
+
@extra_screen.stub(:SelectAll).and_return extra_area
|
38
|
+
@extra_screen
|
39
|
+
end
|
40
|
+
|
41
|
+
def extra_area
|
42
|
+
@extra_area ||= double('area')
|
43
|
+
@extra_area
|
44
|
+
end
|
45
|
+
|
46
|
+
def quick_system
|
47
|
+
@quick_system ||= double('quick_system')
|
48
|
+
@quick_system.stub(:ActiveSession).and_return quick_session
|
49
|
+
@quick_system.stub(:Visible=)
|
50
|
+
@quick_system
|
51
|
+
end
|
52
|
+
|
53
|
+
def quick_session
|
54
|
+
@quick_session ||= double('quick_session')
|
55
|
+
@quick_session.stub(:Screen).and_return quick_screen
|
56
|
+
@quick_session.stub(:Open)
|
57
|
+
@quick_session.stub(:Connect)
|
58
|
+
@quick_session.stub(:Server_Name=)
|
59
|
+
@quick_session.stub(:Connected).and_return true
|
60
|
+
@quick_session
|
61
|
+
end
|
62
|
+
|
63
|
+
def quick_screen
|
64
|
+
@quick_screen ||= double('screen')
|
65
|
+
@quick_screen
|
66
|
+
end
|
67
|
+
|
data/te3270.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'te3270/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "te3270-jruby"
|
8
|
+
spec.version = TE3270::VERSION
|
9
|
+
spec.platform = Gem::Platform::CURRENT
|
10
|
+
spec.authors = ["Pradeep K. Macharla"]
|
11
|
+
spec.email = ["pradeep@seleniumframework.com"]
|
12
|
+
spec.description = %q{Automates a 3270 Terminal Emulator}
|
13
|
+
spec.summary = %q{Automates a 3270 Terminal Emulator}
|
14
|
+
spec.homepage = "http://github.com/machzqcq/te3270"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files`.split($/)
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
spec.extensions = ["ext/mkrf_conf.rb"]
|
22
|
+
|
23
|
+
spec.add_dependency 'page_navigation', '>= 0.9'
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
26
|
+
spec.add_development_dependency "rake"
|
27
|
+
spec.add_development_dependency "rspec"
|
28
|
+
end
|
29
|
+
|
metadata
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: te3270-jruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: x86-mingw32
|
6
|
+
authors:
|
7
|
+
- Pradeep K. Macharla
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: page_navigation
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.9'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Automates a 3270 Terminal Emulator
|
70
|
+
email:
|
71
|
+
- pradeep@seleniumframework.com
|
72
|
+
executables: []
|
73
|
+
extensions:
|
74
|
+
- ext/mkrf_conf.rb
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- .gitignore
|
78
|
+
- .rspec
|
79
|
+
- .travis.yml
|
80
|
+
- ChangeLog
|
81
|
+
- Gemfile
|
82
|
+
- Guardfile
|
83
|
+
- LICENSE.txt
|
84
|
+
- README.md
|
85
|
+
- Rakefile
|
86
|
+
- ext/mkrf_conf.rb
|
87
|
+
- lib/te3270.rb
|
88
|
+
- lib/te3270/accessors.rb
|
89
|
+
- lib/te3270/emulator_factory.rb
|
90
|
+
- lib/te3270/emulators/extra.rb
|
91
|
+
- lib/te3270/emulators/quick3270.rb
|
92
|
+
- lib/te3270/function_keys.rb
|
93
|
+
- lib/te3270/screen_factory.rb
|
94
|
+
- lib/te3270/version.rb
|
95
|
+
- spec/lib/te3270/accessors_spec.rb
|
96
|
+
- spec/lib/te3270/emulators/extra_spec.rb
|
97
|
+
- spec/lib/te3270/emulators/quick3270_spec.rb
|
98
|
+
- spec/lib/te3270/screen_factory_spec.rb
|
99
|
+
- spec/lib/te3270_spec.rb
|
100
|
+
- spec/spec_helper.rb
|
101
|
+
- te3270.gemspec
|
102
|
+
homepage: http://github.com/machzqcq/te3270
|
103
|
+
licenses:
|
104
|
+
- MIT
|
105
|
+
metadata: {}
|
106
|
+
post_install_message:
|
107
|
+
rdoc_options: []
|
108
|
+
require_paths:
|
109
|
+
- lib
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - '>='
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - '>='
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
requirements: []
|
121
|
+
rubyforge_project:
|
122
|
+
rubygems_version: 2.4.6
|
123
|
+
signing_key:
|
124
|
+
specification_version: 4
|
125
|
+
summary: Automates a 3270 Terminal Emulator
|
126
|
+
test_files:
|
127
|
+
- spec/lib/te3270/accessors_spec.rb
|
128
|
+
- spec/lib/te3270/emulators/extra_spec.rb
|
129
|
+
- spec/lib/te3270/emulators/quick3270_spec.rb
|
130
|
+
- spec/lib/te3270/screen_factory_spec.rb
|
131
|
+
- spec/lib/te3270_spec.rb
|
132
|
+
- spec/spec_helper.rb
|