当前位置: 首页>>代码示例>>C#>>正文


C# CloudServiceProject类代码示例

本文整理汇总了C#中CloudServiceProject的典型用法代码示例。如果您正苦于以下问题:C# CloudServiceProject类的具体用法?C# CloudServiceProject怎么用?C# CloudServiceProject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CloudServiceProject类属于命名空间,在下文中一共展示了CloudServiceProject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddAzureCacheWorkerRoleProcess

        public WorkerRole AddAzureCacheWorkerRoleProcess(string workerRoleName, int instances, string rootPath)
        {
            // Create cache worker role.
            Action<string, RoleInfo> cacheWorkerRoleAction = CacheConfigurationFactory.GetCacheRoleConfigurationAction(
                AzureTool.GetAzureSdkVersion());

            CloudServiceProject cloudServiceProject = new CloudServiceProject(rootPath, null);
            
            RoleInfo genericWorkerRole = cloudServiceProject.AddWorkerRole(
                Path.Combine(Resources.GeneralScaffolding, RoleType.WorkerRole.ToString()),
                workerRoleName,
                instances);

            // Dedicate the worker role for caching.
            cacheWorkerRoleAction(cloudServiceProject.Paths.RootPath, genericWorkerRole);

            cloudServiceProject.Reload();
            WorkerRole cacheWorkerRole = cloudServiceProject.Components.GetWorkerRole(genericWorkerRole.Name);

            // Write output
            SafeWriteOutputPSObject(
                cacheWorkerRole.GetType().FullName,
                Parameters.CacheWorkerRoleName, genericWorkerRole.Name,
                Parameters.Instances, genericWorkerRole.InstanceCount
                );

            return cloudServiceProject.Components.GetWorkerRole(workerRoleName);
        }
开发者ID:EmmaZhu,项目名称:azure-sdk-tools,代码行数:28,代码来源:AddAzureCacheWorkerRole.cs

示例2: StartAzureEmulatorProcess

        public CloudServiceProject StartAzureEmulatorProcess(string rootPath)
        {
            string standardOutput;
            string standardError;

            StringBuilder message = new StringBuilder();
            CloudServiceProject cloudServiceProject = new CloudServiceProject(rootPath ,null);

            if (Directory.Exists(cloudServiceProject.Paths.LocalPackage))
            {
                WriteVerbose(Resources.StopEmulatorMessage);
                cloudServiceProject.StopEmulator(out standardOutput, out standardError);
                WriteVerbose(Resources.StoppedEmulatorMessage);
                WriteVerbose(string.Format(Resources.RemovePackage, cloudServiceProject.Paths.LocalPackage));
                Directory.Delete(cloudServiceProject.Paths.LocalPackage, true);
            }
            
            WriteVerbose(string.Format(Resources.CreatingPackageMessage, "local"));
            cloudServiceProject.CreatePackage(DevEnv.Local, out standardOutput, out standardError);
            
            WriteVerbose(Resources.StartingEmulator);
            cloudServiceProject.ResolveRuntimePackageUrls();
            cloudServiceProject.StartEmulator(Launch.ToBool(), out standardOutput, out standardError);
            
            WriteVerbose(standardOutput);
            WriteVerbose(Resources.StartedEmulator);
            SafeWriteOutputPSObject(
                cloudServiceProject.GetType().FullName,
                Parameters.ServiceName, cloudServiceProject.ServiceName,
                Parameters.RootPath, cloudServiceProject.Paths.RootPath);

            return cloudServiceProject;
        }
开发者ID:AzureRT,项目名称:azure-sdk-tools,代码行数:33,代码来源:StartAzureEmulator.cs

示例3: CreateLocalPackageWithNodeWorkerRoleTest

        public void CreateLocalPackageWithNodeWorkerRoleTest()
        {
            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                CloudServiceProject service = new CloudServiceProject(files.RootPath, serviceName, null);
                service.AddWorkerRole(Data.NodeWorkerRoleScaffoldingPath);
                service.CreatePackage(DevEnv.Local);

                AzureAssert.ScaffoldingExists(Path.Combine(service.Paths.LocalPackage, @"roles\WorkerRole1\approot"), Path.Combine(Resources.NodeScaffolding, Resources.WorkerRole));
            }
        }
