Search in sources :

Example 16 with FaultMessage

use of com.evolveum.midpoint.xml.ns._public.common.fault_3.FaultMessage in project midpoint by Evolveum.

the class TestSanity method deleteObjectViaModelWS.

private OperationResultType deleteObjectViaModelWS(QName typeQName, String oid) throws FaultMessage {
    ObjectDeltaListType deltaList = new ObjectDeltaListType();
    ObjectDeltaType objectDelta = new ObjectDeltaType();
    objectDelta.setOid(oid);
    objectDelta.setObjectType(typeQName);
    objectDelta.setChangeType(ChangeTypeType.DELETE);
    deltaList.getDelta().add(objectDelta);
    ObjectDeltaOperationListType list = modelWeb.executeChanges(deltaList, null);
    return getOdoFromDeltaOperationList(list, objectDelta).getExecutionResult();
}
Also used : ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) ObjectDeltaOperationListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType) ObjectDeltaListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType)

Example 17 with FaultMessage

use of com.evolveum.midpoint.xml.ns._public.common.fault_3.FaultMessage in project midpoint by Evolveum.

the class TestSanity method test041DeleteDerbyAccount.

/**
     * Delete the shadow which will cause deletion of associated account.
     * The account was unlinked in the previous test, therefore no operation with user is needed.
     */
@Test
public void test041DeleteDerbyAccount() throws FileNotFoundException, JAXBException, FaultMessage, ObjectNotFoundException, SchemaException, DirectoryException, SQLException {
    TestUtil.displayTestTile("test041DeleteDerbyAccount");
    // GIVEN
    assertNoRepoCache();
    // WHEN
    OperationResultType result = deleteObjectViaModelWS(ObjectTypes.SHADOW.getTypeQName(), accountShadowOidDerby);
    // THEN
    assertNoRepoCache();
    displayJaxb("deleteObject result", result, SchemaConstants.C_RESULT);
    TestUtil.assertSuccess("deleteObject has failed", result);
    // Check if shadow was deleted
    OperationResult repoResult = new OperationResult("getObject");
    try {
        repositoryService.getObject(ShadowType.class, accountShadowOidDerby, null, repoResult);
        AssertJUnit.fail("Shadow was not deleted");
    } catch (ObjectNotFoundException ex) {
        display("Caught expected exception from getObject(shadow): " + ex);
    }
    // check if account was deleted in DB Table
    Statement stmt = derbyController.getExecutedStatementWhereLoginName(USER_JACK_DERBY_LOGIN);
    ResultSet rs = stmt.getResultSet();
    System.out.println("RS: " + rs);
    assertFalse("Account was not deleted in database", rs.next());
}
Also used : OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) Statement(java.sql.Statement) ResultSet(java.sql.ResultSet) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test) AbstractModelIntegrationTest(com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)

Example 18 with FaultMessage

use of com.evolveum.midpoint.xml.ns._public.common.fault_3.FaultMessage in project midpoint by Evolveum.

the class AbstractTestForExchangeConnector method createAccountOdo.

protected ObjectDeltaOperationType createAccountOdo(String givenName, String sn, String name, String recipientType, String overrideMail) throws FaultMessage {
    ShadowType shadowType = prepareShadowType(givenName, sn, name, recipientType, overrideMail, null, null, null);
    ObjectDeltaType deltaType = new ObjectDeltaType();
    deltaType.setObjectType(ModelClientUtil.getTypeQName(ShadowType.class));
    deltaType.setChangeType(ChangeTypeType.ADD);
    deltaType.setObjectToAdd(shadowType);
    ObjectDeltaListType deltaListType = new ObjectDeltaListType();
    deltaListType.getDelta().add(deltaType);
    ObjectDeltaOperationListType operationListType = modelPort.executeChanges(deltaListType, null);
    return ModelClientUtil.findInDeltaOperationList(operationListType, deltaType);
}
Also used : ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) ObjectDeltaOperationListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType) ObjectDeltaListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType)

Example 19 with FaultMessage

use of com.evolveum.midpoint.xml.ns._public.common.fault_3.FaultMessage in project midpoint by Evolveum.

the class AbstractTestForExchangeConnector method createDistributionGroup.

