use of com.thoughtworks.go.config.Resource in project gocd by gocd.
the class AgentInstance method createFromConfig.
public static AgentInstance createFromConfig(AgentConfig agentInConfig, SystemEnvironment systemEnvironment) {
AgentType type = agentInConfig.isFromLocalHost() ? AgentType.LOCAL : AgentType.REMOTE;
AgentInstance result = new AgentInstance(agentInConfig, type, systemEnvironment);
result.agentConfigStatus = agentInConfig.isDisabled() ? AgentConfigStatus.Disabled : AgentConfigStatus.Enabled;
result.errors = new ConfigErrors();
result.errors.addAll(agentInConfig.errors());
for (Resource resource : agentInConfig.getResources()) {
result.errors.addAll(resource.errors());
}
return result;
}
use of com.thoughtworks.go.config.Resource in project gocd by gocd.
the class AgentsViewModelMother method getTwoAgents.
public static AgentsViewModel getTwoAgents() {
AgentInstance building = AgentInstanceMother.building();
building.getResources().add(new Resource("ruby"));
AgentInstance idle = AgentInstanceMother.idle();
HashSet<String> environments = new HashSet<>();
environments.add("hello");
environments.add("yellow");
return new AgentsViewModel(new AgentViewModel(idle, environments), new AgentViewModel(building));
}
use of com.thoughtworks.go.config.Resource 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.Resource 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.Resource 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