Search in sources :

Example 1 with PageMode

use of com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode in project cia by Hack23.

the class CreateApplicationEventServiceITest method serviceCreateApplicationEventRequestSuccessTest.

/**
 * Service create application event request success test.
 *
 * @throws Exception
 *             the exception
 */
@Test
@PerfTest(threads = 4, duration = 3000, warmUp = 1500)
@Required(max = 1000, average = 400, percentile95 = 450, throughput = 10)
public void serviceCreateApplicationEventRequestSuccessTest() throws Exception {
    setAuthenticatedAnonymousUser();
    final CreateApplicationSessionRequest createSessionRequest = createTestApplicationSession();
    final CreateApplicationEventRequest serviceRequest = new CreateApplicationEventRequest();
    serviceRequest.setSessionId(createSessionRequest.getSessionId());
    serviceRequest.setApplicationMessage("applicationMessage");
    serviceRequest.setEventGroup(ApplicationEventGroup.USER);
    serviceRequest.setApplicationOperation(ApplicationOperationType.CREATE);
    serviceRequest.setPage("Test");
    serviceRequest.setPageMode("PageMode");
    serviceRequest.setElementId("ElementId");
    serviceRequest.setActionName("Content");
    serviceRequest.setApplicationMessage("applicationMessage");
    serviceRequest.setErrorMessage("errorMessage");
    final CreateApplicationEventResponse response = (CreateApplicationEventResponse) applicationManager.service(serviceRequest);
    assertNotNull(EXPECT_A_RESULT, response);
    assertEquals(EXPECT_SUCCESS, ServiceResult.SUCCESS, response.getResult());
    final List<ApplicationSession> findListByProperty = applicationSessionDAO.findListByProperty(ApplicationSession_.sessionId, serviceRequest.getSessionId());
    assertEquals(1, findListByProperty.size());
    final ApplicationSession applicationSession = findListByProperty.get(0);
    assertNotNull(applicationSession);
    assertEquals(1, applicationSession.getEvents().size());
}
Also used : ApplicationSession(com.hack23.cia.model.internal.application.system.impl.ApplicationSession) CreateApplicationEventResponse(com.hack23.cia.service.api.action.application.CreateApplicationEventResponse) CreateApplicationSessionRequest(com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest) CreateApplicationEventRequest(com.hack23.cia.service.api.action.application.CreateApplicationEventRequest) Required(org.databene.contiperf.Required) PerfTest(org.databene.contiperf.PerfTest) Test(org.junit.Test) AbstractServiceFunctionalIntegrationTest(com.hack23.cia.service.impl.AbstractServiceFunctionalIntegrationTest) PerfTest(org.databene.contiperf.PerfTest)

Example 2 with PageMode

use of com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode 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)2 ApplicationSession (com.hack23.cia.model.internal.application.system.impl.ApplicationSession)1 CreateApplicationEventResponse (com.hack23.cia.service.api.action.application.CreateApplicationEventResponse)1 CreateApplicationSessionRequest (com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest)1 AbstractServiceFunctionalIntegrationTest (com.hack23.cia.service.impl.AbstractServiceFunctionalIntegrationTest)1 PerfTest (org.databene.contiperf.PerfTest)1 Required (org.databene.contiperf.Required)1 Test (org.junit.Test)1