Exemple #1
0
        public void SetUp()
        {
            MockedConfigurationManager = new Mock<IConfigurationManager>();
            MockedHttpRuntime = new Mock<IHttpRuntime>();

            ConfigSettings = new Core.Impl.ConfigSettings(MockedHttpRuntime.Object, MockedConfigurationManager.Object);
        }
Exemple #2
0
 public PackageLogService(IRepository<PackageLogEntry> packageLogRepository, IWebFaultExceptionCreator webFaultExceptionCreator,
     IConfigSettings configSettings, ILogger logger)
     : base(webFaultExceptionCreator, logger)
 {
     _packageLogRepository = packageLogRepository;
     _configSettings = configSettings;
 }
Exemple #3
0
 public SpeechMaker(IConfigSettings configSettings, ISpeechTextParser speechTextParser)
 {
     _speechTextParser = speechTextParser;
     _brokenBuildText = configSettings.BrokenBuildText;
     _fixedBuildText = configSettings.FixedBuildText;
     configSettings.AddObserver(this);
 }
Exemple #4
0
 public PollTimer(IConfigSettings configSettings)
 {
     _pollTimer = new DispatcherTimer
     {
         Interval = configSettings.PollFrequencyTimeSpan
     };
 }
 public BuildBuster(IConfigSettings configSettings, FixerStrategy fixerStrategy, GuiltFactory guiltFactory)
 {
     _fixerStrategy = fixerStrategy;
     _guiltFactory = guiltFactory;
     SetGuiltStrategy(configSettings);
     configSettings.AddObserver(this);
 }
        public string WriteFile(IConfigSettings configSettings)
        {
            string configRootDirectory = ConfigurationManager.AppSettings["ConfigRootDirectory"];
            string filename = ConfigurationManager.AppSettings["ConfigFilename"];

            if (string.IsNullOrEmpty(configRootDirectory))
                configRootDirectory = System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
            if (string.IsNullOrEmpty(filename))
                filename = FILENAME;

            try
            {
                var json = JsonConvert.SerializeObject(configSettings, Formatting.Indented);
                File.WriteAllText(filename, json);
            }
            catch (Exception ex)
            {
                return string.Format("Error writing configuration file: {0}", ex.Message);
            }

            var handler = this.ConfigurationSettingsChanged;
            if (handler != null)
            {
                var kioskSettingsChangedEvent = new KioskConfigSettingsEventArgs();
                kioskSettingsChangedEvent.ConfigSettings = configSettings;
                handler(this, kioskSettingsChangedEvent);
            }

            return "File written successfully.";
        }
 public CachedFeedService(IConfigSettings configSettings, IRootPathProvider rootPathProvider)
 {
     this.rootPathProvider = rootPathProvider;
     cacheMinutes = configSettings.GetAppSetting<int>("cacheminutes");
     nancyCategories = configSettings.GetAppSetting("nancycategories")
         .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
 }
        public MediaFilePathFactory(
            IConfigSettings configService)
        {
            Check.Require(configService != null, "configService may not be null");

            _configSettings = configService;
        }
Exemple #9
0
 public PackageFileService(IPackageCreator packageCreator, IWebFaultExceptionCreator webFaultExceptionCreator,
     IServiceInputValidator serviceInputValidator, IConfigSettings configSettings, ILogger logger)
     : base(webFaultExceptionCreator, logger)
 {
     _packageCreator = packageCreator;
     _serviceInputValidator = serviceInputValidator;
     _configSettings = configSettings;
 }
        public BuildDataFetcher(ViewUrl viewUrl, IConfigSettings configSettings,
								IWebClientFactory webClientFactory)
        {
            _viewUrl = viewUrl;
            _webClientFactory = webClientFactory;
            _webClient = webClientFactory.GetWebClient(configSettings.URL);
            configSettings.AddObserver(this);
        }
Exemple #11
0
        public BuildDataFetcher(CruiseAddress cruiseAddress, IConfigSettings configSettings,
		                        IWebClientFactory webClientFactory)
        {
            _cruiseAddress = cruiseAddress;
            _webClientFactory = webClientFactory;
            _webClient = webClientFactory.GetWebClient(configSettings.URL);
            configSettings.AddObserver(this);
        }
Exemple #12
0
        public DiscJockey(IConfigSettings configSettings, IAudioPlayer audioPlayer, SpeechMaker speechMaker)
        {
            _audioPlayer = audioPlayer;
            _speechMaker = speechMaker;
            _brokenBuildSound = configSettings.BrokenBuildSound;
            _fixedBuildSound = configSettings.FixedBuildSound;

            configSettings.AddObserver(this);
        }
