Exemplo n.º 1
0
        public void ServiceComponentsTest()
        {
            newServiceCmdlet.NewAzureServiceProcess(Directory.GetCurrentDirectory(), serviceName);
            ServiceComponents components = new ServiceComponents(new ServicePathInfo(serviceName));

            AzureAssert.AreEqualServiceComponents(components);
        }
Exemplo n.º 2
0
        public void AddNewCacheWorkerRoleSuccessful()
        {
            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                string rootPath = Path.Combine(files.RootPath, "AzureService");
                string roleName = "WorkerRole";
                int    expectedInstanceCount = 10;
                newServiceCmdlet.NewAzureServiceProcess(files.RootPath, "AzureService");
                WorkerRole cacheWorkerRole = addCacheRoleCmdlet.AddAzureCacheWorkerRoleProcess(roleName, expectedInstanceCount, rootPath);

                AzureAssert.ScaffoldingExists(Path.Combine(files.RootPath, "AzureService", "WorkerRole"), Path.Combine(Resources.GeneralScaffolding, Resources.WorkerRole));

                AzureAssert.WorkerRoleImportsExists(new Import {
                    moduleName = Resources.CachingModuleName
                }, cacheWorkerRole);

                AzureAssert.LocalResourcesLocalStoreExists(new LocalStore {
                    name = Resources.CacheDiagnosticStoreName, cleanOnRoleRecycle = false
                },
                                                           cacheWorkerRole.LocalResources);

                Assert.IsNull(cacheWorkerRole.Endpoints.InputEndpoint);

                AssertConfigExists(Testing.GetCloudRole(rootPath, roleName));
                AssertConfigExists(Testing.GetLocalRole(rootPath, roleName), Resources.EmulatorConnectionString);

                PSObject actualOutput = mockCommandRuntime.OutputPipeline[1] as PSObject;
                Assert.AreEqual <string>(roleName, actualOutput.Members[Parameters.CacheWorkerRoleName].Value.ToString());
                Assert.AreEqual <int>(expectedInstanceCount, int.Parse(actualOutput.Members[Parameters.Instances].Value.ToString()));
            }
        }
Exemplo n.º 3
0
        public void ServiceComponentsTest()
        {
            TestMockSupport.TestExecutionFolder = AppDomain.CurrentDomain.BaseDirectory;
            newServiceCmdlet.NewAzureServiceProcess(TestMockSupport.TestExecutionFolder, serviceName);
            ServiceComponents components = new ServiceComponents(
                new PowerShellProjectPathInfo(
                    Path.Combine(AppDomain.CurrentDomain.BaseDirectory, serviceName)));

            AzureAssert.AreEqualServiceComponents(components);
        }
Exemplo n.º 4
0
        public void PublishAzureServiceCreateBasicPackageTest()
        {
            // Create a temp directory that we'll use to "publish" our service
            using (FileSystemHelper files = new FileSystemHelper(this)
            {
                EnableMonitoring = true
            })
            {
                // Import our default publish settings
                files.CreateAzureSdkDirectoryAndImportPublishSettings();

                // Create a new channel to mock the calls to Azure and
                // determine all of the results that we'll need.
                SimpleServiceManagement channel = new SimpleServiceManagement();

                // Create a new service that we're going to publish
                string serviceName = "TEST_SERVICE_NAME";
                NewAzureServiceProjectCommand newService = new NewAzureServiceProjectCommand();
                newService.NewAzureServiceProcess(files.RootPath, serviceName);
                string servicePath = files.CreateDirectory(serviceName);

                // Get the publishing process started by creating the package
                PublishAzureServiceProjectCommand publishService = new PublishAzureServiceProjectCommand(channel);
                publishService.InitializeSettingsAndCreatePackage(servicePath);

                // Verify the generated files
                files.AssertFiles(new Dictionary <string, Action <string> >()
                {
                    {
                        serviceName + @"\deploymentSettings.json",
                        null
                    },
                    {
                        serviceName + @"\ServiceDefinition.csdef",
                        p => File.ReadAllText(p).Contains(serviceName)
                    },
                    {
                        serviceName + @"\ServiceConfiguration.Cloud.cscfg",
                        p => File.ReadAllText(p).Contains(serviceName)
                    },
                    {
                        serviceName + @"\ServiceConfiguration.Local.cscfg",
                        p => File.ReadAllText(p).Contains(serviceName)
                    },
                    {
                        serviceName + @"\cloud_package.cspkg",
                        p =>
                        {
                            using (Package package = Package.Open(p))
                            {
                                Assert.AreEqual(5, package.GetParts().Count());
                            }
                        }
                    }
                });
            }
        }
