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()));
}
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));
}
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));
}
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));
}
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));
}
Aggregations