Exemple #13
0
        public CountdownTimer(IConfigSettings configSettings, ICradiatorView view)
        {
            _view = view;
            _isSwitchedOn = configSettings.ShowCountdown;
            PollFrequency = configSettings.PollFrequencyTimeSpan;

            _countdownTimer = new DispatcherTimer { Interval = OneSecond };
            _countdownTimer.Tick += CountdownTimer_Tick;
            Reset();
        }
        public void SetUp()
        {
            _view = MockRepository.GenerateMock<ICradiatorView>();
            _configSettings = MockRepository.GenerateMock<IConfigSettings>();
            _configSettings.Expect(c => c.ProjectNameRegEx).Return(".*").Repeat.Any();

            _kernel = new StandardKernel(new CradiatorNinjaModule(_view, _configSettings));
            _factory = _kernel.Get<IWebClientFactory>();
            _kernel.Get<BuildDataTransformer>();
        }
        public static string GetMachineName(IConfigSettings config)
        {
            var name = AzureRoleEnvironment.IsEmulated()
                ? Environment.MachineName
                : string.Format("{0}_{1}", AzureRoleEnvironment.CurrentRoleInstanceId(), config.TentacleEnvironment);

            if (!string.IsNullOrEmpty(config.TentacleMachineNameSuffix))
                name = string.Format("{0}_{1}", name, config.TentacleMachineNameSuffix);

            return name;
        }
        public SettingsWindow(IConfigSettings configSettings, ICradiatorView view, ISpeechSynthesizer speechSynth)
        {
            _configSettings = configSettings;
            _view = view;
            _speechSynth = speechSynth;

            InitializeComponent();
            SetBindings();

            _view.Closing += ((sender, e) => Close());
            _view.Activated += ((sender, e) => Owner = view.Window);
            Closing += SettingsWindow_Closing;
        }
        public AzureBlobFileRepository(IConfigSettings configSettings)
        {
            var setting = configSettings.Get("StorageConnectionString");
            containerName = configSettings.Get("BlobContainerName");
            storageAccount = CloudStorageAccount.Parse(setting);
            blobClient = storageAccount.CreateCloudBlobClient();
            container = blobClient.GetContainerReference(containerName.ToLower());

            container.CreateIfNotExist();
            container.SetPermissions(new BlobContainerPermissions
            {
                PublicAccess = BlobContainerPublicAccessType.Blob
            });
        }
Exemple #18
0
        public AudioPlayer(ISpeechSynthesizer speechSynth, IConfigSettings configSettings, 
						   VoiceSelector voiceSelector, IAppLocation appLocation)
        {
            _voiceSelector = voiceSelector;
            _speechVoiceName = configSettings.SpeechVoiceName;
            _playSounds = configSettings.PlaySounds;
            _playSpeech = configSettings.PlaySpeech;
            _wavFileFolder = Path.Combine(appLocation.DirectoryName, "sounds");

            _speechSynth = speechSynth;
            _speechSynth.Rate = -2;		//TODO might be useful as configuration

            configSettings.AddObserver(this);
        }
Exemple #19
0
        public void SetUp()
        {
            _webClientFactory = MockRepository.GenerateMock<IWebClientFactory>();
            _webClient = MockRepository.GenerateStub<IWebClient>();

            _webClientFactory.Expect(w => w.GetWebClient(Arg<string>.Is.Anything)).Return(_webClient).Repeat.Once();

            _configSettings = new ConfigSettings { ProjectNameRegEx = ".*" };
            _urlUpdateResponder = new UrlUpdateResponder(
                new StatusFetcher(new CruiseAddress("url"),
                    _configSettings, _webClientFactory), _configSettings, _webClientFactory);

            _configSettings.URL = "currentUrl";
        }
        public CradiatorWindow(IConfigSettings configSettings)
        {
            try
            {
                InitializeComponent();
            }
            catch (Exception exception)
            {
                _log.Error(exception);	// usually xaml issues
                throw;
            }

            _pollFrequency = configSettings.PollFrequency;
            _isShowProgressConfigured = configSettings.ShowProgress;
            configSettings.AddObserver(this);
        }
        public CradiatorPresenter(ICradiatorView view, IConfigSettings configSettings,
		                          IConfigFileWatcher configFileWatcher, ISkinLoader skinLoader,
		                          ConfigChangeHandlerFarm changeHandlerFarm, IScreenUpdater screenUpdater,
		                          InputBindingAdder inputBindingAdder)
        {
            _view = view;
            view.Presenter = this;
            _configSettings = configSettings;
            _configFileWatcher = configFileWatcher;
            _screenUpdater = screenUpdater;
            _skinLoader = skinLoader;
            _changeHandlerFarm = changeHandlerFarm;

            inputBindingAdder.AddBindings();
            configSettings.AddObserver(this);
        }
Exemple #22
0
 public PackageCreator(IFileSystem fileSystem, IGuid guid, IPackageFactory packageFactory, IConfigSettings configSettings,
     IRepository<Package> packageRepository, IPackageAuthenticator packageAuthenticator, IHashGetter hashGetter,
     IPackageIdValidator packageIdValidator, IPackageUriValidator packageUriValidator,
     ILatestVersionChecker latestVersionChecker, ILatestVersionUpdater<Package> latestVersionUpdater)
 {
     _fileSystem = fileSystem;
     _latestVersionUpdater = latestVersionUpdater;
     _latestVersionChecker = latestVersionChecker;
     _packageIdValidator = packageIdValidator;
     _guid = guid;
     _packageFactory = packageFactory;
     _configSettings = configSettings;
     _packageRepository = packageRepository;
     _packageAuthenticator = packageAuthenticator;
     _hashGetter = hashGetter;
     _packageUriValidator = packageUriValidator;
 }
