コード例 #1
0
        private bool ProcessQaError([NotNull] QaError qaError)
        {
            Assert.ArgumentNotNull(qaError, nameof(qaError));

            if (_msg.IsVerboseDebugEnabled)
            {
                _msg.DebugFormat("Issue found: {0}", qaError);
            }

            // TODO: Consider checking basic relevance (inside test perimeter?) here

            var eventArgs = new QaErrorEventArgs(qaError);

            QaError?.Invoke(this, eventArgs);

            if (eventArgs.Cancel)
            {
                return(false);
            }

            ITest test = qaError.Test;
            QualityConditionVerification conditionVerification =
                GetQualityConditionVerification(test);
            QualityCondition qualityCondition = conditionVerification.QualityCondition;

            Assert.NotNull(qualityCondition, "no quality condition for verification");

            StopInfo stopInfo = null;

            if (conditionVerification.StopOnError)
            {
                stopInfo = new StopInfo(qualityCondition, qaError.Description);

                foreach (InvolvedRow involvedRow in qaError.InvolvedRows)
                {
                    RowsWithStopConditions.Add(involvedRow.TableName,
                                               involvedRow.OID, stopInfo);
                }
            }

            if (!conditionVerification.AllowErrors)
            {
                conditionVerification.Fulfilled = false;

                if (stopInfo != null)
                {
                    // it's a stop condition, and it is a 'hard' condition, and the error is
                    // relevant --> consider the stop situation as sufficiently reported
                    // (no reporting in case of stopped tests required)
                    stopInfo.Reported = true;
                }
            }

            return(true);
        }
コード例 #2
0
        public RowWithStopCondition([NotNull] string tableName,
                                    int oid,
                                    [NotNull] StopInfo stopInfo)
        {
            Assert.ArgumentNotNullOrEmpty(tableName, nameof(tableName));
            Assert.ArgumentNotNull(stopInfo, nameof(tableName));

            OID       = oid;
            TableName = tableName;
            _stopInfo = stopInfo;
        }
コード例 #3
0
        internal static string GetStopInfoErrorDescription([NotNull] StopInfo stopInfo)
        {
            var sb = new StringBuilder();

            sb.AppendFormat("Not tested due to violation of stop condition {0}:",
                            stopInfo.QualityCondition.Name);
            sb.AppendLine();
            sb.Append(stopInfo.ErrorDescription);

            return(sb.ToString());
        }
コード例 #4
0
        public IEnumerable <RowWithStopCondition> GetRowsWithStopConditions()
        {
            foreach (KeyValuePair <RowReference, StopInfo> pair
                     in _rowsWithStopConditions)
            {
                RowReference rowReference = pair.Key;
                StopInfo     stopInfo     = pair.Value;

                yield return(new RowWithStopCondition(rowReference.TableName,
                                                      rowReference.OID,
                                                      stopInfo));
            }
        }
コード例 #5
0
        public void Add([NotNull] string tableName,
                        int objectID,
                        [NotNull] StopInfo stopInfo)
        {
            var rowReference = new RowReference(tableName, objectID);

            if (_rowsWithStopConditions.ContainsKey(rowReference))
            {
                return;
            }

            _rowsWithStopConditions.Add(rowReference, stopInfo);
        }
コード例 #6
0
        /// <summary>
        /// Handles the TestingRow event of the container.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RowEventArgs"/> instance containing the event data.</param>
        /// <remarks>Must be called within dom tx</remarks>
        private void container_TestingRow(object sender, RowEventArgs e)
        {
            if (Cancelled)
            {
                e.Cancel = true;
                return;
            }

            StopInfo stopInfo = RowsWithStopConditions.GetStopInfo(e.Row);

            var test = (ITest)sender;
            TestVerification testVerification = GetTestVerification(test);

            if (stopInfo != null)
            {
                if (!stopInfo.Reported)
                {
                    stopInfo.Reported = TryReportStopInfo(
                        stopInfo, e.Row,
                        testVerification.QualityConditionVerification);
                }

                // cancel further testing on this row
                e.Cancel = true;
                return;
            }

            _currentRow = e.Row;

            if (LocationBasedQualitySpecification != null)
            {
                var feature = e.Row as IFeature;

                if (feature != null &&
                    !LocationBasedQualitySpecification.IsFeatureToBeTested(
                        feature, e.Recycled, e.RecycleUnique,
                        testVerification.QualityCondition, e.IgnoreTestArea))
                {
                    e.Cancel = true;
                }
            }
        }
コード例 #7
0
        private bool TryReportStopInfo(
            [NotNull] StopInfo stopInfo,
            [NotNull] IRow row,
            [NotNull] QualityConditionVerification qualityConditionVerification)
        {
            Assert.ArgumentNotNull(stopInfo, nameof(stopInfo));
            Assert.ArgumentNotNull(row, nameof(row));
            Assert.ArgumentNotNull(qualityConditionVerification,
                                   nameof(qualityConditionVerification));

            qualityConditionVerification.StopCondition = stopInfo.QualityCondition;
            QualityCondition stoppedCondition = qualityConditionVerification.QualityCondition;

            Assert.NotNull(stoppedCondition, "stoppedCondition");

            // TODO gather all stopped conditions for the row, report at end
            // https://issuetracker02.eggits.net/browse/COM-248
            IGeometry errorGeom = TestUtils.GetShapeCopy(row);

            IList <ITest> stoppedTests = _testsByCondition[stoppedCondition];

            string description =
                TestExecutionUtils.GetStopInfoErrorDescription(stopInfo);

            foreach (ITest stoppedTest in stoppedTests)
            {
                // TODO add issue code
                var error = new QaError(stoppedTest, description,
                                        new[] { new InvolvedRow(row) },
                                        errorGeom, null, null);
                bool reported = ProcessQaError(error);

                if (reported)
                {
                    return(true);
                }
            }

            return(false);
        }