Search in sources :

Example 6 with CreateApplicationSessionRequest

use of com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest in project cia by Hack23.

the class ManageUserAccountServiceITest method manageUserAccountFailureTest.

@Test
public void manageUserAccountFailureTest() throws Exception {
    final CreateApplicationSessionRequest createSessionRequest = createTestApplicationSession();
    final ManageUserAccountRequest serviceRequest = new ManageUserAccountRequest();
    serviceRequest.setSessionId(createSessionRequest.getSessionId());
    final ManageUserAccountResponse response = (ManageUserAccountResponse) applicationManager.service(serviceRequest);
    assertNotNull(EXPECT_A_RESULT, response);
    assertEquals(ServiceResult.FAILURE, response.getResult());
    assertEquals("accountOperation must not be null, userAcountId must not be null", response.getErrorMessage());
}
Also used : CreateApplicationSessionRequest(com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest) ManageUserAccountRequest(com.hack23.cia.service.api.action.admin.ManageUserAccountRequest) ManageUserAccountResponse(com.hack23.cia.service.api.action.admin.ManageUserAccountResponse) Test(org.junit.Test) AbstractServiceFunctionalIntegrationTest(com.hack23.cia.service.impl.AbstractServiceFunctionalIntegrationTest)

Example 7 with CreateApplicationSessionRequest

use of com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest in project cia by Hack23.

the class RemoveDataServiceITest method Test.

/**
 * Test.
 *
 * @throws Exception
 *             the exception
 */
@Test
public void Test() throws Exception {
    final RemoveDataManager removeDataManager = Mockito.mock(RemoveDataManager.class);
    ReflectionTestUtils.setField(removeDataService, "removeDataManager", removeDataManager);
    setAuthenticatedAdminuser();
    final CreateApplicationSessionRequest createSessionRequest = createTestApplicationSession();
    for (final DataType dataType : RemoveDataRequest.DataType.values()) {
        final RemoveDataRequest serviceRequest = new RemoveDataRequest();
        serviceRequest.setSessionId(createSessionRequest.getSessionId());
        serviceRequest.setDataType(dataType);
        final RemoveDataResponse response = (RemoveDataResponse) applicationManager.service(serviceRequest);
        assertNotNull(EXPECT_A_RESULT, response);
        assertEquals(EXPECT_SUCCESS, ServiceResult.SUCCESS, response.getResult());
    }
    Mockito.verify(removeDataManager).removeApplicationHistory();
    Mockito.verify(removeDataManager).removeCommitteeProposals();
    Mockito.verify(removeDataManager).removeDocuments();
    Mockito.verify(removeDataManager).removeDocumentStatus();
    Mockito.verify(removeDataManager).removePersonData();
}
Also used : CreateApplicationSessionRequest(com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest) RemoveDataRequest(com.hack23.cia.service.api.action.admin.RemoveDataRequest) RemoveDataResponse(com.hack23.cia.service.api.action.admin.RemoveDataResponse) DataType(com.hack23.cia.service.api.action.admin.RemoveDataRequest.DataType) RemoveDataManager(com.hack23.cia.service.data.api.RemoveDataManager) Test(org.junit.Test) AbstractServiceFunctionalIntegrationTest(com.hack23.cia.service.impl.AbstractServiceFunctionalIntegrationTest)

Example 8 with CreateApplicationSessionRequest

use of com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest in project cia by Hack23.

the class SendEmailServiceITest method sendEmailSuccessTest.

/**
 * Test.
 *
 * @throws Exception
 *             the exception
 */
