}
System.out.println("MethodCount = " + control.getLongValue("methodCount"));
QmfData inArgs;
QmfData outArgs;
MethodResult results;
/*
System.out.println("Testing invokeMethod(toString, args) - method called directly on Agent");
results = _gizmo.invokeMethod("toString", null);
System.out.println("gizmo.toString() = " + results.getArguments().getStringValue("string"));
*/
// ********** Invoke create_child nethod **********
System.out.println("Testing invokeMethod(create_child, args)");
inArgs = new QmfData();
inArgs.setValue("name", "child 1");
results = control.invokeMethod("create_child", inArgs);
if (!results.succeeded())
{
System.out.println("create_child returned an exception object");
System.exit(1);
}
if (!results.hasValue("childAddr"))
{
System.out.println("create_child returned an unexpected value");
System.exit(1);
}
ObjectId childId = results.getRefValue("childAddr");
System.out.println("childId = " + childId);
System.out.println("childAddr subtype = " + results.getSubtype("childAddr"));
QmfConsoleData child1 = _console.getObjects(childId).get(0);
System.out.println("child1 name = " + child1.getStringValue("name"));
// Update and display state of control object
control.refresh();
System.out.println("MethodCount = " + control.getLongValue("methodCount"));
// ********** Invoke event nethod **********
System.out.println("Testing invokeMethod(event, args) ");
inArgs = new QmfData();
inArgs.setValue("text", "Attention Will Robinson!! Aliens have just invaded");
inArgs.setValue("severity", 0);
control.invokeMethod("event", inArgs);
// Update and display state of control object
control.refresh();
System.out.println("MethodCount = " + control.getLongValue("methodCount"));
// ********** Invoke fail nethod **********
System.out.println("Testing invokeMethod(fail, args) ");
QmfData details = new QmfData();
details.setValue("detail1", "something bad");
details.setValue("detail2", "something even badder");
inArgs = new QmfData();
inArgs.setValue("details", details.mapEncode());
results = control.invokeMethod("fail", inArgs);
System.out.println("whatHappened: " + results.getStringValue("whatHappened"));
System.out.println("howBad: " + results.getLongValue("howBad"));
// Update and display state of control object
control.refresh();
System.out.println("MethodCount = " + control.getLongValue("methodCount"));