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