You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ji...@apache.org on 2012/10/03 02:05:29 UTC
svn commit: r1393242 - in /incubator/ambari/branches/AMBARI-666: ./
ambari-server/src/main/java/org/apache/ambari/server/agent/
ambari-server/src/test/java/org/apache/ambari/server/agent/
Author: jitendra
Date: Wed Oct 3 00:05:28 2012
New Revision: 1393242
URL: http://svn.apache.org/viewvc?rev=1393242&view=rev
Log:
AMBARI-790. OK in registration response.
Modified:
incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/RegistrationResponse.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
Modified: incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt?rev=1393242&r1=1393241&r2=1393242&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt (original)
+++ incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt Wed Oct 3 00:05:28 2012
@@ -12,6 +12,8 @@ AMBARI-666 branch (unreleased changes)
NEW FEATURES
+ AMBARI-790. OK in registration response. (jitendra)
+
AMBARI-789. Prototype for management spi interface. (hitesh)
AMBARI-787. Registration throws HostNotFoundException for new hosts. (jitendra)
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java?rev=1393242&r1=1393241&r2=1393242&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java Wed Oct 3 00:05:28 2012
@@ -147,8 +147,10 @@ public class HeartBeatHandler {
hostObject.handleEvent(new HostStatusUpdatesReceivedEvent(hostname,
now));
} else {
- response.setCommand(cmds);
+ response.setCommands(cmds);
}
+ response.setResponseStatus(RegistrationStatus.OK);
+ response.setResponseId(0);
return response;
}
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/RegistrationResponse.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/RegistrationResponse.java?rev=1393242&r1=1393241&r2=1393242&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/RegistrationResponse.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/RegistrationResponse.java Wed Oct 3 00:05:28 2012
@@ -38,6 +38,11 @@ public class RegistrationResponse {
@XmlElement
private RegistrationStatus response;
+ //Response id to start with, usually zero.
+ @XmlElement
+ private long responseId;
+
+ @XmlElement
private List<StatusCommand> commands = null;
public RegistrationStatus getResponseStatus() {
@@ -48,11 +53,19 @@ public class RegistrationResponse {
this.response = response;
}
- public List<StatusCommand> getCommand() {
+ public List<StatusCommand> getCommands() {
return commands;
}
- public void setCommand(List<StatusCommand> commands) {
+ public void setCommands(List<StatusCommand> commands) {
this.commands = commands;
}
+
+ public long getResponseId() {
+ return responseId;
+ }
+
+ public void setResponseId(long responseId) {
+ this.responseId = responseId;
+ }
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java?rev=1393242&r1=1393241&r2=1393242&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java Wed Oct 3 00:05:28 2012
@@ -90,9 +90,12 @@ public class TestHeartbeatHandler {
hi.setOS("MegaOperatingSystem");
reg.setHostname(hostname);
reg.setHardwareProfile(hi);
- handler.handleRegistration(reg);
+ RegistrationResponse response = handler.handleRegistration(reg);
Host hostObject = fsm.getHost(hostname);
assertEquals(hostObject.getState(), HostState.HEALTHY);
assertEquals("MegaOperatingSystem", hostObject.getOsType());
+ assertEquals(RegistrationStatus.OK, response.getResponseStatus());
+ assertEquals(0, response.getResponseId());
+ assertEquals(null, response.getCommands());
}
}