Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/support-4.2' into support-4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Apr 30, 2021
2 parents 1db4d68 + 894230e commit d141dcf
Showing 1 changed file with 130 additions and 15 deletions.
Expand Up @@ -6,6 +6,14 @@
*/
package com.evolveum.midpoint.gui;

import com.evolveum.midpoint.gui.api.component.MainObjectListPanel;

import com.evolveum.midpoint.web.page.admin.configuration.PageSystemConfiguration;

import com.evolveum.midpoint.web.page.admin.server.PageTasks;

import org.apache.wicket.Page;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.javasimon.Split;
import org.javasimon.Stopwatch;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -46,12 +54,9 @@ public class MidScaleGuiTest extends AbstractInitializedGuiIntegrationTest imple
private static final File FILE_ORG_STRUCT = new File(TEST_DIR, "org-struct.xml");
private static final File FILE_USERS = new File(TEST_DIR, "users.xml");

@Autowired TestQueryListener queryListener;
private static final int REPETITION_COUNT = 10;

@BeforeMethod
public void reportBeforeTest() {
queryListener.clear();
}
@Autowired TestQueryListener queryListener;

@Override
public void initSystem(Task initTask, OperationResult initResult) throws Exception {
Expand All @@ -68,7 +73,6 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti
ItemPath.create(SystemConfigurationType.F_ADMIN_GUI_CONFIGURATION, AdminGuiConfigurationType.F_ENABLE_EXPERIMENTAL_FEATURES),
initTask, initResult, true);


}

@BeforeMethod
Expand Down Expand Up @@ -100,17 +104,19 @@ public void test040PageRequestRole() {
runTestFor(PageAssignmentShoppingCart.class, "requestRole", "Request a role");
}


@Test
public void test110PageDashboard() {
displayTestTitle(getTestName());
runTestFor(PageDashboardInfo.class, "dashboard", "Info Dashboard");
}

