use of com.thoughtworks.go.config.Resource in project gocd by gocd.
the class ResourceRepositoryIntegrationTest method shouldLoadSavedResource.
@Test
public void shouldLoadSavedResource() {
// Arrange
JobInstance jobInstance = jobInstanceDao.save(stageId, new JobInstance(JOB_NAME));
Resource savedResource = new Resource("something");
savedResource.setBuildId(jobInstance.getId());
resourceRepository.save(savedResource);
// Act
List<Resource> resourceList = resourceRepository.findByBuildId(jobInstance.getId());
// Assert
assertThat(resourceList.size(), is(1));
assertThat(resourceList.get(0), is(savedResource));
}
use of com.thoughtworks.go.config.Resource in project gocd by gocd.
the class ResourcesTest method shouldUnderstandLesserLengthResourcesAsLesser.
@Test
public void shouldUnderstandLesserLengthResourcesAsLesser() {
Resources resourcesA = new Resources();
Resources resourcesB = new Resources();
resourcesA.add(new Resource("xyz"));
resourcesB.add(new Resource("xyz"));
resourcesB.add(new Resource("zzz"));
assertThat(resourcesA.compareTo(resourcesB), is(lessThan(0)));
assertThat(resourcesB.compareTo(resourcesA), is(greaterThan(0)));
}
use of com.thoughtworks.go.config.Resource in project gocd by gocd.
the class ResourcesTest method shouldCompareBasedOnSimilarResourceList.
@Test
public void shouldCompareBasedOnSimilarResourceList() {
Resources resourcesA = new Resources();
Resources resourcesB = new Resources();
resourcesA.add(new Resource("xyz"));
resourcesA.add(new Resource("aaa"));
resourcesB.add(new Resource("xyz"));
resourcesB.add(new Resource("aaa"));
assertThat(resourcesA.compareTo(resourcesB), is(0));
}
use of com.thoughtworks.go.config.Resource in project gocd by gocd.
the class ResourcesTest method shouldClearAndSetPrimitiveAttributes.
@Test
public void shouldClearAndSetPrimitiveAttributes() {
Resources resources = new Resources();
String csv = "a, b, c,d ";
resources.add(new Resource("old_resource"));
assertThat(resources.size(), is(1));
resources.importFromCsv(csv);
assertThat(resources.size(), is(4));
assertThat(resources.exportToCsv(), is("a, b, c, d, "));
}
use of com.thoughtworks.go.config.Resource in project gocd by gocd.
the class ResourcesTest method shouldReturnSortedResourceNamesAsStringRepresention.
@Test
public void shouldReturnSortedResourceNamesAsStringRepresention() {
Resources actual = new Resources();
actual.add(new Resource("jdk1.4"));
actual.add(new Resource("linux"));
actual.add(new Resource("gentoo"));
actual.add(new Resource("jdk1.5"));
actual.add(new Resource("Jdk1.5"));
assertThat(actual.size(), is(4));
assertThat(actual.toString(), is("gentoo | jdk1.4 | jdk1.5 | linux"));
}
Aggregations