Search in sources :

Example 16 with CompiledGuiProfile

use of com.evolveum.midpoint.model.api.authentication.CompiledGuiProfile in project midpoint by Evolveum.

the class AbstractModelIntegrationTest method assertCompiledGuiProfile.

protected CompiledGuiProfileAsserter<Void> assertCompiledGuiProfile(MidPointPrincipal principal) {
    if (!(principal instanceof GuiProfiledPrincipal)) {
        fail("Expected GuiProfiledPrincipal, but got " + principal.getClass());
    }
    CompiledGuiProfile compiledGuiProfile = ((GuiProfiledPrincipal) principal).getCompiledGuiProfile();
    CompiledGuiProfileAsserter<Void> asserter = new CompiledGuiProfileAsserter<>(compiledGuiProfile, null, "in principal " + principal);
    initializeAsserter(asserter);
    return asserter;
}
Also used : GuiProfiledPrincipal(com.evolveum.midpoint.model.api.authentication.GuiProfiledPrincipal) CompiledGuiProfile(com.evolveum.midpoint.model.api.authentication.CompiledGuiProfile)

Example 17 with CompiledGuiProfile

use of com.evolveum.midpoint.model.api.authentication.CompiledGuiProfile in project midpoint by Evolveum.

the class TestArchetypes method test104GetGuybryshCompiledGuiProfile.

@Test
public void test104GetGuybryshCompiledGuiProfile() throws Exception {
    // GIVEN
    login(USER_GUYBRUSH_USERNAME);
    Task task = getTestTask();
    OperationResult result = task.getResult();
    // WHEN
    CompiledGuiProfile compiledGuiProfile = modelInteractionService.getCompiledGuiProfile(task, result);
    // THEN
    assertSuccess(result);
    loginAdministrator();
    ObjectFilter allEmployeesViewFilter = assertCompiledGuiProfile(compiledGuiProfile).assertAdditionalMenuLinks(0).assertUserDashboardLinks(0).assertObjectForms(2).assertUserDashboardWidgets(0).objectCollectionViews().assertViews(3).by().identifier(VIEW_ACTIVE_EMPLOYEES_IDENTIFIER).find().assertName(VIEW_ACTIVE_EMPLOYEES_IDENTIFIER).assertFilter().end().by().identifier(VIEW_BUSINESS_ROLES_IDENTIFIER).find().assertName(VIEW_BUSINESS_ROLES_IDENTIFIER).assertFilter().displayType().assertLabel(// Overridden in view definition
    VIEW_BUSINESS_ROLES_LABEL).icon().assertCssClass(ARCHETYPE_BUSINESS_ROLE_ICON_CSS_CLASS).assertColor(ARCHETYPE_BUSINESS_ROLE_ICON_COLOR).end().end().end().by().identifier(VIEW_ALL_EMPLOYEES_NAME).find().assertName(VIEW_ALL_EMPLOYEES_NAME).assertFilter().getFilter();
    ObjectQuery viewQuery = prismContext.queryFactory().createQuery(allEmployeesViewFilter, null);
    SearchResultList<PrismObject<UserType>> searchResults = modelService.searchObjects(UserType.class, viewQuery, null, task, result);
    display("Search results", searchResults);
    assertEquals("Wrong number of search results", 1, searchResults.size());
    PrismObject<UserType> foundUser = searchResults.get(0);
    assertUser(foundUser, "found user").assertName(USER_JACK_USERNAME).assertOid(USER_JACK_OID);
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ObjectFilter(com.evolveum.midpoint.prism.query.ObjectFilter) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) CompiledGuiProfile(com.evolveum.midpoint.model.api.authentication.CompiledGuiProfile) Test(org.testng.annotations.Test)

Example 18 with CompiledGuiProfile

use of com.evolveum.midpoint.model.api.authentication.CompiledGuiProfile in project midpoint by Evolveum.

the class TestArchetypes method test202GetGuybryshCompiledGuiProfileActiveEmployeesView.

