You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by st...@apache.org on 2014/10/10 01:01:54 UTC

[1/4] git commit: SLIDER-222 Enhance registry command with --out option

Repository: incubator-slider
Updated Branches:
  refs/heads/develop b8c3546aa -> e39d99e19


SLIDER-222 Enhance registry command with --out option


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/fa53ef91
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/fa53ef91
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/fa53ef91

Branch: refs/heads/develop
Commit: fa53ef91c982eaced4dde327b79af5f32be24416
Parents: 2553f15
Author: Steve Loughran <st...@apache.org>
Authored: Wed Oct 8 17:16:30 2014 -0700
Committer: Steve Loughran <st...@apache.org>
Committed: Wed Oct 8 17:16:30 2014 -0700

----------------------------------------------------------------------
 .../java/org/apache/slider/client/SliderClient.java    | 13 ++++++-------
 .../slider/common/params/ActionRegistryArgs.java       | 10 +++++-----
 .../org/apache/slider/common/params/Arguments.java     |  4 +++-
 .../hbase/funtest/FunctionalHBaseClusterIT.groovy      |  2 +-
 4 files changed, 15 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/fa53ef91/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java b/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
index 8b44870..7daa2b8 100644
--- a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
+++ b/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
@@ -2701,16 +2701,15 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
     PublishedConfigurationOutputter outputter =
         PublishedConfigurationOutputter.createOutputter(configFormat,
             published);