Exemple #23
0
        public void SetUp()
        {
            _view = MockRepository.GenerateMock<ICradiatorView>();
            _configSettings = MockRepository.GenerateMock<IConfigSettings>();
            _configSettings.Expect(c => c.ProjectNameRegEx).Return(".*").Repeat.Any();
            _configSettings.Expect(c => c.CategoryRegEx).Return(".*").Repeat.Any();

            _skinLoader = MockRepository.GenerateMock<ISkinLoader>();
            _screenUpdater = MockRepository.GenerateMock<IScreenUpdater>();
            _configFileWatcher = MockRepository.GenerateMock<IConfigFileWatcher>();

            var bootstrapper = new Bootstrapper(_configSettings, _view);
            _kernel = bootstrapper.CreateKernel();
            _kernel.Rebind<ISkinLoader>().ToConstant(_skinLoader);
            _kernel.Rebind<IScreenUpdater>().ToConstant(_screenUpdater);
            _kernel.Rebind<IConfigFileWatcher>().ToConstant(_configFileWatcher);
        }
Exemple #24
0
        public HomeModule(IPostService postService, IFeedService feedService, IConfigSettings configSettings)
        {
            Get["/"] = _ =>
            {
                int currentPage;
                int pageSize;

                if (!int.TryParse(Request.Query.currentpage.ToString(), out currentPage))
                {
                    currentPage = 1;
                }

                if (!int.TryParse(Request.Query.pagesize.ToString(), out pageSize))
                {
                    pageSize = 10;
                }

                var viewmodel = postService.GetViewModel(pageSize, currentPage);

                return View["index", viewmodel];
            };

            Get["/{title}"] = parameters =>
            {
                var post = feedService.GetItem(parameters.title);
                if (post == null)
                {
                    return View["404"];
                }

                return View["post", post];
            };

            Get["/about"] = _ =>
            {
                var model = configSettings.GetAppSetting("nancycategories")
                    .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                ViewBag.NancyCategories = string.Join(" or ", model);

                return View["about"];
            };

            Get["/rss"] = x => Response.AsRSS(feedService.GetItems(), "Nancy Blog", "http://blog.nancyfx.org/", "feed.xml");
        }
        public SystemStateManager(
            IDocumentSession documentSession,
            IDocumentStore documentStore,
            IConfigSettings configService,
            IMessageBus messageBus,
            IMediaResourceFactory mediaResourceFactory)
        {
            Check.RequireNotNull(documentSession, "documentSession");
            Check.RequireNotNull(documentStore, "documentStore");
            Check.RequireNotNull(configService, "configService");
            Check.RequireNotNull(messageBus, "messageBus");
            Check.RequireNotNull(mediaResourceFactory, "mediaResourceFactory");

            _documentSession = documentSession;
            _documentStore = documentStore;
            _configSettings = configService;
            _messageBus = messageBus;
            _mediaResourceFactory = mediaResourceFactory;
        }
        public ScreenUpdater(ICradiatorView view, DiscJockey discJockey, ICountdownTimer countdownTimer,
            IPollTimer pollTimer, IConfigSettings configSettings,
            BuildDataFetcher buildDataFetcher, BuildDataTransformer transformer,
            FetchExceptionHandler fetchExceptionHandler, BackgroundWorker worker)
        {
            _view = view;
            _discJockey = discJockey;
            _countdownTimer = countdownTimer;
            _pollTimer = pollTimer;
            _configSettings = configSettings;
            _pollTimer.Tick = (sender, e) => PollTimeup();
            _fetcher = buildDataFetcher;
            _fetchExceptionHandler = fetchExceptionHandler;
            _transformer = transformer;

            SetLocalValuesFromConfig(configSettings);

            _configSettings.AddObserver(this);

            _worker = worker;
            worker.DoWork += FetchData;
            worker.RunWorkerCompleted += DataFetched;
        }
 public TestConfiguration(IConfigSettings configSettings)
 {
     this.configSettings = configSettings;
 }
 void SetRegex(IConfigSettings newSettings)
 {
     _projectNameRegEx = new Regex(newSettings.ProjectNameRegEx);
     _categoryRegEx = new Regex(newSettings.CategoryRegEx);
 }
 /// <summary>
 /// Removes the registration of IConfigSettings from application container
 /// </summary>
 /// <returns>True if settings instance was found and removed</returns>
 public bool UnregisterConfigSettings(IConfigSettings settings)
 {
     if (m_ShutdownStarted || settings==null) return false;
     lock(m_ConfigSettings)
       return m_ConfigSettings.Remove(settings);
 }
 public BuildDataTransformer(IConfigSettings configSettings)
 {
     SetRegex(configSettings);
     configSettings.AddObserver(this);
 }