Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / tests / Notify / Basic / Updates.h
bloba75cf37d52f9895aa1e2015fcc5354ee897fba0f
1 /* -*- C++ -*- */
2 //=============================================================================
3 /**
4 * @file Updates.h
6 * Test to check if <offer_change> and <subscription_change> messages are
7 * received correctly.
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"
21 #if defined(_MSC_VER)
22 #pragma warning(push)
23 #pragma warning(disable:4250)
24 #endif /* _MSC_VER */
26 class Updates;
28 class Updates_StructuredPushConsumer : public TAO_Notify_Tests_StructuredPushConsumer
30 public:
31 /// Constructor.
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);
38 protected:
39 Updates * test_client_;
42 /***************************************************************************/
44 class Updates_StructuredPushSupplier : public TAO_Notify_Tests_StructuredPushSupplier
46 public:
47 /// Constructor.
48 Updates_StructuredPushSupplier (Updates * test_client);
50 /// Destructor.
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 protected:
60 Updates* test_client_;
63 /***************************************************************************/
65 class Updates : public Notify_Test_Client
67 public:
68 // Initialization and termination code
69 Updates (void);
70 virtual ~Updates ();
72 /// initialization.
73 int init (int argc, ACE_TCHAR *argv []);
75 /// Run the test.
76 void run_test (void);
78 /// print_event_types
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);
87 protected:
88 /// Create EC
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);
97 // test offer_change
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
107 int added_count_;
109 /// Count of removed updates received
110 /// Check if these are equal to <update_count_> at the end of the test.
111 int removed_count_;
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_;
122 /// Consumer
123 TAO_Notify_Tests_StructuredPushConsumer* consumer_;
125 /// Supplier
126 TAO_Notify_Tests_StructuredPushSupplier* supplier_;
128 private:
129 friend class Updates_StructuredPushSupplier;
130 friend class Updates_StructuredPushConsumer;
133 /***************************************************************************/
135 #if defined(_MSC_VER)
136 #pragma warning(pop)
137 #endif /* _MSC_VER */
139 #endif /* NOTIFY_TESTS_UPDATES_H */