Exemplo n.º 5
0
 public void GetServiceNameTest()
 {
     using (FileSystemHelper files = new FileSystemHelper(this))
     {
         NewAzureServiceProjectCommand newServiceCmdlet = new NewAzureServiceProjectCommand();
         newServiceCmdlet.CommandRuntime = new MockCommandRuntime();
         newServiceCmdlet.NewAzureServiceProcess(files.RootPath, serviceName);
         Assert.AreEqual <string>(serviceName, new AzureService(Path.Combine(files.RootPath, serviceName), null).ServiceName);
     }
 }
        public void NewAzureServiceSuccessfull()
        {
            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                // Setup
                string expectedName     = "test";
                string expectedRootPath = Path.Combine(files.RootPath, expectedName);
                string expectedServiceCreatedMessage = string.Format(Resources.NewServiceCreatedMessage, expectedRootPath);
                cmdlet.ServiceName = expectedName;

                // Test
                cmdlet.NewAzureServiceProcess(files.RootPath, expectedName);

                // Assert
                PSObject actualPSObject = mockCommandRuntime.OutputPipeline[0] as PSObject;
                string   actualServiceCreatedMessage = mockCommandRuntime.VerboseStream[0];

                Assert.AreEqual <string>(expectedName, actualPSObject.Members[Parameters.ServiceName].Value.ToString());
                Assert.AreEqual <string>(expectedRootPath, actualPSObject.Members[Parameters.RootPath].Value.ToString());
                Assert.AreEqual <string>(expectedServiceCreatedMessage, actualServiceCreatedMessage);
                AzureAssert.AzureServiceExists(expectedRootPath, Resources.GeneralScaffolding, expectedName);
            }
        }
Exemplo n.º 7
0
 public void GetServiceNameTest()
 {
     using (FileSystemHelper files = new FileSystemHelper(this))
     {
         NewAzureServiceProjectCommand newServiceCmdlet = new NewAzureServiceProjectCommand();
         newServiceCmdlet.CommandRuntime = new MockCommandRuntime();
         newServiceCmdlet.NewAzureServiceProcess(files.RootPath, serviceName);
         Assert.AreEqual<string>(serviceName, new AzureService(Path.Combine(files.RootPath, serviceName), null).ServiceName);
     }
 }
Exemplo n.º 8
0
        /// <summary>
        /// Create a new service with a given name and make that the current
        /// directory used by cmdlets.
        /// </summary>
        /// <param name="serviceName">Name of the service.</param>
        /// <returns>Directory created for the service.</returns>
        public string CreateNewService(string serviceName)
        {
            NewAzureServiceProjectCommand cmdlet = new NewAzureServiceProjectCommand();
            cmdlet.CommandRuntime = new MockCommandRuntime();
            cmdlet.NewAzureServiceProcess(RootPath, serviceName);

            string path = Path.Combine(RootPath, serviceName);
            _previousDirectory = Environment.CurrentDirectory;
            Environment.CurrentDirectory = path;

            return path;
        }
