示例#1
0
        // Set the workflow status.
        public void setWorkFlowStatus(ErrorIndexType indexType, bool resetService)
        {
            // Add a context.
            CreateNewStackHashContextResponse resp = m_Utils.CreateNewContext(indexType);

            String testPath = "c:\\stackhashunittests\\testindex\\";

            resp.Settings.ErrorIndexSettings.Folder = testPath;
            resp.Settings.ErrorIndexSettings.Name   = "TestIndex";
            m_Utils.SetContextSettings(resp.Settings);
            m_Utils.DeleteIndex(0); // Make sure it is empty.
            m_Utils.ActivateContext(0);

            // Create a test index with one cab file.
            StackHashTestIndexData testIndexData = new StackHashTestIndexData();

            testIndexData.NumberOfProducts   = 1;
            testIndexData.NumberOfFiles      = 1;
            testIndexData.NumberOfEvents     = 1;
            testIndexData.NumberOfEventInfos = 0;
            testIndexData.NumberOfCabs       = 0;

            m_Utils.CreateTestIndex(0, testIndexData);

            GetProductsResponse getProductsResp = m_Utils.GetProducts(0);

            Assert.AreEqual(1, getProductsResp.Products.Count());

            GetFilesResponse allFiles = m_Utils.GetFiles(0, getProductsResp.Products[0].Product);

            Assert.AreEqual(1, allFiles.Files.Count());

            GetProductEventPackageResponse allEvents = m_Utils.GetProductEventPackages(0, getProductsResp.Products[0].Product);

            Assert.AreEqual(1, allEvents.EventPackages.Count());


            // Set the workflow status
            int workFlowStatus = 10;

            m_Utils.SetWorkFlowStatus(0, getProductsResp.Products[0].Product, allFiles.Files[0], allEvents.EventPackages[0].EventData, workFlowStatus);

            if (resetService)
            {
                m_Utils.RestartService();
            }

            allEvents = m_Utils.GetProductEventPackages(0, getProductsResp.Products[0].Product);
            Assert.AreEqual(1, allEvents.EventPackages.Count());

            Assert.AreEqual(workFlowStatus, allEvents.EventPackages[0].EventData.WorkFlowStatus);
            Assert.AreEqual("Resolved - Responded", allEvents.EventPackages[0].EventData.WorkFlowStatusName);
            m_Utils.DeactivateContext(0);
            m_Utils.DeleteIndex(0);
        }
示例#2
0
        // Get the
        public void getCabPackage(ErrorIndexType indexType)
        {
            // Add a context.
            CreateNewStackHashContextResponse resp = m_Utils.CreateNewContext(indexType);

            String testPath = "c:\\stackhashunittests\\testindex\\";

            resp.Settings.ErrorIndexSettings.Folder = testPath;
            resp.Settings.ErrorIndexSettings.Name   = "TestIndex";
            m_Utils.SetContextSettings(resp.Settings);
            m_Utils.DeleteIndex(0); // Make sure it is empty.
            m_Utils.ActivateContext(0);

            // Create a test index with one cab file.
            StackHashTestIndexData testIndexData = new StackHashTestIndexData();

            testIndexData.NumberOfProducts   = 1;
            testIndexData.NumberOfFiles      = 1;
            testIndexData.NumberOfEvents     = 1;
            testIndexData.NumberOfEventInfos = 0;
            testIndexData.NumberOfCabs       = 1;

            m_Utils.CreateTestIndex(0, testIndexData);

            GetProductsResponse getProductsResp = m_Utils.GetProducts(0);

            Assert.AreEqual(1, getProductsResp.Products.Count());

            GetFilesResponse allFiles = m_Utils.GetFiles(0, getProductsResp.Products[0].Product);

            Assert.AreEqual(1, allFiles.Files.Count());

            GetProductEventPackageResponse allEvents = m_Utils.GetProductEventPackages(0, getProductsResp.Products[0].Product);

            Assert.AreEqual(1, allEvents.EventPackages.Count());
            Assert.AreEqual(1, allEvents.EventPackages[0].Cabs.Count);


            // Get the Cab package.
            GetCabPackageResponse cabPackageResp = m_Utils.GetCabPackage(0, getProductsResp.Products[0].Product, allFiles.Files[0], allEvents.EventPackages[0].EventData,
                                                                         allEvents.EventPackages[0].Cabs[0].Cab);

            Assert.AreEqual("c:\\stackhashunittests\\testindex\\TestIndex\\00\\00\\00\\00\\CAB_0000000001\\1-Crash 32bit-0.cab", cabPackageResp.CabPackage.FullPath);
        }
