Skip to content

Commit

Permalink
schrodinger: extending for System Cleanup panel
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Feb 10, 2021
1 parent 3f2e713 commit 970f41e
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 15 deletions.
Expand Up @@ -493,6 +493,15 @@ public PrismContainerPanel<PrismForm<T>> getPrismContainerPanel(String container
return new PrismContainerPanel<PrismForm<T>>(this, containerPanel);
}

public PrismContainerPanel<PrismForm<T>> getPrismContainerPanelByResourceKey(String resourceKey) {
SelenideElement containerPanel = getParentElement().$(Schrodinger.byDataResourceKey(resourceKey))
.parent()
.parent()
.parent();
containerPanel.scrollTo();
return new PrismContainerPanel<PrismForm<T>>(this, containerPanel);
}

public PrismForm<T> assertPropertyWithTitleTextExist(String propertyName, String text) {
Assert.assertTrue(propertyWithTitleTextExists(propertyName, text),
"Property " + propertyName + " with title text '" + text + "' doesn't exist.");
Expand Down
Expand Up @@ -3,6 +3,8 @@
import com.codeborne.selenide.SelenideElement;

import com.evolveum.midpoint.schrodinger.component.TabWithContainerWrapper;
import com.evolveum.midpoint.schrodinger.component.common.PrismContainerPanel;
import com.evolveum.midpoint.schrodinger.component.common.PrismForm;
import com.evolveum.midpoint.schrodinger.page.configuration.SystemPage;

public class CleanupPolicyTab extends TabWithContainerWrapper<SystemPage> {
Expand All @@ -11,30 +13,117 @@ public CleanupPolicyTab(SystemPage parent, SelenideElement parentElement) {
super(parent, parentElement);
}

public void auditRecordsCleanupInterval(String interval) {
// todo implement
public CleanupPolicyTab auditRecordsCleanupInterval(String interval) {
setCleanupIntervalValueByContainerResourceKey("CleanupPoliciesType.auditRecords", interval);
return this;
}

public String auditRecordsCleanupInterval() {
// todo implement
return null;
public CleanupPolicyTab auditRecordsMaxRecordsToKeep(String maxRecordsToKeep) {
setMaxRecordsToKeepValueByContainerResourceKey("CleanupPoliciesType.auditRecords", maxRecordsToKeep);
return this;
}

public void closedCertificationCampaignsCleanupInterval(String interval) {
// todo implement
public String getAuditRecordsCleanupInterval() {
return getCleanupIntervalValueByContainerResourceKey("CleanupPoliciesType.auditRecords");
}

public String closedCertificationCampaignsCleanupInterval() {
// todo implement
return null;
public CleanupPolicyTab closedCertificationCampaignsCleanupInterval(String interval) {
setCleanupIntervalValueByContainerResourceKey("CleanupPoliciesType.closedCertificationCampaigns", interval);
return this;
}

public void operationExecutionResultsCleanupInterval(String interval) {
// todo implement
public CleanupPolicyTab closedCertificationMaxRecordsToKeep(String maxRecordsToKeep) {
setMaxRecordsToKeepValueByContainerResourceKey("CleanupPoliciesType.closedCertificationCampaigns", maxRecordsToKeep);
return this;
}

public String operationExecutionResultsCleanupInterval() {
// todo implement
return null;
public String getClosedCertificationCampaignsCleanupInterval() {
return getCleanupIntervalValueByContainerResourceKey("CleanupPoliciesType.closedCertificationCampaigns");
}

public CleanupPolicyTab closedTasksCleanupInterval(String interval) {
setCleanupIntervalValueByContainerResourceKey("CleanupPoliciesType.closedTasks", interval);
return this;
}

public CleanupPolicyTab closedTasksMaxRecordsToKeep(String maxRecordsToKeep) {
setMaxRecordsToKeepValueByContainerResourceKey("CleanupPoliciesType.closedTasks", maxRecordsToKeep);
return this;
}

public String getClosedTasksCleanupInterval() {
return getCleanupIntervalValueByContainerResourceKey("CleanupPoliciesType.closedTasks");
}

public CleanupPolicyTab closedCasesCleanupInterval(String interval) {
setCleanupIntervalValueByContainerResourceKey("CleanupPoliciesType.closedCases", interval);
return this;
}

public CleanupPolicyTab closedCasesMaxRecordsToKeep(String maxRecordsToKeep) {
setMaxRecordsToKeepValueByContainerResourceKey("CleanupPoliciesType.closedCases", maxRecordsToKeep);
return this;
}

public String getClosedCasesCleanupInterval() {
return getCleanupIntervalValueByContainerResourceKey("CleanupPoliciesType.closedCases");
}

public CleanupPolicyTab outputReportsCleanupInterval(String interval) {
setCleanupIntervalValueByContainerResourceKey("CleanupPoliciesType.outputReports", interval);
return this;
}

public CleanupPolicyTab outputReportsMaxRecordsToKeep(String maxRecordsToKeep) {
setMaxRecordsToKeepValueByContainerResourceKey("CleanupPoliciesType.outputReports", maxRecordsToKeep);
return this;
}

public String getOutputReportsCleanupInterval() {
return getCleanupIntervalValueByContainerResourceKey("CleanupPoliciesType.outputReports");
}

public CleanupPolicyTab objectResultsCleanupInterval(String interval) {
setCleanupIntervalValueByContainerResourceKey("CleanupPoliciesType.objectResults", interval);
return this;
}

public CleanupPolicyTab objectResultsMaxRecordsToKeep(String maxRecordsToKeep) {
setMaxRecordsToKeepValueByContainerResourceKey("CleanupPoliciesType.objectResults", maxRecordsToKeep);
return this;
}

public String getObjectResultsCleanupInterval() {
return getCleanupIntervalValueByContainerResourceKey("CleanupPoliciesType.objectResults");
}

private void setCleanupIntervalValueByContainerResourceKey(String containerResourceKey, String interval) {
getContainerFormPanel(containerResourceKey)
.addAttributeValue("Cleanup interval", interval);
}

private String getCleanupIntervalValueByContainerResourceKey(String containerResourceKey) {
return getContainerFormPanel(containerResourceKey)
.findProperty("Cleanup interval")
.getText();
}

private String getMaxRecordsToKeepValueByContainerResourceKey(String containerResourceKey) {
return getContainerFormPanel(containerResourceKey)
.findProperty("Max records to keep")
.getText();
}

private void setMaxRecordsToKeepValueByContainerResourceKey(String containerResourceKey, String maxRecordsToKeep) {
getContainerFormPanel(containerResourceKey)
.addAttributeValue("Max records to keep", maxRecordsToKeep);
}

private PrismForm<PrismContainerPanel<PrismForm<TabWithContainerWrapper<SystemPage>>>> getContainerFormPanel(String containerResourceKey) {
return form()
.expandContainerPropertiesPanel("pageSystemConfiguration.cleanupPolicy.title")
.expandContainerPropertiesPanel(containerResourceKey)
.getPrismContainerPanelByResourceKey(containerResourceKey)
.getContainerFormFragment();
}
}

0 comments on commit 970f41e

Please sign in to comment.