Exemplo n.º 9
0
        public void PublishAzureServiceRemovesNodeLogs()
        {
            // Create a temp directory that we'll use to "publish" our service
            using (FileSystemHelper files = new FileSystemHelper(this)
            {
                EnableMonitoring = true
            })
            {
                // Import our default publish settings
                files.CreateAzureSdkDirectoryAndImportPublishSettings();

                // Create a new channel to mock the calls to Azure and
                // determine all of the results that we'll need.
                SimpleServiceManagement channel = new SimpleServiceManagement();

                // Create a new service that we're going to publish
                string serviceName = "TEST_SERVICE_NAME";
                NewAzureServiceProjectCommand newService = new NewAzureServiceProjectCommand();
                newService.NewAzureServiceProcess(files.RootPath, serviceName);
                string servicePath = files.CreateDirectory(serviceName);

                // Add a web role
                AddAzureNodeWebRoleCommand newWebRole = new AddAzureNodeWebRoleCommand();
                string webRoleName = "NODE_WEB_ROLE";
                newWebRole.AddAzureNodeWebRoleProcess(webRoleName, 2, servicePath);
                string webRolePath = Path.Combine(servicePath, webRoleName);

                // Add a worker role
                AddAzureNodeWorkerRoleCommand newWorkerRole = new AddAzureNodeWorkerRoleCommand();
                string workerRoleName = "NODE_WORKER_ROLE";
                newWorkerRole.AddAzureNodeWorkerRoleProcess(workerRoleName, 2, servicePath);
                string workerRolePath = Path.Combine(servicePath, workerRoleName);

                // Add second web and worker roles that we won't add log
                // entries to
                new AddAzureNodeWebRoleCommand()
                .AddAzureNodeWebRoleProcess("SECOND_WEB_ROLE", 2, servicePath);
                new AddAzureNodeWorkerRoleCommand()
                .AddAzureNodeWorkerRoleProcess("SECOND_WORKER_ROLE", 2, servicePath);

                // Add fake logs directories for server.js
                string logName = "server.js.logs";
                string logPath = Path.Combine(webRolePath, logName);
                Directory.CreateDirectory(logPath);
                File.WriteAllText(Path.Combine(logPath, "0.txt"), "secret web role debug details were logged here");
                logPath = Path.Combine(Path.Combine(workerRolePath, "NestedDirectory"), logName);
                Directory.CreateDirectory(logPath);
                File.WriteAllText(Path.Combine(logPath, "0.txt"), "secret worker role debug details were logged here");

                // Get the publishing process started by creating the package
                PublishAzureServiceProjectCommand publishService = new PublishAzureServiceProjectCommand(channel);
                publishService.InitializeSettingsAndCreatePackage(servicePath);

                // Rip open the package and make sure we can't find the log
                string packagePath = Path.Combine(servicePath, "cloud_package.cspkg");
                using (Package package = Package.Open(packagePath))
                {
                    // Make sure the web role and worker role packages don't
                    // have any files with server.js.logs in the name
                    Action <string> validateRole = roleName =>
                    {
                        PackagePart rolePart = package.GetParts().Where(p => p.Uri.ToString().Contains(roleName)).First();
                        using (Package rolePackage = Package.Open(rolePart.GetStream()))
                        {
                            Assert.IsFalse(
                                rolePackage.GetParts().Any(p => p.Uri.ToString().Contains(logName)),
                                "Found {0} part in {1} package!",
                                logName,
                                roleName);
                        }
                    };
                    validateRole(webRoleName);
                    validateRole(workerRoleName);
                }
            }
        }
