Beispiel #1
0
        public async Task FahClient_RefreshSlots_ParsesSlotDescriptionForSlotTypeAndSlotThreads_Client_v7_10()
        {
            // Arrange
            var settings = new ClientSettings {
                Name = "Client_v7_10"
            };
            var fahClient = CreateClient(settings);
            var extractor = new FahClientJsonMessageExtractor();
            await fahClient.Messages.UpdateMessageAsync(
                extractor.Extract(new StringBuilder(
                                      File.ReadAllText(@"..\..\..\..\TestFiles\Client_v7_10\slots.txt"))));

            // Act
            fahClient.RefreshSlots();
            // Assert
            var slots = fahClient.Slots.ToList();

            Assert.AreEqual(2, slots.Count);
            Assert.AreEqual(SlotType.CPU, slots[0].SlotType);
            Assert.AreEqual(4, slots[0].SlotThreads);
            Assert.AreEqual(null, slots[0].SlotProcessor);
            Assert.AreEqual(SlotType.GPU, slots[1].SlotType);
            Assert.AreEqual(null, slots[1].SlotThreads);
            Assert.AreEqual("GeForce GTX 285", slots[1].SlotProcessor);
        }
Beispiel #2
0
        public async Task FahClientMessageAggregator_Client_v7_11_SlotID_0()
        {
            // Arrange
            var settings = new ClientSettings {
                Name = "Client_v7_11"
            };
            var fahClient = CreateClient(settings);

            using (var textReader = new StreamReader(@"..\..\..\..\TestFiles\Client_v7_11\log.txt"))
                using (var reader = new FahClientLogTextReader(textReader))
                {
                    await fahClient.Messages.Log.ReadAsync(reader);
                }

            var extractor = new FahClientJsonMessageExtractor();
            await fahClient.Messages.UpdateMessageAsync(
                extractor.Extract(new StringBuilder(
                                      File.ReadAllText(@"..\..\..\..\TestFiles\Client_v7_11\units.txt"))));

            await fahClient.Messages.UpdateMessageAsync(
                extractor.Extract(new StringBuilder(
                                      File.ReadAllText(@"..\..\..\..\TestFiles\Client_v7_11\info.txt"))));

            await fahClient.Messages.UpdateMessageAsync(
                extractor.Extract(new StringBuilder(
                                      File.ReadAllText(@"..\..\..\..\TestFiles\Client_v7_11\options.txt"))));

            await fahClient.Messages.UpdateMessageAsync(
                extractor.Extract(new StringBuilder(
                                      File.ReadAllText(@"..\..\..\..\TestFiles\Client_v7_11\slots.txt"))));

            await fahClient.Messages.UpdateMessageAsync(
                extractor.Extract(new StringBuilder(
                                      File.ReadAllText(@"..\..\..\..\TestFiles\Client_v7_11\slot-options1.txt"))));

            var slotModel = new SlotModel(fahClient)
            {
                SlotID = 0
            };
            var aggregator = new FahClientMessageAggregator(fahClient, slotModel);

            // Act
            var result = aggregator.AggregateData();

            // Assert
            Assert.AreEqual(1, result.WorkUnits.Count);
            Assert.IsFalse(result.WorkUnits.Any(x => x.Value == null));

            #region Check Data Aggregator

            Assert.IsNotNull(result.WorkUnitQueue);
            Assert.AreEqual(1, result.CurrentUnitIndex);
            Assert.AreEqual(new DateTime(2012, 2, 18, 6, 33, 41), result.StartTime);
            Assert.AreEqual(null, result.Arguments);
            Assert.AreEqual(null, result.ClientVersion);
            Assert.AreEqual(null, result.UserID);
            Assert.AreEqual(0, result.MachineID);
            Assert.AreEqual(SlotStatus.Unknown, result.Status);
            Assert.IsNotNull(result.CurrentLogLines);
            Assert.IsFalse(result.WorkUnits.Any(x => x.Value.LogLines == null));
            if (result.WorkUnits.ContainsKey(result.CurrentUnitIndex))
            {
                Assert.AreEqual(result.CurrentLogLines, result.WorkUnits[result.CurrentUnitIndex].LogLines);
            }

            #endregion

            var unitInfoData = result.WorkUnits[result.CurrentUnitIndex];

            #region Check Unit Info Data Values
            Assert.AreEqual(DateTime.MinValue, unitInfoData.UnitRetrievalTime);
            Assert.AreEqual("harlam357", unitInfoData.FoldingID);
            Assert.AreEqual(32, unitInfoData.Team);
            Assert.AreEqual(new DateTime(2012, 2, 17, 21, 48, 22), unitInfoData.Assigned);
            Assert.AreEqual(new DateTime(2012, 2, 29, 14, 50, 46), unitInfoData.Timeout);
            Assert.AreEqual(new TimeSpan(6, 34, 38), unitInfoData.UnitStartTimeStamp);
            Assert.AreEqual(DateTime.MinValue, unitInfoData.Finished);
            Assert.AreEqual(2.27f, unitInfoData.CoreVersion);
            Assert.AreEqual(7610, unitInfoData.ProjectID);
            Assert.AreEqual(192, unitInfoData.ProjectRun);
            Assert.AreEqual(0, unitInfoData.ProjectClone);
            Assert.AreEqual(58, unitInfoData.ProjectGen);
            Assert.AreEqual(null, unitInfoData.ProteinName);
            Assert.AreEqual(null, unitInfoData.ProteinTag);
            Assert.AreEqual(WorkUnitResult.Unknown, unitInfoData.UnitResult);
            Assert.AreEqual(3, unitInfoData.FramesObserved);
            Assert.AreEqual(95, unitInfoData.CurrentFrame.ID);
            Assert.AreEqual(1900000, unitInfoData.CurrentFrame.RawFramesComplete);
            Assert.AreEqual(2000000, unitInfoData.CurrentFrame.RawFramesTotal);
            Assert.AreEqual(new TimeSpan(6, 46, 16), unitInfoData.CurrentFrame.TimeStamp);
            Assert.AreEqual(new TimeSpan(0, 4, 50), unitInfoData.CurrentFrame.Duration);
            Assert.AreEqual("A4", unitInfoData.CoreID);
            #endregion
        }
