Search in sources :

Example 11 with Resources

use of com.thoughtworks.go.config.Resources 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)));
}
Also used : Resource(com.thoughtworks.go.config.Resource) Resources(com.thoughtworks.go.config.Resources) Test(org.junit.Test)

Example 12 with Resources

use of com.thoughtworks.go.config.Resources 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));
}
Also used : Resource(com.thoughtworks.go.config.Resource) Resources(com.thoughtworks.go.config.Resources) Test(org.junit.Test)

Example 13 with Resources

use of com.thoughtworks.go.config.Resources 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, "));
}
Also used : Resource(com.thoughtworks.go.config.Resource) Resources(com.thoughtworks.go.config.Resources) Test(org.junit.Test)

Example 14 with Resources

use of com.thoughtworks.go.config.Resources 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"));
}
Also used : Resource(com.thoughtworks.go.config.Resource) Resources(com.thoughtworks.go.config.Resources) Test(org.junit.Test)

Example 15 with Resources

use of com.thoughtworks.go.config.Resources in project gocd by gocd.

the class ResourcesTest method shouldNotAllowBlankNames.

@Test
public void shouldNotAllowBlankNames() {
    Resources resources = new Resources();
    resources.add(new Resource(""));
    assertThat(resources.size(), is(0));
    resources.add(new Resource("   "));
    assertThat(resources.size(), is(0));
}
Also used : Resource(com.thoughtworks.go.config.Resource) Resources(com.thoughtworks.go.config.Resources) Test(org.junit.Test)

Aggregations

Resources (com.thoughtworks.go.config.Resources)16 Test (org.junit.Test)16 Resource (com.thoughtworks.go.config.Resource)13 Agents (com.thoughtworks.go.config.Agents)2 AgentConfig (com.thoughtworks.go.config.AgentConfig)1 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)1 ArrayList (java.util.ArrayList)1