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());
}
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);
}
Aggregations