Search in sources :

Example 31 with RoleType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.

the class TestEntertainment method test000Sanity.

@Test
public void test000Sanity() throws Exception {
    final String TEST_NAME = "test000Sanity";
    displayTestTile(TEST_NAME);
    Task task = taskManager.createTaskInstance(TestTrafo.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    OperationResult testResultOpenDj = modelService.testResource(RESOURCE_OPENDJ_OID, task);
    assertSuccess(testResultOpenDj);
    SystemConfigurationType systemConfiguration = getSystemConfiguration();
    assertNotNull("No system configuration", systemConfiguration);
    display("System config", systemConfiguration);
    PrismObject<RoleType> metaRole = modelService.getObject(RoleType.class, ROLE_META_CREATE_ORG_GROUPS_OID, null, task, result);
    assertNotNull("No metarole, probably probelm with initialization", metaRole);
    result.computeStatus();
    assertSuccess("Role not fetch successfully", result);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) RoleType(com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) SystemConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType) Test(org.testng.annotations.Test)

Example 32 with RoleType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.

the class TestOrgSync method assertResponsibility.

private String assertResponsibility(PrismObject<UserType> user, String respName) throws SchemaException, ObjectNotFoundException, SecurityViolationException, CommunicationException, ConfigurationException, DirectoryException, ExpressionEvaluationException {
    String respRoleName = "R_" + respName;
    PrismObject<RoleType> respRole = searchObjectByName(RoleType.class, respRoleName);
    assertNotNull("No role for responsibility " + respName);
    display("Responsibility role for " + respName, respRole);
    assertAssignedRole(user, respRole.getOid());
    PrismReferenceValue linkRef = getSingleLinkRef(respRole);
    PrismObject<ShadowType> shadow = getShadowModel(linkRef.getOid());
    display("Role " + respRoleName + " shadow", shadow);
    // TODO assert shadow content
    String groupDn = "cn=" + respRoleName + ",ou=groups," + openDJController.getSuffix();
    Entry groupEntry = openDJController.fetchAndAssertEntry(groupDn, "groupOfUniqueNames");
    display("Group entry", groupEntry);
    PrismReferenceValue accountLinkRef = getLinkRef(user, RESOURCE_OPENDJ_OID);
    PrismObject<ShadowType> accountShadow = getShadowModel(accountLinkRef.getOid());
    String accountDn = IntegrationTestTools.getSecondaryIdentifier(accountShadow);
    openDJController.assertUniqueMember(groupEntry, accountDn);
    IntegrationTestTools.assertAssociation(accountShadow, OPENDJ_ASSOCIATION_GROUP_NAME, shadow.getOid());
    return respRole.getOid();
}
Also used : Entry(org.opends.server.types.Entry) SearchResultEntry(org.opends.server.types.SearchResultEntry) PrismReferenceValue(com.evolveum.midpoint.prism.PrismReferenceValue) RoleType(com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)

Example 33 with RoleType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.

the class TestNotoriousRole method addNotoriousRole.

private void addNotoriousRole(OperationResult result) throws Exception {
    PrismObject<RoleType> role = parseObject(ROLE_NOTORIOUS_FILE);
    RoleType roleType = role.asObjectable();
    for (int i = 0; i < NUMBER_OF_LEVEL_B_ROLES; i++) {
        roleType.beginInducement().targetRef(generateRoleOid(ROLE_LEVEL_B_OID_FORMAT, i), RoleType.COMPLEX_TYPE).end();
    }
    LOGGER.info("Adding {}:\n{}", role, role.debugDump(1));
    repositoryService.addObject(role, null, result);
}
Also used : RoleType(com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType)

Example 34 with RoleType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.

the class TestNullAttribute method initSystem.

