Search in sources :

Example 26 with ObjectType

use of org.mitre.cybox.cybox_2.ObjectType in project midpoint by Evolveum.

the class AbstractTestForExchangeConnector method getConfiguration.

protected SystemConfigurationType getConfiguration() throws FaultMessage {
    Holder<ObjectType> objectHolder = new Holder<ObjectType>();
    Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();
    SelectorQualifiedGetOptionsType options = new SelectorQualifiedGetOptionsType();
    modelPort.getObject(ModelClientUtil.getTypeQName(SystemConfigurationType.class), SystemObjectsType.SYSTEM_CONFIGURATION.value(), options, objectHolder, resultHolder);
    return (SystemConfigurationType) objectHolder.value;
}
Also used : ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) Holder(javax.xml.ws.Holder) SystemConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType) SelectorQualifiedGetOptionsType(com.evolveum.midpoint.xml.ns._public.common.common_3.SelectorQualifiedGetOptionsType)

Example 27 with ObjectType

use of org.mitre.cybox.cybox_2.ObjectType in project midpoint by Evolveum.

the class AbstractAdLdapTest method test390ModifyUserBarbossaRename.

@Test
public void test390ModifyUserBarbossaRename() throws Exception {
    final String TEST_NAME = "test390ModifyUserBarbossaRename";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    ObjectDelta<UserType> objectDelta = createModifyUserReplaceDelta(USER_BARBOSSA_OID, UserType.F_NAME, PrismTestUtil.createPolyString(USER_CPTBARBOSSA_USERNAME));
    objectDelta.addModificationReplaceProperty(UserType.F_FULL_NAME, PrismTestUtil.createPolyString(USER_CPTBARBOSSA_FULL_NAME));
    Collection<ObjectDelta<? extends ObjectType>> deltas = MiscSchemaUtil.createCollection(objectDelta);
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    modelService.executeChanges(deltas, null, task, result);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    Entry entry = assertLdapAccount(USER_CPTBARBOSSA_USERNAME, USER_CPTBARBOSSA_FULL_NAME);
    assertAttribute(entry, "title", "Captain");
    PrismObject<UserType> user = getUser(USER_BARBOSSA_OID);
    String shadowOid = getSingleLinkOid(user);
    assertEquals("Shadows have moved", accountBarbossaOid, shadowOid);
    PrismObject<ShadowType> shadow = getObject(ShadowType.class, shadowOid);
    display("Shadow after rename (model)", shadow);
    PrismObject<ShadowType> repoShadow = repositoryService.getObject(ShadowType.class, shadowOid, null, result);
    display("Shadow after rename (repo)", repoShadow);
    assertNoLdapAccount(USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME);
    assertLdapConnectorInstances(2);
}
Also used : ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) Task(com.evolveum.midpoint.task.api.Task) DefaultEntry(org.apache.directory.api.ldap.model.entry.DefaultEntry) Entry(org.apache.directory.api.ldap.model.entry.Entry) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ObjectDelta(com.evolveum.midpoint.prism.delta.ObjectDelta) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test) AbstractIntegrationTest(com.evolveum.midpoint.test.AbstractIntegrationTest)

Example 28 with ObjectType

use of org.mitre.cybox.cybox_2.ObjectType in project midpoint by Evolveum.

the class AbstractAdLdapMultidomainTest method test690ModifyUserSubmanRename.

@Test
public void test690ModifyUserSubmanRename() throws Exception {
    final String TEST_NAME = "test690ModifyUserSubmanRename";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    ObjectDelta<UserType> objectDelta = createModifyUserReplaceDelta(USER_SUBMAN_OID, UserType.F_NAME, PrismTestUtil.createPolyString(USER_SUBDOG_USERNAME));
    objectDelta.addModificationReplaceProperty(UserType.F_FULL_NAME, PrismTestUtil.createPolyString(USER_SUBDOG_FULL_NAME));
    Collection<ObjectDelta<? extends ObjectType>> deltas = MiscSchemaUtil.createCollection(objectDelta);
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    modelService.executeChanges(deltas, null, task, result);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    Entry entry = assertLdapSubAccount(USER_SUBDOG_USERNAME, USER_SUBDOG_FULL_NAME);
    assertAttribute(entry, "title", "Underdog");
    PrismObject<UserType> user = getUser(USER_SUBMAN_OID);
    String shadowOid = getSingleLinkOid(user);
    assertEquals("Shadows have moved", accountSubmanOid, shadowOid);
    PrismObject<ShadowType> shadow = getObject(ShadowType.class, shadowOid);
    display("Shadow after rename (model)", shadow);
    PrismObject<ShadowType> repoShadow = repositoryService.getObject(ShadowType.class, shadowOid, null, result);
    display("Shadow after rename (repo)", repoShadow);
    assertNoLdapSubAccount(USER_SUBMAN_USERNAME, USER_SUBMAN_FULL_NAME);
//        assertLdapConnectorInstances(2);
}
Also used : ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) Task(com.evolveum.midpoint.task.api.Task) DefaultEntry(org.apache.directory.api.ldap.model.entry.DefaultEntry) Entry(org.apache.directory.api.ldap.model.entry.Entry) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ObjectDelta(com.evolveum.midpoint.prism.delta.ObjectDelta) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test)

