|
From: Teiniker E. <tei...@us...> - 2007-01-18 10:13:01
|
Update of /cvsroot/ccmtools/ccmtools/test/manual/HelloWorld/impl In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv449/test/manual/HelloWorld/impl Added Files: Server_hello_impl.cc _check_world_Server.cc Log Message: Refactored test directory --- NEW FILE: Server_hello_impl.cc --- /** * This file was automatically generated by CCM Tools * <http://ccmtools.sourceforge.net/> * * world::Hello facet class implementation. * * // TODO: WRITE YOUR DESCRIPTION HERE! * * @author * @version **/ #include <cassert> #include <iostream> #include "Server_hello_impl.h" namespace world { Server_hello_impl::Server_hello_impl(Server_impl* component_impl) : component(component_impl) { // OPTIONAL : IMPLEMENT ME HERE ! } Server_hello_impl::~Server_hello_impl() { // OPTIONAL : IMPLEMENT ME HERE ! } std::string Server_hello_impl::sayHello() throw(Components::CCMException) { return "Hello from Server component!"; } } // /namespace world --- NEW FILE: _check_world_Server.cc --- /*** * CCM Tools Test Client * * This file was automatically generated by CCM Tools * <http://ccmtools.sourceforge.net/> * * This test client is part of the mirror component test concept. For each * component a corresponding mirror component will be instantiated. * All component ports will be connected to the mirror component's ports. * Additionally, developers can add some testing code to validate supported * interfaces as well as component attribute access. ***/ #include <cassert> #include <iostream> #include <Components/ccmtools.h> #include <world/ServerHome_gen.h> using namespace std; using namespace world; int main(int argc, char *argv[]) { cout << ">>>> Start Test Client: " << __FILE__ << endl; int error = 0; error = deploy_world_ServerHome("ServerHome"); if(error) { cerr << "BOOTSTRAP ERROR: Can't deploy component homes!" << endl; return(error); } try { Components::HomeFinder* homeFinder = Components::HomeFinder::Instance(); ServerHome::SmartPtr home(dynamic_cast<ServerHome*>( homeFinder->find_home_by_name("ServerHome").ptr())); Server::SmartPtr component; Hello::SmartPtr hello; component = home->create(); hello = component->provide_hello(); component->configuration_complete(); string s = hello->sayHello(); cout << "sayHello(): " << s << endl; assert(s == "Hello from Server component!"); component->remove(); } catch(Components::HomeNotFound& e) { cerr << "DEPLOYMENT ERROR: can't find a home!" << endl; error = -1; } catch(Components::NotImplemented& e) { cerr << "DEPLOYMENT ERROR: function not implemented: " << e.what ( ) << endl; error = -1; } catch(Components::InvalidName& e) { cerr << "DEPLOYMENT ERROR: invalid name during connection: " << e.what ( ) << endl; error = -1; } catch ( ... ) { cerr << "DEPLOYMENT ERROR: there is something wrong!" << endl; error = -1; } error += undeploy_world_ServerHome("ServerHome"); if(error) { cerr << "TEARDOWN ERROR: Can't undeploy component homes!" << endl; return error; } Components::HomeFinder::destroy(); cout << ">>>> Stop Test Client: " << __FILE__ << endl; } |