@Override
public void initSystem(Task initTask, OperationResult initResult) throws Exception {
    super.initSystem(initTask, initResult);
    // Resources
    //default instance, no instance id
    //when id is set it is required to be present in resource.xml (I guess)
    dummyResourceCtl = DummyResourceContoller.create(null, resourceDummy);
    DummyObjectClass dummyAdAccountObjectClass = dummyResourceCtl.getDummyResource().getAccountObjectClass();
    //attributes
    dummyResourceCtl.addAttrDef(dummyAdAccountObjectClass, DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME, String.class, false, false);
    dummyResourceCtl.addAttrDef(dummyAdAccountObjectClass, DUMMY_ACCOUNT_ATTRIBUTE_SHIP, String.class, false, false);
    dummyResourceCtl.addAttrDef(dummyAdAccountObjectClass, DUMMY_ACCOUNT_ATTRIBUTE_WEAPON, String.class, false, false);
    dummyResource = dummyResourceCtl.getDummyResource();
    resourceDummy = importAndGetObjectFromFile(ResourceType.class, RESOURCE_DUMMY_FILE, RESOURCE_DUMMY_OID, initTask, initResult);
    dummyResourceCtl.setResource(resourceDummy);
    //		dummyResource.setSyncStyle(DummySyncStyle.SMART);
    //
    assumeAssignmentPolicy(AssignmentPolicyEnforcementType.FULL);
    // Object Templates
    importObjectFromFile(OBJECT_TEMPLATE_USER_FILE, initResult);
    setDefaultUserTemplate(OBJECT_TEMPLATE_USER_OID);
    // Role
    importObjectFromFile(ROLE_ACCOUNTONLY_FILE, initResult);
    importObjectFromFile(ROLE_SHIPNWEAPON_FILE, initResult);
    PrismObject<RoleType> rolesw = getRole(ROLE_SHIPNWEAPON_OID);
    display("role shipNWeapon initial", rolesw);
    //User
    importObjectFromFile(USER_SMACK_FILE, initResult);
}
Also used : DummyObjectClass(com.evolveum.icf.dummy.resource.DummyObjectClass) RoleType(com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)

Example 35 with RoleType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.

the class TestWSSecurity method test136AddRoleAsDarthAdder.

@Test
public void test136AddRoleAsDarthAdder() throws Exception {
    final String TEST_NAME = "test136AddRoleAsDarthAdder";
    displayTestTitle(TEST_NAME);
    LogfileTestTailer tailer = createLogTailer();
    RoleType role = ModelClientUtil.unmarshallFile(ROLE_MODIFIER_FILE);
    /// WHEN
    addObject(role);
    // THEN
    tailer.tail();
    displayAudit(tailer);
    assertAuditLoginLogout(tailer);
    assertAuditIds(tailer);
    assertAuditOperation(tailer, "ADD_OBJECT");
    tailer.assertAudit(4);
    assertObjectCount(UserType.class, 6);
    assertObjectCount(RoleType.class, 6);
}
Also used : LogfileTestTailer(com.evolveum.midpoint.test.util.LogfileTestTailer) RoleType(com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType) Test(org.testng.annotations.Test)

Aggregations

RoleType (com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType)67 Test (org.testng.annotations.Test)44 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)39 Task (com.evolveum.midpoint.task.api.Task)34 AbstractInitializedModelIntegrationTest (com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)18 AssignmentType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)15 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)13 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)9 NameItemPathSegment (com.evolveum.midpoint.prism.path.NameItemPathSegment)8 AbstractRoleType (com.evolveum.midpoint.xml.ns._public.common.common_3.AbstractRoleType)8 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)8 QName (javax.xml.namespace.QName)7 IdItemPathSegment (com.evolveum.midpoint.prism.path.IdItemPathSegment)6 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)6 PrismObject (com.evolveum.midpoint.prism.PrismObject)5 PrismReferenceValue (com.evolveum.midpoint.prism.PrismReferenceValue)5 PolicyViolationException (com.evolveum.midpoint.util.exception.PolicyViolationException)5 File (java.io.File)5 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)4 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)4