本文整理汇总了C++中Tester::ResetEventReceived方法的典型用法代码示例。如果您正苦于以下问题:C++ Tester::ResetEventReceived方法的具体用法?C++ Tester::ResetEventReceived怎么用?C++ Tester::ResetEventReceived使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tester
的用法示例。
在下文中一共展示了Tester::ResetEventReceived方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main_int
int main_int(int argc, char** argv)
{
SessionManager* smgr;
Tester engine;
Object::Vector list;
Object::AttributeMap args;
// ClassKey ckey;
MethodResponse result;
std::string id;
const char* host = argc>1 ? argv[1] : "127.0.0.1";
int port = argc>2 ? atoi(argv[2]) : 5672;
uint32_t trigger_id;
int32_t interval;
time_t first_event, second_event;
engine.init(host, port);
smgr = engine.GetSessionManager();
smgr->getObjects(list, "agent");
smgr->getObjects(list, "condortrigger");
cout << "Currently installed triggers:" << endl;
for (Object::Vector::iterator iter = list.begin(); iter != list.end(); iter++)
{
cout << "Trigger ID: " << atoll(iter->getIndex().c_str()) << endl;
iter->invokeMethod("GetTriggerName", args, result);
cout << "Trigger Name: " << result.arguments.begin()->second->str() << endl;
iter->invokeMethod("GetTriggerQuery", args, result);
cout << "Trigger Query: " << result.arguments.begin()->second->str() << endl;
iter->invokeMethod("GetTriggerText", args, result);
cout << "Trigger Text: " << result.arguments.begin()->second->str() << endl << endl;
}
// Set the evaluation interval to 5 seconds
engine.SetInterval(5);
interval = engine.GetInterval();
if (interval != 5)
{
cout << "Error: Interval was not to 5 seconds" << endl;
}
// Add a trigger and verify an event is received
engine.AddTrigger("TestTrigger", "(SlotID == 1)", "$(Machine) has a slot 1");
while (false == engine.GetEventReceived())
{
sleep(1);
}
first_event = time(NULL);
engine.ResetEventReceived();
while (false == engine.GetEventReceived())
{
sleep(1);
}
second_event = time(NULL);
engine.ResetEventReceived();
if ((second_event - first_event) > 6)
{
cout << "Error: Trigger evaluations occurring greater than evey 5 seconds" << endl;
}
else
{
cout << "Trigger evaluations occurring every 5 seconds" << endl;
}
// Retrieve the ID of the trigger added
smgr->getObjects(list, "agent");
smgr->getObjects(list, "condortrigger");
for (Object::Vector::iterator iter = list.begin(); iter != list.end(); iter++)
{
iter->invokeMethod("GetTriggerName", args, result);
if (result.arguments.begin()->second->str() == "TestTrigger")
{
cout << "Getting trigger id" << endl;
trigger_id = atoll(iter->getIndex().c_str());
break;
}
}
// Change the trigger Name and verify an event is received
engine.ChangeTriggerName(trigger_id, "Changed Test Trigger");
while (false == engine.GetEventReceived())
{
sleep(1);
}
engine.ResetEventReceived();
// Change the trigger query and text and verify an event is received
engine.ChangeTriggerQuery(trigger_id, "(SlotID > 0)");
engine.ChangeTriggerText(trigger_id, "$(Machine) has a slot $(SlotID)");
while (false == engine.GetEventReceived())
{
sleep(1);
}
engine.ResetEventReceived();
// Remove the trigger
engine.RemoveTrigger(trigger_id);
//.........这里部分代码省略.........