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

Release 5.12.0 #33

Merged
merged 84 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
2323097
Gitlab MVP work in progress
zsoltEPAM Sep 18, 2023
88ff397
Gitlab MVP work in progress 2
zsoltEPAM Sep 20, 2023
6ffe823
Gitlab MVP work in progress 2
zsoltEPAM Sep 20, 2023
e2b3673
Gitlab MVP work in progress | working client
zsoltEPAM Sep 21, 2023
692d7a4
Gitlab MVP work in progress | working client
zsoltEPAM Sep 21, 2023
d17b8cb
Gitlab MVP work in progress | all function working
zsoltEPAM Sep 21, 2023
64f4c0d
Gitlab MVP version 1
zsoltEPAM Sep 22, 2023
f667ffd
Gitlab MVP version 1
zsoltEPAM Sep 22, 2023
2b94452
Gitlab MVP version 1.1
zsoltEPAM Oct 5, 2023
655a5cd
Ticket mapping fix
zsoltEPAM Oct 5, 2023
68cd9d7
EPMRPP-85619 || Create global integration for GitLab plugin (#1)
Vadim73i Oct 13, 2023
b1c515b
EPMRPP-85672 || Link issue from GitLab to failed test case
APiankouski Oct 13, 2023
2a83ded
Remove GetFileCommand
APiankouski Oct 13, 2023
ecfd628
EPMRPP-87071 || Post issue on the failed test in ReportPortal to GitL…
APiankouski Oct 26, 2023
14212bd
Fuature/epmrpp 87071 add weight field (#5)
APiankouski Oct 27, 2023
cbcf137
EPMRPP-87049 || Rename parameters for getIssue
APiankouski Oct 27, 2023
d6e7090
EPMRPP-87023 || No UI validation on Create/Edit Gitlab integration mo…
Vadim73i Oct 27, 2023
3375be5
Update confidential field (#7)
APiankouski Oct 30, 2023
61ca9cb
EPMRPP-87023 || No UI validation on Create/Edit Gitlab integration mo…
Vadim73i Oct 31, 2023
ff3b77d
EPMRPP-86302 || Create Global integration modal. New design support (#8)
AmsterGet Oct 31, 2023
a3aae28
EPMRPP-87411 || All spaces are replaced with %20 if post issue to GitLab
APiankouski Nov 8, 2023
8e42187
Merge pull request #10 from reportportal/bugfix/EPMRPP-87411
pbortnik Nov 8, 2023
26b5164
EMPRPP-87316 || Add search user commands
pbortnik Nov 8, 2023
67ce6f4
EMPRPP-87316 || Add search milestones commands
pbortnik Nov 8, 2023
23aeea6
EMPRPP-87316 || Add search milestones commands
pbortnik Nov 8, 2023
5d2db22
EMPRPP-87316 || Refactor old commands
pbortnik Nov 8, 2023
3823340
EPMRPP-87316 || Add multiselect in fields support
pbortnik Nov 9, 2023
26112e7
EMPRPP-87316 || Provide version
pbortnik Nov 9, 2023
aac9e5f
EMPRPP-87316 || Update plugin api version
pbortnik Nov 9, 2023
0af76a5
Merge commit
pbortnik Nov 9, 2023
ddb70db
Update GitlabClient
pbortnik Nov 9, 2023
4b61b71
Merge remote-tracking branch 'origin/feature/test' into feature/test
pbortnik Nov 9, 2023
f3a17b9
EPMRPP-87316 || Add headers
pbortnik Nov 10, 2023
16ea778
Merge pull request #12 from reportportal/feature/EPMRPP-87316
pbortnik Nov 10, 2023
740b1cb
EPMRPP-87316 || Add search epic command
pbortnik Nov 10, 2023
fffb0cc
EPMRPP-87316 || Add description to the field.
pbortnik Nov 10, 2023
3ef69af
EPMRPP-87316 || Add description to the field.
pbortnik Nov 10, 2023
5a251ed
EPMRPP-87316 || Add description to the field.
pbortnik Nov 10, 2023
cc20960
Merge pull request #13 from reportportal/feature/EPMRPP-87493
pbortnik Nov 10, 2023
8efd5f8
EMPRPP-87334 || Refactor to command approach
pbortnik Nov 11, 2023
32b55f0
Merge pull request #14 from reportportal/feature/EPMRPP-87334
pbortnik Nov 13, 2023
fbe378d
EPMRPP-87316 || Add headers
pbortnik Nov 13, 2023
85d3342
EMPRPP-87336 || Update fields building
Nov 16, 2023
54dfdbf
EMPRPP-86303 || Create search labels commands.
Nov 17, 2023
08b2035
EPMRPP-87316 || Fix title name
pbortnik Nov 17, 2023
76dde90
Merge remote-tracking branch 'origin/develop' into develop
pbortnik Nov 17, 2023
3915c28
EPMRPP-87316 || Refactor fields handling into query params
pbortnik Nov 17, 2023
b2e6a19
Merge pull request #15 from reportportal/feature/EPMRPP-86303
pbortnik Nov 20, 2023
63ae021
EPMRPP-86303 || Add proper handling of not existed labels
pbortnik Nov 20, 2023
983b396
EPMRPP-87336 || Add description to the premium fields
pbortnik Nov 20, 2023
5d08a05
EMPRPP-86303 || Update labels while posting ticket.
pbortnik Nov 21, 2023
b63c7ce
EMPRPP-86303 || Update labels while posting ticket.
pbortnik Nov 21, 2023
444830e
EMPRPP-86303 || Fix potential npes
pbortnik Nov 22, 2023
aac3445
EMPRPP-86303 || Add request logging
pbortnik Nov 22, 2023
2d6009a
EMPRPP-86303 || Add request logging
pbortnik Nov 22, 2023
d2daa68
EMPRPP-86303 || Proper handling of named values
pbortnik Nov 22, 2023
1695d51
EMPRPP-86303 || Refactor handling of named values
pbortnik Nov 22, 2023
fbb78c3
EPMRPP-87336 || Fix labels collector
pbortnik Nov 23, 2023
f3b4525
EPMRPP-87336 || Fix assignee_id
pbortnik Nov 23, 2023
9153561
EPMRPP-87336 || Fix collection of named value
pbortnik Nov 23, 2023
138f62c
EPMRPP-87433 || Add comment, logs, attachment support (#16)
pbortnik Nov 27, 2023
6291226
EPMRPP-88443 || Add empty description handler
pbortnik Nov 29, 2023
04bb7cf
EPMRPP-88419 || Store different types of fields for Incident and Issue
pbortnik Nov 29, 2023
712bcf5
EPMRPP-88419 || Update assignee description
pbortnik Nov 30, 2023
60ae4ba
EPMRPP-88443 || Add empty description handler
pbortnik Nov 30, 2023
cbe3811
Add openapi spec (#17)
raikbitters Dec 14, 2023
f032496
EPMRPP-88902 || Not clear error when user submits invalid token
APiankouski Dec 28, 2023
4ec3b8c
Epmrpp-88957 || Back link to Report Portal, Attachments, Logs and Com…
APiankouski Dec 29, 2023
7e342ba
EPMRPP-87061 || Extra symbols are cut in Integrations modals and user…
Vadim73i Jan 3, 2024
a68961d
Update README.md
AmsterGet Jan 18, 2024
f9cb3aa
Update README.md
AmsterGet Jan 18, 2024
97e0754
EPMRPP-88348 || Description is not added to GitLab issue when posting…
Vadim73i Jan 23, 2024
e0d912d
EPMRPP-80259 || Upgrade Node.js version to 20+ (#26)
Vadim73i Feb 8, 2024
018b0bd
EPMRPP-88848 || Update to use commons reporting instead of commons model
IvanKustau Mar 4, 2024
b3dddfd
Merge pull request #27 from reportportal/EPMRPP-88848-gitlab-multiple…
IvanKustau Mar 4, 2024
5c81f51
EPMRPP-89630 || Update react and subsequent libs (#28)
Vadim73i Mar 5, 2024
adfa131
Merge Rc/5.11.0 (#29)
pbortnik Mar 14, 2024
abcf0cd
EPMRPP-89703 || Update libs with one merged (#31)
pbortnik Apr 5, 2024
fadf9fa
EPMRPP-90180 update dependencies (Instant time) (#30)
grabsefx Apr 15, 2024
317de38
EPMRPP-91000 || Change date time formatter
pbortnik Jun 3, 2024
10b7455
EPMRPP-92203 || Update doc link
pbortnik Jul 3, 2024
a44079d
Merge remote-tracking branch 'origin/master' into develop
APiankouski Sep 4, 2024
638ad2c
Release 5.12.0
APiankouski Sep 4, 2024
2ba0c96
Release 5.12.0
APiankouski Sep 4, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ on:

env:
GH_USER_NAME: github.actor
SCRIPTS_VERSION: 5.10.0
BOM_VERSION: 5.11.2
SCRIPTS_VERSION: 5.12.0
BOM_VERSION: 5.12.1

jobs:
release:
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# Template plugin for Epam Report Portal
# Plugin to integrate GitLab with Report Portal

## UI
## Build locally

### UI

Install the dependencies: `npm install`

Build the UI source code: `npm run build`

## Build the plugin
### Build the plugin

Preconditions:
- Install JDK version 11.
Expand Down
11 changes: 7 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,21 @@ repositories {

dependencyManagement {
imports {
mavenBom(releaseMode ? 'com.epam.reportportal:commons-bom:' + getProperty('bom.version') : 'com.epam.reportportal:commons-bom:5.11.2')
mavenBom(releaseMode ? 'com.epam.reportportal:commons-bom:' + getProperty('bom.version') : 'com.epam.reportportal:commons-bom:5.12.1')
}
}

dependencies {
if (releaseMode) {
implementation 'com.epam.reportportal:commons-dao'
implementation 'com.epam.reportportal:plugin-api'
annotationProcessor 'com.epam.reportportal:plugin-api'
} else {
implementation 'com.epam.reportportal:plugin-api'
annotationProcessor 'com.epam.reportportal:plugin-api'
implementation 'com.github.reportportal:commons-dao:acf1ec7'
implementation 'com.github.reportportal:plugin-api:188792e'
annotationProcessor 'com.github.reportportal:plugin-api:188792e'
}
implementation 'org.hibernate:hibernate-core:5.6.15.Final'

implementation group: 'javax.servlet', name: 'javax.servlet-api', version: '4.0.1'
testImplementation 'org.junit.jupiter:junit-jupiter:5.6.0'
Expand Down Expand Up @@ -125,4 +128,4 @@ task assemblePlugins(type: Copy) {
dependsOn subprojects.assemblePlugin
}

compileJava.dependsOn npm_run_build
compileJava.dependsOn npm_run_build
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version=5.11.2
version=5.12.0
description=EPAM Report Portal. GitLab plugin.
pluginId = GitLab
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class GitlabExtension implements ReportPortalExtensionPoint, DisposableBe
public static final String BINARY_DATA_PROPERTIES_FILE_ID = "binary-data.properties";
private static final String PLUGIN_ID = "GitLab";
private static final String DOCUMENTATION_LINK_FIELD = "documentationLink";
private static final String DOCUMENTATION_LINK = "https://reportportal.io/docs/plugins/GitLabBTS";
private static final String DOCUMENTATION_LINK = "https://reportportal.io/docs/plugins/GitLab/";
private final String resourcesDir;
private final RequestEntityConverter requestEntityConverter;
private final Supplier<ApplicationListener<PluginEvent>> pluginLoadedListenerSupplier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.epam.reportportal.extension.gitlab.dto.UserDto;
import com.epam.reportportal.extension.gitlab.utils.GitlabObjectMapperProvider;
import com.epam.ta.reportportal.entity.attachment.Attachment;
import com.epam.ta.reportportal.exception.ReportPortalException;
import com.epam.reportportal.rules.exception.ReportPortalException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import com.epam.reportportal.extension.gitlab.command.GitlabProperties;
import com.epam.ta.reportportal.entity.integration.IntegrationParams;
import com.epam.ta.reportportal.exception.ReportPortalException;
import com.epam.ta.reportportal.ws.model.ErrorType;
import com.epam.reportportal.rules.exception.ReportPortalException;
import com.epam.reportportal.rules.exception.ErrorType;
import org.jasypt.util.text.BasicTextEncryptor;

/**
Expand All @@ -19,11 +19,12 @@ public GitlabClientProvider(BasicTextEncryptor textEncryptor) {

public GitlabClient get(IntegrationParams integrationParams) {
String credentials = textEncryptor.decrypt(
GitlabProperties.API_TOKEN.getParam(integrationParams)
.orElseThrow(() -> new ReportPortalException(ErrorType.UNABLE_INTERACT_WITH_INTEGRATION,
"Access token is not specified.")));
String url = GitlabProperties.URL.getParam(integrationParams)
.orElseThrow(() -> new ReportPortalException(ErrorType.UNABLE_INTERACT_WITH_INTEGRATION,
GitlabProperties.API_TOKEN.getParam(integrationParams).orElseThrow(
() -> new ReportPortalException(ErrorType.UNABLE_INTERACT_WITH_INTEGRATION,
"Access token is not specified."
)));
String url = GitlabProperties.URL.getParam(integrationParams).orElseThrow(
() -> new ReportPortalException(ErrorType.UNABLE_INTERACT_WITH_INTEGRATION,
"Url to the GitLab is not specified."
));
return new GitlabClient(url, credentials);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,25 @@

package com.epam.reportportal.extension.gitlab.command;

import static com.epam.ta.reportportal.commons.EntityUtils.TO_DATE;
import static com.epam.ta.reportportal.commons.EntityUtils.INSTANT_TO_LDT;
import static java.util.Optional.ofNullable;

import com.epam.reportportal.extension.gitlab.client.GitlabClient;
import com.epam.reportportal.extension.gitlab.dto.UploadsLinkDto;
import com.epam.reportportal.model.externalsystem.PostTicketRQ;
import com.epam.ta.reportportal.binary.DataStoreService;
import com.epam.ta.reportportal.dao.LogRepository;
import com.epam.ta.reportportal.dao.TestItemRepository;
import com.epam.ta.reportportal.entity.attachment.Attachment;
import com.epam.ta.reportportal.entity.item.TestItem;
import com.epam.ta.reportportal.entity.log.Log;
import com.epam.ta.reportportal.exception.ReportPortalException;
import com.epam.ta.reportportal.ws.model.ErrorType;
import com.epam.ta.reportportal.ws.model.externalsystem.PostTicketRQ;
import com.epam.reportportal.rules.exception.ReportPortalException;
import com.epam.reportportal.rules.exception.ErrorType;
import java.io.IOException;
import java.io.InputStream;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.format.DateTimeFormatter;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -64,14 +65,14 @@ public class DescriptionBuilderService {
private final LogRepository logRepository;
private final TestItemRepository itemRepository;
private final DataStoreService dataStoreService;
private final DateFormat dateFormat;
private final DateTimeFormatter dateFormat;
private final MimeTypes mimeRepository;
private GitlabClient gitlabClient;
private String projectId;

public DescriptionBuilderService(LogRepository logRepository, TestItemRepository itemRepository,
DataStoreService dataStoreService) {
this.dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
this.dateFormat = DateTimeFormatter.ofPattern("MM-dd-yyyy HH:mm:ss");
this.logRepository = logRepository;
this.itemRepository = itemRepository;
this.mimeRepository = TikaConfig.getDefaultConfig().getMimeRepository();
Expand All @@ -93,9 +94,8 @@ public String getDescription(PostTicketRQ ticketRQ, GitlabClient gitlabClient,
}
StringBuilder descriptionBuilder = new StringBuilder();

TestItem item = itemRepository.findById(ticketRQ.getTestItemId())
.orElseThrow(() -> new ReportPortalException(ErrorType.TEST_ITEM_NOT_FOUND,
ticketRQ.getTestItemId()));
TestItem item = itemRepository.findById(ticketRQ.getTestItemId()).orElseThrow(
() -> new ReportPortalException(ErrorType.TEST_ITEM_NOT_FOUND, ticketRQ.getTestItemId()));
ticketRQ.getBackLinks().keySet().forEach(
backLinkId -> updateDescriptionBuilder(descriptionBuilder, ticketRQ, backLinkId, item));
return descriptionBuilder.toString();
Expand All @@ -104,9 +104,7 @@ public String getDescription(PostTicketRQ ticketRQ, GitlabClient gitlabClient,
private void updateDescriptionBuilder(StringBuilder descriptionBuilder, PostTicketRQ ticketRQ,
Long backLinkId, TestItem item) {
if (StringUtils.isNotBlank(ticketRQ.getBackLinks().get(backLinkId))) {
descriptionBuilder.append(BACK_LINK_HEADER)
.append("\n\n")
.append(" - ")
descriptionBuilder.append(BACK_LINK_HEADER).append("\n\n").append(" - ")
.append(String.format(BACK_LINK_PATTERN, ticketRQ.getBackLinks().get(backLinkId)))
.append("\n\n");
}
Expand All @@ -131,17 +129,14 @@ private StringBuilder updateWithLogsInfo(StringBuilder descriptionBuilder, Long
PostTicketRQ ticketRQ) {
itemRepository.findById(backLinkId)
.ifPresent(item -> ofNullable(item.getLaunchId()).ifPresent(launchId -> {
List<Log> logs = logRepository.findAllUnderTestItemByLaunchIdAndTestItemIdsWithLimit(
launchId,
Collections.singletonList(item.getItemId()),
ticketRQ.getNumberOfLogs()
);
List<Log> logs =
logRepository.findAllUnderTestItemByLaunchIdAndTestItemIdsWithLimit(launchId,
Collections.singletonList(item.getItemId()), ticketRQ.getNumberOfLogs()
);
if (CollectionUtils.isNotEmpty(logs) && (ticketRQ.getIsIncludeLogs()
|| ticketRQ.getIsIncludeScreenshots())) {
descriptionBuilder.append("### **Test execution log:** \n\n");
logs.forEach(log -> updateWithLog(descriptionBuilder,
log,
ticketRQ.getIsIncludeLogs(),
logs.forEach(log -> updateWithLog(descriptionBuilder, log, ticketRQ.getIsIncludeLogs(),
ticketRQ.getIsIncludeScreenshots()
));
}
Expand All @@ -165,8 +160,7 @@ private String getFormattedMessage(Log log) {
StringBuilder messageBuilder = new StringBuilder();
messageBuilder.append(CODE);
ofNullable(log.getLogTime()).ifPresent(logTime -> messageBuilder.append(" Time: ")
.append(dateFormat.format(TO_DATE.apply(logTime)))
.append(", "));
.append(dateFormat.format(INSTANT_TO_LDT.apply(logTime))).append(", "));
ofNullable(log.getLogLevel()).ifPresent(
logLevel -> messageBuilder.append("Level: ").append(logLevel).append(", "));
messageBuilder.append("Log: ").append(log.getLogMessage()).append(CODE).append("\n\n");
Expand All @@ -187,4 +181,4 @@ private void addAttachment(StringBuilder descriptionBuilder, Attachment attachme
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,29 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.epam.reportportal.extension.gitlab.command;

import static org.hibernate.bytecode.BytecodeLogger.LOGGER;

import com.epam.reportportal.extension.CommonPluginCommand;
import com.epam.reportportal.extension.gitlab.client.GitlabClientProvider;
import com.epam.reportportal.extension.gitlab.utils.TicketMapper;
import com.epam.reportportal.model.externalsystem.Ticket;
import com.epam.reportportal.rules.exception.ErrorType;
import com.epam.reportportal.rules.exception.ReportPortalException;
import com.epam.ta.reportportal.dao.IntegrationRepository;
import com.epam.ta.reportportal.entity.integration.Integration;
import com.epam.ta.reportportal.exception.ReportPortalException;
import com.epam.ta.reportportal.ws.model.ErrorType;
import com.epam.ta.reportportal.ws.model.externalsystem.Ticket;
import java.util.Map;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* @author <a href="mailto:[email protected]">Andrei Piankouski</a>
*/
public class GetIssueCommand implements CommonPluginCommand<Ticket> {
private static final Logger LOGGER = LoggerFactory.getLogger(GetIssueCommand.class);


private final String PROJECT_ID = "projectId";

Expand All @@ -47,25 +51,30 @@ public GetIssueCommand(GitlabClientProvider gitlabClientProvider,

@Override
public Ticket executeCommand(Map<String, Object> params) {
final Long projectId = (Long) Optional.ofNullable(params.get(PROJECT_ID))
.orElseThrow(() -> new ReportPortalException(ErrorType.BAD_REQUEST_ERROR,
PROJECT_ID + " must be provided"));
String btsProject = GitlabProperties.PROJECT.getParam(params)
.orElseThrow(() -> new ReportPortalException(ErrorType.UNABLE_INTERACT_WITH_INTEGRATION,
"Bts Project id is not specified."));
String issueId = GitlabProperties.TICKET_ID.getParam(params)
.orElseThrow(() -> new ReportPortalException(ErrorType.UNABLE_INTERACT_WITH_INTEGRATION,
"Issue id is not specified."));
final String btsUrl = GitlabProperties.URL.getParam(params)
.orElseThrow(() -> new ReportPortalException(ErrorType.UNABLE_INTERACT_WITH_INTEGRATION,
"Url is not specified."));
final Integration integration = integrationRepository.findProjectBtsByUrlAndLinkedProject(
btsUrl, btsProject, projectId)
.orElseGet(
() -> integrationRepository.findGlobalBtsByUrlAndLinkedProject(btsUrl, btsProject)
.orElseThrow(() -> new ReportPortalException(ErrorType.BAD_REQUEST_ERROR,
"Integration with provided url and project isn't found"
)));
final Long projectId = (Long) Optional.ofNullable(params.get(PROJECT_ID)).orElseThrow(
() -> new ReportPortalException(ErrorType.BAD_REQUEST_ERROR,
PROJECT_ID + " must be provided"
));
String btsProject = GitlabProperties.PROJECT.getParam(params).orElseThrow(
() -> new ReportPortalException(ErrorType.UNABLE_INTERACT_WITH_INTEGRATION,
"Bts Project id is not specified."
));
String issueId = GitlabProperties.TICKET_ID.getParam(params).orElseThrow(
() -> new ReportPortalException(ErrorType.UNABLE_INTERACT_WITH_INTEGRATION,
"Issue id is not specified."
));
final String btsUrl = GitlabProperties.URL.getParam(params).orElseThrow(
() -> new ReportPortalException(ErrorType.UNABLE_INTERACT_WITH_INTEGRATION,
"Url is not specified."
));
final Integration integration =
integrationRepository.findProjectBtsByUrlAndLinkedProject(btsUrl, btsProject, projectId)
.orElseGet(
() -> integrationRepository.findGlobalBtsByUrlAndLinkedProject(btsUrl, btsProject)
.orElseThrow(() -> new ReportPortalException(
ErrorType.BAD_REQUEST_ERROR,
"Integration with provided url and project isn't found"
)));
try {
return TicketMapper.toTicket(
gitlabClientProvider.get(integration.getParams()).getIssue(issueId, btsProject));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.epam.reportportal.extension.gitlab.command;

import static com.epam.reportportal.extension.gitlab.command.GetIssueTypesCommand.ISSUE;
import static com.epam.reportportal.extension.gitlab.command.PredefinedFieldTypes.CREATABLE_MULTI_AUTOCOMPLETE;
import static com.epam.reportportal.extension.gitlab.command.PredefinedFieldTypes.MULTI_AUTOCOMPLETE;

import com.epam.reportportal.extension.ProjectMemberCommand;
import com.epam.reportportal.model.externalsystem.AllowedValue;
import com.epam.reportportal.model.externalsystem.PostFormField;
import com.epam.ta.reportportal.dao.ProjectRepository;
import com.epam.ta.reportportal.entity.integration.Integration;
import com.epam.ta.reportportal.exception.ReportPortalException;
import com.epam.ta.reportportal.ws.model.ErrorType;
import com.epam.ta.reportportal.ws.model.externalsystem.AllowedValue;
import com.epam.ta.reportportal.ws.model.externalsystem.PostFormField;
import com.epam.reportportal.rules.exception.ReportPortalException;
import com.epam.reportportal.rules.exception.ErrorType;
import com.google.common.collect.Lists;
import java.util.List;
import java.util.Map;
Expand All @@ -40,42 +41,38 @@ public class GetIssueFieldsCommand extends ProjectMemberCommand<List<PostFormFie
public static final String ISSUE_TYPE_PARAM = "issueType";
public static final String LABELS = "labels";

private static final String PAID_DESCRIPTION = "Available only for paid Enterprise version of GitLab";
private static final String ASSIGNEE_DESCRIPTION = "Note that the free version of GitLab allows only one assignee";
private static final String PAID_DESCRIPTION =
"Available only for paid Enterprise version of GitLab";
private static final String ASSIGNEE_DESCRIPTION =
"Note that the free version of GitLab allows only one assignee";

public GetIssueFieldsCommand(ProjectRepository projectRepository) {
super(projectRepository);
}

@Override
protected List<PostFormField> invokeCommand(Integration integration, Map<String, Object> params) {
String issueTypeParam = Optional.ofNullable(params.get(ISSUE_TYPE_PARAM))
.map(it -> (String) it)
String issueTypeParam = Optional.ofNullable(params.get(ISSUE_TYPE_PARAM)).map(it -> (String) it)
.orElseThrow(() -> new ReportPortalException(ErrorType.BAD_REQUEST_ERROR,
"Issue type is not provided"));
"Issue type is not provided"
));
List<PostFormField> result = Lists.newArrayList(
PostFormField.builder().id("title").fieldName("Title").fieldType("string").isRequired(true)
.build(),
PostFormField.builder().id("description").fieldName("Description").fieldType("multilineText")
.build(),
.build(), PostFormField.builder().id("description").fieldName("Description")
.fieldType("multilineText").build(),
PostFormField.builder().id(ISSUE_TYPE).fieldName("Issue type").fieldType("issuetype")
.isRequired(true)
.definedValues(List.of(
new AllowedValue("issue", "issue"),
new AllowedValue("incident", "incident")))
.isRequired(true).definedValues(
List.of(new AllowedValue("issue", "issue"), new AllowedValue("incident", "incident")))
.build(),
PostFormField.builder().id("confidential").fieldName("Confidential").fieldType("string")
.definedValues(List.of(
new AllowedValue("false", "No"),
new AllowedValue("true", "Yes")))
.build(),
.definedValues(
List.of(new AllowedValue("false", "No"), new AllowedValue("true", "Yes"))).build(),
PostFormField.builder().id("assignee_ids").fieldName("Assignee(s)")
.fieldType(MULTI_AUTOCOMPLETE).commandName("searchUsers")
.description(ASSIGNEE_DESCRIPTION).build(),
PostFormField.builder().id("due_date").fieldName("Due Date").fieldType("string").build(),
PostFormField.builder().id(LABELS).fieldName("Labels")
.fieldType(CREATABLE_MULTI_AUTOCOMPLETE)
.commandName("searchLabels").build(),
.fieldType(CREATABLE_MULTI_AUTOCOMPLETE).commandName("searchLabels").build(),
PostFormField.builder().id("milestone_id").fieldName("Milestone").fieldType("autocomplete")
.commandName("searchMilestones").build()
);
Expand Down
Loading
Loading