diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2010-09-06 19:42:45 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2010-09-06 19:42:45 +0000 |
commit | b8c9f4bb12a65e8e3238cc21bb961dbb17378115 (patch) | |
tree | 10751c9b8a41122a82418bfa8da146b32d6de995 | |
parent | eeaa7c56d4d72342450f815e6d4fe1b2ea987bf4 (diff) | |
download | ATCD-b8c9f4bb12a65e8e3238cc21bb961dbb17378115.tar.gz |
ChangeLogTag: Mon Sep 6 19:42:08 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r-- | ChangeLog | 29 | ||||
-rw-r--r-- | tests/Alt_Mapping/alt_mapping.idl | 6 | ||||
-rw-r--r-- | tests/Alt_Mapping/alt_mapping.mpc | 72 | ||||
-rw-r--r-- | tests/Alt_Mapping/alt_mapping_i.cpp | 12 | ||||
-rw-r--r-- | tests/Alt_Mapping/alt_mapping_i.h | 7 | ||||
-rw-r--r-- | tests/Alt_Mapping/client.cpp | 2 | ||||
-rw-r--r-- | tests/Alt_Mapping/driver.cpp | 44 | ||||
-rw-r--r-- | tests/Alt_Mapping/options.cpp | 2 | ||||
-rw-r--r-- | tests/Alt_Mapping/options.h | 3 | ||||
-rwxr-xr-x | tests/Alt_Mapping/run_test.pl | 2 | ||||
-rw-r--r-- | tests/Alt_Mapping/server.cpp | 6 | ||||
-rw-r--r-- | tests/Alt_Mapping/tests.h | 1 | ||||
-rw-r--r-- | tests/Alt_Mapping/ub_str_seq.cpp | 200 | ||||
-rw-r--r-- | tests/Alt_Mapping/ub_str_seq.h | 59 | ||||
-rw-r--r-- | tests/Alt_Mapping/ub_struct_seq.cpp | 3 | ||||
-rw-r--r-- | tests/Alt_Mapping/ub_struct_seq.h | 2 |
16 files changed, 405 insertions, 45 deletions
diff --git a/ChangeLog b/ChangeLog index 619a9805a2d..c835bfbcbde 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,32 @@ +Mon Sep 6 19:42:08 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu> + + * tests/Alt_Mapping/ub_str_seq.cpp: + * tests/Alt_Mapping/ub_str_seq.h: + + New files, defining a test for unbounded + sequence of string. + + * tests/Alt_Mapping/alt_mapping.mpc: + + Added new files to project, and refactored + projects to separate client and server + executables from stub and skeleton libraries. + + * tests/Alt_Mapping/options.h: + * tests/Alt_Mapping/alt_mapping_i.cpp: + * tests/Alt_Mapping/server.cpp: + * tests/Alt_Mapping/tests.h: + * tests/Alt_Mapping/alt_mapping_i.h: + * tests/Alt_Mapping/client.cpp: + * tests/Alt_Mapping/alt_mapping.idl: + * tests/Alt_Mapping/ub_struct_seq.cpp: + * tests/Alt_Mapping/ub_struct_seq.h: + * tests/Alt_Mapping/options.cpp: + * tests/Alt_Mapping/driver.cpp: + * tests/Alt_Mapping/run_test.pl: + + Changes to cover the added string sequence test. + Mon Sep 6 15:24:49 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu> * tests/Alt_Mapping/server.cpp: diff --git a/tests/Alt_Mapping/alt_mapping.idl b/tests/Alt_Mapping/alt_mapping.idl index bd70a846da0..6869d40f344 100644 --- a/tests/Alt_Mapping/alt_mapping.idl +++ b/tests/Alt_Mapping/alt_mapping.idl @@ -1,5 +1,7 @@ // $Id$ +#include "tao/StringSeq.pidl" + interface Alt_Mapping { string test_unbounded_string (in string s1, @@ -23,6 +25,10 @@ interface Alt_Mapping inout StructSeq s2, out StructSeq s3); + CORBA::StringSeq test_strseq (in CORBA::StringSeq s1, + inout CORBA::StringSeq s2, + out CORBA::StringSeq s3); + void shutdown (); // Shutdown the server: this is useful to check for memory leaks, // performance results and in general to verify that orderly diff --git a/tests/Alt_Mapping/alt_mapping.mpc b/tests/Alt_Mapping/alt_mapping.mpc index 302f66953ee..48eecc37dee 100644 --- a/tests/Alt_Mapping/alt_mapping.mpc +++ b/tests/Alt_Mapping/alt_mapping.mpc @@ -4,46 +4,47 @@ project(*idl): taoidldefaults { IDL_Files { idlflags -= -Sa -St - idlflags += -Gstl + idlflags += -Wb,stub_export_macro=ALT_MAPPING_STUB_Export \ + -Wb,stub_export_include=alt_mapping_stub_export.h \ + -Wb,skel_export_macro=ALT_MAPPING_SKEL_Export \ + -Wb,skel_export_include=alt_mapping_skel_export.h \ + -Gxhst -Gxhsk -Gstl alt_mapping.idl } custom_only = 1 } -project(*Server): taoserver, codeset, avoids_minimum_corba, avoids_corba_e_compact, avoids_corba_e_micro { - after += *idl +project(*Stub): taolib, anytypecode, codeset, avoids_minimum_corba, avoids_ace_for_tao { + sharedname = Alt_Mapping_Stub + after += *idl + dynamicflags += ALT_MAPPING_STUB_BUILD_DLL IDL_Files { } - + Source_Files { - alt_mappingS.cpp alt_mappingC.cpp - alt_mapping_i.cpp - server.cpp } Header_Files { - alt_mappingS.h alt_mappingC.h - alt_mapping_i.h + alt_mapping_stub_export.h } Inline_Files { - alt_mappingS.inl alt_mappingC.inl } } -project(*Client): taoserver, codeset, avoids_minimum_corba, avoids_ace_for_tao { +project(*Client): taoexe, codeset { exename = client - after += *idl + after += *Stub + libs += Alt_Mapping_Stub IDL_Files { } Source_Files { - alt_mappingC.cpp client.cpp driver.cpp helper.cpp @@ -51,20 +52,61 @@ project(*Client): taoserver, codeset, avoids_minimum_corba, avoids_ace_for_tao { results.cpp ub_string.cpp ub_struct_seq.cpp + ub_str_seq.cpp } Header_Files { - alt_mappingC.h driver.h helper.h options.h results.h ub_string.h ub_struct_seq.h + ub_str_seq.h + } +} + +project(*Skel): portableserver, codeset, avoids_minimum_corba, avoids_corba_e_compact, avoids_corba_e_micro { + sharedname = Alt_Mapping_Skel + after += *Stub + libs += Alt_Mapping_Stub + dynamicflags += ALT_MAPPING_SKEL_BUILD_DLL + + IDL_Files { + } + + Source_Files { + alt_mappingS.cpp + alt_mapping_i.cpp + } + + Header_Files { + alt_mappingS.h + alt_mapping_i.h + alt_mapping_skel_export.h + } + + Inline_Files { + alt_mappingS.inl + } +} + +project(*Server): taoexe, codeset, portableserver { + exename = server + after += *Skel + libs += Alt_Mapping_Skel Alt_Mapping_Stub + + IDL_Files { + } + + Source_Files { + server.cpp + } + + Header_Files { } Inline_Files { - alt_mappingC.inl } } diff --git a/tests/Alt_Mapping/alt_mapping_i.cpp b/tests/Alt_Mapping/alt_mapping_i.cpp index f9392cbfda5..48d1134f89f 100644 --- a/tests/Alt_Mapping/alt_mapping_i.cpp +++ b/tests/Alt_Mapping/alt_mapping_i.cpp @@ -47,9 +47,17 @@ Alt_Mapping_i::test_struct_sequence ( Alt_Mapping::StructSeq & s2, Alt_Mapping::StructSeq & s3) { - // We copy the "in" sequences into all the inout, out and return sequences. + s2 = s1; + s3 = s1; + return s1; +} - // now copy all elements of s1 into the others using the assignment operator +CORBA::StringSeq +Alt_Mapping_i::test_strseq ( + const CORBA::StringSeq & s1, + CORBA::StringSeq & s2, + CORBA::StringSeq & s3) +{ s2 = s1; s3 = s1; return s1; diff --git a/tests/Alt_Mapping/alt_mapping_i.h b/tests/Alt_Mapping/alt_mapping_i.h index 5360f329137..a1eb16f045b 100644 --- a/tests/Alt_Mapping/alt_mapping_i.h +++ b/tests/Alt_Mapping/alt_mapping_i.h @@ -15,7 +15,7 @@ #include "alt_mappingS.h" -class Alt_Mapping_i : public POA_Alt_Mapping +class ALT_MAPPING_SKEL_Export Alt_Mapping_i : public POA_Alt_Mapping { // = TITLE // Alt_Mapping_i @@ -35,6 +35,11 @@ public: const Alt_Mapping::StructSeq & s1, Alt_Mapping::StructSeq & s2, Alt_Mapping::StructSeq & s3); + + virtual CORBA::StringSeq test_strseq ( + const CORBA::StringSeq & s1, + CORBA::StringSeq & s2, + CORBA::StringSeq & s3); void shutdown (void); diff --git a/tests/Alt_Mapping/client.cpp b/tests/Alt_Mapping/client.cpp index ff7cfae34e7..b5e936b6e3c 100644 --- a/tests/Alt_Mapping/client.cpp +++ b/tests/Alt_Mapping/client.cpp @@ -146,7 +146,7 @@ Alt_Mapping_Client<T>::run_sii_test (void) opname)); } - return this->results_.error_count ()? -1 : 0; + return this->results_.error_count () ? -1 : 0; } #endif /* CLIENT_CPP */ diff --git a/tests/Alt_Mapping/driver.cpp b/tests/Alt_Mapping/driver.cpp index 1a5c6380d8c..9d9f70bb5a1 100644 --- a/tests/Alt_Mapping/driver.cpp +++ b/tests/Alt_Mapping/driver.cpp @@ -118,10 +118,13 @@ Driver::run (void) { case Options::TEST_UB_STRING: { - Alt_Mapping_Client<Test_Unbounded_String> *client = new - Alt_Mapping_Client<Test_Unbounded_String> (this->orb_.in (), - this->objref_.in(), - new Test_Unbounded_String); + Alt_Mapping_Client<Test_Unbounded_String> *client = + new + Alt_Mapping_Client<Test_Unbounded_String> ( + this->orb_.in (), + this->objref_.in(), + new Test_Unbounded_String); + retstatus = client->run_sii_test (); delete client; @@ -129,25 +132,30 @@ Driver::run (void) break; case Options::TEST_UB_STRUCT_SEQUENCE: { - Alt_Mapping_Client<Test_Unbounded_Struct_Sequence> *client = new - Alt_Mapping_Client<Test_Unbounded_Struct_Sequence> ( - this->orb_.in (), - this->objref_.in(), - new Test_Unbounded_Struct_Sequence); + Alt_Mapping_Client<Test_Unbounded_Struct_Sequence> *client = + new + Alt_Mapping_Client<Test_Unbounded_Struct_Sequence> ( + this->orb_.in (), + this->objref_.in(), + new Test_Unbounded_Struct_Sequence); retstatus = client->run_sii_test (); delete client; + } + break; + case Options::TEST_UB_STRING_SEQUENCE: + { + Alt_Mapping_Client<Test_String_Sequence> *client = + new + Alt_Mapping_Client<Test_String_Sequence> ( + this->orb_.in (), + this->objref_.in(), + new Test_String_Sequence); + + retstatus = client->run_sii_test (); - Alt_Mapping_Client<Test_Unbounded_Struct_Sequence> *client2 = new - Alt_Mapping_Client<Test_Unbounded_Struct_Sequence> - (this->orb_.in (), - this->objref_.in(), - new Test_Unbounded_Struct_Sequence); - - retstatus = client2->run_sii_test (); - - delete client2; + delete client; } break; default: diff --git a/tests/Alt_Mapping/options.cpp b/tests/Alt_Mapping/options.cpp index 66055e12438..979db1b8e34 100644 --- a/tests/Alt_Mapping/options.cpp +++ b/tests/Alt_Mapping/options.cpp @@ -93,6 +93,8 @@ Options::parse_args (int argc, ACE_TCHAR **argv) this->test_type_ = Options::TEST_UB_STRING; else if (!ACE_OS::strcmp (get_opts.opt_arg (), ACE_TEXT("ub_struct_seq"))) this->test_type_ = Options::TEST_UB_STRUCT_SEQUENCE; + else if (!ACE_OS::strcmp (get_opts.opt_arg (), ACE_TEXT("ub_strseq"))) + this->test_type_ = Options::TEST_UB_STRING_SEQUENCE; break; case '?': diff --git a/tests/Alt_Mapping/options.h b/tests/Alt_Mapping/options.h index d6596a5b74f..d6f61d1511d 100644 --- a/tests/Alt_Mapping/options.h +++ b/tests/Alt_Mapping/options.h @@ -37,7 +37,8 @@ public: { NO_TEST, TEST_UB_STRING, - TEST_UB_STRUCT_SEQUENCE + TEST_UB_STRUCT_SEQUENCE, + TEST_UB_STRING_SEQUENCE }; enum INVOKE_TYPE diff --git a/tests/Alt_Mapping/run_test.pl b/tests/Alt_Mapping/run_test.pl index a39ea895ae8..8b13d25c2ef 100755 --- a/tests/Alt_Mapping/run_test.pl +++ b/tests/Alt_Mapping/run_test.pl @@ -24,7 +24,7 @@ $status = 0; # Parse the arguments -@types = ("ubstring", "ub_struct_seq"); +@types = ("ubstring", "ub_struct_seq", "ub_strseq"); for ($i = 0; $i <= $#ARGV; $i++) { diff --git a/tests/Alt_Mapping/server.cpp b/tests/Alt_Mapping/server.cpp index f020fc1f858..7d4a81fc6a8 100644 --- a/tests/Alt_Mapping/server.cpp +++ b/tests/Alt_Mapping/server.cpp @@ -103,14 +103,14 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) temp = oa_ptr->id_to_reference (id); - CORBA::String_var str = + std::string str = orb_ptr->object_to_string (temp.in ()); if (TAO_debug_level > 0) { ACE_DEBUG ((LM_DEBUG, "(%P|%t) The IOR is <%s>\n", - str.in ())); + str.c_str ())); } ior_output_file = ACE_OS::fopen (ior_output_filename, "w"); @@ -125,7 +125,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) ACE_OS::fprintf (ior_output_file, "%s", - str.in ()); + str.c_str ()); ACE_OS::fclose (ior_output_file); diff --git a/tests/Alt_Mapping/tests.h b/tests/Alt_Mapping/tests.h index ed6cdb30ef8..3f2f8e3e3fb 100644 --- a/tests/Alt_Mapping/tests.h +++ b/tests/Alt_Mapping/tests.h @@ -18,5 +18,6 @@ #include "ub_struct_seq.h" #include "ub_string.h" +#include "ub_str_seq.h" #endif /* if !defined */ diff --git a/tests/Alt_Mapping/ub_str_seq.cpp b/tests/Alt_Mapping/ub_str_seq.cpp new file mode 100644 index 00000000000..a2e36b6c0f7 --- /dev/null +++ b/tests/Alt_Mapping/ub_str_seq.cpp @@ -0,0 +1,200 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/tests/Param_Test +// +// = FILENAME +// ub_str_seq.cpp +// +// = DESCRIPTION +// tests unbounded string sequences +// +// = AUTHORS +// Aniruddha Gokhale +// +// ============================================================================ + +#include "helper.h" +#include "ub_str_seq.h" + +// ************************************************************************ +// Test_String_Sequence +// ************************************************************************ + +Test_String_Sequence::Test_String_Sequence (void) + : opname_ (CORBA::string_dup ("test_strseq")) +{ +} + +Test_String_Sequence::~Test_String_Sequence (void) +{ + CORBA::string_free (this->opname_); + this->opname_ = 0; +} + +const char * +Test_String_Sequence::opname (void) const +{ + return this->opname_; +} + +int +Test_String_Sequence::init_parameters (Alt_Mapping_ptr) +{ + const char *choiceList[] = + { + "one", + "two", + "three", + "four" + }; + + CORBA::ULong len = sizeof(choiceList)/sizeof(char *) - 1; + + // set the length of the sequences + this->in_.resize (len); + this->inout_.resize (len); + + // now set each individual element + for (CORBA::ULong i = 0; i < this->in_.size (); i++) + { + this->in_[i] = choiceList[i]; + this->inout_[i] = choiceList[i + 1]; + } + + return 0; +} + +int +Test_String_Sequence::reset_parameters (void) +{ + this->inout_.clear (); + this->out_.clear (); + this->ret_.clear (); + + return 0; +} + +int +Test_String_Sequence::run_sii_test (Alt_Mapping_ptr objref) +{ + try + { + this->ret_ = objref->test_strseq (this->in_, + this->inout_, + this->out_); + + return 0; + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Test_String_Sequence::run_sii_test\n"); + + } + + return -1; +} + +CORBA::Boolean +Test_String_Sequence::check_validity (void) +{ + CORBA::Boolean flag = false; + + if ((this->in_.size () == this->inout_.size ()) && + (this->in_.size () == this->out_.size ()) && + (this->in_.size () == this->ret_.size ())) + { + flag = true; + + // Now compare the contents + for (CORBA::ULong i = 0; i < this->in_.size () && flag; i++) + { + if (this->in_[i] != this->inout_[i] + || this->in_[i] != this->out_[i] + || this->in_[i] != this->ret_[i]) + { + flag = false; + } + } + } + + return flag; +} + +void +Test_String_Sequence::print_values (void) +{ + CORBA::ULong i; + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); + + for (i = 0; i < this->in_.size (); i++) + { + ACE_DEBUG ((LM_DEBUG, + "Element #%d\n" + "in : %s\n", + i, + (this->in_[i].size () > 0 + ? this->in_[i].c_str () + : "<empty>"))); + } + + if (this->in_.size () == 0) + { + ACE_DEBUG ((LM_DEBUG, "\nin sequence is empty\n")); + } + + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); + + for (i = 0; i < this->inout_.size (); i++) + { + ACE_DEBUG ((LM_DEBUG, + "Element #%d\n" + "in : %s\n", + i, + (this->inout_[i].size () > 0 + ? this->inout_[i].c_str () + : "<empty>"))); + } + if (!this->inout_.size () == 0) + { + ACE_DEBUG ((LM_DEBUG, "\ninout sequence is empty\n")); + } + + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); + + for ( i = 0; i < this->out_.size (); i++) + { + ACE_DEBUG ((LM_DEBUG, + "Element #%d\n" + "in : %s\n", + i, + (this->out_[i].size () > 0 + ? this->out_[i].c_str () + : "<empty>"))); + } + if (!this->out_.size () == 0) + { + ACE_DEBUG ((LM_DEBUG, "\nout sequence is empty\n")); + } + + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); + + for (i = 0; i < this->ret_.size (); i++) + { + ACE_DEBUG ((LM_DEBUG, + "Element #%d\n" + "in : %s\n", + i, + (this->ret_[i].size () > 0 + ? this->ret_[i].c_str () + : "<empty>"))); + } + if (!this->ret_.size () == 0) + { + ACE_DEBUG ((LM_DEBUG, "\nreturn sequence is empty\n")); + } + + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); +} diff --git a/tests/Alt_Mapping/ub_str_seq.h b/tests/Alt_Mapping/ub_str_seq.h new file mode 100644 index 00000000000..584664869b1 --- /dev/null +++ b/tests/Alt_Mapping/ub_str_seq.h @@ -0,0 +1,59 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/tests/Param_Test +// +// = FILENAME +// ub_str_seq.h +// +// = DESCRIPTION +// Tests sequences of strings +// +// = AUTHORS +// Aniruddha Gokhale +// +// ============================================================================ + +#ifndef PARAM_TEST_UNBOUNDED_STRING_SEQUENCE_H +#define PARAM_TEST_UNBOUNDED_STRING_SEQUENCE_H + +#include "alt_mappingC.h" + +// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +// test typedefed sequences (in our case, sequences of strings) +// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* + +class Test_String_Sequence +{ +public: + Test_String_Sequence (void); + + ~Test_String_Sequence (void); + + int run_sii_test (Alt_Mapping_ptr objref); + + const char *opname (void) const; + + int init_parameters (Alt_Mapping_ptr objref); + + int reset_parameters (void); + + CORBA::Boolean check_validity (void); + + void print_values (void); + +private: + char *opname_; + + CORBA::StringSeq in_; + + CORBA::StringSeq inout_; + + CORBA::StringSeq out_; + + CORBA::StringSeq ret_; +}; + +#endif /* PARAM_TEST_UNBOUNDED_STRING_SEQUENCE_H */ diff --git a/tests/Alt_Mapping/ub_struct_seq.cpp b/tests/Alt_Mapping/ub_struct_seq.cpp index 568fafb76b2..456140f8fc6 100644 --- a/tests/Alt_Mapping/ub_struct_seq.cpp +++ b/tests/Alt_Mapping/ub_struct_seq.cpp @@ -34,8 +34,6 @@ Test_Unbounded_Struct_Sequence::~Test_Unbounded_Struct_Sequence ( { CORBA::string_free (this->opname_); this->opname_ = 0; - // the other data members will be freed as they are "_var"s and objects - // (rather than pointers to objects) } const char * @@ -95,6 +93,7 @@ Test_Unbounded_Struct_Sequence::run_sii_test ( ex._tao_print_exception ("Test_Struct_Sequence::run_sii_test\n"); } + return -1; } diff --git a/tests/Alt_Mapping/ub_struct_seq.h b/tests/Alt_Mapping/ub_struct_seq.h index a79a5fcf70a..04d3308af8b 100644 --- a/tests/Alt_Mapping/ub_struct_seq.h +++ b/tests/Alt_Mapping/ub_struct_seq.h @@ -61,7 +61,7 @@ protected: // print individual sequence private: - char *opname_; + char *opname_; Alt_Mapping::StructSeq in_; |