Search in sources :

Example 56 with TaskType

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

the class Main method main.

/**
	 * @param args
	 */
public static void main(String[] args) {
    try {
        ModelPortType modelPort = createModelPort(args);
        SystemConfigurationType configurationType = getConfiguration(modelPort);
        System.out.println("Got system configuration");
        //			System.out.println(configurationType);
        UserType userAdministrator = searchUserByName(modelPort, "administrator");
        System.out.println("Got administrator user: " + userAdministrator.getOid());
        //			System.out.println(userAdministrator);
        RoleType sailorRole = searchRoleByName(modelPort, "Sailor");
        System.out.println("Got Sailor role");
        //			System.out.println(sailorRole);
        Collection<ResourceType> resources = listResources(modelPort);
        System.out.println("Resources (" + resources.size() + ")");
        //			dump(resources);
        Collection<UserType> users = listUsers(modelPort);
        System.out.println("Users (" + users.size() + ")");
        //            dump(users);
        Collection<TaskType> tasks = listTasks(modelPort);
        System.out.println("Tasks (" + tasks.size() + ")");
        //            dump(tasks);
        //            System.out.println("Next scheduled times: ");
        //            for (TaskType taskType : tasks) {
        //                System.out.println(" - " + getOrig(taskType.getName()) + ": " + taskType.getNextRunStartTimestamp());
        //            }
        String userGuybrushoid = createUserGuybrush(modelPort, sailorRole);
        System.out.println("Created user guybrush, OID: " + userGuybrushoid);
        UserType userGuybrush = getUser(modelPort, userGuybrushoid);
        System.out.println("Fetched user guybrush:");
        //			System.out.println(userGuybrush);
        System.out.println("Users fullName: " + ModelClientUtil.getOrig(userGuybrush.getFullName()));
        String userLeChuckOid = createUserFromSystemResource(modelPort, "user-lechuck.xml");
        System.out.println("Created user lechuck, OID: " + userLeChuckOid);
        changeUserPassword(modelPort, userGuybrushoid, "MIGHTYpirate");
        System.out.println("Changed user password");
        changeUserGivenName(modelPort, userLeChuckOid, "CHUCK");
        System.out.println("Changed user given name");
        assignRoles(modelPort, userGuybrushoid, ROLE_PIRATE_OID, ROLE_CAPTAIN_OID);
        System.out.println("Assigned roles");
        unAssignRoles(modelPort, userGuybrushoid, ROLE_CAPTAIN_OID);
        System.out.println("Unassigned roles");
        Collection<RoleType> roles = listRequestableRoles(modelPort);
        System.out.println("Found " + roles.size() + " requestable roles");
        //			System.out.println(roles);
        String seaSuperuserRole = createRoleFromSystemResource(modelPort, "role-sea-superuser.xml");
        System.out.println("Created role Sea Superuser, OID: " + seaSuperuserRole);
        assignRoles(modelPort, userLeChuckOid, seaSuperuserRole);
        System.out.println("Assigned role Sea Superuser to LeChuck");
        modifyRoleModifyInducement(modelPort, seaSuperuserRole);
        System.out.println("Modified role Sea Superuser - modified resource inducement");
        modifyRoleReplaceInducement(modelPort, seaSuperuserRole, 2, ROLE_CAPTAIN_OID);
        System.out.println("Modified role Sea Superuser - changed role inducement");
        reconcileUser(modelPort, userLeChuckOid);
        System.out.println("LeChuck reconciled.");
        // Uncomment the following lines if you want to see what midPoint really did
        // ... because deleting the user will delete also all the traces (except logs and audit of course).
        deleteUser(modelPort, userGuybrushoid);
        deleteUser(modelPort, userLeChuckOid);
        deleteRole(modelPort, seaSuperuserRole);
        System.out.println("Deleted user(s)");
    } catch (Exception e) {
        e.printStackTrace();
        System.exit(-1);
    }
}
Also used : ModelPortType(com.evolveum.midpoint.xml.ns._public.model.model_3.ModelPortType) RoleType(com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) SystemConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) JAXBException(javax.xml.bind.JAXBException) FileNotFoundException(java.io.FileNotFoundException) SAXException(org.xml.sax.SAXException) IOException(java.io.IOException)

