Search in sources :

Example 1 with ApplicationSession

use of com.hack23.cia.model.internal.application.system.impl.ApplicationSession in project cia by Hack23.

the class AdminApplicationSessionPageModContentFactoryImpl method createContent.

@Secured({ "ROLE_ADMIN" })
@Override
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout content = createPanelContent();
    final String pageId = getPageId(parameters);
    final int pageNr = getPageNr(parameters);
    getMenuItemFactory().createMainPageMenuBar(menuBar);
    LabelFactory.createHeader2Label(content, ADMIN_APPLICATION_SESSION);
    final DataContainer<ApplicationSession, Long> dataContainer = getApplicationManager().getDataContainer(ApplicationSession.class);
    final List<ApplicationSession> pageOrderBy = dataContainer.getPageOrderBy(pageNr, DEFAULT_RESULTS_PER_PAGE, ApplicationSession_.createdDate);
    createPagingControls(content, NAME, pageId, dataContainer.getSize(), pageNr, DEFAULT_RESULTS_PER_PAGE);
    getGridFactory().createBasicBeanItemGrid(content, ApplicationSession.class, pageOrderBy, APPLICATION_SESSION, COLUMN_ORDER, HIDE_COLUMNS, new PageItemPropertyClickListener(AdminViews.ADMIN_APPLICATIONS_SESSION_VIEW_NAME, "hjid"), null, new ListPropertyConverter[] { new ListPropertyConverter("page", "events", "actionName") });
    if (pageId != null && !pageId.isEmpty()) {
        final ApplicationSession applicationSession = dataContainer.load(Long.valueOf(pageId));
        if (applicationSession != null) {
            final VerticalLayout rightLayout = new VerticalLayout();
            rightLayout.setSizeFull();
            final HorizontalLayout horizontalLayout = new HorizontalLayout();
            horizontalLayout.setWidth(ContentSize.FULL_SIZE);
            content.addComponent(horizontalLayout);
            content.setExpandRatio(horizontalLayout, ContentRatio.GRID);
            getFormFactory().addFormPanelTextFields(horizontalLayout, applicationSession, ApplicationSession.class, AS_LIST);
            horizontalLayout.addComponent(rightLayout);
            horizontalLayout.setExpandRatio(rightLayout, ContentRatio.GRID);
            getGridFactory().createBasicBeanItemGrid(rightLayout, ApplicationActionEvent.class, applicationSession.getEvents(), APPLICATION_ACTION_EVENT, COLUMN_ORDER2, HIDE_COLUMNS2, new PageItemPropertyClickListener(AdminViews.ADMIN_APPLICATIONS_EVENTS_VIEW_NAME, "hjid"), null, null);
        }
    }
    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_APPLICATION_SESSION_VIEW, ApplicationEventGroup.ADMIN, NAME, null, pageId);
    return content;
}
Also used : ApplicationSession(com.hack23.cia.model.internal.application.system.impl.ApplicationSession) PageItemPropertyClickListener(com.hack23.cia.web.impl.ui.application.views.pageclicklistener.PageItemPropertyClickListener) VerticalLayout(com.vaadin.ui.VerticalLayout) ListPropertyConverter(com.hack23.cia.web.impl.ui.application.views.common.converters.ListPropertyConverter) HorizontalLayout(com.vaadin.ui.HorizontalLayout) Secured(org.springframework.security.access.annotation.Secured)

Example 2 with ApplicationSession

use of com.hack23.cia.model.internal.application.system.impl.ApplicationSession in project cia by Hack23.

the class DestroyApplicationSessionServiceITest method serviceDestroyApplicationSessionRequestSuccessTest.

/**
 * Service destroy application session request success test.
 *
 * @throws Exception
 *             the exception
 */
