Search in sources :

Example 56 with CapabilitiesType

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();
}
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)

Aggregations

CapabilitiesType (net.opengis.cat.csw.v_2_0_2.CapabilitiesType)45 GetCapabilitiesType (net.opengis.cat.csw.v_2_0_2.GetCapabilitiesType)40 Test (org.junit.Test)40 CswException (org.codice.ddf.spatial.ogc.csw.catalog.common.CswException)38 GetCapabilitiesRequest (org.codice.ddf.spatial.ogc.csw.catalog.common.GetCapabilitiesRequest)24 SectionsType (net.opengis.ows.v_1_0_0.SectionsType)12 CapabilitiesType (com.evolveum.midpoint.xml.ns._public.common.common_3.CapabilitiesType)6 ActivationCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType)6 DomainType (net.opengis.ows.v_1_0_0.DomainType)5 Operation (net.opengis.ows.v_1_0_0.Operation)5 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)4 CachingMetadataType (com.evolveum.midpoint.xml.ns._public.common.common_3.CachingMetadataType)4 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)4 ScalarCapabilitiesType (net.opengis.filter.v_1_1_0.ScalarCapabilitiesType)4 Test (org.testng.annotations.Test)4 CapabilityCollectionType (com.evolveum.midpoint.xml.ns._public.common.common_3.CapabilityCollectionType)3 PrismObject (com.evolveum.midpoint.prism.PrismObject)2 ResourceSchema (com.evolveum.midpoint.schema.processor.ResourceSchema)2 Task (com.evolveum.midpoint.task.api.Task)2 Metacard (ddf.catalog.data.Metacard)2