[RM] Feature Pack services settings which used in matrix into report archive.
MODIFY
BackEnd/Core/sailfish-core/src/main/java/com/exactpro/sf/actions/ServiceActions.java
BackEnd/Core/sailfish-core/src/main/java/com/exactpro/sf/actions/ServiceActions.java
@@ -26,6 +26,7 @@ import java.util.Set;
import org.apache.commons.beanutils.BeanMap;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.beanutils.ConvertUtilsBean;
+import org.apache.commons.beanutils.Converter;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.text.WordUtils;
@@ -57,10 +58,27 @@ public class ServiceActions extends AbstractCaller {
//TODO: change to service_uri someday
public final String SERVICE_TYPE = "service_type";
+ private static class SailfishURIConverter implements Converter {
+ @Override
+ public <T> T convert(Class<T> type, Object value) {
+ if (value instanceof String) {
+ try {
+ return (T) SailfishURI.parse((String) value);
+ } catch (SailfishURIException e) {
+ throw new EPSCommonException("Wrong value [" + value + "] for parse to SailfishURI", e);
+ }
+ }
+
+ throw new EPSCommonException("Wrong value [" + value + "] for parse to SailfishURI");
+ }
+ }
+
private final ThreadLocal<ConvertUtilsBean> converter = new ThreadLocal<ConvertUtilsBean>() {
@Override
protected ConvertUtilsBean initialValue() {
- return new ConvertUtilsBean();
+ ConvertUtilsBean convertUtilsBean = new ConvertUtilsBean();
+ convertUtilsBean.register(new SailfishURIConverter(), SailfishURI.class);
+ return convertUtilsBean;
}
};
@@ -146,12 +164,14 @@ public class ServiceActions extends AbstractCaller {
try {
IServiceSettings serviceSettings = serviceManager.getServiceSettings(serviceName);
BeanMap beanMap = new BeanMap(serviceSettings);
+ Set<String> editedProperty = new HashSet<>();
Set<String> incorrectProperty = new HashSet<>();
for (Entry<?, ?> entry : message.entrySet()) {
String property = convertProperty(entry.getKey().toString());
if (beanMap.containsKey(property)){
try {
BeanUtils.setProperty(serviceSettings, property, converter.get().convert((Object)unwrapFilters(entry.getValue()), beanMap.getType(property)));
+ editedProperty.add(property);
} catch (IllegalAccessException e) {
throw new EPSCommonException(e);
} catch (InvocationTargetException e) {
@@ -169,6 +189,8 @@ public class ServiceActions extends AbstractCaller {
serviceManager.updateService(serviceName, serviceSettings, null);
serviceManager.initService(serviceName, null).get();
+
+ actionContext.getReport().createChangingSettingsFile(serviceName.toString(), serviceSettings, editedProperty);
} catch (EPSCommonException e) {
throw e;
} catch (Exception e){

MODIFY
BackEnd/Core/sailfish-core/src/main/java/com/exactpro/sf/configuration/workspace/DefaultWorkspaceDispatcher.java
BackEnd/Core/sailfish-core/src/main/java/com/exactpro/sf/configuration/workspace/DefaultWorkspaceDispatcher.java
@@ -23,6 +23,7 @@ import java.nio.file.FileVisitOption;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.HashSet;
@@ -43,6 +44,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.exactpro.sf.common.util.Pair;
+import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
public class DefaultWorkspaceDispatcher implements IWorkspaceDispatcher {
@@ -185,6 +187,36 @@ public class DefaultWorkspaceDispatcher implements IWorkspaceDispatcher {
}
}
+ public File getOrCreateFolder(FolderType folderType, String... folderName) throws WorkspaceStructureException, WorkspaceSecurityException, FileNotFoundException {
+ checkFolderTypeAndFileName(folderType, folderName);
+
+ try {
+ workspacesLock.readLock().lock();
+ File targetFolder = new File(Iterables.getLast(workspaces).get(folderType), toPathString(folderName));
+
+ if (targetFolder.exists()) {
+ if (targetFolder.isDirectory()) {
+ return targetFolder;
+ } else {
+ throw new FileNotFoundException(MessageFormat.format("Path '{'{0}'}' is not folder", targetFolder.toPath()));
+ }
+ }
+
+ WorkspaceLayer workspaceLayer = workspaces.get(workspaces.size() - 1);
+ if (workspaceLayer.layout.isEmbedded()) {
+ throw new WorkspaceLayerException(MessageFormat.format("Folder '{'{0}'}'/{1} can'''t be created, the last layer is embedded", folderType, toPathString(folderName)));
+ }
+
+ if (targetFolder.mkdirs()) {
+ return targetFolder;
+ }
+
+ throw new WorkspaceLayerException(MessageFormat.format("Folder '{'{0}'}'/{1} can'''t be created", folderType, toPathString(folderName)));
+ } finally {
+ workspacesLock.readLock().unlock();
+ }
+ }
+
@Override
public File createFolder(FolderType folderType, String... folderName) throws WorkspaceStructureException {
checkFolderTypeAndFileName(folderType, folderName);

MODIFY
BackEnd/Core/sailfish-core/src/main/java/com/exactpro/sf/configuration/workspace/IWorkspaceDispatcher.java
BackEnd/Core/sailfish-core/src/main/java/com/exactpro/sf/configuration/workspace/IWorkspaceDispatcher.java
@@ -19,9 +19,7 @@ import java.io.File;
import java.io.FileFilter;
import java.io.FileNotFoundException;
import java.io.IOException;
-import java.util.Objects;
import java.util.Set;
-import java.util.stream.Collectors;
/**
* Implements UnionMount[1]-like mechanism for SF
@@ -89,6 +87,8 @@ public interface IWorkspaceDispatcher {
*/
File getOrCreateFile(FolderType folderType, String... fileName) throws WorkspaceStructureException, WorkspaceSecurityException, FileNotFoundException;
+ File getOrCreateFolder(FolderType folderType, String... folderName) throws WorkspaceStructureException, WorkspaceSecurityException, FileNotFoundException;
+
boolean exists(FolderType folderType, String... fileName) throws WorkspaceSecurityException;
void removeFile(FolderType folderType, String... fileName) throws IOException, WorkspaceSecurityException;

MODIFY
BackEnd/Core/sailfish-core/src/main/java/com/exactpro/sf/scriptrunner/AbstractScriptRunner.java
BackEnd/Core/sailfish-core/src/main/java/com/exactpro/sf/scriptrunner/AbstractScriptRunner.java
@@ -72,6 +72,8 @@ import com.exactpro.sf.scriptrunner.TestScriptDescription.ScriptState;
import com.exactpro.sf.scriptrunner.TestScriptDescription.ScriptStatus;
import com.exactpro.sf.scriptrunner.actionmanager.IActionManager;
import com.exactpro.sf.scriptrunner.impl.BroadcastScriptReport;
+import com.exactpro.sf.scriptrunner.impl.ReportDictionaries;
+import com.exactpro.sf.scriptrunner.impl.ReportServices;
import com.exactpro.sf.scriptrunner.impl.ScriptReportWithLogs;
import com.exactpro.sf.scriptrunner.impl.StatisticScriptReport;
import com.exactpro.sf.scriptrunner.impl.htmlreport.HtmlReport;
@@ -263,6 +265,10 @@ public abstract class AbstractScriptRunner implements IDisposable {
aggregateReportListeners.add(new JsonReport(reportFolder, workspaceDispatcher, scriptDescription, dictionaryManager));
// html report
aggregateReportListeners.add(new HtmlReport(sfContext.getSfInstanceInfo(), reportFolder, workspaceDispatcher, dictionaryManager, environmentManager.getEnvironmentSettings().getRelevantMessagesSortingMode()));
+ //dictionary report
+ aggregateReportListeners.add(new ReportDictionaries(reportFolder));
+ //services report
+ aggregateReportListeners.add(new ReportServices(staticServiceManager, reportFolder));
BroadcastScriptReport aggregateReport = new BroadcastScriptReport(aggregateReportListeners);
@@ -272,11 +278,8 @@ public abstract class AbstractScriptRunner implements IDisposable {
reportListeners.addAll(userListeners);
}
- ReportOutputFormat reportOutputFormat = environmentManager.getEnvironmentSettings().getReportOutputFormat();
- if(reportOutputFormat.isEnableZip()) {
// NOTE: ZipReport must be latest
- reportListeners.add(new ZipReport(reportFolder, workspaceDispatcher, scriptDescription, reportOutputFormat));
- }
+ reportListeners.add(new ZipReport(reportFolder, workspaceDispatcher, scriptDescription, ReportOutputFormat.ZIP));
BroadcastScriptReport report = new BroadcastScriptReport(reportListeners);

MODIFY
BackEnd/Core/sailfish-core/src/main/java/com/exactpro/sf/scriptrunner/ZipReport.java
BackEnd/Core/sailfish-core/src/main/java/com/exactpro/sf/scriptrunner/ZipReport.java
@@ -169,10 +169,10 @@ public class ZipReport implements IScriptReport {
private void zipFilesInFolder(File reportFolder, String zipName, IWorkspaceDispatcher dispatcher) throws IOException {
- File report = dispatcher.createFile(FolderType.REPORT, true, zipName, zipName + ZIP);
+ File report = dispatcher.createFile(FolderType.REPORT, true, zipName + ZIP);
try (ZipOutputStream zip = new ZipOutputStream(new FileOutputStream(report))) {
- zip.setLevel(Deflater.DEFAULT_COMPRESSION);
+ zip.setLevel(Deflater.BEST_COMPRESSION);
zipFolder(dispatcher, zip, zipName, null);
}
@@ -222,5 +222,6 @@ public class ZipReport implements IScriptReport {
dispatcher.removeFile(FolderType.REPORT, reportFolderName, file);
}
}
+ dispatcher.removeFolder(FolderType.REPORT, reportFolderName);
}
}

MODIFY
BackEnd/Core/sailfish-core/src/main/java/com/exactpro/sf/scriptrunner/actionmanager/actioncontext/IActionReport.java
BackEnd/Core/sailfish-core/src/main/java/com/exactpro/sf/scriptrunner/actionmanager/actioncontext/IActionReport.java
******************************************************************************/
package com.exactpro.sf.scriptrunner.actionmanager.actioncontext;
+import com.exactpro.sf.services.IServiceSettings;
import java.io.File;
import com.exactpro.sf.common.messages.IMessage;
@@ -27,6 +28,10 @@ import com.exactpro.sf.scriptrunner.StatusType;
import com.exactpro.sf.scriptrunner.impl.ReportTable;
import com.exactpro.sf.scriptrunner.reportbuilder.textformatter.TextColor;
import com.exactpro.sf.scriptrunner.reportbuilder.textformatter.TextStyle;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Set;
public interface IActionReport extends AutoCloseable {
IActionReport createEmbeddedReport(String name, String description);
@@ -52,6 +57,9 @@ public interface IActionReport extends AutoCloseable {
void createParametersTable(IMessage message);
+ void createChangingSettingsFile(String serviceName, IServiceSettings serviceSettings, Set<String> editedProperties)
+ throws IOException, IllegalAccessException, NoSuchMethodException, InvocationTargetException;
+
File createFile(StatusType status, String... pathElements)
throws WorkspaceStructureException, WorkspaceSecurityException;

MODIFY
BackEnd/Core/sailfish-core/src/main/java/com/exactpro/sf/scriptrunner/actionmanager/actioncontext/impl/ActionReport.java
BackEnd/Core/sailfish-core/src/main/java/com/exactpro/sf/scriptrunner/actionmanager/actioncontext/impl/ActionReport.java
******************************************************************************/
package com.exactpro.sf.scriptrunner.actionmanager.actioncontext.impl;
+import com.exactpro.sf.services.IServiceSettings;
import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.time.format.DateTimeFormatter;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
+import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.ObjectUtils;
@@ -40,8 +46,13 @@ import com.exactpro.sf.scriptrunner.actionmanager.actioncontext.IActionReport;
import com.exactpro.sf.scriptrunner.impl.ReportTable;
import com.exactpro.sf.scriptrunner.reportbuilder.textformatter.TextColor;
import com.exactpro.sf.scriptrunner.reportbuilder.textformatter.TextStyle;
+import com.exactpro.sf.util.DateTimeUtility;
public class ActionReport implements IActionReport {
+
+ private static final DateTimeFormatter FORMATTER = DateTimeUtility.createFormatter("dd.MM.yyyy HH:mm:ss:SSS");
+ private static final String changingSettingFolder = "changingSetting";
+
private final IScriptReport report;
private final String reportFolder;
private final boolean updateStatus;
@@ -133,6 +144,23 @@ public class ActionReport implements IActionReport {
return workspaceDispatcher.createFile(FolderType.REPORT, false, ArrayUtils.insert(0, pathElements, reportFolder));
}
+ @Override
+ public void createChangingSettingsFile(String serviceName, IServiceSettings serviceSettings, Set<String> editedProperties) throws IOException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
+ File changingSettingsFile = workspaceDispatcher.getOrCreateFile(FolderType.REPORT, reportFolder, changingSettingFolder, serviceName);
+
+ try (FileWriter fileWriter = new FileWriter(changingSettingsFile, true)) {
+ fileWriter.write(String.format("Date and time: {%s}\nProperties:\n", FORMATTER.format(DateTimeUtility.nowLocalDateTime())));
+
+ for (String propertyName : editedProperties) {
+
+ Object value = BeanUtils.getProperty(serviceSettings, propertyName);
+
+ fileWriter.write(String.format("\'%s\'={%s}\n", propertyName, value == null ? "NULL" : value.toString()));
+ }
+ fileWriter.write('\n');
+ }
+ }
+
@Override
public void close() {
if(child != null) {

ADD
BackEnd/Core/sailfish-core/src/main/java/com/exactpro/sf/scriptrunner/impl/ReportDictionaries.java
+/******************************************************************************
+ * Copyright 2009-2018 Exactpro (Exactpro Systems Limited)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+package com.exactpro.sf.scriptrunner.impl;
+
+import com.exactpro.sf.aml.AMLBlockType;
+import com.exactpro.sf.aml.generator.AggregateAlert;
+import com.exactpro.sf.aml.script.CheckPoint;
+import com.exactpro.sf.common.messages.IMessage;
+import com.exactpro.sf.common.services.ServiceName;
+import com.exactpro.sf.common.util.EPSCommonException;
+import com.exactpro.sf.comparison.ComparisonResult;
+import com.exactpro.sf.configuration.suri.SailfishURI;
+import com.exactpro.sf.configuration.workspace.FolderType;
+import com.exactpro.sf.configuration.workspace.WorkspaceStructureException;
+import com.exactpro.sf.scriptrunner.IConnectionManager;
+import com.exactpro.sf.scriptrunner.IReportStats;
+import com.exactpro.sf.scriptrunner.IScriptReport;
+import com.exactpro.sf.scriptrunner.LoggerRow;
+import com.exactpro.sf.scriptrunner.MessageLevel;
+import com.exactpro.sf.scriptrunner.OutcomeCollector;
+import com.exactpro.sf.scriptrunner.ScriptContext;
+import com.exactpro.sf.scriptrunner.StatusDescription;
+import com.exactpro.sf.services.IServiceSettings;
+import com.exactpro.sf.services.ServiceDescription;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.nio.file.Paths;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
+
+public class ReportDictionaries implements IScriptReport {
+
+ private final String dictionariesFolder;
+
+ public ReportDictionaries(String reportFolder){
+ dictionariesFolder = Paths.get(reportFolder, "dictionaries").toString();
+ }
+
+ @Override
+ public void createReport(ScriptContext scriptContext, String name, String description, long scriptRunId, String environmentName, String userName) {
+
+ File dictionariesFolderFile;
+ try {
+ dictionariesFolderFile = scriptContext.getWorkspaceDispatcher().createFolder(FolderType.REPORT, dictionariesFolder);
+ } catch (WorkspaceStructureException e) {
+ throw new EPSCommonException("Can`t create dictionaries folder", e);
+ }
+
+ Set<SailfishURI> dictionariesNames = new HashSet<>();
+ List<String> matrixServicesName = scriptContext.getServiceList();
+ IConnectionManager connectionManager = scriptContext.getEnvironmentManager().getConnectionManager();
+
+ for (String serviceName : matrixServicesName) {
+ ServiceDescription serviceDescription = connectionManager.getServiceDescription(ServiceName.parse(serviceName));
+
+ IServiceSettings serviceSettings = serviceDescription.getSettings();
+ SailfishURI dictionaryInfo = serviceSettings.getDictionaryName();
+ if (dictionaryInfo == null || !dictionariesNames.add(dictionaryInfo)) {
+ continue;
+ }
+
+ String dictionaryPath = scriptContext.getDictionaryManager().getDictionaryLocations().get(dictionaryInfo);
+
+ if (dictionaryPath == null) {
+ continue;
+ }
+
+ File srcDictionaryFile;
+ try {
+ srcDictionaryFile = scriptContext.getWorkspaceDispatcher().getFile(FolderType.ROOT, dictionaryPath);
+ } catch (FileNotFoundException e) {
+ throw new EPSCommonException("Can`t get dictionary file", e);
+ }
+
+ File targetDictionaryDirectory = dictionariesFolderFile;
+ if (!StringUtils.isEmpty(dictionaryInfo.getPluginAlias())) {
+ try {
+ targetDictionaryDirectory = scriptContext.getWorkspaceDispatcher().getOrCreateFolder(FolderType.REPORT, dictionariesFolder, dictionaryInfo.getPluginAlias());
+ } catch (WorkspaceStructureException | FileNotFoundException e) {
+ throw new EPSCommonException("Can`t create dictionaries plugin folder", e);
+ }
+ }
+
+ try {
+ FileUtils.copyFileToDirectory(srcDictionaryFile, targetDictionaryDirectory);
+ } catch (IOException e) {
+ throw new EPSCommonException("Can`t copy dictionary file to target folder", e);
+ }
+ }
+ }
+
+ @Override
+ public void addAlerts(Collection<AggregateAlert> aggregatedAlerts) {
+ }
+
+ @Override
+ public void closeReport() {
+ }
+
+ @Override
+ public void flush() {
+ }
+
+ @Override
+ public void createTestCase(String reference, String description, int order, int matrixOrder, String tcId, int tcHash, AMLBlockType type, Set<String> tags) {
+ }
+
+ @Override
+ public void closeTestCase(StatusDescription status) {
+ }
+
+ @Override
+ public boolean isActionCreated() throws UnsupportedOperationException {
+ return false;
+ }
+
+ @Override
+ public void createAction(String id, String serviceName, String name, String messageType, String description, IMessage parameters, CheckPoint checkPoint, String tag, int hash, List<String> verificationsOrder, String outcome) {
+ }
+
+ @Override
+ public void closeAction(StatusDescription status, Object actionResult) {
+ }
+
+ @Override
+ public void openGroup(String name, String description) {
+ }
+
+ @Override
+ public void closeGroup(StatusDescription status) {
+ }
+
+ @Override
+ public void createVerification(String name, String description, StatusDescription status, ComparisonResult result) {
+ }
+
+ @Override
+ public void createMessage(MessageLevel level, String... messages) {
+ }
+
+ @Override
+ public void createMessage(MessageLevel level, Throwable e, String... messages) {
+ }
+
+ @Override
+ public void createException(Throwable cause) {
+ }
+
+ @Override
+ public void createTable(ReportTable table) {
+ }
+
+ @Override
+ public void createLogTable(List<String> header, List<LoggerRow> rows) {
+ }
+
+ @Override
+ public void setOutcomes(OutcomeCollector outcomes) {
+ }
+
+ @Override
+ public void createLinkToReport(String linkToReport) {
+ }
+
+ @Override
+ public IReportStats getReportStats() {
+ return null;
+ }
+}

ADD
BackEnd/Core/sailfish-core/src/main/java/com/exactpro/sf/scriptrunner/impl/ReportServices.java
+/******************************************************************************
+ * Copyright 2009-2018 Exactpro (Exactpro Systems Limited)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+package com.exactpro.sf.scriptrunner.impl;
+
+import com.exactpro.sf.aml.AMLBlockType;
+import com.exactpro.sf.aml.generator.AggregateAlert;
+import com.exactpro.sf.aml.script.CheckPoint;
+import com.exactpro.sf.common.messages.IMessage;
+import com.exactpro.sf.common.util.EPSCommonException;
+import com.exactpro.sf.comparison.ComparisonResult;
+import com.exactpro.sf.configuration.workspace.FolderType;
+import com.exactpro.sf.configuration.workspace.WorkspaceStructureException;
+import com.exactpro.sf.scriptrunner.IReportStats;
+import com.exactpro.sf.scriptrunner.IScriptReport;
+import com.exactpro.sf.scriptrunner.LoggerRow;
+import com.exactpro.sf.scriptrunner.MessageLevel;
+import com.exactpro.sf.scriptrunner.OutcomeCollector;
+import com.exactpro.sf.scriptrunner.ScriptContext;
+import com.exactpro.sf.scriptrunner.StatusDescription;
+import com.exactpro.sf.scriptrunner.services.IStaticServiceManager;
+import com.exactpro.sf.services.ServiceMarshalManager;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+public class ReportServices implements IScriptReport {
+
+ private final IStaticServiceManager staticServiceManager;
+ private final String reportFolder;
+
+ public ReportServices(IStaticServiceManager staticServiceManager, String reportFolder) {
+ this.staticServiceManager = staticServiceManager;
+ this.reportFolder = reportFolder;
+ }
+
+ @Override
+ public void createReport(ScriptContext scriptContext, String name, String description, long scriptRunId, String environmentName, String userName) {
+
+ // Code for export service coped from ServiceMarshalManager.exportService
+ // Added filter by environment name
+
+ List<String> matrixServicesNames = scriptContext.getServiceList();
+
+ try {
+ new ServiceMarshalManager(staticServiceManager, scriptContext.getDictionaryManager()).saveServices(
+ scriptContext
+ .getEnvironmentManager()
+ .getServiceStorage()
+ .getServiceDescriptions()
+ .stream()
+ .filter(desc -> matrixServicesNames.contains(desc.getServiceName().toString()))
+ .collect(Collectors.toList()),
+ scriptContext
+ .getWorkspaceDispatcher().
+ createFolder(FolderType.REPORT, reportFolder, "services").toPath());
+ } catch (WorkspaceStructureException e) {
+ throw new EPSCommonException("Can`t create scripts folder", e);
+ }
+ }
+
+ @Override
+ public void addAlerts(Collection<AggregateAlert> aggregatedAlerts) {
+ }
+
+ @Override
+ public void closeReport() {
+ }
+
+ @Override
+ public void flush() {
+ }
+
+ @Override
+ public void createTestCase(String reference, String description, int order, int matrixOrder, String tcId, int tcHash, AMLBlockType type, Set<String> tags) {
+ }
+
+ @Override
+ public void closeTestCase(StatusDescription status) {
+ }
+
+ @Override
+ public boolean isActionCreated() throws UnsupportedOperationException {
+ return false;
+ }
+
+ @Override
+ public void createAction(String id, String serviceName, String name, String messageType, String description, IMessage parameters, CheckPoint checkPoint, String tag, int hash, List<String> verificationsOrder, String outcome) {
+ }
+
+ @Override
+ public void closeAction(StatusDescription status, Object actionResult) {
+ }
+
+ @Override
+ public void openGroup(String name, String description) {
+ }
+
+ @Override
+ public void closeGroup(StatusDescription status) {
+ }
+
+ @Override
+ public void createVerification(String name, String description, StatusDescription status, ComparisonResult result) {
+ }
+
+ @Override
+ public void createMessage(MessageLevel level, String... messages) {
+ }
+
+ @Override
+ public void createMessage(MessageLevel level, Throwable e, String... messages) {
+ }
+
+ @Override
+ public void createException(Throwable cause) {
+ }
+
+ @Override
+ public void createTable(ReportTable table) {
+ }
+
+ @Override
+ public void createLogTable(List<String> header, List<LoggerRow> rows) {
+ }
+
+ @Override
+ public void setOutcomes(OutcomeCollector outcomes) {
+ }
+
+ @Override
+ public void createLinkToReport(String linkToReport) {
+ }
+
+ @Override
+ public IReportStats getReportStats() {
+ return null;
+ }
+}

MODIFY
BackEnd/Core/sailfish-core/src/main/java/com/exactpro/sf/services/ServiceMarshalManager.java
BackEnd/Core/sailfish-core/src/main/java/com/exactpro/sf/services/ServiceMarshalManager.java
@@ -21,6 +21,7 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.nio.file.Path;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -59,6 +60,7 @@ import com.exactpro.sf.storage.util.ServiceStorageHelper;
public class ServiceMarshalManager {
private static final Logger logger = LoggerFactory.getLogger(ServiceMarshalManager.class);
+ private static final String servicesFileExpression = ".xml";
private final DocumentBuilder domBuilder;
private final XPathExpression typeExpression;
@@ -77,6 +79,26 @@ public class ServiceMarshalManager {
}
}
+ public void saveServices(List<ServiceDescription> descriptions, Path folderPath) {
+ logger.debug("saveServices: begin");
+
+ for (ServiceDescription descr : descriptions) {
+ try {
+ Marshaller m = createMarshaller(ServiceDescription.class, DisabledServiceSettings.class, getServiceSettingsClass(descr.getType()));
+ File servicesFile = folderPath.resolve(descr.getName() + servicesFileExpression).toFile();
+ if (servicesFile.createNewFile()) {
+ m.marshal(descr, servicesFile);
+ } else {
+ logger.error("Could not create file {}", servicesFile.toPath());
+ }
+ } catch (JAXBException | IOException | SailfishURIException | ClassNotFoundException e) {
+ logger.error("Could not marshal service description {}", descr.getName(), e);
+ }
+ }
+
+ logger.debug("saveServices: end");
+ }
+
public Map<String, File> exportServices(List<ServiceDescription> descriptions) {
logger.info("exportServices: begin");

MODIFY
BackEnd/Core/sailfish-core/src/main/java/com/exactpro/sf/storage/impl/DefaultTestScriptStorage.java
BackEnd/Core/sailfish-core/src/main/java/com/exactpro/sf/storage/impl/DefaultTestScriptStorage.java
@@ -271,7 +271,7 @@ public class DefaultTestScriptStorage implements ITestScriptStorage {
try (ZipFile zipFile = new ZipFile(reportFile)) {
ZipEntry zipJson = zipFile.getEntry(FilenameUtils.removeExtension(reportFile.getName()) + "/" + ROOT_JSON_REPORT_FILE);
try (InputStream stream = zipFile.getInputStream(zipJson)) {
- return convertToTestScriptDescription(relativeReportPath.getParent().toString(), jsonObjectMapper.readValue(stream, ReportRoot.class));
+ return convertToTestScriptDescription(relativeReportPath.toString(), jsonObjectMapper.readValue(stream, ReportRoot.class));
}
}
}

[RM] Feature #59800. Pack services settings which used in matrix into report archive.

Change-Id: I6169a7ad141c478f8f13c83490103f7cbd704252