Search in sources :

Example 16 with CreateApplicationSessionRequest

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());
}
Also used : ApplicationSession(com.hack23.cia.model.internal.application.system.impl.ApplicationSession) Serializable(java.io.Serializable) RegisterUserRequest(com.hack23.cia.service.api.action.application.RegisterUserRequest) ApplicationActionEvent(com.hack23.cia.model.internal.application.system.impl.ApplicationActionEvent) CreateApplicationSessionRequest(com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest) ManageUserAccountRequest(com.hack23.cia.service.api.action.admin.ManageUserAccountRequest) RegisterUserResponse(com.hack23.cia.service.api.action.application.RegisterUserResponse) ManageUserAccountResponse(com.hack23.cia.service.api.action.admin.ManageUserAccountResponse) UserAccount(com.hack23.cia.model.internal.application.user.impl.UserAccount) Test(org.junit.Test) AbstractServiceFunctionalIntegrationTest(com.hack23.cia.service.impl.AbstractServiceFunctionalIntegrationTest)

Example 17 with CreateApplicationSessionRequest

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());
}
Also used : RefreshDataViewsRequest(com.hack23.cia.service.api.action.admin.RefreshDataViewsRequest) CreateApplicationSessionRequest(com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest) RefreshDataViewsResponse(com.hack23.cia.service.api.action.admin.RefreshDataViewsResponse) Test(org.junit.Test) AbstractServiceFunctionalIntegrationTest(com.hack23.cia.service.impl.AbstractServiceFunctionalIntegrationTest)

Example 18 with CreateApplicationSessionRequest

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());
}
Also used : SendEmailResponse(com.hack23.cia.service.api.action.admin.SendEmailResponse) CreateApplicationSessionRequest(com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest) SendEmailRequest(com.hack23.cia.service.api.action.admin.SendEmailRequest) Test(org.junit.Test) AbstractServiceFunctionalIntegrationTest(com.hack23.cia.service.impl.AbstractServiceFunctionalIntegrationTest)

Example 19 with CreateApplicationSessionRequest

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());
}
Also used : UpdateApplicationConfigurationRequest(com.hack23.cia.service.api.action.admin.UpdateApplicationConfigurationRequest) CreateApplicationSessionRequest(com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest) UpdateApplicationConfigurationResponse(com.hack23.cia.service.api.action.admin.UpdateApplicationConfigurationResponse) ApplicationConfiguration(com.hack23.cia.model.internal.application.system.impl.ApplicationConfiguration) Test(org.junit.Test) AbstractServiceFunctionalIntegrationTest(com.hack23.cia.service.impl.AbstractServiceFunctionalIntegrationTest)

Example 20 with CreateApplicationSessionRequest

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);
}
Also used : CreateApplicationSessionRequest(com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest) UpdateSearchIndexResponse(com.hack23.cia.service.api.action.admin.UpdateSearchIndexResponse) UpdateSearchIndexRequest(com.hack23.cia.service.api.action.admin.UpdateSearchIndexRequest) Test(org.junit.Test) AbstractServiceFunctionalIntegrationTest(com.hack23.cia.service.impl.AbstractServiceFunctionalIntegrationTest)

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