Go to the documentation of this file.00001
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef SdoOrganization_cpp
00033 #define SdoOrganization_cpp
00034
00035 #include <cppunit/ui/text/TestRunner.h>
00036 #include <cppunit/TextOutputter.h>
00037 #include <cppunit/extensions/TestFactoryRegistry.h>
00038 #include <cppunit/extensions/HelperMacros.h>
00039 #include <cppunit/TestAssert.h>
00040 #include <rtm/RTObject.h>
00041 #include <rtm/Manager.h>
00042 #include <rtm/SdoOrganization.h>
00043
00044
00049 namespace SdoOrganization
00050 {
00051 using namespace SDOPackage;
00052 using namespace std;
00053
00054 class SdoOrganizationTests
00055 : public CppUnit::TestFixture
00056 {
00057 CPPUNIT_TEST_SUITE(SdoOrganizationTests);
00058
00059 CPPUNIT_TEST(test_get_organization_id);
00060 CPPUNIT_TEST(test_set_get_organization_property);
00061 CPPUNIT_TEST(test_set_get_organization_property_value);
00062 CPPUNIT_TEST(test_remove_organization_property);
00063 CPPUNIT_TEST(test_set_get_owner);
00064 CPPUNIT_TEST(test_set_get_members);
00065 CPPUNIT_TEST(test_add_remove_members);
00066 CPPUNIT_TEST(test_set_get_dependency);
00067
00068 CPPUNIT_TEST_SUITE_END();
00069
00070 private:
00071 ::RTC::RTObject_impl* rtobj;
00072 Organization_impl* m_pOi;
00073 char* m_id;
00074 public:
00075
00079 SdoOrganizationTests()
00080 {
00081 }
00082
00086 ~SdoOrganizationTests()
00087 {
00088 }
00089
00093 virtual void setUp()
00094 {
00095 ::RTC::Manager& mgr(RTC::Manager::instance());
00096 rtobj = new ::RTC::RTObject_impl(&mgr);
00097 m_pOi = new Organization_impl(rtobj->getObjRef());
00098 }
00099
00103 virtual void tearDown()
00104 {
00105 m_pOi->_remove_ref();
00106 rtobj->_remove_ref();
00107 }
00108
00109
00113 void test_get_organization_id() {
00114
00115 m_id = m_pOi->get_organization_id();
00116 CPPUNIT_ASSERT(m_id != NULL);
00117
00118 }
00119
00120
00124 void test_set_get_organization_property() {
00125
00126 OrganizationProperty_var get_prop;
00127 OrganizationProperty set_prop;
00128 CORBA::Boolean ret;
00129 CORBA::Short st;
00130 CORBA::Long lg;
00131 CORBA::Float ft;
00132 CORBA::Double db;
00133
00134
00135 CORBA::Short rst;
00136 CORBA::Long rlg;
00137 CORBA::Float rft;
00138 CORBA::Double rdb;
00139
00140
00141 NVList nvList;
00142 NameValue nv;
00143 string str;
00144
00145 try {
00146
00147 get_prop = m_pOi->get_organization_property();
00148
00149
00150
00151
00152 ret = m_pOi->add_organization_property(set_prop);
00153
00154
00155 nv.name = "hoge";
00156 str = "hoge";
00157 ft = 11.111;
00158 nv.value <<= ft;
00159
00160 nvList.length(1);
00161 nvList[0] = nv;
00162
00163 set_prop.properties = nvList;
00164
00165 ret = m_pOi->add_organization_property(set_prop);
00166
00167
00168 get_prop = m_pOi->get_organization_property();
00169
00170
00171 str = (get_prop->properties[0]).name;
00172 (get_prop->properties[0]).value >>= rft;
00173 CPPUNIT_ASSERT(str == "hoge");
00174 CPPUNIT_ASSERT(rft == ft);
00175
00176
00177 nv.name = "hogehoge";
00178 ft = 22.2;
00179 nv.value <<= ft;
00180
00181 nvList.length(1);
00182 nvList[0] = nv;
00183
00184 set_prop.properties = nvList;
00185
00186 ret = m_pOi->add_organization_property(set_prop);
00187
00188
00189 get_prop = m_pOi->get_organization_property();
00190
00191
00192
00193 str = ((get_prop->properties[0]).name);
00194 (get_prop->properties[0]).value >>= rft;
00195 CPPUNIT_ASSERT(str == "hogehoge");
00196 CPPUNIT_ASSERT(rft == ft);
00197
00198
00199 nvList.length(4);
00200
00201
00202 nv.name = "short";
00203 st = 1;
00204 nv.value <<= st;
00205 nvList[0] = nv;
00206
00207
00208 nv.name = "long";
00209 lg = 2222;
00210 nv.value <<= lg;
00211 nvList[1] = nv;
00212
00213
00214 nv.name = "float";
00215 ft = 33.3;
00216 nv.value <<= ft;
00217 nvList[2] = nv;
00218
00219
00220 nv.name = "double";
00221 db = 3.3;
00222 nv.value <<= db;
00223 nvList[3] = nv;
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240 set_prop.properties = nvList;
00241
00242
00243 ret = m_pOi->add_organization_property(set_prop);
00244
00245
00246 get_prop = m_pOi->get_organization_property();
00247
00248
00249 str = ((get_prop->properties[0]).name);
00250 (get_prop->properties[0]).value >>= rst;
00251 CPPUNIT_ASSERT(str == "short");
00252 CPPUNIT_ASSERT(rst == st);
00253
00254 str = ((get_prop->properties[1]).name);
00255 (get_prop->properties[1]).value >>= rlg;
00256 CPPUNIT_ASSERT(str == "long");
00257 CPPUNIT_ASSERT(rlg == lg);
00258
00259 str = ((get_prop->properties[2]).name);
00260 (get_prop->properties[2]).value >>= rft;
00261 CPPUNIT_ASSERT(str == "float");
00262 CPPUNIT_ASSERT(rft == ft);
00263
00264 str = ((get_prop->properties[3]).name);
00265 (get_prop->properties[3]).value >>= rdb;
00266 CPPUNIT_ASSERT(str == "double");
00267 CPPUNIT_ASSERT(rdb == db);
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280 }
00281 catch (InvalidParameter ip) {
00282 cout << "InvalidParameter exception." << endl;
00283 }
00284 catch (NotAvailable na) {
00285 cout << "NotAvailable exception." << endl;
00286 }
00287 catch (InternalError ip) {
00288 cout << "InternalError exception." << endl;
00289 }
00290 catch (...) {
00291 cout << "othrer exception." << endl;
00292 }
00293
00294 }
00295
00299 void test_set_get_organization_property_value() {
00300
00301 OrganizationProperty_var get_prop;
00302 OrganizationProperty set_prop;
00303 CORBA::Boolean ret;
00304 CORBA::Short st;
00305
00306 CORBA::Float ft;
00307
00308 CORBA::Any any;
00309
00310 CORBA::Short rst;
00311
00312 CORBA::Float rft;
00313
00314 CORBA::Any* rany;
00315
00316 NVList nvList;
00317 NameValue nv;
00318 string str;
00319
00320 try {
00321
00322 get_prop = m_pOi->get_organization_property();
00323
00324
00325
00326 ret = m_pOi->add_organization_property(set_prop);
00327 CPPUNIT_ASSERT(ret);
00328
00329
00330 ft = 11.111;
00331 any <<= ft;
00332 ret = m_pOi->set_organization_property_value("hoge1", any);
00333 CPPUNIT_ASSERT(ret);
00334
00335
00336 rany = m_pOi->get_organization_property_value("hoge1");
00337 (*rany) >>= rft;
00338 CPPUNIT_ASSERT_EQUAL(ft, rft);
00339
00340
00341
00342 st = 123;
00343 any <<= st;
00344 ret = m_pOi->set_organization_property_value("hoge2", any);
00345 CPPUNIT_ASSERT(ret);
00346
00347
00348 rany = m_pOi->get_organization_property_value("hoge2");
00349 (*rany) >>= rst;
00350 CPPUNIT_ASSERT_EQUAL(st, rst);
00351
00352
00353
00354 st = 456;
00355 any <<= st;
00356 ret = m_pOi->set_organization_property_value("hoge2", any);
00357 CPPUNIT_ASSERT(ret);
00358
00359
00360 rany = m_pOi->get_organization_property_value("hoge2");
00361 (*rany) >>= rst;
00362 CPPUNIT_ASSERT_EQUAL(st, rst);
00363
00364
00365 short sflg = -1;
00366 try {
00367 ret = m_pOi->set_organization_property_value("", any);
00368 sflg = 0;
00369 }
00370 catch (InvalidParameter ip) {
00371
00372 sflg = 1;
00373 }
00374 CPPUNIT_ASSERT(sflg == 1);
00375
00376
00377 sflg = -1;
00378 try {
00379 ret = m_pOi->get_organization_property_value("");
00380 sflg = 0;
00381 }
00382 catch (InvalidParameter ip) {
00383
00384 sflg = 1;
00385 }
00386 CPPUNIT_ASSERT(sflg == 1);
00387
00388
00389 sflg = -1;
00390 try {
00391 ret = m_pOi->get_organization_property_value("hoge99");
00392 sflg = 0;
00393 }
00394 catch (InvalidParameter ip) {
00395
00396 sflg = 1;
00397 }
00398 CPPUNIT_ASSERT(sflg == 1);
00399 }
00400 catch (InvalidParameter ip) {
00401 cout << "InvalidParameter exception." << endl;
00402 }
00403 catch (NotAvailable na) {
00404 cout << "NotAvailable exception." << endl;
00405 }
00406 catch (InternalError ip) {
00407 cout << "InternalError exception." << endl;
00408 }
00409 catch (...) {
00410 cout << "othrer exception." << endl;
00411 }
00412
00413
00414 }
00415
00419 void test_remove_organization_property() {
00420
00421 OrganizationProperty set_prop;
00422 CORBA::Boolean ret;
00423 CORBA::Float ft;
00424 NVList nvList;
00425 NameValue nv;
00426 string str;
00427
00428 nv.name = "hoge";
00429 str = "hoge";
00430 ft = 11.111;
00431 nv.value <<= ft;
00432
00433 nvList.length(1);
00434 nvList[0] = nv;
00435
00436 set_prop.properties = nvList;
00437
00438 ret = m_pOi->add_organization_property(set_prop);
00439 CPPUNIT_ASSERT(ret);
00440
00441
00442 short sflg = -1;
00443 try {
00444 ret = m_pOi->remove_organization_property("short");
00445 if (!ret) {
00446 cout << "Couldn't remove name: short" << endl;
00447 }
00448 sflg = 0;
00449 }
00450 catch (InvalidParameter ip) {
00451
00452 sflg = 1;
00453 }
00454 catch (NotAvailable na) {
00455 cout << "NotAvailable exception." << endl;
00456 sflg = 2;
00457 }
00458 catch (InternalError ip) {
00459 cout << "InternalError exception." << endl;
00460 sflg = 3;
00461 }
00462 catch (...) {
00463 cout << "othrer exception." << endl;
00464 sflg = 4;
00465 }
00466 CPPUNIT_ASSERT(sflg == 1);
00467
00468
00469 sflg = -1;
00470 try {
00471 ret = m_pOi->remove_organization_property("hoge");
00472 if (!ret) {
00473 cout << "Couldn't remove name: hoge" << endl;
00474 }
00475 CPPUNIT_ASSERT(ret);
00476 sflg = 0;
00477 }
00478 catch (InvalidParameter ip) {
00479 cout << "InvalidParameter exception." << endl;
00480 sflg = 1;
00481 }
00482 catch (NotAvailable na) {
00483 cout << "NotAvailable exception." << endl;
00484 sflg = 2;
00485 }
00486 catch (InternalError ip) {
00487 cout << "InternalError exception." << endl;
00488 sflg = 3;
00489 }
00490 catch (...) {
00491 cout << "othrer exception." << endl;
00492 sflg = 4;
00493 }
00494 CPPUNIT_ASSERT(sflg == 0);
00495
00496 }
00497
00498
00502 void test_set_get_owner() {
00503
00504 CORBA::Boolean ret;
00505 SDOPackage::SDOSystemElement_var varOwner;
00506 SDOPackage::SDOSystemElement_ptr ptrOwner;
00507
00508 try {
00509
00510 varOwner = m_pOi->get_owner();
00511 CPPUNIT_ASSERT(!::CORBA::is_nil(varOwner));
00512
00513
00514 short sflg = -1;
00515 try {
00516
00517 ptrOwner = SDOPackage::SDOSystemElement::_nil();
00518 ret = m_pOi->set_owner(ptrOwner);
00519 CPPUNIT_ASSERT(ret);
00520 sflg = 0;
00521 }
00522 catch (InvalidParameter ip) {
00523
00524 sflg = 1;
00525 }
00526 catch (NotAvailable na) {
00527 cout << "NotAvailable exception." << endl;
00528 sflg = 2;
00529 }
00530 catch (InternalError ip) {
00531 cout << "InternalError exception." << endl;
00532 sflg = 3;
00533 }
00534 catch (...) {
00535 cout << "othrer exception." << endl;
00536 sflg = 4;
00537 }
00538 CPPUNIT_ASSERT(sflg == 1);
00539
00540
00541 sflg = -1;
00542 try {
00543
00544 ::RTC::RTObject_impl* rtobj2;
00545 ::RTC::Manager& mgr2(RTC::Manager::instance());
00546 rtobj2 = new ::RTC::RTObject_impl(&mgr2);
00547 ptrOwner = rtobj2->getObjRef();
00548
00549 ret = m_pOi->set_owner(ptrOwner);
00550 CPPUNIT_ASSERT(ret);
00551 sflg = 0;
00552 rtobj2->_remove_ref();
00553 }
00554 catch (InvalidParameter ip) {
00555 cout << "InvalidParameter exception." << endl;
00556 sflg = 1;
00557 }
00558 catch (NotAvailable na) {
00559 cout << "NotAvailable exception." << endl;
00560 sflg = 2;
00561 }
00562 catch (InternalError ip) {
00563 cout << "InternalError exception." << endl;
00564 sflg = 3;
00565 }
00566 catch (...) {
00567 cout << "othrer exception." << endl;
00568 sflg = 4;
00569 }
00570 CPPUNIT_ASSERT(sflg == 0);
00571 }
00572 catch (InvalidParameter ip) {
00573 cout << "InvalidParameter exception." << endl;
00574 }
00575 catch (NotAvailable na) {
00576 cout << "NotAvailable exception." << endl;
00577 }
00578 catch (InternalError ip) {
00579 cout << "InternalError exception." << endl;
00580 }
00581 catch (...) {
00582 cout << "othrer exception." << endl;
00583 }
00584
00585 }
00586
00587
00591 void test_set_get_members() {
00592
00593 CORBA::Boolean ret;
00594 SDOPackage::SDO_var sdo;
00595 SDOPackage::SDOList slist;
00596 SDOPackage::SDOList* rslist;
00597
00598
00599
00600
00601
00602 short sflg = -1;
00603 try {
00604 slist = NULL;
00605 ret = m_pOi->set_members(slist);
00606 CPPUNIT_ASSERT(ret);
00607 sflg = 0;
00608 }
00609 catch (InvalidParameter ip) {
00610 cout << "InvalidParameter exception." << endl;
00611 sflg = 1;
00612 }
00613 catch (NotAvailable na) {
00614 cout << "NotAvailable exception." << endl;
00615 sflg = 2;
00616 }
00617 catch (InternalError ip) {
00618 cout << "InternalError exception." << endl;
00619 sflg = 3;
00620 }
00621 catch (...) {
00622 cout << "othrer exception." << endl;
00623 sflg = 4;
00624 }
00625 CPPUNIT_ASSERT(sflg == 0);
00626
00627
00628 rslist = m_pOi->get_members();
00629 CPPUNIT_ASSERT(rslist->length() == 0);
00630
00631
00632
00633 sflg = -1;
00634 try {
00635 RTC::RTObject_impl* rtobj2;
00636 RTC::Manager& mgr2(RTC::Manager::instance());
00637 rtobj2 = new ::RTC::RTObject_impl(&mgr2);
00638 sdo = SDOPackage::SDO::_duplicate(rtobj2->getObjRef());
00639 CORBA_SeqUtil::push_back(slist, sdo);
00640 ret = m_pOi->set_members(slist);
00641 CPPUNIT_ASSERT(ret);
00642 sflg = 0;
00643 rtobj2->_remove_ref();
00644 }
00645 catch (InvalidParameter ip) {
00646 cout << "InvalidParameter exception." << endl;
00647 sflg = 1;
00648 }
00649 catch (NotAvailable na) {
00650 cout << "NotAvailable exception." << endl;
00651 sflg = 2;
00652 }
00653 catch (InternalError ip) {
00654 cout << "InternalError exception." << endl;
00655 sflg = 3;
00656 }
00657 catch (...) {
00658 cout << "othrer exception." << endl;
00659 sflg = 4;
00660 }
00661 CPPUNIT_ASSERT(sflg == 0);
00662
00663
00664 rslist = m_pOi->get_members();
00665 CPPUNIT_ASSERT(rslist->length() == 1);
00666
00667 }
00668
00669
00673 void test_add_remove_members() {
00674
00675 CORBA::Boolean ret;
00676 SDOPackage::SDO_var sdo;
00677 SDOPackage::SDOList slist;
00678 SDOPackage::SDOList* rslist;
00679 Organization_impl* m_pOi2;
00680 std::string str;
00681 CORBA::Any any;
00682
00683 RTC::RTObject_impl* rtobj2;
00684 RTC::Manager& mgr2(RTC::Manager::instance());
00685 mgr2.activateManager();
00686 rtobj2 = new ::RTC::RTObject_impl(&mgr2);
00687 m_pOi2 = new Organization_impl(rtobj2->getObjRef());
00688
00689
00690
00691
00692
00693
00694 short sflg = -1;
00695 try {
00696 slist = NULL;
00697 ret = m_pOi->add_members(slist);
00698 CPPUNIT_ASSERT(ret);
00699 sflg = 0;
00700 }
00701 catch (InvalidParameter ip) {
00702 cout << "InvalidParameter exception." << endl;
00703 sflg = 1;
00704 }
00705 catch (NotAvailable na) {
00706 cout << "NotAvailable exception." << endl;
00707 sflg = 2;
00708 }
00709 catch (InternalError ip) {
00710 cout << "InternalError exception." << endl;
00711 sflg = 3;
00712 }
00713 catch (...) {
00714 cout << "othrer exception." << endl;
00715 sflg = 4;
00716 }
00717 CPPUNIT_ASSERT(sflg == 0);
00718
00719
00720 sflg = -1;
00721 try {
00722 sdo = SDOPackage::SDO::_duplicate(rtobj2->getObjRef());
00723 CORBA_SeqUtil::push_back(slist, sdo);
00724 rtobj2->setInstanceName("hoge1");
00725
00726
00727 ret = m_pOi2->add_members(slist);
00728 CPPUNIT_ASSERT(ret);
00729 sflg = 0;
00730
00731 str = m_pOi2->get_organization_id();
00732 any <<= str.c_str();
00733 ret = m_pOi2->set_organization_property_value("instance_name", any);
00734 }
00735 catch (InvalidParameter ip) {
00736 cout << "InvalidParameter exception." << endl;
00737 sflg = 1;
00738 }
00739 catch (NotAvailable na) {
00740 cout << "NotAvailable exception." << endl;
00741 sflg = 2;
00742 }
00743 catch (InternalError ip) {
00744 cout << "InternalError exception." << endl;
00745 sflg = 3;
00746 }
00747 catch (...) {
00748 cout << "othrer exception." << endl;
00749 sflg = 4;
00750 }
00751 CPPUNIT_ASSERT(sflg == 0);
00752
00753
00754 rslist = m_pOi2->get_members();
00755 CPPUNIT_ASSERT(rslist->length() == 1);
00756
00757
00758 sflg = -1;
00759 try {
00760 ret = m_pOi2->remove_member("");
00761 CPPUNIT_ASSERT(ret);
00762 sflg = 0;
00763 }
00764 catch (InvalidParameter ip) {
00765
00766 sflg = 1;
00767 }
00768 catch (NotAvailable na) {
00769 cout << "NotAvailable exception." << endl;
00770 sflg = 2;
00771 }
00772 catch (InternalError ip) {
00773 cout << "InternalError exception." << endl;
00774 sflg = 3;
00775 }
00776 catch (...) {
00777 cout << "othrer exception." << endl;
00778 sflg = 4;
00779 }
00780 CPPUNIT_ASSERT(sflg == 1);
00781
00782
00783 sflg = -1;
00784 try {
00785 ret = m_pOi2->remove_member("dummy");
00786 CPPUNIT_ASSERT(ret);
00787 sflg = 0;
00788 }
00789 catch (InvalidParameter ip) {
00790
00791 sflg = 1;
00792 }
00793 catch (NotAvailable na) {
00794 cout << "NotAvailable exception." << endl;
00795 sflg = 2;
00796 }
00797 catch (InternalError ip) {
00798 cout << "InternalError exception." << endl;
00799 sflg = 3;
00800 }
00801 catch (...) {
00802 cout << "othrer exception." << endl;
00803 sflg = 4;
00804 }
00805 CPPUNIT_ASSERT(sflg == 1);
00806
00807
00808 sflg = -1;
00809 try {
00810 ret = m_pOi2->remove_member("hoge1");
00811 CPPUNIT_ASSERT(ret);
00812 sflg = 0;
00813 }
00814 catch (InvalidParameter ip) {
00815 cout << "InvalidParameter exception." << endl;
00816 sflg = 1;
00817 }
00818 catch (NotAvailable na) {
00819 cout << "NotAvailable exception." << endl;
00820 sflg = 2;
00821 }
00822 catch (InternalError ip) {
00823 cout << "InternalError exception." << endl;
00824 sflg = 3;
00825 }
00826 catch (...) {
00827 cout << "othrer exception." << endl;
00828 sflg = 4;
00829 }
00830 CPPUNIT_ASSERT(sflg == 0);
00831
00832
00833 rslist = m_pOi2->get_members();
00834 CPPUNIT_ASSERT(rslist->length() == 0);
00835
00836 if ( !CORBA::is_nil( mgr2.getPOA()) ) {
00837 if ( !CORBA::is_nil(mgr2.getPOAManager()) ) {
00838 mgr2.getPOAManager()->deactivate(false, true);
00839 }
00840 }
00841 rtobj2->_remove_ref();
00842 m_pOi2->_remove_ref();
00843
00844 }
00845
00846
00850 void test_set_get_dependency() {
00851
00852 DependencyType depType;
00853
00854
00855
00856 depType = m_pOi->get_dependency();
00857
00858 CPPUNIT_ASSERT(depType == 0);
00859
00860 m_pOi->set_dependency(NO_DEPENDENCY);
00861
00862 depType = m_pOi->get_dependency();
00863 CPPUNIT_ASSERT(depType == 2);
00864
00865
00866
00867
00868
00869
00870
00871 }
00872
00873 };
00874 };
00875
00876
00877
00878
00879 CPPUNIT_TEST_SUITE_REGISTRATION(SdoOrganization::SdoOrganizationTests);
00880
00881 #ifdef LOCAL_MAIN
00882 int main(int argc, char* argv[])
00883 {
00884
00885 FORMAT format = TEXT_OUT;
00886 int target = 0;
00887 std::string xsl;
00888 std::string ns;
00889 std::string fname;
00890 std::ofstream ofs;
00891
00892 int i(1);
00893 while (i < argc)
00894 {
00895 std::string arg(argv[i]);
00896 std::string next_arg;
00897 if (i + 1 < argc) next_arg = argv[i + 1];
00898 else next_arg = "";
00899
00900 if (arg == "--text") { format = TEXT_OUT; break; }
00901 if (arg == "--xml")
00902 {
00903 if (next_arg == "")
00904 {
00905 fname = argv[0];
00906 fname += ".xml";
00907 }
00908 else
00909 {
00910 fname = next_arg;
00911 }
00912 format = XML_OUT;
00913 ofs.open(fname.c_str());
00914 }
00915 if ( arg == "--compiler" ) { format = COMPILER_OUT; break; }
00916 if ( arg == "--cerr" ) { target = 1; break; }
00917 if ( arg == "--xsl" )
00918 {
00919 if (next_arg == "") xsl = "default.xsl";
00920 else xsl = next_arg;
00921 }
00922 if ( arg == "--namespace" )
00923 {
00924 if (next_arg == "")
00925 {
00926 std::cerr << "no namespace specified" << std::endl;
00927 exit(1);
00928 }
00929 else
00930 {
00931 xsl = next_arg;
00932 }
00933 }
00934 ++i;
00935 }
00936 CppUnit::TextUi::TestRunner runner;
00937 if ( ns.empty() )
00938 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
00939 else
00940 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry(ns).makeTest());
00941 CppUnit::Outputter* outputter = 0;
00942 std::ostream* stream = target ? &std::cerr : &std::cout;
00943 switch ( format )
00944 {
00945 case TEXT_OUT :
00946 outputter = new CppUnit::TextOutputter(&runner.result(),*stream);
00947 break;
00948 case XML_OUT :
00949 std::cout << "XML_OUT" << std::endl;
00950 outputter = new CppUnit::XmlOutputter(&runner.result(),
00951 ofs, "shift_jis");
00952 static_cast<CppUnit::XmlOutputter*>(outputter)->setStyleSheet(xsl);
00953 break;
00954 case COMPILER_OUT :
00955 outputter = new CppUnit::CompilerOutputter(&runner.result(),*stream);
00956 break;
00957 }
00958 runner.setOutputter(outputter);
00959 runner.run();
00960 return 0;
00961 }
00962 #endif // MAIN
00963 #endif // SdoOrganization_cpp