use of com.thoughtworks.go.util.SystemEnvironment in project gocd by gocd.
the class ArtifactsDiskIsLow method onTearDown.
public void onTearDown() throws Exception {
new SystemEnvironment().clearProperty(SystemEnvironment.ARTIFACT_FULL_SIZE_LIMIT);
new SystemEnvironment().clearProperty(SystemEnvironment.ARTIFACT_WARNING_SIZE_LIMIT);
}
use of com.thoughtworks.go.util.SystemEnvironment in project gocd by gocd.
the class DiskSpaceSimulator method onTearDown.
public void onTearDown() {
new SystemEnvironment().clearProperty(ARTIFACT_FULL_SIZE_LIMIT);
new SystemEnvironment().clearProperty(ARTIFACT_WARNING_SIZE_LIMIT);
}
use of com.thoughtworks.go.util.SystemEnvironment in project gocd by gocd.
the class DiskSpaceSimulator method simulateDiskSpaceLow.
public String simulateDiskSpaceLow() {
onTearDown();
long space = new File(".").getFreeSpace() / 1024;
String limit = (space - 10) + "M";
new SystemEnvironment().setProperty(ARTIFACT_WARNING_SIZE_LIMIT, limit);
return limit;
}
use of com.thoughtworks.go.util.SystemEnvironment in project gocd by gocd.
the class AgentMain method main.
public static void main(String... argv) throws Exception {
assertVMVersion();
AgentBootstrapperArgs args = new AgentCLI().parse(argv);
LogConfigurator logConfigurator = new LogConfigurator(DEFAULT_LOGBACK_CONFIGURATION_FILE);
logConfigurator.initialize();
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();
}
use of com.thoughtworks.go.util.SystemEnvironment in project gocd by gocd.
the class AgentWebSocketClientControllerTest method processAssignWorkActionWithConsoleLogsThroughWebSockets.
@Test
public void processAssignWorkActionWithConsoleLogsThroughWebSockets() throws IOException, InterruptedException {
SystemEnvironment env = new SystemEnvironment();
env.set(SystemEnvironment.WEBSOCKET_ENABLED, true);
env.set(SystemEnvironment.CONSOLE_LOGS_THROUGH_WEBSOCKET_ENABLED, true);
ArgumentCaptor<Message> argumentCaptor = ArgumentCaptor.forClass(Message.class);
agentController = createAgentController();
agentController.init();
agentController.process(new Message(Action.assignWork, MessageEncoding.encodeWork(new SleepWork("work1", 0))));
assertThat(agentController.getAgentRuntimeInfo().getRuntimeStatus(), is(AgentRuntimeStatus.Idle));
verify(webSocketSessionHandler, times(2)).sendAndWaitForAcknowledgement(argumentCaptor.capture());
verify(artifactsManipulator).setProperty(null, new Property("work1_result", "done"));
Message message = argumentCaptor.getAllValues().get(1);
assertThat(message.getAcknowledgementId(), notNullValue());
assertThat(message.getAction(), is(Action.ping));
assertThat(message.getData(), is(MessageEncoding.encodeData(agentController.getAgentRuntimeInfo())));
Message message2 = argumentCaptor.getAllValues().get(0);
assertThat(message2.getAcknowledgementId(), notNullValue());
assertThat(message2.getAction(), is(Action.consoleOut));
ConsoleTransmission ct = MessageEncoding.decodeData(message2.getData(), ConsoleTransmission.class);
assertThat(ct.getLine(), RegexMatcher.matches("Sleeping for 0 milliseconds"));
env.set(SystemEnvironment.WEBSOCKET_ENABLED, false);
env.set(SystemEnvironment.CONSOLE_LOGS_THROUGH_WEBSOCKET_ENABLED, false);
}
Aggregations