use of com.evolveum.midpoint.xml.ns._public.common.common_3.CapabilitiesType in project midpoint by Evolveum.
the class AbstractManualResourceTest method testCapabilities.
public void testCapabilities() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = getTestOperationResult();
// WHEN
ResourceType resource = modelService.getObject(ResourceType.class, getResourceOid(), null, task, result).asObjectable();
// THEN
display("Resource from model", resource);
displayValue("Resource from model (XML)", PrismTestUtil.serializeObjectToString(resource.asPrismObject(), PrismContext.LANG_XML));
assertSteadyResources();
CapabilitiesType capabilities = resource.getCapabilities();
assertNotNull("Missing capability caching metadata", capabilities.getCachingMetadata());
CapabilityCollectionType nativeCapabilities = capabilities.getNative();
List<Object> nativeCapabilitiesList = nativeCapabilities.getAny();
assertFalse("Empty capabilities returned", nativeCapabilitiesList.isEmpty());
CreateCapabilityType capCreate = CapabilityUtil.getCapability(nativeCapabilitiesList, CreateCapabilityType.class);
assertNotNull("Missing create capability", capCreate);
assertManual(capCreate);
ActivationCapabilityType capAct = CapabilityUtil.getCapability(nativeCapabilitiesList, ActivationCapabilityType.class);
assertNotNull("Missing activation capability", capAct);
ReadCapabilityType capRead = CapabilityUtil.getCapability(nativeCapabilitiesList, ReadCapabilityType.class);
assertNotNull("Missing read capability", capRead);
assertEquals("Wrong caching-only setting in read capability", Boolean.TRUE, capRead.isCachingOnly());
List<Object> effectiveCapabilities = ResourceTypeUtil.getEffectiveCapabilities(resource);
for (Object capability : effectiveCapabilities) {
System.out.println("Capability: " + CapabilityUtil.getCapabilityDisplayName(capability) + " : " + capability);
}
assertSteadyResources();
}
Aggregations