Exemplo n.º 10
0
        public void PublishAzureServiceCreateDeploymentForExistingService()
        {
            // Create a temp directory that we'll use to "publish" our service
            using (FileSystemHelper files = new FileSystemHelper(this)
            {
                EnableMonitoring = true
            })
            {
                // Import our default publish settings
                files.CreateAzureSdkDirectoryAndImportPublishSettings();

                // Create a new channel to mock the calls to Azure and
                // determine all of the results that we'll need.
                bool createdHostedService       = false;
                bool createdOrUpdatedDeployment = false;
                SimpleServiceManagement channel = new SimpleServiceManagement();
                channel.GetStorageServiceThunk           = ar => new StorageService();
                channel.CreateHostedServiceThunk         = ar => { };
                channel.GetHostedServiceWithDetailsThunk = ar => null;
                channel.GetStorageKeysThunk = ar => new StorageService()
                {
                    StorageServiceKeys = new StorageServiceKeys()
                    {
                        Primary = "VGVzdEtleSE="
                    }
                };
                channel.CreateOrUpdateDeploymentThunk = ar => createdOrUpdatedDeployment = true;
                channel.GetDeploymentBySlotThunk      = ar =>
                {
                    if (createdOrUpdatedDeployment)
                    {
                        Deployment deployment = new Deployment("TEST_SERVICE_NAME", "Production", DeploymentStatus.Running);
                        deployment.RoleInstanceList = new RoleInstanceList(new RoleInstance[] { new RoleInstance()
                                                                                                {
                                                                                                    InstanceName = "Role_IN_0", InstanceStatus = RoleInstanceStatus.Ready
                                                                                                } });
                        return(deployment);
                    }
                    else
                    {
                        throw new EndpointNotFoundException();
                    }
                };
                channel.ListCertificatesThunk = ar => new CertificateList();

                // Create a new service that we're going to publish
                string serviceName = "TEST_SERVICE_NAME";
                NewAzureServiceProjectCommand newService = new NewAzureServiceProjectCommand();
                newService.NewAzureServiceProcess(files.RootPath, serviceName);
                string servicePath = files.CreateDirectory(serviceName);

                // Get the publishing process started by creating the package
                PublishAzureServiceProjectCommand publishService = new PublishAzureServiceProjectCommand(channel);
                publishService.ShareChannel = true;
                publishService.SkipUpload   = true;
                publishService.PublishService(servicePath);
                AzureService service = new AzureService(Path.Combine(files.RootPath, serviceName), null);

                // Verify the publish service attempted to create and update
                // the service through the mock.
                Assert.IsFalse(createdHostedService);
                Assert.IsTrue(createdOrUpdatedDeployment);
                Assert.AreEqual <string>(serviceName, service.ServiceName);
            }
        }
Exemplo n.º 11
0
        public void PublishAzureServiceUpgradeTest()
        {
            // Create a temp directory that we'll use to "publish" our service
            using (FileSystemHelper files = new FileSystemHelper(this)
            {
                EnableMonitoring = true
            })
            {
                // Import our default publish settings
                files.CreateAzureSdkDirectoryAndImportPublishSettings();

                // Create a new channel to mock the calls to Azure and
                // determine all of the results that we'll need.
                bool createdHostedService       = false;
                bool createdOrUpdatedDeployment = false;
                bool upgradedDeployment         = false;
                SimpleServiceManagement channel = new SimpleServiceManagement();
                channel.GetStorageServiceThunk           = ar => new StorageService();
                channel.CreateHostedServiceThunk         = ar => createdHostedService = true;
                channel.GetHostedServiceWithDetailsThunk = ar => new HostedService {
                    Deployments = new DeploymentList()
                    {
                        new Deployment {
                            DeploymentSlot = "Production"
                        }
                    }
                };
                channel.GetStorageKeysThunk = ar => new StorageService()
                {
                    StorageServiceKeys = new StorageServiceKeys()
                    {
                        Primary = "VGVzdEtleSE="
                    }
                };
                channel.CreateOrUpdateDeploymentThunk = ar => createdOrUpdatedDeployment = true;
                channel.UpgradeDeploymentThunk        = ar => upgradedDeployment = true;
                channel.GetDeploymentBySlotThunk      = ar => new Deployment()
                {
                    Status           = DeploymentStatus.Starting,
                    RoleInstanceList = new RoleInstanceList(
                        new RoleInstance[] {
                        new RoleInstance()
                        {
                            InstanceName   = "Role_IN_0",
                            InstanceStatus = RoleInstanceStatus.Ready
                        }
                    })
                };
                channel.ListCertificatesThunk = ar => new CertificateList();

                // Create a new service that we're going to publish
                string serviceName = "TEST_SERVICE_NAME";
                NewAzureServiceProjectCommand newService = new NewAzureServiceProjectCommand();
                newService.NewAzureServiceProcess(files.RootPath, serviceName);
                string servicePath = files.CreateDirectory(serviceName);

                // Get the publishing process started by creating the package
                PublishAzureServiceProjectCommand publishService = new PublishAzureServiceProjectCommand(channel);
                publishService.ShareChannel = true;
                publishService.SkipUpload   = true;
                publishService.PublishService(servicePath);

                // Verify the publish service upgraded the deployment
                Assert.IsFalse(createdHostedService);
                Assert.IsFalse(createdOrUpdatedDeployment);
                Assert.IsTrue(upgradedDeployment);
            }
        }