Example 57 with TaskType

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

the class AbstractLdapSynchronizationTest method test820ImportSyncTaskInetOrgPerson.

@Test
public void test820ImportSyncTaskInetOrgPerson() throws Exception {
    final String TEST_NAME = "test820ImportSyncTaskInetOrgPerson";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    long tsStart = System.currentTimeMillis();
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    addObject(getSyncTaskInetOrgPersonFile(), task, result);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    waitForTaskNextRunAssertSuccess(getSyncTaskOid(), true);
    long tsEnd = System.currentTimeMillis();
    PrismObject<TaskType> syncTask = getTask(getSyncTaskOid());
    display("Sync task after start", syncTask);
    assertStepSyncToken(getSyncTaskOid(), 5, tsStart, tsEnd);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test) AbstractModelIntegrationTest(com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)

Example 58 with TaskType

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

the class TestSanity method test440ReconcileResourceOpenDj.

@Test
public void test440ReconcileResourceOpenDj() throws Exception {
    final String TEST_NAME = "test440ReconcileResourceOpenDj";
    TestUtil.displayTestTile(TEST_NAME);
    // GIVEN
    final OperationResult result = new OperationResult(TestSanity.class.getName() + "." + TEST_NAME);
    // Create LDAP account without an owner. The liveSync is off, so it will not be picked up
    Entry ldifEntry = openDJController.addEntryFromLdifFile(LDIF_ELAINE_FILENAME);
    display("Entry from LDIF", ldifEntry);
    // Guybrush's attributes were set up by a role in the previous test. Let's mess the up a bit. Recon should sort it out.
    List<RawModification> modifications = new ArrayList<RawModification>();
    // Expect that a correct title will be added to this one
    RawModification titleMod = RawModification.create(ModificationType.REPLACE, "title", "Scurvy earthworm");
    modifications.add(titleMod);
    // Expect that the correct location will replace this one
    RawModification lMod = RawModification.create(ModificationType.REPLACE, "l", "Davie Jones' locker");
    modifications.add(lMod);
    // Expect that this will be untouched
    RawModification poMod = RawModification.create(ModificationType.REPLACE, "postOfficeBox", "X marks the spot");
    modifications.add(poMod);
    ModifyOperation modifyOperation = openDJController.getInternalConnection().processModify(USER_GUYBRUSH_LDAP_DN, modifications);
    if (ResultCode.SUCCESS != modifyOperation.getResultCode()) {
        AssertJUnit.fail("LDAP operation failed: " + modifyOperation.getErrorMessage());
    }
    // TODO: setup more "inconsistent" state
    // Add reconciliation task. This will trigger reconciliation
    repoAddObjectFromFile(TASK_OPENDJ_RECON_FILENAME, result);
    // We need to wait for a sync interval, so the task scanner has a chance
    // to pick up this
    // task
    waitFor("Waiting for task to finish first run", new Checker() {

        public boolean check() throws ObjectNotFoundException, SchemaException {
            Task task = taskManager.getTask(TASK_OPENDJ_RECON_OID, result);
            display("Task while waiting for task manager to pick up the task", task);
            // wait until the task is finished
            return task.getLastRunFinishTimestamp() != null;
        }

        @Override
        public void timeout() {
        // No reaction, the test will fail right after return from this
        }
    }, 180000);
    // Check task status
    Task task = taskManager.getTask(TASK_OPENDJ_RECON_OID, result);
    result.computeStatus();
    display("getTask result", result);
    TestUtil.assertSuccess("getTask has failed", result);
    AssertJUnit.assertNotNull(task);
    display("Task after pickup", task);
    PrismObject<TaskType> o = repositoryService.getObject(TaskType.class, TASK_OPENDJ_RECON_OID, null, result);
    display("Task after pickup in the repository", o.asObjectable());
    // .. it should be running
    AssertJUnit.assertEquals(TaskExecutionStatus.RUNNABLE, task.getExecutionStatus());
    // .. and claimed
    //        AssertJUnit.assertEquals(TaskExclusivityStatus.CLAIMED, task.getExclusivityStatus());
    // .. and last run should not be zero
    assertNotNull("Null last run start in recon task", task.getLastRunStartTimestamp());
    AssertJUnit.assertFalse("Zero last run start in recon task", task.getLastRunStartTimestamp().longValue() == 0);
    assertNotNull("Null last run finish in recon task", task.getLastRunFinishTimestamp());
    AssertJUnit.assertFalse("Zero last run finish in recon task", task.getLastRunFinishTimestamp().longValue() == 0);
    // The progress should be 0, as there were no changes yet
    // [pm] commented out, as progress in recon task is now determined not only using # of changes
    //AssertJUnit.assertEquals(0, task.getProgress());
    // Test for presence of a result. It should be there and it should
    // indicate success
    OperationResult taskResult = task.getResult();
    AssertJUnit.assertNotNull(taskResult);
    // STOP the task. We don't need it any more and we don't want to give it a chance to run more than once
    taskManager.deleteTask(TASK_OPENDJ_RECON_OID, result);
    // CHECK RESULT: account for user guybrush should be still there and unchanged
    // Check if user object was modified in the repo
    OperationResult repoResult = new OperationResult("getObject");
    PrismObject<UserType> uObject = repositoryService.getObject(UserType.class, USER_GUYBRUSH_OID, null, repoResult);
    UserType repoUser = uObject.asObjectable();
    repoResult.computeStatus();
    displayJaxb("User (repository)", repoUser, new QName("user"));
    List<ObjectReferenceType> accountRefs = repoUser.getLinkRef();
    assertEquals("Guybrush has wrong number of accounts", 1, accountRefs.size());
    ObjectReferenceType accountRef = accountRefs.get(0);
    accountShadowOidGuybrushOpendj = accountRef.getOid();
    assertFalse(accountShadowOidGuybrushOpendj.isEmpty());
    // Check if shadow was created in the repo
    repoResult = new OperationResult("getObject");
    PrismObject<ShadowType> repoShadow = repositoryService.getObject(ShadowType.class, accountShadowOidGuybrushOpendj, null, repoResult);
    ShadowType repoShadowType = repoShadow.asObjectable();
    repoResult.computeStatus();
    TestUtil.assertSuccess("getObject has failed", repoResult);
    displayJaxb("Shadow (repository)", repoShadowType, new QName("shadow"));
    assertNotNull(repoShadowType);
    assertEquals(RESOURCE_OPENDJ_OID, repoShadowType.getResourceRef().getOid());
    accountGuybrushOpendjEntryUuuid = checkRepoShadow(repoShadow);
    // check if account was created in LDAP
    Entry entry = openDJController.searchAndAssertByEntryUuid(accountGuybrushOpendjEntryUuuid);
    display("LDAP account", entry);
    OpenDJController.assertAttribute(entry, "uid", "guybrush");
    OpenDJController.assertAttribute(entry, "givenName", "Guybrush");
    OpenDJController.assertAttribute(entry, "sn", "Threepwood");
    OpenDJController.assertAttribute(entry, "cn", "Guybrush Threepwood");
    OpenDJController.assertAttribute(entry, "displayName", "Guybrush Threepwood");
    // The "l" attribute is assigned indirectly through schemaHandling and
    // config object. It is not tolerant, therefore the other value should be gone now
    OpenDJController.assertAttribute(entry, "l", "Deep in the Caribbean");
    // Set by the role
    OpenDJController.assertAttribute(entry, "employeeType", "sailor");
    // "title" is tolerant, so it will retain the original value as well as the one provided by the role
    OpenDJController.assertAttribute(entry, "title", "Scurvy earthworm", "Honorable Captain");
    OpenDJController.assertAttribute(entry, "carLicense", "C4PT41N");
    OpenDJController.assertAttribute(entry, "businessCategory", "cruise");
    // No setting for "postOfficeBox", so the value should be unchanged
    OpenDJController.assertAttribute(entry, "postOfficeBox", "X marks the spot");
    String guybrushPassword = OpenDJController.getAttributeValue(entry, "userPassword");
    assertNotNull("Pasword was not set on create", guybrushPassword);
    //        QueryType query = QueryUtil.createNameQuery(ELAINE_NAME);
    //        ObjectQuery query = ObjectQuery.createObjectQuery(EqualsFilter.createEqual(UserType.class, prismContext, UserType.F_NAME, ELAINE_NAME));
    ObjectQuery query = ObjectQueryUtil.createNameQuery(ELAINE_NAME, prismContext);
    List<PrismObject<UserType>> users = repositoryService.searchObjects(UserType.class, query, null, repoResult);
    assertEquals("Wrong number of Elaines", 1, users.size());
    repoUser = users.get(0).asObjectable();
    repoResult.computeStatus();
    displayJaxb("User Elaine (repository)", repoUser, new QName("user"));
    assertNotNull(repoUser.getOid());
    assertEquals(PrismTestUtil.createPolyStringType(ELAINE_NAME), repoUser.getName());
    PrismAsserts.assertEqualsPolyString("wrong repo givenName", "Elaine", repoUser.getGivenName());
    PrismAsserts.assertEqualsPolyString("wrong repo familyName", "Marley", repoUser.getFamilyName());
    PrismAsserts.assertEqualsPolyString("wrong repo fullName", "Elaine Marley", repoUser.getFullName());
    accountRefs = repoUser.getLinkRef();
    assertEquals("Elaine has wrong number of accounts", 1, accountRefs.size());
    accountRef = accountRefs.get(0);
    String accountShadowOidElaineOpendj = accountRef.getOid();
    assertFalse(accountShadowOidElaineOpendj.isEmpty());
    // Check if shadow was created in the repo
    repoResult = new OperationResult("getObject");
    repoShadow = repositoryService.getObject(ShadowType.class, accountShadowOidElaineOpendj, null, repoResult);
    repoShadowType = repoShadow.asObjectable();
    repoResult.computeStatus();
    TestUtil.assertSuccess("getObject has failed", repoResult);
    displayJaxb("Shadow (repository)", repoShadowType, new QName("shadow"));
    assertNotNull(repoShadowType);
    assertEquals(RESOURCE_OPENDJ_OID, repoShadowType.getResourceRef().getOid());
    String accountElainehOpendjEntryUuuid = checkRepoShadow(repoShadow);
    // check if account is still in LDAP
    entry = openDJController.searchAndAssertByEntryUuid(accountElainehOpendjEntryUuuid);
    display("LDAP account", entry);
    OpenDJController.assertAttribute(entry, "uid", ELAINE_NAME);
    OpenDJController.assertAttribute(entry, "givenName", "Elaine");
    OpenDJController.assertAttribute(entry, "sn", "Marley");
    OpenDJController.assertAttribute(entry, "cn", "Elaine Marley");
    OpenDJController.assertAttribute(entry, "displayName", "Elaine Marley");
    // The "l" attribute is assigned indirectly through schemaHandling and
    // config object
    // FIXME
    //OpenDJController.assertAttribute(entry, "l", "middle of nowhere");
    // Set by the role
    OpenDJController.assertAttribute(entry, "employeeType", "governor");
    OpenDJController.assertAttribute(entry, "title", "Governor");
    OpenDJController.assertAttribute(entry, "businessCategory", "state");
    String elainePassword = OpenDJController.getAttributeValue(entry, "userPassword");
    assertNotNull("Password of Elaine has disappeared", elainePassword);
    checkAllShadows();
}
Also used : Task(com.evolveum.midpoint.task.api.Task) ArrayList(java.util.ArrayList) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PrismAsserts.assertEqualsPolyString(com.evolveum.midpoint.prism.util.PrismAsserts.assertEqualsPolyString) ChangeRecordEntry(org.opends.server.util.ChangeRecordEntry) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) Checker(com.evolveum.midpoint.test.Checker) ObjectChecker(com.evolveum.midpoint.test.ObjectChecker) QName(javax.xml.namespace.QName) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) ModifyOperation(org.opends.server.core.ModifyOperation) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test) AbstractModelIntegrationTest(com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)

