From 7f8841288ffa6eafa25ae94d4f56d6fa2c71ef70 Mon Sep 17 00:00:00 2001 From: Alexey Sosnoviy Date: Wed, 1 Sep 2021 11:13:44 +0300 Subject: [PATCH 01/17] DebugTargetType --- build.gradle | 10 +- .../CommandLineOptions/DebuggerOptions.java | 3 +- src/main/java/com/clouds42/DebugClient.java | 11 ++- .../java/com/clouds42/DebugTargetType.java | 92 +++++++++++++++++++ 4 files changed, 109 insertions(+), 7 deletions(-) create mode 100644 src/main/java/com/clouds42/DebugTargetType.java diff --git a/build.gradle b/build.gradle index d64b253..8a8b83d 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,7 @@ repositories { configurations { - providedCompile + providedRuntime } dependencies { @@ -77,7 +77,7 @@ dependencies { exclude group: "org.glassfish", module: "javax.json" } - providedCompile fileTree(edtLocation) { include 'com._1c.g5.v8.dt.debug.*.jar' } + providedRuntime fileTree(edtLocation) { include 'com._1c.g5.v8.dt.debug.*.jar' } testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.2' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.6.2' @@ -88,18 +88,18 @@ dependencies { } tasks.withType(JavaCompile) { - sourceSets.main.compileClasspath += configurations.providedCompile + sourceSets.main.compileClasspath += configurations.providedRuntime options.compilerArgs += ["-Aproject=${project.group}/${project.name}"] options.encoding = 'UTF-8' } run { - classpath += configurations.providedCompile + classpath += configurations.providedRuntime } test { finalizedBy jacocoTestReport - classpath += configurations.providedCompile + classpath += configurations.providedRuntime useJUnitPlatform() testLogging.showStandardStreams = true } diff --git a/src/main/java/com/clouds42/CommandLineOptions/DebuggerOptions.java b/src/main/java/com/clouds42/CommandLineOptions/DebuggerOptions.java index d39c33b..2a54231 100644 --- a/src/main/java/com/clouds42/CommandLineOptions/DebuggerOptions.java +++ b/src/main/java/com/clouds42/CommandLineOptions/DebuggerOptions.java @@ -21,7 +21,8 @@ */ package com.clouds42.CommandLineOptions; -import com._1c.g5.v8.dt.debug.model.base.data.DebugTargetType; + +import com.clouds42.DebugTargetType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import picocli.CommandLine.Option; diff --git a/src/main/java/com/clouds42/DebugClient.java b/src/main/java/com/clouds42/DebugClient.java index 42137fc..2912ac2 100644 --- a/src/main/java/com/clouds42/DebugClient.java +++ b/src/main/java/com/clouds42/DebugClient.java @@ -332,13 +332,22 @@ public List getDebugAreas() throws RuntimeDebugClientException { public void setAutoconnectDebugTargets(List debugAreaNames, List debugTargets) throws RuntimeDebugClientException { RDBGSetAutoAttachSettingsRequest requestContent = ResponseFactory.eINSTANCE.createRDBGSetAutoAttachSettingsRequest(); DebugAutoAttachSettings settings = AttachFactory.eINSTANCE.createDebugAutoAttachSettings(); - settings.getTargetType().addAll(debugTargets); + + List v8debugTypes = debugTargets.stream() + .map(type -> castByName(type, com._1c.g5.v8.dt.debug.model.base.data.DebugTargetType.class)) + .collect(Collectors.toList()); + + settings.getTargetType().addAll(v8debugTypes); settings.getAreaName().addAll(debugAreaNames); requestContent.setAutoAttachSettings(settings); Request request = this.buildRequest(HttpMethod.POST, this.debugComponentUrl).param("cmd", "setAutoAttachSettings"); this.performRuntimeHttpRequest(request, this.initRequest(requestContent)); } + public > F castByName(final Enum e, final Class fClass) { + return F.valueOf(fClass, e.name()); + } + public void toggleProfiling(UUID uuid) throws RuntimeDebugClientException { RDBGSetMeasureModeRequest requestContent = ResponseFactory.eINSTANCE.createRDBGSetMeasureModeRequest(); if (uuid != null) { diff --git a/src/main/java/com/clouds42/DebugTargetType.java b/src/main/java/com/clouds42/DebugTargetType.java new file mode 100644 index 0000000..bdb7c41 --- /dev/null +++ b/src/main/java/com/clouds42/DebugTargetType.java @@ -0,0 +1,92 @@ +/* + * This file is a part of Coverage41C. + * + * Copyright (c) 2020-2021 + * Kosolapov Stanislav aka proDOOMman and contributors + * + * SPDX-License-Identifier: LGPL-3.0-or-later + * + * Coverage41C is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3.0 of the License, or (at your option) any later version. + * + * Coverage41C is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Coverage41C. + */ +package com.clouds42; + +import org.eclipse.emf.common.util.Enumerator; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public enum DebugTargetType implements Enumerator { + UNKNOWN(0, "Unknown", "Unknown"), + CLIENT(1, "Client", "Client"), + MANAGED_CLIENT(2, "ManagedClient", "ManagedClient"), + WEB_CLIENT(3, "WEBClient", "WEBClient"), + COM_CONNECTOR(4, "COMConnector", "COMConnector"), + SERVER(5, "Server", "Server"), + SERVER_EMULATION(6, "ServerEmulation", "ServerEmulation"), + WEB_SERVICE(7, "WEBService", "WEBService"), + HTTP_SERVICE(8, "HTTPService", "HTTPService"), + ODATA(9, "OData", "OData"), + JOB(10, "JOB", "JOB"), + JOB_FILE_MODE(11, "JobFileMode", "JobFileMode"), + MOBILE_CLIENT(12, "MobileClient", "MobileClient"), + MOBILE_SERVER(13, "MobileServer", "MobileServer"), + MOBILE_JOB_FILE_MODE(14, "MobileJobFileMode", "MobileJobFileMode"), + MOBILE_MANAGED_CLIENT(15, "MobileManagedClient", "MobileManagedClient"); + + public static final int UNKNOWN_VALUE = 0; + public static final int CLIENT_VALUE = 1; + public static final int MANAGED_CLIENT_VALUE = 2; + public static final int WEB_CLIENT_VALUE = 3; + public static final int COM_CONNECTOR_VALUE = 4; + public static final int SERVER_VALUE = 5; + public static final int SERVER_EMULATION_VALUE = 6; + public static final int WEB_SERVICE_VALUE = 7; + public static final int HTTP_SERVICE_VALUE = 8; + public static final int ODATA_VALUE = 9; + public static final int JOB_VALUE = 10; + public static final int JOB_FILE_MODE_VALUE = 11; + public static final int MOBILE_CLIENT_VALUE = 12; + public static final int MOBILE_SERVER_VALUE = 13; + public static final int MOBILE_JOB_FILE_MODE_VALUE = 14; + public static final int MOBILE_MANAGED_CLIENT_VALUE = 15; + private static final DebugTargetType[] VALUES_ARRAY = new DebugTargetType[]{UNKNOWN, CLIENT, MANAGED_CLIENT, WEB_CLIENT, COM_CONNECTOR, SERVER, SERVER_EMULATION, WEB_SERVICE, HTTP_SERVICE, ODATA, JOB, JOB_FILE_MODE, MOBILE_CLIENT, MOBILE_SERVER, MOBILE_JOB_FILE_MODE, MOBILE_MANAGED_CLIENT}; + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + private final int value; + private final String name; + private final String literal; + + private DebugTargetType(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + public int getValue() { + return this.value; + } + + public String getName() { + return this.name; + } + + public String getLiteral() { + return this.literal; + } + + public String toString() { + return this.literal; + } +} + From 1de693f6dda5b37af33d9e9a7f46774cccf5a69b Mon Sep 17 00:00:00 2001 From: Alexey Sosnoviy Date: Wed, 1 Sep 2021 11:14:22 +0300 Subject: [PATCH 02/17] =?UTF-8?q?=D0=92=D1=8B=D0=BD=D0=BE=D1=81=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BA=D1=80=D1=8B=D1=82=D0=B8=D1=8F=20=D0=B8=D0=B7=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../clouds42/Commands/CoverageCommand.java | 329 +-------------- src/main/java/com/clouds42/Coverager.java | 397 ++++++++++++++++++ 2 files changed, 410 insertions(+), 316 deletions(-) create mode 100644 src/main/java/com/clouds42/Coverager.java diff --git a/src/main/java/com/clouds42/Commands/CoverageCommand.java b/src/main/java/com/clouds42/Commands/CoverageCommand.java index 5d533ba..3dcd189 100644 --- a/src/main/java/com/clouds42/Commands/CoverageCommand.java +++ b/src/main/java/com/clouds42/Commands/CoverageCommand.java @@ -21,50 +21,27 @@ */ package com.clouds42.Commands; -import com._1c.g5.v8.dt.debug.core.runtime.client.RuntimeDebugClientException; -import com._1c.g5.v8.dt.debug.model.base.data.AttachDebugUIResult; -import com._1c.g5.v8.dt.debug.model.base.data.BSLModuleIdInternal; -import com._1c.g5.v8.dt.debug.model.base.data.DebugTargetId; -import com._1c.g5.v8.dt.debug.model.dbgui.commands.DBGUIExtCmdInfoBase; -import com._1c.g5.v8.dt.debug.model.dbgui.commands.DBGUIExtCmds; -import com._1c.g5.v8.dt.debug.model.dbgui.commands.impl.DBGUIExtCmdInfoMeasureImpl; -import com._1c.g5.v8.dt.debug.model.dbgui.commands.impl.DBGUIExtCmdInfoStartedImpl; -import com._1c.g5.v8.dt.debug.model.measure.PerformanceInfoLine; -import com._1c.g5.v8.dt.debug.model.measure.PerformanceInfoMain; -import com._1c.g5.v8.dt.debug.model.measure.PerformanceInfoModule; -import com._1c.g5.v8.dt.internal.debug.core.runtime.client.RuntimeDebugModelXmlSerializer; -import com.clouds42.CommandLineOptions.*; -import com.clouds42.DebugClient; -import com.clouds42.MyRuntimeDebugModelXmlSerializer; + +import com.clouds42.CommandLineOptions.ConnectionOptions; +import com.clouds42.CommandLineOptions.DebuggerOptions; +import com.clouds42.CommandLineOptions.FilterOptions; +import com.clouds42.CommandLineOptions.LoggingOptions; +import com.clouds42.CommandLineOptions.MetadataOptions; +import com.clouds42.CommandLineOptions.OutputOptions; +import com.clouds42.Coverager; import com.clouds42.PipeMessages; -import com.clouds42.Utils; -import org.eclipse.emf.common.util.EList; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import picocli.CommandLine; -import picocli.CommandLine.Command; import picocli.CommandLine.Mixin; +import picocli.CommandLine.Command; import picocli.CommandLine.Option; -import java.lang.module.ModuleDescriptor.Version; -import java.io.IOException; -import java.io.PrintWriter; -import java.lang.invoke.MethodHandles; -import java.math.BigDecimal; -import java.net.URI; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.*; import java.util.concurrent.Callable; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.stream.Stream; @Command(name = PipeMessages.START_COMMAND, mixinStandardHelpOptions = true, description = "Start measure and save coverage data to file", sortOptions = false) -public class CoverageCommand extends CoverServer implements Callable { +public class CoverageCommand implements Callable { - private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + private Coverager coverager; @Mixin private ConnectionOptions connectionOptions; @@ -87,291 +64,11 @@ public class CoverageCommand extends CoverServer implements Callable { @Option(names = {"--opid"}, description = "Owner process PID", defaultValue = "-1") Integer opid; - private DebugClient client; - - private final Map> coverageData = new HashMap<>() { - @Override - public Map get(Object key) { - Map map = super.get(key); - if (map == null) { - map = new HashMap<>(); - put((URI) key, map); - } - return map; - } - }; - - - private final AtomicBoolean stopExecution = new AtomicBoolean(false); - private boolean rawMode = false; - private boolean systemStarted = false; - - private void connectAllTargets(List debugTargets) { - logger.info("Current debug targets size: {}", debugTargets.size()); - debugTargets.forEach(debugTarget -> { - String id = debugTarget.getId(); - String seanceId = debugTarget.getSeanceId(); - String targetType = debugTarget.getTargetType().getName(); - logger.info("Id: {} , seance id: {} , target type: {}", id, seanceId, targetType); - try { - client.attachRuntimeDebugTargets(Collections.singletonList(UUID.fromString(debugTarget.getId()))); - } catch (RuntimeDebugClientException e) { - logger.error(e.getLocalizedMessage()); - } - }); - } - @Override public Integer call() throws Exception { + coverager= new Coverager(connectionOptions,filterOptions, metadataOptions, outputOptions, debuggerOptions, loggingOptions, opid); + return coverager.call(); - int result = CommandLine.ExitCode.OK; - getServerSocket(); - - - RuntimeDebugModelXmlSerializer serializer = new MyRuntimeDebugModelXmlSerializer(); - client = new DebugClient(serializer); - - UUID measureUuid = UUID.randomUUID(); - - rawMode = metadataOptions.isRawMode(); - - Map uriListByKey = Utils.readMetadata(metadataOptions, coverageData); - - try { - startSystem(measureUuid); - } catch (RuntimeDebugClientException e) { - logger.info("Connecting to dbgs failed"); - logger.error(e.getLocalizedMessage()); - result = CommandLine.ExitCode.SOFTWARE; - return result; - } - - addShutdownHook(); - - Set externalDataProcessorsUriSet = new HashSet<>(); - - try { - mainLoop(uriListByKey, externalDataProcessorsUriSet); - } catch (RuntimeDebugClientException e) { - logger.error("Can't send ping to debug server. Coverage analyzing finished"); - logger.error(e.getLocalizedMessage()); - e.printStackTrace(); - result = CommandLine.ExitCode.SOFTWARE; - } - Thread.sleep(debuggerOptions.getPingTimeout()); - - shutdown(); - return result; - } - - private void shutdown() throws IOException { - if (opid > 0 && !Utils.isProcessStillAlive(opid)) { - logger.info("Owner process stopped: {}", opid); - } - - gracefulShutdown(null); - - logger.info("Disconnecting from dbgs..."); - try { - client.disconnect(); - client.dispose(); - } catch (RuntimeDebugClientException e) { - logger.error(e.getLocalizedMessage()); - } - closeSocket(); - - logger.info("Main thread finished"); - stopExecution.set(true); - } - - private void addShutdownHook() { - Runtime.getRuntime().addShutdownHook(new Thread(() -> { - try { - shutdown(); - } catch (IOException e) { - logger.info("Shutdown error."); - e.printStackTrace(); - } - })); } - private void targetStarted(DBGUIExtCmdInfoStartedImpl command) { - DebugTargetId targetId = command.getTargetID(); - try { - client.attachRuntimeDebugTargets(Collections.singletonList(UUID.fromString(targetId.getId()))); - } catch (RuntimeDebugClientException e) { - logger.info("Command: {} error!", command.getCmdID().getName()); - logger.error(e.getLocalizedMessage()); - } - } - - private void mainLoop(Map uriListByKey, Set externalDataProcessorsUriSet) throws RuntimeDebugClientException { - while (!stopExecution.get()) { - List commandsList = client.ping(); - logger.info("Ping result commands size: {}", commandsList.size()); - commandsList.forEach(command -> { - logger.info("Command: {}", command.getCmdID().getName()); - if (command.getCmdID() == DBGUIExtCmds.MEASURE_RESULT_PROCESSING) { - measureResultProcessing(uriListByKey, externalDataProcessorsUriSet, (DBGUIExtCmdInfoMeasureImpl) command); - } else if (command.getCmdID() == DBGUIExtCmds.TARGET_STARTED) { - targetStarted((DBGUIExtCmdInfoStartedImpl) command); - } - }); - } - } - - private void measureResultProcessing(Map uriListByKey, Set externalDataProcessorsUriSet, DBGUIExtCmdInfoMeasureImpl command) { - logger.info("Found MEASURE_RESULT_PROCESSING command"); - PerformanceInfoMain measure = command.getMeasure(); - EList moduleInfoList = measure.getModuleData(); - moduleInfoList.forEach(moduleInfo -> { - BSLModuleIdInternal moduleId = moduleInfo.getModuleID(); - String moduleUrl = moduleId.getURL(); - if (loggingOptions.isVerbose() && !moduleUrl.isEmpty() && !externalDataProcessorsUriSet.contains(moduleUrl)) { - logger.info("Found external data processor: {}", moduleUrl); - externalDataProcessorsUriSet.add(moduleUrl); - } - String moduleExtensionName = moduleId.getExtensionName(); - if (filterOptions.getExtensionName().equals(moduleExtensionName) - && filterOptions.getExternalDataProcessorUrl().equals(moduleUrl)) { - String objectId = moduleId.getObjectID(); - String propertyId = moduleId.getPropertyID(); - String key = Utils.getUriKey(objectId, propertyId); - - URI uri; - if (!rawMode) { - uri = uriListByKey.get(key); - } else { - uri = URI.create("file:///" + key); - } - if (uri == null) { - logger.info("Couldn't find object id {}, property id {} in sources!", objectId, propertyId); - } else { - EList lineInfoList = moduleInfo.getLineInfo(); - lineInfoList.forEach(lineInfo -> { - BigDecimal lineNo = lineInfo.getLineNo(); - Map coverMap = coverageData.get(uri); - if (!coverMap.isEmpty() || rawMode) { - if (!rawMode && !coverMap.containsKey(lineNo)) { - if (loggingOptions.isVerbose()) { - logger.info("Can't find line to cover {} in module {}", lineNo, uri); - try { - Stream all_lines = Files.lines(Paths.get(uri)); - Optional first = all_lines.skip(lineNo.longValue() - 1).findFirst(); - if (first.isPresent()) { - String specific_line_n = first.get(); - logger.info(">>> {}", specific_line_n); - } - } catch (Exception e) { - logger.error(e.getLocalizedMessage()); - } - } - } else { - int currentValue = coverMap.getOrDefault(lineNo, 0); - if (currentValue < 0) { - currentValue = 0; - } - coverMap.put(lineNo, - currentValue - + lineInfo.getFrequency().intValue()); - } - } - }); - } - } - }); - } - - private void startSystem(UUID measureUuid) throws RuntimeDebugClientException { - UUID debugServerUuid = UUID.randomUUID(); - client.configure( - connectionOptions.getDebugServerUrl(), - debugServerUuid, - connectionOptions.getInfobaseAlias()); - logger.info("Connecting to debugger..."); - AttachDebugUIResult connectionResult = client.connect(debuggerOptions.getPassword()); - if (connectionResult != AttachDebugUIResult.REGISTERED) { - if (connectionResult == AttachDebugUIResult.IB_IN_DEBUG) { - throw new RuntimeDebugClientException("Can't connect to debug server. IB is in debug. Close configurator or EDT first"); - } else if (connectionResult == AttachDebugUIResult.CREDENTIALS_REQUIRED) { - throw new RuntimeDebugClientException("Can't connect to debug server. Use -p option to set correct password"); - } else { - throw new RuntimeDebugClientException("Can't connect to debug server. Connection result: " + connectionResult); - } - } - Version apiver = Version.parse(client.getApiVersion()); - logger.info("Setup settings..."); - client.initSettings(false); - client.setAutoconnectDebugTargets( - debuggerOptions.getDebugAreaNames(), - debuggerOptions.getFilteredAutoconnectTargets(apiver)); - logger.info("Setup targets..."); - List debugTargets; - if (debuggerOptions.getDebugAreaNames().isEmpty()) { - debugTargets = client.getRuntimeDebugTargets(null); - } else { - debugTargets = new LinkedList<>(); - debuggerOptions.getDebugAreaNames().forEach(areaName -> { - try { - debugTargets.addAll(client.getRuntimeDebugTargets(areaName)); - } catch (RuntimeDebugClientException ex) { - logger.error(ex.getLocalizedMessage()); - } - }); - } - connectAllTargets(debugTargets); - - logger.info("Enabling profiling..."); - client.toggleProfiling(null); - client.toggleProfiling(measureUuid); - - systemStarted = true; - - } - - protected void gracefulShutdown(PrintWriter serverPipeOut) { - if (stopExecution.get()) { - return; - } - - logger.info("Disabling profiling..."); - try { - client.toggleProfiling(null); - } catch (RuntimeDebugClientException e) { - logger.error(e.getLocalizedMessage()); - } - - Utils.dumpCoverageFile(coverageData, metadataOptions, outputOptions); - if(serverPipeOut!=null) { - serverPipeOut.println(PipeMessages.OK_RESULT); - } - stopExecution.set(true); - - logger.info("Bye!"); - } - - @Override - protected MetadataOptions getMetadataOptions() { - return metadataOptions; - } - - @Override - protected Map> getCoverageData() { - return coverageData; - } - - @Override - protected OutputOptions getOutputOptions() { - return outputOptions; - } - - @Override - public ConnectionOptions getConnectionOptions() { - return connectionOptions; - } - - @Override - protected boolean getSystemStarted() { - return systemStarted; - } } diff --git a/src/main/java/com/clouds42/Coverager.java b/src/main/java/com/clouds42/Coverager.java new file mode 100644 index 0000000..d3eb443 --- /dev/null +++ b/src/main/java/com/clouds42/Coverager.java @@ -0,0 +1,397 @@ +/* + * This file is a part of Coverage41C. + * + * Copyright (c) 2020-2021 + * Kosolapov Stanislav aka proDOOMman and contributors + * + * SPDX-License-Identifier: LGPL-3.0-or-later + * + * Coverage41C is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3.0 of the License, or (at your option) any later version. + * + * Coverage41C is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Coverage41C. + */ +package com.clouds42; + +import com._1c.g5.v8.dt.debug.core.runtime.client.RuntimeDebugClientException; +import com._1c.g5.v8.dt.debug.model.base.data.AttachDebugUIResult; +import com._1c.g5.v8.dt.debug.model.base.data.BSLModuleIdInternal; +import com._1c.g5.v8.dt.debug.model.base.data.DebugTargetId; +import com._1c.g5.v8.dt.debug.model.dbgui.commands.DBGUIExtCmdInfoBase; +import com._1c.g5.v8.dt.debug.model.dbgui.commands.DBGUIExtCmds; +import com._1c.g5.v8.dt.debug.model.dbgui.commands.impl.DBGUIExtCmdInfoMeasureImpl; +import com._1c.g5.v8.dt.debug.model.dbgui.commands.impl.DBGUIExtCmdInfoStartedImpl; +import com._1c.g5.v8.dt.debug.model.measure.PerformanceInfoLine; +import com._1c.g5.v8.dt.debug.model.measure.PerformanceInfoMain; +import com._1c.g5.v8.dt.debug.model.measure.PerformanceInfoModule; +import com._1c.g5.v8.dt.internal.debug.core.runtime.client.RuntimeDebugModelXmlSerializer; +import com.clouds42.CommandLineOptions.ConnectionOptions; +import com.clouds42.CommandLineOptions.DebuggerOptions; +import com.clouds42.CommandLineOptions.FilterOptions; +import com.clouds42.CommandLineOptions.LoggingOptions; +import com.clouds42.CommandLineOptions.MetadataOptions; +import com.clouds42.CommandLineOptions.OutputOptions; +import com.clouds42.Commands.CoverServer; +import org.eclipse.emf.common.util.EList; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import picocli.CommandLine; +import picocli.CommandLine.Option; + +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.invoke.MethodHandles; +import java.lang.module.ModuleDescriptor.Version; +import java.math.BigDecimal; +import java.net.URI; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.stream.Stream; + + +public class Coverager extends CoverServer { + + private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private ConnectionOptions connectionOptions; + + + private FilterOptions filterOptions; + + + private MetadataOptions metadataOptions; + + + private OutputOptions outputOptions; + + + private DebuggerOptions debuggerOptions; + + + private LoggingOptions loggingOptions; + + @Option(names = {"--opid"}, description = "Owner process PID", defaultValue = "-1") + Integer opid; + + private DebugClient client; + + private final Map> coverageData = new HashMap<>() { + @Override + public Map get(Object key) { + Map map = super.get(key); + if (map == null) { + map = new HashMap<>(); + put((URI) key, map); + } + return map; + } + }; + + + private final AtomicBoolean stopExecution = new AtomicBoolean(false); + private boolean rawMode = false; + private boolean systemStarted = false; + + public Coverager(ConnectionOptions connectionOptions, + FilterOptions filterOptions, + MetadataOptions metadataOptions, + OutputOptions outputOptions, + DebuggerOptions debuggerOptions, + LoggingOptions loggingOptions, + Integer opid) { + this.connectionOptions = connectionOptions; + this.filterOptions = filterOptions; + this.metadataOptions = metadataOptions; + this.outputOptions = outputOptions; + this.debuggerOptions = debuggerOptions; + this.loggingOptions = loggingOptions; + this.opid = opid; + } + + private void connectAllTargets(List debugTargets) { + logger.info("Current debug targets size: {}", debugTargets.size()); + debugTargets.forEach(debugTarget -> { + String id = debugTarget.getId(); + String seanceId = debugTarget.getSeanceId(); + String targetType = debugTarget.getTargetType().getName(); + logger.info("Id: {} , seance id: {} , target type: {}", id, seanceId, targetType); + try { + client.attachRuntimeDebugTargets(Collections.singletonList(UUID.fromString(debugTarget.getId()))); + } catch (RuntimeDebugClientException e) { + logger.error(e.getLocalizedMessage()); + } + }); + } + + + public Integer call() throws Exception { + + int result = CommandLine.ExitCode.OK; + getServerSocket(); + + + RuntimeDebugModelXmlSerializer serializer = new MyRuntimeDebugModelXmlSerializer(); + client = new DebugClient(serializer); + + UUID measureUuid = UUID.randomUUID(); + + rawMode = metadataOptions.isRawMode(); + + Map uriListByKey = Utils.readMetadata(metadataOptions, coverageData); + + try { + startSystem(measureUuid); + } catch (RuntimeDebugClientException e) { + logger.info("Connecting to dbgs failed"); + logger.error(e.getLocalizedMessage()); + result = CommandLine.ExitCode.SOFTWARE; + return result; + } + + addShutdownHook(); + + Set externalDataProcessorsUriSet = new HashSet<>(); + + try { + mainLoop(uriListByKey, externalDataProcessorsUriSet); + } catch (RuntimeDebugClientException e) { + logger.error("Can't send ping to debug server. Coverage analyzing finished"); + logger.error(e.getLocalizedMessage()); + e.printStackTrace(); + result = CommandLine.ExitCode.SOFTWARE; + } + Thread.sleep(debuggerOptions.getPingTimeout()); + + shutdown(); + return result; + } + + private void shutdown() throws IOException { + if (opid > 0 && !Utils.isProcessStillAlive(opid)) { + logger.info("Owner process stopped: {}", opid); + } + + gracefulShutdown(null); + + logger.info("Disconnecting from dbgs..."); + try { + client.disconnect(); + client.dispose(); + } catch (RuntimeDebugClientException e) { + logger.error(e.getLocalizedMessage()); + } + closeSocket(); + + logger.info("Main thread finished"); + stopExecution.set(true); + } + + private void addShutdownHook() { + Runtime.getRuntime().addShutdownHook(new Thread(() -> { + try { + shutdown(); + } catch (IOException e) { + logger.info("Shutdown error."); + e.printStackTrace(); + } + })); + } + + private void targetStarted(DBGUIExtCmdInfoStartedImpl command) { + DebugTargetId targetId = command.getTargetID(); + try { + client.attachRuntimeDebugTargets(Collections.singletonList(UUID.fromString(targetId.getId()))); + } catch (RuntimeDebugClientException e) { + logger.info("Command: {} error!", command.getCmdID().getName()); + logger.error(e.getLocalizedMessage()); + } + } + + private void mainLoop(Map uriListByKey, Set externalDataProcessorsUriSet) throws RuntimeDebugClientException { + while (!stopExecution.get()) { + List commandsList = client.ping(); + logger.info("Ping result commands size: {}", commandsList.size()); + commandsList.forEach(command -> { + logger.info("Command: {}", command.getCmdID().getName()); + if (command.getCmdID() == DBGUIExtCmds.MEASURE_RESULT_PROCESSING) { + measureResultProcessing(uriListByKey, externalDataProcessorsUriSet, (DBGUIExtCmdInfoMeasureImpl) command); + } else if (command.getCmdID() == DBGUIExtCmds.TARGET_STARTED) { + targetStarted((DBGUIExtCmdInfoStartedImpl) command); + } + }); + } + } + + private void measureResultProcessing(Map uriListByKey, Set externalDataProcessorsUriSet, DBGUIExtCmdInfoMeasureImpl command) { + logger.info("Found MEASURE_RESULT_PROCESSING command"); + PerformanceInfoMain measure = command.getMeasure(); + EList moduleInfoList = measure.getModuleData(); + moduleInfoList.forEach(moduleInfo -> { + BSLModuleIdInternal moduleId = moduleInfo.getModuleID(); + String moduleUrl = moduleId.getURL(); + if (loggingOptions.isVerbose() && !moduleUrl.isEmpty() && !externalDataProcessorsUriSet.contains(moduleUrl)) { + logger.info("Found external data processor: {}", moduleUrl); + externalDataProcessorsUriSet.add(moduleUrl); + } + String moduleExtensionName = moduleId.getExtensionName(); + if (filterOptions.getExtensionName().equals(moduleExtensionName) + && filterOptions.getExternalDataProcessorUrl().equals(moduleUrl)) { + String objectId = moduleId.getObjectID(); + String propertyId = moduleId.getPropertyID(); + String key = Utils.getUriKey(objectId, propertyId); + + URI uri; + if (!rawMode) { + uri = uriListByKey.get(key); + } else { + uri = URI.create("file:///" + key); + } + if (uri == null) { + logger.info("Couldn't find object id {}, property id {} in sources!", objectId, propertyId); + } else { + EList lineInfoList = moduleInfo.getLineInfo(); + lineInfoList.forEach(lineInfo -> { + BigDecimal lineNo = lineInfo.getLineNo(); + Map coverMap = coverageData.get(uri); + if (!coverMap.isEmpty() || rawMode) { + if (!rawMode && !coverMap.containsKey(lineNo)) { + if (loggingOptions.isVerbose()) { + logger.info("Can't find line to cover {} in module {}", lineNo, uri); + try { + Stream all_lines = Files.lines(Paths.get(uri)); + Optional first = all_lines.skip(lineNo.longValue() - 1).findFirst(); + if (first.isPresent()) { + String specific_line_n = first.get(); + logger.info(">>> {}", specific_line_n); + } + } catch (Exception e) { + logger.error(e.getLocalizedMessage()); + } + } + } else { + int currentValue = coverMap.getOrDefault(lineNo, 0); + if (currentValue < 0) { + currentValue = 0; + } + coverMap.put(lineNo, + currentValue + + lineInfo.getFrequency().intValue()); + } + } + }); + } + } + }); + } + + private void startSystem(UUID measureUuid) throws RuntimeDebugClientException { + UUID debugServerUuid = UUID.randomUUID(); + client.configure( + connectionOptions.getDebugServerUrl(), + debugServerUuid, + connectionOptions.getInfobaseAlias()); + logger.info("Connecting to debugger..."); + AttachDebugUIResult connectionResult = client.connect(debuggerOptions.getPassword()); + if (connectionResult != AttachDebugUIResult.REGISTERED) { + if (connectionResult == AttachDebugUIResult.IB_IN_DEBUG) { + throw new RuntimeDebugClientException("Can't connect to debug server. IB is in debug. Close configurator or EDT first"); + } else if (connectionResult == AttachDebugUIResult.CREDENTIALS_REQUIRED) { + throw new RuntimeDebugClientException("Can't connect to debug server. Use -p option to set correct password"); + } else { + throw new RuntimeDebugClientException("Can't connect to debug server. Connection result: " + connectionResult); + } + } + Version apiver = Version.parse(client.getApiVersion()); + logger.info("Setup settings..."); + client.initSettings(false); + client.setAutoconnectDebugTargets( + debuggerOptions.getDebugAreaNames(), + debuggerOptions.getFilteredAutoconnectTargets(apiver)); + logger.info("Setup targets..."); + List debugTargets; + if (debuggerOptions.getDebugAreaNames().isEmpty()) { + debugTargets = client.getRuntimeDebugTargets(null); + } else { + debugTargets = new LinkedList<>(); + debuggerOptions.getDebugAreaNames().forEach(areaName -> { + try { + debugTargets.addAll(client.getRuntimeDebugTargets(areaName)); + } catch (RuntimeDebugClientException ex) { + logger.error(ex.getLocalizedMessage()); + } + }); + } + connectAllTargets(debugTargets); + + logger.info("Enabling profiling..."); + client.toggleProfiling(null); + client.toggleProfiling(measureUuid); + + systemStarted = true; + + } + + protected void gracefulShutdown(PrintWriter serverPipeOut) { + if (stopExecution.get()) { + return; + } + + logger.info("Disabling profiling..."); + try { + client.toggleProfiling(null); + } catch (RuntimeDebugClientException e) { + logger.error(e.getLocalizedMessage()); + } + + Utils.dumpCoverageFile(coverageData, metadataOptions, outputOptions); + if (serverPipeOut != null) { + serverPipeOut.println(PipeMessages.OK_RESULT); + } + stopExecution.set(true); + + logger.info("Bye!"); + } + + @Override + protected MetadataOptions getMetadataOptions() { + return metadataOptions; + } + + @Override + protected Map> getCoverageData() { + return coverageData; + } + + @Override + protected OutputOptions getOutputOptions() { + return outputOptions; + } + + @Override + public ConnectionOptions getConnectionOptions() { + return connectionOptions; + } + + @Override + protected boolean getSystemStarted() { + return systemStarted; + } +} From 3e44c7bfa4017c649f703b2a2e30be29a61107f9 Mon Sep 17 00:00:00 2001 From: Alexey Sosnoviy Date: Wed, 15 Sep 2021 15:23:47 +0300 Subject: [PATCH 03/17] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B7=D0=B0=D0=B2=D0=B8=D1=81=D0=B8?= =?UTF-8?q?=D0=BC=D0=BE=D1=81=D1=82=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 30 +++++++++---------- .../com/clouds42/AbstractDebugClient.java | 30 ++++++++++++++----- 2 files changed, 38 insertions(+), 22 deletions(-) diff --git a/build.gradle b/build.gradle index d64b253..f23d52b 100644 --- a/build.gradle +++ b/build.gradle @@ -47,22 +47,22 @@ dependencies { compile group: 'org.scala-sbt.ipcsocket', name: 'ipcsocket', version: '1.4.0' - compile group: 'org.eclipse.emf', name: 'org.eclipse.emf.common', version: '2.16.0' + compile group: 'org.eclipse.emf', name: 'org.eclipse.emf.common', version: '2.23.0' compile group: 'org.eclipse.emf', name: 'org.eclipse.emf.ecore.xmi', version: '2.16.0' - compile group: 'org.eclipse.emf', name: 'org.eclipse.emf.ecore.xcore.lib', version: '1.4.0' + compile group: 'org.eclipse.emf', name: 'org.eclipse.emf.ecore.xcore.lib', version: '1.6.0' - compile group: 'org.eclipse.platform', name: 'org.eclipse.osgi', version: '3.15.300' + compile group: 'org.eclipse.platform', name: 'org.eclipse.osgi', version: '3.16.300' - compile group: 'org.eclipse.platform', name: 'org.eclipse.core.runtime', version: '3.15.300' - compile group: 'org.eclipse.platform', name: 'org.eclipse.osgi.services', version: '3.8.0' - compile group: 'org.eclipse.platform', name: 'org.eclipse.equinox.common', version: '3.10.400' + compile group: 'org.eclipse.platform', name: 'org.eclipse.core.runtime', version: '3.22.0' + compile group: 'org.eclipse.platform', name: 'org.eclipse.osgi.services', version: '3.10.100' + compile group: 'org.eclipse.platform', name: 'org.eclipse.equinox.common', version: '3.15.0' - compile group: 'org.eclipse.jetty', name: 'jetty-client', version: '9.4.27.v20200227' + compile group: 'org.eclipse.jetty', name: 'jetty-client', version: '11.0.6' - compile group: 'com.google.guava', name: 'guava', version: '29.0-jre' + compile group: 'com.google.guava', name: 'guava', version: '30.1.1-jre' - compile group: 'com.google.inject', name: 'guice', version: '4.0' + compile group: 'com.google.inject', name: 'guice', version: '5.0.1' compile group: 'de.vandermeer', name:'asciitable', version: '0.3.2' @@ -79,12 +79,12 @@ dependencies { providedCompile fileTree(edtLocation) { include 'com._1c.g5.v8.dt.debug.*.jar' } - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.2' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.6.2' - testCompile 'org.xmlunit:xmlunit-core:2.6.4' - testCompile 'org.xmlunit:xmlunit-matchers:2.6.4' - testCompile 'com.fasterxml.jackson.core:jackson-core:2.11.0' - testCompile 'com.fasterxml.jackson.core:jackson-databind:2.11.0' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.2' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.2' + testCompile 'org.xmlunit:xmlunit-core:2.8.2' + testCompile 'org.xmlunit:xmlunit-matchers:2.8.2' + testCompile 'com.fasterxml.jackson.core:jackson-core:2.12.5' + testCompile 'com.fasterxml.jackson.core:jackson-databind:2.12.5' } tasks.withType(JavaCompile) { diff --git a/src/main/java/com/clouds42/AbstractDebugClient.java b/src/main/java/com/clouds42/AbstractDebugClient.java index a8101c1..e9b3f8c 100644 --- a/src/main/java/com/clouds42/AbstractDebugClient.java +++ b/src/main/java/com/clouds42/AbstractDebugClient.java @@ -29,9 +29,15 @@ import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.client.api.ContentResponse; import org.eclipse.jetty.client.api.Request; +import org.eclipse.jetty.client.dynamic.HttpClientTransportDynamic; import org.eclipse.jetty.client.util.FutureResponseListener; -import org.eclipse.jetty.client.util.StringContentProvider; -import org.eclipse.jetty.http.*; +import org.eclipse.jetty.client.util.StringRequestContent; +import org.eclipse.jetty.http.HttpField; +import org.eclipse.jetty.http.HttpFields; +import org.eclipse.jetty.http.HttpHeader; +import org.eclipse.jetty.http.HttpMethod; +import org.eclipse.jetty.http.HttpStatus; +import org.eclipse.jetty.io.ClientConnector; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -66,16 +72,26 @@ protected HttpClient createHttpClient() { protected HttpClient createHttpClient(long idleTimeout) { SslContextFactory.Client sslContextFactory = new SslContextFactory.Client(); sslContextFactory.setTrustAll(true); - HttpClient httpClient = new HttpClient(sslContextFactory); - HttpField agent = new HttpField("User-Agent", "1CV8"); + + ClientConnector clientConnector = new ClientConnector(); + clientConnector.setSslContextFactory(sslContextFactory); + + HttpClient httpClient = new HttpClient(new HttpClientTransportDynamic(clientConnector)); httpClient.setFollowRedirects(true); - httpClient.setUserAgentField(agent); + httpClient.setUserAgentField(new HttpField("User-Agent", "1CV8")); httpClient.setIdleTimeout(idleTimeout); return httpClient; } protected Request buildRequest(HttpClient httpClient, HttpMethod method, String componentUrl) { - return httpClient.newRequest(this.toUri(componentUrl)).method(method).header(HttpHeader.ACCEPT, "application/xml").header(HttpHeader.CONNECTION, HttpHeader.KEEP_ALIVE.asString()).header(HttpHeader.CONTENT_TYPE, "application/xml").header("1C-ApplicationName", "1C:Enterprise DT"); + return httpClient.newRequest(this.toUri(componentUrl)) + .method(method) + .headers(httpFields -> httpFields + .add(HttpHeader.ACCEPT, "application/xml") + .add(HttpHeader.CONNECTION, HttpHeader.KEEP_ALIVE.asString()) + .add(HttpHeader.CONTENT_TYPE, "application/xml") + .add("1C-ApplicationName", "1C:Enterprise DT") + ); } protected String getComponentUrl(String debugServerUrl, String suffix) { @@ -101,7 +117,7 @@ protected static T performRuntimeHttpRequest(AbstractDebugCl if (requestContent != null) { try { String serializedRequest = abstractDebugClient.serializer.serialize(requestContent); - request.content(new StringContentProvider(serializedRequest)); + request.body(new StringRequestContent(serializedRequest)); } catch (IOException e) { throw new RuntimeDebugClientException("Error occurred while processing request", e); } From 0d1a968d0a02bb41a0c395533352550a4125cc6f Mon Sep 17 00:00:00 2001 From: Alexey Sosnoviy Date: Tue, 21 Sep 2021 17:30:37 +0300 Subject: [PATCH 04/17] =?UTF-8?q?=D0=A2=D0=B5=D1=81=D1=82=20=D0=BD=D0=B0?= =?UTF-8?q?=20=D0=A2=D0=B8=D0=BF()=20fix=20#126?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/clouds42/LinesToCoverageTest.java | 4 ++-- src/test/resources/linestocoverage/filtered.bsl | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/clouds42/LinesToCoverageTest.java b/src/test/java/com/clouds42/LinesToCoverageTest.java index 1dcd9ae..451cc19 100644 --- a/src/test/java/com/clouds42/LinesToCoverageTest.java +++ b/src/test/java/com/clouds42/LinesToCoverageTest.java @@ -157,8 +157,8 @@ void FilterTest() throws IOException { int[] linesToCover = LinesToCoverage.getLines(tokenizer.getAst()); // Реальный замер - // 3, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 23, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 62, 63, 65, 70, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 122, 126, 128, 130, 132, 134, 135, 136, 137, 139, 141, 141, 142, 142, 143, 143 - var expected = new int[]{3, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 23, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 62, 63, 65, 70, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 122, 126, 128, 130, 132, 134, 135, 136, 137, 139, 141, 142, 143}; + // 3, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 23, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 62, 63, 65, 70, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 122, 126, 128, 130, 132, 134, 135, 136, 137, 139, 143, 146, 149, 152, 155, 155, 156, 156, 157, 157, 158, 158 + var expected = new int[]{3, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 23, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 62, 63, 65, 70, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 122, 126, 128, 130, 132, 134, 135, 136, 137, 139, 143, 146, 149, 152, 155, 156, 157, 158}; assertThat(linesToCover, equalTo(expected)); } diff --git a/src/test/resources/linestocoverage/filtered.bsl b/src/test/resources/linestocoverage/filtered.bsl index 3ddb0c7..cc97acc 100644 --- a/src/test/resources/linestocoverage/filtered.bsl +++ b/src/test/resources/linestocoverage/filtered.bsl @@ -138,6 +138,21 @@ КонецПроцедуры +Процедура ФункцииТип(СоответствиеТипов); + +Тип = + Тип("Строка"); + +Тип = + ТипЗнч("Строка"); + +СоответствиеТипов.Вставить( +Тип("Строка"), "Строка"); + +КонецПроцедуры + + ФункцииРаботаСоСтроками(); ФункцииРаботыСДатой(); ФункцииПреобразованияЗначений(); +ФункцииТип(Новый Соответствие); From 8d038b04b778d10e6234b183c3128c7c439e4464 Mon Sep 17 00:00:00 2001 From: Alexey Sosnoviy Date: Tue, 21 Sep 2021 17:55:07 +0300 Subject: [PATCH 05/17] bsl-parser up --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index f23d52b..ecef5ac 100644 --- a/build.gradle +++ b/build.gradle @@ -68,7 +68,7 @@ dependencies { implementation 'com.github.1c-syntax:mdclasses:a5ce5cd5439201040caf27fdc8e4763a7f45f65c' - implementation('com.github.1c-syntax:bsl-parser:0.19.3') { + implementation('com.github.1c-syntax:bsl-parser:0.19.4') { exclude group: "com.tunnelvisionlabs", module: "antlr4-annotations" exclude group: "com.ibm.icu", module: "*" exclude group: "org.antlr", module: "ST4" From 94c95483867bed964ca257f40035a849a5edd616 Mon Sep 17 00:00:00 2001 From: Alexey Sosnoviy Date: Wed, 10 Nov 2021 22:59:35 +0300 Subject: [PATCH 06/17] Dependencies bump --- build.gradle | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index ecef5ac..9a5b8b5 100644 --- a/build.gradle +++ b/build.gradle @@ -51,16 +51,16 @@ dependencies { compile group: 'org.eclipse.emf', name: 'org.eclipse.emf.ecore.xmi', version: '2.16.0' compile group: 'org.eclipse.emf', name: 'org.eclipse.emf.ecore.xcore.lib', version: '1.6.0' - compile group: 'org.eclipse.platform', name: 'org.eclipse.osgi', version: '3.16.300' + compile group: 'org.eclipse.platform', name: 'org.eclipse.osgi', version: '3.17.0' - compile group: 'org.eclipse.platform', name: 'org.eclipse.core.runtime', version: '3.22.0' - compile group: 'org.eclipse.platform', name: 'org.eclipse.osgi.services', version: '3.10.100' + compile group: 'org.eclipse.platform', name: 'org.eclipse.core.runtime', version: '3.23.0' + compile group: 'org.eclipse.platform', name: 'org.eclipse.osgi.services', version: '3.10.200' compile group: 'org.eclipse.platform', name: 'org.eclipse.equinox.common', version: '3.15.0' compile group: 'org.eclipse.jetty', name: 'jetty-client', version: '11.0.6' - compile group: 'com.google.guava', name: 'guava', version: '30.1.1-jre' + compile group: 'com.google.guava', name: 'guava', version: '31.0.1-jre' compile group: 'com.google.inject', name: 'guice', version: '5.0.1' @@ -79,12 +79,12 @@ dependencies { providedCompile fileTree(edtLocation) { include 'com._1c.g5.v8.dt.debug.*.jar' } - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.2' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.2' - testCompile 'org.xmlunit:xmlunit-core:2.8.2' - testCompile 'org.xmlunit:xmlunit-matchers:2.8.2' - testCompile 'com.fasterxml.jackson.core:jackson-core:2.12.5' - testCompile 'com.fasterxml.jackson.core:jackson-databind:2.12.5' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1' + testCompile 'org.xmlunit:xmlunit-core:2.8.3' + testCompile 'org.xmlunit:xmlunit-matchers:2.8.3' + testCompile 'com.fasterxml.jackson.core:jackson-core:2.13.0' + testCompile 'com.fasterxml.jackson.core:jackson-databind:2.13.0' } tasks.withType(JavaCompile) { From 1c447e26f9a96facebafad115527dbcb540206df Mon Sep 17 00:00:00 2001 From: Alexey Sosnoviy Date: Wed, 10 Nov 2021 23:00:19 +0300 Subject: [PATCH 07/17] v2.6.1 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 9a5b8b5..ecbef8f 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ plugins { } group 'com.clouds42' -version '2.5.2' +version '2.6.1' sourceCompatibility = 11 From a34d4437f6e12cd82d5d79a7cf730a61a813f7ff Mon Sep 17 00:00:00 2001 From: Alexey Sosnoviy Date: Tue, 22 Feb 2022 23:03:25 +0300 Subject: [PATCH 08/17] typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 86cdbc0..087e64a 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ https://42clouds.com/ru-ru/techdocs/raschyot-pokrytiya-koda-1C-testami.html путём ручного зарпуска дебаг сервера dbgs.exe (например так: ```dbgs.exe --addr=127.0.0.1 --port=1550```), к которому будет подключаться Coverage41C и клиент файловой базы (запущенный с флагами ```/debug -http -attach /debuggerURL «адрес отладчика»``` или через меню "Настройка->Параметры->Сервер отладки" в самом клиенте), см. https://its.1c.ru/db/v837doc#bookmark:adm:TI000000495 - *Примечание: если включить протокол отладки http через конфигуратор Сервис -> Параметры -> Отладка, то Coverage41C не сможет подключиться к серверу отладки, т.к. одновременно к информационной базе может быть подключен только один интерфей отладки.* + *Примечание: если включить протокол отладки http через конфигуратор Сервис -> Параметры -> Отладка, то Coverage41C не сможет подключиться к серверу отладки, т.к. одновременно к информационной базе может быть подключен только один интерфейс отладки.* 3) Проверяем что сервер отладки dbgs.exe (https://its.1c.ru/db/edtdoc/content/197/hdoc/_top/dbgs) запустился и работает. Для этого в браузере открываем его, адрес по умолчанию http://127.0.0.1:1550/. В случае успеха выдолжны увидеть сообщение "... it works!". 4) Выгружаем исходники конфигурации, расширения или внешней обработки в файлы (если у вас проекта EDT, то этот шаг пропускаем - он и так хранится в файлах) From 9649b00d12452f24754609b5c6864ca934b3ade6 Mon Sep 17 00:00:00 2001 From: Alexey Sosnoviy Date: Tue, 22 Feb 2022 23:03:46 +0300 Subject: [PATCH 09/17] dependency bump --- build.gradle | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/build.gradle b/build.gradle index ecbef8f..8c78c38 100644 --- a/build.gradle +++ b/build.gradle @@ -39,8 +39,8 @@ dependencies { } println 'EDT location: ' + edtLocation - compile group: 'info.picocli', name: 'picocli', version: '4.6.1' - annotationProcessor 'info.picocli:picocli-codegen:4.6.1' + compile group: 'info.picocli', name: 'picocli', version: '4.6.3' + annotationProcessor 'info.picocli:picocli-codegen:4.6.2' compile group: 'org.slf4j', name: 'slf4j-api', version: '2.0.0-alpha1' compile group: 'org.slf4j', name: 'slf4j-simple', version: '2.0.0-alpha1' @@ -51,24 +51,24 @@ dependencies { compile group: 'org.eclipse.emf', name: 'org.eclipse.emf.ecore.xmi', version: '2.16.0' compile group: 'org.eclipse.emf', name: 'org.eclipse.emf.ecore.xcore.lib', version: '1.6.0' - compile group: 'org.eclipse.platform', name: 'org.eclipse.osgi', version: '3.17.0' + compile group: 'org.eclipse.platform', name: 'org.eclipse.osgi', version: '3.17.100' - compile group: 'org.eclipse.platform', name: 'org.eclipse.core.runtime', version: '3.23.0' + compile group: 'org.eclipse.platform', name: 'org.eclipse.core.runtime', version: '3.24.0' compile group: 'org.eclipse.platform', name: 'org.eclipse.osgi.services', version: '3.10.200' - compile group: 'org.eclipse.platform', name: 'org.eclipse.equinox.common', version: '3.15.0' + compile group: 'org.eclipse.platform', name: 'org.eclipse.equinox.common', version: '3.15.100' compile group: 'org.eclipse.jetty', name: 'jetty-client', version: '11.0.6' compile group: 'com.google.guava', name: 'guava', version: '31.0.1-jre' - compile group: 'com.google.inject', name: 'guice', version: '5.0.1' + compile group: 'com.google.inject', name: 'guice', version: '5.1.0' compile group: 'de.vandermeer', name:'asciitable', version: '0.3.2' - implementation 'com.github.1c-syntax:mdclasses:a5ce5cd5439201040caf27fdc8e4763a7f45f65c' + implementation 'com.github.1c-syntax:mdclasses:0.9.3' - implementation('com.github.1c-syntax:bsl-parser:0.19.4') { + implementation('com.github.1c-syntax:bsl-parser:0.20.3') { exclude group: "com.tunnelvisionlabs", module: "antlr4-annotations" exclude group: "com.ibm.icu", module: "*" exclude group: "org.antlr", module: "ST4" @@ -79,12 +79,12 @@ dependencies { providedCompile fileTree(edtLocation) { include 'com._1c.g5.v8.dt.debug.*.jar' } - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1' - testCompile 'org.xmlunit:xmlunit-core:2.8.3' - testCompile 'org.xmlunit:xmlunit-matchers:2.8.3' - testCompile 'com.fasterxml.jackson.core:jackson-core:2.13.0' - testCompile 'com.fasterxml.jackson.core:jackson-databind:2.13.0' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2' + testCompile 'org.xmlunit:xmlunit-core:2.9.0' + testCompile 'org.xmlunit:xmlunit-matchers:2.9.0' + testCompile 'com.fasterxml.jackson.core:jackson-core:2.13.1' + testCompile 'com.fasterxml.jackson.core:jackson-databind:2.13.1' } tasks.withType(JavaCompile) { From 1f4cb68e77432e28fce24ca670ac9c8df8a1f4ec Mon Sep 17 00:00:00 2001 From: Alexey Sosnoviy Date: Tue, 22 Feb 2022 23:04:56 +0300 Subject: [PATCH 10/17] v2.6.2 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 8c78c38..a41ca05 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ plugins { } group 'com.clouds42' -version '2.6.1' +version '2.6.2' sourceCompatibility = 11 From 8908886c0f659995c474f1a7df3b70b92c01b120 Mon Sep 17 00:00:00 2001 From: Alexey Sosnoviy Date: Wed, 23 Feb 2022 14:12:07 +0300 Subject: [PATCH 11/17] =?UTF-8?q?=D0=92=20rawMode=20=D0=BB=D0=BE=D0=B3?= =?UTF-8?q?=D0=B8=D1=80=D1=83=D0=B5=D1=82=D1=81=D1=8F=20=D0=B2=D1=81=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/clouds42/Commands/CoverageCommand.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/clouds42/Commands/CoverageCommand.java b/src/main/java/com/clouds42/Commands/CoverageCommand.java index 5d533ba..adb0d0b 100644 --- a/src/main/java/com/clouds42/Commands/CoverageCommand.java +++ b/src/main/java/com/clouds42/Commands/CoverageCommand.java @@ -232,8 +232,9 @@ private void measureResultProcessing(Map uriListByKey, Set externalDataProcessorsUriSet.add(moduleUrl); } String moduleExtensionName = moduleId.getExtensionName(); - if (filterOptions.getExtensionName().equals(moduleExtensionName) - && filterOptions.getExternalDataProcessorUrl().equals(moduleUrl)) { + if (rawMode + || (filterOptions.getExtensionName().equals(moduleExtensionName) + && filterOptions.getExternalDataProcessorUrl().equals(moduleUrl))) { String objectId = moduleId.getObjectID(); String propertyId = moduleId.getPropertyID(); String key = Utils.getUriKey(objectId, propertyId); From 4e80386951c83b46bed03045396f97c52d3369aa Mon Sep 17 00:00:00 2001 From: Alexey Sosnoviy Date: Wed, 23 Feb 2022 14:12:26 +0300 Subject: [PATCH 12/17] =?UTF-8?q?=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=82?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/clouds42/Commands/CoverageCommand.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/clouds42/Commands/CoverageCommand.java b/src/main/java/com/clouds42/Commands/CoverageCommand.java index adb0d0b..dde950f 100644 --- a/src/main/java/com/clouds42/Commands/CoverageCommand.java +++ b/src/main/java/com/clouds42/Commands/CoverageCommand.java @@ -45,11 +45,11 @@ import picocli.CommandLine.Command; import picocli.CommandLine.Mixin; import picocli.CommandLine.Option; -import java.lang.module.ModuleDescriptor.Version; import java.io.IOException; import java.io.PrintWriter; import java.lang.invoke.MethodHandles; +import java.lang.module.ModuleDescriptor.Version; import java.math.BigDecimal; import java.net.URI; import java.nio.file.Files; @@ -300,7 +300,7 @@ private void startSystem(UUID measureUuid) throws RuntimeDebugClientException { throw new RuntimeDebugClientException("Can't connect to debug server. Connection result: " + connectionResult); } } - Version apiver = Version.parse(client.getApiVersion()); + Version apiver = Version.parse(client.getApiVersion()); logger.info("Setup settings..."); client.initSettings(false); client.setAutoconnectDebugTargets( @@ -343,7 +343,7 @@ protected void gracefulShutdown(PrintWriter serverPipeOut) { } Utils.dumpCoverageFile(coverageData, metadataOptions, outputOptions); - if(serverPipeOut!=null) { + if (serverPipeOut != null) { serverPipeOut.println(PipeMessages.OK_RESULT); } stopExecution.set(true); From 967edc139d6ca73f62ff7fde093f3e23db52f51c Mon Sep 17 00:00:00 2001 From: Alexey Sosnoviy Date: Wed, 23 Feb 2022 14:21:06 +0300 Subject: [PATCH 13/17] v2.7.1 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index a41ca05..232b8ea 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ plugins { } group 'com.clouds42' -version '2.6.2' +version '2.7.1' sourceCompatibility = 11 From 24d5bfe82207f267c125965a1bd5567cc3df9bfd Mon Sep 17 00:00:00 2001 From: Alexey Sosnoviy Date: Wed, 23 Feb 2022 15:08:25 +0300 Subject: [PATCH 14/17] Happy new year! --- src/main/java/com/clouds42/AbstractDebugClient.java | 2 +- .../java/com/clouds42/CommandLineOptions/ConnectionOptions.java | 2 +- .../java/com/clouds42/CommandLineOptions/ConvertOptions.java | 2 +- .../java/com/clouds42/CommandLineOptions/DebuggerOptions.java | 2 +- .../java/com/clouds42/CommandLineOptions/FilterOptions.java | 2 +- .../java/com/clouds42/CommandLineOptions/LoggingOptions.java | 2 +- .../java/com/clouds42/CommandLineOptions/MetadataOptions.java | 2 +- .../java/com/clouds42/CommandLineOptions/OutputOptions.java | 2 +- src/main/java/com/clouds42/Commands/ConvertCommand.java | 2 +- src/main/java/com/clouds42/Commands/CoverServer.java | 2 +- src/main/java/com/clouds42/Commands/CoverageCommand.java | 2 +- .../java/com/clouds42/Commands/SendCheckMessageCommand.java | 2 +- .../java/com/clouds42/Commands/SendCleanMessageCommand.java | 2 +- src/main/java/com/clouds42/Commands/SendDumpMessageCommand.java | 2 +- src/main/java/com/clouds42/Commands/SendMessageCommand.java | 2 +- .../java/com/clouds42/Commands/SendStatsMessageCommand.java | 2 +- src/main/java/com/clouds42/Commands/SendStopMessageCommand.java | 2 +- src/main/java/com/clouds42/Coverage41C.java | 2 +- src/main/java/com/clouds42/DebugClient.java | 2 +- src/main/java/com/clouds42/GlobalCallsFilter.java | 2 +- src/main/java/com/clouds42/LinesToCoverage.java | 2 +- .../java/com/clouds42/MyRuntimeDebugModelXmlSerializer.java | 2 +- src/main/java/com/clouds42/PipeMessages.java | 2 +- src/main/java/com/clouds42/Utils.java | 2 +- src/test/java/com/clouds42/ConvertTest.java | 2 +- src/test/java/com/clouds42/CoverageTest.java | 2 +- src/test/java/com/clouds42/LinesToCoverageTest.java | 2 +- src/test/java/com/clouds42/TestUtils.java | 2 +- src/test/java/com/clouds42/UtilsTest.java | 2 +- 29 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/main/java/com/clouds42/AbstractDebugClient.java b/src/main/java/com/clouds42/AbstractDebugClient.java index e9b3f8c..61b0689 100644 --- a/src/main/java/com/clouds42/AbstractDebugClient.java +++ b/src/main/java/com/clouds42/AbstractDebugClient.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/clouds42/CommandLineOptions/ConnectionOptions.java b/src/main/java/com/clouds42/CommandLineOptions/ConnectionOptions.java index 372ca7e..a16d109 100644 --- a/src/main/java/com/clouds42/CommandLineOptions/ConnectionOptions.java +++ b/src/main/java/com/clouds42/CommandLineOptions/ConnectionOptions.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/clouds42/CommandLineOptions/ConvertOptions.java b/src/main/java/com/clouds42/CommandLineOptions/ConvertOptions.java index f2c6ef1..8b2b149 100644 --- a/src/main/java/com/clouds42/CommandLineOptions/ConvertOptions.java +++ b/src/main/java/com/clouds42/CommandLineOptions/ConvertOptions.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/clouds42/CommandLineOptions/DebuggerOptions.java b/src/main/java/com/clouds42/CommandLineOptions/DebuggerOptions.java index d39c33b..a46c0ec 100644 --- a/src/main/java/com/clouds42/CommandLineOptions/DebuggerOptions.java +++ b/src/main/java/com/clouds42/CommandLineOptions/DebuggerOptions.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/clouds42/CommandLineOptions/FilterOptions.java b/src/main/java/com/clouds42/CommandLineOptions/FilterOptions.java index b20c8f7..da9e345 100644 --- a/src/main/java/com/clouds42/CommandLineOptions/FilterOptions.java +++ b/src/main/java/com/clouds42/CommandLineOptions/FilterOptions.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/clouds42/CommandLineOptions/LoggingOptions.java b/src/main/java/com/clouds42/CommandLineOptions/LoggingOptions.java index 1af5f5d..86173ea 100644 --- a/src/main/java/com/clouds42/CommandLineOptions/LoggingOptions.java +++ b/src/main/java/com/clouds42/CommandLineOptions/LoggingOptions.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/clouds42/CommandLineOptions/MetadataOptions.java b/src/main/java/com/clouds42/CommandLineOptions/MetadataOptions.java index 19da877..fffc00a 100644 --- a/src/main/java/com/clouds42/CommandLineOptions/MetadataOptions.java +++ b/src/main/java/com/clouds42/CommandLineOptions/MetadataOptions.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/clouds42/CommandLineOptions/OutputOptions.java b/src/main/java/com/clouds42/CommandLineOptions/OutputOptions.java index 71f3768..ff8f3c8 100644 --- a/src/main/java/com/clouds42/CommandLineOptions/OutputOptions.java +++ b/src/main/java/com/clouds42/CommandLineOptions/OutputOptions.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/clouds42/Commands/ConvertCommand.java b/src/main/java/com/clouds42/Commands/ConvertCommand.java index 703eba4..0b94cac 100644 --- a/src/main/java/com/clouds42/Commands/ConvertCommand.java +++ b/src/main/java/com/clouds42/Commands/ConvertCommand.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/clouds42/Commands/CoverServer.java b/src/main/java/com/clouds42/Commands/CoverServer.java index 8f82164..c74b0a2 100644 --- a/src/main/java/com/clouds42/Commands/CoverServer.java +++ b/src/main/java/com/clouds42/Commands/CoverServer.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/clouds42/Commands/CoverageCommand.java b/src/main/java/com/clouds42/Commands/CoverageCommand.java index dde950f..33ceabd 100644 --- a/src/main/java/com/clouds42/Commands/CoverageCommand.java +++ b/src/main/java/com/clouds42/Commands/CoverageCommand.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/clouds42/Commands/SendCheckMessageCommand.java b/src/main/java/com/clouds42/Commands/SendCheckMessageCommand.java index 24864aa..7f056e3 100644 --- a/src/main/java/com/clouds42/Commands/SendCheckMessageCommand.java +++ b/src/main/java/com/clouds42/Commands/SendCheckMessageCommand.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/clouds42/Commands/SendCleanMessageCommand.java b/src/main/java/com/clouds42/Commands/SendCleanMessageCommand.java index eaab80d..caf0443 100644 --- a/src/main/java/com/clouds42/Commands/SendCleanMessageCommand.java +++ b/src/main/java/com/clouds42/Commands/SendCleanMessageCommand.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/clouds42/Commands/SendDumpMessageCommand.java b/src/main/java/com/clouds42/Commands/SendDumpMessageCommand.java index d8b8522..ce83373 100644 --- a/src/main/java/com/clouds42/Commands/SendDumpMessageCommand.java +++ b/src/main/java/com/clouds42/Commands/SendDumpMessageCommand.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/clouds42/Commands/SendMessageCommand.java b/src/main/java/com/clouds42/Commands/SendMessageCommand.java index 85214ac..27706d2 100644 --- a/src/main/java/com/clouds42/Commands/SendMessageCommand.java +++ b/src/main/java/com/clouds42/Commands/SendMessageCommand.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/clouds42/Commands/SendStatsMessageCommand.java b/src/main/java/com/clouds42/Commands/SendStatsMessageCommand.java index 5cd1e5f..de5356f 100644 --- a/src/main/java/com/clouds42/Commands/SendStatsMessageCommand.java +++ b/src/main/java/com/clouds42/Commands/SendStatsMessageCommand.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/clouds42/Commands/SendStopMessageCommand.java b/src/main/java/com/clouds42/Commands/SendStopMessageCommand.java index 0005c58..b29e55f 100644 --- a/src/main/java/com/clouds42/Commands/SendStopMessageCommand.java +++ b/src/main/java/com/clouds42/Commands/SendStopMessageCommand.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/clouds42/Coverage41C.java b/src/main/java/com/clouds42/Coverage41C.java index c510ffe..dfd8851 100644 --- a/src/main/java/com/clouds42/Coverage41C.java +++ b/src/main/java/com/clouds42/Coverage41C.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/clouds42/DebugClient.java b/src/main/java/com/clouds42/DebugClient.java index 42137fc..558f89e 100644 --- a/src/main/java/com/clouds42/DebugClient.java +++ b/src/main/java/com/clouds42/DebugClient.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/clouds42/GlobalCallsFilter.java b/src/main/java/com/clouds42/GlobalCallsFilter.java index 7a3376b..703a4cd 100644 --- a/src/main/java/com/clouds42/GlobalCallsFilter.java +++ b/src/main/java/com/clouds42/GlobalCallsFilter.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/clouds42/LinesToCoverage.java b/src/main/java/com/clouds42/LinesToCoverage.java index 2384333..a847dfd 100644 --- a/src/main/java/com/clouds42/LinesToCoverage.java +++ b/src/main/java/com/clouds42/LinesToCoverage.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/clouds42/MyRuntimeDebugModelXmlSerializer.java b/src/main/java/com/clouds42/MyRuntimeDebugModelXmlSerializer.java index 941576a..ac4d622 100644 --- a/src/main/java/com/clouds42/MyRuntimeDebugModelXmlSerializer.java +++ b/src/main/java/com/clouds42/MyRuntimeDebugModelXmlSerializer.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/clouds42/PipeMessages.java b/src/main/java/com/clouds42/PipeMessages.java index a166a09..64ceb1e 100644 --- a/src/main/java/com/clouds42/PipeMessages.java +++ b/src/main/java/com/clouds42/PipeMessages.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/clouds42/Utils.java b/src/main/java/com/clouds42/Utils.java index 7988eeb..e0c8651 100644 --- a/src/main/java/com/clouds42/Utils.java +++ b/src/main/java/com/clouds42/Utils.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/test/java/com/clouds42/ConvertTest.java b/src/test/java/com/clouds42/ConvertTest.java index e54480e..b3ed8aa 100644 --- a/src/test/java/com/clouds42/ConvertTest.java +++ b/src/test/java/com/clouds42/ConvertTest.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/test/java/com/clouds42/CoverageTest.java b/src/test/java/com/clouds42/CoverageTest.java index eed2ad7..e493dec 100644 --- a/src/test/java/com/clouds42/CoverageTest.java +++ b/src/test/java/com/clouds42/CoverageTest.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/test/java/com/clouds42/LinesToCoverageTest.java b/src/test/java/com/clouds42/LinesToCoverageTest.java index 451cc19..1b4b177 100644 --- a/src/test/java/com/clouds42/LinesToCoverageTest.java +++ b/src/test/java/com/clouds42/LinesToCoverageTest.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/test/java/com/clouds42/TestUtils.java b/src/test/java/com/clouds42/TestUtils.java index e6f4580..c319885 100644 --- a/src/test/java/com/clouds42/TestUtils.java +++ b/src/test/java/com/clouds42/TestUtils.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/test/java/com/clouds42/UtilsTest.java b/src/test/java/com/clouds42/UtilsTest.java index b254149..8e076be 100644 --- a/src/test/java/com/clouds42/UtilsTest.java +++ b/src/test/java/com/clouds42/UtilsTest.java @@ -1,7 +1,7 @@ /* * This file is a part of Coverage41C. * - * Copyright (c) 2020-2021 + * Copyright (c) 2020-2022 * Kosolapov Stanislav aka proDOOMman and contributors * * SPDX-License-Identifier: LGPL-3.0-or-later From 6408d98b1571e47eb0af62dc185cf8045f9fd6e7 Mon Sep 17 00:00:00 2001 From: Alexey Sosnoviy Date: Sat, 5 Mar 2022 20:53:12 +0300 Subject: [PATCH 15/17] =?UTF-8?q?=D0=98=D0=BD=D0=B0=D1=87=D0=B5=D0=95?= =?UTF-8?q?=D1=81=D0=BB=D0=B8=20=D0=BA=20=D0=BF=D0=BE=D0=BA=D1=80=D1=8B?= =?UTF-8?q?=D1=82=D0=B8=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/clouds42/LinesToCoverage.java | 1 + .../com/clouds42/LinesToCoverageTest.java | 12 ++++++++++ src/test/resources/linestocoverage/if.bsl | 23 +++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 src/test/resources/linestocoverage/if.bsl diff --git a/src/main/java/com/clouds42/LinesToCoverage.java b/src/main/java/com/clouds42/LinesToCoverage.java index a847dfd..2ec1d0c 100644 --- a/src/main/java/com/clouds42/LinesToCoverage.java +++ b/src/main/java/com/clouds42/LinesToCoverage.java @@ -41,6 +41,7 @@ public class LinesToCoverage { BSLParser.BreakStatementContext.class, BSLParser.ContinueStatementContext.class, BSLParser.IfStatementContext.class, + BSLParser.ElsifBranchContext.class, BSLParser.RaiseStatementContext.class, BSLParser.ForEachStatementContext.class, BSLParser.ForStatementContext.class, diff --git a/src/test/java/com/clouds42/LinesToCoverageTest.java b/src/test/java/com/clouds42/LinesToCoverageTest.java index 1b4b177..d18aba7 100644 --- a/src/test/java/com/clouds42/LinesToCoverageTest.java +++ b/src/test/java/com/clouds42/LinesToCoverageTest.java @@ -78,6 +78,18 @@ void SimpleTest() throws IOException { assertThat(linesToCover, equalTo(expected)); } + @Test + void IfTest() throws IOException { + + var file = new File("src/test/resources/linestocoverage/if.bsl"); + BSLTokenizer tokenizer = new BSLTokenizer(Files.readString(file.toPath())); + + int[] linesToCover = LinesToCoverage.getLines(tokenizer.getAst()); + + var expected = new int[]{3, 8, 10, 16, 17, 19, 21, 22, 23}; + assertThat(linesToCover, equalTo(expected)); + } + @Test void AssigmentTest() throws IOException { diff --git a/src/test/resources/linestocoverage/if.bsl b/src/test/resources/linestocoverage/if.bsl new file mode 100644 index 0000000..f39be0e --- /dev/null +++ b/src/test/resources/linestocoverage/if.bsl @@ -0,0 +1,23 @@ +Функция Условие(А, Б) + + Если + А + = + Б + Тогда + Возврат + Истина; + ИначеЕсли + А + = + "М" + Тогда + Иначе + Возврат Истина; + КонецЕсли; + +КонецФункции + +Условие("В", "В"); +Условие("В", "М"); +Условие("В", "Г"); From a665cefe17f1fdd8735443e13f059655ea2b6408 Mon Sep 17 00:00:00 2001 From: Alexey Sosnoviy Date: Wed, 1 Sep 2021 11:13:44 +0300 Subject: [PATCH 16/17] DebugTargetType --- build.gradle | 10 +- .../CommandLineOptions/DebuggerOptions.java | 3 +- src/main/java/com/clouds42/DebugClient.java | 11 ++- .../java/com/clouds42/DebugTargetType.java | 92 +++++++++++++++++++ 4 files changed, 109 insertions(+), 7 deletions(-) create mode 100644 src/main/java/com/clouds42/DebugTargetType.java diff --git a/build.gradle b/build.gradle index 232b8ea..e6561a2 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,7 @@ repositories { configurations { - providedCompile + providedRuntime } dependencies { @@ -77,7 +77,7 @@ dependencies { exclude group: "org.glassfish", module: "javax.json" } - providedCompile fileTree(edtLocation) { include 'com._1c.g5.v8.dt.debug.*.jar' } + providedRuntime fileTree(edtLocation) { include 'com._1c.g5.v8.dt.debug.*.jar' } testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2' @@ -88,18 +88,18 @@ dependencies { } tasks.withType(JavaCompile) { - sourceSets.main.compileClasspath += configurations.providedCompile + sourceSets.main.compileClasspath += configurations.providedRuntime options.compilerArgs += ["-Aproject=${project.group}/${project.name}"] options.encoding = 'UTF-8' } run { - classpath += configurations.providedCompile + classpath += configurations.providedRuntime } test { finalizedBy jacocoTestReport - classpath += configurations.providedCompile + classpath += configurations.providedRuntime useJUnitPlatform() testLogging.showStandardStreams = true } diff --git a/src/main/java/com/clouds42/CommandLineOptions/DebuggerOptions.java b/src/main/java/com/clouds42/CommandLineOptions/DebuggerOptions.java index a46c0ec..210caa7 100644 --- a/src/main/java/com/clouds42/CommandLineOptions/DebuggerOptions.java +++ b/src/main/java/com/clouds42/CommandLineOptions/DebuggerOptions.java @@ -21,7 +21,8 @@ */ package com.clouds42.CommandLineOptions; -import com._1c.g5.v8.dt.debug.model.base.data.DebugTargetType; + +import com.clouds42.DebugTargetType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import picocli.CommandLine.Option; diff --git a/src/main/java/com/clouds42/DebugClient.java b/src/main/java/com/clouds42/DebugClient.java index 558f89e..9daaa61 100644 --- a/src/main/java/com/clouds42/DebugClient.java +++ b/src/main/java/com/clouds42/DebugClient.java @@ -332,13 +332,22 @@ public List getDebugAreas() throws RuntimeDebugClientException { public void setAutoconnectDebugTargets(List debugAreaNames, List debugTargets) throws RuntimeDebugClientException { RDBGSetAutoAttachSettingsRequest requestContent = ResponseFactory.eINSTANCE.createRDBGSetAutoAttachSettingsRequest(); DebugAutoAttachSettings settings = AttachFactory.eINSTANCE.createDebugAutoAttachSettings(); - settings.getTargetType().addAll(debugTargets); + + List v8debugTypes = debugTargets.stream() + .map(type -> castByName(type, com._1c.g5.v8.dt.debug.model.base.data.DebugTargetType.class)) + .collect(Collectors.toList()); + + settings.getTargetType().addAll(v8debugTypes); settings.getAreaName().addAll(debugAreaNames); requestContent.setAutoAttachSettings(settings); Request request = this.buildRequest(HttpMethod.POST, this.debugComponentUrl).param("cmd", "setAutoAttachSettings"); this.performRuntimeHttpRequest(request, this.initRequest(requestContent)); } + public > F castByName(final Enum e, final Class fClass) { + return F.valueOf(fClass, e.name()); + } + public void toggleProfiling(UUID uuid) throws RuntimeDebugClientException { RDBGSetMeasureModeRequest requestContent = ResponseFactory.eINSTANCE.createRDBGSetMeasureModeRequest(); if (uuid != null) { diff --git a/src/main/java/com/clouds42/DebugTargetType.java b/src/main/java/com/clouds42/DebugTargetType.java new file mode 100644 index 0000000..bdb7c41 --- /dev/null +++ b/src/main/java/com/clouds42/DebugTargetType.java @@ -0,0 +1,92 @@ +/* + * This file is a part of Coverage41C. + * + * Copyright (c) 2020-2021 + * Kosolapov Stanislav aka proDOOMman and contributors + * + * SPDX-License-Identifier: LGPL-3.0-or-later + * + * Coverage41C is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3.0 of the License, or (at your option) any later version. + * + * Coverage41C is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Coverage41C. + */ +package com.clouds42; + +import org.eclipse.emf.common.util.Enumerator; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public enum DebugTargetType implements Enumerator { + UNKNOWN(0, "Unknown", "Unknown"), + CLIENT(1, "Client", "Client"), + MANAGED_CLIENT(2, "ManagedClient", "ManagedClient"), + WEB_CLIENT(3, "WEBClient", "WEBClient"), + COM_CONNECTOR(4, "COMConnector", "COMConnector"), + SERVER(5, "Server", "Server"), + SERVER_EMULATION(6, "ServerEmulation", "ServerEmulation"), + WEB_SERVICE(7, "WEBService", "WEBService"), + HTTP_SERVICE(8, "HTTPService", "HTTPService"), + ODATA(9, "OData", "OData"), + JOB(10, "JOB", "JOB"), + JOB_FILE_MODE(11, "JobFileMode", "JobFileMode"), + MOBILE_CLIENT(12, "MobileClient", "MobileClient"), + MOBILE_SERVER(13, "MobileServer", "MobileServer"), + MOBILE_JOB_FILE_MODE(14, "MobileJobFileMode", "MobileJobFileMode"), + MOBILE_MANAGED_CLIENT(15, "MobileManagedClient", "MobileManagedClient"); + + public static final int UNKNOWN_VALUE = 0; + public static final int CLIENT_VALUE = 1; + public static final int MANAGED_CLIENT_VALUE = 2; + public static final int WEB_CLIENT_VALUE = 3; + public static final int COM_CONNECTOR_VALUE = 4; + public static final int SERVER_VALUE = 5; + public static final int SERVER_EMULATION_VALUE = 6; + public static final int WEB_SERVICE_VALUE = 7; + public static final int HTTP_SERVICE_VALUE = 8; + public static final int ODATA_VALUE = 9; + public static final int JOB_VALUE = 10; + public static final int JOB_FILE_MODE_VALUE = 11; + public static final int MOBILE_CLIENT_VALUE = 12; + public static final int MOBILE_SERVER_VALUE = 13; + public static final int MOBILE_JOB_FILE_MODE_VALUE = 14; + public static final int MOBILE_MANAGED_CLIENT_VALUE = 15; + private static final DebugTargetType[] VALUES_ARRAY = new DebugTargetType[]{UNKNOWN, CLIENT, MANAGED_CLIENT, WEB_CLIENT, COM_CONNECTOR, SERVER, SERVER_EMULATION, WEB_SERVICE, HTTP_SERVICE, ODATA, JOB, JOB_FILE_MODE, MOBILE_CLIENT, MOBILE_SERVER, MOBILE_JOB_FILE_MODE, MOBILE_MANAGED_CLIENT}; + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + private final int value; + private final String name; + private final String literal; + + private DebugTargetType(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + public int getValue() { + return this.value; + } + + public String getName() { + return this.name; + } + + public String getLiteral() { + return this.literal; + } + + public String toString() { + return this.literal; + } +} + From fa331d851d5aa78f236e1d116989a2f51206d584 Mon Sep 17 00:00:00 2001 From: Alexey Sosnoviy Date: Wed, 1 Sep 2021 11:14:22 +0300 Subject: [PATCH 17/17] =?UTF-8?q?=D0=92=D1=8B=D0=BD=D0=BE=D1=81=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BA=D1=80=D1=8B=D1=82=D0=B8=D1=8F=20=D0=B8=D0=B7=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../clouds42/Commands/CoverageCommand.java | 330 +-------------- src/main/java/com/clouds42/Coverager.java | 397 ++++++++++++++++++ 2 files changed, 410 insertions(+), 317 deletions(-) create mode 100644 src/main/java/com/clouds42/Coverager.java diff --git a/src/main/java/com/clouds42/Commands/CoverageCommand.java b/src/main/java/com/clouds42/Commands/CoverageCommand.java index 33ceabd..5e0a612 100644 --- a/src/main/java/com/clouds42/Commands/CoverageCommand.java +++ b/src/main/java/com/clouds42/Commands/CoverageCommand.java @@ -21,50 +21,27 @@ */ package com.clouds42.Commands; -import com._1c.g5.v8.dt.debug.core.runtime.client.RuntimeDebugClientException; -import com._1c.g5.v8.dt.debug.model.base.data.AttachDebugUIResult; -import com._1c.g5.v8.dt.debug.model.base.data.BSLModuleIdInternal; -import com._1c.g5.v8.dt.debug.model.base.data.DebugTargetId; -import com._1c.g5.v8.dt.debug.model.dbgui.commands.DBGUIExtCmdInfoBase; -import com._1c.g5.v8.dt.debug.model.dbgui.commands.DBGUIExtCmds; -import com._1c.g5.v8.dt.debug.model.dbgui.commands.impl.DBGUIExtCmdInfoMeasureImpl; -import com._1c.g5.v8.dt.debug.model.dbgui.commands.impl.DBGUIExtCmdInfoStartedImpl; -import com._1c.g5.v8.dt.debug.model.measure.PerformanceInfoLine; -import com._1c.g5.v8.dt.debug.model.measure.PerformanceInfoMain; -import com._1c.g5.v8.dt.debug.model.measure.PerformanceInfoModule; -import com._1c.g5.v8.dt.internal.debug.core.runtime.client.RuntimeDebugModelXmlSerializer; -import com.clouds42.CommandLineOptions.*; -import com.clouds42.DebugClient; -import com.clouds42.MyRuntimeDebugModelXmlSerializer; + +import com.clouds42.CommandLineOptions.ConnectionOptions; +import com.clouds42.CommandLineOptions.DebuggerOptions; +import com.clouds42.CommandLineOptions.FilterOptions; +import com.clouds42.CommandLineOptions.LoggingOptions; +import com.clouds42.CommandLineOptions.MetadataOptions; +import com.clouds42.CommandLineOptions.OutputOptions; +import com.clouds42.Coverager; import com.clouds42.PipeMessages; -import com.clouds42.Utils; -import org.eclipse.emf.common.util.EList; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import picocli.CommandLine; -import picocli.CommandLine.Command; import picocli.CommandLine.Mixin; +import picocli.CommandLine.Command; import picocli.CommandLine.Option; -import java.io.IOException; -import java.io.PrintWriter; -import java.lang.invoke.MethodHandles; -import java.lang.module.ModuleDescriptor.Version; -import java.math.BigDecimal; -import java.net.URI; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.*; import java.util.concurrent.Callable; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.stream.Stream; @Command(name = PipeMessages.START_COMMAND, mixinStandardHelpOptions = true, description = "Start measure and save coverage data to file", sortOptions = false) -public class CoverageCommand extends CoverServer implements Callable { +public class CoverageCommand implements Callable { - private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + private Coverager coverager; @Mixin private ConnectionOptions connectionOptions; @@ -87,292 +64,11 @@ public class CoverageCommand extends CoverServer implements Callable { @Option(names = {"--opid"}, description = "Owner process PID", defaultValue = "-1") Integer opid; - private DebugClient client; - - private final Map> coverageData = new HashMap<>() { - @Override - public Map get(Object key) { - Map map = super.get(key); - if (map == null) { - map = new HashMap<>(); - put((URI) key, map); - } - return map; - } - }; - - - private final AtomicBoolean stopExecution = new AtomicBoolean(false); - private boolean rawMode = false; - private boolean systemStarted = false; - - private void connectAllTargets(List debugTargets) { - logger.info("Current debug targets size: {}", debugTargets.size()); - debugTargets.forEach(debugTarget -> { - String id = debugTarget.getId(); - String seanceId = debugTarget.getSeanceId(); - String targetType = debugTarget.getTargetType().getName(); - logger.info("Id: {} , seance id: {} , target type: {}", id, seanceId, targetType); - try { - client.attachRuntimeDebugTargets(Collections.singletonList(UUID.fromString(debugTarget.getId()))); - } catch (RuntimeDebugClientException e) { - logger.error(e.getLocalizedMessage()); - } - }); - } - @Override public Integer call() throws Exception { + coverager= new Coverager(connectionOptions,filterOptions, metadataOptions, outputOptions, debuggerOptions, loggingOptions, opid); + return coverager.call(); - int result = CommandLine.ExitCode.OK; - getServerSocket(); - - - RuntimeDebugModelXmlSerializer serializer = new MyRuntimeDebugModelXmlSerializer(); - client = new DebugClient(serializer); - - UUID measureUuid = UUID.randomUUID(); - - rawMode = metadataOptions.isRawMode(); - - Map uriListByKey = Utils.readMetadata(metadataOptions, coverageData); - - try { - startSystem(measureUuid); - } catch (RuntimeDebugClientException e) { - logger.info("Connecting to dbgs failed"); - logger.error(e.getLocalizedMessage()); - result = CommandLine.ExitCode.SOFTWARE; - return result; - } - - addShutdownHook(); - - Set externalDataProcessorsUriSet = new HashSet<>(); - - try { - mainLoop(uriListByKey, externalDataProcessorsUriSet); - } catch (RuntimeDebugClientException e) { - logger.error("Can't send ping to debug server. Coverage analyzing finished"); - logger.error(e.getLocalizedMessage()); - e.printStackTrace(); - result = CommandLine.ExitCode.SOFTWARE; - } - Thread.sleep(debuggerOptions.getPingTimeout()); - - shutdown(); - return result; - } - - private void shutdown() throws IOException { - if (opid > 0 && !Utils.isProcessStillAlive(opid)) { - logger.info("Owner process stopped: {}", opid); - } - - gracefulShutdown(null); - - logger.info("Disconnecting from dbgs..."); - try { - client.disconnect(); - client.dispose(); - } catch (RuntimeDebugClientException e) { - logger.error(e.getLocalizedMessage()); - } - closeSocket(); - - logger.info("Main thread finished"); - stopExecution.set(true); - } - - private void addShutdownHook() { - Runtime.getRuntime().addShutdownHook(new Thread(() -> { - try { - shutdown(); - } catch (IOException e) { - logger.info("Shutdown error."); - e.printStackTrace(); - } - })); } - private void targetStarted(DBGUIExtCmdInfoStartedImpl command) { - DebugTargetId targetId = command.getTargetID(); - try { - client.attachRuntimeDebugTargets(Collections.singletonList(UUID.fromString(targetId.getId()))); - } catch (RuntimeDebugClientException e) { - logger.info("Command: {} error!", command.getCmdID().getName()); - logger.error(e.getLocalizedMessage()); - } - } - - private void mainLoop(Map uriListByKey, Set externalDataProcessorsUriSet) throws RuntimeDebugClientException { - while (!stopExecution.get()) { - List commandsList = client.ping(); - logger.info("Ping result commands size: {}", commandsList.size()); - commandsList.forEach(command -> { - logger.info("Command: {}", command.getCmdID().getName()); - if (command.getCmdID() == DBGUIExtCmds.MEASURE_RESULT_PROCESSING) { - measureResultProcessing(uriListByKey, externalDataProcessorsUriSet, (DBGUIExtCmdInfoMeasureImpl) command); - } else if (command.getCmdID() == DBGUIExtCmds.TARGET_STARTED) { - targetStarted((DBGUIExtCmdInfoStartedImpl) command); - } - }); - } - } - - private void measureResultProcessing(Map uriListByKey, Set externalDataProcessorsUriSet, DBGUIExtCmdInfoMeasureImpl command) { - logger.info("Found MEASURE_RESULT_PROCESSING command"); - PerformanceInfoMain measure = command.getMeasure(); - EList moduleInfoList = measure.getModuleData(); - moduleInfoList.forEach(moduleInfo -> { - BSLModuleIdInternal moduleId = moduleInfo.getModuleID(); - String moduleUrl = moduleId.getURL(); - if (loggingOptions.isVerbose() && !moduleUrl.isEmpty() && !externalDataProcessorsUriSet.contains(moduleUrl)) { - logger.info("Found external data processor: {}", moduleUrl); - externalDataProcessorsUriSet.add(moduleUrl); - } - String moduleExtensionName = moduleId.getExtensionName(); - if (rawMode - || (filterOptions.getExtensionName().equals(moduleExtensionName) - && filterOptions.getExternalDataProcessorUrl().equals(moduleUrl))) { - String objectId = moduleId.getObjectID(); - String propertyId = moduleId.getPropertyID(); - String key = Utils.getUriKey(objectId, propertyId); - - URI uri; - if (!rawMode) { - uri = uriListByKey.get(key); - } else { - uri = URI.create("file:///" + key); - } - if (uri == null) { - logger.info("Couldn't find object id {}, property id {} in sources!", objectId, propertyId); - } else { - EList lineInfoList = moduleInfo.getLineInfo(); - lineInfoList.forEach(lineInfo -> { - BigDecimal lineNo = lineInfo.getLineNo(); - Map coverMap = coverageData.get(uri); - if (!coverMap.isEmpty() || rawMode) { - if (!rawMode && !coverMap.containsKey(lineNo)) { - if (loggingOptions.isVerbose()) { - logger.info("Can't find line to cover {} in module {}", lineNo, uri); - try { - Stream all_lines = Files.lines(Paths.get(uri)); - Optional first = all_lines.skip(lineNo.longValue() - 1).findFirst(); - if (first.isPresent()) { - String specific_line_n = first.get(); - logger.info(">>> {}", specific_line_n); - } - } catch (Exception e) { - logger.error(e.getLocalizedMessage()); - } - } - } else { - int currentValue = coverMap.getOrDefault(lineNo, 0); - if (currentValue < 0) { - currentValue = 0; - } - coverMap.put(lineNo, - currentValue - + lineInfo.getFrequency().intValue()); - } - } - }); - } - } - }); - } - - private void startSystem(UUID measureUuid) throws RuntimeDebugClientException { - UUID debugServerUuid = UUID.randomUUID(); - client.configure( - connectionOptions.getDebugServerUrl(), - debugServerUuid, - connectionOptions.getInfobaseAlias()); - logger.info("Connecting to debugger..."); - AttachDebugUIResult connectionResult = client.connect(debuggerOptions.getPassword()); - if (connectionResult != AttachDebugUIResult.REGISTERED) { - if (connectionResult == AttachDebugUIResult.IB_IN_DEBUG) { - throw new RuntimeDebugClientException("Can't connect to debug server. IB is in debug. Close configurator or EDT first"); - } else if (connectionResult == AttachDebugUIResult.CREDENTIALS_REQUIRED) { - throw new RuntimeDebugClientException("Can't connect to debug server. Use -p option to set correct password"); - } else { - throw new RuntimeDebugClientException("Can't connect to debug server. Connection result: " + connectionResult); - } - } - Version apiver = Version.parse(client.getApiVersion()); - logger.info("Setup settings..."); - client.initSettings(false); - client.setAutoconnectDebugTargets( - debuggerOptions.getDebugAreaNames(), - debuggerOptions.getFilteredAutoconnectTargets(apiver)); - logger.info("Setup targets..."); - List debugTargets; - if (debuggerOptions.getDebugAreaNames().isEmpty()) { - debugTargets = client.getRuntimeDebugTargets(null); - } else { - debugTargets = new LinkedList<>(); - debuggerOptions.getDebugAreaNames().forEach(areaName -> { - try { - debugTargets.addAll(client.getRuntimeDebugTargets(areaName)); - } catch (RuntimeDebugClientException ex) { - logger.error(ex.getLocalizedMessage()); - } - }); - } - connectAllTargets(debugTargets); - - logger.info("Enabling profiling..."); - client.toggleProfiling(null); - client.toggleProfiling(measureUuid); - - systemStarted = true; - - } - - protected void gracefulShutdown(PrintWriter serverPipeOut) { - if (stopExecution.get()) { - return; - } - - logger.info("Disabling profiling..."); - try { - client.toggleProfiling(null); - } catch (RuntimeDebugClientException e) { - logger.error(e.getLocalizedMessage()); - } - - Utils.dumpCoverageFile(coverageData, metadataOptions, outputOptions); - if (serverPipeOut != null) { - serverPipeOut.println(PipeMessages.OK_RESULT); - } - stopExecution.set(true); - - logger.info("Bye!"); - } - - @Override - protected MetadataOptions getMetadataOptions() { - return metadataOptions; - } - - @Override - protected Map> getCoverageData() { - return coverageData; - } - - @Override - protected OutputOptions getOutputOptions() { - return outputOptions; - } - - @Override - public ConnectionOptions getConnectionOptions() { - return connectionOptions; - } - - @Override - protected boolean getSystemStarted() { - return systemStarted; - } } diff --git a/src/main/java/com/clouds42/Coverager.java b/src/main/java/com/clouds42/Coverager.java new file mode 100644 index 0000000..d3eb443 --- /dev/null +++ b/src/main/java/com/clouds42/Coverager.java @@ -0,0 +1,397 @@ +/* + * This file is a part of Coverage41C. + * + * Copyright (c) 2020-2021 + * Kosolapov Stanislav aka proDOOMman and contributors + * + * SPDX-License-Identifier: LGPL-3.0-or-later + * + * Coverage41C is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3.0 of the License, or (at your option) any later version. + * + * Coverage41C is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Coverage41C. + */ +package com.clouds42; + +import com._1c.g5.v8.dt.debug.core.runtime.client.RuntimeDebugClientException; +import com._1c.g5.v8.dt.debug.model.base.data.AttachDebugUIResult; +import com._1c.g5.v8.dt.debug.model.base.data.BSLModuleIdInternal; +import com._1c.g5.v8.dt.debug.model.base.data.DebugTargetId; +import com._1c.g5.v8.dt.debug.model.dbgui.commands.DBGUIExtCmdInfoBase; +import com._1c.g5.v8.dt.debug.model.dbgui.commands.DBGUIExtCmds; +import com._1c.g5.v8.dt.debug.model.dbgui.commands.impl.DBGUIExtCmdInfoMeasureImpl; +import com._1c.g5.v8.dt.debug.model.dbgui.commands.impl.DBGUIExtCmdInfoStartedImpl; +import com._1c.g5.v8.dt.debug.model.measure.PerformanceInfoLine; +import com._1c.g5.v8.dt.debug.model.measure.PerformanceInfoMain; +import com._1c.g5.v8.dt.debug.model.measure.PerformanceInfoModule; +import com._1c.g5.v8.dt.internal.debug.core.runtime.client.RuntimeDebugModelXmlSerializer; +import com.clouds42.CommandLineOptions.ConnectionOptions; +import com.clouds42.CommandLineOptions.DebuggerOptions; +import com.clouds42.CommandLineOptions.FilterOptions; +import com.clouds42.CommandLineOptions.LoggingOptions; +import com.clouds42.CommandLineOptions.MetadataOptions; +import com.clouds42.CommandLineOptions.OutputOptions; +import com.clouds42.Commands.CoverServer; +import org.eclipse.emf.common.util.EList; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import picocli.CommandLine; +import picocli.CommandLine.Option; + +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.invoke.MethodHandles; +import java.lang.module.ModuleDescriptor.Version; +import java.math.BigDecimal; +import java.net.URI; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.stream.Stream; + + +public class Coverager extends CoverServer { + + private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private ConnectionOptions connectionOptions; + + + private FilterOptions filterOptions; + + + private MetadataOptions metadataOptions; + + + private OutputOptions outputOptions; + + + private DebuggerOptions debuggerOptions; + + + private LoggingOptions loggingOptions; + + @Option(names = {"--opid"}, description = "Owner process PID", defaultValue = "-1") + Integer opid; + + private DebugClient client; + + private final Map> coverageData = new HashMap<>() { + @Override + public Map get(Object key) { + Map map = super.get(key); + if (map == null) { + map = new HashMap<>(); + put((URI) key, map); + } + return map; + } + }; + + + private final AtomicBoolean stopExecution = new AtomicBoolean(false); + private boolean rawMode = false; + private boolean systemStarted = false; + + public Coverager(ConnectionOptions connectionOptions, + FilterOptions filterOptions, + MetadataOptions metadataOptions, + OutputOptions outputOptions, + DebuggerOptions debuggerOptions, + LoggingOptions loggingOptions, + Integer opid) { + this.connectionOptions = connectionOptions; + this.filterOptions = filterOptions; + this.metadataOptions = metadataOptions; + this.outputOptions = outputOptions; + this.debuggerOptions = debuggerOptions; + this.loggingOptions = loggingOptions; + this.opid = opid; + } + + private void connectAllTargets(List debugTargets) { + logger.info("Current debug targets size: {}", debugTargets.size()); + debugTargets.forEach(debugTarget -> { + String id = debugTarget.getId(); + String seanceId = debugTarget.getSeanceId(); + String targetType = debugTarget.getTargetType().getName(); + logger.info("Id: {} , seance id: {} , target type: {}", id, seanceId, targetType); + try { + client.attachRuntimeDebugTargets(Collections.singletonList(UUID.fromString(debugTarget.getId()))); + } catch (RuntimeDebugClientException e) { + logger.error(e.getLocalizedMessage()); + } + }); + } + + + public Integer call() throws Exception { + + int result = CommandLine.ExitCode.OK; + getServerSocket(); + + + RuntimeDebugModelXmlSerializer serializer = new MyRuntimeDebugModelXmlSerializer(); + client = new DebugClient(serializer); + + UUID measureUuid = UUID.randomUUID(); + + rawMode = metadataOptions.isRawMode(); + + Map uriListByKey = Utils.readMetadata(metadataOptions, coverageData); + + try { + startSystem(measureUuid); + } catch (RuntimeDebugClientException e) { + logger.info("Connecting to dbgs failed"); + logger.error(e.getLocalizedMessage()); + result = CommandLine.ExitCode.SOFTWARE; + return result; + } + + addShutdownHook(); + + Set externalDataProcessorsUriSet = new HashSet<>(); + + try { + mainLoop(uriListByKey, externalDataProcessorsUriSet); + } catch (RuntimeDebugClientException e) { + logger.error("Can't send ping to debug server. Coverage analyzing finished"); + logger.error(e.getLocalizedMessage()); + e.printStackTrace(); + result = CommandLine.ExitCode.SOFTWARE; + } + Thread.sleep(debuggerOptions.getPingTimeout()); + + shutdown(); + return result; + } + + private void shutdown() throws IOException { + if (opid > 0 && !Utils.isProcessStillAlive(opid)) { + logger.info("Owner process stopped: {}", opid); + } + + gracefulShutdown(null); + + logger.info("Disconnecting from dbgs..."); + try { + client.disconnect(); + client.dispose(); + } catch (RuntimeDebugClientException e) { + logger.error(e.getLocalizedMessage()); + } + closeSocket(); + + logger.info("Main thread finished"); + stopExecution.set(true); + } + + private void addShutdownHook() { + Runtime.getRuntime().addShutdownHook(new Thread(() -> { + try { + shutdown(); + } catch (IOException e) { + logger.info("Shutdown error."); + e.printStackTrace(); + } + })); + } + + private void targetStarted(DBGUIExtCmdInfoStartedImpl command) { + DebugTargetId targetId = command.getTargetID(); + try { + client.attachRuntimeDebugTargets(Collections.singletonList(UUID.fromString(targetId.getId()))); + } catch (RuntimeDebugClientException e) { + logger.info("Command: {} error!", command.getCmdID().getName()); + logger.error(e.getLocalizedMessage()); + } + } + + private void mainLoop(Map uriListByKey, Set externalDataProcessorsUriSet) throws RuntimeDebugClientException { + while (!stopExecution.get()) { + List commandsList = client.ping(); + logger.info("Ping result commands size: {}", commandsList.size()); + commandsList.forEach(command -> { + logger.info("Command: {}", command.getCmdID().getName()); + if (command.getCmdID() == DBGUIExtCmds.MEASURE_RESULT_PROCESSING) { + measureResultProcessing(uriListByKey, externalDataProcessorsUriSet, (DBGUIExtCmdInfoMeasureImpl) command); + } else if (command.getCmdID() == DBGUIExtCmds.TARGET_STARTED) { + targetStarted((DBGUIExtCmdInfoStartedImpl) command); + } + }); + } + } + + private void measureResultProcessing(Map uriListByKey, Set externalDataProcessorsUriSet, DBGUIExtCmdInfoMeasureImpl command) { + logger.info("Found MEASURE_RESULT_PROCESSING command"); + PerformanceInfoMain measure = command.getMeasure(); + EList moduleInfoList = measure.getModuleData(); + moduleInfoList.forEach(moduleInfo -> { + BSLModuleIdInternal moduleId = moduleInfo.getModuleID(); + String moduleUrl = moduleId.getURL(); + if (loggingOptions.isVerbose() && !moduleUrl.isEmpty() && !externalDataProcessorsUriSet.contains(moduleUrl)) { + logger.info("Found external data processor: {}", moduleUrl); + externalDataProcessorsUriSet.add(moduleUrl); + } + String moduleExtensionName = moduleId.getExtensionName(); + if (filterOptions.getExtensionName().equals(moduleExtensionName) + && filterOptions.getExternalDataProcessorUrl().equals(moduleUrl)) { + String objectId = moduleId.getObjectID(); + String propertyId = moduleId.getPropertyID(); + String key = Utils.getUriKey(objectId, propertyId); + + URI uri; + if (!rawMode) { + uri = uriListByKey.get(key); + } else { + uri = URI.create("file:///" + key); + } + if (uri == null) { + logger.info("Couldn't find object id {}, property id {} in sources!", objectId, propertyId); + } else { + EList lineInfoList = moduleInfo.getLineInfo(); + lineInfoList.forEach(lineInfo -> { + BigDecimal lineNo = lineInfo.getLineNo(); + Map coverMap = coverageData.get(uri); + if (!coverMap.isEmpty() || rawMode) { + if (!rawMode && !coverMap.containsKey(lineNo)) { + if (loggingOptions.isVerbose()) { + logger.info("Can't find line to cover {} in module {}", lineNo, uri); + try { + Stream all_lines = Files.lines(Paths.get(uri)); + Optional first = all_lines.skip(lineNo.longValue() - 1).findFirst(); + if (first.isPresent()) { + String specific_line_n = first.get(); + logger.info(">>> {}", specific_line_n); + } + } catch (Exception e) { + logger.error(e.getLocalizedMessage()); + } + } + } else { + int currentValue = coverMap.getOrDefault(lineNo, 0); + if (currentValue < 0) { + currentValue = 0; + } + coverMap.put(lineNo, + currentValue + + lineInfo.getFrequency().intValue()); + } + } + }); + } + } + }); + } + + private void startSystem(UUID measureUuid) throws RuntimeDebugClientException { + UUID debugServerUuid = UUID.randomUUID(); + client.configure( + connectionOptions.getDebugServerUrl(), + debugServerUuid, + connectionOptions.getInfobaseAlias()); + logger.info("Connecting to debugger..."); + AttachDebugUIResult connectionResult = client.connect(debuggerOptions.getPassword()); + if (connectionResult != AttachDebugUIResult.REGISTERED) { + if (connectionResult == AttachDebugUIResult.IB_IN_DEBUG) { + throw new RuntimeDebugClientException("Can't connect to debug server. IB is in debug. Close configurator or EDT first"); + } else if (connectionResult == AttachDebugUIResult.CREDENTIALS_REQUIRED) { + throw new RuntimeDebugClientException("Can't connect to debug server. Use -p option to set correct password"); + } else { + throw new RuntimeDebugClientException("Can't connect to debug server. Connection result: " + connectionResult); + } + } + Version apiver = Version.parse(client.getApiVersion()); + logger.info("Setup settings..."); + client.initSettings(false); + client.setAutoconnectDebugTargets( + debuggerOptions.getDebugAreaNames(), + debuggerOptions.getFilteredAutoconnectTargets(apiver)); + logger.info("Setup targets..."); + List debugTargets; + if (debuggerOptions.getDebugAreaNames().isEmpty()) { + debugTargets = client.getRuntimeDebugTargets(null); + } else { + debugTargets = new LinkedList<>(); + debuggerOptions.getDebugAreaNames().forEach(areaName -> { + try { + debugTargets.addAll(client.getRuntimeDebugTargets(areaName)); + } catch (RuntimeDebugClientException ex) { + logger.error(ex.getLocalizedMessage()); + } + }); + } + connectAllTargets(debugTargets); + + logger.info("Enabling profiling..."); + client.toggleProfiling(null); + client.toggleProfiling(measureUuid); + + systemStarted = true; + + } + + protected void gracefulShutdown(PrintWriter serverPipeOut) { + if (stopExecution.get()) { + return; + } + + logger.info("Disabling profiling..."); + try { + client.toggleProfiling(null); + } catch (RuntimeDebugClientException e) { + logger.error(e.getLocalizedMessage()); + } + + Utils.dumpCoverageFile(coverageData, metadataOptions, outputOptions); + if (serverPipeOut != null) { + serverPipeOut.println(PipeMessages.OK_RESULT); + } + stopExecution.set(true); + + logger.info("Bye!"); + } + + @Override + protected MetadataOptions getMetadataOptions() { + return metadataOptions; + } + + @Override + protected Map> getCoverageData() { + return coverageData; + } + + @Override + protected OutputOptions getOutputOptions() { + return outputOptions; + } + + @Override + public ConnectionOptions getConnectionOptions() { + return connectionOptions; + } + + @Override + protected boolean getSystemStarted() { + return systemStarted; + } +}