Exemplo n.º 12
0
        public void PublishAzurePHPServiceSimpleDeployTest()
        {
            // Create a temp directory that we'll use to "publish" our service
            using (FileSystemHelper files = new FileSystemHelper(this)
            {
                EnableMonitoring = true
            })
            {
                // Import our default publish settings
                files.CreateAzureSdkDirectoryAndImportPublishSettings();

                // Create a new channel to mock the calls to Azure and
                // determine all of the results that we'll need.
                bool createdHostedService       = false;
                bool createdOrUpdatedDeployment = false;
                SimpleServiceManagement channel = new SimpleServiceManagement();
                channel.GetStorageServiceThunk           = ar => new StorageService();
                channel.CreateHostedServiceThunk         = ar => createdHostedService = true;
                channel.GetHostedServiceWithDetailsThunk = ar => { throw new EndpointNotFoundException(); };
                channel.GetStorageKeysThunk = ar => new StorageService()
                {
                    StorageServiceKeys = new StorageServiceKeys()
                    {
                        Primary = "VGVzdEtleSE="
                    }
                };
                channel.CreateOrUpdateDeploymentThunk = ar => createdOrUpdatedDeployment = true;
                channel.GetDeploymentBySlotThunk      = ar => new Deployment()
                {
                    Status           = DeploymentStatus.Starting,
                    RoleInstanceList = new RoleInstanceList(
                        new RoleInstance[] {
                        new RoleInstance()
                        {
                            InstanceName   = "Role_IN_0",
                            InstanceStatus = RoleInstanceStatus.Ready
                        }
                    })
                };
                channel.ListCertificatesThunk = ar => new CertificateList();

                // Create a new service that we're going to publish
                string serviceName = "TEST_SERVICE_NAME";
                NewAzureServiceProjectCommand newService = new NewAzureServiceProjectCommand();
                newService.NewAzureServiceProcess(files.RootPath, serviceName);
                string       servicePath = files.CreateDirectory(serviceName);
                AzureService testService = new AzureService(Path.Combine(files.RootPath, serviceName), null);
                testService.AddWebRole(Resources.PHPScaffolding);
                string cloudConfigFile = File.ReadAllText(testService.Paths.CloudConfiguration);
                File.WriteAllText(testService.Paths.CloudConfiguration, new Regex("<Certificates\\s*/>").Replace(cloudConfigFile, ""));
                // Get the publishing process started by creating the package
                PublishAzureServiceProjectCommand publishService = new PublishAzureServiceProjectCommand(channel);
                publishService.ShareChannel = true;
                publishService.SkipUpload   = true;
                publishService.PublishService(servicePath);
                AzureService service = new AzureService(Path.Combine(files.RootPath, serviceName), null);

                // Verify the publish service attempted to create and update
                // the service through the mock.
                Assert.IsTrue(createdHostedService);
                Assert.IsTrue(createdOrUpdatedDeployment);
                Assert.AreEqual <string>(serviceName, service.ServiceName);
            }
        }
