Esempio n. 1
0
        protected override List <Summary> GetSummaries(string url)
        {
            List <Summary> summaries = new List <Summary>();

            var baseHtml = RequestTo(url);

            if (baseHtml == null)
            {
                return(new List <Summary>());
            }

            var listSummaries = baseHtml.QuerySelectorAll("div.resume-search-item");

            foreach (var item in listSummaries)
            {
                var sum = GetSummary(item);
                if (sum != null)
                {
                    summaries.Add(sum);
                    Application.Current.Dispatcher.Invoke(new Action(() =>
                    {
                        Summaries.Add(sum);
                    }));
                }
                System.Threading.Thread.Sleep(8000);
            }

            return(summaries);
        }
 public GeneralPrefs(ComboBox.ObjectCollection mSummaries)
 {
     foreach (object s in mSummaries)
     {
         Summaries.Add(s.ToString());
     }
 }
        /// <summary>
        /// The object factory for a particular data collection instance.
        /// </summary>
        public virtual void CreateObjectsFromData(Summaries summaries, System.Data.DataSet data)
        {
            // Do nothing if we have nothing
            if (data == null || data.Tables.Count == 0 || data.Tables[0].Rows.Count == 0)
            {
                return;
            }


            // Create a local variable for the new instance.
            Summary newobj = null;

            // Create a local variable for the data row instance.
            System.Data.DataRow dr = null;


            // Iterate through the table rows
            for (int i = 0; i < data.Tables[0].Rows.Count; i++)
            {
                // Get a reference to the data row
                dr = data.Tables[0].Rows[i];
                // Create a new object instance
                newobj = System.Activator.CreateInstance(summaries.ContainsType[0]) as Summary;
                // Let the instance set its own members
                newobj.SetMembers(ref dr);
                // Add the new object to the collection instance
                summaries.Add(newobj);
            }
        }
        private async Task RunTestCollections(IMessageBus messageBus, CancellationTokenSource ctx, GroupedByCluster g,
                                              string[] testFilters)
        {
            var test = g.Collection.DisplayName.Replace("Test collection for", string.Empty).Trim();

            if (!MatchesATestFilter(test, testFilters))
            {
                return;
            }
            if (testFilters.Length > 0)
            {
                Console.WriteLine(" -> " + test);
            }

            try
            {
                var summary = await RunTestCollectionAsync(messageBus, g.Collection, g.TestCases, ctx)
                              .ConfigureAwait(false);

                var type        = g.Cluster?.GetType();
                var clusterName = type?.Name.Replace("Cluster", "") ?? "UNKNOWN";
                if (summary.Failed > 0)
                {
                    FailedCollections.Add(Tuple.Create(clusterName, test));
                }
                Summaries.Add(summary);
            }
            catch (TaskCanceledException)
            {
                // TODO: What should happen here?
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Fill the object with settings from UI
        /// </summary>
        public GeneralPrefs(bool mSaveArticleList, bool mIgnoreNoBots,
                            System.Windows.Forms.ComboBox.ObjectCollection mSummaries, string mSelectedSummary,
                            string[] mPasteMore, string mFindText, bool mFindRegex, bool mFindCaseSensitive, bool mWordWrap,
                            bool mToolBarEnabled, bool mBypassRedirect, bool mAutoSaveSettings, bool mPreParseMode, bool mNoAutoChanges, int mOnLoadAction, bool mMinor,
                            bool mWatch, bool mDoNotWatch, bool mTimerEnabled, bool mSortListAlphabetically, bool mAddIgnoredToLog, int mTextBoxSize,
                            string mTextBoxFont, bool mLowThreadPriority, bool mBeep, bool mFlash, bool mMinimize,
                            decimal mTimeOutLimit, bool autoSaveEditBoxEnabled, decimal autoSaveEditBoxPeriod,
                            string autoSaveEditBoxFile, bool mLockSummary, bool mEditToolbarEnabled, bool mSuppressUsingAWB,
                            bool mAddUsingAWBToActionSummaries, bool mfilterNonMainSpace, bool mAutoFilterDupes, bool mSortInterWikiOrder,
                            bool mReplaceReferenceTags, bool mFocusAtEndOfEditBox, bool mscrollToUnbalancedBrackets)
        {
            SaveArticleList = mSaveArticleList;
            IgnoreNoBots    = mIgnoreNoBots;

            foreach (object s in mSummaries)
            {
                Summaries.Add(s.ToString());
            }

            SelectedSummary        = mSelectedSummary;
            PasteMore              = mPasteMore;
            FindText               = mFindText;
            FindRegex              = mFindRegex;
            FindCaseSensitive      = mFindCaseSensitive;
            WordWrap               = mWordWrap;
            ToolBarEnabled         = mToolBarEnabled;
            BypassRedirect         = mBypassRedirect;
            AutoSaveSettings       = mAutoSaveSettings;
            PreParseMode           = mPreParseMode;
            NoAutoChanges          = mNoAutoChanges;
            OnLoadAction           = mOnLoadAction;
            Minor                  = mMinor;
            Watch                  = mWatch;
            DoNotWatch             = mDoNotWatch;
            TimerEnabled           = mTimerEnabled;
            SortListAlphabetically = mSortListAlphabetically;
            AddIgnoredToLog        = mAddIgnoredToLog;
            TextBoxSize            = mTextBoxSize;
            TextBoxFont            = mTextBoxFont;
            LowThreadPriority      = mLowThreadPriority;
            Beep         = mBeep;
            Flash        = mFlash;
            Minimize     = mMinimize;
            TimeOutLimit = mTimeOutLimit;
            AutoSaveEdit = new EditBoxAutoSavePrefs(autoSaveEditBoxEnabled, autoSaveEditBoxPeriod,
                                                    autoSaveEditBoxFile);
            LockSummary                  = mLockSummary;
            EditToolbarEnabled           = mEditToolbarEnabled;
            SuppressUsingAWB             = mSuppressUsingAWB;
            AddUsingAWBToActionSummaries = mAddUsingAWBToActionSummaries;
            filterNonMainSpace           = mfilterNonMainSpace;
            AutoFilterDuplicates         = mAutoFilterDupes;
            FocusAtEndOfEditBox          = mFocusAtEndOfEditBox;
            scrollToUnbalancedBrackets   = mscrollToUnbalancedBrackets;

            SortInterWikiOrder   = mSortInterWikiOrder;
            ReplaceReferenceTags = mReplaceReferenceTags;
        }
Esempio n. 6
0
        private async Task LoadSummariesAsync()
        {
            Summaries.Clear();
            var summaries = await Database.ExecuteAsync(Query);

            foreach (var summary in summaries)
            {
                Summaries.Add(summary);
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Add a summary to the collection.
        /// </summary>
        /// <param name="newSummary">The summary to be added.</param>
        public static void AddSummary(MediaHighwaySummary newSummary)
        {
            foreach (MediaHighwaySummary oldSummary in Summaries)
            {
                if (oldSummary.EventID == newSummary.EventID && oldSummary.ShortDescription == newSummary.ShortDescription)
                {
                    return;
                }

                if (oldSummary.EventID > newSummary.EventID)
                {
                    Summaries.Insert(Summaries.IndexOf(oldSummary), newSummary);
                    return;
                }
            }

            Summaries.Add(newSummary);
        }
        /// <summary>
        /// The object factory for a particular data collection instance.
        /// </summary>
        public virtual void CreateObjectsFromData(Summaries summaries, System.Data.SqlClient.SqlDataReader data)
        {
            // Do nothing if we have nothing
            if (data == null)
            {
                return;
            }


            // Create a local variable for the new instance.
            Summary newobj = null;

            // Iterate through the data reader
            while (data.Read())
            {
                // Create a new object instance
                newobj = System.Activator.CreateInstance(summaries.ContainsType[0]) as Summary;
                // Let the instance set its own members
                newobj.SetMembers(ref data);
                // Add the new object to the collection instance
                summaries.Add(newobj);
            }
        }
        public void Update(Account selectedAccount, DateTime?start, DateTime?end)
        {
            Start = start;
            End   = end;
            var transactions = Dao.Query(GetCurrentRange(start, end, x => x.AccountId == selectedAccount.Id)).OrderBy(x => x.Date);

            Transactions = transactions.Select(x => new AccountDetailData(x, selectedAccount)).ToList();
            if (start.HasValue)
            {
                var pastDebit    = Dao.Sum(x => x.Debit, GetPastRange(start, x => x.AccountId == selectedAccount.Id));
                var pastCredit   = Dao.Sum(x => x.Credit, GetPastRange(start, x => x.AccountId == selectedAccount.Id));
                var pastExchange = Dao.Sum(x => x.Exchange, GetPastRange(start, x => x.AccountId == selectedAccount.Id));
                if (pastCredit > 0 || pastDebit > 0)
                {
                    Summaries.Add(new AccountSummaryData(Resources.TransactionTotal, Transactions.Sum(x => x.Debit), Transactions.Sum(x => x.Credit)));
                    var detailValue =
                        new AccountDetailData(
                            new AccountTransactionValue
                    {
                        Date     = start.GetValueOrDefault(),
                        Name     = Resources.BalanceBroughtForward,
                        Credit   = pastCredit,
                        Debit    = pastDebit,
                        Exchange = pastExchange
                    }, selectedAccount)
                    {
                        IsBold = true
                    };
                    Transactions.Insert(0, detailValue);
                }
            }
            if (end.HasValue && end != start)
            {
                var futureDebit    = Dao.Sum(x => x.Debit, GetFutureRange(end, x => x.AccountId == selectedAccount.Id));
                var futureCredit   = Dao.Sum(x => x.Credit, GetFutureRange(end, x => x.AccountId == selectedAccount.Id));
                var futureExchange = Dao.Sum(x => x.Exchange, GetFutureRange(end, x => x.AccountId == selectedAccount.Id));
                if (futureCredit > 0 || futureDebit > 0)
                {
                    Summaries.Add(new AccountSummaryData(Resources.DateRangeTotal, Transactions.Sum(x => x.Debit), Transactions.Sum(x => x.Credit)));
                    var detailValue =
                        new AccountDetailData(
                            new AccountTransactionValue
                    {
                        Date     = end.GetValueOrDefault(),
                        Name     = Resources.BalanceAfterDate,
                        Credit   = futureCredit,
                        Debit    = futureDebit,
                        Exchange = futureExchange
                    }, selectedAccount)
                    {
                        IsBold = true
                    };
                    Transactions.Add(detailValue);
                }
            }

            Summaries.Add(new AccountSummaryData(Resources.GrandTotal, Transactions.Sum(x => x.Debit), Transactions.Sum(x => x.Credit)));

            for (var i = 0; i < Transactions.Count; i++)
            {
                Transactions[i].Balance = (Transactions[i].Debit - Transactions[i].Credit);
                if (i > 0)
                {
                    (Transactions[i].Balance) += (Transactions[i - 1].Balance);
                }
            }
        }
Esempio n. 10
0
 public void AddSummary(SummaryViewModel summary)
 {
     Summaries.Add(summary);
 }
        private async Task <RunSummary> IntegrationPipeline(int defaultMaxConcurrency, IMessageBus messageBus,
                                                            CancellationTokenSource ctx)
        {
            var testFilters = CreateTestFilters(TestFilter);

            foreach (var group in _grouped)
            {
                ElasticXunitRunner.CurrentCluster = @group.Key;
                if (@group.Key == null)
                {
                    var testCount = @group.SelectMany(q => q.TestCases).Count();
                    Console.WriteLine($" -> Several tests skipped because they have no cluster associated");
                    Summaries.Add(new RunSummary {
                        Total = testCount, Skipped = testCount
                    });
                    continue;
                }

                var type        = @group.Key.GetType();
                var clusterName = type.Name.Replace("Cluster", string.Empty) ?? "UNKNOWN";
                if (!MatchesClusterFilter(clusterName))
                {
                    continue;
                }

                var dop = @group.Key.ClusterConfiguration?.MaxConcurrency ?? defaultMaxConcurrency;
                dop = dop <= 0 ? defaultMaxConcurrency : dop;

                var timeout = @group.Key.ClusterConfiguration?.Timeout ?? TimeSpan.FromMinutes(2);

                var skipReasons = @group.SelectMany(g => g.TestCases.Select(t => t.SkipReason)).ToList();
                var allSkipped  = skipReasons.All(r => !string.IsNullOrWhiteSpace(r));
                if (allSkipped)
                {
                    Console.WriteLine($" -> All tests from {clusterName} are skipped under the current configuration");
                    Summaries.Add(new RunSummary {
                        Total = skipReasons.Count, Skipped = skipReasons.Count
                    });
                    continue;
                }

                ClusterTotals.Add(clusterName, Stopwatch.StartNew());

                bool ValidateRunningVersion()
                {
                    try
                    {
                        var t = new ValidateRunningVersion();
                        t.Run(@group.Key);
                        return(true);
                    }
                    catch (Exception)
                    {
                        return(false);
                    }
                }

                using (@group.Key)
                {
                    if (!IntegrationTestsMayUseAlreadyRunningNode || !ValidateRunningVersion())
                    {
                        @group.Key?.Start(timeout);
                    }

                    await @group.ForEachAsync(dop,
                                              async g =>
                    {
                        await RunTestCollections(messageBus, ctx, g, testFilters).ConfigureAwait(false);
                    })
                    .ConfigureAwait(false);
                }

                ClusterTotals[clusterName].Stop();
            }

            return(new RunSummary
            {
                Total = Summaries.Sum(s => s.Total),
                Failed = Summaries.Sum(s => s.Failed),
                Skipped = Summaries.Sum(s => s.Skipped)
            });
        }