本文整理汇总了C#中net.openstack.Providers.Rackspace.CloudFilesProvider.GetContainerMetaData方法的典型用法代码示例。如果您正苦于以下问题:C# CloudFilesProvider.GetContainerMetaData方法的具体用法?C# CloudFilesProvider.GetContainerMetaData怎么用?C# CloudFilesProvider.GetContainerMetaData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.openstack.Providers.Rackspace.CloudFilesProvider
的用法示例。
在下文中一共展示了CloudFilesProvider.GetContainerMetaData方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Should_Disable_Static_Web_On_Container
public void Should_Disable_Static_Web_On_Container()
{
var provider = new CloudFilesProvider();
//var cdnEnabledResponse = provider.EnableCDNOnContainer( containerName, true, identity: _testIdentity);
provider.DisableStaticWebOnContainer(containerName, null, false, _testIdentity);
var cdnContainerMetaDataResponse = provider.GetContainerMetaData(containerName, identity: _testIdentity);
Assert.IsFalse(cdnContainerMetaDataResponse.ContainsKey("Web-Index"));
Assert.IsFalse(cdnContainerMetaDataResponse.ContainsKey("Web-Error"));
Assert.IsFalse(cdnContainerMetaDataResponse.ContainsKey("Web-Listings-Css"));
Assert.IsFalse(cdnContainerMetaDataResponse.ContainsKey("Web-Listings"));
}
示例2: Should_Enable_Static_Web_On_Container_With_CSS_And_Listing_As_True
public void Should_Enable_Static_Web_On_Container_With_CSS_And_Listing_As_True()
{
var provider = new CloudFilesProvider();
//var cdnEnabledResponse = provider.EnableCDNOnContainer( containerName, true, identity: _testIdentity);
provider.EnableStaticWebOnContainer(containerName, webListingsCSS, webListing, null, false, _testIdentity);
var cdnContainerMetaDataResponse = provider.GetContainerMetaData(containerName, identity: _testIdentity);
Assert.AreEqual(webListingsCSS, cdnContainerMetaDataResponse.Where(x => x.Key.Equals("web-listings-css", StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault().Value);
Assert.IsTrue(bool.Parse(cdnContainerMetaDataResponse.Where(x => x.Key.Equals("web-listings", StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault().Value));
}
示例3: Should_Enable_Static_Web_On_Container_With_Index_And_Error
public void Should_Enable_Static_Web_On_Container_With_Index_And_Error()
{
var provider = new CloudFilesProvider();
//var cdnEnabledResponse = provider.EnableCDNOnContainer( containerName, true, identity: _testIdentity);
provider.EnableStaticWebOnContainer(containerName, webIndex, webError, null, false, _testIdentity);
var cdnContainerMetaDataResponse = provider.GetContainerMetaData(containerName, identity: _testIdentity);
Assert.AreEqual(webIndex, cdnContainerMetaDataResponse.Where(x => x.Key.Equals("Web-index", StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault().Value);
Assert.AreEqual(webError, cdnContainerMetaDataResponse.Where(x => x.Key.Equals("web-error", StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault().Value);
}
示例4: CleanupAllContainerMetadata
public void CleanupAllContainerMetadata()
{
IObjectStorageProvider provider = new CloudFilesProvider(Bootstrapper.Settings.TestIdentity);
IEnumerable<Container> containers = ListAllContainers(provider);
foreach (Container container in containers)
{
Dictionary<string, string> metadata = provider.GetContainerMetaData(container.Name);
provider.DeleteContainerMetadata(container.Name, metadata.Keys);
}
}
示例5: Should_Get_MetaData_For_Container
public void Should_Get_MetaData_For_Container()
{
var provider = new CloudFilesProvider();
var objectHeadersResponse = provider.GetContainerMetaData(containerName, identity: _testIdentity);
Assert.IsNotNull(objectHeadersResponse);
Assert.AreEqual("Action", objectHeadersResponse.Where(x => x.Key.Equals("Genre", StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault().Value);
}
示例6: TestDeleteContainerMetadata
public void TestDeleteContainerMetadata()
{
IObjectStorageProvider provider = new CloudFilesProvider(Bootstrapper.Settings.TestIdentity);
string containerName = TestContainerPrefix + Path.GetRandomFileName();
ObjectStore result = provider.CreateContainer(containerName);
Assert.AreEqual(ObjectStore.ContainerCreated, result);
Dictionary<string, string> metadata = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{
{ "Key1", "Value 1" },
{ "Key2", "Value ²" },
{ "Key3", "Value 3" },
{ "Key4", "Value 4" },
};
provider.UpdateContainerMetadata(containerName, new Dictionary<string, string>(metadata, StringComparer.OrdinalIgnoreCase));
Dictionary<string, string> actualMetadata = provider.GetContainerMetaData(containerName);
Console.WriteLine("Container Metadata");
foreach (KeyValuePair<string, string> pair in actualMetadata)
Console.WriteLine(" {0}: {1}", pair.Key, pair.Value);
CheckMetadataCollections(metadata, actualMetadata);
/* Check the overload which takes a single key
*/
// remove Key3 first to make sure we still have a ² character in a remaining value
metadata.Remove("Key3");
provider.DeleteContainerMetadata(containerName, "Key3");
actualMetadata = provider.GetContainerMetaData(containerName);
Console.WriteLine("Container Metadata after removing Key3");
foreach (KeyValuePair<string, string> pair in actualMetadata)
Console.WriteLine(" {0}: {1}", pair.Key, pair.Value);
CheckMetadataCollections(metadata, actualMetadata);
/* Check the overload which takes multiple keys
*/
metadata.Remove("Key2");
metadata.Remove("Key4");
provider.DeleteContainerMetadata(containerName, new[] { "Key2", "Key4" });
actualMetadata = provider.GetContainerMetaData(containerName);
Console.WriteLine("Container Metadata after removing Key2, Key4");
foreach (KeyValuePair<string, string> pair in actualMetadata)
Console.WriteLine(" {0}: {1}", pair.Key, pair.Value);
CheckMetadataCollections(metadata, actualMetadata);
/* Check that duplicate removal is a NOP
*/
metadata.Remove("Key2");
metadata.Remove("Key4");
provider.DeleteContainerMetadata(containerName, new[] { "Key2", "Key4" });
actualMetadata = provider.GetContainerMetaData(containerName);
Console.WriteLine("Container Metadata after removing Key2, Key4");
foreach (KeyValuePair<string, string> pair in actualMetadata)
Console.WriteLine(" {0}: {1}", pair.Key, pair.Value);
CheckMetadataCollections(metadata, actualMetadata);
/* Cleanup
*/
provider.DeleteContainer(containerName, deleteObjects: true);
}
示例7: TestUpdateContainerMetadata
public void TestUpdateContainerMetadata()
{
IObjectStorageProvider provider = new CloudFilesProvider(Bootstrapper.Settings.TestIdentity);
string containerName = TestContainerPrefix + Path.GetRandomFileName();
ObjectStore result = provider.CreateContainer(containerName);
Assert.AreEqual(ObjectStore.ContainerCreated, result);
Dictionary<string, string> metadata = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{
{ "Key1", "Value 1" },
{ "Key2", "Value ²" },
};
provider.UpdateContainerMetadata(containerName, new Dictionary<string, string>(metadata, StringComparer.OrdinalIgnoreCase));
Dictionary<string, string> actualMetadata = provider.GetContainerMetaData(containerName);
Console.WriteLine("Container Metadata");
foreach (KeyValuePair<string, string> pair in actualMetadata)
Console.WriteLine(" {0}: {1}", pair.Key, pair.Value);
CheckMetadataCollections(metadata, actualMetadata);
metadata["Key2"] = "Value 2";
Dictionary<string, string> updatedMetadata = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{
{ "Key2", "Value 2" }
};
provider.UpdateContainerMetadata(containerName, new Dictionary<string, string>(updatedMetadata, StringComparer.OrdinalIgnoreCase));
actualMetadata = provider.GetContainerMetaData(containerName);
Console.WriteLine("Container Metadata");
foreach (KeyValuePair<string, string> pair in actualMetadata)
Console.WriteLine(" {0}: {1}", pair.Key, pair.Value);
CheckMetadataCollections(metadata, actualMetadata);
provider.DeleteContainer(containerName, deleteObjects: true);
}
示例8: TestContainerHeaderKeyCharacters
public void TestContainerHeaderKeyCharacters()
{
IObjectStorageProvider provider = new CloudFilesProvider(Bootstrapper.Settings.TestIdentity);
string containerName = TestContainerPrefix + Path.GetRandomFileName();
ObjectStore result = provider.CreateContainer(containerName);
Assert.AreEqual(ObjectStore.ContainerCreated, result);
List<char> keyCharList = new List<char>();
for (char i = MinHeaderKeyCharacter; i <= MaxHeaderKeyCharacter; i++)
{
if (!SeparatorCharacters.Contains(i) && !NotSupportedCharacters.Contains(i))
keyCharList.Add(i);
}
string key = TestKeyPrefix + new string(keyCharList.ToArray());
Console.WriteLine("Expected key: {0}", key);
provider.UpdateContainerMetadata(
containerName,
new Dictionary<string, string>
{
{ key, "Value" }
});
Dictionary<string, string> metadata = provider.GetContainerMetaData(containerName);
Assert.IsNotNull(metadata);
string value;
Assert.IsTrue(metadata.TryGetValue(key, out value));
Assert.AreEqual("Value", value);
provider.UpdateContainerMetadata(
containerName,
new Dictionary<string, string>
{
{ key, null }
});
metadata = provider.GetContainerMetaData(containerName);
Assert.IsNotNull(metadata);
Assert.IsFalse(metadata.TryGetValue(key, out value));
provider.DeleteContainer(containerName, deleteObjects: true);
}
示例9: Should_Get_MetaData_For_Container_After_Single_Delete_And_Include__Key4
public void Should_Get_MetaData_For_Container_After_Single_Delete_And_Include__Key4()
{
var provider = new CloudFilesProvider();
var metaData = provider.GetContainerMetaData(containerName, identity: _testIdentity);
Assert.IsNotNull(metaData);
Assert.AreEqual("value4", metaData.Where(x => x.Key.Equals("key4", StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault().Value);
}
示例10: Should_Get_MetaData_For_Container_And_Include_Key1_And_Key2_And_Key3_And_Key4
public void Should_Get_MetaData_For_Container_And_Include_Key1_And_Key2_And_Key3_And_Key4()
{
var provider = new CloudFilesProvider( _testIdentity);
var metaData = provider.GetContainerMetaData(containerName);
Assert.IsNotNull(metaData);
Assert.IsTrue(metaData.Any());
Assert.AreEqual("value1", metaData.Where(x => x.Key.Equals("key1", StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault().Value);
Assert.AreEqual("value2", metaData.Where(x => x.Key.Equals("key2", StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault().Value);
Assert.AreEqual("value3", metaData.Where(x => x.Key.Equals("key3", StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault().Value);
Assert.AreEqual("value4", metaData.Where(x => x.Key.Equals("key4", StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault().Value);
}