use of com.evolveum.icf.dummy.resource.DummyGroup in project midpoint by Evolveum.
the class TestRoleEntitlement method test101GetGroup.
@Test
public void test101GetGroup() throws Exception {
final String TEST_NAME = "test101GetGroup";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestRoleEntitlement.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.POSITIVE);
// Let's do some evil things. Like changing some of the attribute on a resource and see if they will be
// fetched after get.
DummyGroup dummyGroup = getDummyGroup(null, GROUP_PIRATE_DUMMY_NAME);
dummyGroup.replaceAttributeValue(DummyResourceContoller.DUMMY_GROUP_ATTRIBUTE_DESCRIPTION, "Bloodthirsty Pirates");
// WHEN
PrismObject<ShadowType> shadow = modelService.getObject(ShadowType.class, groupOid, null, task, result);
// THEN
display("Group shadow (model)", shadow);
assertDummyGroupShadowModel(shadow, groupOid, GROUP_PIRATE_DUMMY_NAME);
result.computeStatus();
TestUtil.assertSuccess("getObject result", result);
shadow.checkConsistence(true, true);
IntegrationTestTools.assertAttribute(shadow, getAttributeQName(getDummyResourceObject(), DummyResourceContoller.DUMMY_GROUP_ATTRIBUTE_DESCRIPTION), "Bloodthirsty Pirates");
}
use of com.evolveum.icf.dummy.resource.DummyGroup in project midpoint by Evolveum.
the class AbstractModelIntegrationTest method assertNoDummyGroupMember.
protected void assertNoDummyGroupMember(String dummyInstanceName, String dummyGroupName, String accountId) throws ConnectException, FileNotFoundException, SchemaViolationException, ConflictException {
DummyResource dummyResource = DummyResource.getInstance(dummyInstanceName);
DummyGroup group = dummyResource.getGroupByName(dummyGroupName);
IntegrationTestTools.assertNoGroupMember(group, accountId);
}
use of com.evolveum.icf.dummy.resource.DummyGroup in project midpoint by Evolveum.
the class AbstractModelIntegrationTest method assertNoDummyGroup.
protected void assertNoDummyGroup(String dummyInstanceName, String groupname) throws SchemaViolationException, ConflictException {
DummyGroup group = getDummyGroup(dummyInstanceName, groupname);
assertNull("Dummy group '" + groupname + "' exists while not expecting it (" + dummyInstanceName + ")", group);
}
use of com.evolveum.icf.dummy.resource.DummyGroup in project midpoint by Evolveum.
the class AbstractModelIntegrationTest method assertDummyGroupAttribute.
protected void assertDummyGroupAttribute(String dummyInstanceName, String groupname, String attributeName, Object... expectedAttributeValues) throws SchemaViolationException, ConflictException {
DummyGroup group = getDummyGroup(dummyInstanceName, groupname);
assertNotNull("No dummy group for groupname " + groupname, group);
Set<Object> values = group.getAttributeValues(attributeName, Object.class);
if ((values == null || values.isEmpty()) && (expectedAttributeValues == null || expectedAttributeValues.length == 0)) {
return;
}
assertNotNull("No values for attribute " + attributeName + " of " + dummyInstanceName + " dummy group " + groupname, values);
assertEquals("Unexpected number of values for attribute " + attributeName + " of dummy group " + groupname + ": " + values, expectedAttributeValues.length, values.size());
for (Object expectedValue : expectedAttributeValues) {
if (!values.contains(expectedValue)) {
AssertJUnit.fail("Value '" + expectedValue + "' expected in attribute " + attributeName + " of dummy group " + groupname + " but not found. Values found: " + values);
}
}
}
use of com.evolveum.icf.dummy.resource.DummyGroup in project midpoint by Evolveum.
the class AbstractModelIntegrationTest method assertDummyGroup.
protected void assertDummyGroup(String dummyInstanceName, String groupname, String description, Boolean active) throws SchemaViolationException, ConflictException {
DummyGroup group = getDummyGroup(dummyInstanceName, groupname);
assertNotNull("No dummy(" + dummyInstanceName + ") group for name " + groupname, group);
assertEquals("Wrong fullname for dummy(" + dummyInstanceName + ") group " + groupname, description, group.getAttributeValue(DummyResourceContoller.DUMMY_GROUP_ATTRIBUTE_DESCRIPTION));
if (active != null) {
assertEquals("Wrong activation for dummy(" + dummyInstanceName + ") group " + groupname, active, group.isEnabled());
}
}
Aggregations