diff options
author | msmit <msmit@remedy.nl> | 2009-02-13 15:23:07 +0000 |
---|---|---|
committer | msmit <msmit@remedy.nl> | 2009-02-13 15:23:07 +0000 |
commit | d331f916e1239830a68d4debefb2d0a2171b25a8 (patch) | |
tree | 12f19c517891ba019b3c21bb13a4122af527dc4c | |
parent | d90c67ff881e4e636c88076af7222fa9885dea80 (diff) | |
download | ATCD-d331f916e1239830a68d4debefb2d0a2171b25a8.tar.gz |
Fri Feb 13 15:22:39 UTC 2009 Marcel Smit <msmit@remedy.nl>
* tests/Big_Reply/Test.idl:
* tests/Bug_3430_Regression/Bug_3430_Regression.mpc:
* tests/ZIOP/client.cpp:
* tests/ZIOP/Hello.cpp:
* tests/ZIOP/Hello.h:
* tests/ZIOP/run_test.pl:
* tests/ZIOP/server.cpp:
* tests/ZIOP/Test.idl:
* tests/ZIOP/ZIOP.mpc:
Updated to meet the latest ZIOP changes (see previous
commits).
-rw-r--r-- | TAO/ChangeLog | 14 | ||||
-rw-r--r-- | TAO/tests/Big_Reply/Test.idl | 2 | ||||
-rw-r--r-- | TAO/tests/ZIOP/Hello.cpp | 32 | ||||
-rw-r--r-- | TAO/tests/ZIOP/Hello.h | 5 | ||||
-rw-r--r-- | TAO/tests/ZIOP/Test.idl | 9 | ||||
-rw-r--r-- | TAO/tests/ZIOP/ZIOP.mpc | 1 | ||||
-rw-r--r-- | TAO/tests/ZIOP/client.cpp | 243 | ||||
-rwxr-xr-x | TAO/tests/ZIOP/run_test.pl | 4 | ||||
-rw-r--r-- | TAO/tests/ZIOP/server.cpp | 49 |
9 files changed, 312 insertions, 47 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 334cc60a602..ffa651bdefa 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,17 @@ +Fri Feb 13 15:22:39 UTC 2009 Marcel Smit <msmit@remedy.nl> + + * tests/Big_Reply/Test.idl: + * tests/Bug_3430_Regression/Bug_3430_Regression.mpc: + * tests/ZIOP/client.cpp: + * tests/ZIOP/Hello.cpp: + * tests/ZIOP/Hello.h: + * tests/ZIOP/run_test.pl: + * tests/ZIOP/server.cpp: + * tests/ZIOP/Test.idl: + * tests/ZIOP/ZIOP.mpc: + Updated to meet the latest ZIOP changes (see previous + commits). + Fri Feb 13 15:17:39 UTC 2009 Johnny Willemsen <jwillemsen@remedy.nl> * orbsvcs/orbsvcs/HTIOP/HTIOP_Transport.cpp diff --git a/TAO/tests/Big_Reply/Test.idl b/TAO/tests/Big_Reply/Test.idl index 442d6a746be..f17457681f9 100644 --- a/TAO/tests/Big_Reply/Test.idl +++ b/TAO/tests/Big_Reply/Test.idl @@ -7,7 +7,7 @@ module Test interface Big_Reply { /// Receive a big reply - Octet_Seq get_big_reply (); + Octet_Seq get_big_reply (in Octet_Seq octet_in); /// Ping message void ping (); diff --git a/TAO/tests/ZIOP/Hello.cpp b/TAO/tests/ZIOP/Hello.cpp index 8d092e0a4f6..db7ffe13818 100644 --- a/TAO/tests/ZIOP/Hello.cpp +++ b/TAO/tests/ZIOP/Hello.cpp @@ -8,15 +8,45 @@ ACE_RCSID(Hello, Hello, "$Id$") Hello::Hello (CORBA::ORB_ptr orb) : orb_ (CORBA::ORB::_duplicate (orb)) { + length_ = 4000000; } char * Hello::get_string (const char * mystring) { ACE_DEBUG ((LM_DEBUG, "Received <%s>\n", mystring)); - return CORBA::string_dup ("Hello there!Hello there!Hello there!Hello there!Hello there!Hello there!Hello there!Hello there!Hello there!\n"); + return CORBA::string_dup ("Hello there!Hello there!Hello there!Hello there!Hello there!Hello there!Hello there!Hello there!Hello there!"); } + +Test::Octet_Seq * +Hello::get_big_reply () +{ + Test::Octet_Seq_var reply_mesg = + new Test::Octet_Seq (this->length_); + + reply_mesg->length (this->length_); + + return reply_mesg._retn (); +} + +void +Hello::big_request (const ::Test::Octet_Seq & octet_in) +{ + if (octet_in.length () > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("Server side BLOB received\n"))); + } + else + { + ACE_DEBUG ((LM_ERROR, + ACE_TEXT("Error recieving BLOB on server\n"))); + } +} + + + void Hello::shutdown (void) { diff --git a/TAO/tests/ZIOP/Hello.h b/TAO/tests/ZIOP/Hello.h index 17f91192fe8..dbbd2d62e2a 100644 --- a/TAO/tests/ZIOP/Hello.h +++ b/TAO/tests/ZIOP/Hello.h @@ -16,6 +16,9 @@ public: /// Constructor Hello (CORBA::ORB_ptr orb); + virtual Test::Octet_Seq *get_big_reply (); + virtual void big_request (const ::Test::Octet_Seq & octet_in); + // = The skeleton methods virtual char * get_string (const char * mystring); @@ -24,6 +27,8 @@ public: private: /// Use an ORB reference to conver strings to objects and shutdown /// the application. + CORBA::ULong length_; + CORBA::ORB_var orb_; }; diff --git a/TAO/tests/ZIOP/Test.idl b/TAO/tests/ZIOP/Test.idl index 5d218fd76d2..7e5383ef267 100644 --- a/TAO/tests/ZIOP/Test.idl +++ b/TAO/tests/ZIOP/Test.idl @@ -5,12 +5,21 @@ /// Put the interfaces in a module, to avoid global namespace pollution module Test { + /// for big files + typedef sequence<octet> Octet_Seq; + /// A very simple interface interface Hello { /// Return a simple string string get_string (in string mystring); + /// Return binary info + Octet_Seq get_big_reply (); + + ///recieve a large number of bytes + void big_request (in Octet_Seq octet_in); + /// A method to shutdown the ORB /** * This method is used to simplify the test shutdown process diff --git a/TAO/tests/ZIOP/ZIOP.mpc b/TAO/tests/ZIOP/ZIOP.mpc index 22fab2e866e..9eb91d4ceb5 100644 --- a/TAO/tests/ZIOP/ZIOP.mpc +++ b/TAO/tests/ZIOP/ZIOP.mpc @@ -24,6 +24,7 @@ project(*Server): taoserver, compression, ziop, codecfactory, zlibcompressor { project(*Client): taoclient, compression, ziop, codecfactory, zlibcompressor { after += *idl + libs += TAO_TC Source_Files { client.cpp } diff --git a/TAO/tests/ZIOP/client.cpp b/TAO/tests/ZIOP/client.cpp index ced5329dd13..23bd1bd82c9 100644 --- a/TAO/tests/ZIOP/client.cpp +++ b/TAO/tests/ZIOP/client.cpp @@ -3,7 +3,10 @@ #include "TestC.h" #include "ace/Get_Opt.h" #include "tao/ZIOP/ZIOP.h" +#include "ace/OS.h" #include "tao/Compression/zlib/ZlibCompressor_Factory.h" +#include "tao/ORB_Constants.h" +#include "tao/TransportCurrent/TCC.h" ACE_RCSID(Hello, client, "$Id$") @@ -35,12 +38,183 @@ parse_args (int argc, ACE_TCHAR *argv[]) return 0; } +void log_statistics (ACE_TCHAR* test, + ::TAO::CounterT initial_bytes_send, + ::TAO::CounterT initial_bytes_recv, + ::TAO::CounterT bytes_send_after_test, + ::TAO::CounterT bytes_recv_after_test) +{ + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%s statistics:") + ACE_TEXT (" initial bytes sent:%d") + ACE_TEXT (" initial bytes recv:%d") + ACE_TEXT (" bytes sent after test:%d") + ACE_TEXT (" bytes recv after test:%d\n"), + test, + initial_bytes_send, + initial_bytes_recv, + bytes_send_after_test, + bytes_recv_after_test)); +} + +void start_low_value_test(Test::Hello_ptr hello, ::TAO::Transport::Current_ptr tc) +{ +#if defined (TAO_HAS_TRANSPORT_CURRENT) && TAO_HAS_TRANSPORT_CURRENT == 1 +// ::TAO::CounterT initial_bytes_sent = tc->bytes_sent (); +// ::TAO::CounterT initial_bytes_recv = tc->bytes_received (); +#endif + + ACE_DEBUG((LM_DEBUG, + ACE_TEXT("Start get_string; large compression ratio\n"))); + + CORBA::String_var the_string = hello->get_string ("This is a test string" + "This is a test string" + "This is a test string" + "This is a test string" + "This is a test string" + "This is a test string" + "This is a test string" + "This is a test string" + "This is a test string"); + ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n", + the_string.in ())); + +#if defined (TAO_HAS_TRANSPORT_CURRENT) && TAO_HAS_TRANSPORT_CURRENT ==1 +// log_statistics ("low_value_test", initial_bytes_sent, initial_bytes_recv, +// tc->bytes_sent (), tc->bytes_received ()); +#endif +} + +void start_min_ratio_test (Test::Hello_ptr hello, ::TAO::Transport::Current_ptr tc) +{ +#if defined (TAO_HAS_TRANSPORT_CURRENT) && TAO_HAS_TRANSPORT_CURRENT ==1 +// ::TAO::CounterT initial_bytes_sent = tc->bytes_sent (); +// ::TAO::CounterT initial_bytes_recv = tc->bytes_received (); +#endif + + ACE_DEBUG((LM_DEBUG, + ACE_TEXT("Start get_string; small compression ratio\n"))); + + //shouldn't compress since compress_ratio < min_ratio + CORBA::String_var the_string = hello->get_string ("!@#$#%^#@&^%*$@#GFGSd" + "fgdbdfgwe%^@#$#$%EQRT" + "sfdgdafs56#$@@#$&((%$" + "#4&%3#4%^21@!sdfSADHv" + "dsaAhn~1`2#$#sAFDGHdf"); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n", + the_string.in ())); + +#if defined (TAO_HAS_TRANSPORT_CURRENT) && TAO_HAS_TRANSPORT_CURRENT ==1 +// log_statistics ("min_ratio_test", initial_bytes_sent, initial_bytes_recv, +// tc->bytes_sent (), tc->bytes_received ()); +#endif +} + +void start_big_reply_test (Test::Hello_ptr hello, ::TAO::Transport::Current_ptr tc) +{ +#if defined (TAO_HAS_TRANSPORT_CURRENT) && TAO_HAS_TRANSPORT_CURRENT ==1 +// ::TAO::CounterT initial_bytes_sent = tc->bytes_sent (); +// ::TAO::CounterT initial_bytes_recv = tc->bytes_received (); +#endif + + ACE_DEBUG((LM_DEBUG, + ACE_TEXT("Start get_big_reply; large compression ratio\n"))); + + //Prepare to send a large number of bytes. Should be compressed + Test::Octet_Seq_var dummy = hello->get_big_reply (); + if (dummy.ptr ()->length () > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("Client side BLOB received\n"))); + } + else + { + ACE_DEBUG ((LM_ERROR, + ACE_TEXT("Error recieving BLOB on Client\n"))); + } + +#if defined (TAO_HAS_TRANSPORT_CURRENT) && TAO_HAS_TRANSPORT_CURRENT ==1 +// log_statistics ("big_reply_test",initial_bytes_sent, initial_bytes_recv, +// tc->bytes_sent (), tc->bytes_received ()); +#endif +} + +void start_big_request_test (Test::Hello_ptr hello, ::TAO::Transport::Current_ptr tc) +{ +#if defined (TAO_HAS_TRANSPORT_CURRENT) && TAO_HAS_TRANSPORT_CURRENT ==1 +// ::TAO::CounterT initial_bytes_sent = tc->bytes_sent (); +// ::TAO::CounterT initial_bytes_recv = tc->bytes_received (); +#endif + + ACE_DEBUG((LM_DEBUG, + ACE_TEXT("Start big_request; large compression ratio\n"))); + //ACE_OS::sleep(1); + int length = 2000; + Test::Octet_Seq send_msg(length); + send_msg.length (length); + + hello->big_request(send_msg); + +#if defined (TAO_HAS_TRANSPORT_CURRENT) && TAO_HAS_TRANSPORT_CURRENT ==1 +// log_statistics ("big_request_test", initial_bytes_sent, initial_bytes_recv, +// tc->bytes_sent (), tc->bytes_received ()); +#endif +} + +void start_tests (Test::Hello_ptr hello, ::TAO::Transport::Current_ptr tc) +{ + //::CORBA::String_var rhost (tc->remote_host ()); + //::CORBA::String_var lhost (tc->local_host ()); + //::CORBA::Long id = tc->id (); + //::TAO::CounterT bs = tc->bytes_sent (); + //::TAO::CounterT br = tc->bytes_received (); + //::TAO::CounterT rs = tc->messages_sent (); + //::TAO::CounterT rr = tc->messages_received (); + + +#if !defined (TAO_HAS_TRANSPORT_CURRENT) || TAO_HAS_TRANSPORT_CURRENT == 0 + ACE_DEBUG((LM_DEBUG, + ACE_TEXT ("No statistical information available since TAO_HAS_TRANSPORT_CURRENT is not set"))); +#endif + + start_low_value_test (hello, tc); + + start_min_ratio_test (hello, tc); + + start_big_reply_test (hello, tc); + + start_big_request_test (hello, tc); +} + int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { + int extra_argc = 2; + try { - CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + ACE_TCHAR **extra = 0; + ACE_NEW_RETURN (extra, ACE_TCHAR *[extra_argc], -1); + extra[0] = ACE::strnew (ACE_TEXT ("-ORBSvcConfDirective")); + extra[1] = ACE::strnew (ACE_TEXT ("dynamic TAO_Transport_Current_Loader Service_Object") + ACE_TEXT (" * TAO_TC:_make_TAO_Transport_Current_Loader() ''")); + + ACE_TCHAR **largv = new ACE_TCHAR *[argc+extra_argc]; + for (int i = 0; i < argc; i++) + largv[i] = argv[i]; + + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("client adding args: "))); + for (int i = 0; i < extra_argc; i++) + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s "), extra[i])); + largv[argc+i] = extra[i]; + } + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); + + argc += extra_argc; + + CORBA::ORB_var orb = CORBA::ORB_init (argc, largv); if (parse_args (argc, argv) != 0) return 1; @@ -63,27 +237,40 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) Compression::CompressorFactory_var compr_fact = compressor_factory; manager->register_factory(compr_fact.in ()); - CORBA::Boolean comp_enables = true; - CORBA::ULong min_value = 0; - CORBA::Any compression_enabled; - CORBA::Any compmin; Compression::CompressorIdLevelList compressor_id_list(2); compressor_id_list.length(2); - Compression::CompressorIdLevel levelid; - levelid.compressor_id = Compression::COMPRESSORID_ZLIB; - levelid.compression_level = 9; - compressor_id_list[0] = levelid; - levelid.compressor_id = Compression::COMPRESSORID_BZIP2; - compressor_id_list[1] = levelid; + compressor_id_list[0].compressor_id = Compression::COMPRESSORID_ZLIB; + compressor_id_list[0].compression_level = 5; + compressor_id_list[1].compressor_id = Compression::COMPRESSORID_BZIP2; + compressor_id_list[1].compression_level = 5; + + //Setting policy whether compression is used. + CORBA::Boolean compression_enabling = true; + CORBA::Any compression_enabling_any; + compression_enabling_any <<= CORBA::Any::from_boolean(compression_enabling); + + //Setting policy for minimum amount of bytes that needs to be + //compressed. If a message is smaller than this, it doesn't get + //compressed + CORBA::ULong compression_low_value = 100; + CORBA::Any low_value_any; + low_value_any <<= compression_low_value; + + CORBA::Any min_compression_ratio_any; + CORBA::Long min_compression_ratio = 75; + min_compression_ratio_any <<= min_compression_ratio; + CORBA::Any compressor_id_any; compressor_id_any <<= compressor_id_list; - compression_enabled <<= CORBA::Any::from_boolean (comp_enables); - compmin <<= min_value; - CORBA::PolicyList policies (3); - policies.length (3); - policies[0] = orb->create_policy (ZIOP::COMPRESSION_ENABLING_POLICY_ID, compression_enabled); - policies[1] = orb->create_policy (ZIOP::COMPRESSION_LOW_VALUE_POLICY_ID, compmin); - policies[2] = orb->create_policy(ZIOP::COMPRESSOR_ID_LEVEL_LIST_POLICY_ID,compressor_id_any); + + CORBA::PolicyList policies(4); + policies.length(4); + + policies[0] = orb->create_policy (ZIOP::COMPRESSION_ENABLING_POLICY_ID, compression_enabling_any); + policies[1] = orb->create_policy (ZIOP::COMPRESSOR_ID_LEVEL_LIST_POLICY_ID, compressor_id_any); + policies[2] = orb->create_policy (ZIOP::COMPRESSION_LOW_VALUE_POLICY_ID, low_value_any); + policies[3] = orb->create_policy (ZIOP::COMPRESSION_MIN_RATIO_POLICY_ID, min_compression_ratio_any); + CORBA::Object_var tmp = orb->string_to_object(ior); CORBA::Object_var tmp2 = tmp->_set_policy_overrides (policies, CORBA::ADD_OVERRIDE); @@ -97,14 +284,24 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) 1); } - CORBA::String_var the_string = hello->get_string ("This is a test stringThis is a test stringThis is a test stringThis is a test stringThis is a test stringThis is a test stringThis is a test stringThis is a test stringThis is a test string\n"); - - ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n", - the_string.in ())); + CORBA::Object_var tcobject = + orb->resolve_initial_references ("TAO::Transport::Current"); + + ::TAO::Transport::Current_var tc = + ::TAO::Transport::Current::_narrow (tcobject.in ()); + if (CORBA::is_nil (tc.in ())) + throw ::CORBA::INTERNAL (); + + start_tests(hello.in (), tc.in ()); hello->shutdown (); - + orb->destroy (); + + for (int i = 0; i < extra_argc; i++) + ACE::strdelete (extra[i]); + delete [] extra; + delete [] largv; } catch (const CORBA::Exception& ex) { diff --git a/TAO/tests/ZIOP/run_test.pl b/TAO/tests/ZIOP/run_test.pl index 80e8a03725c..a036aecd5f3 100755 --- a/TAO/tests/ZIOP/run_test.pl +++ b/TAO/tests/ZIOP/run_test.pl @@ -26,8 +26,8 @@ my $client_iorfile = $client->LocalFile ($iorbase); $server->DeleteFile($iorbase); $client->DeleteFile($iorbase); -$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile"); -$CL = $client->CreateProcess ("client", "-k file://$client_iorfile"); +$SV = $server->CreateProcess ("server", "-o $server_iorfile -ORBdebuglevel $debug_level"); +$CL = $client->CreateProcess ("client", "-k file://$client_iorfile -ORBdebuglevel $debug_level"); $server_status = $SV->Spawn (); if ($server_status != 0) { diff --git a/TAO/tests/ZIOP/server.cpp b/TAO/tests/ZIOP/server.cpp index 4d8e1a7353e..7af7f1885c0 100644 --- a/TAO/tests/ZIOP/server.cpp +++ b/TAO/tests/ZIOP/server.cpp @@ -7,13 +7,14 @@ #include "tao/Compression/zlib/ZlibCompressor_Factory.h" #include "tao/Policy_ManagerC.h" #include "tao/Policy_CurrentC.h" +#include "tao/Transport.h" ACE_RCSID (Hello, server, "$Id$") const ACE_TCHAR *ior_output_file = ACE_TEXT("test.ior"); -Compression::CompressionLevel level = 9; +Compression::CompressionLevel level = 6; int parse_args (int argc, ACE_TCHAR *argv[]) @@ -84,33 +85,41 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) if (parse_args (argc, argv) != 0) return 1; - CORBA::Boolean compression_enabling = true; Compression::CompressorIdLevelList compressor_id_list(2); compressor_id_list.length(2); - Compression::CompressorIdLevel levelid; - levelid.compressor_id = Compression::COMPRESSORID_ZLIB; - levelid.compression_level = 9; - compressor_id_list[0] = levelid; - levelid.compressor_id = Compression::COMPRESSORID_BZIP2; - compressor_id_list[1] = levelid; - //CORBA::ULong compression_low_value = 16384; - //CORBA::ULong min_compression_ratio = 40; - CORBA::Any compression_enabling_any;//, compressor_id_any, low_value_any; - //CORBA::Any min_compression_ratio_any; + compressor_id_list[0].compressor_id = Compression::COMPRESSORID_ZLIB; + compressor_id_list[0].compression_level = 6; + compressor_id_list[1].compressor_id = Compression::COMPRESSORID_BZIP2; + compressor_id_list[1].compression_level = 6; + + //Setting policy whether compression is used. + CORBA::Boolean compression_enabling = true; + CORBA::Any compression_enabling_any; compression_enabling_any <<= CORBA::Any::from_boolean(compression_enabling); + + //Setting policy for minimum amount of bytes that needs to be + //compressed. If a message is smaller than this, it doesn't get + //compressed + CORBA::ULong compression_low_value = 100; + CORBA::Any low_value_any; + low_value_any <<= compression_low_value; + + CORBA::Any min_compression_ratio_any; + CORBA::Long min_compression_ratio = 40; + min_compression_ratio_any <<= min_compression_ratio; + CORBA::Any compressor_id_any; compressor_id_any <<= compressor_id_list; - //low_value_any <<= compression_low_value; - //min_compression_ratio_any <<= min_compression_ratio; + PortableServer::POA_var my_compress_poa = 0; - CORBA::PolicyList policies(2); - policies.length(2); + CORBA::PolicyList policies(4); + policies.length(4); try { - policies[0] = orb->create_policy(ZIOP::COMPRESSION_ENABLING_POLICY_ID, compression_enabling_any); - policies[1] = orb->create_policy(ZIOP::COMPRESSOR_ID_LEVEL_LIST_POLICY_ID,compressor_id_any); - //policies[2] = orb->create_policy(ZIOP::COMPRESSION_LOW_VALUE_POLICY_ID,compressor_id_any); - //policies[3] = orb->create_policy(ZIOP::MIN_COMPRESSION_RATIO_POLICY_ID,min_compression_ratio); + policies[0] = orb->create_policy (ZIOP::COMPRESSION_ENABLING_POLICY_ID, compression_enabling_any); + policies[1] = orb->create_policy (ZIOP::COMPRESSOR_ID_LEVEL_LIST_POLICY_ID, compressor_id_any); + policies[2] = orb->create_policy (ZIOP::COMPRESSION_LOW_VALUE_POLICY_ID, low_value_any); + policies[3] = orb->create_policy (ZIOP::COMPRESSION_MIN_RATIO_POLICY_ID, min_compression_ratio_any); my_compress_poa = root_poa->create_POA("My_Compress_Poa", 0, policies); } catch(const CORBA::PolicyError&) { |