From 776c1b4e90c315ba593416a3b39e9e25fc9b09a2 Mon Sep 17 00:00:00 2001 From: lskublik Date: Thu, 9 Apr 2020 09:36:28 +0200 Subject: [PATCH 1/9] fix for number of unique char of generated password when valuePolicy doesn't contain limits --- .../stringpolicy/ValuePolicyProcessor.java | 21 ++++++++++++------- .../model/impl/lens/TestPasswordPolicy.java | 21 +++++++++++++++++++ 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/model/model-common/src/main/java/com/evolveum/midpoint/model/common/stringpolicy/ValuePolicyProcessor.java b/model/model-common/src/main/java/com/evolveum/midpoint/model/common/stringpolicy/ValuePolicyProcessor.java index f3634a4e30b..b4cd56b09fe 100644 --- a/model/model-common/src/main/java/com/evolveum/midpoint/model/common/stringpolicy/ValuePolicyProcessor.java +++ b/model/model-common/src/main/java/com/evolveum/midpoint/model/common/stringpolicy/ValuePolicyProcessor.java @@ -7,14 +7,7 @@ package com.evolveum.midpoint.model.common.stringpolicy; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.Set; +import java.util.*; import java.util.function.Consumer; import com.evolveum.midpoint.prism.MutablePrismPropertyDefinition; @@ -96,6 +89,7 @@ public class ValuePolicyProcessor { private static final Trace LOGGER = TraceManager.getTrace(ValuePolicyProcessor.class); private static final Random RAND = new Random(System.currentTimeMillis()); + private static final String ALPHANUMERIC_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; private static final String DOT_CLASS = ValuePolicyProcessor.class.getName() + "."; private static final String OPERATION_STRING_POLICY_VALIDATION = DOT_CLASS + "stringPolicyValidation"; @@ -596,6 +590,17 @@ private String generateAttempt(ValuePolicyType policy, int defaultLength, boolea boolean uniquenessReached = false; + //fake limit with all alphanumeric character, because of number of unique char + if(lims.isEmpty()){ + StringLimitType fakeLimit = new StringLimitType(); + CharacterClassType charClass = new CharacterClassType(); + charClass.setValue(ALPHANUMERIC_CHARS); + fakeLimit.setCharacterClass(charClass); + fakeLimit.setMustBeFirst(false); + fakeLimit.setMaxOccurs(maxLen); + fakeLimit.setMinOccurs(minLen); + lims.put(fakeLimit, StringPolicyUtils.stringTokenizer(ALPHANUMERIC_CHARS)); + } // Count cardinality of elements Map> chars; for (int i = 0; i < minLen; i++) { diff --git a/model/model-impl/src/test/java/com/evolveum/midpoint/model/impl/lens/TestPasswordPolicy.java b/model/model-impl/src/test/java/com/evolveum/midpoint/model/impl/lens/TestPasswordPolicy.java index f0501777088..c704fc07dbf 100644 --- a/model/model-impl/src/test/java/com/evolveum/midpoint/model/impl/lens/TestPasswordPolicy.java +++ b/model/model-impl/src/test/java/com/evolveum/midpoint/model/impl/lens/TestPasswordPolicy.java @@ -159,6 +159,27 @@ public void testValueGenerateRandomPin() throws Exception { } + @Test + public void testValueGenerateMailNonce() throws Exception { + Task task = getTestTask(); + OperationResult result = task.getResult(); + + ValuePolicyType pp = parsePasswordPolicy("value-policy-generate-without-limit-with-unique.xml"); + + // WHEN + when(); + String mailNonce = valuePolicyProcessor.generate(SchemaConstants.PATH_PASSWORD_VALUE, pp, 24, false, null, getTestNameShort(), task, result); + + // THEN + then(); + displayValue("Generated password", mailNonce); + result.computeStatus(); + TestUtil.assertSuccess(result); + assertNotNull(mailNonce); + assertPassword(mailNonce, pp); + + } + @Test public void testValueGenerate() throws Exception { Task task = getTestTask(); From 3fac3235e1ce587e9104dfe48e2561ddb5bbaa6a Mon Sep 17 00:00:00 2001 From: kate Date: Tue, 14 Apr 2020 16:43:21 +0200 Subject: [PATCH 2/9] MID-6212 confirmation for cleanup task actions --- .../web/page/admin/server/PageTask.java | 57 ++++++++++++++----- 1 file changed, 44 insertions(+), 13 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/server/PageTask.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/server/PageTask.java index 5d8bbc891d1..e1c46eb4dc9 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/server/PageTask.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/server/PageTask.java @@ -4,6 +4,8 @@ import java.util.Collection; import java.util.Collections; +import com.evolveum.midpoint.web.component.dialog.ConfirmationPanel; + import org.apache.wicket.Page; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.behavior.AttributeAppender; @@ -11,6 +13,7 @@ import org.apache.wicket.markup.repeater.RepeatingView; import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; +import org.apache.wicket.model.StringResourceModel; import org.apache.wicket.request.mapper.parameter.PageParameters; import com.evolveum.midpoint.gui.api.GuiStyleConstants; @@ -63,6 +66,8 @@ import com.evolveum.midpoint.web.util.TaskOperationUtils; import com.evolveum.midpoint.xml.ns._public.common.common_3.*; +import static com.evolveum.midpoint.web.component.data.column.ColumnUtils.createStringResource; + @PageDescriptor( urls = { @Url(mountUrl = "/admin/task", matchUrlForSecurity = "/admin/task") @@ -349,12 +354,25 @@ private void createCleanupPerformanceButton(RepeatingView repeatingView) { @Override public void onClick(AjaxRequestTarget target) { - try { - deleteItem(TaskType.F_OPERATION_STATS); - } catch (SchemaException e){ - LOGGER.error("Cannot clear task results: {}", e.getMessage()); - } - saveTaskChanges(target); + ConfirmationPanel dialog = new ConfirmationPanel(getMainPopupBodyId(), createStringResource("operationalButtonsPanel.cleanupEnvironmentalPerformance.confirmation")) { + private static final long serialVersionUID = 1L; + + @Override + public StringResourceModel getTitle() { + return createStringResource("pageUsers.message.confirmActionPopupTitle"); + } + + @Override + public void yesPerformed(AjaxRequestTarget target) { + try { + deleteItem(TaskType.F_OPERATION_STATS); + } catch (SchemaException e){ + LOGGER.error("Cannot clear task results: {}", e.getMessage()); + } + saveTaskChanges(target); + } + }; + showMainPopup(dialog, target); } }; cleanupPerformance.add(AttributeAppender.append("class", "btn btn-default btn-margin-left btn-sm")); @@ -368,13 +386,26 @@ private void createCleanupResultsButton(RepeatingView repeatingView) { @Override public void onClick(AjaxRequestTarget target) { - try { - deleteItem(TaskType.F_RESULT); - deleteItem(TaskType.F_RESULT_STATUS); - } catch (SchemaException e){ - LOGGER.error("Cannot clear task results: {}", e.getMessage()); - } - saveTaskChanges(target); + ConfirmationPanel dialog = new ConfirmationPanel(getMainPopupBodyId(), createStringResource("operationalButtonsPanel.cleanupEnvironmentalPerformance.confirmation")) { + private static final long serialVersionUID = 1L; + + @Override + public StringResourceModel getTitle() { + return createStringResource("pageUsers.message.confirmActionPopupTitle"); + } + + @Override + public void yesPerformed(AjaxRequestTarget target) { + try { + deleteItem(TaskType.F_RESULT); + deleteItem(TaskType.F_RESULT_STATUS); + } catch (SchemaException e){ + LOGGER.error("Cannot clear task results: {}", e.getMessage()); + } + saveTaskChanges(target); + } + }; + showMainPopup(dialog, target); } }; cleanupResults.add(new VisibleBehaviour(this::isNotRunning)); From 05a6a961486b3d372a6db768b260060487bfc4f6 Mon Sep 17 00:00:00 2001 From: kate Date: Tue, 14 Apr 2020 17:58:18 +0200 Subject: [PATCH 3/9] MID-6212 confirmation for change archetype action --- .../gui/api/component/AssignmentPopup.html | 1 + .../gui/api/component/AssignmentPopup.java | 963 +++++++++--------- .../page/admin/PageAdminObjectDetails.java | 5 + 3 files changed, 493 insertions(+), 476 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/api/component/AssignmentPopup.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/api/component/AssignmentPopup.html index 71127fd5c67..5b81f636cc7 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/api/component/AssignmentPopup.html +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/api/component/AssignmentPopup.html @@ -9,6 +9,7 @@
+

diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/api/component/AssignmentPopup.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/api/component/AssignmentPopup.java index bc504656f9f..a4d92cbfa38 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/api/component/AssignmentPopup.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/api/component/AssignmentPopup.java @@ -1,476 +1,487 @@ -/* - * Copyright (c) 2010-2018 Evolveum and contributors - * - * This work is dual-licensed under the Apache License 2.0 - * and European Union Public License. See LICENSE file for details. - */ -package com.evolveum.midpoint.gui.api.component; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.namespace.QName; - -import com.evolveum.midpoint.gui.api.component.tabs.PanelTab; -import com.evolveum.midpoint.web.component.util.SelectableBean; -import org.apache.wicket.Component; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.behavior.AttributeAppender; -import org.apache.wicket.extensions.markup.html.tabs.ITab; -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.model.IModel; -import org.apache.wicket.model.StringResourceModel; - -import com.evolveum.midpoint.gui.api.component.tabs.CountablePanelTab; -import com.evolveum.midpoint.gui.api.model.LoadableModel; -import com.evolveum.midpoint.gui.api.prism.PrismContainerWrapper; -import com.evolveum.midpoint.gui.api.util.WebComponentUtil; -import com.evolveum.midpoint.prism.query.ObjectFilter; -import com.evolveum.midpoint.schema.constants.ObjectTypes; -import com.evolveum.midpoint.web.component.AjaxButton; -import com.evolveum.midpoint.web.component.TabbedPanel; -import com.evolveum.midpoint.web.component.dialog.Popupable; -import com.evolveum.midpoint.web.component.util.EnableBehaviour; -import com.evolveum.midpoint.web.component.util.SelectableBeanImpl; -import com.evolveum.midpoint.web.component.util.VisibleBehaviour; -import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ServiceType; - -/** - * Created by honchar. - */ -public class AssignmentPopup extends BasePanel implements Popupable{ - private static final long serialVersionUID = 1L; - - private static final String ID_TABS_PANEL = "tabsPanel"; - private static final String ID_CANCEL_BUTTON = "cancelButton"; - private static final String ID_ASSIGN_BUTTON = "assignButton"; - private static final String ID_FORM = "form"; - - private List selectedOrgsList = new ArrayList<>(); - - public AssignmentPopup(String id){ - super(id); - } - - @Override - protected void onInitialize(){ - super.onInitialize(); - - Form form = new Form(ID_FORM); - form.setOutputMarkupId(true); - add(form); - - List tabs = createAssignmentTabs(); - TabbedPanel tabPanel = WebComponentUtil.createTabPanel(ID_TABS_PANEL, getPageBase(), tabs, null); - tabPanel.setOutputMarkupId(true); - tabPanel.setOutputMarkupPlaceholderTag(true); - form.add(tabPanel); - - AjaxButton cancelButton = new AjaxButton(ID_CANCEL_BUTTON, - createStringResource("userBrowserDialog.button.cancelButton")) { - - private static final long serialVersionUID = 1L; - - @Override - public void onClick(AjaxRequestTarget target) { - AssignmentPopup.this.getPageBase().hideMainPopup(target); - } - }; - cancelButton.setOutputMarkupId(true); - form.add(cancelButton); - - AjaxButton addButton = new AjaxButton(ID_ASSIGN_BUTTON, - createStringResource("userBrowserDialog.button.addButton")) { - - private static final long serialVersionUID = 1L; - - @Override - public void onClick(AjaxRequestTarget target) { - Map selectedAssignmentsMap = new HashMap<>(); - - tabs.forEach(panelTab -> { - WebMarkupContainer assignmentPanel = ((PanelTab)panelTab).getPanel(); - if (assignmentPanel == null){ - return; - } - - (((AbstractAssignmentPopupTabPanel) assignmentPanel).getSelectedAssignmentsMap()).forEach((k, v) -> - selectedAssignmentsMap.putIfAbsent((String)k, (AssignmentType) v)); - - - }); - List assignments = new ArrayList<>(selectedAssignmentsMap.values()); - addPerformed(target, assignments); - } - }; - addButton.add(AttributeAppender.append("title", getAddButtonTitleModel())); - addButton.add(new EnableBehaviour(() -> isAssignButtonEnabled())); - addButton.setOutputMarkupId(true); - form.add(addButton); - } - - protected List createAssignmentTabs() { - List tabs = new ArrayList<>(); - - if (isTabVisible(ObjectTypes.ROLE)) { - tabs.add(new CountablePanelTab(getPageBase().createStringResource("ObjectTypes.ROLE"), - new VisibleBehaviour(() -> isTabVisible(ObjectTypes.ROLE))) { - - private static final long serialVersionUID = 1L; - - @Override - public WebMarkupContainer createPanel(String panelId) { - return new FocusTypeAssignmentPopupTabPanel(panelId, ObjectTypes.ROLE) { - private static final long serialVersionUID = 1L; - - @Override - protected void onSelectionPerformed(AjaxRequestTarget target, IModel> rowModel) { - tabLabelPanelUpdate(target); - } - - @Override - protected ObjectTypes getObjectType() { - return ObjectTypes.ROLE; - } - - @Override - protected PrismContainerWrapper getAssignmentWrapperModel() { - return AssignmentPopup.this.getAssignmentWrapperModel(); - } - - @Override - protected QName getPredefinedRelation() { - return AssignmentPopup.this.getPredefinedRelation(); - } - - @Override - protected List getArchetypeRefList() { - return AssignmentPopup.this.getArchetypeRefList(); - } - }; - } - - @Override - public String getCount() { - return Integer.toString(getTabPanelSelectedCount(getPanel())); - } - }); - } - - if (isTabVisible(ObjectTypes.ORG)) { - tabs.add( - new CountablePanelTab(getPageBase().createStringResource("ObjectTypes.ORG"), - new VisibleBehaviour(() -> isTabVisible(ObjectTypes.ORG))) { - - private static final long serialVersionUID = 1L; - - @Override - public WebMarkupContainer createPanel(String panelId) { - return new FocusTypeAssignmentPopupTabPanel(panelId, ObjectTypes.ORG) { - private static final long serialVersionUID = 1L; - - @Override - protected void onSelectionPerformed(AjaxRequestTarget target, IModel> rowModel) { - selectedOrgsListUpdate(rowModel); - tabLabelPanelUpdate(target); - } - - @Override - protected ObjectTypes getObjectType() { - return ObjectTypes.ORG; - } - - @Override - protected List getPreselectedObjects() { - return selectedOrgsList; - } - - @Override - protected PrismContainerWrapper getAssignmentWrapperModel() { - return AssignmentPopup.this.getAssignmentWrapperModel(); - } - - @Override - protected QName getPredefinedRelation() { - return AssignmentPopup.this.getPredefinedRelation(); - } - - @Override - protected List getArchetypeRefList() { - return AssignmentPopup.this.getArchetypeRefList(); - } - - @Override - protected ObjectFilter getSubtypeFilter() { - return AssignmentPopup.this.getSubtypeFilter(); - } - }; - } - - @Override - public String getCount() { - return Integer.toString(selectedOrgsList.size()); - } - }); - } - - if (isTabVisible(ObjectTypes.ORG) && isOrgTreeTabVisible()) { - tabs.add(new CountablePanelTab(createStringResource("TypedAssignablePanel.orgTreeView"), - new VisibleBehaviour(() -> isTabVisible(ObjectTypes.ORG) && isOrgTreeTabVisible())) { - - private static final long serialVersionUID = 1L; - - @Override - public WebMarkupContainer createPanel(String panelId) { - return new OrgTreeAssignmentPopupTabPanel(panelId) { - private static final long serialVersionUID = 1L; - - @Override - protected void onSelectionPerformed(AjaxRequestTarget target, IModel> rowModel) { - selectedOrgsListUpdate(rowModel); - tabLabelPanelUpdate(target); - } - - @Override - protected List getPreselectedObjects() { - return selectedOrgsList; - } - - @Override - protected PrismContainerWrapper getAssignmentWrapperModel() { - return AssignmentPopup.this.getAssignmentWrapperModel(); - } - - @Override - protected QName getPredefinedRelation() { - return AssignmentPopup.this.getPredefinedRelation(); - } - - @Override - protected List getArchetypeRefList() { - return AssignmentPopup.this.getArchetypeRefList(); - } - - @Override - protected ObjectFilter getSubtypeFilter() { - return AssignmentPopup.this.getSubtypeFilter(); - } - }; - } - - @Override - public String getCount() { - return Integer.toString(selectedOrgsList.size()); - } - }); - } - - if (isTabVisible(ObjectTypes.SERVICE)) { - tabs.add( - new CountablePanelTab(getPageBase().createStringResource("ObjectTypes.SERVICE"), - new VisibleBehaviour(() -> isTabVisible(ObjectTypes.SERVICE))) { - - private static final long serialVersionUID = 1L; - - @Override - public WebMarkupContainer createPanel(String panelId) { - return new FocusTypeAssignmentPopupTabPanel(panelId, ObjectTypes.SERVICE) { - private static final long serialVersionUID = 1L; - - @Override - protected ObjectTypes getObjectType() { - return ObjectTypes.SERVICE; - } - - @Override - protected void onSelectionPerformed(AjaxRequestTarget target, IModel> rowModel) { - tabLabelPanelUpdate(target); - } - - @Override - protected PrismContainerWrapper getAssignmentWrapperModel() { - return AssignmentPopup.this.getAssignmentWrapperModel(); - } - - @Override - protected QName getPredefinedRelation() { - return AssignmentPopup.this.getPredefinedRelation(); - } - - @Override - protected List getArchetypeRefList() { - return AssignmentPopup.this.getArchetypeRefList(); - } - }; - } - - @Override - public String getCount() { - return Integer.toString(getTabPanelSelectedCount(getPanel())); - } - }); - } - - if (isTabVisible(ObjectTypes.RESOURCE)) { - tabs.add( - new CountablePanelTab(getPageBase().createStringResource("ObjectTypes.RESOURCE"), - new VisibleBehaviour(() -> isTabVisible(ObjectTypes.RESOURCE))) { - - private static final long serialVersionUID = 1L; - - @Override - public WebMarkupContainer createPanel(String panelId) { - return new ResourceTypeAssignmentPopupTabPanel(panelId) { - private static final long serialVersionUID = 1L; - - @Override - protected void onSelectionPerformed(AjaxRequestTarget target, IModel> rowModel) { - super.onSelectionPerformed(target, rowModel); - tabLabelPanelUpdate(target); - } - - @Override - protected boolean isEntitlementAssignment() { - return AssignmentPopup.this.isEntitlementAssignment(); - } - - @Override - protected List getArchetypeRefList() { - return AssignmentPopup.this.getArchetypeRefList(); - } - }; - } - - @Override - public String getCount() { - return Integer.toString(getTabPanelSelectedCount(getPanel())); - } - }); - } - - return tabs; - } - - protected PrismContainerWrapper getAssignmentWrapperModel(){ - return null; - } - - protected List getArchetypeRefList(){ - return null; - } - - protected ObjectFilter getSubtypeFilter(){ - return null; - } - - private boolean isTabVisible(ObjectTypes objectType){ - List availableObjectTypesList = getAvailableObjectTypesList(); - return availableObjectTypesList == null || availableObjectTypesList.size() == 0 || availableObjectTypesList.contains(objectType); - } - - protected boolean isOrgTreeTabVisible(){ - return true; - } - - protected List getAvailableObjectTypesList(){ - return WebComponentUtil.createAssignableTypesList(); - } - - protected QName getPredefinedRelation(){ - return null; - } - - protected boolean isEntitlementAssignment(){ - return false; - } - - private int getTabPanelSelectedCount(WebMarkupContainer panel){ - if (panel != null && panel instanceof AbstractAssignmentPopupTabPanel){ - return ((AbstractAssignmentPopupTabPanel) panel).getSelectedObjectsList().size(); - } - return 0; - } - - protected void tabLabelPanelUpdate(AjaxRequestTarget target){ - getTabbedPanel().reloadCountLabels(target); - target.add(get(ID_FORM).get(ID_ASSIGN_BUTTON)); - } - - private void selectedOrgsListUpdate(IModel> rowModel){ - if (rowModel == null){ - return; - } - if (rowModel.getObject().isSelected()){ - selectedOrgsList.add(rowModel.getObject().getValue()); - } else { - selectedOrgsList.removeIf((OrgType org) -> org.getOid().equals(rowModel.getObject().getValue().getOid())); - } - } - - private TabbedPanel getTabbedPanel(){ - return (TabbedPanel) get(ID_FORM).get(ID_TABS_PANEL); - } - - protected void addPerformed(AjaxRequestTarget target, List newAssignmentsList) { - getPageBase().hideMainPopup(target); - } - - private IModel getAddButtonTitleModel(){ - return new LoadableModel(true) { - @Override - protected String load() { - return !isAssignButtonEnabled() ? createStringResource("AssignmentPopup.addButtonTitle").getString() : ""; - } - }; - } - - private boolean isAssignButtonEnabled(){ - TabbedPanel tabbedPanel = getTabbedPanel(); - List tabs = tabbedPanel.getTabs().getObject(); - for (ITab tab : tabs){ - WebMarkupContainer assignmentPanel = ((PanelTab)tab).getPanel(); - if (assignmentPanel == null){ - continue; - } - if (((AbstractAssignmentPopupTabPanel) assignmentPanel).getSelectedObjectsList().size() > 0) { - return true; - } - } - return false; - } - - public int getWidth(){ - return 80; - } - - public int getHeight(){ - return 80; - } - - @Override - public String getWidthUnit(){ - return "%"; - } - - @Override - public String getHeightUnit(){ - return "%"; - } - - public StringResourceModel getTitle(){ - return createStringResource("TypedAssignablePanel.selectObjects"); - } - - public Component getComponent(){ - return this; - } -} +/* + * Copyright (c) 2010-2018 Evolveum and contributors + * + * This work is dual-licensed under the Apache License 2.0 + * and European Union Public License. See LICENSE file for details. + */ +package com.evolveum.midpoint.gui.api.component; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.xml.namespace.QName; + +import com.evolveum.midpoint.gui.api.component.tabs.PanelTab; +import com.evolveum.midpoint.web.component.util.SelectableBean; +import org.apache.wicket.Component; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.behavior.AttributeAppender; +import org.apache.wicket.extensions.markup.html.tabs.ITab; +import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.StringResourceModel; + +import com.evolveum.midpoint.gui.api.component.tabs.CountablePanelTab; +import com.evolveum.midpoint.gui.api.model.LoadableModel; +import com.evolveum.midpoint.gui.api.prism.PrismContainerWrapper; +import com.evolveum.midpoint.gui.api.util.WebComponentUtil; +import com.evolveum.midpoint.prism.query.ObjectFilter; +import com.evolveum.midpoint.schema.constants.ObjectTypes; +import com.evolveum.midpoint.web.component.AjaxButton; +import com.evolveum.midpoint.web.component.TabbedPanel; +import com.evolveum.midpoint.web.component.dialog.Popupable; +import com.evolveum.midpoint.web.component.util.EnableBehaviour; +import com.evolveum.midpoint.web.component.util.SelectableBeanImpl; +import com.evolveum.midpoint.web.component.util.VisibleBehaviour; +import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ServiceType; + +/** + * Created by honchar. + */ +public class AssignmentPopup extends BasePanel implements Popupable{ + private static final long serialVersionUID = 1L; + + private static final String ID_TABS_PANEL = "tabsPanel"; + private static final String ID_WARNING_MESSAGE = "warningMessage"; + private static final String ID_CANCEL_BUTTON = "cancelButton"; + private static final String ID_ASSIGN_BUTTON = "assignButton"; + private static final String ID_FORM = "form"; + + private List selectedOrgsList = new ArrayList<>(); + + public AssignmentPopup(String id){ + super(id); + } + + @Override + protected void onInitialize(){ + super.onInitialize(); + + Form form = new Form(ID_FORM); + form.setOutputMarkupId(true); + add(form); + + List tabs = createAssignmentTabs(); + TabbedPanel tabPanel = WebComponentUtil.createTabPanel(ID_TABS_PANEL, getPageBase(), tabs, null); + tabPanel.setOutputMarkupId(true); + tabPanel.setOutputMarkupPlaceholderTag(true); + form.add(tabPanel); + + Label warningMessage = new Label(ID_WARNING_MESSAGE, this :: getWarningMessageModel); + warningMessage.setOutputMarkupId(true); + warningMessage.add(new VisibleBehaviour(() -> getWarningMessageModel() != null)); + form.add(warningMessage); + + AjaxButton cancelButton = new AjaxButton(ID_CANCEL_BUTTON, + createStringResource("userBrowserDialog.button.cancelButton")) { + + private static final long serialVersionUID = 1L; + + @Override + public void onClick(AjaxRequestTarget target) { + AssignmentPopup.this.getPageBase().hideMainPopup(target); + } + }; + cancelButton.setOutputMarkupId(true); + form.add(cancelButton); + + AjaxButton addButton = new AjaxButton(ID_ASSIGN_BUTTON, + createStringResource("userBrowserDialog.button.addButton")) { + + private static final long serialVersionUID = 1L; + + @Override + public void onClick(AjaxRequestTarget target) { + Map selectedAssignmentsMap = new HashMap<>(); + + tabs.forEach(panelTab -> { + WebMarkupContainer assignmentPanel = ((PanelTab)panelTab).getPanel(); + if (assignmentPanel == null){ + return; + } + + (((AbstractAssignmentPopupTabPanel) assignmentPanel).getSelectedAssignmentsMap()).forEach((k, v) -> + selectedAssignmentsMap.putIfAbsent((String)k, (AssignmentType) v)); + + + }); + List assignments = new ArrayList<>(selectedAssignmentsMap.values()); + addPerformed(target, assignments); + } + }; + addButton.add(AttributeAppender.append("title", getAddButtonTitleModel())); + addButton.add(new EnableBehaviour(() -> isAssignButtonEnabled())); + addButton.setOutputMarkupId(true); + form.add(addButton); + } + + protected List createAssignmentTabs() { + List tabs = new ArrayList<>(); + + if (isTabVisible(ObjectTypes.ROLE)) { + tabs.add(new CountablePanelTab(getPageBase().createStringResource("ObjectTypes.ROLE"), + new VisibleBehaviour(() -> isTabVisible(ObjectTypes.ROLE))) { + + private static final long serialVersionUID = 1L; + + @Override + public WebMarkupContainer createPanel(String panelId) { + return new FocusTypeAssignmentPopupTabPanel(panelId, ObjectTypes.ROLE) { + private static final long serialVersionUID = 1L; + + @Override + protected void onSelectionPerformed(AjaxRequestTarget target, IModel> rowModel) { + tabLabelPanelUpdate(target); + } + + @Override + protected ObjectTypes getObjectType() { + return ObjectTypes.ROLE; + } + + @Override + protected PrismContainerWrapper getAssignmentWrapperModel() { + return AssignmentPopup.this.getAssignmentWrapperModel(); + } + + @Override + protected QName getPredefinedRelation() { + return AssignmentPopup.this.getPredefinedRelation(); + } + + @Override + protected List getArchetypeRefList() { + return AssignmentPopup.this.getArchetypeRefList(); + } + }; + } + + @Override + public String getCount() { + return Integer.toString(getTabPanelSelectedCount(getPanel())); + } + }); + } + + if (isTabVisible(ObjectTypes.ORG)) { + tabs.add( + new CountablePanelTab(getPageBase().createStringResource("ObjectTypes.ORG"), + new VisibleBehaviour(() -> isTabVisible(ObjectTypes.ORG))) { + + private static final long serialVersionUID = 1L; + + @Override + public WebMarkupContainer createPanel(String panelId) { + return new FocusTypeAssignmentPopupTabPanel(panelId, ObjectTypes.ORG) { + private static final long serialVersionUID = 1L; + + @Override + protected void onSelectionPerformed(AjaxRequestTarget target, IModel> rowModel) { + selectedOrgsListUpdate(rowModel); + tabLabelPanelUpdate(target); + } + + @Override + protected ObjectTypes getObjectType() { + return ObjectTypes.ORG; + } + + @Override + protected List getPreselectedObjects() { + return selectedOrgsList; + } + + @Override + protected PrismContainerWrapper getAssignmentWrapperModel() { + return AssignmentPopup.this.getAssignmentWrapperModel(); + } + + @Override + protected QName getPredefinedRelation() { + return AssignmentPopup.this.getPredefinedRelation(); + } + + @Override + protected List getArchetypeRefList() { + return AssignmentPopup.this.getArchetypeRefList(); + } + + @Override + protected ObjectFilter getSubtypeFilter() { + return AssignmentPopup.this.getSubtypeFilter(); + } + }; + } + + @Override + public String getCount() { + return Integer.toString(selectedOrgsList.size()); + } + }); + } + + if (isTabVisible(ObjectTypes.ORG) && isOrgTreeTabVisible()) { + tabs.add(new CountablePanelTab(createStringResource("TypedAssignablePanel.orgTreeView"), + new VisibleBehaviour(() -> isTabVisible(ObjectTypes.ORG) && isOrgTreeTabVisible())) { + + private static final long serialVersionUID = 1L; + + @Override + public WebMarkupContainer createPanel(String panelId) { + return new OrgTreeAssignmentPopupTabPanel(panelId) { + private static final long serialVersionUID = 1L; + + @Override + protected void onSelectionPerformed(AjaxRequestTarget target, IModel> rowModel) { + selectedOrgsListUpdate(rowModel); + tabLabelPanelUpdate(target); + } + + @Override + protected List getPreselectedObjects() { + return selectedOrgsList; + } + + @Override + protected PrismContainerWrapper getAssignmentWrapperModel() { + return AssignmentPopup.this.getAssignmentWrapperModel(); + } + + @Override + protected QName getPredefinedRelation() { + return AssignmentPopup.this.getPredefinedRelation(); + } + + @Override + protected List getArchetypeRefList() { + return AssignmentPopup.this.getArchetypeRefList(); + } + + @Override + protected ObjectFilter getSubtypeFilter() { + return AssignmentPopup.this.getSubtypeFilter(); + } + }; + } + + @Override + public String getCount() { + return Integer.toString(selectedOrgsList.size()); + } + }); + } + + if (isTabVisible(ObjectTypes.SERVICE)) { + tabs.add( + new CountablePanelTab(getPageBase().createStringResource("ObjectTypes.SERVICE"), + new VisibleBehaviour(() -> isTabVisible(ObjectTypes.SERVICE))) { + + private static final long serialVersionUID = 1L; + + @Override + public WebMarkupContainer createPanel(String panelId) { + return new FocusTypeAssignmentPopupTabPanel(panelId, ObjectTypes.SERVICE) { + private static final long serialVersionUID = 1L; + + @Override + protected ObjectTypes getObjectType() { + return ObjectTypes.SERVICE; + } + + @Override + protected void onSelectionPerformed(AjaxRequestTarget target, IModel> rowModel) { + tabLabelPanelUpdate(target); + } + + @Override + protected PrismContainerWrapper getAssignmentWrapperModel() { + return AssignmentPopup.this.getAssignmentWrapperModel(); + } + + @Override + protected QName getPredefinedRelation() { + return AssignmentPopup.this.getPredefinedRelation(); + } + + @Override + protected List getArchetypeRefList() { + return AssignmentPopup.this.getArchetypeRefList(); + } + }; + } + + @Override + public String getCount() { + return Integer.toString(getTabPanelSelectedCount(getPanel())); + } + }); + } + + if (isTabVisible(ObjectTypes.RESOURCE)) { + tabs.add( + new CountablePanelTab(getPageBase().createStringResource("ObjectTypes.RESOURCE"), + new VisibleBehaviour(() -> isTabVisible(ObjectTypes.RESOURCE))) { + + private static final long serialVersionUID = 1L; + + @Override + public WebMarkupContainer createPanel(String panelId) { + return new ResourceTypeAssignmentPopupTabPanel(panelId) { + private static final long serialVersionUID = 1L; + + @Override + protected void onSelectionPerformed(AjaxRequestTarget target, IModel> rowModel) { + super.onSelectionPerformed(target, rowModel); + tabLabelPanelUpdate(target); + } + + @Override + protected boolean isEntitlementAssignment() { + return AssignmentPopup.this.isEntitlementAssignment(); + } + + @Override + protected List getArchetypeRefList() { + return AssignmentPopup.this.getArchetypeRefList(); + } + }; + } + + @Override + public String getCount() { + return Integer.toString(getTabPanelSelectedCount(getPanel())); + } + }); + } + + return tabs; + } + + protected PrismContainerWrapper getAssignmentWrapperModel(){ + return null; + } + + protected List getArchetypeRefList(){ + return null; + } + + protected ObjectFilter getSubtypeFilter(){ + return null; + } + + private boolean isTabVisible(ObjectTypes objectType){ + List availableObjectTypesList = getAvailableObjectTypesList(); + return availableObjectTypesList == null || availableObjectTypesList.size() == 0 || availableObjectTypesList.contains(objectType); + } + + protected boolean isOrgTreeTabVisible(){ + return true; + } + + protected List getAvailableObjectTypesList(){ + return WebComponentUtil.createAssignableTypesList(); + } + + protected QName getPredefinedRelation(){ + return null; + } + + protected boolean isEntitlementAssignment(){ + return false; + } + + private int getTabPanelSelectedCount(WebMarkupContainer panel){ + if (panel != null && panel instanceof AbstractAssignmentPopupTabPanel){ + return ((AbstractAssignmentPopupTabPanel) panel).getSelectedObjectsList().size(); + } + return 0; + } + + protected void tabLabelPanelUpdate(AjaxRequestTarget target){ + getTabbedPanel().reloadCountLabels(target); + target.add(get(ID_FORM).get(ID_ASSIGN_BUTTON)); + } + + private void selectedOrgsListUpdate(IModel> rowModel){ + if (rowModel == null){ + return; + } + if (rowModel.getObject().isSelected()){ + selectedOrgsList.add(rowModel.getObject().getValue()); + } else { + selectedOrgsList.removeIf((OrgType org) -> org.getOid().equals(rowModel.getObject().getValue().getOid())); + } + } + + private TabbedPanel getTabbedPanel(){ + return (TabbedPanel) get(ID_FORM).get(ID_TABS_PANEL); + } + + protected void addPerformed(AjaxRequestTarget target, List newAssignmentsList) { + getPageBase().hideMainPopup(target); + } + + private IModel getAddButtonTitleModel(){ + return new LoadableModel(true) { + @Override + protected String load() { + return !isAssignButtonEnabled() ? createStringResource("AssignmentPopup.addButtonTitle").getString() : ""; + } + }; + } + + private boolean isAssignButtonEnabled(){ + TabbedPanel tabbedPanel = getTabbedPanel(); + List tabs = tabbedPanel.getTabs().getObject(); + for (ITab tab : tabs){ + WebMarkupContainer assignmentPanel = ((PanelTab)tab).getPanel(); + if (assignmentPanel == null){ + continue; + } + if (((AbstractAssignmentPopupTabPanel) assignmentPanel).getSelectedObjectsList().size() > 0) { + return true; + } + } + return false; + } + + protected IModel getWarningMessageModel(){ + return null; + } + + public int getWidth(){ + return 80; + } + + public int getHeight(){ + return 80; + } + + @Override + public String getWidthUnit(){ + return "%"; + } + + @Override + public String getHeightUnit(){ + return "%"; + } + + public StringResourceModel getTitle(){ + return createStringResource("TypedAssignablePanel.selectObjects"); + } + + public Component getComponent(){ + return this; + } +} diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/PageAdminObjectDetails.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/PageAdminObjectDetails.java index 88bcfd8807d..4c33bf4775b 100755 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/PageAdminObjectDetails.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/PageAdminObjectDetails.java @@ -569,6 +569,11 @@ protected ObjectQuery addFilterToContentQuery(ObjectQuery query){ }); return tabs; } + + @Override + protected IModel getWarningMessageModel(){ + return createStringResource("PageAdminObjectDetails.button.changeArchetype.warningMessage"); + } }; changeArchetypePopup.setOutputMarkupPlaceholderTag(true); From 085144ff0bfaa2744013aeb94909b9618ee51c76 Mon Sep 17 00:00:00 2001 From: lskublik Date: Tue, 14 Apr 2020 19:38:17 +0200 Subject: [PATCH 4/9] adding schrodinger tests for labs of demo 101 and resolving some bugs from testing --- .../gui/api/component/ObjectListPanel.java | 6 +- .../admin/resources/ResourceContentPanel.java | 44 +- ...icy-generate-without-limit-with-unique.xml | 33 + .../schrodinger/AbstractSchrodingerTest.java | 21 +- .../schrodinger/labs/AbstractLabTest.java | 150 ++++ .../labs/AccountsAssignmentsAndRoles.java | 271 +++++++ .../labs/BasicProvisioningTest.java | 128 ---- .../labs/ConfiguringMultipleAccountTypes.java | 107 +++ .../schrodinger/labs/ImportResourceTest.java | 154 ---- .../labs/ProvisioningToResources.java | 326 +++++++++ .../ResourcesAttributesAndMappingsTest.java | 239 ++++++ .../labs/SynchronizationFlavours.java | 49 ++ .../scenarios/OrgMembersTests.java | 6 +- .../scenarios/ScenariosCommons.java | 2 +- .../policy-nonce-reset-pass.xml | 2 +- .../objects/valuepolicies/mail-nonce.xml | 2 +- .../objects/archetypes/archetype-employee.xml | 31 + .../objects/archetypes/archetype-external.xml | 31 + ...ocalhost-csvfile-1-document-access-4-2.xml | 464 ++++++++++++ ...ocalhost-csvfile-1-document-access-4-3.xml | 470 ++++++++++++ ...ocalhost-csvfile-1-document-access-5-5.xml | 462 ++++++++++++ ...ocalhost-csvfile-1-document-access-6-1.xml | 454 ++++++++++++ ...lhost-csvfile-1-document-access-simple.xml | 208 ++++++ .../localhost-csvfile-1-document-access.xml | 311 +++----- .../localhost-csvfile-2-canteen-5-5.xml | 263 +++++++ .../resources/localhost-csvfile-2-canteen.xml | 271 +++++++ .../localhost-csvfile-3-ldap-4-2.xml | 536 ++++++++++++++ .../localhost-csvfile-3-ldap-4-4.xml | 559 ++++++++++++++ .../localhost-csvfile-3-ldap-5-5.xml | 551 ++++++++++++++ .../localhost-csvfile-3-ldap-6-1.xml | 543 ++++++++++++++ .../resources/localhost-csvfile-3-ldap.xml | 542 ++++++++++++++ .../labs/objects/roles/role-csv1-tester.xml | 24 + .../labs/objects/roles/role-csv3-admin.xml | 24 + .../labs/objects/roles/role-incognito.xml | 65 ++ .../objects/roles/role-internal-employee.xml | 47 ++ .../labs/objects/roles/role-secret-i.xml | 33 + .../labs/objects/roles/role-secret-ii.xml | 33 + .../labs/objects/roles/role-top-secret-i.xml | 37 + .../system-configuration-5-7.xml | 680 ++++++++++++++++++ .../numeric-pin-first-nonzero-policy.xml | 44 ++ .../test/resources/labs/resources/csv-1.csv | 6 - .../labs/schema/extension-example.xsd | 77 ++ .../src/test/resources/labs/sources/csv-1.csv | 18 + .../src/test/resources/labs/sources/csv-2.csv | 14 + .../src/test/resources/labs/sources/csv-3.csv | 18 + .../schrodingertest/testng-integration.xml | 8 + tools/schrodinger/pom.xml | 12 + .../schrodinger/component/AssignmentsTab.java | 54 +- .../schrodinger/component/InducementsTab.java | 77 ++ .../schrodinger/component/ProjectionsTab.java | 5 +- .../archetype/ArchetypePolicyTab.java | 22 + .../AssignmentHolderObjectListTable.java | 2 +- .../schrodinger/component/common/Popover.java | 6 + .../component/common/PrismForm.java | 39 + .../schrodinger/component/common/Search.java | 30 +- .../component/common/table/Table.java | 4 +- .../resource/ResourceAccountsTab.java | 6 + .../resource/ResourceShadowTable.java | 17 +- .../table/DirectIndirectAssignmentTable.java | 48 ++ .../component/user/UserHistoryTab.java | 44 +- .../component/user/UsersPageTable.java | 5 +- .../schrodinger/page/AbstractRolePage.java | 25 + .../midpoint/schrodinger/page/BasicPage.java | 18 +- .../midpoint/schrodinger/page/FocusPage.java | 113 +++ .../page/archetype/ArchetypePage.java | 46 ++ .../page/archetype/ListArchetypesPage.java | 30 + .../org/{NewOrgPage.java => OrgPage.java} | 24 +- .../page/resource/AccountPage.java | 46 ++ .../EditResourceConfigurationPage.java | 2 +- .../page/resource/ViewResourcePage.java | 4 +- .../schrodinger/page/role/NewRolePage.java | 15 - .../schrodinger/page/role/RolePage.java | 38 + .../schrodinger/page/user/ListUsersPage.java | 30 + .../schrodinger/page/user/UserPage.java | 83 +-- .../midpoint/schrodinger/util/Utils.java | 55 ++ 75 files changed, 8595 insertions(+), 669 deletions(-) create mode 100644 model/model-impl/src/test/resources/lens/ppolicy/value-policy-generate-without-limit-with-unique.xml create mode 100644 testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/AbstractLabTest.java create mode 100644 testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/AccountsAssignmentsAndRoles.java delete mode 100644 testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/BasicProvisioningTest.java create mode 100644 testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/ConfiguringMultipleAccountTypes.java delete mode 100644 testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/ImportResourceTest.java create mode 100644 testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/ProvisioningToResources.java create mode 100644 testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/ResourcesAttributesAndMappingsTest.java create mode 100644 testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/SynchronizationFlavours.java create mode 100644 testing/schrodingertest/src/test/resources/labs/objects/archetypes/archetype-employee.xml create mode 100644 testing/schrodingertest/src/test/resources/labs/objects/archetypes/archetype-external.xml create mode 100644 testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-1-document-access-4-2.xml create mode 100644 testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-1-document-access-4-3.xml create mode 100644 testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-1-document-access-5-5.xml create mode 100644 testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-1-document-access-6-1.xml create mode 100644 testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-1-document-access-simple.xml rename testing/schrodingertest/src/test/resources/labs/{ => objects}/resources/localhost-csvfile-1-document-access.xml (62%) create mode 100644 testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-2-canteen-5-5.xml create mode 100644 testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-2-canteen.xml create mode 100644 testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-3-ldap-4-2.xml create mode 100644 testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-3-ldap-4-4.xml create mode 100644 testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-3-ldap-5-5.xml create mode 100644 testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-3-ldap-6-1.xml create mode 100644 testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-3-ldap.xml create mode 100644 testing/schrodingertest/src/test/resources/labs/objects/roles/role-csv1-tester.xml create mode 100644 testing/schrodingertest/src/test/resources/labs/objects/roles/role-csv3-admin.xml create mode 100644 testing/schrodingertest/src/test/resources/labs/objects/roles/role-incognito.xml create mode 100644 testing/schrodingertest/src/test/resources/labs/objects/roles/role-internal-employee.xml create mode 100644 testing/schrodingertest/src/test/resources/labs/objects/roles/role-secret-i.xml create mode 100644 testing/schrodingertest/src/test/resources/labs/objects/roles/role-secret-ii.xml create mode 100644 testing/schrodingertest/src/test/resources/labs/objects/roles/role-top-secret-i.xml create mode 100644 testing/schrodingertest/src/test/resources/labs/objects/systemConfiguration/system-configuration-5-7.xml create mode 100644 testing/schrodingertest/src/test/resources/labs/objects/valuePolicies/numeric-pin-first-nonzero-policy.xml delete mode 100644 testing/schrodingertest/src/test/resources/labs/resources/csv-1.csv create mode 100644 testing/schrodingertest/src/test/resources/labs/schema/extension-example.xsd create mode 100644 testing/schrodingertest/src/test/resources/labs/sources/csv-1.csv create mode 100644 testing/schrodingertest/src/test/resources/labs/sources/csv-2.csv create mode 100644 testing/schrodingertest/src/test/resources/labs/sources/csv-3.csv create mode 100644 tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/InducementsTab.java create mode 100644 tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/archetype/ArchetypePolicyTab.java create mode 100644 tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/table/DirectIndirectAssignmentTable.java create mode 100644 tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/AbstractRolePage.java create mode 100644 tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/FocusPage.java create mode 100644 tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/archetype/ArchetypePage.java create mode 100644 tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/archetype/ListArchetypesPage.java rename tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/org/{NewOrgPage.java => OrgPage.java} (51%) create mode 100644 tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/resource/AccountPage.java delete mode 100644 tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/role/NewRolePage.java create mode 100644 tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/role/RolePage.java diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/api/component/ObjectListPanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/api/component/ObjectListPanel.java index 5f3738aad56..51683c19258 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/api/component/ObjectListPanel.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/api/component/ObjectListPanel.java @@ -160,7 +160,7 @@ private void initLayout() { } - private LoadableModel initSearchModel(){ + protected LoadableModel initSearchModel(){ return new LoadableModel(false) { private static final long serialVersionUID = 1L; @@ -192,7 +192,7 @@ public Search load() { }; } - private String getSearchByNameParameterValue() { + protected String getSearchByNameParameterValue() { PageParameters parameters = getPageBase().getPageParameters(); if (parameters == null) { return null; @@ -628,7 +628,7 @@ protected String getStorageKey(){ return key; } - private PageStorage getPageStorage(String storageKey){ + protected PageStorage getPageStorage(String storageKey){ PageStorage storage = getSession().getSessionStorage().getPageStorageMap().get(storageKey); if (storage == null) { storage = getSession().getSessionStorage().initPageStorage(storageKey); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/ResourceContentPanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/ResourceContentPanel.java index 491043c4fa1..d0f79b92a49 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/ResourceContentPanel.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/ResourceContentPanel.java @@ -6,14 +6,12 @@ */ package com.evolveum.midpoint.web.page.admin.resources; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; +import java.util.*; import javax.xml.namespace.QName; import com.evolveum.midpoint.gui.api.component.PendingOperationPanel; +import com.evolveum.midpoint.gui.api.model.LoadableModel; import com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView; import com.evolveum.midpoint.prism.delta.*; import com.evolveum.midpoint.prism.path.ItemPath; @@ -22,10 +20,13 @@ import com.evolveum.midpoint.schema.constants.ObjectTypes; import com.evolveum.midpoint.util.MiscUtil; import com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem; +import com.evolveum.midpoint.web.component.search.SearchItem; +import com.evolveum.midpoint.web.component.search.SearchValue; import com.evolveum.midpoint.web.component.util.SelectableBean; import com.evolveum.midpoint.web.page.admin.server.PageTask; import com.evolveum.midpoint.web.page.admin.server.PageTasks; import com.evolveum.midpoint.web.security.util.SecurityUtils; +import com.evolveum.midpoint.web.session.PageStorage; import com.evolveum.midpoint.xml.ns._public.common.common_3.*; import org.apache.commons.lang.StringUtils; @@ -294,6 +295,41 @@ protected ObjectQuery createContentQuery() { return queryFactory.createQuery(queryFactory.createAnd(filters)); } + @Override + protected LoadableModel initSearchModel() { + return new LoadableModel(false) { + + private static final long serialVersionUID = 1L; + + @Override + public Search load() { + String storageKey = getStorageKey(); + Search search = null; + if (org.apache.commons.lang3.StringUtils.isNotEmpty(storageKey)) { + PageStorage storage = getPageStorage(storageKey); + if (storage != null) { + search = storage.getSearch(); + } + } + Search newSearch = createSearch(); + if (search == null + || !search.getAvailableDefinitions().containsAll(newSearch.getAvailableDefinitions())) { + search = newSearch; + } + + String searchByName = getSearchByNameParameterValue(); + if (searchByName != null) { + for (SearchItem item : search.getItems()) { + if (ItemPath.create(ObjectType.F_NAME).equivalent(item.getPath())) { + item.setValues(Collections.singletonList(new SearchValue(searchByName))); + } + } + } + return search; + } + }; + } + @Override protected Search createSearch() { return ResourceContentPanel.this.createSearch(); diff --git a/model/model-impl/src/test/resources/lens/ppolicy/value-policy-generate-without-limit-with-unique.xml b/model/model-impl/src/test/resources/lens/ppolicy/value-policy-generate-without-limit-with-unique.xml new file mode 100644 index 00000000000..bc00a2bb9c8 --- /dev/null +++ b/model/model-impl/src/test/resources/lens/ppolicy/value-policy-generate-without-limit-with-unique.xml @@ -0,0 +1,33 @@ + + + + + + Numeric PIN Policy + numeric pin policy + + A policy useful for generating long password without limit, but with more unique characters. + + String validation policy + + 30 + 29 + + + + diff --git a/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/AbstractSchrodingerTest.java b/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/AbstractSchrodingerTest.java index cf7216ffcdc..89609315e04 100644 --- a/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/AbstractSchrodingerTest.java +++ b/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/AbstractSchrodingerTest.java @@ -15,6 +15,12 @@ import com.codeborne.selenide.Selenide; import com.codeborne.selenide.testng.BrowserPerClass; + +import com.evolveum.midpoint.schrodinger.component.AssignmentsTab; + +import com.evolveum.midpoint.schrodinger.component.common.table.AbstractTableWithPrismView; +import com.evolveum.midpoint.schrodinger.page.AssignmentHolderDetailsPage; + import org.apache.commons.io.FileUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -56,17 +62,17 @@ public abstract class AbstractSchrodingerTest extends AbstractIntegrationTest { protected static final String CSV_RESOURCE_ATTR_UNIQUE = "Unique attribute name"; - private static final String SCHRODINGER_PROPERTIES = "./src/test/resources/configuration/schrodinger.properties"; + protected static final String SCHRODINGER_PROPERTIES = "./src/test/resources/configuration/schrodinger.properties"; private static final Logger LOG = LoggerFactory.getLogger(AbstractSchrodingerTest.class); protected static File csvTargetDir; - private EnvironmentConfiguration configuration; + protected EnvironmentConfiguration configuration; - private String username; + protected String username; - private String password; + protected String password; protected MidPoint midPoint; @@ -105,7 +111,7 @@ public void beforeClass() throws IOException { basicPage = login.loginIfUserIsNotLog(username, password); } - private EnvironmentConfiguration buildEnvironmentConfiguration(Properties props) { + protected EnvironmentConfiguration buildEnvironmentConfiguration(Properties props) { EnvironmentConfiguration config = new EnvironmentConfiguration(); config.driver(WebDriver.valueOf(props.getProperty("webdriver"))); @@ -246,8 +252,8 @@ public void changeResourceAttribute(String resourceName, String attributeName, S ResourceConfigurationTab resourceConfigurationTab = viewResourcePage .clickEditResourceConfiguration(); Selenide.screenshot("afterEditConfigurationClick"); - Selenide.sleep(60000); - Selenide.screenshot("afterMinuteSleep"); + Selenide.sleep(MidPoint.TIMEOUT_MEDIUM_6_S); + Selenide.screenshot("afterSixSecondsSleep"); Assert.assertTrue(resourceConfigurationTab .form() @@ -278,5 +284,4 @@ public void changeResourceAttribute(String resourceName, String attributeName, S } } - } diff --git a/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/AbstractLabTest.java b/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/AbstractLabTest.java new file mode 100644 index 00000000000..88ac2a83ba6 --- /dev/null +++ b/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/AbstractLabTest.java @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2010-2019 Evolveum and contributors + * + * This work is dual-licensed under the Apache License 2.0 + * and European Union Public License. See LICENSE file for details. + */ +package com.evolveum.midpoint.testing.schrodinger.labs; + +import com.codeborne.selenide.Selenide; + +import com.evolveum.midpoint.schrodinger.MidPoint; +import com.evolveum.midpoint.schrodinger.component.assignmentholder.AssignmentHolderObjectListTable; +import com.evolveum.midpoint.schrodinger.component.resource.ResourceAccountsTab; +import com.evolveum.midpoint.schrodinger.component.resource.ResourceShadowTable; +import com.evolveum.midpoint.schrodinger.page.configuration.AboutPage; +import com.evolveum.midpoint.schrodinger.page.resource.AccountPage; +import com.evolveum.midpoint.schrodinger.page.resource.ViewResourcePage; +import com.evolveum.midpoint.schrodinger.page.user.ListUsersPage; +import com.evolveum.midpoint.schrodinger.page.user.UserPage; +import com.evolveum.midpoint.testing.schrodinger.AbstractSchrodingerTest; +import com.evolveum.midpoint.testing.schrodinger.scenarios.SynchronizationTests; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testng.annotations.AfterClass; + +import java.io.File; +import java.util.Arrays; +import java.util.List; + +/** + * @author skublik + */ + +public class AbstractLabTest extends AbstractSchrodingerTest { + + private static final Logger LOG = LoggerFactory.getLogger(AbstractLabTest.class); + + protected static final String LAB_DIRECTORY = "./src/test/resources/labs/"; + protected static final String LAB_OBJECTS_DIRECTORY = LAB_DIRECTORY + "objects/"; + protected static final String LAB_SOURCES_DIRECTORY = LAB_DIRECTORY + "sources/"; + + protected static final File EXTENSION_SCHEMA_FILE = new File(LAB_DIRECTORY +"schema/extension-example.xsd"); + protected static final File CSV_1_SIMPLE_RESOURCE_FILE = new File(LAB_OBJECTS_DIRECTORY + "resources/localhost-csvfile-1-document-access-simple.xml"); + protected static final File CSV_1_RESOURCE_FILE = new File(LAB_OBJECTS_DIRECTORY + "resources/localhost-csvfile-1-document-access.xml"); + protected static final File CSV_1_SOURCE_FILE = new File(LAB_SOURCES_DIRECTORY + "csv-1.csv"); + protected static final File NUMERIC_PIN_FIRST_NONZERO_POLICY_FILE = new File(LAB_OBJECTS_DIRECTORY + "valuePolicies/numeric-pin-first-nonzero-policy.xml"); + protected static final File CSV_2_RESOURCE_FILE = new File(LAB_OBJECTS_DIRECTORY + "resources/localhost-csvfile-2-canteen.xml"); + protected static final File CSV_2_SOURCE_FILE = new File(LAB_SOURCES_DIRECTORY + "csv-2.csv"); + protected static final File CSV_3_RESOURCE_FILE = new File(LAB_OBJECTS_DIRECTORY + "resources/localhost-csvfile-3-ldap.xml"); + protected static final File CSV_3_SOURCE_FILE = new File(LAB_SOURCES_DIRECTORY + "csv-3.csv"); + + protected static final String DIRECTORY_CURRENT_TEST = "labTests"; + protected static final String EXTENSION_SCHEMA_NAME = "extension-example.xsd"; + protected static final String CSV_1_FILE_SOURCE_NAME = "csv-1.csv"; + protected static final String CSV_1_RESOURCE_NAME = "CSV-1 (Document Access)"; + protected static final String CSV_2_FILE_SOURCE_NAME = "csv-2.csv"; + protected static final String CSV_2_RESOURCE_NAME = "CSV-2 (Canteen Ordering System)"; + protected static final String CSV_3_FILE_SOURCE_NAME = "csv-3.csv"; + protected static final String CSV_3_RESOURCE_NAME = "CSV-3 (LDAP)"; + + protected static final String PASSWORD_ATTRIBUTE_RESOURCE_KEY = "User password attribute name"; + protected static final String UNIQUE_ATTRIBUTE_RESOURCE_KEY = "Unique attribute name"; + + protected static final String CSV_1_UNIQUE_ATTRIBUTE_NAME = "login"; + protected static final String CSV_1_PASSWORD_ATTRIBUTE_NAME = "password"; + protected static final String CSV_1_ACCOUNT_OBJECT_CLASS_LINK = "AccountObjectClass (Default Account)"; + + protected static final List CSV_1_RESOURCE_ATTRIBUTES = Arrays.asList("login", "lname", "groups", "enumber", "phone", "dep", "fname", "dis"); + + protected static File csv1TargetFile; + protected static File csv2TargetFile; + protected static File csv3TargetFile; + + @AfterClass + @Override + public void afterClass() { + LOG.info("Finished tests from class {}", getClass().getName()); + + Selenide.clearBrowserCookies(); + Selenide.clearBrowserLocalStorage(); + Selenide.close(); + } + + public UserPage showUser(String userName){ + UserPage user = showUserInTable(userName).clickByName(userName); + Selenide.sleep(MidPoint.TIMEOUT_DEFAULT_2_S); + return user; + } + + public AssignmentHolderObjectListTable showUserInTable(String userName) { + return basicPage.listUsers() + .table() + .search() + .byName() + .inputValue(userName) + .updateSearch() + .and(); + } + + public AccountPage showShadow(String resourceName, String searchedItem, String itemValue){ + return showShadow(resourceName, searchedItem, itemValue, null, false); + } + + public AccountPage showShadow(String resourceName, String searchedItem, String itemValue, String intent, boolean useRepository){ + return getShadowTable(resourceName, searchedItem, itemValue, intent, useRepository) + .clickByName(itemValue); + } + + public boolean existShadow(String resourceName, String searchedItem, String itemValue){ + return existShadow(resourceName, searchedItem, itemValue, null, false); + } + + public boolean existShadow(String resourceName, String searchedItem, String itemValue, String intent, boolean useRepository){ + ResourceShadowTable table = getShadowTable(resourceName, searchedItem, itemValue, intent, useRepository); + return table.containsText(itemValue); + } + public ResourceShadowTable getShadowTable(String resourceName, String searchedItem, String itemValue) { + return getShadowTable(resourceName, searchedItem, itemValue, null, false); + } + + public ResourceShadowTable getShadowTable(String resourceName, String searchedItem, String itemValue, String intent, boolean useRepository) { + ResourceAccountsTab tab = basicPage.listResources() + .table() + .search() + .byName() + .inputValue(resourceName) + .updateSearch() + .and() + .clickByName(resourceName) + .clickAccountsTab(); + if (useRepository) { + tab.clickSearchInRepository(); + } else { + tab.clickSearchInResource(); + } + Selenide.sleep(1000); + if (intent != null && !intent.isBlank()) { + tab.setIntent(intent); + Selenide.sleep(MidPoint.TIMEOUT_DEFAULT_2_S); + } + return tab.table() + .search() + .resetBasicSearch() + .byItem(searchedItem) + .inputValueWithEnter(itemValue) + .and() + .and(); + } +} diff --git a/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/AccountsAssignmentsAndRoles.java b/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/AccountsAssignmentsAndRoles.java new file mode 100644 index 00000000000..3654bc79169 --- /dev/null +++ b/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/AccountsAssignmentsAndRoles.java @@ -0,0 +1,271 @@ +/* + * Copyright (c) 2010-2019 Evolveum and contributors + * + * This work is dual-licensed under the Apache License 2.0 + * and European Union Public License. See LICENSE file for details. + */ +package com.evolveum.midpoint.testing.schrodinger.labs; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; + +import com.codeborne.selenide.Selenide; + +import com.evolveum.midpoint.schema.SchemaConstantsGenerated; +import com.evolveum.midpoint.schrodinger.MidPoint; +import com.evolveum.midpoint.schrodinger.component.AssignmentHolderBasicTab; +import com.evolveum.midpoint.schrodinger.component.AssignmentsTab; +import com.evolveum.midpoint.schrodinger.component.InducementsTab; +import com.evolveum.midpoint.schrodinger.component.common.PrismForm; +import com.evolveum.midpoint.schrodinger.component.common.table.AbstractTableWithPrismView; +import com.evolveum.midpoint.schrodinger.component.table.DirectIndirectAssignmentTable; +import com.evolveum.midpoint.schrodinger.page.AbstractRolePage; +import com.evolveum.midpoint.schrodinger.page.archetype.ArchetypePage; +import com.evolveum.midpoint.schrodinger.page.resource.AccountPage; +import com.evolveum.midpoint.schrodinger.page.user.UserPage; +import com.evolveum.midpoint.schrodinger.util.Utils; + +import com.evolveum.midpoint.testing.schrodinger.scenarios.ScenariosCommons; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType; + +import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testng.Assert; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import javax.xml.namespace.QName; + +/** + * @author skublik + */ + +public class AccountsAssignmentsAndRoles extends AbstractLabTest { + + private static final Logger LOG = LoggerFactory.getLogger(AccountsAssignmentsAndRoles.class); + + private static final File INCOGNITO_ROLE_FILE = new File(LAB_OBJECTS_DIRECTORY + "roles/role-incognito.xml"); + private static final File INTERNAL_EMPLOYEE_ROLE_FILE = new File(LAB_OBJECTS_DIRECTORY + "roles/role-internal-employee.xml"); + private static final File SECRET_I_ROLE_FILE = new File(LAB_OBJECTS_DIRECTORY + "roles/role-secret-i.xml"); + private static final File SECRET_II_ROLE_FILE = new File(LAB_OBJECTS_DIRECTORY + "roles/role-secret-ii.xml"); + private static final File TOP_SECRET_I_ROLE_FILE = new File(LAB_OBJECTS_DIRECTORY + "roles/role-top-secret-i.xml"); + private static final File CSV_1_RESOURCE_FILE_5_5 = new File(LAB_OBJECTS_DIRECTORY + "resources/localhost-csvfile-1-document-access-5-5.xml"); + private static final File CSV_2_RESOURCE_FILE_5_5 = new File(LAB_OBJECTS_DIRECTORY + "resources/localhost-csvfile-2-canteen-5-5.xml"); + private static final File CSV_3_RESOURCE_FILE_5_5 = new File(LAB_OBJECTS_DIRECTORY + "resources/localhost-csvfile-3-ldap-5-5.xml"); + private static final File ARCHETYPE_EMPLOYEE_FILE = new File(LAB_OBJECTS_DIRECTORY + "archetypes/archetype-employee.xml"); + private static final String ARCHETYPE_EMPLOYEE_NAME = "Employee"; + private static final String ARCHETYPE_EMPLOYEE_LABEL = "Employee"; + private static final String ARCHETYPE_EMPLOYEE_PLURAL_LABEL = "Employees"; + private static final File ARCHETYPE_EXTERNAL_FILE = new File(LAB_OBJECTS_DIRECTORY + "archetypes/archetype-external.xml"); + private static final File SYSTEM_CONFIGURATION_FILE_5_7 = new File(LAB_OBJECTS_DIRECTORY + "systemConfiguration/system-configuration-5-7.xml"); + + @Test + public void test0501UsingRBAC() { + importObject(INTERNAL_EMPLOYEE_ROLE_FILE,true); + importObject(INCOGNITO_ROLE_FILE,true); + importObject(SECRET_I_ROLE_FILE,true); + importObject(SECRET_II_ROLE_FILE,true); + importObject(TOP_SECRET_I_ROLE_FILE,true); + + Utils.addAsignments(showUser("kirk").selectTabAssignments(), "Secret Projects I", "Secret Projects II"); + Assert.assertTrue( + showShadow(CSV_1_RESOURCE_NAME, "Login", "jkirk") + .form() + .compareInputAttributeValues("groups", "Lucky Numbers", + "Teleportation", "Time Travel", "Presidential Candidates Motivation")); + + Utils.removeAssignments(showUser("kirk").selectTabAssignments(), "Secret Projects I"); + + Assert.assertTrue( + showShadow(CSV_1_RESOURCE_NAME, "Login", "jkirk") + .form() + .compareInputAttributeValues("groups", "Lucky Numbers", + "Presidential Candidates Motivation")); + + Utils.removeAssignments(showUser("kirk").selectTabAssignments(), "Secret Projects II"); + + Assert.assertFalse(existShadow(CSV_1_RESOURCE_NAME, "Login", "jkirk")); + + Utils.addAsignments(showUser("kirk").selectTabAssignments(), "Internal Employee"); + + Assert.assertTrue(existShadow(CSV_1_RESOURCE_NAME, "Login", "jkirk")); + Assert.assertTrue(existShadow(CSV_2_RESOURCE_NAME, "Login", "jkirk")); + Assert.assertTrue(existShadow(CSV_3_RESOURCE_NAME, "Distinguished Name", + "cn=Jim Tiberius Kirk,ou=ExAmPLE,dc=example,dc=com")); + + } + + @Test(dependsOnMethods = {"test0501UsingRBAC"}) + public void test0502SegregationOfDuties() { + showUser("kirk").selectTabAssignments() + .clickAddAssignemnt() + .table() + .search() + .byName() + .inputValue("Incognito") + .updateSearch() + .and() + .selectCheckboxByName("Incognito") + .and() + .clickAdd() + .and() + .clickSave() + .feedback() + .isError(); + } + + @Test(dependsOnMethods = {"test0502SegregationOfDuties"}) + public void test0504CreatingRoles() { + InducementsTab tab = basicPage.newRole() + .selectTabBasic() + .form() + .addAttributeValue(RoleType.F_NAME, "Too Many Secrets") + .addAttributeValue(RoleType.F_DISPLAY_NAME, "Too Many Secrets") + .and() + .and() + .selectTabInducements(); + Utils.addAsignments(tab, "Secret Projects I", "Secret Projects II", "Top Secret Projects I"); + + Utils.addAsignments(showUser("kirk").selectTabAssignments(), "Too Many Secrets"); + Assert.assertTrue(existShadow(CSV_1_RESOURCE_NAME, "Login", "jkirk")); + + DirectIndirectAssignmentTable> table = showUser("kirk").selectTabAssignments() + .selectTypeAllDirectIndirect(); + Selenide.sleep(MidPoint.TIMEOUT_MEDIUM_6_S); + Assert.assertTrue(table.containsIndirectAssignments("Secret Projects I", + "Secret Projects II", "Top Secret Projects I", CSV_1_RESOURCE_NAME, CSV_2_RESOURCE_NAME, + CSV_3_RESOURCE_NAME)); + + Utils.removeAssignments(showUser("kirk").selectTabAssignments(), "Too Many Secrets"); + } + + @Test(dependsOnMethods = {"test0504CreatingRoles"}) + public void test0505DisableOnUnassign() { + importObject(CSV_1_RESOURCE_FILE_5_5,true); + changeResourceAttribute(CSV_1_RESOURCE_NAME, ScenariosCommons.CSV_RESOURCE_ATTR_FILE_PATH, csv1TargetFile.getAbsolutePath(), true); + + importObject(CSV_2_RESOURCE_FILE_5_5,true); + changeResourceAttribute(CSV_2_RESOURCE_NAME, ScenariosCommons.CSV_RESOURCE_ATTR_FILE_PATH, csv2TargetFile.getAbsolutePath(), true); + + importObject(CSV_3_RESOURCE_FILE_5_5,true); + changeResourceAttribute(CSV_3_RESOURCE_NAME, ScenariosCommons.CSV_RESOURCE_ATTR_FILE_PATH, csv3TargetFile.getAbsolutePath(), true); + + Utils.removeAssignments(showUser("kirk").selectTabAssignments(), "Internal Employee"); + + AccountPage shadow = showShadow(CSV_1_RESOURCE_NAME, "Login", "jkirk"); + Selenide.sleep(2000); + PrismForm accountForm = shadow.form(); + Assert.assertTrue(accountForm.compareSelectAttributeValue("administrativeStatus", "Disabled")); + Assert.assertTrue(accountForm.showEmptyAttributes("Attributes") + .compareInputAttributeValues("groups", new ArrayList())); + + showShadow(CSV_2_RESOURCE_NAME, "Login", "jkirk"); + Assert.assertTrue(accountForm.compareSelectAttributeValue("administrativeStatus", "Disabled")); + + showShadow(CSV_3_RESOURCE_NAME, "Distinguished Name", "cn=Jim Tiberius Kirk,ou=ExAmPLE,dc=example,dc=com"); + Assert.assertTrue(accountForm.compareSelectAttributeValue("administrativeStatus", "Disabled")); + + Utils.addAsignments(showUser("kirk").selectTabAssignments(), "Internal Employee"); + showShadow(CSV_1_RESOURCE_NAME, "Login", "jkirk"); + Assert.assertTrue(accountForm.compareSelectAttributeValue("administrativeStatus", "Enabled")); + Assert.assertTrue( + accountForm.compareInputAttributeValues("groups", "Internal Employees", + "Essential Documents")); + + showShadow(CSV_2_RESOURCE_NAME, "Login", "jkirk"); + Assert.assertTrue(accountForm.compareSelectAttributeValue("administrativeStatus", "Enabled")); + + showShadow(CSV_3_RESOURCE_NAME, "Distinguished Name", "cn=Jim Tiberius Kirk,ou=ExAmPLE,dc=example,dc=com"); + Assert.assertTrue(accountForm.compareSelectAttributeValue("administrativeStatus", "Enabled")); + } + + @Test(dependsOnMethods = {"test0505DisableOnUnassign"}) + public void test0506InactiveAssignment() { + Utils.addAsignments(showUser("kirk").selectTabAssignments(), "Too Many Secrets"); + AccountPage shadow = showShadow(CSV_1_RESOURCE_NAME, "Login", "jkirk"); + Selenide.sleep(MidPoint.TIMEOUT_DEFAULT_2_S); + PrismForm accountForm = shadow.form(); + Assert.assertTrue( + accountForm.compareInputAttributeValues("groups", "Internal Employees", + "Essential Documents", "Lucky Numbers", "Teleportation", + "Time Travel", "Presidential Candidates Motivation", + "Area 52 Managers", "Area 52 News Obfuscators", "Abduction Professional Services", + "Immortality Training", "Telekinesis In Practice", "IDDQD")); + Assert.assertTrue( + accountForm.compareInputAttributeValues("groups", "Lucky Numbers", + "Teleportation", "Time Travel", "Presidential Candidates Motivation")); + + Utils.setStatusForAssignment(showUser("kirk").selectTabAssignments(), "Too Many Secrets", "Disabled"); + + showShadow(CSV_1_RESOURCE_NAME, "Login", "jkirk"); + Assert.assertTrue(accountForm.compareSelectAttributeValue("administrativeStatus", "Enabled")); + Assert.assertTrue( + accountForm.compareInputAttributeValues("groups", "Internal Employees", "Essential Documents")); + + showShadow(CSV_2_RESOURCE_NAME, "Login", "jkirk"); + Assert.assertTrue(accountForm.compareSelectAttributeValue("administrativeStatus", "Enabled")); + + showShadow(CSV_3_RESOURCE_NAME, "Distinguished Name", "cn=Jim Tiberius Kirk,ou=ExAmPLE,dc=example,dc=com"); + Assert.assertTrue(accountForm.compareSelectAttributeValue("administrativeStatus", "Enabled")); + + Utils.setStatusForAssignment(showUser("kirk").selectTabAssignments(), "Internal Employee", "Disabled"); + + showShadow(CSV_1_RESOURCE_NAME, "Login", "jkirk"); + Assert.assertTrue(accountForm.compareSelectAttributeValue("administrativeStatus", "Disabled")); + Assert.assertTrue(accountForm.showEmptyAttributes("Attributes") + .compareInputAttributeValues("groups", new ArrayList())); + + showShadow(CSV_2_RESOURCE_NAME, "Login", "jkirk"); + Assert.assertTrue(accountForm.compareSelectAttributeValue("administrativeStatus", "Disabled")); + + showShadow(CSV_3_RESOURCE_NAME, "Distinguished Name", "cn=Jim Tiberius Kirk,ou=ExAmPLE,dc=example,dc=com"); + Assert.assertTrue(accountForm.compareSelectAttributeValue("administrativeStatus", "Disabled")); + + Utils.setStatusForAssignment(showUser("kirk").selectTabAssignments(), "Internal Employee", "Undefined"); + Utils.removeAssignments(showUser("kirk").selectTabAssignments(), "Too Many Secrets"); + } + + @Test(dependsOnMethods = {"test0506InactiveAssignment"}) + public void test0507ArchetypesIntroduction() { + + importObject(ARCHETYPE_EMPLOYEE_FILE, true); + importObject(ARCHETYPE_EXTERNAL_FILE, true); + + PrismForm> archetypePolicyForm = basicPage.listArchetypes() + .table() + .clickByName(ARCHETYPE_EMPLOYEE_NAME) + .selectTabArchetypePolicy() + .form(); + + Assert.assertTrue(archetypePolicyForm.compareInputAttributeValue("label", ARCHETYPE_EMPLOYEE_LABEL)); + Assert.assertTrue(archetypePolicyForm.compareInputAttributeValue("pluralLabel", ARCHETYPE_EMPLOYEE_PLURAL_LABEL)); + Assert.assertTrue(archetypePolicyForm.compareInputAttributeValue("cssClass", "fa fa-user")); + Assert.assertTrue(archetypePolicyForm.compareInputAttributeValue("color", "darkgreen")); + + importObject(SYSTEM_CONFIGURATION_FILE_5_7, true); + + basicPage.listUsers().newUser(ARCHETYPE_EMPLOYEE_LABEL) + .selectTabBasic() + .form() + .addAttributeValue(UserType.F_NAME, "janeway") + .addAttributeValue(UserType.F_GIVEN_NAME, "Kathryn") + .addAttributeValue(UserType.F_FAMILY_NAME, "Janeway") + .setDropDownAttributeValue(ActivationType.F_ADMINISTRATIVE_STATUS, "Enabled") + .setPasswordFieldsValues(new QName(SchemaConstantsGenerated.NS_COMMON, "value"), "abc123") + .and() + .and() + .clickSave() + .feedback() + .isSuccess(); + + AssignmentsTab assigmentsTab = showUser("janeway") + .selectTabAssignments(); + Assert.assertFalse(assigmentsTab.table().containsText(ARCHETYPE_EMPLOYEE_NAME)); + Utils.addAsignments(assigmentsTab, "Secret Projects I"); + } +} diff --git a/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/BasicProvisioningTest.java b/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/BasicProvisioningTest.java deleted file mode 100644 index 31a9a6c151f..00000000000 --- a/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/BasicProvisioningTest.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2010-2019 Evolveum and contributors - * - * This work is dual-licensed under the Apache License 2.0 - * and European Union Public License. See LICENSE file for details. - */ -package com.evolveum.midpoint.testing.schrodinger.labs; - -import static com.codeborne.selenide.Selenide.$; - -import javax.xml.namespace.QName; - -import com.codeborne.selenide.Condition; -import org.testng.Assert; -import org.testng.annotations.Test; - -import com.evolveum.midpoint.schema.SchemaConstantsGenerated; -import com.evolveum.midpoint.schrodinger.page.user.ListUsersPage; -import com.evolveum.midpoint.schrodinger.page.user.UserPage; -import com.evolveum.midpoint.schrodinger.util.Schrodinger; -import com.evolveum.midpoint.testing.schrodinger.AbstractSchrodingerTest; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType; - -/** - * Created by honchar - * covers LAB 4-1 - */ -public class BasicProvisioningTest extends AbstractSchrodingerTest { - - private static final String USER_NAME_ATTRIBUTE = "Name"; - private static final String USER_GIVEN_NAME_ATTRIBUTE = "Given name"; - private static final String USER_FAMILY_NAME_ATTRIBUTE = "Family name"; - private static final String USER_PASSWORD_ATTRIBUTE = "Value"; - private static final String USER_ADMINISTRATIVE_STATUS_ATTRIBUTE = "Administrative status"; - private static final String PASSWORD_IS_SET_LABEL = "password is set"; - private static final QName PASSWORD_FIELD_LABEL = new QName(SchemaConstantsGenerated.NS_COMMON, "value"); - - private static final String USER_NAME = "kirk"; - private static final String USER_GIVEN_NAME = "Jim"; - private static final String USER_FAMILY_NAME = "Kirk"; - private static final String USER_PASSWORD = "abc123"; - private static final String USER_ADMINISTRATIVE_STATUS = "Enabled"; - - //todo dependsOnGroup - @Test(groups = { "lab_4_1" }) - public void test001createUserKirk() { - //we use New user link in this test - UserPage userPage = basicPage.newUser(); - userPage - .selectTabBasic() - .form() - .addAttributeValue(UserType.F_NAME, USER_NAME) - .addAttributeValue(UserType.F_FAMILY_NAME, USER_FAMILY_NAME) - .addAttributeValue(UserType.F_GIVEN_NAME, USER_GIVEN_NAME) - .setDropDownAttributeValue(ActivationType.F_ADMINISTRATIVE_STATUS, USER_ADMINISTRATIVE_STATUS) - .setPasswordFieldsValues(PASSWORD_FIELD_LABEL, USER_PASSWORD) - .and() - .and() - .clickSave(); - - ListUsersPage usersList = new ListUsersPage(); - - usersList - .table() - .search() - .byName() - .inputValue(USER_NAME) - .updateSearch() - .and() - .clickByName(USER_NAME); - - //check name attribute value - Assert.assertTrue(userPage - .selectTabBasic() - .form() - .compareInputAttributeValue(USER_NAME_ATTRIBUTE, USER_NAME)); - - //check given name attribute value - Assert.assertTrue(userPage - .selectTabBasic() - .form() - .compareInputAttributeValue(USER_GIVEN_NAME_ATTRIBUTE, USER_GIVEN_NAME)); - - //check family name attribute value - Assert.assertTrue(userPage - .selectTabBasic() - .form() - .compareInputAttributeValue(USER_FAMILY_NAME_ATTRIBUTE, USER_FAMILY_NAME)); - - //check password is set label - Assert.assertTrue($(Schrodinger.byElementValue("span", PASSWORD_IS_SET_LABEL)) - .shouldBe(Condition.visible) - .exists()); - - //check Administrative status value - Assert.assertTrue(userPage - .selectTabBasic() - .form() - .compareSelectAttributeValue(USER_ADMINISTRATIVE_STATUS_ATTRIBUTE, USER_ADMINISTRATIVE_STATUS)); - - } - - @Test(groups = { "lab_4_1" }) - public void test002addProjectionToUserKirk() { - ListUsersPage users = basicPage.listUsers(); - users - .table() - .search() - .byName() - .inputValue(USER_NAME) - .updateSearch() - .and() - .clickByName(USER_NAME) - .selectTabProjections() - .clickAddProjection() - .table() - .selectCheckboxByName(ImportResourceTest.RESOURCE_NAME) - .and() - .clickAdd() - .and() - .clickSave() - .feedback() - .isSuccess(); - - } - -} diff --git a/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/ConfiguringMultipleAccountTypes.java b/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/ConfiguringMultipleAccountTypes.java new file mode 100644 index 00000000000..c6e924370d0 --- /dev/null +++ b/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/ConfiguringMultipleAccountTypes.java @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2010-2019 Evolveum and contributors + * + * This work is dual-licensed under the Apache License 2.0 + * and European Union Public License. See LICENSE file for details. + */ +package com.evolveum.midpoint.testing.schrodinger.labs; + +import com.codeborne.selenide.Selenide; + +import com.evolveum.midpoint.schrodinger.component.ProjectionsTab; +import com.evolveum.midpoint.schrodinger.component.common.table.AbstractTableWithPrismView; +import com.evolveum.midpoint.schrodinger.page.configuration.AboutPage; +import com.evolveum.midpoint.schrodinger.page.user.UserPage; +import com.evolveum.midpoint.schrodinger.util.Utils; +import com.evolveum.midpoint.testing.schrodinger.scenarios.ScenariosCommons; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testng.Assert; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import javax.validation.constraints.AssertTrue; +import java.io.File; +import java.io.IOException; + +/** + * @author skublik + */ + +public class ConfiguringMultipleAccountTypes extends AbstractLabTest { + + private static final Logger LOG = LoggerFactory.getLogger(ConfiguringMultipleAccountTypes.class); + + private static final File CSV_1_RESOURCE_FILE_6_1 = new File(LAB_OBJECTS_DIRECTORY + "resources/localhost-csvfile-1-document-access-6-1.xml"); + private static final File CSV_3_RESOURCE_FILE_6_1 = new File(LAB_OBJECTS_DIRECTORY + "resources/localhost-csvfile-3-ldap-6-1.xml"); + private static final File CSV1_TESTER_ROLE_FILE = new File(LAB_OBJECTS_DIRECTORY + "roles/role-csv1-tester.xml"); + private static final File CSV3_ADMIN_ROLE_FILE = new File(LAB_OBJECTS_DIRECTORY + "roles/role-csv3-admin.xml"); + private static final String CSV1_TESTER_ROLE_NAME = "CSV-1 Tester"; + private static final String CSV3_ADMIN_ROLE_NAME = "CSV-3 Admin"; + + @AfterClass + @Override + public void afterClass() { + super.afterClass(); + + midPoint.formLogin().loginWithReloadLoginPage(username, password); + + LOG.info("After: Login name " + username + " pass " + password); + + AboutPage aboutPage = basicPage.aboutPage(); + aboutPage + .clickSwitchToFactoryDefaults() + .clickYes(); + } + + @Test + public void test0601UsingAccountIntentsForProvisioning() { + + importObject(CSV_1_RESOURCE_FILE_6_1,true); + changeResourceAttribute(CSV_1_RESOURCE_NAME, ScenariosCommons.CSV_RESOURCE_ATTR_FILE_PATH, csv1TargetFile.getAbsolutePath(), true); + + importObject(CSV_3_RESOURCE_FILE_6_1,true); + changeResourceAttribute(CSV_3_RESOURCE_NAME, ScenariosCommons.CSV_RESOURCE_ATTR_FILE_PATH, csv3TargetFile.getAbsolutePath(), true); + + importObject(CSV1_TESTER_ROLE_FILE, true); + importObject(CSV3_ADMIN_ROLE_FILE, true); + + Utils.addAsignments(showUser("kirk").selectTabAssignments(), CSV1_TESTER_ROLE_NAME, CSV3_ADMIN_ROLE_NAME); + + AbstractTableWithPrismView> table = showUser("kirk").selectTabProjections() + .table(); + Assert.assertTrue(table.search() + .byItem("Resource") + .inputRefOid("10000000-9999-9999-0000-a000ff000002") + .updateSearch() + .and() + .containsText("jkirk")); + Assert.assertTrue(table.containsText("_kirk")); + + Assert.assertTrue(table.search() + .byItem("Resource") + .inputRefOid("10000000-9999-9999-0000-a000ff000003") + .updateSearch() + .and() + .containsText("jkirk")); + + Assert.assertTrue(table.search() + .byItem("Resource") + .inputRefOid("10000000-9999-9999-0000-a000ff000004") + .updateSearch() + .and() + .containsText("cn=Jim Tiberius Kirk,ou=ExAmPLE,dc=example,dc=com")); + Assert.assertTrue(table.containsText("cn=Jim Tiberius Kirk,ou=_Administrators_,ou=ExAmPLE,dc=example,dc=com")); + + Assert.assertTrue(existShadow(CSV_1_RESOURCE_NAME, "Name", "jkirk", "default", true)); + Assert.assertTrue(existShadow(CSV_1_RESOURCE_NAME, "Name", "_kirk", "test", true)); + Assert.assertTrue(existShadow(CSV_2_RESOURCE_NAME, "Name", "jkirk", "default", true)); + Assert.assertTrue(existShadow(CSV_3_RESOURCE_NAME, "Name", + "cn=Jim Tiberius Kirk,ou=ExAmPLE,dc=example,dc=com", "default", true)); + Assert.assertTrue(existShadow(CSV_3_RESOURCE_NAME, "Name", + "cn=Jim Tiberius Kirk,ou=_Administrators_,ou=ExAmPLE,dc=example,dc=com", "admin", true)); + } + +} diff --git a/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/ImportResourceTest.java b/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/ImportResourceTest.java deleted file mode 100644 index 448a875431d..00000000000 --- a/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/ImportResourceTest.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 2010-2018 Evolveum and contributors - * - * This work is dual-licensed under the Apache License 2.0 - * and European Union Public License. See LICENSE file for details. - */ - -package com.evolveum.midpoint.testing.schrodinger.labs; - -import com.codeborne.selenide.Condition; -import com.codeborne.selenide.SelenideElement; -import com.evolveum.midpoint.schrodinger.MidPoint; -import com.evolveum.midpoint.schrodinger.page.configuration.ImportObjectPage; -import com.evolveum.midpoint.schrodinger.page.resource.ListResourcesPage; -import com.evolveum.midpoint.schrodinger.page.resource.ResourceWizardPage; -import com.evolveum.midpoint.schrodinger.page.resource.ViewResourcePage; -import com.evolveum.midpoint.schrodinger.util.Schrodinger; - -import org.openqa.selenium.By; -import org.testng.Assert; -import org.testng.annotations.Test; -import com.evolveum.midpoint.testing.schrodinger.AbstractSchrodingerTest; - -import java.io.File; -import java.util.Arrays; -import java.util.List; - -import static com.codeborne.selenide.Selenide.$; - - -/** - * Created by honchar - * covers LAB 3-1: Viewing Resources - */ -public class ImportResourceTest extends AbstractSchrodingerTest { - - private static final File CSV_RESOURCE = new File("./src/test/resources/labs/resources/localhost-csvfile-1-document-access.xml"); - public static final String RESOURCE_NAME = "CSV-1 (Document Access)"; - private static final String UNIQUE_ATTRIBUTE_NAME = "login"; - private static final String PASSWORD_ATTRIBUTE_NAME = "password"; - private static final String PASSWORD_ATTRIBUTE_RESOURCE_KEY = "User password attribute name"; - private static final String UNIQUE_ATTRIBUTE_RESOURCE_KEY = "Unique attribute name"; - private static final String RESOURCE_WIZARD_READONLY_LABEL = "Resource is in read-only mode"; - private static final String ACCOUNT_OBJECT_CLASS_LINK = "AccountObjectClass (Default Account)"; - - private static final List RESOURCE_ATTRIBUTES = Arrays.asList("login", "lname", "groups", "enumber", "phone", "dep", "fname", "dis"); - - @Test(groups={"lab_3_1"}) - public void test001ImportCsvResource() { - ImportObjectPage importPage = basicPage.importObject(); - //import resource - Assert.assertTrue( - importPage - .getObjectsFromFile() - .chooseFile(CSV_RESOURCE) - .checkOverwriteExistingObject() - .clickImportFileButton() - .feedback() - .isSuccess() - ); - - String basePathTofile = "/src/test/resources/labs/resources/csv-1.csv"; - String pathToProject = System.getProperty("user.dir"); - changeResourceAttribute("CSV-1 (Document Access)", "File path", pathToProject + basePathTofile); - - ListResourcesPage listResourcesPage = basicPage.listResources(); - - //test connection - Assert.assertTrue(listResourcesPage - .testConnectionClick(RESOURCE_NAME) - .feedback() - .isSuccess()); - } - - @Test(groups={"lab_3_1"}, dependsOnMethods = {"test001ImportCsvResource"}, priority = 1) - public void test002ViewResourceDetailsPage(){ - - //click Edit configuration on the resource edit page - navigateToViewResourcePage() - .clickEditResourceConfiguration(); - - SelenideElement uniqueAttributeField = $(Schrodinger.byDataResourceKey(UNIQUE_ATTRIBUTE_RESOURCE_KEY)) - .waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT_2_S); - - // Unique attribute name should be login - Assert.assertTrue(uniqueAttributeField - .$(By.tagName("input")) - .waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT_2_S) - .getValue() - .equals(UNIQUE_ATTRIBUTE_NAME)); - - SelenideElement passwordAttributeField = $(Schrodinger.byDataResourceKey(PASSWORD_ATTRIBUTE_RESOURCE_KEY)) - .waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT_2_S); - - // Password attribute name should be password - Assert.assertTrue(passwordAttributeField - .$(By.tagName("input")) - .waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT_2_S) - .getValue() - .equals(PASSWORD_ATTRIBUTE_NAME)); - - } - - @Test(groups={"lab_3_1"}, dependsOnMethods = {"test001ImportCsvResource"}, priority = 2) - public void test003showUsingWizard(){ - ResourceWizardPage resourceWizard = navigateToViewResourcePage() - .clickShowUsingWizard(); - - //wizard should appear - Assert.assertTrue($(By.className("wizard")) - .waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT_2_S) - .exists()); - - Assert.assertTrue($(Schrodinger.byDataId("readOnlyNote")) - .waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT_2_S) - .exists()); - - //Configuration tab - resourceWizard.clickOnWizardTab("Configuration"); - Assert.assertTrue($(Schrodinger.byDataId("configuration")) - .waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT_2_S) - .exists()); - - //Schema tab - resourceWizard.clickOnWizardTab("Schema"); - Assert.assertTrue($(Schrodinger.byElementValue("a", "Schema")) - .shouldBe(Condition.visible) - .exists()); - $(By.linkText(ACCOUNT_OBJECT_CLASS_LINK)) - .shouldBe(Condition.visible) - .click(); - //Attributes table visibility check - Assert.assertTrue($(Schrodinger.byDataId("attributeTable")) - .shouldBe(Condition.visible) - .exists()); - - //check resource attributes are present - RESOURCE_ATTRIBUTES.forEach(attr -> - Assert.assertTrue($(Schrodinger.byElementValue("div", attr)) - .waitUntil(Condition.visible, MidPoint.TIMEOUT_DEFAULT_2_S) - .exists())); - - } - - - private ViewResourcePage navigateToViewResourcePage(){ - ListResourcesPage resourcesList = basicPage.listResources(); - - return resourcesList - .table() - .clickByName(RESOURCE_NAME); - } -} - diff --git a/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/ProvisioningToResources.java b/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/ProvisioningToResources.java new file mode 100644 index 00000000000..e7d0f843e0d --- /dev/null +++ b/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/ProvisioningToResources.java @@ -0,0 +1,326 @@ +/* + * Copyright (c) 2010-2019 Evolveum and contributors + * + * This work is dual-licensed under the Apache License 2.0 + * and European Union Public License. See LICENSE file for details. + */ +package com.evolveum.midpoint.testing.schrodinger.labs; + +import com.codeborne.selenide.Selenide; + +import com.evolveum.midpoint.schema.SchemaConstantsGenerated; +import com.evolveum.midpoint.schrodinger.component.ProjectionsTab; +import com.evolveum.midpoint.schrodinger.component.common.PrismForm; +import com.evolveum.midpoint.schrodinger.component.common.PrismFormWithActionButtons; +import com.evolveum.midpoint.schrodinger.component.common.table.AbstractTableWithPrismView; +import com.evolveum.midpoint.schrodinger.page.configuration.AboutPage; +import com.evolveum.midpoint.schrodinger.page.resource.AccountPage; +import com.evolveum.midpoint.schrodinger.page.user.UserPage; + +import com.evolveum.midpoint.testing.schrodinger.scenarios.ScenariosCommons; + + +import com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testng.Assert; +import org.testng.annotations.AfterClass; +import org.testng.annotations.Test; + +import javax.xml.namespace.QName; +import java.io.File; + +/** + * @author skublik + */ + +public class ProvisioningToResources extends AbstractLabTest { + + private static final Logger LOG = LoggerFactory.getLogger(ProvisioningToResources.class); + + private static final File CSV_1_RESOURCE_FILE_4_2 = new File(LAB_OBJECTS_DIRECTORY + "resources/localhost-csvfile-1-document-access-4-2.xml"); + private static final File CSV_3_RESOURCE_FILE_4_2 = new File(LAB_OBJECTS_DIRECTORY + "resources/localhost-csvfile-3-ldap-4-2.xml"); + private static final File CSV_1_RESOURCE_FILE_4_3 = new File(LAB_OBJECTS_DIRECTORY + "resources/localhost-csvfile-1-document-access-4-3.xml"); + private static final File CSV_3_RESOURCE_FILE_4_4 = new File(LAB_OBJECTS_DIRECTORY + "resources/localhost-csvfile-3-ldap-4-4.xml"); + + + @Test + public void test0401BasicProvisioningToMultipleResources() { + importObject(CSV_1_RESOURCE_FILE,true); + + changeResourceAttribute(CSV_1_RESOURCE_NAME, ScenariosCommons.CSV_RESOURCE_ATTR_FILE_PATH, csv1TargetFile.getAbsolutePath(), true); + + showUser("kirk") + .selectTabProjections() + .clickAddProjection() + .table() + .search() + .byName() + .inputValue(CSV_1_RESOURCE_NAME) + .updateSearch() + .and() + .selectCheckboxByName(CSV_1_RESOURCE_NAME) + .and() + .clickAdd() + .and() + .clickSave() + .feedback() + .isSuccess(); + + Assert.assertTrue(existShadow(CSV_1_RESOURCE_NAME, "Login", "jkirk")); + + showUser("kirk") + .selectTabBasic() + .form() + .addAttributeValue(UserType.F_GIVEN_NAME, "Jim Tiberius") + .and() + .and() + .clickSave() + .feedback() + .isSuccess(); + + AccountPage shadow = showShadow(CSV_1_RESOURCE_NAME, "Login", "jkirk"); + Selenide.sleep(2000); + PrismForm accountForm = shadow.form(); + Selenide.sleep(1000); + Assert.assertTrue(accountForm.compareInputAttributeValue("fname", "Jim Tiberius")); + + showUser("kirk") + .selectTabBasic() + .form() + .setDropDownAttributeValue(ActivationType.F_ADMINISTRATIVE_STATUS, "Disabled") + .and() + .and() + .clickSave() + .feedback() + .isSuccess(); + + showShadow(CSV_1_RESOURCE_NAME, "Login", "jkirk"); + Assert.assertTrue(accountForm.compareSelectAttributeValue("administrativeStatus", "Disabled")); + showUserInTable("kirk") + .selectAll() + .and() + .table() + .clickActionDropDown() + .clickEnable() + .clickYes(); + + showShadow(CSV_1_RESOURCE_NAME, "Login", "jkirk"); + Assert.assertTrue(accountForm.compareSelectAttributeValue("administrativeStatus", "Enabled")); + + changeAdministrativeStatusViaProjectionTab("kirk", "jkirk", "Disabled", CSV_1_RESOURCE_NAME); + changeAdministrativeStatusViaProjectionTab("kirk", "jkirk", "Enabled", CSV_1_RESOURCE_NAME); + + showUser("kirk") + .selectTabProjections() + .clickAddProjection() + .table() + .search() + .byName() + .inputValue(CSV_2_RESOURCE_NAME) + .updateSearch() + .and() + .selectCheckboxByName(CSV_2_RESOURCE_NAME) + .and() + .clickAdd() + .clickAddProjection() + .table() + .search() + .byName() + .inputValue(CSV_3_RESOURCE_NAME) + .updateSearch() + .and() + .selectCheckboxByName(CSV_3_RESOURCE_NAME) + .and() + .clickAdd() + .and() + .clickSave() + .feedback() + .isSuccess(); + + Assert.assertTrue(existShadow(CSV_2_RESOURCE_NAME, "Login", "kirk")); + + Assert.assertTrue(basicPage.listResources() + .table() + .search() + .byName() + .inputValue(CSV_3_RESOURCE_NAME) + .updateSearch() + .and() + .clickByName(CSV_3_RESOURCE_NAME) + .clickAccountsTab() + .clickSearchInResource() + .table() + .search() + .byItem("Distinguished Name") + .inputValue("cn=Jim Tiberius Kirk,ou=ExAmPLE,dc=example,dc=com") + .updateSearch() + .and() + .containsText("cn=Jim Tiberius Kirk,ou=ExAmPLE,dc=example,dc=com")); + + showUser("kirk") + .selectTabProjections() + .table() + .search() + .byItem("Resource") + .inputRefOid("10000000-9999-9999-0000-a000ff000003") + .updateSearch() + .and() + .selectAll() + .and() + .clickHeaderActionDropDown() + .delete() + .clickYes() + .and() + .and() + .clickSave() + .feedback() + .isSuccess(); + + Assert.assertFalse(existShadow(CSV_2_RESOURCE_NAME, "Login", "kirk")); + } + + @Test(dependsOnMethods = {"test0401BasicProvisioningToMultipleResources"}) + public void test0402AddingMappings() { + + importObject(CSV_1_RESOURCE_FILE_4_2,true); + + changeResourceAttribute(CSV_1_RESOURCE_NAME, ScenariosCommons.CSV_RESOURCE_ATTR_FILE_PATH, csv1TargetFile.getAbsolutePath(), true); + + importObject(CSV_3_RESOURCE_FILE_4_2,true); + + changeResourceAttribute(CSV_3_RESOURCE_NAME, ScenariosCommons.CSV_RESOURCE_ATTR_FILE_PATH, csv3TargetFile.getAbsolutePath(), true); + + showUser("kirk") + .selectTabBasic() + .form() + .showEmptyAttributes("Properties") + .addAttributeValue(UserType.F_DESCRIPTION, "This user is created by midPoint") + .addAttributeValue("telephoneNumber","123 / 555 - 1010") + .and() + .and() + .clickSave() + .feedback() + .isSuccess(); + + AccountPage shadow = showShadow(CSV_1_RESOURCE_NAME, "Login", "jkirk"); + Selenide.sleep(2000); + PrismForm accountForm = shadow.form(); + Selenide.sleep(1000); + Assert.assertTrue(accountForm.compareInputAttributeValue("phone", "123555-1010")); + + showShadow(CSV_3_RESOURCE_NAME, "Distinguished Name", "cn=Jim Tiberius Kirk,ou=ExAmPLE,dc=example,dc=com"); + Selenide.sleep(2000); + + Assert.assertTrue(accountForm.compareInputAttributeValue("telephoneNumber", "123 / 555 - 1010")); + Assert.assertTrue(accountForm.compareInputAttributeValue("description", "This user is created by midPoint")); + + } + + @Test(dependsOnMethods = {"test0402AddingMappings"}) + public void test0403ModifyingExistingMappings() { + importObject(CSV_1_RESOURCE_FILE_4_3,true); + + changeResourceAttribute(CSV_1_RESOURCE_NAME, ScenariosCommons.CSV_RESOURCE_ATTR_FILE_PATH, csv1TargetFile.getAbsolutePath(), true); + + UserPage user = basicPage.newUser(); + user.selectTabBasic() + .form() + .addAttributeValue(UserType.F_NAME, "picard") + .addAttributeValue(UserType.F_GIVEN_NAME, "Jean-Luc") + .addAttributeValue(UserType.F_FAMILY_NAME, "Picard") + .setDropDownAttributeValue(ActivationType.F_ADMINISTRATIVE_STATUS, "Enabled") + .setPasswordFieldsValues(new QName(SchemaConstantsGenerated.NS_COMMON, "value"), "abc123") + .and() + .and() + .clickSave() + .feedback() + .isSuccess(); + + showUser("picard") + .selectTabProjections() + .clickAddProjection() + .table() + .search() + .byName() + .inputValue(CSV_1_RESOURCE_NAME) + .updateSearch() + .and() + .selectCheckboxByName(CSV_1_RESOURCE_NAME) + .and() + .clickAdd() + .and() + .clickSave() + .feedback() + .isSuccess(); + + AccountPage shadow = showShadow(CSV_1_RESOURCE_NAME, "Login", "jpicard"); + Selenide.sleep(2000); + PrismForm accountForm = shadow.form(); + Selenide.sleep(1000); + Assert.assertTrue(accountForm.compareInputAttributeValue("lname", "PICARD")); + + showUser("kirk") + .checkReconcile() + .clickSave() + .feedback() + .isSuccess(); + + showShadow(CSV_1_RESOURCE_NAME, "Login", "jkirk"); + Selenide.sleep(2000); + Assert.assertTrue(accountForm.compareInputAttributeValue("lname", "KIRK")); + + } + + @Test(dependsOnMethods = {"test0403ModifyingExistingMappings"}) + public void test0404AddingANewAttribute() { + ((PrismFormWithActionButtons>>) + ((AbstractTableWithPrismView)showUser("kirk") + .selectTabProjections() + .table() + .search() + .byItem("Name") + .inputValue("jim tiberius kirk") + .updateSearch() + .and()) + .clickByName("cn=Jim Tiberius Kirk,ou=ExAmPLE,dc=example,dc=com") + .showEmptyAttributes("Attributes") + .addAttributeValue("manager", "xxx")) + .and() + .and() + .and() + .clickSave() + .feedback() + .isSuccess(); + AccountPage shadow = showShadow(CSV_3_RESOURCE_NAME, "Distinguished Name", "cn=Jim Tiberius Kirk,ou=ExAmPLE,dc=example,dc=com"); + Assert.assertTrue(shadow.form().compareInputAttributeValue("manager", "xxx")); + + importObject(CSV_3_RESOURCE_FILE_4_4,true); + + changeResourceAttribute(CSV_3_RESOURCE_NAME, ScenariosCommons.CSV_RESOURCE_ATTR_FILE_PATH, csv3TargetFile.getAbsolutePath(), true); + } + + private void changeAdministrativeStatusViaProjectionTab(String userName, String accountName, String status, String resourceName) { + ((PrismFormWithActionButtons>>) + ((AbstractTableWithPrismView)showUser(userName) + .selectTabProjections() + .table() + .search() + .byItem("Name") + .inputValue(accountName) + .updateSearch() + .and()) + .clickByName(accountName) + .setDropDownAttributeValue(ActivationType.F_ADMINISTRATIVE_STATUS, status)) + .and() + .and() + .and() + .clickSave() + .feedback() + .isSuccess(); + AccountPage shadow = showShadow(resourceName, "Login", accountName); + Assert.assertTrue(shadow.form().compareSelectAttributeValue("administrativeStatus", status)); + } +} diff --git a/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/ResourcesAttributesAndMappingsTest.java b/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/ResourcesAttributesAndMappingsTest.java new file mode 100644 index 00000000000..9dabbcaa688 --- /dev/null +++ b/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/ResourcesAttributesAndMappingsTest.java @@ -0,0 +1,239 @@ +/* + * Copyright (c) 2010-2019 Evolveum and contributors + * + * This work is dual-licensed under the Apache License 2.0 + * and European Union Public License. See LICENSE file for details. + */ +package com.evolveum.midpoint.testing.schrodinger.labs; + +import com.codeborne.selenide.Condition; + +import com.codeborne.selenide.Selenide; +import com.codeborne.selenide.SelenideElement; + +import com.evolveum.midpoint.schema.SchemaConstantsGenerated; +import com.evolveum.midpoint.schrodinger.MidPoint; +import com.evolveum.midpoint.schrodinger.component.common.PrismForm; +import com.evolveum.midpoint.schrodinger.component.resource.ResourceShadowTable; +import com.evolveum.midpoint.schrodinger.page.resource.AccountPage; +import com.evolveum.midpoint.schrodinger.page.resource.ListResourcesPage; +import com.evolveum.midpoint.schrodinger.page.resource.ResourceWizardPage; +import com.evolveum.midpoint.schrodinger.page.user.UserPage; +import com.evolveum.midpoint.schrodinger.util.Schrodinger; + +import com.evolveum.midpoint.testing.schrodinger.scenarios.ScenariosCommons; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType; + +import org.apache.commons.io.FileUtils; +import org.openqa.selenium.By; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import javax.xml.namespace.QName; +import java.io.File; +import java.io.IOException; + +import static com.codeborne.selenide.Selenide.$; + +/** + * @author skublik + */ + +public class ResourcesAttributesAndMappingsTest extends AbstractLabTest { + +// @BeforeClass(alwaysRun = true, dependsOnMethods = { "springTestContextBeforeTestClass" }) +// @Override +// protected void springTestContextPrepareTestInstance() throws Exception { +// +// String home = System.getProperty("midpoint.home"); +// File schemaDir = new File(home, "schema"); +// +// if (!schemaDir.mkdir()) { +// if (schemaDir.exists()) { +// FileUtils.cleanDirectory(schemaDir); +// } else { +// throw new IOException("Creation of directory \"" + schemaDir.getAbsolutePath() + "\" unsuccessful"); +// } +// } +// File schemaFile = new File(schemaDir, EXTENSION_SCHEMA_NAME); +// FileUtils.copyFile(EXTENSION_SCHEMA_FILE, schemaFile); +// +// super.springTestContextPrepareTestInstance(); +// } + + @BeforeClass(alwaysRun = true, dependsOnMethods = { "springTestContextPrepareTestInstance" }) + @Override + public void beforeClass() throws IOException { + super.beforeClass(); + } + + @Test + public void test0301ViewingResources() throws Exception { + initTestDirectory(DIRECTORY_CURRENT_TEST); + + csv1TargetFile = new File(csvTargetDir, CSV_1_FILE_SOURCE_NAME); + FileUtils.copyFile(CSV_1_SOURCE_FILE, csv1TargetFile); + + importObject(CSV_1_SIMPLE_RESOURCE_FILE,true); + + changeResourceAttribute(CSV_1_RESOURCE_NAME, ScenariosCommons.CSV_RESOURCE_ATTR_FILE_PATH, csv1TargetFile.getAbsolutePath(), true); + + ListResourcesPage resourcesList = basicPage.listResources(); + + resourcesList + .table() + .clickByName(CSV_1_RESOURCE_NAME) + .clickEditResourceConfiguration(); + + SelenideElement uniqueAttributeField = $(Schrodinger.byDataResourceKey(UNIQUE_ATTRIBUTE_RESOURCE_KEY)) + .waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT_2_S); + + // Unique attribute name should be login + Assert.assertTrue(uniqueAttributeField + .$(By.tagName("input")) + .waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT_2_S) + .getValue() + .equals(CSV_1_UNIQUE_ATTRIBUTE_NAME)); + + SelenideElement passwordAttributeField = $(Schrodinger.byDataResourceKey(PASSWORD_ATTRIBUTE_RESOURCE_KEY)) + .waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT_2_S); + + // Password attribute name should be password + Assert.assertTrue(passwordAttributeField + .$(By.tagName("input")) + .waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT_2_S) + .getValue() + .equals(CSV_1_PASSWORD_ATTRIBUTE_NAME)); + + ResourceWizardPage resourceWizard = basicPage.listResources() + .table() + .clickByName(CSV_1_RESOURCE_NAME) + .clickShowUsingWizard(); + + //wizard should appear + Assert.assertTrue($(By.className("wizard")) + .waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT_2_S) + .exists()); + + Assert.assertTrue($(Schrodinger.byDataId("readOnlyNote")) + .waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT_2_S) + .exists()); + + //Configuration tab + resourceWizard.clickOnWizardTab("Configuration"); + Assert.assertTrue($(Schrodinger.byDataId("configuration")) + .waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT_2_S) + .exists()); + + //Schema tab + resourceWizard.clickOnWizardTab("Schema"); + Assert.assertTrue($(Schrodinger.byElementValue("a", "Schema")) + .shouldBe(Condition.visible) + .exists()); + $(By.linkText(CSV_1_ACCOUNT_OBJECT_CLASS_LINK)) + .shouldBe(Condition.visible) + .click(); + //Attributes table visibility check + Assert.assertTrue($(Schrodinger.byDataId("attributeTable")) + .shouldBe(Condition.visible) + .exists()); + + //check resource attributes are present + CSV_1_RESOURCE_ATTRIBUTES.forEach(attr -> + Assert.assertTrue($(Schrodinger.byElementValue("div", attr)) + .waitUntil(Condition.visible, MidPoint.TIMEOUT_DEFAULT_2_S) + .exists())); + + importObject(NUMERIC_PIN_FIRST_NONZERO_POLICY_FILE,true); + + csv2TargetFile = new File(csvTargetDir, CSV_2_FILE_SOURCE_NAME); + FileUtils.copyFile(CSV_2_SOURCE_FILE, csv2TargetFile); + + importObject(CSV_2_RESOURCE_FILE,true); + + changeResourceAttribute(CSV_2_RESOURCE_NAME, ScenariosCommons.CSV_RESOURCE_ATTR_FILE_PATH, csv2TargetFile.getAbsolutePath(), true); + + csv3TargetFile = new File(csvTargetDir, CSV_3_FILE_SOURCE_NAME); + FileUtils.copyFile(CSV_3_SOURCE_FILE, csv3TargetFile); + + importObject(CSV_3_RESOURCE_FILE,true); + + changeResourceAttribute(CSV_3_RESOURCE_NAME, ScenariosCommons.CSV_RESOURCE_ATTR_FILE_PATH, csv3TargetFile.getAbsolutePath(), true); + } + + @Test(dependsOnMethods = {"test0301ViewingResources"}) + public void test0302BasicProvisioning() { + UserPage user = basicPage.newUser(); + user.selectTabBasic() + .form() + .addAttributeValue(UserType.F_NAME, "kirk") + .addAttributeValue(UserType.F_GIVEN_NAME, "Jim") + .addAttributeValue(UserType.F_FAMILY_NAME, "Kirk") + .setDropDownAttributeValue(ActivationType.F_ADMINISTRATIVE_STATUS, "Enabled") + .setPasswordFieldsValues(new QName(SchemaConstantsGenerated.NS_COMMON, "value"), "abc123") + .and() + .and() + .clickSave() + .feedback() + .isSuccess(); + + showUser("kirk") + .selectTabProjections() + .clickAddProjection() + .table() + .search() + .byName() + .inputValue(CSV_1_RESOURCE_NAME) + .updateSearch() + .and() + .selectCheckboxByName(CSV_1_RESOURCE_NAME) + .and() + .clickAdd() + .and() + .clickSave() + .feedback() + .isSuccess(); + + Assert.assertTrue(existShadow(CSV_1_RESOURCE_NAME, "Login", "kirk")); + + showUser("kirk") + .selectTabBasic() + .form() + .addAttributeValue(UserType.F_GIVEN_NAME, "Jim T.") + .and() + .and() + .clickSave() + .feedback() + .isSuccess(); + + PrismForm accountForm = showShadow(CSV_1_RESOURCE_NAME, "Login", "kirk") + .form(); + + Selenide.sleep(2000); + Assert.assertTrue(accountForm.compareInputAttributeValue("fname", "Jim T.")); + + showUser("kirk") + .selectTabProjections() + .table() + .search() + .byItem("Name") + .inputValue("kirk") + .updateSearch() + .and() + .selectAll() + .and() + .clickHeaderActionDropDown() + .delete() + .clickYes() + .and() + .and() + .clickSave() + .feedback() + .isSuccess(); + + Assert.assertFalse(existShadow(CSV_1_RESOURCE_NAME, "Login", "kirk")); + + } +} diff --git a/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/SynchronizationFlavours.java b/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/SynchronizationFlavours.java new file mode 100644 index 00000000000..62b4a48003e --- /dev/null +++ b/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/SynchronizationFlavours.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2010-2019 Evolveum and contributors + * + * This work is dual-licensed under the Apache License 2.0 + * and European Union Public License. See LICENSE file for details. + */ +package com.evolveum.midpoint.testing.schrodinger.labs; + +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import java.io.File; +import java.io.IOException; + +/** + * @author skublik + */ + +public class SynchronizationFlavours extends AbstractLabTest{ + +// @AfterClass +// @Override +// public void afterClass() { +// super.afterClass(); +// +// midPoint.formLogin().loginWithReloadLoginPage(username, password); +// +// LOG.info("After: Login name " + username + " pass " + password); +// +// AboutPage aboutPage = basicPage.aboutPage(); +// aboutPage +// .clickSwitchToFactoryDefaults() +// .clickYes(); +// } + + @BeforeClass + @Override + public void beforeClass() throws IOException { + super.beforeClass(); + csv1TargetFile = new File("/home/lskublik/Documents/Evolveum/actual/master/05-02-2020/midpoint/testing/schrodingertest/target/midpoint-home/schrodinger/labTests/csv-1.csv"); + csv2TargetFile = new File ("/home/lskublik/Documents/Evolveum/actual/master/05-02-2020/midpoint/testing/schrodingertest/target/midpoint-home/schrodinger/labTests/csv-2.csv"); + csv3TargetFile = new File ("/home/lskublik/Documents/Evolveum/actual/master/05-02-2020/midpoint/testing/schrodingertest/target/midpoint-home/schrodinger/labTests/csv-3.csv"); + } + + @Test + public void test0701RunningImportFromResource() { + + } +} diff --git a/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/scenarios/OrgMembersTests.java b/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/scenarios/OrgMembersTests.java index a76d85501cb..14842172b83 100644 --- a/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/scenarios/OrgMembersTests.java +++ b/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/scenarios/OrgMembersTests.java @@ -11,7 +11,7 @@ import com.codeborne.selenide.Selenide; import com.evolveum.midpoint.schrodinger.component.AssignmentHolderBasicTab; -import com.evolveum.midpoint.schrodinger.page.org.NewOrgPage; +import com.evolveum.midpoint.schrodinger.page.org.OrgPage; import com.evolveum.midpoint.schrodinger.page.org.OrgTreePage; import com.evolveum.midpoint.schrodinger.page.user.UserPage; import com.evolveum.midpoint.schrodinger.util.Schrodinger; @@ -32,8 +32,8 @@ public class OrgMembersTests extends AbstractSchrodingerTest { @Test public void createOrgWithinMenuItem(){ - NewOrgPage newOrgPage = basicPage.newOrgUnit(); - AssignmentHolderBasicTab basicTab = newOrgPage + OrgPage newOrgPage = basicPage.newOrgUnit(); + AssignmentHolderBasicTab basicTab = newOrgPage .selectTabBasic() .form() .addAttributeValue("name", ORG_NAME) diff --git a/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/scenarios/ScenariosCommons.java b/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/scenarios/ScenariosCommons.java index dcd241dbff9..cf96c019117 100644 --- a/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/scenarios/ScenariosCommons.java +++ b/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/scenarios/ScenariosCommons.java @@ -24,6 +24,6 @@ public class ScenariosCommons { protected static final String TEST_USER_PROTECTED_NAME= "chief"; protected static final String TEST_USER_RAPHAEL_NAME = "raphael"; - protected static final String CSV_RESOURCE_ATTR_FILE_PATH= "File path"; + public static final String CSV_RESOURCE_ATTR_FILE_PATH= "File path"; } diff --git a/testing/schrodingertest/src/test/resources/configuration/objects/securitypolicies/policy-nonce-reset-pass.xml b/testing/schrodingertest/src/test/resources/configuration/objects/securitypolicies/policy-nonce-reset-pass.xml index 186ae72bb1c..defe2e11a58 100644 --- a/testing/schrodingertest/src/test/resources/configuration/objects/securitypolicies/policy-nonce-reset-pass.xml +++ b/testing/schrodingertest/src/test/resources/configuration/objects/securitypolicies/policy-nonce-reset-pass.xml @@ -57,7 +57,7 @@ selfRegistration draft Self Registration - selfRegistrationAuth + confirmationLink diff --git a/testing/schrodingertest/src/test/resources/configuration/objects/valuepolicies/mail-nonce.xml b/testing/schrodingertest/src/test/resources/configuration/objects/valuepolicies/mail-nonce.xml index cf3205c1825..e89c8bf9b8f 100644 --- a/testing/schrodingertest/src/test/resources/configuration/objects/valuepolicies/mail-nonce.xml +++ b/testing/schrodingertest/src/test/resources/configuration/objects/valuepolicies/mail-nonce.xml @@ -18,7 +18,7 @@ Testing string policy - 23 + 30 20 diff --git a/testing/schrodingertest/src/test/resources/labs/objects/archetypes/archetype-employee.xml b/testing/schrodingertest/src/test/resources/labs/objects/archetypes/archetype-employee.xml new file mode 100644 index 00000000000..97a3e8ca821 --- /dev/null +++ b/testing/schrodingertest/src/test/resources/labs/objects/archetypes/archetype-employee.xml @@ -0,0 +1,31 @@ + + + + Employee + Internal employee + + + + Employees + Internal employee + + fa fa-user + darkgreen + + + + + + UserType + + + diff --git a/testing/schrodingertest/src/test/resources/labs/objects/archetypes/archetype-external.xml b/testing/schrodingertest/src/test/resources/labs/objects/archetypes/archetype-external.xml new file mode 100644 index 00000000000..53235056702 --- /dev/null +++ b/testing/schrodingertest/src/test/resources/labs/objects/archetypes/archetype-external.xml @@ -0,0 +1,31 @@ + + + + External + External worker, e.g. contractor + + + + Externals + External worker + + fa fa-space-shuttle + olive + + + + + + UserType + + + diff --git a/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-1-document-access-4-2.xml b/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-1-document-access-4-2.xml new file mode 100644 index 00000000000..be3e63ec9af --- /dev/null +++ b/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-1-document-access-4-2.xml @@ -0,0 +1,464 @@ + + + + + CSV-1 (Document Access) + + + + c:connectorType + com.evolveum.polygon.connector.csv.CsvConnector + + + + + + /opt/training/midpoint-labs/flatfiles/csv-1.csv + utf-8 + ALL + " + , + ; + login + password + + + + + account + default + Default Account + true + ri:AccountObjectClass + + ri:login + Login + + 0 + + + + givenName + + + familyName + + + + + + + + ri:enumber + Employee Number + Definition of Employee Number attribute handling. + + + employeeNumber + + + + + ri:fname + First name + Definition of Firstname attribute handling. + + + givenName + + + + + ri:lname + Last name + Definition of Lastname attribute handling. + + + familyName + + + + + ri:dep + Department + Definition of Department attribute handling. + + + organizationalUnit + + + + + ri:groups + Groups + Definition of Group attribute handling. + + 0 + unbounded + + false + + + ri:phone + Phone Number + Phone number must be without any spaces on this system + + + telephoneNumber + + + + + + + + + + + + + http://prism.evolveum.com/xml/ns/public/matching-rule-3#stringIgnoreCase + attributes/ri:login + admin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ri:dis + false + true + + + + sequentialSearch + + + + + + Default account + The default account name does NOT start with "_" + account + default + true + + + + + + Correlation expression is a search query. + Following search queury will look for users that have "employeeNumber" + equal to the "enumber" attribute of the account. + The condition will ensure that "enumber" is not + empty, otherwise it would match any midPoint user + with empty "employeeNumber" attribute, such as "administrator". + The correlation rule by default looks for users, so it will not match + any other object type. + + + c:employeeNumber + + $projection/attributes/ri:enumber + + + + + + + + linked + true + + + deleted + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#unlink + + + + unlinked + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#link + + + + unmatched + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#inactivateShadow + + + + + + + + + diff --git a/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-1-document-access-4-3.xml b/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-1-document-access-4-3.xml new file mode 100644 index 00000000000..5113c835de4 --- /dev/null +++ b/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-1-document-access-4-3.xml @@ -0,0 +1,470 @@ + + + + + CSV-1 (Document Access) + + + + c:connectorType + com.evolveum.polygon.connector.csv.CsvConnector + + + + + + /opt/training/midpoint-labs/flatfiles/csv-1.csv + utf-8 + ALL + " + , + ; + login + password + + + + + account + default + Default Account + true + ri:AccountObjectClass + + ri:login + Login + + 0 + + + + givenName + + + familyName + + + + + + + + ri:enumber + Employee Number + Definition of Employee Number attribute handling. + + + employeeNumber + + + + + ri:fname + First name + Definition of Firstname attribute handling. + + + givenName + + + + + ri:lname + Last name + Definition of Lastname attribute handling. + + strong + + familyName + + + + + + + + ri:dep + Department + Definition of Department attribute handling. + + + organizationalUnit + + + + + ri:groups + Groups + Definition of Group attribute handling. + + 0 + unbounded + + false + + + ri:phone + Phone Number + Phone number must be without any spaces on this system + + + telephoneNumber + + + + + + + + + + + + + http://prism.evolveum.com/xml/ns/public/matching-rule-3#stringIgnoreCase + attributes/ri:login + admin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ri:dis + false + true + + + + sequentialSearch + + + + + + Default account + The default account name does NOT start with "_" + account + default + true + + + + + + Correlation expression is a search query. + Following search queury will look for users that have "employeeNumber" + equal to the "enumber" attribute of the account. + The condition will ensure that "enumber" is not + empty, otherwise it would match any midPoint user + with empty "employeeNumber" attribute, such as "administrator". + The correlation rule by default looks for users, so it will not match + any other object type. + + + c:employeeNumber + + $projection/attributes/ri:enumber + + + + + + + + linked + true + + + deleted + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#unlink + + + + unlinked + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#link + + + + unmatched + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#inactivateShadow + + + + + + + + + diff --git a/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-1-document-access-5-5.xml b/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-1-document-access-5-5.xml new file mode 100644 index 00000000000..edb3f30456a --- /dev/null +++ b/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-1-document-access-5-5.xml @@ -0,0 +1,462 @@ + + + + + CSV-1 (Document Access) + + + + c:connectorType + com.evolveum.polygon.connector.csv.CsvConnector + + + + + + /opt/training/midpoint-labs/flatfiles/csv-1.csv + utf-8 + ALL + " + , + ; + login + password + + + + + account + default + Default Account + true + ri:AccountObjectClass + + ri:login + Login + + 0 + + + + givenName + + + familyName + + + + + + + + ri:enumber + Employee Number + Definition of Employee Number attribute handling. + + + employeeNumber + + + + + ri:fname + First name + Definition of Firstname attribute handling. + + + givenName + + + + + ri:lname + Last name + Definition of Lastname attribute handling. + + strong + + familyName + + + + + + + + ri:dep + Department + Definition of Department attribute handling. + + + organizationalUnit + + + + + ri:groups + Groups + Definition of Group attribute handling. + + 0 + unbounded + + false + + + ri:phone + Phone Number + Phone number must be without any spaces on this system + + + telephoneNumber + + + + + + + + + + + + + http://prism.evolveum.com/xml/ns/public/matching-rule-3#stringIgnoreCase + attributes/ri:login + admin + + + + + + + + $focusExists + + + + + + + + + + + + + + + + + + + + + + + + + + + ri:dis + false + true + + + + sequentialSearch + + + + + + Default account + The default account name does NOT start with "_" + account + default + true + + + + + + Correlation expression is a search query. + Following search queury will look for users that have "employeeNumber" + equal to the "enumber" attribute of the account. + The condition will ensure that "enumber" is not + empty, otherwise it would match any midPoint user + with empty "employeeNumber" attribute, such as "administrator". + The correlation rule by default looks for users, so it will not match + any other object type. + + + c:employeeNumber + + $projection/attributes/ri:enumber + + + + + + + + linked + true + + + deleted + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#unlink + + + + unlinked + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#link + + + + unmatched + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#inactivateShadow + + + + + + + + + diff --git a/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-1-document-access-6-1.xml b/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-1-document-access-6-1.xml new file mode 100644 index 00000000000..2ea521dca0e --- /dev/null +++ b/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-1-document-access-6-1.xml @@ -0,0 +1,454 @@ + + + + + CSV-1 (Document Access) + + + + c:connectorType + com.evolveum.polygon.connector.csv.CsvConnector + + + + + + /opt/training/midpoint-labs/flatfiles/csv-1.csv + utf-8 + ALL + " + , + ; + login + password + + + + + account + default + Default Account + true + ri:AccountObjectClass + + ri:login + Login + + 0 + + + + givenName + + + familyName + + + + + + + + ri:enumber + Employee Number + Definition of Employee Number attribute handling. + + + employeeNumber + + + + + ri:fname + First name + Definition of Firstname attribute handling. + + + givenName + + + + + ri:lname + Last name + Definition of Lastname attribute handling. + + strong + + familyName + + + + + + + + ri:dep + Department + Definition of Department attribute handling. + + + organizationalUnit + + + + + ri:groups + Groups + Definition of Group attribute handling. + + 0 + unbounded + + false + + + ri:phone + Phone Number + Phone number must be without any spaces on this system + + + telephoneNumber + + + + + + + + + + + + + http://prism.evolveum.com/xml/ns/public/matching-rule-3#stringIgnoreCase + attributes/ri:login + admin + + + + + + + + $focusExists + + + + + + + + + + + + + + + + + + + + account + test + + Test Account + false + + ri:AccountObjectClass + + ri:login + Login + + + 0 + + + + name + + + + + + + + + ri:enumber + Employee Number + Definition of Employee Number attribute handling. + + + employeeNumber + + + + + ri:fname + First name + Definition of Firstname attribute handling. + + + givenName + + + + + + ri:lname + Last name + Definition of Lastname attribute handling. + + + familyName + + + + + ri:dep + Department + Definition of Department attribute handling. + + + organizationalUnit + + + + + ri:groups + Groups + Definition of Group attribute handling. + + 0 + unbounded + + false + + + ri:phone + Phone Number + Phone number must be without any spaces on this system + + + telephoneNumber + + + + + + + + + + http://prism.evolveum.com/xml/ns/public/matching-rule-3#stringIgnoreCase + attributes/ri:login + admin + + + + + + + + + + + + + + + + + + + + + + + + + ri:dis + false + true + + + + sequentialSearch + + + + + + Default account + The default account name does NOT start with "_" + account + default + true + + + + + + Correlation expression is a search query. + Following search queury will look for users that have "employeeNumber" + equal to the "enumber" attribute of the account. + The condition will ensure that "enumber" is not + empty, otherwise it would match any midPoint user + with empty "employeeNumber" attribute, such as "administrator". + The correlation rule by default looks for users, so it will not match + any other object type. + + + c:employeeNumber + + $projection/attributes/ri:enumber + + + + + + + + linked + true + + + deleted + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#unlink + + + + unlinked + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#link + + + + unmatched + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#inactivateShadow + + + + + Test account + The test account name starts with "_" + account + test + true + + + + + + + Correlation expression is a search query. + Following search queury will look for users that have "name" + equal to the account name without the first character. We assume that + the first character is "_" because of the condition above. + The correlation rule by default looks for users, so it will not match + any other object type. + + + polyStringNorm + c:name + + + + + + + linked + true + + + deleted + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#unlink + + + + unlinked + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#link + + + + unmatched + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#inactivateShadow + + + + + + diff --git a/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-1-document-access-simple.xml b/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-1-document-access-simple.xml new file mode 100644 index 00000000000..fe64dabfc6b --- /dev/null +++ b/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-1-document-access-simple.xml @@ -0,0 +1,208 @@ + + + + + CSV-1 (Document Access) + + + + c:connectorType + com.evolveum.polygon.connector.csv.CsvConnector + + + + + + /opt/training/midpoint-labs/flatfiles/csv-1.csv + utf-8 + ALL + " + , + ; + login + password + + + + + account + default + Default Account + true + ri:AccountObjectClass + + ri:login + Login + + 0 + + + + name + + + + + ri:enumber + Employee Number + Definition of Employee Number attribute handling. + + + employeeNumber + + + + + ri:fname + First name + Definition of Firstname attribute handling. + + + givenName + + + + + ri:lname + Last name + Definition of Lastname attribute handling. + + + familyName + + + + + ri:dep + Department + Definition of Department attribute handling. + + + organizationalUnit + + + + + ri:groups + Groups + Definition of Group attribute handling. + + 0 + unbounded + + false + + + + + http://prism.evolveum.com/xml/ns/public/matching-rule-3#stringIgnoreCase + attributes/ri:login + admin + + + + + + + + + + + + + + + + + + + + + ri:dis + false + true + + + + sequentialSearch + + + + + + Default account + The default account name does NOT start with "_" + account + default + true + + + + + + Correlation expression is a search query. + Following search queury will look for users that have "employeeNumber" + equal to the "enumber" attribute of the account. + The condition will ensure that "enumber" is not + empty, otherwise it would match any midPoint user + with empty "employeeNumber" attribute, such as "administrator". + The correlation rule by default looks for users, so it will not match + any other object type. + + + c:employeeNumber + + $projection/attributes/ri:enumber + + + + + + + + linked + true + + + deleted + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#unlink + + + + unlinked + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#link + + + + unmatched + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#inactivateShadow + + + + + + diff --git a/testing/schrodingertest/src/test/resources/labs/resources/localhost-csvfile-1-document-access.xml b/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-1-document-access.xml similarity index 62% rename from testing/schrodingertest/src/test/resources/labs/resources/localhost-csvfile-1-document-access.xml rename to testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-1-document-access.xml index 6daa871dbd2..629c6863468 100644 --- a/testing/schrodingertest/src/test/resources/labs/resources/localhost-csvfile-1-document-access.xml +++ b/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-1-document-access.xml @@ -5,34 +5,15 @@ ~ This work is dual-licensed under the Apache License 2.0 ~ and European Union Public License. See LICENSE file for details. --> - - - - - - + xmlns:icfc="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/connector-schema-3"> - - CSV-1 (Document Access) - - @@ -41,15 +22,9 @@ object. - - - - - - /usr/midpoint/testing/schrodingertest/src/test/resources/labs/resources/csv-1.csv + + /opt/training/midpoint-labs/flatfiles/csv-1.csv utf-8 ALL " @@ -57,87 +32,47 @@ object. ; login password - login - - - - - - - account default - - Default Account true - - ri:AccountObjectClass ri:login - - Login - - 0 - - true - true - true - - $user/givenName + givenName - $user/familyName + familyName - + basic.norm(tmpGivenNameInitial + basic.stringify(familyName))?.replace(' ', '') + + - ri:enumber Employee Number Definition of Employee Number attribute handling. - $user/employeeNumber + employeeNumber @@ -147,10 +82,9 @@ basic.norm(tmpGivenNameInitial + familyName)?.replace(' ', '') Definition of Firstname attribute handling. - $user/givenName + givenName - ri:lname @@ -158,7 +92,7 @@ basic.norm(tmpGivenNameInitial + familyName)?.replace(' ', '') Definition of Lastname attribute handling. - $user/familyName + familyName @@ -168,7 +102,7 @@ basic.norm(tmpGivenNameInitial + familyName)?.replace(' ', '') Definition of Department attribute handling. - $user/organizationalUnit + organizationalUnit @@ -177,26 +111,20 @@ basic.norm(tmpGivenNameInitial + familyName)?.replace(' ', '') Groups Definition of Group attribute handling. - 0 - -1 - - true - true - true - - + 0 + unbounded - false + false - - + - - - + + - - - - - http://prism.evolveum.com/xml/ns/public/matching-rule-3#stringIgnoreCase - attributes/ri:login - admin - - - + + + + + http://prism.evolveum.com/xml/ns/public/matching-rule-3#stringIgnoreCase + attributes/ri:login + admin + + + - - + - - - - - + + + + - - - + + + - - - - - - - + + - - - + - + - + @@ -412,92 +323,79 @@ basic.norm(tmpGivenNameInitial + familyName)?.replace(' ', '') true + + sequentialSearch + - - Default account - The default account name does NOT start with "_" - - account - default + Default account + The default account name does NOT start with "_" + account + default true - - - - + + + Correlation expression is a search query. Following search queury will look for users that have "employeeNumber" equal to the "enumber" attribute of the account. - The condition will ensure that "enumber" is not - empty, otherwise it would match any midPoint user - with empty "employeeNumber" attribute, such as "administrator". + The condition will ensure that "enumber" is not + empty, otherwise it would match any midPoint user + with empty "employeeNumber" attribute, such as "administrator". The correlation rule by default looks for users, so it will not match any other object type. c:employeeNumber - - $account/attributes/ri:enumber - + + $projection/attributes/ri:enumber + - - - + + + - - - - linked - true + true deleted true - - http://midpoint.evolveum.com/xml/ns/public/model/action-3#unlink - + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#unlink + unlinked true - - http://midpoint.evolveum.com/xml/ns/public/model/action-3#link - + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#link + unmatched true - - http://midpoint.evolveum.com/xml/ns/public/model/action-3#inactivateShadow - + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#inactivateShadow + - - - + - + - diff --git a/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-2-canteen-5-5.xml b/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-2-canteen-5-5.xml new file mode 100644 index 00000000000..6f40d60a2ed --- /dev/null +++ b/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-2-canteen-5-5.xml @@ -0,0 +1,263 @@ + + + + + CSV-2 (Canteen Ordering System) + + + + c:connectorType + com.evolveum.polygon.connector.csv.CsvConnector + + + + + + /opt/training/midpoint-labs/flatfiles/csv-2.csv + utf-8 + ALL + " + , + + login + password + + + + + account + default + Default Account + true + ri:AccountObjectClass + + ri:login + Login + + 0 + + + + givenName + + + familyName + + + + + + + + ri:pin + Meal Card PIN + Definition of Meal Card PIN attribute handling. + + + 1 + + + weak + + + + + + + + + ri:empnumber + Employee Number + Definition of Employee Number attribute handling. + + + employeeNumber + + + + + ri:firstname + First name + Definition of Firstname attribute handling. + + + givenName + + + + + ri:lastname + Last name + Definition of Lastname attribute handling. + + + familyName + + + + + ri:department + Department + Definition of Department attribute handling. + + + organizationalUnit + + + + + ri:cardNumber + Meal Card Number + This attribute is not used in this training. Hide it. + + presentation + true + + + + + + + + + + $focusExists + + + + + + + + + + + + + + + + + + + + + + + + ri:disabled + false + true + + + + sequentialSearch + + + + + + Default account + account + default + true + + + Correlation expression is a search query. + Following search queury will look for users that have "employeeNumber" + equal to the "empnumber" attribute of the account. + The condition will ensure that "empnumber" is not + empty, otherwise it would match any midPoint user + with empty "employeeNumber" attribute, such as "administrator". + The correlation rule always looks for users, so it will not match + any other object type. + + + c:employeeNumber + + $projection/attributes/ri:empnumber + + + + + + + + linked + true + + + deleted + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#unlink + + + + unlinked + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#link + + + + unmatched + + + + + diff --git a/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-2-canteen.xml b/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-2-canteen.xml new file mode 100644 index 00000000000..8d04e7ab68b --- /dev/null +++ b/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-2-canteen.xml @@ -0,0 +1,271 @@ + + + + + CSV-2 (Canteen Ordering System) + + + + c:connectorType + com.evolveum.polygon.connector.csv.CsvConnector + + + + + + /opt/training/midpoint-labs/flatfiles/csv-2.csv + utf-8 + ALL + " + , + + login + password + + + + + account + default + Default Account + true + ri:AccountObjectClass + + ri:login + Login + + 0 + + + + givenName + + + familyName + + + + + + + + ri:pin + Meal Card PIN + Definition of Meal Card PIN attribute handling. + + + 1 + + + weak + + + + + + + + + ri:empnumber + Employee Number + Definition of Employee Number attribute handling. + + + employeeNumber + + + + + ri:firstname + First name + Definition of Firstname attribute handling. + + + givenName + + + + + ri:lastname + Last name + Definition of Lastname attribute handling. + + + familyName + + + + + ri:department + Department + Definition of Department attribute handling. + + + organizationalUnit + + + + + ri:cardNumber + Meal Card Number + This attribute is not used in this training. Hide it. + + presentation + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ri:disabled + false + true + + + + sequentialSearch + + + + + + Default account + account + default + true + + + Correlation expression is a search query. + Following search queury will look for users that have "employeeNumber" + equal to the "empnumber" attribute of the account. + The condition will ensure that "empnumber" is not + empty, otherwise it would match any midPoint user + with empty "employeeNumber" attribute, such as "administrator". + The correlation rule always looks for users, so it will not match + any other object type. + + + c:employeeNumber + + $projection/attributes/ri:empnumber + + + + + + + + linked + true + + + deleted + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#unlink + + + + unlinked + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#link + + + + unmatched + + + + + diff --git a/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-3-ldap-4-2.xml b/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-3-ldap-4-2.xml new file mode 100644 index 00000000000..feed4313952 --- /dev/null +++ b/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-3-ldap-4-2.xml @@ -0,0 +1,536 @@ + + + + + CSV-3 (LDAP) + + + + c:connectorType + com.evolveum.polygon.connector.csv.CsvConnector + + + + + + /opt/training/midpoint-labs/flatfiles/csv-3.csv + utf-8 + ALL + " + , + ; + dn + userPassword + + + + + account + default + Default Account + true + ri:AccountObjectClass + + ri:dn + Distinguished Name + + 0 + + + + + + + givenName + + + familyName + + + + + + + + ri:employeeNumber + Employee Number + Definition of Employee Number attribute handling. + + + employeeNumber + + + + + ri:givenName + First name + Definition of Firstname attribute handling. + + + givenName + + + + + ri:sn + Last name + Definition of Lastname attribute handling. + + + familyName + + + + + ri:mail + Mail + Definition of Mail attribute handling. + + + givenName + + + familyName + + + + + + + + emailAddress + + + + + ri:MemberOf + Member Of + Definition of MemberOf attribute handling. + + 0 + unbounded + + + + ri:description + Description + + + description + + + + + ri:telephoneNumber + Telephone Number + Phone number normalized spaces + + + telephoneNumber + + + + + + + + + + + + + http://prism.evolveum.com/xml/ns/public/matching-rule-3#stringIgnoreCase + attributes/ri:dn + cn=administrator,ou=ExAmPLE,dc=example,dc=com + + + + + + + http://prism.evolveum.com/xml/ns/public/matching-rule-3#stringIgnoreCase + attributes/ri:dn + cn=mail-daemon,ou=ExAmPLE,dc=example,dc=com + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ri:disabled + false + true + + + + sequentialSearch + + + + + + Default account + Normal accounts are NOT in ou=_Administrators container + account + default + true + + + + + + Correlation expression is a search query. + Following search queury will look for users that have "employeeNumber" + equal to the "employeeNumber" attribute of the account. + The condition will ensure that "employeeNumber" is not + empty, otherwise it would match any midPoint user + with empty "employeeNumber" attribute, such as "administrator". + The correlation rule always looks for users, so it will not match + any other object type. + + + c:employeeNumber + + $projection/attributes/ri:employeeNumber + + + + + + + + linked + true + + + deleted + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#unlink + + + + unlinked + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#link + + + + unmatched + + + + + + + + diff --git a/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-3-ldap-4-4.xml b/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-3-ldap-4-4.xml new file mode 100644 index 00000000000..3a88b65c00c --- /dev/null +++ b/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-3-ldap-4-4.xml @@ -0,0 +1,559 @@ + + + + + CSV-3 (LDAP) + + + + c:connectorType + com.evolveum.polygon.connector.csv.CsvConnector + + + + + + /opt/training/midpoint-labs/flatfiles/csv-3.csv + utf-8 + ALL + " + , + ; + dn + userPassword + + + + + account + default + Default Account + true + ri:AccountObjectClass + + ri:dn + Distinguished Name + + 0 + + + + + + + givenName + + + familyName + + + + + + + + ri:employeeNumber + Employee Number + Definition of Employee Number attribute handling. + + + employeeNumber + + + + + ri:givenName + First name + Definition of Firstname attribute handling. + + + givenName + + + + + ri:sn + Last name + Definition of Lastname attribute handling. + + + familyName + + + + + ri:mail + Mail + Definition of Mail attribute handling. + + + givenName + + + familyName + + + + + + + + emailAddress + + + + + ri:MemberOf + Member Of + Definition of MemberOf attribute handling. + + 0 + unbounded + + + + ri:description + Description + + + description + + + + + ri:manager + Manager + false + + strong + + + + + + + ri:telephoneNumber + Telephone Number + Phone number normalized spaces + + + telephoneNumber + + + + + + + + + + + + + http://prism.evolveum.com/xml/ns/public/matching-rule-3#stringIgnoreCase + attributes/ri:dn + cn=administrator,ou=ExAmPLE,dc=example,dc=com + + + + + + + http://prism.evolveum.com/xml/ns/public/matching-rule-3#stringIgnoreCase + attributes/ri:dn + cn=mail-daemon,ou=ExAmPLE,dc=example,dc=com + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ri:disabled + false + true + + + + sequentialSearch + + + + + + Default account + Normal accounts are NOT in ou=_Administrators container + account + default + true + + + + + + Correlation expression is a search query. + Following search queury will look for users that have "employeeNumber" + equal to the "employeeNumber" attribute of the account. + The condition will ensure that "employeeNumber" is not + empty, otherwise it would match any midPoint user + with empty "employeeNumber" attribute, such as "administrator". + The correlation rule always looks for users, so it will not match + any other object type. + + + c:employeeNumber + + $projection/attributes/ri:employeeNumber + + + + + + + + linked + true + + + deleted + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#unlink + + + + unlinked + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#link + + + + unmatched + + + + + + + + diff --git a/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-3-ldap-5-5.xml b/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-3-ldap-5-5.xml new file mode 100644 index 00000000000..834a8d45711 --- /dev/null +++ b/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-3-ldap-5-5.xml @@ -0,0 +1,551 @@ + + + + + CSV-3 (LDAP) + + + + c:connectorType + com.evolveum.polygon.connector.csv.CsvConnector + + + + + + /opt/training/midpoint-labs/flatfiles/csv-3.csv + utf-8 + ALL + " + , + ; + dn + userPassword + + + + + account + default + Default Account + true + ri:AccountObjectClass + + ri:dn + Distinguished Name + + 0 + + + + + + + givenName + + + familyName + + + + + + + + ri:employeeNumber + Employee Number + Definition of Employee Number attribute handling. + + + employeeNumber + + + + + ri:givenName + First name + Definition of Firstname attribute handling. + + + givenName + + + + + ri:sn + Last name + Definition of Lastname attribute handling. + + + familyName + + + + + ri:mail + Mail + Definition of Mail attribute handling. + + + givenName + + + familyName + + + + + + + + emailAddress + + + + + ri:MemberOf + Member Of + Definition of MemberOf attribute handling. + + 0 + unbounded + + + + ri:description + Description + + + description + + + + + ri:manager + Manager + false + + strong + + + + + + + ri:telephoneNumber + Telephone Number + Phone number normalized spaces + + + telephoneNumber + + + + + + + + + + + + + http://prism.evolveum.com/xml/ns/public/matching-rule-3#stringIgnoreCase + attributes/ri:dn + cn=administrator,ou=ExAmPLE,dc=example,dc=com + + + + + + + http://prism.evolveum.com/xml/ns/public/matching-rule-3#stringIgnoreCase + attributes/ri:dn + cn=mail-daemon,ou=ExAmPLE,dc=example,dc=com + + + + + + + weak + + $focusExists + + + + + + + + + + + + + + + + + + + + + + + + + + + ri:disabled + false + true + + + + sequentialSearch + + + + + + Default account + Normal accounts are NOT in ou=_Administrators container + account + default + true + + + + + + Correlation expression is a search query. + Following search queury will look for users that have "employeeNumber" + equal to the "employeeNumber" attribute of the account. + The condition will ensure that "employeeNumber" is not + empty, otherwise it would match any midPoint user + with empty "employeeNumber" attribute, such as "administrator". + The correlation rule always looks for users, so it will not match + any other object type. + + + c:employeeNumber + + $projection/attributes/ri:employeeNumber + + + + + + + + linked + true + + + deleted + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#unlink + + + + unlinked + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#link + + + + unmatched + + + + + + + + diff --git a/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-3-ldap-6-1.xml b/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-3-ldap-6-1.xml new file mode 100644 index 00000000000..447d473df3f --- /dev/null +++ b/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-3-ldap-6-1.xml @@ -0,0 +1,543 @@ + + + + + CSV-3 (LDAP) + + + + c:connectorType + com.evolveum.polygon.connector.csv.CsvConnector + + + + + + /opt/training/midpoint-labs/flatfiles/csv-3.csv + utf-8 + ALL + " + , + ; + dn + userPassword + + + + + account + default + Default Account + true + ri:AccountObjectClass + + ri:dn + Distinguished Name + + 0 + + + + + + + givenName + + + familyName + + + + + + + + ri:employeeNumber + Employee Number + Definition of Employee Number attribute handling. + + + employeeNumber + + + + + ri:givenName + First name + Definition of Firstname attribute handling. + + + givenName + + + + + ri:sn + Last name + Definition of Lastname attribute handling. + + + familyName + + + + + ri:mail + Mail + Definition of Mail attribute handling. + + + givenName + + + familyName + + + + + + + + emailAddress + + + + + ri:MemberOf + Member Of + Definition of MemberOf attribute handling. + + 0 + unbounded + + + + ri:description + Description + + + description + + + + + ri:manager + Manager + false + + strong + + + + + + + ri:telephoneNumber + Telephone Number + Phone number normalized spaces + + + telephoneNumber + + + + + + + + + + + + + http://prism.evolveum.com/xml/ns/public/matching-rule-3#stringIgnoreCase + attributes/ri:dn + cn=administrator,ou=ExAmPLE,dc=example,dc=com + + + + + + + http://prism.evolveum.com/xml/ns/public/matching-rule-3#stringIgnoreCase + attributes/ri:dn + cn=mail-daemon,ou=ExAmPLE,dc=example,dc=com + + + + + + + weak + + $focusExists + + + + + + + + + + + + + + + + + + + + account + admin + + Admin Account + false + + ri:AccountObjectClass + + ri:dn + Distinguished Name + + + 0 + + + + givenName + + + familyName + + + + + + + + + ri:employeeNumber + Employee Number + Definition of Employee Number attribute handling. + + + employeeNumber + + + + + ri:givenName + First name + Definition of Firstname attribute handling. + + + givenName + + + + + + ri:sn + Last name + Definition of Lastname attribute handling. + + + familyName + + + + + ri:MemberOf + Member Of + Definition of MemberOf attribute handling. + + 0 + unbounded + + + + + 10 + + + + + + + + + + http://prism.evolveum.com/xml/ns/public/matching-rule-3#stringIgnoreCase + attributes/ri:dn + cn=admin2,ou=_Administrators_,ou=ExAmPLE,dc=example,dc=com + + + + + + + http://prism.evolveum.com/xml/ns/public/matching-rule-3#stringIgnoreCase + attributes/ri:dn + cn=admin3,ou=_Administrators_,ou=ExAmPLE,dc=example,dc=com + + + + + + + + + + + + + + + + + + + + + + + + + ri:disabled + false + true + + + + sequentialSearch + + + + + + Default account + Normal accounts are NOT in ou=_Administrators container + account + default + true + + + + + + Correlation expression is a search query. + Following search queury will look for users that have "employeeNumber" + equal to the "employeeNumber" attribute of the account. + The condition will ensure that "employeeNumber" is not + empty, otherwise it would match any midPoint user + with empty "employeeNumber" attribute, such as "administrator". + The correlation rule always looks for users, so it will not match + any other object type. + + + c:employeeNumber + + $projection/attributes/ri:employeeNumber + + + + + + + + linked + true + + + deleted + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#unlink + + + + unlinked + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#link + + + + unmatched + + + + Admin account + Admin accounts are in ou=_Administrators container + account + admin + true + + + + + + Correlation expression is a search query. + Following search queury will look for users that have "employeeNumber" + equal to the "employeeNumber" attribute of the account. + The condition will ensure that "employeeNumber" is not + empty, otherwise it would match any midPoint user + with empty "employeeNumber" attribute, such as "administrator". + The correlation rule always looks for users, so it will not match + any other object type. + + + c:employeeNumber + + $projection/attributes/ri:employeeNumber + + + + + + + + + linked + true + + + deleted + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#unlink + + + + unlinked + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#link + + + + unmatched + + + + + diff --git a/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-3-ldap.xml b/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-3-ldap.xml new file mode 100644 index 00000000000..44a96ec1a34 --- /dev/null +++ b/testing/schrodingertest/src/test/resources/labs/objects/resources/localhost-csvfile-3-ldap.xml @@ -0,0 +1,542 @@ + + + + + CSV-3 (LDAP) + + + + c:connectorType + com.evolveum.polygon.connector.csv.CsvConnector + + + + + + /opt/training/midpoint-labs/flatfiles/csv-3.csv + utf-8 + ALL + " + , + ; + dn + userPassword + + + + + account + default + Default Account + true + ri:AccountObjectClass + + ri:dn + Distinguished Name + + 0 + + + + + + + givenName + + + familyName + + + + + + + + ri:employeeNumber + Employee Number + Definition of Employee Number attribute handling. + + + employeeNumber + + + + + ri:givenName + First name + Definition of Firstname attribute handling. + + + givenName + + + + + ri:sn + Last name + Definition of Lastname attribute handling. + + + familyName + + + + + ri:mail + Mail + Definition of Mail attribute handling. + + + givenName + + + familyName + + + + + + + + emailAddress + + + + + ri:MemberOf + Member Of + Definition of MemberOf attribute handling. + + 0 + unbounded + + + + + + + + + + + + + + + http://prism.evolveum.com/xml/ns/public/matching-rule-3#stringIgnoreCase + attributes/ri:dn + cn=administrator,ou=ExAmPLE,dc=example,dc=com + + + + + + + http://prism.evolveum.com/xml/ns/public/matching-rule-3#stringIgnoreCase + attributes/ri:dn + cn=mail-daemon,ou=ExAmPLE,dc=example,dc=com + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ri:disabled + false + true + + + + sequentialSearch + + + + + + Default account + Normal accounts are NOT in ou=_Administrators container + account + default + true + + + + + + Correlation expression is a search query. + Following search queury will look for users that have "employeeNumber" + equal to the "employeeNumber" attribute of the account. + The condition will ensure that "employeeNumber" is not + empty, otherwise it would match any midPoint user + with empty "employeeNumber" attribute, such as "administrator". + The correlation rule always looks for users, so it will not match + any other object type. + + + c:employeeNumber + + $projection/attributes/ri:employeeNumber + + + + + + + + linked + true + + + deleted + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#unlink + + + + unlinked + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#link + + + + unmatched + + + + + + + + diff --git a/testing/schrodingertest/src/test/resources/labs/objects/roles/role-csv1-tester.xml b/testing/schrodingertest/src/test/resources/labs/objects/roles/role-csv1-tester.xml new file mode 100644 index 00000000000..df1065c711a --- /dev/null +++ b/testing/schrodingertest/src/test/resources/labs/objects/roles/role-csv1-tester.xml @@ -0,0 +1,24 @@ + + + + CSV-1 Tester + + This role assigns CSV-1 (Document Access) resource and creates a test account. + + + + + + account + test + + + diff --git a/testing/schrodingertest/src/test/resources/labs/objects/roles/role-csv3-admin.xml b/testing/schrodingertest/src/test/resources/labs/objects/roles/role-csv3-admin.xml new file mode 100644 index 00000000000..a3b32773779 --- /dev/null +++ b/testing/schrodingertest/src/test/resources/labs/objects/roles/role-csv3-admin.xml @@ -0,0 +1,24 @@ + + + + CSV-3 Admin + + This role assigns CSV-3 (LDAP) resource and creates an admin account. + + + + + + account + admin + + + diff --git a/testing/schrodingertest/src/test/resources/labs/objects/roles/role-incognito.xml b/testing/schrodingertest/src/test/resources/labs/objects/roles/role-incognito.xml new file mode 100644 index 00000000000..d2cd5ccf28c --- /dev/null +++ b/testing/schrodingertest/src/test/resources/labs/objects/roles/role-incognito.xml @@ -0,0 +1,65 @@ + + + + Incognito + + This role assigns CSV-1 (Document Access), CSV-2 (Canteen Ordering System) and + CSV-3 (LDAP) resources and sets CSV-1 "groups" attribute to + "Incognito Employees" and "SETI Success Documents". + This role excludes "Internal Employee" role, they cannot be assigned to the same + user. + + + + + + + ri:groups + + strong + + + Incognito Employees + SETI Success Documents + Partial Invisibility + + + + + + + + + + + + + + + + + + + + excluded-role + + + Internal Employee role cannot be assigned together with Incognito role + + + + + + + + + + diff --git a/testing/schrodingertest/src/test/resources/labs/objects/roles/role-internal-employee.xml b/testing/schrodingertest/src/test/resources/labs/objects/roles/role-internal-employee.xml new file mode 100644 index 00000000000..4d660c310f7 --- /dev/null +++ b/testing/schrodingertest/src/test/resources/labs/objects/roles/role-internal-employee.xml @@ -0,0 +1,47 @@ + + + + Internal Employee + + This role assigns CSV-1 (Document Access), CSV-2 (Canteen Ordering System) and + CSV-3 (LDAP) resources and sets CSV-1 (Document Access) "groups" + attribute to "Internal Employees" and "Essential Documents". + + + + + + + ri:groups + + strong + + + Internal Employees + Essential Documents + + + + + + + + + + + + + + + + + + diff --git a/testing/schrodingertest/src/test/resources/labs/objects/roles/role-secret-i.xml b/testing/schrodingertest/src/test/resources/labs/objects/roles/role-secret-i.xml new file mode 100644 index 00000000000..cdd86df3af4 --- /dev/null +++ b/testing/schrodingertest/src/test/resources/labs/objects/roles/role-secret-i.xml @@ -0,0 +1,33 @@ + + + + Secret Projects I + + This role assigns CSV-1 (Document Access) resource and sets "groups" attribute to "Time Travel" and "Teleportation". + + + + + + + ri:groups + + strong + + + Time Travel + Teleportation + + + + + + diff --git a/testing/schrodingertest/src/test/resources/labs/objects/roles/role-secret-ii.xml b/testing/schrodingertest/src/test/resources/labs/objects/roles/role-secret-ii.xml new file mode 100644 index 00000000000..f6fcf5e6a31 --- /dev/null +++ b/testing/schrodingertest/src/test/resources/labs/objects/roles/role-secret-ii.xml @@ -0,0 +1,33 @@ + + + + Secret Projects II + + This role assigns CSV-1 (Document Access) resource and sets "groups" attribute to "Lucky Numbers" and "Presidential Candidates Motivation". + + + + + + + ri:groups + + strong + + + Lucky Numbers + Presidential Candidates Motivation + + + + + + diff --git a/testing/schrodingertest/src/test/resources/labs/objects/roles/role-top-secret-i.xml b/testing/schrodingertest/src/test/resources/labs/objects/roles/role-top-secret-i.xml new file mode 100644 index 00000000000..0f68fbd9d25 --- /dev/null +++ b/testing/schrodingertest/src/test/resources/labs/objects/roles/role-top-secret-i.xml @@ -0,0 +1,37 @@ + + + + Top Secret Projects I + + This role assigns CSV-1 (Document Access) resource and sets "groups" attribute to "Area 52 Managers", "Area 52 News Obfuscators", "Abduction Professional Services", "Immortality Training", "Telekinesis In Practice" and "IDDQD". + + + + + + + ri:groups + + strong + + + Area 52 Managers + Area 52 News Obfuscators + Abduction Professional Services + Immortality Training + Telekinesis In Practice + IDDQD + + + + + + diff --git a/testing/schrodingertest/src/test/resources/labs/objects/systemConfiguration/system-configuration-5-7.xml b/testing/schrodingertest/src/test/resources/labs/objects/systemConfiguration/system-configuration-5-7.xml new file mode 100644 index 00000000000..743d01e650f --- /dev/null +++ b/testing/schrodingertest/src/test/resources/labs/objects/systemConfiguration/system-configuration-5-7.xml @@ -0,0 +1,680 @@ + + + + SystemConfiguration + + + + + ERROR + ro.isdc.wro.extensions.processor.css.Less4jProcessor + + + OFF + org.hibernate.engine.jdbc.spi.SqlExceptionHelper + + + OFF + org.hibernate.engine.jdbc.batch.internal.BatchingBatch + + + WARN + org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl + + + OFF + org.hibernate.internal.ExceptionMapperStandardImpl + + + OFF + net.sf.jasperreports.engine.fill.JRFillDataset + + + WARN + org.apache.wicket.resource.PropertiesFactory + + + ERROR + org.springframework.context.support.ResourceBundleMessageSource + + + INFO + com.evolveum.midpoint.model.impl.lens.projector.Projector + + + INFO + com.evolveum.midpoint.model.impl.lens.Clockwork + + + %date [%X{subsystem}] [%thread] %level \(%logger\): %msg%n + MIDPOINT_LOG + ${midpoint.home}/log/midpoint.log + ${midpoint.home}/log/midpoint-%d{yyyy-MM-dd}.%i.log + 10 + 100MB + true + + + %date %level: %msg%n + MIDPOINT_PROFILE_LOG + ${midpoint.home}/log/midpoint-profile.log + ${midpoint.home}/log/midpoint-profile-%d{yyyy-MM-dd}.%i.log + 10 + 100MB + true + + MIDPOINT_LOG + INFO + + false +

false
+ + + + + P3M + + + P1M + + + + + + performance + Performance tracing + true + true + performance-trace %{timestamp} %{focusName} %{milliseconds} + true + true + + + functional + Functional tracing + true + functional-trace %{timestamp} %{focusName} + true + true + true + + normal + + + + functional-model-logging + Functional tracing (with model logging) + true + functional-trace %{timestamp} %{focusName} + true + true + true + + + com.evolveum.midpoint.model + TRACE + + + + normal + + + + functional-sql-logging + Functional tracing (with SQL logging) + true + functional-trace %{timestamp} %{focusName} + true + true + true + + + org.hibernate.SQL + TRACE + + + + normal + + + + + + + /self/profile + + View/edit your profile + + fa fa-user + + green + http://midpoint.evolveum.com/xml/ns/public/security/authorization-ui-3#selfProfile + http://midpoint.evolveum.com/xml/ns/public/security/authorization-ui-3#selfAll + + + /self/credentials + + View/edit your credentials + + fa fa-shield + + blue + http://midpoint.evolveum.com/xml/ns/public/security/authorization-ui-3#selfCredentials + http://midpoint.evolveum.com/xml/ns/public/security/authorization-ui-3#selfAll + + + /admin/users + + + fa fa-users + + red + http://midpoint.evolveum.com/xml/ns/public/security/authorization-ui-3#users + + + /admin/resources + + + fa fa-database + + purple + http://midpoint.evolveum.com/xml/ns/public/security/authorization-ui-3#resources + + + + my-cases + + + My case + My cases + + fe fe-case-object + + + 1000 + CaseType + + + + + + + + manual-case-view + + + Manual case + All manual cases + Manual provisioning cases + + 1010 + CaseType + + + + + + + + operation-request-case-view + + + Request + All requests + Operation requests + + 1020 + CaseType + + + + + + + + approval-case-view + + + Approval + All approvals + Approval cases + + 1030 + CaseType + + + + + + + + reconciliation-tasks-view + 30 + TaskType + + + + + + + + recomputation-tasks-view + 30 + TaskType + + + + + + + + import-tasks-view + 30 + TaskType + + + + + + + + live-sync-tasks-view + 30 + TaskType + + + + + + + + async-update-tasks-view + 30 + TaskType + + + + + + + + cleanup-tasks-view + 30 + TaskType + + + + + + + + report-tasks-view + 30 + TaskType + + + + + + + + single-bulk-action-tasks-view + 30 + TaskType + + + + + + + + iterative-bulk-action-tasks-view + 30 + TaskType + + + + + + + + certification-tasks-view + 30 + TaskType + + + + + + + + approval-tasks-view + 30 + TaskType + + + + + + + + utility-tasks-view + 30 + TaskType + + + + + + + + system-tasks-view + 30 + TaskType + + + + + + + + empls-view + 10 + UserType + + + + + + + + ext-view + 20 + UserType + + + + + + + + + + c:TaskType + + + + + 150 + + cleanupAfterCompletion + + + threadStopAction + + + binding + + + dependent + + + + + + + 900 + + executionStatus + + + node + + + nodeAsObserved + + + resultStatus + + + result + + + nextRunStartTimestamp + + + nextRetryTimestamp + + + unpauseAction + + + taskIdentifier + + + parent + + + waitingReason + + + stateBeforeSuspend + + + category + + + handlerUri + + + otherHandlersUriStack + + + channel + + + subtaskRef + + + dependentTaskRef + + + lastRunStartTimestamp + + + lastRunFinishTimestamp + + + completionTimestamp + + + + + + + hidden + 910 + + progress + + + expectedTotal + + + stalledSince + + + + + + + + safe + + "Safe" expression profile. It is supposed to contain only operations that are "safe", + i.e. operations that have very little risk to harm the system, circumvent midPoint security + and so on. Use of those operations should be reasonably safe in all expressions. + However, there are limitations. This profile may incomplete or it may even be not completely secure. + Proper security testing of this profile was not yet conducted. It is provided here "AS IS", + without any guarantees. Use at your own risk. + + deny + + asIs + allow + + + path + allow + + + value + allow + + + const + allow + + + script + deny + + + + + script-safe + deny + + com.evolveum.midpoint.xml.ns._public.common.common_3 + MidPoint common schema - generated bean classes + allow + + + com.evolveum.prism.xml.ns._public.types_3 + Prism schema - bean classes + allow + + + java.lang.Integer + allow + + + java.lang.Object + Basic Java operations. + deny + + equals + allow + + + hashCode + allow + + + + java.lang.String + String operations are generally safe. But Groovy is adding execute() method which is very dangerous. + allow + + execute + deny + + + + java.lang.CharSequence + allow + + + java.lang.Enum + allow + + + java.util.List + List operations are generally safe. But Groovy is adding execute() method which is very dangerous. + allow + + execute + deny + + + + java.util.ArrayList + List operations are generally safe. But Groovy is adding execute() method which is very dangerous. + allow + + execute + deny + + + + java.util.Map + allow + + + java.util.HashMap + allow + + + java.util.Date + allow + + + javax.xml.namespace.QName + allow + + + javax.xml.datatype.XMLGregorianCalendar + allow + + + java.lang.System + Just a few methods of System are safe enough. + deny + + currentTimeMillis + allow + + + + java.lang.IllegalStateException + Basic Java exception. Also used in test. + allow + + + java.lang.IllegalArgumentException + Basic Java exception. + allow + + + com.evolveum.midpoint.model.common.expression.functions.BasicExpressionFunctions + MidPoint basic functions library + allow + + + com.evolveum.midpoint.model.common.expression.functions.LogExpressionFunctions + MidPoint logging functions library + allow + + + com.evolveum.midpoint.report.impl.ReportFunctions + MidPoint report functions library + allow + + + org.apache.commons.lang.StringUtils + Apache Commons: Strings + allow + + + + diff --git a/testing/schrodingertest/src/test/resources/labs/objects/valuePolicies/numeric-pin-first-nonzero-policy.xml b/testing/schrodingertest/src/test/resources/labs/objects/valuePolicies/numeric-pin-first-nonzero-policy.xml new file mode 100644 index 00000000000..f06237d8dc3 --- /dev/null +++ b/testing/schrodingertest/src/test/resources/labs/objects/valuePolicies/numeric-pin-first-nonzero-policy.xml @@ -0,0 +1,44 @@ + + + + + Numeric PIN Policy - first character not zero + A policy useful for generating PIN. The first character + is not zero to avoid string to integer conversion losing one the first character. + + String validation policy + + 4 + 4 + 2 + false + + + Numeric characters - first digit (non zero) + 1 + true + + 123456789 + + + + Numeric characters + false + + 1234567890 + + + + + + diff --git a/testing/schrodingertest/src/test/resources/labs/resources/csv-1.csv b/testing/schrodingertest/src/test/resources/labs/resources/csv-1.csv deleted file mode 100644 index 3ff107ffdef..00000000000 --- a/testing/schrodingertest/src/test/resources/labs/resources/csv-1.csv +++ /dev/null @@ -1,6 +0,0 @@ -"login","fname","lname","enumber","dep","dis","password","groups","phone" -"hacker","","","","","false","hackedSecretPassword","","" -"admin","Admin","Admin","","","false","secret","","" -"_tjru68","Test","Test","","","false","secret","","" -"_x000090","Mel","Austenberg Test","","","false","secret","","" -"onull","o;isddj;fl",,,,"false",,, diff --git a/testing/schrodingertest/src/test/resources/labs/schema/extension-example.xsd b/testing/schrodingertest/src/test/resources/labs/schema/extension-example.xsd new file mode 100644 index 00000000000..09dce89b73c --- /dev/null +++ b/testing/schrodingertest/src/test/resources/labs/schema/extension-example.xsd @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + true + Department Number + 141 + + + Organizational unit/department number. + + + + + + + true + Organizational Path + 142 + + + Organizational path from root to user's department. Separated by ":". + + + + + + + true + Is Manager + 143 + + + TRUE: is manager. + + + + + + + true + Employee Status + 146 + + + F: Former employee + A: Active employee + I: Inactive employee (maternity leave etc.) + + + + + + + diff --git a/testing/schrodingertest/src/test/resources/labs/sources/csv-1.csv b/testing/schrodingertest/src/test/resources/labs/sources/csv-1.csv new file mode 100644 index 00000000000..aec84cabadb --- /dev/null +++ b/testing/schrodingertest/src/test/resources/labs/sources/csv-1.csv @@ -0,0 +1,18 @@ +"login","fname","lname","enumber","dep","dis","password","groups","phone" +"hacker","","","","","false","hackedSecretPassword","","" +"admin","Admin","Admin","","","false","secret","","" +"_tjru68","Test","Test","","","false","secret","","" +"_x000090","Mel","Austenberg Test","","","false","secret","","" +"jsmith","John","Smith","001212","Human Resources","false","9hYJX","Internal Employees;Essential Documents","" +"maustenberg","Mel","Austenberg","000090","Executive Division","false","WM30M","Internal Employees;Essential Documents","" +"efeckerwood","Ellen","Feckerwood","001049","Executive Division","true","Nr7Ra","Internal Employees;Essential Documents","" +"adecker","Andreas","Decker","000045","Sales Department","false","2UZcf","Internal Employees;Essential Documents","" +"rmechal","Rudie","Mechal","000021","Executive Division","false","FQMMj","Internal Employees;Essential Documents","" +"irockerteller","Ivan","Rockerteller","000089","Java Development","false","UrvRe","Internal Employees;Essential Documents","" +"emorthanic","Eve","Morthanic","000005","Executive Division","false","dLbOe","Internal Employees;Essential Documents","" +"jbradley","James","Bradley","000035","Technology Division","false","BZxqQ","Internal Employees;Essential Documents","" +"kharrison","Kyle","Harrison","000078","Software Department","false","dgL8k","Internal Employees;Essential Documents","" +"adewries","Ann","De Wries","000389","Sales Department","false","2j2o0","Internal Employees;Essential Documents","" +"ablack","Alice","Black","000158","IT Administration Department","false","fm4Fs","Internal Employees;Essential Documents","" +"jwicks","John","Wicks","000390","IT Administration Department","false","KZvNz","Internal Employees;Essential Documents","" +"adewrieux","Adele","Dewrieux","000328","Java Development","false","Tz00U","Internal Employees;Essential Documents", diff --git a/testing/schrodingertest/src/test/resources/labs/sources/csv-2.csv b/testing/schrodingertest/src/test/resources/labs/sources/csv-2.csv new file mode 100644 index 00000000000..62c57b7e370 --- /dev/null +++ b/testing/schrodingertest/src/test/resources/labs/sources/csv-2.csv @@ -0,0 +1,14 @@ +"login","firstname","lastname","empnumber","department","disabled","password","pin","cardNumber" +"jsmith","John","Smith","001212","Human Resources","false","9hYJX","1572","" +"maustenb","Mel","Austenberg","000090","Executive Division","false","WM30M","9496","" +"efeckerw","Ellen","Feckerwood","001049","Executive Division","true","Nr7Ra","2943","" +"adecker","Andreas","Decker","000045","Sales Department","false","2UZcf","1911","" +"rmechal","Rudie","Mechal","000021","Executive Division","false","FQMMj","1546","" +"irockert","Ivan","Rockerteller","000089","Java Development","false","UrvRe","8714","" +"emorthan","Eve","Morthanic","000005","Executive Division","false","dLbOe","2323","" +"jbradley","James","Bradley","000035","Technology Division","false","BZxqQ","7088","" +"kharriso","Kyle","Harrison","000078","Software Department","false","dgL8k","7370","" +"adewries","Ann","De Wries","000389","Sales Department","false","2j2o0","8491","" +"ablack","Alice","Black","000158","IT Administration Department","false","fm4Fs","1312","" +"jwicks","John","Wicks","000390","IT Administration Department","false","KZvNz","9842","" +"adewrieu","Adele","Dewrieux","000328","Java Development","false","Tz00U","9384","" diff --git a/testing/schrodingertest/src/test/resources/labs/sources/csv-3.csv b/testing/schrodingertest/src/test/resources/labs/sources/csv-3.csv new file mode 100644 index 00000000000..18596bd6fa2 --- /dev/null +++ b/testing/schrodingertest/src/test/resources/labs/sources/csv-3.csv @@ -0,0 +1,18 @@ +"dn","givenName","sn","employeeNumber","mail","disabled","userPassword","MemberOf","telephoneNumber","description","manager" +"cn=administrator,ou=ExAmPLE,dc=example,dc=com","administrator","administrator","","","false","","","","","" +"cn=mail-daemon,ou=ExAmPLE,dc=example,dc=com","mail","daemon","","","false","","","","","" +"cn=admin2,ou=_Administrators_,ou=ExAmPLE,dc=example,dc=com","administrator","administrator","","","false","","","","","" +"cn=admin3,ou=_Administrators_,ou=ExAmPLE,dc=example,dc=com","administrator","administrator","","","false","","","","","" +"cn=John Smith,ou=ExAmPLE,dc=example,dc=com","John","Smith","001212","john.smith@example.com","false","9hYJX","","","","" +"cn=Mel Austenberg,ou=ExAmPLE,dc=example,dc=com","Mel","Austenberg","000090","mel.austenberg@example.com","false","WM30M","","","","" +"cn=Ellen Feckerwood,ou=ExAmPLE,dc=example,dc=com","Ellen","Feckerwood","001049","ellen.feckerwood@example.com","true","Nr7Ra","","","","" +"cn=Andreas Decker,ou=ExAmPLE,dc=example,dc=com","Andreas","Decker","000045","andreas.decker@example.com","false","2UZcf","","","","" +"cn=Rudie Mechal,ou=ExAmPLE,dc=example,dc=com","Rudie","Mechal","000021","rudie.mechal@example.com","false","FQMMj","","","","" +"cn=Ivan Rockerteller,ou=ExAmPLE,dc=example,dc=com","Ivan","Rockerteller","000089","ivan.rockerteller@example.com","false","UrvRe","","","","" +"cn=Eve Morthanic,ou=ExAmPLE,dc=example,dc=com","Eve","Morthanic","000005","eve.morthanic@example.com","false","dLbOe","","","","" +"cn=James Bradley,ou=ExAmPLE,dc=example,dc=com","James","Bradley","000035","james.bradley@example.com","false","BZxqQ","","","","" +"cn=Kyle Harrison,ou=ExAmPLE,dc=example,dc=com","Kyle","Harrison","000078","kyle.harrison@example.com","false","dgL8k","","","","" +"cn=Ann De Wries,ou=ExAmPLE,dc=example,dc=com","Ann","De Wries","000389","ann.de.wries@example.com","false","2j2o0","","","","" +"cn=Alice Black,ou=ExAmPLE,dc=example,dc=com","Alice","Black","000158","alice.black@example.com","false","fm4Fs","","","","" +"cn=John Wicks,ou=ExAmPLE,dc=example,dc=com","John","Wicks","000390","john.wicks@example.com","false","KZvNz","","","","" +"cn=Adele Dewrieux,ou=ExAmPLE,dc=example,dc=com","Adele","Dewrieux","000328","adele.dewrieux@example.com","false","Tz00U",,,,"" \ No newline at end of file diff --git a/testing/schrodingertest/testng-integration.xml b/testing/schrodingertest/testng-integration.xml index b1793f0ef4d..ea7744f495c 100644 --- a/testing/schrodingertest/testng-integration.xml +++ b/testing/schrodingertest/testng-integration.xml @@ -108,4 +108,12 @@ + + + + + + + + \ No newline at end of file diff --git a/tools/schrodinger/pom.xml b/tools/schrodinger/pom.xml index 066cd0c03cf..7f8fec8a528 100644 --- a/tools/schrodinger/pom.xml +++ b/tools/schrodinger/pom.xml @@ -59,6 +59,18 @@ runtime + + com.evolveum.midpoint.infra + schema + ${project.version} + + + net.sf.jasperreports + jasperreports + + + + org.testng testng diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/AssignmentsTab.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/AssignmentsTab.java index 447d9bc752e..89655be5f04 100644 --- a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/AssignmentsTab.java +++ b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/AssignmentsTab.java @@ -8,11 +8,13 @@ package com.evolveum.midpoint.schrodinger.component; import com.codeborne.selenide.Condition; +import com.codeborne.selenide.Selenide; import com.codeborne.selenide.SelenideElement; import com.evolveum.midpoint.schrodinger.MidPoint; import com.evolveum.midpoint.schrodinger.component.modal.FocusSetAssignmentsModal; import com.evolveum.midpoint.schrodinger.component.common.PrismFormWithActionButtons; import com.evolveum.midpoint.schrodinger.component.common.table.AbstractTableWithPrismView; +import com.evolveum.midpoint.schrodinger.component.table.DirectIndirectAssignmentTable; import com.evolveum.midpoint.schrodinger.page.AssignmentHolderDetailsPage; import com.evolveum.midpoint.schrodinger.util.Schrodinger; @@ -27,13 +29,13 @@ public AssignmentsTab(P parent, SelenideElement parentElement) { super(parent, parentElement); } - public AbstractTableWithPrismView> table() { + public > AbstractTableWithPrismView table() { SelenideElement tableBox = $(Schrodinger.byDataId("div", "assignmentsTable")); - return new AbstractTableWithPrismView>(this, tableBox) { + return new AbstractTableWithPrismView((A) this, tableBox) { @Override - public PrismFormWithActionButtons>> clickByName(String name) { + public PrismFormWithActionButtons> clickByName(String name) { $(Schrodinger.byElementValue("span", "data-s-id", "label", name)) .waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S).click(); @@ -45,7 +47,7 @@ public PrismFormWithActionButtons>> } @Override - public AbstractTableWithPrismView> selectCheckboxByName(String name) { + public AbstractTableWithPrismView selectCheckboxByName(String name) { $(Schrodinger.byFollowingSiblingEnclosedValue("td", "class", "check", "data-s-id", "3", name)) .waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S).click(); @@ -53,7 +55,7 @@ public AbstractTableWithPrismView> selectCheckboxByName(String return this; } - public AbstractTableWithPrismView> removeByName(String name) { + public AbstractTableWithPrismView removeByName(String name) { $(Schrodinger.byAncestorPrecedingSiblingDescendantOrSelfElementEnclosedValue("button", "title", "Unassign", null, null, name)) .waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S).click(); @@ -63,14 +65,14 @@ public AbstractTableWithPrismView> removeByName(String name) { }; } - public FocusSetAssignmentsModal> clickAddAssignemnt() { + public > FocusSetAssignmentsModal clickAddAssignemnt() { $(Schrodinger.byElementAttributeValue("i", "class", "fe fe-assignment ")) .waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S).click(); SelenideElement modalElement = $(Schrodinger.byElementAttributeValue("div", "aria-labelledby", "Select object(s)")) .waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S); - return new FocusSetAssignmentsModal<>(this, modalElement); + return new FocusSetAssignmentsModal((A) this, modalElement); } public boolean assignmentExists(String assignmentName){ @@ -80,4 +82,42 @@ public boolean assignmentExists(String assignmentName){ .$(Schrodinger.byDataId("displayName")); return assignmentName.equals(assignmentSummaryDisplayName.getText()); } + + public > A selectTypeAll() { + selectType("allAssignments"); + return (A) this; + } + + public > A selectTypeRole() { + selectType("roleTypeAssignments"); + return (A) this; + } + + public > A selectTypeOrg() { + selectType("orgTypeAssignments"); + return (A) this; + } + + public > A selectTypeService() { + selectType("serviceAssignments"); + return (A) this; + } + + public > A selectTypeResource() { + selectType("resourceAssignments"); + return (A) this; + } + + public > DirectIndirectAssignmentTable selectTypeAllDirectIndirect() { + selectType("showIndirectAssignmentsButton"); + Selenide.sleep(MidPoint.TIMEOUT_MEDIUM_6_S); + SelenideElement table = $(Schrodinger.byDataId("table", "table")); + + return new DirectIndirectAssignmentTable((A) this, table); + } + + protected void selectType(String resourceKey) { + $(Schrodinger.byDataId("div", resourceKey)).click(); + Selenide.sleep(MidPoint.TIMEOUT_DEFAULT_2_S); + } } diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/InducementsTab.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/InducementsTab.java new file mode 100644 index 00000000000..95ca083ea23 --- /dev/null +++ b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/InducementsTab.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2010-2018 Evolveum and contributors + * + * This work is dual-licensed under the Apache License 2.0 + * and European Union Public License. See LICENSE file for details. + */ + +package com.evolveum.midpoint.schrodinger.component; + +import com.codeborne.selenide.Condition; +import com.codeborne.selenide.SelenideElement; + +import com.evolveum.midpoint.schrodinger.MidPoint; +import com.evolveum.midpoint.schrodinger.component.common.PrismFormWithActionButtons; +import com.evolveum.midpoint.schrodinger.component.common.table.AbstractTableWithPrismView; +import com.evolveum.midpoint.schrodinger.component.modal.FocusSetAssignmentsModal; +import com.evolveum.midpoint.schrodinger.page.AbstractRolePage; +import com.evolveum.midpoint.schrodinger.page.AssignmentHolderDetailsPage; +import com.evolveum.midpoint.schrodinger.util.Schrodinger; + +import static com.codeborne.selenide.Selenide.$; + +/** + * Created by Viliam Repan (lazyman). + */ +public class InducementsTab

extends AssignmentsTab

{ + + public InducementsTab(P parent, SelenideElement parentElement) { + super(parent, parentElement); + } + + public AbstractTableWithPrismView> table() { + + SelenideElement tableBox = $(Schrodinger.byDataId("div", "assignmentsTable")); + + return new AbstractTableWithPrismView>(this, tableBox) { + @Override + public PrismFormWithActionButtons>> clickByName(String name) { + + $(Schrodinger.byElementValue("span", "data-s-id", "label", name)) + .waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S).click(); + + SelenideElement prismElement = $(Schrodinger.byDataId("div", "assignmentsContainer")) + .waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S); + + return new PrismFormWithActionButtons<>(this, prismElement); + } + + @Override + public AbstractTableWithPrismView> selectCheckboxByName(String name) { + + $(Schrodinger.byFollowingSiblingEnclosedValue("td", "class", "check", "data-s-id", "3", name)) + .waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S).click(); + + return this; + } + + public AbstractTableWithPrismView> removeByName(String name) { + + $(Schrodinger.byAncestorPrecedingSiblingDescendantOrSelfElementEnclosedValue("button", "title", "Unassign", null, null, name)) + .waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S).click(); + + return this; + } + }; + } + + + + public FocusSetAssignmentsModal> clickAddInducement() { + return super.clickAddAssignemnt(); + } + + public boolean inducementExists(String inducementName){ + return super.assignmentExists(inducementName); + } +} diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/ProjectionsTab.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/ProjectionsTab.java index 1c95f229942..5de0bab92a8 100644 --- a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/ProjectionsTab.java +++ b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/ProjectionsTab.java @@ -15,6 +15,7 @@ import com.evolveum.midpoint.schrodinger.component.modal.FocusSetProjectionModal; import com.evolveum.midpoint.schrodinger.component.user.ProjectionsDropDown; import com.evolveum.midpoint.schrodinger.page.AssignmentHolderDetailsPage; +import com.evolveum.midpoint.schrodinger.page.FocusPage; import com.evolveum.midpoint.schrodinger.page.user.UserPage; import com.evolveum.midpoint.schrodinger.util.Schrodinger; import org.openqa.selenium.By; @@ -24,8 +25,8 @@ /** * Created by Viliam Repan (lazyman). */ -public class ProjectionsTab

extends Component { - public ProjectionsTab(UserPage parent, SelenideElement parentElement) { +public class ProjectionsTab

extends Component { + public ProjectionsTab(FocusPage parent, SelenideElement parentElement) { super(parent, parentElement); } diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/archetype/ArchetypePolicyTab.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/archetype/ArchetypePolicyTab.java new file mode 100644 index 00000000000..34aba967255 --- /dev/null +++ b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/archetype/ArchetypePolicyTab.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2010-2019 Evolveum and contributors + * + * This work is dual-licensed under the Apache License 2.0 + * and European Union Public License. See LICENSE file for details. + */ +package com.evolveum.midpoint.schrodinger.component.archetype; + +import com.codeborne.selenide.SelenideElement; + +import com.evolveum.midpoint.schrodinger.component.AssignmentHolderBasicTab; +import com.evolveum.midpoint.schrodinger.page.archetype.ArchetypePage; + +/** + * @author skublik + */ + +public class ArchetypePolicyTab extends AssignmentHolderBasicTab { + public ArchetypePolicyTab(ArchetypePage parent, SelenideElement parentElement) { + super(parent, parentElement); + } +} diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/assignmentholder/AssignmentHolderObjectListTable.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/assignmentholder/AssignmentHolderObjectListTable.java index 3f8e9e50b79..0cf2d70f9bb 100644 --- a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/assignmentholder/AssignmentHolderObjectListTable.java +++ b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/assignmentholder/AssignmentHolderObjectListTable.java @@ -41,7 +41,7 @@ public PD clickByName(String name) { getParentElement().$(Schrodinger.byElementValue("span", "data-s-id", "label", name)) .waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S).click(); -// Selenide.sleep(2000); + Selenide.sleep(MidPoint.TIMEOUT_DEFAULT_2_S); return getObjectDetailsPage(); } diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/common/Popover.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/common/Popover.java index 71698c2bf9a..94d8f3c356e 100644 --- a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/common/Popover.java +++ b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/common/Popover.java @@ -28,6 +28,12 @@ public Popover inputValue(String input) { return this; } + public Popover inputRefOid(String oid) { + getDisplayedElement(getParentElement().$$(Schrodinger.byDataId("oid"))).waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S).setValue(oid); + + return this; + } + public Popover inputValueWithEnter(String input) { SelenideElement inputField = getDisplayedElement(getParentElement().$$(Schrodinger.byDataId("textInput"))); inputField.waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S).setValue(input); diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/common/PrismForm.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/common/PrismForm.java index 72a4d333361..9064243c42b 100644 --- a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/common/PrismForm.java +++ b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/common/PrismForm.java @@ -19,6 +19,8 @@ import javax.xml.namespace.QName; import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import static com.codeborne.selenide.Selenide.$; @@ -117,6 +119,43 @@ public Boolean compareInputAttributeValue(String name, String expectedValue) { } + public Boolean compareInputAttributeValues(String name, String... expectedValues) { + return compareInputAttributeValues(name, Arrays.asList(expectedValues)); + } + + public Boolean containsInputAttributeValues(String name, String... expectedValues) { + return containsInputAttributeValues(name, Arrays.asList(expectedValues)); + } + + public Boolean compareInputAttributeValues(String name, List expectedValues) { + return compareInputAttributeValues(name, expectedValues, true); + } + + public Boolean containsInputAttributeValues(String name, List expectedValues) { + return compareInputAttributeValues(name, expectedValues, false); + } + + private Boolean compareInputAttributeValues(String name, List expectedValues, boolean strictSameValues) { + SelenideElement property = findProperty(name); + ElementsCollection valuesElements = property.parent().$$(By.xpath(".//input[contains(@class,\"form-control\")]")); + List values = new ArrayList(); + for (SelenideElement valueElement : valuesElements) { + String value = valueElement.getValue(); + if (!value.isEmpty()) { + return values.add(value); + } + } + if (!values.isEmpty()) { + if (strictSameValues) { + return values.equals(expectedValues); + } + return values.containsAll(expectedValues); + } else { + return expectedValues.isEmpty(); + } + + } + public Boolean compareSelectAttributeValue(String name, String expectedValue) { SelenideElement property = findProperty(name); SelenideElement value = property.$(By.xpath(".//select[contains(@class,\"form-control\")]")); diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/common/Search.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/common/Search.java index cf6402d081a..8d20ca56f73 100644 --- a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/common/Search.java +++ b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/common/Search.java @@ -7,16 +7,12 @@ package com.evolveum.midpoint.schrodinger.component.common; -import com.codeborne.selenide.Condition; -import com.codeborne.selenide.ElementsCollection; -import com.codeborne.selenide.Selenide; -import com.codeborne.selenide.SelenideElement; +import com.codeborne.selenide.*; + import com.evolveum.midpoint.schrodinger.MidPoint; import com.evolveum.midpoint.schrodinger.component.Component; import com.evolveum.midpoint.schrodinger.util.Schrodinger; -import org.openqa.selenium.By; - /** * Created by Viliam Repan (lazyman). */ @@ -61,10 +57,10 @@ public InputBox> byFullText() { public Search addSearchItem(String name) { choiceBasicSearch(); getParentElement().$(Schrodinger.byDataId("a", "more")).waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S).click(); - Selenide.sleep(2000); + Selenide.sleep(MidPoint.TIMEOUT_DEFAULT_2_S); SelenideElement popover = getDisplayedPopover(); popover.$(Schrodinger.byDataId("input", "addText")).setValue(name); - Selenide.sleep(2000); + Selenide.sleep(MidPoint.TIMEOUT_DEFAULT_2_S); popover.$(Schrodinger.byDataId("a", "propLink")).click(); return this; } @@ -111,5 +107,23 @@ private SelenideElement getDisplayedPopover() { return popover; } + public Search resetBasicSearch() { + choiceBasicSearch(); + SelenideElement nameItem = getItemByName("Name"); + if (nameItem != null) { + nameItem.waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S).click(); + Selenide.sleep(1000); + new Popover<>(this, nameItem).inputValue("").updateSearch(); + } + + ElementsCollection deleteButtons = getParentElement().$$(Schrodinger.byDataId("deleteButton")); + for (SelenideElement deleteButton : deleteButtons) { + if (deleteButton.isDisplayed()) { + deleteButton.click(); + } + } + Selenide.sleep(2000); + return this; + } } diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/common/table/Table.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/common/table/Table.java index cf7fb130cd1..f9cd95b5507 100644 --- a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/common/table/Table.java +++ b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/common/table/Table.java @@ -70,7 +70,7 @@ public TableRow rowByColumnResourceKey(String key, String rowValue) { return null; } - public Search search() { + public Search> search() { SelenideElement searchElement = getParentElement().$(By.cssSelector(".form-inline.pull-right.search-form")); return new Search<>(this, searchElement); @@ -106,7 +106,7 @@ public boolean currentTableContains(String elementName, String elementValue) { } public boolean containsText(String value) { - return $(byText(value)).is(Condition.visible); + return getParentElement().$(byText(value)).is(Condition.visible); } public boolean containsLinkTextPartially(String value) { diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/resource/ResourceAccountsTab.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/resource/ResourceAccountsTab.java index abdd1c40805..4df674fc2a3 100644 --- a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/resource/ResourceAccountsTab.java +++ b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/resource/ResourceAccountsTab.java @@ -13,6 +13,7 @@ import com.evolveum.midpoint.schrodinger.component.Component; import com.evolveum.midpoint.schrodinger.util.Schrodinger; import org.openqa.selenium.By; +import org.openqa.selenium.Keys; import static com.codeborne.selenide.Selenide.$; import static com.codeborne.selenide.Selenide.$$; @@ -89,4 +90,9 @@ public ResourceShadowTable> table() { return new ResourceShadowTable<>(this, element); } + public void setIntent(String intent) { + $(Schrodinger.byDataId("div", "intent")).$(Schrodinger.byDataId("input", "input")) + .setValue(intent).sendKeys(Keys.ENTER); + } + } diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/resource/ResourceShadowTable.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/resource/ResourceShadowTable.java index 1e8f246e250..a13a99bd2da 100644 --- a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/resource/ResourceShadowTable.java +++ b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/resource/ResourceShadowTable.java @@ -9,10 +9,15 @@ import com.codeborne.selenide.Condition; import com.codeborne.selenide.SelenideElement; import com.evolveum.midpoint.schrodinger.MidPoint; +import com.evolveum.midpoint.schrodinger.component.assignmentholder.AssignmentHolderObjectListTable; +import com.evolveum.midpoint.schrodinger.component.common.Search; import com.evolveum.midpoint.schrodinger.component.common.table.TableWithPageRedirect; import com.evolveum.midpoint.schrodinger.page.BasicPage; +import com.evolveum.midpoint.schrodinger.page.resource.AccountPage; import com.evolveum.midpoint.schrodinger.util.Schrodinger; +import org.openqa.selenium.By; + import static com.codeborne.selenide.Selenide.$; /** @@ -24,8 +29,11 @@ public ResourceShadowTable(T parent, SelenideElement parentElement) { } @Override - public E clickByName(String name) { - return null; + public AccountPage clickByName(String name) { + getParentElement().$(Schrodinger.byElementValue("span", "data-s-id", "label", name)) + .waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S).click(); + + return new AccountPage(); } @Override @@ -47,4 +55,9 @@ public ResourceShadowTableCog> clickCog() { return new ResourceShadowTableCog<>(this, cog); } + @Override + public Search> search() { + return (Search>) super.search(); + } + } diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/table/DirectIndirectAssignmentTable.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/table/DirectIndirectAssignmentTable.java new file mode 100644 index 00000000000..f7ac85df959 --- /dev/null +++ b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/table/DirectIndirectAssignmentTable.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2010-2019 Evolveum and contributors + * + * This work is dual-licensed under the Apache License 2.0 + * and European Union Public License. See LICENSE file for details. + */ +package com.evolveum.midpoint.schrodinger.component.table; + +import com.codeborne.selenide.ElementsCollection; +import com.codeborne.selenide.SelenideElement; + +import com.evolveum.midpoint.schrodinger.component.common.DropDown; +import com.evolveum.midpoint.schrodinger.util.Schrodinger; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * @author skublik + */ + +public class DirectIndirectAssignmentTable extends DropDown { + + public DirectIndirectAssignmentTable(T parent, SelenideElement parentElement) { + super(parent, parentElement); + } + + public boolean containsIndirectAssignments(String... expectedAssignments) { + return containsAssignments("Indirect", expectedAssignments); + } + + public boolean containsDirectAssignments(String... expectedAssignments) { + return containsAssignments("Direct", expectedAssignments); + } + + private boolean containsAssignments(String status, String... expectedAssignments) { + ElementsCollection labels = getParentElement() + .$$(Schrodinger.byAncestorFollowingSiblingDescendantOrSelfElementEnclosedValue("span", "data-s-id", "label", "data-s-id", "3", status)); + List indirectAssignments = new ArrayList(); + for (SelenideElement label : labels) { + if (!label.getText().isEmpty()) { + indirectAssignments.add(label.getText()); + } + } + return indirectAssignments.containsAll(Arrays.asList(expectedAssignments)); + } +} diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/user/UserHistoryTab.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/user/UserHistoryTab.java index a857c416f40..2ae5346f12b 100644 --- a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/user/UserHistoryTab.java +++ b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/user/UserHistoryTab.java @@ -1,22 +1,22 @@ -/* - * Copyright (c) 2010-2018 Evolveum and contributors - * - * This work is dual-licensed under the Apache License 2.0 - * and European Union Public License. See LICENSE file for details. - */ - -package com.evolveum.midpoint.schrodinger.component.user; - -import com.codeborne.selenide.SelenideElement; -import com.evolveum.midpoint.schrodinger.component.Component; -import com.evolveum.midpoint.schrodinger.page.user.UserPage; - -/** - * Created by Viliam Repan (lazyman). - */ -public class UserHistoryTab extends Component { - - public UserHistoryTab(UserPage parent, SelenideElement parentElement) { - super(parent, parentElement); - } -} +/* + * Copyright (c) 2010-2018 Evolveum and contributors + * + * This work is dual-licensed under the Apache License 2.0 + * and European Union Public License. See LICENSE file for details. + */ + +package com.evolveum.midpoint.schrodinger.component.user; + +import com.codeborne.selenide.SelenideElement; +import com.evolveum.midpoint.schrodinger.component.Component; +import com.evolveum.midpoint.schrodinger.page.user.UserPage; + +/** + * Created by Viliam Repan (lazyman). + */ +public class UserHistoryTab extends Component { + + public UserHistoryTab(UserPage parent, SelenideElement parentElement) { + super(parent, parentElement); + } +} diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/user/UsersPageTable.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/user/UsersPageTable.java index 7fb4bfddd02..a13aebaa3eb 100644 --- a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/user/UsersPageTable.java +++ b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/component/user/UsersPageTable.java @@ -9,6 +9,7 @@ import com.codeborne.selenide.Condition; import com.codeborne.selenide.ElementsCollection; +import com.codeborne.selenide.Selenide; import com.codeborne.selenide.SelenideElement; import com.evolveum.midpoint.schrodinger.MidPoint; import com.evolveum.midpoint.schrodinger.component.assignmentholder.AssignmentHolderObjectListTable; @@ -35,8 +36,8 @@ public UsersTableDropDown clickActionDropDown() { $(Schrodinger.bySelfOrAncestorElementAttributeValue("button", "data-toggle", "dropdown", "class", "sortableLabel")) .waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S).click(); - - SelenideElement dropDown = $(Schrodinger.byElementAttributeValue("ul", "class", "dropdown-menu pull-right")) + Selenide.sleep(MidPoint.TIMEOUT_DEFAULT_2_S); + SelenideElement dropDown = $(Schrodinger.byDataId("ul", "dropDownMenu")) .waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S); return new UsersTableDropDown<>(this, dropDown); diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/AbstractRolePage.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/AbstractRolePage.java new file mode 100644 index 00000000000..40c156f6f29 --- /dev/null +++ b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/AbstractRolePage.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2010-2019 Evolveum and contributors + * + * This work is dual-licensed under the Apache License 2.0 + * and European Union Public License. See LICENSE file for details. + */ +package com.evolveum.midpoint.schrodinger.page; + +import com.codeborne.selenide.SelenideElement; + +import com.evolveum.midpoint.schrodinger.component.AssignmentsTab; +import com.evolveum.midpoint.schrodinger.component.InducementsTab; + +/** + * @author skublik + */ + +public class AbstractRolePage extends FocusPage { + + public InducementsTab selectTabInducements() { + SelenideElement element = findTabPanel().clickTab("FocusType.inducement"); + + return new InducementsTab((A) this, element); + } +} diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/BasicPage.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/BasicPage.java index a737f106e94..51d214c1e38 100644 --- a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/BasicPage.java +++ b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/BasicPage.java @@ -13,9 +13,10 @@ import com.evolveum.midpoint.schrodinger.component.LoggedUser; import com.evolveum.midpoint.schrodinger.component.common.FeedbackBox; import com.evolveum.midpoint.schrodinger.component.configuration.*; +import com.evolveum.midpoint.schrodinger.page.archetype.ListArchetypesPage; import com.evolveum.midpoint.schrodinger.page.certification.*; import com.evolveum.midpoint.schrodinger.page.configuration.*; -import com.evolveum.midpoint.schrodinger.page.org.NewOrgPage; +import com.evolveum.midpoint.schrodinger.page.org.OrgPage; import com.evolveum.midpoint.schrodinger.page.org.OrgTreePage; import com.evolveum.midpoint.schrodinger.page.report.AuditLogViewerPage; import com.evolveum.midpoint.schrodinger.page.report.CreatedReportsPage; @@ -26,7 +27,7 @@ import com.evolveum.midpoint.schrodinger.page.resource.ListResourcesPage; import com.evolveum.midpoint.schrodinger.page.resource.NewResourcePage; import com.evolveum.midpoint.schrodinger.page.role.ListRolesPage; -import com.evolveum.midpoint.schrodinger.page.role.NewRolePage; +import com.evolveum.midpoint.schrodinger.page.role.RolePage; import com.evolveum.midpoint.schrodinger.page.self.CredentialsPage; import com.evolveum.midpoint.schrodinger.page.self.HomePage; import com.evolveum.midpoint.schrodinger.page.self.ProfilePage; @@ -103,9 +104,9 @@ public OrgTreePage orgStructure() { return new OrgTreePage(); } - public NewOrgPage newOrgUnit() { + public OrgPage newOrgUnit() { clickAdministrationMenu("PageAdmin.menu.top.users.org", "PageAdmin.menu.top.users.org.new"); - return new NewOrgPage(); + return new OrgPage(); } public ListRolesPage listRoles() { @@ -113,9 +114,9 @@ public ListRolesPage listRoles() { return new ListRolesPage(); } - public NewRolePage newRole() { + public RolePage newRole() { clickAdministrationMenu("PageAdmin.menu.top.roles", "PageAdmin.menu.top.roles.new"); - return new NewRolePage(); + return new RolePage(); } public ListServicesPage listServices() { @@ -128,6 +129,11 @@ public NewServicePage newService() { return new NewServicePage(); } + public ListArchetypesPage listArchetypes() { + clickAdministrationMenu("PageAdmin.menu.top.archetypes", "PageAdmin.menu.top.archetypes.list"); + return new ListArchetypesPage(); + } + public ListResourcesPage listResources() { clickAdministrationMenu("PageAdmin.menu.top.resources", "PageAdmin.menu.top.resources.list"); return new ListResourcesPage(); diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/FocusPage.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/FocusPage.java new file mode 100644 index 00000000000..e07d037518a --- /dev/null +++ b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/FocusPage.java @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2010-2019 Evolveum and contributors + * + * This work is dual-licensed under the Apache License 2.0 + * and European Union Public License. See LICENSE file for details. + */ +package com.evolveum.midpoint.schrodinger.page; + +import com.codeborne.selenide.Condition; +import com.codeborne.selenide.Selenide; +import com.codeborne.selenide.SelenideElement; + +import com.evolveum.midpoint.schrodinger.MidPoint; +import com.evolveum.midpoint.schrodinger.component.AssignmentHolderBasicTab; +import com.evolveum.midpoint.schrodinger.component.AssignmentsTab; +import com.evolveum.midpoint.schrodinger.component.ProjectionsTab; +import com.evolveum.midpoint.schrodinger.component.common.SummaryPanel; +import com.evolveum.midpoint.schrodinger.component.user.*; +import com.evolveum.midpoint.schrodinger.page.user.UserPage; +import com.evolveum.midpoint.schrodinger.util.Schrodinger; + +import org.openqa.selenium.By; + +import static com.codeborne.selenide.Selenide.$; + +import static com.evolveum.midpoint.schrodinger.util.Utils.setOptionChecked; + +/** + * @author skublik + */ + +public class FocusPage extends AssignmentHolderDetailsPage { + + public FocusPage checkForce() { + setOptionChecked("executeOptions:force", true); + return this; + } + + public FocusPage checkReconcile() { + setOptionChecked("executeOptions:reconcileContainer:container:check", true); + return this; + } + + public FocusPage checkExecuteAfterAllApprovals() { + setOptionChecked("executeOptions:executeAfterAllApprovals", true); + return this; + } + + public FocusPage checkKeepDisplayingResults() { + setOptionChecked("executeOptions:keepDisplayingResultsContainer:container:check", true); + return this; + } + + public FocusPage uncheckForce() { + setOptionChecked("executeOptions:force", false); + return this; + } + + public FocusPage uncheckReconcile() { + setOptionChecked("executeOptions:reconcileLabel:reconcile", false); + return this; + } + + public FocusPage uncheckExecuteAfterAllApprovals() { + setOptionChecked("executeOptions:executeAfterAllApprovals", false); + return this; + } + + public FocusPage uncheckKeepDisplayingResults() { + setOptionChecked("executeOptions:keepDisplayingResultsContainer:keepDisplayingResults", false); + return this; + } + + public ProjectionsTab selectTabProjections() { + SelenideElement element = findTabPanel().clickTab("pageAdminFocus.projections"); + Selenide.sleep(2000); + return new ProjectionsTab(this, element); + } + + + public SummaryPanel summary() { + + SelenideElement summaryPanel = $(By.cssSelector("div.info-box-content")); + + return new SummaryPanel(this, summaryPanel); + } + + public boolean isActivationState(String state) { + + SelenideElement summaryPanel = $(Schrodinger.byDataId("span", "summaryTagLabel")).waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT_2_S); + + if (state != null || !(state.isEmpty())) { + return state.equals(summaryPanel.getText()); + } else { + return "".equals(summaryPanel.getText()); + } + } + + @Override + public

AssignmentHolderBasicTab

selectTabBasic(){ + SelenideElement element = findTabPanel().clickTab("pageAdminFocus.basic") + .waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT_2_S); + + return new AssignmentHolderBasicTab

((P) this, element); + } + + @Override + public

AssignmentsTab

selectTabAssignments(){ + SelenideElement element = findTabPanel().clickTab("pageAdminFocus.assignments"); + + return new AssignmentsTab

((P) this, element); + } +} diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/archetype/ArchetypePage.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/archetype/ArchetypePage.java new file mode 100644 index 00000000000..3c276fd0229 --- /dev/null +++ b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/archetype/ArchetypePage.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2010-2019 Evolveum and contributors + * + * This work is dual-licensed under the Apache License 2.0 + * and European Union Public License. See LICENSE file for details. + */ +package com.evolveum.midpoint.schrodinger.page.archetype; + +import com.codeborne.selenide.Condition; +import com.codeborne.selenide.SelenideElement; + +import com.evolveum.midpoint.schrodinger.MidPoint; +import com.evolveum.midpoint.schrodinger.component.AssignmentHolderBasicTab; +import com.evolveum.midpoint.schrodinger.component.AssignmentsTab; +import com.evolveum.midpoint.schrodinger.component.ProjectionsTab; +import com.evolveum.midpoint.schrodinger.component.archetype.ArchetypePolicyTab; +import com.evolveum.midpoint.schrodinger.page.AbstractRolePage; + +/** + * Created by Viliam Repan (lazyman). + */ +public class ArchetypePage extends AbstractRolePage { + + @Override + public ProjectionsTab selectTabProjections() { + return super.selectTabProjections(); + } + + @Override + public AssignmentHolderBasicTab selectTabBasic() { + return super.selectTabBasic(); + } + + @Override + public AssignmentsTab selectTabAssignments() { + return super.selectTabAssignments(); + } + + public ArchetypePolicyTab selectTabArchetypePolicy() { + SelenideElement element = findTabPanel().clickTab("PageArchetype.archetypePolicy") + .waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT_2_S); + + return new ArchetypePolicyTab(this, element); + } + +} diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/archetype/ListArchetypesPage.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/archetype/ListArchetypesPage.java new file mode 100644 index 00000000000..6bf26deb09b --- /dev/null +++ b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/archetype/ListArchetypesPage.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2010-2019 Evolveum and contributors + * + * This work is dual-licensed under the Apache License 2.0 + * and European Union Public License. See LICENSE file for details. + */ +package com.evolveum.midpoint.schrodinger.page.archetype; + +import com.evolveum.midpoint.schrodinger.component.assignmentholder.AssignmentHolderObjectListPage; +import com.evolveum.midpoint.schrodinger.component.assignmentholder.AssignmentHolderObjectListTable; +import com.evolveum.midpoint.schrodinger.component.user.UsersPageTable; +import com.evolveum.midpoint.schrodinger.page.AssignmentHolderDetailsPage; +import com.evolveum.midpoint.schrodinger.page.BasicPage; + +/** + * Created by Viliam Repan (lazyman). + */ +public class ListArchetypesPage extends AssignmentHolderObjectListPage { + + @Override + public AssignmentHolderObjectListTable table() { + return new AssignmentHolderObjectListTable(this, getTableBoxElement()) { + @Override + public ArchetypePage getObjectDetailsPage() { + return new ArchetypePage(); + } + }; + } + +} diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/org/NewOrgPage.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/org/OrgPage.java similarity index 51% rename from tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/org/NewOrgPage.java rename to tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/org/OrgPage.java index af99ce36b98..219de0cbf46 100644 --- a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/org/NewOrgPage.java +++ b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/org/OrgPage.java @@ -11,25 +11,29 @@ import com.evolveum.midpoint.schrodinger.MidPoint; import com.evolveum.midpoint.schrodinger.component.AssignmentHolderBasicTab; import com.evolveum.midpoint.schrodinger.component.AssignmentsTab; +import com.evolveum.midpoint.schrodinger.component.ProjectionsTab; +import com.evolveum.midpoint.schrodinger.page.AbstractRolePage; import com.evolveum.midpoint.schrodinger.page.AssignmentHolderDetailsPage; +import com.evolveum.midpoint.schrodinger.page.FocusPage; +import com.evolveum.midpoint.schrodinger.page.role.RolePage; /** * Created by Viliam Repan (lazyman). */ -public class NewOrgPage extends AssignmentHolderDetailsPage { +public class OrgPage extends AbstractRolePage { @Override - public AssignmentHolderBasicTab selectTabBasic(){ - SelenideElement element = findTabPanel().clickTab("pageAdminFocus.basic") - .waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT_2_S); - - return new AssignmentHolderBasicTab(this, element); + public ProjectionsTab selectTabProjections() { + return super.selectTabProjections(); } - public AssignmentsTab selectTabAssignments(){ - SelenideElement element = findTabPanel().clickTab("pageAdminFocus.assignments"); - - return new AssignmentsTab(this, element); + @Override + public AssignmentHolderBasicTab selectTabBasic() { + return super.selectTabBasic(); } + @Override + public AssignmentsTab selectTabAssignments() { + return super.selectTabAssignments(); + } } diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/resource/AccountPage.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/resource/AccountPage.java new file mode 100644 index 00000000000..f48e77c91f5 --- /dev/null +++ b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/resource/AccountPage.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2010-2019 Evolveum and contributors + * + * This work is dual-licensed under the Apache License 2.0 + * and European Union Public License. See LICENSE file for details. + */ +package com.evolveum.midpoint.schrodinger.page.resource; + +import com.codeborne.selenide.Condition; + +import com.codeborne.selenide.SelenideElement; + +import com.evolveum.midpoint.schrodinger.MidPoint; +import com.evolveum.midpoint.schrodinger.component.AssignmentHolderBasicTab; +import com.evolveum.midpoint.schrodinger.component.common.PrismForm; +import com.evolveum.midpoint.schrodinger.page.BasicPage; +import com.evolveum.midpoint.schrodinger.page.user.ProgressPage; +import com.evolveum.midpoint.schrodinger.page.user.UserPage; +import com.evolveum.midpoint.schrodinger.util.Schrodinger; + +import static com.codeborne.selenide.Selenide.$; + +/** + * @author skublik + */ + +public class AccountPage extends BasicPage { + + public BasicPage clickBack() { + $(Schrodinger.byDataResourceKey("pageAccount.button.back")) + .waitUntil(Condition.visible, MidPoint.TIMEOUT_DEFAULT_2_S) + .click(); + return new BasicPage(); + } + + public ProgressPage clickSave() { + $(Schrodinger.byDataId("save")).waitUntil(Condition.visible, MidPoint.TIMEOUT_DEFAULT_2_S).click(); + return new ProgressPage(); + } + + public PrismForm form() { + SelenideElement element = null; + return new PrismForm(this, element); + } + +} diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/resource/EditResourceConfigurationPage.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/resource/EditResourceConfigurationPage.java index dfdac82f635..cb3d77753c1 100644 --- a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/resource/EditResourceConfigurationPage.java +++ b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/resource/EditResourceConfigurationPage.java @@ -60,7 +60,7 @@ public ResourceResultsHandlersTab selectTabResultHandlers() { public TestConnectionModal clickSaveAndTestConnection() { $(Schrodinger.byDataId("testConnection")).waitUntil(Condition.visible, MidPoint.TIMEOUT_DEFAULT_2_S).click(); - Selenide.sleep(MidPoint.TIMEOUT_LONG_1_M); +// Selenide.sleep(MidPoint.TIMEOUT_LONG_1_M); SelenideElement testModalBox = $(Schrodinger .byElementAttributeValue("div", "aria-labelledby", "Test connection result(s)")) .waitUntil(Condition.visible, MidPoint.TIMEOUT_EXTRA_LONG_1_M); diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/resource/ViewResourcePage.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/resource/ViewResourcePage.java index 708b6236fd4..bc68a9de7f4 100644 --- a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/resource/ViewResourcePage.java +++ b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/resource/ViewResourcePage.java @@ -23,7 +23,7 @@ public ResourceConfigurationTab clickEditResourceConfiguration() { $(Schrodinger.byDataResourceKey("a", "pageResource.button.configurationEdit")).waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S).click(); - SelenideElement element= $(By.cssSelector(".tab-pane.active")) + SelenideElement element= $(By.cssSelector(".tab0.active")) .waitUntil(Condition.visible, MidPoint.TIMEOUT_LONG_1_M); return new ResourceConfigurationTab(new EditResourceConfigurationPage(), element); @@ -39,7 +39,7 @@ public ResourceWizardPage clickShowUsingWizard() { public ResourceAccountsTab clickAccountsTab() { $(Schrodinger.byDataResourceKey("schrodinger", "PageResource.tab.content.account")).parent() - .waitUntil(Condition.visible, MidPoint.TIMEOUT_DEFAULT_2_S).click(); + .waitUntil(Condition.visible, MidPoint.TIMEOUT_MEDIUM_6_S).click(); $(By.className("resource-content-selection")).waitUntil(Condition.visible, MidPoint.TIMEOUT_MEDIUM_6_S); SelenideElement tabContent = $(By.cssSelector(".tab-pane.active")) .waitUntil(Condition.visible, MidPoint.TIMEOUT_DEFAULT_2_S); diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/role/NewRolePage.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/role/NewRolePage.java deleted file mode 100644 index c807baac166..00000000000 --- a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/role/NewRolePage.java +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) 2010-2019 Evolveum and contributors - * - * This work is dual-licensed under the Apache License 2.0 - * and European Union Public License. See LICENSE file for details. - */ -package com.evolveum.midpoint.schrodinger.page.role; - -import com.evolveum.midpoint.schrodinger.page.BasicPage; - -/** - * Created by Viliam Repan (lazyman). - */ -public class NewRolePage extends BasicPage { -} diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/role/RolePage.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/role/RolePage.java new file mode 100644 index 00000000000..64cc99422fc --- /dev/null +++ b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/role/RolePage.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2010-2019 Evolveum and contributors + * + * This work is dual-licensed under the Apache License 2.0 + * and European Union Public License. See LICENSE file for details. + */ +package com.evolveum.midpoint.schrodinger.page.role; + +import com.evolveum.midpoint.schrodinger.component.AssignmentHolderBasicTab; +import com.evolveum.midpoint.schrodinger.component.AssignmentsTab; +import com.evolveum.midpoint.schrodinger.component.InducementsTab; +import com.evolveum.midpoint.schrodinger.component.ProjectionsTab; +import com.evolveum.midpoint.schrodinger.page.AbstractRolePage; +import com.evolveum.midpoint.schrodinger.page.AssignmentHolderDetailsPage; +import com.evolveum.midpoint.schrodinger.page.BasicPage; +import com.evolveum.midpoint.schrodinger.page.FocusPage; + +/** + * Created by Viliam Repan (lazyman). + */ +public class RolePage extends AbstractRolePage { + + @Override + public ProjectionsTab selectTabProjections() { + return super.selectTabProjections(); + } + + @Override + public AssignmentHolderBasicTab selectTabBasic() { + return super.selectTabBasic(); + } + + @Override + public AssignmentsTab selectTabAssignments() { + return super.selectTabAssignments(); + } + +} diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/user/ListUsersPage.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/user/ListUsersPage.java index e96c5774fdc..00ef7fbc151 100644 --- a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/user/ListUsersPage.java +++ b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/user/ListUsersPage.java @@ -6,9 +6,18 @@ */ package com.evolveum.midpoint.schrodinger.page.user; +import com.codeborne.selenide.Condition; +import com.codeborne.selenide.SelenideElement; + +import com.evolveum.midpoint.schrodinger.MidPoint; import com.evolveum.midpoint.schrodinger.component.assignmentholder.AssignmentHolderObjectListPage; import com.evolveum.midpoint.schrodinger.component.user.UsersPageTable; import com.evolveum.midpoint.schrodinger.util.ConstantsUtil; +import com.evolveum.midpoint.schrodinger.util.Schrodinger; + +import org.openqa.selenium.By; + +import static com.codeborne.selenide.Selenide.$; /** * Created by Viliam Repan (lazyman). @@ -25,4 +34,25 @@ protected String getTableAdditionalClass(){ return ConstantsUtil.OBJECT_USER_BOX_COLOR; } + @Override + public UserPage newUser() { + SelenideElement mainButton = $(By.xpath("//button[@type='button'][@" + Schrodinger.DATA_S_ID + "='mainButton']")); + String expanded = mainButton.getAttribute("aria-haspopup"); + if (Boolean.getBoolean(expanded)) { + return newUser("user"); + } + mainButton.click(); + return new UserPage(); + } + + public UserPage newUser(String title) { + SelenideElement mainButton = $(By.xpath("//button[@type='button'][@" + Schrodinger.DATA_S_ID + "='mainButton']")); + if (!Boolean.getBoolean(mainButton.getAttribute("aria-expanded"))) { + mainButton.click(); + } + $(Schrodinger.byElementAttributeValue("div", "title", "New " + title.toLowerCase())) + .waitUntil(Condition.visible, MidPoint.TIMEOUT_DEFAULT_2_S).click(); + return new UserPage(); + } + } diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/user/UserPage.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/user/UserPage.java index d2cb59ec01a..45f352ac8e4 100644 --- a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/user/UserPage.java +++ b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/page/user/UserPage.java @@ -16,7 +16,9 @@ import com.evolveum.midpoint.schrodinger.component.common.SummaryPanel; import com.evolveum.midpoint.schrodinger.component.user.*; import com.evolveum.midpoint.schrodinger.page.AssignmentHolderDetailsPage; +import com.evolveum.midpoint.schrodinger.page.FocusPage; import com.evolveum.midpoint.schrodinger.page.PreviewPage; +import com.evolveum.midpoint.schrodinger.page.org.OrgPage; import com.evolveum.midpoint.schrodinger.util.Schrodinger; import org.openqa.selenium.By; @@ -26,53 +28,7 @@ /** * Created by Viliam Repan (lazyman). */ -public class UserPage extends AssignmentHolderDetailsPage { - - public UserPage checkForce() { - setOptionChecked("executeOptions:force", true); - return this; - } - - public UserPage checkReconcile() { - setOptionChecked("executeOptions:reconcileContainer:container:check", true); - return this; - } - - public UserPage checkExecuteAfterAllApprovals() { - setOptionChecked("executeOptions:executeAfterAllApprovals", true); - return this; - } - - public UserPage checkKeepDisplayingResults() { - setOptionChecked("executeOptions:keepDisplayingResultsContainer:container:check", true); - return this; - } - - public UserPage uncheckForce() { - setOptionChecked("executeOptions:force", false); - return this; - } - - public UserPage uncheckReconcile() { - setOptionChecked("executeOptions:reconcileLabel:reconcile", false); - return this; - } - - public UserPage uncheckExecuteAfterAllApprovals() { - setOptionChecked("executeOptions:executeAfterAllApprovals", false); - return this; - } - - public UserPage uncheckKeepDisplayingResults() { - setOptionChecked("executeOptions:keepDisplayingResultsContainer:keepDisplayingResults", false); - return this; - } - - public ProjectionsTab selectTabProjections() { - SelenideElement element = findTabPanel().clickTab("pageAdminFocus.projections"); - Selenide.sleep(2000); - return new ProjectionsTab(this, element); - } +public class UserPage extends FocusPage { public UserPersonasTab selectTabPersonas() { SelenideElement element = findTabPanel().clickTab("pageAdminFocus.personas"); @@ -104,37 +60,18 @@ public UserDelegatedToMeTab selectTabDelegatedToMe() { return new UserDelegatedToMeTab(this, element); } - public SummaryPanel summary() { - - SelenideElement summaryPanel = $(By.cssSelector("div.info-box-content")); - - return new SummaryPanel(this, summaryPanel); - } - - public boolean isActivationState(String state) { - - SelenideElement summaryPanel = $(Schrodinger.byDataId("span", "summaryTagLabel")).waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT_2_S); - - if (state != null || !(state.isEmpty())) { - return state.equals(summaryPanel.getText()); - } else { - return "".equals(summaryPanel.getText()); - } + @Override + public ProjectionsTab selectTabProjections() { + return super.selectTabProjections(); } @Override - public AssignmentHolderBasicTab selectTabBasic(){ - SelenideElement element = findTabPanel().clickTab("pageAdminFocus.basic") - .waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT_2_S); - - return new AssignmentHolderBasicTab(this, element); + public AssignmentHolderBasicTab selectTabBasic() { + return super.selectTabBasic(); } @Override - public AssignmentsTab selectTabAssignments(){ - SelenideElement element = findTabPanel().clickTab("pageAdminFocus.assignments"); - - return new AssignmentsTab(this, element); + public AssignmentsTab selectTabAssignments() { + return super.selectTabAssignments(); } - } diff --git a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/util/Utils.java b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/util/Utils.java index 25ede9fb002..0128aa05e49 100644 --- a/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/util/Utils.java +++ b/tools/schrodinger/src/main/java/com/evolveum/midpoint/schrodinger/util/Utils.java @@ -6,6 +6,14 @@ */ package com.evolveum.midpoint.schrodinger.util; +import com.evolveum.midpoint.schrodinger.component.AssignmentsTab; +import com.evolveum.midpoint.schrodinger.component.FocusTableWithChoosableElements; +import com.evolveum.midpoint.schrodinger.component.common.table.AbstractTableWithPrismView; +import com.evolveum.midpoint.schrodinger.component.modal.FocusSetAssignmentsModal; +import com.evolveum.midpoint.schrodinger.page.AssignmentHolderDetailsPage; + +import com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType; + import org.openqa.selenium.By; import static com.codeborne.selenide.Selenide.$; @@ -26,4 +34,51 @@ public static T createInstance(Class type) { public static void setOptionChecked(String optionName, boolean checked) { $(By.name(optionName)).setSelected(checked); } + + public static

void removeAssignments(AssignmentsTab

tab, String... assignments){ + AbstractTableWithPrismView> table = tab.table(); + for (String assignment : assignments) { + table.removeByName(assignment); + } + tab.table() + .and() + .and() + .clickSave() + .feedback() + .isSuccess(); + + } + + public static

void addAsignments(AssignmentsTab

tab, String... assignments){ + for (String assignment : assignments) { + tab.clickAddAssignemnt() + .table() + .search() + .byName() + .inputValue(assignment) + .updateSearch() + .and() + .selectCheckboxByName(assignment) + .and() + .clickAdd(); + } + + tab.and() + .clickSave() + .feedback() + .isSuccess(); + } + + public static

void setStatusForAssignment(AssignmentsTab

tab, String assignment, String status) { + tab.table() + .clickByName(assignment) + .showEmptyAttributes("Activation") + .setDropDownAttributeValue(ActivationType.F_ADMINISTRATIVE_STATUS , status) + .and() + .and() + .and() + .clickSave() + .feedback() + .isSuccess(); + } } From 9c22f399b595d4c2b391c28ac44abaf81d30f385 Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Wed, 15 Apr 2020 09:16:18 +0200 Subject: [PATCH 5/9] dependency cleanup for prism-impl, removed cxf dependency --- infra/prism-impl/pom.xml | 10 ++-------- .../prism/impl/schema/SchemaDescriptionParser.java | 12 +++++++++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/infra/prism-impl/pom.xml b/infra/prism-impl/pom.xml index a95723298bc..92482efd0f2 100644 --- a/infra/prism-impl/pom.xml +++ b/infra/prism-impl/pom.xml @@ -48,14 +48,8 @@ jaxb-xjc - org.apache.cxf - cxf-rt-wsdl - - - javax.xml.stream - stax-api - - + org.glassfish.jaxb + jaxb-runtime commons-lang diff --git a/infra/prism-impl/src/main/java/com/evolveum/midpoint/prism/impl/schema/SchemaDescriptionParser.java b/infra/prism-impl/src/main/java/com/evolveum/midpoint/prism/impl/schema/SchemaDescriptionParser.java index ebdbd8a070a..02cb1858576 100644 --- a/infra/prism-impl/src/main/java/com/evolveum/midpoint/prism/impl/schema/SchemaDescriptionParser.java +++ b/infra/prism-impl/src/main/java/com/evolveum/midpoint/prism/impl/schema/SchemaDescriptionParser.java @@ -13,7 +13,7 @@ import com.evolveum.midpoint.util.exception.SchemaException; import com.evolveum.midpoint.util.logging.Trace; import com.evolveum.midpoint.util.logging.TraceManager; -import org.apache.cxf.wsdl.WSDLConstants; + import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -29,6 +29,12 @@ class SchemaDescriptionParser { private static final Trace LOGGER = TraceManager.getTrace(SchemaDescription.class); + public static final String NS_WSDL11 = "http://schemas.xmlsoap.org/wsdl/"; + + public static final QName QNAME_DEFINITIONS = new QName(NS_WSDL11, "definitions"); + + public static final QName QNAME_TYPES = new QName(NS_WSDL11, "types"); + static SchemaDescriptionImpl parseResource(String resourcePath) throws SchemaException { SchemaDescriptionImpl desc = new SchemaDescriptionImpl("system resource " + resourcePath, resourcePath); desc.setStreamable(() -> { @@ -57,8 +63,8 @@ static List parseWsdlResource(String resourcePath) throws } Element rootElement = node instanceof Element ? (Element) node : DOMUtil.getFirstChildElement(node); QName rootElementQName = DOMUtil.getQName(rootElement); - if (WSDLConstants.QNAME_DEFINITIONS.equals(rootElementQName)) { - Element types = DOMUtil.getChildElement(rootElement, WSDLConstants.QNAME_TYPES); + if (QNAME_DEFINITIONS.equals(rootElementQName)) { + Element types = DOMUtil.getChildElement(rootElement, QNAME_TYPES); if (types == null) { LOGGER.warn("No section in WSDL document in system resource " + resourcePath); return schemaDescriptions; From a28513289a1518dfb0f8e3c7687791683af9f45a Mon Sep 17 00:00:00 2001 From: lskublik Date: Wed, 15 Apr 2020 10:41:21 +0200 Subject: [PATCH 6/9] fix for 'checkMpVersion' schrodinger test --- .../midpoint/testing/schrodinger/page/AboutPageTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/page/AboutPageTest.java b/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/page/AboutPageTest.java index 82cecdf5a9f..d64e359a9b8 100644 --- a/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/page/AboutPageTest.java +++ b/testing/schrodingertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/page/AboutPageTest.java @@ -19,7 +19,7 @@ */ public class AboutPageTest extends AbstractSchrodingerTest { - private static final String VERSION_EXPECTED = "4.1-SNAPSHOT"; // Static value, should be changed each version change. + private static final String VERSION_EXPECTED = "4.2-SNAPSHOT"; // Static value, should be changed each version change. private static final String HIBERNATE_DIALECT_EXPECTED = "org.hibernate.dialect.H2Dialect"; private static final String CONNID_VERSION_EXPECTED = "1.5.0.10"; // Static value, should be changed each version change. private static final String REINDEX_REPO_TASK_CATEGORY_EXPECTED = "Utility"; From cd1f8b121d3eb06fd787a44f5098e7694f525dde Mon Sep 17 00:00:00 2001 From: kate Date: Wed, 15 Apr 2020 12:27:21 +0200 Subject: [PATCH 7/9] small cleanup --- .../page/admin/workflow/WorkItemPanel.html | 133 ------------------ 1 file changed, 133 deletions(-) delete mode 100644 gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/workflow/WorkItemPanel.html diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/workflow/WorkItemPanel.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/workflow/WorkItemPanel.html deleted file mode 100644 index 0f4765efa54..00000000000 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/workflow/WorkItemPanel.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - -

-
-
-
-

-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- -
- -
-
- -
-
-

-
-
-
-
-
- -
- -
-
-

-
-
-
-
-
- -
-
-

-
-
-
-
-
- -
-
- -
-
-

-
-
-
-
-
- -

- - -

- - -
-
-

-
-
-
-
-
- - -

- -

- - - From 88b1142401eb5b0ebe16f3cbb3095da441df736c Mon Sep 17 00:00:00 2001 From: kate Date: Wed, 15 Apr 2020 13:42:21 +0200 Subject: [PATCH 8/9] mid-6184 gui part for Power of attorney in approvals --- .../midpoint/web/page/admin/cases/PageCaseWorkItems.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/cases/PageCaseWorkItems.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/cases/PageCaseWorkItems.java index ff956a31e0c..4faec67f84a 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/cases/PageCaseWorkItems.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/cases/PageCaseWorkItems.java @@ -64,7 +64,8 @@ protected void onInitialize(){ } private void initLayout() { - CaseWorkItemsPanel workItemsPanel = new CaseWorkItemsPanel(ID_CASE_WORK_ITEMS_TABLE, CaseWorkItemsPanel.View.FULL_LIST) { + CaseWorkItemsPanel workItemsPanel = new CaseWorkItemsPanel(ID_CASE_WORK_ITEMS_TABLE, CaseWorkItemsPanel.View.FULL_LIST, + pageParameters) { private static final long serialVersionUID = 1L; @Override From 2665232e77a5583ba79a5d3049a4d79e5a027eff Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Wed, 15 Apr 2020 14:23:33 +0200 Subject: [PATCH 9/9] Disallow raw mode for previewChanges Such combination does not make sense. This resolves MID-6141 "Bulk task with dryRun and raw combo seems to work only for dryRun". --- .../prism/xml/ns/_public/types_3/RawType.java | 12 ++++-- .../ModelInteractionServiceImpl.java | 36 ++++++++++-------- .../scripting/actions/AssignExecutor.java | 2 +- .../intest/scripting/TestScriptingBasic.java | 24 ++++++++++++ .../scripting/assign-to-jack-dry-and-raw.xml | 37 +++++++++++++++++++ 5 files changed, 92 insertions(+), 19 deletions(-) create mode 100644 model/model-intest/src/test/resources/scripting/assign-to-jack-dry-and-raw.xml diff --git a/infra/prism-api/src/main/java/com/evolveum/prism/xml/ns/_public/types_3/RawType.java b/infra/prism-api/src/main/java/com/evolveum/prism/xml/ns/_public/types_3/RawType.java index 44ab534ed38..829362e2670 100644 --- a/infra/prism-api/src/main/java/com/evolveum/prism/xml/ns/_public/types_3/RawType.java +++ b/infra/prism-api/src/main/java/com/evolveum/prism/xml/ns/_public/types_3/RawType.java @@ -265,10 +265,16 @@ public PrismValue getAlreadyParsedValue() { public T getParsedRealValue(@NotNull Class clazz) throws SchemaException { if (parsed != null) { - if (clazz.isAssignableFrom(parsed.getRealValue().getClass())) { - return (T) parsed.getRealValue(); + Object realValue = parsed.getRealValue(); + if (realValue != null) { + if (clazz.isAssignableFrom(realValue.getClass())) { + //noinspection unchecked + return (T) realValue; + } else { + throw new IllegalArgumentException("Parsed value ("+realValue.getClass()+") is not assignable to "+clazz); + } } else { - throw new IllegalArgumentException("Parsed value ("+parsed.getClass()+") is not assignable to "+clazz); + return null; // strange but possible } } else if (xnode != null) { return prismContext.parserFor(xnode.toRootXNode()).parseRealValue(clazz); diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelInteractionServiceImpl.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelInteractionServiceImpl.java index ab98af98097..be036abadb7 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelInteractionServiceImpl.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelInteractionServiceImpl.java @@ -10,6 +10,8 @@ import static com.evolveum.midpoint.schema.SelectorOptions.createCollection; import static com.evolveum.midpoint.schema.util.ObjectTypeUtil.createObjectRef; import static com.evolveum.midpoint.xml.ns._public.common.common_3.TaskExecutionStatusType.RUNNABLE; + +import static java.util.Collections.emptyList; import static java.util.Collections.singleton; import java.util.ArrayList; @@ -200,9 +202,6 @@ public class ModelInteractionServiceImpl implements ModelInteractionService { private static final String OPERATION_VALIDATE_VALUE = ModelInteractionService.class.getName() + ".validateValue"; private static final String OPERATION_DETERMINE_VIRTUAL_CONTAINERS = ModelInteractionService.class.getName() + ".determineVirtualContainers"; - /* (non-Javadoc) - * @see com.evolveum.midpoint.model.api.ModelInteractionService#previewChanges(com.evolveum.midpoint.prism.delta.ObjectDelta, com.evolveum.midpoint.schema.result.OperationResult) - */ @Override public ModelContext previewChanges( Collection> deltas, ModelExecuteOptions options, Task task, OperationResult parentResult) @@ -216,20 +215,13 @@ public ModelContext previewChanges( Collection listeners, OperationResult parentResult) throws SchemaException, PolicyViolationException, ExpressionEvaluationException, ObjectNotFoundException, ObjectAlreadyExistsException, CommunicationException, ConfigurationException, SecurityViolationException { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Preview changes input:\n{}", DebugUtil.debugDump(deltas)); - } - int size = 0; - if (deltas != null) { - size = deltas.size(); - } - Collection> clonedDeltas = new ArrayList<>(size); - if (deltas != null) { - for (ObjectDelta delta : deltas){ - clonedDeltas.add(delta.clone()); - } + if (ModelExecuteOptions.isRaw(options)) { + throw new UnsupportedOperationException("previewChanges is not supported in raw mode"); } + LOGGER.debug("Preview changes input:\n{}", DebugUtil.debugDumpLazily(deltas)); + Collection> clonedDeltas = cloneDeltas(deltas); + OperationResult result = parentResult.createSubresult(PREVIEW_CHANGES); LensContext context = null; @@ -250,6 +242,20 @@ public ModelContext previewChanges( return context; } + @NotNull + private Collection> cloneDeltas(Collection> deltas) { + Collection> clonedDeltas; + if (deltas != null) { + clonedDeltas = new ArrayList<>(deltas.size()); + for (ObjectDelta delta : deltas) { + clonedDeltas.add(delta.clone()); + } + return clonedDeltas; + } else { + return emptyList(); + } + } + @Override public ModelContext unwrapModelContext(LensContextType wrappedContext, Task task, OperationResult result) throws SchemaException, ConfigurationException, ObjectNotFoundException, CommunicationException, ExpressionEvaluationException { return LensContext.fromLensContextType(wrappedContext, prismContext, provisioning, task, result); diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/scripting/actions/AssignExecutor.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/scripting/actions/AssignExecutor.java index 896ef8a471f..8a7bd222731 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/scripting/actions/AssignExecutor.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/scripting/actions/AssignExecutor.java @@ -37,7 +37,7 @@ protected ObjectDelta createDelta(AssignmentHolderType obj Collection roles, Collection relationSpecifications) throws SchemaException { QName relationSpecification = MiscUtil.extractSingleton(relationSpecifications, - () -> new IllegalArgumentException("Couldn't use 'relation' as multivalue parameter")); + () -> new IllegalArgumentException("Using 'relation' as a multivalued parameter is not allowed")); if (PrismConstants.Q_ANY.matches(relationSpecification)) { throw new IllegalArgumentException("Using 'q:any' as relation specification is not allowed"); diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/scripting/TestScriptingBasic.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/scripting/TestScriptingBasic.java index c953495d997..58e56d53e8f 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/scripting/TestScriptingBasic.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/scripting/TestScriptingBasic.java @@ -8,6 +8,7 @@ import static java.util.Collections.singleton; import static org.apache.commons.collections4.CollectionUtils.emptyIfNull; +import static org.assertj.core.api.Assertions.assertThat; import static org.testng.AssertJUnit.*; import java.io.File; @@ -18,6 +19,8 @@ import javax.xml.bind.JAXBException; import javax.xml.namespace.QName; +import com.evolveum.midpoint.model.api.ScriptExecutionException; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.annotation.DirtiesContext.ClassMode; @@ -86,6 +89,7 @@ public class TestScriptingBasic extends AbstractInitializedModelIntegrationTest private static final String MODIFY_JACK_PASSWORD_TASK_OID = "9de76345-0f02-48de-86bf-e7a887cb374a"; private static final File RECOMPUTE_JACK_FILE = new File(TEST_DIR, "recompute-jack.xml"); private static final File ASSIGN_TO_JACK_FILE = new File(TEST_DIR, "assign-to-jack.xml"); + private static final File ASSIGN_TO_JACK_DRY_AND_RAW_FILE = new File(TEST_DIR, "assign-to-jack-dry-and-raw.xml"); private static final File ASSIGN_TO_JACK_2_FILE = new File(TEST_DIR, "assign-to-jack-2.xml"); private static final File UNASSIGN_FROM_WILL_FILE = new File(TEST_DIR, "unassign-from-will.xml"); private static final File UNASSIGN_FROM_WILL_2_FILE = new File(TEST_DIR, "unassign-from-will-2.xml"); @@ -505,6 +509,26 @@ public void test360AssignToJack() throws Exception { assertAssignedRole(jack, "12345678-d34d-b33f-f00d-55555555cccc"); } + /** + * MID-6141 + */ + @Test + public void test365AssignToJackDryAndRaw() throws Exception { + given(); + Task task = getTestTask(); + OperationResult result = task.getResult(); + ScriptingExpressionType expression = parseScriptingExpression(ASSIGN_TO_JACK_DRY_AND_RAW_FILE); + + when(); + try { + scriptingExpressionEvaluator.evaluateExpression(expression, task, result); + fail("unexpected success"); + } catch (ScriptExecutionException e) { + displayExpectedException(e); + assertThat(e).hasMessageContaining("previewChanges is not supported in raw mode"); + } + } + @Test public void test370AssignToJackInBackground() throws Exception { // GIVEN diff --git a/model/model-intest/src/test/resources/scripting/assign-to-jack-dry-and-raw.xml b/model/model-intest/src/test/resources/scripting/assign-to-jack-dry-and-raw.xml new file mode 100644 index 00000000000..5a545c394df --- /dev/null +++ b/model/model-intest/src/test/resources/scripting/assign-to-jack-dry-and-raw.xml @@ -0,0 +1,37 @@ + + + + + c:UserType + + + c:name + jack + + + + assign + + role + 12345678-d34d-b33f-f00d-55555555cccc + + + dryRun + true + + + options + + true + + + +