ConfigurationProxyTests.cpp
Go to the documentation of this file.
00001 // -*- C++ -*-
00012 /*
00013  * $Log$
00014  *
00015  */
00016 
00017 #ifndef ConfigurationProxy_cpp
00018 #define ConfigurationProxy_cpp
00019 
00020 #include <cppunit/ui/text/TestRunner.h>
00021 #include <cppunit/TextOutputter.h>
00022 #include <cppunit/extensions/TestFactoryRegistry.h>
00023 #include <cppunit/extensions/HelperMacros.h>
00024 #include <cppunit/TestAssert.h>
00025 #include <string>
00026 #include <iostream>
00027 #include <idl/SDOPackageSkel.h>
00028 #include <idl/RTCSkel.h>
00029 #include <ConfigurationProxy.h>
00030 #include <rtm/NVUtil.h>
00031 #include <ISDOService.h>
00032 #include <ISDOSystemElement.h>
00033 #include <IOrganization.h>
00034 #include <doil/corba/CORBAManager.h>
00035 
00036 
00041 namespace ConfigurationProxy
00042 {
00043   class Logger
00044   {
00045   public:
00046     void log(const std::string& msg)
00047     {
00048       m_log.push_back(msg);
00049     }
00050 
00051     int countLog(const std::string& msg)
00052     {
00053       int count = 0;
00054       for (int i = 0; i < (int) m_log.size(); ++i)
00055         {
00056           if (m_log[i] == msg) ++count;
00057         }
00058      return count;
00059     }
00060                 
00061   private:
00062     std::vector<std::string> m_log;
00063   };
00064 
00071   class OrganizationServantMock
00072    : public virtual ::POA_SDOPackage::Organization,
00073      public virtual ::doil::CORBA::CORBAServantBase
00074   {
00075   public:
00076     OrganizationServantMock(doil::ImplBase* impl)
00077     : ::doil::CORBA::CORBAServantBase(impl), m_impl(NULL) 
00078     {
00079       m_impl = dynamic_cast< ::SDOPackage::Local::IOrganization* >(impl);
00080     }
00081     virtual ~OrganizationServantMock(){}
00082     virtual char* get_organization_id(){return "OrganizationServantMock";}
00083     virtual ::SDOPackage::OrganizationProperty* get_organization_property()
00084     {
00085       ::SDOPackage::OrganizationProperty_var ret 
00086                             = new ::SDOPackage::OrganizationProperty ();
00087       return ret._retn();
00088     }
00089     virtual ::CORBA::Any* get_organization_property_value(const char* name)
00090     {
00091         CORBA::Any_var value;
00092         value = new CORBA::Any();
00093         return value._retn();
00094 //      return new ::CORBA::Any();
00095     }
00096     virtual ::CORBA::Boolean set_organization_property(
00097           const ::SDOPackage::OrganizationProperty& organization_property)
00098     {
00099         return true;
00100     }
00101     virtual ::CORBA::Boolean set_organization_property_value(
00102           const char* name, const CORBA::Any& value)
00103     {
00104         return true;
00105     }
00106     virtual ::CORBA::Boolean remove_organization_property(const char* name)
00107     {
00108         return true;
00109     }
00110     virtual ::SDOPackage::SDOSystemElement_ptr get_owner()
00111     {
00112         return m_varOwner._retn();
00113     }
00114     virtual ::CORBA::Boolean set_owner(
00115           ::SDOPackage::SDOSystemElement_ptr sdo)
00116     { 
00117         return true; 
00118     }
00119     virtual ::SDOPackage::SDOList* get_members()
00120     {
00121 //        ::SDOPackage::SDOList* ret = new ::SDOPackage::SDOList ();
00122 //      return ret;
00123         ::SDOPackage::SDOList_var sdos;
00124         sdos = new ::SDOPackage::SDOList(m_memberList);
00125         return sdos._retn();
00126     }
00127     virtual CORBA::Boolean set_members(
00128           const ::SDOPackage::SDOList& sdos)
00129     {
00130         m_memberList = sdos;
00131         return true;
00132     }
00133     virtual CORBA::Boolean add_members(
00134           const ::SDOPackage::SDOList& sdo_list)
00135     {
00136         return true; 
00137     }
00138     virtual CORBA::Boolean remove_member(const char* id){return true;}
00139     virtual ::SDOPackage::DependencyType get_dependency()
00140     {
00141         return m_dependency;
00142     }
00143     virtual CORBA::Boolean set_dependency(
00144           ::SDOPackage::DependencyType dependency) 
00145     { 
00146         m_dependency = dependency;
00147         return true; 
00148     }
00149 
00150 
00151   private:
00152     ::SDOPackage::Local::IOrganization* m_impl;
00153     ::SDOPackage::SDOSystemElement_var m_varOwner;
00154     ::SDOPackage::DependencyType m_dependency;
00155     ::SDOPackage::SDOList m_memberList;
00156   };
00157 
00163   class ISDOServiceServantMock
00164    : public virtual ::POA_SDOPackage::SDOService,
00165      public virtual ::doil::CORBA::CORBAServantBase
00166   {
00167   public:
00168     ISDOServiceServantMock(doil::ImplBase* impl)
00169     : ::doil::CORBA::CORBAServantBase(impl)
00170     {
00171       m_impl = dynamic_cast< ::SDOPackage::Local::ISDOService* >(impl);
00172     }
00173     virtual ~ISDOServiceServantMock(){}
00174 
00175 
00176   private:
00177     ::SDOPackage::Local::ISDOService* m_impl;
00178   };
00184   class ISDOServiceMock
00185     : public virtual ::SDOPackage::Local::ISDOService
00186   {
00187   public:
00188     ISDOServiceMock()
00189       : m_refcount(0)
00190     {}
00191     virtual ~ISDOServiceMock(){}
00192     const char* id() {return "ISDOServiceMock";}
00193     const char* name() {return "ISDOServiceMock";}
00194     void incRef()
00195     {
00196       ++m_refcount;
00197     }
00198     void decRef()
00199     {
00200       --m_refcount;
00201       if (m_refcount == 0)
00202         delete this;
00203     }
00204 
00205   private:
00206     std::string m_name;
00207     int m_refcount;
00208   };
00214   class IOrganizationMock
00215     : public virtual ::SDOPackage::Local::IOrganization
00216   {
00217   public:
00218     IOrganizationMock()
00219       : m_refcount(0)
00220     {}
00221     virtual ~IOrganizationMock(){}
00222 
00223     virtual ::std::string get_organization_id()
00224       throw (::SDOPackage::Local::InvalidParameter,
00225              ::SDOPackage::Local::NotAvailable,
00226              ::SDOPackage::Local::InternalError)
00227     {
00228         return "IOrganizationMock";
00229     }
00230 
00231     virtual ::SDOPackage::Local::OrganizationProperty get_organization_property()
00232       throw (::SDOPackage::Local::NotAvailable,
00233              ::SDOPackage::Local::InternalError)
00234     {
00235        ::SDOPackage::Local::OrganizationProperty ret;
00236        return ret;
00237     }
00238 
00239     virtual ::std::string get_organization_property_value(const ::std::string& name)
00240       throw (::SDOPackage::Local::InvalidParameter,
00241              ::SDOPackage::Local::NotAvailable,
00242              ::SDOPackage::Local::InternalError)
00243     {
00244         return "IOrganizationMock";
00245     }
00246     virtual bool set_organization_property(const ::SDOPackage::Local::OrganizationProperty& organization_property)
00247       throw (::SDOPackage::Local::InvalidParameter,
00248              ::SDOPackage::Local::NotAvailable,
00249              ::SDOPackage::Local::InternalError)
00250     {
00251         return true;       
00252     }
00253 
00254     virtual bool set_organization_property_value(const ::std::string&name, const ::std::string& value)
00255       throw (::SDOPackage::Local::InvalidParameter,
00256              ::SDOPackage::Local::NotAvailable,
00257              ::SDOPackage::Local::InternalError)
00258     {
00259         return true;       
00260     }
00261 
00262     virtual bool remove_organization_property(const ::std::string& name)
00263       throw (::SDOPackage::Local::InvalidParameter,
00264              ::SDOPackage::Local::NotAvailable,
00265              ::SDOPackage::Local::InternalError)
00266     {
00267         return true;       
00268     }
00269 
00270     virtual ::SDOPackage::Local::ISDOSystemElement* get_owner()
00271       throw (::SDOPackage::Local::NotAvailable,
00272              ::SDOPackage::Local::InternalError)
00273     {
00274         return NULL;
00275     }
00276 
00277     virtual bool set_owner(const ::SDOPackage::Local::ISDOSystemElement* sdo)
00278       throw (::SDOPackage::Local::InvalidParameter,
00279              ::SDOPackage::Local::NotAvailable,
00280              ::SDOPackage::Local::InternalError)
00281     {
00282         return true;
00283     }
00284 
00285     virtual ::SDOPackage::Local::SDOList get_members()
00286       throw (::SDOPackage::Local::NotAvailable,
00287              ::SDOPackage::Local::InternalError)
00288     {
00289         ::SDOPackage::Local::SDOList ret; 
00290         return ret;
00291     }
00292 
00293     virtual bool set_members(const ::SDOPackage::Local::SDOList& sdos)
00294       throw (::SDOPackage::Local::InvalidParameter,
00295              ::SDOPackage::Local::NotAvailable,
00296              ::SDOPackage::Local::InternalError)
00297     {
00298         return true;
00299     }
00300 
00301     virtual bool add_members(const ::SDOPackage::Local::SDOList& sdo_list)
00302       throw (::SDOPackage::Local::InvalidParameter,
00303              ::SDOPackage::Local::NotAvailable,
00304              ::SDOPackage::Local::InternalError)
00305     {
00306         return true;
00307     }
00308 
00309     virtual bool remove_member(const ::std::string& id)
00310       throw (::SDOPackage::Local::InvalidParameter,
00311              ::SDOPackage::Local::NotAvailable,
00312              ::SDOPackage::Local::InternalError)
00313     {
00314         return true;
00315     }
00316 
00317     virtual ::SDOPackage::Local::DependencyType get_dependency()
00318       throw (::SDOPackage::Local::NotAvailable,
00319              ::SDOPackage::Local::InternalError)
00320     {
00321         return m_dependency;
00322     }
00323 
00324     virtual bool set_dependency(::SDOPackage::Local::DependencyType dependency)
00325       throw (::SDOPackage::Local::NotAvailable,
00326              ::SDOPackage::Local::InternalError)
00327     {
00328         m_dependency = dependency;
00329         return true;
00330     }
00331 
00332 
00333     const char* id() {return "IOrganizationMock";}
00334     const char* name() {return "IOrganizationMock";}
00335     void incRef()
00336     {
00337       ++m_refcount;
00338     }
00339     void decRef()
00340     {
00341       --m_refcount;
00342       if (m_refcount == 0)
00343         delete this;
00344     }
00345 
00346   private:
00347     std::string m_name;
00348     int m_refcount;
00349     ::SDOPackage::Local::DependencyType m_dependency;
00350    };
00356   class ConfigurationMock
00357     : public virtual ::POA_SDOPackage::Configuration
00358   {
00359   protected:
00360       ::std::vector<std::string> m_log;
00361   private:
00362       ::std::string m_name;
00363       ::std::string m_code;
00364       ::std::string m_val;
00365       ::SDOPackage::Parameter m_par;
00366       ::SDOPackage::StringList m_stlist;
00367       ::SDOPackage::EnumerationType m_etype;
00368       ::CORBA::Any m_any;
00369   public :
00370       ConfigurationMock(){}
00371       virtual ~ConfigurationMock()
00372       {
00373       }
00374 
00375       void setLogger(Logger* logger)
00376       {
00377         m_logger = logger;
00378       }
00379 
00383      ::CORBA::Boolean set_device_profile(const ::SDOPackage::DeviceProfile& dProfile)
00384        throw (CORBA::SystemException,
00385              ::SDOPackage::InvalidParameter, 
00386              ::SDOPackage::NotAvailable, 
00387              ::SDOPackage::InternalError)
00388      {
00389         if (m_logger != NULL) m_logger->log("set_device_profile");
00390         return true;
00391      }
00395      ::CORBA::Boolean set_service_profile(const ::SDOPackage::ServiceProfile& sProfile)
00396        throw (CORBA::SystemException,
00397               ::SDOPackage::InvalidParameter, 
00398               ::SDOPackage::NotAvailable, 
00399               ::SDOPackage::InternalError)
00400      {
00401         if (m_logger != NULL) m_logger->log("set_service_profile");
00402         return true;
00403      }
00407      ::CORBA::Boolean add_organization(::SDOPackage::Organization_ptr org)
00408        throw (CORBA::SystemException,
00409               ::SDOPackage::InvalidParameter, 
00410               ::SDOPackage::NotAvailable, 
00411               ::SDOPackage::InternalError)
00412      {
00413         if (m_logger != NULL) m_logger->log("add_organization");
00414         return true;
00415      }
00419      ::CORBA::Boolean remove_service_profile(const char* id)
00420        throw (CORBA::SystemException,
00421               ::SDOPackage::InvalidParameter, 
00422               ::SDOPackage::NotAvailable, 
00423               ::SDOPackage::InternalError)
00424      {
00425         if (m_logger != NULL)
00426         {
00427             m_logger->log("remove_service_profile");
00428             m_logger->log(id);
00429         }
00430         return true;
00431      }
00435      ::CORBA::Boolean remove_organization(const char* organization_id)
00436        throw (CORBA::SystemException,
00437               ::SDOPackage::InvalidParameter, 
00438               ::SDOPackage::NotAvailable, 
00439               ::SDOPackage::InternalError)
00440      {
00441         if (m_logger != NULL)
00442         { 
00443             m_logger->log("remove_organization");
00444             m_logger->log(organization_id);
00445         }
00446         return true;
00447      }
00451      ::SDOPackage::ParameterList* get_configuration_parameters()
00452        throw (CORBA::SystemException,
00453                ::SDOPackage::NotAvailable, 
00454                ::SDOPackage::InternalError)
00455      {
00456         if (m_logger != NULL)
00457         {
00458             m_logger->log("get_configuration_parameters");
00459         }
00460         m_name = "test_get_configuration_parameters";
00461 //        m_code = "5";
00462 //        m_any <<= m_code.c_str();
00463         m_any <<= (short)5;
00464         m_par.name = m_name.c_str();
00465         m_par.type = m_any.type();
00466         char* cp = "999";
00467         ::SDOPackage::StringList* stlist;
00468         stlist = new ::SDOPackage::StringList((::CORBA::ULong)1,
00469                                               (::CORBA::ULong)1,
00470                                               &cp,
00471                                               (::CORBA::Boolean)0);
00472         m_stlist = *stlist;
00473         m_etype.enumerated_values = m_stlist;
00474         delete stlist;
00475         m_par.allowed_values.allowed_enum(m_etype);
00476 
00477         ::SDOPackage::ParameterList_var param;
00478         param = new ::SDOPackage::ParameterList((::CORBA::ULong)1,
00479                                                 (::CORBA::ULong)1,
00480                                                  &m_par,
00481                                                 (::CORBA::Boolean)0);
00482 
00483      
00484         return param._retn();
00485      }
00489      ::SDOPackage::NVList* get_configuration_parameter_values()
00490        throw (CORBA::SystemException,
00491               ::SDOPackage::NotAvailable, 
00492               ::SDOPackage::InternalError)
00493      {  
00494         if (m_logger != NULL) 
00495         {
00496             m_logger->log("get_configuration_parameter_values");
00497         }
00498         
00499         const char* name_str = "get_configuration_parameter_values_name";
00500         const char* value_str = "5";
00501         ::SDOPackage::NVList nv;
00502         ::NVUtil::appendStringValue(nv,
00503                                   ::CORBA::string_dup(name_str),
00504                                   ::CORBA::string_dup(value_str));
00505         ::SDOPackage::NVList_var nvlist;
00506         nvlist = new ::SDOPackage::NVList(nv);
00507         return nvlist._retn();
00508      }
00512      ::CORBA::Any* get_configuration_parameter_value(const char* name)
00513        throw (CORBA::SystemException,
00514               ::SDOPackage::InvalidParameter, 
00515               ::SDOPackage::NotAvailable, 
00516               ::SDOPackage::InternalError)
00517      {
00518         if (m_logger != NULL) 
00519         {
00520             m_logger->log("get_configuration_parameter_value");
00521             m_logger->log(name);
00522         }
00523         if (::std::string(name).empty()) 
00524             throw ::SDOPackage::InvalidParameter("Name is empty.");
00525         CORBA::Any val;
00526         val <<= name;
00527 
00528         CORBA::Any_var value;
00529         value = new CORBA::Any(val);
00530         return value._retn();
00531      }
00535      ::CORBA::Boolean set_configuration_parameter(const char* name,
00536                                                   const CORBA::Any& value)
00537        throw (CORBA::SystemException,
00538               ::SDOPackage::InvalidParameter, 
00539               ::SDOPackage::NotAvailable, 
00540               ::SDOPackage::InternalError)
00541      {
00542         if (m_logger != NULL) 
00543         {
00544             m_logger->log("set_configuration_parameter");
00545             m_logger->log(name);
00546 
00547             const char* ch;
00548             ::CORBA::ULong ul = 4;
00549             ::CORBA::Any::to_string to_str(ch, ul);
00550             value >>= to_str;
00551             m_logger->log(to_str.val);
00552 
00553         }
00554         return true;
00555      }
00559      ::SDOPackage::ConfigurationSetList* get_configuration_sets()
00560        throw (CORBA::SystemException,
00561               ::SDOPackage::NotAvailable, 
00562               ::SDOPackage::InternalError)
00563      {
00564         const char* id_str = "test_get_configuration_sets_id";
00565         const char* description_str = 
00566                          "test_get_configuration_sets_description";
00567         const char* name_str = "test_get_configuration_sets_nv_name";
00568         const char* value_str = "5";
00569         if (m_logger != NULL)
00570         { 
00571             m_logger->log("get_configuration_sets");
00572         }
00573 
00574 
00575         ::SDOPackage::ConfigurationSetList_var config_sets;
00576         config_sets 
00577               = new ::SDOPackage::ConfigurationSetList((CORBA::ULong)0);
00578         config_sets->length(1);
00579         config_sets[0].id = ::CORBA::string_dup(id_str);
00580         config_sets[0].description = ::CORBA::string_dup(description_str);
00581         ::NVUtil::appendStringValue(config_sets[0].configuration_data,
00582                                     ::CORBA::string_dup(name_str),
00583                                     ::CORBA::string_dup(value_str));
00584 
00585         return config_sets._retn();
00586 
00587      }
00588   
00592      ::SDOPackage::ConfigurationSet* get_configuration_set(const char* id)
00593        throw (CORBA::SystemException,
00594               ::SDOPackage::NotAvailable, 
00595               ::SDOPackage::InternalError)
00596      {
00597         const char* id_str = "test_get_configuration_set_id";
00598         const char* description_str = 
00599                          "test_get_configuration_set_description";
00600         const char* name_str = "test_get_configuration_set_nv_name";
00601         const char* value_str = "5";
00602 
00603         if (m_logger != NULL)
00604         { 
00605             m_logger->log("get_configuration_set");
00606             m_logger->log(id);
00607         }
00608         if (std::string(id).empty()) 
00609             throw ::SDOPackage::InternalError("ID is empty");
00610 
00611         ::SDOPackage::ConfigurationSet_var config;
00612         config = new ::SDOPackage::ConfigurationSet();
00613 //        ::SDOPackage::ConfigurationSet* obj;
00614 //        obj = new ::SDOPackage::ConfigurationSet();
00615 //        ::SDOPackage::ConfigurationSet_ptr config = obj->_this();
00616         
00617 
00618         config->id.out() = ::CORBA::string_dup(id_str);
00619         config->description.out() = ::CORBA::string_dup(description_str);
00620         ::NVUtil::appendStringValue(config->configuration_data,
00621                                     ::CORBA::string_dup(name_str),
00622                                     ::CORBA::string_dup(value_str));
00623 
00624         return config._retn();
00625 
00626       }
00627   
00631     ::CORBA::Boolean set_configuration_set_values(
00632              const char* id,
00633              const ::SDOPackage::ConfigurationSet& configuration_set)
00634       throw (CORBA::SystemException,
00635              ::SDOPackage::InvalidParameter, 
00636              ::SDOPackage::NotAvailable, 
00637              ::SDOPackage::InternalError)
00638     {
00639         if (m_logger != NULL)
00640         { 
00641             m_logger->log("set_configuration_set_values");
00642             m_logger->log(id);
00643             m_logger->log(configuration_set.id.in());
00644             m_logger->log(configuration_set.description.in());
00645             m_logger->log(configuration_set.configuration_data[0].name.in());
00646             ::CORBA::Any any;
00647 //            any = ::NVUtil::find(
00648 //                      configuration_set.configuration_data,
00649 //                      configuration_set.configuration_data[0].name.in());
00650             any = configuration_set.configuration_data[0].value;
00651             const char* ch;
00652             ::CORBA::ULong ul = 1;
00653             ::CORBA::Any::to_string to_str(ch, ul);
00654             any >>= to_str;
00655             m_logger->log(to_str.val);
00656         }
00657         if (std::string(id).empty()) 
00658             throw ::SDOPackage::InvalidParameter("ID is empty.");
00659         return true;
00660     }
00664     ::SDOPackage::ConfigurationSet* get_active_configuration_set()
00665       throw (CORBA::SystemException,
00666              ::SDOPackage::NotAvailable, 
00667              ::SDOPackage::InternalError)
00668     {
00669         const char* id_str = "test_get_active_configuration_set_id";
00670         const char* description_str = 
00671                          "test_get_active_configuration_set_description";
00672         const char* name_str = "test_get_active_configuration_set_nv_name";
00673         const char* value_str = "5";
00674         if (m_logger != NULL) 
00675         {
00676           m_logger->log("get_active_configuration_set");
00677         }
00678         ::SDOPackage::ConfigurationSet_var config;
00679         config = new ::SDOPackage::ConfigurationSet();
00680         config->id.out() = ::CORBA::string_dup(id_str);
00681         config->description.out() = ::CORBA::string_dup(description_str);
00682         ::NVUtil::appendStringValue(config->configuration_data,
00683                                     ::CORBA::string_dup(name_str),
00684                                     ::CORBA::string_dup(value_str));
00685         return config._retn();
00686     }
00690     ::CORBA::Boolean add_configuration_set(
00691              const ::SDOPackage::ConfigurationSet& configuration_set)
00692       throw (CORBA::SystemException,
00693              ::SDOPackage::InvalidParameter, 
00694              ::SDOPackage::NotAvailable, 
00695              ::SDOPackage::InternalError)
00696     {
00697         if (m_logger != NULL) 
00698         {
00699             m_logger->log("add_configuration_set");
00700             m_logger->log(configuration_set.id.in());
00701             m_logger->log(configuration_set.description.in());
00702             m_logger->log(configuration_set.configuration_data[0].name.in());
00703             ::CORBA::Any any;
00704             any = configuration_set.configuration_data[0].value;
00705             const char* ch;
00706             ::CORBA::ULong ul = 1;
00707             ::CORBA::Any::to_string to_str(ch, ul);
00708             any >>= to_str;
00709             m_logger->log(to_str.val);
00710        }
00711         return true;
00712     }
00716     ::CORBA::Boolean remove_configuration_set(const char* id)
00717       throw (CORBA::SystemException,
00718              ::SDOPackage::InvalidParameter, 
00719              ::SDOPackage::NotAvailable, 
00720              ::SDOPackage::InternalError)
00721     {
00722         if (m_logger != NULL) 
00723         {
00724             m_logger->log("remove_configuration_set");
00725             m_logger->log(id);
00726         }
00727         if (std::string(id).empty())
00728           throw ::SDOPackage::InvalidParameter("ID is empty.");
00729         return false;
00730     }
00734     ::CORBA::Boolean activate_configuration_set(const char* id)
00735       throw (CORBA::SystemException,
00736              ::SDOPackage::InvalidParameter, 
00737              ::SDOPackage::NotAvailable, 
00738              ::SDOPackage::InternalError)
00739     {
00740         if (m_logger != NULL) 
00741         {
00742             m_logger->log("activate_configuration_set");
00743             m_logger->log(id);
00744         }
00745         if (std::string(id).empty())
00746           throw ::SDOPackage::InvalidParameter("ID is empty.");
00747         return true;
00748     }
00749   private:
00750     Logger* m_logger;
00751 
00752   };
00753 
00754   class ConfigurationProxyTests
00755    : public CppUnit::TestFixture
00756   {
00757     CPPUNIT_TEST_SUITE(ConfigurationProxyTests);
00758     CPPUNIT_TEST(test_set_device_profile);
00759     CPPUNIT_TEST(test_set_service_profile);
00760     CPPUNIT_TEST(test_add_organization);
00761     CPPUNIT_TEST(test_remove_service_profile);
00762     CPPUNIT_TEST(test_remove_organization);
00763     CPPUNIT_TEST(test_get_configuration_parameters);
00764     CPPUNIT_TEST(test_get_configuration_parameter_values);
00765     CPPUNIT_TEST(test_get_configuration_parameter_value);
00766     CPPUNIT_TEST(test_set_configuration_parameter);
00767     CPPUNIT_TEST(test_get_configuration_sets);
00768     CPPUNIT_TEST(test_get_configuration_set);
00769     CPPUNIT_TEST(test_set_configuration_set_values);
00770     CPPUNIT_TEST(test_get_active_configuration_set);
00771     CPPUNIT_TEST(test_add_configuration_set);
00772     CPPUNIT_TEST(test_remove_configuration_set);
00773     CPPUNIT_TEST(test_activate_configuration_set);
00774     CPPUNIT_TEST_SUITE_END();
00775   
00776   private:
00777     CORBA::ORB_ptr m_pORB;
00778     PortableServer::POA_ptr m_pPOA;
00779   
00780   public:
00781   
00785     ConfigurationProxyTests()
00786     {
00787       int argc = 0;
00788       char** argv = NULL;
00789       m_pORB = CORBA::ORB_init(argc, argv);
00790       m_pPOA = PortableServer::POA::_narrow(
00791                        m_pORB->resolve_initial_references("RootPOA"));
00792       m_pPOA->the_POAManager()->activate();
00793     }
00794     
00798     ~ConfigurationProxyTests()
00799     {
00800     }
00801   
00805     virtual void setUp()
00806     {
00807     }
00808     
00812     virtual void tearDown()
00813     { 
00814     }
00815   
00821     void test_set_device_profile()
00822     {
00823       ConfigurationMock* obj = new ConfigurationMock();
00824       ::CORBA::Object_ptr ref = obj->_this();
00825       if(::CORBA::is_nil(ref))
00826       {
00827          std::cout<<"ref is nil.Abort test."<<std::endl;
00828          return;
00829       }
00830       ::SDOPackage::CORBA::ConfigurationProxy* ap 
00831                  = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
00832 
00833       Logger logger;
00834       obj->setLogger(&logger);
00835 
00836       CPPUNIT_ASSERT_EQUAL(0, logger.countLog("set_device_profile"));
00837       const ::SDOPackage::Local::DeviceProfile porf;
00838       ap->set_device_profile(porf);
00839       CPPUNIT_ASSERT_EQUAL(1, logger.countLog("set_device_profile"));
00840 
00841       
00842 
00843       delete ap;
00844       CORBA::release(ref);
00845     }
00851     void test_set_service_profile()
00852     {
00853       doil::CORBA::CORBAManager& 
00854                             mgr(doil::CORBA::CORBAManager::instance());
00855       std::cout <<"Manager Name==>"<< mgr.name() << std::endl;
00856 
00857       ConfigurationMock* obj = new ConfigurationMock();
00858       ::CORBA::Object_ptr ref = obj->_this();
00859       if(::CORBA::is_nil(ref))
00860       {
00861          std::cout<<"ref is nil.Abort test."<<std::endl;
00862          return;
00863       }
00864       ::SDOPackage::CORBA::ConfigurationProxy* ap 
00865                  = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
00866 
00867       Logger logger;
00868       obj->setLogger(&logger);
00869 
00870       CPPUNIT_ASSERT_EQUAL(0, logger.countLog("set_service_profile"));
00871       ::SDOPackage::Local::ServiceProfile porf;
00872       ISDOServiceMock service;
00873 
00874       mgr.registerFactory(service.id(), 
00875                           doil::New<ISDOServiceServantMock>,
00876                           doil::Delete<ISDOServiceServantMock>);
00877       mgr.activateObject(&service);
00878 
00879       porf.service = &service;
00880       const ::SDOPackage::Local::ServiceProfile _porf = porf;
00881       ap->set_service_profile(_porf);
00882       CPPUNIT_ASSERT_EQUAL(1, logger.countLog("set_service_profile"));
00883 
00884       mgr.deactivateObject(&service);
00885 
00886       delete ap;
00887       CORBA::release(ref);
00888     }
00894     void test_add_organization()
00895     {
00896       doil::CORBA::CORBAManager& 
00897                             mgr(doil::CORBA::CORBAManager::instance());
00898       std::cout <<"Manager Name==>"<< mgr.name() << std::endl;
00899 
00900       ConfigurationMock* obj = new ConfigurationMock();
00901       ::CORBA::Object_ptr ref = obj->_this();
00902       if(::CORBA::is_nil(ref))
00903       {
00904          std::cout<<"ref is nil.Abort test."<<std::endl;
00905          return;
00906       }
00907       ::SDOPackage::CORBA::ConfigurationProxy* ap 
00908                  = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
00909 
00910       Logger logger;
00911       obj->setLogger(&logger);
00912       CPPUNIT_ASSERT_EQUAL(0, logger.countLog("add_organization"));
00913 
00914       IOrganizationMock org;
00915       mgr.registerFactory(org.id(), 
00916                           doil::New<OrganizationServantMock>,
00917                           doil::Delete<OrganizationServantMock>);
00918       mgr.activateObject(&org);
00919       const IOrganizationMock _org(org);
00920       ap->add_organization(&_org);
00921 
00922       CPPUNIT_ASSERT_EQUAL(1, logger.countLog("add_organization"));
00923       mgr.deactivateObject(&org);
00924 
00925       delete ap;
00926       CORBA::release(ref);
00927     }
00933     void test_remove_service_profile()
00934     {
00935       ConfigurationMock* obj = new ConfigurationMock();
00936       ::CORBA::Object_ptr ref = obj->_this();
00937       if(::CORBA::is_nil(ref))
00938       {
00939          std::cout<<"ref is nil.Abort test."<<std::endl;
00940          return;
00941       }
00942       ::SDOPackage::CORBA::ConfigurationProxy* ap 
00943                  = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
00944 
00945       Logger logger;
00946       obj->setLogger(&logger);
00947 
00948       const ::std::string str = "test_remove_service_profile";
00949       CPPUNIT_ASSERT_EQUAL(0, logger.countLog("remove_service_profile"));
00950       CPPUNIT_ASSERT_EQUAL(0, logger.countLog(str));
00951       ap->remove_service_profile(str);
00952       CPPUNIT_ASSERT_EQUAL(1, logger.countLog("remove_service_profile"));
00953       CPPUNIT_ASSERT_EQUAL(1, logger.countLog(str));
00954 
00955       delete ap;
00956       CORBA::release(ref);
00957     }
00963     void test_remove_organization()
00964     {
00965       ConfigurationMock* obj = new ConfigurationMock();
00966       ::CORBA::Object_ptr ref = obj->_this();
00967       if(::CORBA::is_nil(ref))
00968       {
00969          std::cout<<"ref is nil.Abort test."<<std::endl;
00970          return;
00971       }
00972       ::SDOPackage::CORBA::ConfigurationProxy* ap 
00973                  = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
00974 
00975       Logger logger;
00976       obj->setLogger(&logger);
00977       const ::std::string str = "test_remove_organization";
00978 
00979       CPPUNIT_ASSERT_EQUAL(0, logger.countLog("remove_organization"));
00980       CPPUNIT_ASSERT_EQUAL(0, logger.countLog(str));
00981       ap->remove_organization(str);
00982       CPPUNIT_ASSERT_EQUAL(1, logger.countLog("remove_organization"));
00983       CPPUNIT_ASSERT_EQUAL(1, logger.countLog(str));
00984 
00985       delete ap;
00986       CORBA::release(ref);
00987     }
00993     void test_get_configuration_parameters()
00994     {
00995 std::cout<<"test_get_configuration_parameters"<<std::endl;
00996       ConfigurationMock* obj = new ConfigurationMock();
00997       ::CORBA::Object_ptr ref = obj->_this();
00998       if(::CORBA::is_nil(ref))
00999       {
01000          std::cout<<"ref is nil.Abort test."<<std::endl;
01001          return;
01002       }
01003       ::SDOPackage::CORBA::ConfigurationProxy* ap 
01004                  = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
01005 
01006       Logger logger;
01007       obj->setLogger(&logger);
01008 
01009       ::SDOPackage::Local::ParameterList pl;
01010       CPPUNIT_ASSERT_EQUAL(0, 
01011                         logger.countLog("get_configuration_parameters"));
01012       pl = ap->get_configuration_parameters();
01013       CPPUNIT_ASSERT_EQUAL(1, 
01014                         logger.countLog("get_configuration_parameters"));
01015       CPPUNIT_ASSERT(pl[0].name == 
01016                              "test_get_configuration_parameters");
01017 
01018 
01019       delete ap;
01020       CORBA::release(ref);
01021     }
01027     void test_get_configuration_parameter_values()
01028     {
01029       ConfigurationMock* obj = new ConfigurationMock();
01030       ::CORBA::Object_ptr ref = obj->_this();
01031       if(::CORBA::is_nil(ref))
01032       {
01033          std::cout<<"ref is nil.Abort test."<<std::endl;
01034          return;
01035       }
01036       ::SDOPackage::CORBA::ConfigurationProxy* ap 
01037                  = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
01038 
01039       Logger logger;
01040       obj->setLogger(&logger);
01041 
01042       ::SDOPackage::Local::NVList nvlist;
01043       CPPUNIT_ASSERT_EQUAL(0, 
01044                   logger.countLog("get_configuration_parameter_values"));
01045       nvlist = ap->get_configuration_parameter_values();
01046       CPPUNIT_ASSERT_EQUAL(1, 
01047                   logger.countLog("get_configuration_parameter_values"));
01048 
01049      
01050       CPPUNIT_ASSERT(nvlist[0].name == 
01051                              "get_configuration_parameter_values_name");
01052       CPPUNIT_ASSERT(nvlist[0].value == "5");
01053 
01054       delete ap;
01055       CORBA::release(ref);
01056     }
01062     void test_get_configuration_parameter_value()
01063     {
01064       ConfigurationMock* obj = new ConfigurationMock();
01065       ::CORBA::Object_ptr ref = obj->_this();
01066       if(::CORBA::is_nil(ref))
01067       {
01068          std::cout<<"ref is nil.Abort test."<<std::endl;
01069          return;
01070       }
01071       ::SDOPackage::CORBA::ConfigurationProxy* ap 
01072                  = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
01073 
01074       Logger logger;
01075       obj->setLogger(&logger);
01076 
01077       const ::std::string str = "test_get_configuration_parameter_value";
01078       ::std::string ret;
01079       CPPUNIT_ASSERT_EQUAL(0, 
01080                   logger.countLog("get_configuration_parameter_value"));
01081       ret = ap->get_configuration_parameter_value(str);
01082       CPPUNIT_ASSERT_EQUAL(1, 
01083                   logger.countLog("get_configuration_parameter_value"));
01084 
01085       CPPUNIT_ASSERT(ret == str);
01086       delete ap;
01087       CORBA::release(ref);
01088 
01089     }
01095     void test_set_configuration_parameter()
01096     {
01097       ConfigurationMock* obj = new ConfigurationMock();
01098       ::CORBA::Object_ptr ref = obj->_this();
01099       if(::CORBA::is_nil(ref))
01100       {
01101          std::cout<<"ref is nil.Abort test."<<std::endl;
01102          return;
01103       }
01104       ::SDOPackage::CORBA::ConfigurationProxy* ap 
01105                  = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
01106 
01107       Logger logger;
01108       obj->setLogger(&logger);
01109 
01110       const ::std::string str1 = "configuration_parameter";
01111       const ::std::string str2 = "5555";
01112       CPPUNIT_ASSERT_EQUAL(0, 
01113                         logger.countLog("set_configuration_parameter"));
01114       CPPUNIT_ASSERT_EQUAL(0, logger.countLog(str1));
01115       CPPUNIT_ASSERT_EQUAL(0, logger.countLog(str2));
01116       ap->set_configuration_parameter(str1,str2);
01117       CPPUNIT_ASSERT_EQUAL(1, 
01118                         logger.countLog("set_configuration_parameter"));
01119       CPPUNIT_ASSERT_EQUAL(1, logger.countLog(str1));
01120       CPPUNIT_ASSERT_EQUAL(1, logger.countLog(str2));
01121 
01122 
01123       delete ap;
01124       CORBA::release(ref);
01125     }
01131     void test_get_configuration_sets()
01132     {
01133       ConfigurationMock* obj = new ConfigurationMock();
01134       ::CORBA::Object_ptr ref = obj->_this();
01135       if(::CORBA::is_nil(ref))
01136       {
01137          std::cout<<"ref is nil.Abort test."<<std::endl;
01138          return;
01139       }
01140       ::SDOPackage::CORBA::ConfigurationProxy* ap 
01141                  = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
01142 
01143       Logger logger;
01144       obj->setLogger(&logger);
01145       ::SDOPackage::Local::ConfigurationSetList configlist;
01146 
01147       CPPUNIT_ASSERT_EQUAL(0, logger.countLog("get_configuration_sets"));
01148       configlist = ap->get_configuration_sets();
01149       CPPUNIT_ASSERT_EQUAL(1, logger.countLog("get_configuration_sets"));
01150 
01151       CPPUNIT_ASSERT(configlist[0].id == 
01152                          "test_get_configuration_sets_id");
01153       CPPUNIT_ASSERT(configlist[0].description == 
01154                          "test_get_configuration_sets_description");
01155       CPPUNIT_ASSERT(configlist[0].configuration_data[0].name == 
01156                          "test_get_configuration_sets_nv_name");
01157       CPPUNIT_ASSERT(configlist[0].configuration_data[0].value ==  "5");
01158 
01159 
01160       delete ap;
01161       CORBA::release(ref);
01162     }
01168     void test_get_configuration_set()
01169     {
01170       ConfigurationMock* obj = new ConfigurationMock();
01171       ::CORBA::Object_ptr ref = obj->_this();
01172       if(::CORBA::is_nil(ref))
01173       {
01174          std::cout<<"ref is nil.Abort test."<<std::endl;
01175          return;
01176       }
01177       ::SDOPackage::CORBA::ConfigurationProxy* ap 
01178                  = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
01179 
01180       Logger logger;
01181       obj->setLogger(&logger);
01182 
01183       const ::std::string str = "get_configuration_set_config_id";
01184       ::SDOPackage::Local::ConfigurationSet confset;
01185 
01186       CPPUNIT_ASSERT_EQUAL(0, logger.countLog("get_configuration_set"));
01187       CPPUNIT_ASSERT_EQUAL(0, logger.countLog(str));
01188       confset = ap->get_configuration_set(str);
01189       CPPUNIT_ASSERT_EQUAL(1, logger.countLog("get_configuration_set"));
01190       CPPUNIT_ASSERT_EQUAL(1, logger.countLog(str));
01191 
01192       CPPUNIT_ASSERT(confset.id == 
01193                          "test_get_configuration_set_id");
01194       CPPUNIT_ASSERT(confset.description == 
01195                          "test_get_configuration_set_description");
01196       CPPUNIT_ASSERT(confset.configuration_data[0].name == 
01197                          "test_get_configuration_set_nv_name");
01198       CPPUNIT_ASSERT(confset.configuration_data[0].value ==  "5");
01199 
01200       delete ap;
01201       CORBA::release(ref);
01202 
01203     }
01209     void test_set_configuration_set_values()
01210     {
01211       ConfigurationMock* obj = new ConfigurationMock();
01212       ::CORBA::Object_ptr ref = obj->_this();
01213       if(::CORBA::is_nil(ref))
01214       {
01215          std::cout<<"ref is nil.Abort test."<<std::endl;
01216          return;
01217       }
01218       ::SDOPackage::CORBA::ConfigurationProxy* ap 
01219                  = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
01220 
01221       Logger logger;
01222       obj->setLogger(&logger);
01223 
01224       const ::std::string str = "set_configuration_set_values_config_id";
01225       const ::std::string id_str = "test_set_configuration_set_valuest_id";
01226       const ::std::string description_str = 
01227                           "test_set_configuration_set_values_description";
01228       const ::std::string name_str = 
01229                           "test_set_configuration_set_values_nv_name";
01230       const ::std::string value_str = "5";
01231 
01232       ::SDOPackage::Local::NameValue nv; 
01233       nv.name  = name_str;
01234       nv.value = value_str;
01235       ::SDOPackage::Local::NVList nvlist;
01236       nvlist.push_back(nv);
01237 
01238       ::SDOPackage::Local::ConfigurationSet configuration_set;
01239       configuration_set.id = id_str;
01240       configuration_set.description = description_str;
01241       configuration_set.configuration_data = nvlist; 
01242 
01243       CPPUNIT_ASSERT_EQUAL(0, 
01244                         logger.countLog("set_configuration_set_values"));
01245       CPPUNIT_ASSERT_EQUAL(0, logger.countLog(str));
01246       ap->set_configuration_set_values(str,configuration_set);
01247       CPPUNIT_ASSERT_EQUAL(1, 
01248                         logger.countLog("set_configuration_set_values"));
01249       CPPUNIT_ASSERT_EQUAL(1, logger.countLog(str));
01250 
01251       delete ap;
01252       CORBA::release(ref);
01253     }
01259     void test_get_active_configuration_set()
01260     {
01261       ConfigurationMock* obj = new ConfigurationMock();
01262       ::CORBA::Object_ptr ref = obj->_this();
01263       if(::CORBA::is_nil(ref))
01264       {
01265          std::cout<<"ref is nil.Abort test."<<std::endl;
01266          return;
01267       }
01268       ::SDOPackage::CORBA::ConfigurationProxy* ap 
01269                  = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
01270 
01271       Logger logger;
01272       obj->setLogger(&logger);
01273 
01274       ::SDOPackage::Local::ConfigurationSet confset;
01275       CPPUNIT_ASSERT_EQUAL(0, 
01276                         logger.countLog("get_active_configuration_set"));
01277       confset = ap->get_active_configuration_set();
01278       CPPUNIT_ASSERT_EQUAL(1, 
01279                         logger.countLog("get_active_configuration_set"));
01280 
01281       CPPUNIT_ASSERT(confset.id == 
01282                          "test_get_active_configuration_set_id");
01283       CPPUNIT_ASSERT(confset.description == 
01284                          "test_get_active_configuration_set_description");
01285       CPPUNIT_ASSERT(confset.configuration_data[0].name == 
01286                          "test_get_active_configuration_set_nv_name");
01287       CPPUNIT_ASSERT(confset.configuration_data[0].value ==  "5");
01288 
01289       delete ap;
01290       CORBA::release(ref);
01291     }
01297     void test_add_configuration_set()
01298     {
01299       ConfigurationMock* obj = new ConfigurationMock();
01300       ::CORBA::Object_ptr ref = obj->_this();
01301       if(::CORBA::is_nil(ref))
01302       {
01303          std::cout<<"ref is nil.Abort test."<<std::endl;
01304          return;
01305       }
01306       ::SDOPackage::CORBA::ConfigurationProxy* ap 
01307                  = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
01308 
01309       Logger logger;
01310       obj->setLogger(&logger);
01311 
01312       const ::std::string id_str = "test_add_configuration_set_id";
01313       const ::std::string description_str = 
01314                                  "test_add_configuration_set_description";
01315       const ::std::string name_str = "test_add_configuration_set_nv_name";
01316       const ::std::string value_str = "5";
01317 
01318       ::SDOPackage::Local::NameValue nv; 
01319       nv.name  = name_str;
01320       nv.value = value_str;
01321       ::SDOPackage::Local::NVList nvlist;
01322       nvlist.push_back(nv);
01323 
01324       ::SDOPackage::Local::ConfigurationSet configuration_set;
01325       configuration_set.id = id_str;
01326       configuration_set.description = description_str;
01327       configuration_set.configuration_data = nvlist; 
01328 
01329       CPPUNIT_ASSERT_EQUAL(0, logger.countLog("add_configuration_set"));
01330       CPPUNIT_ASSERT_EQUAL(0, logger.countLog(id_str));
01331       CPPUNIT_ASSERT_EQUAL(0, logger.countLog(description_str));
01332       CPPUNIT_ASSERT_EQUAL(0, logger.countLog(name_str));
01333       CPPUNIT_ASSERT_EQUAL(0, logger.countLog(value_str));
01334       ap->add_configuration_set(configuration_set);
01335       CPPUNIT_ASSERT_EQUAL(1, logger.countLog("add_configuration_set"));
01336       CPPUNIT_ASSERT_EQUAL(1, logger.countLog(id_str));
01337       CPPUNIT_ASSERT_EQUAL(1, logger.countLog(description_str));
01338       CPPUNIT_ASSERT_EQUAL(1, logger.countLog(name_str));
01339       CPPUNIT_ASSERT_EQUAL(1, logger.countLog(value_str));
01340       delete ap;
01341       CORBA::release(ref);
01342 
01343     }
01349     void test_remove_configuration_set()
01350     {
01351       ConfigurationMock* obj = new ConfigurationMock();
01352       ::CORBA::Object_ptr ref = obj->_this();
01353       if(::CORBA::is_nil(ref))
01354       {
01355          std::cout<<"ref is nil.Abort test."<<std::endl;
01356          return;
01357       }
01358       ::SDOPackage::CORBA::ConfigurationProxy* ap 
01359                  = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
01360 
01361       Logger logger;
01362       obj->setLogger(&logger);
01363 
01364       const ::std::string str = "test_remove_configuration_set";
01365       CPPUNIT_ASSERT_EQUAL(0, logger.countLog("remove_configuration_set"));
01366       CPPUNIT_ASSERT_EQUAL(0, logger.countLog(str));
01367       ap->remove_configuration_set(str);
01368       CPPUNIT_ASSERT_EQUAL(1, logger.countLog("remove_configuration_set"));
01369       CPPUNIT_ASSERT_EQUAL(1, logger.countLog(str));
01370 
01371       delete ap;
01372       CORBA::release(ref);
01373     }
01379     void test_activate_configuration_set()
01380     {
01381       ConfigurationMock* obj = new ConfigurationMock();
01382       ::CORBA::Object_ptr ref = obj->_this();
01383       if(::CORBA::is_nil(ref))
01384       {
01385          std::cout<<"ref is nil.Abort test."<<std::endl;
01386          delete obj;
01387          return;
01388       }
01389       ::SDOPackage::CORBA::ConfigurationProxy* ap 
01390                  = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
01391 
01392       Logger logger;
01393       obj->setLogger(&logger);
01394 
01395       const ::std::string str = "test_activate_configuration_set";
01396       CPPUNIT_ASSERT_EQUAL(0, 
01397                            logger.countLog("activate_configuration_set"));
01398       CPPUNIT_ASSERT_EQUAL(0, logger.countLog(str));
01399       ap->activate_configuration_set(str);
01400       CPPUNIT_ASSERT_EQUAL(1, 
01401                            logger.countLog("activate_configuration_set"));
01402       CPPUNIT_ASSERT_EQUAL(1, logger.countLog(str));
01403 
01404       delete ap;
01405       CORBA::release(ref);
01406     }
01407     /* test case */
01408     void test_case0()
01409     {
01410     }
01411   };
01412 }; // namespace ConfigurationProxy
01413 
01414 /*
01415  * Register test suite
01416  */
01417 CPPUNIT_TEST_SUITE_REGISTRATION(ConfigurationProxy::ConfigurationProxyTests);
01418 
01419 #ifdef LOCAL_MAIN
01420 int main(int argc, char* argv[])
01421 {
01422     CppUnit::TextUi::TestRunner runner;
01423     runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
01424     CppUnit::Outputter* outputter = 
01425       new CppUnit::TextOutputter(&runner.result(), std::cout);
01426     runner.setOutputter(outputter);
01427     bool retcode = runner.run();
01428     return !retcode;
01429 }
01430 #endif // MAIN
01431 #endif // ConfigurationProxy_cpp


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Sun Mar 26 2017 03:37:15