Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPMRPP-89396 || fix failing tests #1939

Merged
merged 2 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -65,6 +66,7 @@ class ProjectInfoWidgetDataConverterTest {

@BeforeEach
void setUp() {
Locale.setDefault(Locale.US);
converter = new ProjectInfoWidgetDataConverter(
ImmutableMap.<InfoInterval, ProjectInfoWidgetDataConverter.ProjectInfoGroup>builder()
.put(InfoInterval.ONE_MONTH, ProjectInfoWidgetDataConverter.ProjectInfoGroup.BY_DAY)
Expand All @@ -88,6 +90,7 @@ void setUp() {

@Test
void getInvestigatedProjectInfo() {
Locale.setDefault(Locale.US);
Map<String, List<ChartObject>> investigatedProjectInfo =
converter.getInvestigatedProjectInfo(getTestData(), InfoInterval.ONE_MONTH);

Expand Down Expand Up @@ -233,4 +236,4 @@ private Statistics getStatistics(String statisticsFieldName, int counter) {
statistics.setCounter(counter);
return statistics;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [reviewdog] <com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceBeforeCheck> reported by reviewdog 🐶
',' is preceded with whitespace.

.andExpect(status().is(200));
List<Launch> launches = launchRepository.findAllById(ids);
assertTrue(launches.isEmpty());
}
Expand Down Expand Up @@ -420,4 +421,4 @@ void bulkDeleteAttributes() throws Exception {
assertEquals(comment, it.getDescription());
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,49 @@

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;
import com.epam.ta.reportportal.model.project.UpdateProjectRQ;
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;
Expand All @@ -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 <a href="mailto:[email protected]">Ihar Kahadouski</a>
*/
Expand Down Expand Up @@ -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"))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [reviewdog] <com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceBeforeCheck> reported by reviewdog 🐶
',' is preceded with whitespace.

.andExpect(status().isOk());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 <a href="mailto:[email protected]">Ihar Kahadouski</a>
*/
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -376,4 +388,4 @@ void exportUsers() throws Exception {
mockMvc.perform(get("/v1/user/export").with(token(oAuthHelper.getSuperadminToken())))
.andExpect(status().isOk());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -876,4 +876,4 @@ void getEmptyContentProductStatusGroupedByLaunchWidget() throws Exception {
.andExpect(jsonPath("$.widgetType").value("productStatus"))
.andExpect(jsonPath("$.content").isEmpty());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -26,6 +27,7 @@ public class TicketsValidationTest {

@BeforeAll
public static void init() {
Locale.setDefault(Locale.US);
validator = Validation.buildDefaultValidatorFactory().getValidator();
}

Expand Down
Loading