private void PerformGlobalLocatorServiceTest(ref GlobalLocatorServiceOutcome result) { bool flag = true; string error = string.Empty; StringBuilder stringBuilder = new StringBuilder(); GlobalLocatorServiceError globalLocatorServiceError = GlobalLocatorServiceError.None; Stopwatch stopwatch = Stopwatch.StartNew(); try { SmtpAddress?multiTenantAutomatedTaskUser = TestConnectivityCredentialsManager.GetMultiTenantAutomatedTaskUser(this, this.SystemConfigurationSession, this.SystemConfigurationSession.GetLocalSite(), DatacenterUserType.EDU); if (multiTenantAutomatedTaskUser == null) { throw new MailboxNotFoundException(new MailboxIdParameter(), null); } IGlobalLocatorServiceReader globalLocatorServiceReader = LocatorServiceClientReader.Create(GlsCallerId.Exchange); FindDomainResult findDomainResult = globalLocatorServiceReader.FindDomain(new SmtpDomain(multiTenantAutomatedTaskUser.Value.Domain), GlsDirectorySession.AllExoDomainProperties, GlsDirectorySession.AllExoTenantProperties); if (string.IsNullOrEmpty(findDomainResult.Domain)) { flag = false; error = "Domain not found"; } else { stringBuilder.AppendLine("Domain Found"); } } catch (CommunicationException ex) { flag = false; error = ex.Message; globalLocatorServiceError = GlobalLocatorServiceError.CommunicationException; } catch (Exception ex2) { flag = false; error = ex2.Message; globalLocatorServiceError = GlobalLocatorServiceError.OtherException; } stopwatch.Stop(); result.Update(flag ? GlobalLocatorServiceResultEnum.Success : GlobalLocatorServiceResultEnum.Failure, stopwatch.Elapsed, error, stringBuilder.ToString()); if (this.MonitoringContext) { this.monitoringData.Events.Add(new MonitoringEvent(TestGlobalLocatorServiceTask.CmdletMonitoringEventSource, flag ? 1000 : 2000, flag ? EventTypeEnumeration.Success : EventTypeEnumeration.Error, flag ? Strings.GlobalLocatorServiceSuccess : (Strings.GlobalLocatorServiceFailed(error) + " " + globalLocatorServiceError))); } }
protected override void InternalProcessRecord() { base.InternalBeginProcessing(); TaskLogger.LogEnter(); try { GlobalLocatorServiceOutcome sendToPipeline = new GlobalLocatorServiceOutcome(new ServerIdParameter().ToString()); this.PerformGlobalLocatorServiceTest(ref sendToPipeline); base.WriteObject(sendToPipeline); } catch (LocalizedException e) { this.HandleException(e); } finally { if (this.MonitoringContext) { base.WriteObject(this.monitoringData); } TaskLogger.LogExit(); } }