@Override public void reportBuildStatus(String buildId, JobState buildState) { webSocketSessionHandler.sendAndWaitForAcknowledgement(new Message(Action.reportCurrentStatus, MessageEncoding.encodeData(new Report(agentRuntimeInfo, buildId, buildState, null)))); }
@Override public void reportCompleted(AgentRuntimeInfo agentRuntimeInfo, JobIdentifier jobIdentifier, JobResult result) { Report report = new Report(agentRuntimeInfo, jobIdentifier, result); webSocketSessionHandler.sendAndWaitForAcknowledgement(new Message(Action.reportCompleted, MessageEncoding.encodeData(report))); }
@Override public void reportCompleted(String buildId, JobResult buildResult) { Report report = new Report(agentRuntimeInfo, buildId, null, buildResult); webSocketSessionHandler.sendAndWaitForAcknowledgement(new Message(Action.reportCompleted, MessageEncoding.encodeData(report))); }
@Override public void reportCurrentStatus(AgentRuntimeInfo agentRuntimeInfo, JobIdentifier jobIdentifier, JobState jobState) { Report report = new Report(agentRuntimeInfo, jobIdentifier, jobState); webSocketSessionHandler.sendAndWaitForAcknowledgement(new Message(Action.reportCurrentStatus, MessageEncoding.encodeData(report))); }
@Override public void reportCompleting(AgentRuntimeInfo agentRuntimeInfo, JobIdentifier jobIdentifier, JobResult result) { Report report = new Report(agentRuntimeInfo, jobIdentifier, result); webSocketSessionHandler.sendAndWaitForAcknowledgement(new Message(Action.reportCompleting, MessageEncoding.encodeData(report))); }
@Override public void reportCompleting(String buildId, JobResult buildResult) { Report report = new Report(agentRuntimeInfo, buildId, null, buildResult); webSocketSessionHandler.sendAndWaitForAcknowledgement(new Message(Action.reportCompleting, MessageEncoding.encodeData(report))); } }
@Test public void encodeAndDecodeAsMessageData() throws Exception { AgentRuntimeInfo info = new AgentRuntimeInfo(new AgentIdentifier("HostName", "ipAddress", "uuid"), AgentRuntimeStatus.Idle, null, null, true); JobIdentifier jobIdentifier = new JobIdentifier("pipeline", 1, "pipelinelabel", "stagename", "1", "job", 1L); Report report = new Report(info, jobIdentifier, JobResult.Passed); assertThat(MessageEncoding.decodeData(MessageEncoding.encodeData(report), Report.class), is(report)); } }
assertThat(message.getAcknowledgementId(), notNullValue()); assertThat(message.getAction(), is(Action.reportCurrentStatus)); assertThat(message.getData(), is(MessageEncoding.encodeData(new Report(agentRuntimeInfo, "b001", JobState.Building, null)))); assertThat(jobCompletedMessage.getData(), is(MessageEncoding.encodeData(new Report(agentRuntimeInfo, "b001", null, JobResult.Passed))));
assertThat(message.getAcknowledgementId(), notNullValue()); assertThat(message.getAction(), is(Action.reportCurrentStatus)); assertThat(message.getData(), is(MessageEncoding.encodeData(new Report(agentRuntimeInfo, "b001", JobState.Building, null)))); assertThat(jobCompletedMessage.getData(), is(MessageEncoding.encodeData(new Report(agentRuntimeInfo, "b001", null, JobResult.Passed))));
assertThat(message.getAcknowledgementId(), notNullValue()); assertThat(message.getAction(), is(Action.reportCompleted)); assertThat(message.getData(), is(MessageEncoding.encodeData(new Report(agentRuntimeInfo, "b001", null, JobResult.Cancelled))));