开发者ID:EmmaZhu,项目名称:azure-sdk-tools,代码行数:11,代码来源:CsPackTests.cs

示例4: SetAzureInstancesProcess

        /// <summary>
        /// The code to run if setting azure instances
        /// </summary>
        /// <param name="roleName">The name of the role to update</param>
        /// <param name="instances">The new number of instances for the role</param>
        /// <param name="rootPath">The root path to the service containing the role</param>
        /// <returns>Role after updating instance count</returns>
        public RoleSettings SetAzureInstancesProcess(string roleName, int instances, string rootPath)
        {
            CloudServiceProject service = new CloudServiceProject(rootPath, null);
            service.SetRoleInstances(service.Paths, roleName, instances);

            if (PassThru)
            {
                SafeWriteOutputPSObject(typeof(RoleSettings).FullName, Parameters.RoleName, roleName);
            }

            return service.Components.GetCloudConfigRole(roleName);
        }
开发者ID:AzureRT,项目名称:azure-sdk-tools,代码行数:19,代码来源:SetAzureServiceProjectRole.cs

示例5: StopAzureEmulatorProcess

        public void StopAzureEmulatorProcess()
        {
            CloudServiceProject service = new CloudServiceProject();
            WriteVerbose(Resources.StopEmulatorMessage);
            service.StopEmulator();
            
            WriteVerbose(Resources.StoppedEmulatorMessage);

            if (PassThru.IsPresent)
            {
                WriteObject(true);
            }
        }
开发者ID:jasonnewyork,项目名称:azure-sdk-tools,代码行数:13,代码来源:StopAzureEmulator.cs

示例6: StartAzureEmulatorProcess

        public CloudServiceProject StartAzureEmulatorProcess(string rootPath)
        {
            string warning;
            string roleInformation;

            StringBuilder message = new StringBuilder();
            CloudServiceProject cloudServiceProject = new CloudServiceProject(rootPath, null);

            if (Directory.Exists(cloudServiceProject.Paths.LocalPackage))
            {
                WriteVerbose(Resources.StopEmulatorMessage);
                cloudServiceProject.StopEmulators(out warning);
                if (!string.IsNullOrEmpty(warning))
                {
                    WriteWarning(warning);
                }
                WriteVerbose(Resources.StoppedEmulatorMessage);
                string packagePath = cloudServiceProject.Paths.LocalPackage;
                WriteVerbose(string.Format(Resources.RemovePackage, packagePath));
                try
                {
                    Directory.Delete(packagePath, true);
                }
                catch (IOException)
                {
                    throw new InvalidOperationException(string.Format(Resources.FailedToCleanUpLocalPackage, packagePath));
                }
            }

            WriteVerbose(string.Format(Resources.CreatingPackageMessage, "local"));
            cloudServiceProject.CreatePackage(DevEnv.Local);

            WriteVerbose(Resources.StartingEmulator);
            cloudServiceProject.ResolveRuntimePackageUrls();
            cloudServiceProject.StartEmulators(Launch.ToBool(), Mode, out roleInformation, out warning);
            WriteVerbose(roleInformation);
            if (!string.IsNullOrEmpty(warning))
            {
                WriteWarning(warning);
            }

            WriteVerbose(Resources.StartedEmulator);
            SafeWriteOutputPSObject(
                cloudServiceProject.GetType().FullName,
                Parameters.ServiceName, cloudServiceProject.ServiceName,
                Parameters.RootPath, cloudServiceProject.Paths.RootPath);

            return cloudServiceProject;
        }
开发者ID:kangyangthu,项目名称:azure-sdk-tools,代码行数:49,代码来源:StartAzureEmulator.cs

示例7: VerifyDisableRoleSettings

 private static void VerifyDisableRoleSettings(CloudServiceProject service)
 {
     IEnumerable<RoleSettings> settings =
         Enumerable.Concat(
             service.Components.CloudConfig.Role,
             service.Components.LocalConfig.Role);
     foreach (RoleSettings roleSettings in settings)
     {
         Assert.AreEqual(
             1,
             roleSettings.ConfigurationSettings
                 .Where(c => c.name == "Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled" && c.value == "false")
                 .Count());
     }
 }
