Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / tests / Notify / Basic / ConnectDisconnect.h
blobe06d200aac437e0829fee48147173793bdd5c054
1 /* -*- C++ -*- */
2 //=============================================================================
3 /**
4 * @file ConnectDisconnect.h
6 * Test connect-disconnect methods of Notify.
8 * @author Pradeep Gore <pradeep@cs.wustl.edu>
9 */
10 //=============================================================================
13 #ifndef NOTIFY_CONNECT_DISCONNECT_H
14 #define NOTIFY_CONNECT_DISCONNECT_H
16 #include "Notify_Test_Client.h"
17 #include "Notify_StructuredPushConsumer.h"
18 #include "Notify_StructuredPushSupplier.h"
19 #include "Notify_PushConsumer.h"
20 #include "Notify_PushSupplier.h"
21 #include "Notify_SequencePushConsumer.h"
22 #include "Notify_SequencePushSupplier.h"
24 #if defined(_MSC_VER)
25 #pragma warning(push)
26 #pragma warning(disable:4250)
27 #endif /* _MSC_VER */
29 class ConnectDisconnect;
31 /**
32 * @class CD_Entity
33 The entity that connects/disconnects.
35 class CD_Entity
37 public:
38 CD_Entity (ConnectDisconnect* cd, int id);
39 ~CD_Entity ();
40 private:
41 int id_;
42 ConnectDisconnect* cd_;
45 #define CD_DECLARE_ENTITY(X) \
46 class CD_##X : public TAO_Notify_##X, public CD_Entity \
47 { \
48 public: \
49 CD_##X (ConnectDisconnect* cd, int id); \
52 CD_DECLARE_ENTITY(PushConsumer)
53 CD_DECLARE_ENTITY(StructuredPushConsumer)
54 CD_DECLARE_ENTITY(SequencePushConsumer)
56 CD_DECLARE_ENTITY(PushSupplier)
57 CD_DECLARE_ENTITY(StructuredPushSupplier)
58 CD_DECLARE_ENTITY(SequencePushSupplier)
60 /***************************************************************************/
62 class ConnectDisconnect : public Notify_Test_Client
64 public:
65 // Initialization and termination code.
66 ConnectDisconnect (void);
67 virtual ~ConnectDisconnect ();
69 /// Keeps track of how many objects were destroyed.
70 void on_entity_destroyed (void);
72 int parse_args (int argc,
73 ACE_TCHAR *argv[]);
75 /// initialization.
76 int init (int argc,
77 ACE_TCHAR *argv []);
79 /// Run the test.
80 void run_test (void);
82 /// End the test.
83 void end_test (void);
85 /// Check if we got the expected results.
86 int check_results (void);
88 protected:
89 /// Create EC.
90 void create_EC (void);
92 /// The one channel that we create using the factory.
93 CosNotifyChannelAdmin::EventChannel_var ec_;
95 /// The consumer admin used by consumers.
96 CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin_;
98 /// The supplier admin used by suppliers.
99 CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin_;
101 /// Arrays of Consumers.
102 TAO_Notify_Tests_PushConsumer** any_consumer_;
103 TAO_Notify_Tests_StructuredPushConsumer** structured_consumer_;
104 TAO_Notify_Tests_SequencePushConsumer** sequence_consumer_;
106 /// arrays of Suppliers
107 TAO_Notify_Tests_PushSupplier** any_supplier_;
108 TAO_Notify_Tests_StructuredPushSupplier** structured_supplier_;
109 TAO_Notify_Tests_SequencePushSupplier** sequence_supplier_;
111 /// Count of clients destroyed. for c consumers, s suppliers and for t times.
112 /// this should be (s+c)*t.
113 ACE_Atomic_Op <TAO_SYNCH_MUTEX, int> result_count_;
115 int expected_count_; // (s+c)*t
117 // = command line params
119 /// The number of iterations to connect disconnect.
120 int count_;
122 /// The number of counsumers to create.
123 int consumers_;
125 /// The number of suppliers to create.
126 int suppliers_;
129 /***************************************************************************/
131 #if defined(_MSC_VER)
132 #pragma warning(pop)
133 #endif /* _MSC_VER */
135 #endif /* NOTIFY_TESTS_UPDATES_H */