Search in sources :

Example 61 with SystemEnvironment

use of com.thoughtworks.go.util.SystemEnvironment in project gocd by gocd.

the class GoLauncher method main.

public static void main(String[] args) throws Exception {
    assertVMVersion();
    SystemEnvironment systemEnvironment = new SystemEnvironment();
    systemEnvironment.setProperty(GoConstants.USE_COMPRESSED_JAVASCRIPT, Boolean.toString(true));
    LogConfigurator logConfigurator = new LogConfigurator(DEFAULT_LOGBACK_CONFIGURATION_FILE);
    logConfigurator.initialize();
    try {
        cleanupTempFiles();
        new GoServer().go();
    } catch (Exception e) {
        System.err.println("ERROR: Failed to start Go server. Please check the logs.");
        e.printStackTrace();
        System.exit(1);
    }
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) LogConfigurator(com.thoughtworks.go.logging.LogConfigurator) GoServer(com.thoughtworks.go.server.GoServer)

Example 62 with SystemEnvironment

use of com.thoughtworks.go.util.SystemEnvironment in project gocd by gocd.

the class GoServerTest method shouldRegisterSubprocessLoggerAsExit.

@Test
public void shouldRegisterSubprocessLoggerAsExit() throws Exception {
    SystemEnvironment systemEnvironment = mock(SystemEnvironment.class);
    Validation validation = mock(Validation.class);
    when(validation.isSuccessful()).thenReturn(true);
    StubGoServer goServer = new StubGoServer(systemEnvironment, validation);
    goServer.subprocessLogger = mock(SubprocessLogger.class);
    goServer.go();
    verify(goServer.subprocessLogger).registerAsExitHook("Following processes were alive at shutdown: ");
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) Validation(com.thoughtworks.go.util.validators.Validation) SubprocessLogger(com.thoughtworks.go.util.SubprocessLogger) Test(org.junit.Test)

Example 63 with SystemEnvironment

use of com.thoughtworks.go.util.SystemEnvironment in project gocd by gocd.

the class GoServerTest method setUp.

@Before
public void setUp() throws Exception {
    systemEnvironment = new SystemEnvironment();
    systemEnvironment.set(SystemEnvironment.APP_SERVER, AppServerStub.class.getCanonicalName());
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) Before(org.junit.Before)

Example 64 with SystemEnvironment

use of com.thoughtworks.go.util.SystemEnvironment in project gocd by gocd.

the class GoServerTest method shouldNotStartServerIfValidationFails.

@Test
public void shouldNotStartServerIfValidationFails() throws Exception {
    final SystemEnvironment systemEnvironment = context.mock(SystemEnvironment.class);
    Validation validation = new Validation().addError(new Exception("Server Port occupied"));
    StubGoServer goServer = new StubGoServer(systemEnvironment, validation);
    goServer.go();
    assertThat(goServer.wasStarted(), is(false));
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) Validation(com.thoughtworks.go.util.validators.Validation) Test(org.junit.Test)

Example 65 with SystemEnvironment

use of com.thoughtworks.go.util.SystemEnvironment in project gocd by gocd.

the class ArtifactsControllerTest method setUp.

@Before
public void setUp() {
    consoleActivityMonitor = mock(ConsoleActivityMonitor.class);
    restfulService = mock(RestfulService.class);
    artifactService = mock(ArtifactsService.class);
    consoleService = mock(ConsoleService.class);
    jobInstanceDao = mock(JobInstanceDao.class);
    systemEnvironment = mock(SystemEnvironment.class);
    artifactsController = new ArtifactsController(artifactService, restfulService, mock(ZipArtifactCache.class), jobInstanceDao, consoleActivityMonitor, consoleService, systemEnvironment);
    request = new MockHttpServletRequest();
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) ConsoleActivityMonitor(com.thoughtworks.go.server.service.ConsoleActivityMonitor) RestfulService(com.thoughtworks.go.server.service.RestfulService) ArtifactsService(com.thoughtworks.go.server.service.ArtifactsService) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) ConsoleService(com.thoughtworks.go.server.service.ConsoleService) JobInstanceDao(com.thoughtworks.go.server.dao.JobInstanceDao) Before(org.junit.Before)

Aggregations

SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)174 Test (org.junit.Test)93 Before (org.junit.Before)38 File (java.io.File)37 AgentInstance (com.thoughtworks.go.domain.AgentInstance)27 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)15 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)14 ArrayList (java.util.ArrayList)14 AgentRuntimeInfo (com.thoughtworks.go.server.service.AgentRuntimeInfo)11 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)10 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)10 AgentStatusChangeListener (com.thoughtworks.go.listener.AgentStatusChangeListener)10 AgentIdentifier (com.thoughtworks.go.remote.AgentIdentifier)9 AgentConfig (com.thoughtworks.go.config.AgentConfig)8 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)8 PipelineConfigDependencyGraph (com.thoughtworks.go.server.domain.PipelineConfigDependencyGraph)8 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)7 EnvironmentVariableContext (com.thoughtworks.go.util.command.EnvironmentVariableContext)7 Date (java.util.Date)7 CruiseConfig (com.thoughtworks.go.config.CruiseConfig)6