use of com.evolveum.midpoint.xml.ns._public.common.common_3.UserType 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);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.UserType in project midpoint by Evolveum.
the class AbstractAdLdapMultidomainTest method test630DisableUserSubman.
@Test
public void test630DisableUserSubman() throws Exception {
final String TEST_NAME = "test630DisableUserSubman";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
// WHEN
TestUtil.displayWhen(TEST_NAME);
modifyUserReplace(USER_SUBMAN_OID, new ItemPath(UserType.F_ACTIVATION, ActivationType.F_ADMINISTRATIVE_STATUS), task, result, ActivationStatusType.DISABLED);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
// assertLdapConnectorInstances(2);
PrismObject<UserType> user = getUser(USER_SUBMAN_OID);
assertAdministrativeStatus(user, ActivationStatusType.DISABLED);
Entry entry = assertLdapSubAccount(USER_SUBMAN_USERNAME, USER_SUBMAN_FULL_NAME);
assertAttribute(entry, ATTRIBUTE_USER_ACCOUNT_CONTROL_NAME, "514");
String shadowOid = getSingleLinkOid(user);
PrismObject<ShadowType> shadow = getObject(ShadowType.class, shadowOid);
assertAccountDisabled(shadow);
try {
assertLdapPassword(getSubLdapConnectionConfig(), USER_SUBMAN_USERNAME, USER_SUBMAN_FULL_NAME, "SuB.321");
AssertJUnit.fail("Password authentication works, but it should fail");
} catch (SecurityException e) {
// this is expected
}
// assertLdapConnectorInstances(2);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.UserType in project midpoint by Evolveum.
the class AbstractAdLdapMultidomainTest method test200AssignAccountBarbossa.
// /**
// * Blocksize is 5, so this gets more than two blocks.
// */
// @Test
// public void test154SeachFirst11Accounts() throws Exception {
// final String TEST_NAME = "test154SeachFirst11Accounts";
// TestUtil.displayTestTile(this, TEST_NAME);
//
// // GIVEN
// Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
// OperationResult result = task.getResult();
//
// ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(getResourceOid(), getAccountObjectClass(), prismContext);
//
// ObjectPaging paging = ObjectPaging.createEmptyPaging();
// paging.setMaxSize(11);
// query.setPaging(paging);
//
// SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(TEST_NAME, query, 11, task, result);
//
// assertConnectorOperationIncrement(1);
// assertConnectorSimulatedPagingSearchIncrement(0);
//
// SearchResultMetadata metadata = searchResultList.getMetadata();
// if (metadata != null) {
// assertFalse(metadata.isPartialResults());
// }
//
// assertLdapConnectorInstances(2);
// }
//
// @Test
// public void test162SeachFirst2AccountsOffset0() throws Exception {
// final String TEST_NAME = "test162SeachFirst2AccountsOffset0";
// TestUtil.displayTestTile(this, TEST_NAME);
//
// // GIVEN
// Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
// OperationResult result = task.getResult();
//
// ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(getResourceOid(), getAccountObjectClass(), prismContext);
//
// ObjectPaging paging = ObjectPaging.createEmptyPaging();
// paging.setOffset(0);
// paging.setMaxSize(2);
// query.setPaging(paging);
//
// SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(TEST_NAME, query, 2, task, result);
//
// assertConnectorOperationIncrement(1);
// assertConnectorSimulatedPagingSearchIncrement(0);
//
// SearchResultMetadata metadata = searchResultList.getMetadata();
// if (metadata != null) {
// assertFalse(metadata.isPartialResults());
// }
//
// assertLdapConnectorInstances(2);
// }
//
// /**
// * Blocksize is 5, so this is in one block.
// * There is offset, so VLV should be used.
// * No explicit sorting.
// */
// @Test
// public void test172Search2AccountsOffset1() throws Exception {
// final String TEST_NAME = "test172Search2AccountsOffset1";
// TestUtil.displayTestTile(this, TEST_NAME);
//
// // GIVEN
// Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
// OperationResult result = task.getResult();
//
// ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(getResourceOid(), getAccountObjectClass(), prismContext);
//
// ObjectPaging paging = ObjectPaging.createPaging(1, 2);
// query.setPaging(paging);
//
// SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(TEST_NAME, query, 2, task, result);
//
// assertConnectorOperationIncrement(1);
// assertConnectorSimulatedPagingSearchIncrement(0);
//
// SearchResultMetadata metadata = searchResultList.getMetadata();
// if (metadata != null) {
// assertFalse(metadata.isPartialResults());
// }
//
// assertLdapConnectorInstances(2);
// }
//
// /**
// * Blocksize is 5, so this gets more than two blocks.
// * There is offset, so VLV should be used.
// * No explicit sorting.
// */
// @Test
// public void test174SeachFirst11AccountsOffset2() throws Exception {
// final String TEST_NAME = "test174SeachFirst11AccountsOffset2";
// TestUtil.displayTestTile(this, TEST_NAME);
//
// // GIVEN
// Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
// OperationResult result = task.getResult();
//
// ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(getResourceOid(), getAccountObjectClass(), prismContext);
//
// ObjectPaging paging = ObjectPaging.createPaging(2, 11);
// query.setPaging(paging);
//
// allowDuplicateSearchResults = true;
//
// // WHEN
// SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(TEST_NAME, query, 11, task, result);
//
// // THEN
// allowDuplicateSearchResults = false;
//
// assertConnectorOperationIncrement(1);
// assertConnectorSimulatedPagingSearchIncrement(0);
//
// SearchResultMetadata metadata = searchResultList.getMetadata();
// if (metadata != null) {
// assertFalse(metadata.isPartialResults());
// }
//
// assertLdapConnectorInstances(2);
// }
//
// /**
// * Blocksize is 5, so this is in one block.
// * There is offset, so VLV should be used.
// * Explicit sorting.
// */
// @Test
// public void test182Search2AccountsOffset1SortCn() throws Exception {
// final String TEST_NAME = "test182Search2AccountsOffset1SortCn";
// TestUtil.displayTestTile(this, TEST_NAME);
//
// // GIVEN
// Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
// OperationResult result = task.getResult();
//
// ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(getResourceOid(), getAccountObjectClass(), prismContext);
//
// ObjectPaging paging = ObjectPaging.createPaging(1, 2);
// paging.setOrdering(getAttributePath(resource, "cn"), OrderDirection.ASCENDING);
// query.setPaging(paging);
//
// SearchResultList<PrismObject<ShadowType>> shadows = doSearch(TEST_NAME, query, 2, task, result);
//
// assertAccountShadow(shadows.get(0), "CN=Adalbert Meduza,OU=evolveum,DC=win,DC=evolveum,DC=com");
// assertAccountShadow(shadows.get(1), "CN=Adalbert Meduza1,OU=evolveum,DC=win,DC=evolveum,DC=com");
//
// assertConnectorOperationIncrement(1);
// assertConnectorSimulatedPagingSearchIncrement(0);
//
// SearchResultMetadata metadata = shadows.getMetadata();
// if (metadata != null) {
// assertFalse(metadata.isPartialResults());
// }
//
// assertLdapConnectorInstances(2);
// }
@Test
public void test200AssignAccountBarbossa() throws Exception {
final String TEST_NAME = "test200AssignAccountBarbossa";
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);
assignAccount(USER_BARBOSSA_OID, getResourceOid(), null, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
long tsEnd = System.currentTimeMillis();
Entry entry = assertLdapAccount(USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME);
assertAttribute(entry, "title", null);
PrismObject<UserType> user = getUser(USER_BARBOSSA_OID);
String shadowOid = getSingleLinkOid(user);
PrismObject<ShadowType> shadow = getShadowModel(shadowOid);
display("Shadow (model)", shadow);
accountBarbossaOid = shadow.getOid();
Collection<ResourceAttribute<?>> identifiers = ShadowUtil.getPrimaryIdentifiers(shadow);
String accountBarbossaIcfUid = (String) identifiers.iterator().next().getRealValue();
assertNotNull("No identifier in " + shadow, accountBarbossaIcfUid);
assertEquals("Wrong ICFS UID", AdUtils.formatGuidToDashedNotation(MiscUtil.binaryToHex(entry.get(getPrimaryIdentifierAttributeName()).getBytes())), accountBarbossaIcfUid);
assertLdapPassword(USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, USER_BARBOSSA_PASSWORD);
assertAttribute(entry, ATTRIBUTE_USER_ACCOUNT_CONTROL_NAME, "512");
ResourceAttribute<Long> createTimestampAttribute = ShadowUtil.getAttribute(shadow, new QName(MidPointConstants.NS_RI, "createTimeStamp"));
assertNotNull("No createTimestamp in " + shadow, createTimestampAttribute);
Long createTimestamp = createTimestampAttribute.getRealValue();
// LDAP server may be on a different host. Allow for some clock offset.
TestUtil.assertBetween("Wrong createTimestamp in " + shadow, roundTsDown(tsStart) - 120000, roundTsUp(tsEnd) + 120000, createTimestamp);
// assertLdapConnectorInstances(2);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.UserType in project midpoint by Evolveum.
the class AbstractAdLdapMultidomainTest method test639EnableUserSubman.
@Test
public void test639EnableUserSubman() throws Exception {
final String TEST_NAME = "test639EnableUserBarbossa";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
// WHEN
TestUtil.displayWhen(TEST_NAME);
modifyUserReplace(USER_SUBMAN_OID, new ItemPath(UserType.F_ACTIVATION, ActivationType.F_ADMINISTRATIVE_STATUS), task, result, ActivationStatusType.ENABLED);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
PrismObject<UserType> user = getUser(USER_SUBMAN_OID);
assertAdministrativeStatus(user, ActivationStatusType.ENABLED);
Entry entry = assertLdapSubAccount(USER_SUBMAN_USERNAME, USER_SUBMAN_FULL_NAME);
assertAttribute(entry, ATTRIBUTE_USER_ACCOUNT_CONTROL_NAME, "512");
String shadowOid = getSingleLinkOid(user);
PrismObject<ShadowType> shadow = getObject(ShadowType.class, shadowOid);
assertAccountEnabled(shadow);
// assertLdapConnectorInstances(2);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.UserType in project midpoint by Evolveum.
the class AbstractAdLdapMultidomainTest method test510AssignGuybrushMeleeIsland.
@Test
public void test510AssignGuybrushMeleeIsland() throws Exception {
final String TEST_NAME = "test510AssignGuybrushMeleeIsland";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
// WHEN
TestUtil.displayWhen(TEST_NAME);
assignOrg(USER_GUYBRUSH_OID, orgMeleeIslandOid, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
Entry entry = assertLdapAccount(USER_GUYBRUSH_USERNAME, USER_GUYBRUSH_FULL_NAME);
PrismObject<UserType> user = getUser(USER_GUYBRUSH_OID);
String shadowOid = getSingleLinkOid(user);
PrismObject<ShadowType> shadow = getShadowModel(shadowOid);
display("Shadow (model)", shadow);
assertLdapGroupMember(entry, GROUP_MELEE_ISLAND_NAME);
IntegrationTestTools.assertAssociation(shadow, getAssociationGroupQName(), groupMeleeIslandOid);
// assertLdapConnectorInstances(2);
}
Aggregations