/// <summary> /// Starts azure emulator for this service. /// </summary> /// <remarks>This methods removes all deployments already in the emulator.</remarks> /// <param name="launchBrowser">Switch to control opening a browser for web roles.</param> /// <param name="standardOutput">Output result from csrun.exe</param> /// <param name="standardError">Error result from csrun.exe</param> public void StartEmulators(bool launchBrowser, ComputeEmulatorMode mode, out string roleInformation, out string warning) { var runTool = new CsRun(AzureTool.GetComputeEmulatorDirectory()); runTool.StartEmulator(Paths.LocalPackage, Paths.LocalConfiguration, launchBrowser, mode); roleInformation = runTool.RoleInformation; var storageEmulator = new StorageEmulator(AzureTool.GetStorageEmulatorDirectory()); storageEmulator.Start(); //for now, errors related with storage emulator are treated as non-fatal warning = storageEmulator.Error; }
private void StartEmulatorCommonTest(ComputeEmulatorMode mode) { // Setup string testEmulatorFolder = @"C:\sample-path"; string testPackagePath = @"c:\sample-path\local_package.csx"; string testConfigPath = @"c:\sample-path\ServiceConfiguration.Local.cscfg"; string expectedCsrunCommand = testEmulatorFolder + @"\" + Resources.CsRunExe; string expectedComputeArguments = Resources.CsRunStartComputeEmulatorArg; string expectedRemoveAllDeploymentsArgument = Resources.CsRunRemoveAllDeploymentsArg; string expectedAzureProjectArgument = string.Format("/run:\"{0}\";\"{1}\" {2} /useiisexpress", testPackagePath, testConfigPath, Resources.CsRunLanuchBrowserArg); if (mode == ComputeEmulatorMode.Full) { expectedComputeArguments += " " + Resources.CsRunFullEmulatorArg; expectedAzureProjectArgument += " " + Resources.CsRunFullEmulatorArg; } string testRoleUrl = "http://127.0.0.1:8080/"; int testDeploymentId = 58; string testOutput = string.Format("Started: deployment23({0}) Role is running at " + testRoleUrl + ".", testDeploymentId.ToString()); string expectedRoleRunningMessage = string.Format(Resources.EmulatorRoleRunningMessage, testRoleUrl) + System.Environment.NewLine; CsRun csRun = new CsRun(testEmulatorFolder); Mock <ProcessHelper> commandRunner = new Mock <ProcessHelper>(); commandRunner.Setup(p => p.StartAndWaitForProcess(expectedCsrunCommand, expectedComputeArguments)); commandRunner.Setup(p => p.StartAndWaitForProcess(expectedCsrunCommand, expectedRemoveAllDeploymentsArgument)); commandRunner.Setup(p => p.StartAndWaitForProcess(expectedCsrunCommand, expectedAzureProjectArgument)) .Callback(() => { commandRunner.Object.StandardOutput = testOutput; }); // Execute csRun.CommandRunner = commandRunner.Object; csRun.StartEmulator(testPackagePath, testConfigPath, true, mode); // Assert commandRunner.VerifyAll(); Assert.Equal(csRun.DeploymentId, testDeploymentId); Assert.Equal(csRun.RoleInformation, expectedRoleRunningMessage); }
private void StartEmulatorCommonTest(ComputeEmulatorMode mode) { // Setup string testEmulatorFolder = @"C:\sample-path"; string testPackagePath = @"c:\sample-path\local_package.csx"; string testConfigPath = @"c:\sample-path\ServiceConfiguration.Local.cscfg"; string expectedCsrunCommand = testEmulatorFolder + @"\" + Resources.CsRunExe; string expectedComputeArguments = Resources.CsRunStartComputeEmulatorArg; string expectedRemoveAllDeploymentsArgument = Resources.CsRunRemoveAllDeploymentsArg; string expectedAzureProjectArgument = string.Format("\"{0}\" \"{1}\" {2} /useiisexpress", testPackagePath, testConfigPath, Resources.CsRunLanuchBrowserArg); if (mode== ComputeEmulatorMode.Express) { expectedComputeArguments += " " + Resources.CsRunEmulatorExpressArg; expectedAzureProjectArgument += " " + Resources.CsRunEmulatorExpressArg; } string testRoleUrl = "http://127.0.0.1:8080/"; int testDeploymentId = 58; string testOutput = string.Format("Started: deployment23({0}) Role is running at " + testRoleUrl + ".", testDeploymentId.ToString()); string expectedRoleRunningMessage = string.Format(Resources.EmulatorRoleRunningMessage, testRoleUrl) + Environment.NewLine; CsRun csRun = new CsRun(testEmulatorFolder); Mock<ProcessHelper> commandRunner = new Mock<ProcessHelper>(); commandRunner.Setup(p => p.StartAndWaitForProcess(expectedCsrunCommand, expectedComputeArguments)); commandRunner.Setup(p => p.StartAndWaitForProcess(expectedCsrunCommand, expectedRemoveAllDeploymentsArgument)); commandRunner.Setup(p => p.StartAndWaitForProcess(expectedCsrunCommand, expectedAzureProjectArgument)) .Callback(() => { commandRunner.Object.StandardOutput = testOutput; }); // Execute csRun.CommandRunner = commandRunner.Object; csRun.StartEmulator(testPackagePath, testConfigPath, true, mode); // Assert commandRunner.VerifyAll(); Assert.AreEqual(csRun.DeploymentId, testDeploymentId); Assert.AreEqual(csRun.RoleInformation, expectedRoleRunningMessage); }
private void StartEmulatorCommonTest(ComputeEmulatorMode mode) { // Setup string testEmulatorFolder = @"C:\foo-bar"; string testPackagePath = @"c:\foo-bar\local_package.csx"; string testConfigPath = @"c:\foo-bar\ServiceConfiguration.Local.cscfg"; string expectedCsrunCommand = testEmulatorFolder + @"\" + Resources.CsRunExe; string expectedComputeArguments = Resources.CsRunStartComputeEmulatorArg; string expectedStorageArgument = Resources.CsRunStartStorageEmulatorArg; string expectedRemoveAllDeploymentsArgument = Resources.CsRunRemoveAllDeploymentsArg; string expectedAzureProjectArgument = string.Format("\"{0}\" \"{1}\" {2} /useiisexpress", testPackagePath, testConfigPath, Resources.CsRunLanuchBrowserArg); if (mode== ComputeEmulatorMode.Express) { expectedComputeArguments += " " + Resources.CsRunEmulatorExpressArg; expectedAzureProjectArgument += " " + Resources.CsRunEmulatorExpressArg; } string testOutput = "Role is running at tcp://127.0.0.1:8080"; CsRun csRun = new CsRun(testEmulatorFolder); Mock<ProcessHelper> commandRunner = new Mock<ProcessHelper>(); commandRunner.Setup(p => p.StartAndWaitForProcess(expectedCsrunCommand, expectedComputeArguments)); commandRunner.Setup(p => p.StartAndWaitForProcess(expectedCsrunCommand, expectedStorageArgument)); commandRunner.Setup(p => p.StartAndWaitForProcess(expectedCsrunCommand, expectedRemoveAllDeploymentsArgument)); commandRunner.Setup(p => p.StartAndWaitForProcess(expectedCsrunCommand, expectedAzureProjectArgument)) .Callback(() => { commandRunner.Object.StandardOutput = testOutput; }); // Execute csRun.CommandRunner = commandRunner.Object; string output, error; csRun.StartEmulator(testPackagePath, testConfigPath, true, mode, out output, out error); // Assert commandRunner.VerifyAll(); }
public void StartEmulator(bool launch, out string standardOutput, out string standardError) { runTool.StartEmulator(Paths.LocalPackage, Paths.LocalConfiguration, launch, out standardOutput, out standardError); }
/// <summary> /// Starts azure emulator for this service. /// </summary> /// <remarks>This methods removes all deployments already in the emulator.</remarks> /// <param name="launchBrowser">Switch to control opening a browser for web roles.</param> /// <param name="standardOutput">Output result from csrun.exe</param> /// <param name="standardError">Error result from csrun.exe</param> public void StartEmulator(bool launchBrowser, ComputeEmulatorMode mode , out string standardOutput, out string standardError) { var runTool = new CsRun(AzureTool.GetAzureEmulatorDirectory()); runTool.StartEmulator(Paths.LocalPackage, Paths.LocalConfiguration, launchBrowser, mode, out standardOutput, out standardError); }
/// <summary> /// Starts azure emulator for this service. /// </summary> /// <remarks>This methods removes all deployments already in the emulator.</remarks> /// <param name="launchBrowser">Switch to control opening a browser for web roles.</param> /// <param name="standardOutput">Output result from csrun.exe</param> /// <param name="standardError">Error result from csrun.exe</param> public void StartEmulators(bool launchBrowser, ComputeEmulatorMode mode , out string roleInformation, out string warning) { var runTool = new CsRun(AzureTool.GetComputeEmulatorDirectory()); runTool.StartEmulator(Paths.LocalPackage, Paths.LocalConfiguration, launchBrowser, mode); roleInformation = runTool.RoleInformation; var storageEmulator = new StorageEmulator(AzureTool.GetStorageEmulatorDirectory()); storageEmulator.Start(); //for now, errors related with storage emulator are treated as non-fatal warning = storageEmulator.Error; }
public void StartEmulator(bool launch, out string standardOutput, out string standardError) { var runTool = new CsRun(); runTool.StartEmulator(Paths.LocalPackage, Paths.LocalConfiguration, launch, out standardOutput, out standardError); }