Search in sources :

Example 1 with Resources

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

the class DefaultSchedulingContextTest method shouldFindNoAgentsIfNoneExist.

@Test
public void shouldFindNoAgentsIfNoneExist() throws Exception {
    DefaultSchedulingContext context = new DefaultSchedulingContext("approved", new Agents());
    assertThat(context.findAgentsMatching(new Resources()), is(new Agents()));
}
Also used : Agents(com.thoughtworks.go.config.Agents) Resources(com.thoughtworks.go.config.Resources) Test(org.junit.Test)

Example 2 with Resources

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

the class DefaultSchedulingContextTest method shouldFindAllAgentsIfNoResourcesAreSpecified.

@Test
public void shouldFindAllAgentsIfNoResourcesAreSpecified() throws Exception {
    AgentConfig linux = agent("uuid1", "linux");
    AgentConfig windows = agent("uuid2", "windows");
    Agents matchingAgents = new Agents(linux, windows);
    DefaultSchedulingContext context = new DefaultSchedulingContext("approved", matchingAgents);
    assertThat(context.findAgentsMatching(new Resources()), is(matchingAgents));
}
Also used : AgentConfig(com.thoughtworks.go.config.AgentConfig) Agents(com.thoughtworks.go.config.Agents) Resources(com.thoughtworks.go.config.Resources) Test(org.junit.Test)

Example 3 with Resources

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

the class ResourcesTest method shouldTrimResourceNames.

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

Example 4 with Resources

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

the class ResourcesTest method shouldGetAllResourcesNames.

@Test
public void shouldGetAllResourcesNames() {
    Resources resources = new Resources();
    resources.add(new Resource("Eoo"));
    resources.add(new Resource("Poo"));
    List<String> names = new ArrayList<>();
    names.add("Eoo");
    names.add("Poo");
    List<String> resourceNames = resources.resourceNames();
    assertThat(resourceNames, is(names));
}
Also used : Resource(com.thoughtworks.go.config.Resource) ArrayList(java.util.ArrayList) Resources(com.thoughtworks.go.config.Resources) Test(org.junit.Test)

Example 5 with Resources

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

the class ResourcesTest method shouldIgnoreCaseNamesOfResources.

@Test
public void shouldIgnoreCaseNamesOfResources() {
    Resources resources = new Resources();
    resources.add(new Resource("Eoo"));
    resources.add(new Resource("eoo"));
    assertThat(resources.size(), is(1));
}
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