use of com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest in project cia by Hack23.
the class ManageUserAccountServiceITest method manageUserAccountSuccessDeleteTest.
@Test
public void manageUserAccountSuccessDeleteTest() throws Exception {
setAuthenticatedAnonymousUser();
final CreateApplicationSessionRequest createSessionRequest = createTestApplicationSession();
final RegisterUserRequest createAccountRequest = new RegisterUserRequest();
createAccountRequest.setCountry("Sweden");
createAccountRequest.setUsername(UUID.randomUUID().toString());
createAccountRequest.setEmail(createAccountRequest.getUsername() + "@email.com");
createAccountRequest.setUserpassword("Userpassword1!");
createAccountRequest.setUserType(UserType.PRIVATE);
createAccountRequest.setSessionId(createSessionRequest.getSessionId());
final RegisterUserResponse response = (RegisterUserResponse) applicationManager.service(createAccountRequest);
assertNotNull("Expect a result", response);
assertEquals(EXPECT_SUCCESS, ServiceResult.SUCCESS, response.getResult());
setAuthenticatedAdminuser();
final DataContainer<UserAccount, Long> userContainer = applicationManager.getDataContainer(UserAccount.class);
final List<UserAccount> firstCreatedUsed = userContainer.getAllBy(UserAccount_.username, createAccountRequest.getUsername());
assertEquals(1, firstCreatedUsed.size());
final ManageUserAccountRequest deleteAccountRequest = new ManageUserAccountRequest();
deleteAccountRequest.setSessionId(createSessionRequest.getSessionId());
deleteAccountRequest.setAccountOperation(AccountOperation.DELETE);
deleteAccountRequest.setUserAcountId(firstCreatedUsed.get(0).getUserId());
final ManageUserAccountResponse deleteAccountResponse = (ManageUserAccountResponse) applicationManager.service(deleteAccountRequest);
assertNotNull(EXPECT_A_RESULT, deleteAccountResponse);
assertEquals(EXPECT_SUCCESS, ServiceResult.SUCCESS, deleteAccountResponse.getResult());
final List<UserAccount> allByAfterDelete = userContainer.getAllBy(UserAccount_.username, createAccountRequest.getUsername());
assertEquals(0, allByAfterDelete.size());
final DataContainer<ApplicationActionEvent, Long> eventContainer = applicationManager.getDataContainer(ApplicationActionEvent.class);
final List<ApplicationActionEvent> events = eventContainer.getAllBy(ApplicationActionEvent_.userId, firstCreatedUsed.get(0).getUserId());
assertEquals(0, events.size());
final DataContainer<ApplicationSession, Serializable> sessionContainer = applicationManager.getDataContainer(ApplicationSession.class);
final List<ApplicationSession> sessions = sessionContainer.getAllBy(ApplicationSession_.userId, firstCreatedUsed.get(0).getUserId());
assertEquals(0, sessions.size());
}
use of com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest in project cia by Hack23.
the class RefreshDataViewsServiceITest method Test.
/**
* Test.
*
* @throws Exception
* the exception
*/
@Test
public void Test() throws Exception {
setAuthenticatedAdminuser();
final CreateApplicationSessionRequest createSessionRequest = createTestApplicationSession();
final RefreshDataViewsRequest serviceRequest = new RefreshDataViewsRequest();
serviceRequest.setSessionId(createSessionRequest.getSessionId());
final RefreshDataViewsResponse response = (RefreshDataViewsResponse) applicationManager.service(serviceRequest);
assertNotNull(EXPECT_A_RESULT, response);
assertEquals(EXPECT_SUCCESS, ServiceResult.SUCCESS, response.getResult());
}
use of com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest in project cia by Hack23.
the class SendEmailServiceITest method sendEmailInvalidEmailFailureTest.
/**
* Send email invalid email failure test.
*
* @throws Exception
* the exception
*/
@Test
public void sendEmailInvalidEmailFailureTest() throws Exception {
final CreateApplicationSessionRequest createSessionRequest = createTestApplicationSession();
final SendEmailRequest serviceRequest = new SendEmailRequest();
serviceRequest.setSessionId(createSessionRequest.getSessionId());
serviceRequest.setEmail("novalidemail$###hack23.com");
serviceRequest.setSubject("Test Email SendEmailServiceITest");
serviceRequest.setContent("Test content");
final SendEmailResponse response = (SendEmailResponse) applicationManager.service(serviceRequest);
assertNotNull(EXPECT_A_RESULT, response);
assertEquals(ServiceResult.FAILURE, response.getResult());
assertEquals("email must be a well-formed email address", response.getErrorMessage());
}
use of com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest in project cia by Hack23.
the class UpdateApplicationConfigurationServiceITest method successTest.
/**
* Success test.
*
* @throws Exception
* the exception
*/
@Test
public void successTest() throws Exception {
setAuthenticatedAdminuser();
final CreateApplicationSessionRequest createTestApplicationSession = createTestApplicationSession();
final String randomUUID = UUID.randomUUID().toString();
final ApplicationConfiguration applicationConfigurationToUpdate = applicationConfigurationService.checkValueOrLoadDefault("UpdateApplicationRequestTest property", "UpdateApplicationRequestTest should be set to true/false", ConfigurationGroup.AUTHORIZATION, UpdateApplicationConfigurationServiceITest.class.getSimpleName(), "UpdateApplicationConfigurationService ITest", "FunctionalIntegrationTest", "UpdateApplicationRequestTest." + randomUUID, "true");
final UpdateApplicationConfigurationRequest serviceRequest = new UpdateApplicationConfigurationRequest();
serviceRequest.setApplicationConfigurationId(applicationConfigurationToUpdate.getHjid());
serviceRequest.setSessionId(createTestApplicationSession.getSessionId());
serviceRequest.setComponentDescription("componentDescription");
serviceRequest.setConfigDescription("configDescription");
serviceRequest.setConfigTitle("configTitle");
serviceRequest.setComponentTitle("componentTitle");
serviceRequest.setPropertyValue("false");
final UpdateApplicationConfigurationResponse response = (UpdateApplicationConfigurationResponse) applicationManager.service(serviceRequest);
assertNotNull(EXPECT_A_RESULT, response);
assertEquals(EXPECT_SUCCESS, ServiceResult.SUCCESS, response.getResult());
final ApplicationConfiguration applicationConfigurationUpdated = applicationConfigurationService.checkValueOrLoadDefault("UpdateApplicationRequestTest property", "UpdateApplicationRequestTest should be set to true/false", ConfigurationGroup.AUTHORIZATION, UpdateApplicationConfigurationServiceITest.class.getSimpleName(), "UpdateApplicationConfigurationService ITest", "FunctionalIntegrationTest", "UpdateApplicationRequestTest." + randomUUID, "true");
assertEquals("false", applicationConfigurationUpdated.getPropertyValue());
assertEquals("configTitle", applicationConfigurationUpdated.getConfigTitle());
assertEquals("configDescription", applicationConfigurationUpdated.getConfigDescription());
assertEquals("componentTitle", applicationConfigurationUpdated.getComponentTitle());
assertEquals("componentDescription", applicationConfigurationUpdated.getComponentDescription());
}
use of com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest in project cia by Hack23.
the class UpdateSearchIndexServiceITest method Test.
/**
* Test.
*
* @throws Exception
* the exception
*/
@Test
public void Test() throws Exception {
setAuthenticatedAdminuser();
final CreateApplicationSessionRequest createSessionRequest = createTestApplicationSession();
final UpdateSearchIndexRequest serviceRequest = new UpdateSearchIndexRequest();
serviceRequest.setSessionId(createSessionRequest.getSessionId());
final UpdateSearchIndexResponse response = (UpdateSearchIndexResponse) applicationManager.service(serviceRequest);
assertNotNull(EXPECT_A_RESULT, response);
}
Aggregations