2 //=============================================================================
6 * Test to check if <offer_change> and <subscription_change> messages are
9 * @author Pradeep Gore <pradeep@cs.wustl.edu>
11 //=============================================================================
14 #ifndef NOTIFY_TESTS_UPDATES_H
15 #define NOTIFY_TESTS_UPDATES_H
17 #include "Notify_Test_Client.h"
18 #include "Notify_StructuredPushConsumer.h"
19 #include "Notify_StructuredPushSupplier.h"
23 #pragma warning(disable:4250)
28 class Updates_StructuredPushConsumer
: public TAO_Notify_Tests_StructuredPushConsumer
32 Updates_StructuredPushConsumer (Updates
*test_client
);
34 /// Offer change is conveyed here.
35 virtual void offer_change (const CosNotification::EventTypeSeq
& added
,
36 const CosNotification::EventTypeSeq
& removed
);
39 Updates
* test_client_
;
42 /***************************************************************************/
44 class Updates_StructuredPushSupplier
: public TAO_Notify_Tests_StructuredPushSupplier
48 Updates_StructuredPushSupplier (Updates
* test_client
);
51 virtual ~Updates_StructuredPushSupplier ();
53 /// Subscription change is conveyed here.
54 virtual void subscription_change (
55 const CosNotification::EventTypeSeq
& added
,
56 const CosNotification::EventTypeSeq
& removed
);
59 Updates
* test_client_
;
62 /***************************************************************************/
64 class Updates
: public Notify_Test_Client
67 // Initialization and termination code
72 int init (int argc
, ACE_TCHAR
*argv
[]);
78 void print_event_types (const CosNotification::EventTypeSeq
&types
);
80 /// Invoked by Supplier and Consumer when they receive updates
81 void types_changed (const CosNotification::EventTypeSeq
& added
, const CosNotification::EventTypeSeq
& removed
);
83 /// Wait for expected count of updates.
84 void wait_for_updates (int expected_added
, int expected_removed
);
90 /// Helper to add types.
91 void add_type (CosNotification::EventTypeSeq
& type_seq
, const char* type
);
93 // test subscription_change
94 void test_subscription_change ();
97 void test_offer_change ();
100 void reset_counts ();
102 /// Lock to serialize internal state.
103 TAO_SYNCH_MUTEX lock_
;
105 /// Count of added updates received
108 /// Count of removed updates received
109 /// Check if these are equal to <update_count_> at the end of the test.
112 /// The one channel that we create using the factory.
113 CosNotifyChannelAdmin::EventChannel_var ec_
;
115 /// The consumer admin used by consumers.
116 CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin_
;
118 /// The supplier admin used by suppliers.
119 CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin_
;
122 TAO_Notify_Tests_StructuredPushConsumer
* consumer_
;
125 TAO_Notify_Tests_StructuredPushSupplier
* supplier_
;
128 friend class Updates_StructuredPushSupplier
;
129 friend class Updates_StructuredPushConsumer
;
132 /***************************************************************************/
134 #if defined(_MSC_VER)
136 #endif /* _MSC_VER */
138 #endif /* NOTIFY_TESTS_UPDATES_H */