public ChangeServiceName ( string newName, |
||
newName | string | |
paths | ||
return | void |
private PublishContext CreatePublishContext( string name, string slot, string location, string affinityGroup, string storageServiceName, string deploymentName, CloudServiceProject cloudServiceProject) { string serviceName; // If the name provided is different than existing name change it if (!string.IsNullOrEmpty(name) && name != cloudServiceProject.ServiceName) { cloudServiceProject.ChangeServiceName(name, cloudServiceProject.Paths); } // If there's no storage service provided, try using the default one if (string.IsNullOrEmpty(storageServiceName)) { storageServiceName = Subscription.GetProperty(AzureSubscription.Property.StorageAccount); } ServiceSettings serviceSettings = ServiceSettings.LoadDefault( cloudServiceProject.Paths.Settings, slot, location, affinityGroup, Subscription.Name, storageServiceName, name, cloudServiceProject.ServiceName, out serviceName ); // Use default location if not location and affinity group provided serviceSettings.Location = string.IsNullOrEmpty(serviceSettings.Location) && string.IsNullOrEmpty(serviceSettings.AffinityGroup) ? GetDefaultLocation() : serviceSettings.Location; PublishContext context = new PublishContext( serviceSettings, Path.Combine(GetCurrentDirectory(), cloudServiceProject.Paths.CloudPackage), Path.Combine(GetCurrentDirectory(), cloudServiceProject.Paths.CloudConfiguration), serviceName, deploymentName, cloudServiceProject.Paths.RootPath); context.ServiceProject = cloudServiceProject; return(context); }
public void ChangeServiceNameTest() { string newName = "NodeAppService"; using (FileSystemHelper files = new FileSystemHelper(this)) { CloudServiceProject service = new CloudServiceProject(files.RootPath, serviceName, null); service.ChangeServiceName(newName, service.Paths); Assert.Equal<string>(newName, service.Components.CloudConfig.serviceName); Assert.Equal<string>(newName, service.Components.LocalConfig.serviceName); Assert.Equal<string>(newName, service.Components.Definition.name); } }
private PublishContext CreatePublishContext( string name, string slot, string location, string affinityGroup, string storageServiceName, string deploymentName, CloudServiceProject cloudServiceProject) { string serviceName; // If the name provided is different than existing name change it if (!string.IsNullOrEmpty(name) && name != cloudServiceProject.ServiceName) { cloudServiceProject.ChangeServiceName(name, cloudServiceProject.Paths); } // If there's no storage service provided, try using the default one if (string.IsNullOrEmpty(storageServiceName)) { storageServiceName = Subscription.CurrentStorageAccountName; } ServiceSettings serviceSettings = ServiceSettings.LoadDefault( cloudServiceProject.Paths.Settings, slot, location, affinityGroup, Subscription.SubscriptionName, storageServiceName, name, cloudServiceProject.ServiceName, out serviceName ); // Use default location if not location and affinity group provided serviceSettings.Location = string.IsNullOrEmpty(serviceSettings.Location) && string.IsNullOrEmpty(serviceSettings.AffinityGroup) ? GetDefaultLocation() : serviceSettings.Location; PublishContext context = new PublishContext( serviceSettings, Path.Combine(GetCurrentDirectory(), cloudServiceProject.Paths.CloudPackage), Path.Combine(GetCurrentDirectory(), cloudServiceProject.Paths.CloudConfiguration), serviceName, deploymentName, cloudServiceProject.Paths.RootPath); context.ServiceProject = cloudServiceProject; return context; }