diff options
| author | Luke Kanies <luke@madstop.com> | 2008-02-11 18:27:49 -0600 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2008-02-11 18:27:49 -0600 |
| commit | 8b2fae019b31513becd002eb474e1b4803abde24 (patch) | |
| tree | 92312a50927ff65a8b78fbec7fff52d3bf59eb78 | |
| parent | cf21ade9abf4541920b535b0e2643b30e44b067b (diff) | |
| download | puppet-8b2fae019b31513becd002eb474e1b4803abde24.tar.gz puppet-8b2fae019b31513becd002eb474e1b4803abde24.tar.xz puppet-8b2fae019b31513becd002eb474e1b4803abde24.zip | |
Removing the last remaining vestiges of GRATR --
removing the bangs from 'add_vertex!' and 'add_edge!'.
| -rw-r--r-- | lib/puppet/node/catalog.rb | 10 | ||||
| -rw-r--r-- | lib/puppet/parser/compiler.rb | 6 | ||||
| -rw-r--r-- | lib/puppet/pgraph.rb | 14 | ||||
| -rw-r--r-- | lib/puppet/simple_graph.rb | 8 | ||||
| -rw-r--r-- | lib/puppet/transaction.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/transportable.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/type/pfile.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/util/graph.rb | 2 | ||||
| -rwxr-xr-x | spec/unit/node/catalog.rb | 48 | ||||
| -rwxr-xr-x | spec/unit/other/pgraph.rb | 34 | ||||
| -rwxr-xr-x | spec/unit/ral/type.rb | 4 | ||||
| -rwxr-xr-x | spec/unit/simple_graph.rb | 64 | ||||
| -rwxr-xr-x | test/lib/puppettest/support/resources.rb | 2 | ||||
| -rwxr-xr-x | test/other/transactions.rb | 8 | ||||
| -rwxr-xr-x | test/ral/manager/type.rb | 4 | ||||
| -rwxr-xr-x | test/ral/types/basic.rb | 4 |
16 files changed, 103 insertions, 111 deletions
diff --git a/lib/puppet/node/catalog.rb b/lib/puppet/node/catalog.rb index 96f60b179..b74947107 100644 --- a/lib/puppet/node/catalog.rb +++ b/lib/puppet/node/catalog.rb @@ -69,7 +69,7 @@ class Puppet::Node::Catalog < Puppet::PGraph @resource_table[ref] = resource resource.catalog = self if resource.respond_to?(:catalog=) and ! is_relationship_graph - add_vertex!(resource) + add_vertex(resource) end end @@ -316,9 +316,9 @@ class Puppet::Node::Catalog < Puppet::PGraph # First create the dependency graph self.vertices.each do |vertex| - @relationship_graph.add_vertex! vertex + @relationship_graph.add_vertex vertex vertex.builddepends.each do |edge| - @relationship_graph.add_edge!(edge) + @relationship_graph.add_edge(edge) end end @@ -328,7 +328,7 @@ class Puppet::Node::Catalog < Puppet::PGraph unless @relationship_graph.edge?(edge.source, edge.target) # don't let automatic relationships conflict with manual ones. unless @relationship_graph.edge?(edge.target, edge.source) vertex.debug "Autorequiring %s" % [edge.source] - @relationship_graph.add_edge!(edge) + @relationship_graph.add_edge(edge) else vertex.debug "Skipping automatic relationship with %s" % (edge.source == vertex ? edge.target : edge.source) end @@ -487,7 +487,7 @@ class Puppet::Node::Catalog < Puppet::PGraph raise Puppet::DevError, "Could not find resource %s when converting %s resources" % [edge.target.ref, message] end - result.add_edge!(source, target, edge.label) + result.add_edge(source, target, edge.label) end map.clear diff --git a/lib/puppet/parser/compiler.rb b/lib/puppet/parser/compiler.rb index 27860487a..26fdd3743 100644 --- a/lib/puppet/parser/compiler.rb +++ b/lib/puppet/parser/compiler.rb @@ -36,7 +36,7 @@ class Puppet::Parser::Compiler # And in the resource graph. At some point, this might supercede # the global resource table, but the table is a lot faster # so it makes sense to maintain for now. - @catalog.add_edge!(scope.resource, resource) + @catalog.add_edge(scope.resource, resource) end # Do we use nodes found in the code, vs. the external node sources? @@ -184,7 +184,7 @@ class Puppet::Parser::Compiler options[:compiler] = self options[:parser] ||= self.parser scope = Puppet::Parser::Scope.new(options) - @scope_graph.add_edge!(parent, scope) + @scope_graph.add_edge(parent, scope) scope end @@ -383,7 +383,7 @@ class Puppet::Parser::Compiler def init_main # Create our initial scope and a resource that will evaluate main. @topscope = Puppet::Parser::Scope.new(:compiler => self, :parser => self.parser) - @scope_graph.add_vertex!(@topscope) + @scope_graph.add_vertex(@topscope) end # Set up all of our internal variables. diff --git a/lib/puppet/pgraph.rb b/lib/puppet/pgraph.rb index 54b815b45..71547802e 100644 --- a/lib/puppet/pgraph.rb +++ b/lib/puppet/pgraph.rb @@ -7,17 +7,14 @@ require 'puppet/simple_graph' # This class subclasses a graph class in order to handle relationships # among resources. class Puppet::PGraph < Puppet::SimpleGraph - # This is the type used for splicing. - attr_accessor :container_type - include Puppet::Util - def add_edge!(*args) + def add_edge(*args) @reversal = nil super end - def add_vertex!(*args) + def add_vertex(*args) @reversal = nil super end @@ -57,11 +54,6 @@ class Puppet::PGraph < Puppet::SimpleGraph @reversal.tree_from_vertex(resource, :out).keys end - # Override this method to use our class instead. - def edge_class() - Puppet::Relationship - end - # Determine all of the leaf nodes below a given vertex. def leaves(vertex, direction = :out) tree = tree_from_vertex(vertex, direction) @@ -133,7 +125,7 @@ class Puppet::PGraph < Puppet::SimpleGraph copy_label(s, t, edge.label) next end - add_edge!(s, t, edge.label) + add_edge(s, t, edge.label) end # Now get rid of the edge, so remove_vertex! works correctly. diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb index 11542ad53..503e4814c 100644 --- a/lib/puppet/simple_graph.rb +++ b/lib/puppet/simple_graph.rb @@ -100,10 +100,10 @@ class Puppet::SimpleGraph # Return a reversed version of this graph. def reversal result = self.class.new - vertices.each { |vertex| result.add_vertex!(vertex) } + vertices.each { |vertex| result.add_vertex(vertex) } edges.each do |edge| newedge = edge.class.new(edge.target, edge.source, edge.label) - result.add_edge!(newedge) + result.add_edge(newedge) end result end @@ -150,7 +150,7 @@ class Puppet::SimpleGraph end # Add a new vertex to the graph. - def add_vertex!(vertex) + def add_vertex(vertex) return false if vertex?(vertex) setup_vertex(vertex) true # don't return the VertexWrapper instance. @@ -176,7 +176,7 @@ class Puppet::SimpleGraph # Add a new edge. The graph user has to create the edge instance, # since they have to specify what kind of edge it is. - def add_edge!(source, target = nil, label = nil) + def add_edge(source, target = nil, label = nil) if target edge = Puppet::Relationship.new(source, target, label) else diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index f304cadc6..976bf7c68 100644 --- a/lib/puppet/transaction.rb +++ b/lib/puppet/transaction.rb @@ -173,7 +173,7 @@ class Transaction relationship_graph.add_resource(gen_child) unless relationship_graph.resource(gen_child.ref) unless relationship_graph.edge?(edge[1], edge[0]) - relationship_graph.add_edge!(*edge) + relationship_graph.add_edge(*edge) else resource.debug "Skipping automatic relationship to %s" % gen_child end diff --git a/lib/puppet/transportable.rb b/lib/puppet/transportable.rb index c1d68a881..f686fbb78 100644 --- a/lib/puppet/transportable.rb +++ b/lib/puppet/transportable.rb @@ -193,7 +193,7 @@ module Puppet next unless resource = child.to_type config.add_resource resource end - config.add_edge!(container, resource) + config.add_edge(container, resource) if child.is_a?(self.class) delver.call(child) end diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb index 7d928d959..c32a4d474 100644 --- a/lib/puppet/type/pfile.rb +++ b/lib/puppet/type/pfile.rb @@ -650,7 +650,7 @@ module Puppet # LAK:FIXME This shouldn't be necessary, but as long as we're # modeling the relationship graph specifically, it is. - catalog.relationship_graph.add_edge! self, child + catalog.relationship_graph.add_edge self, child return child end diff --git a/lib/puppet/util/graph.rb b/lib/puppet/util/graph.rb index a9744578b..d1ef36f8e 100644 --- a/lib/puppet/util/graph.rb +++ b/lib/puppet/util/graph.rb @@ -16,7 +16,7 @@ module Puppet::Util::Graph self.each do |child| unless block_given? and ! yield(child) - graph.add_edge!(self, child) + graph.add_edge(self, child) if child.respond_to?(:to_graph) child.to_graph(graph, &block) diff --git a/spec/unit/node/catalog.rb b/spec/unit/node/catalog.rb index a0e201ca9..aa49909e2 100755 --- a/spec/unit/node/catalog.rb +++ b/spec/unit/node/catalog.rb @@ -75,7 +75,7 @@ describe Puppet::Node::Catalog, " when extracting transobjects" do @source = mock 'source' main = mkresource("class", :main) - config.add_vertex!(main) + config.add_vertex(main) bucket = mock 'bucket' bucket.expects(:classes=).with(config.classes) @@ -95,7 +95,7 @@ describe Puppet::Node::Catalog, " when extracting transobjects" do defined = mkresource("class", :main) builtin = mkresource("file", "/yay") - config.add_edge!(defined, builtin) + config.add_edge(defined, builtin) bucket = [] bucket.expects(:classes=).with(config.classes) @@ -121,21 +121,21 @@ describe Puppet::Node::Catalog, " when extracting transobjects" do top.expects(:to_trans).returns(topbucket) topres = mkresource "file", "/top" topres.expects(:to_trans).returns(:topres) - config.add_edge! top, topres + config.add_edge top, topres middle = mkresource "class", "middle" middle.expects(:to_trans).returns([]) - config.add_edge! top, middle + config.add_edge top, middle midres = mkresource "file", "/mid" midres.expects(:to_trans).returns(:midres) - config.add_edge! middle, midres + config.add_edge middle, midres bottom = mkresource "class", "bottom" bottom.expects(:to_trans).returns([]) - config.add_edge! middle, bottom + config.add_edge middle, bottom botres = mkresource "file", "/bot" botres.expects(:to_trans).returns(:botres) - config.add_edge! bottom, botres + config.add_edge bottom, botres toparray = config.extract_to_transportable @@ -196,13 +196,13 @@ describe Puppet::Node::Catalog, " when converting to a transobject catalog" do @resources = [@top, @topobject, @middle, @middleobject, @bottom, @bottomobject] - @original.add_edge!(@top, @topobject) - @original.add_edge!(@top, @virtual) - @original.add_edge!(@virtual, @virtualobject) - @original.add_edge!(@top, @middle) - @original.add_edge!(@middle, @middleobject) - @original.add_edge!(@middle, @bottom) - @original.add_edge!(@bottom, @bottomobject) + @original.add_edge(@top, @topobject) + @original.add_edge(@top, @virtual) + @original.add_edge(@virtual, @virtualobject) + @original.add_edge(@top, @middle) + @original.add_edge(@middle, @middleobject) + @original.add_edge(@middle, @bottom) + @original.add_edge(@bottom, @bottomobject) @catalog = @original.to_transportable end @@ -261,11 +261,11 @@ describe Puppet::Node::Catalog, " when converting to a RAL catalog" do @original.add_resource(*@resources) - @original.add_edge!(@top, @topobject) - @original.add_edge!(@top, @middle) - @original.add_edge!(@middle, @middleobject) - @original.add_edge!(@middle, @bottom) - @original.add_edge!(@bottom, @bottomobject) + @original.add_edge(@top, @topobject) + @original.add_edge(@top, @middle) + @original.add_edge(@middle, @middleobject) + @original.add_edge(@middle, @bottom) + @original.add_edge(@bottom, @bottomobject) @catalog = @original.to_ral end @@ -300,7 +300,7 @@ describe Puppet::Node::Catalog, " when converting to a RAL catalog" do config.add_resource(changer) config.add_resource(@top) - config.add_edge!(@top, changer) + config.add_edge(@top, changer) resource = stub 'resource', :name => "changer2", :title => "changer2", :ref => "Test[changer2]", :catalog= => nil, :remove => nil @@ -597,8 +597,8 @@ describe Puppet::Node::Catalog, " when creating a relationship graph" do @file = Puppet::Type.type(:file) @one = @file.create :path => "/one" @two = @file.create :path => "/two" - @catalog.add_edge! @compone, @one - @catalog.add_edge! @comptwo, @two + @catalog.add_edge @compone, @one + @catalog.add_edge @comptwo, @two @three = @file.create :path => "/three" @four = @file.create :path => "/four", :require => ["file", "/three"] @@ -771,7 +771,7 @@ end describe Puppet::Node::Catalog, " when converting to yaml" do before do @catalog = Puppet::Node::Catalog.new("me") - @catalog.add_edge!("one", "two") + @catalog.add_edge("one", "two") end it "should be able to be dumped to yaml" do @@ -782,7 +782,7 @@ end describe Puppet::Node::Catalog, " when converting from yaml" do before do @catalog = Puppet::Node::Catalog.new("me") - @catalog.add_edge!("one", "two") + @catalog.add_edge("one", "two") text = YAML.dump(@catalog) @newcatalog = YAML.load(text) diff --git a/spec/unit/other/pgraph.rb b/spec/unit/other/pgraph.rb index 252a807ec..7d66ae331 100755 --- a/spec/unit/other/pgraph.rb +++ b/spec/unit/other/pgraph.rb @@ -35,8 +35,8 @@ describe Puppet::PGraph do end it "should correctly clear vertices and edges when asked" do - @graph.add_edge!("a", "b") - @graph.add_vertex! "c" + @graph.add_edge("a", "b") + @graph.add_vertex "c" @graph.clear @graph.vertices.should be_empty @graph.edges.should be_empty @@ -52,7 +52,7 @@ describe Puppet::PGraph, " when matching edges" do @edges = {} @edges["a/b"] = Puppet::Relationship.new("a", "b", {:event => :yay, :callback => :refresh}) @edges["a/c"] = Puppet::Relationship.new("a", "c", {:event => :yay, :callback => :refresh}) - @graph.add_edge!(@edges["a/b"]) + @graph.add_edge(@edges["a/b"]) end it "should match edges whose source matches the source of the event" do @@ -64,7 +64,7 @@ describe Puppet::PGraph, " when matching edges" do end it "should match multiple edges" do - @graph.add_edge!(@edges["a/c"]) + @graph.add_edge(@edges["a/c"]) edges = @graph.matching_edges([@event]) edges.should be_include(@edges["a/b"]) edges.should be_include(@edges["a/c"]) @@ -75,9 +75,9 @@ describe Puppet::PGraph, " when determining dependencies" do before do @graph = Puppet::PGraph.new - @graph.add_edge!("a", "b") - @graph.add_edge!("a", "c") - @graph.add_edge!("b", "d") + @graph.add_edge("a", "b") + @graph.add_edge("a", "c") + @graph.add_edge("b", "d") end it "should find all dependents when they are on multiple levels" do @@ -118,19 +118,19 @@ describe Puppet::PGraph, " when splicing the relationship graph" do # We have to add the container to the main graph, else it won't # be spliced in the dependency graph. - @contgraph.add_vertex!(@empty) + @contgraph.add_vertex(@empty) end def dependency_graph @depgraph = Puppet::PGraph.new @contgraph.vertices.each do |v| - @depgraph.add_vertex!(v) + @depgraph.add_vertex(v) end # We have to specify a relationship to our empty container, else it # never makes it into the dep graph in the first place. {@one => @two, "f" => "c", "h" => @middle, "c" => @empty}.each do |source, target| - @depgraph.add_edge!(source, target, :callback => :refresh) + @depgraph.add_edge(source, target, :callback => :refresh) end end @@ -176,13 +176,13 @@ describe Puppet::PGraph, " when splicing the relationship graph" do end it "should not add labels to edges that have none" do - @depgraph.add_edge!(@two, @three) + @depgraph.add_edge(@two, @three) splice @depgraph.edge_label("c", "i").should == {} end it "should copy labels over edges that have none" do - @depgraph.add_edge!("c", @three, {:callback => :refresh}) + @depgraph.add_edge("c", @three, {:callback => :refresh}) splice # And make sure the label got copied. @depgraph.edge_label("c", "i").should == {:callback => :refresh} @@ -190,18 +190,18 @@ describe Puppet::PGraph, " when splicing the relationship graph" do it "should not replace a label with a nil label" do # Lastly, add some new label-less edges and make sure the label stays. - @depgraph.add_edge!(@middle, @three) - @depgraph.add_edge!("c", @three, {:callback => :refresh}) + @depgraph.add_edge(@middle, @three) + @depgraph.add_edge("c", @three, {:callback => :refresh}) splice @depgraph.edge_label("c", "i").should == {:callback => :refresh} end it "should copy labels to all created edges" do - @depgraph.add_edge!(@middle, @three) - @depgraph.add_edge!("c", @three, {:callback => :refresh}) + @depgraph.add_edge(@middle, @three) + @depgraph.add_edge("c", @three, {:callback => :refresh}) splice @three.each do |child| - edge = @depgraph.edge_class.new("c", child) + edge = Puppet::Relationship.new("c", child) @depgraph.should be_edge(edge.source, edge.target) @depgraph.edge_label(edge.source, edge.target).should == {:callback => :refresh} end diff --git a/spec/unit/ral/type.rb b/spec/unit/ral/type.rb index 25f8cbaf1..5980167d6 100755 --- a/spec/unit/ral/type.rb +++ b/spec/unit/ral/type.rb @@ -11,8 +11,8 @@ describe Puppet::Type, " when in a configuration" do @catalog.add_resource @container @catalog.add_resource @one @catalog.add_resource @two - @catalog.add_edge! @container, @one - @catalog.add_edge! @container, @two + @catalog.add_edge @container, @one + @catalog.add_edge @container, @two end it "should have no parent if there is no in edge" do diff --git a/spec/unit/simple_graph.rb b/spec/unit/simple_graph.rb index 061a07458..c8fe14cf3 100755 --- a/spec/unit/simple_graph.rb +++ b/spec/unit/simple_graph.rb @@ -9,8 +9,8 @@ require 'puppet/simple_graph' describe Puppet::SimpleGraph do it "should return the number of its vertices as its length" do @graph = Puppet::SimpleGraph.new - @graph.add_vertex!("one") - @graph.add_vertex!("two") + @graph.add_vertex("one") + @graph.add_vertex("two") @graph.size.should == 2 end @@ -20,13 +20,13 @@ describe Puppet::SimpleGraph do it "should provide a method for reversing the graph" do @graph = Puppet::SimpleGraph.new - @graph.add_edge!(:one, :two) + @graph.add_edge(:one, :two) @graph.reversal.edge?(:two, :one).should be_true end it "should be able to produce a dot graph" do @graph = Puppet::SimpleGraph.new - @graph.add_edge!(:one, :two) + @graph.add_edge(:one, :two) proc { @graph.to_dot_graph }.should_not raise_error end @@ -38,17 +38,17 @@ describe Puppet::SimpleGraph, " when managing vertices" do end it "should provide a method to add a vertex" do - @graph.add_vertex!(:test) + @graph.add_vertex(:test) @graph.vertex?(:test).should be_true end it "should ignore already-present vertices when asked to add a vertex" do - @graph.add_vertex!(:test) - proc { @graph.add_vertex!(:test) }.should_not raise_error + @graph.add_vertex(:test) + proc { @graph.add_vertex(:test) }.should_not raise_error end it "should return true when asked if a vertex is present" do - @graph.add_vertex!(:test) + @graph.add_vertex(:test) @graph.vertex?(:test).should be_true end @@ -57,15 +57,15 @@ describe Puppet::SimpleGraph, " when managing vertices" do end it "should return all set vertices when asked" do - @graph.add_vertex!(:one) - @graph.add_vertex!(:two) + @graph.add_vertex(:one) + @graph.add_vertex(:two) @graph.vertices.length.should == 2 @graph.vertices.should include(:one) @graph.vertices.should include(:two) end it "should remove a given vertex when asked" do - @graph.add_vertex!(:one) + @graph.add_vertex(:one) @graph.remove_vertex!(:one) @graph.vertex?(:one).should be_false end @@ -86,49 +86,49 @@ describe Puppet::SimpleGraph, " when managing edges" do it "should provide a method to add an edge as an instance of the edge class" do edge = Puppet::Relationship.new(:one, :two) - @graph.add_edge!(edge) + @graph.add_edge(edge) @graph.edge?(:one, :two).should be_true end it "should provide a method to add an edge by specifying the two vertices" do - @graph.add_edge!(:one, :two) + @graph.add_edge(:one, :two) @graph.edge?(:one, :two).should be_true end it "should provide a method to add an edge by specifying the two vertices and a label" do - @graph.add_edge!(:one, :two, :stuff => :awesome) + @graph.add_edge(:one, :two, :stuff => :awesome) @graph.edge?(:one, :two).should be_true end it "should provide a method for retrieving an edge label" do edge = Puppet::Relationship.new(:one, :two, :stuff => :awesome) - @graph.add_edge!(edge) + @graph.add_edge(edge) @graph.edge_label(:one, :two).should == {:stuff => :awesome} end it "should provide a method for retrieving an edge" do edge = Puppet::Relationship.new(:one, :two) - @graph.add_edge!(edge) + @graph.add_edge(edge) @graph.edge(:one, :two).should equal(edge) end it "should add the edge source as a vertex if it is not already" do edge = Puppet::Relationship.new(:one, :two) - @graph.add_edge!(edge) + @graph.add_edge(edge) @graph.vertex?(:one).should be_true end it "should add the edge target as a vertex if it is not already" do edge = Puppet::Relationship.new(:one, :two) - @graph.add_edge!(edge) + @graph.add_edge(edge) @graph.vertex?(:two).should be_true end it "should return all edges as edge instances when asked" do one = Puppet::Relationship.new(:one, :two) two = Puppet::Relationship.new(:two, :three) - @graph.add_edge!(one) - @graph.add_edge!(two) + @graph.add_edge(one) + @graph.add_edge(two) edges = @graph.edges edges.length.should == 2 edges.should include(one) @@ -137,7 +137,7 @@ describe Puppet::SimpleGraph, " when managing edges" do it "should remove an edge when asked" do edge = Puppet::Relationship.new(:one, :two) - @graph.add_edge!(edge) + @graph.add_edge(edge) @graph.remove_edge!(edge) @graph.edge?(edge.source, edge.target).should be_false end @@ -145,8 +145,8 @@ describe Puppet::SimpleGraph, " when managing edges" do it "should remove all related edges when a vertex is removed" do one = Puppet::Relationship.new(:one, :two) two = Puppet::Relationship.new(:two, :three) - @graph.add_edge!(one) - @graph.add_edge!(two) + @graph.add_edge(one) + @graph.add_edge(two) @graph.remove_vertex!(:two) @graph.edge?(:one, :two).should be_false @graph.edge?(:two, :three).should be_false @@ -160,9 +160,9 @@ describe Puppet::SimpleGraph, " when finding adjacent vertices" do @one_two = Puppet::Relationship.new(:one, :two) @two_three = Puppet::Relationship.new(:two, :three) @one_three = Puppet::Relationship.new(:one, :three) - @graph.add_edge!(@one_two) - @graph.add_edge!(@one_three) - @graph.add_edge!(@two_three) + @graph.add_edge(@one_two) + @graph.add_edge(@one_three) + @graph.add_edge(@two_three) end it "should return adjacent vertices" do @@ -193,8 +193,8 @@ describe Puppet::SimpleGraph, " when clearing" do @graph = Puppet::SimpleGraph.new one = Puppet::Relationship.new(:one, :two) two = Puppet::Relationship.new(:two, :three) - @graph.add_edge!(one) - @graph.add_edge!(two) + @graph.add_edge(one) + @graph.add_edge(two) @graph.clear end @@ -214,18 +214,18 @@ describe Puppet::SimpleGraph, " when reversing graphs" do end it "should provide a method for reversing the graph" do - @graph.add_edge!(:one, :two) + @graph.add_edge(:one, :two) @graph.reversal.edge?(:two, :one).should be_true end it "should add all vertices to the reversed graph" do - @graph.add_edge!(:one, :two) + @graph.add_edge(:one, :two) @graph.vertex?(:one).should be_true @graph.vertex?(:two).should be_true end it "should retain labels on edges" do - @graph.add_edge!(:one, :two, :stuff => :awesome) + @graph.add_edge(:one, :two, :stuff => :awesome) edge = @graph.reversal.edge(:two, :one) edge.label.should == {:stuff => :awesome} end @@ -238,7 +238,7 @@ describe Puppet::SimpleGraph, " when sorting the graph" do def add_edges(hash) hash.each do |a,b| - @graph.add_edge!(a, b) + @graph.add_edge(a, b) end end diff --git a/test/lib/puppettest/support/resources.rb b/test/lib/puppettest/support/resources.rb index 384f61c33..255c55569 100755 --- a/test/lib/puppettest/support/resources.rb +++ b/test/lib/puppettest/support/resources.rb @@ -18,7 +18,7 @@ module PuppetTest::Support::Resources if resource.is_a?(String) resource = tree_resource(resource) end - config.add_edge!(comp, resource) + config.add_edge(comp, resource) config.add_resource resource unless config.resource(resource.ref) end return comp diff --git a/test/other/transactions.rb b/test/other/transactions.rb index 79971a28b..105698da1 100755 --- a/test/other/transactions.rb +++ b/test/other/transactions.rb @@ -348,12 +348,12 @@ class TestTransactions < Test::Unit::TestCase fcomp = Puppet::Type.type(:component).create(:name => "file") config.add_resource fcomp config.add_resource file - config.add_edge!(fcomp, file) + config.add_edge(fcomp, file) ecomp = Puppet::Type.type(:component).create(:name => "exec") config.add_resource ecomp config.add_resource exec - config.add_edge!(ecomp, exec) + config.add_edge(ecomp, exec) # 'subscribe' expects an array of arrays #component[:require] = [[file.class.name,file.name]] @@ -828,10 +828,10 @@ class TestTransactions < Test::Unit::TestCase c = trigger.new(:c) nope = Puppet::Relationship.new(a, b) yep = Puppet::Relationship.new(a, c, {:callback => :refresh}) - graph.add_edge!(nope) + graph.add_edge(nope) # And a triggering one. - graph.add_edge!(yep) + graph.add_edge(yep) # Create our transaction trans = Puppet::Transaction.new(graph) diff --git a/test/ral/manager/type.rb b/test/ral/manager/type.rb index 6a044687e..6c5587ddd 100755 --- a/test/ral/manager/type.rb +++ b/test/ral/manager/type.rb @@ -708,7 +708,7 @@ class TestType < Test::Unit::TestCase res = type.create(hash) config.add_resource res if parent - config.add_edge!(parent, res) + config.add_edge(parent, res) end res end @@ -741,7 +741,7 @@ class TestType < Test::Unit::TestCase newcomp = Puppet::Type.newcomponent :type => "yay", :name => "Good[bad]" config.add_resource newcomp - config.add_edge! comp, newcomp + config.add_edge comp, newcomp exec = mk.call(6, :parent => newcomp) assert_equal("//Good[bad]/Exec[exec6]", exec.path) end diff --git a/test/ral/types/basic.rb b/test/ral/types/basic.rb index 7bbadc5bc..3c5faeee0 100755 --- a/test/ral/types/basic.rb +++ b/test/ral/types/basic.rb @@ -36,8 +36,8 @@ class TestBasic < Test::Unit::TestCase ) } @config = mk_catalog(@component, @configfile, @command) - @config.add_edge! @component, @configfile - @config.add_edge! @component, @command + @config.add_edge @component, @configfile + @config.add_edge @component, @command end def teardown |
