public void TestBVConfigLoading() { BVConfiguration bvConfiguration = new BVSdkConfiguration(); String stagingS3Hostname = bvConfiguration.getProperty("stagingS3Hostname"); Assert.AreEqual<string>(stagingS3Hostname, "seo-stg.bazaarvoice.com", "stagingS3Hostname are different."); String productionS3Hostname = bvConfiguration.getProperty("productionS3Hostname"); Assert.AreEqual<string>(productionS3Hostname, "seo.bazaarvoice.com", "productionS3Hostname are different."); }
public void TestAdd_GetProperty() { BVConfiguration bvConfiguration = new BVSdkConfiguration(); String actualErrorMessage = null; String depZoneId = null; String actualDepZoneId = null; /** Negative scenario. trying to add null value to existing value. **/ try { bvConfiguration.addProperty(BVClientConfig.BV_ROOT_FOLDER, depZoneId); } catch (BVSdkException e) { actualErrorMessage = e.getMessage(); } Assert.AreEqual<string>(actualErrorMessage, BVMessageUtil.getMessage("ERR0006"), "Error message does not match."); /** Negative scenario. trying to add empty value. **/ actualErrorMessage = null; actualDepZoneId = null; depZoneId = ""; try { bvConfiguration.addProperty(BVClientConfig.BV_ROOT_FOLDER, depZoneId); } catch (BVSdkException e) { actualErrorMessage = e.getMessage(); } Assert.AreEqual<string>(actualErrorMessage, BVMessageUtil.getMessage("ERR0006"), "Error message does not match."); /** positive scenario. when adding valid value. **/ actualErrorMessage = null; actualDepZoneId = null; depZoneId = "DEP_ZONE_ID"; try { bvConfiguration.addProperty(BVClientConfig.BV_ROOT_FOLDER, depZoneId); } catch (BVSdkException e) { actualErrorMessage = e.getMessage(); Assert.Fail("There was an exception please fix the code so that the exception will not occur."); } Assert.IsNull(actualErrorMessage, "There should not be any error message."); actualDepZoneId = bvConfiguration.getProperty(BVClientConfig.BV_ROOT_FOLDER); Assert.AreEqual<string>(depZoneId, actualDepZoneId, "deployment zone id does not match"); /** positive scenario. value overwrite. **/ actualErrorMessage = null; actualDepZoneId = null; depZoneId = "DEP_ZONE_ID_OVERWRITE"; try { bvConfiguration.addProperty(BVClientConfig.BV_ROOT_FOLDER, depZoneId); } catch (BVSdkException e) { actualErrorMessage = e.getMessage(); Assert.Fail("There was an exception please fix the code so that the exception will not occur."); } Assert.IsNull(actualErrorMessage, "There should not be any error message."); actualDepZoneId = bvConfiguration.getProperty(BVClientConfig.BV_ROOT_FOLDER); Assert.AreEqual<string>(depZoneId, actualDepZoneId, "deployment zone id does not match"); /** positive scenario : when trying to get non-existence property. **/ String nonExistingProperty = bvConfiguration.getProperty("NON_EXISTING_PROPERTY"); Assert.IsNull(nonExistingProperty, "the nonExistingProperty should be null."); }
public void TestBVCoreConfig() { BVConfiguration configuration = new BVSdkConfiguration(); String hostName = configuration.getProperty(BVCoreConfig.PRODUCTION_S3_HOSTNAME); Assert.AreEqual<string>(hostName, "seo.bazaarvoice.com", "production hostname has been changed please fix."); hostName = configuration.getProperty(BVCoreConfig.STAGING_S3_HOSTNAME); Assert.AreEqual<string>(hostName, "seo-stg.bazaarvoice.com", "staging hostname has been changed please fix."); }
public void TestMultipleConfigurations() { BVConfiguration configurationInstance_1 = new BVSdkConfiguration(); configurationInstance_1.addProperty(BVClientConfig.BV_ROOT_FOLDER, "DEP_INST_1"); BVConfiguration configurationInstance_2 = new BVSdkConfiguration(); configurationInstance_2.addProperty(BVClientConfig.BV_ROOT_FOLDER, "DEP_INST_2"); String deploymentInstance_1 = configurationInstance_1.getProperty(BVClientConfig.BV_ROOT_FOLDER); String deploymentInstance_2 = configurationInstance_2.getProperty(BVClientConfig.BV_ROOT_FOLDER); Assert.AreEqual<Boolean>(deploymentInstance_1.Equals(deploymentInstance_2,StringComparison.InvariantCultureIgnoreCase), false, "Instance configuration should not be same"); }