Ejemplo n.º 1
0
        public void TestLoadFileListNullProductCached()
        {
            XmlErrorIndex   index      = new XmlErrorIndex(m_TempPath, "Cucku");
            ErrorIndexCache indexCache = new ErrorIndexCache(index);

            indexCache.Activate();
            indexCache.LoadFileList(null);
        }
Ejemplo n.º 2
0
        public void UpdateProductStatsIndex10Files100EventsCached()
        {
            XmlErrorIndex   xmlIndex   = new XmlErrorIndex(m_TempPath, "TestIndex");
            ErrorIndexCache cacheIndex = new ErrorIndexCache(xmlIndex);

            cacheIndex.Activate();

            updateProductStatsNoEvents(cacheIndex, 1, 10, 100);
        }
Ejemplo n.º 3
0
        public void GetProductEvents20Products5Files3EventsCached()
        {
            XmlErrorIndex   xmlIndex   = new XmlErrorIndex(m_TempPath, "TestIndex");
            ErrorIndexCache cacheIndex = new ErrorIndexCache(xmlIndex);

            cacheIndex.Activate();

            getProductEvents(cacheIndex, 20, 5, 3);
        }
Ejemplo n.º 4
0
        public void GetProductEvents1Products2Files2EventsCached()
        {
            XmlErrorIndex   xmlIndex   = new XmlErrorIndex(m_TempPath, "TestIndex");
            ErrorIndexCache cacheIndex = new ErrorIndexCache(xmlIndex);

            cacheIndex.Activate();

            getProductEvents(cacheIndex, 1, 2, 2);
        }
Ejemplo n.º 5
0
        private void testCacheInitialiseNProducts(IErrorIndex realIndex, int numProducts)
        {
            realIndex.Activate();
            StackHashProductCollection allProducts = new StackHashProductCollection();

            for (int i = 0; i < numProducts; i++)
            {
                DateTime         creationDateTime = new DateTime(2010, 04, 04, 22, 9, 0, DateTimeKind.Utc).AddDays(i);
                DateTime         modifiedDateTime = new DateTime(2010, 05, 05, 23, 10, 0, DateTimeKind.Utc).AddDays(i);
                int              productId        = 200 + i;
                StackHashProduct product1         =
                    new StackHashProduct(creationDateTime, modifiedDateTime, null, productId, "TestProduct1", 20 + i, 30 + i, "2.10.02123.1293");

                realIndex.AddProduct(product1);
            }

            // Hook up the cache and call LoadProductList.
            ErrorIndexCache indexCache = new ErrorIndexCache(realIndex);

            indexCache.Activate();

            // Get the product list.
            StackHashProductCollection products = indexCache.LoadProductList();

            Assert.AreNotEqual(null, products);
            Assert.AreEqual(numProducts, products.Count);

            for (int i = 0; i < allProducts.Count; i++)
            {
                Assert.AreEqual(0, allProducts[0].CompareTo(products.FindProduct(allProducts[0].Id)));
            }

            // Hook up the cache afresh and call GetProduct.
            indexCache = new ErrorIndexCache(realIndex);
            indexCache.Activate();
            for (int i = 0; i < allProducts.Count; i++)
            {
                StackHashProduct thisProduct = indexCache.GetProduct(allProducts[i].Id);
                Assert.AreNotEqual(null, thisProduct);
                Assert.AreEqual(0, allProducts[i].CompareTo(thisProduct));
            }
        }
Ejemplo n.º 6
0
        private void testAddNEventInfoReloadCache(IErrorIndex realIndex, int numEventInfos)
        {
            ErrorIndexCache index = new ErrorIndexCache(realIndex);

            index.Activate();

            StackHashProduct product =
                new StackHashProduct(DateTime.Now, DateTime.Now, "http://www.cucku.com", 1, "TestProduct1", 20, 30, "2.10.02123.1293");
            StackHashFile file = new StackHashFile(new DateTime(100), new DateTime(101), 39, new DateTime(102), "filename.dll", "1.2.3.4");
            StackHashParameterCollection parameters = new StackHashParameterCollection();

            parameters.Add(new StackHashParameter("param1", "param1value"));
            parameters.Add(new StackHashParameter("param2", "param2value"));
            StackHashEventSignature signature = new StackHashEventSignature(parameters);

            StackHashEvent theEvent = new StackHashEvent(new DateTime(102), new DateTime(103), "EventType1", 20000, signature, 99, 2);

            index.AddProduct(product);
            index.AddFile(product, file);
            index.AddEvent(product, file, theEvent);

            StackHashEventInfoCollection eventInfoCollection = new StackHashEventInfoCollection();

            for (int i = 0; i < numEventInfos; i++)
            {
                StackHashEventInfo eventInfo = new StackHashEventInfo(DateTime.Now.AddDays(i),
                                                                      DateTime.Now.AddDays(i + 1), DateTime.Now.AddDays(i + 2), "English" + i.ToString(),
                                                                      i, "locale" + i.ToString(), "OS" + i.ToString(), "OSVersion" + i.ToString(), i * 10);
                eventInfoCollection.Add(eventInfo);
            }

            index.AddEventInfoCollection(product, file, theEvent, eventInfoCollection);

            // Now reconnect a cache to make sure that the data has been stored ok.
            index = new ErrorIndexCache(realIndex);
            index.Activate();

            // Now get all the event info and make sure it all matches.
            StackHashEventInfoCollection eventInfoCollection2 = index.LoadEventInfoList(product, file, theEvent);

            Assert.AreEqual(0, eventInfoCollection.CompareTo(eventInfoCollection2));
        }