use of com.thoughtworks.go.agent.common.AgentBootstrapperArgs in project gocd by gocd.
the class AgentBootstrapper method main.
public static void main(String[] argv) {
BootstrapperLoggingHelper.initLog4j();
AgentBootstrapperArgs args = new AgentCLI().parse(argv);
new AgentBootstrapper().go(true, args);
}
use of com.thoughtworks.go.agent.common.AgentBootstrapperArgs in project gocd by gocd.
the class AgentBootstrapperFunctionalTest method shouldDownloadJarIfItDoesNotExist.
@Test
public void shouldDownloadJarIfItDoesNotExist() throws Exception {
if (!OS_CHECKER.satisfy()) {
File agentJar = new File("agent.jar");
agentJar.delete();
new AgentBootstrapper() {
@Override
void jvmExit(int returnValue) {
}
}.go(false, new AgentBootstrapperArgs(new URL("http://" + "localhost" + ":" + 9090 + "/go"), null, AgentBootstrapperArgs.SslMode.NONE));
assertTrue("No agent downloaded", agentJar.exists());
agentJar.delete();
}
}
use of com.thoughtworks.go.agent.common.AgentBootstrapperArgs in project gocd by gocd.
the class AgentBootstrapperFunctionalTest method shouldLoadAndBootstrapJarUsingAgentBootstrapCode_specifiedInAgentManifestFile.
@Test
public void shouldLoadAndBootstrapJarUsingAgentBootstrapCode_specifiedInAgentManifestFile() throws Exception {
if (!OS_CHECKER.satisfy()) {
PrintStream err = System.err;
try {
ByteArrayOutputStream os = new ByteArrayOutputStream();
System.setErr(new PrintStream(os));
File agentJar = new File("agent.jar");
agentJar.delete();
new AgentBootstrapper() {
@Override
void jvmExit(int returnValue) {
}
}.go(false, new AgentBootstrapperArgs(new URL("http://" + "localhost" + ":" + 9090 + "/go"), null, AgentBootstrapperArgs.SslMode.NONE));
agentJar.delete();
assertThat(new String(os.toByteArray()), containsString("Hello World Fellas!"));
} finally {
System.setErr(err);
}
}
}
use of com.thoughtworks.go.agent.common.AgentBootstrapperArgs in project gocd by gocd.
the class DefaultAgentLaunchDescriptorImplTest method contextShouldContainEnvAndPropertiesAndHostAndPort.
@Test
public void contextShouldContainEnvAndPropertiesAndHostAndPort() throws Exception {
String hostname = "xx.xx.xx";
int port = 20;
AgentBootstrapperArgs bootstrapperArgs = new AgentBootstrapperArgs(new URL("https://" + hostname + ":" + port + "/go"), null, AgentBootstrapperArgs.SslMode.NONE);
DefaultAgentLaunchDescriptorImpl launchDescriptor = new DefaultAgentLaunchDescriptorImpl(bootstrapperArgs, new AgentBootstrapper());
Map context = launchDescriptor.context();
assertEquals(context, bootstrapperArgs.toProperties());
}
use of com.thoughtworks.go.agent.common.AgentBootstrapperArgs in project gocd by gocd.
the class AgentMain method main.
public static void main(String... argv) throws Exception {
AgentBootstrapperArgs args = new AgentCLI().parse(argv);
LoggingHelper.configureLoggerIfNoneExists("go-agent.log", "go-agent-log4j.properties");
new SystemEnvironment().setProperty("go.process.type", "agent");
new SystemEnvironment().setProperty(SystemEnvironment.SERVICE_URL, args.getServerUrl().toString());
new SystemEnvironment().setProperty(SystemEnvironment.AGENT_SSL_VERIFICATION_MODE, args.getSslMode().toString());
if (args.getRootCertFile() != null) {
new SystemEnvironment().setProperty(SystemEnvironment.AGENT_ROOT_CERT_FILE, args.getRootCertFile().toString());
}
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
ctx.registerShutdownHook();
}
Aggregations