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;
}
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);
}
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());
}
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);
}
Aggregations