Beispiel #3
0
        public async Task FahClientMessageAggregator_Client_v7_10_SlotID_0_UnitDataOnly()
        {
            // Arrange
            var settings = new ClientSettings {
                Name = "Client_v7_10"
            };
            var fahClient = CreateClient(settings);

            string filteredLogText = String.Join(Environment.NewLine, File.ReadLines(@"..\..\..\..\TestFiles\Client_v7_10\log.txt").Where(x => x.Length != 0).Take(82));

            using (var textReader = new StringReader(filteredLogText))
                using (var reader = new FahClientLogTextReader(textReader))
                {
                    await fahClient.Messages.Log.ReadAsync(reader);
                }

            var extractor = new FahClientJsonMessageExtractor();
            await fahClient.Messages.UpdateMessageAsync(
                extractor.Extract(new StringBuilder(
                                      File.ReadAllText(@"..\..\..\..\TestFiles\Client_v7_10\units.txt"))));

            await fahClient.Messages.UpdateMessageAsync(
                extractor.Extract(new StringBuilder(
                                      File.ReadAllText(@"..\..\..\..\TestFiles\Client_v7_10\info.txt"))));

            await fahClient.Messages.UpdateMessageAsync(
                extractor.Extract(new StringBuilder(
                                      File.ReadAllText(@"..\..\..\..\TestFiles\Client_v7_10\options.txt"))));

            await fahClient.Messages.UpdateMessageAsync(
                extractor.Extract(new StringBuilder(
                                      File.ReadAllText(@"..\..\..\..\TestFiles\Client_v7_10\slots.txt"))));

            await fahClient.Messages.UpdateMessageAsync(
                extractor.Extract(new StringBuilder(
                                      File.ReadAllText(@"..\..\..\..\TestFiles\Client_v7_10\slot-options1.txt"))));

            await fahClient.Messages.UpdateMessageAsync(
                extractor.Extract(new StringBuilder(
                                      File.ReadAllText(@"..\..\..\..\TestFiles\Client_v7_10\slot-options2.txt"))));

            var slotModel = new SlotModel(fahClient)
            {
                SlotID = 0
            };
            var aggregator = new FahClientMessageAggregator(fahClient, slotModel);

            // Act
            var result = aggregator.AggregateData();

            // Assert
            Assert.AreEqual(1, result.WorkUnits.Count);
            Assert.IsFalse(result.WorkUnits.Any(x => x.Value == null));

            #region Check Data Aggregator

            Assert.IsNotNull(result.WorkUnitQueue);
            Assert.AreEqual(1, result.CurrentUnitIndex);
            Assert.AreEqual(new DateTime(2012, 1, 11, 3, 24, 22), result.StartTime);
            Assert.AreEqual(null, result.Arguments);
            Assert.AreEqual(null, result.ClientVersion);
            Assert.AreEqual(null, result.UserID);
            Assert.AreEqual(0, result.MachineID);
            Assert.AreEqual(SlotStatus.Unknown, result.Status);
            Assert.IsNotNull(result.CurrentLogLines);
            Assert.IsTrue(result.WorkUnits.All(x => x.Value.LogLines == null));
            if (result.WorkUnits.ContainsKey(result.CurrentUnitIndex))
            {
                Assert.AreEqual(result.CurrentLogLines, LogLineEnumerable.Create(fahClient.Messages.Log.ClientRuns.Last()));
            }

            #endregion

            var unitInfoData = result.WorkUnits[result.CurrentUnitIndex];

            #region Check Unit Info Data Values
            Assert.AreEqual(DateTime.MinValue, unitInfoData.UnitRetrievalTime);
            Assert.AreEqual("harlam357", unitInfoData.FoldingID);
            Assert.AreEqual(32, unitInfoData.Team);
            Assert.AreEqual(new DateTime(2012, 1, 10, 23, 20, 27), unitInfoData.Assigned);
            Assert.AreEqual(new DateTime(2012, 1, 22, 16, 22, 51), unitInfoData.Timeout);
            Assert.AreEqual(TimeSpan.Zero, unitInfoData.UnitStartTimeStamp);
            Assert.AreEqual(DateTime.MinValue, unitInfoData.Finished);
            Assert.AreEqual(0, unitInfoData.CoreVersion);
            Assert.AreEqual(7610, unitInfoData.ProjectID);
            Assert.AreEqual(630, unitInfoData.ProjectRun);
            Assert.AreEqual(0, unitInfoData.ProjectClone);
            Assert.AreEqual(59, unitInfoData.ProjectGen);
            Assert.AreEqual(null, unitInfoData.ProteinName);
            Assert.AreEqual(null, unitInfoData.ProteinTag);
            Assert.AreEqual(WorkUnitResult.Unknown, unitInfoData.UnitResult);
            Assert.AreEqual(0, unitInfoData.FramesObserved);
            Assert.IsNull(unitInfoData.CurrentFrame);
            Assert.AreEqual("A4", unitInfoData.CoreID);
            #endregion
        }