diff --git a/src/image/test/ImagePoolTest.cc b/src/image/test/ImagePoolTest.cc index d7745bd474..7a59fdfa27 100644 --- a/src/image/test/ImagePoolTest.cc +++ b/src/image/test/ImagePoolTest.cc @@ -25,6 +25,10 @@ using namespace std; const int uids[] = {0,1,2}; +const char* unames[] = {"one","two","three"}; +const char* gnames[] = {"oneadmin","oneadmin","users"}; + + const string names[] = {"Image one", "Second Image", "The third image"}; const string templates[] = @@ -106,7 +110,10 @@ public: if( rc == 0 ) { - return ImagePool::allocate(uid, 1, img_template, oid, err); + string uname = unames[uid]; + string gname = gnames[uid]; + + return ImagePool::allocate(uid, 1, uname, gname, img_template, oid, err); } else { diff --git a/src/lcm/test/LifeCycleManagerTest.cc b/src/lcm/test/LifeCycleManagerTest.cc index 33ec6ea6ed..414be71a67 100644 --- a/src/lcm/test/LifeCycleManagerTest.cc +++ b/src/lcm/test/LifeCycleManagerTest.cc @@ -24,6 +24,9 @@ using namespace std; const int uids[] = {123, 261, 123}; const int gids[] = {150, 164, 175}; +const char* unames[] = {"one", "two", "three"}; +const char* gnames[] = {"oneadmin", "oneadmin", "users"}; + const string names[] = {"VM one", "Second VM", "VM 3"}; const string templates[] = @@ -186,8 +189,17 @@ private: if( rc == 0 ) { - return vmpool->allocate(uids[index], gids[index], vm_template, &oid, - err, false); + string uname = unames[index]; + string gname = gnames[index]; + + return vmpool->allocate(uids[index], + gids[index], + uname, + gname, + vm_template, + &oid, + err, + false); } else { diff --git a/src/pool/test/TestPoolSQL.h b/src/pool/test/TestPoolSQL.h index d9eac8a5c2..9dd86a041d 100644 --- a/src/pool/test/TestPoolSQL.h +++ b/src/pool/test/TestPoolSQL.h @@ -30,7 +30,7 @@ class TestObjectSQL : public PoolObjectSQL { public: //OBJECT ATTRIBUTES - TestObjectSQL(int n=-1, string t="default"):PoolObjectSQL(-1,"",0,0,0),number(n),text(t){}; + TestObjectSQL(int n=-1, string t="default"):PoolObjectSQL(-1,"",0,0,"","",0),number(n),text(t){}; ~TestObjectSQL(){}; diff --git a/src/um/test/UserPoolTest.cc b/src/um/test/UserPoolTest.cc index c90dd971cb..ad60f7e3fa 100644 --- a/src/um/test/UserPoolTest.cc +++ b/src/um/test/UserPoolTest.cc @@ -97,7 +97,7 @@ protected: int oid; string err; - return ((UserPool*)pool)->allocate(&oid, 0, usernames[index], + return ((UserPool*)pool)->allocate(&oid, 0, usernames[index],"oneadmin", passwords[index], true, err); }; @@ -187,24 +187,28 @@ public: bool rc; int oid, gid; + set groups; + string uname, gname; // There is an initial user, created with the one_auth file: // one_user_test:password string session="one_user_test:5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8"; - rc = user_pool->authenticate( session, oid, gid ); + rc = user_pool->authenticate( session, oid, gid, uname, gname, groups ); CPPUNIT_ASSERT( rc == true ); CPPUNIT_ASSERT( oid == 0 ); - CPPUNIT_ASSERT( oid == 0 ); + CPPUNIT_ASSERT( gid == 0 ); + CPPUNIT_ASSERT( uname == "one_user_test" ); + CPPUNIT_ASSERT( gname == "oneadmin" ); session = "one_user_test:wrong_password"; - rc = user_pool->authenticate( session, oid, gid ); + rc = user_pool->authenticate( session, oid, gid , uname, gname, groups ); CPPUNIT_ASSERT( rc == false ); CPPUNIT_ASSERT( oid == -1 ); CPPUNIT_ASSERT( gid == -1 ); session = "unknown_user:5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8"; - rc = user_pool->authenticate( session, oid, gid ); + rc = user_pool->authenticate( session, oid, gid, uname, gname, groups ); CPPUNIT_ASSERT( rc == false ); CPPUNIT_ASSERT( oid == -1 ); CPPUNIT_ASSERT( gid == -1 ); @@ -293,17 +297,17 @@ public: UserPool * up = static_cast(pool); // Allocate a user. - rc = up->allocate(&oid, 0,usernames[0], passwords[0], true, err); + rc = up->allocate(&oid, 0,usernames[0], "oneadmin",passwords[0], true, err); CPPUNIT_ASSERT( oid == 1 ); CPPUNIT_ASSERT( oid == rc ); // Try to allocate twice the same user, should fail - rc = up->allocate(&oid, 0,usernames[0], passwords[0], true, err); + rc = up->allocate(&oid, 0,usernames[0], "oneadmin", passwords[0], true, err); CPPUNIT_ASSERT( rc == -1 ); CPPUNIT_ASSERT( oid == rc ); // Try again, with different password - rc = up->allocate(&oid, 0, usernames[0], passwords[1], true, err); + rc = up->allocate(&oid, 0, usernames[0], "oneadmin", passwords[1], true, err); CPPUNIT_ASSERT( rc == -1 ); CPPUNIT_ASSERT( oid == rc ); } @@ -318,7 +322,7 @@ public: for(int i=0; i<5; i++) { - ((UserPool*)pool)->allocate(&oid, 0, d_names[i], d_pass[i], true, err); + ((UserPool*)pool)->allocate(&oid, 0, d_names[i], "oneadmin", d_pass[i], true, err); } ostringstream oss; @@ -345,7 +349,7 @@ public: for(int i=0; i<5; i++) { - ((UserPool*)pool)->allocate(&oid, 0, d_names[i], d_pass[i], true, err); + ((UserPool*)pool)->allocate(&oid, 0, d_names[i], "oneadmin",d_pass[i], true, err); } // Note: second parameter of dump is the WHERE constraint. The "order diff --git a/src/vm/test/SConstruct b/src/vm/test/SConstruct index 7876b88735..fe0a76e259 100644 --- a/src/vm/test/SConstruct +++ b/src/vm/test/SConstruct @@ -23,6 +23,7 @@ env.Prepend(LIBS=[ 'nebula_vnm', 'nebula_authm', 'nebula_acl', + 'nebula_group', 'nebula_template', 'nebula_pool', 'nebula_xml', diff --git a/src/vm/test/VirtualMachinePoolTest.cc b/src/vm/test/VirtualMachinePoolTest.cc index 6e636d0065..b3122614dc 100644 --- a/src/vm/test/VirtualMachinePoolTest.cc +++ b/src/vm/test/VirtualMachinePoolTest.cc @@ -105,7 +105,7 @@ public: if( rc == 0 ) { - return VirtualMachinePool::allocate(uid, 1, vm_template, + return VirtualMachinePool::allocate(uid, 1, "the_user", "users",vm_template, oid, err, on_hold); } else diff --git a/src/vm_template/test/VMTemplatePoolTest.cc b/src/vm_template/test/VMTemplatePoolTest.cc index b70ff0b4a8..e6a8921888 100644 --- a/src/vm_template/test/VMTemplatePoolTest.cc +++ b/src/vm_template/test/VMTemplatePoolTest.cc @@ -78,7 +78,7 @@ public: if( rc == 0 ) { - return VMTemplatePool::allocate(uid, 0,template_contents, oid, err); + return VMTemplatePool::allocate(uid, 0,"the_user","oneadmin",template_contents, oid, err); } else { diff --git a/src/vnm/test/SConstruct b/src/vnm/test/SConstruct index d645885a0b..0854a0e939 100644 --- a/src/vnm/test/SConstruct +++ b/src/vnm/test/SConstruct @@ -22,6 +22,7 @@ env.Prepend(LIBS=[ 'nebula_vnm', 'nebula_authm', 'nebula_acl', + 'nebula_group', 'nebula_template', 'nebula_pool', 'nebula_xml', diff --git a/src/vnm/test/VirtualNetworkPoolTest.cc b/src/vnm/test/VirtualNetworkPoolTest.cc index 05e7227242..ef14d38149 100644 --- a/src/vnm/test/VirtualNetworkPoolTest.cc +++ b/src/vnm/test/VirtualNetworkPoolTest.cc @@ -111,7 +111,7 @@ public: if( rc == 0 ) { - return VirtualNetworkPool::allocate(uid, 0, vn_template, oid, err); + return VirtualNetworkPool::allocate(uid, 0,"the_user","oneadmin", vn_template, oid, err); } else {