From c47809df59703674750cba277cd9186e7151711f Mon Sep 17 00:00:00 2001 From: yamuna Date: Thu, 27 Jun 2002 02:29:51 +0000 Subject: ChangelogTag: Wed June 26 2:09:00 2002 Yamuna Krishnamurthy --- TAO/tests/RTCORBA/Diffserv/client.cpp | 70 +++++++---------------------------- TAO/tests/RTCORBA/Diffserv/server.cpp | 55 ++++----------------------- 2 files changed, 21 insertions(+), 104 deletions(-) diff --git a/TAO/tests/RTCORBA/Diffserv/client.cpp b/TAO/tests/RTCORBA/Diffserv/client.cpp index 199163e1c5d..6943778a10e 100644 --- a/TAO/tests/RTCORBA/Diffserv/client.cpp +++ b/TAO/tests/RTCORBA/Diffserv/client.cpp @@ -1,15 +1,12 @@ // $Id$ #include "testC.h" -//#include "Client_ORBInitializer.h" #include "tao/RTCORBA/RTCORBA.h" #include "tao/RTCORBA/RT_Policy_i.h" #include "tao/RTCORBA/Network_Priority_Mapping_Manager.h" #include "tao/RTCORBA/Network_Priority_Mapping.h" #include "ace/Get_Opt.h" #include "Custom_Network_Priority_Mapping.h" -//#include "../check_supported_priorities.cpp" -//#include "../main_thread_policy.cpp" #include "tao/Stub.h" const char *ior = "file://test1.ior"; @@ -73,7 +70,7 @@ change_network_priority (int enable_network_priority, RTCORBA::ProtocolProperties::_duplicate (tcp_properties.in ()); protocols[0].orb_protocol_properties = RTCORBA::ProtocolProperties::_nil (); - + CORBA::PolicyList policy_list; policy_list.length (1); policy_list[0] = @@ -165,6 +162,8 @@ parse_args (int argc, char *argv[]) "-k " "-n " "-p " + "-s [test server setting dscp]" + "-c [test client setting dscp]" "\n", argv [0]), -1); @@ -180,6 +179,7 @@ toggle (int &i) i = 1; else i = 0; } + int main (int argc, char *argv[]) { @@ -188,22 +188,14 @@ main (int argc, char *argv[]) ACE_TRY_NEW_ENV { - // Initialize and obtain reference to the Test object. CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - //set_main_thread_policy (orb.in ()); - - // Make sure we can support multiple priorities that are required - // for this test. - // check_supported_priorities (); - //check_supported_priorities (orb.in ()); - - if (parse_args (argc, argv) != 0) return 1; + // Initialize and obtain reference to the Test object. CORBA::Object_var client_object = orb->string_to_object (ior ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; @@ -220,33 +212,7 @@ main (int argc, char *argv[]) 1); } - // Check that the object is configured with CLIENT_PROPAGATED - // PriorityModelPolicy. - // CORBA::Policy_var policy = - // server->_get_policy (RTCORBA::PRIORITY_MODEL_POLICY_TYPE - // ACE_ENV_ARG_PARAMETER); - // ACE_TRY_CHECK; - - // RTCORBA::PriorityModelPolicy_var priority_policy = - // RTCORBA::PriorityModelPolicy::_narrow (policy.in () ACE_ENV_ARG_PARAMETER); - // ACE_TRY_CHECK; - - // if (CORBA::is_nil (priority_policy.in ())) - // ACE_ERROR_RETURN ((LM_ERROR, - // "ERROR: Priority Model Policy not exposed!\n"), - // 1); - - // RTCORBA::PriorityModel priority_model = - // priority_policy->priority_model (ACE_ENV_SINGLE_ARG_PARAMETER); - // ACE_TRY_CHECK; - - // if (priority_model != RTCORBA::CLIENT_PROPAGATED) - // ACE_ERROR_RETURN ((LM_ERROR, - // "ERROR: priority_model != " - // "RTCORBA::CLIENT_PROPAGATED!\n"), - // 1); - - + //Resolve the Network priority Mapping Manager CORBA::Object_var object = orb->resolve_initial_references ("NetworkPriorityMappingManager" ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; @@ -256,18 +222,16 @@ main (int argc, char *argv[]) ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; + // Initialize the custom priority mapping TAO_Custom_Network_Priority_Mapping *cnpm = 0; ACE_NEW_RETURN (cnpm, TAO_Custom_Network_Priority_Mapping, -1); + //Set the desired corba priority on the network mapping manager cnpm->desired_priority (desired_priority); - - //RTCORBA::NetworkPriorityMapping_var npm = - //RTCORBA::NetworkPriorityMapping::_narrow (tnpm - // ACE_ENV_ARG_PARAMETER); - //ACE_TRY_CHECK; + //Load the custom network priority mapping object in the network priority //mapping manager. The user can thus add his own priority mapping. mapping_manager->mapping (cnpm); ACE_DEBUG ((LM_DEBUG, @@ -280,23 +244,14 @@ main (int argc, char *argv[]) RTCORBA::Current_var current = RTCORBA::Current::_narrow (object.in () ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - + + // Set the native priority current->the_priority (0 ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - //CORBA::Short priority = - // current->the_priority (ACE_ENV_SINGLE_ARG_PARAMETER); - // ACE_TRY_CHECK; - - // if (desired_priority != priority) - // ACE_ERROR_RETURN ((LM_ERROR, - // "ERROR: Unable to set thread " - // "priority to %d\n", desired_priority), - // 1); - int enp = 0; //enable_network_priority - // Make several invocation, + // Make several invocation, for (int i = 0; i < n; ++i) { switch (i) @@ -323,6 +278,7 @@ main (int argc, char *argv[]) ACE_TRY_CHECK; } + // Shut down Server ORB. server->shutdown ();//(0 ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; diff --git a/TAO/tests/RTCORBA/Diffserv/server.cpp b/TAO/tests/RTCORBA/Diffserv/server.cpp index cccdb0a78d0..dceee8b0150 100644 --- a/TAO/tests/RTCORBA/Diffserv/server.cpp +++ b/TAO/tests/RTCORBA/Diffserv/server.cpp @@ -4,8 +4,6 @@ #include "ace/Get_Opt.h" #include "tao/RTCORBA/RTCORBA.h" #include "tao/RTPortableServer/RTPortableServer.h" -//#include "../check_supported_priorities.cpp" -//#include "../main_thread_policy.cpp" #include "tao/RTCORBA/Network_Priority_Mapping_Manager.h" #include "tao/RTCORBA/Network_Priority_Mapping.h" #include "Custom_Network_Priority_Mapping.h" @@ -97,7 +95,7 @@ parse_args (int argc, char *argv[]) while ((c = get_opts ()) != -1) switch (c) { - case 'p': + case 'k': ior_output_file1 = get_opts.opt_arg (); break; @@ -105,7 +103,7 @@ parse_args (int argc, char *argv[]) ior_output_file2 = get_opts.opt_arg (); break; - case 'a': + case 'p': result = ::sscanf (get_opts.opt_arg (), "%hd", &poa_priority); @@ -123,39 +121,20 @@ parse_args (int argc, char *argv[]) test_client = 1; test_server = 0; break; - -// case 'b': -// result = ::sscanf (get_opts.opt_arg (), -// "%hd", -// &object_priority); -// if (result == 0 || result == EOF) -// ACE_ERROR_RETURN ((LM_ERROR, -// "Unable to process <-b> option"), -// -1); -// break; - case '?': default: ACE_ERROR_RETURN ((LM_ERROR, "usage: %s " - "-p " + "-k " "-o " - "-a " - "-b " + "-p " + "-s [test_server setting of dscp]" + "-c [test client setting of dscp]" "\n", argv [0]), -1); } - // if (poa_priority < 0) - // ACE_ERROR_RETURN ((LM_ERROR, - // "Valid poa and object priorities must be" - // " specified.\nSee README file for more info\n"), - // -1); - - // if (object_priority < 0) - // object_priority = poa_priority; - return 0; } @@ -182,12 +161,6 @@ create_object (RTPortableServer::POA_ptr poa, // Register with poa. PortableServer::ObjectId_var id; - //if (priority > -1) - // id = poa->activate_object_with_priority (server_impl, - // priority - // ACE_ENV_ARG_PARAMETER); - // else - id = poa->activate_object (server_impl ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (-1); @@ -234,9 +207,6 @@ main (int argc, char *argv[]) CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - // set_main_thread_policy (orb.in ()); - // check_supported_priorities (orb.in ()); - // Parse arguments. if (parse_args (argc, argv) != 0) return 1; @@ -266,10 +236,6 @@ main (int argc, char *argv[]) root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; - // Create child POA with SERVER_DECLARED PriorityModelPolicy, - // and MULTIPLE_ID id uniqueness policy (so we can use one - // servant to create several objects). - // Servant. Test_i server_impl (orb.in ()); @@ -280,11 +246,6 @@ main (int argc, char *argv[]) if (test_client) { poa_policy_list.length (1); - //poa_policy_list[0] = - // rt_orb->create_priority_model_policy (RTCORBA::SERVER_DECLARED, - // poa_priority - // ACE_ENV_ARG_PARAMETER); - // ACE_TRY_CHECK; poa_policy_list[0] = root_poa->create_id_uniqueness_policy (PortableServer::MULTIPLE_ID @@ -306,7 +267,7 @@ main (int argc, char *argv[]) if (check_for_nil (poa_without_ds.in (), "RTPOA") == -1) return 1; - // Create object 2 (override POA's priority). + // Create object 1 ACE_DEBUG ((LM_DEBUG, "\nActivated object two as ")); result = create_object (rt_poa_without_ds.in (), orb.in (), &server_impl, ior_output_file1 ACE_ENV_ARG_PARAMETER); @@ -375,7 +336,7 @@ main (int argc, char *argv[]) return 1; - // Create object 1 (it will inherit POA's priority). + // Create object 2 (it will inherit POA's priority). ACE_DEBUG ((LM_DEBUG, "\nActivated object one as ")); result = create_object (rt_poa_with_ds.in (), orb.in (), &server_impl, ior_output_file2 ACE_ENV_ARG_PARAMETER); -- cgit v1.2.1