Search in sources :

Example 71 with UserType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.UserType 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 72 with UserType

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

the class AbstractAdLdapMultidomainTest method test213ModifyUserBarbossaShowInAdvancedViewOnlyFalse.

/**
	 * Modify USER, test boolean value mapping.
	 */
@Test
public void test213ModifyUserBarbossaShowInAdvancedViewOnlyFalse() throws Exception {
    final String TEST_NAME = "test213ModifyUserBarbossaShowInAdvancedViewOnlyFalse";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    ObjectDelta<ShadowType> delta = ObjectDelta.createEmptyModifyDelta(ShadowType.class, accountBarbossaOid, prismContext);
    QName attrQName = new QName(MidPointConstants.NS_RI, "showInAdvancedViewOnly");
    ResourceAttributeDefinition<String> attrDef = accountObjectClassDefinition.findAttributeDefinition(attrQName);
    PropertyDelta<Boolean> attrDelta = PropertyDelta.createModificationReplaceProperty(new ItemPath(ShadowType.F_ATTRIBUTES, attrQName), attrDef, Boolean.TRUE);
    delta.addModification(attrDelta);
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    modifyUserReplace(USER_BARBOSSA_OID, new ItemPath(UserType.F_EXTENSION, EXTENSION_SHOW_IN_ADVANCED_VIEW_ONLY_QNAME), task, result, Boolean.FALSE);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    Entry entry = assertLdapAccount(USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME);
    assertAttribute(entry, "showInAdvancedViewOnly", "FALSE");
    assertAttribute(entry, ATTRIBUTE_USER_ACCOUNT_CONTROL_NAME, "512");
    PrismObject<UserType> user = getUser(USER_BARBOSSA_OID);
    String shadowOid = getSingleLinkOid(user);
    assertEquals("Shadows have moved", accountBarbossaOid, shadowOid);
//        assertLdapConnectorInstances(2);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) QName(javax.xml.namespace.QName) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) DefaultEntry(org.apache.directory.api.ldap.model.entry.DefaultEntry) Entry(org.apache.directory.api.ldap.model.entry.Entry) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) Test(org.testng.annotations.Test)

Example 73 with UserType

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

the class AbstractAdLdapMultidomainTest method test809UnAssignAccountSubmarine.

@Test
public void test809UnAssignAccountSubmarine() throws Exception {
    final String TEST_NAME = "test809UnAssignAccountSubmarine";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    unassignRole(USER_SUBMARINE_OID, ROLE_SUBMISSIVE_OID, task, result);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    assertNoLdapSubAccount(USER_SUBMARINE_USERNAME, USER_SUBMARINE_FULL_NAME);
    PrismObject<UserType> user = getUser(USER_SUBMARINE_OID);
    assertNoLinkedAccount(user);
//        assertLdapConnectorInstances(2);
}
Also used : 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)

Example 74 with UserType

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

the class AbstractAdLdapMultidomainTest method test399UnAssignAccountBarbossa.

@Test
public void test399UnAssignAccountBarbossa() throws Exception {
    final String TEST_NAME = "test399UnAssignAccountBarbossa";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    unassignAccount(USER_BARBOSSA_OID, getResourceOid(), null, task, result);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    assertNoLdapAccount(USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME);
    assertNoLdapAccount(USER_CPTBARBOSSA_USERNAME, USER_CPTBARBOSSA_FULL_NAME);
    PrismObject<UserType> user = getUser(USER_BARBOSSA_OID);
    assertNoLinkedAccount(user);
//        assertLdapConnectorInstances(2);
}
Also used : 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)

Example 75 with UserType

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

the class AbstractAdLdapMultidomainTest method test220ModifyUserBarbossaPassword.

@Test
public void test220ModifyUserBarbossaPassword() throws Exception {
    final String TEST_NAME = "test220ModifyUserBarbossaPassword";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    ProtectedStringType userPasswordPs = new ProtectedStringType();
    userPasswordPs.setClearValue("here.There.Be.Monsters");
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    modifyUserReplace(USER_BARBOSSA_OID, new ItemPath(UserType.F_CREDENTIALS, CredentialsType.F_PASSWORD, PasswordType.F_VALUE), task, result, userPasswordPs);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    Entry entry = assertLdapAccount(USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME);
    assertAttribute(entry, "title", "Captain");
    assertLdapPassword(USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, "here.There.Be.Monsters");
    assertAttribute(entry, ATTRIBUTE_USER_ACCOUNT_CONTROL_NAME, "512");
    PrismObject<UserType> user = getUser(USER_BARBOSSA_OID);
    String shadowOid = getSingleLinkOid(user);
    assertEquals("Shadows have moved", accountBarbossaOid, shadowOid);
//        assertLdapConnectorInstances(2);
}
Also used : 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) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ProtectedStringType(com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) Test(org.testng.annotations.Test)

Aggregations

UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)903 Test (org.testng.annotations.Test)767 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)741 Task (com.evolveum.midpoint.task.api.Task)576 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)217 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)192 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)104 PrismObject (com.evolveum.midpoint.prism.PrismObject)100 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)99 AbstractInitializedModelIntegrationTest (com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)88 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)85 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)84 AbstractModelIntegrationTest (com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)83 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)77 ArrayList (java.util.ArrayList)74 QName (javax.xml.namespace.QName)74 File (java.io.File)72 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)58 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)55 PrismAsserts.assertEqualsPolyString (com.evolveum.midpoint.prism.util.PrismAsserts.assertEqualsPolyString)55