use of com.thoughtworks.go.plugin.access.elastic.models.AgentMetadata in project gocd by gocd.
the class AgentMetadataConverterV4Test method fromDTO_shouldConvertToAgentMetadataFromAgentMetadataDTO.
@Test
public void fromDTO_shouldConvertToAgentMetadataFromAgentMetadataDTO() {
final AgentMetadataDTO agentMetadataDTO = new AgentMetadataDTO("agent-id", "Idle", "Building", "Enabled");
final AgentMetadata agentMetadata = new AgentMetadataConverterV4().fromDTO(agentMetadataDTO);
assertThat(agentMetadata.elasticAgentId(), is("agent-id"));
assertThat(agentMetadata.agentState(), is("Idle"));
assertThat(agentMetadata.buildState(), is("Building"));
assertThat(agentMetadata.configState(), is("Enabled"));
}
use of com.thoughtworks.go.plugin.access.elastic.models.AgentMetadata in project gocd by gocd.
the class AgentMetadataConverterV5Test method fromDTO_shouldConvertToAgentMetadataFromAgentMetadataDTO.
@Test
public void fromDTO_shouldConvertToAgentMetadataFromAgentMetadataDTO() {
final com.thoughtworks.go.plugin.access.elastic.v5.AgentMetadataDTO agentMetadataDTO = new com.thoughtworks.go.plugin.access.elastic.v5.AgentMetadataDTO("agent-id", "Idle", "Building", "Enabled");
final AgentMetadata agentMetadata = new AgentMetadataConverterV5().fromDTO(agentMetadataDTO);
assertThat(agentMetadata.elasticAgentId(), is("agent-id"));
assertThat(agentMetadata.agentState(), is("Idle"));
assertThat(agentMetadata.buildState(), is("Building"));
assertThat(agentMetadata.configState(), is("Enabled"));
}
use of com.thoughtworks.go.plugin.access.elastic.models.AgentMetadata in project gocd by gocd.
the class ElasticAgentProcessorConverterV1Test method shouldJsonizeAgentMetadataListConvertAgentMetadataList.
@Test
public void shouldJsonizeAgentMetadataListConvertAgentMetadataList() {
final List<AgentMetadata> agentMetadataList = Arrays.asList(new AgentMetadata("foo-id", "Idle", "Idle", "Enabled"), new AgentMetadata("bar-id", "Idle", "Building", "Enabled"));
final String responseBody = elasticAgentProcessorConverterV1.listAgentsResponseBody(agentMetadataList);
final String expectedStr = "[\n" + " {\n" + " \"agent_id\": \"foo-id\",\n" + " \"agent_state\": \"Idle\",\n" + " \"build_state\": \"Idle\",\n" + " \"config_state\": \"Enabled\"\n" + " },\n" + " {\n" + " \"agent_id\": \"bar-id\",\n" + " \"agent_state\": \"Idle\",\n" + " \"build_state\": \"Building\",\n" + " \"config_state\": \"Enabled\"\n" + " }\n" + "]";
assertThatJson(expectedStr).isEqualTo(responseBody);
}
Aggregations