/// <summary>
        ///     Default Constructor to set the BVConfiguration values
        /// </summary>
        /// <param name="bvConfiguration"></param>
        public BVUIContentServiceProvider(BVConfiguration bvConfiguration)
        {
            _bvConfiguration = bvConfiguration;

            _message   = new StringBuilder();
            _uiContent = new StringBuilder();
        }
        /// <summary>
        ///     Default Constructor to set the BVConfiguration values
        /// </summary>
        /// <param name="bvConfiguration"></param>
        public BVUIContentServiceProvider(BVConfiguration bvConfiguration)
        {
            _bvConfiguration = bvConfiguration;

            _message = new StringBuilder();
            _uiContent = new StringBuilder();
        }
 /// <summary>
 ///     Configurable ctor for <see cref="HttpContentLoader" />.
 /// </summary>
 /// <param name="config">
 ///     <list type="bullet">
 ///         <listheader>
 ///             <description>Supported <see cref="BVClientConfig" /> properties</description>
 ///         </listheader>
 ///         <item>
 ///             <description>
 ///                 <see cref="BVClientConfig.CONNECT_TIMEOUT" />
 ///             </description>
 ///         </item>
 ///         <item>
 ///             <description>
 ///                 <see cref="BVClientConfig.SOCKET_TIMEOUT" />
 ///             </description>
 ///         </item>
 ///         <item>
 ///             <description>
 ///                 <see cref="BVClientConfig.PROXY_PORT" />
 ///             </description>
 ///         </item>
 ///         <item>
 ///             <description>
 ///                 <see cref="BVClientConfig.PROXY_HOST" />
 ///             </description>
 ///         </item>
 ///         <item>
 ///             <description>
 ///                 <see cref="BVClientConfig.CHARSET" />
 ///             </description>
 ///         </item>
 ///     </list>
 /// </param>
 /// <param name="userAgent">
 ///     Browser and system details to be forwarded as the <see cref="HttpRequestHeader.UserAgent" />
 ///     when loading content via HTTP.
 /// </param>
 public HttpContentLoader(BVConfiguration config, string userAgent)
 {
     ConnectionTimeout = int.Parse(config.getProperty(BVClientConfig.CONNECT_TIMEOUT));
     SocketTimeout     = int.Parse(config.getProperty(BVClientConfig.SOCKET_TIMEOUT));
     ProxyPort         = int.Parse(config.getProperty(BVClientConfig.PROXY_PORT));
     ProxyHost         = config.getProperty(BVClientConfig.PROXY_HOST);
     Encoding          = EncodingParser.GetEncoding(config.getProperty(BVClientConfig.CHARSET));
     UserAgent         = userAgent;
 }
        /// <summary>
        /// Constructor with BVConfiguration argument.
        /// </summary>
        /// <param name="bvConfiguration">The configuration/settings that has to be provided</param>
        public BVManagedUIContent(BVConfiguration bvConfiguration)
        {
            this._bvConfiguration = bvConfiguration;

            if (bvConfiguration == null)
            {
                this._bvConfiguration = new BVSdkConfiguration();
            }
        }
Ejemplo n.º 5
0
 public void BVGetSpotlights_TestInitialize()
 {
     _bvConfiguration = new BVSdkConfiguration();
     _bvConfiguration.addProperty(BVClientConfig.BV_ROOT_FOLDER, DISPLAY_CODE);
     _bvConfiguration.addProperty(BVClientConfig.CLOUD_KEY, CLOUD_KEY);
     _bvConfiguration.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");
     _bvConfiguration.addProperty(BVClientConfig.SEO_SDK_ENABLED, "true");
     _bvConfiguration.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "300000");
 }
        /// <summary>
        /// Constructor with BVConfiguration argument.
        /// </summary>
        /// <param name="bvConfiguration">The configuration/settings that has to be provided</param>
        public BVManagedUIContent(BVConfiguration bvConfiguration)
        {
            this._bvConfiguration = bvConfiguration;

            if (bvConfiguration == null)
            {
                this._bvConfiguration = new BVSdkConfiguration();
            }
        }
 public void BVGetSellerRatings_TestInitialize()
 {
     _bvConfiguration = new BVSdkConfiguration();
     _bvConfiguration.addProperty(BVClientConfig.BV_ROOT_FOLDER, DISPLAY_CODE);
     _bvConfiguration.addProperty(BVClientConfig.CLOUD_KEY, CLOUD_KEY);
     _bvConfiguration.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");
     _bvConfiguration.addProperty(BVClientConfig.SEO_SDK_ENABLED, "true");
     _bvConfiguration.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "300000");
 }
        public void BVSeoSdkURLBuilderTestInitialize()
        {
            bvConfiguration = new BVSdkConfiguration();

            bvConfiguration.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");
            bvConfiguration.addProperty(BVClientConfig.CLOUD_KEY,"myshco-359c29d8a8cbe3822bc0d7c58cb9f9ca");

            bvConfiguration.addProperty(BVClientConfig.LOCAL_SEO_FILE_ROOT, "/filePath");
            bvConfiguration.addProperty(BVClientConfig.BV_ROOT_FOLDER, "6574-en_us");
        }
