Skip to content
Merged
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 @@ -20,8 +20,6 @@
import com.epam.ta.reportportal.dao.IntegrationTypeRepository;
import com.epam.ta.reportportal.dao.LaunchRepository;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import jakarta.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.HashMap;
Expand Down Expand Up @@ -55,7 +53,8 @@ public class RobotFrameworkPluginExtension implements ReportPortalExtensionPoint
this::getCommands);
private final String resourcesDir;
private final Supplier<ApplicationListener<PluginEvent>> pluginLoadedListener;
private final RequestEntityConverter requestEntityConverter;
private final Supplier<RequestEntityConverter> requestEntityConverterSupplier = new MemoizingSupplier<>(
this::createRequestEntityConverter);
@Autowired
private IntegrationTypeRepository integrationTypeRepository;
@Autowired
Expand All @@ -68,6 +67,8 @@ public class RobotFrameworkPluginExtension implements ReportPortalExtensionPoint
this::getCommonCommands);
@Autowired
private ApplicationContext applicationContext;
@Autowired
private ObjectMapper objectMapper;

public RobotFrameworkPluginExtension(Map<String, Object> initParams) {
resourcesDir = IntegrationTypeProperties.RESOURCES_DIRECTORY.getValue(initParams)
Expand All @@ -77,11 +78,10 @@ public RobotFrameworkPluginExtension(Map<String, Object> initParams) {
new PluginEventHandlerFactory(resourcesDir, integrationTypeRepository,
integrationRepository)
));
}

ObjectMapper objectMapper = new ObjectMapper();
objectMapper.registerModule(new JavaTimeModule());
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
requestEntityConverter = new RequestEntityConverter(objectMapper);
private RequestEntityConverter createRequestEntityConverter() {
return new RequestEntityConverter(objectMapper);
}

@PostConstruct
Expand Down Expand Up @@ -146,7 +146,7 @@ private Map<String, PluginCommand> getCommands() {

private Map<String, CommonPluginCommand<?>> getCommonCommands() {
HashMap<String, CommonPluginCommand<?>> pluginCommands = new HashMap<>();
var robotImportCommand = new RobotImportCommand(requestEntityConverter,
var robotImportCommand = new RobotImportCommand(requestEntityConverterSupplier.get(),
eventPublisher, launchRepository);
pluginCommands.put(robotImportCommand.getName(), robotImportCommand);
return pluginCommands;
Expand Down
Loading