pacer 2.0.13-java → 2.0.14-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pacer/core/graph/element_route.rb +1 -1
- data/lib/pacer/core/graph/graph_route.rb +2 -2
- data/lib/pacer/core/graph/mixed_route.rb +3 -3
- data/lib/pacer/filter/property_filter.rb +2 -14
- data/lib/pacer/version.rb +1 -1
- data/spec/pacer/blueprints/neo4j2_spec.rb +18 -0
- data/spec/pacer/blueprints/neo4j_spec.rb +18 -0
- data/spec/pacer/wrapper/vertex_wrapper_spec.rb +286 -236
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 516ac17e78965aa3d2e83cd8abcdd698a6a65df2
|
4
|
+
data.tar.gz: 42d4eec909e091059251f379296f5b4c118f008f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e2ed8eb71d0e19d61adc9e324b6405c75b0aa710944f4e4fa41e542075673584ec63f618149c93f973325a8bc5b04ff8751b4e19de3fe457a65e61e745e5e1d
|
7
|
+
data.tar.gz: 6c6ecde3e79970241e660108de1bb4bdb8055df7f94a84a152902273ed4f36521e7dd861e98510875b5de4cc95088e691a49f12b04a84f257e3316ecb28d6266
|
@@ -9,7 +9,7 @@ module Pacer::Core::Graph
|
|
9
9
|
# @yield [ElementWrapper] filter proc, see {Pacer::Route#property_filter}
|
10
10
|
# @return [ElementRoute] the same type and extensions as the source route.
|
11
11
|
def filter(*filters, &block)
|
12
|
-
Pacer::Route.property_filter(self, filters, block)
|
12
|
+
Pacer::Route.property_filter(self, filters, block, true)
|
13
13
|
end
|
14
14
|
|
15
15
|
# v is undefined for edge routes.
|
@@ -9,7 +9,7 @@ module Pacer::Core::Graph
|
|
9
9
|
route = chain_route :element_type => :vertex,
|
10
10
|
:pipe_class => Pacer::Pipes::VerticesPipe,
|
11
11
|
:route_name => 'GraphV'
|
12
|
-
Pacer::Route.property_filter(route, filters, block)
|
12
|
+
Pacer::Route.property_filter(route, filters, block, true)
|
13
13
|
end
|
14
14
|
|
15
15
|
# Returns a new route to all graph edges. Standard filter options.
|
@@ -18,7 +18,7 @@ module Pacer::Core::Graph
|
|
18
18
|
route = chain_route :element_type => :edge,
|
19
19
|
:pipe_class => Pacer::Pipes::EdgesPipe,
|
20
20
|
:route_name => 'GraphE'
|
21
|
-
Pacer::Route.property_filter(route, filters, block)
|
21
|
+
Pacer::Route.property_filter(route, filters, block, true)
|
22
22
|
end
|
23
23
|
|
24
24
|
def filter(*args)
|
@@ -10,7 +10,7 @@ module Pacer::Core::Graph
|
|
10
10
|
:pipe_args => Pacer::Vertex,
|
11
11
|
:wrapper => wrapper,
|
12
12
|
:extensions => extensions
|
13
|
-
Pacer::Route.property_filter(route, args, block)
|
13
|
+
Pacer::Route.property_filter(route, args, block, true)
|
14
14
|
end
|
15
15
|
|
16
16
|
# Pass through only edges.
|
@@ -20,7 +20,7 @@ module Pacer::Core::Graph
|
|
20
20
|
:pipe_args => Pacer::Edge,
|
21
21
|
:wrapper => wrapper,
|
22
22
|
:extensions => extensions
|
23
|
-
Pacer::Route.property_filter(route, args, block)
|
23
|
+
Pacer::Route.property_filter(route, args, block, true)
|
24
24
|
end
|
25
25
|
|
26
26
|
def filter(*args, &block)
|
@@ -29,7 +29,7 @@ module Pacer::Core::Graph
|
|
29
29
|
|
30
30
|
def mixed(*args, &block)
|
31
31
|
route = chain_route :pipe_class => Pacer::Pipes::IdentityPipe
|
32
|
-
Pacer::Route.property_filter(route, args, block)
|
32
|
+
Pacer::Route.property_filter(route, args, block, true)
|
33
33
|
end
|
34
34
|
|
35
35
|
# Out edges from matching vertices.
|
@@ -28,21 +28,9 @@ module Pacer
|
|
28
28
|
filters.is_a? Pacer::Filter::PropertyFilter::Filters
|
29
29
|
end
|
30
30
|
|
31
|
-
def
|
32
|
-
filters = Pacer::Route.edge_filters(base.graph, args)
|
33
|
-
filters.blocks = [block] if block
|
34
|
-
args = chain_args(filters)
|
35
|
-
if filters.extensions_only? and base.is_a? Route
|
36
|
-
yield base.chain_route(args)
|
37
|
-
elsif filters and filters.any?
|
38
|
-
yield base.chain_route(args.merge!(filter: :property, filters: filters))
|
39
|
-
else
|
40
|
-
yield base
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def property_filter(base, args, block)
|
31
|
+
def property_filter(base, args, block, strict = false)
|
45
32
|
filters = Pacer::Route.edge_filters(base.graph, args)
|
33
|
+
filters.use_lookup! if strict
|
46
34
|
filters.blocks = [block] if block
|
47
35
|
args = chain_args(filters)
|
48
36
|
if filters.extensions_only? and base.is_a? Route
|
data/lib/pacer/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Pacer
|
2
|
-
VERSION = "2.0.
|
2
|
+
VERSION = "2.0.14"
|
3
3
|
# Clients may optionally define the following constants in the Pacer namespace:
|
4
4
|
# - LOAD_JARS : set to false to manage jar loading in the client. Be sure to load the jars defined in JARFILES.
|
5
5
|
# - LOCKJAR_LOCK_OPTS : set some options to be passed to LockJar.lock (ie. :lockfile, :download_artifacts, :local_repo)
|
@@ -7,6 +7,12 @@ module Neo2Spec
|
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
+
class FastPerson < Pacer::Wrappers::VertexWrapper
|
11
|
+
def self.route_conditions(graph)
|
12
|
+
{ type: 'person' }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
10
16
|
class Frog < Pacer::Wrappers::VertexWrapper
|
11
17
|
def self.route_conditions(graph)
|
12
18
|
{ frog: 'yes' }
|
@@ -48,6 +54,18 @@ module Neo2Spec
|
|
48
54
|
its(:wrapper) { should == Person }
|
49
55
|
end
|
50
56
|
|
57
|
+
describe FastPerson do
|
58
|
+
subject { graph2.v(FastPerson) }
|
59
|
+
|
60
|
+
# sanity checks
|
61
|
+
it { should be_a Pacer::Filter::LuceneFilter }
|
62
|
+
its(:query) { should == 'type:"person"' }
|
63
|
+
# This doesn't work because neo indices are out of sync before the transaction finalizes
|
64
|
+
#its(:count) { should == 2 }
|
65
|
+
|
66
|
+
its(:wrapper) { should == FastPerson }
|
67
|
+
end
|
68
|
+
|
51
69
|
describe Frog do
|
52
70
|
subject { graph2.v(Frog) }
|
53
71
|
|
@@ -7,6 +7,12 @@ module NeoSpec
|
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
+
class FastPerson < Pacer::Wrappers::VertexWrapper
|
11
|
+
def self.lookup(graph)
|
12
|
+
{ type: 'person' }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
10
16
|
class Frog < Pacer::Wrappers::VertexWrapper
|
11
17
|
def self.route_conditions(graph)
|
12
18
|
{ frog: 'yes' }
|
@@ -48,6 +54,18 @@ module NeoSpec
|
|
48
54
|
its(:wrapper) { should == Person }
|
49
55
|
end
|
50
56
|
|
57
|
+
describe FastPerson do
|
58
|
+
subject { graph2.v(FastPerson) }
|
59
|
+
|
60
|
+
# sanity checks
|
61
|
+
it { should be_a Pacer::Filter::LuceneFilter }
|
62
|
+
its(:query) { should == 'type:"person"' }
|
63
|
+
# This doesn't work because neo indices are out of sync before the transaction finalizes
|
64
|
+
#its(:count) { should == 2 }
|
65
|
+
|
66
|
+
its(:wrapper) { should == FastPerson }
|
67
|
+
end
|
68
|
+
|
51
69
|
describe Frog do
|
52
70
|
subject { graph2.v(Frog) }
|
53
71
|
|
@@ -1,39 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
Run.all :read_only do
|
4
|
-
use_pacer_graphml_data :read_only
|
5
|
-
|
6
|
-
describe Pacer::Wrappers::VertexWrapper do
|
7
|
-
|
8
|
-
let(:v_exts) { [Tackle::SimpleMixin, TP::Project] }
|
9
|
-
let(:v_wrapper_class) { Pacer::Wrappers::VertexWrapper.wrapper_for v_exts }
|
10
|
-
|
11
|
-
subject { v_wrapper_class }
|
12
|
-
|
13
|
-
it { should_not be_nil }
|
14
|
-
it { subject.route_conditions(graph).should == { type: 'project' } }
|
15
|
-
its(:extensions) { should == v_exts }
|
16
|
-
|
17
|
-
describe 'instance' do
|
18
|
-
subject do
|
19
|
-
v_wrapper_class.new graph, pacer.element
|
20
|
-
end
|
21
|
-
it { should_not be_nil }
|
22
|
-
its(:element) { should_not be_nil }
|
23
|
-
it { should == pacer }
|
24
|
-
it { should_not equal pacer }
|
25
|
-
its(:element_id) { should == pacer.element_id }
|
26
|
-
its(:extensions) { should == v_exts }
|
27
|
-
|
28
|
-
describe 'with more extensions added' do
|
29
|
-
subject { v_wrapper_class.new(graph, pacer.element).add_extensions([Pacer::Utils::TSort]) }
|
30
|
-
its(:class) { should_not == v_wrapper_class }
|
31
|
-
its(:extensions) { should == v_exts + [Pacer::Utils::TSort] }
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
3
|
module VertexWrapperSpec
|
38
4
|
module Project
|
39
5
|
def self.route_conditions(graph)
|
@@ -45,277 +11,361 @@ module VertexWrapperSpec
|
|
45
11
|
end
|
46
12
|
|
47
13
|
module IsRuby
|
48
|
-
def self.
|
14
|
+
def self.lookup(graph)
|
49
15
|
{ :language => 'ruby' }
|
50
16
|
end
|
51
17
|
|
52
18
|
module Vertex
|
53
19
|
end
|
54
20
|
end
|
55
|
-
end
|
56
21
|
|
57
|
-
|
58
|
-
|
22
|
+
Run.all :read_only do
|
23
|
+
use_pacer_graphml_data :read_only
|
59
24
|
|
60
|
-
|
61
|
-
subject { v0.v }
|
62
|
-
it { should be_a_vertices_route }
|
63
|
-
its(:element_type) { should == :vertex }
|
64
|
-
end
|
25
|
+
describe Pacer::Wrappers::VertexWrapper do
|
65
26
|
|
66
|
-
|
67
|
-
|
68
|
-
subject { v0.add_extensions([]) }
|
69
|
-
its('extensions.to_a') { should == [] }
|
70
|
-
its(:class) { should == graph.base_vertex_wrapper }
|
71
|
-
end
|
27
|
+
let(:v_exts) { [Tackle::SimpleMixin, TP::Project] }
|
28
|
+
let(:v_wrapper_class) { Pacer::Wrappers::VertexWrapper.wrapper_for v_exts }
|
72
29
|
|
73
|
-
|
74
|
-
subject { v0.add_extensions([Tackle::SimpleMixin]) }
|
75
|
-
its('extensions.to_a') { should == [Tackle::SimpleMixin] }
|
76
|
-
it { should be_a(Pacer::Wrappers::ElementWrapper) }
|
77
|
-
it { should be_a(Pacer::Wrappers::VertexWrapper) }
|
78
|
-
it { should_not be_a(Pacer::Wrappers::EdgeWrapper) }
|
30
|
+
subject { v_wrapper_class }
|
79
31
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
it { should be_a_vertices_route }
|
84
|
-
it { should be_a(Tackle::SimpleMixin::Route) }
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
32
|
+
it { should_not be_nil }
|
33
|
+
it { subject.route_conditions(graph).should == { type: 'project' } }
|
34
|
+
its(:extensions) { should == v_exts }
|
88
35
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
36
|
+
describe 'instance' do
|
37
|
+
subject do
|
38
|
+
v_wrapper_class.new graph, pacer.element
|
39
|
+
end
|
40
|
+
it { should_not be_nil }
|
41
|
+
its(:element) { should_not be_nil }
|
42
|
+
it { should == pacer }
|
43
|
+
it { should_not equal pacer }
|
44
|
+
its(:element_id) { should == pacer.element_id }
|
45
|
+
its(:extensions) { should == v_exts }
|
46
|
+
|
47
|
+
describe 'with more extensions added' do
|
48
|
+
subject { v_wrapper_class.new(graph, pacer.element).add_extensions([Pacer::Utils::TSort]) }
|
49
|
+
its(:class) { should_not == v_wrapper_class }
|
50
|
+
its(:extensions) { should == v_exts + [Pacer::Utils::TSort] }
|
51
|
+
end
|
52
|
+
end
|
102
53
|
end
|
103
54
|
end
|
104
55
|
|
105
|
-
|
106
|
-
|
107
|
-
|
56
|
+
Run.all :read_only do
|
57
|
+
describe 'type filtering' do
|
58
|
+
before :all do
|
59
|
+
graph.tx do
|
60
|
+
graph.create_vertex type: 'project'
|
61
|
+
graph.create_vertex type: 'project'
|
62
|
+
graph.create_vertex type: 'file'
|
63
|
+
graph.create_vertex language: 'ruby'
|
64
|
+
graph.create_vertex language: 'perl'
|
65
|
+
end
|
66
|
+
end
|
108
67
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
v2.should be_a VertexWrapperSpec::Project::Vertex
|
68
|
+
context Project, 'using route_conditions' do
|
69
|
+
specify 'initial lookup' do
|
70
|
+
graph.v(Project).count.should == 2
|
71
|
+
end
|
72
|
+
specify 'filter route' do
|
73
|
+
graph.v.v(Project).count.should == 2
|
116
74
|
end
|
117
|
-
yielded.should be_true
|
118
75
|
end
|
119
76
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
77
|
+
context IsRuby, 'using lookup' do
|
78
|
+
specify 'initial lookup' do
|
79
|
+
graph.v(IsRuby).count.should == 1
|
80
|
+
end
|
81
|
+
specify 'filter route' do
|
82
|
+
graph.v.v(IsRuby).count.should == 1
|
124
83
|
end
|
125
|
-
yielded.should be_false
|
126
84
|
end
|
127
85
|
end
|
128
86
|
end
|
129
87
|
|
130
|
-
|
131
|
-
|
132
|
-
subject { graph.create_vertex VertexWrapperSpec::IsRuby, type: 'project', language: 'ruby' }
|
133
|
-
|
134
|
-
its(:extensions) { should include VertexWrapperSpec::IsRuby }
|
88
|
+
shared_examples_for Pacer::Wrappers::VertexWrapper do
|
89
|
+
use_simple_graph_data
|
135
90
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
v2.should == subject
|
141
|
-
v2.extensions.should == [VertexWrapperSpec::Project]
|
142
|
-
v2.should be_a VertexWrapperSpec::Project::Vertex
|
143
|
-
end
|
144
|
-
yielded.should be_true
|
145
|
-
end
|
91
|
+
describe '#v' do
|
92
|
+
subject { v0.v }
|
93
|
+
it { should be_a_vertices_route }
|
94
|
+
its(:element_type) { should == :vertex }
|
146
95
|
end
|
147
96
|
|
148
|
-
|
149
|
-
|
97
|
+
describe '#add_extensions' do
|
98
|
+
context 'no extensions' do
|
99
|
+
subject { v0.add_extensions([]) }
|
100
|
+
its('extensions.to_a') { should == [] }
|
101
|
+
its(:class) { should == graph.base_vertex_wrapper }
|
102
|
+
end
|
150
103
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
104
|
+
context 'with extensions' do
|
105
|
+
subject { v0.add_extensions([Tackle::SimpleMixin]) }
|
106
|
+
its('extensions.to_a') { should == [Tackle::SimpleMixin] }
|
107
|
+
it { should be_a(Pacer::Wrappers::ElementWrapper) }
|
108
|
+
it { should be_a(Pacer::Wrappers::VertexWrapper) }
|
109
|
+
it { should_not be_a(Pacer::Wrappers::EdgeWrapper) }
|
110
|
+
|
111
|
+
describe '#v' do
|
112
|
+
subject { v0.add_extensions([Tackle::SimpleMixin]).v }
|
113
|
+
its('extensions.to_a') { should == [Tackle::SimpleMixin] }
|
114
|
+
it { should be_a_vertices_route }
|
115
|
+
it { should be_a(Tackle::SimpleMixin::Route) }
|
155
116
|
end
|
156
|
-
yielded.should be_false
|
157
117
|
end
|
158
118
|
end
|
159
|
-
end
|
160
119
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
120
|
+
describe '#as?' do
|
121
|
+
context 'project' do
|
122
|
+
let(:v) { graph.create_vertex type: 'project' }
|
123
|
+
context 'Project' do
|
124
|
+
subject { v.as?(Project) }
|
125
|
+
it { should be_true }
|
126
|
+
end
|
127
|
+
context 'IsRuby' do
|
128
|
+
subject { v.as?(IsRuby) }
|
129
|
+
it { should_not be_true }
|
130
|
+
end
|
131
|
+
context 'Project, IsRuby' do
|
132
|
+
subject { v.as?(Project, IsRuby) }
|
133
|
+
it { should_not be_true }
|
134
|
+
end
|
135
|
+
end
|
136
|
+
context 'language' do
|
137
|
+
let(:v) { graph.create_vertex language: 'ruby' }
|
138
|
+
context 'Project' do
|
139
|
+
subject { v.as?(Project) }
|
140
|
+
it { should_not be_true }
|
141
|
+
end
|
142
|
+
context 'IsRuby' do
|
143
|
+
subject { v.as?(IsRuby) }
|
144
|
+
it { should be_true }
|
145
|
+
end
|
146
|
+
context 'Project, IsRuby' do
|
147
|
+
subject { v.as?(Project, IsRuby) }
|
148
|
+
it { should_not be_true }
|
149
|
+
end
|
150
|
+
end
|
170
151
|
end
|
171
|
-
end
|
172
152
|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
its(:graph) { should equal(dest) }
|
188
|
-
its('element_id.to_s') { should == v0.element_id.to_s unless graph.features.ignoresSuppliedIds }
|
189
|
-
end
|
153
|
+
describe '#as' do
|
154
|
+
context 'vertex is a Project' do
|
155
|
+
let(:v) { graph.create_vertex type: 'project' }
|
156
|
+
|
157
|
+
it 'should yield a Project' do
|
158
|
+
yielded = false
|
159
|
+
v.as(Project) do |v2|
|
160
|
+
yielded = true
|
161
|
+
v2.should == v
|
162
|
+
v2.extensions.should include Project
|
163
|
+
v2.should be_a Project::Vertex
|
164
|
+
end
|
165
|
+
yielded.should be_true
|
166
|
+
end
|
190
167
|
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
168
|
+
it 'should not yield a IsRuby' do
|
169
|
+
yielded = false
|
170
|
+
v.as(IsRuby) do |v2|
|
171
|
+
yielded = true
|
172
|
+
end
|
173
|
+
yielded.should be_false
|
174
|
+
end
|
175
|
+
end
|
195
176
|
end
|
196
|
-
end
|
197
177
|
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
178
|
+
describe '#only_as' do
|
179
|
+
context 'able' do
|
180
|
+
subject { graph.create_vertex IsRuby, type: 'project', language: 'ruby' }
|
181
|
+
|
182
|
+
its(:extensions) { should include IsRuby }
|
183
|
+
|
184
|
+
it 'should yield a Project' do
|
185
|
+
yielded = false
|
186
|
+
subject.only_as(Project) do |v2|
|
187
|
+
yielded = true
|
188
|
+
v2.should == subject
|
189
|
+
v2.extensions.should == [Project]
|
190
|
+
v2.should be_a Project::Vertex
|
191
|
+
end
|
192
|
+
yielded.should be_true
|
193
|
+
end
|
194
|
+
end
|
214
195
|
|
215
|
-
|
216
|
-
|
217
|
-
let(:to_v) { graph.create_vertex }
|
196
|
+
context 'unable' do
|
197
|
+
subject { graph.create_vertex IsRuby, language: 'ruby' }
|
218
198
|
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
199
|
+
it 'should not yield a Project' do
|
200
|
+
yielded = false
|
201
|
+
subject.only_as(Project) do |v2|
|
202
|
+
yielded = true
|
203
|
+
end
|
204
|
+
yielded.should be_false
|
205
|
+
end
|
224
206
|
end
|
225
207
|
end
|
226
208
|
|
227
|
-
describe '#
|
228
|
-
|
229
|
-
|
209
|
+
describe '#delete!' do
|
210
|
+
before do
|
211
|
+
@vertex_id = v0.element_id
|
212
|
+
v0.delete!
|
213
|
+
c = example.metadata[:graph_commit]
|
214
|
+
c.call if c
|
230
215
|
end
|
231
|
-
|
232
|
-
|
233
|
-
to_v.in_edges('a').count.should == 3
|
216
|
+
it 'should be removed' do
|
217
|
+
graph.vertex(@vertex_id).should be_nil
|
234
218
|
end
|
219
|
+
end
|
235
220
|
|
236
|
-
|
237
|
-
|
221
|
+
contexts(
|
222
|
+
'into new tg' => proc {
|
223
|
+
let(:dest) { Pacer.tg }
|
224
|
+
},
|
225
|
+
'into graph2' => proc {
|
226
|
+
before { pending 'support temporary hash indices for clone/copy' unless graph.features.supportsIndices }
|
227
|
+
let(:dest) { graph2 }
|
228
|
+
}
|
229
|
+
) do
|
230
|
+
before do
|
231
|
+
graph.transaction(nesting: true) { setup_data }
|
238
232
|
end
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
233
|
+
describe '#clone_into', :transactions => false, read_transaction: true do
|
234
|
+
subject { dest.transaction { v0.clone_into(dest) } }
|
235
|
+
its(:properties) { should == { 'name' => 'eliza' } }
|
236
|
+
its(:graph) { should equal(dest) }
|
237
|
+
its('element_id.to_s') { should == v0.element_id.to_s unless graph.features.ignoresSuppliedIds }
|
244
238
|
end
|
245
239
|
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
240
|
+
describe '#copy_into', :transaction => false, read_transaction: true do
|
241
|
+
subject { v1.copy_into(dest) }
|
242
|
+
its(:properties) { should == { 'name' => 'darrick' } }
|
243
|
+
its(:graph) { should equal(dest) }
|
250
244
|
end
|
245
|
+
end
|
251
246
|
|
252
|
-
|
253
|
-
|
247
|
+
subject { graph.transaction(nesting: true) { setup_data; v0 } }
|
248
|
+
its(:graph) { should equal(graph) }
|
249
|
+
its(:display_name) { should be_nil }
|
250
|
+
its(:inspect) { should =~ /#<[VM]\[#{Regexp.quote v0.element_id.to_s }\]>/ }
|
251
|
+
context 'with label proc' do
|
252
|
+
before do
|
253
|
+
graph.vertex_name = proc { |e| "some name" }
|
254
254
|
end
|
255
|
+
its(:display_name) { should == "some name" }
|
256
|
+
its(:inspect) { should =~ /#<[VM]\[#{ Regexp.quote v0.element_id.to_s }\] some name>/ }
|
257
|
+
end
|
258
|
+
it { should_not == v1 }
|
259
|
+
it { should == v0 }
|
260
|
+
context 'edge with same element id', :transactions => false, read_transaction: true do
|
261
|
+
it { should_not == e0 }
|
255
262
|
end
|
256
263
|
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
end
|
264
|
+
context 'with more data' do
|
265
|
+
let(:from_v) { graph.create_vertex }
|
266
|
+
let(:to_v) { graph.create_vertex }
|
261
267
|
|
262
|
-
|
263
|
-
|
268
|
+
before do
|
269
|
+
%w[ a a a b b c ].each do |label|
|
270
|
+
v = graph.create_vertex
|
271
|
+
graph.create_edge nil, from_v, v, label
|
272
|
+
graph.create_edge nil, v, to_v, label
|
273
|
+
end
|
264
274
|
end
|
265
275
|
|
266
|
-
|
267
|
-
|
268
|
-
|
276
|
+
describe '#in_edges' do
|
277
|
+
specify 'to_v should have 6 in edges' do
|
278
|
+
to_v.in_edges.count.should == 6
|
279
|
+
end
|
269
280
|
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
edge.extensions.should include(Tackle::SimpleMixin)
|
274
|
-
end
|
281
|
+
specify 'to_v should have 3 in edges with label a' do
|
282
|
+
to_v.in_edges('a').count.should == 3
|
283
|
+
end
|
275
284
|
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
edge.extensions.should include(Tackle::SimpleMixin)
|
280
|
-
end
|
285
|
+
specify 'to_v should have 4 in edges with label a or c' do
|
286
|
+
to_v.in_edges('a', 'c').count.should == 4
|
287
|
+
end
|
281
288
|
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
289
|
+
it 'should add an extension' do
|
290
|
+
edge = to_v.in_edges(Tackle::SimpleMixin).first
|
291
|
+
edge.should be_a(Pacer::Wrappers::EdgeWrapper)
|
292
|
+
edge.extensions.should include(Tackle::SimpleMixin)
|
293
|
+
end
|
286
294
|
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
295
|
+
it 'should be able to mix labels and mixins as arguments' do
|
296
|
+
edge = to_v.in_edges('a', Tackle::SimpleMixin, 'b').first
|
297
|
+
edge.should be_a(Pacer::Wrappers::EdgeWrapper)
|
298
|
+
edge.extensions.should include(Tackle::SimpleMixin)
|
299
|
+
end
|
291
300
|
|
292
|
-
|
293
|
-
|
301
|
+
it 'should filter correctly with a mix of labels and mixins as arguments' do
|
302
|
+
to_v.in_edges('a', Tackle::SimpleMixin, 'b').count.should == 5
|
303
|
+
end
|
294
304
|
end
|
295
305
|
|
296
|
-
|
297
|
-
from_v
|
298
|
-
|
306
|
+
describe '#out_edges' do
|
307
|
+
specify 'from_v should have 6 out edges' do
|
308
|
+
from_v.out_edges.count.should == 6
|
309
|
+
end
|
299
310
|
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
311
|
+
specify 'from_v should have 3 out edges with label a' do
|
312
|
+
from_v.out_edges('a').count.should == 3
|
313
|
+
end
|
314
|
+
|
315
|
+
specify 'from_v should have 4 out edges with label a or c' do
|
316
|
+
from_v.out_edges('a', 'c').count.should == 4
|
317
|
+
end
|
305
318
|
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
319
|
+
it 'should add an extension' do
|
320
|
+
edge = from_v.out_edges(Tackle::SimpleMixin).first
|
321
|
+
edge.should be_a(Pacer::Wrappers::EdgeWrapper)
|
322
|
+
edge.extensions.should include(Tackle::SimpleMixin)
|
323
|
+
end
|
324
|
+
|
325
|
+
it 'should be able to mix labels and mixins as arguments' do
|
326
|
+
edge = from_v.out_edges('a', Tackle::SimpleMixin, 'b').first
|
327
|
+
edge.should be_a(Pacer::Wrappers::EdgeWrapper)
|
328
|
+
edge.extensions.should include(Tackle::SimpleMixin)
|
329
|
+
end
|
330
|
+
|
331
|
+
it 'should filter correctly with a mix of labels and mixins as arguments' do
|
332
|
+
from_v.out_edges('a', Tackle::SimpleMixin, 'b').count.should == 5
|
333
|
+
end
|
310
334
|
end
|
311
335
|
|
312
|
-
|
313
|
-
from_v
|
336
|
+
describe '#both_edges' do
|
337
|
+
specify 'from_v should have 6 edges' do
|
338
|
+
from_v.both_edges.count.should == 6
|
339
|
+
end
|
340
|
+
|
341
|
+
specify 'from_v should have 3 edges with label a' do
|
342
|
+
from_v.both_edges('a').count.should == 3
|
343
|
+
end
|
344
|
+
|
345
|
+
specify 'from_v should have 4 edges with label a or c' do
|
346
|
+
from_v.both_edges('a', 'c').count.should == 4
|
347
|
+
end
|
348
|
+
|
349
|
+
it 'should add an extension' do
|
350
|
+
edge = from_v.both_edges(Tackle::SimpleMixin).first
|
351
|
+
edge.should be_a(Pacer::Wrappers::EdgeWrapper)
|
352
|
+
edge.extensions.should include(Tackle::SimpleMixin)
|
353
|
+
end
|
354
|
+
|
355
|
+
it 'should be able to mix labels and mixins as arguments' do
|
356
|
+
edge = from_v.both_edges('a', Tackle::SimpleMixin, 'b').first
|
357
|
+
edge.should be_a(Pacer::Wrappers::EdgeWrapper)
|
358
|
+
edge.extensions.should include(Tackle::SimpleMixin)
|
359
|
+
end
|
360
|
+
|
361
|
+
it 'should filter correctly with a mix of labels and mixins as arguments' do
|
362
|
+
from_v.both_edges('a', Tackle::SimpleMixin, 'b').count.should == 5
|
363
|
+
end
|
314
364
|
end
|
315
365
|
end
|
316
366
|
end
|
317
|
-
end
|
318
367
|
|
319
|
-
Run.all do
|
320
|
-
|
368
|
+
Run.all do
|
369
|
+
it_uses Pacer::Wrappers::VertexWrapper
|
370
|
+
end
|
321
371
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pacer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.14
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Darrick Wiebe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lock_jar
|