diff --git a/src/test/java/com/epam/ta/reportportal/core/project/impl/ProjectInfoWidgetDataConverterTest.java b/src/test/java/com/epam/ta/reportportal/core/project/impl/ProjectInfoWidgetDataConverterTest.java index 0d0a96ca88..36ae0fafd0 100644 --- a/src/test/java/com/epam/ta/reportportal/core/project/impl/ProjectInfoWidgetDataConverterTest.java +++ b/src/test/java/com/epam/ta/reportportal/core/project/impl/ProjectInfoWidgetDataConverterTest.java @@ -44,6 +44,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Locale; import java.util.Map; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -65,6 +66,7 @@ class ProjectInfoWidgetDataConverterTest { @BeforeEach void setUp() { + Locale.setDefault(Locale.US); converter = new ProjectInfoWidgetDataConverter( ImmutableMap.builder() .put(InfoInterval.ONE_MONTH, ProjectInfoWidgetDataConverter.ProjectInfoGroup.BY_DAY) @@ -88,6 +90,7 @@ void setUp() { @Test void getInvestigatedProjectInfo() { + Locale.setDefault(Locale.US); Map> investigatedProjectInfo = converter.getInvestigatedProjectInfo(getTestData(), InfoInterval.ONE_MONTH); @@ -233,4 +236,4 @@ private Statistics getStatistics(String statisticsFieldName, int counter) { statistics.setCounter(counter); return statistics; } -} \ No newline at end of file +} diff --git a/src/test/java/com/epam/ta/reportportal/ws/controller/LaunchControllerTest.java b/src/test/java/com/epam/ta/reportportal/ws/controller/LaunchControllerTest.java index 07078629b4..95ce0a8469 100644 --- a/src/test/java/com/epam/ta/reportportal/ws/controller/LaunchControllerTest.java +++ b/src/test/java/com/epam/ta/reportportal/ws/controller/LaunchControllerTest.java @@ -256,7 +256,8 @@ void bulkDeleteLaunches() throws Exception { deleteBulkRQ.setIds(ids); mockMvc.perform(delete(DEFAULT_PROJECT_BASE_URL + "/launch").contentType(APPLICATION_JSON) .with(token(oAuthHelper.getDefaultToken())) - .content(objectMapper.writeValueAsBytes(deleteBulkRQ))).andExpect(status().is(200)); + .param("ids" , "1", "2")) + .andExpect(status().is(200)); List launches = launchRepository.findAllById(ids); assertTrue(launches.isEmpty()); } @@ -420,4 +421,4 @@ void bulkDeleteAttributes() throws Exception { assertEquals(comment, it.getDescription()); }); } -} \ No newline at end of file +} diff --git a/src/test/java/com/epam/ta/reportportal/ws/controller/ProjectControllerTest.java b/src/test/java/com/epam/ta/reportportal/ws/controller/ProjectControllerTest.java index 1a6e27ad6a..a1d8712c50 100644 --- a/src/test/java/com/epam/ta/reportportal/ws/controller/ProjectControllerTest.java +++ b/src/test/java/com/epam/ta/reportportal/ws/controller/ProjectControllerTest.java @@ -16,14 +16,30 @@ package com.epam.ta.reportportal.ws.controller; +import static java.util.Collections.singletonList; +import static org.hamcrest.Matchers.hasSize; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static org.springframework.http.MediaType.APPLICATION_JSON; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + import com.epam.ta.reportportal.core.events.activity.ProjectIndexEvent; import com.epam.ta.reportportal.dao.ProjectRepository; import com.epam.ta.reportportal.entity.enums.LogicalOperator; import com.epam.ta.reportportal.entity.project.Project; import com.epam.ta.reportportal.entity.project.ProjectAttribute; -import com.epam.ta.reportportal.ws.BaseMvcTest; import com.epam.ta.reportportal.model.DeleteBulkRQ; -import com.epam.ta.reportportal.ws.reporting.ItemAttributeResource; import com.epam.ta.reportportal.model.project.AssignUsersRQ; import com.epam.ta.reportportal.model.project.CreateProjectRQ; import com.epam.ta.reportportal.model.project.UnassignUsersRQ; @@ -31,11 +47,18 @@ import com.epam.ta.reportportal.model.project.config.ProjectConfigurationUpdate; import com.epam.ta.reportportal.model.project.email.ProjectNotificationConfigDTO; import com.epam.ta.reportportal.model.project.email.SenderCaseDTO; +import com.epam.ta.reportportal.ws.BaseMvcTest; +import com.epam.ta.reportportal.ws.reporting.ItemAttributeResource; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import com.rabbitmq.http.client.Client; import com.rabbitmq.http.client.domain.ExchangeInfo; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -48,18 +71,6 @@ import org.springframework.test.context.jdbc.Sql; import org.springframework.test.web.servlet.ResultActions; -import java.util.*; - -import static java.util.Collections.singletonList; -import static org.hamcrest.Matchers.hasSize; -import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.*; -import static org.springframework.http.MediaType.APPLICATION_JSON; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - /** * @author Ihar Kahadouski */ @@ -300,7 +311,8 @@ void bulkDeleteProjects() throws Exception { bulkRQ.setIds(Lists.newArrayList(2L, 3L)); mockMvc.perform(delete("/v1/project").with(token(oAuthHelper.getSuperadminToken())) .contentType(APPLICATION_JSON) - .content(objectMapper.writeValueAsBytes(bulkRQ))).andExpect(status().isOk()); + .param("ids" , "2", "3")) + .andExpect(status().isOk()); } @Test diff --git a/src/test/java/com/epam/ta/reportportal/ws/controller/UserControllerTest.java b/src/test/java/com/epam/ta/reportportal/ws/controller/UserControllerTest.java index 7807873e40..d65355dcd6 100644 --- a/src/test/java/com/epam/ta/reportportal/ws/controller/UserControllerTest.java +++ b/src/test/java/com/epam/ta/reportportal/ws/controller/UserControllerTest.java @@ -16,6 +16,20 @@ package com.epam.ta.reportportal.ws.controller; +import static com.epam.ta.reportportal.commons.EntityUtils.normalizeId; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.when; +import static org.springframework.http.MediaType.APPLICATION_JSON; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + import com.epam.ta.reportportal.dao.IssueTypeRepository; import com.epam.ta.reportportal.dao.ProjectRepository; import com.epam.ta.reportportal.dao.UserRepository; @@ -24,34 +38,31 @@ import com.epam.ta.reportportal.entity.item.issue.IssueType; import com.epam.ta.reportportal.entity.project.Project; import com.epam.ta.reportportal.entity.project.ProjectIssueType; -import com.epam.ta.reportportal.ws.BaseMvcTest; import com.epam.ta.reportportal.model.DeleteBulkRQ; import com.epam.ta.reportportal.model.Page; +import com.epam.ta.reportportal.model.user.ChangePasswordRQ; +import com.epam.ta.reportportal.model.user.CreateUserBidRS; +import com.epam.ta.reportportal.model.user.CreateUserRQ; +import com.epam.ta.reportportal.model.user.CreateUserRQConfirm; +import com.epam.ta.reportportal.model.user.CreateUserRQFull; +import com.epam.ta.reportportal.model.user.CreateUserRS; +import com.epam.ta.reportportal.model.user.EditUserRQ; +import com.epam.ta.reportportal.model.user.ResetPasswordRQ; +import com.epam.ta.reportportal.model.user.RestorePasswordRQ; +import com.epam.ta.reportportal.ws.BaseMvcTest; import com.epam.ta.reportportal.ws.model.ValidationConstraints; -import com.epam.ta.reportportal.model.user.*; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.Lists; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; import org.apache.commons.lang3.RandomStringUtils; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.jdbc.Sql; import org.springframework.test.web.servlet.MvcResult; -import java.util.List; -import java.util.Optional; -import java.util.stream.Collectors; - -import static com.epam.ta.reportportal.commons.EntityUtils.normalizeId; -import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.when; -import static org.springframework.http.MediaType.APPLICATION_JSON; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - /** * @author Ihar Kahadouski */ @@ -189,8 +200,9 @@ void deleteUsers() throws Exception { deleteBulkRQ.setIds(Lists.newArrayList(2L)); mockMvc.perform(delete("/v1/user").with(token(oAuthHelper.getSuperadminToken())) - .contentType(APPLICATION_JSON) - .content(objectMapper.writeValueAsBytes(deleteBulkRQ))).andExpect(status().isOk()); + .contentType(APPLICATION_JSON) + .param("ids", "1", "2")) + .andExpect(status().isOk()); } @Test @@ -376,4 +388,4 @@ void exportUsers() throws Exception { mockMvc.perform(get("/v1/user/export").with(token(oAuthHelper.getSuperadminToken()))) .andExpect(status().isOk()); } -} \ No newline at end of file +} diff --git a/src/test/java/com/epam/ta/reportportal/ws/controller/WidgetControllerTest.java b/src/test/java/com/epam/ta/reportportal/ws/controller/WidgetControllerTest.java index a4cfb42657..f65d3909dd 100644 --- a/src/test/java/com/epam/ta/reportportal/ws/controller/WidgetControllerTest.java +++ b/src/test/java/com/epam/ta/reportportal/ws/controller/WidgetControllerTest.java @@ -876,4 +876,4 @@ void getEmptyContentProductStatusGroupedByLaunchWidget() throws Exception { .andExpect(jsonPath("$.widgetType").value("productStatus")) .andExpect(jsonPath("$.content").isEmpty()); } -} \ No newline at end of file +} diff --git a/src/test/java/com/epam/ta/reportportal/ws/validation/TicketsValidationTest.java b/src/test/java/com/epam/ta/reportportal/ws/validation/TicketsValidationTest.java index 05e230a4d7..9e433bf7b6 100644 --- a/src/test/java/com/epam/ta/reportportal/ws/validation/TicketsValidationTest.java +++ b/src/test/java/com/epam/ta/reportportal/ws/validation/TicketsValidationTest.java @@ -10,6 +10,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.HashSet; +import java.util.Locale; import java.util.Set; import javax.validation.ConstraintViolation; import javax.validation.Validation; @@ -26,6 +27,7 @@ public class TicketsValidationTest { @BeforeAll public static void init() { + Locale.setDefault(Locale.US); validator = Validation.buildDefaultValidatorFactory().getValidator(); }