private void runTestFor(Class pageToRender, String stopwathName, String stopwatchDescription) {
OperationsPerformanceMonitor.INSTANCE.clearGlobalPerformanceInformation();
Stopwatch stopwatch = stopwatch(stopwathName, stopwatchDescription);
for (int i = 0; i < 1; i++) {
private void runTestFor(Class pageToRender, String stopwatchName, String stopwatchDescription) {
runTestFor(pageToRender, null, stopwatchName, stopwatchDescription);
}

private void runTestFor(Class pageToRender, PageParameters params, String stopwatchName, String stopwatchDescription) {
Stopwatch stopwatch = stopwatch(stopwatchName, stopwatchDescription);
for (int i = 0; i < REPETITION_COUNT; i++) {
try (Split ignored = stopwatch.start()) {
queryListener.start();
tester.startPage(pageToRender);
Expand All @@ -123,12 +129,8 @@ private void runTestFor(Class pageToRender, String stopwathName, String stopwatc
OperationsPerformanceMonitor.INSTANCE.getGlobalPerformanceInformation());
displayValue("Operation performance (by name)",
OperationsPerformanceInformationUtil.format(performanceInformation));
// displayValue("Operation performance (by time)",
// OperationsPerformanceInformationUtil.format(performanceInformation,
// new AbstractStatisticsPrinter.Options(AbstractStatisticsPrinter.Format.TEXT, AbstractStatisticsPrinter.SortBy.TIME), null, null));
}


@Test
public void test210listUsers() {
logger.info(getTestName());
Expand All @@ -142,10 +144,123 @@ public void test220newUser() {

}

@Test
public void test230editUser() {
logger.info(getTestName());

for (int i = 0; i < REPETITION_COUNT; i++) {
tester.startPage(PageUsers.class);

String idTable = "mainForm:table";
tester.assertComponent(idTable, MainObjectListPanel.class);

tester.debugComponentTrees(":rows:.*:cells:3:cell:link");

String id = idTable + ":mainForm:table:box:tableContainer:table:body:rows:3:cells:3:cell:link";

Stopwatch stopwatch = stopwatch("editUser", "Edit User");
try (Split ignored = stopwatch.start()) {
queryListener.start();
tester.clickLink(id);
}
}

queryListener.dumpAndStop();
tester.assertRenderedPage(PageUser.class);
OperationsPerformanceInformationType performanceInformation =
OperationsPerformanceInformationUtil.toOperationsPerformanceInformationType(
OperationsPerformanceMonitor.INSTANCE.getGlobalPerformanceInformation());
displayValue("Operation performance (by name)",
OperationsPerformanceInformationUtil.format(performanceInformation));
}

@Test
public void test231editUserTabProjections() {
logger.info(getTestName());

for (int i = 0; i < REPETITION_COUNT; i++) {
tester.startPage(PageUsers.class);

String idTable = "mainForm:table";
tester.assertComponent(idTable, MainObjectListPanel.class);

tester.debugComponentTrees(":rows:.*:cells:3:cell:link");

String id = idTable + ":mainForm:table:box:tableContainer:table:body:rows:3:cells:3:cell:link";
tester.clickLink(id);

Stopwatch stopwatch = stopwatch("showProjections", "User's projection tab");
try (Split ignored = stopwatch.start()) {
clickOnTab(1, PageUser.class);
queryListener.start();

}
}

queryListener.dumpAndStop();
tester.assertRenderedPage(PageUser.class);
OperationsPerformanceInformationType performanceInformation =
OperationsPerformanceInformationUtil.toOperationsPerformanceInformationType(
OperationsPerformanceMonitor.INSTANCE.getGlobalPerformanceInformation());
displayValue("Operation performance (by name)",
OperationsPerformanceInformationUtil.format(performanceInformation));
}

@Test
public void test232editUserTabAssignments() {
logger.info(getTestName());

for (int i = 0; i < REPETITION_COUNT; i++) {
tester.startPage(PageUsers.class);

String idTable = "mainForm:table";
tester.assertComponent(idTable, MainObjectListPanel.class);

tester.debugComponentTrees(":rows:.*:cells:3:cell:link");

String id = idTable + ":mainForm:table:box:tableContainer:table:body:rows:3:cells:3:cell:link";
tester.clickLink(id);

Stopwatch stopwatch = stopwatch("showAssignments", "User's assignmentTab");
try (Split ignored = stopwatch.start()) {
queryListener.start();
clickOnTab(2, PageUser.class);
}
}

queryListener.dumpAndStop();
tester.assertRenderedPage(PageUser.class);
OperationsPerformanceInformationType performanceInformation =
OperationsPerformanceInformationUtil.toOperationsPerformanceInformationType(
OperationsPerformanceMonitor.INSTANCE.getGlobalPerformanceInformation());
displayValue("Operation performance (by name)",
OperationsPerformanceInformationUtil.format(performanceInformation));
}

@Test
public void test310orgTree() throws Exception {
logger.info(getTestName());
runTestFor(PageOrgTree.class, "orgTree", "Organization tree");
}

@Test
public void test410allTasks() {
logger.info(getTestName());
runTestFor(PageTasks.class, "tasks", "All tasks");
}

@Test
public void test510systemConfigurationAdminGuiConfig() {
logger.info(getTestName());
PageParameters params = new PageParameters();
params.add(PageSystemConfiguration.SELECTED_TAB_INDEX, PageSystemConfiguration.CONFIGURATION_TAB_ADMIN_GUI);
runTestFor(PageSystemConfiguration.class, params,"adminGuiConfig", "Admin Gui Config");
}


private void clickOnTab(int order, Class<? extends Page> expectedPage) {
tester.assertRenderedPage(expectedPage);
String tabPath = "mainPanel:mainForm:tabPanel:tabs-container:tabs:" + order + ":link";
tester.clickLink(tabPath);
}
}

0 comments on commit d141dcf

Please sign in to comment.