Ejemplo n.º 9
0
        public void TestValidation_When_BVConfig_Is_Null()
        {
            bvConfig = null;
            bvParams = null;
            bvValidator = new BVDefaultValidator();
            errorMessage = bvValidator.validate(bvConfig, bvParams);
            Assert.AreEqual<Boolean>(errorMessage.Contains("BVConfiguration is null, please set a valid BVConfiguration.;"), true, "Error Messages are different.");

            bvConfig = new BVSdkConfiguration();
            bvParams = new BVParameters();
            bvValidator = new BVDefaultValidator();
            errorMessage = bvValidator.validate(bvConfig, bvParams);

            Assert.AreEqual<Boolean>(errorMessage.Contains("SubjectId cannot be null or empty.;"), true, "Error Messages are different.");
        }
Ejemplo n.º 10
0
        public void TestValidation_When_BVConfig_Is_Null()
        {
            bvConfig     = null;
            bvParams     = null;
            bvValidator  = new BVDefaultValidator();
            errorMessage = bvValidator.validate(bvConfig, bvParams);
            Assert.AreEqual <Boolean>(errorMessage.Contains("BVConfiguration is null, please set a valid BVConfiguration.;"), true, "Error Messages are different.");

            bvConfig     = new BVSdkConfiguration();
            bvParams     = new BVParameters();
            bvValidator  = new BVDefaultValidator();
            errorMessage = bvValidator.validate(bvConfig, bvParams);

            Assert.AreEqual <Boolean>(errorMessage.Contains("SubjectId cannot be null or empty.;"), true, "Error Messages are different.");
        }
Ejemplo n.º 11
0
        public BVHTMLFooter(BVConfiguration bvConfiguration, BVParameters bvParameters)
        {
            if (bvConfiguration == null)
            {
                _logger.Error(BVMessageUtil.getMessage("ERR0007"));
                throw new BVSdkException("ERR0007");
            }

            _bvConfiguration = bvConfiguration;
            _bvParameters = bvParameters;

            _velocityEngine = new VelocityEngine();
            _velocityEngine.Init();

            messageList = new List<String>();
        }
Ejemplo n.º 12
0
        public BVHTMLFooter(BVConfiguration bvConfiguration, BVParameters bvParameters)
        {
            if (bvConfiguration == null)
            {
                _logger.Error(BVMessageUtil.getMessage("ERR0007"));
                throw new BVSdkException("ERR0007");
            }

            _bvConfiguration = bvConfiguration;
            _bvParameters    = bvParameters;

            _velocityEngine = new VelocityEngine();
            _velocityEngine.Init();

            messageList = new List <String>();
        }
 public void BVManagedUIContentTestInitialize() 
 {
     bvConfig = new BVSdkConfiguration();
     bvConfig.addProperty(BVCoreConfig.STAGING_S3_HOSTNAME, "google.com:81");
     bvConfig.addProperty(BVCoreConfig.PRODUCTION_S3_HOSTNAME, "google.com:81");
     bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "rootFolder");
     bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "cloudKey");
     bvConfig.addProperty(BVClientConfig.CONNECT_TIMEOUT, "100");
     bvConfig.addProperty(BVClientConfig.CRAWLER_AGENT_PATTERN, ".*(msnbot|google|teoma|bingbot|yandexbot|yahoo).*");
     bvConfig.addProperty(BVClientConfig.INCLUDE_DISPLAY_INTEGRATION_CODE, "false");
     bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");
     bvConfig.addProperty(BVClientConfig.LOCAL_SEO_FILE_ROOT, "/");
     bvConfig.addProperty(BVClientConfig.SEO_SDK_ENABLED, "true");
     bvConfig.addProperty(BVClientConfig.SOCKET_TIMEOUT, "1000");
     bvConfig.addProperty(BVClientConfig.STAGING, "true");
     bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "30000");
 }
 public void BVManagedUIContentTestInitialize()
 {
     bvConfig = new BVSdkConfiguration();
     bvConfig.addProperty(BVCoreConfig.STAGING_S3_HOSTNAME, "google.com:81");
     bvConfig.addProperty(BVCoreConfig.PRODUCTION_S3_HOSTNAME, "google.com:81");
     bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "rootFolder");
     bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "cloudKey");
     bvConfig.addProperty(BVClientConfig.CONNECT_TIMEOUT, "100");
     bvConfig.addProperty(BVClientConfig.CRAWLER_AGENT_PATTERN, ".*(msnbot|google|teoma|bingbot|yandexbot|yahoo).*");
     bvConfig.addProperty(BVClientConfig.INCLUDE_DISPLAY_INTEGRATION_CODE, "false");
     bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");
     bvConfig.addProperty(BVClientConfig.LOCAL_SEO_FILE_ROOT, "/");
     bvConfig.addProperty(BVClientConfig.SEO_SDK_ENABLED, "true");
     bvConfig.addProperty(BVClientConfig.SOCKET_TIMEOUT, "1000");
     bvConfig.addProperty(BVClientConfig.STAGING, "true");
     bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "30000");
 }
