/// <summary> /// Make sure notification only comes back to the one client. /// Username and password are incorrect so should just fail to login. /// </summary> public void adminReportShouldBeSentToIndividualClient(ErrorIndexType indexType) { m_Utils.RegisterForNotifications(true, Guid.NewGuid()); m_Utils.RegisterForNotifications(true, m_Utils.ApplicationGuid); m_Utils.RegisterForNotifications(true, Guid.NewGuid()); m_Utils.CreateAndSetNewContext(indexType); m_Utils.ActivateContext(0); StackHashTestIndexData indexData = new StackHashTestIndexData(); indexData.NumberOfProducts = 1; indexData.NumberOfFiles = 1; indexData.NumberOfEvents = 1; indexData.NumberOfCabs = 1; indexData.NumberOfEventInfos = 1; m_Utils.CreateTestIndex(0, indexData); try { StackHashProductInfoCollection products = m_Utils.GetProducts(0).Products; StackHashFileCollection files = m_Utils.GetFiles(0, products[0].Product).Files; StackHashEventPackageCollection events = m_Utils.GetProductEventPackages(0, products[0].Product).EventPackages; StackHashCabPackageCollection cabs = events[0].Cabs; DownloadCabResponse resp = m_Utils.DownloadCab(0, products[0].Product, files[0], events[0].EventData, events[0].Cabs[0].Cab, 30000); StackHashAdminReport adminReport = m_Utils.DownloadCabAdminReport; Assert.AreNotEqual(null, adminReport); Assert.AreEqual(m_Utils.LastClientData.ApplicationGuid, adminReport.ClientData.ApplicationGuid); Assert.AreEqual(m_Utils.LastClientData.ClientId, adminReport.ClientData.ClientId); Assert.AreEqual(m_Utils.LastClientData.ClientName, adminReport.ClientData.ClientName); Assert.AreEqual(m_Utils.LastClientData.ClientRequestId, adminReport.ClientData.ClientRequestId); Assert.AreEqual(0, adminReport.ContextId); Assert.AreNotEqual(null, adminReport.LastException); Assert.AreEqual(true, adminReport.LastException.Contains("username and password")); Assert.AreEqual(StackHashAdminOperation.DownloadCabCompleted, adminReport.Operation); Assert.AreEqual(StackHashAsyncOperationResult.Failed, adminReport.ResultData); // Should receive 3 admin register + download started + download completed. Assert.AreEqual(5, m_Utils.AllReports.Count); } finally { m_Utils.DeactivateContext(0); m_Utils.DeleteIndex(0); } }
/// <summary> /// Product doesn't exist. /// </summary> public void downloadCabProductDoesntExist(ErrorIndexType indexType) { m_Utils.RegisterForNotifications(true, m_Utils.ApplicationGuid); m_Utils.CreateAndSetNewContext(indexType); m_Utils.ActivateContext(0); StackHashTestIndexData indexData = new StackHashTestIndexData(); indexData.NumberOfProducts = 1; indexData.NumberOfFiles = 1; indexData.NumberOfEvents = 1; indexData.NumberOfCabs = 1; indexData.NumberOfEventInfos = 1; m_Utils.CreateTestIndex(0, indexData); try { try { StackHashProductInfoCollection products = m_Utils.GetProducts(0).Products; StackHashFileCollection files = m_Utils.GetFiles(0, products[0].Product).Files; StackHashEventPackageCollection events = m_Utils.GetProductEventPackages(0, products[0].Product).EventPackages; StackHashCabPackageCollection cabs = events[0].Cabs; products[0].Product.Id++; // Wrong ID. DownloadCabResponse resp = m_Utils.DownloadCab(0, products[0].Product, files[0], events[0].EventData, events[0].Cabs[0].Cab, 30000); } catch (FaultException <ReceiverFaultDetail> ex) { Assert.AreEqual(true, ex.Message.Contains("Product does not exist")); } } finally { m_Utils.DeactivateContext(0); m_Utils.DeleteIndex(0); } }
public void RunBugReportSpecificEvent() { m_Utils.RegisterForNotifications(true, m_Utils.ApplicationGuid); m_Utils.CreateAndSetNewContext(ErrorIndexType.SqlExpress); GetContextBugTrackerPlugInSettingsResponse resp = m_Utils.GetContextBugTrackerPlugInSettings(0); Assert.AreNotEqual(null, resp.BugTrackerPlugInSettings); Assert.AreNotEqual(null, resp.BugTrackerPlugInSettings.PlugInSettings); Assert.AreEqual(0, resp.BugTrackerPlugInSettings.PlugInSettings.Count); resp.BugTrackerPlugInSettings.PlugInSettings.Add(new StackHashBugTrackerPlugIn()); resp.BugTrackerPlugInSettings.PlugInSettings[0].Enabled = true; resp.BugTrackerPlugInSettings.PlugInSettings[0].Name = "TestPlugIn"; resp.BugTrackerPlugInSettings.PlugInSettings[0].Properties = new StackHashNameValueCollection(); resp.BugTrackerPlugInSettings.PlugInSettings[0].Properties.Add(new StackHashNameValuePair() { Name = "TestParam1", Value = "TestValue1" }); resp.BugTrackerPlugInSettings.PlugInSettings[0].Properties.Add(new StackHashNameValuePair() { Name = "TestParam2", Value = "TestValue2" }); m_Utils.SetContextBugTrackerPlugInSettings(0, resp.BugTrackerPlugInSettings); m_Utils.RestartService(); m_Utils.ActivateContext(0); StackHashTestIndexData indexData = new StackHashTestIndexData(); indexData.NumberOfProducts = 1; indexData.NumberOfFiles = 1; indexData.NumberOfEvents = 1; indexData.NumberOfCabs = 1; indexData.NumberOfEventInfos = 1; m_Utils.CreateTestIndex(0, indexData); try { StackHashProductInfoCollection products = m_Utils.GetProducts(0).Products; StackHashFileCollection files = m_Utils.GetFiles(0, products[0].Product).Files; StackHashEventPackageCollection events = m_Utils.GetProductEventPackages(0, products[0].Product).EventPackages; StackHashCabPackageCollection cabs = events[0].Cabs; StackHashBugReportDataCollection bugReportDataCollection = new StackHashBugReportDataCollection(); bugReportDataCollection.Add(new StackHashBugReportData() { Product = products[0].Product, File = files[0], TheEvent = events[0].EventData, Cab = null, ScriptName = null, Options = StackHashReportOptions.IncludeAllObjects }); m_Utils.RunBugReportTask(0, bugReportDataCollection, 30000, true); } finally { m_Utils.DeactivateContext(0); m_Utils.DeleteIndex(0); } }
public void RunBugReportSpecificFileProgressCheckManyEventsAbortTest() { m_Utils.RegisterForNotifications(true, m_Utils.ApplicationGuid); m_Utils.CreateAndSetNewContext(ErrorIndexType.SqlExpress); GetContextBugTrackerPlugInSettingsResponse resp = m_Utils.GetContextBugTrackerPlugInSettings(0); Assert.AreNotEqual(null, resp.BugTrackerPlugInSettings); Assert.AreNotEqual(null, resp.BugTrackerPlugInSettings.PlugInSettings); Assert.AreEqual(0, resp.BugTrackerPlugInSettings.PlugInSettings.Count); resp.BugTrackerPlugInSettings.PlugInSettings.Add(new StackHashBugTrackerPlugIn()); resp.BugTrackerPlugInSettings.PlugInSettings[0].Enabled = true; resp.BugTrackerPlugInSettings.PlugInSettings[0].Name = "TestPlugIn"; resp.BugTrackerPlugInSettings.PlugInSettings[0].Properties = new StackHashNameValueCollection(); resp.BugTrackerPlugInSettings.PlugInSettings[0].Properties.Add(new StackHashNameValuePair() { Name = "TestParam1", Value = "TestValue1" }); resp.BugTrackerPlugInSettings.PlugInSettings[0].Properties.Add(new StackHashNameValuePair() { Name = "TestParam2", Value = "TestValue2" }); m_Utils.SetContextBugTrackerPlugInSettings(0, resp.BugTrackerPlugInSettings); m_Utils.RestartService(); m_Utils.ActivateContext(0); StackHashTestIndexData indexData = new StackHashTestIndexData(); indexData.NumberOfProducts = 1; indexData.NumberOfFiles = 1; indexData.NumberOfEvents = 200; indexData.NumberOfCabs = 1; indexData.NumberOfEventInfos = 1; m_Utils.CreateTestIndex(0, indexData); try { StackHashProductInfoCollection products = m_Utils.GetProducts(0).Products; StackHashFileCollection files = m_Utils.GetFiles(0, products[0].Product).Files; StackHashEventPackageCollection events = m_Utils.GetProductEventPackages(0, products[0].Product).EventPackages; StackHashCabPackageCollection cabs = events[0].Cabs; StackHashBugReportDataCollection bugReportDataCollection = new StackHashBugReportDataCollection(); bugReportDataCollection.Add(new StackHashBugReportData() { Product = products[0].Product, File = files[0], TheEvent = null, Cab = null, ScriptName = null, Options = StackHashReportOptions.IncludeAllObjects }); m_Utils.RunBugReportTask(0, bugReportDataCollection, 0, false); // Don't wait. m_Utils.WaitForBugReportProgress(30000); m_Utils.AbortTask(0, StackHashTaskType.BugReportTask); m_Utils.WaitForBugReportTaskCompleted(30000); // Check the progress reports. Assert.AreEqual(true, m_Utils.BugReportProgressReports.Count < 100); long lastProgress = -1; foreach (StackHashAdminReport report in m_Utils.BugReportProgressReports) { StackHashBugReportProgressAdminReport progress = report as StackHashBugReportProgressAdminReport; Assert.AreEqual(true, progress.CurrentEvent > lastProgress); Assert.AreEqual(true, progress.CurrentEvent < progress.TotalEvents); lastProgress = progress.CurrentEvent; } } finally { m_Utils.DeactivateContext(0); m_Utils.DeleteIndex(0); } }