Example 29 with ObjectType

use of org.mitre.cybox.cybox_2.ObjectType in project midpoint by Evolveum.

the class TestRetirement method test300RetireUserGorc.

@Test
public void test300RetireUserGorc() throws Exception {
    final String TEST_NAME = "test300RetireUserGorc";
    TestUtil.displayTestTile(this, TEST_NAME);
    Task task = taskManager.createTaskInstance(TestRetirement.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    Collection<ItemDelta<?, ?>> modifications = new ArrayList<>();
    modifications.add(createAssignmentModification(orgCortuvHradOid, OrgType.COMPLEX_TYPE, null, null, null, false));
    modifications.add(createAssignmentModification(ORG_RETIRED_OID, OrgType.COMPLEX_TYPE, null, null, null, true));
    ObjectDelta<UserType> userDelta = ObjectDelta.createModifyDelta(userGorcOid, modifications, UserType.class, prismContext);
    Collection<ObjectDelta<? extends ObjectType>> deltas = MiscSchemaUtil.createCollection(userDelta);
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    modelService.executeChanges(deltas, null, task, result);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    dumpOrgTree();
    dumpLdap();
    PrismObject<UserType> userAfter = getAndAssertRetiredUser(USER_GORC_USERNAME);
    userGorcOid = userAfter.getOid();
}
Also used : Task(com.evolveum.midpoint.task.api.Task) ArrayList(java.util.ArrayList) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ItemDelta(com.evolveum.midpoint.prism.delta.ItemDelta) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) ObjectDelta(com.evolveum.midpoint.prism.delta.ObjectDelta) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test) AbstractIntegrationTest(com.evolveum.midpoint.test.AbstractIntegrationTest)

Example 30 with ObjectType

use of org.mitre.cybox.cybox_2.ObjectType in project midpoint by Evolveum.

the class TestPlentyOfAssignments method test120CheesePreviewChanges.

@Test
public void test120CheesePreviewChanges() throws Exception {
    final String TEST_NAME = "test120CheesePreviewChanges";
    displayTestTile(TEST_NAME);
    Task task = createTask(TEST_NAME);
    OperationResult result = task.getResult();
    PrismObject<UserType> cheeseBefore = prepareCheese();
    display("Cheese before", assignmentSummary(cheeseBefore));
    ObjectDelta<UserType> delta = cheeseBefore.createModifyDelta();
    delta.addModificationReplaceProperty(UserType.F_EMPLOYEE_NUMBER, "123");
    inspector.reset();
    rememberPrismObjectCompareCount();
    rememberRepositoryReadCount();
    long startMillis = System.currentTimeMillis();
    // WHEN
    displayWhen(TEST_NAME);
    ModelContext<ObjectType> modelContext = modelInteractionService.previewChanges(MiscSchemaUtil.createCollection(delta), null, task, result);
    // THEN
    displayThen(TEST_NAME);
    long endMillis = System.currentTimeMillis();
    assertSuccess(result);
    display("Preview cheese in " + (endMillis - startMillis) + "ms (" + ((endMillis - startMillis) / NUMBER_OF_CHEESE_ASSIGNMENTS) + "ms per assignment)");
    PrismObject<UserType> cheeseAfter = getUser(USER_CHEESE_OID);
    display("Cheese after", assignmentSummary(cheeseAfter));
    assertCheeseRoleMembershipRef(cheeseAfter);
    display("Repo reads", InternalMonitor.getRepositoryReadCount());
    display("Object compares", InternalMonitor.getPrismObjectCompareCount());
    display("Inspector", inspector);
    inspector.assertRead(RoleType.class, 1);
    //        assertRepositoryReadCount(4); // may be influenced by tasks
    assertPrismObjectCompareCount(0);
}
Also used : ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test)

Aggregations

ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)371 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)280 Test (org.testng.annotations.Test)261 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)244 Task (com.evolveum.midpoint.task.api.Task)242 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)223 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)153 ArrayList (java.util.ArrayList)119 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)93 OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)56 Holder (javax.xml.ws.Holder)48 AbstractInitializedModelIntegrationTest (com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)34 ReferenceDelta (com.evolveum.midpoint.prism.delta.ReferenceDelta)33 ShadowDiscriminatorObjectDelta (com.evolveum.midpoint.common.refinery.ShadowDiscriminatorObjectDelta)32 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)32 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)31 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)30 SystemConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType)30 PrismObject (com.evolveum.midpoint.prism.PrismObject)29 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)29