use of com.thoughtworks.go.util.SystemEnvironment in project gocd by gocd.
the class EmailMessageDrafterTest method shouldDraftNoArtifactDiskSpaceEmail.
@Test
public void shouldDraftNoArtifactDiskSpaceEmail() throws Exception {
String size = "2345";
new SystemEnvironment().setProperty(SystemEnvironment.ARTIFACT_FULL_SIZE_LIMIT, size);
String email = "admin@mail.com";
SendEmailMessage message = EmailMessageDrafter.noArtifactsDiskSpaceMessage(new SystemEnvironment(), email, artifactRoot);
String ip = SystemUtil.getFirstLocalNonLoopbackIpAddress();
assertThat(message, is(new SendEmailMessage("No artifacts disk space error message from Go Server at " + ip, noArtifactDiskSpaceEmail(ip, size), email)));
}
use of com.thoughtworks.go.util.SystemEnvironment in project gocd by gocd.
the class GoVelocityViewTest method shouldSetAssetsPathVariableWhenRailsNewWithCompressedJavascriptsIsUsed.
@Test
public void shouldSetAssetsPathVariableWhenRailsNewWithCompressedJavascriptsIsUsed() throws Exception {
SystemEnvironment systemEnvironment = mock(SystemEnvironment.class);
when(systemEnvironment.useCompressedJs()).thenReturn(true);
when(railsAssetsService.getAssetPath("application.js")).thenReturn("assets/application-digest.js");
when(railsAssetsService.getAssetPath("application.css")).thenReturn("assets/application-digest.css");
when(railsAssetsService.getAssetPath("vm/application.css")).thenReturn("assets/vm/application-digest.css");
when(railsAssetsService.getAssetPath("css/application.css")).thenReturn("assets/css/application-digest.css");
when(railsAssetsService.getAssetPath("g9/stage_bar_cancelled_icon.png")).thenReturn("assets/g9/stage_bar_cancelled_icon.png");
when(railsAssetsService.getAssetPath("spinner.gif")).thenReturn("assets/spinner.gif");
when(railsAssetsService.getAssetPath("cruise.ico")).thenReturn("assets/cruise.ico");
GoVelocityView view = spy(new GoVelocityView(systemEnvironment));
doReturn(railsAssetsService).when(view).getRailsAssetsService();
doReturn(versionInfoService).when(view).getVersionInfoService();
Request servletRequest = mock(Request.class);
when(servletRequest.getSession()).thenReturn(mock(HttpSession.class));
view.exposeHelpers(velocityContext, servletRequest);
assertThat(velocityContext.get(GoVelocityView.CONCATENATED_JAVASCRIPT_FILE_PATH), is("assets/application-digest.js"));
assertThat(velocityContext.get(GoVelocityView.CONCATENATED_APPLICATION_CSS_FILE_PATH), is("assets/application-digest.css"));
assertThat(velocityContext.get(GoVelocityView.CONCATENATED_VM_APPLICATION_CSS_FILE_PATH), is("assets/vm/application-digest.css"));
assertThat(velocityContext.get(GoVelocityView.CONCATENATED_CSS_APPLICATION_CSS_FILE_PATH), is("assets/css/application-digest.css"));
assertThat(velocityContext.get(GoVelocityView.CONCATENATED_STAGE_BAR_CANCELLED_ICON_FILE_PATH), is("assets/g9/stage_bar_cancelled_icon.png"));
assertThat(velocityContext.get(GoVelocityView.CONCATENATED_SPINNER_ICON_FILE_PATH), is("assets/spinner.gif"));
assertThat(velocityContext.get(GoVelocityView.CONCATENATED_CRUISE_ICON_FILE_PATH), is("assets/cruise.ico"));
assertThat(velocityContext.get(GoVelocityView.PATH_RESOLVER), is(railsAssetsService));
}
use of com.thoughtworks.go.util.SystemEnvironment in project gocd by gocd.
the class ConsoleOutputTransmitterTest method setup.
@Before
public void setup() throws Exception {
initMocks(this);
// so the thread does not wake up
new SystemEnvironment().setProperty(SystemEnvironment.INTERVAL, "60");
requestArgumentCaptor = ArgumentCaptor.forClass(String.class);
doNothing().when(consoleAppender).append(requestArgumentCaptor.capture());
transmitter = new ConsoleOutputTransmitter(consoleAppender, 0, mock(ScheduledThreadPoolExecutor.class));
}
use of com.thoughtworks.go.util.SystemEnvironment in project gocd by gocd.
the class BuildWorkArtifactUploadingTest method teardown.
@After
public void teardown() throws Exception {
TestRepo.internalTearDown();
FileUtil.deleteFolder(buildWorkingDirectory);
new SystemEnvironment().clearProperty("serviceUrl");
}
use of com.thoughtworks.go.util.SystemEnvironment in project gocd by gocd.
the class GoPlainSocketConnectorTest method setUp.
@Before
public void setUp() {
SystemEnvironment systemEnvironment = mock(SystemEnvironment.class);
when(systemEnvironment.getServerPort()).thenReturn(1234);
when(systemEnvironment.get(SystemEnvironment.RESPONSE_BUFFER_SIZE)).thenReturn(100);
when(systemEnvironment.get(SystemEnvironment.IDLE_TIMEOUT)).thenReturn(200);
when(systemEnvironment.getListenHost()).thenReturn("foo");
when(systemEnvironment.get(SystemEnvironment.GO_SSL_CONFIG_ALLOW)).thenReturn(true);
when(systemEnvironment.get(SystemEnvironment.GO_SSL_RENEGOTIATION_ALLOWED)).thenReturn(true);
Jetty9Server server = new Jetty9Server(systemEnvironment, null, mock(SSLSocketFactory.class));
connector = (ServerConnector) new GoPlainSocketConnector(server, systemEnvironment).getConnector();
HttpConnectionFactory connectionFactory = (HttpConnectionFactory) connector.getDefaultConnectionFactory();
configuration = connectionFactory.getHttpConfiguration();
}
Aggregations