本文整理汇总了C#中Kudu.TestHarness.ApplicationManager类的典型用法代码示例。如果您正苦于以下问题:C# ApplicationManager类的具体用法?C# ApplicationManager怎么用?C# ApplicationManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ApplicationManager类属于Kudu.TestHarness命名空间,在下文中一共展示了ApplicationManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateApplicationInternal
private static async Task<ApplicationManager> CreateApplicationInternal()
{
int siteIndex;
// try till succeeded
while (!_availableSiteIndex.TryPop(out siteIndex))
{
await Task.Delay(5000);
}
string applicationName = _sitePrefix + siteIndex;
string operationName = "SitePool.CreateApplicationInternal " + applicationName;
var siteManager = GetSiteManager(new KuduTestContext());
Site site = siteManager.GetSite(applicationName);
if (site != null)
{
TestTracer.Trace("{0} Site already exists at {1}. Reusing site", operationName, site.SiteUrl);
var appManager = new ApplicationManager(siteManager, site, applicationName)
{
SitePoolIndex = siteIndex
};
// In site reuse mode, clean out the existing site so we start clean
// Enumrate all w3wp processes and make sure to kill any process with an open handle to klr.host.dll
foreach (var process in (await appManager.ProcessManager.GetProcessesAsync()).Where(p => p.Name.Equals("w3wp", StringComparison.OrdinalIgnoreCase)))
{
var extendedProcess = await appManager.ProcessManager.GetProcessAsync(process.Id);
if (extendedProcess.OpenFileHandles.Any(h => h.IndexOf("dnx.host.dll", StringComparison.OrdinalIgnoreCase) != -1))
{
await appManager.ProcessManager.KillProcessAsync(extendedProcess.Id, throwOnError:false);
}
}
await appManager.RepositoryManager.Delete(deleteWebRoot: true, ignoreErrors: true);
// Make sure we start with the correct default file as some tests expect it
WriteIndexHtml(appManager);
TestTracer.Trace("{0} completed", operationName);
return appManager;
}
else
{
TestTracer.Trace("{0} Creating new site", operationName);
site = await siteManager.CreateSiteAsync(applicationName);
TestTracer.Trace("{0} Created new site at {1}", operationName, site.SiteUrl);
return new ApplicationManager(siteManager, site, applicationName)
{
SitePoolIndex = siteIndex
};
}
}
开发者ID:sr457,项目名称:kudu,代码行数:56,代码来源:SitePool.cs
示例2: ReportTestCompletion
public static void ReportTestCompletion(ApplicationManager applicationManager, bool success)
{
if (success || _availableSiteIndex.Count <= 1)
{
_availableSiteIndex.Push(applicationManager.SitePoolIndex);
}
else
{
TestTracer.Trace("SitePool.ReportTestCompletion Removing application {0} from pool", applicationManager.ApplicationName);
}
}
开发者ID:40a,项目名称:kudu,代码行数:11,代码来源:SitePool.cs
示例3: VerifyCommand
private void VerifyCommand(CommandTestSettings commandTestSettings, ApplicationManager appManager)
{
TestTracer.Trace("Running command - '{0}' on '{1}'", commandTestSettings.Command, commandTestSettings.WorkingDirectory);
CommandResult commandResult = appManager.CommandExecutor.ExecuteCommand(commandTestSettings.Command, commandTestSettings.WorkingDirectory).Result;
TestTracer.Trace("Received result\nOutput\n======\n{0}\nError\n======\n{1}\nExit Code - {2}", commandResult.Output, commandResult.Error, commandResult.ExitCode);
Assert.Equal(commandTestSettings.ExpectedResult.ExitCode, commandResult.ExitCode);
AssertOutput(commandTestSettings.ExpectedResult.Error, commandResult.Error);
AssertOutput(commandTestSettings.ExpectedResult.Output, commandResult.Output);
}
开发者ID:robzelt,项目名称:kudu,代码行数:11,代码来源:CommandExecutorTests.cs
示例4: TraceDeploymentLog
public static void TraceDeploymentLog(ApplicationManager appManager, string id)
{
Trace("\n====================================================================================\n\t\tDeployment Log for " + id + "\n=====================================================================================");
var entries = appManager.DeploymentManager.GetLogEntriesAsync(id).Result.ToList();
var allDetails = entries.Where(e => e.DetailsUrl != null)
.SelectMany(e => appManager.DeploymentManager.GetLogEntryDetailsAsync(id, e.Id).Result).ToList();
var allEntries = entries.Concat(allDetails).ToList();
foreach (var entry in allEntries)
{
Trace(entry.LogTime, entry.Message);
}
}
开发者ID:WeAreMammoth,项目名称:kudu-obsolete,代码行数:13,代码来源:TestTracer.cs
示例5: CreateApplicationAsync
public static async Task<ApplicationManager> CreateApplicationAsync()
{
await _semaphore.WaitAsync();
ApplicationManager appManager = _nextAppManager;
_nextAppManager = null;
_semaphore.Release();
if (appManager == null)
{
appManager = await CreateApplicationInternal();
}
EnsureNextApplication();
return appManager;
}
开发者ID:40a,项目名称:kudu,代码行数:15,代码来源:SitePool.cs
示例6: CreateApplicationInternal
private static async Task<ApplicationManager> CreateApplicationInternal()
{
int siteIndex;
_availableSiteIndex.TryPop(out siteIndex);
string applicationName = _sitePrefix + siteIndex;
string operationName = "SitePool.CreateApplicationInternal " + applicationName;
var pathResolver = new DefaultPathResolver(PathHelper.ServiceSitePath, PathHelper.SitesPath);
var settingsResolver = new DefaultSettingsResolver();
var siteManager = GetSiteManager(pathResolver, settingsResolver);
Site site = siteManager.GetSite(applicationName);
if (site != null)
{
TestTracer.Trace("{0} Site already exists at {1}. Reusing site", operationName, site.SiteUrl);
var appManager = new ApplicationManager(siteManager, site, applicationName, settingsResolver)
{
SitePoolIndex = siteIndex
};
// In site reuse mode, clean out the existing site so we start clean
await appManager.RepositoryManager.Delete(deleteWebRoot: true, ignoreErrors: true);
// Make sure we start with the correct default file as some tests expect it
WriteIndexHtml(appManager);
TestTracer.Trace("{0} completed", operationName);
return appManager;
}
else
{
TestTracer.Trace("{0} Creating new site", operationName);
site = await siteManager.CreateSiteAsync(applicationName);
TestTracer.Trace("{0} Created new site at {1}", operationName, site.SiteUrl);
return new ApplicationManager(siteManager, site, applicationName, settingsResolver)
{
SitePoolIndex = siteIndex
};
}
}
开发者ID:40a,项目名称:kudu,代码行数:43,代码来源:SitePool.cs
示例7: DoGitRedeploy
private void DoGitRedeploy(ApplicationManager appManager, string commitId, string verificationContent)
{
DeployResult result = null;
try
{
appManager.DeploymentManager.DeployAsync(commitId).Wait();
var results = appManager.DeploymentManager.GetResultsAsync().Result.ToList();
result = results.Where(r => r.Id == commitId).FirstOrDefault();
}
catch(Exception ex)
{
string msg = string.Format("Redeploy operation failed for commit ID: {0}. Exception: {1}", commitId, ex.ToString() );
throw new ApplicationException(msg) ;
}
if (result == null)
{
string msg = string.Format("Redeploy operation completed but expected commit Id was not deployed. Commit ID: {0}.", commitId);
throw new ApplicationException(msg);
}
StressUtils.VerifySite(appManager.SiteUrl, verificationContent);
}
开发者ID:40a,项目名称:kudu,代码行数:23,代码来源:StressTestCases.cs
示例8: PushAndVerifyConsoleWorker
private void PushAndVerifyConsoleWorker(ApplicationManager appManager, TestRepository testRepository, string[] expectedVerificationFileLines, int expectedDeployments = 1)
{
appManager.GitDeploy(testRepository.PhysicalPath);
var results = appManager.DeploymentManager.GetResultsAsync().Result.ToList();
Assert.Equal(expectedDeployments, results.Count);
for (int i = 0; i < expectedDeployments; i++)
{
Assert.Equal(DeployStatus.Success, results[i].Status);
}
var expectedContinuousJob = new ContinuousJob()
{
Name = "deployedJob",
JobType = "continuous",
Status = "Running",
RunCommand = "ConsoleWorker.exe"
};
WaitUntilAssertVerified(
"verify continuous job",
TimeSpan.FromSeconds(60),
() =>
{
ContinuousJob deployedJob = appManager.JobsManager.GetContinuousJobAsync("deployedJob").Result;
AssertContinuousJob(expectedContinuousJob, deployedJob);
});
WaitUntilAssertVerified(
"verification file",
TimeSpan.FromSeconds(30),
() =>
{
VerifyVerificationFile(appManager, expectedVerificationFileLines);
});
}
开发者ID:sr457,项目名称:kudu,代码行数:36,代码来源:WebJobsTests.cs
示例9: AssertUrlContentAsync
private async Task AssertUrlContentAsync(ApplicationManager appManager, Uri requestUrl, string expectedContent)
{
if (expectedContent == null)
{
Assert.Null(requestUrl);
return;
}
string address = requestUrl.ToString();
using (var httpClient = HttpClientHelper.CreateClient(address, appManager.JobsManager.Credentials))
{
using (var response = await httpClient.GetAsync(String.Empty))
{
var content = await response.Content.ReadAsStringAsync();
TestTracer.Trace("Request to: {0}\nStatus code: {1}\nContent: {2}", address, response.StatusCode, content);
Assert.True(content.IndexOf(expectedContent, StringComparison.OrdinalIgnoreCase) >= 0, "Expected content: " + expectedContent);
}
}
}
开发者ID:sr457,项目名称:kudu,代码行数:20,代码来源:WebJobsTests.cs
示例10: VerifyVerificationFile
private void VerifyVerificationFile(ApplicationManager appManager, string[] expectedContentLines)
{
var logFiles = appManager.VfsManager.ListAsync("LogFiles").Result;
string[] verificationFileNames = logFiles.Where(logFile => logFile.Name.StartsWith("verification.txt", StringComparison.OrdinalIgnoreCase)).Select(logFile => logFile.Name).ToArray();
for (int fileIndex = 0; fileIndex < verificationFileNames.Length; fileIndex++)
{
// Make sure at least one file is verified
try
{
string verificationFileName = verificationFileNames[fileIndex];
string verificationFileContent = appManager.VfsManager.ReadAllText("LogFiles/" + verificationFileName).TrimEnd();
Assert.NotNull(verificationFileContent);
string[] lines = verificationFileContent.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
Assert.Equal(expectedContentLines.Length, lines.Length);
for (int i = 0; i < expectedContentLines.Length; i++)
{
Assert.Equal(expectedContentLines[i], lines[i].Trim());
}
return;
}
catch
{
if (fileIndex == verificationFileNames.Length - 1)
{
throw;
}
}
}
}
开发者ID:sr457,项目名称:kudu,代码行数:31,代码来源:WebJobsTests.cs
示例11: RestartServiceSite
private static void RestartServiceSite(ApplicationManager appManager)
{
try
{
appManager.ProcessManager.KillProcessAsync(0).Wait();
}
catch
{
}
}
开发者ID:sr457,项目名称:kudu,代码行数:10,代码来源:WebJobsTests.cs
示例12: VerifyTriggeredJobTriggers
private void VerifyTriggeredJobTriggers(ApplicationManager appManager, string jobName, int expectedNumberOfRuns, string expectedStatus, string expectedOutput = null, string expectedError = null, string arguments = null, bool scheduledTriggeredJob = false)
{
if (!scheduledTriggeredJob)
{
appManager.JobsManager.InvokeTriggeredJobAsync(jobName, arguments).Wait();
}
try
{
WaitUntilAssertVerified(
"verify triggered job run",
TimeSpan.FromSeconds(30),
() =>
{
TriggeredJobHistory triggeredJobHistory = appManager.JobsManager.GetTriggeredJobHistoryAsync(jobName).Result;
Assert.NotNull(triggeredJobHistory);
Assert.Equal(expectedNumberOfRuns, triggeredJobHistory.TriggeredJobRuns.Count());
TriggeredJobRun triggeredJobRun = triggeredJobHistory.TriggeredJobRuns.FirstOrDefault();
AssertTriggeredJobRun(appManager, triggeredJobRun, jobName, expectedStatus, expectedOutput, expectedError);
});
}
catch
{
// On error trace the scheduler log if it is a scheduler job
if (scheduledTriggeredJob)
{
try
{
string schedulerLog = appManager.VfsManager.ReadAllText(JobsDataPath + "/triggered/" + jobName + "/job_scheduler.log");
TestTracer.Trace("Scheduler log - " + schedulerLog);
}
catch
{
}
}
throw;
}
}
开发者ID:sr457,项目名称:kudu,代码行数:40,代码来源:WebJobsTests.cs
示例13: CleanupTest
private void CleanupTest(ApplicationManager appManager)
{
WaitUntilAssertVerified(
"clean site for jobs",
TimeSpan.FromSeconds(60),
() =>
{
appManager.VfsManager.Delete(JobsBinPath, recursive: true);
appManager.VfsManager.Delete(JobsDataPath, recursive: true);
appManager.VfsManager.Delete(VerificationFilePath);
});
}
开发者ID:Nexus6studio,项目名称:kudu,代码行数:12,代码来源:WebJobsTests.cs
示例14: VerifyTriggeredJobTriggers
private void VerifyTriggeredJobTriggers(ApplicationManager appManager, string jobName, int expectedNumberOfRuns, string expectedStatus, string expectedOutput = null, string expectedError = null)
{
appManager.JobsManager.InvokeTriggeredJobAsync(jobName).Wait();
WaitUntilAssertVerified(
"verify triggered job run",
TimeSpan.FromSeconds(20),
() =>
{
TriggeredJobHistory triggeredJobHistory = appManager.JobsManager.GetTriggeredJobHistoryAsync(jobName).Result;
Assert.NotNull(triggeredJobHistory);
Assert.Equal(expectedNumberOfRuns, triggeredJobHistory.TriggeredJobRuns.Count());
foreach (TriggeredJobRun triggeredJobRun in triggeredJobHistory.TriggeredJobRuns)
{
AssertTriggeredJobRun(appManager, triggeredJobRun, expectedStatus, expectedOutput, expectedError);
}
});
}
开发者ID:Nexus6studio,项目名称:kudu,代码行数:19,代码来源:WebJobsTests.cs
示例15: DoGitPush
private void DoGitPush(ApplicationManager appManager, TestRepository testRepository, string appName, string verificationContent)
{
appManager.GitDeploy(testRepository.PhysicalPath, "master");
var results = appManager.DeploymentManager.GetResultsAsync().Result.ToList();
if (results[0].Status != Kudu.Core.Deployment.DeployStatus.Success)
{
string msg = string.Format("Deployment of app {0} failed. Deployment count: {1} . Deployment Status: {2}", appName, results.Count, results[0].Status);
throw new ApplicationException(msg);
}
StressUtils.VerifySite(appManager.SiteUrl, verificationContent);
}
开发者ID:40a,项目名称:kudu,代码行数:12,代码来源:StressTestCases.cs
示例16: VerifyVerificationFile
private void VerifyVerificationFile(ApplicationManager appManager, string[] expectedContentLines)
{
string verificationFileContent = appManager.VfsManager.ReadAllText(VerificationFilePath).TrimEnd();
Assert.NotNull(verificationFileContent);
string[] lines = verificationFileContent.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
Assert.Equal(expectedContentLines.Length, lines.Length);
for (int i = 0; i < expectedContentLines.Length; i++)
{
Assert.Equal(expectedContentLines[i], lines[i].Trim());
}
}
开发者ID:Nexus6studio,项目名称:kudu,代码行数:11,代码来源:WebJobsTests.cs
示例17: ReportTestCompletion
public static void ReportTestCompletion(ApplicationManager applicationManager, bool success)
{
_availableSiteIndex.Push(applicationManager.SitePoolIndex);
}
开发者ID:Walk4Muscle,项目名称:kudu,代码行数:4,代码来源:SitePool.cs
示例18: WaitForRepositorySite
private static void WaitForRepositorySite(ApplicationManager appManager)
{
HttpUtils.WaitForSite(appManager.ServiceUrl);
}
开发者ID:chrisdias,项目名称:kudu,代码行数:4,代码来源:DeploymentManagerExtensions.cs
示例19: CreateApplicationInternal
private static async Task<ApplicationManager> CreateApplicationInternal(int siteIndex)
{
string applicationName = _sitePrefix + siteIndex;
string operationName = "SitePool.CreateApplicationInternal " + applicationName;
var context = new KuduTestContext();
var siteManager = GetSiteManager(context);
Site site = siteManager.GetSite(applicationName);
if (site != null)
{
TestTracer.Trace("{0} Site already exists at {1}. Reusing site", operationName, site.SiteUrl);
var appManager = new ApplicationManager(siteManager, site, applicationName)
{
SitePoolIndex = siteIndex
};
// In site reuse mode, clean out the existing site so we start clean
// Enumrate all w3wp processes and make sure to kill any process with an open handle to klr.host.dll
foreach (var process in (await appManager.ProcessManager.GetProcessesAsync()).Where(p => p.Name.Equals("w3wp", StringComparison.OrdinalIgnoreCase)))
{
var extendedProcess = await appManager.ProcessManager.GetProcessAsync(process.Id);
if (extendedProcess.OpenFileHandles.Any(h => h.IndexOf("dnx.host.dll", StringComparison.OrdinalIgnoreCase) != -1))
{
await appManager.ProcessManager.KillProcessAsync(extendedProcess.Id, throwOnError:false);
}
}
await appManager.RepositoryManager.Delete(deleteWebRoot: true, ignoreErrors: true);
// Make sure we start with the correct default file as some tests expect it
WriteIndexHtml(appManager);
TestTracer.Trace("{0} completed", operationName);
return appManager;
}
else
{
TestTracer.Trace("{0} Creating new site", operationName);
lock (_createSiteLock)
{
if (ConfigurationManager.AppSettings["UseNetworkServiceIdentity"] == "true")
{
var applicationsPath = context.Configuration.ApplicationsPath;
if (!Directory.Exists(applicationsPath))
{
Directory.CreateDirectory(applicationsPath);
var accessRule = new FileSystemAccessRule("NETWORK SERVICE",
fileSystemRights: FileSystemRights.Modify | FileSystemRights.Write | FileSystemRights.ReadAndExecute | FileSystemRights.Read | FileSystemRights.ListDirectory,
inheritanceFlags: InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit,
propagationFlags: PropagationFlags.None,
type: AccessControlType.Allow);
var directoryInfo = new DirectoryInfo(applicationsPath);
DirectorySecurity directorySecurity = directoryInfo.GetAccessControl();
directorySecurity.AddAccessRule(accessRule);
directoryInfo.SetAccessControl(directorySecurity);
}
}
site = siteManager.CreateSiteAsync(applicationName).Result;
}
TestTracer.Trace("{0} Created new site at {1}", operationName, site.SiteUrl);
return new ApplicationManager(siteManager, site, applicationName)
{
SitePoolIndex = siteIndex
};
}
}
开发者ID:Walk4Muscle,项目名称:kudu,代码行数:72,代码来源:SitePool.cs
示例20: VerifyTriggeredJobDoesNotTrigger
private async Task VerifyTriggeredJobDoesNotTrigger(ApplicationManager appManager, string jobName)
{
HttpUnsuccessfulRequestException thrownException = null;
try
{
await appManager.JobsManager.InvokeTriggeredJobAsync(jobName);
}
catch (HttpUnsuccessfulRequestException ex)
{
thrownException = ex;
}
Assert.NotNull(thrownException);
Assert.Equal(HttpStatusCode.Conflict, thrownException.ResponseMessage.StatusCode);
}
开发者ID:sr457,项目名称:kudu,代码行数:15,代码来源:WebJobsTests.cs
注:本文中的Kudu.TestHarness.ApplicationManager类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论