@Test
public void test202GetGuybryshCompiledGuiProfileActiveEmployeesView() throws Exception {
    // GIVEN
    login(USER_GUYBRUSH_USERNAME);
    Task task = getTestTask();
    OperationResult result = task.getResult();
    // WHEN
    CompiledGuiProfile compiledGuiProfile = modelInteractionService.getCompiledGuiProfile(task, result);
    // THEN
    assertSuccess(result);
    loginAdministrator();
    ObjectFilter activeEmployeesViewFilter = assertCompiledGuiProfile(compiledGuiProfile).objectCollectionViews().assertViews(3).by().identifier(VIEW_ACTIVE_EMPLOYEES_IDENTIFIER).find().assertName(VIEW_ACTIVE_EMPLOYEES_IDENTIFIER).assertFilter().getFilter();
    ObjectQuery viewQuery = prismContext.queryFactory().createQuery(activeEmployeesViewFilter, null);
    SearchResultList<PrismObject<UserType>> searchResults = modelService.searchObjects(UserType.class, viewQuery, null, task, result);
    display("Search results", searchResults);
    assertEquals("Wrong number of search results", 2, searchResults.size());
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ObjectFilter(com.evolveum.midpoint.prism.query.ObjectFilter) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) CompiledGuiProfile(com.evolveum.midpoint.model.api.authentication.CompiledGuiProfile) Test(org.testng.annotations.Test)

Example 19 with CompiledGuiProfile

use of com.evolveum.midpoint.model.api.authentication.CompiledGuiProfile in project midpoint by Evolveum.

the class TestPreviewChanges method test130GetCompiledGuiProfile.

@Test
public void test130GetCompiledGuiProfile() throws Exception {
    // GIVEN
    Task task = getTestTask();
    OperationResult result = task.getResult();
    // WHEN
    CompiledGuiProfile compiledGuiProfile = modelInteractionService.getCompiledGuiProfile(task, result);
    // THEN
    assertSuccess(result);
    assertCompiledGuiProfile(compiledGuiProfile).assertAdditionalMenuLinks(0).assertUserDashboardLinks(1).assertObjectForms(1).assertUserDashboardWidgets(0).assertObjectCollectionViews(3);
    RichHyperlinkType link = compiledGuiProfile.getUserDashboardLink().get(0);
    assertEquals("Bad link label", "Foo", link.getLabel());
    assertEquals("Bad link targetUrl", "/foo", link.getTargetUrl());
    assertEquals("Bad timezone targetUrl", "Jamaica", compiledGuiProfile.getDefaultTimezone());
    assertSerializable(compiledGuiProfile);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) CompiledGuiProfile(com.evolveum.midpoint.model.api.authentication.CompiledGuiProfile) Test(org.testng.annotations.Test)

Aggregations

CompiledGuiProfile (com.evolveum.midpoint.model.api.authentication.CompiledGuiProfile)19 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)9 Task (com.evolveum.midpoint.task.api.Task)6 PrismObject (com.evolveum.midpoint.prism.PrismObject)4 Test (org.testng.annotations.Test)4 ObjectFilter (com.evolveum.midpoint.prism.query.ObjectFilter)3 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)3 CompiledObjectCollectionView (com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView)2 GuiProfiledPrincipal (com.evolveum.midpoint.model.api.authentication.GuiProfiledPrincipal)2 ArrayList (java.util.ArrayList)2 RestartResponseException (org.apache.wicket.RestartResponseException)2 ReadOnlyModel (com.evolveum.midpoint.gui.api.model.ReadOnlyModel)1 AssignmentHolderDetailsModel (com.evolveum.midpoint.gui.impl.page.admin.assignmentholder.AssignmentHolderDetailsModel)1 ModelInteractionService (com.evolveum.midpoint.model.api.ModelInteractionService)1 LensContext (com.evolveum.midpoint.model.impl.lens.LensContext)1 Referencable (com.evolveum.midpoint.prism.Referencable)1 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)1 ExpressionEvaluationContext (com.evolveum.midpoint.repo.common.expression.ExpressionEvaluationContext)1 ExpressionFactory (com.evolveum.midpoint.repo.common.expression.ExpressionFactory)1 VariablesMap (com.evolveum.midpoint.schema.expression.VariablesMap)1