diff --git a/include/test/NebulaTest.h b/include/test/NebulaTest.h index 18589b0da4..a60b93141e 100644 --- a/include/test/NebulaTest.h +++ b/include/test/NebulaTest.h @@ -35,6 +35,7 @@ #include "RequestManager.h" #include "HookManager.h" #include "AuthManager.h" +#include "ImageManager.h" class NebulaTest { @@ -71,6 +72,7 @@ public: bool need_rm; bool need_hm; bool need_authm; + bool need_imagem; static NebulaTest * instance() { @@ -132,6 +134,8 @@ public: virtual HookManager* create_hm(VirtualMachinePool * vmpool); virtual AuthManager* create_authm(time_t timer_period); + + virtual ImageManager* create_imagem(ImagePool * ipool); }; #endif /*NEBULA_TEST_H_*/ diff --git a/src/image/test/ImagePoolTest.cc b/src/image/test/ImagePoolTest.cc index 041076cbba..d995f40920 100644 --- a/src/image/test/ImagePoolTest.cc +++ b/src/image/test/ImagePoolTest.cc @@ -451,7 +451,7 @@ public: CPPUNIT_ASSERT( img != 0 ); CPPUNIT_ASSERT( oid == 0 ); - img->enable(true); + img->set_state(Image::READY); img->disk_attribute(disk, &index, &img_type); value = disk->vector_value("TARGET"); @@ -474,7 +474,7 @@ public: img = imp->get(oid, false); CPPUNIT_ASSERT( img != 0 ); - img->enable(true); + img->set_state(Image::READY); img->disk_attribute(disk, &index, &img_type); value = disk->vector_value("TARGET"); @@ -496,7 +496,7 @@ public: img = imp->get(oid, false); CPPUNIT_ASSERT( img != 0 ); - img->enable(true); + img->set_state(Image::READY); img->disk_attribute(disk, &index, &img_type); value = disk->vector_value("TARGET"); @@ -518,7 +518,7 @@ public: img = imp->get(oid, false); CPPUNIT_ASSERT( img != 0 ); - img->enable(true); + img->set_state(Image::READY); img->disk_attribute(disk, &index, &img_type); value = disk->vector_value("TARGET"); @@ -551,7 +551,7 @@ public: // A disk without a BUS attribute should not have it added. disk = new VectorAttribute("DISK"); - img->enable(true); + img->set_state(Image::READY); rc = img->disk_attribute(disk, &index, &img_type); CPPUNIT_ASSERT( rc == 0 ); @@ -565,7 +565,7 @@ public: "source_prefix/9ab4a4e021ee2883f57e3aeecc9e2aed7c3fa198" ); // clean up - img->release_image(); + //img->release_image(); delete disk; // --------------------------------------------------------------------- @@ -573,7 +573,7 @@ public: disk = new VectorAttribute("DISK"); disk->replace("BUS", "SCSI"); - img->enable(true); + img->set_state(Image::READY); rc = img->disk_attribute(disk, &index, &img_type); CPPUNIT_ASSERT( rc == 0 ); @@ -621,11 +621,11 @@ public: img = imp->get(oid_0, false); CPPUNIT_ASSERT( img != 0 ); - img->enable(true); + img->set_state(Image::READY); img = imp->get(oid_1, false); CPPUNIT_ASSERT( img != 0 ); - img->enable(true); + img->set_state(Image::READY); // Disk using image 0 diff --git a/src/test/Nebula.cc b/src/test/Nebula.cc index 7fbf0642b3..e0215e3f3d 100644 --- a/src/test/Nebula.cc +++ b/src/test/Nebula.cc @@ -424,6 +424,29 @@ void Nebula::start() } } + // ---- Auth Manager ---- + if (tester->need_imagem) + { + try + { + imagem = tester->create_imagem(ipool); + } + catch (bad_alloc&) + { + throw; + } + + if (imagem != 0) + { + rc = imagem->start(); + + if ( rc != 0 ) + { + throw runtime_error("Could not start the Image Manager"); + } + } + } + // ----------------------------------------------------------- // Load mads // ----------------------------------------------------------- diff --git a/src/test/NebulaTest.cc b/src/test/NebulaTest.cc index d953962b5e..cb385a5208 100644 --- a/src/test/NebulaTest.cc +++ b/src/test/NebulaTest.cc @@ -145,3 +145,18 @@ AuthManager* NebulaTest::create_authm(time_t timer_period) { return 0; } + +ImageManager* NebulaTest::create_imagem(ImagePool * ipool) +{ + map mad_value; + VectorAttribute * mad; + + vector im_mads; + + mad_value.insert(make_pair("executable","one_image")); + + mad = new VectorAttribute("HM_MAD",mad_value); + im_mads.push_back(mad); + + return new ImageManager(ipool,im_mads); +}