Ejemplo n.º 15
0
 /// <summary>
 ///     Configurable ctor for <see cref="FileContentLoader" />.
 /// </summary>
 /// <param name="config">
 ///     <list type="bullet">
 ///         <listheader>
 ///             <description>Supported <see cref="BVClientConfig" /> properties</description>
 ///         </listheader>
 ///         <item>
 ///             <description>
 ///                 <see cref="BVClientConfig.CHARSET" />
 ///             </description>
 ///         </item>
 ///     </list>
 /// </param>
 public FileContentLoader(BVConfiguration config)
 {
     Encoding = EncodingParser.GetEncoding(config.getProperty(BVClientConfig.CHARSET));
 }
        /// <summary>
        /// Method to validate bvConfiguration & bvParameters.
        /// </summary>
        /// <param name="bvConfiguration">The BVConfiguration Object to validate</param>
        /// <param name="bvParams">The BVParameters Object to validate</param>
        /// <returns>Errors as String if Invalid attributes are found</returns>
        public String validate(BVConfiguration bvConfiguration, BVParameters bvParams)
        {
            if (bvConfiguration == null)
            {
                errorMessages.Append(BVMessageUtil.getMessage("ERR0007"));
                _logger.Error(BVMessageUtil.getMessage("ERR0007"));
                return errorMessages.ToString();
            }

            if (bvParams == null)
            {
                errorMessages.Append(BVMessageUtil.getMessage("ERR0011"));
                _logger.Error(BVMessageUtil.getMessage("ERR0011"));
                return errorMessages.ToString();
            }

            Boolean loadSeoFilesLocally = Boolean.Parse(bvConfiguration.getProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY));
            if (loadSeoFilesLocally)
            {
                String localSeoFileRoot = bvConfiguration.getProperty(BVClientConfig.LOCAL_SEO_FILE_ROOT);
                if (String.IsNullOrEmpty(localSeoFileRoot))
                {
                    errorMessages.Append(BVMessageUtil.getMessage("ERR0010"));
                    _logger.Error(BVMessageUtil.getMessage("ERR0010"));
                }
            }
            else
            {
                String cloudKey = bvConfiguration.getProperty(BVClientConfig.CLOUD_KEY);
                if (String.IsNullOrEmpty(cloudKey))
                {
                    errorMessages.Append(BVMessageUtil.getMessage("ERR0020"));
                    _logger.Error(BVMessageUtil.getMessage("ERR0020"));
                }
            }

            String rootFolder = bvConfiguration.getProperty(BVClientConfig.BV_ROOT_FOLDER);
            if (String.IsNullOrEmpty(rootFolder))
            {
                errorMessages.Append(BVMessageUtil.getMessage("ERR0021"));
                _logger.Error(BVMessageUtil.getMessage("ERR0021"));
            }

            Uri uri = null;
            if (bvParams.BaseURI != null)
            {
                try
                {
                    uri = new Uri(bvParams.BaseURI);
                }
                catch (UriFormatException e)
                {
                    errorMessages.Append(BVMessageUtil.getMessage("ERR0023"));
                    _logger.Error(BVMessageUtil.getMessage("ERR0023"),e);
                }
            }

            if (bvParams.PageURI != null)
            {
                try
                {
                    uri = new Uri(bvParams.PageURI);
                }
                catch (UriFormatException e)
                {
                    errorMessages.Append(BVMessageUtil.getMessage("ERR0022"));
                    _logger.Error(BVMessageUtil.getMessage("ERR0022"), e);
                }
            }

            if (String.IsNullOrEmpty(bvParams.PageURI) || !bvParams.PageURI.Contains("bvpage"))
            {
                if (String.IsNullOrEmpty(bvParams.SubjectId))
                {
                    errorMessages.Append(BVMessageUtil.getMessage("ERR0014"));
                    _logger.Error(BVMessageUtil.getMessage("ERR0014"));
                }

                if (bvParams.SubjectType == null)
                {
                    errorMessages.Append(BVMessageUtil.getMessage("ERR0016"));
                    _logger.Error(BVMessageUtil.getMessage("ERR0016"));
                }

                if (bvParams.ContentType == null)
                {
                    errorMessages.Append(BVMessageUtil.getMessage("ERR0015"));
                    _logger.Error(BVMessageUtil.getMessage("ERR0015"));
                }
            }


            if (errorMessages.Length > 0)
            {
                _logger.Error("There is an error : " + errorMessages.ToString());
                return errorMessages.ToString();
            }

            return null;
        }
        /// <summary>
        /// Method to validate bvConfiguration & bvParameters.
        /// </summary>
        /// <param name="bvConfiguration">The BVConfiguration Object to validate</param>
        /// <param name="bvParams">The BVParameters Object to validate</param>
        /// <returns>Errors as String if Invalid attributes are found</returns>
        public String validate(BVConfiguration bvConfiguration, BVParameters bvParams)
        {
            if (bvConfiguration == null)
            {
                errorMessages.Append(BVMessageUtil.getMessage("ERR0007"));
                _logger.Error(BVMessageUtil.getMessage("ERR0007"));
                return(errorMessages.ToString());
            }

            if (bvParams == null)
            {
                errorMessages.Append(BVMessageUtil.getMessage("ERR0011"));
                _logger.Error(BVMessageUtil.getMessage("ERR0011"));
                return(errorMessages.ToString());
            }

            Boolean loadSeoFilesLocally = Boolean.Parse(bvConfiguration.getProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY));

            if (loadSeoFilesLocally)
            {
                String localSeoFileRoot = bvConfiguration.getProperty(BVClientConfig.LOCAL_SEO_FILE_ROOT);
                if (String.IsNullOrEmpty(localSeoFileRoot))
                {
                    errorMessages.Append(BVMessageUtil.getMessage("ERR0010"));
                    _logger.Error(BVMessageUtil.getMessage("ERR0010"));
                }
            }
            else
            {
                String cloudKey = bvConfiguration.getProperty(BVClientConfig.CLOUD_KEY);
                if (String.IsNullOrEmpty(cloudKey))
                {
                    errorMessages.Append(BVMessageUtil.getMessage("ERR0020"));
                    _logger.Error(BVMessageUtil.getMessage("ERR0020"));
                }
            }

            String rootFolder = bvConfiguration.getProperty(BVClientConfig.BV_ROOT_FOLDER);

            if (String.IsNullOrEmpty(rootFolder))
            {
                errorMessages.Append(BVMessageUtil.getMessage("ERR0021"));
                _logger.Error(BVMessageUtil.getMessage("ERR0021"));
            }

            Uri uri = null;

            if (bvParams.BaseURI != null)
            {
                try
                {
                    uri = new Uri(bvParams.BaseURI);
                }
                catch (UriFormatException e)
                {
                    errorMessages.Append(BVMessageUtil.getMessage("ERR0023"));
                    _logger.Error(BVMessageUtil.getMessage("ERR0023"), e);
                }
            }

            if (bvParams.PageURI != null)
            {
                try
                {
                    uri = new Uri(bvParams.PageURI);
                }
                catch (UriFormatException e)
                {
                    errorMessages.Append(BVMessageUtil.getMessage("ERR0022"));
                    _logger.Error(BVMessageUtil.getMessage("ERR0022"), e);
                }
            }

            if (String.IsNullOrEmpty(bvParams.PageURI) || !bvParams.PageURI.Contains("bvpage"))
            {
                if (String.IsNullOrEmpty(bvParams.SubjectId))
                {
                    errorMessages.Append(BVMessageUtil.getMessage("ERR0014"));
                    _logger.Error(BVMessageUtil.getMessage("ERR0014"));
                }

                if (bvParams.SubjectType == null)
                {
                    errorMessages.Append(BVMessageUtil.getMessage("ERR0016"));
                    _logger.Error(BVMessageUtil.getMessage("ERR0016"));
                }

                if (bvParams.ContentType == null)
                {
                    errorMessages.Append(BVMessageUtil.getMessage("ERR0015"));
                    _logger.Error(BVMessageUtil.getMessage("ERR0015"));
                }
            }


            if (errorMessages.Length > 0)
            {
                _logger.Error("There is an error : " + errorMessages.ToString());
                return(errorMessages.ToString());
            }

            return(null);
        }
 public void BVUIContentServiceProviderTestInitialize() 
 {
     bvConfiguration = new BVSdkConfiguration();
 }
 public BVSeoSdkURLBuilder(BVConfiguration bvConfiguration, BVParameters bvParameters)
 {
     this.bvConfiguration = bvConfiguration;
     this.bvParameters = bvParameters;
     this._queryString = queryString();
 }
 public BVSeoSdkURLBuilder(BVConfiguration bvConfiguration, BVParameters bvParameters)
 {
     this.bvConfiguration = bvConfiguration;
     this.bvParameters    = bvParameters;
     this._queryString    = queryString();
 }