示例#3
0
        /// <summary>
        /// Gets all the event data stored about a particular event.
        /// </summary>
        /// <param name="requestData">Request data.</param>
        /// <returns>Event package included per instance and cab data.</returns>
        public GetProductEventPackageResponse GetProductEventPackages(GetProductEventPackageRequest requestData)
        {
            if (requestData == null)
            {
                throw new ArgumentNullException("requestData");
            }

            GetProductEventPackageResponse resp = new GetProductEventPackageResponse();

            StackHashEventPackageCollection eventPackages =
                StaticObjects.TheStaticObjects.TheController.GetProductEvents(requestData.ContextId, requestData.Product);

            resp.EventPackages = eventPackages;
            resp.Product       = requestData.Product;

            resp.ResultData = new StackHashServiceResultData(
                StackHashServiceResult.Success, s_OperationSuccessful, null);

            return(resp);
        }
示例#4
0
        public void getProductEventPackages(ErrorIndexType indexType, int numProducts, int numFiles, int numEvents, int numEventInfos, int numCabs)
        {
            // Add a context.
            CreateNewStackHashContextResponse resp = m_Utils.CreateNewContext(indexType);

            String testPath = "c:\\stackhashsoaktest\\";

            resp.Settings.ErrorIndexSettings.Folder = testPath;
            resp.Settings.ErrorIndexSettings.Name   = "TestIndex";
            m_Utils.SetContextSettings(resp.Settings);
            m_Utils.DeleteIndex(0); // Make sure it is empty.
            m_Utils.ActivateContext(0);

            // Create a test index with one cab file.
            StackHashTestIndexData testIndexData = new StackHashTestIndexData();

            testIndexData.NumberOfProducts   = numProducts;
            testIndexData.NumberOfFiles      = numFiles;
            testIndexData.NumberOfEvents     = numEvents;
            testIndexData.NumberOfEventInfos = numEventInfos;
            testIndexData.NumberOfCabs       = numCabs;

            m_Utils.CreateTestIndex(0, testIndexData);


            // Service is now started with the specified index.
            // Make sure we can get at least the list of products.
            GetProductsResponse getProductsResp = m_Utils.GetProducts(0);

            Assert.AreEqual(numProducts, getProductsResp.Products.Count());
            try
            {
                DateTime startTime = DateTime.Now;
                foreach (StackHashProductInfo productInfo in getProductsResp.Products)
                {
                    StackHashProduct product = productInfo.Product;

                    GetProductEventPackageResponse response = m_Utils.GetProductEventPackages(0, product);
                    Assert.AreEqual(1 * numFiles * numEvents, response.EventPackages.Count);

                    foreach (StackHashEventPackage package in response.EventPackages)
                    {
                        Assert.AreEqual(numCabs, package.Cabs.Count);
                        Assert.AreEqual(numEventInfos, package.EventInfoList.Count);
                    }
                }
                DateTime endTime = DateTime.Now;

                TimeSpan duration = endTime - startTime;
                Console.WriteLine("Duration: {0}", duration);


                m_Utils.RestartService();

                startTime = DateTime.Now;
                foreach (StackHashProductInfo productInfo in getProductsResp.Products)
                {
                    StackHashProduct product = productInfo.Product;

                    GetProductEventPackageResponse response = m_Utils.GetProductEventPackages(0, product);
                    Assert.AreEqual(1 * numFiles * numEvents, response.EventPackages.Count);

                    foreach (StackHashEventPackage package in response.EventPackages)
                    {
                        Assert.AreEqual(numCabs, package.Cabs.Count);
                        Assert.AreEqual(numEventInfos, package.EventInfoList.Count);
                    }
                }
                endTime = DateTime.Now;

                duration = endTime - startTime;
                Console.WriteLine("Duration: {0}", duration);
            }
            finally
            {
                m_Utils.DeactivateContext(0);
                m_Utils.DeleteIndex(0);
            }
        }