@Test public void test710DarkVioletAddLeChuck() throws Exception { final String TEST_NAME = "test710DarkVioletAddLeChuck"; displayTestTitle(TEST_NAME); // GIVEN Task task = createTask(TEST_NAME); OperationResult result = task.getResult(); dummyAuditService.clear(); DummyAccount account = new DummyAccount(ACCOUNT_LECHUCK_USERNAME); account.setEnabled(true); account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, LECHUCK_FULLNAME); // WHEN displayWhen(TEST_NAME); display("Adding dummy account", account.debugDump()); getDummyResource(RESOURCE_DUMMY_DARK_VIOLET_NAME).addAccount(account); waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); // THEN displayThen(TEST_NAME); assertUserNick(ACCOUNT_LECHUCK_USERNAME, LECHUCK_FULLNAME, LECHUCK_FULLNAME); }
protected void changePassword(final DummyAccount account, GuardedString guardedString) throws ConnectException, FileNotFoundException, SchemaViolationException, ConflictException { String password = getString(guardedString); checkPasswordPolicies(password); account.setPassword(password); }
public String addAccount(DummyAccount newAccount) throws ObjectAlreadyExistsException, ConnectException, FileNotFoundException, SchemaViolationException, ConflictException, InterruptedException { if (generateAccountDescriptionOnCreate && newAccount.getAttributeValue(DummyAccount.ATTR_DESCRIPTION_NAME) == null) { newAccount.addAttributeValue(DummyAccount.ATTR_DESCRIPTION_NAME, "Description of " + newAccount.getName()); } return addObject(accounts, newAccount); }
public DummyAccount addAccount(String userId, String fullName) throws ObjectAlreadyExistsException, SchemaViolationException, ConnectException, FileNotFoundException, ConflictException, InterruptedException { DummyAccount account = new DummyAccount(userId); account.setEnabled(true); account.addAttributeValues(DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, fullName); dummyResource.addAccount(account); return account; }
public void changeDescriptionIfNeeded(DummyAccount account) throws SchemaViolationException, ConflictException { if (generateAccountDescriptionOnCreate) { try { account.replaceAttributeValue(DummyAccount.ATTR_DESCRIPTION_NAME, "Updated description of " + account.getName()); } catch (SchemaViolationException|ConnectException|FileNotFoundException|InterruptedException e) { throw new SystemException("Couldn't replace the 'description' attribute value", e); } } }
@Test public void test101FetchAddChange() throws Exception { final String TEST_NAME = "test101FetchAddChange"; TestUtil.displayTestTitle(this, TEST_NAME); OperationResult result = new OperationResult(this.getClass().getName() + "." + TEST_NAME); ObjectClassComplexTypeDefinition accountDefinition = resourceSchema.findDefaultObjectClassDefinition(ShadowKindType.ACCOUNT); PrismProperty<?> lastToken = cc.fetchCurrentToken(accountDefinition, null, result); assertNotNull("No last sync token", lastToken); // Add account to the resource dummyResource.setSyncStyle(DummySyncStyle.DUMB); DummyAccount newAccount = new DummyAccount("blackbeard"); newAccount.addAttributeValues("fullname", "Edward Teach"); newAccount.setEnabled(true); newAccount.setPassword("shiverMEtimbers"); dummyResource.addAccount(newAccount); // WHEN List<Change> changes = cc.fetchChanges(accountDefinition, lastToken, null, null, result); AssertJUnit.assertEquals(1, changes.size()); Change change = changes.get(0); assertNotNull("null change", change); PrismObject<ShadowType> currentShadow = change.getCurrentShadow(); assertNotNull("null current shadow", currentShadow); PrismAsserts.assertParentConsistency(currentShadow); Collection<ResourceAttribute<?>> identifiers = change.getIdentifiers(); assertNotNull("null identifiers", identifiers); assertFalse("empty identifiers", identifiers.isEmpty()); }
assertEquals("Username is wrong", transformNameFromResource(ACCOUNT_WILL_USERNAME), dummyAccount.getName()); assertEquals("Fullname is wrong", "Will Turner", dummyAccount.getAttributeValue("fullname")); assertTrue("The account is not enabled", dummyAccount.isEnabled()); assertEquals("Wrong password", ACCOUNT_WILL_PASSWORD, dummyAccount.getPassword());
String newName = (String)attr.getValue().get(0); try { resource.renameAccount(account.getId(), account.getName(), newName); } catch (ObjectDoesNotExistException e) { throw new org.identityconnectors.framework.common.exceptions.UnknownUidException(e.getMessage(), e); account.setEnabled(getBoolean(attr)); account.setValidFrom(getDate(attr)); account.setValidTo(getDate(attr)); account.setLockout(getBooleanMandatory(attr)); account.replaceAuxiliaryObjectClassNames(attr.getValue()); account.replaceAttributeValues(name, attr.getValue()); } catch (SchemaViolationException e) {
assertEquals("Fullname is wrong", "Will Turner", dummyAccount.getAttributeValue("fullname")); assertTrue("The account is not enabled", dummyAccount.isEnabled()); assertEquals("Wrong password", "3lizab3th123", dummyAccount.getPassword());
OperationResult result = task.getResult(); DummyAccount account = new DummyAccount(ACCOUNT_MANCOMB_DUMMY_USERNAME); account.setEnabled(true); account.setValidFrom(ACCOUNT_MANCOMB_VALID_FROM_DATE); account.setValidTo(ACCOUNT_MANCOMB_VALID_TO_DATE); account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, "Mancomb Seepgood"); account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME, "Melee Island");
String newName = getSingleReplaceValueMandatory(delta, String.class); try { resource.renameAccount(account.getId(), account.getName(), newName); } catch (ObjectDoesNotExistException e) { throw new org.identityconnectors.framework.common.exceptions.UnknownUidException(e.getMessage(), e); account.setEnabled(getBoolean(delta)); account.setValidFrom(getDate(delta)); account.setValidTo(getDate(delta)); account.setLockout(getBooleanMandatory(delta));
assertEquals("Fullname is wrong", "LeChuck", dummyAccount.getAttributeValue(DummyAccount.ATTR_FULLNAME_NAME)); assertTrue("The account is not enabled", dummyAccount.isEnabled()); assertEquals("Wrong password", "und3ad", dummyAccount.getPassword()); Set<String> accountProvileges = dummyAccount.getAttributeValues(DummyAccount.ATTR_PRIVILEGES_NAME, String.class); PrismAsserts.assertSets("account privileges", accountProvileges, PRIVILEGE_PILLAGE_NAME); assertAttribute(repoAccount, SchemaConstants.ICFS_UID, ACCOUNT_LECHUCK_NAME); } else { assertAttribute(repoAccount, SchemaConstants.ICFS_UID, dummyAccount.getId()); assertAttribute(provisioningAccount, SchemaConstants.ICFS_UID, transformNameFromResource(ACCOUNT_LECHUCK_NAME)); } else { assertAttribute(provisioningAccount, SchemaConstants.ICFS_UID, dummyAccount.getId());
if (account.getPassword() != null) { throw new InvalidAttributeValueException("Attempt to add value for password while password is already set"); account.addAuxiliaryObjectClassNames(attr.getValue()); account.addAttributeValues(name, attr.getValue()); log.ok("Added attribute {0} values {1} from {2}, resulting values: {3}", name, attr.getValue(), account, account.getAttributeValues(name, Object.class)); } catch (SchemaViolationException e) {
accountWill.replaceAttributeValue(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_SHIP_NAME, "Flying Dutchman"); accountWill.replaceAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME); accountWill.setEnabled(true);
/** * MID-2104 */ @Test public void test110ModifyAccountTitleCraticAndReconcile() throws Exception { final String TEST_NAME = "test110ModifyAccountTitleCraticAndReconcile"; displayTestTitle(TEST_NAME); // GIVEN Task task = createTask(TEST_NAME); OperationResult result = task.getResult(); DummyAccount accountHerman = getDummyResource(RESOURCE_DUMMY_AUTOGREEN_NAME).getAccountByUsername(USER_HERMAN_USERNAME); accountHerman.replaceAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME, "cratic"); // WHEN displayWhen(TEST_NAME); reconcileUser(userHermanOid, task, result); // THEN displayThen(TEST_NAME); assertSuccess(result); PrismObject<UserType> userAfter = getUser(userHermanOid); display("User after", userAfter); assertAssignedRole(userAfter, ROLE_AUTOCRATIC_OID); assertAssignments(userAfter, 1); }
@Test public void test720DarkVioletModifyShinetopLocation() throws Exception { final String TEST_NAME = "test720DarkVioletModifyShinetopLocation"; displayTestTitle(TEST_NAME); // GIVEN Task task = createTask(TEST_NAME); OperationResult result = task.getResult(); dummyAuditService.clear(); DummyAccount account = getDummyResource(RESOURCE_DUMMY_DARK_VIOLET_NAME).getAccountByUsername(ACCOUNT_SHINETOP_USERNAME); // WHEN displayWhen(TEST_NAME); account.replaceAttributeValue(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME, "Monkey Island"); waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); // THEN displayThen(TEST_NAME); displayAllUsers(); assertUserNick(ACCOUNT_LECHUCK_USERNAME, LECHUCK_FULLNAME, LECHUCK_FULLNAME); assertNoUserNick(ACCOUNT_CHARLES_USERNAME, LECHUCK_FULLNAME, LECHUCK_FULLNAME+".1"); assertUserNick(ACCOUNT_SHINETOP_USERNAME, LECHUCK_FULLNAME, LECHUCK_FULLNAME+".2", "Monkey Island"); }
protected void assertNoDummyAccountAttribute(String dummyInstanceName, String username, String attributeName) throws SchemaViolationException, ConflictException, InterruptedException { DummyAccount account = getDummyAccount(dummyInstanceName, username); assertNotNull("No dummy "+dummyInstanceName+" account for username "+username, account); Set<Object> values = account.getAttributeValues(attributeName, Object.class); if (values == null || values.isEmpty()) { return; } AssertJUnit.fail("Expected no value in attribute " + attributeName + " of "+dummyInstanceName+" dummy account " + username + ". Values found: " + values); }
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.NONE); DummyAccount dummyAccountBefore = new DummyAccount(ACCOUNT_STAN_USERNAME); dummyAccountBefore.replaceAttributeValue(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, ACCOUNT_STAN_FULLNAME); dummyAccountBefore.replaceAttributeValue(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME, "Melee Island"); dummyResourceEmerald.addAccount(dummyAccountBefore);
accountWill.replaceAttributeValue(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME, "Very Nice Pirate"); accountWill.setEnabled(true);
OperationResult result = task.getResult(); DummyAccount accountHerman = new DummyAccount(USER_HERMAN_USERNAME); accountHerman.replaceAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, USER_HERMAN_FULL_NAME); accountHerman.replaceAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME, "matic"); getDummyResource(RESOURCE_DUMMY_AUTOGREEN_NAME).addAccount(accountHerman);