use of jetbrains.buildServer.agent.CurrentBuildTracker in project teamcity-git by JetBrains.
the class SSHAgentServiceTest method check_classpath_is_correct.
public void check_classpath_is_correct() throws IOException {
File tempDir = createTempDir();
Mockery m = new Mockery();
BuildAgent agent = m.mock(BuildAgent.class);
BuildAgentConfiguration agentConf = m.mock(BuildAgentConfiguration.class);
CurrentBuildTracker buildTracker = m.mock(CurrentBuildTracker.class);
m.checking(new Expectations() {
{
allowing(agentConf).getConfigurationParameters();
will(returnValue(Collections.emptyMap()));
allowing(agentConf).getTempDirectory();
will(returnValue(tempDir));
allowing(buildTracker).getCurrentBuild();
will(throwException(new NoRunningBuildException()));
}
});
GitAgentSSHService agentSSHService = new GitAgentSSHService(agent, agentConf, new MockGitPluginDescriptor(), new MockVcsRootSshKeyManagerProvider(), buildTracker);
String scriptPath = agentSSHService.getScriptPath();
GeneralCommandLine commandLine = new GeneralCommandLine();
commandLine.setExePath(scriptPath);
commandLine.addParameter("localhost");
Map<String, String> env = new HashMap<>();
env.put(GitSSHHandler.TEAMCITY_DEBUG_SSH, "true");
commandLine.setEnvParams(env);
ExecResult res = SimpleCommandLineProcessRunner.runCommand(commandLine, new byte[0]);
then(res.getStderr()).doesNotContain("NoClassDefFoundError").doesNotContain("ClassNotFoundError");
}
Aggregations