Search in sources :

Example 11 with XmlSchemaType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.XmlSchemaType in project midpoint by Evolveum.

the class TestDummyLegacy method test203LegacyTestResource.

@Test
public void test203LegacyTestResource() throws Exception {
    // GIVEN
    Task task = getTestTask();
    OperationResult result = task.getResult();
    // Check that there is no schema before test (pre-condition)
    ResourceType resourceBefore = repositoryService.getObject(ResourceType.class, RESOURCE_DUMMY_LEGACY_OID, null, result).asObjectable();
    assertNotNull("No connector ref", resourceBefore.getConnectorRef());
    assertNotNull("No connector ref OID", resourceBefore.getConnectorRef().getOid());
    ConnectorType connector = repositoryService.getObject(ConnectorType.class, resourceBefore.getConnectorRef().getOid(), null, result).asObjectable();
    assertNotNull(connector);
    XmlSchemaType xmlSchemaTypeBefore = resourceBefore.getSchema();
    Element resourceXsdSchemaElementBefore = ResourceTypeUtil.getResourceXsdSchema(resourceBefore);
    AssertJUnit.assertNull("Found schema before test connection. Bad test setup?", resourceXsdSchemaElementBefore);
    // WHEN
    OperationResult testResult = provisioningService.testResource(RESOURCE_DUMMY_LEGACY_OID, task);
    // THEN
    display("Test result", testResult);
    OperationResult connectorResult = assertSingleConnectorTestResult(testResult);
    assertTestResourceSuccess(connectorResult, ConnectorTestOperation.CONNECTOR_INITIALIZATION);
    assertTestResourceSuccess(connectorResult, ConnectorTestOperation.CONNECTOR_CONFIGURATION);
    assertTestResourceSuccess(connectorResult, ConnectorTestOperation.CONNECTOR_CONNECTION);
    assertTestResourceSuccess(connectorResult, ConnectorTestOperation.CONNECTOR_CAPABILITIES);
    assertSuccess(connectorResult);
    assertTestResourceSuccess(testResult, ConnectorTestOperation.RESOURCE_SCHEMA);
    assertSuccess(testResult);
    PrismObject<ResourceType> resourceRepoAfter = repositoryService.getObject(ResourceType.class, RESOURCE_DUMMY_LEGACY_OID, null, result);
    ResourceType resourceTypeRepoAfter = resourceRepoAfter.asObjectable();
    display("Resource after test", resourceTypeRepoAfter);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) ConnectorType(com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorType) Element(org.w3c.dom.Element) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType) XmlSchemaType(com.evolveum.midpoint.xml.ns._public.common.common_3.XmlSchemaType) AbstractIntegrationTest(com.evolveum.midpoint.test.AbstractIntegrationTest) Test(org.testng.annotations.Test)

Example 12 with XmlSchemaType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.XmlSchemaType in project midpoint by Evolveum.

the class ResourceCarefulAntUtil method createNewXmlSchemaDef.

private static SchemaDefinitionType createNewXmlSchemaDef(File resourceFile, int iteration, PrismContext prismContext) throws SchemaException {
    PrismObject<ResourceType> resource = parseResource(resourceFile, prismContext);
    XmlSchemaType schema = resource.asObjectable().getSchema();
    SchemaDefinitionType def;
    if (schema == null) {
        def = new SchemaDefinitionType();
        def.getAny().add(DOMUtil.createElement(DOMUtil.XSD_SCHEMA_ELEMENT));
    } else {
        def = schema.getDefinition();
    // TODO: modify it somehow
    }
    return def;
}
Also used : SchemaDefinitionType(com.evolveum.prism.xml.ns._public.types_3.SchemaDefinitionType) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType) XmlSchemaType(com.evolveum.midpoint.xml.ns._public.common.common_3.XmlSchemaType)

Example 13 with XmlSchemaType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.XmlSchemaType in project midpoint by Evolveum.

the class UcfUtil method getConnectorSchema.

public static PrismSchema getConnectorSchema(ConnectorType connectorType, PrismContext prismContext) throws SchemaException {
    XmlSchemaType xmlSchema = connectorType.getSchema();
    if (xmlSchema == null) {
        return null;
    }
    Element xsdElement = ObjectTypeUtil.findXsdElement(xmlSchema);
    if (xsdElement == null) {
        return null;
    }
    MutablePrismSchema connectorSchema = prismContext.schemaFactory().createPrismSchema(DOMUtil.getSchemaTargetNamespace(xsdElement));
    connectorSchema.parseThis(xsdElement, true, connectorType.toString(), prismContext);
    return connectorSchema;
}
Also used : Element(org.w3c.dom.Element) MutablePrismSchema(com.evolveum.midpoint.prism.schema.MutablePrismSchema) XmlSchemaType(com.evolveum.midpoint.xml.ns._public.common.common_3.XmlSchemaType)

Aggregations

XmlSchemaType (com.evolveum.midpoint.xml.ns._public.common.common_3.XmlSchemaType)12 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)10 Element (org.w3c.dom.Element)10 Test (org.testng.annotations.Test)6 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)4 Task (com.evolveum.midpoint.task.api.Task)4 ResourceSchema (com.evolveum.midpoint.schema.processor.ResourceSchema)3 AbstractIntegrationTest (com.evolveum.midpoint.test.AbstractIntegrationTest)3 CachingMetadataType (com.evolveum.midpoint.xml.ns._public.common.common_3.CachingMetadataType)3 ConnectorType (com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorType)3 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)2 AbstractSchemaTest (com.evolveum.midpoint.schema.AbstractSchemaTest)2 SchemaDefinitionType (com.evolveum.prism.xml.ns._public.types_3.SchemaDefinitionType)2 QName (javax.xml.namespace.QName)2 Document (org.w3c.dom.Document)2 RefinedResourceSchema (com.evolveum.midpoint.common.refinery.RefinedResourceSchema)1 AbstractConfiguredModelIntegrationTest (com.evolveum.midpoint.model.intest.AbstractConfiguredModelIntegrationTest)1 ComplexTypeDefinition (com.evolveum.midpoint.prism.ComplexTypeDefinition)1 ItemDelta (com.evolveum.midpoint.prism.delta.ItemDelta)1 VariableItemPathSegment (com.evolveum.midpoint.prism.path.VariableItemPathSegment)1