Skip to content

Commit

Permalink
schrodinger: cleanup policy test
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Feb 11, 2021
1 parent 9afd425 commit 15f42cf
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 16 deletions.
@@ -1,25 +1,54 @@
package com.evolveum.midpoint.testing.schrodinger.scenarios;

import com.codeborne.selenide.Selenide;

import com.evolveum.midpoint.schrodinger.MidPoint;
import com.evolveum.midpoint.testing.schrodinger.AbstractSchrodingerTest;

import org.testng.annotations.Test;

import java.io.File;
import java.util.Collections;
import java.util.List;

public class CleanupPoliciesTest extends AbstractSchrodingerTest {

public static final File CLOSED_TASKS_XML = new File("./src/test/resources/component/objects/tasks/closed-tasks.xml");

@Override
protected List<File> getObjectListToImport(){
return Collections.singletonList(CLOSED_TASKS_XML);
}

@Test
public void test00100closedTasksCleanup() {
basicPage
.listTasks()
.table()
.assertCurrentTableContains("ClosedTask1")
.assertCurrentTableContains("ClosedTask2")
.and()
.cleanupPolicy()
.closedTasksCleanupInterval("P6M");
basicPage
.closedTasksCleanupInterval("P6M")
.and()
.clickSave()
.feedback()
.assertSuccess()
.and()
.listTasks()
.table()
.search()
.byName()
.inputValue("Cleanup task")
.inputValue("Cleanup")
.updateSearch()
.and()
.clickByName("Cleanup task")
.clickByName("Cleanup")
.clickRunNow();
Selenide.sleep(MidPoint.TIMEOUT_LONG_1_M);
basicPage
.listTasks()
.table()
.assertCurrentTableDoesntContain("ClosedTask1")
.assertCurrentTableDoesntContain("ClosedTask2");
}
}
Expand Up @@ -13,11 +13,11 @@
<gen930:token xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">1612471320167</gen930:token>
</extension>
<metadata>
<requestTimestamp>2021-02-04T21:37:01.724+01:00</requestTimestamp>
<requestTimestamp>2020-02-04T21:37:01.724+01:00</requestTimestamp>
<requestorRef oid="00000000-0000-0000-0000-000000000002" relation="org:default" type="c:UserType">
<!-- administrator -->
</requestorRef>
<createTimestamp>2021-02-04T21:37:01.738+01:00</createTimestamp>
<createTimestamp>2020-02-04T21:37:01.738+01:00</createTimestamp>
<creatorRef oid="00000000-0000-0000-0000-000000000002" relation="org:default" type="c:UserType">
<!-- administrator -->
</creatorRef>
Expand Down
Expand Up @@ -14,21 +14,21 @@ public CleanupPolicyTab(SystemPage parent, SelenideElement parentElement) {
}

public CleanupPolicyTab auditRecordsCleanupInterval(String interval) {
setCleanupIntervalValueByContainerResourceKey("CleanupPoliciesType.auditRecords", interval);
setCleanupIntervalValueByContainerResourceKey("Audit records", interval);
return this;
}

public CleanupPolicyTab auditRecordsMaxRecordsToKeep(String maxRecordsToKeep) {
setMaxRecordsToKeepValueByContainerResourceKey("CleanupPoliciesType.auditRecords", maxRecordsToKeep);
setMaxRecordsToKeepValueByContainerResourceKey("Audit records", maxRecordsToKeep);
return this;
}

public String getAuditRecordsCleanupInterval() {
return getCleanupIntervalValueByContainerResourceKey("CleanupPoliciesType.auditRecords");
return getCleanupIntervalValueByContainerResourceKey("Audit records");
}

public String getAuditRecordsMaxRecordsToKeep() {
return getMaxRecordsToKeepValueByContainerResourceKey("CleanupPoliciesType.auditRecords");
return getMaxRecordsToKeepValueByContainerResourceKey("Audit records");
}

public CleanupPolicyTab closedCertificationCampaignsCleanupInterval(String interval) {
Expand All @@ -50,21 +50,21 @@ public String getClosedCertificationCampaignsMaxRecordsToKeep() {
}

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

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

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

public String getClosedTasksMaxRecordsToKeep() {
return getMaxRecordsToKeepValueByContainerResourceKey("CleanupPoliciesType.closedTasks");
return getMaxRecordsToKeepValueByContainerResourceKey("Closed tasks");
}

public CleanupPolicyTab closedCasesCleanupInterval(String interval) {
Expand Down Expand Up @@ -123,6 +123,7 @@ public String getObjectResultsMaxRecordsToKeep() {

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

Expand All @@ -140,12 +141,13 @@ private String getMaxRecordsToKeepValueByContainerResourceKey(String containerRe

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

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

0 comments on commit 15f42cf

Please sign in to comment.