From: Maros Zatko <mzatko(a)redhat.com>
---
src/app/controllers/api/images_controller.rb | 6 ++--
src/app/views/api/builds/_build.xml.haml | 4 +-
src/app/views/api/images/_image.xml.haml | 6 ++--
src/app/views/api/provider_images/_image.xml.haml | 4 +-
src/app/views/api/target_images/_image.xml.haml | 8 +++---
src/spec/controllers/api/builds_controller_spec.rb | 18 +++++++-------
src/spec/controllers/api/images_controller_spec.rb | 12 ++++----
.../api/provider_images_controller_spec.rb | 18 +++++++-------
.../api/target_images_controller_spec.rb | 26 ++++++++++----------
9 files changed, 51 insertions(+), 51 deletions(-)
diff --git a/src/app/controllers/api/images_controller.rb
b/src/app/controllers/api/images_controller.rb
index 7987a3e..49553db 100644
--- a/src/app/controllers/api/images_controller.rb
+++ b/src/app/controllers/api/images_controller.rb
@@ -30,7 +30,7 @@ module Api
@images = Aeolus::Image::Warehouse::Image.all
@builds = {}
@images.each do |img|
- @builds.merge!({img.uuid =>
Aeolus::Image::Warehouse::ImageBuild.find_all_by_image_uuid(img.uuid)})
+ @builds.merge!({img.id =>
Aeolus::Image::Warehouse::ImageBuild.find_all_by_image_uuid(img.id)})
end
respond_with(@images)
end
@@ -39,7 +39,7 @@ module Api
id = params[:id]
@image = Aeolus::Image::Warehouse::Image.find(id)
if @image
- @builds = {(a)image.uuid =>
Aeolus::Image::Warehouse::ImageBuild.find_all_by_image_uuid(@image.uuid)}
+ @builds = {(a)image.id =>
Aeolus::Image::Warehouse::ImageBuild.find_all_by_image_uuid(@image.id)}
respond_with(@image)
else
render :nothing => true, :status => 404
@@ -83,4 +83,4 @@ module Api
end
end
end
-end
\ No newline at end of file
+end
diff --git a/src/app/views/api/builds/_build.xml.haml
b/src/app/views/api/builds/_build.xml.haml
index c50aa78..c22a383 100644
--- a/src/app/views/api/builds/_build.xml.haml
+++ b/src/app/views/api/builds/_build.xml.haml
@@ -1,3 +1,3 @@
!!! XML
-%build{:id => build.uuid, :href => api_build_url(build.uuid) }
- %image{:type => 'xs:string', :href => api_image_url(build.image.uuid)}=
build.image.uuid
+%build{:id => build.id, :href => api_build_url(build.id) }
+ %image{:type => 'xs:string', :href => api_image_url(build.image.id)}=
build.image.id
diff --git a/src/app/views/api/images/_image.xml.haml
b/src/app/views/api/images/_image.xml.haml
index 0c0341b..fe898db 100644
--- a/src/app/views/api/images/_image.xml.haml
+++ b/src/app/views/api/images/_image.xml.haml
@@ -1,5 +1,5 @@
!!!XML
-%image{:id => image.uuid, :href => api_image_url(image.uuid) }
+%image{:id => image.id, :href => api_image_url(image.id) }
%name= image.name
%description= image.description
- if !image.os.nil?
@@ -7,5 +7,5 @@
%os_version= image.os.version
%arch= image.os.arch
%builds{:type => 'xs:list'}
- - @builds[image.uuid].each do |bld|
- %build{:id => bld.uuid, :href => api_build_url(bld.uuid)}
+ - @builds[image.id].each do |bld|
+ %build{:id => bld.id, :href => api_build_url(bld.id)}
diff --git a/src/app/views/api/provider_images/_image.xml.haml
b/src/app/views/api/provider_images/_image.xml.haml
index ee49143..284c5fa 100644
--- a/src/app/views/api/provider_images/_image.xml.haml
+++ b/src/app/views/api/provider_images/_image.xml.haml
@@ -1,6 +1,6 @@
!!!XML
-%provider_image{:id => image.uuid, :href => api_provider_image_url(image.uuid) }
+%provider_image{:id => image.id, :href => api_provider_image_url(image.id) }
%icicle= image.icicle
%object_type= image.object_type
%target_identifier= image.target_identifier
- %target_image{:id => image.target_image.uuid, :href =>
api_target_image_url(image.target_image.uuid)}
+ %target_image{:id => image.target_image.id, :href =>
api_target_image_url(image.target_image.id)}
diff --git a/src/app/views/api/target_images/_image.xml.haml
b/src/app/views/api/target_images/_image.xml.haml
index deab843..0734855 100644
--- a/src/app/views/api/target_images/_image.xml.haml
+++ b/src/app/views/api/target_images/_image.xml.haml
@@ -1,9 +1,9 @@
!!!XML
-%target_image{:id => image.uuid, :href => api_target_image_url(image.uuid) }
+%target_image{:id => image.id, :href => api_target_image_url(image.id) }
%icicle= image.icicle
%object_type= image.object_type
%template= image.template
- %build{:href=>api_build_url(image.build.uuid), :id=>image.build.uuid}
- %provider_images{:href => api_target_image_provider_images_url(image.uuid)}
+ %build{:href=>api_build_url(image.build.id), :id=>image.build.id}
+ %provider_images{:href => api_target_image_provider_images_url(image.id)}
- image.provider_images.each do |pimg|
- %provider_image{:id => pimg.uuid, :href =>
api_provider_image_url(pimg.uuid)}
+ %provider_image{:id => pimg.id, :href => api_provider_image_url(pimg.id)}
diff --git a/src/spec/controllers/api/builds_controller_spec.rb
b/src/spec/controllers/api/builds_controller_spec.rb
index 3e2bab4..de9e879 100644
--- a/src/spec/controllers/api/builds_controller_spec.rb
+++ b/src/spec/controllers/api/builds_controller_spec.rb
@@ -38,13 +38,13 @@ describe Api::BuildsController do
before do
@os = mock(:OS, :name => 'fedora', :version => '15', :arch
=> 'x86_64')
@image = mock(Aeolus::Image::Warehouse::Image,
- :uuid => '5',
+ :id => '5',
:os => @os,
:name => 'test',
:description => 'test image')
@build = mock(Aeolus::Image::Warehouse::ImageBuild,
- :uuid => '10',
+ :id => '10',
:image => @image)
Aeolus::Image::Warehouse::ImageBuild.stub(:all).and_return([@build])
@@ -55,8 +55,8 @@ describe Api::BuildsController do
it { response.headers['Content-Type'].should
include("application/xml") }
it {
resp = Hash.from_xml(response.body)
- resp['builds']['build']['id'].should == @build.uuid
- resp['builds']['build']['image'].should == @image.uuid
+ resp['builds']['build']['id'].should == @build.id
+ resp['builds']['build']['image'].should == @image.id
}
end
@@ -64,13 +64,13 @@ describe Api::BuildsController do
before do
@os = mock(:OS, :name => 'fedora', :version => '15', :arch
=> 'x86_64')
@image = mock(Aeolus::Image::Warehouse::Image,
- :uuid => '5',
+ :id => '5',
:os => @os,
:name => 'test',
:description => 'test image')
@build = mock(Aeolus::Image::Warehouse::ImageBuild,
- :uuid => '10',
+ :id => '10',
:image => @image)
Aeolus::Image::Warehouse::ImageBuild.stub(:find).and_return(@build)
@@ -79,10 +79,10 @@ describe Api::BuildsController do
it { response.should be_success}
it { response.headers['Content-Type'].should
include("application/xml") }
- it {
+ it {
resp = Hash.from_xml(response.body)
- resp['build']['id'].should == @build.uuid
- resp['build']['image'].should == @image.uuid
+ resp['build']['id'].should == @build.id
+ resp['build']['image'].should == @image.id
}
end
end
diff --git a/src/spec/controllers/api/images_controller_spec.rb
b/src/spec/controllers/api/images_controller_spec.rb
index dbc555f..edd5e98 100644
--- a/src/spec/controllers/api/images_controller_spec.rb
+++ b/src/spec/controllers/api/images_controller_spec.rb
@@ -38,7 +38,7 @@ describe Api::ImagesController do
before do
@os = mock(:OS, :name => 'fedora', :version => '15', :arch
=> 'x86_64')
@image = mock(Aeolus::Image::Warehouse::Image,
- :uuid => '5',
+ :id => '5',
:os => @os,
:name => 'test',
:description => 'test image')
@@ -53,7 +53,7 @@ describe Api::ImagesController do
it {
resp = Hash.from_xml(response.body)
resp['images']['image']['name'].should == @image.name
- resp['images']['image']['id'].should == @image.uuid
+ resp['images']['image']['id'].should == @image.id
resp['images']['image']['os'].should == @image.os.name
resp['images']['image']['arch'].should == @image.os.arch
resp['images']['image']['os_version'].should ==
@image.os.version
@@ -65,21 +65,21 @@ describe Api::ImagesController do
before do
@os = mock(:OS, :name => 'fedora', :version => '15', :arch
=> 'x86_64')
@image = mock(Aeolus::Image::Warehouse::Image,
- :uuid => '5',
+ :id => '5',
:os => @os,
:name => 'test',
:description => 'test image')
Aeolus::Image::Warehouse::Image.stub(:find).and_return(@image)
-
Aeolus::Image::Warehouse::ImageBuild.stub(:find_all_by_image_uuid).and_return([])
+ Aeolus::Image::Warehouse::ImageBuild.stub(:find_all_by_image_id).and_return([])
get :show, :id => '5'
end
it { response.should be_success}
it { response.headers['Content-Type'].should
include("application/xml") }
- it {
+ it {
resp = Hash.from_xml(response.body)
resp['image']['name'].should == @image.name
- resp['image']['id'].should == @image.uuid
+ resp['image']['id'].should == @image.id
resp['image']['os'].should == @image.os.name
resp['image']['arch'].should == @image.os.arch
resp['image']['os_version'].should == @image.os.version
diff --git a/src/spec/controllers/api/provider_images_controller_spec.rb
b/src/spec/controllers/api/provider_images_controller_spec.rb
index 2eaf2c1..4162d78 100644
--- a/src/spec/controllers/api/provider_images_controller_spec.rb
+++ b/src/spec/controllers/api/provider_images_controller_spec.rb
@@ -37,9 +37,9 @@ describe Api::ProviderImagesController do
describe "#index" do
before do
@timage = mock(Aeolus::Image::Warehouse::TargetImage,
- :uuid => '300')
+ :id => '300')
@pimage = mock(Aeolus::Image::Warehouse::ProviderImage,
- :uuid => '17',
+ :id => '17',
:icicle => '30',
:object_type => 'provider_image',
:target_identifier => '80',
@@ -53,20 +53,20 @@ describe Api::ProviderImagesController do
it { response.headers['Content-Type'].should
include("application/xml") }
it {
resp = Hash.from_xml(response.body)
- resp['provider_images']['provider_image']['id'].should ==
@pimage.uuid
+ resp['provider_images']['provider_image']['id'].should ==
@pimage.id
resp['provider_images']['provider_image']['icicle'].should ==
@pimage.icicle
resp['provider_images']['provider_image']['object_type'].should ==
@pimage.object_type
resp['provider_images']['provider_image']['target_identifier'].should
== @pimage.target_identifier
-
resp['provider_images']['provider_image']['target_image']['id'].should
== @pimage.target_image.uuid
+
resp['provider_images']['provider_image']['target_image']['id'].should
== @pimage.target_image.id
}
end
describe "#show" do
before do
@timage = mock(Aeolus::Image::Warehouse::TargetImage,
- :uuid => '300')
+ :id => '300')
@pimage = mock(Aeolus::Image::Warehouse::ProviderImage,
- :uuid => '17',
+ :id => '17',
:icicle => '30',
:object_type => 'provider_image',
:target_identifier => '80',
@@ -78,13 +78,13 @@ describe Api::ProviderImagesController do
it { response.should be_success}
it { response.headers['Content-Type'].should
include("application/xml") }
- it {
+ it {
resp = Hash.from_xml(response.body)
- resp['provider_image']['id'].should == @pimage.uuid
+ resp['provider_image']['id'].should == @pimage.id
resp['provider_image']['icicle'].should == @pimage.icicle
resp['provider_image']['object_type'].should ==
@pimage.object_type
resp['provider_image']['target_identifier'].should ==
@pimage.target_identifier
- resp['provider_image']['target_image']['id'].should ==
@pimage.target_image.uuid
+ resp['provider_image']['target_image']['id'].should ==
@pimage.target_image.id
}
end
end
diff --git a/src/spec/controllers/api/target_images_controller_spec.rb
b/src/spec/controllers/api/target_images_controller_spec.rb
index 623c5d1..451786f 100644
--- a/src/spec/controllers/api/target_images_controller_spec.rb
+++ b/src/spec/controllers/api/target_images_controller_spec.rb
@@ -37,11 +37,11 @@ describe Api::TargetImagesController do
describe "#index" do
before do
@pimage = mock(Aeolus::Image::Warehouse::ProviderImage,
- :uuid => '42')
+ :id => '42')
@build = mock(Aeolus::Image::Warehouse::ImageBuild,
- :uuid => '543')
+ :id => '543')
@timage = mock(Aeolus::Image::Warehouse::TargetImage,
- :uuid => '100',
+ :id => '100',
:icicle => '321',
:object_type => 'target_image',
:template => '12',
@@ -56,24 +56,24 @@ describe Api::TargetImagesController do
it { response.headers['Content-Type'].should
include("application/xml") }
it {
resp = Hash.from_xml(response.body)
- resp['target_images']['target_image']['id'].should ==
@timage.uuid
+ resp['target_images']['target_image']['id'].should ==
@timage.id
resp['target_images']['target_image']['icicle'].should ==
@timage.icicle
resp['target_images']['target_image']['object_type'].should ==
@timage.object_type
resp['target_images']['target_image']['template'].should
== @timage.template
-
resp['target_images']['target_image']['build']['id'].should
== @timage.build.uuid
+
resp['target_images']['target_image']['build']['id'].should
== @timage.build.id
pimgs =
resp['target_images']['target_image']['provider_images']
- pimgs['provider_image']['id'].should == @pimage.uuid
+ pimgs['provider_image']['id'].should == @pimage.id
}
end
describe "#show" do
before do
@pimage = mock(Aeolus::Image::Warehouse::ProviderImage,
- :uuid => '42')
+ :id => '42')
@build = mock(Aeolus::Image::Warehouse::ImageBuild,
- :uuid => '543')
+ :id => '543')
@timage = mock(Aeolus::Image::Warehouse::TargetImage,
- :uuid => '100',
+ :id => '100',
:icicle => '321',
:object_type => 'target_image',
:template => '12',
@@ -86,15 +86,15 @@ describe Api::TargetImagesController do
it { response.should be_success}
it { response.headers['Content-Type'].should
include("application/xml") }
- it {
+ it {
resp = Hash.from_xml(response.body)
- resp['target_image']['id'].should == @timage.uuid
+ resp['target_image']['id'].should == @timage.id
resp['target_image']['icicle'].should == @timage.icicle
resp['target_image']['object_type'].should ==
@timage.object_type
resp['target_image']['template'].should == @timage.template
- resp['target_image']['build']['id'].should ==
@timage.build.uuid
+ resp['target_image']['build']['id'].should ==
@timage.build.id
pimgs = resp['target_image']['provider_images']
- pimgs['provider_image']['id'].should == @pimage.uuid
+ pimgs['provider_image']['id'].should == @pimage.id
}
end
end
--
1.7.6.2