Search in sources :

Example 41 with ConnectorType

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

the class TestDBTable method test000Integrity.

@Test
public void test000Integrity() throws ObjectNotFoundException, SchemaException {
    OperationResult result = createOperationResult();
    ResourceType resource = repositoryService.getObject(ResourceType.class, RESOURCE_DERBY_OID, null, result).asObjectable();
    String connectorOid = resource.getConnectorRef().getOid();
    ConnectorType connector = repositoryService.getObject(ConnectorType.class, connectorOid, null, result).asObjectable();
    assertNotNull(connector);
    display("DB Connector", connector);
}
Also used : ConnectorType(com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType) AbstractIntegrationTest(com.evolveum.midpoint.test.AbstractIntegrationTest) Test(org.testng.annotations.Test)

Example 42 with ConnectorType

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

the class TestDummyFoundAgain method test101AddAccountWithoutName.

@Test
public void test101AddAccountWithoutName() throws Exception {
    // GIVEN
    Task syncTask = getTestTask();
    OperationResult result = syncTask.getResult();
    syncServiceMock.reset();
    List<PrismObject<ConnectorType>> connectors = repositoryService.searchObjects(ConnectorType.class, null, null, result);
    assertNotNull(connectors);
    // lets take first connector
    PrismObject<ConnectorType> toBeFoundAgain = connectors.get(0);
    connectorManager.invalidate(ConnectorType.class, toBeFoundAgain.getOid(), null);
    repositoryService.deleteObject(ConnectorType.class, toBeFoundAgain.getOid(), result);
    Holder<ConnectorType> discovered = new Holder<>();
    // Consumer is called after initial inRepo check, we add connector again
    // so add should fail.
    connectorManager.setNotFoundInRepoConsumer(c -> {
        discovered.setValue(c);
        try {
            repositoryService.addObject(toBeFoundAgain, null, result);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    });
    provisioningService.discoverConnectors(null, result);
    assertNotNull(discovered.getValue());
    assertEquals(discovered.getValue().getConnectorType(), toBeFoundAgain.asObjectable().getConnectorType());
    List<PrismObject<ConnectorType>> connectorsAfter = repositoryService.searchObjects(ConnectorType.class, null, null, result);
    assertEquals(connectorsAfter.size(), connectors.size());
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) Task(com.evolveum.midpoint.task.api.Task) ConnectorType(com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorType) Holder(com.evolveum.midpoint.util.Holder) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) AbstractBasicDummyTest(com.evolveum.midpoint.provisioning.impl.dummy.AbstractBasicDummyTest) Test(org.testng.annotations.Test)

Example 43 with ConnectorType

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

the class ConnIdNameMapper method objectClassToConnId.

@Nullable
ObjectClass objectClassToConnId(PrismObject<? extends ShadowType> shadow, ConnectorType connectorBean, boolean legacySchema) {
    ShadowType shadowBean = shadow.asObjectable();
    QName objectClassName = shadowBean.getObjectClass();
    if (objectClassName == null) {
        ResourceAttributeContainer attrContainer = ShadowUtil.getAttributesContainer(shadowBean);
        if (attrContainer == null) {
            return null;
        }
        ResourceAttributeContainerDefinition objectClassDefinition = attrContainer.getDefinition();
        objectClassName = objectClassDefinition.getTypeName();
    }
    return objectClassToConnId(objectClassName, connectorBean, legacySchema);
}
Also used : ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) QName(javax.xml.namespace.QName) Nullable(org.jetbrains.annotations.Nullable)

Example 44 with ConnectorType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorType 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)

Example 45 with ConnectorType

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

the class ConnectorFactoryConnIdImpl method listRemoteConnectors.

private Set<ConnectorType> listRemoteConnectors(ConnectorHostType host) {
    ConnectorInfoManager remoteConnectorInfoManager = getRemoteConnectorInfoManager(host);
    Set<ConnectorType> connectorTypes = new HashSet<>();
    List<ConnectorInfo> connectorInfos = remoteConnectorInfoManager.getConnectorInfos();
    for (ConnectorInfo connectorInfo : connectorInfos) {
        try {
            ConnectorType connectorType = convertToConnectorType(connectorInfo, host);
            connectorTypes.add(connectorType);
        } catch (SchemaException e) {
            LOGGER.error("Schema error while initializing ConnId connector {}: {}", getConnectorDesc(connectorInfo), e.getMessage(), e);
        }
    }
    return connectorTypes;
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) ConnectorType(com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorType)

Aggregations

ConnectorType (com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorType)39 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)21 Test (org.testng.annotations.Test)17 PrismObject (com.evolveum.midpoint.prism.PrismObject)13 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)13 Task (com.evolveum.midpoint.task.api.Task)12 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)12 PrismSchema (com.evolveum.midpoint.prism.schema.PrismSchema)8 AbstractIntegrationTest (com.evolveum.midpoint.test.AbstractIntegrationTest)8 SystemException (com.evolveum.midpoint.util.exception.SystemException)8 QName (javax.xml.namespace.QName)7 CommunicationException (com.evolveum.midpoint.util.exception.CommunicationException)6 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)6 AbstractModelIntegrationTest (com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)4 SchemaRegistry (com.evolveum.midpoint.prism.schema.SchemaRegistry)4 ConnectorConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorConfigurationType)4 ConnectorHostType (com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorHostType)4 XmlSchemaType (com.evolveum.midpoint.xml.ns._public.common.common_3.XmlSchemaType)4 Element (org.w3c.dom.Element)4 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)3