Exemple #1
0
        public void GetConfigTestFile()
        {
            SharpCvsLibConfig config =
                (SharpCvsLibConfig)ConfigurationSettings.GetConfig
                    (SharpCvsLibConfigHandler.APP_CONFIG_SECTION);

            this.CheckValues(config);
        }
Exemple #2
0
 private void CheckValues(SharpCvsLibConfig config)
 {
     Assert.AreEqual(TIMEOUT,
                     1000, "timeout value");
     Assert.AreEqual(AUTH_SLEEP,
                     1000,
                     "authorization sleep value");
 }
        /// <summary>
        /// Get a new instance of the configuration settings.  If the configuration
        ///     file cannot be loaded then use default configuration settings.
        /// </summary>
        /// <returns>The configuration settings contained in the configuration file,
        ///     or if that cannot be loaded then default configurations are
        ///     returned.</returns>
        public static SharpCvsLibConfig GetInstance()
        {
            SharpCvsLibConfig config;

            try {
                config =
                    (SharpCvsLibConfig)ConfigurationSettings.GetConfig
                        (SharpCvsLibConfigHandler.APP_CONFIG_SECTION);

                if (null == config)
                {
                    config = new SharpCvsLibConfig();
                }
            } catch (Exception e) {
                LOGGER.Error(e);
                config = new SharpCvsLibConfig();
            }
            return(config);
        }
Exemple #4
0
        public void LoadAppConfigTest()
        {
            SharpCvsLibConfigHandler configHandler =
                new SharpCvsLibConfigHandler();
            ConfigXmlDocument xmlDoc =
                new ConfigXmlDocument();

            xmlDoc.Load(CONFIG_FILE);

            SharpCvsLibConfig config = null;

            config =
                (SharpCvsLibConfig)configHandler.Create
                    (xmlDoc.SelectSingleNode("configuration"),
                    null,
                    xmlDoc.SelectSingleNode("//" +
                                            SharpCvsLibConfigHandler.APP_CONFIG_SECTION));
            this.CheckValues(config);
        }
 /// <summary>
 /// Constructor.
 ///
 /// // TODO: Write a more useful description.
 /// </summary>
 public ResponseLog () {
     this.settings = SharpCvsLibConfig.GetInstance();
 }
        private void Init () {
            inputStream  = new CvsStream (new MemoryStream());
            outputStream = new CvsStream (new MemoryStream());

            this.config = SharpCvsLibConfig.GetInstance();
            try {
                if (config.Log.DebugLog.Enabled) {
                    requestLog = new RequestLog ();
                    responseLog = new ResponseLog ();

                    this.InputStream.RequestMessage.MessageEvent +=
                        new EncodedMessage.MessageHandler (requestLog.Log);
                    this.OutputStream.ResponseMessage.MessageEvent +=
                        new EncodedMessage.MessageHandler (responseLog.Log);
                }
            } catch (Exception e) {
                LOGGER.Error (e);
            }

            if (null == config) {
                config = new SharpCvsLibConfig ();
            }
            LOGGER.Debug("Config=["  + config.ToString() + "]");

            if (this.repository == null) {
                this.repository = DeriveWorkingDirectory();
            }
        }
 /// <summary>
 /// Constructor.
 ///
 /// // TODO: Write a more useful description.
 /// </summary>
 public RequestLog () {
     this.settings = SharpCvsLibConfig.GetInstance();
 }
        /// <summary>
        /// Get a new instance of the configuration settings.  If the configuration
        ///     file cannot be loaded then use default configuration settings.
        /// </summary>
        /// <returns>The configuration settings contained in the configuration file,
        ///     or if that cannot be loaded then default configurations are
        ///     returned.</returns>
        public static SharpCvsLibConfig GetInstance () {
            SharpCvsLibConfig config;
            try {
                config =
                    (SharpCvsLibConfig)ConfigurationSettings.GetConfig
                    (SharpCvsLibConfigHandler.APP_CONFIG_SECTION);

                if (null == config) {
                    config = new SharpCvsLibConfig();
                }
            } catch (Exception e) {
                LOGGER.Error(e);
                config = new SharpCvsLibConfig();
            }
            return config;
        }