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
60 Updates
* test_client_
;
63 /***************************************************************************/
65 class Updates
: public Notify_Test_Client
68 // Initialization and termination code
73 int init (int argc
, ACE_TCHAR
*argv
[]);
79 void print_event_types (const CosNotification::EventTypeSeq
&types
);
81 /// Invoked by Supplier and Consumer when they receive updates
82 void types_changed (const CosNotification::EventTypeSeq
& added
, const CosNotification::EventTypeSeq
& removed
);
84 /// Wait for expected count of updates.
85 void wait_for_updates (int expected_added
, int expected_removed
);
89 void create_EC (void);
91 /// Helper to add types.
92 void add_type (CosNotification::EventTypeSeq
& type_seq
, const char* type
);
94 // test subscription_change
95 void test_subscription_change (void);
98 void test_offer_change (void);
100 /// Reset the counts.
101 void reset_counts (void);
103 /// Lock to serialize internal state.
104 TAO_SYNCH_MUTEX lock_
;
106 /// Count of added updates received
109 /// Count of removed updates received
110 /// Check if these are equal to <update_count_> at the end of the test.
113 /// The one channel that we create using the factory.
114 CosNotifyChannelAdmin::EventChannel_var ec_
;
116 /// The consumer admin used by consumers.
117 CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin_
;
119 /// The supplier admin used by suppliers.
120 CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin_
;
123 TAO_Notify_Tests_StructuredPushConsumer
* consumer_
;
126 TAO_Notify_Tests_StructuredPushSupplier
* supplier_
;
129 friend class Updates_StructuredPushSupplier
;
130 friend class Updates_StructuredPushConsumer
;
133 /***************************************************************************/
135 #if defined(_MSC_VER)
137 #endif /* _MSC_VER */
139 #endif /* NOTIFY_TESTS_UPDATES_H */