开发者ID:EmmaZhu,项目名称:azure-sdk-tools,代码行数:15,代码来源:DisableAzureRemoteDesktopCommandTest.cs

示例8: TestStartAzureService

        public void TestStartAzureService()
        {
            stopServiceCmdlet.ServiceName = serviceName;
            stopServiceCmdlet.Slot = slot;
            cloudServiceClientMock.Setup(f => f.StartCloudService(serviceName, slot));

            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                files.CreateAzureSdkDirectoryAndImportPublishSettings();
                CloudServiceProject service = new CloudServiceProject(files.RootPath, serviceName, null);
                stopServiceCmdlet.ExecuteCmdlet();

                Assert.AreEqual<int>(0, mockCommandRuntime.OutputPipeline.Count);
                cloudServiceClientMock.Verify(f => f.StartCloudService(serviceName, slot), Times.Once());
            }
        }
开发者ID:kangyangthu,项目名称:azure-sdk-tools,代码行数:16,代码来源:StartAzureServiceTests.cs

示例9: NewAzureServiceProcess

        internal CloudServiceProject NewAzureServiceProcess(string parentDirectory, string serviceName)
        {
            // Create scaffolding structure
            //
            CloudServiceProject newService = new CloudServiceProject(parentDirectory, serviceName, null);

            SafeWriteOutputPSObject(
                newService.GetType().FullName,
                Parameters.ServiceName, newService.ServiceName,
                Parameters.RootPath, newService.Paths.RootPath
                );

            WriteVerbose(string.Format(Resources.NewServiceCreatedMessage, newService.Paths.RootPath));

            return newService;
        }
开发者ID:B-Rich,项目名称:azure-sdk-tools,代码行数:16,代码来源:NewAzureServiceProject.cs

示例10: StopAzureEmulatorProcess

        public void StopAzureEmulatorProcess()
        {
            string standardOutput;
            string standardError;

            CloudServiceProject service = new CloudServiceProject();
            WriteVerbose(Resources.StopEmulatorMessage);
            service.StopEmulator(out standardOutput, out standardError);
            
            WriteVerbose(Resources.StoppedEmulatorMessage);

            if (PassThru.IsPresent)
            {
                WriteObject(true);
            }
        }
开发者ID:AzureRT,项目名称:azure-sdk-tools,代码行数:16,代码来源:StopAzureEmulator.cs

示例11: CreateLocalPackageWithOnePHPWebRoleTest

        public void CreateLocalPackageWithOnePHPWebRoleTest()
        {
            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                CloudServiceProject service = new CloudServiceProject(files.RootPath, serviceName, null);
                RoleInfo webRoleInfo = service.AddWebRole(Data.PHPWebRoleScaffoldingPath);
                string logsDir = Path.Combine(service.Paths.RootPath, webRoleInfo.Name, "server.js.logs");
                string logFile = Path.Combine(logsDir, "0.txt");
                string targetLogsFile = Path.Combine(service.Paths.LocalPackage, "roles", webRoleInfo.Name, @"approot\server.js.logs\0.txt");
                files.CreateDirectory(logsDir);
                files.CreateEmptyFile(logFile);
                service.CreatePackage(DevEnv.Local);

                AzureAssert.ScaffoldingExists(Path.Combine(service.Paths.LocalPackage, @"roles\WebRole1\approot"), Path.Combine(Resources.PHPScaffolding, Resources.WebRole));
                Assert.IsTrue(File.Exists(targetLogsFile));
            }
        }
开发者ID:EmmaZhu,项目名称:azure-sdk-tools,代码行数:17,代码来源:CsPackTests.cs

