Skip to content

Commit b07df4b

Browse files
authored
EPMRPP-98732 refactor imports (#109)
* EPMRPP-98732 || refactor imports and update dependency versions * EPMRPP-98732 || refactor imports and update dependency versions * EPMRPP-98732 || refactor imports and update dependency versions
1 parent 93f16af commit b07df4b

34 files changed

+398
-381
lines changed

build.gradle

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
id 'jacoco'
55
id "com.github.node-gradle.node" version "2.2.1"
66
id "org.openapi.generator" version "7.12.0"
7-
id "org.springframework.boot" version "3.4.2" apply false
7+
id "org.springframework.boot" version "${springBootVersion}" apply false
88
}
99

1010
import org.openapitools.generator.gradle.plugin.tasks.GenerateTask
@@ -27,28 +27,18 @@ repositories {
2727
}
2828
}
2929

30-
dependencyManagement {
31-
imports {
32-
mavenBom(releaseMode ? 'com.epam.reportportal:commons-bom:' + getProperty('bom.version') : 'com.epam.reportportal:commons-bom:5.14.2')
33-
}
34-
}
3530
ext['spring-boot.version'] = "${springBootVersion}"
3631

3732
dependencies {
3833
// ALL new dependencies should be included in shadowJar plugin!
3934
// transitive dependencies may be required as well. could be checked in runtime only!
4035
if (releaseMode) {
41-
implementation 'com.epam.reportportal:commons-dao'
42-
implementation 'com.epam.reportportal:plugin-api'
43-
annotationProcessor 'com.epam.reportportal:plugin-api'
36+
implementation 'com.epam.reportportal:service-api'
37+
annotationProcessor 'com.epam.reportportal:service-api'
4438
} else {
45-
implementation 'com.github.reportportal:commons-dao:develop-SNAPSHOT'
46-
implementation 'com.github.reportportal:plugin-api:develop-SNAPSHOT'
47-
annotationProcessor 'com.github.reportportal:plugin-api:develop-SNAPSHOT'
39+
implementation 'com.github.reportportal:service-api:3e34a90'
40+
annotationProcessor 'com.github.reportportal:service-api:3e34a90'
4841
}
49-
50-
implementation("org.apache.httpcomponents.client5:httpclient5:5.4.2") // supports gzip encoding
51-
implementation "org.hibernate.validator:hibernate-validator:8.0.2.Final"
5242
implementation 'jakarta.el:jakarta.el-api:6.0.1'
5343
implementation 'org.glassfish:jakarta.el:4.0.2'
5444
implementation "org.springdoc:springdoc-openapi-common:1.8.0"

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ version=5.13.5
22
description=EPAM Report Portal. Cloud Jira plugin
33
pluginId = JIRA Cloud
44

5-
springBootVersion=3.4.2
6-
lombokVersion=1.18.36
5+
springBootVersion=3.4.11
6+
lombokVersion=1.18.42

src/main/java/com/epam/reportportal/extension/jira/CloudJiraExtension.java

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@
4040
import com.epam.reportportal.extension.jira.info.impl.PluginInfoProviderImpl;
4141
import com.epam.reportportal.extension.jira.utils.MemoizingSupplier;
4242
import com.epam.reportportal.extension.util.RequestEntityConverter;
43-
import com.epam.ta.reportportal.binary.DataStoreService;
44-
import com.epam.ta.reportportal.dao.IntegrationRepository;
45-
import com.epam.ta.reportportal.dao.IntegrationTypeRepository;
46-
import com.epam.ta.reportportal.dao.LaunchRepository;
47-
import com.epam.ta.reportportal.dao.LogRepository;
48-
import com.epam.ta.reportportal.dao.ProjectRepository;
49-
import com.epam.ta.reportportal.dao.TestItemRepository;
50-
import com.epam.ta.reportportal.dao.TicketRepository;
51-
import com.epam.ta.reportportal.dao.organization.OrganizationRepositoryCustom;
43+
import com.epam.reportportal.infrastructure.persistence.binary.DataStoreService;
44+
import com.epam.reportportal.infrastructure.persistence.dao.IntegrationRepository;
45+
import com.epam.reportportal.infrastructure.persistence.dao.IntegrationTypeRepository;
46+
import com.epam.reportportal.infrastructure.persistence.dao.LaunchRepository;
47+
import com.epam.reportportal.infrastructure.persistence.dao.LogRepository;
48+
import com.epam.reportportal.infrastructure.persistence.dao.ProjectRepository;
49+
import com.epam.reportportal.infrastructure.persistence.dao.TestItemRepository;
50+
import com.epam.reportportal.infrastructure.persistence.dao.TicketRepository;
51+
import com.epam.reportportal.infrastructure.persistence.dao.organization.OrganizationRepositoryCustom;
5252
import com.fasterxml.jackson.databind.DeserializationFeature;
5353
import com.fasterxml.jackson.databind.MapperFeature;
5454
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -233,10 +233,13 @@ private Map<String, CommonPluginCommand<?>> getCommonCommands() {
233233

234234
private Map<String, PluginCommand<?>> getCommands() {
235235
List<PluginCommand<?>> commands = new ArrayList<>();
236-
commands.add(new UserSearchCommand(projectRepository, cloudJiraClientProviderSupplier.get(), organizationRepository));
236+
commands.add(
237+
new UserSearchCommand(projectRepository, cloudJiraClientProviderSupplier.get(), organizationRepository));
237238
commands.add(new TestConnectionCommand(cloudJiraClientProviderSupplier.get()));
238-
commands.add(new GetIssueFieldsCommand(projectRepository, organizationRepository, cloudJiraClientProviderSupplier.get()));
239-
commands.add(new GetIssueTypesCommand(projectRepository, cloudJiraClientProviderSupplier.get(), organizationRepository));
239+
commands.add(
240+
new GetIssueFieldsCommand(projectRepository, organizationRepository, cloudJiraClientProviderSupplier.get()));
241+
commands.add(
242+
new GetIssueTypesCommand(projectRepository, cloudJiraClientProviderSupplier.get(), organizationRepository));
240243
commands.add(new PostTicketCommand(projectRepository,
241244
requestEntityConverter,
242245
cloudJiraClientProviderSupplier.get(),

src/main/java/com/epam/reportportal/extension/jira/CloudJiraPlugin.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222
* @author <a href="mailto:ivan_budayeu@epam.com">Ivan Budayeu</a>
2323
*/
2424
public class CloudJiraPlugin extends Plugin {
25-
/**
26-
* Constructor to be used by plugin manager for plugin instantiation.
27-
* Your plugins have to provide constructor with this exact signature to
28-
* be successfully loaded by manager.
29-
*
30-
* @param wrapper
31-
*/
32-
public CloudJiraPlugin(PluginWrapper wrapper) {
33-
super(wrapper);
34-
}
25+
26+
/**
27+
* Constructor to be used by plugin manager for plugin instantiation. Your plugins have to provide constructor with
28+
* this exact signature to be successfully loaded by manager.
29+
*
30+
* @param wrapper
31+
*/
32+
public CloudJiraPlugin(PluginWrapper wrapper) {
33+
super(wrapper);
34+
}
3535
}

src/main/java/com/epam/reportportal/extension/jira/command/GetIssueCommand.java

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
import com.epam.reportportal.extension.jira.command.utils.CloudJiraClientProvider;
2222
import com.epam.reportportal.extension.jira.command.utils.CloudJiraProperties;
2323
import com.epam.reportportal.extension.jira.command.utils.JIRATicketUtils;
24-
import com.epam.reportportal.model.externalsystem.Ticket;
25-
import com.epam.reportportal.rules.exception.ErrorType;
26-
import com.epam.reportportal.rules.exception.ReportPortalException;
27-
import com.epam.ta.reportportal.dao.IntegrationRepository;
28-
import com.epam.ta.reportportal.dao.TicketRepository;
29-
import com.epam.ta.reportportal.entity.integration.Integration;
30-
import com.epam.ta.reportportal.entity.integration.IntegrationParams;
24+
import com.epam.reportportal.infrastructure.model.externalsystem.Ticket;
25+
import com.epam.reportportal.infrastructure.persistence.dao.IntegrationRepository;
26+
import com.epam.reportportal.infrastructure.persistence.dao.TicketRepository;
27+
import com.epam.reportportal.infrastructure.persistence.entity.integration.Integration;
28+
import com.epam.reportportal.infrastructure.persistence.entity.integration.IntegrationParams;
29+
import com.epam.reportportal.infrastructure.rules.exception.ErrorType;
30+
import com.epam.reportportal.infrastructure.rules.exception.ReportPortalException;
3131
import java.util.Map;
3232
import java.util.Optional;
3333
import org.apache.commons.collections4.CollectionUtils;
@@ -57,36 +57,42 @@ public Ticket executeCommand(Map<String, Object> params) {
5757
var ticketId = Optional.ofNullable(params.get(TICKET_ID))
5858
.map(String::valueOf)
5959
.orElseThrow(() -> new ReportPortalException(ErrorType.BAD_REQUEST_ERROR, TICKET_ID + " must be provided"));
60-
final com.epam.ta.reportportal.entity.bts.Ticket ticket = ticketRepository.findByTicketId(ticketId)
61-
.orElseThrow(() -> new ReportPortalException(ErrorType.BAD_REQUEST_ERROR, "Ticket not found with id " + TICKET_ID));
60+
var ticket = ticketRepository.findByTicketId(ticketId)
61+
.orElseThrow(
62+
() -> new ReportPortalException(ErrorType.BAD_REQUEST_ERROR, "Ticket not found with id " + TICKET_ID));
6263
final Long projectId = (Long) Optional.ofNullable(params.get(PROJECT_ID))
6364
.orElseThrow(() -> new ReportPortalException(ErrorType.BAD_REQUEST_ERROR, PROJECT_ID + " must be provided"));
6465

6566
final String btsUrl = CloudJiraProperties.URL.getParam(params)
66-
.orElseThrow(() -> new ReportPortalException(ErrorType.UNABLE_INTERACT_WITH_INTEGRATION, "Url is not specified."));
67+
.orElseThrow(
68+
() -> new ReportPortalException(ErrorType.UNABLE_INTERACT_WITH_INTEGRATION, "Url is not specified."));
6769
final String btsProject = CloudJiraProperties.PROJECT.getParam(params)
68-
.orElseThrow(() -> new ReportPortalException(ErrorType.UNABLE_INTERACT_WITH_INTEGRATION, "Project is not specified."));
70+
.orElseThrow(
71+
() -> new ReportPortalException(ErrorType.UNABLE_INTERACT_WITH_INTEGRATION, "Project is not specified."));
6972

7073
final Integration integration =
7174
integrationRepository.findProjectBtsByUrlAndLinkedProject(btsUrl, btsProject, projectId)
7275
.orElseGet(() -> integrationRepository.findGlobalBtsByUrlAndLinkedProject(btsUrl, btsProject)
73-
.orElseThrow(() -> new ReportPortalException(ErrorType.BAD_REQUEST_ERROR, "Integration with provided url and project isn't found")));
76+
.orElseThrow(() -> new ReportPortalException(ErrorType.BAD_REQUEST_ERROR,
77+
"Integration with provided url and project isn't found")));
7478
return getTicket(ticketId, integration.getParams());
7579
}
7680

7781
private Ticket getTicket(String ticketId, IntegrationParams details) {
7882
var client = cloudJiraClientProvider.getApiClient(details);
7983
SearchResults issues;
8084
try {
81-
var jql = String.format("project=%s and key=%s", CloudJiraProperties.PROJECT.getParam(details.getParams()).get(), ticketId);
85+
var jql = String.format("project=%s and key=%s", CloudJiraProperties.PROJECT.getParam(details.getParams()).get(),
86+
ticketId);
8287
issues = client.issueSearchApi().searchForIssuesUsingJql(jql, null, 50, "", null, null, null, null, null);
8388

8489
} catch (Exception e) {
8590
throw new ReportPortalException(ErrorType.BAD_REQUEST_ERROR);
8691
}
8792
if (CollectionUtils.isNotEmpty(issues.getIssues())) {
8893
return JIRATicketUtils.toTicket(issues.getIssues().getFirst(), CloudJiraProperties.URL.getParam(details)
89-
.orElseThrow(() -> new ReportPortalException(ErrorType.UNABLE_INTERACT_WITH_INTEGRATION, "Url is not specified.")));
94+
.orElseThrow(
95+
() -> new ReportPortalException(ErrorType.UNABLE_INTERACT_WITH_INTEGRATION, "Url is not specified.")));
9096
} else {
9197
throw new ReportPortalException(ErrorType.BAD_REQUEST_ERROR, "Ticket with id {} is not found", ticketId);
9298
}

src/main/java/com/epam/reportportal/extension/jira/command/GetIssueFieldsCommand.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import static com.epam.reportportal.extension.jira.command.utils.IssueField.FIX_VERSIONS_FIELD;
2222
import static com.epam.reportportal.extension.jira.command.utils.IssueField.ISSUE_TYPE_FIELD;
2323
import static com.epam.reportportal.extension.jira.command.utils.IssueField.PRIORITY_FIELD;
24-
import static com.epam.reportportal.rules.exception.ErrorType.UNABLE_INTERACT_WITH_INTEGRATION;
24+
import static com.epam.reportportal.infrastructure.rules.exception.ErrorType.UNABLE_INTERACT_WITH_INTEGRATION;
2525

2626
import com.epam.reportportal.extension.ProjectManagerCommand;
2727
import com.epam.reportportal.extension.jira.api.model.IssueCreateMetadata;
@@ -34,13 +34,13 @@
3434
import com.epam.reportportal.extension.jira.command.utils.CloudJiraClientProvider;
3535
import com.epam.reportportal.extension.jira.command.utils.CloudJiraProperties;
3636
import com.epam.reportportal.extension.jira.command.utils.JIRATicketUtils;
37-
import com.epam.reportportal.model.externalsystem.AllowedValue;
38-
import com.epam.reportportal.model.externalsystem.PostFormField;
39-
import com.epam.reportportal.rules.exception.ErrorType;
40-
import com.epam.reportportal.rules.exception.ReportPortalException;
41-
import com.epam.ta.reportportal.dao.ProjectRepository;
42-
import com.epam.ta.reportportal.dao.organization.OrganizationRepositoryCustom;
43-
import com.epam.ta.reportportal.entity.integration.Integration;
37+
import com.epam.reportportal.infrastructure.model.externalsystem.AllowedValue;
38+
import com.epam.reportportal.infrastructure.model.externalsystem.PostFormField;
39+
import com.epam.reportportal.infrastructure.persistence.dao.ProjectRepository;
40+
import com.epam.reportportal.infrastructure.persistence.dao.organization.OrganizationRepositoryCustom;
41+
import com.epam.reportportal.infrastructure.persistence.entity.integration.Integration;
42+
import com.epam.reportportal.infrastructure.rules.exception.ErrorType;
43+
import com.epam.reportportal.infrastructure.rules.exception.ReportPortalException;
4444
import com.fasterxml.jackson.databind.JsonNode;
4545
import com.fasterxml.jackson.databind.ObjectMapper;
4646
import java.util.ArrayList;
@@ -92,7 +92,8 @@ protected List<PostFormField> invokeCommand(Integration integration, Map<String,
9292
IssueTypeDetails issueType = jiraProject.getIssueTypes().stream()
9393
.filter(input -> issueTypeParam.equalsIgnoreCase(input.getName()))
9494
.findFirst()
95-
.orElseThrow(() -> new ReportPortalException(UNABLE_INTERACT_WITH_INTEGRATION, "Issue type '" + issueTypeParam + "' not found"));
95+
.orElseThrow(() -> new ReportPortalException(UNABLE_INTERACT_WITH_INTEGRATION,
96+
"Issue type '" + issueTypeParam + "' not found"));
9697

9798
IssueCreateMetadata issueCreateMetadata = client.issuesApi().getCreateIssueMeta(
9899
Collections.singletonList(jiraProject.getId()),
@@ -125,10 +126,10 @@ protected List<PostFormField> invokeCommand(Integration integration, Map<String,
125126
// Provide values for custom fields with predefined options
126127
if (issueField.getValue().getAllowedValues() != null) {
127128
allowed = issueField.getValue().getAllowedValues().stream()
128-
.map(value -> (JsonNode) new ObjectMapper().valueToTree(value))
129-
.filter(JIRATicketUtils::isCustomField)
130-
.map(jn -> new AllowedValue(jn.get("id").asText(), jn.get("value").asText()))
131-
.collect(Collectors.toList());
129+
.map(value -> (JsonNode) new ObjectMapper().valueToTree(value))
130+
.filter(JIRATicketUtils::isCustomField)
131+
.map(jn -> new AllowedValue(jn.get("id").asText(), jn.get("value").asText()))
132+
.collect(Collectors.toList());
132133
}
133134

134135
if (fieldID.equalsIgnoreCase(COMPONENTS_FIELD.getValue())) {

src/main/java/com/epam/reportportal/extension/jira/command/GetIssueTypesCommand.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
import com.epam.reportportal.extension.jira.client.JiraRestClient;
2323
import com.epam.reportportal.extension.jira.command.utils.CloudJiraClientProvider;
2424
import com.epam.reportportal.extension.jira.command.utils.CloudJiraProperties;
25-
import com.epam.reportportal.rules.exception.ErrorType;
26-
import com.epam.reportportal.rules.exception.ReportPortalException;
27-
import com.epam.ta.reportportal.dao.ProjectRepository;
28-
import com.epam.ta.reportportal.dao.organization.OrganizationRepositoryCustom;
29-
import com.epam.ta.reportportal.entity.integration.Integration;
25+
import com.epam.reportportal.infrastructure.persistence.dao.ProjectRepository;
26+
import com.epam.reportportal.infrastructure.persistence.dao.organization.OrganizationRepositoryCustom;
27+
import com.epam.reportportal.infrastructure.persistence.entity.integration.Integration;
28+
import com.epam.reportportal.infrastructure.rules.exception.ErrorType;
29+
import com.epam.reportportal.infrastructure.rules.exception.ReportPortalException;
3030
import java.util.List;
3131
import java.util.Map;
3232
import org.springframework.web.client.RestClientException;

0 commit comments

Comments
 (0)