You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by sm...@apache.org on 2014/05/12 19:22:14 UTC

svn commit: r1594031 - in /incubator/slider/trunk: app-packages/accumulo-v1_5/ app-packages/hbase-v0_96/ app-packages/storm-v0_91/ slider-agent/src/main/python/agent/ slider-core/src/main/java/org/apache/slider/providers/agent/ slider-core/src/main/jav...

Author: smohanty
Date: Mon May 12 17:22:13 2014
New Revision: 1594031

URL: http://svn.apache.org/r1594031
Log:
SLIDER 25. Have Slider-Agent report back the latest config of any type

Modified:
    incubator/slider/trunk/app-packages/accumulo-v1_5/appConfig.json
    incubator/slider/trunk/app-packages/hbase-v0_96/appConfig.json
    incubator/slider/trunk/app-packages/storm-v0_91/appConfig.json
    incubator/slider/trunk/slider-agent/src/main/python/agent/CustomServiceOrchestrator.py
    incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java
    incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/providers/agent/ComponentInstanceState.java
    incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/ComponentStatus.java
    incubator/slider/trunk/slider-core/src/test/groovy/org/apache/slider/agent/AgentMiniClusterTestBase.groovy
    incubator/slider/trunk/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/rest/publisher/TestPublisherRestResources.groovy
    incubator/slider/trunk/slider-core/src/test/java/org/apache/slider/providers/agent/TestAgentProviderService.java
    incubator/slider/trunk/src/site/markdown/debugging.md

Modified: incubator/slider/trunk/app-packages/accumulo-v1_5/appConfig.json
URL: http://svn.apache.org/viewvc/incubator/slider/trunk/app-packages/accumulo-v1_5/appConfig.json?rev=1594031&r1=1594030&r2=1594031&view=diff
==============================================================================
--- incubator/slider/trunk/app-packages/accumulo-v1_5/appConfig.json (original)
+++ incubator/slider/trunk/app-packages/accumulo-v1_5/appConfig.json Mon May 12 17:22:13 2014
@@ -4,7 +4,7 @@
   },
   "global": {
     "agent.conf": "/slider/agent/conf/agent.ini",
-    "application.def": "/slider/accumulo_v151.tar",
+    "application.def": "/slider/accumulo_v151.zip",
     "config_types": "accumulo-site",
     "java_home": "/usr/jdk64/jdk1.7.0_45",
     "package_list": "files/accumulo-1.5.1-bin.tar.gz",
@@ -45,27 +45,22 @@
   },
   "components": {
     "ACCUMULO_MASTER": {
-      "wait.heartbeat": "3",
-      "role.script": "scripts/accumulo_master.py"
+      "wait.heartbeat": "3"
     },
     "slider-appmaster": {
       "jvm.heapsize": "256M"
     },
     "ACCUMULO_TSERVER": {
-      "wait.heartbeat": "6",
-      "role.script": "scripts/accumulo_tserver.py"
+      "wait.heartbeat": "6"
     },
     "ACCUMULO_MONITOR": {
-      "wait.heartbeat": "8",
-      "role.script": "scripts/accumulo_monitor.py"
+      "wait.heartbeat": "8"
     },
     "ACCUMULO_GC": {
-      "wait.heartbeat": "6",
-      "role.script": "scripts/accumulo_gc.py"
+      "wait.heartbeat": "6"
     },
     "ACCUMULO_TRACER": {
-      "wait.heartbeat": "8",
-      "role.script": "scripts/accumulo_tracer.py"
+      "wait.heartbeat": "8"
     }
   }
 }

