Commit 6ab828d82f4c434518051c0b17207d3dd4dfa0b9

  • avatar
  • Jussi <jukrsund @stu…nt.jyu.fi> (Committer)
  • Fri May 24 15:58:44 EEST 2019
  • avatar
  • Jussi <jukrsund @stu…nt.jyu.fi> (Author)
  • Fri May 24 15:58:44 EEST 2019
TCP-yhteyden uudelleenkäynnistykseen korjaus; ETFileReaderissa tarkastetaan oikea aikaleimasarake; HamsterDatasetin testi päivitetty


Former-commit-id: ea354e0265d6a6801acf92a3f717ae9b359b2c08
sovellus/vs/Ajolabra/ALBackend/DeviceComponents/ET/ETFileReader.cs
(2 / 2)
  
139139 // Split the header row and determine appropriate schema elements.
140140 string[] columnHeaders = lines.First().Split(SplittingChar);
141141
142 if (!columnHeaders.Contains(ETWrapper.ETTimestamp))
142 if (!columnHeaders.Contains("UTC"))
143143 throw new ArgumentException(
144 $"Expected file that contains '{ETWrapper.ETTimestamp}' column, " +
144 $"Expected file that contains 'UTC' column, " +
145145 $"but no such column was found.");
146146
147147 var elems = _schemaElements.GetSchemaElements(columnHeaders).ToArray();
sovellus/vs/Ajolabra/ALBackend/DeviceComponents/Shared/TCPUDPRawLineReader.cs
(11 / 0)
  
5252 UDPListener
5353 }
5454
55 /// <summary>
56 /// Read timeout
57 /// </summary>
58
59
5560 [Flags]
5661 public enum LRFlags
5762 {
7777
7878 public class TCPUDPRawLineReader : AbstractPipelineComponent, IDisposable
7979 {
80 public const int ReadTimeoutSeconds = 30;
81
8082 /// <summary>
8183 /// An unifying interface for various network endpoint types.
8284 /// </summary>
224224 // Create a networks stream
225225 netStream = tcpClient.GetStream();
226226 nsReader = new StreamReader(netStream);
227 netStream.ReadTimeout = ReadTimeoutSeconds * 1000;
227228 }
228229
229230 Task<string> lineTask = nsReader.ReadLineAsync();
230231 lineTask.Wait(ct);
231232 string line = lineTask.Result;
233
234 if (line == null)
235 throw new IOException("End of stream reached, restart.");
232236
233237 return line;
234238
sovellus/vs/Ajolabra/ALUnitTests/Database/HamsterDataSetTests.cs
(1 / 1)
  
3131 var id = await hamsterDataset.AddRecording("study", "subject", "task", "comment", recordingStarted, recordingEnded);
3232
3333 Assert.IsFalse(hamsterDataset.HasChanges()); // changes should be accepted when the recording was added
34 Assert.AreEqual("study_subject_task_01.01.70_00.00.00.002_comment", id);
34 Assert.AreEqual("study_subject_task_01.01.70_00.00.00.000_comment", id);
3535 var recRow = hamsterDataset.Recording[0];
3636 Assert.AreEqual("study", recRow.Study);
3737 Assert.AreEqual("subject", recRow.Subject);