Exemplo n.º 1
0
list<string>
SimpleConsole::findAbsentNodes()
{
	list<string> missing;
	Object::Vector objs;

	try {
		sessionManager->getObjects(objs, "Node");
	} catch(...) {
		cout << "Failed to get roster of Nodes" << endl;
		return missing;
	}

	cout << "Roster contains " << objs.size() << " nodes" << endl;

	for (Object::Vector::const_iterator obj = objs.begin();
		 objs.end() != obj;
		 obj++) {
		cout << " . " << obj->attrString("name") << endl;
		missing.push_back(obj->attrString("name"));
	}

	try {
		sessionManager->getObjects(objs, "master");
	} catch(...) {
		cout << "Failed to get list of present Nodes" << endl;
		return missing;
	}

	cout << objs.size() << " nodes present" << endl;

	for (Object::Vector::const_iterator obj = objs.begin();
		 objs.end() != obj;
		 obj++) {
		missing.remove(obj->attrString("Name"));
	}

	cout << "Found " << missing.size() << " missing nodes" << endl;

	return missing;
}
Exemplo n.º 2
0
void
Tester::AddTrigger(const char* name, const char* query, const char* text)
{
   Object::AttributeMap args;
   MethodResponse result;
   Object::Vector list;

   cout << "AddTrigger called" << endl;

   sm->getObjects(list, "condortriggerservice");
   cout << "# of objects: " << list.size() << endl;
   if (0 < list.size())
   {
      cout << "Adding Trigger: " << name << endl;
      Object& triggerService = *list.begin();
      args.addString("Name", std::string(name));
      args.addString("Query", std::string(query));
      args.addString("Text", std::string(text));

      triggerService.invokeMethod("AddTrigger", args, result);
      cout << "Result: code=" << result.code << " text=" << result.text << endl << endl;
   }
}
Exemplo n.º 3
0
int32_t
Tester::GetInterval()
{
   Object::AttributeMap args;
   MethodResponse result;
   Object::Vector list;

   sm->getObjects(list, "condortriggerservice");
   if (0 < list.size())
   {
      cout << "Retrieving Interval" << endl;
      Object& triggerService = *list.begin();
      triggerService.invokeMethod("GetEvalInterval", args, result);
      cout << "Result: code=" << result.code << " text=" << result.text << endl << endl;
   }
   return atoll(result.arguments.begin()->second->str().c_str());
}
Exemplo n.º 4
0
void
Tester::RemoveTrigger(uint32_t id)
{
   Object::AttributeMap args;
   MethodResponse result;
   Object::Vector list;

   sm->getObjects(list, "condortriggerservice");
   if (0 < list.size())
   {
      cout << "Removing Trigger ID: " << id << endl;
      Object& triggerService = *list.begin();
      args.addUint("TriggerID", id);
      triggerService.invokeMethod("RemoveTrigger", args, result);
      cout << "Result: code=" << result.code << " text=" << result.text << endl << endl;
   }
}
Exemplo n.º 5
0
void
Tester::ChangeTriggerText(uint32_t id, const char* text)
{
   Object::AttributeMap args;
   MethodResponse result;
   Object::Vector list;

   sm->getObjects(list, "condortriggerservice");
   if (0 < list.size())
   {
      cout << "Changing Trigger Text to : " << text << endl;
      Object& triggerService = *list.begin();
      args.addUint("TriggerID", id);
      args.addString("Text", std::string(text));
      triggerService.invokeMethod("SetTriggerText", args, result);
      cout << "Result: code=" << result.code << " text=" << result.text << endl << endl;
   }
}
Exemplo n.º 6
0
void
Tester::SetInterval(int32_t interval)
{
   Object::AttributeMap args;
   MethodResponse result;
   Object::Vector list;

// Hack.  Can safely be removed once qmf is fixed
   sm->getObjects(list, "agent");
   sm->getObjects(list, "condortriggerservice");
   if (0 < list.size())
   {
      cout << "Setting Interval to " << interval << endl;
      Object& triggerService = *list.begin();
      args.addInt("Interval", interval);
      triggerService.invokeMethod("SetEvalInterval", args, result);
      cout << "Result: code=" << result.code << " text=" << result.text << endl << endl;
   }
}