示例12: TestSetAzureRuntimeValidRuntimeVersions

 public void TestSetAzureRuntimeValidRuntimeVersions()
 {
     using (FileSystemHelper files = new FileSystemHelper(this))
     {
         CloudServiceProject service = new CloudServiceProject(files.RootPath, serviceName, null);
         service.AddWebRole(Data.NodeWebRoleScaffoldingPath);
         string roleName = "WebRole1";
         cmdlet.PassThru = false;
         
         RoleSettings roleSettings1 = cmdlet.SetAzureRuntimesProcess(roleName, "node", "0.8.2", service.Paths.RootPath, RuntimePackageHelper.GetTestManifest(files));
         RoleSettings roleSettings2 = cmdlet.SetAzureRuntimesProcess(roleName, "iisnode", "0.1.21", service.Paths.RootPath, RuntimePackageHelper.GetTestManifest(files));
         VerifyPackageJsonVersion(service.Paths.RootPath, roleName, "node", "0.8.2");
         VerifyPackageJsonVersion(service.Paths.RootPath, roleName, "iisnode", "0.1.21");
         Assert.AreEqual<int>(0, mockCommandRuntime.OutputPipeline.Count);
         Assert.AreEqual<string>(roleName, roleSettings1.name);
         Assert.AreEqual<string>(roleName, roleSettings2.name);
     }
 }
开发者ID:B-Rich,项目名称:azure-sdk-tools,代码行数:18,代码来源:SetAzureRuntimeTests.cs

示例13: DisableRemoteDesktop

        public void DisableRemoteDesktop()
        {
            CloudServiceProject service = new CloudServiceProject(General.GetServiceRootPath(CurrentPath()), null);
            WebRole[] webRoles = service.Components.Definition.WebRole ?? new WebRole[0];
            WorkerRole[] workerRoles = service.Components.Definition.WorkerRole ?? new WorkerRole[0];

            string forwarderName = GetForwarderName(webRoles, workerRoles);
            if (forwarderName != null)
            {
                UpdateServiceConfigurations(service, forwarderName);
                service.Components.Save(service.Paths);
            }

            if (PassThru)
            {
                WriteObject(true);
            }
        }
开发者ID:AzureRT,项目名称:azure-sdk-tools,代码行数:18,代码来源:DisableAzureRemoteDesktop.cs

示例14: SetAzureVMSizeProcessTestsNode

        public void SetAzureVMSizeProcessTestsNode()
        {
            string newRoleVMSize = RoleSize.Large.ToString();

            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                CloudServiceProject service = new CloudServiceProject(files.RootPath, serviceName, null);
                string roleName = "WebRole1";
                service.AddWebRole(Data.NodeWebRoleScaffoldingPath);
                cmdlet.PassThru = false;
                RoleSettings roleSettings = cmdlet.SetAzureVMSizeProcess("WebRole1", newRoleVMSize, service.Paths.RootPath);
                service = new CloudServiceProject(service.Paths.RootPath, null);

                Assert.AreEqual<string>(newRoleVMSize, service.Components.Definition.WebRole[0].vmsize.ToString());
                Assert.AreEqual<int>(0, mockCommandRuntime.OutputPipeline.Count);
                Assert.AreEqual<string>(roleName, roleSettings.name);
            }
        }
开发者ID:B-Rich,项目名称:azure-sdk-tools,代码行数:18,代码来源:SetAzureVMSizeTests.cs

示例15: SetAzureVMSizeProcessTestsPHP

        public void SetAzureVMSizeProcessTestsPHP()
        {
            string newRoleVMSize = RoleSize.Medium.ToString();

            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                CloudServiceProject service = new CloudServiceProject(files.RootPath, serviceName, null);
                string roleName = "WebRole1";
                service.AddWebRole(Data.PHPWebRoleScaffoldingPath);
                RoleSettings roleSettings = cmdlet.SetAzureVMSizeProcess("WebRole1", newRoleVMSize, service.Paths.RootPath);
                service = new CloudServiceProject(service.Paths.RootPath, null);

                
                Assert.AreEqual<string>(newRoleVMSize, service.Components.Definition.WebRole[0].vmsize.ToString());
                Assert.AreEqual<string>(roleName, ((PSObject)mockCommandRuntime.OutputPipeline[0]).Members[Parameters.RoleName].Value.ToString());
                Assert.IsTrue(((PSObject)mockCommandRuntime.OutputPipeline[0]).TypeNames.Contains(typeof(RoleSettings).FullName));
                Assert.AreEqual<string>(roleName, roleSettings.name);
            }
        }
开发者ID:B-Rich,项目名称:azure-sdk-tools,代码行数:19,代码来源:SetAzureVMSizeTests.cs


注:本文中的CloudServiceProject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。