@Test
@PerfTest(threads = 4, duration = 3000, warmUp = 1500)
@Required(max = 1000, average = 600, percentile95 = 850, throughput = 10)
public void serviceDestroyApplicationSessionRequestSuccessTest() throws Exception {
    setAuthenticatedAnonymousUser();
    final CreateApplicationSessionRequest createTestApplicationSession = createTestApplicationSession();
    final DestroyApplicationSessionRequest destroyApplicationSessionRequest = new DestroyApplicationSessionRequest();
    destroyApplicationSessionRequest.setSessionId(createTestApplicationSession.getSessionId());
    final ServiceResponse response = applicationManager.service(destroyApplicationSessionRequest);
    assertNotNull(EXPECT_A_RESULT, response);
    assertEquals(EXPECT_SUCCESS, ServiceResult.SUCCESS, response.getResult());
    final ApplicationSession applicationSession = applicationSessionDAO.findFirstByProperty(ApplicationSession_.sessionId, createTestApplicationSession.getSessionId());
    assertNotNull(EXPECT_A_RESULT, applicationSession);
    assertNotNull(EXPECT_A_RESULT, applicationSession.getDestroyedDate());
}
Also used : ApplicationSession(com.hack23.cia.model.internal.application.system.impl.ApplicationSession) ServiceResponse(com.hack23.cia.service.api.action.common.ServiceResponse) CreateApplicationSessionRequest(com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest) DestroyApplicationSessionRequest(com.hack23.cia.service.api.action.application.DestroyApplicationSessionRequest) 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 3 with ApplicationSession

use of com.hack23.cia.model.internal.application.system.impl.ApplicationSession 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 4 with ApplicationSession

use of com.hack23.cia.model.internal.application.system.impl.ApplicationSession in project cia by Hack23.

the class ApplicationSessionDAOITest method getAllTest.

/**
 * Gets the all test.
 *
 * @return the all test
 * @throws Exception
 *             the exception
 */
@Test
public void getAllTest() throws Exception {
    final ApplicationSession applicationSession = createApplicationSession();
    final List<ApplicationSession> all = applicationSessionDAO.getAll();
    assertNotNull(all);
    assertFalse(all.isEmpty());
}
Also used : ApplicationSession(com.hack23.cia.model.internal.application.system.impl.ApplicationSession) Test(org.junit.Test)

Example 5 with ApplicationSession

use of com.hack23.cia.model.internal.application.system.impl.ApplicationSession in project cia by Hack23.

the class ApplicationSessionDAOITest method getPageOrderByTest.

/**
 * Gets the page order by test.
 *
 * @return the page order by test
 * @throws Exception
 *             the exception
 */
@Test
public void getPageOrderByTest() throws Exception {
    final ApplicationSession applicationSession = createApplicationSession();
    final int resultPerPage = 1;
    final List<ApplicationSession> pageList = applicationSessionDAO.getPageOrderBy(1, resultPerPage, ApplicationSession_.createdDate);
    assertNotNull(pageList);
    assertFalse(pageList.isEmpty());
    assertEquals(resultPerPage, pageList.size());
}
Also used : ApplicationSession(com.hack23.cia.model.internal.application.system.impl.ApplicationSession) Test(org.junit.Test)

Aggregations

ApplicationSession (com.hack23.cia.model.internal.application.system.impl.ApplicationSession)21 Test (org.junit.Test)14 Date (java.util.Date)5 CreateApplicationSessionRequest (com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest)4 AbstractServiceFunctionalIntegrationTest (com.hack23.cia.service.impl.AbstractServiceFunctionalIntegrationTest)4 Secured (org.springframework.security.access.annotation.Secured)4 ApplicationActionEvent (com.hack23.cia.model.internal.application.system.impl.ApplicationActionEvent)3 UserAccount (com.hack23.cia.model.internal.application.user.impl.UserAccount)2 CreateApplicationEventResponse (com.hack23.cia.service.api.action.application.CreateApplicationEventResponse)2 CreateApplicationSessionResponse (com.hack23.cia.service.api.action.application.CreateApplicationSessionResponse)2 VerticalLayout (com.vaadin.ui.VerticalLayout)2 PerfTest (org.databene.contiperf.PerfTest)2 Required (org.databene.contiperf.Required)2 ApplicationConfiguration (com.hack23.cia.model.internal.application.system.impl.ApplicationConfiguration)1 ManageUserAccountRequest (com.hack23.cia.service.api.action.admin.ManageUserAccountRequest)1 ManageUserAccountResponse (com.hack23.cia.service.api.action.admin.ManageUserAccountResponse)1 CreateApplicationEventRequest (com.hack23.cia.service.api.action.application.CreateApplicationEventRequest)1 DestroyApplicationSessionRequest (com.hack23.cia.service.api.action.application.DestroyApplicationSessionRequest)1 DestroyApplicationSessionResponse (com.hack23.cia.service.api.action.application.DestroyApplicationSessionResponse)1 RegisterUserRequest (com.hack23.cia.service.api.action.application.RegisterUserRequest)1