Exemplo n.º 13
0
        public void PublishAzureServiceManifestTest()
        {
            // Create a temp directory that we'll use to "publish" our service
            using (FileSystemHelper files = new FileSystemHelper(this)
            {
                EnableMonitoring = true
            })
            {
                // Import our default publish settings
                files.CreateAzureSdkDirectoryAndImportPublishSettings();

                // Create a new channel to mock the calls to Azure and
                // determine all of the results that we'll need.
                SimpleServiceManagement channel = new SimpleServiceManagement();

                // Create a new service that we're going to publish
                string serviceName = "TEST_SERVICE_NAME";
                NewAzureServiceProjectCommand newService = new NewAzureServiceProjectCommand();
                newService.NewAzureServiceProcess(files.RootPath, serviceName);
                string servicePath = files.CreateDirectory(serviceName);
                // Add web and worker roles
                AddAzureNodeWebRoleCommand newWebRole       = new AddAzureNodeWebRoleCommand();
                string defaultWebRoleName                   = "WebRoleDefault";
                string defaultWebRolePath                   = newWebRole.AddAzureNodeWebRoleProcess(defaultWebRoleName, 2, servicePath);
                AddAzureNodeWorkerRoleCommand newWorkerRole = new AddAzureNodeWorkerRoleCommand();
                string defaultWorkerRoleName                = "WorkerRoleDefault";
                string defaultWorkerRolePath                = newWorkerRole.AddAzureNodeWorkerRoleProcess(defaultWorkerRoleName, 2, servicePath);

                AddAzureNodeWebRoleCommand matchWebRole = new AddAzureNodeWebRoleCommand();
                string matchWebRoleName = "WebRoleExactMatch";
                string matchWebRolePath = matchWebRole.AddAzureNodeWebRoleProcess(matchWebRoleName, 2, servicePath);

                AddAzureNodeWorkerRoleCommand matchWorkerRole = new AddAzureNodeWorkerRoleCommand();
                string matchWorkerRoleName = "WorkerRoleExactMatch";
                string matchWorkerRolePath = matchWorkerRole.AddAzureNodeWorkerRoleProcess(matchWorkerRoleName, 2, servicePath);

                AddAzureNodeWebRoleCommand overrideWebRole = new AddAzureNodeWebRoleCommand();
                string overrideWebRoleName = "WebRoleOverride";
                string overrideWebRolePath = overrideWebRole.AddAzureNodeWebRoleProcess(overrideWebRoleName, 2, servicePath);

                AddAzureNodeWorkerRoleCommand overrideWorkerRole = new AddAzureNodeWorkerRoleCommand();
                string overrideWorkerRoleName = "WorkerRoleOverride";
                string overrideWorkerRolePath = matchWorkerRole.AddAzureNodeWorkerRoleProcess(overrideWorkerRoleName, 2, servicePath);

                AzureService testService = new AzureService(Path.Combine(files.RootPath, serviceName), null);
                RuntimePackageHelper.SetRoleRuntime(testService.Components.Definition, matchWebRoleName, testService.Paths, version: "0.8.2");
                RuntimePackageHelper.SetRoleRuntime(testService.Components.Definition, matchWorkerRoleName, testService.Paths, version: "0.8.2");
                RuntimePackageHelper.SetRoleRuntime(testService.Components.Definition, overrideWebRoleName, testService.Paths, overrideUrl: "http://OVERRIDE");
                RuntimePackageHelper.SetRoleRuntime(testService.Components.Definition, overrideWorkerRoleName, testService.Paths, overrideUrl: "http://OVERRIDE");
                testService.Components.Save(testService.Paths);

                // Get the publishing process started by creating the package
                PublishAzureServiceProjectCommand publishService = new PublishAzureServiceProjectCommand(channel);
                publishService.InitializeSettingsAndCreatePackage(servicePath, RuntimePackageHelper.GetTestManifest(files));

                AzureService updatedService = new AzureService(testService.Paths.RootPath, null);

                RuntimePackageHelper.ValidateRoleRuntime(updatedService.Components.Definition, defaultWebRoleName, "http://DATACENTER/node/default.exe;http://DATACENTER/iisnode/default.exe", null);
                RuntimePackageHelper.ValidateRoleRuntime(updatedService.Components.Definition, defaultWorkerRoleName, "http://DATACENTER/node/default.exe", null);
                RuntimePackageHelper.ValidateRoleRuntime(updatedService.Components.Definition, matchWorkerRoleName, "http://DATACENTER/node/foo.exe", null);
                RuntimePackageHelper.ValidateRoleRuntime(updatedService.Components.Definition, matchWebRoleName, "http://DATACENTER/node/foo.exe;http://DATACENTER/iisnode/default.exe", null);
                RuntimePackageHelper.ValidateRoleRuntime(updatedService.Components.Definition, overrideWebRoleName, null, "http://OVERRIDE");
                RuntimePackageHelper.ValidateRoleRuntime(updatedService.Components.Definition, overrideWorkerRoleName, null, "http://OVERRIDE");
            }
        }
