operations.put(mo.getName(), mo);
}
ManagedOperation mgdop = operations.get("showHistory");
assertNotNull("HAPartition has showHistory", mgdop);
MetaValue result = mgdop.invoke();
assertNotNull(result);
mgdop = operations.get("showHistoryAsXML");
assertNotNull("HAPartition has showHistoryAsXML", mgdop);
result = mgdop.invoke();
assertNotNull(result);
mgdop = operations.get("getDRMServiceNames");
assertNotNull("HAPartition has getDRMServiceNames", mgdop);
result = mgdop.invoke();
assertTrue(result instanceof CollectionValue);
MetaValue[] elements = ((CollectionValue) result).getElements();
assertNotNull(elements);
boolean found = false;
for (MetaValue element : elements)
{
assertTrue(element instanceof SimpleValue);
if (HAJNDI.equals(((SimpleValue) element).getValue()))
{
found = true;
break;
}
}
assertTrue(found);
mgdop = operations.get("listDRMContent");
assertNotNull("HAPartition has listDRMContent", mgdop);
result = mgdop.invoke();
assertTrue(result instanceof SimpleValue);
Object val = ((SimpleValue) result).getValue();
assertTrue(val instanceof String);
assertTrue(((String) val).indexOf(HAJNDI) > -1);
mgdop = operations.get("listDRMContentAsXml");
assertNotNull("HAPartition has listDRMContentAsXml", mgdop);
result = mgdop.invoke();
assertTrue(result instanceof SimpleValue);
val = ((SimpleValue) result).getValue();
assertTrue(val instanceof String);
assertTrue(((String) val).indexOf(HAJNDI) > -1);
mgdop = operations.get("getDRMServiceViewId");
assertNotNull("HAPartition has getDRMServiceViewId", mgdop);
MetaValue hajndiparam = SimpleValueSupport.wrap(HAJNDI);
MetaValue[] hajndiparams = new MetaValue[]{hajndiparam};
result = mgdop.invoke(hajndiparams);
assertNotNull(result);
mgdop = operations.get("lookupDRMNodeNames");
assertNotNull("HAPartition has lookupDRMNodeNames", mgdop);
result = mgdop.invoke(hajndiparams);
assertTrue(result instanceof CollectionValue);
elements = ((CollectionValue) result).getElements();
assertNotNull(elements);
assertEquals(2, elements.length);
mgdop = operations.get("isDRMMasterForService");
assertNotNull("HAPartition has isDRMMasterForService", mgdop);
result = mgdop.invoke(hajndiparams);
assertTrue(result instanceof SimpleValue);
val = ((SimpleValue) result).getValue();
assertTrue(val instanceof Boolean);
mgdop = operations.get("create");
assertNotNull("HAPartition has create", mgdop);
mgdop = operations.get("start");
assertNotNull("HAPartition has start", mgdop);
mgdop = operations.get("stop");
assertNotNull("HAPartition has stop", mgdop);
mgdop = operations.get("destroy");
assertNotNull("HAPartition has destroy", mgdop);
assertEquals("Correct number of operations", 12, operations.size());
for (Map.Entry<String, ManagedProperty> entry : mc.getProperties().entrySet())
{
getLog().debug(entry.getKey() + " == " + entry.getValue());
ManagedObject mo = entry.getValue().getTargetManagedObject();
if (mo != null)
{
getLog().debug(entry.getKey() + " -- ManagedObject == " + mo);
}
}
ManagedProperty prop = mc.getProperty("stateString");
assertNotNull("HAPartition has property stateString", prop);
MetaValue metaVal = prop.getValue();
assertTrue(metaVal instanceof SimpleValue);
val = ((SimpleValue) metaVal).getValue();
assertNotNull(val);
assertTrue(val instanceof String);