summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/Notify
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/orbsvcs/tests/Notify')
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/AdminProperties.cpp223
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/AdminProperties.h22
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/ConnectDisconnect.cpp51
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/ConnectDisconnect.h4
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/Events.cpp18
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/Events.h4
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/Filter.cpp11
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/Filter.h4
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/IdAssignment.cpp7
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/LifeCycle.cpp19
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/MultiTypes.cpp97
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/MultiTypes.h4
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/Sequence.cpp18
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/Sequence.h4
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/Simple.cpp18
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/Simple.h4
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/Updates.cpp15
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/Updates.h4
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/adminproperties.conf4
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/notify.mt.conf2
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/notify.rt.conf2
-rwxr-xr-xTAO/orbsvcs/tests/Notify/Basic/run_test.pl21
-rw-r--r--TAO/orbsvcs/tests/Notify/Blocking/Notify_Structured_Push_Consumer.cpp93
-rw-r--r--TAO/orbsvcs/tests/Notify/Blocking/Notify_Structured_Push_Consumer.h6
24 files changed, 268 insertions, 387 deletions
diff --git a/TAO/orbsvcs/tests/Notify/Basic/AdminProperties.cpp b/TAO/orbsvcs/tests/Notify/Basic/AdminProperties.cpp
index 38f8e9002de..0e2e370f177 100644
--- a/TAO/orbsvcs/tests/Notify/Basic/AdminProperties.cpp
+++ b/TAO/orbsvcs/tests/Notify/Basic/AdminProperties.cpp
@@ -9,7 +9,8 @@
/***************************************************************************/
AdminProperties_Task::AdminProperties_Task (void)
- :supplier_ (0), client_ (0)
+ : supplier_ (0)
+ , client_ (0)
{
}
@@ -23,8 +24,7 @@ AdminProperties_Task::init (TAO_Notify_Tests_StructuredPushSupplier *supplier, A
int
AdminProperties_Task::init (int argc, ACE_TCHAR *argv[])
{
- return ACE_Task_Base::init (argc,
- argv);
+ return ACE_Task_Base::init (argc, argv);
}
int
@@ -65,7 +65,7 @@ AdminProperties_Task::svc (void)
int event_count = this->client_->event_count_;
- ACE_DEBUG ((LM_DEBUG, "Supplier sending %d events...\n", event_count));
+ ACE_DEBUG ((LM_DEBUG, "\n1 supplier sending %d events...\n", event_count));
ACE_DECLARE_NEW_CORBA_ENV;
@@ -73,24 +73,25 @@ AdminProperties_Task::svc (void)
{
event.filterable_data[0].value <<= (CORBA::Long)i;
- // Any.
event.remainder_of_body <<= (CORBA::Long)i;
ACE_TRY
{
+ ACE_DEBUG((LM_DEBUG, "+"));
this->supplier_->send_event (event ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
}
ACE_CATCH (CORBA::IMP_LIMIT, impl_limit)
{
- if (TAO_debug_level)
- ACE_DEBUG ((LM_DEBUG, "Event %d was not send due to Impl Limit reached\n", i));
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG, "\nEvent %d was not send due to Impl Limit reached\n", i));
- this->client_->was_rejected_ = 1;
+ ++ this->client_->rejections_;
}
ACE_CATCHANY
{
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Exception sending event\n");
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Error: Exception sending event\n");
+ return 1;
}
ACE_ENDTRY;
}
@@ -100,25 +101,26 @@ return 0;
/***************************************************************************/
AdminProperties_StructuredPushConsumer::AdminProperties_StructuredPushConsumer (AdminProperties* client)
- :client_ (client), events_received_ (0)
+ : client_ (client)
+ , events_received_ (0)
{
+ client_->consumer_start(this);
}
void
AdminProperties_StructuredPushConsumer::push_structured_event (const CosNotification::StructuredEvent & /*notification*/
- ACE_ENV_ARG_DECL_NOT_USED
- )
- ACE_THROW_SPEC ((
- CORBA::SystemException,
- CosEventComm::Disconnected
- ))
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,CosEventComm::Disconnected))
{
++events_received_;
- if (TAO_debug_level)
- ACE_DEBUG ((LM_DEBUG, "Consumer %x received event %d\n", this, events_received_.value ()));
+ if (events_received_ >= client_->max_queue_length_)
+ client_->consumer_done(this);
+
+ ACE_DEBUG((LM_DEBUG, "-"));
- ACE_OS::sleep (this->client_->consumer_delay_);
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "\nConsumer %x received event %d\n", this, events_received_.value ()));
}
/***************************************************************************/
@@ -128,14 +130,12 @@ AdminProperties::AdminProperties (void)
max_consumers_ (3),
max_suppliers_ (3),
reject_new_events_ (0),
- consumer_delay_ (0, 0),
- initial_delay_ (5, 0),
consumers_ (4),
suppliers_ (4),
event_count_ (30),
suppliers_connected_count_ (0),
consumers_connected_count_ (0),
- was_rejected_ (0)
+ rejections_ (0)
{
}
@@ -188,18 +188,6 @@ AdminProperties::parse_args(int argc, char *argv[])
// Number of suppliers to create.
arg_shifter.consume_arg ();
}
- else if ((current_arg = arg_shifter.get_the_parameter ("-ConsumerDelay")))
- {
- this->consumer_delay_ = ACE_Time_Value (ACE_OS::atoi (current_arg), 0); // Consumer delay in secs.
-
- arg_shifter.consume_arg ();
- }
- else if ((current_arg = arg_shifter.get_the_parameter ("-InitialDelay")))
- {
- this->initial_delay_ = ACE_Time_Value (ACE_OS::atoi (current_arg), 0); // Initial delay in secs.
-
- arg_shifter.consume_arg ();
- }
else if (arg_shifter.cur_arg_strncasecmp ("-?") == 0)
{
ACE_DEBUG((LM_DEBUG,
@@ -210,9 +198,7 @@ AdminProperties::parse_args(int argc, char *argv[])
"-reject_new_events [reject_new_events] "
"-consumers [consumers] "
"-suppliers [suppliers] "
- "-event_count [event_count] "
- "-ConsumerDelay [delay_in_sec] "
- "-InitialDelay [delay_in_secs]\n",
+ "-event_count [event_count] ",
argv[0],
argv[0]));
@@ -228,20 +214,11 @@ AdminProperties::parse_args(int argc, char *argv[])
return 0;
}
-int
-AdminProperties::init (int argc,
- char *argv []
- ACE_ENV_ARG_DECL)
+void
+AdminProperties::create_channel(bool reject ACE_ENV_ARG_DECL)
{
- // Initialize base class.
- Notify_Test_Client::init (argc,
- argv
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
-
CosNotifyChannelAdmin::ChannelID id;
- // Initialize the admin object.
initial_admin_.length (4);
this->initial_admin_[0].name =
@@ -260,9 +237,7 @@ AdminProperties::init (int argc,
this->initial_admin_[3].name =
CORBA::string_dup (CosNotification::RejectNewEvents);
- this->initial_admin_[3].value <<= CORBA::Any::from_boolean (
- this->reject_new_events_
- );
+ this->initial_admin_[3].value <<= CORBA::Any::from_boolean (reject);
this->ec_ = notify_factory_->create_channel (this->initial_qos_,
this->initial_admin_,
@@ -288,51 +263,49 @@ AdminProperties::init (int argc,
ACE_CHECK_RETURN (-1);
ACE_ASSERT (!CORBA::is_nil (consumer_admin_.in ()));
-
- return 0;
}
void
AdminProperties::run_test (ACE_ENV_SINGLE_ARG_DECL)
{
- this->test_max_queue_length (ACE_ENV_SINGLE_ARG_PARAMETER);
+ bool reject = true;
+ this->create_channel(reject ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ this->test_max_queue_length (reject ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->ec_->destroy(ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ reject = false;
+ this->create_channel(reject ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ this->test_max_queue_length (reject ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
this->test_max_clients (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK;
- // Destroy the EC and hence release server resources.
this->ec_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
}
void
-AdminProperties::test_max_queue_length (ACE_ENV_SINGLE_ARG_DECL)
+AdminProperties::test_max_queue_length (bool reject ACE_ENV_ARG_DECL)
{
// Create the consumer
AdminProperties_StructuredPushConsumer *consumer;
-
- ACE_NEW (consumer,
- AdminProperties_StructuredPushConsumer (this));
-
- consumer->init (root_poa_.in ()
- ACE_ENV_ARG_PARAMETER);
+ ACE_NEW (consumer, AdminProperties_StructuredPushConsumer (this));
+ consumer->init (root_poa_.in () ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
-
- consumer->connect (this->consumer_admin_.in ()
- ACE_ENV_ARG_PARAMETER);
+ consumer->connect (this->consumer_admin_.in () ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
// Create the supplier
TAO_Notify_Tests_StructuredPushSupplier *supplier = 0;
- ACE_NEW (supplier,
- TAO_Notify_Tests_StructuredPushSupplier ());
-
- supplier->init (root_poa_.in ()
- ACE_ENV_ARG_PARAMETER);
+ ACE_NEW (supplier, TAO_Notify_Tests_StructuredPushSupplier ());
+ supplier->init (root_poa_.in () ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
-
- supplier->connect (this->supplier_admin_.in ()
- ACE_ENV_ARG_PARAMETER);
+ supplier->connect (this->supplier_admin_.in () ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
AdminProperties_Task supplier_task;
@@ -340,50 +313,56 @@ AdminProperties::test_max_queue_length (ACE_ENV_SINGLE_ARG_DECL)
// Init the Task to send events;
supplier_task.init (supplier, this);
- if (supplier_task.activate (THR_NEW_LWP | THR_JOINABLE,
- 1) != 0)
+ if (supplier_task.activate (THR_NEW_LWP | THR_JOINABLE, 1) != 0)
{
- ACE_ERROR ((LM_ERROR,
- "Cannot activate supplier task\n"));
+ ACE_ERROR ((LM_ERROR, "\nCannot activate supplier task\n"));
}
- ACE_OS::sleep (initial_delay_); // Consumers receive events in the main thread. delay receiving the 1st event.
-
- CORBA::Long previous_count = 0;
-
- do{
- previous_count = consumer->events_received_.value ();
-
- // we add a full 1 sec. to the waiting period for a new event.
- ACE_Time_Value waiting_period (this->consumer_delay_.sec () + 1, 0);
-
- this->orb_->run (waiting_period);
-
- }while (previous_count != consumer->events_received_.value ());
-
- // Test ended.
- // wait for the supplier task to finish.
+ // All supplier events should be sent before the first consumer event is
+ // received. This relies on our use of -ORBClientConnectionHandler RW.
supplier_task.wait ();
+ this->ORB_run(ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // consumer is destroyed by consumer->disconnect()
CORBA::Long received_count = consumer->events_received_.value ();
// disconnect the participants.
consumer->disconnect (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
supplier->disconnect (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
- // check the results and print the assessment.
- // we expect to see event_count_+1 events
+ // If the reject_new_events setting == true, then the supplier should
+ // have received an imp_limit exception for each event it tried to push
+ // after the maximum was reached.
+ // If the reject_new_events setting == false, then the events should
+ // have been discarded according to the DiscardPolicy, which for this
+ // test we leave as AnyOrder.
- ACE_DEBUG ((LM_DEBUG, "Supplier send %d events, consumer received %d events, max_queue_length = %d\n",
+ ACE_DEBUG ((LM_DEBUG, "\nSupplier sent %d events, consumer received %d events, max_queue_length = %d\n",
event_count_, received_count, max_queue_length_));
- if (received_count > this->max_queue_length_ + 1)
- {
- ACE_DEBUG ((LM_ERROR, "Error: MaxQueueLength exceeded, try increasing consumer delay (currently = %d)\n",
- this->consumer_delay_.sec ()));
+ int expected_min = max_queue_length_;
+ int expected_max = max_queue_length_ + max_consumers_;
+ if (reject)
+ {
+ expected_max = event_count_ - rejections_;
+ expected_min = expected_max;
+ }
- if (this->reject_new_events_ == 1 && was_rejected_ == 0)
- ACE_DEBUG ((LM_ERROR, "RejectNewEvents failed\n"));
+ if (reject && rejections_ != event_count_ - received_count)
+ {
+ ACE_ERROR ((LM_ERROR, "\nError: Expected %d rejections, but got %d\n",
+ event_count_ - received_count, rejections_));
+ return;
+ }
+
+ if (received_count < expected_min || received_count > expected_max)
+ {
+ ACE_ERROR ((LM_ERROR, "\nError: Expected %d to %d events, but received %d\n",
+ expected_min, expected_max, received_count));
}
}
@@ -398,11 +377,11 @@ AdminProperties::test_max_clients (ACE_ENV_SINGLE_ARG_DECL)
// check the results and print the assessment.
if (this->consumers_connected_count_ > this->max_consumers_)
- ACE_DEBUG ((LM_ERROR, "Connected consumers %d, exceed MaxConsumers %d\n",
+ ACE_DEBUG ((LM_ERROR, "\nConnected consumers %d, exceed MaxConsumers %d\n",
this->consumers_connected_count_ > this->max_consumers_));
if (this->suppliers_connected_count_ > this->max_suppliers_)
- ACE_DEBUG ((LM_ERROR, "Connected suppliers %d, exceed MaxSuppliers %d\n",
+ ACE_DEBUG ((LM_ERROR, "\nConnected suppliers %d, exceed MaxSuppliers %d\n",
this->suppliers_connected_count_ > this->max_suppliers_));
}
@@ -424,8 +403,7 @@ AdminProperties::create_suppliers (ACE_ENV_SINGLE_ARG_DECL)
{
ACE_NEW (supplier,
TAO_Notify_Tests_StructuredPushSupplier ());
- supplier->init (root_poa_.in ()
- ACE_ENV_ARG_PARAMETER);
+ supplier->init (root_poa_.in () ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
supplier->connect (this->supplier_admin_.in ()
@@ -438,12 +416,12 @@ AdminProperties::create_suppliers (ACE_ENV_SINGLE_ARG_DECL)
ACE_CATCH (CORBA::IMP_LIMIT, impl_limit)
{
if (TAO_debug_level)
- ACE_DEBUG ((LM_DEBUG, "Impl Limit excpetion when connecting supplier\n"));
+ ACE_DEBUG ((LM_DEBUG, "\nImpl Limit excpetion when connecting supplier\n"));
}
ACE_CATCHANY
{
ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "Exception in connecting supplier\n");
+ "\nError: Exception in connecting supplier\n");
}
ACE_ENDTRY;
}
@@ -464,14 +442,11 @@ AdminProperties::create_consumers (ACE_ENV_SINGLE_ARG_DECL)
for (index = 0; index < this->consumers_; ++index)
{
- ACE_NEW (consumer,
- TAO_Notify_Tests_StructuredPushConsumer ());
- consumer->init (root_poa_.in ()
- ACE_ENV_ARG_PARAMETER);
+ ACE_NEW (consumer, TAO_Notify_Tests_StructuredPushConsumer ());
+ consumer->init (root_poa_.in () ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
- consumer->connect (this->consumer_admin_.in ()
- ACE_ENV_ARG_PARAMETER);
+ consumer->connect (this->consumer_admin_.in () ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
this->consumers_connected_count_++;
@@ -480,13 +455,12 @@ AdminProperties::create_consumers (ACE_ENV_SINGLE_ARG_DECL)
ACE_CATCH (CORBA::IMP_LIMIT, impl_limit)
{
if (TAO_debug_level)
- ACE_DEBUG ((LM_DEBUG, "Impl Limit excpetion when connecting consumer\n"));
+ ACE_DEBUG ((LM_DEBUG, "\nImpl Limit exception when connecting consumer\n"));
}
ACE_CATCHANY
{
- if (TAO_debug_level)
ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "Exception in connecting consumer \n");
+ "\nError: Exception in connecting consumer \n");
}
ACE_ENDTRY;
}
@@ -500,24 +474,15 @@ main (int argc, char* argv[])
ACE_TRY_NEW_ENV
{
- test.init (argc,
- argv
- ACE_ENV_ARG_PARAMETER);
+ test.init (argc, argv ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
test.run_test (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
}
- ACE_CATCH (CORBA::UserException, ue)
- {
- ACE_PRINT_EXCEPTION (ue,
- "Events user error: ");
- return 1;
- }
- ACE_CATCH (CORBA::SystemException, se)
+ ACE_CATCH (CORBA::Exception, se)
{
- ACE_PRINT_EXCEPTION (se,
- "Events system error: ");
+ ACE_PRINT_EXCEPTION (se, "Error: ");
return 1;
}
ACE_ENDTRY;
diff --git a/TAO/orbsvcs/tests/Notify/Basic/AdminProperties.h b/TAO/orbsvcs/tests/Notify/Basic/AdminProperties.h
index 5090fa15f31..44abf483bf7 100644
--- a/TAO/orbsvcs/tests/Notify/Basic/AdminProperties.h
+++ b/TAO/orbsvcs/tests/Notify/Basic/AdminProperties.h
@@ -97,26 +97,23 @@ public:
AdminProperties (void);
~AdminProperties (void);
- int parse_args (int argc,
- char *argv[]) ;
+ int parse_args (int argc, char *argv[]) ;
- int init (int argc,
- char *argv []
- ACE_ENV_ARG_DECL);
// Initialization.
void run_test (ACE_ENV_SINGLE_ARG_DECL);
// Run the test.
-protected:
+private:
void create_suppliers (ACE_ENV_SINGLE_ARG_DECL);
void create_consumers (ACE_ENV_SINGLE_ARG_DECL);
+ void create_channel(bool reject ACE_ENV_ARG_DECL);
/// Test MaxSuppliers and MaxConsumers
void test_max_clients (ACE_ENV_SINGLE_ARG_DECL);
/// Test MaxQueueLength properties
- void test_max_queue_length (ACE_ENV_SINGLE_ARG_DECL);
+ void test_max_queue_length (bool reject ACE_ENV_ARG_DECL);
// Data Members
CosNotifyChannelAdmin::EventChannel_var ec_;
@@ -134,12 +131,6 @@ protected:
CORBA::Boolean reject_new_events_;
// Values for Admin Properties supplied by user.
- /// Consumer Delay.
- ACE_Time_Value consumer_delay_;
-
- /// Inital delay.
- ACE_Time_Value initial_delay_;
-
/// Number of consumers to connect to check MaxConsumers property.
CORBA::Long consumers_;
@@ -155,9 +146,8 @@ protected:
/// Count of consumers successfully connect to the EC.
int consumers_connected_count_;
- /// Boolean flag that is set if the IMPL_LIMIT exception is thrown when trying to
- /// exceed the Max_Queue_Length
- CORBA::Boolean was_rejected_;
+ // Number of supplier pushes that resulted in an IMP_LIMIT exception
+ int rejections_;
};
#endif /* ADMINPROPERTIES */
diff --git a/TAO/orbsvcs/tests/Notify/Basic/ConnectDisconnect.cpp b/TAO/orbsvcs/tests/Notify/Basic/ConnectDisconnect.cpp
index d66d372563f..f82175451cb 100644
--- a/TAO/orbsvcs/tests/Notify/Basic/ConnectDisconnect.cpp
+++ b/TAO/orbsvcs/tests/Notify/Basic/ConnectDisconnect.cpp
@@ -47,9 +47,9 @@ ConnectDisconnect::ConnectDisconnect (void)
any_supplier_ (0),
structured_supplier_ (0),
sequence_supplier_ (0),
- count_ (10),
- consumers_ (10),
- suppliers_ (10)
+ count_ (3),
+ consumers_ (3),
+ suppliers_ (3)
{
}
@@ -111,8 +111,6 @@ ConnectDisconnect::init (int argc,
// How many are we counting..?
this->expected_count_ = count_ * (consumers_ * 3 + suppliers_ * 3);
- // this->expected_count_ = 10*(10*2 + 0);
-
// Create the consumers and suppliers.
// Arrays of Consumers.
@@ -137,6 +135,7 @@ ConnectDisconnect::init (int argc,
TAO_Notify_Tests_SequencePushSupplier*[this->suppliers_],
-1);
+ consumer_start( 0 );
return 0;
}
@@ -153,19 +152,16 @@ ConnectDisconnect::parse_args(int argc, char *argv[])
if ((current_arg = arg_shifter.get_the_parameter ("-count")))
{
this->count_ = ACE_OS::atoi (current_arg);
- // The number of counsumers to create.
arg_shifter.consume_arg ();
}
else if ((current_arg = arg_shifter.get_the_parameter ("-consumers")))
{
this->consumers_ = ACE_OS::atoi (current_arg);
- // The number of suppliers to create.
arg_shifter.consume_arg ();
}
else if ((current_arg = arg_shifter.get_the_parameter ("-suppliers")))
{
this->suppliers_ = ACE_OS::atoi (current_arg);
- // The number of iterations to connect disconnect.
arg_shifter.consume_arg ();
}
else if (arg_shifter.cur_arg_strncasecmp ("-?") == 0)
@@ -325,28 +321,22 @@ ConnectDisconnect::run_test (ACE_ENV_SINGLE_ARG_DECL)
void
ConnectDisconnect::end_test (ACE_ENV_SINGLE_ARG_DECL)
{
- this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+ consumer_done( 0 );
}
int
ConnectDisconnect::check_results (void)
{
- ACE_DEBUG ((LM_DEBUG,
- "result_count_ = %d",
- this->result_count_.value ()));
- ACE_DEBUG ((LM_DEBUG,
- " expected_count_ = %d\n",
- this->expected_count_));
+ ACE_DEBUG ((LM_DEBUG, "result_count_ = %d", this->result_count_.value ()));
+ ACE_DEBUG ((LM_DEBUG, " expected_count_ = %d\n", this->expected_count_));
if (this->result_count_ != this->expected_count_)
{
- ACE_DEBUG ((LM_DEBUG,
- "ConnectDisconnect test failed\n"));
+ ACE_DEBUG ((LM_DEBUG, "ConnectDisconnect test failed\n"));
}
else
{
- ACE_DEBUG ((LM_DEBUG,
- "ConnectDisconnect test succeded\n"));
+ ACE_DEBUG ((LM_DEBUG, "ConnectDisconnect test succeeded\n"));
}
// Destroy the channel.
@@ -371,9 +361,7 @@ main (int argc, char* argv[])
ACE_TRY_NEW_ENV
{
- client.init (argc,
- argv
- ACE_ENV_ARG_PARAMETER);
+ client.init (argc, argv ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
client.run_test (ACE_ENV_SINGLE_ARG_PARAMETER);
@@ -382,16 +370,9 @@ main (int argc, char* argv[])
client.end_test (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
}
- ACE_CATCH (CORBA::UserException, ue)
+ ACE_CATCH (CORBA::Exception, se)
{
- ACE_PRINT_EXCEPTION (ue,
- "ConnectDisconnect user error: ");
- return 1;
- }
- ACE_CATCH (CORBA::SystemException, se)
- {
- ACE_PRINT_EXCEPTION (se,
- "ConnectDisconnect system error: ");
+ ACE_PRINT_EXCEPTION (se, "Error: ");
return 1;
}
ACE_ENDTRY;
@@ -399,11 +380,3 @@ main (int argc, char* argv[])
return client.check_results ();
}
-
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-
-
-#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-
-
-#endif /*ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/orbsvcs/tests/Notify/Basic/ConnectDisconnect.h b/TAO/orbsvcs/tests/Notify/Basic/ConnectDisconnect.h
index a08cd5dd3ad..eb98ba33e2b 100644
--- a/TAO/orbsvcs/tests/Notify/Basic/ConnectDisconnect.h
+++ b/TAO/orbsvcs/tests/Notify/Basic/ConnectDisconnect.h
@@ -25,7 +25,9 @@
#include "Notify_SequencePushSupplier.h"
#if defined(_MSC_VER)
+#if (_MSC_VER >= 1200)
#pragma warning(push)
+#endif /* _MSC_VER >= 1200 */
#pragma warning(disable:4250)
#endif /* _MSC_VER */
@@ -129,7 +131,7 @@ protected:
/***************************************************************************/
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
#pragma warning(pop)
#endif /* _MSC_VER */
diff --git a/TAO/orbsvcs/tests/Notify/Basic/Events.cpp b/TAO/orbsvcs/tests/Notify/Basic/Events.cpp
index d75a23f4404..4f818fad8a9 100644
--- a/TAO/orbsvcs/tests/Notify/Basic/Events.cpp
+++ b/TAO/orbsvcs/tests/Notify/Basic/Events.cpp
@@ -139,6 +139,8 @@ Events::init (int argc,
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (-1);
+ consumer_start( 0 );
+
return 0;
}
@@ -292,7 +294,7 @@ Events::run_test (ACE_ENV_SINGLE_ARG_DECL)
void
Events::end_test (ACE_ENV_SINGLE_ARG_DECL)
{
- this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+ consumer_done( 0 );
}
int
@@ -339,18 +341,12 @@ main (int argc, char* argv[])
events.run_test (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
- events.ORB_run ();
- }
- ACE_CATCH (CORBA::UserException, ue)
- {
- ACE_PRINT_EXCEPTION (ue,
- "Events user error: ");
- return 1;
+ events.ORB_run( ACE_ENV_SINGLE_ARG_PARAMETER );
+ ACE_TRY_CHECK;
}
- ACE_CATCH (CORBA::SystemException, se)
+ ACE_CATCH (CORBA::Exception, se)
{
- ACE_PRINT_EXCEPTION (se,
- "Events system error: ");
+ ACE_PRINT_EXCEPTION (se, "Error: ");
return 1;
}
ACE_ENDTRY;
diff --git a/TAO/orbsvcs/tests/Notify/Basic/Events.h b/TAO/orbsvcs/tests/Notify/Basic/Events.h
index e7493489b67..1c2ad251bcb 100644
--- a/TAO/orbsvcs/tests/Notify/Basic/Events.h
+++ b/TAO/orbsvcs/tests/Notify/Basic/Events.h
@@ -22,7 +22,9 @@
#include "Notify_StructuredPushSupplier.h"
#if defined(_MSC_VER)
+#if (_MSC_VER >= 1200)
#pragma warning(push)
+#endif /* _MSC_VER >= 1200 */
#pragma warning(disable:4250)
#endif /* _MSC_VER */
@@ -125,7 +127,7 @@ private:
/***************************************************************************/
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
#pragma warning(pop)
#endif /* _MSC_VER */
diff --git a/TAO/orbsvcs/tests/Notify/Basic/Filter.cpp b/TAO/orbsvcs/tests/Notify/Basic/Filter.cpp
index 0cf0b43eae4..6a93dd7bf8b 100644
--- a/TAO/orbsvcs/tests/Notify/Basic/Filter.cpp
+++ b/TAO/orbsvcs/tests/Notify/Basic/Filter.cpp
@@ -237,16 +237,9 @@ main (int argc, char* argv[])
events.run_test (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
}
- ACE_CATCH (CORBA::UserException, ue)
+ ACE_CATCH (CORBA::Exception, se)
{
- ACE_PRINT_EXCEPTION (ue,
- "Events user error: ");
- return 1;
- }
- ACE_CATCH (CORBA::SystemException, se)
- {
- ACE_PRINT_EXCEPTION (se,
- "Events system error: ");
+ ACE_PRINT_EXCEPTION (se, "Error: ");
return 1;
}
ACE_ENDTRY;
diff --git a/TAO/orbsvcs/tests/Notify/Basic/Filter.h b/TAO/orbsvcs/tests/Notify/Basic/Filter.h
index 9bd93156d6d..a0f6e83f80b 100644
--- a/TAO/orbsvcs/tests/Notify/Basic/Filter.h
+++ b/TAO/orbsvcs/tests/Notify/Basic/Filter.h
@@ -21,7 +21,9 @@
#include "Notify_PushSupplier.h"
#if defined(_MSC_VER)
+#if (_MSC_VER >= 1200)
#pragma warning(push)
+#endif /* _MSC_VER >= 1200 */
#pragma warning(disable:4250)
#endif /* _MSC_VER */
@@ -85,7 +87,7 @@ protected:
/***************************************************************************/
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
#pragma warning(pop)
#endif /* _MSC_VER */
diff --git a/TAO/orbsvcs/tests/Notify/Basic/IdAssignment.cpp b/TAO/orbsvcs/tests/Notify/Basic/IdAssignment.cpp
index d6e52a015d8..ebfd98f3df1 100644
--- a/TAO/orbsvcs/tests/Notify/Basic/IdAssignment.cpp
+++ b/TAO/orbsvcs/tests/Notify/Basic/IdAssignment.cpp
@@ -7,8 +7,8 @@
#include "orbsvcs/CosNotifyCommC.h"
#include "IdAssignment.h"
-ACE_RCSID (Notify_Tests,
- IdAssignment,
+ACE_RCSID (Notify_Tests,
+ IdAssignment,
"$Id$")
IdAssignment::IdAssignment (void)
@@ -478,8 +478,7 @@ int main (int argc, char* argv[])
}
ACE_CATCHANY
{
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "Caught exception:");
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Error: ");
return 1;
}
ACE_ENDTRY;
diff --git a/TAO/orbsvcs/tests/Notify/Basic/LifeCycle.cpp b/TAO/orbsvcs/tests/Notify/Basic/LifeCycle.cpp
index 4f48407b6af..0bb420600c7 100644
--- a/TAO/orbsvcs/tests/Notify/Basic/LifeCycle.cpp
+++ b/TAO/orbsvcs/tests/Notify/Basic/LifeCycle.cpp
@@ -9,8 +9,8 @@
#include "LifeCycle.h"
-ACE_RCSID (Notify_Tests,
- LifeCycle,
+ACE_RCSID (Notify_Tests,
+ LifeCycle,
"$Id$")
LifeCycle::LifeCycle (void)
@@ -260,22 +260,9 @@ main (int argc, char *argv[])
test.run_test (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
}
- ACE_CATCH(CosNotification::UnsupportedAdmin, ex)
- {
- ACE_PRINT_EXCEPTION (ex, "Unsupported Admin Properties");
- }
- ACE_CATCH(CosNotification::UnsupportedQoS, ex)
- {
- ACE_PRINT_EXCEPTION (ex, "Unsupported QoS Properties");
- }
- ACE_CATCH(CosNotifyChannelAdmin::AdminNotFound, ex)
- {
- ACE_PRINT_EXCEPTION (ex, "destroying admin object");
- }
ACE_CATCHANY
{
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "Caught exception:");
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Error: ");
return 1;
}
ACE_ENDTRY;
diff --git a/TAO/orbsvcs/tests/Notify/Basic/MultiTypes.cpp b/TAO/orbsvcs/tests/Notify/Basic/MultiTypes.cpp
index 275567eab72..0e438e75142 100644
--- a/TAO/orbsvcs/tests/Notify/Basic/MultiTypes.cpp
+++ b/TAO/orbsvcs/tests/Notify/Basic/MultiTypes.cpp
@@ -98,7 +98,12 @@ MultiTypes::on_received_event (MultiTypes_PushConsumer* consumer)
ACE_DECLARE_NEW_CORBA_ENV;
if (disconnect_on_last_event_ == 1)
+ {
consumer->disconnect (ACE_ENV_SINGLE_ARG_PARAMETER);
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "PushConsumer has been disconnected.\n"));
+ consumer = 0;
+ }
}
void
@@ -112,7 +117,12 @@ MultiTypes::on_received_event (MultiTypes_StructuredPushConsumer* consumer)
ACE_DECLARE_NEW_CORBA_ENV;
if (disconnect_on_last_event_ == 1)
+ {
consumer->disconnect (ACE_ENV_SINGLE_ARG_PARAMETER);
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "StructuredPushConsumer has been disconnected.\n"));
+ consumer = 0;
+ }
}
void
@@ -126,7 +136,12 @@ MultiTypes::on_received_event (MultiTypes_SequencePushConsumer* consumer)
ACE_DECLARE_NEW_CORBA_ENV;
if (disconnect_on_last_event_ == 1)
+ {
consumer->disconnect (ACE_ENV_SINGLE_ARG_PARAMETER);
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "SequencePushConsumer has been disconnected.\n"));
+ consumer = 0;
+ }
}
int
@@ -210,42 +225,15 @@ MultiTypes::init (int argc,
sequence_supplier_->connect (this->supplier_admin_.in () ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (-1);
+ consumer_start( 0 );
+
return 0;
}
int
-MultiTypes::parse_args(int argc, char *argv[])
+MultiTypes::parse_args(int, char **)
{
- ACE_Arg_Shifter arg_shifter (argc,
- argv);
-
- const char *current_arg = 0;
-
- while (arg_shifter.is_anything_left ())
- {
- if ((current_arg = arg_shifter.get_the_parameter ("-count")))
- {
- // The number of counsumers to create.
- arg_shifter.consume_arg ();
- }
- else if (arg_shifter.cur_arg_strncasecmp ("-?") == 0)
- {
- ACE_DEBUG((LM_DEBUG,
- "usage: %s "
- "-count testcount \n",
- argv[0],
- argv[0]));
-
- arg_shifter.consume_arg ();
-
- return -1;
- }
- else
- {
- arg_shifter.ignore_arg ();
- }
- }
-
+ // Doesn't accept any arguments
return 0;
}
@@ -276,7 +264,7 @@ MultiTypes::run_test (ACE_ENV_SINGLE_ARG_DECL)
ACE_CHECK;
if (TAO_debug_level)
- ACE_DEBUG ((LM_DEBUG, "Waiting for consumers to receive the event..\n"));
+ ACE_DEBUG ((LM_DEBUG, "Waiting for consumers to receive the 1 event..\n"));
this->wait_for_all_consumers (1);
/*****************************************************************************/
@@ -298,7 +286,7 @@ MultiTypes::run_test (ACE_ENV_SINGLE_ARG_DECL)
ACE_CHECK;
if (TAO_debug_level)
- ACE_DEBUG ((LM_DEBUG, "Waiting for consumers to receive the event..\n"));
+ ACE_DEBUG ((LM_DEBUG, "Waiting for consumers to receive the 1 event..\n"));
this->wait_for_all_consumers (1);
/*****************************************************************************/
@@ -326,7 +314,7 @@ MultiTypes::run_test (ACE_ENV_SINGLE_ARG_DECL)
ACE_CHECK;
if (TAO_debug_level)
- ACE_DEBUG ((LM_DEBUG, "Waiting for consumers to receive the event..\n"));
+ ACE_DEBUG ((LM_DEBUG, "Waiting for consumers to receive the 2 events..\n"));
this->wait_for_all_consumers (2);
/*****************************************************************************/
@@ -344,7 +332,7 @@ MultiTypes::run_test (ACE_ENV_SINGLE_ARG_DECL)
ACE_CHECK;
if (TAO_debug_level)
- ACE_DEBUG ((LM_DEBUG, "Waiting for consumers to receive the event..\n"));
+ ACE_DEBUG ((LM_DEBUG, "Waiting for consumers to receive the 1 event..\n"));
this->wait_for_all_consumers (1);
ACE_DEBUG ((LM_DEBUG, "MultiTypes test has run successfully!\n"));
@@ -353,25 +341,24 @@ MultiTypes::run_test (ACE_ENV_SINGLE_ARG_DECL)
void
MultiTypes::wait_for_all_consumers (int expected_count_per_consumer)
{
- while (1)
+ while (true)
{
- if (any_event_count_.value () == expected_count_per_consumer &&
- struct_event_count_.value () == expected_count_per_consumer &&
- seq_event_count_.value () == expected_count_per_consumer)
- break;
-
+ if (any_event_count_.value () >= expected_count_per_consumer &&
+ struct_event_count_.value () >= expected_count_per_consumer &&
+ seq_event_count_.value () >= expected_count_per_consumer)
{
- ACE_Time_Value tv (0,1000);
- if (this->orb_->work_pending (tv))
- this->orb_->perform_work ();
+ break;
}
+
+ ACE_Time_Value tv (0, 100 * 1000);
+ this->orb_->run(tv);
}
}
void
MultiTypes::end_test (ACE_ENV_SINGLE_ARG_DECL)
{
- this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+ consumer_done( 0 );
}
int
@@ -410,28 +397,12 @@ main (int argc, char* argv[])
client.end_test (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
}
- ACE_CATCH (CORBA::UserException, ue)
+ ACE_CATCH (CORBA::Exception, se)
{
- ACE_PRINT_EXCEPTION (ue,
- "MultiTypes user error: ");
- return 1;
- }
- ACE_CATCH (CORBA::SystemException, se)
- {
- ACE_PRINT_EXCEPTION (se,
- "MultiTypes system error: ");
+ ACE_PRINT_EXCEPTION (se, "Error: ");
return 1;
}
ACE_ENDTRY;
return client.check_results ();
}
-
-
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-
-
-#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-
-
-#endif /*ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/orbsvcs/tests/Notify/Basic/MultiTypes.h b/TAO/orbsvcs/tests/Notify/Basic/MultiTypes.h
index ac2701e61b8..6b3ff26a83a 100644
--- a/TAO/orbsvcs/tests/Notify/Basic/MultiTypes.h
+++ b/TAO/orbsvcs/tests/Notify/Basic/MultiTypes.h
@@ -25,7 +25,9 @@
#include "Notify_SequencePushSupplier.h"
#if defined(_MSC_VER)
+#if (_MSC_VER >= 1200)
#pragma warning(push)
+#endif /* _MSC_VER >= 1200 */
#pragma warning(disable:4250)
#endif /* _MSC_VER */
@@ -162,7 +164,7 @@ protected:
/***************************************************************************/
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
#pragma warning(pop)
#endif /* _MSC_VER */
diff --git a/TAO/orbsvcs/tests/Notify/Basic/Sequence.cpp b/TAO/orbsvcs/tests/Notify/Basic/Sequence.cpp
index 8eed8e3683d..f5276b25cfc 100644
--- a/TAO/orbsvcs/tests/Notify/Basic/Sequence.cpp
+++ b/TAO/orbsvcs/tests/Notify/Basic/Sequence.cpp
@@ -141,6 +141,8 @@ Sequence::init (int argc,
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (-1);
+ consumer_start( 0 );
+
return 0;
}
@@ -324,7 +326,7 @@ Sequence::run_test (ACE_ENV_SINGLE_ARG_DECL)
void
Sequence::end_test (ACE_ENV_SINGLE_ARG_DECL)
{
- this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+ consumer_done( 0 );
}
int
@@ -371,18 +373,12 @@ main (int argc, char* argv[])
events.run_test (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
- events.ORB_run ();
- }
- ACE_CATCH (CORBA::UserException, ue)
- {
- ACE_PRINT_EXCEPTION (ue,
- "Sequence user error: ");
- return 1;
+ events.ORB_run( ACE_ENV_SINGLE_ARG_PARAMETER );
+ ACE_TRY_CHECK;
}
- ACE_CATCH (CORBA::SystemException, se)
+ ACE_CATCH (CORBA::Exception, se)
{
- ACE_PRINT_EXCEPTION (se,
- "Sequence system error: ");
+ ACE_PRINT_EXCEPTION (se, "Error: ");
return 1;
}
ACE_ENDTRY;
diff --git a/TAO/orbsvcs/tests/Notify/Basic/Sequence.h b/TAO/orbsvcs/tests/Notify/Basic/Sequence.h
index 5a8e1138f3b..19352ec0150 100644
--- a/TAO/orbsvcs/tests/Notify/Basic/Sequence.h
+++ b/TAO/orbsvcs/tests/Notify/Basic/Sequence.h
@@ -22,7 +22,9 @@
#include "orbsvcs/TimeBaseC.h"
#if defined(_MSC_VER)
+#if (_MSC_VER >= 1200)
#pragma warning(push)
+#endif /* _MSC_VER >= 1200 */
#pragma warning(disable:4250)
#endif /* _MSC_VER */
@@ -135,7 +137,7 @@ private:
/***************************************************************************/
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
#pragma warning(pop)
#endif /* _MSC_VER */
diff --git a/TAO/orbsvcs/tests/Notify/Basic/Simple.cpp b/TAO/orbsvcs/tests/Notify/Basic/Simple.cpp
index 85a1fd75b2d..2e637bd4b47 100644
--- a/TAO/orbsvcs/tests/Notify/Basic/Simple.cpp
+++ b/TAO/orbsvcs/tests/Notify/Basic/Simple.cpp
@@ -118,7 +118,7 @@ Simple_Test::init (int argc,
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (-1);
- ACE_CHECK_RETURN (-1);
+ consumer_start( 0 );
return 0;
}
@@ -210,7 +210,7 @@ Simple_Test::run_test (ACE_ENV_SINGLE_ARG_DECL)
void
Simple_Test::end_test (ACE_ENV_SINGLE_ARG_DECL)
{
- this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+ consumer_done( 0 );
}
int
@@ -257,18 +257,12 @@ main (int argc, char* argv[])
events.run_test (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
- events.ORB_run ();
- }
- ACE_CATCH (CORBA::UserException, ue)
- {
- ACE_PRINT_EXCEPTION (ue,
- "Events user error: ");
- return 1;
+ events.ORB_run( ACE_ENV_SINGLE_ARG_PARAMETER );
+ ACE_TRY_CHECK;
}
- ACE_CATCH (CORBA::SystemException, se)
+ ACE_CATCH (CORBA::Exception, se)
{
- ACE_PRINT_EXCEPTION (se,
- "Events system error: ");
+ ACE_PRINT_EXCEPTION (se, "Error: ");
return 1;
}
ACE_ENDTRY;
diff --git a/TAO/orbsvcs/tests/Notify/Basic/Simple.h b/TAO/orbsvcs/tests/Notify/Basic/Simple.h
index a941fcfb027..93fb9b9ef5e 100644
--- a/TAO/orbsvcs/tests/Notify/Basic/Simple.h
+++ b/TAO/orbsvcs/tests/Notify/Basic/Simple.h
@@ -21,7 +21,9 @@
#include "Notify_PushSupplier.h"
#if defined(_MSC_VER)
+#if (_MSC_VER >= 1200)
#pragma warning(push)
+#endif /* _MSC_VER >= 1200 */
#pragma warning(disable:4250)
#endif /* _MSC_VER */
@@ -123,7 +125,7 @@ private:
/***************************************************************************/
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
#pragma warning(pop)
#endif /* _MSC_VER */
diff --git a/TAO/orbsvcs/tests/Notify/Basic/Updates.cpp b/TAO/orbsvcs/tests/Notify/Basic/Updates.cpp
index 0646e37a59e..b5d396e3808 100644
--- a/TAO/orbsvcs/tests/Notify/Basic/Updates.cpp
+++ b/TAO/orbsvcs/tests/Notify/Basic/Updates.cpp
@@ -184,10 +184,8 @@ Updates::wait_for_updates (int expected_added, int expected_removed)
removed_count_ == expected_removed)
break;
- {
- if (this->orb_->work_pending ())
- this->orb_->perform_work ();
- }
+ ACE_Time_Value tv(0, 100 * 1000);
+ orb_->run(tv);
}
}
@@ -479,16 +477,9 @@ main (int argc, char* argv[])
updates.run_test (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
}
- ACE_CATCH (CORBA::UserException, ue)
- {
- ACE_PRINT_EXCEPTION (ue,
- "Updates user error: ");
- return 1;
- }
ACE_CATCH (CORBA::SystemException, se)
{
- ACE_PRINT_EXCEPTION (se,
- "Updates system error: ");
+ ACE_PRINT_EXCEPTION (se, "Error: ");
return 1;
}
ACE_ENDTRY;
diff --git a/TAO/orbsvcs/tests/Notify/Basic/Updates.h b/TAO/orbsvcs/tests/Notify/Basic/Updates.h
index e4c7104f9bf..20ebbc6bcb8 100644
--- a/TAO/orbsvcs/tests/Notify/Basic/Updates.h
+++ b/TAO/orbsvcs/tests/Notify/Basic/Updates.h
@@ -22,7 +22,9 @@
#include "Notify_StructuredPushSupplier.h"
#if defined(_MSC_VER)
+#if (_MSC_VER >= 1200)
#pragma warning(push)
+#endif /* _MSC_VER >= 1200 */
#pragma warning(disable:4250)
#endif /* _MSC_VER */
@@ -141,7 +143,7 @@ private:
/***************************************************************************/
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
#pragma warning(pop)
#endif /* _MSC_VER */
diff --git a/TAO/orbsvcs/tests/Notify/Basic/adminproperties.conf b/TAO/orbsvcs/tests/Notify/Basic/adminproperties.conf
index d0f06676cb4..7ed22785ab7 100644
--- a/TAO/orbsvcs/tests/Notify/Basic/adminproperties.conf
+++ b/TAO/orbsvcs/tests/Notify/Basic/adminproperties.conf
@@ -1,4 +1,6 @@
## $Id$
## Load the static Cos Notification Service
-static Client_Strategy_Factory "-ORBClientConnectionHandler RW"
+## We must use the following settings, because the supplier and consumer are co-located, and
+## the test needs to prevent the threads from mixing during upcalls.
+static Client_Strategy_Factory "-ORBWaitStrategy RW -ORBTransportMuxStrategy exclusive"
diff --git a/TAO/orbsvcs/tests/Notify/Basic/notify.mt.conf b/TAO/orbsvcs/tests/Notify/Basic/notify.mt.conf
index d9f7dbeb983..1ed64ed8d98 100644
--- a/TAO/orbsvcs/tests/Notify/Basic/notify.mt.conf
+++ b/TAO/orbsvcs/tests/Notify/Basic/notify.mt.conf
@@ -1,2 +1,2 @@
##$Id$
-static Notify_Default_Event_Manager_Objects_Factory "-MTDispatching -DispatchingThreads 1"
+static Notify_Default_Event_Manager_Objects_Factory "-DispatchingThreads 2"
diff --git a/TAO/orbsvcs/tests/Notify/Basic/notify.rt.conf b/TAO/orbsvcs/tests/Notify/Basic/notify.rt.conf
index 70abb0d32cd..50faf80e5ee 100644
--- a/TAO/orbsvcs/tests/Notify/Basic/notify.rt.conf
+++ b/TAO/orbsvcs/tests/Notify/Basic/notify.rt.conf
@@ -1,5 +1,5 @@
dynamic TAO_RT_ORB_Loader Service_Object *TAO_RTCORBA:_make_TAO_RT_ORB_Loader () "-ORBPriorityMapping continuous"
-
+#
# Uncomment this line to use SCHED_FIFO
#dynamic TAO_RT_ORB_Loader Service_Object *TAO_RTCORBA:_make_TAO_RT_ORB_Loader () "-ORBSchedPolicy SCHED_FIFO -ORBScopePolicy SYSTEM -ORBPriorityMapping continuous"
dynamic TAO_Notify_Service Service_Object * TAO_RT_Notification:_make_TAO_RT_Notify_Service () "" \ No newline at end of file
diff --git a/TAO/orbsvcs/tests/Notify/Basic/run_test.pl b/TAO/orbsvcs/tests/Notify/Basic/run_test.pl
index 79a85b158eb..683f9c24930 100755
--- a/TAO/orbsvcs/tests/Notify/Basic/run_test.pl
+++ b/TAO/orbsvcs/tests/Notify/Basic/run_test.pl
@@ -23,6 +23,7 @@ $status = 0;
{
name => "ConnectDisconnect",
args => "",
+ extra => 300,
},
{
name => "Events",
@@ -78,9 +79,7 @@ $Naming = new PerlACE::Process ("../../../Naming_Service/Naming_Service",
"-o $namingior");
unlink $namingior;
-if ($Naming->Spawn () == -1) {
- exit 1;
-}
+$Naming->Spawn ();
if (PerlACE::waitforfile_timed ($namingior, $startup_timeout) == -1) {
print STDERR "ERROR: waiting for the naming service to start\n";
@@ -98,20 +97,20 @@ for $config (@test_configs)
"-ORBSvcConf $config");
unlink $notifyior;
$Notification->Spawn ();
-
+
if (PerlACE::waitforfile_timed ($notifyior, $startup_timeout) == -1) {
print STDERR "ERROR: waiting for the notify service to start\n";
$Notification->Kill ();
$Naming->Kill ();
exit 1;
}
-
+
for $name (@tests)
{
## The MaxQueueLength and MaxEventsPerConsumer are not supported in the Reactive
## configuration, so we skip this test for now.
## The Notification should actually throw an exception for the property not supported.
- if ($name->{name} eq "AdminProperties"
+ if ($name->{name} eq "AdminProperties"
&& ($config eq "notify.reactive.conf" || $config eq "notify.rt.conf"))
{
next;
@@ -123,15 +122,17 @@ for $config (@test_configs)
"$name->{args} ");
$test->Spawn ();
- $status = $test->WaitKill ($experiment_timeout);
+ $status = $test->WaitKill ($experiment_timeout +
+ (defined $name->{extra} ?
+ $name->{extra} : 0));
- if ($status != 0)
+ if ($status != 0)
{
- print STDERR "ERROR: $name returned $status\n";
+ print STDERR "ERROR: $name->{name} returned $status\n";
break;
}
}
-
+
$Notification->Kill ();
}
diff --git a/TAO/orbsvcs/tests/Notify/Blocking/Notify_Structured_Push_Consumer.cpp b/TAO/orbsvcs/tests/Notify/Blocking/Notify_Structured_Push_Consumer.cpp
index 475e5719d0d..3e7c1986bb9 100644
--- a/TAO/orbsvcs/tests/Notify/Blocking/Notify_Structured_Push_Consumer.cpp
+++ b/TAO/orbsvcs/tests/Notify/Blocking/Notify_Structured_Push_Consumer.cpp
@@ -2,21 +2,25 @@
#include "ace/OS_NS_unistd.h"
#include "Notify_Structured_Push_Consumer.h"
+#include "Notify_Test_Client.h"
#include "orbsvcs/Notify/Notify_Extensions.h"
#include "common.h"
#include "tao/debug.h"
+static const int CONSUMER_DELAY = 1; // seconds.
+
Notify_Structured_Push_Consumer::Notify_Structured_Push_Consumer (
const char* name,
TimeBase::TimeT block,
unsigned int expected,
- CORBA::Boolean& done)
+ Notify_Test_Client& client)
: name_ (name),
blocking_timeout_ (block),
expected_ (expected),
count_ (0),
- done_ (done)
+ client_ (client)
{
+ this->client_.consumer_start (this);
}
@@ -44,8 +48,25 @@ Notify_Structured_Push_Consumer::_connect (
CosNotification::QoSProperties properties (2);
properties.length (2);
+ // The discard policy and admin properties tests already test using
+ // the MaxQueueLength policy, so we'll use MEPC instead. It should
+ // make no difference.
+ // If the blocking timeout is less than CONSUMER_DELAY seconds, then
+ // we want to ensure that exactly one event is discarded, so we set
+ // the MEPC to expected_ - 1. If the supplier sends 20, then we expect 19,
+ // and we set MEPC to 18. The first event will be dispatched at once, but
+ // will block in the consumer. This will allow the queue in the notify svc
+ // to fill up to 18. However, the blocking code will timeout before the
+ // consumer finishes which will cause an event to be discarded. This will
+ // allow the last event to be queued. Eventually the consumer will unblock
+ // and receive the remaining events
properties[0].name = CORBA::string_dup (CosNotification::MaxEventsPerConsumer);
- properties[0].value <<= (CORBA::Long)10;
+ if (blocking_timeout_ < CONSUMER_DELAY * 1000 * 1000 * 10)
+ properties[0].value <<= (CORBA::Long) expected_ - 1;
+ else
+ properties[0].value <<= (CORBA::Long) 10;
+
+
properties[1].name = CORBA::string_dup (TAO_Notify_Extensions::BlockingPolicy);
properties[1].value <<= this->blocking_timeout_;
@@ -62,48 +83,34 @@ Notify_Structured_Push_Consumer::_connect (
void
Notify_Structured_Push_Consumer::push_structured_event (
- const CosNotification::StructuredEvent& event
- ACE_ENV_ARG_DECL_NOT_USED /*ACE_ENV_SINGLE_ARG_PARAMETER*/)
+ const CosNotification::StructuredEvent& event
+ ACE_ENV_ARG_DECL_NOT_USED /*ACE_ENV_SINGLE_ARG_PARAMETER*/)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- if (TAO_debug_level)
- ACE_DEBUG ((LM_DEBUG, "Received event:\n"));
-
- CORBA::ULong hlength = event.header.variable_header.length ();
- for (CORBA::ULong hi = 0; hi < hlength; hi++)
- {
- if (TAO_debug_level)
- ACE_DEBUG ((LM_DEBUG,
- "%s = %s\n",
- (const char*)event.header.variable_header[hi].name,
- Any_String (event.header.variable_header[hi].value)));
- }
- CORBA::ULong flength = event.filterable_data.length ();
- for (CORBA::ULong i = 0; i < flength; i++)
- {
- if (TAO_debug_level)
- ACE_DEBUG ((LM_DEBUG,
- "%s = %s\n",
- (const char*)event.filterable_data[i].name,
- Any_String (event.filterable_data[i].value)));
- }
- if (TAO_debug_level)
- ACE_DEBUG ((LM_DEBUG,
- "-------------------------\n"));
+ ACE_DEBUG((LM_DEBUG, "-"));
+ ACE_UNUSED_ARG(event);
+
this->count_++;
if (this->count_ > this->expected_)
- {
- this->done_ = 1;
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("Structured Consumer (%P|%t): ERROR: too "
- "many events received.\n")));
- }
- else if (this->count_ == this->expected_)
- {
- this->done_ = 1;
- }
- else
- {
- ACE_OS::sleep (1);
- }
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Structured Consumer (%P|%t): ERROR: too "
+ "many events received.\n")));
+ }
+
+ if (this->count_ >= this->expected_)
+ {
+ ACE_DEBUG((LM_DEBUG, "\nConsumer received %u events.\n", count_));
+ this->client_.consumer_done (this);
+ }
+
+ // By pausing here, we force the channel to back up, which will
+ // either result in discarding of events, or blocking, depending
+ // on whether our BlockingPolicy is greater than the following
+ // delay time.
+ // A BlockingPolicy > 1 second should allow the first event.
+ // A BlockingPolicy < 1 second should discard the first event.
+ if (count_ == 1)
+ ACE_OS::sleep (CONSUMER_DELAY);
}
+
diff --git a/TAO/orbsvcs/tests/Notify/Blocking/Notify_Structured_Push_Consumer.h b/TAO/orbsvcs/tests/Notify/Blocking/Notify_Structured_Push_Consumer.h
index 8041f156b35..502c28c924d 100644
--- a/TAO/orbsvcs/tests/Notify/Blocking/Notify_Structured_Push_Consumer.h
+++ b/TAO/orbsvcs/tests/Notify/Blocking/Notify_Structured_Push_Consumer.h
@@ -21,6 +21,8 @@
#include "Notify_StructuredPushConsumer.h"
#include "orbsvcs/TimeBaseC.h"
+class Notify_Test_Client;
+
class Notify_Structured_Push_Consumer: public TAO_Notify_Tests_StructuredPushConsumer
{
public:
@@ -28,7 +30,7 @@ public:
const char* name,
TimeBase::TimeT blocking,
unsigned int expected,
- CORBA::Boolean& done);
+ Notify_Test_Client& client);
void _connect (CosNotifyChannelAdmin::ConsumerAdmin_ptr consumer_admin
ACE_ENV_ARG_DECL)
@@ -43,7 +45,7 @@ protected:
TimeBase::TimeT blocking_timeout_;
unsigned int expected_;
unsigned int count_;
- CORBA::Boolean& done_;
+ Notify_Test_Client& client_;
};
#endif /* TAO_NOTIFY_STRUCTURED_PUSH_CONSUMER_H */