Example 59 with TaskType

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

the class TestSanityLegacy method test500NotifyChangeCreateAccount.

@Test
public void test500NotifyChangeCreateAccount() throws Exception {
    //    	try{
    TestUtil.displayTestTile("test500NotifyChangeCreateAccount");
    Entry ldifEntry = openDJController.addEntryFromLdifFile(LDIF_ANGELIKA_FILENAME);
    display("Entry from LDIF", ldifEntry);
    List<Attribute> attributes = ldifEntry.getAttributes();
    //        for (Attribute a : attributes){
    //        	display("attr anem : ", a.getAttributeType().toString());
    //        }
    List<Attribute> attrs = ldifEntry.getAttribute("entryUUID");
    AttributeValue val = null;
    if (attrs == null) {
        for (Attribute a : attributes) {
            if (a.getName().equals("entryUUID")) {
                val = a.iterator().next();
            }
        }
    } else {
        val = attrs.get(0).iterator().next();
    }
    String icfUid = val.toString();
    ShadowType anglicaAccount = parseObjectType(new File(ACCOUNT_ANGELIKA_FILENAME), ShadowType.class);
    PrismProperty prop = anglicaAccount.asPrismObject().findOrCreateProperty(new ItemPath(ShadowType.F_ATTRIBUTES, SchemaConstants.ICFS_UID));
    prop.setValue(new PrismPropertyValue(icfUid));
    anglicaAccount.setResourceRef(ObjectTypeUtil.createObjectRef(RESOURCE_OPENDJ_OID, ObjectTypes.RESOURCE));
    OperationResult parentResult = new OperationResult("test500notifyChange.addAngelicaAccount");
    //    	repositoryService.addObject(anglicaAccount.asPrismObject(), null, parentResult);
    display("Angelica shdow: ", anglicaAccount.asPrismObject().debugDump());
    //    	provisioningService.applyDefinition(anglicaAccount.asPrismObject(), parentResult);
    ResourceObjectShadowChangeDescriptionType changeDescription = new ResourceObjectShadowChangeDescriptionType();
    ObjectDeltaType delta = new ObjectDeltaType();
    delta.setChangeType(ChangeTypeType.ADD);
    //    	ObjectToAdd objToAdd = new ObjectToAdd();
    //    	objToAdd.setAny(anglicaAccount);
    delta.setObjectToAdd(anglicaAccount);
    delta.setObjectType(ShadowType.COMPLEX_TYPE);
    //    	delta.setOid(anglicaAccount.getOid());
    changeDescription.setObjectDelta(delta);
    changeDescription.setChannel(SchemaConstants.CHANNEL_WEB_SERVICE_URI);
    TaskType task = modelWeb.notifyChange(changeDescription);
    OperationResult result = OperationResult.createOperationResult(task.getResult());
    display(result);
    assertSuccess(result);
    PrismObject<UserType> userAngelika = findUserByUsername(ANGELIKA_NAME);
    assertNotNull("User with the name angelika must exist.", userAngelika);
    UserType user = userAngelika.asObjectable();
    assertNotNull("User with the name angelika must have one link ref.", user.getLinkRef());
    assertEquals("Expected one account ref in user", 1, user.getLinkRef().size());
    String oid = user.getLinkRef().get(0).getOid();
    ShadowType modelShadow = modelService.getObject(ShadowType.class, oid, null, taskManager.createTaskInstance(), result).asObjectable();
    assertAttributeNotNull(modelShadow, SchemaConstants.ICFS_UID);
    assertAttribute(resourceTypeOpenDjrepo, modelShadow, "uid", "angelika");
    assertAttribute(resourceTypeOpenDjrepo, modelShadow, "givenName", "Angelika");
    assertAttribute(resourceTypeOpenDjrepo, modelShadow, "sn", "Marley");
    assertAttribute(resourceTypeOpenDjrepo, modelShadow, "cn", "Angelika Marley");
//        assertAttribute(modelShadow, resourceTypeOpenDjrepo, "displayName", "Jack Sparrow");
//        assertAttribute(modelShadow, resourceTypeOpenDjrepo, "l", "middle of nowhere");
//    	} catch (Exception ex){
//    		display("exception: ", ex);
//    		throw ex;
//    	}
}
Also used : IntegrationTestTools.getAttributeValue(com.evolveum.midpoint.test.IntegrationTestTools.getAttributeValue) IntegrationTestTools.assertAttribute(com.evolveum.midpoint.test.IntegrationTestTools.assertAttribute) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PrismAsserts.assertEqualsPolyString(com.evolveum.midpoint.prism.util.PrismAsserts.assertEqualsPolyString) ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) ChangeRecordEntry(org.opends.server.util.ChangeRecordEntry) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) ResourceObjectShadowChangeDescriptionType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceObjectShadowChangeDescriptionType) File(java.io.File) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) Test(org.testng.annotations.Test) AbstractModelIntegrationTest(com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)

