use of com.googlecode.junit.ext.RunIf in project gocd by gocd.
the class BuilderTest method shouldReportErrorWhenCancelCommandDoesNotExists.
@Test
@RunIf(value = EnhancedOSChecker.class, arguments = { DO_NOT_RUN_ON, WINDOWS })
public void shouldReportErrorWhenCancelCommandDoesNotExists() throws Exception {
StubBuilder stubBuilder = new StubBuilder();
CommandBuilder cancelBuilder = new CommandBuilder("echo2", "cancel task", new File("."), new RunIfConfigs(FAILED), stubBuilder, "");
CommandBuilder builder = new CommandBuilder("echo", "normal task", new File("."), new RunIfConfigs(FAILED), cancelBuilder, "");
builder.cancel(goPublisher, new EnvironmentVariableContext(), null);
assertThat(goPublisher.getMessage(), containsString("Error happened while attempting to execute 'echo2 cancel task'"));
}
use of com.googlecode.junit.ext.RunIf in project gocd by gocd.
the class MagicalGoConfigXmlLoaderTest method shouldNotAllowAbsoluteDestFolderNamesOnWindows.
@Test
@RunIf(value = EnhancedOSChecker.class, arguments = { EnhancedOSChecker.WINDOWS })
public void shouldNotAllowAbsoluteDestFolderNamesOnWindows() throws Exception {
String materials1 = " <materials>\n" + " <svn url=\"/hgrepo2\" dest=\"C:\\tmp\\foo\" />\n" + " </materials>\n";
MagicalGoConfigXmlLoaderFixture.assertNotValid("Dest folder 'C:\\tmp\\foo' is not valid. It must be a sub-directory of the working folder.", materials1);
}
use of com.googlecode.junit.ext.RunIf in project gocd by gocd.
the class BuildWorkTest method shouldReportErrorWhenComandIsNotExistOnWindows.
@Test
@RunIf(value = EnhancedOSChecker.class, arguments = { EnhancedOSChecker.WINDOWS })
public void shouldReportErrorWhenComandIsNotExistOnWindows() throws Exception {
buildWork = (BuildWork) getWork(CMD_NOT_EXIST, PIPELINE_NAME);
buildWork.doWork(agentIdentifier, buildRepository, artifactManipulator, environmentVariableContext, new AgentRuntimeInfo(agentIdentifier, AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false), packageRepositoryExtension, scmExtension, taskExtension);
assertThat(artifactManipulator.consoleOut(), printedAppsMissingInfoOnWindows(SOMETHING_NOT_EXIST));
assertThat(buildRepository.results, containsResult(Failed));
}
use of com.googlecode.junit.ext.RunIf in project gocd by gocd.
the class BuildWorkTest method shouldReportErrorWhenComandIsNotExistOnLinux.
@Test
@RunIf(value = EnhancedOSChecker.class, arguments = { DO_NOT_RUN_ON, WINDOWS })
public void shouldReportErrorWhenComandIsNotExistOnLinux() throws Exception {
buildWork = (BuildWork) getWork(CMD_NOT_EXIST, PIPELINE_NAME);
buildWork.doWork(agentIdentifier, buildRepository, artifactManipulator, environmentVariableContext, new AgentRuntimeInfo(agentIdentifier, AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false), packageRepositoryExtension, scmExtension, taskExtension);
assertThat(artifactManipulator.consoleOut(), printedAppsMissingInfoOnUnix(SOMETHING_NOT_EXIST));
assertThat(buildRepository.results, containsResult(Failed));
}
use of com.googlecode.junit.ext.RunIf in project gocd by gocd.
the class MaterialRepositoryWithH2IntegrationTest method materialFingerprintShouldUseTheHashAlgoritmInMigration47.
@Test
@RunIf(value = DatabaseChecker.class, arguments = { DatabaseChecker.H2 })
public void materialFingerprintShouldUseTheHashAlgoritmInMigration47() throws Exception {
final HgMaterial material = new HgMaterial("url", null);
byte[] fingerprint = (byte[]) repo.getHibernateTemplate().execute(new HibernateCallback() {
public Object doInHibernate(Session session) throws HibernateException, SQLException {
String pattern = format("'type=%s%surl=%s'", material.getType(), AbstractMaterial.FINGERPRINT_DELIMITER, material.getUrl());
SQLQuery query = session.createSQLQuery(format("CALL HASH('SHA256', STRINGTOUTF8(%s), 1)", pattern));
return query.uniqueResult();
}
});
assertThat(Hex.encodeHexString(fingerprint), is(material.getFingerprint()));
}
Aggregations