use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class AbstractDummyTest method initSystem.
@Override
public void initSystem(Task initTask, OperationResult initResult) throws Exception {
// We need to switch off the encryption checks. Some values cannot be encrypted as we do
// not have a definition here
InternalsConfig.encryptionChecks = false;
provisioningService.postInit(initResult);
resource = addResourceFromFile(getResourceDummyFilename(), IntegrationTestTools.DUMMY_CONNECTOR_TYPE, initResult);
resourceType = resource.asObjectable();
dummyResourceCtl = DummyResourceContoller.create(null);
dummyResourceCtl.setResource(resource);
dummyResourceCtl.extendSchemaPirate();
dummyResource = dummyResourceCtl.getDummyResource();
extraDummyResourceInit();
DummyAccount dummyAccountDaemon = new DummyAccount(ACCOUNT_DAEMON_USERNAME);
dummyAccountDaemon.setEnabled(true);
dummyAccountDaemon.addAttributeValues("fullname", "Evil Daemon");
dummyResource.addAccount(dummyAccountDaemon);
daemonIcfUid = dummyAccountDaemon.getId();
PrismObject<ShadowType> shadowDaemon = PrismTestUtil.parseObject(ACCOUNT_DAEMON_FILE);
if (!isIcfNameUidSame()) {
setIcfUid(shadowDaemon, dummyAccountDaemon.getId());
}
repositoryService.addObject(shadowDaemon, null, initResult);
}
use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class AbstractDummyTest method getDummyAccountAssert.
protected DummyAccount getDummyAccountAssert(String icfName, String icfUid) throws ConnectException, FileNotFoundException, SchemaViolationException, ConflictException {
// if (isNameUnique()) {
if (isIcfNameUidSame()) {
return dummyResource.getAccountByUsername(icfName);
} else {
DummyAccount account = dummyResource.getAccountById(icfUid);
assertNotNull("No dummy account with ICF UID " + icfUid + " (expected name " + icfName + ")", account);
assertEquals("Unexpected name in " + account, icfName, account.getName());
return account;
}
}
use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class TestBrokenResources method testAssignTwoResoures.
/**
* Assign two resources to a user. One of them is looney, the other is not. The result should be that
* the account on the good resource is created.
*/
private void testAssignTwoResoures(final String TEST_NAME, String badResourceOid) throws Exception {
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestBrokenResources.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.POSITIVE);
ObjectDelta<UserType> userDelta = createAccountAssignmentUserDelta(USER_JACK_OID, badResourceOid, null, true);
userDelta.addModification(createAccountAssignmentModification(RESOURCE_DUMMY_OID, null, true));
display("input delta", userDelta);
Collection<ObjectDelta<? extends ObjectType>> deltas = MiscSchemaUtil.createCollection(userDelta);
// WHEN
modelService.executeChanges(deltas, null, task, result);
// THEN
result.computeStatus();
display("executeChanges result", result);
//TODO: ugly hack, see MID-1248
if ("test401AssignTwoResouresBroken".equals(TEST_NAME)) {
assertEquals("Expected partial error in result", OperationResultStatus.PARTIAL_ERROR, result.getStatus());
}
DummyAccount jackDummyAccount = getDummyResource().getAccountByUsername(USER_JACK_USERNAME);
assertNotNull("No jack dummy account", jackDummyAccount);
}
use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class AbstractModelIntegrationTest method assertDummyAccountNoAttribute.
protected void assertDummyAccountNoAttribute(String dummyInstanceName, String username, String attributeName) throws SchemaViolationException, ConflictException {
DummyAccount account = getDummyAccount(dummyInstanceName, username);
assertNotNull("No dummy account for username " + username, account);
Set<Object> values = account.getAttributeValues(attributeName, Object.class);
assertTrue("Unexpected values for attribute " + attributeName + " of dummy account " + username + ": " + values, values == null || values.isEmpty());
}
use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class AbstractModelIntegrationTest method assertDummyAccount.
protected DummyAccount assertDummyAccount(String dummyInstanceName, String username) throws SchemaViolationException, ConflictException {
DummyAccount account = getDummyAccount(dummyInstanceName, username);
assertNotNull("No dummy(" + dummyInstanceName + ") account for username " + username, account);
return account;
}
Aggregations