use of com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.CreateCapabilityType in project midpoint by Evolveum.
the class AbstractManualResourceTest method test006Capabilities.
@Test
public void test006Capabilities() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = createOperationResult();
// WHEN
ResourceType resource = provisioningService.getObject(ResourceType.class, getResourceOid(), null, task, result).asObjectable();
// THEN
display("Resource from provisioninig", resource);
displayValue("Resource from provisioninig (XML)", PrismTestUtil.serializeObjectToString(resource.asPrismObject(), PrismContext.LANG_XML));
CapabilityCollectionType nativeCapabilities = resource.getCapabilities().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);
}
}
use of com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.CreateCapabilityType in project midpoint by Evolveum.
the class ConnIdCapabilitiesAndSchemaParser method processOperationCapabilities.
/**
* Create capabilities from supported connector operations
*/
private void processOperationCapabilities() {
if (connIdSupportedOperations.contains(SchemaApiOp.class)) {
SchemaCapabilityType capSchema = new SchemaCapabilityType();
capabilities.add(CAPABILITY_OBJECT_FACTORY.createSchema(capSchema));
supportsSchema = true;
} else {
supportsSchema = false;
}
if (connIdSupportedOperations.contains(SyncApiOp.class)) {
LiveSyncCapabilityType capSync = new LiveSyncCapabilityType();
capabilities.add(CAPABILITY_OBJECT_FACTORY.createLiveSync(capSync));
}
if (connIdSupportedOperations.contains(TestApiOp.class)) {
TestConnectionCapabilityType capTest = new TestConnectionCapabilityType();
capabilities.add(CAPABILITY_OBJECT_FACTORY.createTestConnection(capTest));
}
if (connIdSupportedOperations.contains(CreateApiOp.class)) {
CreateCapabilityType capCreate = new CreateCapabilityType();
capabilities.add(CAPABILITY_OBJECT_FACTORY.createCreate(capCreate));
}
if (connIdSupportedOperations.contains(UpdateDeltaApiOp.class)) {
UpdateCapabilityType capUpdate = new UpdateCapabilityType();
capUpdate.setDelta(true);
// This is the default for all resources.
// (Currently there is no way how to obtain it from the connector.)
// It can be disabled manually.
capUpdate.setAddRemoveAttributeValues(true);
capabilities.add(CAPABILITY_OBJECT_FACTORY.createUpdate(capUpdate));
} else if (connIdSupportedOperations.contains(UpdateApiOp.class)) {
UpdateCapabilityType capUpdate = new UpdateCapabilityType();
// This is the default for all resources.
// (Currently there is no way how to obtain it from the connector.)
// It can be disabled manually.
capUpdate.setAddRemoveAttributeValues(true);
capabilities.add(CAPABILITY_OBJECT_FACTORY.createUpdate(capUpdate));
}
if (connIdSupportedOperations.contains(DeleteApiOp.class)) {
DeleteCapabilityType capDelete = new DeleteCapabilityType();
capabilities.add(CAPABILITY_OBJECT_FACTORY.createDelete(capDelete));
}
if (connIdSupportedOperations.contains(ScriptOnResourceApiOp.class) || connIdSupportedOperations.contains(ScriptOnConnectorApiOp.class)) {
ScriptCapabilityType capScript = new ScriptCapabilityType();
if (connIdSupportedOperations.contains(ScriptOnResourceApiOp.class)) {
Host host = new Host();
host.setType(ProvisioningScriptHostType.RESOURCE);
capScript.getHost().add(host);
// language is unknown here
}
if (connIdSupportedOperations.contains(ScriptOnConnectorApiOp.class)) {
Host host = new Host();
host.setType(ProvisioningScriptHostType.CONNECTOR);
capScript.getHost().add(host);
// language is unknown here
}
capabilities.add(CAPABILITY_OBJECT_FACTORY.createScript(capScript));
}
}
Aggregations