-    boolean print = registryArgs.dest == null;
+    boolean print = registryArgs.out == null;
     if (!print) {
-      File destFile;
-      destFile = registryArgs.dest;
-      if (destFile.isDirectory()) {
+      File outputPath = registryArgs.out;
+      if (outputPath.isDirectory()) {
         // creating it under a directory
-        destFile = new File(destFile, entry + "." + format);
+        outputPath = new File(outputPath, entry + "." + format);
       }
-      log.info("Destination path: {}", destFile);
-      outputter.save(destFile);
+      log.debug("Destination path: {}", outputPath);
+      outputter.save(outputPath);
     } else {
       print(outputter.asString());
     }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/fa53ef91/slider-core/src/main/java/org/apache/slider/common/params/ActionRegistryArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionRegistryArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionRegistryArgs.java
index 6de9a45..df40ef1 100644
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionRegistryArgs.java
+++ b/slider-core/src/main/java/org/apache/slider/common/params/ActionRegistryArgs.java
@@ -104,7 +104,7 @@ public class ActionRegistryArgs extends AbstractActionArgs {
 
   @Parameter(names = {ARG_OUTPUT, ARG_OUTPUT_SHORT, ARG_DEST},
       description = "Output destination")
-  public File dest;
+  public File out;
 
   @Parameter(names = {ARG_NAME},
       description = "name of an instance")
@@ -137,8 +137,8 @@ public class ActionRegistryArgs extends AbstractActionArgs {
     if (set > 1) {
       throw new UsageException(USAGE);
     }
-    if (dest != null && (lists > 0 || set == 0)) {
-      throw new UsageException("Argument " + ARG_DEST
+    if (out != null && (lists > 0 || set == 0)) {
+      throw new UsageException("output path"
            + " is only supported on 'get' operations: " + USAGE);
     }
     if (!list && !is(name)) {
@@ -190,8 +190,8 @@ public class ActionRegistryArgs extends AbstractActionArgs {
     sb.append(ifdef(ARG_VERBOSE, verbose));
     sb.append(ifdef(ARG_INTERNAL, internal));
 
-    if (dest != null) {
-      sb.append(ifdef(ARG_DEST, dest.toString()));
+    if (out != null) {
+      sb.append(ifdef(ARG_OUTPUT, out.toString()));
     }
     sb.append(ifdef(ARG_FORMAT, format));
 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/fa53ef91/slider-core/src/main/java/org/apache/slider/common/params/Arguments.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/Arguments.java b/slider-core/src/main/java/org/apache/slider/common/params/Arguments.java
index bbd7da6..4deebd7 100644
--- a/slider-core/src/main/java/org/apache/slider/common/params/Arguments.java
+++ b/slider-core/src/main/java/org/apache/slider/common/params/Arguments.java
@@ -32,8 +32,10 @@ public interface Arguments {
   String ARG_COMP_OPT_SHORT = "--co";
   
   String ARG_DEBUG = "--debug";
-  String ARG_DEST = "--dest";
   String ARG_DEFINE = "-D";
+  String ARG_DEST = "--dest";
+  String ARG_DESTDIR = "--destdir";
+  String ARG_DESTFILE = "--destfile";
   String ARG_EXITCODE = "--exitcode";
   /**
    filesystem-uri: {@value}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/fa53ef91/slider-providers/hbase/hbase-funtests/src/test/groovy/org/apache/slider/providers/hbase/funtest/FunctionalHBaseClusterIT.groovy
----------------------------------------------------------------------
diff --git a/slider-providers/hbase/hbase-funtests/src/test/groovy/org/apache/slider/providers/hbase/funtest/FunctionalHBaseClusterIT.groovy b/slider-providers/hbase/hbase-funtests/src/test/groovy/org/apache/slider/providers/hbase/funtest/FunctionalHBaseClusterIT.groovy
index 5137101..3b8d1f9 100644
--- a/slider-providers/hbase/hbase-funtests/src/test/groovy/org/apache/slider/providers/hbase/funtest/FunctionalHBaseClusterIT.groovy
+++ b/slider-providers/hbase/hbase-funtests/src/test/groovy/org/apache/slider/providers/hbase/funtest/FunctionalHBaseClusterIT.groovy
@@ -210,7 +210,7 @@ public class FunctionalHBaseClusterIT extends HBaseCommandTestBase
     getConfDir.mkdirs();
     registry([ARG_GETCONF, yarn_site_config,
               ARG_NAME, name,
-              ARG_DEST, getConfDir.absolutePath])
+              ARG_OUTPUT, getConfDir.absolutePath])
     File retrieved = new File(getConfDir, yarn_site_config +".xml")
     def confFromFile = ConfigHelper.loadConfFromFile(retrieved)
     assert confFromFile.get(YarnConfiguration.RM_ADDRESS)


[3/4] git commit: SLIDER-365 slider "resolve" command : more tests, more fixes

Posted by st...@apache.org.
SLIDER-365 slider "resolve" command : more tests, more fixes


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/67b38362
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/67b38362
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/67b38362

Branch: refs/heads/develop
Commit: 67b383620f70244412d5d6765c1da1bb278cc970
Parents: bfaea96
Author: Steve Loughran <st...@apache.org>
Authored: Thu Oct 9 15:50:45 2014 -0700
Committer: Steve Loughran <st...@apache.org>
Committed: Thu Oct 9 15:50:45 2014 -0700

----------------------------------------------------------------------
 .../org/apache/slider/client/SliderClient.java  |  8 ++-
 .../slider/common/params/ActionResolveArgs.java | 14 +----
 .../slider/common/params/SliderActions.java     |  2 +
 .../TestStandaloneYarnRegistryAM.groovy         | 63 ++++++++++++++++----
 .../apache/slider/test/SliderTestUtils.groovy   |  2 +-
 5 files changed, 62 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/67b38362/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java b/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
index 2944e2a..476f300 100644
--- a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
+++ b/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
@@ -22,6 +22,7 @@ import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
 import org.apache.commons.lang.StringUtils;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileUtil;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.PathNotFoundException;
 import org.apache.hadoop.fs.permission.FsPermission;
@@ -2206,6 +2207,9 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
     try {
       if (args.list) {
         File destDir = args.destdir;
+        if (destDir != null) {
+          destDir.mkdirs();
+        }
 
         Map<String, ServiceRecord> recordMap =
             listServiceRecords(operations, path);
@@ -2237,12 +2241,14 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
           print(serviceRecordMarshal.toJson(instance));
         }
       }
-//      JDK7
+//      TODO JDK7
     } catch (PathNotFoundException e) {
       // no record at this path
       return EXIT_NOT_FOUND;
     } catch (NoRecordException e) {
       return EXIT_NOT_FOUND;
+    } catch (UnknownApplicationInstanceException e) {
+      return EXIT_NOT_FOUND;
     } catch (InvalidRecordException e) {
       // it is not a record
       log.error("{}", e);

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/67b38362/slider-core/src/main/java/org/apache/slider/common/params/ActionResolveArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionResolveArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionResolveArgs.java
index 944be1b..4759bcb 100644
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionResolveArgs.java
+++ b/slider-core/src/main/java/org/apache/slider/common/params/ActionResolveArgs.java
@@ -38,7 +38,7 @@ import static org.apache.slider.common.params.SliderActions.DESCRIBE_ACTION_REGI
  * --verbose
  * --list
  */
-@Parameters(commandNames = {ACTION_REGISTRY},
+@Parameters(commandNames = {ACTION_RESOLVE},
             commandDescription = DESCRIBE_ACTION_REGISTRY)
 public class ActionResolveArgs extends AbstractActionArgs {
 
@@ -47,7 +47,6 @@ public class ActionResolveArgs extends AbstractActionArgs {
       + " "
       + ARG_PATH + " <path> "
       + "[" + ARG_LIST + "] "
-      + "[" + ARG_VERBOSE + "] "
       + "[" + ARG_OUTPUT + " <filename> ] "
       + "[" + ARG_DESTDIR + " <directory> ] "
       ;
@@ -84,10 +83,6 @@ public class ActionResolveArgs extends AbstractActionArgs {
       description = "dest file")
   public File out;
 
- @Parameter(names = {ARG_VERBOSE},
-      description = "verbose output")
-  public boolean verbose;
-
   @Override
   public String toString() {
     final StringBuilder sb =
@@ -156,11 +151,4 @@ public class ActionResolveArgs extends AbstractActionArgs {
     this.out = out;
   }
 
-  public boolean isVerbose() {
-    return verbose;
-  }
-
-  public void setVerbose(boolean verbose) {
-    this.verbose = verbose;
-  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/67b38362/slider-core/src/main/java/org/apache/slider/common/params/SliderActions.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/SliderActions.java b/slider-core/src/main/java/org/apache/slider/common/params/SliderActions.java
index 0c37b94..abb669a 100644
--- a/slider-core/src/main/java/org/apache/slider/common/params/SliderActions.java
+++ b/slider-core/src/main/java/org/apache/slider/common/params/SliderActions.java
@@ -72,6 +72,8 @@ public interface SliderActions {
                     "Monitor a running application";
   String DESCRIBE_ACTION_REGISTRY =
                       "Query the registry of a YARN application";
+  String DESCRIBE_ACTION_RESOLVE =
+                      "Resolve or list records in the YARN registry";
   String DESCRIBE_ACTION_STATUS =
                       "Get the status of an application";
   String DESCRIBE_ACTION_THAW =

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/67b38362/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneYarnRegistryAM.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneYarnRegistryAM.groovy b/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneYarnRegistryAM.groovy
index ca200fd..700a6d8 100644
--- a/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneYarnRegistryAM.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneYarnRegistryAM.groovy
@@ -20,9 +20,9 @@ package org.apache.slider.agent.standalone
 
 import groovy.transform.CompileStatic
 import groovy.util.logging.Slf4j
-import org.apache.commons.io.IOUtils
 import org.apache.hadoop.fs.FileUtil
 import org.apache.hadoop.fs.PathNotFoundException
+import org.apache.hadoop.registry.client.binding.RegistryPathUtils
 import org.apache.hadoop.yarn.api.records.ApplicationReport
 import org.apache.hadoop.yarn.api.records.YarnApplicationState
 import org.apache.hadoop.yarn.conf.YarnConfiguration
@@ -187,11 +187,10 @@ class TestStandaloneYarnRegistryAM extends AgentMiniClusterTestBase {
     File resolveListDir= new File(destDir, "list")
     ActionResolveArgs resolveList = new ActionResolveArgs(
         path:recordsPath,
-        list:true,
-        verbose:true)
+        list:true)
 
     // to stdout
-    client.actionResolve(resolveList)
+    assert 0 == client.actionResolve(resolveList)
     // to a file
     resolveList.out = resolveListDir;
     try {
@@ -200,16 +199,47 @@ class TestStandaloneYarnRegistryAM extends AgentMiniClusterTestBase {
       assertExceptionDetails(ex, LauncherExitCodes.EXIT_COMMAND_ARGUMENT_ERROR,
           Arguments.ARG_OUTPUT)
     }
+    
+    // list to a destination dir
     resolveList.out = null
     resolveList.destdir = resolveListDir
-    client.actionResolve(resolveList)
-    File resolvedFile = new File(resolveListDir, clustername+".json")
+    assert 0 == client.actionResolve(resolveList)
+    File resolvedFile = new File(resolveListDir, clustername + ".json")
     assertFileExists("resolved file", resolvedFile)
-    def recordFromList = serviceRecordMarshal.fromFile(resolvedFile)
+    serviceRecordMarshal.fromFile(resolvedFile)
+
+    // list the parent path, expect success and no entries
+    File listParentDir = new File(destDir, "listParent")
+    String parentPath = RegistryPathUtils.parentOf(recordsPath)
+    assert 0 == client.actionResolve(new ActionResolveArgs(
+        path: parentPath,
+        list: true,
+        destdir: listParentDir))
+    assertFileExists("output dir", listParentDir)
+    assert null != listParentDir.list()
+    assert 0 == listParentDir.list().length
+
+    // look for a record a path not in the registry expect failure
+    ActionResolveArgs listUnknownPath = new ActionResolveArgs(
+        path: recordsPath +"/unknown",
+        list: true)
+    // the record is not there, even if the path is
+    assert SliderExitCodes.EXIT_NOT_FOUND == client.actionResolve(
+        listUnknownPath)
+    
     
+    // look for a record at the same path as the listing; expect failure
+    ActionResolveArgs resolveRecordAtListPath = new ActionResolveArgs(
+        path: recordsPath,
+        list: false)
+    // the record is not there, even if the path is
+    assert SliderExitCodes.EXIT_NOT_FOUND == client.actionResolve(
+        resolveRecordAtListPath)
+
     // look at a single record
+    def instanceRecordPath = recordsPath + "/" + clustername
     ActionResolveArgs resolveRecordCommand = new ActionResolveArgs(
-        path: recordsPath + "/" + clustername)
+        path: instanceRecordPath)
     // to stdout
     client.actionResolve(resolveRecordCommand)
     
@@ -218,7 +248,7 @@ class TestStandaloneYarnRegistryAM extends AgentMiniClusterTestBase {
     File singleFile = new File(destDir, "singlefile.json")
     singleFile.delete()
     resolveRecordCommand.out = singleFile
-    client.actionResolve(resolveRecordCommand)
+    assert 0 == client.actionResolve(resolveRecordCommand)
     assertFileExists("\"slider $resolveRecordCommand\"", singleFile)
     def recordFromFile = serviceRecordMarshal.fromFile(singleFile)
     assert recordFromFile[YarnRegistryAttributes.YARN_ID] ==
@@ -231,9 +261,18 @@ class TestStandaloneYarnRegistryAM extends AgentMiniClusterTestBase {
         CustomRegistryConstants.REGISTRY_REST_API)
     assert registryEndpoint != null
     def registryURL = RegistryTypeUtils.retrieveAddressURLs(registryEndpoint)[0]
-    
-    
-    // Look at the Registry WADL
+
+    // list the path at the record, expect success and no entries
+    File listUnderRecordDir = new File(destDir, "listUnderRecord")
+    ActionResolveArgs listUnderRecordCommand = new ActionResolveArgs(
+        path: instanceRecordPath,
+        list:true,
+        destdir: listUnderRecordDir)
+    assert 0 == client.actionResolve(listUnderRecordCommand)
+    assert 0 == listUnderRecordDir.list().length
+
+
+           // Look at the Registry WADL
     describe("Registry WADL @ $registryURL")
     def publisherEndpoint = serviceRecord.getExternalEndpoint(
         CustomRegistryConstants.PUBLISHER_REST_API)

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/67b38362/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy b/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy
index d09d280..61dfeb5 100644
--- a/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy
@@ -807,7 +807,7 @@ class SliderTestUtils extends Assert {
       StringBuilder builder = new StringBuilder()
       builder.append("${parent.absolutePath}:\n")
       files.each { String name-> builder.append("  $name\n")}
-      throw new FileNotFoundException("$text: file $file not found in $builder")
+      throw new FileNotFoundException("$text: $file not found in $builder")
     }
   }
 }


[4/4] git commit: Merge branch 'feature/SLIDER-365-resolve-command' into develop

Posted by st...@apache.org.
Merge branch 'feature/SLIDER-365-resolve-command' into develop


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/e39d99e1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/e39d99e1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/e39d99e1

Branch: refs/heads/develop
Commit: e39d99e1943cc4d000fa4796478dad2387da2ef3
Parents: b8c3546 67b3836
Author: Steve Loughran <st...@apache.org>
Authored: Thu Oct 9 16:01:45 2014 -0700
Committer: Steve Loughran <st...@apache.org>
Committed: Thu Oct 9 16:01:45 2014 -0700

----------------------------------------------------------------------
 .../org/apache/slider/client/SliderClient.java  |  78 ++++++-------
 .../common/params/ActionRegistryArgs.java       |  10 +-
 .../slider/common/params/ActionResolveArgs.java |  91 ++++++++++++++--
 .../apache/slider/common/params/Arguments.java  |   4 +-
 .../slider/common/params/SliderActions.java     |   2 +
 .../TestStandaloneYarnRegistryAM.groovy         | 109 ++++++++++++++-----
 .../apache/slider/test/SliderTestUtils.groovy   |  21 +++-
 .../funtest/FunctionalHBaseClusterIT.groovy     |   2 +-
 8 files changed, 229 insertions(+), 88 deletions(-)
----------------------------------------------------------------------



[2/4] git commit: SLIDER-365 slider "resolve" command to retrieve service record

Posted by st...@apache.org.
SLIDER-365 slider "resolve" command to retrieve service record


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/bfaea962
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/bfaea962
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/bfaea962

Branch: refs/heads/develop
Commit: bfaea9629ed7aa11e6c882e4a7533cc081cfc9dc
Parents: fa53ef9
Author: Steve Loughran <st...@apache.org>
Authored: Thu Oct 9 11:29:10 2014 -0700
Committer: Steve Loughran <st...@apache.org>
Committed: Thu Oct 9 11:32:26 2014 -0700

----------------------------------------------------------------------
 .../org/apache/slider/client/SliderClient.java  | 57 +++++-------
 .../slider/common/params/ActionResolveArgs.java | 95 ++++++++++++++++++--
 .../TestStandaloneYarnRegistryAM.groovy         | 64 ++++++++-----
 .../apache/slider/test/SliderTestUtils.groovy   | 21 ++++-
 4 files changed, 171 insertions(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/bfaea962/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java b/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
index 7daa2b8..2944e2a 100644
--- a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
+++ b/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
@@ -28,6 +28,7 @@ import org.apache.hadoop.fs.permission.FsPermission;
 import org.apache.hadoop.hdfs.DFSConfigKeys;
 import org.apache.hadoop.hdfs.HdfsConfiguration;
 import org.apache.hadoop.net.NetUtils;
+import org.apache.hadoop.registry.client.binding.RegistryPathUtils;
 import org.apache.hadoop.registry.client.exceptions.InvalidRecordException;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.security.alias.CredentialProvider;
@@ -134,13 +135,11 @@ import org.slf4j.LoggerFactory;
 
 import java.io.File;
 import java.io.FileNotFoundException;
-import java.io.FileWriter;
 import java.io.IOException;
 import java.io.StringWriter;
 import java.io.Writer;
 import java.net.InetSocketAddress;
 import java.net.URISyntaxException;
-import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -149,7 +148,6 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
-import java.util.Properties;
 import java.util.Set;
 import java.util.regex.Pattern;
 
@@ -394,14 +392,7 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
     YarnAppListClient =
         new YarnAppListClient(yarnClient, getUsername(), getConfig());
     // create the filesystem
-    sliderFileSystem = new SliderFileSystem(getConfig());
-
-    // and the registry
-/*
-    YARNRegistryClient =
-        new YARNRegistryClient(yarnClient, getUsername(), getConfig());
-*/
-    
+    sliderFileSystem = new SliderFileSystem(getConfig());    
   }
 
   /**
@@ -2211,40 +2202,38 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
     args.validate();
     RegistryOperations operations = getRegistryOperations();
     String path = args.path;
-    Collection<ServiceRecord> serviceRecords;
     ServiceRecordMarshal serviceRecordMarshal = new ServiceRecordMarshal();
-    File outputPath = args.out;
     try {
       if (args.list) {
+        File destDir = args.destdir;
+
         Map<String, ServiceRecord> recordMap =
             listServiceRecords(operations, path);
-        serviceRecords = recordMap.values();
-        // list records out
-        StringBuilder builder = new StringBuilder(1024);
-        for (Entry<String, ServiceRecord> recordEntry : recordMap
-            .entrySet()) {
+
+        for (Entry<String, ServiceRecord> recordEntry : recordMap.entrySet()) {
+          String name = recordEntry.getKey();
           ServiceRecord instance = recordEntry.getValue();
-          builder.append("\"").append(recordEntry.getKey()).append("\":\n");
-          builder.append(serviceRecordMarshal.toJson(instance));
-          builder.append("}\n");
-        }
-        String records = builder.toString();
-        if (outputPath == null) {
-          print(records);
-        } else {
-          SliderUtils.write(outputPath, records.getBytes("UTF-8"), false);
+          String json = serviceRecordMarshal.toJson(instance);
+          if (destDir == null) {
+            print(name);
+            print(json);
+          } else {
+            String filename = RegistryPathUtils.lastPathEntry(name) + ".json";
+            File jsonFile = new File(destDir, filename);
+            SliderUtils.write(jsonFile,
+                serviceRecordMarshal.toBytes(instance), true);
+          }
         }
       } else  {
         // resolve single entry
         ServiceRecord instance = resolve(path);
-        serviceRecords = new ArrayList<ServiceRecord>(1);
-        serviceRecords.add(instance);
-        // write out JSON content
-        if (outputPath != null) {
-          byte[] data = serviceRecordMarshal.toBytes(instance);
-          SliderUtils.write(outputPath, data, false);
+        File outFile = args.out;
+        if (args.destdir != null) {
+          outFile = new File(args.destdir, RegistryPathUtils.lastPathEntry(path));
+        }
+        if (outFile != null) {
+          SliderUtils.write(outFile, serviceRecordMarshal.toBytes(instance), true);
         } else {
-          // print to the console
           print(serviceRecordMarshal.toJson(instance));
         }
       }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/bfaea962/slider-core/src/main/java/org/apache/slider/common/params/ActionResolveArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionResolveArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionResolveArgs.java
index cf5611c..944be1b 100644
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionResolveArgs.java
+++ b/slider-core/src/main/java/org/apache/slider/common/params/ActionResolveArgs.java
@@ -20,7 +20,7 @@ package org.apache.slider.common.params;
 
 import com.beust.jcommander.Parameter;
 import com.beust.jcommander.Parameters;
-import org.apache.slider.common.SliderKeys;
+import org.apache.commons.lang.StringUtils;
 import org.apache.slider.core.exceptions.BadCommandArgumentsException;
 import org.apache.slider.core.exceptions.UsageException;
 
@@ -45,10 +45,11 @@ public class ActionResolveArgs extends AbstractActionArgs {
   public static final String USAGE =
       "Usage: " + SliderActions.ACTION_RESOLVE
       + " "
-      + Arguments.ARG_PATH + " <path> "
-      + "[" + Arguments.ARG_LIST + "] "
-      + "[" + Arguments.ARG_VERBOSE + "] "
-      + "[" + Arguments.ARG_OUTPUT + " <filename> ] "
+      + ARG_PATH + " <path> "
+      + "[" + ARG_LIST + "] "
+      + "[" + ARG_VERBOSE + "] "
+      + "[" + ARG_OUTPUT + " <filename> ] "
+      + "[" + ARG_DESTDIR + " <directory> ] "
       ;
   public ActionResolveArgs() {
   }
@@ -71,17 +72,95 @@ public class ActionResolveArgs extends AbstractActionArgs {
       description = "list services")
   public boolean list;
 
-
   @Parameter(names = {ARG_PATH},
       description = "resolve a path")
   public String path;
 
+  @Parameter(names = {ARG_DESTDIR},
+      description = "destination directory for operations")
+  public File destdir;
+
   @Parameter(names = {ARG_OUTPUT, ARG_OUTPUT_SHORT},
-      description = "Output destination")
+      description = "dest file")
   public File out;
 
  @Parameter(names = {ARG_VERBOSE},
       description = "verbose output")
   public boolean verbose;
-  
+
+  @Override
+  public String toString() {
+    final StringBuilder sb =
+        new StringBuilder(ACTION_RESOLVE).append(" ");
+    sb.append(ARG_PATH).append(" ").append(path).append(" ");
+    if (list) {
+      sb.append(ARG_LIST).append(" ");
+    }
+    if (destdir != null) {
+      sb.append(ARG_DESTDIR).append(" ").append(destdir).append(" ");
+    }
+    if (out != null) {
+      sb.append(ARG_OUTPUT).append(" ").append(out).append(" ");
+    }
+    return sb.toString();
+  }
+
+  @Override
+  public void validate() throws BadCommandArgumentsException, UsageException {
+    super.validate();
+    if (StringUtils.isEmpty(path)) {
+      throw new BadCommandArgumentsException("Missing mandatory argument "
+                                             + ARG_PATH);
+    }
+    if (list && out != null) {
+      throw new BadCommandArgumentsException("Argument "
+                                             + ARG_OUTPUT +
+                                             " not supported for " + ARG_LIST);
+    }
+    if (out != null && destdir != null) {
+      throw new BadCommandArgumentsException(
+          ARG_OUTPUT + " and " + ARG_DESTDIR + " cannot be used together"
+      );
+    }
+  }
+
+  public String getPath() {
+    return path;
+  }
+
+  public void setPath(String path) {
+    this.path = path;
+  }
+
+  public boolean isList() {
+    return list;
+  }
+
+  public void setList(boolean list) {
+    this.list = list;
+  }
+
+  public File getDestdir() {
+    return destdir;
+  }
+
+  public void setDestdir(File destdir) {
+    this.destdir = destdir;
+  }
+
+  public File getOut() {
+    return out;
+  }
+
+  public void setOut(File out) {
+    this.out = out;
+  }
+
+  public boolean isVerbose() {
+    return verbose;
+  }
+
+  public void setVerbose(boolean verbose) {
+    this.verbose = verbose;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/bfaea962/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneYarnRegistryAM.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneYarnRegistryAM.groovy b/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneYarnRegistryAM.groovy
index 84dcc50..ca200fd 100644
--- a/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneYarnRegistryAM.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneYarnRegistryAM.groovy
@@ -20,6 +20,8 @@ package org.apache.slider.agent.standalone
 
 import groovy.transform.CompileStatic
 import groovy.util.logging.Slf4j
+import org.apache.commons.io.IOUtils
+import org.apache.hadoop.fs.FileUtil
 import org.apache.hadoop.fs.PathNotFoundException
 import org.apache.hadoop.yarn.api.records.ApplicationReport
 import org.apache.hadoop.yarn.api.records.YarnApplicationState
@@ -31,7 +33,10 @@ import org.apache.hadoop.registry.client.types.RegistryPathStatus
 import org.apache.hadoop.registry.client.types.ServiceRecord
 import org.apache.hadoop.registry.client.types.yarn.YarnRegistryAttributes
 import org.apache.slider.common.params.ActionResolveArgs
+import org.apache.slider.common.params.Arguments
+import org.apache.slider.core.exceptions.BadCommandArgumentsException
 import org.apache.slider.core.exceptions.UnknownApplicationInstanceException
+import org.apache.slider.core.main.LauncherExitCodes
 
 import static org.apache.hadoop.registry.client.binding.RegistryUtils.*
 import org.apache.slider.agent.AgentMiniClusterTestBase
@@ -174,37 +179,52 @@ class TestStandaloneYarnRegistryAM extends AgentMiniClusterTestBase {
     assert null != serviceRecord.getInternalEndpoint(AGENT_SECURE_REST_API)
 
     // use the resolve operation
+
     describe "resolve CLI action"
-    ActionResolveArgs resolveArgs = new ActionResolveArgs()
-    resolveArgs.path = recordsPath;
-    resolveArgs.list = true;
+    File destDir= new File("target/resolve")
+    ServiceRecordMarshal serviceRecordMarshal = new ServiceRecordMarshal()
+    FileUtil.fullyDelete(destDir)
+    File resolveListDir= new File(destDir, "list")
+    ActionResolveArgs resolveList = new ActionResolveArgs(
+        path:recordsPath,
+        list:true,
+        verbose:true)
+
     // to stdout
-    client.actionResolve(resolveArgs)
+    client.actionResolve(resolveList)
     // to a file
-    File destFile = new File("target/resolve.json")
-    destFile.delete()
-    resolveArgs.out = destFile
-    client.actionResolve(resolveArgs)
-    assert destFile.exists()
-    destFile.delete()
+    resolveList.out = resolveListDir;
+    try {
+      client.actionResolve(resolveList)
+    } catch (BadCommandArgumentsException ex) {
+      assertExceptionDetails(ex, LauncherExitCodes.EXIT_COMMAND_ARGUMENT_ERROR,
+          Arguments.ARG_OUTPUT)
+    }
+    resolveList.out = null
+    resolveList.destdir = resolveListDir
+    client.actionResolve(resolveList)
+    File resolvedFile = new File(resolveListDir, clustername+".json")
+    assertFileExists("resolved file", resolvedFile)
+    def recordFromList = serviceRecordMarshal.fromFile(resolvedFile)
     
     // look at a single record
-    resolveArgs.out = null;
-    resolveArgs.list = false;
-    resolveArgs.path = recordsPath +"/"+ clustername
+    ActionResolveArgs resolveRecordCommand = new ActionResolveArgs(
+        path: recordsPath + "/" + clustername)
     // to stdout
-    client.actionResolve(resolveArgs)
-    resolveArgs.out = destFile
-    client.actionResolve(resolveArgs)
-    assert destFile.exists()
-    ServiceRecordMarshal serviceRecordMarshal = new ServiceRecordMarshal()
-    def recordFromFile = serviceRecordMarshal.fromFile(destFile)
+    client.actionResolve(resolveRecordCommand)
+    
+    // then to a file
+    FileUtil.fullyDelete(destDir)
+    File singleFile = new File(destDir, "singlefile.json")
+    singleFile.delete()
+    resolveRecordCommand.out = singleFile
+    client.actionResolve(resolveRecordCommand)
+    assertFileExists("\"slider $resolveRecordCommand\"", singleFile)
+    def recordFromFile = serviceRecordMarshal.fromFile(singleFile)
     assert recordFromFile[YarnRegistryAttributes.YARN_ID] ==
            serviceRecord[YarnRegistryAttributes.YARN_ID]
     assert recordFromFile[YarnRegistryAttributes.YARN_PERSISTENCE] ==
            serviceRecord[YarnRegistryAttributes.YARN_PERSISTENCE]
-    
-    
 
     // hit the registry web page
     def registryEndpoint = serviceRecord.getExternalEndpoint(
@@ -402,7 +422,7 @@ class TestStandaloneYarnRegistryAM extends AgentMiniClusterTestBase {
     // create a new registry args with the defaults back in
     registryArgs = new ActionRegistryArgs(clustername)
     registryArgs.getConf = yarn_site_config
-    registryArgs.dest = outputDir
+    registryArgs.out = outputDir
     describe registryArgs.toString()
     client.actionRegistry(registryArgs)
     assert new File(outputDir, yarn_site_config + ".xml").exists()

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/bfaea962/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy b/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy
index 0b45a5d..d09d280 100644
--- a/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy
@@ -79,13 +79,13 @@ class SliderTestUtils extends Assert {
   }
 
   public static void skip(String message) {
-    log.warn("Skipping test: " + message)
+    log.warn("Skipping test: {}", message)
     Assume.assumeTrue(message, false);
   }
 
   public static void assume(boolean condition, String message) {
     if (!condition) {
-      log.warn("Skipping test: " + message)
+      log.warn("Skipping test: {}",  message)
       Assume.assumeTrue(message, false);
     }
   }
@@ -793,4 +793,21 @@ class SliderTestUtils extends Assert {
   public String toURIArg(File file) {
     file.absoluteFile.toURI().toString()
   }
+
+  /**
+   * Assert a file exists; fails with a listing of the parent dir
+   * @param text text for front of message
+   * @param file file to look for
+   * @throws FileNotFoundException
+   */
+  public void assertFileExists(String text, File file) {
+    if (!file.exists()) {
+      def parent = file.parentFile
+      def files = parent.list()
+      StringBuilder builder = new StringBuilder()
+      builder.append("${parent.absolutePath}:\n")
+      files.each { String name-> builder.append("  $name\n")}
+      throw new FileNotFoundException("$text: file $file not found in $builder")
+    }
+  }
 }