Modified: incubator/slider/trunk/app-packages/hbase-v0_96/appConfig.json
URL: http://svn.apache.org/viewvc/incubator/slider/trunk/app-packages/hbase-v0_96/appConfig.json?rev=1594031&r1=1594030&r2=1594031&view=diff
==============================================================================
--- incubator/slider/trunk/app-packages/hbase-v0_96/appConfig.json (original)
+++ incubator/slider/trunk/app-packages/hbase-v0_96/appConfig.json Mon May 12 17:22:13 2014
@@ -4,7 +4,7 @@
   },
   "global": {
     "agent.conf": "/slider/agent/conf/agent.ini",
-    "application.def": "/slider/hbase_v096.tar",
+    "application.def": "/slider/hbase_v096.zip",
     "config_types": "core-site,hdfs-site,hbase-site",
     "java_home": "/usr/jdk64/jdk1.7.0_45",
     "package_list": "files/hbase-0.96.1-hadoop2-bin.tar.gz",
@@ -54,15 +54,13 @@
   },
   "components": {
     "HBASE_MASTER": {
-      "wait.heartbeat": "5",
-      "role.script": "scripts/hbase_master.py"
+      "wait.heartbeat": "5"
     },
     "slider-appmaster": {
       "jvm.heapsize": "256M"
     },
     "HBASE_REGIONSERVER": {
-      "wait.heartbeat": "3",
-      "role.script": "scripts/hbase_regionserver.py"
+      "wait.heartbeat": "3"
     }
   }
 }

Modified: incubator/slider/trunk/app-packages/storm-v0_91/appConfig.json
URL: http://svn.apache.org/viewvc/incubator/slider/trunk/app-packages/storm-v0_91/appConfig.json?rev=1594031&r1=1594030&r2=1594031&view=diff
==============================================================================
--- incubator/slider/trunk/app-packages/storm-v0_91/appConfig.json (original)
+++ incubator/slider/trunk/app-packages/storm-v0_91/appConfig.json Mon May 12 17:22:13 2014
@@ -4,7 +4,7 @@
   },
   "global": {
     "agent.conf": "/slider/agent/conf/agent.ini",
-    "application.def": "/slider/storm_v091.tar",
+    "application.def": "/slider/storm_v091.zip",
     "config_types": "storm-site",
     "java_home": "/usr/jdk64/jdk1.7.0_45",
     "package_list": "files/apache-storm-0.9.1.2.1.1.0-237.tar.gz",
@@ -107,23 +107,18 @@
       "jvm.heapsize": "256M"
     },
     "NIMBUS": {
-      "role.script": "scripts/nimbus.py"
     },
     "STORM_REST_API": {
-      "wait.heartbeat": "3",
-      "role.script": "scripts/rest_api.py"
+      "wait.heartbeat": "3"
     },
     "STORM_UI_SERVER": {
-      "wait.heartbeat": "3",
-      "role.script": "scripts/ui_server.py"
+      "wait.heartbeat": "3"
     },
     "DRPC_SERVER": {
-      "wait.heartbeat": "7",
-      "role.script": "scripts/drpc_server.py"
+      "wait.heartbeat": "7"
     },
     "SUPERVISOR": {
-      "wait.heartbeat": "10",
-      "role.script": "scripts/supervisor.py"
+      "wait.heartbeat": "10"
     }
   }
 }

Modified: incubator/slider/trunk/slider-agent/src/main/python/agent/CustomServiceOrchestrator.py
URL: http://svn.apache.org/viewvc/incubator/slider/trunk/slider-agent/src/main/python/agent/CustomServiceOrchestrator.py?rev=1594031&r1=1594030&r2=1594031&view=diff
==============================================================================
--- incubator/slider/trunk/slider-agent/src/main/python/agent/CustomServiceOrchestrator.py (original)
+++ incubator/slider/trunk/slider-agent/src/main/python/agent/CustomServiceOrchestrator.py Mon May 12 17:22:13 2014
@@ -134,6 +134,26 @@ class CustomServiceOrchestrator():
       raise AgentException(message)
     return path
 
