Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / tests / Notify / Basic / AdminProperties.h
blobffea58af84dfee7aaa957ee71e4a02ed3f48d4ec
1 /* -*- C++ -*- */
2 //=============================================================================
3 /**
4 * @file AdminProperties.h
6 * Test for EC Admin QoS properties.
8 * @author Pradeep Gore <pradeep@cs.wustl.edu>
9 */
10 //=============================================================================
13 #ifndef ADMINPROPERTIES
14 #define ADMINPROPERTIES
16 #include "ace/Task.h"
17 #include "Notify_Test_Client.h"
18 #include "Notify_StructuredPushConsumer.h"
19 #include "Notify_StructuredPushSupplier.h"
21 class AdminProperties;
22 /***************************************************************************/
24 class AdminProperties_StructuredPushConsumer : public TAO_Notify_Tests_StructuredPushConsumer
26 friend class AdminProperties;
27 public:
28 AdminProperties_StructuredPushConsumer (AdminProperties* client);
30 // = StructuredPushSupplier methods
31 virtual void push_structured_event (const CosNotification::StructuredEvent & notification
34 protected:
35 AdminProperties* client_;
37 ACE_Atomic_Op <TAO_SYNCH_MUTEX, CORBA::Long> events_received_;
41 /**
42 * @class AdminProperties_Task
44 * @brief Run a thread to dispatch events.
46 * Use the ACE_Task_Base class.
48 class AdminProperties_Task : public ACE_Task_Base
51 public:
52 /// Constructor.
53 AdminProperties_Task (void);
55 /// Init this object.
56 void init (TAO_Notify_Tests_StructuredPushSupplier *supplier, AdminProperties* client);
58 virtual int init (int argc, ACE_TCHAR *argv []);
60 /// The thread entry point.
61 virtual int svc (void);
63 private:
64 /// Supplier
65 TAO_Notify_Tests_StructuredPushSupplier *supplier_;
67 /// Client Object.
68 AdminProperties* client_;
71 /***************************************************************************/
73 /**
74 * @class AdminProperties
76 * @brief AdminProperties
78 * Test for Notify EC properties -
79 * max_queue_length
80 * max_consumers
81 * max_suppliers
82 * reject_new_events
84 class AdminProperties : public Notify_Test_Client
87 friend class AdminProperties_StructuredPushConsumer;
88 friend class AdminProperties_Task;
90 public:
91 AdminProperties (void);
92 ~AdminProperties (void);
94 int parse_args (int argc, ACE_TCHAR *argv[]) ;
96 // Initialization.
98 /// Run the test.
99 void run_test (void);
101 private:
102 void create_suppliers (void);
103 void create_consumers (void);
104 void create_channel(bool reject);
106 /// Test MaxSuppliers and MaxConsumers
107 void test_max_clients (void);
109 /// Test MaxQueueLength properties
110 void test_max_queue_length (bool reject);
112 // Data Members
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 /// Values for Admin Properties supplied by user.
123 CORBA::Long max_queue_length_;
124 CORBA::Long max_consumers_;
125 CORBA::Long max_suppliers_;
126 CORBA::Boolean reject_new_events_;
128 /// Number of consumers to connect to check MaxConsumers property.
129 CORBA::Long consumers_;
131 /// Number of suppliers to connect to check MaxSuppliers property.
132 CORBA::Long suppliers_;
134 /// Number of events to send to the channel.
135 CORBA::Long event_count_;
137 /// Count of consumers successfully connect to the EC.
138 int suppliers_connected_count_;
140 /// Count of consumers successfully connect to the EC.
141 int consumers_connected_count_;
143 // Number of supplier pushes that resulted in an IMP_LIMIT exception
144 int rejections_;
147 #endif /* ADMINPROPERTIES */