use of com.thoughtworks.go.domain.notificationdata.AgentNotificationData in project gocd by gocd.
the class AgentStatusChangeNotifierTest method shouldNotifyIfAgentIsElastic.
@Test
public void shouldNotifyIfAgentIsElastic() throws Exception {
ElasticAgentRuntimeInfo agentRuntimeInfo = new ElasticAgentRuntimeInfo(new AgentIdentifier("localhost", "127.0.0.1", "uuid"), AgentRuntimeStatus.Idle, "/foo/one", null, "42", "go.cd.elastic-agent-plugin.docker");
AgentConfig agentConfig = new AgentConfig();
agentConfig.setElasticAgentId("42");
agentConfig.setElasticPluginId("go.cd.elastic-agent-plugin.docker");
agentConfig.setIpAddress("127.0.0.1");
AgentInstance agentInstance = AgentInstance.createFromConfig(agentConfig, new SystemEnvironment(), mock(AgentStatusChangeListener.class));
agentInstance.update(agentRuntimeInfo);
when(notificationPluginRegistry.isAnyPluginInterestedIn("agent-status")).thenReturn(true);
agentStatusChangeNotifier.onAgentStatusChange(agentInstance);
verify(pluginNotificationQueue).post(captor.capture());
assertThat(captor.getValue().getData() instanceof AgentNotificationData, is(true));
AgentNotificationData data = (AgentNotificationData) captor.getValue().getData();
assertTrue(data.isElastic());
}
Aggregations