Skip to content
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
17 changes: 4 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,32 +33,23 @@ repositories {
}
}

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

ext['spring-boot.version'] = "${springBootVersion}"
ext['junit-jupiter.version'] = "${junitVersion}"

dependencies {
if (releaseMode) {
implementation 'com.epam.reportportal:commons-dao'
implementation 'com.epam.reportportal:plugin-api'
annotationProcessor 'com.epam.reportportal:plugin-api'
implementation 'com.epam.reportportal:service-api'
annotationProcessor 'com.epam.reportportal:service-api'
} else {
implementation 'com.github.reportportal:commons-dao:develop-SNAPSHOT'
implementation 'com.github.reportportal:plugin-api:develop-SNAPSHOT'
annotationProcessor 'com.github.reportportal:plugin-api:develop-SNAPSHOT'
implementation 'com.github.reportportal:service-api:3e34a90'
annotationProcessor 'com.github.reportportal:service-api:3e34a90'
}

compileOnly "org.projectlombok:lombok:${lombokVersion}"
annotationProcessor "org.projectlombok:lombok:${lombokVersion}"
testCompileOnly "org.projectlombok:lombok:${lombokVersion}"
testAnnotationProcessor "org.projectlombok:lombok:${lombokVersion}"

implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.2'
testImplementation 'org.mockito:mockito-core:5.14.2'
testImplementation 'org.mockito:mockito-junit-jupiter:5.14.2'
testImplementation "org.junit.jupiter:junit-jupiter"
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version=1.1.0
description=EPAM Report Portal. Slack plugin.
pluginId = slack
lombokVersion=1.18.36
lombokVersion=1.18.42
junitVersion=5.11.0

springBootVersion=3.4.2
springBootVersion=3.4.11
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
* @author Andrei Piankouski
*/
public class SlackPlugin extends Plugin {
/**
* Constructor to be used by plugin manager for plugin instantiation.
* Your plugins have to provide constructor with this exact signature to
* be successfully loaded by manager.
*
* @param wrapper - A wrapper over plugin instance.
*/
public SlackPlugin(PluginWrapper wrapper) {
super(wrapper);
}

/**
* Constructor to be used by plugin manager for plugin instantiation. Your plugins have to provide constructor with
* this exact signature to be successfully loaded by manager.
*
* @param wrapper - A wrapper over plugin instance.
*/
public SlackPlugin(PluginWrapper wrapper) {
super(wrapper);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
import com.epam.reportportal.extension.slack.factory.PropertyCollectorFactory;
import com.epam.reportportal.extension.slack.info.impl.PluginInfoProviderImpl;
import com.epam.reportportal.extension.slack.utils.MemoizingSupplier;
import com.epam.ta.reportportal.dao.IntegrationRepository;
import com.epam.ta.reportportal.dao.IntegrationTypeRepository;
import com.epam.ta.reportportal.dao.LaunchRepository;
import com.epam.ta.reportportal.dao.ProjectRepository;
import com.epam.ta.reportportal.dao.TestItemRepository;
import com.epam.reportportal.infrastructure.persistence.dao.IntegrationRepository;
import com.epam.reportportal.infrastructure.persistence.dao.IntegrationTypeRepository;
import com.epam.reportportal.infrastructure.persistence.dao.LaunchRepository;
import com.epam.reportportal.infrastructure.persistence.dao.ProjectRepository;
import com.epam.reportportal.infrastructure.persistence.dao.TestItemRepository;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

import com.epam.reportportal.extension.slack.collector.PropertyCollector;
import com.epam.reportportal.extension.slack.model.enums.template.DefaultTemplateProperty;
import com.epam.ta.reportportal.entity.ItemAttribute;
import com.epam.ta.reportportal.entity.launch.Launch;
import com.epam.reportportal.infrastructure.persistence.entity.ItemAttribute;
import com.epam.reportportal.infrastructure.persistence.entity.launch.Launch;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;

public class AttributesCollector implements PropertyCollector<Launch, DefaultTemplateProperty> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import com.epam.reportportal.extension.slack.collector.PropertyCollector;
import com.epam.reportportal.extension.slack.model.enums.template.DefaultTemplateProperty;
import com.epam.ta.reportportal.entity.launch.Launch;
import com.epam.reportportal.infrastructure.persistence.entity.launch.Launch;
import com.google.common.collect.ImmutableMap;
import java.util.LinkedHashMap;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
*/
package com.epam.reportportal.extension.slack.collector.laucnh;

import static com.epam.ta.reportportal.entity.enums.StatusEnum.FAILED;
import static com.epam.ta.reportportal.entity.enums.StatusEnum.INTERRUPTED;
import static com.epam.ta.reportportal.entity.enums.StatusEnum.PASSED;
import static com.epam.reportportal.infrastructure.persistence.entity.enums.StatusEnum.FAILED;
import static com.epam.reportportal.infrastructure.persistence.entity.enums.StatusEnum.INTERRUPTED;
import static com.epam.reportportal.infrastructure.persistence.entity.enums.StatusEnum.PASSED;

import com.epam.reportportal.extension.slack.collector.PropertyCollector;
import com.epam.reportportal.extension.slack.model.enums.template.Color;
import com.epam.reportportal.extension.slack.model.template.TextProperty;
import com.epam.ta.reportportal.entity.enums.StatusEnum;
import com.epam.ta.reportportal.entity.launch.Launch;
import com.epam.reportportal.infrastructure.persistence.entity.enums.StatusEnum;
import com.epam.reportportal.infrastructure.persistence.entity.launch.Launch;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

import com.epam.reportportal.extension.slack.collector.PropertyCollector;
import com.epam.reportportal.extension.slack.model.enums.template.StatisticTemplateProperty;
import com.epam.ta.reportportal.entity.launch.Launch;
import com.epam.reportportal.infrastructure.persistence.entity.launch.Launch;
import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections4.CollectionUtils;

public class StatisticsPropertiesCollector implements PropertyCollector<Launch, StatisticTemplateProperty> {

Expand All @@ -22,8 +22,10 @@ public Map<StatisticTemplateProperty, String> collect(Launch launch) {

ofNullable(launch.getStatistics()).filter(CollectionUtils::isNotEmpty)
.ifPresent(statistics -> statistics.stream()
.filter(s -> properties.containsKey(StatisticTemplateProperty.valueOfByName(s.getStatisticsField().getName())))
.forEach(s -> properties.put(StatisticTemplateProperty.valueOfByName(s.getStatisticsField().getName()), String.valueOf(s.getCounter()))));
.filter(
s -> properties.containsKey(StatisticTemplateProperty.valueOfByName(s.getStatisticsField().getName())))
.forEach(s -> properties.put(StatisticTemplateProperty.valueOfByName(s.getStatisticsField().getName()),
String.valueOf(s.getCounter()))));

return properties;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
*/
public interface EventHandler<T> {

void handle(T event);
void handle(T event);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.epam.reportportal.extension.event.PluginEvent;
import com.epam.reportportal.extension.slack.event.handler.EventHandler;
import com.epam.reportportal.extension.slack.info.PluginInfoProvider;
import com.epam.ta.reportportal.dao.IntegrationTypeRepository;
import com.epam.reportportal.infrastructure.persistence.dao.IntegrationTypeRepository;

/**
* @author Andrei Piankouski
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
import com.epam.reportportal.extension.event.LaunchFinishedPluginEvent;
import com.epam.reportportal.extension.slack.event.launch.resolver.AttachmentResolver;
import com.epam.reportportal.extension.slack.event.launch.resolver.SenderCaseMatcher;
import com.epam.reportportal.rules.exception.ErrorType;
import com.epam.reportportal.rules.exception.ReportPortalException;
import com.epam.ta.reportportal.dao.LaunchRepository;
import com.epam.ta.reportportal.dao.ProjectRepository;
import com.epam.ta.reportportal.entity.enums.ProjectAttributeEnum;
import com.epam.ta.reportportal.entity.launch.Launch;
import com.epam.ta.reportportal.entity.project.Project;
import com.epam.ta.reportportal.entity.project.ProjectUtils;
import com.epam.ta.reportportal.entity.project.email.SenderCase;
import com.epam.reportportal.infrastructure.persistence.dao.LaunchRepository;
import com.epam.reportportal.infrastructure.persistence.dao.ProjectRepository;
import com.epam.reportportal.infrastructure.persistence.entity.enums.ProjectAttributeEnum;
import com.epam.reportportal.infrastructure.persistence.entity.launch.Launch;
import com.epam.reportportal.infrastructure.persistence.entity.project.Project;
import com.epam.reportportal.infrastructure.persistence.entity.project.ProjectUtils;
import com.epam.reportportal.infrastructure.persistence.entity.project.email.SenderCase;
import com.epam.reportportal.infrastructure.rules.exception.ErrorType;
import com.epam.reportportal.infrastructure.rules.exception.ReportPortalException;
import java.util.Map;
import java.util.Optional;
import org.apache.commons.lang3.BooleanUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import com.epam.reportportal.extension.slack.model.enums.SlackEventType;
import com.epam.reportportal.extension.slack.model.template.TemplateProperty;
import com.epam.reportportal.extension.slack.model.template.TextProperty;
import com.epam.ta.reportportal.entity.launch.Launch;
import com.epam.reportportal.infrastructure.persistence.entity.launch.Launch;
import com.fasterxml.jackson.databind.JsonNode;
import java.util.LinkedHashMap;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@
import static com.epam.reportportal.extension.slack.model.enums.template.StatisticTemplateProperty.STATISTIC_EXECUTION_TOTAL;

import com.epam.reportportal.extension.slack.utils.NotificationConfigConverter;
import com.epam.ta.reportportal.dao.TestItemRepository;
import com.epam.ta.reportportal.entity.enums.LogicalOperator;
import com.epam.ta.reportportal.entity.enums.SendCase;
import com.epam.ta.reportportal.entity.launch.Launch;
import com.epam.ta.reportportal.entity.project.email.LaunchAttributeRule;
import com.epam.ta.reportportal.entity.project.email.SenderCase;
import com.epam.ta.reportportal.entity.statistics.Statistics;
import com.epam.ta.reportportal.ws.reporting.ItemAttributeResource;
import com.epam.reportportal.infrastructure.persistence.dao.TestItemRepository;
import com.epam.reportportal.infrastructure.persistence.entity.enums.LogicalOperator;
import com.epam.reportportal.infrastructure.persistence.entity.enums.SendCase;
import com.epam.reportportal.infrastructure.persistence.entity.launch.Launch;
import com.epam.reportportal.infrastructure.persistence.entity.project.email.LaunchAttributeRule;
import com.epam.reportportal.infrastructure.persistence.entity.project.email.SenderCase;
import com.epam.reportportal.infrastructure.persistence.entity.statistics.Statistics;
import com.epam.reportportal.reporting.ItemAttributeResource;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections4.CollectionUtils;

/**
* @author <a href="mailto:andrei_piankouski@epam.com">Andrei Piankouski</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.epam.reportportal.extension.slack.event.handler.EventHandler;
import com.epam.reportportal.extension.slack.event.handler.plugin.PluginLoadedEventHandler;
import com.epam.reportportal.extension.slack.info.PluginInfoProvider;
import com.epam.ta.reportportal.dao.IntegrationTypeRepository;
import com.epam.reportportal.infrastructure.persistence.dao.IntegrationTypeRepository;
import java.util.HashMap;
import java.util.Map;

Expand All @@ -19,7 +19,7 @@ public class PluginEventHandlerFactory implements EventHandlerFactory<PluginEven
private final Map<String, EventHandler<PluginEvent>> eventHandlerMapping;

public PluginEventHandlerFactory(IntegrationTypeRepository integrationTypeRepository,
PluginInfoProvider pluginInfoProvider) {
PluginInfoProvider pluginInfoProvider) {
this.eventHandlerMapping = new HashMap<>();
this.eventHandlerMapping.put(LOAD_KEY,
new PluginLoadedEventHandler(integrationTypeRepository, pluginInfoProvider)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ public PluginEventListener(String pluginId, EventHandlerFactory<PluginEvent> plu
@Override
public void onApplicationEvent(PluginEvent event) {
if (supports(event)) {
ofNullable(pluginEventEventHandlerFactory.getEventHandler(event.getType())).ifPresent(pluginEventEventHandler -> pluginEventEventHandler
.handle(event));
ofNullable(pluginEventEventHandlerFactory.getEventHandler(event.getType())).ifPresent(
pluginEventEventHandler -> pluginEventEventHandler
.handle(event));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.epam.reportportal.extension.slack.collector.laucnh.ResultColorCollector;
import com.epam.reportportal.extension.slack.collector.laucnh.StatisticsPropertiesCollector;
import com.epam.reportportal.extension.slack.model.template.TemplateProperty;
import com.epam.ta.reportportal.entity.launch.Launch;
import com.epam.reportportal.infrastructure.persistence.entity.launch.Launch;
import java.util.List;

public class PropertyCollectorFactory {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.epam.reportportal.extension.slack.info;

import com.epam.ta.reportportal.entity.integration.IntegrationType;
import com.epam.reportportal.infrastructure.persistence.entity.integration.IntegrationType;

/**
* @author <a href="mailto:ivan_budayeu@epam.com">Ivan Budayeu</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import static java.util.Optional.ofNullable;

import com.epam.reportportal.extension.slack.info.PluginInfoProvider;
import com.epam.reportportal.rules.exception.ErrorType;
import com.epam.reportportal.rules.exception.ReportPortalException;
import com.epam.ta.reportportal.entity.enums.IntegrationGroupEnum;
import com.epam.ta.reportportal.entity.integration.IntegrationType;
import com.epam.reportportal.infrastructure.persistence.entity.enums.IntegrationGroupEnum;
import com.epam.reportportal.infrastructure.persistence.entity.integration.IntegrationType;
import com.epam.reportportal.infrastructure.rules.exception.ErrorType;
import com.epam.reportportal.infrastructure.rules.exception.ReportPortalException;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
Expand Down Expand Up @@ -99,10 +99,11 @@ private void addFieldsInfo(IntegrationType integrationType) {
ruleField.put("label", "Webhook URL");
ruleField.put("type", "text");
ruleField.put("placeholder", "https://...");
ruleField.put("required", true);
ruleField.put("required", true);
Map<String, Object> validation = new HashMap<>();
validation.put("type", "url");
validation.put("regex", "^https:\\/\\/hooks\\.slack\\.com\\/services\\/T[A-Z0-9]{8,12}\\/B[A-Z0-9]{8,12}\\/[a-zA-Z0-9]{24}$");
validation.put("regex",
"^https:\\/\\/hooks\\.slack\\.com\\/services\\/T[A-Z0-9]{8,12}\\/B[A-Z0-9]{8,12}\\/[a-zA-Z0-9]{24}$");
validation.put("errorMessage", "Field is Required. Please provide valid URL");
ruleField.put("validation", validation);
details.put(FIELDS_KEY, List.of(ruleField));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static java.util.Optional.ofNullable;

import com.epam.ta.reportportal.entity.integration.Integration;
import com.epam.reportportal.infrastructure.persistence.entity.integration.Integration;
import java.util.Optional;

public enum SlackEventType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static java.util.Optional.ofNullable;

import com.epam.ta.reportportal.entity.integration.Integration;
import com.epam.reportportal.infrastructure.persistence.entity.integration.Integration;
import java.util.Optional;

public enum SlackIntegrationProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public enum StatisticTemplateProperty implements TemplateProperty {
STATISTIC_EXECUTION_FAILED("statistics$executions$failed"),
STATISTIC_EXECUTION_SKIPPED("statistics$executions$skipped"),
STATISTIC_DEFECTS_PRODUCT_BUG("statistics$defects$product_bug$total"),
STATISTIC_DEFECTS_SYSTEM_ISSUE ("statistics$defects$system_issue$total"),
STATISTIC_DEFECTS_SYSTEM_ISSUE("statistics$defects$system_issue$total"),
STATISTIC_DEFECTS_AUTOMATION_BUG("statistics$defects$automation_bug$total"),
STATISTIC_DEFECTS_NO_DEFECT("statistics$defects$no_defect$total"),
STATISTIC_DEFECTS_TO_INVESTIGATE("statistics$defects$to_investigate$total"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,29 @@
*/
public class MemoizingSupplier<T> implements Supplier<T> {

private final Supplier<T> delegate;
private final Supplier<T> delegate;

private AtomicBoolean initialized = new AtomicBoolean(false);
private AtomicBoolean initialized = new AtomicBoolean(false);

private T value;
private T value;

public MemoizingSupplier(Supplier<T> delegate) {
this.delegate = checkNotNull(delegate);
}
public MemoizingSupplier(Supplier<T> delegate) {
this.delegate = checkNotNull(delegate);
}

@Override
public T get() {
@Override
public T get() {
if (!initialized.get()) {
synchronized (this) {
if (!initialized.get()) {
synchronized (this) {
if (!initialized.get()) {
T t = delegate.get();
value = t;
initialized.set(true);
return t;
}
}
T t = delegate.get();
value = t;
initialized.set(true);
return t;
}
return value;
}
}
return value;
}

}
Loading