Пример #1
0
 public ValidationTest()
 {
     _parcelV       = new ParcelValidator();
     _recipientV    = new RecipientValidator();
     _truckV        = new TruckValidator();
     _hopArrivalV   = new HopArrivalValidator();
     _trackingInfoV = new TrackingInformationValidator();
     _errorV        = new ErrorValidator();
 }
Пример #2
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            Exception exception = null;

            if (!ReplicationTopology.TryLoadLocalSiteTopology(this.DomainController, out this.replicationTopology, out exception))
            {
                this.WriteErrorAndMonitoringEvent(exception, ExchangeErrorCategory.ServerOperation, null, 1002, "MSExchange Monitoring EdgeSynchronization");
                return;
            }
            if (this.replicationTopology.EdgeSyncServiceConfig == null)
            {
                this.ReportStatus(new EdgeSubscriptionStatus(string.Empty)
                {
                    SyncStatus    = ValidationStatus.NoSyncConfigured,
                    FailureDetail = Strings.EdgeSyncServiceConfigMissing((this.replicationTopology.LocalSite != null) ? this.replicationTopology.LocalSite.Name : string.Empty)
                });
                return;
            }
            if (this.replicationTopology.SiteEdgeServers.Count == 0)
            {
                this.ReportStatus(new EdgeSubscriptionStatus(string.Empty)
                {
                    SyncStatus    = ValidationStatus.NoSyncConfigured,
                    FailureDetail = Strings.NoSubscription((this.replicationTopology.LocalSite != null) ? this.replicationTopology.LocalSite.Name : string.Empty)
                });
                return;
            }
            List <EdgeSubscriptionStatus> list = new List <EdgeSubscriptionStatus>(this.replicationTopology.SiteEdgeServers.Count);

            foreach (Server server in this.replicationTopology.SiteEdgeServers)
            {
                if (string.IsNullOrEmpty(this.TargetServer) || this.TargetServer.Equals(server.Name, StringComparison.OrdinalIgnoreCase) || this.TargetServer.Equals(server.Fqdn))
                {
                    EdgeSubscriptionStatus edgeSubscriptionStatus = new EdgeSubscriptionStatus(server.Name);
                    EdgeConnectionInfo     edgeConnectionInfo     = new EdgeConnectionInfo(this.replicationTopology, server);
                    if (edgeConnectionInfo.EdgeConnection == null)
                    {
                        goto IL_3D5;
                    }
                    edgeSubscriptionStatus.LeaseHolder               = edgeConnectionInfo.LeaseHolder;
                    edgeSubscriptionStatus.LeaseType                 = edgeConnectionInfo.LeaseType;
                    edgeSubscriptionStatus.LeaseExpiryUtc            = edgeConnectionInfo.LeaseExpiry;
                    edgeSubscriptionStatus.LastSynchronizedUtc       = edgeConnectionInfo.LastSynchronizedDate;
                    edgeSubscriptionStatus.CredentialRecords.Records = CredentialRecordsLoader.Load(server);
                    edgeSubscriptionStatus.CookieRecords.Load(edgeConnectionInfo.Cookies);
                    if (this.VerifyRecipient != null)
                    {
                        RecipientValidator recipientValidator = new RecipientValidator(this.replicationTopology);
                        edgeSubscriptionStatus.RecipientStatus = recipientValidator.ValidateOneRecipient(edgeConnectionInfo, this.VerifyRecipient.ProxyAddressString);
                    }
                    else if (this.InitializeSubscriptionStatus(edgeConnectionInfo, ref edgeSubscriptionStatus))
                    {
                        if (!(DateTime.UtcNow > edgeSubscriptionStatus.LeaseExpiryUtc + this.GetAlertPaddingTimeSpan()))
                        {
                            bool flag = false;
                            if (edgeSubscriptionStatus.CookieRecords.Records.Count > 0)
                            {
                                using (MultiValuedProperty <CookieRecord> .Enumerator enumerator2 = edgeSubscriptionStatus.CookieRecords.Records.GetEnumerator())
                                {
                                    while (enumerator2.MoveNext())
                                    {
                                        CookieRecord cookieRecord = enumerator2.Current;
                                        if (DateTime.UtcNow > cookieRecord.LastUpdated + this.GetAlertPaddingTimeSpan())
                                        {
                                            flag = true;
                                        }
                                    }
                                    goto IL_2EC;
                                }
                                goto IL_2E9;
                            }
                            goto IL_2E9;
IL_2EC:
                            if (!flag)
                            {
                                edgeSubscriptionStatus.SyncStatus = ValidationStatus.Normal;
                                goto IL_313;
                            }
                            edgeSubscriptionStatus.SyncStatus    = ValidationStatus.Failed;
                            edgeSubscriptionStatus.FailureDetail = Strings.CookieNotUpdated;
                            goto IL_313;
IL_2E9:
                            flag = true;
                            goto IL_2EC;
                        }
                        edgeSubscriptionStatus.SyncStatus    = ValidationStatus.Failed;
                        edgeSubscriptionStatus.FailureDetail = Strings.LeaseExpired;
IL_313:
                        if (this.fullCompareMode)
                        {
                            try
                            {
                                this.LoadValidators();
                                edgeSubscriptionStatus.TransportConfigStatus       = this.transportConfigValidator.Validate(edgeConnectionInfo);
                                edgeSubscriptionStatus.TransportServerStatus       = this.transportServerValidator.Validate(edgeConnectionInfo);
                                edgeSubscriptionStatus.AcceptedDomainStatus        = this.acceptedDomainValidator.Validate(edgeConnectionInfo);
                                edgeSubscriptionStatus.RemoteDomainStatus          = this.remoteDomainValidator.Validate(edgeConnectionInfo);
                                edgeSubscriptionStatus.MessageClassificationStatus = this.messageClassificationValidator.Validate(edgeConnectionInfo);
                                edgeSubscriptionStatus.SendConnectorStatus         = this.sendConnectorValidator.Validate(edgeConnectionInfo);
                                if (!this.ExcludeRecipientTest.IsPresent)
                                {
                                    edgeSubscriptionStatus.RecipientStatus = this.recipientValidator.Validate(edgeConnectionInfo);
                                }
                                goto IL_3F5;
                            }
                            catch (ExDirectoryException ex)
                            {
                                edgeSubscriptionStatus.FailureDetail = ex.Message;
                                goto IL_3F5;
                            }
                            goto IL_3D5;
                        }
                    }
IL_3F5:
                    base.WriteObject(edgeSubscriptionStatus);
                    list.Add(edgeSubscriptionStatus);
                    continue;
IL_3D5:
                    edgeSubscriptionStatus.SyncStatus    = ValidationStatus.Failed;
                    edgeSubscriptionStatus.FailureDetail = Strings.SubscriptionConnectionError(edgeConnectionInfo.FailureDetail);
                    goto IL_3F5;
                }
            }
            if (this.MonitoringContext)
            {
                this.ReportMomStatus(list);
            }
            TaskLogger.LogExit();
        }