protected String createDistributionGroup(String name, String primaryAddress, Collection<String> members, String ou, String displayName, String valueForFilter) throws FaultMessage {
    Document doc = ModelClientUtil.getDocumnent();
    ShadowType shadow = new ShadowType();
    shadow.setName(ModelClientUtil.createPolyStringType(name, doc));
    shadow.setResourceRef(createObjectReferenceType(ResourceType.class, getResourceOid()));
    shadow.setObjectClass(OC_DISTRIBUTION_GROUP);
    shadow.setKind(ShadowKindType.GENERIC);
    shadow.setIntent("distribution-group");
    ShadowAttributesType attributes = new ShadowAttributesType();
    attributes.getAny().add(ModelClientUtil.createTextElement(new QName(NS_ICFS, "name"), name, doc));
    attributes.getAny().add(ModelClientUtil.createTextElement(new QName(NS_RI, "Type"), "Security", doc));
    attributes.getAny().add(ModelClientUtil.createTextElement(new QName(NS_RI, "PrimarySmtpAddress"), primaryAddress, doc));
    for (String member : members) {
        attributes.getAny().add(ModelClientUtil.createTextElement(new QName(NS_RI, "Members"), member, doc));
    }
    attributes.getAny().add(ModelClientUtil.createTextElement(new QName(NS_RI, "OrganizationalUnit"), ou, doc));
    attributes.getAny().add(ModelClientUtil.createTextElement(new QName(NS_RI, "DisplayName"), displayName, doc));
    attributes.getAny().add(ModelClientUtil.createTextElement(new QName(NS_RI, "HiddenFromAddressListsEnabled"), "true", doc));
    attributes.getAny().add(ModelClientUtil.createTextElement(new QName(NS_RI, "CustomAttribute1"), valueForFilter, doc));
    attributes.getAny().add(ModelClientUtil.createTextElement(new QName(NS_RI, "BypassSecurityGroupManagerCheck"), "true", doc));
    shadow.setAttributes(attributes);
    return createShadow(shadow);
}
Also used : ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) QName(javax.xml.namespace.QName) ShadowAttributesType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowAttributesType) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType) Document(org.w3c.dom.Document)

Example 20 with FaultMessage

use of com.evolveum.midpoint.xml.ns._public.common.fault_3.FaultMessage in project midpoint by Evolveum.

the class AbstractTestForExchangeConnector method listUsers.

protected Collection<UserType> listUsers() throws SAXException, IOException, FaultMessage {
    SelectorQualifiedGetOptionsType options = new SelectorQualifiedGetOptionsType();
    Holder<ObjectListType> objectListHolder = new Holder<ObjectListType>();
    Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();
    // let's say we want to get first 3 users, sorted alphabetically by user name
    // holds search query + paging options
    QueryType queryType = new QueryType();
    PagingType pagingType = new PagingType();
    pagingType.setMaxSize(3);
    pagingType.setOrderBy(ModelClientUtil.createItemPathType("name"));
    pagingType.setOrderDirection(OrderDirectionType.ASCENDING);
    queryType.setPaging(pagingType);
    modelPort.searchObjects(ModelClientUtil.getTypeQName(UserType.class), queryType, options, objectListHolder, resultHolder);
    ObjectListType objectList = objectListHolder.value;
    return (Collection) objectList.getObject();
}
Also used : OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) Holder(javax.xml.ws.Holder) PagingType(com.evolveum.prism.xml.ns._public.query_3.PagingType) Collection(java.util.Collection) ObjectListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectListType) QueryType(com.evolveum.prism.xml.ns._public.query_3.QueryType) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) SelectorQualifiedGetOptionsType(com.evolveum.midpoint.xml.ns._public.common.common_3.SelectorQualifiedGetOptionsType)

Aggregations

OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)46 ObjectDeltaType (com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType)36 ObjectDeltaListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType)33 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)32 Holder (javax.xml.ws.Holder)32 SelectorQualifiedGetOptionsType (com.evolveum.midpoint.xml.ns._public.common.common_3.SelectorQualifiedGetOptionsType)25 ObjectDeltaOperationListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType)22 FaultMessage (com.evolveum.midpoint.xml.ns._public.common.fault_3.FaultMessage)22 Test (org.testng.annotations.Test)22 ObjectListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectListType)21 AbstractModelIntegrationTest (com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)17 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)16 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)16 QName (javax.xml.namespace.QName)15 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)13 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)13 Document (org.w3c.dom.Document)13 ModelExecuteOptionsType (com.evolveum.midpoint.xml.ns._public.common.common_3.ModelExecuteOptionsType)10 QueryType (com.evolveum.prism.xml.ns._public.query_3.QueryType)10 ItemDeltaType (com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType)10