te3270-jruby 0.1-universal-java-1.7
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 +87 -0
- data/Rakefile +6 -0
- data/lib/te3270/accessors.rb +30 -0
- data/lib/te3270/emulator_factory.rb +21 -0
- data/lib/te3270/emulators/extra.rb +212 -0
- data/lib/te3270/emulators/quick3270.rb +191 -0
- data/lib/te3270/function_keys.rb +78 -0
- data/lib/te3270/screen_factory.rb +49 -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 +161 -0
- data/spec/lib/te3270/emulators/quick3270_spec.rb +146 -0
- data/spec/lib/te3270/screen_factory_spec.rb +32 -0
- data/spec/lib/te3270_spec.rb +98 -0
- data/spec/spec_helper.rb +61 -0
- data/te3270.gemspec +29 -0
- metadata +145 -0
@@ -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,61 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
|
+
|
3
|
+
require 'te3270'
|
4
|
+
require 'jruby-win32ole'
|
5
|
+
|
6
|
+
|
7
|
+
def extra_system
|
8
|
+
@extra_system ||= double('system')
|
9
|
+
@extra_system.stub(:Sessions).and_return extra_sessions
|
10
|
+
@extra_system.stub(:Version).and_return("0")
|
11
|
+
@extra_system
|
12
|
+
end
|
13
|
+
|
14
|
+
def extra_sessions
|
15
|
+
@extra_sessions ||= double('sessions')
|
16
|
+
@extra_sessions.stub(:Count).and_return 0
|
17
|
+
@extra_sessions.stub(:Open).and_return extra_session
|
18
|
+
@extra_sessions
|
19
|
+
end
|
20
|
+
|
21
|
+
def extra_session
|
22
|
+
@extra_session ||= double('session')
|
23
|
+
@extra_session.stub(:Screen).and_return extra_screen
|
24
|
+
@extra_session.stub(:WindowState=)
|
25
|
+
@extra_session.stub(:Visible=)
|
26
|
+
@extra_session
|
27
|
+
end
|
28
|
+
|
29
|
+
def extra_screen
|
30
|
+
@extra_screen ||= double('screen')
|
31
|
+
@extra_screen.stub(:SelectAll).and_return extra_area
|
32
|
+
@extra_screen
|
33
|
+
end
|
34
|
+
|
35
|
+
def extra_area
|
36
|
+
@extra_area ||= double('area')
|
37
|
+
@extra_area
|
38
|
+
end
|
39
|
+
|
40
|
+
def quick_system
|
41
|
+
@quick_system ||= double('quick_system')
|
42
|
+
@quick_system.stub(:ActiveSession).and_return quick_session
|
43
|
+
@quick_system.stub(:Visible=)
|
44
|
+
@quick_system
|
45
|
+
end
|
46
|
+
|
47
|
+
def quick_session
|
48
|
+
@quick_session ||= double('quick_session')
|
49
|
+
@quick_session.stub(:Screen).and_return quick_screen
|
50
|
+
@quick_session.stub(:Open)
|
51
|
+
@quick_session.stub(:Connect)
|
52
|
+
@quick_session.stub(:Server_Name=)
|
53
|
+
@quick_session.stub(:Connected).and_return true
|
54
|
+
@quick_session
|
55
|
+
end
|
56
|
+
|
57
|
+
def quick_screen
|
58
|
+
@quick_screen ||= double('screen')
|
59
|
+
@quick_screen
|
60
|
+
end
|
61
|
+
|
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
|
+
|
22
|
+
spec.add_dependency 'page_navigation', '>= 0.9'
|
23
|
+
spec.add_dependency 'jruby-win32ole'
|
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,145 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: te3270-jruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: universal-java-1.7
|
6
|
+
authors:
|
7
|
+
- Pradeep K. Macharla
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-02-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: page_navigation
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.9'
|
20
|
+
requirement: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - '>='
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '0.9'
|
25
|
+
prerelease: false
|
26
|
+
type: :runtime
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: jruby-win32ole
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
prerelease: false
|
40
|
+
type: :runtime
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ~>
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '1.3'
|
53
|
+
prerelease: false
|
54
|
+
type: :development
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
requirement: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
prerelease: false
|
68
|
+
type: :development
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
version_requirements: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
requirement: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
prerelease: false
|
82
|
+
type: :development
|
83
|
+
description: Automates a 3270 Terminal Emulator
|
84
|
+
email:
|
85
|
+
- pradeep@seleniumframework.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- .gitignore
|
91
|
+
- .rspec
|
92
|
+
- .travis.yml
|
93
|
+
- ChangeLog
|
94
|
+
- Gemfile
|
95
|
+
- Guardfile
|
96
|
+
- LICENSE.txt
|
97
|
+
- README.md
|
98
|
+
- Rakefile
|
99
|
+
- lib/te3270.rb
|
100
|
+
- lib/te3270/accessors.rb
|
101
|
+
- lib/te3270/emulator_factory.rb
|
102
|
+
- lib/te3270/emulators/extra.rb
|
103
|
+
- lib/te3270/emulators/quick3270.rb
|
104
|
+
- lib/te3270/function_keys.rb
|
105
|
+
- lib/te3270/screen_factory.rb
|
106
|
+
- lib/te3270/version.rb
|
107
|
+
- spec/lib/te3270/accessors_spec.rb
|
108
|
+
- spec/lib/te3270/emulators/extra_spec.rb
|
109
|
+
- spec/lib/te3270/emulators/quick3270_spec.rb
|
110
|
+
- spec/lib/te3270/screen_factory_spec.rb
|
111
|
+
- spec/lib/te3270_spec.rb
|
112
|
+
- spec/spec_helper.rb
|
113
|
+
- te3270.gemspec
|
114
|
+
homepage: http://github.com/machzqcq/te3270
|
115
|
+
licenses:
|
116
|
+
- MIT
|
117
|
+
metadata: {}
|
118
|
+
post_install_message:
|
119
|
+
rdoc_options: []
|
120
|
+
require_paths:
|
121
|
+
- lib
|
122
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - '>='
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
requirements: []
|
133
|
+
rubyforge_project:
|
134
|
+
rubygems_version: 2.1.9
|
135
|
+
signing_key:
|
136
|
+
specification_version: 4
|
137
|
+
summary: Automates a 3270 Terminal Emulator
|
138
|
+
test_files:
|
139
|
+
- spec/lib/te3270/accessors_spec.rb
|
140
|
+
- spec/lib/te3270/emulators/extra_spec.rb
|
141
|
+
- spec/lib/te3270/emulators/quick3270_spec.rb
|
142
|
+
- spec/lib/te3270/screen_factory_spec.rb
|
143
|
+
- spec/lib/te3270_spec.rb
|
144
|
+
- spec/spec_helper.rb
|
145
|
+
has_rdoc:
|