summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2007-08-13 11:20:01 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2007-08-13 11:20:01 +0000
commitf2c3b6d735dc43f1a89e04381726f80ac40aa8b2 (patch)
tree0a95886a3bc823fbfd70e35c6c79bbd0c730e6d9
parentf36a63ffc450fa1c5b84f2edd17eb286e8f833c0 (diff)
downloadATCD-f2c3b6d735dc43f1a89e04381726f80ac40aa8b2.tar.gz
ChangeLogTag: Mon Aug 13 11:19:28 UTC 2007 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r--TAO/ChangeLog73
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Consumer.cpp22
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Consumer.h5
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Event.cpp2
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Event.h4
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.cpp12
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.h6
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.cpp10
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.h3
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Object.cpp4
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.cpp10
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.cpp2
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Routing_Slip.cpp47
-rw-r--r--TAO/orbsvcs/tests/Notify/Reconnecting/Consumer.cpp37
-rw-r--r--TAO/orbsvcs/tests/Notify/Reconnecting/Supplier.cpp7
-rw-r--r--TAO/orbsvcs/tests/Notify/Reconnecting/event.conf2
-rw-r--r--TAO/orbsvcs/tests/Notify/Reconnecting/ns_mt_both.conf2
-rw-r--r--TAO/orbsvcs/tests/Notify/Reconnecting/ns_st_both.conf2
-rwxr-xr-xTAO/orbsvcs/tests/Notify/Reconnecting/run_test.pl506
19 files changed, 492 insertions, 264 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 365d7f58694..ce38b6962a6 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,76 @@
+Mon Aug 13 11:19:28 UTC 2007 Chad Elliott <elliott_c@ociweb.com>
+
+ * orbsvcs/orbsvcs/Notify/Consumer.h:
+ * orbsvcs/orbsvcs/Notify/Consumer.cpp:
+
+ Added a new function, assume_pending_events, so that events
+ that were sent for a consumer are not lost during the consumer
+ reconnect.
+
+ * orbsvcs/orbsvcs/Notify/Event.h:
+
+ Document the way that the queueable_copy() method works.
+
+ * orbsvcs/orbsvcs/Notify/Event.cpp:
+
+ Change the default reliable_ setting to true. This doesn't cause
+ any harm since this value is only inspected when persistence is
+ enabled.
+
+ * orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.h:
+ * orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.cpp:
+
+ Removed an unused constructor from
+ TAO_Notify_Method_Request_Dispatch_No_Copy.
+
+ * orbsvcs/orbsvcs/Notify/Method_Request_Lookup.h:
+ * orbsvcs/orbsvcs/Notify/Method_Request_Lookup.cpp:
+
+ Added a constructor to make a TAO_Notify_Method_Request_Lookup
+ using a deliver request. And use this new constructor in the
+ TAO_Notify_Method_Request_Lookup_Queueable constructor.
+
+ * orbsvcs/orbsvcs/Notify/Object.cpp:
+
+ Fixed a bug in find_qos_property_value() where finding a property
+ would return false when, in fact, the property existed.
+
+ * orbsvcs/orbsvcs/Notify/ProxyConsumer.cpp:
+
+ Fixed a bug where getting the CosNotification::EventReliability
+ would fail due to extraction of a CORBA::Any into the wrong type.
+
+ * orbsvcs/orbsvcs/Notify/ProxySupplier.cpp:
+
+ Attempt to have the new consumer assume the pending events for the
+ old consumer.
+
+ * orbsvcs/orbsvcs/Notify/Routing_Slip.cpp:
+
+ Fixed a locking issue where the lock was not being released at the
+ correct time. Also, reduced the number of mutex acquire()'s which
+ will increase performence.
+
+ * orbsvcs/tests/Notify/Reconnecting/Consumer.cpp:
+ * orbsvcs/tests/Notify/Reconnecting/Supplier.cpp:
+
+ Cleaned up the code by removing redundant sequence length settings
+ and the TEST_SET_QOS and DISABLE_PROPERTIES_TODO #ifdef's.
+
+ * orbsvcs/tests/Notify/Reconnecting/event.conf:
+ * orbsvcs/tests/Notify/Reconnecting/ns_mt_both.conf:
+ * orbsvcs/tests/Notify/Reconnecting/ns_st_both.conf:
+
+ Fixed a bug where the wrong library name is used to find the
+ Standard_Event_Persistence service.
+
+ * orbsvcs/tests/Notify/Reconnecting/run_test.pl:
+
+ Cleaned up this script quite a bit and added a new test which
+ tests the persistence of events that are sent by a supplier (upon
+ reconnect) before the consumer reconnects. The consumer should
+ receive events sent during it's absence.
+
Mon Aug 12 10:45:00 UTC 2007 Simon Massey <sma@prismtech.com>
* tao/AnyTypeCode/TypeCode_CDR_Extraction.cpp:
diff --git a/TAO/orbsvcs/orbsvcs/Notify/Consumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Consumer.cpp
index b036e0d6b6e..f461665e9cc 100644
--- a/TAO/orbsvcs/orbsvcs/Notify/Consumer.cpp
+++ b/TAO/orbsvcs/orbsvcs/Notify/Consumer.cpp
@@ -680,4 +680,26 @@ TAO_Notify_Consumer::proxy_supplier (void)
return this->proxy_;
}
+void
+TAO_Notify_Consumer::assume_pending_events (TAO_Notify_Consumer& rhs)
+{
+ // No need to lock the this proxy's lock. It should have been locked
+ // by the caller.
+
+ // If the original consumer has pending events
+ if (!rhs.pending_events ().is_empty ())
+ {
+ // We will take them away and cancel it's timer
+ this->pending_events_.reset (rhs.pending_events_.release ());
+ if (rhs.timer_.isSet ())
+ {
+ rhs.cancel_timer ();
+ }
+
+ // Schedule a new timer for us, which will use the default
+ // timer value (unless we have a valid pacing interval).
+ this->schedule_timer ();
+ }
+}
+
TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/orbsvcs/orbsvcs/Notify/Consumer.h b/TAO/orbsvcs/orbsvcs/Notify/Consumer.h
index 19eabddd0b8..095a51492ff 100644
--- a/TAO/orbsvcs/orbsvcs/Notify/Consumer.h
+++ b/TAO/orbsvcs/orbsvcs/Notify/Consumer.h
@@ -105,6 +105,11 @@ public:
/// Override, Peer::qos_changed
virtual void qos_changed (const TAO_Notify_QoSProperties& qos_properties);
+ /// Take the pending queue from the rhs, cancel it's timer and
+ /// schedule our timer. The caller should have locked the proxy lock
+ /// before calling this method.
+ void assume_pending_events (TAO_Notify_Consumer& rhs);
+
protected:
typedef ACE_Unbounded_Queue<TAO_Notify_Method_Request_Event_Queueable *> Request_Queue;
diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event.cpp b/TAO/orbsvcs/orbsvcs/Notify/Event.cpp
index 3be4e32a4ce..44bf84dc9fd 100644
--- a/TAO/orbsvcs/orbsvcs/Notify/Event.cpp
+++ b/TAO/orbsvcs/orbsvcs/Notify/Event.cpp
@@ -22,7 +22,7 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL
TAO_Notify_Event::TAO_Notify_Event (void)
: priority_ (CosNotification::Priority, CosNotification::DefaultPriority)
, timeout_ (CosNotification::Timeout)
-, reliable_ (CosNotification::EventReliability, false)
+, reliable_ (CosNotification::EventReliability, true)
, clone_ (0)
, is_on_heap_ (false)
, time_ (ACE_OS::gettimeofday ())
diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event.h b/TAO/orbsvcs/orbsvcs/Notify/Event.h
index 451dd3c0493..67f3c1e8455 100644
--- a/TAO/orbsvcs/orbsvcs/Notify/Event.h
+++ b/TAO/orbsvcs/orbsvcs/Notify/Event.h
@@ -87,7 +87,9 @@ public:
/// Push event to the Event_Forwarder interface
virtual void push_no_filtering (Event_Forwarder::ProxyPushSupplier_ptr forwarder) const = 0;
- /// Return a pointer to a copy of this event on the heap
+ /// Return a pointer to a copy of this event on the heap. The
+ /// event is not owned by the caller, so it should not be deleted or
+ /// released.
TAO_Notify_Event* queueable_copy (void) const;
/// marshal this event into a CDR buffer (for persistence)
diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.cpp b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.cpp
index 4ec5559992d..0b98a0a028a 100644
--- a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.cpp
+++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.cpp
@@ -237,18 +237,6 @@ TAO_Notify_Method_Request_Dispatch_Queueable::execute (void)
/*********************************************************************************************************/
-TAO_Notify_Method_Request_Dispatch_No_Copy::TAO_Notify_Method_Request_Dispatch_No_Copy (
- const TAO_Notify_Event* event,
- TAO_Notify_ProxySupplier* proxy_supplier,
- bool filtering)
- : TAO_Notify_Method_Request_Dispatch (event, proxy_supplier, filtering)
-{
-#if 0
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("(%P|%t) Construct Method_Request_Dispatch_No_Copy @%@\n"),
- this));
-#endif
-}
/// Constuct construct from another method request
TAO_Notify_Method_Request_Dispatch_No_Copy::TAO_Notify_Method_Request_Dispatch_No_Copy (
const TAO_Notify_Method_Request_Event & request,
diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.h b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.h
index 6b7213678ef..8da8e887820 100644
--- a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.h
+++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.h
@@ -139,12 +139,6 @@ class TAO_Notify_Serv_Export TAO_Notify_Method_Request_Dispatch_No_Copy
, public TAO_Notify_Method_Request
{
public:
- /// Constuct from event
- TAO_Notify_Method_Request_Dispatch_No_Copy (
- const TAO_Notify_Event * event,
- TAO_Notify_ProxySupplier* proxy_supplier,
- bool filtering);
-
/// Constuct construct from another method request
TAO_Notify_Method_Request_Dispatch_No_Copy (
const TAO_Notify_Method_Request_Event & request,
diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.cpp b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.cpp
index fd447d57433..018949a94bf 100644
--- a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.cpp
+++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.cpp
@@ -31,6 +31,14 @@ TAO_Notify_Method_Request_Lookup::TAO_Notify_Method_Request_Lookup (
{
}
+TAO_Notify_Method_Request_Lookup::TAO_Notify_Method_Request_Lookup (
+ const TAO_Notify::Delivery_Request_Ptr& delivery,
+ TAO_Notify_ProxyConsumer * proxy)
+ : TAO_Notify_Method_Request_Event (delivery)
+ , proxy_consumer_ (proxy)
+{
+}
+
TAO_Notify_Method_Request_Lookup::~TAO_Notify_Method_Request_Lookup ()
{
}
@@ -168,7 +176,7 @@ TAO_Notify_Method_Request_Lookup_Queueable::TAO_Notify_Method_Request_Lookup_Que
TAO_Notify_Method_Request_Lookup_Queueable::TAO_Notify_Method_Request_Lookup_Queueable (
TAO_Notify::Delivery_Request_Ptr & request,
TAO_Notify_ProxyConsumer * proxy_consumer)
- : TAO_Notify_Method_Request_Lookup (request->event ().get (), proxy_consumer)
+ : TAO_Notify_Method_Request_Lookup (request, proxy_consumer)
, TAO_Notify_Method_Request_Queueable (request->event ().get ())
, event_var_ (request->event ())
, proxy_guard_ (proxy_consumer)
diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.h b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.h
index 72f431b9a2e..4828457df6e 100644
--- a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.h
+++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.h
@@ -59,6 +59,9 @@ protected:
/// Constuctor
TAO_Notify_Method_Request_Lookup (const TAO_Notify_Event * event, TAO_Notify_ProxyConsumer * proxy);
+ /// Constuctor
+ TAO_Notify_Method_Request_Lookup (const TAO_Notify::Delivery_Request_Ptr& delivery, TAO_Notify_ProxyConsumer * proxy);
+
/// Execute the dispatch operation.
int execute_i (void);
diff --git a/TAO/orbsvcs/orbsvcs/Notify/Object.cpp b/TAO/orbsvcs/orbsvcs/Notify/Object.cpp
index de7dccde5ca..4b87e5105c1 100644
--- a/TAO/orbsvcs/orbsvcs/Notify/Object.cpp
+++ b/TAO/orbsvcs/orbsvcs/Notify/Object.cpp
@@ -301,7 +301,9 @@ TAO_Notify_Object::find_qos_property_value (
const char * name,
CosNotification::PropertyValue & value) const
{
- return this->qos_properties_.find (name, value);
+ // qos_properties_ is essentially a map and the find() method returns
+ // zero on success. We must convert this to a boolean value.
+ return (this->qos_properties_.find (name, value) == 0);
}
diff --git a/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.cpp
index 3eecff5bbf0..df3aca6a898 100644
--- a/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.cpp
+++ b/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.cpp
@@ -133,13 +133,13 @@ TAO_Notify_ProxyConsumer::supports_reliable_events () const
{
bool reliable = false;
CosNotification::PropertyValue value;
- if (this->find_qos_property_value (CosNotification::EventReliability, value))
+ if (this->find_qos_property_value (CosNotification::EventReliability, value))
{
- CORBA::Long setting;
+ CORBA::Short setting;
if (value >>= setting)
- {
- reliable = (setting == CosNotification::Persistent);
- }
+ {
+ reliable = (setting == CosNotification::Persistent);
+ }
}
return reliable;
}
diff --git a/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.cpp
index e0f509c9600..5feed74d664 100644
--- a/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.cpp
+++ b/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.cpp
@@ -79,6 +79,8 @@ TAO_Notify_ProxySupplier::connect (TAO_Notify_Consumer *consumer)
}
// Adopt the consumer
+ if (this->consumer_.get() != 0)
+ auto_consumer->assume_pending_events (*this->consumer_.get ());
this->consumer_ = auto_consumer;
this->consumer_admin_->subscribed_types (this->subscribed_types_); // get the parents subscribed types.
diff --git a/TAO/orbsvcs/orbsvcs/Notify/Routing_Slip.cpp b/TAO/orbsvcs/orbsvcs/Notify/Routing_Slip.cpp
index 62730cd01e0..373c38dcc21 100644
--- a/TAO/orbsvcs/orbsvcs/Notify/Routing_Slip.cpp
+++ b/TAO/orbsvcs/orbsvcs/Notify/Routing_Slip.cpp
@@ -262,7 +262,7 @@ Routing_Slip::route (TAO_Notify_ProxyConsumer* pc, bool reliable_channel)
{
enter_state_new (guard);
}
- else if (this->event_->reliable().value() == CosNotification::Persistent)
+ else if (this->event_->reliable().value() == true)
{
enter_state_new (guard);
}
@@ -271,7 +271,13 @@ Routing_Slip::route (TAO_Notify_ProxyConsumer* pc, bool reliable_channel)
enter_state_transient (guard);
}
}
- guard.release ();
+ else
+ {
+ // We only need to release the guard if the state is rssCREATING.
+ // By calling enter_state_*, we are guaranteed that the guard has
+ // been released.
+ guard.release ();
+ }
pc->execute_task (method);
}
#if 0 // forward
@@ -285,6 +291,7 @@ Routing_Slip::forward (TAO_Notify_ProxySupplier* ps, bool filter)
Routing_Slip_Guard guard (this->internals_);
enter_state_transient (guard);
+ guard.acquire();
size_t request_id = delivery_requests_.size ();
if (DEBUG_LEVEL > 8) ACE_DEBUG ((LM_DEBUG,
@@ -464,6 +471,7 @@ Routing_Slip::at_front_of_persist_queue ()
ACE_TEXT ("(%P|%t) Routing Slip #%d: COMPLETE_WHILE_NEW Reached front of queue\n"),
this->sequence_
));
+ guard.release ();
this->persistent_queue_.complete ();
enter_state_terminal (guard);
break;
@@ -554,6 +562,7 @@ Routing_Slip::persist_complete ()
ACE_TEXT ("(%P|%t) Notification Service Routing Slip: Unexpected transition in state %d\n"),
static_cast<int> (this->state_)
));
+ guard.release ();
break;
}
}
@@ -574,7 +583,6 @@ Routing_Slip::add_to_persist_queue(Routing_Slip_Guard & guard)
{
guard.release ();
this->persistent_queue_.add (this->this_ptr_);
- guard.acquire (); // necessary?
}
////////////////////
@@ -600,6 +608,7 @@ Routing_Slip::continue_state_new (Routing_Slip_Guard & guard)
{
this->enter_state_complete_while_new (guard);
}
+ guard.release ();
}
void
Routing_Slip::enter_state_complete_while_new (Routing_Slip_Guard & guard)
@@ -623,19 +632,18 @@ void
Routing_Slip::enter_state_reloaded (Routing_Slip_Guard & guard)
{
++count_enter_reloaded_;
- ACE_UNUSED_ARG (guard);
if (DEBUG_LEVEL > 8) ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) Routing Slip #&d: enter state RELOADED\n"),
this->sequence_
));
this->state_ = rssRELOADED;
+ guard.release();
}
void
Routing_Slip::enter_state_transient (Routing_Slip_Guard & guard)
{
++count_enter_transient_;
- ACE_UNUSED_ARG (guard);
if (DEBUG_LEVEL > 8) ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) Routing Slip #%d: enter state TRANSIENT\n"),
this->sequence_
@@ -650,6 +658,10 @@ Routing_Slip::enter_state_transient (Routing_Slip_Guard & guard)
{
enter_state_terminal (guard);
}
+ else
+ {
+ guard.release ();
+ }
}
void
@@ -660,6 +672,10 @@ Routing_Slip::continue_state_transient (Routing_Slip_Guard & guard)
{
enter_state_terminal (guard);
}
+ else
+ {
+ guard.release ();
+ }
}
void
Routing_Slip::enter_state_saving (Routing_Slip_Guard & guard)
@@ -669,6 +685,7 @@ Routing_Slip::enter_state_saving (Routing_Slip_Guard & guard)
{
// Note This should actually be a throw (out of memory)
// but we cheat and make this a transient event.
+ guard.release ();
this->persistent_queue_.complete ();
enter_state_transient (guard);
}
@@ -690,8 +707,6 @@ Routing_Slip::enter_state_saving (Routing_Slip_Guard & guard)
guard.release ();
this->rspm_->store (*event_mb, *rs_mb);
-
- guard.acquire (); // necessary?
}
}
@@ -699,12 +714,12 @@ void
Routing_Slip::enter_state_saved (Routing_Slip_Guard & guard)
{
++count_enter_saved_;
- ACE_UNUSED_ARG (guard);
if (DEBUG_LEVEL > 8) ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) Routing Slip #%d: enter state SAVED\n"),
this->sequence_
));
this->state_ = rssSAVED;
+ guard.release ();
}
void
@@ -724,7 +739,6 @@ Routing_Slip::enter_state_updating (Routing_Slip_Guard & guard)
ACE_ASSERT (this->rspm_ != 0);
this->rspm_->update (*rs_mb);
- guard.acquire (); // necessary?
}
@@ -732,19 +746,19 @@ void
Routing_Slip::enter_state_changed_while_saving (Routing_Slip_Guard & guard)
{
++count_enter_changed_while_saving_;
- ACE_UNUSED_ARG (guard);
if (DEBUG_LEVEL > 8) ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) Routing Slip #%d: enter state CHANGED_WHILE_SAVING\n"),
this->sequence_
));
this->state_ = rssCHANGED_WHILE_SAVING;
+ guard.release ();
}
void
Routing_Slip::continue_state_changed_while_saving (Routing_Slip_Guard & guard)
{
- ACE_UNUSED_ARG (guard);
// no action necessary
+ guard.release ();
}
void
@@ -773,18 +787,22 @@ Routing_Slip::continue_state_changed (Routing_Slip_Guard & guard)
{
enter_state_complete (guard);
}
+ else
+ {
+ guard.release ();
+ }
}
void
Routing_Slip::enter_state_complete (Routing_Slip_Guard & guard)
{
++count_enter_complete_;
- ACE_UNUSED_ARG (guard);
if (DEBUG_LEVEL > 8) ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) Routing Slip #%d: enter state COMPLETE\n"),
this->sequence_
));
this->state_ = rssCOMPLETE;
+ guard.release ();
}
void
@@ -798,14 +816,12 @@ Routing_Slip::enter_state_deleting (Routing_Slip_Guard & guard)
this->state_ = rssDELETING;
guard.release ();
this->rspm_->remove ();
- guard.acquire (); // necessary?
}
void
Routing_Slip::enter_state_terminal (Routing_Slip_Guard & guard)
{
++count_enter_terminal_;
- ACE_UNUSED_ARG (guard);
ACE_ASSERT( this->is_safe_);
if (DEBUG_LEVEL > 8) ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) Routing Slip #%d: enter state TERMINAL\n"),
@@ -813,6 +829,7 @@ Routing_Slip::enter_state_terminal (Routing_Slip_Guard & guard)
));
this->state_ = rssTERMINAL;
this->this_ptr_.reset ();
+ guard.release ();
}
void
@@ -892,7 +909,7 @@ Routing_Slip::reconnect (void)
{
Routing_Slip_Guard guard (this->internals_);
enter_state_saved (guard);
- guard.release ();
+
//@@todo is there a worker_task available to do this?
size_t count = this->delivery_methods_.size ();
for (size_t nmethod = 0; nmethod < count; ++nmethod)
diff --git a/TAO/orbsvcs/tests/Notify/Reconnecting/Consumer.cpp b/TAO/orbsvcs/tests/Notify/Reconnecting/Consumer.cpp
index 2a16f35c2dd..af1ee3a18c1 100644
--- a/TAO/orbsvcs/tests/Notify/Reconnecting/Consumer.cpp
+++ b/TAO/orbsvcs/tests/Notify/Reconnecting/Consumer.cpp
@@ -1224,7 +1224,6 @@ Consumer_Main::init_event_channel (void)
CosNotification::QoSProperties qosprops (7);
qosprops.length (7);
CORBA::ULong i = 0;
-#ifdef DISABLE_PROPERTIES_TODO
qosprops[i].name = CORBA::string_dup(CosNotification::EventReliability);
qosprops[i++].value <<= CosNotification::Persistent;
qosprops[i].name = CORBA::string_dup(CosNotification::ConnectionReliability);
@@ -1239,12 +1238,10 @@ Consumer_Main::init_event_channel (void)
qosprops[i++].value <<= (CORBA::Long)2;
qosprops[i].name = CORBA::string_dup(CosNotification::PacingInterval);
qosprops[i++].value <<= (TimeBase::TimeT) 50 * 10000; // 50ms
-#endif
- qosprops.length (i);
+
CosNotification::AdminProperties adminprops(4);
adminprops.length (4);
i = 0;
-#ifdef DISABLE_PROPERTIES_TODO
adminprops[i].name = CORBA::string_dup(CosNotification::MaxQueueLength);
adminprops[i++].value <<= (CORBA::Long) 1234;
adminprops[i].name = CORBA::string_dup(CosNotification::MaxSuppliers);
@@ -1253,8 +1250,6 @@ Consumer_Main::init_event_channel (void)
adminprops[i++].value <<= (CORBA::Long) 1000;
adminprops[i].name = CORBA::string_dup(CosNotification::RejectNewEvents);
adminprops[i++].value <<= CORBA::Any::from_boolean(1);
-#endif
- adminprops.length(i);
ec_ = this->ecf_->create_channel (
qosprops,
@@ -1365,7 +1360,6 @@ Consumer_Main::init_consumer_admin (void)
this->sa_id_);
ok = ! CORBA::is_nil (this->sa_.in ());
-#ifdef TEST_SET_QOS
// temporary: be sure we can set qos properties here
if (ok)
{
@@ -1380,7 +1374,6 @@ Consumer_Main::init_consumer_admin (void)
qosprops.length(i);
this->sa_->set_qos (qosprops);
}
-#endif
if (ok && this->verbose_)
{
@@ -1412,16 +1405,30 @@ Consumer_Main::init_structured_proxy_supplier (void)
this->structured_proxy_id_
);
ok = ! CORBA::is_nil (proxy.in ());
- if (ok && this->verbose_)
+ if (this->verbose_)
{
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("(%P|%t) Consumer: Reconnect to proxy supplier %d\n"),
- static_cast<int>(this->structured_proxy_id_)
- ));
+ if (ok)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) Consumer: Reconnect to proxy supplier %d\n"),
+ static_cast<int>(this->structured_proxy_id_)
+ ));
+ }
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) Consumer: Unable to reconnect to proxy supplier %d\n"),
+ static_cast<int>(this->structured_proxy_id_)
+ ));
+ }
}
}
catch (...)
{
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) Consumer: Unable to reconnect to proxy supplier %d\n"),
+ static_cast<int>(this->structured_proxy_id_)
+ ));
}
}
@@ -1508,13 +1515,13 @@ Consumer_Main::init_sequence_proxy_supplier (void)
CosNotifyChannelAdmin::SEQUENCE_EVENT,
this->sequence_proxy_id_);
ok = ! CORBA::is_nil (proxy.in ());
-#ifdef TEST_SET_QOS
+
// temporary
if (ok)
{
set_proxy_qos (proxy.in ());
}
-#endif // TEST_SET_QOS
+
if (ok && this->verbose_)
{
ACE_DEBUG ((LM_DEBUG,
diff --git a/TAO/orbsvcs/tests/Notify/Reconnecting/Supplier.cpp b/TAO/orbsvcs/tests/Notify/Reconnecting/Supplier.cpp
index e50d249db47..6ba784cb9c1 100644
--- a/TAO/orbsvcs/tests/Notify/Reconnecting/Supplier.cpp
+++ b/TAO/orbsvcs/tests/Notify/Reconnecting/Supplier.cpp
@@ -626,7 +626,6 @@ Supplier_Main::init_event_channel (void)
CosNotification::QoSProperties qosprops (7);
qosprops.length (7);
CORBA::ULong i = 0;
-#ifdef DISABLE_PROPERTIES_TODO
qosprops[i].name = CORBA::string_dup(CosNotification::EventReliability);
qosprops[i++].value <<= CosNotification::Persistent;
qosprops[i].name = CORBA::string_dup(CosNotification::ConnectionReliability);
@@ -641,12 +640,10 @@ Supplier_Main::init_event_channel (void)
qosprops[i++].value <<= (CORBA::Long) 2;
qosprops[i].name = CORBA::string_dup(CosNotification::PacingInterval);
qosprops[i++].value <<= (TimeBase::TimeT) 50 * 10000; // 50ms
-#endif
- qosprops.length (i);
+
CosNotification::AdminProperties adminprops(4);
adminprops.length (4);
i = 0;
-#ifdef DISABLE_PROPERTIES_TODO
adminprops[i].name = CORBA::string_dup(CosNotification::MaxQueueLength);
adminprops[i++].value <<= (CORBA::Long) 1234;
adminprops[i].name = CORBA::string_dup(CosNotification::MaxConsumers);
@@ -655,8 +652,6 @@ Supplier_Main::init_event_channel (void)
adminprops[i++].value <<= (CORBA::Long) 1000;
adminprops[i].name = CORBA::string_dup(CosNotification::RejectNewEvents);
adminprops[i++].value <<= CORBA::Any::from_boolean(1);
-#endif
- adminprops.length(i);
ec_ = this->ecf_->create_channel (
qosprops,
diff --git a/TAO/orbsvcs/tests/Notify/Reconnecting/event.conf b/TAO/orbsvcs/tests/Notify/Reconnecting/event.conf
index 1365667e20a..b1a5edc1876 100644
--- a/TAO/orbsvcs/tests/Notify/Reconnecting/event.conf
+++ b/TAO/orbsvcs/tests/Notify/Reconnecting/event.conf
@@ -3,4 +3,4 @@ static TAO_CosNotify_Service "-AllowReconnect"
#
# This should fail because event perstence requires topology persistence
#
-dynamic Event_Persistence Service_Object* TAO_CosNotification:_make_TAO_Notify_Standard_Event_Persistence() "-v -file_path ./event_persist.db"
+dynamic Event_Persistence Service_Object* TAO_CosNotification_Serv:_make_TAO_Notify_Standard_Event_Persistence() "-v -file_path ./event_persist.db"
diff --git a/TAO/orbsvcs/tests/Notify/Reconnecting/ns_mt_both.conf b/TAO/orbsvcs/tests/Notify/Reconnecting/ns_mt_both.conf
index 9022e30fee6..02ba9ed52ba 100644
--- a/TAO/orbsvcs/tests/Notify/Reconnecting/ns_mt_both.conf
+++ b/TAO/orbsvcs/tests/Notify/Reconnecting/ns_mt_both.conf
@@ -1,5 +1,5 @@
static TAO_CosNotify_Service "-DispatchingThreads 2 -SourceThreads 2 -AllowReconnect"
#
dynamic Topology_Factory Service_Object* TAO_CosNotification_Persist:_make_TAO_Notify_XML_Topology_Factory() "-base_path ./reconnect_test"
-dynamic Event_Persistence Service_Object* TAO_CosNotification_Persist:_make_TAO_Notify_Standard_Event_Persistence() "-file_path ./event_persist.db"
+dynamic Event_Persistence Service_Object* TAO_CosNotification_Serv:_make_TAO_Notify_Standard_Event_Persistence() "-file_path ./event_persist.db"
diff --git a/TAO/orbsvcs/tests/Notify/Reconnecting/ns_st_both.conf b/TAO/orbsvcs/tests/Notify/Reconnecting/ns_st_both.conf
index c2da6f07cee..eb8e1f29923 100644
--- a/TAO/orbsvcs/tests/Notify/Reconnecting/ns_st_both.conf
+++ b/TAO/orbsvcs/tests/Notify/Reconnecting/ns_st_both.conf
@@ -1,4 +1,4 @@
static TAO_CosNotify_Service "-AllowReconnect"
#
dynamic Topology_Factory Service_Object* TAO_CosNotification_Persist:_make_TAO_Notify_XML_Topology_Factory() "-v -base_path ./reconnect_test"
-dynamic Event_Persistence Service_Object* TAO_CosNotification_Persist:_make_TAO_Notify_Standard_Event_Persistence() "-v -file_path ./event_persist.db"
+dynamic Event_Persistence Service_Object* TAO_CosNotification_Serv:_make_TAO_Notify_Standard_Event_Persistence() "-v -file_path ./event_persist.db"
diff --git a/TAO/orbsvcs/tests/Notify/Reconnecting/run_test.pl b/TAO/orbsvcs/tests/Notify/Reconnecting/run_test.pl
index 0835c14d579..b57f87cc683 100755
--- a/TAO/orbsvcs/tests/Notify/Reconnecting/run_test.pl
+++ b/TAO/orbsvcs/tests/Notify/Reconnecting/run_test.pl
@@ -5,392 +5,502 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
# $Id$
# -*- perl -*-
-use lib "$ENV{ACE_ROOT}/bin";
-use PerlACE::Run_Test;
-
-PerlACE::check_privilege_group();
-
-my($eventType) = "-any"; # your choice of -any -structured or -sequence
-
-my($notify_port) = "9889";
-
-#file used to detect notification service startup
-my($notify_ior) = PerlACE::LocalFile("notify.ior");
-#hard coded file name in Consumer.cpp (for now)
-my($consumer_ids) = PerlACE::LocalFile("consumer.ids");
-#hard coded file name in Supplier.cpp (for now)
-my($supplier_ids) = PerlACE::LocalFile("supplier.ids");
-#file used to communicate channel # from consumer to supplier
-my($channel_id) = PerlACE::LocalFile("channel_id");
-#file names comes from svc.conf (+.xml & .000)
-my($save_xml) = PerlACE::LocalFile("./reconnect_test.xml");
-my($save_000) = PerlACE::LocalFile("./reconnect_test.000");
-my($eventpersist) = PerlACE::LocalFile("./event_persist.db");
-# hardcode filename written by the Supplier when it pauses.
-my($supplier_pause) = PerlACE::LocalFile("Supplier.paused");
+# ******************************************************************
+# Pragma Section
+# ******************************************************************
-my($verbose) = "";
+use strict;
-my $svcconf = "ns_st_topo.conf";
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::Run_Test;
-my $discon ="";
+# ******************************************************************
+# Data Section
+# ******************************************************************
+
+my($eventType) = '-any'; # your choice of -any -structured or -sequence
+
+my($status) = 0;
+my($notify_port) = PerlACE::random_port();
+my($st_topo) = 'ns_st_topo.conf';
+my($st_both) = 'ns_st_both.conf';
+my(%files) = (# File used to detect notification service startup
+ 'notify_ior' => PerlACE::LocalFile('notify.ior'),
+ # Hard coded file name in Consumer.cpp (for now)
+ 'consumer_ids' => PerlACE::LocalFile('consumer.ids'),
+ # Hard coded file name in Supplier.cpp (for now)
+ 'supplier_ids' => PerlACE::LocalFile('supplier.ids'),
+ # File used to communicate channel # from consumer to supplier
+ 'channel_id' => PerlACE::LocalFile('channel_id'),
+ # File used to save configuration for reconnect test
+ 'save_xml' => PerlACE::LocalFile('reconnect_test.xml'),
+ # File names comes from svc.conf (+.xml & .000)
+ 'save_000' => PerlACE::LocalFile('reconnect_test.000'),
+ # File names comes from svc.conf (+.xml & .001)
+ 'save_001' => PerlACE::LocalFile('reconnect_test.001'),
+ # Event persistent database file (from svc.conf)
+ 'eventpersist' => PerlACE::LocalFile('event_persist.db'),
+ # Hardcode filename written by the Supplier when it pauses.
+ 'supplier_pause' => PerlACE::LocalFile('Supplier.paused'),
+ );
+
+# ******************************************************************
+# Main Section
+# ******************************************************************
+
+my($verbose) = '';
+my($svcconf) = $st_topo;
+my($discon) = '';
# Process command line arguments
-foreach $i (@ARGV) {
- if ($i eq "-any") {
- $eventType = "-any";
+foreach my $i (@ARGV) {
+ if ($i eq '-any') {
+ $eventType = '-any';
}
- elsif ($i eq "-str" or $i eq "-structured") {
- $eventType = "-structured";
+ elsif ($i eq '-str' or $i eq '-structured') {
+ $eventType = '-structured';
}
- elsif ($i eq "-seq" or $i eq "-sequence") {
- $eventType = "-sequence";
+ elsif ($i eq '-seq' or $i eq '-sequence') {
+ $eventType = '-sequence';
}
- elsif ($i eq "-mt") {
- $svcconf = "ns_mt_topo.conf";
+ elsif ($i eq '-mt') {
+ $svcconf = 'ns_mt_topo.conf';
}
- elsif ($i eq "-disconnect") {
- $discon= "-disconnect";
+ elsif ($i eq '-disconnect') {
+ $discon= '-disconnect';
}
- elsif ($i eq "-v" or $i eq "-verbose") {
- $verbose = "-v";
+ elsif ($i eq '-v' or $i eq '-verbose') {
+ $verbose = '-v';
}
else {
print "TEST SCRIPT: unknown: $i\n";
print "TEST SCRIPT: usage: [-any|-str|-seq] -mt -v\n";
- exit -4;
+ exit(-4);
}
}
-my($client_args) = " $eventType $verbose -NoNameSvc -ORBInitRef NotifyEventChannelFactory=corbaloc::localhost:$notify_port/NotifyEventChannelFactory ";
-my($ns_args) = " -ORBObjRefStyle url -NoNameSvc -Boot -ORBSvcConf $svcconf -IORoutput $notify_ior -ORBEndpoint iiop://:$notify_port ";
-#my($ns_args_hidden) = " -NoNameSvc -Boot -ORBSvcConf $svcconf -IORoutput $notify_ior";
-# nuke the topology save files so we start clean
-unlink $save_xml;
-unlink $save_000;
-unlink $eventpersist;
-unlink $notify_ior;
+my($client_args) = "$eventType $verbose -NoNameSvc -ORBInitRef " .
+ "NotifyEventChannelFactory=corbaloc::" .
+ "localhost:$notify_port/NotifyEventChannelFactory ";
+my($ns_base_args) = "-ORBObjRefStyle url -NoNameSvc -Boot " .
+ "-IORoutput $files{'notify_ior'} " .
+ "-ORBEndpoint iiop://:$notify_port ";
+my($ns_args) = "-ORBSvcConf $svcconf $ns_base_args";
+
+# Delete the all of the files used in the test
+unlink(values(%files));
+# Define the processes first
+my($NS) = new PerlACE::Process("$PerlACE::TAO_ROOT/orbsvcs/Notify_Service/Notify_Service");
+my($CON) = new PerlACE::Process('Consumer');
+my($SUP) = new PerlACE::Process('Supplier');
-##define the processes first
-my($NS) = new PerlACE::Process("$PerlACE::TAO_ROOT/orbsvcs/Notify_Service/Notify_Service");
-my($CON) = new PerlACE::Process("./Consumer");
-my($SUP) = new PerlACE::Process("./Supplier");
+################
+# begin test 1
+################
-if ($verbose eq "-v") {print "TEST SCRIPT: Starting Notify Service on port $notify_port\n";}
+if ($verbose eq '-v') {
+ print "TEST SCRIPT: Starting Notify Service on port $notify_port\n";
+}
$NS->Arguments($ns_args);
-if ($verbose eq "-v") {print "TEST SCRIPT: " . $NS->CommandLine . "\n";}
-print $NS->CommandLine ();
+if ($verbose eq '-v') {print "TEST SCRIPT: " . $NS->CommandLine() . "\n";}
if ($NS->Spawn() == -1) {
- exit 1;
+ exit(1);
}
# the ior file is only used to wait for the service to start
-if (PerlACE::waitforfile_timed ($notify_ior, $PerlACE::wait_interval_for_process_creation) == -1) {
- print STDERR "ERROR: Timed out waiting for $notify_ior\n";
- $NS->Kill ();
- exit 1;
+if (PerlACE::waitforfile_timed(
+ $files{'notify_ior'},
+ $PerlACE::wait_interval_for_process_creation) == -1) {
+ print STDERR "ERROR: Timed out waiting for $files{'notify_ior'}\n";
+ $NS->Kill();
+ exit(1);
}
-# be sure consumer doesn't try to reconnect the first time
-unlink $consumer_ids;
-# don't use previous channel id
-unlink $channel_id;
# start the consumer,
# write the channel number to channel.id for use by Supplier
# expect to receive 20 events of type any
#
-$CON->Arguments("-channel $channel_id -expect 20 $discon $client_args");
-if ($verbose eq "-v") {print "TEST SCRIPT: " . $CON->CommandLine . "\n";}
-print $CON->CommandLine ();
+$CON->Arguments("-channel $files{'channel_id'} " .
+ "-expect 20 $discon $client_args");
+print "TEST SCRIPT: ", $CON->CommandLine(), "\n" if ($verbose eq '-v');
$CON->Spawn();
# wait for the channel number file
-if (PerlACE::waitforfile_timed ($channel_id, $PerlACE::wait_interval_for_process_creation) == -1) {
- print STDERR "ERROR: Timed out waiting for Consumer to write $channel_id\n";
- $NS->Kill ();
- $CON->Kill ();
- exit 1;
+if (PerlACE::waitforfile_timed(
+ $files{'channel_id'},
+ $PerlACE::wait_interval_for_process_creation) == -1) {
+ print STDERR "ERROR: Timed out waiting for Consumer ",
+ "to write $files{'channel_id'}\n";
+ $NS->Kill();
+ $CON->Kill();
+ exit(1);
}
-# discard old reconnect information
-unlink $supplier_ids;
-
# send 10 Any's, picking up the channel# from channel.id
-$SUP->Arguments("-channel $channel_id -send 10 $client_args");
-if ($verbose eq "-v") {print "TEST SCRIPT: " . $SUP->CommandLine . "\n";}
-print $SUP->CommandLine ();
+$SUP->Arguments("-channel $files{'channel_id'} -send 10 $client_args");
+print "TEST SCRIPT: ", $SUP->CommandLine(), "\n" if ($verbose eq '-v');
$SUP->SpawnWaitKill(60);
# forget the channel id, depend on the reconnect information
-unlink $channel_id;
+unlink($files{'channel_id'});
$SUP->Arguments("-send 10 -serial_number 10 $discon $client_args");
-if ($verbose eq "-v") {print "TEST SCRIPT: " . $SUP->CommandLine . "\n";}
-print $SUP->CommandLine ();
+if ($verbose eq '-v') {print "TEST SCRIPT: " . $SUP->CommandLine() . "\n";}
$SUP->SpawnWaitKill(60);
-$status = $CON->WaitKill (60);
+$status = $CON->WaitKill(60);
if ($status) {
print STDERR "ERROR: Consumer reported error\n";
$NS->Kill();
- exit $status;
- }
+ exit($status);
+}
print "TEST SCRIPT: ****Passed: Supplier reconnect test.\n";
################
-#end of test 1
+# end of test 1
################
+################
+# begin test 2
+################
# Now start the consumer again. Depending on reconnect this time
# Let it write the channel.id file so we know when it's up.
-if ($verbose eq "-v") {print "TEST SCRIPT: " . $CON->CommandLine . "\n";}
+if ($verbose eq '-v') {print "TEST SCRIPT: " . $CON->CommandLine() . "\n";}
$CON->Spawn();
# wait for the channel number file
-if (PerlACE::waitforfile_timed ($channel_id, $PerlACE::wait_interval_for_process_creation) == -1) {
- print STDERR "ERROR: Timed out waiting for Consumer to write $channel_id\n";
- $NS->Kill ();
- $CON->Kill ();
- exit 1;
+if (PerlACE::waitforfile_timed(
+ $files{'channel_id'},
+ $PerlACE::wait_interval_for_process_creation) == -1) {
+ print STDERR "ERROR: Timed out waiting for Consumer ",
+ "to write $files{'channel_id'}\n";
+ $NS->Kill();
+ $CON->Kill();
+ exit(1);
}
# forget the channel id, depend on the supplier reconnect information
-unlink $channel_id;
+unlink $files{'channel_id'};
$SUP->Arguments("-send 20 -serial_number 0 $client_args");
-if ($verbose eq "-v") {print "TEST SCRIPT: " . $SUP->CommandLine . "\n";}
-$status= $SUP->SpawnWaitKill(60);
+if ($verbose eq '-v') {print "TEST SCRIPT: " . $SUP->CommandLine() . "\n";}
+$status = $SUP->SpawnWaitKill(60);
if ($status) {
print STDERR "ERROR: Supplier reported error\n";
$CON->Kill();
$NS->Kill();
- exit $status;
- }
+ exit($status);
+}
-$status = $CON->WaitKill (60);
+$status = $CON->WaitKill(60);
if ($status) {
print STDERR "ERROR: Consumer reported error\n";
$NS->Kill();
- exit $status;
- }
+ exit($status);
+}
print "TEST SCRIPT: ****Passed: Consumer reconnect test.\n";
################
-#end of test 2
+# end of test 2
+################
+
+################
+# begin test 3
################
-if ($verbose eq "-v") {print "TEST SCRIPT: Stop the Notification Service\n";}
+if ($verbose eq '-v') {print "TEST SCRIPT: Stop the Notification Service\n";}
$NS->Kill();
-unlink $notify_ior;
+unlink $files{'notify_ior'};
-if ($verbose eq "-v") {print "TEST SCRIPT: Restarting Notify Service on port $notify_port\n";}
-if ($verbose eq "-v") {print "TEST SCRIPT: It should load topology from $save_xml\n";}
+if ($verbose eq '-v') {
+ print "TEST SCRIPT: Restarting Notify Service on port $notify_port\n",
+ "TEST SCRIPT: It should load topology from $files{'save_xml'}\n";
+}
# sleep to avoid socket-related problems
-sleep (10 * $PerlACE::Process::WAIT_DELAY_FACTOR);
+sleep(10 * $PerlACE::Process::WAIT_DELAY_FACTOR);
$NS->Arguments($ns_args);
-if ($verbose eq "-v") {print "TEST SCRIPT: " . $NS->CommandLine . "\n";}
+if ($verbose eq '-v') {print "TEST SCRIPT: " . $NS->CommandLine() . "\n";}
$NS->Spawn();
# the ior file is only used to wait for the service to start
-if (PerlACE::waitforfile_timed ($notify_ior, $PerlACE::wait_interval_for_process_creation) == -1) {
- print STDERR "ERROR: Timed out waiting for $notify_ior\n";
- $NS->Kill ();
- exit 1;
+if (PerlACE::waitforfile_timed(
+ $files{'notify_ior'},
+ $PerlACE::wait_interval_for_process_creation) == -1) {
+ print STDERR "ERROR: Timed out waiting for $files{'notify_ior'}\n";
+ $NS->Kill();
+ exit(1);
}
# Now start the consumer again. It will use the reconnect info.
# Let it write the channel.id file so we know when it's up.
-unlink $channel_id;
+unlink $files{'channel_id'};
-if ($verbose eq "-v") {print "TEST SCRIPT: " . $CON->CommandLine . "\n";}
+if ($verbose eq '-v') {print "TEST SCRIPT: " . $CON->CommandLine() . "\n";}
$CON->Spawn();
# wait for the channel number file
-if (PerlACE::waitforfile_timed ($channel_id, $PerlACE::wait_interval_for_process_creation) == -1) {
- print STDERR "ERROR: Timed out waiting for Consumer to write $channel_id\n";
- $NS->Kill ();
- $CON->Kill ();
- exit 1;
+if (PerlACE::waitforfile_timed(
+ $files{'channel_id'},
+ $PerlACE::wait_interval_for_process_creation) == -1) {
+ print STDERR "ERROR: Timed out waiting for Consumer ",
+ "to write $files{'channel_id'}\n";
+ $NS->Kill();
+ $CON->Kill();
+ exit(1);
}
# forget the channel id, depend on the supplier reconnect information
-unlink $channel_id;
+unlink $files{'channel_id'};
$SUP->Arguments("-send 20 -serial_number 0 $client_args");
-if ($verbose eq "-v") {print "TEST SCRIPT: " . $SUP->CommandLine . "\n";}
+if ($verbose eq '-v') {print "TEST SCRIPT: " . $SUP->CommandLine() . "\n";}
$status = $SUP->SpawnWaitKill(60);
if ($status) {
print STDERR "ERROR: Supplier reported error\n";
$NS->Kill();
$CON->Kill();
- exit $status;
- }
+ exit($status);
+}
-$status = $CON->WaitKill (60);
+$status = $CON->WaitKill(60);
if ($status) {
print STDERR "ERROR: Consumer reported error\n";
$NS->Kill();
- exit $status;
- }
+ exit($status);
+}
print "TEST SCRIPT: ****Passed: Topology Persistence Test.\n";
################
-#end of test 3
+# end of test 3
+################
+
+################
+# begin test 4
################
# Now start the consumer one more time
# Let it write the channel.id file so we know when it's up.
-unlink $channel_id;
+unlink $files{'channel_id'};
-if ($verbose eq "-v") {print "TEST SCRIPT: " . $CON->CommandLine . "\n";}
+if ($verbose eq '-v') {print "TEST SCRIPT: " . $CON->CommandLine() . "\n";}
$CON->Spawn();
# wait for the channel number file
-if (PerlACE::waitforfile_timed ($channel_id, $PerlACE::wait_interval_for_process_creation) == -1) {
- print STDERR "ERROR: Timed out waiting for Consumer to write $channel_id\n";
- $NS->Kill ();
- $CON->Kill ();
- exit 1;
+if (PerlACE::waitforfile_timed(
+ $files{'channel_id'},
+ $PerlACE::wait_interval_for_process_creation) == -1) {
+ print STDERR "ERROR: Timed out waiting for Consumer ",
+ "to write $files{'channel_id'}\n";
+ $NS->Kill();
+ $CON->Kill();
+ exit(1);
}
# forget the channel id, depend on the supplier reconnect information
-unlink $channel_id;
-
-# Start the Supplier, tell it to send 10 messages, pause until it is reconnected
-# then send another 10.
-
-unlink ($supplier_pause);
+unlink $files{'channel_id'};
+# Start the Supplier, tell it to send 10 messages,
+# pause until it is reconnected then send another 10.
$SUP->Arguments("-send 20 -pause 10 -serial_number 0 $client_args");
-if ($verbose eq "-v") {print "TEST SCRIPT: " . $SUP->CommandLine . "\n";}
+if ($verbose eq '-v') {print "TEST SCRIPT: " . $SUP->CommandLine() . "\n";}
$SUP->Spawn();
# wait for the supplier's "paused" file
-if (PerlACE::waitforfile_timed ($supplier_pause, 30) == -1) {
- print STDERR "ERROR: Timed out waiting for Supplier to write $supplier_pause\n";
- $NS->Kill ();
- $SUP->Kill ();
- $CON->Kill ();
- exit 1;
+if (PerlACE::waitforfile_timed(
+ $files{'supplier_pause'},
+ $PerlACE::wait_interval_for_process_creation) == -1) {
+ print STDERR "ERROR: Timed out waiting for Supplier ",
+ "to write $files{'supplier_pause'}\n";
+ $NS->Kill();
+ $SUP->Kill();
+ $CON->Kill();
+ exit(1);
}
-unlink ($supplier_pause);
-if ($verbose eq "-v") {print "TEST SCRIPT: Stop the Notification Service\n";}
+if ($verbose eq '-v') {print "TEST SCRIPT: Stop the Notification Service\n";}
$NS->Kill();
-unlink $notify_ior;
+unlink($files{'notify_ior'});
-if ($verbose eq "-v") {print "TEST SCRIPT: Restarting Notify Service\n";}
-if ($verbose eq "-v") {print "TEST SCRIPT: Use unspecified port to make it \"invisible\" to clients\n";}
-if ($verbose eq "-v") {print "TEST SCRIPT: It should load topology from $save_xml\n";}
-if ($verbose eq "-v") {print "TEST SCRIPT: and reconnect to registered clients.\n";}
+if ($verbose eq '-v') {
+ print "TEST SCRIPT: Restarting Notify Service\n",
+ "TEST SCRIPT: It should load topology from $files{'save_xml'}\n",
+ "TEST SCRIPT: and reconnect to registered clients.\n";
+}
-#$NS->Arguments($ns_args_hidden);
# sleep to avoid socket-related problems
-sleep (10 * $PerlACE::Process::WAIT_DELAY_FACTOR);
+sleep(10 * $PerlACE::Process::WAIT_DELAY_FACTOR);
-if ($verbose eq "-v") {print "TEST SCRIPT: " . $NS->CommandLine . "\n";}
+if ($verbose eq '-v') {print "TEST SCRIPT: " . $NS->CommandLine() . "\n";}
$NS->Spawn();
# at this point, both the consumer and the supplier should reconnect
# and the remaining events should be delivered
# eventually the consumer will finish
-$status = $CON->WaitKill (20);
+$status = $CON->WaitKill(20);
if ($status) {
print STDERR "ERROR: Consumer reported error\n";
$SUP->Kill();
$NS->Kill();
- exit $status;
- }
+ exit($status);
+}
-$status = $SUP->Kill ();
+$status = $SUP->Kill();
if ($status) {
print STDERR "ERROR: Supplier reported error\n";
$NS->Kill();
- exit $status;
- }
+ exit($status);
+}
print "TEST SCRIPT: ****Passed: Reconnection Factory test.\n";
################
-#end of test 4
+# end of test 4
+################
+
+################
+# begin test 5
################
-if ($verbose eq "-v") {print "TEST SCRIPT: Stop the Notification Service\n";}
+if ($verbose eq '-v') {print "TEST SCRIPT: Stop the Notification Service\n";}
$NS->Kill();
-unlink $notify_ior;
-unlink $save_xml;
-unlink $save_000;
-unlink $eventpersist;
-unlink $consumer_ids;
-unlink $channel_id;
-unlink $supplier_ids;
+unlink(values(%files));
-sleep (10 * $PerlACE::Process::WAIT_DELAY_FACTOR); ## avoid lingering sockets
+sleep(10 * $PerlACE::Process::WAIT_DELAY_FACTOR); ## avoid lingering sockets
# go back to normal ns args
$NS->Arguments($ns_args);
-if ($verbose eq "-v") {print "TEST SCRIPT: " . $NS->CommandLine . "\n";}
+if ($verbose eq '-v') {print "TEST SCRIPT: " . $NS->CommandLine() . "\n";}
$NS->Spawn();
# the ior file is only used to wait for the service to start
-if (PerlACE::waitforfile_timed ($notify_ior, $PerlACE::wait_interval_for_process_creation) == -1) {
- print STDERR "ERROR: Timed out waiting for $notify_ior\n";
- $NS->Kill ();
- exit 1;
+if (PerlACE::waitforfile_timed(
+ $files{'notify_ior'},
+ $PerlACE::wait_interval_for_process_creation) == -1) {
+ print STDERR "ERROR: Timed out waiting for $files{'notify_ior'}\n";
+ $NS->Kill();
+ exit(1);
}
#configure the consumer to expect 20 events, fail (throw an exception
# after 8 events) then continue to listen for remaining events.
#The Notification service should automatically retry (but may discard)
# the failed events.
-$CON->Arguments("-channel $channel_id -expect 20 -fail 8 $client_args");
-if ($verbose eq "-v") {print "TEST SCRIPT: " . $CON->CommandLine . "\n";}
+$CON->Arguments("-channel $files{'channel_id'} " .
+ "-expect 20 -fail 8 $client_args");
+if ($verbose eq '-v') {print "TEST SCRIPT: " . $CON->CommandLine() . "\n";}
$CON->Spawn();
# wait for the channel number file
-if (PerlACE::waitforfile_timed ($channel_id, $PerlACE::wait_interval_for_process_creation) == -1) {
- print STDERR "ERROR: Timed out waiting for Consumer to write $channel_id\n";
- $NS->Kill ();
- $CON->Kill ();
- exit 1;
+if (PerlACE::waitforfile_timed(
+ $files{'channel_id'},
+ $PerlACE::wait_interval_for_process_creation) == -1) {
+ print STDERR "ERROR: Timed out waiting for Consumer ",
+ "to write $files{'channel_id'}\n";
+ $NS->Kill();
+ $CON->Kill();
+ exit(1);
}
-$SUP->Arguments("-channel $channel_id -send 20 $client_args");
-if ($verbose eq "-v") {print "TEST SCRIPT: " . $SUP->CommandLine . "\n";}
+$SUP->Arguments("-channel $files{'channel_id'} -send 20 $client_args");
+if ($verbose eq '-v') {print "TEST SCRIPT: " . $SUP->CommandLine() . "\n";}
$status = $SUP->SpawnWaitKill(20);
if ($status) {
print STDERR "ERROR: Supplier reported error\n";
$NS->Kill();
- $CON->Kill ();
- exit $status;
- }
+ $CON->Kill();
+ exit($status);
+}
## this is a slow test due to the reconnection
## time, so give it enough time...
-$status = $CON->WaitKill (240);
+$status = $CON->WaitKill(240);
if ($status) {
print STDERR "ERROR: Consumer reported error\n";
$NS->Kill();
- exit $status;
- }
+ exit($status);
+}
print "TEST SCRIPT: ****Passed: Consumer recoverable exception test.\n";
################
-#end of test 5
+# end of test 5
+################
+
+################
+# begin test 6
################
-if ($verbose eq "-v") {print "TEST SCRIPT: Stop the Notification Service\n";}
+print "TEST SCRIPT: Stop the Notification Service\n" if ($verbose eq '-v');
$NS->Kill();
-unlink $notify_ior;
-unlink $save_xml;
-unlink $save_000;
-unlink $eventpersist;
+unlink(values(%files));
+
+## Wait a bit to avoid lingering sockets from the previous Notify_Service
+sleep(3);
+
+$NS->Arguments("-ORBSvcConf $st_both $ns_base_args");
+print "TEST SCRIPT: ", $NS->CommandLine(), "\n" if ($verbose eq '-v');
+if ($NS->Spawn() == -1) {
+ exit(1);
+}
+
+# the ior file is only used to wait for the service to start
+if (PerlACE::waitforfile_timed(
+ $files{'notify_ior'},
+ $PerlACE::wait_interval_for_process_creation) == -1) {
+ print STDERR "ERROR: Timed out waiting for $files{'notify_ior'}\n";
+ $NS->Kill();
+ exit(1);
+}
+
+my($expected) = 10;
+$CON->Arguments("-channel $files{'channel_id'} " .
+ "-expect $expected $client_args");
+print "TEST SCRIPT: ", $CON->CommandLine(), "\n" if ($verbose eq '-v');
+$CON->Spawn();
+
+# wait for the channel number file
+if (PerlACE::waitforfile_timed(
+ $files{'channel_id'},
+ $PerlACE::wait_interval_for_process_creation) == -1) {
+ print STDERR "ERROR: Timed out waiting for Consumer ",
+ "to write $files{'channel_id'}\n";
+ $NS->Kill();
+ $CON->Kill();
+ exit(1);
+}
+
+$SUP->Arguments("-channel $files{'channel_id'} -send $expected $client_args");
+print "TEST SCRIPT: ", $SUP->CommandLine(), "\n" if ($verbose eq '-v');
+$SUP->SpawnWaitKill(60);
+
+my($con) = $CON->WaitKill(30);
+if ($con != 0) {
+ $NS->Kill();
+ exit(1);
+}
+
+my($next_expected) = 3;
+$SUP->Arguments("-channel $files{'channel_id'} -send 3 " .
+ "-serial_number $expected $client_args");
+print "TEST SCRIPT: ", $SUP->CommandLine(), "\n" if ($verbose eq '-v');
+$SUP->SpawnWaitKill(60);
+
+$CON->Arguments("-channel $files{'channel_id'} -expect $next_expected " .
+ "-serial_number $expected $client_args");
+print "TEST SCRIPT: ", $CON->CommandLine(), "\n" if ($verbose eq '-v');
+$status = $CON->SpawnWaitKill(30);
+
+$NS->Kill();
+
+################
+# end of test 6
+################
-exit $status;
+unlink(values(%files));
+exit($status);