net-ping 1.2.2-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +133 -0
- data/MANIFEST +21 -0
- data/README +31 -0
- data/Rakefile +55 -0
- data/doc/ping.txt +231 -0
- data/lib/net/ping.rb +11 -0
- data/lib/net/ping/external.rb +107 -0
- data/lib/net/ping/http.rb +88 -0
- data/lib/net/ping/icmp.rb +165 -0
- data/lib/net/ping/ping.rb +81 -0
- data/lib/net/ping/tcp.rb +86 -0
- data/lib/net/ping/udp.rb +119 -0
- data/net-ping-1.2.2-x86-mswin32-60.gem +0 -0
- data/net-ping.gemspec +35 -0
- data/net-ping.gemspec~ +34 -0
- data/test/tc_pingexternal.rb +89 -0
- data/test/tc_pinghttp.rb +83 -0
- data/test/tc_pingicmp.rb +84 -0
- data/test/tc_pingtcp.rb +105 -0
- data/test/tc_pingudp.rb +99 -0
- data/test/ts_ping.rb +18 -0
- metadata +101 -0
data/test/tc_pingicmp.rb
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
#######################################################################
|
2
|
+
# tc_pingicmp.rb
|
3
|
+
#
|
4
|
+
# Test case for the Net::PingICMP class. You must run this test case
|
5
|
+
# with root privileges on UNIX systems. This should be run via the
|
6
|
+
# 'test' or 'test_icmp' Rake task.
|
7
|
+
#######################################################################
|
8
|
+
require 'test/unit'
|
9
|
+
require 'net/ping/icmp'
|
10
|
+
include Net
|
11
|
+
|
12
|
+
unless Process.euid == 0
|
13
|
+
raise "The test_icmp task must be run with root privileges"
|
14
|
+
end
|
15
|
+
|
16
|
+
class TC_PingICMP < Test::Unit::TestCase
|
17
|
+
def setup
|
18
|
+
@host = "www.ruby-lang.org"
|
19
|
+
@icmp = Ping::ICMP.new(@host)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_version
|
23
|
+
assert_equal('1.2.2', PingICMP::VERSION)
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_ping
|
27
|
+
assert_respond_to(@icmp, :ping)
|
28
|
+
assert_nothing_raised{ @icmp.ping }
|
29
|
+
assert_nothing_raised{ @icmp.ping(@host) }
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_ping_aliases
|
33
|
+
assert_respond_to(@icmp, :ping?)
|
34
|
+
assert_respond_to(@icmp, :pingecho)
|
35
|
+
assert_nothing_raised{ @icmp.ping? }
|
36
|
+
assert_nothing_raised{ @icmp.ping?(@host) }
|
37
|
+
assert_nothing_raised{ @icmp.pingecho }
|
38
|
+
assert_nothing_raised{ @icmp.pingecho(@host) }
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_bind
|
42
|
+
assert_respond_to(@icmp, :bind)
|
43
|
+
assert_nothing_raised{ @icmp.bind(Socket.gethostname) }
|
44
|
+
assert_nothing_raised{ @icmp.bind(Socket.gethostname, 80) }
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_duration
|
48
|
+
assert_nothing_raised{ @icmp.ping }
|
49
|
+
assert_respond_to(@icmp, :duration)
|
50
|
+
assert_kind_of(Float, @icmp.duration)
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_host
|
54
|
+
assert_respond_to(@icmp, :host)
|
55
|
+
assert_respond_to(@icmp, :host=)
|
56
|
+
assert_equal('www.ruby-lang.org', @icmp.host)
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_port
|
60
|
+
assert_respond_to(@icmp, :port)
|
61
|
+
assert_equal(nil, @icmp.port)
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_timeout
|
65
|
+
assert_respond_to(@icmp, :timeout)
|
66
|
+
assert_respond_to(@icmp, :timeout=)
|
67
|
+
assert_equal(5, @icmp.timeout)
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_exception
|
71
|
+
assert_respond_to(@icmp, :exception)
|
72
|
+
assert_nothing_raised{ @icmp.ping }
|
73
|
+
assert_nil(@icmp.exception)
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_warning
|
77
|
+
assert_respond_to(@icmp, :warning)
|
78
|
+
end
|
79
|
+
|
80
|
+
def teardown
|
81
|
+
@host = nil
|
82
|
+
@icmp = nil
|
83
|
+
end
|
84
|
+
end
|
data/test/tc_pingtcp.rb
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
#####################################################################
|
2
|
+
# tc_pingtcp.rb
|
3
|
+
#
|
4
|
+
# Test case for the Net::PingTCP class. This test should be run via
|
5
|
+
# the 'test' or 'test_tcp' Rake task.
|
6
|
+
#####################################################################
|
7
|
+
require 'test/unit'
|
8
|
+
require 'net/ping/tcp'
|
9
|
+
include Net
|
10
|
+
|
11
|
+
class TC_PingTCP < Test::Unit::TestCase
|
12
|
+
def setup
|
13
|
+
@host = Socket.gethostname
|
14
|
+
@tcp = Ping::TCP.new(@host)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_version
|
18
|
+
assert_equal('1.2.2', PingTCP::VERSION)
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_ping
|
22
|
+
assert_respond_to(@tcp, :ping)
|
23
|
+
assert_nothing_raised{ @tcp.ping }
|
24
|
+
assert_nothing_raised{ @tcp.ping(@host) }
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_ping_aliases
|
28
|
+
assert_respond_to(@tcp, :ping?)
|
29
|
+
assert_respond_to(@tcp, :pingecho)
|
30
|
+
assert_nothing_raised{ @tcp.ping? }
|
31
|
+
assert_nothing_raised{ @tcp.ping?(@host) }
|
32
|
+
assert_nothing_raised{ @tcp.pingecho }
|
33
|
+
assert_nothing_raised{ @tcp.pingecho(@host) }
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_ping_service_check_false
|
37
|
+
msg = "+this test may fail depending on your network environment+"
|
38
|
+
PingTCP.service_check = false
|
39
|
+
assert_equal(false, @tcp.ping?, msg)
|
40
|
+
assert_equal(false, @tcp.exception.nil?, "Bad exception data")
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_ping_service_check_true
|
44
|
+
msg = "+this test may fail depending on your network environment+"
|
45
|
+
PingTCP.service_check = true
|
46
|
+
assert_equal(true, @tcp.ping?, msg)
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_service_check
|
50
|
+
assert_respond_to(PingTCP, :service_check)
|
51
|
+
assert_respond_to(PingTCP, :service_check=)
|
52
|
+
end
|
53
|
+
|
54
|
+
# These will be removed in 1.3.0
|
55
|
+
def test_service_check_aliases
|
56
|
+
assert_respond_to(PingTCP, :econnrefused)
|
57
|
+
assert_respond_to(PingTCP, :econnrefused=)
|
58
|
+
assert_respond_to(PingTCP, :ecr)
|
59
|
+
assert_respond_to(PingTCP, :ecr=)
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_service_check_expected_errors
|
63
|
+
assert_raises(ArgumentError){ PingTCP.service_check = "blah" }
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_duration
|
67
|
+
assert_nothing_raised{ @tcp.ping }
|
68
|
+
assert_respond_to(@tcp, :duration)
|
69
|
+
assert_kind_of(Float, @tcp.duration, '+nil if the ping failed+')
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_host
|
73
|
+
assert_respond_to(@tcp, :host)
|
74
|
+
assert_respond_to(@tcp, :host=)
|
75
|
+
assert_equal(@host, @tcp.host)
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_port
|
79
|
+
assert_respond_to(@tcp, :port)
|
80
|
+
assert_respond_to(@tcp, :port=)
|
81
|
+
assert_equal(7, @tcp.port)
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_timeout
|
85
|
+
assert_respond_to(@tcp, :timeout)
|
86
|
+
assert_respond_to(@tcp, :timeout=)
|
87
|
+
assert_equal(5, @tcp.timeout)
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_exception
|
91
|
+
msg = "+this test may fail depending on your network environment+"
|
92
|
+
assert_respond_to(@tcp, :exception)
|
93
|
+
assert_nothing_raised{ @tcp.ping }
|
94
|
+
assert_nil(@tcp.exception, msg)
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_warning
|
98
|
+
assert_respond_to(@tcp, :warning)
|
99
|
+
end
|
100
|
+
|
101
|
+
def teardown
|
102
|
+
@host = nil
|
103
|
+
@tcp = nil
|
104
|
+
end
|
105
|
+
end
|
data/test/tc_pingudp.rb
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
################################################################
|
2
|
+
# tc_pingudp.rb
|
3
|
+
#
|
4
|
+
# Test case for the Net::Ping::UDP class. This should be run
|
5
|
+
# via the 'test' or 'test_udp' Rake task.
|
6
|
+
#
|
7
|
+
# If someone could provide me a host where a udp ping actually
|
8
|
+
# works (with a service check), I would appreciate it. :)
|
9
|
+
################################################################
|
10
|
+
require 'test/unit'
|
11
|
+
require 'net/ping/udp'
|
12
|
+
include Net
|
13
|
+
|
14
|
+
class TC_PingUDP < Test::Unit::TestCase
|
15
|
+
def setup
|
16
|
+
Ping::UDP.service_check = false
|
17
|
+
@host = '127.0.0.1'
|
18
|
+
@udp = Ping::UDP.new(@host)
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_version
|
22
|
+
assert_equal('1.2.2', Ping::UDP::VERSION)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_ping
|
26
|
+
assert_respond_to(@udp, :ping)
|
27
|
+
assert_nothing_raised{ @udp.ping }
|
28
|
+
assert_nothing_raised{ @udp.ping(@host) }
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_ping_aliases
|
32
|
+
assert_respond_to(@udp, :ping?)
|
33
|
+
assert_respond_to(@udp, :pingecho)
|
34
|
+
assert_nothing_raised{ @udp.ping? }
|
35
|
+
assert_nothing_raised{ @udp.ping?(@host) }
|
36
|
+
assert_nothing_raised{ @udp.pingecho }
|
37
|
+
assert_nothing_raised{ @udp.pingecho(@host) }
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_ping_standard
|
41
|
+
assert_equal(true, @udp.ping?)
|
42
|
+
assert_equal(true, @udp.exception.nil?)
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_bind
|
46
|
+
assert_respond_to(@udp, :bind)
|
47
|
+
assert_nothing_raised{ @udp.bind('127.0.0.1', 80) }
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_duration
|
51
|
+
assert_nothing_raised{ @udp.ping }
|
52
|
+
assert_respond_to(@udp, :duration)
|
53
|
+
assert_kind_of(Float, @udp.duration)
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_host
|
57
|
+
assert_respond_to(@udp, :host)
|
58
|
+
assert_respond_to(@udp, :host=)
|
59
|
+
assert_equal('127.0.0.1', @udp.host)
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_port
|
63
|
+
assert_respond_to(@udp, :port)
|
64
|
+
assert_respond_to(@udp, :port=)
|
65
|
+
assert_equal(7, @udp.port)
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_timeout
|
69
|
+
assert_respond_to(@udp, :timeout)
|
70
|
+
assert_respond_to(@udp, :timeout=)
|
71
|
+
assert_equal(5, @udp.timeout)
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_exception
|
75
|
+
assert_respond_to(@udp, :exception)
|
76
|
+
assert_nothing_raised{ @udp.ping }
|
77
|
+
assert_nil(@udp.exception)
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_warning
|
81
|
+
assert_respond_to(@udp, :warning)
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_service_check
|
85
|
+
assert_respond_to(Ping::UDP, :service_check)
|
86
|
+
assert_respond_to(Ping::UDP, :service_check=)
|
87
|
+
assert_equal(false, Ping::UDP.service_check) # Set in setup
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_service_check_expected_failures
|
91
|
+
assert_raise(ArgumentError){ Ping::UDP.service_check(1) }
|
92
|
+
assert_raise(ArgumentError){ Ping::UDP.service_check = 1 }
|
93
|
+
end
|
94
|
+
|
95
|
+
def teardown
|
96
|
+
@host = nil
|
97
|
+
@udp = nil
|
98
|
+
end
|
99
|
+
end
|
data/test/ts_ping.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
######################################################################
|
2
|
+
# ts_ping.rb
|
3
|
+
#
|
4
|
+
# Test suite for all the Ping subclasses. Note that the PingICMP
|
5
|
+
# class test won't be run unless this is run as a privileged process.
|
6
|
+
######################################################################
|
7
|
+
$LOAD_PATH.unshift(Dir.pwd)
|
8
|
+
$LOAD_PATH.unshift(Dir.pwd + "/lib")
|
9
|
+
$LOAD_PATH.unshift(Dir.pwd + "/test")
|
10
|
+
|
11
|
+
require "tc_pingexternal"
|
12
|
+
require "tc_pinghttp"
|
13
|
+
require "tc_pingtcp"
|
14
|
+
require "tc_pingudp"
|
15
|
+
|
16
|
+
if Process.euid == 0
|
17
|
+
require "tc_pingicmp"
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: net-ping
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.2
|
5
|
+
platform: x86-mswin32-60
|
6
|
+
authors:
|
7
|
+
- Daniel J. Berger
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-01-22 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: win32-open3
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.2.5
|
23
|
+
version:
|
24
|
+
- !ruby/object:Gem::Dependency
|
25
|
+
name: windows-pr
|
26
|
+
version_requirement:
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 0.7.4
|
32
|
+
version:
|
33
|
+
description: A ping interface for Ruby. Includes TCP, HTTP, ICMP, UDP, and External ping interfaces.
|
34
|
+
email: djberg96@gmail.com
|
35
|
+
executables: []
|
36
|
+
|
37
|
+
extensions: []
|
38
|
+
|
39
|
+
extra_rdoc_files:
|
40
|
+
- README
|
41
|
+
- CHANGES
|
42
|
+
- doc/ping.txt
|
43
|
+
files:
|
44
|
+
- lib/net/CVS
|
45
|
+
- lib/net/ping
|
46
|
+
- lib/net/ping.rb
|
47
|
+
- CHANGES
|
48
|
+
- CVS
|
49
|
+
- doc
|
50
|
+
- examples
|
51
|
+
- lib
|
52
|
+
- MANIFEST
|
53
|
+
- net-ping-1.2.2-x86-mswin32-60.gem
|
54
|
+
- net-ping.gemspec
|
55
|
+
- net-ping.gemspec~
|
56
|
+
- Rakefile
|
57
|
+
- README
|
58
|
+
- test
|
59
|
+
- test/CVS
|
60
|
+
- test/tc_pingexternal.rb
|
61
|
+
- test/tc_pinghttp.rb
|
62
|
+
- test/tc_pingicmp.rb
|
63
|
+
- test/tc_pingtcp.rb
|
64
|
+
- test/tc_pingudp.rb
|
65
|
+
- test/ts_ping.rb
|
66
|
+
- lib/net/ping/CVS
|
67
|
+
- lib/net/ping/external.rb
|
68
|
+
- lib/net/ping/http.rb
|
69
|
+
- lib/net/ping/icmp.rb
|
70
|
+
- lib/net/ping/ping.rb
|
71
|
+
- lib/net/ping/tcp.rb
|
72
|
+
- lib/net/ping/udp.rb
|
73
|
+
- doc/ping.txt
|
74
|
+
has_rdoc: true
|
75
|
+
homepage: http://www.rubyforge.org/projects/shards
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options: []
|
78
|
+
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: "0"
|
86
|
+
version:
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: "0"
|
92
|
+
version:
|
93
|
+
requirements: []
|
94
|
+
|
95
|
+
rubyforge_project: shards
|
96
|
+
rubygems_version: 1.0.1
|
97
|
+
signing_key:
|
98
|
+
specification_version: 2
|
99
|
+
summary: A ping interface for Ruby.
|
100
|
+
test_files:
|
101
|
+
- test/ts_ping.rb
|