Ejemplo n.º 21
0
 /// <summary>
 ///     Configurable ctor for <see cref="FileContentLoader" />.
 /// </summary>
 /// <param name="config">
 ///     <list type="bullet">
 ///         <listheader>
 ///             <description>Supported <see cref="BVClientConfig" /> properties</description>
 ///         </listheader>
 ///         <item>
 ///             <description>
 ///                 <see cref="BVClientConfig.CHARSET" />
 ///             </description>
 ///         </item>
 ///     </list>
 /// </param>
 public FileContentLoader(BVConfiguration config)
 {
     Encoding = EncodingParser.GetEncoding(config.getProperty(BVClientConfig.CHARSET));
 }
Ejemplo n.º 22
0
 public void BVUIContentServiceProviderTestInitialize()
 {
     bvConfiguration = new BVSdkConfiguration();
 }
Ejemplo n.º 23
0
 /// <summary>
 ///     Configurable ctor for <see cref="HttpContentLoader" />.
 /// </summary>
 /// <param name="config">
 ///     <list type="bullet">
 ///         <listheader>
 ///             <description>Supported <see cref="BVClientConfig" /> properties</description>
 ///         </listheader>
 ///         <item>
 ///             <description>
 ///                 <see cref="BVClientConfig.CONNECT_TIMEOUT" />
 ///             </description>
 ///         </item>
 ///         <item>
 ///             <description>
 ///                 <see cref="BVClientConfig.SOCKET_TIMEOUT" />
 ///             </description>
 ///         </item>
 ///         <item>
 ///             <description>
 ///                 <see cref="BVClientConfig.PROXY_PORT" />
 ///             </description>
 ///         </item>
 ///         <item>
 ///             <description>
 ///                 <see cref="BVClientConfig.PROXY_HOST" />
 ///             </description>
 ///         </item>
 ///         <item>
 ///             <description>
 ///                 <see cref="BVClientConfig.CHARSET" />
 ///             </description>
 ///         </item>
 ///     </list>
 /// </param>
 /// <param name="userAgent">
 ///     Browser and system details to be forwarded as the <see cref="HttpRequestHeader.UserAgent" />
 ///     when loading content via HTTP.
 /// </param>
 public HttpContentLoader(BVConfiguration config, string userAgent)
 {
     ConnectionTimeout = int.Parse(config.getProperty(BVClientConfig.CONNECT_TIMEOUT));
     SocketTimeout = int.Parse(config.getProperty(BVClientConfig.SOCKET_TIMEOUT));
     ProxyPort = int.Parse(config.getProperty(BVClientConfig.PROXY_PORT));
     ProxyHost = config.getProperty(BVClientConfig.PROXY_HOST);
     Encoding = EncodingParser.GetEncoding(config.getProperty(BVClientConfig.CHARSET));
     UserAgent = userAgent;
 }