Search in sources :

Example 6 with CreateCapabilityType

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);
    }
}
Also used : Task(com.evolveum.midpoint.task.api.Task) ReadCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ReadCapabilityType) ActivationCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) CreateCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.CreateCapabilityType) Test(org.testng.annotations.Test) AbstractProvisioningIntegrationTest(com.evolveum.midpoint.provisioning.impl.AbstractProvisioningIntegrationTest)

Example 7 with CreateCapabilityType

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));
    }
}
Also used : UpdateApiOp(org.identityconnectors.framework.api.operations.UpdateApiOp) UpdateCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.UpdateCapabilityType) ScriptCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityType) DeleteCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.DeleteCapabilityType) LiveSyncCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.LiveSyncCapabilityType) SchemaCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.SchemaCapabilityType) ScriptOnConnectorApiOp(org.identityconnectors.framework.api.operations.ScriptOnConnectorApiOp) TestConnectionCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.TestConnectionCapabilityType) ScriptOnResourceApiOp(org.identityconnectors.framework.api.operations.ScriptOnResourceApiOp) Host(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityType.Host) CreateCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.CreateCapabilityType)

Aggregations

CreateCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.CreateCapabilityType)6 ReadCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ReadCapabilityType)5 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)4 ActivationCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType)4 Task (com.evolveum.midpoint.task.api.Task)3 DeleteCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.DeleteCapabilityType)3 Host (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityType.Host)3 UpdateCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.UpdateCapabilityType)3 Test (org.testng.annotations.Test)3 PrismObject (com.evolveum.midpoint.prism.PrismObject)2 LiveSyncCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.LiveSyncCapabilityType)2 SchemaCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.SchemaCapabilityType)2 ScriptCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityType)2 TestConnectionCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.TestConnectionCapabilityType)2 ScriptOnConnectorApiOp (org.identityconnectors.framework.api.operations.ScriptOnConnectorApiOp)2 ScriptOnResourceApiOp (org.identityconnectors.framework.api.operations.ScriptOnResourceApiOp)2 AbstractConfiguredModelIntegrationTest (com.evolveum.midpoint.model.intest.AbstractConfiguredModelIntegrationTest)1 AbstractProvisioningIntegrationTest (com.evolveum.midpoint.provisioning.impl.AbstractProvisioningIntegrationTest)1 CapabilityCollectionType (com.evolveum.midpoint.xml.ns._public.common.common_3.CapabilityCollectionType)1 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)1