Fixes a bug where user could not connect to devstack using the sdk example.
Added the ability to specify a service name when creating a service client. Moved the default service name into the service definitions for both Identity and Storage Modified the region resolution code to include a fall back when the given service name cannot be found Updated unit tests and examples. Closes-Bug: #1323260 Change-Id: Ifefd12ec783429f7a9c0f80c22bbd9aa6985df55
This commit is contained in:
parent
63d036cc88
commit
26a8760388
@ -31,7 +31,7 @@ namespace CustomServiceClientExample
|
||||
this.Name = typeof(EchoServiceClient).Name;
|
||||
}
|
||||
|
||||
public IOpenStackServiceClient Create(ICredential credential, CancellationToken cancellationToken, IServiceLocator serviceLocator)
|
||||
public IOpenStackServiceClient Create(ICredential credential, string serviceName, CancellationToken cancellationToken, IServiceLocator serviceLocator)
|
||||
{
|
||||
return new EchoServiceClient(credential, cancellationToken, serviceLocator);
|
||||
}
|
||||
@ -41,7 +41,7 @@ namespace CustomServiceClientExample
|
||||
return new List<string>();
|
||||
}
|
||||
|
||||
public bool IsSupported(ICredential credential)
|
||||
public bool IsSupported(ICredential credential, string serviceName)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\..\Bin\Debug\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath>..\..\Bin\net45\Debug\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OpenStack, Version=0.9.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
|
@ -70,7 +70,7 @@ namespace OpenStack.Test.HttpAbstraction
|
||||
Assert.IsTrue(response.Headers.Contains("Content-Length"));
|
||||
Assert.IsTrue(response.Headers.Contains("Content-Type"));
|
||||
|
||||
Assert.AreEqual("214", response.Headers["Content-Length"].First());
|
||||
Assert.AreEqual("213", response.Headers["Content-Length"].First());
|
||||
Assert.AreEqual("application/json", response.Headers["Content-Type"].First());
|
||||
|
||||
Assert.IsNotNull(response.Content);
|
||||
|
@ -11,7 +11,7 @@ namespace OpenStack.Test.Identity
|
||||
{
|
||||
public IOpenStackCredential GetValidCredentials()
|
||||
{
|
||||
var endpoint = new Uri("https://someidentityendpoint:35357/v2.0/tokens");
|
||||
var endpoint = new Uri("https://someidentityendpoint:35357/v2.0");
|
||||
var userName = "TestUser";
|
||||
var password = "RandomPassword";
|
||||
var tenantId = "12345";
|
||||
@ -24,7 +24,7 @@ namespace OpenStack.Test.Identity
|
||||
{
|
||||
var client = new IdentityServiceClientDefinition();
|
||||
|
||||
Assert.IsTrue(client.IsSupported(GetValidCredentials()));
|
||||
Assert.IsTrue(client.IsSupported(GetValidCredentials(), string.Empty));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -39,7 +39,7 @@ namespace OpenStack.Test.Identity
|
||||
|
||||
var client = new IdentityServiceClientDefinition();
|
||||
|
||||
Assert.IsFalse(client.IsSupported(creds));
|
||||
Assert.IsFalse(client.IsSupported(creds, string.Empty));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -69,7 +69,7 @@ namespace OpenStack.Test.Identity
|
||||
return Task.Factory.StartNew(() => creds);
|
||||
};
|
||||
|
||||
var client = new IdentityServiceClientDefinition().Create(GetValidCredentials(), CancellationToken.None, this.ServiceLocator) as IdentityServiceClient;
|
||||
var client = new IdentityServiceClientDefinition().Create(GetValidCredentials(), string.Empty, CancellationToken.None, this.ServiceLocator) as IdentityServiceClient;
|
||||
var resp = await client.Authenticate();
|
||||
|
||||
Assert.AreEqual(creds, resp);
|
||||
|
@ -113,7 +113,7 @@ namespace OpenStack.Test.Identity
|
||||
this.RestClient.Response = restResp;
|
||||
|
||||
var client =
|
||||
new IdentityServicePocoClientFactory().Create(creds, CancellationToken.None, this.ServiceLocator) as
|
||||
new IdentityServicePocoClientFactory().Create(creds, "Swift", CancellationToken.None, this.ServiceLocator) as
|
||||
IdentityServicePocoClient;
|
||||
var result = await client.Authenticate();
|
||||
|
||||
@ -172,7 +172,7 @@ namespace OpenStack.Test.Identity
|
||||
var restResp = new HttpResponseAbstraction(content, new HttpHeadersAbstraction(), HttpStatusCode.NonAuthoritativeInformation);
|
||||
this.RestClient.Response = restResp;
|
||||
|
||||
var client = new IdentityServicePocoClient(creds, CancellationToken.None, this.ServiceLocator);
|
||||
var client = new IdentityServicePocoClient(creds, "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
var result = await client.Authenticate();
|
||||
|
||||
Assert.IsNotNull(result);
|
||||
@ -229,7 +229,7 @@ namespace OpenStack.Test.Identity
|
||||
var restResp = new HttpResponseAbstraction(content, new HttpHeadersAbstraction(), HttpStatusCode.NonAuthoritativeInformation);
|
||||
this.RestClient.Response = restResp;
|
||||
|
||||
var client = new IdentityServicePocoClient(creds, CancellationToken.None, this.ServiceLocator);
|
||||
var client = new IdentityServicePocoClient(creds, "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
var result = await client.Authenticate();
|
||||
|
||||
Assert.AreEqual(expectedRegion, result.Region);
|
||||
@ -244,7 +244,7 @@ namespace OpenStack.Test.Identity
|
||||
var restResp = new HttpResponseAbstraction(new MemoryStream(), new HttpHeadersAbstraction(), HttpStatusCode.Unauthorized);
|
||||
this.RestClient.Response = restResp;
|
||||
|
||||
var client = new IdentityServicePocoClient(creds, CancellationToken.None, this.ServiceLocator);
|
||||
var client = new IdentityServicePocoClient(creds, "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.Authenticate();
|
||||
}
|
||||
|
||||
@ -257,7 +257,7 @@ namespace OpenStack.Test.Identity
|
||||
var restResp = new HttpResponseAbstraction(new MemoryStream(), new HttpHeadersAbstraction(), HttpStatusCode.BadRequest);
|
||||
this.RestClient.Response = restResp;
|
||||
|
||||
var client = new IdentityServicePocoClient(creds, CancellationToken.None, this.ServiceLocator);
|
||||
var client = new IdentityServicePocoClient(creds, "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.Authenticate();
|
||||
}
|
||||
|
||||
@ -270,7 +270,7 @@ namespace OpenStack.Test.Identity
|
||||
var restResp = new HttpResponseAbstraction(new MemoryStream(), new HttpHeadersAbstraction(), HttpStatusCode.InternalServerError);
|
||||
this.RestClient.Response = restResp;
|
||||
|
||||
var client = new IdentityServicePocoClient(creds, CancellationToken.None, this.ServiceLocator);
|
||||
var client = new IdentityServicePocoClient(creds, "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.Authenticate();
|
||||
}
|
||||
|
||||
@ -283,7 +283,7 @@ namespace OpenStack.Test.Identity
|
||||
var restResp = new HttpResponseAbstraction(new MemoryStream(), new HttpHeadersAbstraction(), HttpStatusCode.Forbidden);
|
||||
this.RestClient.Response = restResp;
|
||||
|
||||
var client = new IdentityServicePocoClient(creds, CancellationToken.None, this.ServiceLocator);
|
||||
var client = new IdentityServicePocoClient(creds, "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.Authenticate();
|
||||
}
|
||||
|
||||
@ -296,7 +296,7 @@ namespace OpenStack.Test.Identity
|
||||
var restResp = new HttpResponseAbstraction(new MemoryStream(), new HttpHeadersAbstraction(), HttpStatusCode.MethodNotAllowed);
|
||||
this.RestClient.Response = restResp;
|
||||
|
||||
var client = new IdentityServicePocoClient(creds, CancellationToken.None, this.ServiceLocator);
|
||||
var client = new IdentityServicePocoClient(creds, "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.Authenticate();
|
||||
}
|
||||
|
||||
@ -309,7 +309,7 @@ namespace OpenStack.Test.Identity
|
||||
var restResp = new HttpResponseAbstraction(new MemoryStream(), new HttpHeadersAbstraction(), HttpStatusCode.RequestEntityTooLarge);
|
||||
this.RestClient.Response = restResp;
|
||||
|
||||
var client = new IdentityServicePocoClient(creds, CancellationToken.None, this.ServiceLocator);
|
||||
var client = new IdentityServicePocoClient(creds, "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.Authenticate();
|
||||
}
|
||||
|
||||
@ -322,7 +322,7 @@ namespace OpenStack.Test.Identity
|
||||
var restResp = new HttpResponseAbstraction(new MemoryStream(), new HttpHeadersAbstraction(), HttpStatusCode.ServiceUnavailable);
|
||||
this.RestClient.Response = restResp;
|
||||
|
||||
var client = new IdentityServicePocoClient(creds, CancellationToken.None, this.ServiceLocator);
|
||||
var client = new IdentityServicePocoClient(creds, "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.Authenticate();
|
||||
}
|
||||
|
||||
@ -335,7 +335,7 @@ namespace OpenStack.Test.Identity
|
||||
var restResp = new HttpResponseAbstraction(new MemoryStream(), new HttpHeadersAbstraction(), HttpStatusCode.NotFound);
|
||||
this.RestClient.Response = restResp;
|
||||
|
||||
var client = new IdentityServicePocoClient(creds, CancellationToken.None, this.ServiceLocator);
|
||||
var client = new IdentityServicePocoClient(creds, "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.Authenticate();
|
||||
}
|
||||
}
|
||||
|
@ -67,8 +67,8 @@ namespace OpenStack.Test.Identity
|
||||
var client = new IdentityServiceRestClientFactory().Create(creds,CancellationToken.None, this.ServiceLocator);
|
||||
|
||||
await client.Authenticate();
|
||||
|
||||
Assert.AreEqual(creds.AuthenticationEndpoint, this.simulator.Uri);
|
||||
var expectedUri = new Uri(string.Format("{0}/tokens", creds.AuthenticationEndpoint));
|
||||
Assert.AreEqual(expectedUri, this.simulator.Uri);
|
||||
Assert.AreEqual(HttpMethod.Post, this.simulator.Method);
|
||||
}
|
||||
|
||||
|
@ -78,6 +78,29 @@ namespace OpenStack.Test.Identity
|
||||
Assert.AreEqual(expectedRegion, region);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CanResolveRegionWhenNoMatchingServicesButMatchingEndpoint()
|
||||
{
|
||||
var expectedRegion = "Some Region";
|
||||
var catalog = new OpenStackServiceCatalog();
|
||||
catalog.Add(new OpenStackServiceDefinition("Test Service", "Test-Service",
|
||||
new List<OpenStackServiceEndpoint>()
|
||||
{
|
||||
new OpenStackServiceEndpoint("http://the.endpoint.org", "Some Region" , "1.0",
|
||||
"http://www.someplace.com", "http://www.someplace.com")
|
||||
}));
|
||||
|
||||
catalog.Add(new OpenStackServiceDefinition("Other Test Service", "Test-Service",
|
||||
new List<OpenStackServiceEndpoint>()
|
||||
{
|
||||
new OpenStackServiceEndpoint("http://other.endpoint.org", "some other region", "1.0",
|
||||
"http://www.someplace.com", "http://www.someplace.com")
|
||||
}));
|
||||
var resolver = new OpenStackRegionResolver();
|
||||
var region = resolver.Resolve(new Uri("http://the.endpoint.org/v2/tokens"), catalog, "No Matching Service");
|
||||
Assert.AreEqual(expectedRegion, region);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CannotResolveRegionWhenMatchingEndpointHasEmptyRegion()
|
||||
{
|
||||
|
@ -97,8 +97,7 @@ namespace OpenStack.Test.Identity
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(FormatException))]
|
||||
public void CannotConvertJsonPayloadWithMissingVersion()
|
||||
public void CanConvertJsonPayloadWithMissingVersion()
|
||||
{
|
||||
var endpointPayload = @" {
|
||||
""tenantId"": ""10244656540440"",
|
||||
@ -114,8 +113,7 @@ namespace OpenStack.Test.Identity
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(FormatException))]
|
||||
public void CannotConvertJsonPayloadWithMissingVersionInfoUri()
|
||||
public void CanConvertJsonPayloadWithMissingVersionInfoUri()
|
||||
{
|
||||
var endpointPayload = @" {
|
||||
""tenantId"": ""10244656540440"",
|
||||
@ -131,8 +129,7 @@ namespace OpenStack.Test.Identity
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(FormatException))]
|
||||
public void CannotConvertJsonPayloadWithMissingVersionListUri()
|
||||
public void CanConvertJsonPayloadWithMissingVersionListUri()
|
||||
{
|
||||
var endpointPayload = @" {
|
||||
""tenantId"": ""10244656540440"",
|
||||
|
@ -41,7 +41,7 @@ namespace OpenStack.Test.Identity
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
public IIdentityServicePocoClient Create(IOpenStackCredential credentials, CancellationToken token, IServiceLocator serviceLocator)
|
||||
public IIdentityServicePocoClient Create(IOpenStackCredential credentials, string serviceName, CancellationToken token, IServiceLocator serviceLocator)
|
||||
{
|
||||
return client;
|
||||
}
|
||||
|
@ -83,6 +83,16 @@ namespace OpenStack.Test
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public T CreateServiceClientByName<T>(string serviceName) where T : IOpenStackServiceClient
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public T CreateServiceClientByName<T>(string serviceName, string version) where T : IOpenStackServiceClient
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IEnumerable<string> GetSupportedVersions()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@ -122,6 +132,16 @@ namespace OpenStack.Test
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public T CreateServiceClientByName<T>(string serviceName) where T : IOpenStackServiceClient
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public T CreateServiceClientByName<T>(string serviceName, string version) where T : IOpenStackServiceClient
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IEnumerable<string> GetSupportedVersions()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@ -166,6 +186,16 @@ namespace OpenStack.Test
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public T CreateServiceClientByName<T>(string serviceName) where T : IOpenStackServiceClient
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public T CreateServiceClientByName<T>(string serviceName, string version) where T : IOpenStackServiceClient
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IEnumerable<string> GetSupportedVersions()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
@ -56,7 +56,7 @@ namespace OpenStack.Test
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
|
||||
public IOpenStackServiceClient Create(ICredential credential, CancellationToken cancellationToken, IServiceLocator serviceLocator)
|
||||
public IOpenStackServiceClient Create(ICredential credential, string serviceName, CancellationToken cancellationToken, IServiceLocator serviceLocator)
|
||||
{
|
||||
return new TestIdentityServiceClient((IOpenStackCredential)credential, cancellationToken);
|
||||
}
|
||||
@ -66,7 +66,7 @@ namespace OpenStack.Test
|
||||
return new List<string>();
|
||||
}
|
||||
|
||||
public bool IsSupported(ICredential credential)
|
||||
public bool IsSupported(ICredential credential, string serviceName)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ namespace OpenStack.Test
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
|
||||
public IOpenStackServiceClient Create(ICredential credential, CancellationToken token, IServiceLocator serviceLocator)
|
||||
public IOpenStackServiceClient Create(ICredential credential, string serviceName, CancellationToken token, IServiceLocator serviceLocator)
|
||||
{
|
||||
return new TestOpenStackServiceClient(credential, token);
|
||||
}
|
||||
@ -49,7 +49,7 @@ namespace OpenStack.Test
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool IsSupported(ICredential credential)
|
||||
public bool IsSupported(ICredential credential, string serviceName)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -82,7 +82,7 @@ namespace OpenStack.Test
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
|
||||
public IOpenStackServiceClient Create(ICredential credential, CancellationToken token, IServiceLocator serviceLocator)
|
||||
public IOpenStackServiceClient Create(ICredential credential, string serviceName, CancellationToken token, IServiceLocator serviceLocator)
|
||||
{
|
||||
return new OtherTestOpenStackServiceClient(credential, token);
|
||||
}
|
||||
@ -92,7 +92,7 @@ namespace OpenStack.Test
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool IsSupported(ICredential credential)
|
||||
public bool IsSupported(ICredential credential, string serviceName)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -221,7 +221,7 @@ namespace OpenStack.Test
|
||||
{
|
||||
var manager = new OpenStackServiceClientManager(new ServiceLocator());
|
||||
|
||||
var service = manager.CreateServiceClientInstance(new TestOpenStackServiceClientDefinition(), new OpenStackClientManagerTests.TestCredential(), CancellationToken.None);
|
||||
var service = manager.CreateServiceClientInstance(new TestOpenStackServiceClientDefinition(), new OpenStackClientManagerTests.TestCredential(), string.Empty, CancellationToken.None);
|
||||
Assert.IsNotNull(service);
|
||||
Assert.IsInstanceOfType(service, typeof(TestOpenStackServiceClient));
|
||||
}
|
||||
@ -231,7 +231,7 @@ namespace OpenStack.Test
|
||||
public void CanCreateAnInstanceOfAServiceWithNullFactory()
|
||||
{
|
||||
var manager = new OpenStackServiceClientManager(new ServiceLocator());
|
||||
manager.CreateServiceClientInstance(null, new OpenStackClientManagerTests.TestCredential(), CancellationToken.None);
|
||||
manager.CreateServiceClientInstance(null, new OpenStackClientManagerTests.TestCredential(), string.Empty, CancellationToken.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ namespace OpenStack.Test.Storage
|
||||
var catalog =
|
||||
new OpenStackServiceCatalog
|
||||
{
|
||||
new OpenStackServiceDefinition("Object Storage", "Test",
|
||||
new OpenStackServiceDefinition("Swift", "Test",
|
||||
new List<OpenStackServiceEndpoint>()
|
||||
{
|
||||
new OpenStackServiceEndpoint("http://someplace.com", "somewhere", "1.0",
|
||||
@ -37,7 +37,7 @@ namespace OpenStack.Test.Storage
|
||||
})
|
||||
};
|
||||
creds.SetServiceCatalog(catalog);
|
||||
Assert.IsTrue(client.IsSupported(creds));
|
||||
Assert.IsTrue(client.IsSupported(creds, "Swift"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -48,7 +48,7 @@ namespace OpenStack.Test.Storage
|
||||
var catalog =
|
||||
new OpenStackServiceCatalog
|
||||
{
|
||||
new OpenStackServiceDefinition("Object Storage", "Test",
|
||||
new OpenStackServiceDefinition("Swift", "Test",
|
||||
new List<OpenStackServiceEndpoint>()
|
||||
{
|
||||
new OpenStackServiceEndpoint("http://someplace.com", "somewhere", "2.0.0.0",
|
||||
@ -56,7 +56,26 @@ namespace OpenStack.Test.Storage
|
||||
})
|
||||
};
|
||||
creds.SetServiceCatalog(catalog);
|
||||
Assert.IsFalse(client.IsSupported(creds));
|
||||
Assert.IsFalse(client.IsSupported(creds, "Swift"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CannotSupportUnknownServiceName()
|
||||
{
|
||||
var client = new StorageServiceClientDefinition();
|
||||
var creds = GetValidCreds();
|
||||
var catalog =
|
||||
new OpenStackServiceCatalog
|
||||
{
|
||||
new OpenStackServiceDefinition("Swift", "Test",
|
||||
new List<OpenStackServiceEndpoint>()
|
||||
{
|
||||
new OpenStackServiceEndpoint("http://someplace.com", "somewhere", "1.0",
|
||||
"http://www.someplace.com", "http://www.someplace.com")
|
||||
})
|
||||
};
|
||||
creds.SetServiceCatalog(catalog);
|
||||
Assert.IsFalse(client.IsSupported(creds, "BadServiceName"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -62,7 +62,7 @@ namespace OpenStack.Test.Storage
|
||||
IOpenStackCredential GetValidCreds()
|
||||
{
|
||||
var catalog = new OpenStackServiceCatalog();
|
||||
catalog.Add(new OpenStackServiceDefinition(StorageServiceClient.StorageServiceName, "Storage Service",
|
||||
catalog.Add(new OpenStackServiceDefinition("Swift", "Storage Service",
|
||||
new List<OpenStackServiceEndpoint>()
|
||||
{
|
||||
new OpenStackServiceEndpoint(endpoint, string.Empty, "some version", "some version info", "1,2,3")
|
||||
@ -97,7 +97,7 @@ namespace OpenStack.Test.Storage
|
||||
return Task.Factory.StartNew(() => obj);
|
||||
};
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.ListStorageObjects(containerName);
|
||||
|
||||
Assert.AreEqual(1,numberObjCalls);
|
||||
@ -122,7 +122,7 @@ namespace OpenStack.Test.Storage
|
||||
throw new InvalidOperationException("Cannot get storage object. '" +HttpStatusCode.NotFound +"'");
|
||||
};
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
var resp = await client.ListStorageObjects(containerName);
|
||||
|
||||
Assert.AreEqual(0, resp.Count());
|
||||
@ -132,7 +132,7 @@ namespace OpenStack.Test.Storage
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public async Task ListingStorageObjectsWithNullContainerNameThrows()
|
||||
{
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.ListStorageObjects(null);
|
||||
}
|
||||
|
||||
@ -156,7 +156,7 @@ namespace OpenStack.Test.Storage
|
||||
|
||||
this.ServicePocoClient.GetStorageAccountDelegate = () => Task.Factory.StartNew(() => account);
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
var resp = await client.ListStorageContainers();
|
||||
var containers = resp.ToList();
|
||||
|
||||
@ -175,7 +175,7 @@ namespace OpenStack.Test.Storage
|
||||
return Task.Factory.StartNew(() => account);
|
||||
};
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
var resp = await client.GetStorageAccount();
|
||||
|
||||
Assert.AreEqual(account, resp);
|
||||
@ -197,7 +197,7 @@ namespace OpenStack.Test.Storage
|
||||
return Task.Factory.StartNew(() => obj);
|
||||
};
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
var resp = await client.GetStorageObject(containerName, objectName);
|
||||
|
||||
Assert.AreEqual(obj, resp);
|
||||
@ -209,7 +209,7 @@ namespace OpenStack.Test.Storage
|
||||
{
|
||||
var objectName = "TestObject";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.GetStorageObject(null, objectName);
|
||||
}
|
||||
|
||||
@ -219,7 +219,7 @@ namespace OpenStack.Test.Storage
|
||||
{
|
||||
var objectName = "TestObject";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.GetStorageObject(string.Empty, objectName);
|
||||
}
|
||||
|
||||
@ -229,7 +229,7 @@ namespace OpenStack.Test.Storage
|
||||
{
|
||||
var containerName = "TestContainer";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.GetStorageObject(containerName, null);
|
||||
}
|
||||
|
||||
@ -239,7 +239,7 @@ namespace OpenStack.Test.Storage
|
||||
{
|
||||
var containerName = "TestContainer";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.GetStorageObject(containerName, string.Empty);
|
||||
}
|
||||
|
||||
@ -259,7 +259,7 @@ namespace OpenStack.Test.Storage
|
||||
return Task.Factory.StartNew(() => (StorageManifest)obj);
|
||||
};
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
var resp = await client.GetStorageManifest(containerName, manifestName);
|
||||
|
||||
Assert.AreEqual(obj, resp);
|
||||
@ -271,7 +271,7 @@ namespace OpenStack.Test.Storage
|
||||
{
|
||||
var manifestName = "TestManifest";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.GetStorageManifest(null, manifestName);
|
||||
}
|
||||
|
||||
@ -281,7 +281,7 @@ namespace OpenStack.Test.Storage
|
||||
{
|
||||
var manifestName = "TestManifest";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.GetStorageObject(string.Empty, manifestName);
|
||||
}
|
||||
|
||||
@ -291,7 +291,7 @@ namespace OpenStack.Test.Storage
|
||||
{
|
||||
var containerName = "TestContainer";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.GetStorageManifest(containerName, null);
|
||||
}
|
||||
|
||||
@ -301,7 +301,7 @@ namespace OpenStack.Test.Storage
|
||||
{
|
||||
var containerName = "TestContainer";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.GetStorageManifest(containerName, string.Empty);
|
||||
}
|
||||
|
||||
@ -320,7 +320,7 @@ namespace OpenStack.Test.Storage
|
||||
return Task.Factory.StartNew(() => obj);
|
||||
};
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
var resp = await client.GetStorageFolder(containerName, folderName);
|
||||
|
||||
Assert.AreEqual(obj, resp);
|
||||
@ -341,7 +341,7 @@ namespace OpenStack.Test.Storage
|
||||
return Task.Factory.StartNew(() => obj);
|
||||
};
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
var resp = await client.GetStorageFolder(containerName, folderName);
|
||||
|
||||
Assert.AreEqual(obj, resp);
|
||||
@ -353,7 +353,7 @@ namespace OpenStack.Test.Storage
|
||||
{
|
||||
var folderName = "TestFolder";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.GetStorageFolder(null, folderName);
|
||||
}
|
||||
|
||||
@ -363,7 +363,7 @@ namespace OpenStack.Test.Storage
|
||||
{
|
||||
var folderName = "TestFolder";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.GetStorageFolder(string.Empty, folderName);
|
||||
}
|
||||
|
||||
@ -373,7 +373,7 @@ namespace OpenStack.Test.Storage
|
||||
{
|
||||
var containerName = "TestContainer";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.GetStorageFolder(containerName, null);
|
||||
}
|
||||
|
||||
@ -383,7 +383,7 @@ namespace OpenStack.Test.Storage
|
||||
{
|
||||
var containerName = "TestContainer";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.GetStorageFolder(containerName, string.Empty);
|
||||
}
|
||||
|
||||
@ -405,7 +405,7 @@ namespace OpenStack.Test.Storage
|
||||
return await Task.Run(()=>obj);
|
||||
};
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
var resp = await client.CreateStorageObject(containerName, objectName, new Dictionary<string,string>(), content);
|
||||
|
||||
Assert.AreEqual(obj, resp);
|
||||
@ -414,7 +414,7 @@ namespace OpenStack.Test.Storage
|
||||
[TestMethod]
|
||||
public async Task CreatingAnObjectLargerThanTheThresholdCreatesObjectWithSegments()
|
||||
{
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
|
||||
var containerName = "TestContainer";
|
||||
var objectName = "TestObject";
|
||||
@ -465,7 +465,7 @@ namespace OpenStack.Test.Storage
|
||||
return await Task.Run(() => new StorageObject(o,c));
|
||||
};
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
var res = await client.CreateLargeStorageObject(containerName, objectName, metadata, contentStream, 3);
|
||||
|
||||
Assert.AreEqual(containerName, res.ContainerName);
|
||||
@ -481,7 +481,7 @@ namespace OpenStack.Test.Storage
|
||||
var content = "THIS IS A LOT OF CONTENT THAT WILL AND CAN BE CHOPPED UP";
|
||||
var contentStream = content.ConvertToStream();
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
var res = await client.CreateLargeStorageObject(null, objectName, metadata, contentStream, 3);
|
||||
}
|
||||
|
||||
@ -494,7 +494,7 @@ namespace OpenStack.Test.Storage
|
||||
var content = "THIS IS A LOT OF CONTENT THAT WILL AND CAN BE CHOPPED UP";
|
||||
var contentStream = content.ConvertToStream();
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
var res = await client.CreateLargeStorageObject(string.Empty, objectName, metadata, contentStream, 3);
|
||||
}
|
||||
|
||||
@ -507,7 +507,7 @@ namespace OpenStack.Test.Storage
|
||||
var content = "THIS IS A LOT OF CONTENT THAT WILL AND CAN BE CHOPPED UP";
|
||||
var contentStream = content.ConvertToStream();
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
var res = await client.CreateLargeStorageObject(containerName, null, metadata, contentStream, 3);
|
||||
}
|
||||
|
||||
@ -520,7 +520,7 @@ namespace OpenStack.Test.Storage
|
||||
var content = "THIS IS A LOT OF CONTENT THAT WILL AND CAN BE CHOPPED UP";
|
||||
var contentStream = content.ConvertToStream();
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
var res = await client.CreateLargeStorageObject(containerName, string.Empty, metadata, contentStream, 3);
|
||||
}
|
||||
|
||||
@ -533,7 +533,7 @@ namespace OpenStack.Test.Storage
|
||||
var content = "THIS IS A LOT OF CONTENT THAT WILL AND CAN BE CHOPPED UP";
|
||||
var contentStream = content.ConvertToStream();
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
var res = await client.CreateLargeStorageObject(containerName, objectName, null, contentStream, 3);
|
||||
}
|
||||
|
||||
@ -545,7 +545,7 @@ namespace OpenStack.Test.Storage
|
||||
var objectName = "TestObject";
|
||||
var metadata = new Dictionary<string, string>();
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
var res = await client.CreateLargeStorageObject(containerName, objectName, metadata, null, 3);
|
||||
}
|
||||
|
||||
@ -559,7 +559,7 @@ namespace OpenStack.Test.Storage
|
||||
var content = "THIS IS A LOT OF CONTENT THAT WILL AND CAN BE CHOPPED UP";
|
||||
var contentStream = content.ConvertToStream();
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
var res = await client.CreateLargeStorageObject(containerName, objectName, metadata, contentStream, -3);
|
||||
}
|
||||
|
||||
@ -573,7 +573,7 @@ namespace OpenStack.Test.Storage
|
||||
var content = "THIS IS A LOT OF CONTENT THAT WILL AND CAN BE CHOPPED UP";
|
||||
var contentStream = content.ConvertToStream();
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
var res = await client.CreateLargeStorageObject(containerName, objectName, metadata, contentStream, 0);
|
||||
}
|
||||
|
||||
@ -583,7 +583,7 @@ namespace OpenStack.Test.Storage
|
||||
{
|
||||
var objectName = "TestObject";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageObject(null, objectName, new Dictionary<string, string>(), new MemoryStream());
|
||||
}
|
||||
|
||||
@ -593,7 +593,7 @@ namespace OpenStack.Test.Storage
|
||||
{
|
||||
var objectName = "TestObject";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageObject(string.Empty, objectName, new Dictionary<string, string>(), new MemoryStream());
|
||||
}
|
||||
|
||||
@ -603,7 +603,7 @@ namespace OpenStack.Test.Storage
|
||||
{
|
||||
var containerName = "TestContainer";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageObject(containerName, null, new Dictionary<string, string>(), new MemoryStream());
|
||||
}
|
||||
|
||||
@ -613,7 +613,7 @@ namespace OpenStack.Test.Storage
|
||||
{
|
||||
var containerName = "TestContainer";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageObject(containerName, string.Empty, new Dictionary<string, string>(), new MemoryStream());
|
||||
}
|
||||
|
||||
@ -624,7 +624,7 @@ namespace OpenStack.Test.Storage
|
||||
var containerName = "TestContainer";
|
||||
var objectName = "TestObject";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageObject(containerName, objectName, new Dictionary<string, string>(), null);
|
||||
}
|
||||
|
||||
@ -635,7 +635,7 @@ namespace OpenStack.Test.Storage
|
||||
var containerName = "TestContainer";
|
||||
var objectName = "TestObject";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageObject(containerName, objectName, null, new MemoryStream());
|
||||
}
|
||||
|
||||
@ -654,7 +654,7 @@ namespace OpenStack.Test.Storage
|
||||
return await Task.Run(() => m);
|
||||
};
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageManifest(containerName, objectName, new Dictionary<string, string>(), new List<StorageObject>() { obj });
|
||||
}
|
||||
|
||||
@ -670,7 +670,7 @@ namespace OpenStack.Test.Storage
|
||||
return await Task.Run(() => m);
|
||||
};
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageManifest(containerName, objectName, new Dictionary<string, string>(), "segments");
|
||||
}
|
||||
|
||||
@ -681,7 +681,7 @@ namespace OpenStack.Test.Storage
|
||||
var manifestName = "TestManifest";
|
||||
var segmentPath = "segments";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageManifest(null, manifestName, new Dictionary<string, string>(), segmentPath);
|
||||
}
|
||||
|
||||
@ -692,7 +692,7 @@ namespace OpenStack.Test.Storage
|
||||
var manifestName = "TestManifest";
|
||||
var segmentPath = "segments";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageManifest(string.Empty, manifestName, new Dictionary<string, string>(), segmentPath);
|
||||
}
|
||||
|
||||
@ -703,7 +703,7 @@ namespace OpenStack.Test.Storage
|
||||
var containerName = "TestContainer";
|
||||
var segmentPath = "segments";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageManifest(containerName, null, new Dictionary<string, string>(), segmentPath);
|
||||
}
|
||||
|
||||
@ -714,7 +714,7 @@ namespace OpenStack.Test.Storage
|
||||
var containerName = "TestContainer";
|
||||
var segmentPath = "segments";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageManifest(containerName, string.Empty, new Dictionary<string, string>(), segmentPath);
|
||||
}
|
||||
|
||||
@ -725,7 +725,7 @@ namespace OpenStack.Test.Storage
|
||||
var containerName = "TestContainer";
|
||||
var manifestName = "TestManifest";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageManifest(containerName, manifestName, new Dictionary<string, string>(), (string)null);
|
||||
}
|
||||
|
||||
@ -736,7 +736,7 @@ namespace OpenStack.Test.Storage
|
||||
var containerName = "TestContainer";
|
||||
var manifestName = "TestManifest";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageManifest(containerName, manifestName, new Dictionary<string, string>(), string.Empty);
|
||||
}
|
||||
|
||||
@ -748,7 +748,7 @@ namespace OpenStack.Test.Storage
|
||||
var manifestName = "TestManifest";
|
||||
var segmentPath = "segments";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageManifest(containerName, manifestName, null, segmentPath);
|
||||
}
|
||||
|
||||
@ -762,7 +762,7 @@ namespace OpenStack.Test.Storage
|
||||
var obj = new StorageObject(objectName, containerName, DateTime.UtcNow, "12345", 12345,
|
||||
"application/octet-stream", new Dictionary<string, string>());
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageManifest(null, objectName, new Dictionary<string, string>(), new List<StorageObject>() { obj });
|
||||
}
|
||||
|
||||
@ -776,7 +776,7 @@ namespace OpenStack.Test.Storage
|
||||
var obj = new StorageObject(objectName, containerName, DateTime.UtcNow, "12345", 12345,
|
||||
"application/octet-stream", new Dictionary<string, string>());
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageManifest(string.Empty, objectName, new Dictionary<string, string>(), new List<StorageObject>() { obj });
|
||||
}
|
||||
|
||||
@ -790,7 +790,7 @@ namespace OpenStack.Test.Storage
|
||||
var obj = new StorageObject(objectName, containerName, DateTime.UtcNow, "12345", 12345,
|
||||
"application/octet-stream", new Dictionary<string, string>());
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageManifest(containerName, null, new Dictionary<string, string>(), new List<StorageObject>() { obj });
|
||||
}
|
||||
|
||||
@ -804,7 +804,7 @@ namespace OpenStack.Test.Storage
|
||||
var obj = new StorageObject(objectName, containerName, DateTime.UtcNow, "12345", 12345,
|
||||
"application/octet-stream", new Dictionary<string, string>());
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageManifest(containerName, string.Empty, new Dictionary<string, string>(), new List<StorageObject>() { obj });
|
||||
}
|
||||
|
||||
@ -815,7 +815,7 @@ namespace OpenStack.Test.Storage
|
||||
var containerName = "TestContainer";
|
||||
var objectName = "TestObject";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageManifest(containerName, objectName, new Dictionary<string, string>(), (List<StorageObject>)null);
|
||||
}
|
||||
|
||||
@ -829,7 +829,7 @@ namespace OpenStack.Test.Storage
|
||||
var obj = new StorageObject(objectName, containerName, DateTime.UtcNow, "12345", 12345,
|
||||
"application/octet-stream", new Dictionary<string, string>());
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageManifest(containerName, objectName, null, new List<StorageObject>() { obj });
|
||||
}
|
||||
|
||||
@ -850,7 +850,7 @@ namespace OpenStack.Test.Storage
|
||||
});
|
||||
};
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageFolder(containerName, folderName);
|
||||
}
|
||||
|
||||
@ -871,7 +871,7 @@ namespace OpenStack.Test.Storage
|
||||
});
|
||||
};
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageFolder(containerName, folderName);
|
||||
}
|
||||
|
||||
@ -882,7 +882,7 @@ namespace OpenStack.Test.Storage
|
||||
var containerName = "someContainer";
|
||||
var folderName = "Test//Folder";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageFolder(containerName, folderName);
|
||||
}
|
||||
|
||||
@ -892,7 +892,7 @@ namespace OpenStack.Test.Storage
|
||||
{
|
||||
var folderName = "TestFolder";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageFolder(null, folderName);
|
||||
}
|
||||
|
||||
@ -902,7 +902,7 @@ namespace OpenStack.Test.Storage
|
||||
{
|
||||
var folderName = "TestFolder";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageFolder(string.Empty, folderName);
|
||||
}
|
||||
|
||||
@ -912,7 +912,7 @@ namespace OpenStack.Test.Storage
|
||||
{
|
||||
var containerName = "TestContainer";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageFolder(containerName, null);
|
||||
}
|
||||
|
||||
@ -922,7 +922,7 @@ namespace OpenStack.Test.Storage
|
||||
{
|
||||
var containerName = "TestContainer";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageFolder(containerName, string.Empty);
|
||||
}
|
||||
|
||||
@ -939,7 +939,7 @@ namespace OpenStack.Test.Storage
|
||||
return await Task.Run(()=>obj);
|
||||
};
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageContainer(containerName, new Dictionary<string, string>());
|
||||
}
|
||||
|
||||
@ -947,7 +947,7 @@ namespace OpenStack.Test.Storage
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public async Task CreatingStorageContainersWithNullContainerNameThrows()
|
||||
{
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageContainer(null, new Dictionary<string, string>());
|
||||
}
|
||||
|
||||
@ -955,7 +955,7 @@ namespace OpenStack.Test.Storage
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public async Task CreatingStorageContainersWithEmptyContainerNameThrows()
|
||||
{
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageContainer(string.Empty, new Dictionary<string, string>());
|
||||
}
|
||||
|
||||
@ -963,7 +963,7 @@ namespace OpenStack.Test.Storage
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public async Task CreatingStorageContainersWithNullMetadataThrows()
|
||||
{
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.CreateStorageContainer("TestContainer", null);
|
||||
}
|
||||
|
||||
@ -980,7 +980,7 @@ namespace OpenStack.Test.Storage
|
||||
return Task.Factory.StartNew(() => obj);
|
||||
};
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
var resp = await client.GetStorageContainer(containerName);
|
||||
|
||||
Assert.AreEqual(obj, resp);
|
||||
@ -990,7 +990,7 @@ namespace OpenStack.Test.Storage
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public async Task GettingStorageContainersWithNullContainerNameThrows()
|
||||
{
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.GetStorageContainer(null);
|
||||
}
|
||||
|
||||
@ -998,7 +998,7 @@ namespace OpenStack.Test.Storage
|
||||
[ExpectedException(typeof (ArgumentException))]
|
||||
public async Task GettingStorageContainersWithEmptyContainerNameThrows()
|
||||
{
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.GetStorageContainer(string.Empty);
|
||||
}
|
||||
|
||||
@ -1014,7 +1014,7 @@ namespace OpenStack.Test.Storage
|
||||
await Task.Run(() => Assert.AreEqual(s.Name, obj.Name));
|
||||
};
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.UpdateStorageContainer(obj);
|
||||
}
|
||||
|
||||
@ -1022,7 +1022,7 @@ namespace OpenStack.Test.Storage
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public async Task UpdatingStorageContainersWithNullContainerThrows()
|
||||
{
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.UpdateStorageContainer(null);
|
||||
}
|
||||
|
||||
@ -1038,7 +1038,7 @@ namespace OpenStack.Test.Storage
|
||||
await Task.Run(()=>Assert.AreEqual(s, obj.Name));
|
||||
};
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.DeleteStorageContainer(obj.Name);
|
||||
}
|
||||
|
||||
@ -1046,7 +1046,7 @@ namespace OpenStack.Test.Storage
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public async Task DeletingStorageContainersWithNullContainerNameThrows()
|
||||
{
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.DeleteStorageContainer(null);
|
||||
}
|
||||
|
||||
@ -1054,7 +1054,7 @@ namespace OpenStack.Test.Storage
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public async Task DeletingStorageContainersWithEmptyContainerNameThrows()
|
||||
{
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.DeleteStorageContainer(string.Empty);
|
||||
}
|
||||
|
||||
@ -1076,7 +1076,7 @@ namespace OpenStack.Test.Storage
|
||||
});
|
||||
};
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.DeleteStorageObject(obj.ContainerName,obj.Name);
|
||||
}
|
||||
|
||||
@ -1084,7 +1084,7 @@ namespace OpenStack.Test.Storage
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public async Task DeletingStorageObjectWithNullContainerNameThrows()
|
||||
{
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.DeleteStorageObject(null,"TestObject");
|
||||
}
|
||||
|
||||
@ -1092,7 +1092,7 @@ namespace OpenStack.Test.Storage
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public async Task DeletingStorageObjectsWithEmptyContainerNameThrows()
|
||||
{
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.DeleteStorageObject(string.Empty, "TestObject");
|
||||
}
|
||||
|
||||
@ -1100,7 +1100,7 @@ namespace OpenStack.Test.Storage
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public async Task DeletingStorageObjectWithNullObjectNameThrows()
|
||||
{
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.DeleteStorageObject("TestContainer", null);
|
||||
}
|
||||
|
||||
@ -1108,7 +1108,7 @@ namespace OpenStack.Test.Storage
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public async Task DeletingStorageObjectsWithEmptyObjectNameThrows()
|
||||
{
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.DeleteStorageObject("TestContainer", string.Empty);
|
||||
}
|
||||
|
||||
@ -1127,7 +1127,7 @@ namespace OpenStack.Test.Storage
|
||||
});
|
||||
};
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.DeleteStorageFolder(containerName, folderName);
|
||||
}
|
||||
|
||||
@ -1146,7 +1146,7 @@ namespace OpenStack.Test.Storage
|
||||
});
|
||||
};
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.DeleteStorageFolder(containerName, folderName);
|
||||
}
|
||||
|
||||
@ -1154,7 +1154,7 @@ namespace OpenStack.Test.Storage
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public async Task DeletingStorageFolderWithNullContainerNameThrows()
|
||||
{
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.DeleteStorageFolder(null, "TestFolder");
|
||||
}
|
||||
|
||||
@ -1162,7 +1162,7 @@ namespace OpenStack.Test.Storage
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public async Task DeletingStorageFolderWithEmptyContainerNameThrows()
|
||||
{
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.DeleteStorageFolder(string.Empty, "TestFolder");
|
||||
}
|
||||
|
||||
@ -1170,7 +1170,7 @@ namespace OpenStack.Test.Storage
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public async Task DeletingStorageFolderWithNullObjectNameThrows()
|
||||
{
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.DeleteStorageFolder("TestContainer", null);
|
||||
}
|
||||
|
||||
@ -1178,7 +1178,7 @@ namespace OpenStack.Test.Storage
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public async Task DeletingStorageFolderWithEmptyObjectNameThrows()
|
||||
{
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.DeleteStorageFolder("TestContainer", string.Empty);
|
||||
}
|
||||
|
||||
@ -1200,7 +1200,7 @@ namespace OpenStack.Test.Storage
|
||||
});
|
||||
};
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.UpdateStorageObject(obj);
|
||||
}
|
||||
|
||||
@ -1208,7 +1208,7 @@ namespace OpenStack.Test.Storage
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public async Task UpdatingStorageObjectWithNullContainerThrows()
|
||||
{
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.UpdateStorageObject(null);
|
||||
}
|
||||
|
||||
@ -1234,7 +1234,7 @@ namespace OpenStack.Test.Storage
|
||||
return obj;
|
||||
};
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
var resp = await client.DownloadStorageObject(containerName, objectName, respStream);
|
||||
respStream.Position = 0;
|
||||
|
||||
@ -1248,7 +1248,7 @@ namespace OpenStack.Test.Storage
|
||||
{
|
||||
var objectName = "TestObject";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.DownloadStorageObject(null, objectName, new MemoryStream());
|
||||
}
|
||||
|
||||
@ -1258,7 +1258,7 @@ namespace OpenStack.Test.Storage
|
||||
{
|
||||
var objectName = "TestObject";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.DownloadStorageObject(string.Empty, objectName, new MemoryStream());
|
||||
}
|
||||
|
||||
@ -1268,7 +1268,7 @@ namespace OpenStack.Test.Storage
|
||||
{
|
||||
var containerName = "TestContainer";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.DownloadStorageObject(containerName, null, new MemoryStream() );
|
||||
}
|
||||
|
||||
@ -1278,7 +1278,7 @@ namespace OpenStack.Test.Storage
|
||||
{
|
||||
var containerName = "TestContainer";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.DownloadStorageObject(containerName, string.Empty, new MemoryStream());
|
||||
}
|
||||
|
||||
@ -1289,7 +1289,7 @@ namespace OpenStack.Test.Storage
|
||||
var containerName = "TestContainer";
|
||||
var objectName = "TestObject";
|
||||
|
||||
var client = new StorageServiceClient(GetValidCreds(), CancellationToken.None, this.ServiceLocator);
|
||||
var client = new StorageServiceClient(GetValidCreds(), "Swift", CancellationToken.None, this.ServiceLocator);
|
||||
await client.DownloadStorageObject(containerName, objectName, null);
|
||||
}
|
||||
}
|
||||
|
@ -58,6 +58,23 @@ namespace OpenStack
|
||||
/// <returns>An implementation of the requested client.</returns>
|
||||
T CreateServiceClient<T>(string version) where T : IOpenStackServiceClient;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a client for a given OpenStack service.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of client to create.</typeparam>
|
||||
/// <param name="serviceName">The name of the service that must be supported.</param>
|
||||
/// <returns>An implementation of the requested client.</returns>
|
||||
T CreateServiceClientByName<T>(string serviceName) where T : IOpenStackServiceClient;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a client for a given OpenStack service that supports the given version.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of client to create.</typeparam>
|
||||
/// <param name="serviceName">The name of the service that must be supported.</param>
|
||||
/// <param name="version">The version that must be supported.</param>
|
||||
/// <returns>An implementation of the requested client.</returns>
|
||||
T CreateServiceClientByName<T>(string serviceName, string version) where T : IOpenStackServiceClient;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of supported OpenStack versions for this client.
|
||||
/// </summary>
|
||||
|
@ -32,10 +32,11 @@ namespace OpenStack
|
||||
/// Creates an instance of the service client being defined.
|
||||
/// </summary>
|
||||
/// <param name="credential">The credential that the client will use.</param>
|
||||
/// <param name="serviceName">The name of the service that the client will use.</param>
|
||||
/// <param name="cancellationToken">The cancellation token that the client will use.</param>
|
||||
/// <param name="serviceLocator">A service locator to be used to locate/inject dependent services.</param>
|
||||
/// <returns></returns>
|
||||
IOpenStackServiceClient Create(ICredential credential, CancellationToken cancellationToken, IServiceLocator serviceLocator);
|
||||
IOpenStackServiceClient Create(ICredential credential, string serviceName, CancellationToken cancellationToken, IServiceLocator serviceLocator);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of supported versions.
|
||||
@ -47,7 +48,8 @@ namespace OpenStack
|
||||
/// Determines if this client is currently supported.
|
||||
/// </summary>
|
||||
/// <param name="credential">The credential for the service to use.</param>
|
||||
/// <param name="serviceName">The serviceName for the service.</param>
|
||||
/// <returns>A value indicating if the client is supported.</returns>
|
||||
bool IsSupported(ICredential credential);
|
||||
bool IsSupported(ICredential credential, string serviceName);
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,16 @@ namespace OpenStack
|
||||
/// </summary>
|
||||
public interface IOpenStackServiceClientManager
|
||||
{
|
||||
/// <summary>
|
||||
/// Create a client that can interact with the requested OpenStack service.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of client to be created.</typeparam>
|
||||
/// <param name="credential">The credential to be used by the client.</param>
|
||||
/// <param name="serviceName">The name of the service to be used by the client.</param>
|
||||
/// <param name="cancellationToken">The cancellation token to be used by the client.</param>
|
||||
/// <returns>An instance of the requested client.</returns>
|
||||
T CreateServiceClient<T>(ICredential credential, string serviceName, CancellationToken cancellationToken) where T : IOpenStackServiceClient;
|
||||
|
||||
/// <summary>
|
||||
/// Create a client that can interact with the requested OpenStack service.
|
||||
/// </summary>
|
||||
|
@ -28,9 +28,10 @@ namespace OpenStack.Identity
|
||||
/// Creates a client that can be used to interact with the remote OpenStack service.
|
||||
/// </summary>
|
||||
/// <param name="credentials">The credential to be used when interacting with OpenStack.</param>
|
||||
/// <param name="serviceName">The name of the service to be used when interacting with OpenStack.</param>
|
||||
/// <param name="token">The cancellation token to be used when interacting with OpenStack.</param>
|
||||
/// <param name="serviceLocator">A service locator to be used to locate/inject dependent services.</param>
|
||||
/// <returns>An instance of the client.</returns>
|
||||
IIdentityServicePocoClient Create(IOpenStackCredential credentials, CancellationToken token, IServiceLocator serviceLocator);
|
||||
IIdentityServicePocoClient Create(IOpenStackCredential credentials, string serviceName, CancellationToken token, IServiceLocator serviceLocator);
|
||||
}
|
||||
}
|
||||
|
@ -27,25 +27,29 @@ namespace OpenStack.Identity
|
||||
internal IOpenStackCredential Credential;
|
||||
internal CancellationToken CancellationToken;
|
||||
internal IServiceLocator ServiceLocator;
|
||||
internal string ServiceName;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the IdentityServiceClient class.
|
||||
/// </summary>
|
||||
/// <param name="credential">The credential to be used by the client.</param>
|
||||
/// <param name="serviceName">The name of the service to be used by the client.</param>
|
||||
/// <param name="cancellationToken">A cancellation token to be used when completing requests.</param>
|
||||
/// <param name="serviceLocator">A service locator to be used to locate/inject dependent services.</param>
|
||||
internal IdentityServiceClient(IOpenStackCredential credential, CancellationToken cancellationToken, IServiceLocator serviceLocator)
|
||||
internal IdentityServiceClient(IOpenStackCredential credential, string serviceName, CancellationToken cancellationToken, IServiceLocator serviceLocator)
|
||||
{
|
||||
serviceLocator.AssertIsNotNull("serviceLocator", "Cannot create an identity service client with a null service locator.");
|
||||
|
||||
this.ServiceLocator = serviceLocator;
|
||||
this.Credential = credential;
|
||||
this.CancellationToken = cancellationToken;
|
||||
this.ServiceName = serviceName;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<IOpenStackCredential> Authenticate()
|
||||
{
|
||||
var client = this.ServiceLocator.Locate<IIdentityServicePocoClientFactory>().Create(this.Credential, this.CancellationToken, this.ServiceLocator);
|
||||
var client = this.ServiceLocator.Locate<IIdentityServicePocoClientFactory>().Create(this.Credential, this.ServiceName, this.CancellationToken, this.ServiceLocator);
|
||||
this.Credential = await client.Authenticate();
|
||||
return this.Credential;
|
||||
}
|
||||
|
@ -25,6 +25,8 @@ namespace OpenStack.Identity
|
||||
/// <inheritdoc/>
|
||||
internal class IdentityServiceClientDefinition : IOpenStackServiceClientDefinition
|
||||
{
|
||||
internal const string DefaultServiceName = "Keystone";
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string Name { get; private set; }
|
||||
|
||||
@ -37,9 +39,10 @@ namespace OpenStack.Identity
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IOpenStackServiceClient Create(ICredential credential, CancellationToken cancellationToken, IServiceLocator serviceLocator)
|
||||
public IOpenStackServiceClient Create(ICredential credential, string serviceName, CancellationToken cancellationToken, IServiceLocator serviceLocator)
|
||||
{
|
||||
return new IdentityServiceClient((IOpenStackCredential)credential, cancellationToken, serviceLocator);
|
||||
var srvName = string.IsNullOrEmpty(serviceName) ? DefaultServiceName : serviceName;
|
||||
return new IdentityServiceClient((IOpenStackCredential)credential, srvName, cancellationToken, serviceLocator);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
@ -49,13 +52,13 @@ namespace OpenStack.Identity
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool IsSupported(ICredential credential)
|
||||
public bool IsSupported(ICredential credential, string serviceName)
|
||||
{
|
||||
if (credential != null && credential.AuthenticationEndpoint != null)
|
||||
{
|
||||
//https://someidentityendpoint:35357/v2.0/tokens
|
||||
//https://someidentityendpoint:35357/v2.0
|
||||
var endpointSegs = credential.AuthenticationEndpoint.Segments;
|
||||
if (endpointSegs.Count() == 3 && string.Equals(endpointSegs[1].Trim('/'), "v2.0", StringComparison.Ordinal))
|
||||
if (endpointSegs.Count() == 2 && string.Equals(endpointSegs[1].Trim('/'), "v2.0", StringComparison.Ordinal))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ namespace OpenStack.Identity
|
||||
{
|
||||
internal IOpenStackCredential credential;
|
||||
internal CancellationToken cancellationToken;
|
||||
internal const string IdentityServiceName = "Identity";
|
||||
internal string ServiceName;
|
||||
internal IServiceLocator ServiceLocator;
|
||||
|
||||
/// <summary>
|
||||
@ -37,15 +37,17 @@ namespace OpenStack.Identity
|
||||
/// <param name="credential">The credential to be used when interacting with OpenStack.</param>
|
||||
/// <param name="cancellationToken">The cancellation token to be used when interacting with OpenStack.</param>
|
||||
/// <param name="serviceLocator">A service locator to be used to locate/inject dependent services.</param>
|
||||
public IdentityServicePocoClient(IOpenStackCredential credential, CancellationToken cancellationToken, IServiceLocator serviceLocator)
|
||||
public IdentityServicePocoClient(IOpenStackCredential credential, string serviceName, CancellationToken cancellationToken, IServiceLocator serviceLocator)
|
||||
{
|
||||
credential.AssertIsNotNull("credential");
|
||||
cancellationToken.AssertIsNotNull("cancellationToken");
|
||||
serviceLocator.AssertIsNotNull("serviceLocator", "Cannot create an identity service poco client with a null service locator.");
|
||||
serviceName.AssertIsNotNullOrEmpty("serviceName", "Cannot create an identity service poco client with a null or empty service name.");
|
||||
|
||||
this.credential = credential;
|
||||
this.cancellationToken = cancellationToken;
|
||||
this.ServiceLocator = serviceLocator;
|
||||
this.ServiceName = serviceName;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
@ -74,7 +76,7 @@ namespace OpenStack.Identity
|
||||
if (string.IsNullOrEmpty(this.credential.Region))
|
||||
{
|
||||
var resolver = this.ServiceLocator.Locate<IOpenStackRegionResolver>();
|
||||
var region = resolver.Resolve(this.credential.AuthenticationEndpoint, this.credential.ServiceCatalog, IdentityServiceName);
|
||||
var region = resolver.Resolve(this.credential.AuthenticationEndpoint, this.credential.ServiceCatalog, this.ServiceName);
|
||||
|
||||
//TODO: figure out if we want to throw in the case where the region cannot be resolved...
|
||||
this.credential.SetRegion(region);
|
||||
|
@ -23,9 +23,9 @@ namespace OpenStack.Identity
|
||||
internal class IdentityServicePocoClientFactory :IIdentityServicePocoClientFactory
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public IIdentityServicePocoClient Create(IOpenStackCredential credentials, CancellationToken token, IServiceLocator serviceLocator)
|
||||
public IIdentityServicePocoClient Create(IOpenStackCredential credentials, string serviceName, CancellationToken token, IServiceLocator serviceLocator)
|
||||
{
|
||||
return new IdentityServicePocoClient(credentials, token, serviceLocator);
|
||||
return new IdentityServicePocoClient(credentials, serviceName, token, serviceLocator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
// limitations under the License.
|
||||
// ============================================================================ */
|
||||
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
@ -55,7 +56,7 @@ namespace OpenStack.Identity
|
||||
client.Headers.Add("Accept", "application/json");
|
||||
client.ContentType = "application/json";
|
||||
|
||||
client.Uri = this.Credential.AuthenticationEndpoint;
|
||||
client.Uri = new Uri(string.Format("{0}/tokens", this.Credential.AuthenticationEndpoint));
|
||||
client.Method = HttpMethod.Post;
|
||||
client.Content = CreateAuthenticationJsonPayload(this.Credential).ConvertToStream();
|
||||
|
||||
|
@ -30,19 +30,27 @@ namespace OpenStack.Identity
|
||||
serviceName.AssertIsNotNullOrEmpty("serviceName", "Cannot resolve a region with a null or empty service name.");
|
||||
|
||||
var ret = string.Empty;
|
||||
var cat = catalog.ToList();
|
||||
|
||||
var identService = catalog.FirstOrDefault(s => string.Equals(s.Name, serviceName, StringComparison.OrdinalIgnoreCase));
|
||||
var identService = cat.FirstOrDefault(s => string.Equals(s.Name, serviceName, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (identService == null)
|
||||
{
|
||||
return ret;
|
||||
//Fall back and see if any service can be found that publishes an endpoint that matches the one given.
|
||||
identService = cat.FirstOrDefault(s => s.Endpoints.Any(e => endpoint.AbsoluteUri.TrimEnd('/').Contains(e.PublicUri.TrimEnd('/'))));
|
||||
if (identService == null)
|
||||
{
|
||||
//if no service can be found, either by name or endpoint, then return string.empty
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
var defaultRegionEndpoint = identService.Endpoints.FirstOrDefault(e => endpoint.AbsoluteUri.Contains(e.PublicUri));
|
||||
var defaultRegionEndpoint = identService.Endpoints.FirstOrDefault(e => endpoint.AbsoluteUri.TrimEnd('/').Contains(e.PublicUri.TrimEnd('/')));
|
||||
if (defaultRegionEndpoint != null && !string.IsNullOrEmpty(defaultRegionEndpoint.Region))
|
||||
{
|
||||
ret = defaultRegionEndpoint.Region;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
@ -60,15 +60,12 @@ namespace OpenStack.Identity
|
||||
{
|
||||
publicUri.AssertIsNotNull("publicUri", "Cannot create a service endpoint with a null public URI.");
|
||||
region.AssertIsNotNull("region", "Cannot create a service endpoint with a null public URI.");
|
||||
version.AssertIsNotNull("version", "Cannot create a service endpoint with a null version.");
|
||||
versionInfo.AssertIsNotNull("versionInfo", "Cannot create a service endpoint with a null version information URI.");
|
||||
versionList.AssertIsNotNull("versionList", "Cannot create a service endpoint with a null version list URI.");
|
||||
|
||||
this.PublicUri = publicUri;
|
||||
this.Region = region;
|
||||
this.Version = version;
|
||||
this.VersionInformation = versionInfo;
|
||||
this.VersionList = versionList;
|
||||
this.Version = version ?? string.Empty;
|
||||
this.VersionInformation = versionInfo ?? string.Empty;
|
||||
this.VersionList = versionList ?? string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -79,6 +79,19 @@ namespace OpenStack
|
||||
return manager.CreateServiceClient<T>(this.Credential, this.CancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public T CreateServiceClientByName<T>(string serviceName) where T : IOpenStackServiceClient
|
||||
{
|
||||
return this.CreateServiceClientByName<T>(serviceName, string.Empty);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public T CreateServiceClientByName<T>(string serviceName, string version) where T : IOpenStackServiceClient
|
||||
{
|
||||
var manager = this.ServiceLocator.Locate<IOpenStackServiceClientManager>();
|
||||
return manager.CreateServiceClient<T>(this.Credential, serviceName, this.CancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IEnumerable<string> GetSupportedVersions()
|
||||
{
|
||||
|
@ -17,7 +17,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using OpenStack.Common;
|
||||
using OpenStack.Common.ServiceLocation;
|
||||
@ -41,7 +40,14 @@ namespace OpenStack
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public T CreateServiceClient<T>(ICredential credential, CancellationToken cancellationToken) where T : IOpenStackServiceClient
|
||||
public T CreateServiceClient<T>(ICredential credential, CancellationToken cancellationToken)
|
||||
where T : IOpenStackServiceClient
|
||||
{
|
||||
return CreateServiceClient<T>(credential, string.Empty, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public T CreateServiceClient<T>(ICredential credential, string serviceName, CancellationToken cancellationToken) where T : IOpenStackServiceClient
|
||||
{
|
||||
credential.AssertIsNotNull("credential", "Cannot create an OpenStack service with a null credential.");
|
||||
cancellationToken.AssertIsNotNull("cancellationToken", "Cannot create an OpenStack service with a null cancellationToken.");
|
||||
@ -54,9 +60,9 @@ namespace OpenStack
|
||||
|
||||
foreach (var serviceClientDef in this.serviceClientDefinitions.Where(s =>typeof(T).IsAssignableFrom(s.Key)))
|
||||
{
|
||||
if (serviceClientDef.Value != null && serviceClientDef.Value.IsSupported(credential))
|
||||
if (serviceClientDef.Value != null && serviceClientDef.Value.IsSupported(credential, serviceName))
|
||||
{
|
||||
var client = this.CreateServiceClientInstance(serviceClientDef.Value, credential, cancellationToken);
|
||||
var client = this.CreateServiceClientInstance(serviceClientDef.Value, credential, serviceName, cancellationToken);
|
||||
return (T) client;
|
||||
}
|
||||
}
|
||||
@ -69,16 +75,17 @@ namespace OpenStack
|
||||
/// </summary>
|
||||
/// <param name="clientDefinition">A object that can be used to validate and create the give client type.</param>
|
||||
/// <param name="credential">The credential to be used by the created client.</param>
|
||||
/// <param name="serviceName">The name of the service to be used by the created client.</param>
|
||||
/// <param name="cancellationToken">The cancellation token to be used by the created client.</param>
|
||||
/// <returns>An instance of the requested client.</returns>
|
||||
internal IOpenStackServiceClient CreateServiceClientInstance(IOpenStackServiceClientDefinition clientDefinition, ICredential credential, CancellationToken cancellationToken)
|
||||
internal IOpenStackServiceClient CreateServiceClientInstance(IOpenStackServiceClientDefinition clientDefinition, ICredential credential, string serviceName, CancellationToken cancellationToken)
|
||||
{
|
||||
clientDefinition.AssertIsNotNull("clientDefinition", "Cannot create an OpenStack service with a null client definition.");
|
||||
|
||||
IOpenStackServiceClient instance;
|
||||
try
|
||||
{
|
||||
instance = clientDefinition.Create(credential, cancellationToken, this.ServiceLocator) as IOpenStackServiceClient;
|
||||
instance = clientDefinition.Create(credential, serviceName, cancellationToken, this.ServiceLocator) as IOpenStackServiceClient;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -31,7 +31,6 @@ namespace OpenStack.Storage
|
||||
internal class StorageServiceClient : IStorageServiceClient
|
||||
{
|
||||
internal StorageServiceClientContext Context;
|
||||
internal const string StorageServiceName = "Object Storage";
|
||||
internal IServiceLocator ServiceLocator;
|
||||
|
||||
/// <inheritdoc/>
|
||||
@ -49,7 +48,7 @@ namespace OpenStack.Storage
|
||||
/// <param name="credentials">The credential to be used by this client.</param>
|
||||
/// <param name="token">The cancellation token to be used by this client.</param>
|
||||
/// <param name="serviceLocator">A service locator to be used to locate/inject dependent services.</param>
|
||||
public StorageServiceClient(IOpenStackCredential credentials, CancellationToken token, IServiceLocator serviceLocator)
|
||||
public StorageServiceClient(IOpenStackCredential credentials, string serviceName, CancellationToken token, IServiceLocator serviceLocator)
|
||||
{
|
||||
serviceLocator.AssertIsNotNull("serviceLocator", "Cannot create a storage service client with a null service locator.");
|
||||
|
||||
@ -58,8 +57,8 @@ namespace OpenStack.Storage
|
||||
this.LargeObjectSegmentContainer = "LargeObjectSegments"; //set the default name of the container that will hold segments to 'LargeObjectSegments';
|
||||
|
||||
this.ServiceLocator = serviceLocator;
|
||||
var endpoint = new Uri(credentials.ServiceCatalog.GetPublicEndpoint(StorageServiceName, credentials.Region));
|
||||
this.Context = new StorageServiceClientContext(credentials, token, StorageServiceName, endpoint);
|
||||
var endpoint = new Uri(credentials.ServiceCatalog.GetPublicEndpoint(serviceName, credentials.Region));
|
||||
this.Context = new StorageServiceClientContext(credentials, token, serviceName, endpoint);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
@ -26,6 +26,8 @@ namespace OpenStack.Storage
|
||||
/// <inheritdoc/>
|
||||
internal class StorageServiceClientDefinition : IOpenStackServiceClientDefinition
|
||||
{
|
||||
internal const string DefaultStorageServiceName = "Swift";
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string Name { get; private set; }
|
||||
|
||||
@ -38,9 +40,9 @@ namespace OpenStack.Storage
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IOpenStackServiceClient Create(ICredential credential, CancellationToken cancellationToken, IServiceLocator serviceLocator)
|
||||
public IOpenStackServiceClient Create(ICredential credential, string serviceName, CancellationToken cancellationToken, IServiceLocator serviceLocator)
|
||||
{
|
||||
return new StorageServiceClient((IOpenStackCredential)credential, cancellationToken, serviceLocator);
|
||||
return new StorageServiceClient((IOpenStackCredential)credential, GetServiceName(serviceName), cancellationToken, serviceLocator);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
@ -50,18 +52,29 @@ namespace OpenStack.Storage
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool IsSupported(ICredential credential)
|
||||
public bool IsSupported(ICredential credential, string serviceName)
|
||||
{
|
||||
if (credential != null && credential.ServiceCatalog != null)
|
||||
if (credential == null || credential.ServiceCatalog == null)
|
||||
{
|
||||
var catalog = credential.ServiceCatalog;
|
||||
return
|
||||
catalog.Any(
|
||||
s =>
|
||||
string.Equals(s.Name, StorageServiceClient.StorageServiceName, StringComparison.OrdinalIgnoreCase) &&
|
||||
s.Endpoints.Any(e => this.ListSupportedVersions().Contains(e.Version)));
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
|
||||
var catalog = credential.ServiceCatalog;
|
||||
return
|
||||
catalog.Any(
|
||||
s =>
|
||||
string.Equals(s.Name, GetServiceName(serviceName), StringComparison.OrdinalIgnoreCase) &&
|
||||
s.Endpoints.Any(e => this.ListSupportedVersions().Contains(e.Version) || e.PublicUri.Contains("/v1")));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the service name to use.
|
||||
/// </summary>
|
||||
/// <param name="serviceName">The given service name.</param>
|
||||
/// <returns>The given service name if it is not empty or null, otherwise the default service name will be returned.</returns>
|
||||
internal string GetServiceName(string serviceName)
|
||||
{
|
||||
return string.IsNullOrEmpty(serviceName) ? DefaultStorageServiceName : serviceName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user