use of com.thoughtworks.go.plugin.access.elastic.models.AgentMetadata in project gocd by gocd.
the class AgentMetadataConverterV1Test method fromDTO_shouldConvertToAgentMetadataDTOFromAgentMetadata.
@Test
public void fromDTO_shouldConvertToAgentMetadataDTOFromAgentMetadata() {
final AgentMetadata agentMetadata = new AgentMetadata("agent-id", "Idle", "Building", "Enabled");
final AgentMetadataDTO agentMetadataDTO = new AgentMetadataConverterV1().toDTO(agentMetadata);
assertThat(agentMetadataDTO.elasticAgentId(), is("agent-id"));
assertThat(agentMetadataDTO.agentState(), is("Idle"));
assertThat(agentMetadataDTO.buildState(), is("Building"));
assertThat(agentMetadataDTO.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() throws JSONException {
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" + "]";
JSONAssert.assertEquals(expectedStr, responseBody, true);
}
Aggregations