예제 #1
0
        /// <summary>
        /// Executes the Ps1 script with DryDun switch,
        /// Parses the output to acquire primary and legacy Urls,
        /// Tests the primary Url to see if it is available,
        /// Reports the results to the data service provided.
        /// </summary>
        internal static async Task ExecuteDryRunCheckAndReportUrlAccessAsync(ILogger log, string monitorName, string additionalCmdArgs,
                                                                             CancellationToken cancellationToken = default)
        {
            string scriptName      = "dotnet-install.ps1";
            string commandLineArgs = $"-DryRun {additionalCmdArgs}";

            using IDataService dataService = new DataServiceFactory().GetDataService();

            // Execute the script;
            ScriptExecutionResult results = await HelperMethods.ExecuteInstallScriptPs1Async(commandLineArgs).ConfigureAwait(false);

            log.LogInformation($"Ouput stream: {results.Output}");

            if (!string.IsNullOrWhiteSpace(results.Error))
            {
                log.LogError($"Error stream: {results.Error}");
                await dataService.ReportScriptExecutionAsync(monitorName, scriptName, commandLineArgs, results.Error, cancellationToken)
                .ConfigureAwait(false);

                return;
            }

            // Parse the output
            ScriptDryRunResult dryRunResults = ParseDryRunOutput(results.Output);

            if (string.IsNullOrWhiteSpace(dryRunResults.PrimaryUrl))
            {
                log.LogError($"Primary Url was not found for channel {additionalCmdArgs}");
                await dataService.ReportScriptExecutionAsync(monitorName, scriptName, commandLineArgs,
                                                             "Failed to parse primary url from the following DryRun execution output: " + results.Output
                                                             , cancellationToken).ConfigureAwait(false);

                return;
            }

            // Validate URL accessibility
            await HelperMethods.CheckAndReportUrlAccessAsync(log, monitorName, dryRunResults.PrimaryUrl, dataService);
        }
예제 #2
0
        protected override async void OnLoad(EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            try
            {
                var ticket = await Session.GetTikectAsync();

                var results = await DataServiceFactory.Create().ListProcessesAsync(ticket);

                foreach (var item in results)
                {
                    if (item.active == 1)
                    {
                        AddToListView(item);
                    }
                }
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
예제 #3
0
        /// <summary>
        /// Loads Items from our DataServices and sort into grouped enumerable
        /// </summary>
        private async void LoadItems(bool overrideCache = false)
        {
            IsBusy = true;

            if (AppSettings.EnableRemoteAppSettings)
            {
                RemoteAppSettingsService remoteAppSettingsService = new RemoteAppSettingsService();
                await remoteAppSettingsService.LoadRemoteAppSettings(overrideCache);
            }

            //Name may change after RemoteSettings enabled
            ApplicationName = AppSettings.ApplicationName;

            if (AppSettings.EnableRemoteUrlSourceService)
            {
                await RemoteUrlSourceService.GetRemoteUrlSources();
            }

            EnabledDataServices = DataServiceFactory.GetCurrentDataService();

            if (EnabledDataServices.Count == 0)
            {
                ServiceLocator.MessageService.ShowErrorAsync("No DataServices Enabled", "Application Error");
                return;
            }

            items = new List <Item>();
            await DoFetchDataServices(EnabledDataServices, overrideCache);

            ItemGroups = new List <Group <Item> >(from item in items
                                                  group item by item.Group into grp
                                                  orderby grp.GetOrderPreference()
                                                  select new Group <Item>(grp.Key, grp)).ToList();

            IsBusy = false;
        }
예제 #4
0
 public static async Task RunAsync([TimerTrigger("0 */30 * * * *")] TimerInfo myTimer, ILogger log)
 {
     using IDataService dataService = new DataServiceFactory().GetDataService();
     await HelperMethods.CheckAndReportUrlAccessAsync(log, _monitorName, _url, dataService).ConfigureAwait(false);
 }
예제 #5
0
 public void ConstructorThrowsIoExceptionIfCacheBaseDirectoryDoesNotExist()
 {
     DataServiceFactory.GetService(StorageDomain.UserCacheData, new NewsComponentsConfiguration());
 }
예제 #6
0
 public void ConstructorThrowsArgumentNullExceptionIfConfigurationIsMissing()
 {
     Assert.Throws <ArgumentNullException>(() => DataServiceFactory.GetService(StorageDomain.UserCacheData, null));
 }
예제 #7
0
 public static PubHelper GetHelper()
 {
     return(new PubHelper(DataServiceFactory.Create(BLLConstants.SITE_DEFAULT + BLLConstants.BU_DEFAULT)));
 }
예제 #8
0
        public MainForm()
        {
            InitializeComponent();

            _dataService = DataServiceFactory.Create();
        }
 public UploadManager()
 {
     log         = LogManager.GetLogger(GetType());
     dataService = DataServiceFactory.Create();
     queue       = new Queue <Tuple <string, List <DokuField> > >();
 }
예제 #10
0
 public static DataContext GetDB(UserInfo ui)
 {
     return(DataServiceFactory.Create(ui.SiteCode + ui.BUCode));
 }
예제 #11
0
 public AGServer()
 {
     DataFactory.DataFactory.ConnectionString  = StaticConfigs.GetDBConfig("OracleConnectionString");
     DataFactory.DataFactory.SqlCommandTimeout = int.Parse(StaticConfigs.GetDBConfig("SqlCommandTimeout"));
     _dataServiceSample = new DataServiceFactory();
 }
예제 #12
0
 private ConstantsHelper(string site, string bu)
 {
     _site          = string.IsNullOrEmpty(site)?BLLConstants.SITE_DEFAULT:site;
     _bu            = string.IsNullOrEmpty(bu)?BLLConstants.BU_DEFAULT:bu;
     this.DBContext = DataServiceFactory.Create(_site + _bu);
 }
예제 #13
0
 private ConstantsHelper()
 {
     this.DBContext = DataServiceFactory.Create(_site + _bu);
 }