Search in sources :

Example 1 with ViewAction

use of com.hack23.cia.web.impl.ui.application.action.ViewAction in project cia by Hack23.

the class AdminRoleSystemTest method siteAdminAgentOperationTest.

/**
 * Site admin test.
 *
 * @throws Exception
 *             the exception
 */
@Test
public void siteAdminAgentOperationTest() throws Exception {
    final WebDriver driver = getWebDriver();
    assertNotNull(NO_WEBDRIVER_EXIST_FOR_BROWSER + browser, driver);
    final UserPageVisit userPageVisit = new UserPageVisit(driver, browser);
    loginAsAdmin(userPageVisit);
    userPageVisit.visitDirectPage(new PageModeMenuCommand(AdminViews.ADMIN_AGENT_OPERATIONVIEW_NAME, ""));
    userPageVisit.verifyViewActions(new ViewAction[] { ViewAction.VISIT_MAIN_VIEW });
    final WebElement importWorldBankDataButton = userPageVisit.findButton("Start IMPORT MODEL_EXTERNAL_WORLDBANK");
    assertNotNull("Start IMPORT MODEL_EXTERNAL_WORLDBANK Button", importWorldBankDataButton);
    final WebElement importRiksdagenDataButton = userPageVisit.findButton("Start IMPORT MODEL_EXTERNAL_RIKSDAGEN");
    assertNotNull("Start IMPORT MODEL_EXTERNAL_RIKSDAGEN Button", importRiksdagenDataButton);
    userPageVisit.performClickAction(importRiksdagenDataButton);
}
Also used : WebDriver(org.openqa.selenium.WebDriver) PageModeMenuCommand(com.hack23.cia.web.impl.ui.application.views.common.pagelinks.api.PageModeMenuCommand) WebElement(org.openqa.selenium.WebElement) Test(org.junit.Test)

Example 2 with ViewAction

use of com.hack23.cia.web.impl.ui.application.action.ViewAction in project cia by Hack23.

the class PageActionEventHelperImpl method createPageEvent.

@Override
public void createPageEvent(final ViewAction viewAction, final ApplicationEventGroup applicationEventGroup, final String page, final String pageMode, final String elementId) {
    String pageModeToUse;
    if (pageMode != null && elementId != null && pageMode.contains(elementId)) {
        pageModeToUse = pageMode.replace(elementId, "").replace("/", "");
    } else {
        pageModeToUse = pageMode;
    }
    if ((pageModeToUse == null || "".equals(pageModeToUse)) && ApplicationEventGroup.USER == applicationEventGroup) {
        pageModeToUse = "Overview";
    }
    final CreateApplicationEventRequest serviceRequest = new CreateApplicationEventRequest();
    serviceRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
    serviceRequest.setEventGroup(applicationEventGroup);
    serviceRequest.setApplicationOperation(ApplicationOperationType.READ);
    serviceRequest.setPage(StringUtils.defaultString(page));
    serviceRequest.setPageMode(StringUtils.defaultString(pageModeToUse));
    serviceRequest.setElementId(StringUtils.defaultString(elementId));
    serviceRequest.setActionName(viewAction.toString());
    serviceRequest.setUserId(UserContextUtil.getUserIdFromSecurityContext());
    serviceRequest.setApplicationMessage(viewAction.toString());
    applicationManager.service(serviceRequest);
}
Also used : CreateApplicationEventRequest(com.hack23.cia.service.api.action.application.CreateApplicationEventRequest)

Aggregations

CreateApplicationEventRequest (com.hack23.cia.service.api.action.application.CreateApplicationEventRequest)1 PageModeMenuCommand (com.hack23.cia.web.impl.ui.application.views.common.pagelinks.api.PageModeMenuCommand)1 Test (org.junit.Test)1 WebDriver (org.openqa.selenium.WebDriver)1 WebElement (org.openqa.selenium.WebElement)1