use of com.thoughtworks.go.util.validators.Validation 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: ");
}
use of com.thoughtworks.go.util.validators.Validation 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));
}
use of com.thoughtworks.go.util.validators.Validation in project gocd by gocd.
the class GoServerValidatorTest method shouldValidatorServerBeforeStart.
@Test
public void shouldValidatorServerBeforeStart() throws IOException, InterruptedException {
try {
startServerOnPort(PORT_TO_TRY);
serverPortValidator = new ServerPortValidator(PORT_TO_TRY);
Validation validation = serverPortValidator.validate(new Validation());
assertThat(validation.isSuccessful(), is(false));
} finally {
shutDownServer();
}
}
use of com.thoughtworks.go.util.validators.Validation in project gocd by gocd.
the class GoServerValidatorTest method shouldNotFailIfPortIsAvailable.
@Test
public void shouldNotFailIfPortIsAvailable() throws IOException, InterruptedException {
serverPortValidator = new ServerPortValidator(PORT_TO_TRY);
Validation validation = serverPortValidator.validate(new Validation());
assertThat(validation.isSuccessful(), is(true));
}
use of com.thoughtworks.go.util.validators.Validation in project gocd by gocd.
the class AgentBootstrapper method validate.
void validate() {
Validation validation = new Validation();
FileValidator.defaultFile(Downloader.AGENT_LAUNCHER, false).validate(validation);
if (!validation.isSuccessful()) {
validation.logErrors(LOG);
throw new RuntimeException("Agent Bootstrapper initialization failed. Could not validate file: " + Downloader.AGENT_LAUNCHER);
}
}
Aggregations