Beispiel #1
0
 public static UiModel Create(IReaderConnection connection)
 {
     return(new UiModel
     {
         Id = connection.Id.ToString(),
         Name = connection.Name,
         Ip = connection.Ip,
         Tables = connection.Tables,
         ConnectedTime = connection.ConnectedTime.ToString("s"),
         LastIncomingTime = connection.LastIncomingTime.ToString("s"),
     });
 }
Beispiel #2
0
 public void Connect(string username, string password, string apiKey, IgRestApiClient igRestApiClient)
 {
     if (Config.Settings.ContainsKey("PUBLISHING_START_TIME"))
     {
         _startTime = Config.ParseDateTimeLocal(Config.Settings["PUBLISHING_START_TIME"]);
     }
     if (Config.Settings.ContainsKey("PUBLISHING_STOP_TIME"))
     {
         _stopTime = Config.ParseDateTimeLocal(Config.Settings["PUBLISHING_STOP_TIME"]);
     }
     if (Config.Settings.ContainsKey("SAMPLING_MS"))
     {
         _samplingMs = int.Parse(Config.Settings["SAMPLING_MS"]);
     }
     _testReplayFiles.Clear();
     _igRestApiClient = igRestApiClient;
     if (Config.Settings.ContainsKey("DELETEDB"))
     {
         _deleteDB = true;
         _testReplayFiles.Add(null); // Add a fake element to trigger the replay from db
         _deleter = new CassandraConnection();
         _reader  = _deleter;
         _readerExpectedResults = _deleter;
         _hasExpectedResults    = true;
     }
     else
     {
         if (Config.Settings["REPLAY_MODE"] == "DB")
         {
             _testReplayFiles.Add(null); // Add a fake element to trigger the replay from db
             _reader = new CassandraConnection();
         }
         else if (Config.Settings["REPLAY_MODE"] == "CSV")
         {
             if (Config.Settings.ContainsKey("REPLAY_CSV"))
             {
                 _testReplayFiles = Config.Settings["REPLAY_CSV"].Split(';').ToList();
                 if (_reader != null)
                 {
                     _reader.CloseConnection();
                 }
                 _reader = new CsvReader(_testReplayFiles[0]);
             }
             else
             {
                 _reader = new CsvReader(null);
             }
         }
         else
         {
             _reader = null;
         }
         _hasExpectedResults = Config.TestReplayEnabled || Config.CalibratorEnabled;
         if (_hasExpectedResults)
         {
             if (Config.Settings.ContainsKey("EXPECTEDRESULTS_CSV"))
             {
                 _readerExpectedResults = new CsvReader(Config.Settings["EXPECTEDRESULTS_CSV"]);
             }
             else
             {
                 _readerExpectedResults = new CsvReader(_testReplayFiles[0]);
             }
         }
     }
     _numId  = 1;
     _numRef = 1;
 }
Beispiel #3
0
 public void Connect(string username, string password, string apiKey)
 {
     if (Config.Settings.ContainsKey("PUBLISHING_START_TIME"))
         _startTime = Config.ParseDateTimeLocal(Config.Settings["PUBLISHING_START_TIME"]);
     if (Config.Settings.ContainsKey("PUBLISHING_STOP_TIME"))
         _stopTime = Config.ParseDateTimeLocal(Config.Settings["PUBLISHING_STOP_TIME"]);
     if (Config.Settings.ContainsKey("SAMPLING_MS"))
         _samplingMs = int.Parse(Config.Settings["SAMPLING_MS"]);
     _testReplayFiles.Clear();
     if (Config.Settings.ContainsKey("DELETEDB"))
     {
         _deleteDB = true;
         _testReplayFiles.Add(null); // Add a fake element to trigger the replay from db
         _deleter = new CassandraConnection();
         _reader = _deleter;
         _readerExpectedResults = _deleter;
         _hasExpectedResults = true;
     }
     else
     {
         if (Config.Settings["REPLAY_MODE"] == "DB")
         {
             _testReplayFiles.Add(null); // Add a fake element to trigger the replay from db
             _reader = new CassandraConnection();
         }
         else if (Config.Settings["REPLAY_MODE"] == "CSV")
         {
             if (Config.Settings.ContainsKey("REPLAY_CSV"))
             {
                 _testReplayFiles = Config.Settings["REPLAY_CSV"].Split(';').ToList();
                 if (_reader != null)
                     _reader.CloseConnection();
                 _reader = new CsvReader(_testReplayFiles[0]);
             }
             else
                 _reader = new CsvReader(null);
         }
         else
             _reader = null;
         _hasExpectedResults = Config.TestReplayEnabled || Config.CalibratorEnabled;
         if (_hasExpectedResults)
         {
             if (Config.Settings.ContainsKey("EXPECTEDRESULTS_CSV"))
                 _readerExpectedResults = new CsvReader(Config.Settings["EXPECTEDRESULTS_CSV"]);
             else
                 _readerExpectedResults = new CsvReader(_testReplayFiles[0]);
         }
     }
     _numId = 1;
     _numRef = 1;
 }