Exemplo n.º 1
0
 public FixedPortRecordingController(string host, int port, InstrumentationMap map, ILogger logger = null)
 {
     _host   = host;
     _port   = port;
     _map    = map;
     _logger = logger ?? new ConsoleLogger();
 }
        private void SaveMapFile(InstrumentationMap map, string outputFilePath)
        {
            var serializer = new JsonSerializer()
            {
                NullValueHandling = NullValueHandling.Ignore
            };

            using (var writer = new JsonTextWriter(new StreamWriter(outputFilePath)))
                serializer.Serialize(writer, map);
        }
Exemplo n.º 3
0
        private void Init(InstrumentationMap map, Guid uniqueId, int[][] hits)
        {
            if (map.UniqueId != uniqueId)
            {
                throw new Exception($"Hits file's unique id ({uniqueId}) does not match the unique id in the map file ({map.UniqueId}).");
            }

            Version    = map.Version;
            UniqueId   = uniqueId;
            Assemblies = map.Assemblies.Select(asm => ToAssemblyCoverage(asm, hits)).ToList().AsReadOnly();
        }
Exemplo n.º 4
0
        public static CoverageResult CollectResultAndReset(string host, int port, InstrumentationMap map)
        {
            var fileName = GetTempFileName();

            try
            {
                SaveHitsAndReset(host, port, fileName);
                return(new CoverageResult(map, fileName));
            }
            finally
            {
                if (File.Exists(fileName))
                {
                    File.Delete(fileName);
                }
            }
        }
 private IRecordingController CreateRecordingController(InstrumentationMap map)
 {
     if (Options.ControllerPortNumber > 0)
     {
         return(new FixedPortRecordingController(
                    "localhost", Options.ControllerPortNumber, map, _logger));
     }
     else
     {
         var dir = Options.RuntimeConfigOutputPath;
         if (string.IsNullOrEmpty(dir))
         {
             dir = Options.RecorderAssemblyCopyPath;
         }
         var fullPath = Path.Combine(dir, Options.RuntimeConfigFileName);
         return(new DynamicPortRecordingController(fullPath, map, _logger));
     }
 }
Exemplo n.º 6
0
 public DynamicPortRecordingController(string recorderRuntimeConfigFilePath, InstrumentationMap map, ILogger logger = null)
 {
     _recorderRuntimeConfigFilePath = recorderRuntimeConfigFilePath;
     _map    = map;
     _logger = logger ?? new ConsoleLogger();
 }
 public static IRecordingController ForRuntimeConfigFile(string runtimeConfigFilePath, InstrumentationMap map, ILogger logger)
 {
     return(new DynamicPortRecordingController(runtimeConfigFilePath, map, logger));
 }
 public static IRecordingController ForEndPoint(string host, int port, InstrumentationMap map, ILogger logger)
 {
     return(new FixedPortRecordingController(host, port, map, logger));
 }
Exemplo n.º 9
0
 private InstrumentationMap LoadMapFile(string mapFilePath)
 {
     ValidateFilePath(mapFilePath);
     return(InstrumentationMap.Parse(mapFilePath));
 }
Exemplo n.º 10
0
 public CoverageResult(InstrumentationMap map, int[][] hits)
 {
     Init(map, map.UniqueId, hits);
 }
Exemplo n.º 11
0
 public CoverageResult(InstrumentationMap map, string hitsPath)
 {
     var(uniqueId, hits) = LoadHits(hitsPath);
     Init(map, uniqueId, hits);
 }