From 334223dbca985e1319b077bde4a07b42d7d857be Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Tue, 1 Feb 2011 17:50:06 +0100 Subject: [PATCH] Removed unused test files. Listed the test directories in the do_test script to prevent the execution of non-test files --- share/test/do_tests.sh | 19 ++- share/test/one.db | Bin 19457 -> 0 bytes share/test/src/common/AMTest.cc | 67 -------- share/test/src/host/TestHostPool.cc | 252 ---------------------------- share/test/src/im/ImTest.cc | 98 ----------- share/test/src/mad/MMTest.cc | 188 --------------------- share/test/src/mad/mad_echo.sh | 43 ----- share/test/src/nebula/log.cc | 15 -- share/test/src/pool/TestSQL.cc | 173 ------------------- share/test/src/template/ATTest.cc | 122 -------------- share/test/src/template/vm.template | 8 - share/test/src/vm/TestVMPool.cc | 74 -------- share/test/src/vmm/VMManager.cc | 56 ------- 13 files changed, 16 insertions(+), 1099 deletions(-) delete mode 100644 share/test/one.db delete mode 100644 share/test/src/common/AMTest.cc delete mode 100644 share/test/src/host/TestHostPool.cc delete mode 100644 share/test/src/im/ImTest.cc delete mode 100644 share/test/src/mad/MMTest.cc delete mode 100755 share/test/src/mad/mad_echo.sh delete mode 100644 share/test/src/nebula/log.cc delete mode 100644 share/test/src/pool/TestSQL.cc delete mode 100644 share/test/src/template/ATTest.cc delete mode 100644 share/test/src/template/vm.template delete mode 100644 share/test/src/vm/TestVMPool.cc delete mode 100644 share/test/src/vmm/VMManager.cc diff --git a/share/test/do_tests.sh b/share/test/do_tests.sh index 17238f2220..7e07fee314 100755 --- a/share/test/do_tests.sh +++ b/share/test/do_tests.sh @@ -1,8 +1,23 @@ #!/bin/bash #------------------------------------------------------------------------------- -# COMMAND LINE PARSING +# DEFINE THE TESTS #------------------------------------------------------------------------------- +TWD_DIR="../../src" +BASE_DIR=$PWD +TESTS="$TWD_DIR/vnm/test \ + $TWD_DIR/scheduler/src/xml/test \ + $TWD_DIR/scheduler/src/pool/test \ + $TWD_DIR/hm_mad/test \ + $TWD_DIR/common/test \ + $TWD_DIR/host/test \ + $TWD_DIR/template/test \ + $TWD_DIR/image/test \ + $TWD_DIR/authm/test \ + $TWD_DIR/vm/test \ + $TWD_DIR/um/test \ + $TWD_DIR/lcm/test \ + $TWD_DIR/pool/test" #------------------------------------------------------------------------------- # COMMAND LINE PARSING @@ -38,8 +53,6 @@ LOGS="no" CLEAR="no" BUILD="no" -TWD_DIR="../../src" -BASE_DIR=$PWD while true ; do case "$1" in diff --git a/share/test/one.db b/share/test/one.db deleted file mode 100644 index e87cb27baef992c60f8371372f069b421a8462a3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 19457 zcmeHP3w)eamA{WkZZgSalBVep#x&EWK)OjL^U5Sq3JuK=YMZvC0ZNe#)66s(I*%}q zHsRq~L_}EmkVO;}0Y%ZeAiBCNZxrOAw1TXxyTH0D$igZJEa(DiJ?Gx}9+RXG$kN|} znICDsd*(&Hhds-2X6%ArXuB0Bf z*ahSy7NjrId+E37$4G{Dk{8IGB8BwjP0*4qYXPLM^XKelUL+o(Lnp^!M=gW ziq2$aG@9%LF`cnYDw;^=@VO(NA06+^?TAhwn)bo<{gD+r`WMXL;y(y3u|#g0g$tV^ zRrOA^g1@sCZNT1!4V-8LrflH%wbh^v*g@LBA+T-i{$QX$?1gO$k(tJ*kvq4e@3^{h2(Z1&h>Me zeF3FSCsOKm*&yYp4~d>tNF<}akY(9T$F~%c(av0Uv~znZ)tQgy@}1kGSwdhP9?9j# zV}(>|3QCv9uzq<=!P-=5VP51-=f=FK?-><3=LSgC6n`k8McBau!=^gyG?aA!_(J&E zMG*Qf^+Zk=rUYO<;ETmcos^|C7=03dP{L+rl^~J-A4ovXU>0iOtys^Ix8h4M{>$lOgkQt^+4Jl| z)&Y(A&wJMbn`=uvMP^<0j+57(Yi~KcO0C! zp~hXc{(~YmJFF5^1kGK71W!(>w(u?n=iGQJz9d?uGsg8(<*Yd_ageMY(|=HkgZoJp zjc|Sg|0zF{oyXo_chCsyXI1nbdLeD4twk(<;lKC|q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c9XaI`eD8_nz6~C2rv^6=2mz8~Vpf4)X7N9RlN%E{%d` -#include - -class AMTest : public ActionListener -{ -public: - AMTest():am() - { - am.addListener(this); - }; - - ~AMTest(){}; - - ActionManager am; - -private: - void do_action(const string &action, void * arg); -}; - -void AMTest::do_action(const string &action, void * arg) -{ - int * i = static_cast(arg); - - cout<<"Event received: "< (arg); - - MT->am.trigger(event,&i); - - sleep(4); - - i = 10; - - MT->am.trigger(event,&i); - - i = 23; - - MT->am.trigger(ActionListener::ACTION_FINALIZE,&i); - - return 0; -} -/* -int main() -{ - pthread_t id; - int i = 3; - AMTest * MT = new AMTest(); - - pthread_create(&id, 0, startThread, MT); - - MT->am.loop(1,&i); - - delete MT; - - pthread_join(id,0); - - return 0; -} -*/ diff --git a/share/test/src/host/TestHostPool.cc b/share/test/src/host/TestHostPool.cc deleted file mode 100644 index 32116e5008..0000000000 --- a/share/test/src/host/TestHostPool.cc +++ /dev/null @@ -1,252 +0,0 @@ -#include "VirtualMachine.h" -#include "VirtualMachineManagerDriver.h" -#include "Nebula.h" - -#include "InformationManagerDriver.h" -#include "InformationManager.h" -#include "Mad.h" - -#include "Host.h" -#include "HostPool.h" - - - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include - -extern "C" void *test(void *nothing) -{ - ostringstream os; - - sleep(2); - os.str(""); - - int rc; - - Nebula & pn = Nebula::instance(); - - HostPool * thepool = pn.get_hpool(); - Host * host; - int hid; - - thepool->bootstrap(); - - thepool->allocate(&hid,"foo.dacya","mad1","mad2","mad3",true); - - os.str(""); - os << "Host " << hid << " allocated"; - Nebula::log("TST", Log::ERROR, os); - - thepool->allocate(&hid,"foo2.dacya","mad1","mad2","mad3",true); - - os.str(""); - os << "Host " << hid << " allocated"; - Nebula::log("TST", Log::ERROR, os); - - thepool->allocate(&hid,"foo3.dacya","mad1","mad2","mad3",true); - - os.str(""); - os << "Host " << hid << " allocated"; - Nebula::log("TST", Log::ERROR, os); - - host = static_cast(thepool->get(3422,false)); - - if (host != 0) - { - os.str(""); - os << "Test failed. Shouldn't be here."; - Nebula::log("TST", Log::ERROR, os); - } - - host = static_cast(thepool->get(0,true)); - - if (host != 0) - { - os.str(""); - os << "Going fine. Host " << *host << " retrieved."; - Nebula::log("TST", Log::ERROR, os); - - host->unlock(); - } - else - { - os.str(""); - os << "Test failed!. Not able to retrieve host 0"; - Nebula::log("TST", Log::ERROR, os); - } - - - Host * host2 = static_cast(thepool->get(1,false)); - - if (host2 != 0) - { - os.str(""); - os << "Going fine. Host " << *host2 << " retrieved."; - Nebula::log("TST", Log::ERROR, os); - } - - Host * host3 = static_cast(thepool->get(2,false)); - - if (host3 != 0) - { - os.str(""); - os << "Going fine. Host " << *host3 << " retrieved."; - Nebula::log("TST", Log::ERROR, os); - - } - - - Host * host4 = static_cast(thepool->get(32,false)); - - - if (host4 != 0) - { - os.str(""); - os << "Going fine. Host " << *host4 << " retrieved."; - Nebula::log("TST", Log::ERROR, os); - - } - - host3->lock(); - - string host_info_str("cpuArchitecture=x86_32\nnumberCores=1\ncpuSpeed=2211\ntotalMemory=2046\nfreeMemory=125\nusedMemory=1921\ncpupercentage=50\nnetTX=78516\nnetRX=138612\nnetRX=138612\n"); - rc = host3->update_info(host_info_str); - - host3->touch(); - - - os.str(""); - os << "updated host info with RC = " << rc; - Nebula::log("TST", Log::ERROR, os); - - rc = thepool->update_host(host3); - - os.str(""); - os << "updated host into DB with RC = " << rc; - Nebula::log("TST", Log::ERROR, os); - - bool result; - char * error; - - rc = host3->match("numberCores=1 & cpuArchitecture=\"OTRA ARCH\"",result,&error); - - os.str(""); - if ( rc == 0) - { - os << "REQ result = " << result; - } - else - { - os << "REQ error = " << error; - - free(error); - } - Nebula::log("TST", Log::ERROR, os); - - int resulti; - - rc = host3->rank("cpuSpeed + numberCores",resulti,&error); - - os.str(""); - if ( rc == 0) - { - os << "RANK result = " << resulti; - } - else - { - os << "RANK error = " << error; - - free(error); - } - Nebula::log("TST", Log::ERROR, os); - - host3->unlock(); - - host3->lock(); - - string host_info_str2("cpuArchitecture=\"OTRA ARCH\"\n"); - - rc = host3->update_info(host_info_str2); - - host3->touch(); - - rc = thepool->update_host(host3); - - host3->unlock(); - - - host2->lock(); - - string host_info_str3("cpuArchitecture=x86_32\nnumberCores=8\ncpuSpeed=2211\ntotalMemory=2046\nfreeMemory=125\nusedMemory=1921\ncpupercentage=50\nnetTX=78516\nnetRX=138612\nnetRX=138612\n"); - - rc = host2->update_info(host_info_str3); - - host2->touch(); - - rc = thepool->update_host(host2); - - host2->unlock(); - - map test_discover; - - rc = thepool->discover(&test_discover); - - if(rc!=0) - { - os.str(""); - os << "Error discovering hosts."; - Nebula::log("TST", Log::ERROR, os); - } - - os.str(""); - os << "Discover size:" << test_discover.size(); - Nebula::log("TST", Log::ERROR, os); - - map ::iterator it; - - for(it=test_discover.begin();it!=test_discover.end();it++) - { - os.str(""); - os << "IM_MAD:" << it->second << " has to monitor " << it->first; - Nebula::log("TST", Log::ERROR, os); - } - - return 0; -} - - - -int main() -{ - pthread_t test_thread; - - pthread_create(&test_thread,0,test,(void *)0); - - try - { - Nebula& nd = Nebula::instance(); - nd.start(); - } - catch (exception &e) - { - cout << e.what() << endl; - - return -1; - } - - - return 0; -} diff --git a/share/test/src/im/ImTest.cc b/share/test/src/im/ImTest.cc deleted file mode 100644 index e7f12400b7..0000000000 --- a/share/test/src/im/ImTest.cc +++ /dev/null @@ -1,98 +0,0 @@ -/* -------------------------------------------------------------------------- */ -/* Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ -/* not use this file except in compliance with the License. You may obtain */ -/* a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ -/* See the License for the specific language governing permissions and */ -/* limitations under the License. */ -/* -------------------------------------------------------------------------- */ - -#include "VirtualMachine.h" -#include "VirtualMachineManagerDriver.h" -#include "Nebula.h" - -#include "InformationManagerDriver.h" -#include "InformationManager.h" -#include "Mad.h" - - - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -using namespace std; - - -extern "C" void *test(void *nothing) -{ - sleep(2); - - Nebula& pn = Nebula::instance(); - - InformationManager * im = pn.get_im(); - HostPool * hostp = pn.get_hpool(); - - int * oid; - int rc; - - sleep(2); - - /* rc = hostp->allocate(oid,"aquila03","im_test","xen_ssh","dummy",true); - - if ( rc != 0 ) - { - Nebula::log("TST",Log::ERROR,"Error allocating host!"); - return 0; - } -*/ - - im->load_mads(); - - sleep(600); - - return 0; -} - -int main() -{ - pthread_attr_t pattr; - pthread_t test_thread; - - pthread_attr_init (&pattr); - pthread_attr_setdetachstate (&pattr, PTHREAD_CREATE_JOINABLE); - - pthread_create(&test_thread,&pattr,test,(void *)0); - - try - { - Nebula& nd = Nebula::instance(); - nd.start(); - } - catch (exception &e) - { - cout << e.what() << endl; - - return -1; - } - - - return 0; -} - diff --git a/share/test/src/mad/MMTest.cc b/share/test/src/mad/MMTest.cc deleted file mode 100644 index 1694209388..0000000000 --- a/share/test/src/mad/MMTest.cc +++ /dev/null @@ -1,188 +0,0 @@ -#include -#include -#include - -#include - -#include "MadManager.h" - -pthread_cond_t cond = PTHREAD_COND_INITIALIZER; -pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; -bool finalized = false; - -class MadEcho : public Mad -{ -public: - MadEcho(map &attrs):Mad(0,attrs,false) - {} - ; - - ~MadEcho() - {} - ; - - void protocol(string& message); - - void recover() - { - cout<<"Recover Function @ MadEcho\n"; - }; - - void test(const char *a1, const char *a2, const char *a3) - { - ostringstream buf; - - buf << "TEST " << a1 << " " << a2 << " " << a3 << "\n"; - - write(buf); - } - - void first(const char *a1) - { - ostringstream buf; - - buf << "FIRST " << a1 << "\n"; - - write(buf); - } -}; - -void MadEcho::protocol(string& message) -{ - stringbuf sbuf(message); - iostream sstr(&sbuf); - - string field[5]; - - sstr >> field[0] >> ws; - - if ( field[0] == "INIT" ) - { - getline(sstr,field[1]); - - cout << "Init Result: " << field[1] << "\n"; - } - else if ( field[0] == "FINALIZE" ) - { - getline(sstr,field[1]); - - cout << "Finalize Result: " << field[1] << "\n"; - } - else if ( field[0] == "TEST" ) - { - sstr >> field[1] >> field[2] >> field[3] >> ws; - - getline(sstr,field[4]); - - cout << "Test Result: " << field[1] << "\nArg1: " << field[2] - << "\nArg2: " << field[3] << "\nInfo: " << field[4] << "\n"; - } - else if ( field[0] == "FIRST" ) - { - finalized = true; - - sstr >> field[1] >> ws; - getline(sstr,field[2]); - - cout << "First Result: " << field[1] << "\nArg1: " << field[2] << "\n"; - - pthread_cond_signal(&cond); - } -} - -class MMadManager : public MadManager -{ -public: - MMadManager(vector& _mads):MadManager(_mads){}; - ~MMadManager(){}; - - void load_mads(int uid){}; - - int mstart(){ - return start(); - } - - void mstop(){ - stop(); - } - - int madd(Mad *mad){ - return add(mad); - } -}; - -int main() -{ - vector _mads; - MMadManager *mm; - MadEcho * mad_echo; - map attrs; - int rc; - - MadManager::mad_manager_system_init(); - - mm = new MMadManager(_mads); - - rc = mm->mstart(); - - if ( rc != 0 ) - { - goto error_start; - } - - attrs.insert(make_pair("NAME","echo_mad")); - attrs.insert(make_pair("EXECUTABLE","./mad_echo.sh")); - attrs.insert(make_pair("OWNER","foo")); - - mad_echo = new MadEcho(attrs); - /* - rc = mad_echo->start(); - - if ( rc != 0 ) - { - goto error_start_mad; - } - */ - rc = mm->madd(mad_echo); - - if ( rc != 0 ) - { - goto error_register; - } - - mad_echo->test("argument1","argument2","argument3"); - - mad_echo->first("filed1"); - - pthread_mutex_lock(&mutex); - - while ( finalized == false ) - { - pthread_cond_wait(&cond, &mutex); - } - - printf("Mad_Test - OK\n"); - - mm->mstop(); - - delete mm; - - return 0; - -error_register: - cout << "Mad_Test - error register mad\n"; - mm->mstop(); - - delete mm; - delete mad_echo; - - return -1; - -error_start: - cout << "Mad_Test - error start manager\n"; - mm->mstop(); - - delete mm; - - return -1; -} diff --git a/share/test/src/mad/mad_echo.sh b/share/test/src/mad/mad_echo.sh deleted file mode 100755 index 0092ea27a7..0000000000 --- a/share/test/src/mad/mad_echo.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -# -------------------------------------------------------------------------- -# Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -------------------------------------------------------------------------- - -echo "MAD started" > mad.log - - -while read COMMAND ARG1 ARG2 ARG3 -do - echo "$COMMAND $ARG1 $ARG2 $ARG3" >> mad.log - case $COMMAND in - "INIT" | "init") - echo "INIT SUCCESS" - ;; - "FINALIZE" | "finalize") - echo "FINALIZE SUCCESS" - exit 0 - ;; - "TEST" | "test") - echo "TEST SUCCESS $ARG1 $ARG2 $ARG3" - ;; - "FIRST" | "first") - echo "FIRST SUCCESS $ARG1" - ;; - *) - echo "$COMMAND - FAILURE Unknown command" - ;; - esac -done diff --git a/share/test/src/nebula/log.cc b/share/test/src/nebula/log.cc deleted file mode 100644 index 6121ac8e63..0000000000 --- a/share/test/src/nebula/log.cc +++ /dev/null @@ -1,15 +0,0 @@ -#include "Log.h" -#include - -int main() -{ - Log log("file.log"); - - ostringstream message; - message << "pepe"; - - log.log("module", Log::ERROR, message); - - return 0; -} - diff --git a/share/test/src/pool/TestSQL.cc b/share/test/src/pool/TestSQL.cc deleted file mode 100644 index b06795814b..0000000000 --- a/share/test/src/pool/TestSQL.cc +++ /dev/null @@ -1,173 +0,0 @@ -#include "PoolSQL.h" -#include -#include -#include -#include - -class A : public ObjectSQL -{ -public: - A(int n,string &t):number(n),text(t){oid=n;}; - A(int n,const char *t):number(n),text(t){oid=n;}; - A(int n):number(n){oid=n;}; - A(){}; - ~A(){}; - - int number; - string text; - - int insert(sqlite3 *db); - int select(sqlite3 *db); - int update(sqlite3 *db){return 0;}; -}; - -int A::insert(sqlite3 *db) -{ - const char * sql_cmd; - ostringstream buffer; - string sql; - int rc; - - buffer << "INSERT INTO test (numero,texto) VALUES (" << oid << ",\"" << -text << "\")"; - - sql = buffer.str(); - sql_cmd = sql.c_str(); - - rc = sqlite3_exec(db, - sql_cmd, - NULL, - NULL, - NULL); - - if ( rc != SQLITE_OK ) - { - cout << "ERROR : "<text = values[1]; - - cout << "-" << aclass->text << "-\n"; - - return 0; -} - -int A::select(sqlite3 *db){ - - const char * sql_cmd; - ostringstream buffer; - string sql; - - buffer << "SELECT * FROM test WHERE numero=" << oid; - - - sql = buffer.str(); - sql_cmd = sql.c_str(); - - sqlite3_exec(db, - sql_cmd, - select_cb, - this, - NULL); - - return 0; -}; - -class Apool : public PoolSQL -{ -public: - Apool(sqlite3 *db):PoolSQL(db,"test"){}; - ~Apool(){}; -private: - ObjectSQL* create(){ return (new A);}; - -}; - - -/* -int main() -{ - sqlite3 * db; - - sqlite3_open("pool.db", &db); - - sqlite3_exec(db, - "CREATE TABLE test (numero INTEGER," - "texto TEXT)", - NULL, - NULL, - NULL); - - - A *a; - Apool apool(db); - - - a = new A(-1,"prueba"); - - apool.allocate(a); - - a = new A(4,"otro"); - - apool.allocate(a); - - a = new A(8,"otro mas"); - - apool.allocate(a); - - A * aobj = static_cast(apool.get(1,false)); - - cout << aobj->text << "\n"; - - delete aobj; - - aobj = static_cast(apool.get(0,false)); - - cout << aobj->text << "\n"; - - delete aobj; - - sqlite3_close(db); -} -*/ - -/* -int main() -{ - sqlite3 * db; - string s("HOLA"); - A test(8,s); - A otro(8); - - sqlite3_open("pool.db", &db); - - sqlite3_exec(db, - "CREATE TABLE test (numero INTEGER," - "texto TEXT)", - NULL, - NULL, - NULL); - - test.insert(db); - - otro.select(db); - - cout << "texto : " << otro.text; - - sqlite3_close(db); -}*/ diff --git a/share/test/src/template/ATTest.cc b/share/test/src/template/ATTest.cc deleted file mode 100644 index a66ff43a66..0000000000 --- a/share/test/src/template/ATTest.cc +++ /dev/null @@ -1,122 +0,0 @@ -#include "VirtualMachineTemplate.h" -#include -#include -#include - - -int main() -{ - VirtualMachineTemplate tmp; - Template t; - - char *error; - string st("MEMORY=345\nCPU=4\nDISK=[FILE=\"img\",TYPE=cd]\nDISK=[FILE=\"../f\"]\n"); - - - ostringstream os; - - if ((tmp.parse("vm.template",&error) != 0 ) && - (error != 0)) - { - cout << "Error parsing file: "<< error << endl; - - free(error); - } - - string mrs; - - tmp.marshall(mrs,':'); - - cout << "-" << mrs << "-"; - - if ((t.parse(st,&error) != 0 ) && - (error != 0)) - { - cout << "Error parsing string: "<< error << endl; - - free(error); - } - cout << "TEMPLATE" << endl << t << endl; - cout << "------" << endl << endl; - cout << "TEMPLATE" << endl << tmp << endl; - - string mm("MEMORY"); - vector values; - - tmp.get(mm,values); - - const SingleAttribute *pmemo; - - pmemo = static_cast(values[0]); - - cout << "MEM = " << pmemo->value() << "\n"; - - cout << "TEMPLATE--" << endl << t << endl; - - // ---- Init template DB ---- - /* - - sqlite3 * db; - sqlite3_open("template.db", &db); - - sqlite3_exec(db, - "CREATE TABLE vm_template (id INTEGER," - "name TEXT, value TEXT)", - 0, - 0, - 0); - - cout << tmp.insert(db) << endl; - - VirtualMachineTemplate rtmp(2); - - rtmp.select(db); - - cout << endl << "FROM DB" << endl << rtmp; - - sqlite3_close(db); - - */ - return 0; -} - - -/* -int main() -{ - TemplateAttribute sa1("ejemplo","valor"); - TemplateAttribute sa2("sample","value"); -// Attribute * pa; -// Attribute * pa2; - - cout << sa1.name() << ":" << sa1.value() << "\n"; - cout << sa2.name() << ":" << sa2.value() << "\n"; - - - cout << sa2.name() << ":" << sa2.value() << "\n"; - - - - - //map mymap; - //TemplateAttribute * pta; - - - - //pa = new TemplateAttribute("ejemplo","valor"); - - //cout << str_attr.name(); - //cout << pa->name(); - - //pta = static_cast *> (pa); - - //cout << pa->name(); - - //mymap.insert(make_pair("cadena",pa)); - - //delete pa; - - return 0; -} -*/ - diff --git a/share/test/src/template/vm.template b/share/test/src/template/vm.template deleted file mode 100644 index 171190715d..0000000000 --- a/share/test/src/template/vm.template +++ /dev/null @@ -1,8 +0,0 @@ -MEMORY = 512 -Cpu = 1 - -DISK = [ ImaGE="/local/VM/disk.img",device="sda",TYPE="hd" ] -DISK = [ image="../debian.iso",DEvice="sdb",TYPE="cdrom" ] - -nic = [ MAC="00:01:02", TYPE="bridged", IP="147.3"] - diff --git a/share/test/src/vm/TestVMPool.cc b/share/test/src/vm/TestVMPool.cc deleted file mode 100644 index 8b279fb118..0000000000 --- a/share/test/src/vm/TestVMPool.cc +++ /dev/null @@ -1,74 +0,0 @@ -#include "VirtualMachinePool.h" -#include -#include -#include -#include - -int main() -{ - sqlite3 * db; - - sqlite3_open("pool.db", &db); - - VirtualMachinePool thepool(db); - VirtualMachine * vm; - int eid; - string st("MEMORY=345\nCPU=4\nDISK=[FILE=\"img\",TYPE=cd]\nDISK=[FILE=\"../f\"]\n"); - - thepool.bootstrap(); - - thepool.allocate(0,st,&eid); - cout << eid << endl; - - thepool.allocate(0,st,&eid); - cout << eid << endl; - - thepool.allocate(0,st,&eid); - cout << eid << endl; - - vm = static_cast(thepool.get(444,false)); - - if (vm != 0) - { - cout << *vm; - } - - vm = static_cast(thepool.get(1,true)); - - string vmm = "xen"; - string tm = "gridftp"; - - //vm->add_history(2,2,vmm,tm); - - //thepool.update_history(vm); - - if (vm != 0) - { - cout << *vm << endl; - - vm->unlock(); - } - else - { - cout << "VM es cero!" << endl; - } - - VirtualMachine * vm2 = static_cast(thepool.get(2,false)); - - if (vm2 != 0) - { - - cout << *vm2; - } - - VirtualMachine * vm3 = static_cast(thepool.get(3,true)); - - if (vm3 != 0) - { - cout << *vm3; - - vm3->unlock(); - } - - sqlite3_close(db); -} diff --git a/share/test/src/vmm/VMManager.cc b/share/test/src/vmm/VMManager.cc deleted file mode 100644 index 74dc2a14a0..0000000000 --- a/share/test/src/vmm/VMManager.cc +++ /dev/null @@ -1,56 +0,0 @@ - -#include - -#include "Nebula.h" -#include -#include -#include "VirtualMachine.h" -#include "VirtualMachineManagerDriver.h" - -extern "C" void *test(void *nothing) -{ - VirtualMachineManager *vm_manager; - InformationManager *im_manager; - Nebula& ne = Nebula::instance(); - string s_template; - ostringstream os; - - sleep(20); - - Nebula::log("TST", Log::INFO, "Alive!"); - - vm_manager = ne.get_vmm(); - vm_manager->load_mads(0); - - im_manager = ne.get_im(); - im_manager->load_mads(0); - - return 0; -} - -int main() -{ - pthread_attr_t pattr; - pthread_t test_thread; - - pthread_attr_init (&pattr); - pthread_attr_setdetachstate (&pattr, PTHREAD_CREATE_JOINABLE); - - pthread_create(&test_thread,&pattr,test,(void *)0); - - try - { - Nebula& nd = Nebula::instance(); - nd.start(); - } - catch (exception &e) - { - cout << e.what() << endl; - - return -1; - } - - - return 0; -} -