public static void AreEqualServicePathInfo(string rootPath, CloudProjectPathInfo actual) { Assert.AreEqual<string>(rootPath, actual.RootPath); Assert.AreEqual<string>(Path.Combine(rootPath, Resources.ServiceDefinitionFileName), actual.Definition); Assert.AreEqual<string>(Path.Combine(rootPath, Resources.CloudServiceConfigurationFileName), actual.CloudConfiguration); Assert.AreEqual<string>(Path.Combine(rootPath, Resources.LocalServiceConfigurationFileName), actual.LocalConfiguration); Assert.AreEqual<string>(Path.Combine(rootPath, Resources.SettingsFileName), actual.Settings); Assert.AreEqual<string>(Path.Combine(rootPath, Resources.CloudPackageFileName), actual.CloudPackage); Assert.AreEqual<string>(Path.Combine(rootPath, Resources.LocalPackageFileName), actual.LocalPackage); }
/// <summary> /// Set the runtime properties for a role /// </summary> /// <param name="definition">The service containing the role</param> /// <param name="roleName">The name of the role to change</param> /// <param name="path">The path to the service</param> /// <param name="version">The version of the runtime to be installed</param> /// <param name="overrideUrl">The value of the override url, if the user wants to opt out of the system</param> /// <returns>true if the settings were successfully changed</returns> public static bool SetRoleRuntime(ServiceDefinition definition, string roleName, CloudProjectPathInfo path, string version = null, string overrideUrl = null) { bool changed = false; Variable[] environment = GetRoleRuntimeEnvironment(definition, roleName); if (version != null) { string filePath = Path.Combine(path.RootPath, roleName, "package.json"); File.WriteAllText(filePath, string.Format(TestResources.ValidPackageJson, "testapp", version)); changed = true; } if (overrideUrl != null) { environment = SetRuntimeEnvironment(environment, Resources.RuntimeOverrideKey, overrideUrl); changed = true; } return changed && ApplyRuntimeChanges(definition, roleName, environment); }
public void CreatePackage(ServiceDefinition definition, CloudProjectPathInfo paths, DevEnv type, string azureSdkBinDirectory, out string standardOutput, out string standardError) { if (definition == null) { throw new ArgumentNullException( "definition", string.Format(Resources.InvalidOrEmptyArgumentMessage, "Service definition")); } if (string.IsNullOrEmpty(paths.RootPath)) { throw new ArgumentException(Resources.InvalidRootNameMessage, "rootPath"); } // Track the directories that are created by GetOrCreateCleanPath // to avoid publishing iisnode log files so we can delete the temp // copies when we're finished packaging Dictionary<string, string> tempDirectories = new Dictionary<string, string>(); try { string roles = // Get the names of all web and worker roles Enumerable.Concat( definition.WebRole.NonNull().Select(role => role.name), definition.WorkerRole.NonNull().Select(role => role.name)) // Get the name and safe path for each role (i.e., if the // role has files that shouldn't be packaged, it'll be // copied to a temp location without those files) .Select(name => GetOrCreateCleanPath(paths.RolesPath, name, tempDirectories, type)) // Format the role name and path as a role argument .Select(nameAndPath => string.Format(Resources.RoleArgTemplate, nameAndPath.Key, nameAndPath.Value)) // Join all the role arguments together into one .DefaultIfEmpty(string.Empty) .Aggregate(string.Concat); string sites = // Get all of the web roles definition.WebRole.NonNull() // Get all the sites in each role and format them all as // site arguments .SelectMany(role => // Format each site as a site argument role.Sites.Site.Select(site => string.Format( Resources.SitesArgTemplate, role.name, site.name, tempDirectories.GetValueOrDefault(role.name, paths.RolesPath)))) // Join all the site arguments together into one .DefaultIfEmpty(string.Empty) .Aggregate(string.Concat); string args = string.Format( type == DevEnv.Local ? Resources.CsPackLocalArg : Resources.CsPackCloudArg, paths.RootPath, roles, sites); // Run CsPack to generate the package ProcessHelper.StartAndWaitForProcess( new ProcessStartInfo( Path.Combine(azureSdkBinDirectory, Resources.CsPackExe), args), out standardOutput, out standardError); } finally { // Cleanup any temp directories tempDirectories.Values.ForEach(dir => Directory.Delete(dir, true)); } }
public static void AreEqualServicePathInfo(string cloudConfig, string cloudPackage, string def, string localConfig, string localPackage, string rootPath, string settings, CloudProjectPathInfo actual) { throw new NotImplementedException(); }
public static void AreEqualServicePathInfo(CloudProjectPathInfo expected, CloudProjectPathInfo actual) { AreEqualServicePathInfo(expected.CloudConfiguration, expected.CloudPackage, expected.Definition, expected.LocalConfiguration, expected.LocalPackage, expected.RootPath, expected.Settings, actual); }