Search in sources :

Example 21 with DummyGroup

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");
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) DummyGroup(com.evolveum.icf.dummy.resource.DummyGroup) Test(org.testng.annotations.Test)

Example 22 with DummyGroup

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);
}
Also used : DummyResource(com.evolveum.icf.dummy.resource.DummyResource) DummyGroup(com.evolveum.icf.dummy.resource.DummyGroup)

Example 23 with DummyGroup

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);
}
Also used : DummyGroup(com.evolveum.icf.dummy.resource.DummyGroup)

Example 24 with DummyGroup

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);
        }
    }
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) DummyGroup(com.evolveum.icf.dummy.resource.DummyGroup)

Example 25 with DummyGroup

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());
    }
}
Also used : DummyGroup(com.evolveum.icf.dummy.resource.DummyGroup)

Aggregations

DummyGroup (com.evolveum.icf.dummy.resource.DummyGroup)38 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)24 Task (com.evolveum.midpoint.task.api.Task)23 Test (org.testng.annotations.Test)23 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)20 DummyAccount (com.evolveum.icf.dummy.resource.DummyAccount)18 DummyPrivilege (com.evolveum.icf.dummy.resource.DummyPrivilege)16 OperationProvisioningScriptsType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationProvisioningScriptsType)11 SchemaViolationException (com.evolveum.icf.dummy.resource.SchemaViolationException)7 GuardedString (org.identityconnectors.common.security.GuardedString)7 ConflictException (com.evolveum.icf.dummy.resource.ConflictException)6 DummyOrg (com.evolveum.icf.dummy.resource.DummyOrg)6 ObjectAlreadyExistsException (com.evolveum.icf.dummy.resource.ObjectAlreadyExistsException)6 FileNotFoundException (java.io.FileNotFoundException)6 ConnectException (java.net.ConnectException)6 AlreadyExistsException (org.identityconnectors.framework.common.exceptions.AlreadyExistsException)6 ConnectionFailedException (org.identityconnectors.framework.common.exceptions.ConnectionFailedException)6 ConnectorIOException (org.identityconnectors.framework.common.exceptions.ConnectorIOException)6 InvalidAttributeValueException (org.identityconnectors.framework.common.exceptions.InvalidAttributeValueException)6 QName (javax.xml.namespace.QName)5