Exemplo n.º 14
0
        public void PublishAzureServiceCreateWorkersPackageTest()
        {
            // Create a temp directory that we'll use to "publish" our service
            using (FileSystemHelper files = new FileSystemHelper(this)
            {
                EnableMonitoring = true
            })
            {
                // Import our default publish settings
                files.CreateAzureSdkDirectoryAndImportPublishSettings();

                // Create a new channel to mock the calls to Azure and
                // determine all of the results that we'll need.
                SimpleServiceManagement channel = new SimpleServiceManagement();

                // Create a new service that we're going to publish
                string serviceName = "TEST_SERVICE_NAME";
                NewAzureServiceProjectCommand newService = new NewAzureServiceProjectCommand();
                newService.NewAzureServiceProcess(files.RootPath, serviceName);
                string servicePath = files.CreateDirectory(serviceName);
                // Add web and worker roles
                AddAzureNodeWebRoleCommand newWebRole = new AddAzureNodeWebRoleCommand();
                string webRoleName = "NODE_WEB_ROLE";
                string webRolePath = newWebRole.AddAzureNodeWebRoleProcess(webRoleName, 2, servicePath);
                AddAzureNodeWorkerRoleCommand newWorkerRole = new AddAzureNodeWorkerRoleCommand();
                string workerRoleName = "NODE_WORKER_ROLE";
                string workerRolePath = newWorkerRole.AddAzureNodeWorkerRoleProcess(workerRoleName, 2, servicePath);

                // Get the publishing process started by creating the package
                PublishAzureServiceProjectCommand publishService = new PublishAzureServiceProjectCommand(channel);
                publishService.InitializeSettingsAndCreatePackage(servicePath);

                // Verify the generated files
                Action <string> verifyContainsNames =
                    p =>
                {
                    string contents = File.ReadAllText(p);
                    Assert.IsTrue(contents.Contains(webRoleName));
                    Assert.IsTrue(contents.Contains(workerRoleName));
                };
                files.AssertFiles(new Dictionary <string, Action <string> >()
                {
                    { serviceName + @"\deploymentSettings.json", null },
                    { serviceName + '\\' + webRoleName + @"\server.js", null },
                    { serviceName + '\\' + workerRoleName + @"\server.js", null },
                    { serviceName + @"\ServiceDefinition.csdef", verifyContainsNames },
                    { serviceName + @"\ServiceConfiguration.Cloud.cscfg", verifyContainsNames },
                    { serviceName + @"\ServiceConfiguration.Local.cscfg", verifyContainsNames },
                    {
                        serviceName + @"\cloud_package.cspkg",
                        p =>
                        {
                            using (Package package = Package.Open(p))
                            {
                                Assert.AreEqual(7, package.GetParts().Count());
                            }
                        }
                    }
                });
            }
        }