+  def getConfig(self, command):
+    if 'commandParams' in command and 'config_type' in command['commandParams']:
+      config_type = command['commandParams']['config_type']
+      logger.info("Requesting applied config for type {0}".format(config_type))
+      if config_type in self.applied_configs:
+        return {
+          'configurations': {config_type: self.applied_configs[config_type]}
+        }
+      else:
+        return {
+          'configurations': {}
+        }
+      pass
+    else:
+      logger.info("Requesting all applied config.")
+      return {
+        'configurations': self.applied_configs
+      }
+    pass
+
   def requestComponentStatus(self, command):
     """
      Component status is determined by exit code, returned by runCommand().
@@ -145,24 +165,7 @@ class CustomServiceOrchestrator():
       override_output_files = False
 
     if command['roleCommand'] == "GET_CONFIG":
-      if 'commandParams' in command and 'config_type' in command['commandParams']:
-        config_type = command['commandParams']['config_type']
-        logger.info("Requesting applied config for type {0}".format(config_type))
-        if config_type in self.applied_configs:
-          return {
-            'configurations': {config_type: self.applied_configs[config_type]}
-          }
-        else:
-          return {
-            'configurations': {}
-          }
-        pass
-      else:
-        logger.info("Requesting all applied config.")
-        return {
-          'configurations': self.applied_configs
-        }
-      pass
+      return self.getConfig(command)
 
     else:
       res = self.runCommand(command, self.status_commands_stdout,

Modified: incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java
URL: http://svn.apache.org/viewvc/incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java?rev=1594031&r1=1594030&r2=1594031&view=diff
==============================================================================
--- incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java (original)
+++ incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java Mon May 12 17:22:13 2014
@@ -39,8 +39,6 @@ import org.apache.slider.core.exceptions
 import org.apache.slider.core.launch.CommandLineBuilder;
 import org.apache.slider.core.launch.ContainerLauncher;
 import org.apache.slider.core.registry.docstore.PublishedConfiguration;
-import org.apache.slider.core.registry.info.RegisteredEndpoint;
-import org.apache.slider.core.registry.info.ServiceInstanceData;
 import org.apache.slider.providers.AbstractProviderService;
 import org.apache.slider.providers.ProviderCore;
 import org.apache.slider.providers.ProviderRole;
@@ -53,6 +51,7 @@ import org.apache.slider.server.appmaste
 import org.apache.slider.server.appmaster.web.rest.agent.AgentCommandType;
 import org.apache.slider.server.appmaster.web.rest.agent.AgentRestOperations;
 import org.apache.slider.server.appmaster.web.rest.agent.CommandReport;
+import org.apache.slider.server.appmaster.web.rest.agent.ComponentStatus;
 import org.apache.slider.server.appmaster.web.rest.agent.ExecutionCommand;
 import org.apache.slider.server.appmaster.web.rest.agent.HeartBeat;
 import org.apache.slider.server.appmaster.web.rest.agent.HeartBeatResponse;
@@ -92,6 +91,7 @@ public class AgentProviderService extend
   private static final ProviderUtils providerUtils = new ProviderUtils(log);
   private static final String LABEL_MAKER = "___";
   private static final String CONTAINER_ID = "container_id";
+  private static final String GLOBAL_CONFIG_TAG = "global";
   private AgentClientProvider clientProvider;
   private Map<String, ComponentInstanceState> componentStatuses = new HashMap<String, ComponentInstanceState>();
   private Map<String, List<String>> roleHostMapping = new HashMap<String, List<String>>();
@@ -147,7 +147,7 @@ public class AgentProviderService extend
     // No need to synchronize as there is low chance of multiple simultaneous reads
     if (metainfo == null) {
       metainfo = getApplicationMetainfo(fileSystem, appDef);
-      if(metainfo == null) {
+      if (metainfo == null) {
         log.error("metainfo.xml is unavailable or malformed at {}.", appDef);
         throw new SliderException("metainfo.xml is required in app package.");
       }
@@ -239,7 +239,7 @@ public class AgentProviderService extend
     log.info("Reading metainfo at {}", appDef);
     InputStream metainfoStream = SliderUtils.getApplicationResourceInputStream(
         fileSystem.getFileSystem(), new Path(appDef), "metainfo.xml");
-    if(metainfoStream == null) {
+    if (metainfoStream == null) {
       log.error("metainfo.xml is unavailable at {}.", appDef);
       throw new IOException("metainfo.xml is required in app package.");
     }
@@ -250,7 +250,7 @@ public class AgentProviderService extend
   }
 
   protected void publishComponentConfiguration(String name, String description,
-                                             Iterable<Map.Entry<String, String>> entries) {
+                                               Iterable<Map.Entry<String, String>> entries) {
     PublishedConfiguration pubconf = new PublishedConfiguration();
     pubconf.description = description;
     pubconf.putValues(entries);
@@ -368,12 +368,8 @@ public class AgentProviderService extend
     String roleName = getRoleName(label);
     String containerId = getContainerId(label);
     StateAccessForProviders accessor = getStateAccessor();
-    String scriptPath = null;
-
-    scriptPath = getScriptPathFromMetainfo(roleName);
+    String scriptPath = getScriptPathFromMetainfo(roleName);
 
-    //scriptPath = accessor.getInstanceDefinitionSnapshot().
-    //    getAppConfOperations().getComponentOpt(roleName, AgentKeys.COMPONENT_SCRIPT, null);
     if (scriptPath == null) {
       log.error("role.script is unavailable for " + roleName + ". Commands will not be sent.");
       return response;
@@ -382,7 +378,9 @@ public class AgentProviderService extend
     if (!componentStatuses.containsKey(label)) {
       return response;
     }
+
     ComponentInstanceState componentStatus = componentStatuses.get(label);
+    processReturnedStatus(heartBeat, componentStatus);
 
     List<CommandReport> reports = heartBeat.getReports();
     if (reports != null && !reports.isEmpty()) {
@@ -403,8 +401,8 @@ public class AgentProviderService extend
     }
 
     Command command = componentStatus.getNextCommand();
-    if (Command.NOP != command) {
-      try {
+    try {
+      if (Command.NOP != command) {
         componentStatus.commandIssued(command);
         if (command == Command.INSTALL) {
           log.info("Installing component ...");
@@ -413,15 +411,42 @@ public class AgentProviderService extend
           log.info("Starting component ...");
           addStartCommand(roleName, containerId, response, scriptPath);
         }
-      } catch (SliderException e) {
-        componentStatus.applyCommandResult(CommandResult.FAILED, command);
-        log.warn("Component instance failed operation.", e);
       }
+      // if there is no outstanding command then retrieve config
+      Boolean isMaster = isMaster(roleName);
+      if (isMaster && componentStatus.getState() == State.STARTED
+          && command == Command.NOP) {
+        if (!componentStatus.getConfigReported()) {
+          addGetConfigCommand(roleName, containerId, response);
+        }
+      }
+    } catch (SliderException e) {
+      componentStatus.applyCommandResult(CommandResult.FAILED, command);
+      log.warn("Component instance failed operation.", e);
     }
 
     return response;
   }
 
+  protected void processReturnedStatus(HeartBeat heartBeat, ComponentInstanceState componentStatus) {
+    List<ComponentStatus> statuses = heartBeat.getComponentStatus();
+    if (statuses != null && statuses.size() > 0) {
+      log.info("Processing {} status reports.", statuses.size());
+      for (ComponentStatus status : statuses) {
+        log.info("Status report: " + status.toString());
+        if (status.getConfigs() != null) {
+          for (String key : status.getConfigs().keySet()) {
+            if (!key.equals(GLOBAL_CONFIG_TAG)) {
+              Map<String, String> configs = status.getConfigs().get(key);
+              publishComponentConfiguration(key, key, configs.entrySet());
+            }
+          }
+          componentStatus.setConfigReported(true);
+        }
+      }
+    }
+  }
+
   protected String getScriptPathFromMetainfo(String roleName) {
     String scriptPath = null;
     List<Service> services = getMetainfo().getServices();
@@ -438,6 +463,26 @@ public class AgentProviderService extend
     return scriptPath;
   }
 
+  protected Boolean isMaster(String roleName) throws SliderException {
+    String scriptPath = null;
+    List<Service> services = getMetainfo().getServices();
+    if (services.size() != 1) {
+      log.error("Malformed app definition: Expect only one service in the metainfo.xml");
+    } else {
+      Service service = services.get(0);
+      for (Component component : service.getComponents()) {
+        if (component.getName().equals(roleName)) {
+          if (component.getCategory().equals("MASTER")) {
+            return true;
+          } else {
+            return false;
+          }
+        }
+      }
+    }
+    throw new SliderException(String.format("Rolename %s not found in metainfo.xml", roleName));
+  }
+
   private String getRoleName(String label) {
     return label.substring(label.indexOf(LABEL_MAKER) + LABEL_MAKER.length());
   }
@@ -610,7 +655,7 @@ public class AgentProviderService extend
     // for now, reading this from appConf.  In the future, modify this method to
     // process metainfo.xml
     List<String> configList = new ArrayList<String>();
-    configList.add("global");
+    configList.add(GLOBAL_CONFIG_TAG);
 
     String configTypes = appConf.get("config_types");
     String[] configs = configTypes.split(",");
@@ -625,7 +670,7 @@ public class AgentProviderService extend
                                      Map<String, Map<String, String>> configurations,
                                      Map<String, String> tokens) {
     Map<String, String> config = new HashMap<String, String>();
-    if (configName.equals("global")) {
+    if (configName.equals(GLOBAL_CONFIG_TAG)) {
       addDefaultGlobalConfig(config);
     }
     // add role hosts to tokens
@@ -669,10 +714,10 @@ public class AgentProviderService extend
           registry.listInstancesByType(SliderKeys.APP_TYPE);
       assert services.size() >= 1;
       Map payload = (Map) services.get(0);
-      Map<String,Map> endpointMap =
-          (Map<String,Map>) ((Map)payload.get("externalView")).get("endpoints");
-      for (Map.Entry<String,Map> endpoint : endpointMap.entrySet()) {
-        Map<String,String> val = endpoint.getValue();
+      Map<String, Map> endpointMap =
+          (Map<String, Map>) ((Map) payload.get("externalView")).get("endpoints");
+      for (Map.Entry<String, Map> endpoint : endpointMap.entrySet()) {
+        Map<String, String> val = endpoint.getValue();
         if ("http".equals(val.get("protocol"))) {
           URL url = new URL(val.get("value"));
           details.put(val.get("description"), url);

Modified: incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/providers/agent/ComponentInstanceState.java
URL: http://svn.apache.org/viewvc/incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/providers/agent/ComponentInstanceState.java?rev=1594031&r1=1594030&r2=1594031&view=diff
==============================================================================
--- incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/providers/agent/ComponentInstanceState.java (original)
+++ incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/providers/agent/ComponentInstanceState.java Mon May 12 17:22:13 2014
@@ -29,13 +29,13 @@ public class ComponentInstanceState {
   private static int MAX_FAILURE_TOLERATED = 3;
   private static String INVALID_TRANSITION_ERROR =
       "Result {0} for command {1} is not expected for component {2} in state {3}.";
-  private State state = State.INIT;
-  private State targetState = State.STARTED;
-  private int failuresSeen = 0;
   private final String compName;
   private final String containerId;
   private final String applicationId;
-
+  private State state = State.INIT;
+  private State targetState = State.STARTED;
+  private int failuresSeen = 0;
+  private Boolean configReported = false;
 
   public ComponentInstanceState(String compName,
                                 String containerId,
@@ -45,6 +45,14 @@ public class ComponentInstanceState {
     this.applicationId = applicationId;
   }
 
+  public Boolean getConfigReported() {
+    return configReported;
+  }
+
+  public void setConfigReported(Boolean configReported) {
+    this.configReported = configReported;
+  }
+
   public void commandIssued(Command command) {
     Command expected = getNextCommand();
     if (expected != command) {

Modified: incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/ComponentStatus.java
URL: http://svn.apache.org/viewvc/incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/ComponentStatus.java?rev=1594031&r1=1594030&r2=1594031&view=diff
==============================================================================
--- incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/ComponentStatus.java (original)
+++ incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/ComponentStatus.java Mon May 12 17:22:13 2014
@@ -17,6 +17,7 @@
 package org.apache.slider.server.appmaster.web.rest.agent;
 
 import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.annotate.JsonProperty;
 import org.codehaus.jackson.map.annotate.JsonSerialize;
 
 import java.util.Map;
@@ -32,8 +33,18 @@ public class ComponentStatus {
   String status;
   String serviceName;
   String clusterName;
+  String roleCommand;
+  @JsonProperty("configurations")
   private Map<String, Map<String, String>> configurations;
 
+  public String getRoleCommand() {
+    return roleCommand;
+  }
+
+  public void setRoleCommand(String roleCommand) {
+    this.roleCommand = roleCommand;
+  }
+
   public String getComponentName() {
     return this.componentName;
   }
@@ -75,13 +86,13 @@ public class ComponentStatus {
   }
 
   /** @return the config tags that match this command, or <code>null</code> if none are present */
-  public Map<String, Map<String, String>> getConfiguration() {
+  public Map<String, Map<String, String>> getConfigs() {
     return configurations;
   }
 
-  /** @param configurations the config tags that match this status */
-  public void setConfiguration(Map<String, Map<String, String>> configurations) {
-    this.configurations = configurations;
+  /** @param configs the config tags that match this status */
+  public void setConfigs(Map<String, Map<String, String>> configs) {
+    this.configurations = configs;
   }
 
   @Override
@@ -92,6 +103,7 @@ public class ComponentStatus {
            ", status='" + status + '\'' +
            ", serviceName='" + serviceName + '\'' +
            ", clusterName='" + clusterName + '\'' +
+           ", roleCommand='" + roleCommand + '\'' +
            '}';
   }
 }

Modified: incubator/slider/trunk/slider-core/src/test/groovy/org/apache/slider/agent/AgentMiniClusterTestBase.groovy
URL: http://svn.apache.org/viewvc/incubator/slider/trunk/slider-core/src/test/groovy/org/apache/slider/agent/AgentMiniClusterTestBase.groovy?rev=1594031&r1=1594030&r2=1594031&view=diff
==============================================================================
--- incubator/slider/trunk/slider-core/src/test/groovy/org/apache/slider/agent/AgentMiniClusterTestBase.groovy (original)
+++ incubator/slider/trunk/slider-core/src/test/groovy/org/apache/slider/agent/AgentMiniClusterTestBase.groovy Mon May 12 17:22:13 2014
@@ -48,9 +48,8 @@ public abstract class AgentMiniClusterTe
     agentConf.createNewFile()
     agentDef = new File(destDir, "agentdef")
     agentDef.createNewFile()
-    imagePath = new File(destDir, "imagePath.tar.gz")
-    imagePath.createNewFile()
-    
+    File slider_dir = new File(new File(".").absoluteFile, "src/test/python");
+    imagePath = new File(slider_dir, "appdef_1.zip")
   }
   @Override
   public String getTestConfigurationPath() {
@@ -89,7 +88,7 @@ public abstract class AgentMiniClusterTe
    */
   @Override
   List<String> getImageCommands() {
-    [Arguments.ARG_IMAGE, imagePath.toURI().toString()]
+    [Arguments.ARG_IMAGE, agentDef.toURI().toString()]
   }
 
 /**
@@ -113,8 +112,8 @@ public abstract class AgentMiniClusterTe
         deleteExistingData,
         blockUntilRunning,
         [
-            (AgentKeys.APP_DEF): agentConf.toURI().toString(),
-            (AgentKeys.AGENT_CONF): agentDef.toURI().toString()
+            (AgentKeys.APP_DEF): imagePath.toURI().toString(),
+            (AgentKeys.AGENT_CONF): agentConf.toURI().toString()
         ])
   }
 

Modified: incubator/slider/trunk/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/rest/publisher/TestPublisherRestResources.groovy
URL: http://svn.apache.org/viewvc/incubator/slider/trunk/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/rest/publisher/TestPublisherRestResources.groovy?rev=1594031&r1=1594030&r2=1594031&view=diff
==============================================================================
--- incubator/slider/trunk/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/rest/publisher/TestPublisherRestResources.groovy (original)
+++ incubator/slider/trunk/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/rest/publisher/TestPublisherRestResources.groovy Mon May 12 17:22:13 2014
@@ -58,7 +58,7 @@ class TestPublisherRestResources extends
         false)
     Map<String, Integer> roles = [:]
     File slider_core = new File(new File(".").absoluteFile, "src/test/python");
-    String app_def = "appdef_1.tar"
+    String app_def = "appdef_1.zip"
     File app_def_path = new File(slider_core, app_def)
     String agt_ver = "version"
     File agt_ver_path = new File(slider_core, agt_ver)

Modified: incubator/slider/trunk/slider-core/src/test/java/org/apache/slider/providers/agent/TestAgentProviderService.java
URL: http://svn.apache.org/viewvc/incubator/slider/trunk/slider-core/src/test/java/org/apache/slider/providers/agent/TestAgentProviderService.java?rev=1594031&r1=1594030&r2=1594031&view=diff
==============================================================================
--- incubator/slider/trunk/slider-core/src/test/java/org/apache/slider/providers/agent/TestAgentProviderService.java (original)
+++ incubator/slider/trunk/slider-core/src/test/java/org/apache/slider/providers/agent/TestAgentProviderService.java Mon May 12 17:22:13 2014
@@ -44,6 +44,7 @@ import org.apache.slider.server.appmaste
 import org.apache.slider.server.appmaster.model.mock.MockFileSystem;
 import org.apache.slider.server.appmaster.model.mock.MockNodeId;
 import org.apache.slider.server.appmaster.state.StateAccessForProviders;
+import org.apache.slider.server.appmaster.web.rest.agent.ComponentStatus;
 import org.apache.slider.server.appmaster.web.rest.agent.HeartBeat;
 import org.apache.slider.server.appmaster.web.rest.agent.HeartBeatResponse;
 import org.apache.slider.server.appmaster.web.rest.agent.Register;
@@ -57,6 +58,8 @@ import org.slf4j.LoggerFactory;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -65,8 +68,11 @@ import static org.easymock.EasyMock.anyO
 import static org.easymock.EasyMock.createNiceMock;
 import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
 import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyCollection;
 import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.atLeastOnce;
 import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.eq;
@@ -116,6 +122,7 @@ public class TestAgentProviderService {
     doReturn(new Metainfo()).when(mockAps).getApplicationMetainfo(any(SliderFileSystem.class), anyString());
 
     try {
+      doReturn(true).when(mockAps).isMaster(anyString());
       doNothing().when(mockAps).addInstallCommand(
           eq("HBASE_MASTER"),
           eq("mockcontainer_1"),
@@ -183,6 +190,31 @@ public class TestAgentProviderService {
   }
 
   @Test
+  public void testProcessConfig() throws Exception {
+    AgentProviderService aps = new AgentProviderService();
+    HeartBeat hb = new HeartBeat();
+    ComponentStatus status = new ComponentStatus();
+    status.setClusterName("test");
+    status.setComponentName("HBASE_MASTER");
+    status.setRoleCommand("GET_CONFIG");
+    Map<String, String> hbaseSite = new HashMap<String, String>();
+    hbaseSite.put("a", "b");
+    hbaseSite.put("c", "d");
+    Map<String, Map<String, String>> configs = new HashMap<String,Map<String, String>>();
+    configs.put("hbase-site", hbaseSite);
+    configs.put("global", hbaseSite);
+    status.setConfigs(configs);
+    hb.setComponentStatus(new ArrayList<ComponentStatus>(Arrays.asList(status)));
+
+    ComponentInstanceState componentStatus = new ComponentInstanceState("HBASE_MASTER", "aid", "cid");
+    AgentProviderService mockAps = Mockito.spy(aps);
+    doNothing().when(mockAps).publishComponentConfiguration(anyString(), anyString(), anyCollection());
+    mockAps.processReturnedStatus(hb, componentStatus);
+    assert componentStatus.getConfigReported() == true;
+    Mockito.verify(mockAps, Mockito.times(1)).publishComponentConfiguration(anyString(), anyString(), anyCollection());
+  }
+
+  @Test
   public void testMetainfoParsing() throws Exception {
     String metainfo_1_str = "<metainfo>\n"
                             + "  <schemaVersion>2.0</schemaVersion>\n"

Modified: incubator/slider/trunk/src/site/markdown/debugging.md
URL: http://svn.apache.org/viewvc/incubator/slider/trunk/src/site/markdown/debugging.md?rev=1594031&r1=1594030&r2=1594031&view=diff
==============================================================================
--- incubator/slider/trunk/src/site/markdown/debugging.md (original)
+++ incubator/slider/trunk/src/site/markdown/debugging.md Mon May 12 17:22:13 2014
@@ -74,7 +74,7 @@ irrespective of what the path leading to
 
 ## IDE-based remote debugging of the Application Master
 
-For situtations in which the logging does not yield enough information to debug an issue,
+For situations in which the logging does not yield enough information to debug an issue,
 the user has the option of specifying JVM command line options for the
 Application Master that enable attaching to the running process with a debugger
 (e.g. the remote debugging facilities in Eclipse or Intellij IDEA).