Ejemplo n.º 1
0
        public void UpdateEventFrame()
        {
            AFEventFrame frame = GenerateFrame(DateTime.UtcNow, null);

            _db.CreateEventFrame(frame);

            frame = _db.EventFrames[frame.Name];

            Assert.IsNotNull(frame, "Assert frame exists in AFDB frame list");

            Assert.Equals(frame.Name, frame.Name);
            Assert.Equals(frame.Description, frame.Description);
            Assert.Equals(frame.StartTime, frame.StartTime);
            Assert.IsNull(frame.EndTime, "Assert EndTime is null.");

            frame.EndTime = DateTime.UtcNow.AddMinutes(5);
            frame.Name   += " (Updated)";
            Assert.IsTrue(frame.IsDirty);
            frame.CheckIn();

            frame.Delete();
            Assert.IsTrue(frame.IsDeleted);

            frame.CheckIn();

            AFEventFrame temp = AFEventFrame.Find(_conn, frame.WebID);

            Assert.IsNull(temp);
        }
        public void EventFrameAFSDK2018SP3Patch1Check()
        {
            AFEventFrame ef = null;

            try
            {
                AFRpcMetric[] rpcBefore = Fixture.AFDatabase.PISystem.GetClientRpcMetrics();
                ef = new AFEventFrame(Fixture.AFDatabase, "OSIsoftTests_Patch2107Applied_EF1");
                ef.CheckIn();
                ef.SetEndTime("*");
                ef.CheckIn();
                AFRpcMetric[]       rpcAfter = Fixture.AFDatabase.PISystem.GetClientRpcMetrics();
                IList <AFRpcMetric> rpcDiff  = AFRpcMetric.SubtractList(rpcAfter, rpcBefore);
                foreach (AFRpcMetric rpcMetric in rpcDiff)
                {
                    Assert.False(rpcMetric.Name.Equals("getcheckoutinfo", StringComparison.InvariantCultureIgnoreCase), "Error: GetCheckOutInfo rpc was still called after Checkin with 2018 SP3 Patch 1!");
                }
            }
            finally
            {
                if (ef != null)
                {
                    ef.Delete();
                    Fixture.AFDatabase.PISystem.CheckIn();
                }
            }
        }
Ejemplo n.º 3
0
        public void CreateFreeEventFrame()
        {
            AFEventFrame frame = GenerateFrame(DateTime.Now, null);

            _db.CreateEventFrame(frame);

            AFEventFrame foundFrame = _db.EventFrames[frame.Name];

            Assert.IsNotNull(foundFrame, "Assert frame exists in AFDB frame list");

            Assert.Equals(frame.Name, foundFrame.Name);
            Assert.Equals(frame.Description, foundFrame.Description);
            Assert.Equals(frame.StartTime, foundFrame.StartTime);
            Assert.IsNull(frame.EndTime, "Assert EndTime is null.");

            foundFrame.Delete();
            foundFrame.CheckIn();

            try
            {
                var x = _db.EventFrames[foundFrame.Name];
                Assert.Fail("Index out of bound was not thrown!");
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Remove the event frame by name if it exists.
        /// </summary>
        /// <param name="name">The name of the event frame to remove.</param>
        /// <param name="output">The output logger used for writing messages.</param>
        public void RemoveEventFrameIfExists(string name, ITestOutputHelper output)
        {
            Contract.Requires(output != null);

            AFEventFrame preCheckEventFrame = null;

            using (var search = new AFEventFrameSearch(AFDatabase, string.Empty, $"Name:'{name}'"))
            {
                var searchResults = new AFNamedCollectionList <AFEventFrame>(search.FindObjects());
                if (searchResults.Count > 0)
                {
                    preCheckEventFrame = searchResults.First();
                }
            }

            if (preCheckEventFrame?.Name.Equals(name, StringComparison.OrdinalIgnoreCase) ?? false)
            {
                output.WriteLine($"Event Frame [{preCheckEventFrame}] exists, delete it.");
                preCheckEventFrame.Delete();
                preCheckEventFrame.CheckIn();
            }
            else
            {
                output.WriteLine($"Event Frame [{name}] does not exist, can not be deleted.");
            }
        }