Ejemplo n.º 1
0
 //------------------------------------------------------------------------------------
 /// <summary>
 /// Will be called any time there's a set of DSItems to be deferred during a normal
 /// planning query.
 /// </summary>
 //------------------------------------------------------------------------------------
 public void ReceiveStoreItemsToDefer(Datastore store, DatastoreItems items)
 {
     foreach (DatastoreItem dsItem in items)
     {
         DeferStoreItem(store, dsItem, IsRefresh.No);
     }
 }
Ejemplo n.º 2
0
        //------------------------------------------------------------------------------------
        /// <summary>
        /// Will be called any time there's a set of DSItems to be deferred during a Refresh
        /// query. In this case, we're only interested in items that have changed since the
        /// last refresh.
        /// </summary>
        //------------------------------------------------------------------------------------
        public void ReceiveRefreshStoreItemsToDefer(Datastore store, DatastoreItems items)
        {
            DateTime lastRefreshTime = Planner.Instance.LastRefreshTime;

            foreach (DatastoreItem dsItem in items)
            {
                DateTime changedDateTime = TypeUtils.GetValueAsLocalTime(store.GetBackingValue(dsItem, Datastore.PropNameChangedDate));
                if (changedDateTime >= lastRefreshTime)
                {
                    DeferStoreItem(store, dsItem, IsRefresh.Yes);
                }
            }
        }
Ejemplo n.º 3
0
        void IRepository.ReceiveDSItems(Datastore store, DatastoreItems items, ShouldRefresh isRefresh, bool isDefer)
        {
            if (isRefresh == ShouldRefresh.Yes)
            {
                ReceiveRefreshStoreItemsToDefer(store, items);
            }
            else if (isDefer)
            {
                ReceiveStoreItemsToDefer(store, items);
            }
            else
            {
                foreach (DatastoreItem dsItem in items)
                {
                    StoreItem storeItem = store.CreateAndInitializeItemFromDS(dsItem);

                    // Every item loaded from the back-end store is placed into
                    // the global item cache for immediate access.
                    AddItemFromStore(storeItem);
                }
            }
        }
Ejemplo n.º 4
0
        private void ExportCases(string testType, string profileName, DatastoreItems items)
        {
            XmlTextWriter oo         = newXmlProfile(testType, profileName);
            string        prevModule = "";
            string        prevSuite  = "";

            foreach (DatastoreItem psItem in items)
            {
                object module   = psItem.Fields["Test Module"].Value;
                object suite    = psItem.Fields["Test Suite"].Value;
                object testcase = psItem.Fields["TestCase"].Value;
                if (module == null || suite == null || testcase == null)
                {
                    Console.WriteLine("Test case not prepared for automation: {0}", psItem.Fields["ID"].Value);
                    continue;
                }

                if (!module.Equals(prevModule))
                {
                    if (prevModule != "")
                    {
                        // special case the first test case
                        oo.WriteEndElement();
                        oo.WriteEndElement();
                    }
                    prevModule = module.ToString();
                    prevSuite  = suite.ToString();
                    oo.WriteStartElement("Module");
                    oo.WriteAttributeString("Name", prevModule);
                    oo.WriteStartElement("Suite");
                    oo.WriteAttributeString("Name", prevSuite);
                }
                else if (!suite.Equals(prevSuite))
                {
                    prevSuite = suite.ToString();
                    oo.WriteEndElement();
                    oo.WriteStartElement("Suite");
                    oo.WriteAttributeString("Name", prevSuite);
                }
                oo.WriteStartElement("Test");
                oo.WriteAttributeString("Name", testcase.ToString());
                object timeout = psItem.Fields["Test Timeout"].Value;
                if (timeout != null)
                {
                    oo.WriteAttributeString("Timeout", timeout.ToString());
                }
                object order = psItem.Fields["Order"].Value;
                if (order != null)
                {
                    oo.WriteAttributeString("Order", order.ToString());
                    int o;
                    //NOTE Magic: the 1000s digit in Order determines the pass for the test.
                    if (Int32.TryParse(order.ToString(), out o) && o / 1000 > 0)
                    {
                        oo.WriteAttributeString("Pass", "" + (o / 1000));
                    }
                }
                object knownFailure = psItem.Fields["Test Known Failure"].Value;
                if (knownFailure != null)
                {
                    oo.WriteAttributeString("KnownFailure", knownFailure.ToString());
                }
                oo.WriteEndElement();
            }
            if (prevModule != "")
            {
                oo.WriteEndElement(); // suite
                oo.WriteEndElement(); // module
            }
            oo.WriteEndElement();
            oo.WriteEndDocument();
            oo.Close();
        }