Search in sources :

Example 1 with MConnector

use of com.evolveum.midpoint.repo.sqale.qmodel.connector.MConnector in project midpoint by Evolveum.

the class SqaleRepoAddDeleteObjectTest method test811Connector.

@Test
public void test811Connector() throws Exception {
    OperationResult result = createOperationResult();
    given("connector");
    String objectName = "conn" + getTestNumber();
    UUID connectorHostOid = UUID.randomUUID();
    QName connectorHostRelation = QName.valueOf("{https://random.org/ns}conn-host-rel");
    ConnectorType connector = new ConnectorType(prismContext).name(objectName).connectorBundle("com.connector.package").connectorType("ConnectorTypeClass").connectorVersion("1.2.3").framework(SchemaConstants.UCF_FRAMEWORK_URI_BUILTIN).connectorHostRef(connectorHostOid.toString(), ConnectorHostType.COMPLEX_TYPE, connectorHostRelation).targetSystemType("type1").targetSystemType("type2");
    when("adding it to the repository");
    repositoryService.addObject(connector.asPrismObject(), null, result);
    then("it is stored and relevant attributes are in columns");
    assertThatOperationResult(result).isSuccess();
    MConnector row = selectObjectByOid(QConnector.class, connector.getOid());
    assertThat(row.connectorBundle).isEqualTo("com.connector.package");
    assertThat(row.connectorType).isEqualTo("ConnectorTypeClass");
    assertThat(row.connectorVersion).isEqualTo("1.2.3");
    assertCachedUri(row.frameworkId, SchemaConstants.UCF_FRAMEWORK_URI_BUILTIN);
    assertThat(row.connectorHostRefTargetOid).isEqualTo(connectorHostOid);
    assertThat(row.connectorHostRefTargetType).isEqualTo(MObjectType.CONNECTOR_HOST);
    assertCachedUri(row.connectorHostRefRelationId, connectorHostRelation);
    assertThat(resolveCachedUriIds(row.targetSystemTypes)).containsExactlyInAnyOrder("type1", "type2");
}
Also used : MConnector(com.evolveum.midpoint.repo.sqale.qmodel.connector.MConnector) QName(javax.xml.namespace.QName) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) UUID(java.util.UUID) Test(org.testng.annotations.Test) SqaleRepoBaseTest(com.evolveum.midpoint.repo.sqale.SqaleRepoBaseTest)

Example 2 with MConnector

use of com.evolveum.midpoint.repo.sqale.qmodel.connector.MConnector in project midpoint by Evolveum.

the class SqaleRepoAddDeleteObjectTest method test812ConnectorWithNullConnectorHost.

@Test
public void test812ConnectorWithNullConnectorHost() throws Exception {
    OperationResult result = createOperationResult();
    given("connector with no connector host reference");
    String objectName = "conn" + getTestNumber();
    ConnectorType connector = new ConnectorType(prismContext).name(objectName).connectorBundle("com.connector.package").connectorType("ConnectorTypeClass").connectorVersion("1.2.3").framework(SchemaConstants.UCF_FRAMEWORK_URI_BUILTIN);
    when("adding it to the repository");
    repositoryService.addObject(connector.asPrismObject(), null, result);
    then("it is stored and with null connection host reference");
    assertThatOperationResult(result).isSuccess();
    MConnector row = selectObjectByOid(QConnector.class, connector.getOid());
    assertThat(row.connectorHostRefTargetOid).isNull();
}
Also used : MConnector(com.evolveum.midpoint.repo.sqale.qmodel.connector.MConnector) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) Test(org.testng.annotations.Test) SqaleRepoBaseTest(com.evolveum.midpoint.repo.sqale.SqaleRepoBaseTest)

Aggregations

PolyString (com.evolveum.midpoint.prism.polystring.PolyString)2 SqaleRepoBaseTest (com.evolveum.midpoint.repo.sqale.SqaleRepoBaseTest)2 MConnector (com.evolveum.midpoint.repo.sqale.qmodel.connector.MConnector)2 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 Test (org.testng.annotations.Test)2 UUID (java.util.UUID)1 QName (javax.xml.namespace.QName)1