@Test
public void sendEmailSuccessTest() throws Exception {
    final CreateApplicationSessionRequest createSessionRequest = createTestApplicationSession();
    final SendEmailRequest serviceRequest = new SendEmailRequest();
    serviceRequest.setSessionId(createSessionRequest.getSessionId());
    serviceRequest.setEmail("info@hack23.com");
    serviceRequest.setSubject("Test Email SendEmailServiceITest");
    serviceRequest.setContent("Test content");
    final SendEmailResponse response = (SendEmailResponse) applicationManager.service(serviceRequest);
    assertNotNull(EXPECT_A_RESULT, response);
    final List<SmtpMessage> emails = dumbster.getReceivedEmails();
    assertEquals(1, emails.size());
    final SmtpMessage email = emails.get(0);
    assertEquals(email.getHeaderValue("Subject"), serviceRequest.getSubject());
    assertEquals(email.getBody(), serviceRequest.getContent());
    assertEquals(email.getHeaderValue("To"), serviceRequest.getEmail());
}
Also used : SendEmailResponse(com.hack23.cia.service.api.action.admin.SendEmailResponse) CreateApplicationSessionRequest(com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest) SmtpMessage(com.dumbster.smtp.SmtpMessage) SendEmailRequest(com.hack23.cia.service.api.action.admin.SendEmailRequest) Test(org.junit.Test) AbstractServiceFunctionalIntegrationTest(com.hack23.cia.service.impl.AbstractServiceFunctionalIntegrationTest)

Example 9 with CreateApplicationSessionRequest

use of com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest 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 10 with CreateApplicationSessionRequest

use of com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest in project cia by Hack23.

the class AbstractServiceFunctionalIntegrationTest method createTestApplicationSession.

/**
 * Creates the test application session.
 *
 * @return the creates the application session request
 */
protected final CreateApplicationSessionRequest createTestApplicationSession() {
    final Random r = new Random();
    final CreateApplicationSessionRequest serviceRequest = new CreateApplicationSessionRequest();
    serviceRequest.setIpInformation(r.nextInt(256) + "." + r.nextInt(256) + "." + r.nextInt(256) + "." + r.nextInt(256));
    serviceRequest.setLocale("en_US.UTF-8");
    serviceRequest.setOperatingSystem("LINUX");
    serviceRequest.setSessionId(UUID.randomUUID().toString());
    serviceRequest.setSessionType(ApplicationSessionType.ANONYMOUS);
    serviceRequest.setUserAgentInformation("Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0");
    final CreateApplicationSessionResponse response = (CreateApplicationSessionResponse) applicationManager.service(serviceRequest);
    assertNotNull(EXPECT_A_RESULT, response);
    assertEquals(EXPECT_SUCCESS, ServiceResult.SUCCESS, response.getResult());
    return serviceRequest;
}
Also used : Random(java.util.Random) CreateApplicationSessionRequest(com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest) CreateApplicationSessionResponse(com.hack23.cia.service.api.action.application.CreateApplicationSessionResponse)

Aggregations

CreateApplicationSessionRequest (com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest)29 AbstractServiceFunctionalIntegrationTest (com.hack23.cia.service.impl.AbstractServiceFunctionalIntegrationTest)27 Test (org.junit.Test)27 RegisterUserRequest (com.hack23.cia.service.api.action.application.RegisterUserRequest)14 RegisterUserResponse (com.hack23.cia.service.api.action.application.RegisterUserResponse)14 UserAccount (com.hack23.cia.model.internal.application.user.impl.UserAccount)13 PerfTest (org.databene.contiperf.PerfTest)13 LoginRequest (com.hack23.cia.service.api.action.application.LoginRequest)7 LoginResponse (com.hack23.cia.service.api.action.application.LoginResponse)7 Required (org.databene.contiperf.Required)7 ApplicationSession (com.hack23.cia.model.internal.application.system.impl.ApplicationSession)5 ServiceResponse (com.hack23.cia.service.api.action.common.ServiceResponse)5 ManageUserAccountRequest (com.hack23.cia.service.api.action.admin.ManageUserAccountRequest)4 ManageUserAccountResponse (com.hack23.cia.service.api.action.admin.ManageUserAccountResponse)4 ApplicationConfiguration (com.hack23.cia.model.internal.application.system.impl.ApplicationConfiguration)3 CreateApplicationSessionResponse (com.hack23.cia.service.api.action.application.CreateApplicationSessionResponse)3 LogoutRequest (com.hack23.cia.service.api.action.application.LogoutRequest)3 SendEmailRequest (com.hack23.cia.service.api.action.admin.SendEmailRequest)2 SendEmailResponse (com.hack23.cia.service.api.action.admin.SendEmailResponse)2 UpdateApplicationConfigurationRequest (com.hack23.cia.service.api.action.admin.UpdateApplicationConfigurationRequest)2