handle-system 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/handle/command/connection.rb +2 -2
- data/lib/handle/version.rb +1 -1
- data/spec/command/connection_spec.rb +31 -20
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 549796c65d94011546d191cd875f4f5acf6c66ba
|
4
|
+
data.tar.gz: 8bb4e27b7fca6429d6f0c2eb918ac286dc1f3950
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e471e7c08e283574a2439c6e13307841e555632a4dd2021154848a58118b6c39d72b0f7248ac7ebce1d44b37f26bc9f4f9980ec9270e0ab99dd83674c229a7d
|
7
|
+
data.tar.gz: 9bcbf9c24969da9722e580eb883a1f90d7b67961867c108e355c66de0a541fa4de149d44b23f76e3bf0c0f3d994cf0692467ea27d561cc951460e729936a06f2
|
data/README.md
CHANGED
@@ -106,7 +106,7 @@ module Handle
|
|
106
106
|
|
107
107
|
def resolve_handle(handle, types=[], indexes=[], auth=true)
|
108
108
|
cmd = File.join(Handle::HOME, 'bin', 'hdl-qresolver')
|
109
|
-
response = `#{cmd} #{handle} 2
|
109
|
+
response = `#{cmd} #{handle} 2>&1`.strip
|
110
110
|
if response =~ /^Got Response:/
|
111
111
|
response = response.lines.select { |line| line =~ /^\s*index=/ }.join("")
|
112
112
|
result = Handle::Record.from_data(response)
|
@@ -114,7 +114,7 @@ module Handle
|
|
114
114
|
result.handle = handle
|
115
115
|
result
|
116
116
|
else
|
117
|
-
(code, message) = response.
|
117
|
+
(code, message) = response.scan(/Error\(([0-9]+)\): (.+)$/).last
|
118
118
|
exception_klass = case code.to_i
|
119
119
|
when 100 then Handle::NotFound
|
120
120
|
else Handle::HandleError
|
data/lib/handle/version.rb
CHANGED
@@ -45,30 +45,41 @@ on_cruby do
|
|
45
45
|
let(:server) { double(Handle::Java::Native::HSAdapter) }
|
46
46
|
subject { Handle::Command::Connection.new('0.NA/FAKE.ADMIN', 300, 'privkey', 'keypass') }
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
expect(
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
48
|
+
describe "#resolve_handle" do
|
49
|
+
it "is successful" do
|
50
|
+
expect(subject).to receive(:`) { |command|
|
51
|
+
expect(command).to match(/hdl-qresolver #{fake_handle}/)
|
52
|
+
"Got Response:\n#{record.to_s}"
|
53
|
+
}
|
54
|
+
expect(subject.resolve_handle(fake_handle)).to eq(record)
|
55
|
+
end
|
55
56
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
57
|
+
it "handles not found" do
|
58
|
+
expect(subject).to receive(:`) { |command|
|
59
|
+
expect(command).to match(/hdl-qresolver #{bad_handle}/)
|
60
|
+
"Got Error:\nError(100): HANDLE NOT FOUND"
|
61
|
+
}
|
62
|
+
expect { subject.resolve_handle(bad_handle) }.to raise_error(Handle::NotFound)
|
63
|
+
end
|
63
64
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
65
|
+
it "handles other error" do
|
66
|
+
expect(subject).to receive(:`) { |command|
|
67
|
+
expect(command).to match(/hdl-qresolver #{bad_handle}/)
|
68
|
+
"Got Error:\nError(3): SERVER TOO BUSY"
|
69
|
+
}
|
70
|
+
expect { subject.resolve_handle(bad_handle) }.to raise_error(Handle::HandleError)
|
71
|
+
end
|
72
|
+
|
73
|
+
it "handles error on stderr (Bad prefix)" do
|
74
|
+
expect(subject).to receive(:`) { |command|
|
75
|
+
expect(command).to match(/hdl-qresolver #{bad_handle}/)
|
76
|
+
"received HDL-UDP response: Error(100): HANDLE NOT FOUND\n\nError: HandleException (SERVICE_NOT_FOUND) Unable to find service for prefix 0.NA/10427.TEXX; prefix resolution response: Error(100): HANDLE NOT FOUND\nHandleException (SERVICE_NOT_FOUND) Unable to find service for prefix 0.NA/10427.TEXX; prefix resolution response: Error(100): HANDLE NOT FOUND\nat net.handle.hdllib.HandleResolver.tryAuthGlobalServiceLookupAndThrowExceptionOnFailure(HandleResolver.java:804)"
|
77
|
+
}
|
78
|
+
expect { subject.resolve_handle(bad_handle) }.to raise_error(Handle::HandleError)
|
79
|
+
end
|
70
80
|
end
|
71
81
|
|
82
|
+
|
72
83
|
it "#create_record" do
|
73
84
|
new_record = subject.create_record(new_handle)
|
74
85
|
expect(new_record.connection).to eq(subject)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: handle-system
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Klein
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
123
|
version: '0'
|
124
124
|
requirements: []
|
125
125
|
rubyforge_project:
|
126
|
-
rubygems_version: 2.
|
126
|
+
rubygems_version: 2.4.8
|
127
127
|
signing_key:
|
128
128
|
specification_version: 4
|
129
129
|
summary: Ruby classes for interfacing with Handle System servers
|