Example 60 with TaskType

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

the class TestSanity method test503NotifyChangeDeleteAccount.

@Test
public void test503NotifyChangeDeleteAccount() throws Exception {
    final String TEST_NAME = "test503NotifyChangeDeleteAccount";
    TestUtil.displayTestTile(TEST_NAME);
    PrismObject<UserType> userAngelika = findUserByUsername(ANGELIKA_NAME);
    assertNotNull("User with the name angelika must exist.", userAngelika);
    UserType user = userAngelika.asObjectable();
    assertNotNull("User with the name angelika must have one link ref.", user.getLinkRef());
    assertEquals("Expected one account ref in user", 1, user.getLinkRef().size());
    String oid = user.getLinkRef().get(0).getOid();
    ResourceObjectShadowChangeDescriptionType changeDescription = new ResourceObjectShadowChangeDescriptionType();
    ObjectDeltaType delta = new ObjectDeltaType();
    delta.setChangeType(ChangeTypeType.DELETE);
    delta.setObjectType(ShadowType.COMPLEX_TYPE);
    delta.setOid(oid);
    changeDescription.setObjectDelta(delta);
    changeDescription.setOldShadowOid(oid);
    changeDescription.setChannel(SchemaConstants.CHANNEL_WEB_SERVICE_URI);
    // WHEN
    TaskType task = modelWeb.notifyChange(changeDescription);
    // THEN
    OperationResult result = OperationResult.createOperationResult(task.getResult());
    display(result);
    assertTrue(result.isAcceptable());
    PrismObject<UserType> userAngelikaAfterSync = findUserByUsername(ANGELIKA_NAME);
    display("User after", userAngelikaAfterSync);
    assertNotNull("User with the name angelika must exist.", userAngelikaAfterSync);
    UserType userType = userAngelikaAfterSync.asObjectable();
    assertNotNull("User with the name angelika must have one link ref.", userType.getLinkRef());
    assertEquals("Expected no account ref in user", 0, userType.getLinkRef().size());
}
Also used : ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PrismAsserts.assertEqualsPolyString(com.evolveum.midpoint.prism.util.PrismAsserts.assertEqualsPolyString) ResourceObjectShadowChangeDescriptionType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceObjectShadowChangeDescriptionType) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test) AbstractModelIntegrationTest(com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)

Aggregations

TaskType (com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType)88 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)63 Test (org.testng.annotations.Test)50 Task (com.evolveum.midpoint.task.api.Task)47 PrismObject (com.evolveum.midpoint.prism.PrismObject)30 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)25 OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)23 AbstractModelIntegrationTest (com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)19 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)18 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)17 PrismAsserts.assertEqualsPolyString (com.evolveum.midpoint.prism.util.PrismAsserts.assertEqualsPolyString)16 AbstractInitializedModelIntegrationTest (com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)15 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)15 ArrayList (java.util.ArrayList)14 QName (javax.xml.namespace.QName)13 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)11 ObjectDeltaType (com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType)10 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)8 Checker (com.evolveum.midpoint.test.Checker)8 ObjectChecker (com.evolveum.midpoint.test.ObjectChecker)8