You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by vi...@apache.org on 2013/09/06 18:17:18 UTC

svn commit: r1520624 - in /oozie/trunk: ./ core/src/main/java/org/apache/oozie/action/hadoop/ core/src/main/java/org/apache/oozie/service/ core/src/main/resources/ core/src/test/java/org/apache/oozie/action/hadoop/ core/src/test/java/org/apache/oozie/s...

Author: virag
Date: Fri Sep  6 16:17:17 2013
New Revision: 1520624

URL: http://svn.apache.org/r1520624
Log:
OOZIE-1461 provide an option to auto-deploy launcher jar onto HDFS system libpath (ryota,virag via virag)

Added:
    oozie/trunk/core/src/main/java/org/apache/oozie/service/ShareLibService.java
    oozie/trunk/core/src/test/java/org/apache/oozie/service/TestShareLibService.java
Modified:
    oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/DistcpActionExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/HiveActionExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/MapReduceActionExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/PigActionExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/ScriptLanguageActionExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/ShellActionExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/SqoopActionExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/service/ActionService.java
    oozie/trunk/core/src/main/resources/oozie-default.xml
    oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/ActionExecutorTestCase.java
    oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java
    oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestShellActionExecutor.java
    oozie/trunk/core/src/test/java/org/apache/oozie/test/XFsTestCase.java
    oozie/trunk/core/src/test/java/org/apache/oozie/test/XTestCase.java
    oozie/trunk/release-log.txt
    oozie/trunk/sharelib/hive/src/test/java/org/apache/oozie/action/hadoop/TestHiveActionExecutor.java
    oozie/trunk/sharelib/pig/src/test/java/org/apache/oozie/action/hadoop/TestPigActionExecutor.java
    oozie/trunk/sharelib/sqoop/src/test/java/org/apache/oozie/action/hadoop/TestSqoopActionExecutor.java
    oozie/trunk/sharelib/streaming/src/test/java/org/apache/oozie/action/hadoop/TestMapReduceActionExecutor.java
    oozie/trunk/sharelib/streaming/src/test/java/org/apache/oozie/action/hadoop/TestMapReduceActionExecutorUberJar.java

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/DistcpActionExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/DistcpActionExecutor.java?rev=1520624&r1=1520623&r2=1520624&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/DistcpActionExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/DistcpActionExecutor.java Fri Sep  6 16:17:17 2013
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,6 +17,8 @@
  */
 package org.apache.oozie.action.hadoop;
 
+import java.util.List;
+
 import org.apache.hadoop.conf.Configuration;
 import org.apache.oozie.service.Services;
 import org.apache.oozie.util.XLog;
@@ -46,6 +48,11 @@ public class DistcpActionExecutor extend
         return launcherConf.get(LauncherMapper.CONF_OOZIE_ACTION_MAIN_CLASS, classNameDistcp);
     }
 
+    @Override
+    public List<Class> getLauncherClasses() {
+       return null;
+    }
+
     /**
      * This function returns the Action classes names from the configuration
      *

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/HiveActionExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/HiveActionExecutor.java?rev=1520624&r1=1520623&r2=1520624&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/HiveActionExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/HiveActionExecutor.java Fri Sep  6 16:17:17 2013
@@ -19,6 +19,7 @@ package org.apache.oozie.action.hadoop;
 
 import static org.apache.oozie.action.hadoop.LauncherMapper.CONF_OOZIE_ACTION_MAIN_CLASS;
 
+import java.util.ArrayList;
 import java.util.List;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
@@ -41,8 +42,8 @@ public class HiveActionExecutor extends 
     }
 
     @Override
-    protected List<Class> getLauncherClasses() {
-        List<Class> classes = super.getLauncherClasses();
+    public List<Class> getLauncherClasses() {
+        List<Class> classes = new ArrayList<Class>();
         try {
             classes.add(Class.forName(HIVE_MAIN_CLASS_NAME));
         }

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java?rev=1520624&r1=1520623&r2=1520624&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java Fri Sep  6 16:17:17 2013
@@ -60,6 +60,7 @@ import org.apache.oozie.client.WorkflowA
 import org.apache.oozie.service.HadoopAccessorException;
 import org.apache.oozie.service.HadoopAccessorService;
 import org.apache.oozie.service.Services;
+import org.apache.oozie.service.ShareLibService;
 import org.apache.oozie.service.URIHandlerService;
 import org.apache.oozie.service.WorkflowAppService;
 import org.apache.oozie.servlet.CallbackServlet;
@@ -90,7 +91,6 @@ public class JavaActionExecutor extends 
     public static final String ACL_VIEW_JOB = "mapreduce.job.acl-view-job";
     public static final String ACL_MODIFY_JOB = "mapreduce.job.acl-modify-job";
     private static final String HADOOP_YARN_UBER_MODE = "mapreduce.job.ubertask.enable";
-    public static final String OOZIE_ACTION_SHIP_LAUNCHER_JAR = "oozie.action.ship.launcher.jar";
     public static final String HADOOP_MAP_MEMORY_MB = "mapreduce.map.memory.mb";
     public static final String HADOOP_CHILD_JAVA_OPTS = "mapred.child.java.opts";
     public static final String HADOOP_MAP_JAVA_OPTS = "mapreduce.map.java.opts";
@@ -100,7 +100,6 @@ public class JavaActionExecutor extends 
     public static final String YARN_AM_COMMAND_OPTS = "yarn.app.mapreduce.am.command-opts";
     public static final String YARN_AM_ENV = "yarn.app.mapreduce.am.env";
     public static final int YARN_MEMORY_MB_MIN = 512;
-    private boolean useLauncherJar;
     private static int maxActionOutputLen;
     private static int maxExternalStatsSize;
     private static int maxFSGlobMax;
@@ -127,26 +126,19 @@ public class JavaActionExecutor extends 
     protected JavaActionExecutor(String type) {
         super(type);
         requiresNNJT = true;
-        useLauncherJar = getOozieConf().getBoolean(OOZIE_ACTION_SHIP_LAUNCHER_JAR, true);
     }
 
-    protected String getLauncherJarName() {
-        return getType() + "-launcher.jar";
-    }
-
-    protected List<Class> getLauncherClasses() {
+    public static List<Class> getCommonLauncherClasses() {
         List<Class> classes = new ArrayList<Class>();
         classes.add(LauncherMapper.class);
-        classes.add(LauncherSecurityManager.class);
-        classes.add(LauncherException.class);
-        classes.add(LauncherMainException.class);
-        classes.add(PrepareActionsDriver.class);
         classes.addAll(Services.get().get(URIHandlerService.class).getClassesForLauncher());
-        classes.add(ActionStats.class);
-        classes.add(ActionType.class);
         return classes;
     }
 
+    public List<Class> getLauncherClasses() {
+       return null;
+    }
+
     @Override
     public void initActionType() {
         super.initActionType();
@@ -155,7 +147,7 @@ public class JavaActionExecutor extends 
           // TODO: Remove the below config get in a subsequent release..
           // This other irrelevant property is only used to
           // preserve backwards compatibility cause of a typo.
-          // See OOZIE-4.
+                  // See OOZIE-4.
           getOozieConf().getInt(CallbackServlet.CONF_MAX_DATA_LEN,
             2 * 1024));
         //Get the limit for the maximum allowed size of action stats
@@ -164,8 +156,6 @@ public class JavaActionExecutor extends 
         //Get the limit for the maximum number of globbed files/dirs for FS operation
         maxFSGlobMax = getOozieConf().getInt(LauncherMapper.CONF_OOZIE_ACTION_FS_GLOB_MAX, LauncherMapper.GLOB_MAX_DEFAULT);
 
-        createLauncherJar();
-
         registerError(UnknownHostException.class.getName(), ActionExecutorException.ErrorType.TRANSIENT, "JA001");
         registerError(AccessControlException.class.getName(), ActionExecutorException.ErrorType.NON_TRANSIENT,
                 "JA002");
@@ -181,23 +171,6 @@ public class JavaActionExecutor extends 
         registerError(IOException.class.getName(), ActionExecutorException.ErrorType.TRANSIENT, "JA009");
     }
 
-    public void createLauncherJar() {
-        if (useLauncherJar) {
-            try {
-                List<Class> classes = getLauncherClasses();
-                Class[] launcherClasses = classes.toArray(new Class[classes.size()]);
-                IOUtils.createJar(new File(getOozieRuntimeDir()), getLauncherJarName(), launcherClasses);
-            }
-            catch (IOException ex) {
-                throw new RuntimeException(ex);
-            }
-            catch (java.lang.NoClassDefFoundError err) {
-                ByteArrayOutputStream baos = new ByteArrayOutputStream();
-                err.printStackTrace(new PrintStream(baos));
-                log.warn(baos.toString());
-            }
-         }
-    }
 
     /**
      * Get the maximum allowed size of stats
@@ -459,28 +432,13 @@ public class JavaActionExecutor extends 
         }
     }
 
-    String getOozieLauncherJar(Context context) throws ActionExecutorException {
-        try {
-            return new Path(context.getActionDir(), getLauncherJarName()).toString();
-        }
-        catch (Exception ex) {
-            throw convertException(ex);
-        }
-    }
-
     public void prepareActionDir(FileSystem actionFs, Context context) throws ActionExecutorException {
         try {
             Path actionDir = context.getActionDir();
             Path tempActionDir = new Path(actionDir.getParent(), actionDir.getName() + ".tmp");
             if (!actionFs.exists(actionDir)) {
                 try {
-                    if (useLauncherJar) {
-                        actionFs.copyFromLocalFile(new Path(getOozieRuntimeDir(), getLauncherJarName()), new Path(
-                                tempActionDir, getLauncherJarName()));
-                    }
-                    else {
-                        actionFs.mkdirs(tempActionDir);
-                    }
+                    actionFs.mkdirs(tempActionDir);
                     actionFs.rename(tempActionDir, actionDir);
                 }
                 catch (IOException ex) {
@@ -512,16 +470,16 @@ public class JavaActionExecutor extends 
             throws ActionExecutorException {
         if (actionShareLibNames != null) {
             for (String actionShareLibName : actionShareLibNames) {
-                try {
-                    Path systemLibPath = Services.get().get(WorkflowAppService.class).getSystemLibPath();
-                    if (systemLibPath != null) {
-                        Path actionLibPath = new Path(systemLibPath, actionShareLibName.trim());
-                        String user = conf.get("user.name");
-                        FileSystem fs;
-                        // If the actionLibPath has a valid scheme and authority, then use them to
-                        // determine the filesystem that the sharelib resides on; otherwise, assume
-                        // it resides on the same filesystem as the appPath and use the appPath to
-                        // determine the filesystem
+                Path systemLibPath = Services.get().get(WorkflowAppService.class).getSystemLibPath();
+                if (systemLibPath != null) {
+                    Path actionLibPath = new Path(systemLibPath, actionShareLibName.trim());
+                    String user = conf.get("user.name");
+                    FileSystem fs;
+                    // If the actionLibPath has a valid scheme and authority,
+                    // then use them to determine the filesystem that the sharelib resides on;
+                    // otherwise, assume it resides on the same filesystem as the appPath and use
+                    // the appPath to determine the filesystem
+                    try {
                         if (actionLibPath.toUri().getScheme() != null && actionLibPath.toUri().getAuthority() != null) {
                             fs = Services.get().get(HadoopAccessorService.class)
                                     .createFileSystem(user, actionLibPath.toUri(), conf);
@@ -533,20 +491,50 @@ public class JavaActionExecutor extends 
                         if (fs.exists(actionLibPath)) {
                             FileStatus[] files = fs.listStatus(actionLibPath);
                             for (FileStatus file : files) {
-                                addToCache(conf, actionLibPath, file.getPath().toUri().getPath(), false);
+                                if (!file.isDir()) {
+                                    addToCache(conf, actionLibPath, file.getPath().toUri().getPath(), false);
+                                }
                             }
                         }
                     }
+                    catch (HadoopAccessorException ex) {
+                        throw new ActionExecutorException(ActionExecutorException.ErrorType.FAILED, ex.getErrorCode()
+                                .toString(), ex.getMessage());
+                    }
+                    catch (IOException ex) {
+                        throw new ActionExecutorException(ActionExecutorException.ErrorType.FAILED, "It should never happen",
+                                ex.getMessage());
+                    }
+
                 }
-                catch (HadoopAccessorException ex) {
-                    throw new ActionExecutorException(ActionExecutorException.ErrorType.FAILED, ex.getErrorCode()
-                            .toString(), ex.getMessage());
-                }
-                catch (IOException ex) {
-                    throw new ActionExecutorException(ActionExecutorException.ErrorType.FAILED,
-                            "It should never happen", ex.getMessage());
+            }
+        }
+    }
+
+    protected void addSystemShareLibForAction(Configuration conf) throws ActionExecutorException {
+        ShareLibService shareLibService = Services.get().get(ShareLibService.class);
+        // ShareLibService is null for test cases
+        if (shareLibService != null) {
+            try {
+                List<Path> listOfPaths = shareLibService
+                        .getActionSystemLibCommonJars(JavaActionExecutor.OOZIE_COMMON_LIBDIR);
+                FileSystem fs = listOfPaths.get(0).getFileSystem(conf);
+                for (Path actionLibPath : listOfPaths) {
+                    DistributedCache.addFileToClassPath(actionLibPath, conf, fs);
+                    DistributedCache.createSymlink(conf);
+                }
+                listOfPaths = shareLibService.getActionSystemLibCommonJars(getType());
+                if (listOfPaths != null) {
+                    for (Path actionLibPath : listOfPaths) {
+                        DistributedCache.addFileToClassPath(actionLibPath, conf, fs);
+                        DistributedCache.createSymlink(conf);
+                    }
                 }
             }
+            catch (IOException ex) {
+                throw new ActionExecutorException(ActionExecutorException.ErrorType.FAILED, "It should never happen",
+                        ex.getMessage());
+            }
         }
     }
 
@@ -582,15 +570,10 @@ public class JavaActionExecutor extends 
     }
 
     @SuppressWarnings("unchecked")
-    void setLibFilesArchives(Context context, Element actionXml, Path appPath, Configuration conf)
+    public void setLibFilesArchives(Context context, Element actionXml, Path appPath, Configuration conf)
             throws ActionExecutorException {
         Configuration proto = context.getProtoActionConf();
 
-        // launcher JAR
-        if (useLauncherJar) {
-            addToCache(conf, appPath, getOozieLauncherJar(context), false);
-        }
-
         // Workflow lib/
         String[] paths = proto.getStrings(WorkflowAppService.APP_LIB_PATH_LIST);
         if (paths != null) {
@@ -626,8 +609,8 @@ public class JavaActionExecutor extends 
             throws ActionExecutorException {
         // Add action specific share libs
         addActionShareLib(appPath, conf, context, actionXml);
-        // Add common sharelibs for Oozie
-        addShareLib(appPath, conf, new String[]{JavaActionExecutor.OOZIE_COMMON_LIBDIR});
+        // Add common sharelibs for Oozie and launcher jars
+        addSystemShareLibForAction(conf);
     }
 
     private void addActionShareLib(Path appPath, Configuration conf, Context context, Element actionXml)

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/MapReduceActionExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/MapReduceActionExecutor.java?rev=1520624&r1=1520623&r2=1520624&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/MapReduceActionExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/MapReduceActionExecutor.java Fri Sep  6 16:17:17 2013
@@ -19,6 +19,7 @@ package org.apache.oozie.action.hadoop;
 
 import java.io.IOException;
 import java.io.StringReader;
+import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.hadoop.conf.Configuration;
@@ -51,12 +52,10 @@ public class MapReduceActionExecutor ext
         super("map-reduce");
     }
 
+    @SuppressWarnings("rawtypes")
     @Override
-    protected List<Class> getLauncherClasses() {
-        List<Class> classes = super.getLauncherClasses();
-        classes.add(LauncherMain.class);
-        classes.add(MapReduceMain.class);
-        classes.add(PipesMain.class);
+    public List<Class> getLauncherClasses() {
+        List<Class> classes = new ArrayList<Class>();
         try {
             classes.add(Class.forName(STREAMING_MAIN_CLASS_NAME));
         }

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/PigActionExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/PigActionExecutor.java?rev=1520624&r1=1520623&r2=1520624&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/PigActionExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/PigActionExecutor.java Fri Sep  6 16:17:17 2013
@@ -25,13 +25,14 @@ import org.apache.oozie.client.WorkflowA
 import org.jdom.Element;
 import org.jdom.Namespace;
 import org.jdom.JDOMException;
+import org.json.simple.parser.JSONParser;
 
+import java.util.ArrayList;
 import java.util.List;
 
 public class PigActionExecutor extends ScriptLanguageActionExecutor {
 
     private static final String PIG_MAIN_CLASS_NAME = "org.apache.oozie.action.hadoop.PigMain";
-    private static final String OOZIE_PIG_STATS = "org.apache.oozie.action.hadoop.OoziePigStats";
     static final String PIG_SCRIPT = "oozie.pig.script";
     static final String PIG_PARAMS = "oozie.pig.params";
     static final String PIG_ARGS = "oozie.pig.args";
@@ -40,12 +41,13 @@ public class PigActionExecutor extends S
         super("pig");
     }
 
+    @SuppressWarnings("rawtypes")
     @Override
-    protected List<Class> getLauncherClasses() {
-        List<Class> classes = super.getLauncherClasses();
+    public List<Class> getLauncherClasses() {
+        List<Class> classes = new ArrayList<Class>();
         try {
             classes.add(Class.forName(PIG_MAIN_CLASS_NAME));
-            classes.add(Class.forName(OOZIE_PIG_STATS));
+            classes.add(JSONParser.class);
         }
         catch (ClassNotFoundException e) {
             throw new RuntimeException("Class not found", e);

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/ScriptLanguageActionExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/ScriptLanguageActionExecutor.java?rev=1520624&r1=1520623&r2=1520624&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/ScriptLanguageActionExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/ScriptLanguageActionExecutor.java Fri Sep  6 16:17:17 2013
@@ -35,12 +35,10 @@ public abstract class ScriptLanguageActi
         super(type);
     }
 
+    @SuppressWarnings("rawtypes")
     @Override
-    protected List<Class> getLauncherClasses() {
-        List<Class> classes = super.getLauncherClasses();
-        classes.add(LauncherMain.class);
-        classes.add(MapReduceMain.class);
-        return classes;
+    public List<Class> getLauncherClasses() {
+        return null;
     }
 
     @Override

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/ShellActionExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/ShellActionExecutor.java?rev=1520624&r1=1520623&r2=1520624&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/ShellActionExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/ShellActionExecutor.java Fri Sep  6 16:17:17 2013
@@ -37,18 +37,10 @@ public class ShellActionExecutor extends
         super("shell");
     }
 
+    @SuppressWarnings("rawtypes")
     @Override
-    protected List<Class> getLauncherClasses() {
-        List<Class> classes = super.getLauncherClasses();
-        // Base class of ShellMain dedicated for 'shell' action
-        classes.add(LauncherMain.class);
-        // Some utility methods used in ShelltMain
-        classes.add(MapReduceMain.class);
-        // Specific to Shell action
-        classes.add(ShellMain.class);
-        // ShellMain's inner class
-        classes.add(ShellMain.OutputWriteThread.class);
-        return classes;
+    public List<Class> getLauncherClasses() {
+        return null;
     }
 
     @Override

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/SqoopActionExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/SqoopActionExecutor.java?rev=1520624&r1=1520623&r2=1520624&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/SqoopActionExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/SqoopActionExecutor.java Fri Sep  6 16:17:17 2013
@@ -50,10 +50,8 @@ public class SqoopActionExecutor extends
     }
 
     @Override
-    protected List<Class> getLauncherClasses() {
-        List<Class> classes = super.getLauncherClasses();
-        classes.add(LauncherMain.class);
-        classes.add(MapReduceMain.class);
+    public List<Class> getLauncherClasses() {
+        List<Class> classes = new ArrayList<Class>();
         try {
             classes.add(Class.forName(SQOOP_MAIN_CLASS_NAME));
         }

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/service/ActionService.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/service/ActionService.java?rev=1520624&r1=1520623&r2=1520624&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/service/ActionService.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/service/ActionService.java Fri Sep  6 16:17:17 2013
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,9 +30,9 @@ import org.apache.oozie.service.Services
 import org.apache.oozie.util.ParamChecker;
 import org.apache.oozie.util.XLog;
 import org.apache.oozie.ErrorCode;
-
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Set;
 
 public class ActionService implements Service {
 
@@ -42,6 +42,7 @@ public class ActionService implements Se
 
     private Services services;
     private Map<String, Class<? extends ActionExecutor>> executors;
+    private static XLog LOG = XLog.getLog(ActionService.class);
 
     @SuppressWarnings("unchecked")
     public void init(Services services) throws ServiceException {
@@ -82,9 +83,8 @@ public class ActionService implements Se
     }
 
     public void register(Class<? extends ActionExecutor> klass) throws ServiceException {
-        XLog log = XLog.getLog(getClass());
         ActionExecutor executor = (ActionExecutor) ReflectionUtils.newInstance(klass, services.getConf());
-        log.trace("Registering action type [{0}] class [{1}]", executor.getType(), klass);
+        LOG.trace("Registering action type [{0}] class [{1}]", executor.getType(), klass);
         if (executors.containsKey(executor.getType())) {
             throw new ServiceException(ErrorCode.E0150, executor.getType());
         }
@@ -92,7 +92,7 @@ public class ActionService implements Se
         executor.initActionType();
         ActionExecutor.disableInit();
         executors.put(executor.getType(), klass);
-        log.trace("Registered Action executor for action type [{0}] class [{1}]", executor.getType(), klass);
+        LOG.trace("Registered Action executor for action type [{0}] class [{1}]", executor.getType(), klass);
     }
 
     public ActionExecutor getExecutor(String actionType) {
@@ -101,4 +101,7 @@ public class ActionService implements Se
         return (executorClass != null) ? (ActionExecutor) ReflectionUtils.newInstance(executorClass, null) : null;
     }
 
+    Set<String> getActionTypes() {
+        return executors.keySet();
+    }
 }

Added: oozie/trunk/core/src/main/java/org/apache/oozie/service/ShareLibService.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/service/ShareLibService.java?rev=1520624&view=auto
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/service/ShareLibService.java (added)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/service/ShareLibService.java Fri Sep  6 16:17:17 2013
@@ -0,0 +1,206 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oozie.service;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.PathFilter;
+import org.apache.hadoop.fs.permission.FsPermission;
+import org.apache.oozie.action.ActionExecutor;
+import org.apache.oozie.action.hadoop.JavaActionExecutor;
+import org.apache.oozie.service.Service;
+import org.apache.oozie.service.ServiceException;
+import org.apache.oozie.service.Services;
+import org.apache.oozie.util.XLog;
+import org.apache.oozie.ErrorCode;
+import com.google.common.annotations.VisibleForTesting;
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLDecoder;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TimeZone;
+
+public class ShareLibService implements Service {
+
+    public static final String LAUNCHERJAR_LIB_RETENTION = CONF_PREFIX
+            + "ShareLibService.temp.sharelib.retention.days";
+
+    private Services services;
+    private Map<String, List<Path>> shareLibLauncherMap = new HashMap<String, List<Path>>();
+    private static XLog LOG = XLog.getLog(ShareLibService.class);
+
+    public void init(Services services) throws ServiceException {
+        this.services = services;
+        String formattedDate = new SimpleDateFormat("yyyyMMddHHmmss").format(Calendar.getInstance(
+                TimeZone.getTimeZone("GMT")).getTime());
+        Path tmpShareLibPath = new Path(services.get(WorkflowAppService.class).getSystemLibPath(), "tmp-"
+                + formattedDate);
+        HadoopAccessorService has = Services.get().get(HadoopAccessorService.class);
+        URI uri = tmpShareLibPath.toUri();
+        try {
+            FileSystem fs = FileSystem.get(has.createJobConf(uri.getAuthority()));
+            copyLauncherJarsToShareLib(fs, tmpShareLibPath);
+            purgeShareLibs(fs, tmpShareLibPath);
+        }
+        catch (Exception e) {
+            throw new ServiceException(ErrorCode.E0100, getClass().getName(), e.getMessage(), e);
+        }
+    }
+
+    private void copyLauncherJarsToShareLib(FileSystem fs, Path tmpShareLibPath) throws IOException,
+            ClassNotFoundException {
+        ActionService actionService = Services.get().get(ActionService.class);
+        List<Class> classes = JavaActionExecutor.getCommonLauncherClasses();
+        Path baseDir = new Path(tmpShareLibPath, JavaActionExecutor.OOZIE_COMMON_LIBDIR);
+        copyJarContainingClasses(classes, fs, baseDir, JavaActionExecutor.OOZIE_COMMON_LIBDIR);
+        Set<String> actionTypes = actionService.getActionTypes();
+        for (String key : actionTypes) {
+            ActionExecutor executor = actionService.getExecutor(key);
+            if (executor instanceof JavaActionExecutor) {
+                JavaActionExecutor jexecutor = (JavaActionExecutor) executor;
+                classes = jexecutor.getLauncherClasses();
+                if (classes != null) {
+                    String type = executor.getType();
+                    Path executorDir = new Path(baseDir, type);
+                    copyJarContainingClasses(classes, fs, executorDir, type);
+                }
+            }
+        }
+    }
+
+    private void copyJarContainingClasses(List<Class> classes, FileSystem fs, Path executorDir, String type)
+            throws IOException {
+        fs.mkdirs(executorDir);
+        fs.setPermission(executorDir, FsPermission.valueOf("-rwxr-xr-x"));
+        Set<String> localJarSet = new HashSet<String>();
+        for (Class c : classes) {
+            String localJar = findContainingJar(c);
+            if (localJar != null) {
+                localJarSet.add(localJar);
+            }
+            else {
+                throw new IOException("No jar containing " + c + " found");
+            }
+        }
+        List<Path> listOfPaths = new ArrayList<Path>();
+        for (String localJarStr : localJarSet) {
+            File localJar = new File(localJarStr);
+            fs.copyFromLocalFile(new Path(localJar.getPath()), executorDir);
+            Path path = new Path(executorDir, localJar.getName());
+            fs.setPermission(path, FsPermission.valueOf("-rw-r--r--"));
+            listOfPaths.add(path);
+            LOG.info(localJar.getName() + " uploaded to " + executorDir.toString());
+        }
+        shareLibLauncherMap.put(type, listOfPaths);
+    }
+
+    public List<Path> getActionSystemLibCommonJars(String type) {
+        return shareLibLauncherMap.get(type);
+    }
+
+    @VisibleForTesting
+    protected String findContainingJar(Class clazz) {
+        ClassLoader loader = clazz.getClassLoader();
+        String classFile = clazz.getName().replaceAll("\\.", "/") + ".class";
+        try {
+            for (Enumeration itr = loader.getResources(classFile); itr.hasMoreElements();) {
+                URL url = (URL) itr.nextElement();
+                if ("jar".equals(url.getProtocol())) {
+                    String toReturn = url.getPath();
+                    if (toReturn.startsWith("file:")) {
+                        toReturn = toReturn.substring("file:".length());
+                        // URLDecoder is a misnamed class, since it actually
+                        // decodes
+                        // x-www-form-urlencoded MIME type rather than actual
+                        // URL encoding (which the file path has). Therefore it
+                        // would
+                        // decode +s to ' 's which is incorrect (spaces are
+                        // actually
+                        // either unencoded or encoded as "%20"). Replace +s
+                        // first, so
+                        // that they are kept sacred during the decoding
+                        // process.
+                        toReturn = toReturn.replaceAll("\\+", "%2B");
+                        toReturn = URLDecoder.decode(toReturn, "UTF-8");
+                        toReturn = toReturn.replaceAll("!.*$", "");
+                        return toReturn;
+                    }
+                }
+            }
+        }
+        catch (IOException ioe) {
+            throw new RuntimeException(ioe);
+        }
+        return null;
+    }
+
+    private void purgeShareLibs(FileSystem fs, Path launcherJarLibPath) throws IOException, ParseException {
+        Configuration conf = services.getConf();
+        Path executorLibBasePath = services.get(WorkflowAppService.class).getSystemLibPath();
+        PathFilter directoryFilter = new PathFilter() {
+            public boolean accept(Path path) {
+                return path.getName().startsWith("tmp-");
+            }
+        };
+        FileStatus[] dirList = fs.listStatus(executorLibBasePath, directoryFilter);
+        Arrays.sort(dirList, new Comparator<FileStatus>() {
+            // sort in desc order
+            @Override
+            public int compare(FileStatus o1, FileStatus o2) {
+                return o2.getPath().getName().compareTo(o1.getPath().getName());
+            }
+
+        });
+        Date current = Calendar.getInstance(TimeZone.getTimeZone("GMT")).getTime();
+        // Always keep top two, so start counter from 3
+        long retentionTime = 1000 * 60 * 60 * 24 * conf.getInt(LAUNCHERJAR_LIB_RETENTION, 7);
+        for (int i = 2; i < dirList.length; i++) {
+            Path dirPath = dirList[i].getPath();
+            Date ts = new SimpleDateFormat("yyyyMMddHHmmss").parse(dirPath.getName().split("tmp-", -1)[1]);
+            if ((current.getTime() - ts.getTime()) > retentionTime) {
+                fs.delete(dirPath, true);
+                LOG.info("Deleted old launcher jar lib directory {0}", dirPath.getName());
+            }
+        }
+    }
+
+    public void destroy() {
+        shareLibLauncherMap.clear();
+    }
+
+    public Class<? extends Service> getInterface() {
+        return ShareLibService.class;
+    }
+
+}

Modified: oozie/trunk/core/src/main/resources/oozie-default.xml
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/resources/oozie-default.xml?rev=1520624&r1=1520623&r2=1520624&view=diff
==============================================================================
--- oozie/trunk/core/src/main/resources/oozie-default.xml (original)
+++ oozie/trunk/core/src/main/resources/oozie-default.xml Fri Sep  6 16:17:17 2013
@@ -25,18 +25,6 @@
     <!-- ************************** VERY IMPORTANT  ************************** -->
 
     <property>
-        <name>oozie.action.ship.launcher.jar</name>
-        <value>true</value>
-        <description>
-            If true, Oozie will create and ship a "launcher jar" that contains classes necessary for the launcher job.  If false,
-            Oozie will not do this, and it is assumed that the necessary classes are in their respective sharelib jars or the
-            "oozie" sharelib instead.  When false, the sharelib is required for ALL actions; when true, the sharelib is only
-            required for actions that need additional jars (e.g. Pig).  The main advantage of setting this to false is that
-            launching jobs should be slightly faster.
-        </description>
-    </property>
-
-    <property>
         <name>oozie.action.mapreduce.uber.jar.enable</name>
         <value>false</value>
         <description>
@@ -116,6 +104,7 @@
             org.apache.oozie.service.DBLiteWorkflowStoreService,
             org.apache.oozie.service.CallbackService,
             org.apache.oozie.service.ActionService,
+            org.apache.oozie.service.ShareLibService,
             org.apache.oozie.service.ActionCheckerService,
             org.apache.oozie.service.RecoveryService,
             org.apache.oozie.service.PurgeService,
@@ -1613,11 +1602,10 @@
             A list of class name mapping for Action classes
         </description>
     </property>
-	
-	
+
     <property>
         <name>oozie.service.WorkflowAppService.system.libpath</name>
-        <value>/user/${user.name}/share/lib</value>
+        <value>hdfs:///user/${user.name}/share/lib</value>
         <description>
             System library path to use for workflow applications.
             This path is added to workflow application if their job properties sets

Modified: oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/ActionExecutorTestCase.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/ActionExecutorTestCase.java?rev=1520624&r1=1520623&r2=1520624&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/ActionExecutorTestCase.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/ActionExecutorTestCase.java Fri Sep  6 16:17:17 2013
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -73,7 +73,7 @@ public abstract class ActionExecutorTest
         super.tearDown();
     }
 
-    protected class Context implements ActionExecutor.Context {
+    public class Context implements ActionExecutor.Context {
         private WorkflowActionBean action;
         private WorkflowJobBean workflow;
         boolean started;

Modified: oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java?rev=1520624&r1=1520623&r2=1520624&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java Fri Sep  6 16:17:17 2013
@@ -30,7 +30,6 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Properties;
-import java.util.regex.Pattern;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.filecache.DistributedCache;
@@ -53,10 +52,10 @@ import org.apache.oozie.client.WorkflowJ
 import org.apache.oozie.service.HadoopAccessorService;
 import org.apache.oozie.service.LiteWorkflowStoreService;
 import org.apache.oozie.service.Services;
-import org.apache.oozie.service.URIHandlerService;
 import org.apache.oozie.service.UUIDService;
 import org.apache.oozie.service.WorkflowAppService;
 import org.apache.oozie.service.WorkflowStoreService;
+import org.apache.oozie.util.HCatURI;
 import org.apache.oozie.util.IOUtils;
 import org.apache.oozie.util.XConfiguration;
 import org.apache.oozie.util.XmlUtils;
@@ -85,58 +84,9 @@ public class TestJavaActionExecutor exte
         IOUtils.copyStream(is, os);
     }
 
-    public void testSetupMethodsWithLauncherJar() throws Exception {
-        String defaultVal = Services.get().getConf().get("oozie.action.ship.launcher.jar");
-        try {
-            Services.get().getConf().set("oozie.action.ship.launcher.jar", "true");
-            _testSetupMethods(true);
-        }
-        finally {
-            // back to default
-            if (defaultVal != null) {
-                Services.get().getConf().set("oozie.action.ship.launcher.jar", defaultVal);
-            }
-        }
-     }
-
-    public void testSetupMethodsWithoutLauncherJar() throws Exception {
-        String defaultVal = Services.get().getConf().get("oozie.action.ship.launcher.jar");
-        try {
-            Services.get().getConf().set("oozie.action.ship.launcher.jar", "false");
-            _testSetupMethods(false);
-        }
-        finally {
-            // back to default
-            if (defaultVal != null) {
-                Services.get().getConf().set("oozie.action.ship.launcher.jar", defaultVal);
-            }
-        }
-    }
-
-    public void _testSetupMethods(boolean launcherJarShouldExist) throws Exception {
+    public void testSetupMethods() throws Exception {
         JavaActionExecutor ae = new JavaActionExecutor();
-        Path jar = new Path(ae.getOozieRuntimeDir(), ae.getLauncherJarName());
-        File fJar = new File(jar.toString());
-        fJar.delete();
-        assertFalse(fJar.exists());
-        ae.createLauncherJar();
-        assertEquals(launcherJarShouldExist, fJar.exists());
-
-        assertEquals("java", ae.getType());
-        assertEquals("java-launcher.jar", ae.getLauncherJarName());
-        if (launcherJarShouldExist) {
-            List<Class> classes = new ArrayList<Class>();
-            classes.add(LauncherMapper.class);
-            classes.add(LauncherSecurityManager.class);
-            classes.add(LauncherException.class);
-            classes.add(LauncherMainException.class);
-            classes.add(PrepareActionsDriver.class);
-            classes.addAll(Services.get().get(URIHandlerService.class).getClassesForLauncher());
-            classes.add(ActionStats.class);
-            classes.add(ActionType.class);
-            assertEquals(classes, ae.getLauncherClasses());
-        }
-
+        assertEquals(null, ae.getLauncherClasses());
         Configuration conf = new XConfiguration();
         conf.set("user.name", "a");
         try {
@@ -260,14 +210,9 @@ public class TestJavaActionExecutor exte
         assertTrue(conf.get("mapred.cache.files").contains(appSoPath.toUri().getPath()));
         ae.addToCache(conf, appPath, appSo1Path.toString(), false);
         assertTrue(conf.get("mapred.cache.files").contains(expectedSo1Path));
-
-        assertTrue(ae.getOozieLauncherJar(context).startsWith(context.getActionDir().toString()));
-        assertTrue(ae.getOozieLauncherJar(context).endsWith(ae.getLauncherJarName()));
-
         assertFalse(getFileSystem().exists(context.getActionDir()));
         ae.prepareActionDir(getFileSystem(), context);
         assertTrue(getFileSystem().exists(context.getActionDir()));
-        assertEquals(launcherJarShouldExist, getFileSystem().exists(new Path(context.getActionDir(), ae.getLauncherJarName())));
 
         ae.cleanUpActionDir(getFileSystem(), context);
         assertFalse(getFileSystem().exists(context.getActionDir()));
@@ -1272,7 +1217,7 @@ public class TestJavaActionExecutor exte
     public void testAddShareLibSchemeAndAuthority() throws Exception {
         JavaActionExecutor ae = new JavaActionExecutor() {
             @Override
-            protected String getDefaultShareLibName(Element actionXml) {
+            public String getDefaultShareLibName(Element actionXml) {
                 return "java-action-executor";
             }
         };

Modified: oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestShellActionExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestShellActionExecutor.java?rev=1520624&r1=1520623&r2=1520624&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestShellActionExecutor.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestShellActionExecutor.java Fri Sep  6 16:17:17 2013
@@ -17,11 +17,8 @@
  */
 package org.apache.oozie.action.hadoop;
 
-import java.io.File;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
-import java.util.ArrayList;
-import java.util.List;
 import java.util.Map;
 
 import org.apache.hadoop.conf.Configuration;
@@ -36,7 +33,6 @@ import org.apache.oozie.WorkflowJobBean;
 import org.apache.oozie.client.WorkflowAction;
 import org.apache.oozie.service.HadoopAccessorService;
 import org.apache.oozie.service.Services;
-import org.apache.oozie.service.URIHandlerService;
 import org.apache.oozie.service.WorkflowAppService;
 import org.apache.oozie.util.PropertiesUtils;
 import org.apache.oozie.util.XConfiguration;
@@ -55,70 +51,15 @@ public class TestShellActionExecutor ext
         setSystemProperty("oozie.service.ActionService.executor.classes", ShellActionExecutor.class.getName());
     }
 
-    public void testSetupMethodsWithLauncherJar() throws Exception {
-        String defaultVal = Services.get().getConf().get("oozie.action.ship.launcher.jar");
-        try {
-            Services.get().getConf().set("oozie.action.ship.launcher.jar", "true");
-            _testSetupMethods(true);
-        }
-        finally {
-            // back to default
-            if (defaultVal != null) {
-                Services.get().getConf().set("oozie.action.ship.launcher.jar", defaultVal);
-            }
-        }
-     }
-
-    public void testSetupMethodsWithoutLauncherJar() throws Exception {
-        String defaultVal = Services.get().getConf().get("oozie.action.ship.launcher.jar");
-        try {
-            Services.get().getConf().set("oozie.action.ship.launcher.jar", "false");
-            _testSetupMethods(false);
-        }
-        finally {
-            // back to default
-            if (defaultVal != null) {
-                Services.get().getConf().set("oozie.action.ship.launcher.jar", defaultVal);
-            }
-        }
-    }
-
     /**
      * Verify if the ShellActionExecutor indeed setups the basic stuffs
      *
      * @param launcherJarShouldExist
      * @throws Exception
      */
-    public void _testSetupMethods(boolean launcherJarShouldExist) throws Exception {
+    public void testSetupMethods() throws Exception {
         ShellActionExecutor ae = new ShellActionExecutor();
-        Path jar = new Path(ae.getOozieRuntimeDir(), ae.getLauncherJarName());
-        File fJar = new File(jar.toString());
-        fJar.delete();
-        assertFalse(fJar.exists());
-        ae.createLauncherJar();
-        assertEquals(launcherJarShouldExist, fJar.exists());
-
-        assertEquals("shell", ae.getType());// ActionExcutor type is 'shell'
-        // Verify the launcher jar filename
-        assertEquals("shell-launcher.jar", ae.getLauncherJarName());
-
-        if (launcherJarShouldExist) {
-            List<Class> classes = new ArrayList<Class>();
-            classes.add(LauncherMapper.class);
-            classes.add(LauncherSecurityManager.class);
-            classes.add(LauncherException.class);
-            classes.add(LauncherMainException.class);
-            classes.add(PrepareActionsDriver.class);
-            classes.addAll(Services.get().get(URIHandlerService.class).getClassesForLauncher());
-            classes.add(ActionStats.class);
-            classes.add(ActionType.class);
-            classes.add(LauncherMain.class);
-            classes.add(MapReduceMain.class);
-            classes.add(ShellMain.class);
-            classes.add(ShellMain.OutputWriteThread.class);
-            assertEquals(classes, ae.getLauncherClasses());// Verify the class
-        }
-
+        assertNull(ae.getLauncherClasses());
         Element actionXml = XmlUtils.parseXml("<shell>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>"
                 + "<name-node>" + getNameNodeUri() + "</name-node>" + "<exec>SCRIPT</exec>"
                 + "<argument>a=A</argument>" + "<argument>b=B</argument>" + "</shell>");

Added: oozie/trunk/core/src/test/java/org/apache/oozie/service/TestShareLibService.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestShareLibService.java?rev=1520624&view=auto
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/service/TestShareLibService.java (added)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/service/TestShareLibService.java Fri Sep  6 16:17:17 2013
@@ -0,0 +1,174 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oozie.service;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.filecache.DistributedCache;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.oozie.WorkflowActionBean;
+import org.apache.oozie.WorkflowJobBean;
+import org.apache.oozie.action.hadoop.JavaActionExecutor;
+import org.apache.oozie.action.hadoop.PigActionExecutor;
+import org.apache.oozie.action.hadoop.ActionExecutorTestCase.Context;
+import org.apache.oozie.action.hadoop.TestJavaActionExecutor;
+import org.apache.oozie.service.Services;
+import org.apache.oozie.service.ActionService;
+import org.apache.oozie.test.XFsTestCase;
+import org.apache.oozie.util.IOUtils;
+import org.apache.oozie.util.XConfiguration;
+import org.apache.oozie.util.XmlUtils;
+import org.jdom.Element;
+import org.junit.Test;
+
+public class TestShareLibService extends XFsTestCase {
+
+    Services services;
+    private static String testCaseDirPath;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        testCaseDirPath = getTestCaseDir();
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    private void setSystemProps() throws IOException {
+        IOUtils.createJar(new File(getTestCaseDir()), MyOozie.class.getName() + ".jar", MyOozie.class);
+        IOUtils.createJar(new File(getTestCaseDir()), MyPig.class.getName() + ".jar", MyPig.class);
+        Configuration conf = services.getConf();
+        conf.set(WorkflowAppService.SYSTEM_LIB_PATH, getFsTestCaseDir() + "/share/lib");
+        conf.set(Services.CONF_SERVICE_CLASSES, conf.get(Services.CONF_SERVICE_CLASSES) + ","
+                + DummyShareLibService.class.getName());
+        conf.set(ActionService.CONF_ACTION_EXECUTOR_CLASSES, DummyPigActionExecutor.class.getName());
+    }
+
+    public static class DummyShareLibService extends ShareLibService {
+        @Override
+        public String findContainingJar(Class clazz) {
+            if (JavaActionExecutor.getCommonLauncherClasses().contains(clazz) ){
+                return testCaseDirPath + "/" + MyOozie.class.getName() + ".jar";
+            }
+            return testCaseDirPath + "/" + clazz.getName() + ".jar";
+        }
+    }
+
+    public static class DummyPigActionExecutor extends PigActionExecutor {
+        public DummyPigActionExecutor() {
+        }
+
+        @Override
+        public List<Class> getLauncherClasses() {
+            return Arrays.asList((Class) MyPig.class);
+        }
+    }
+
+    static class MyOozie {
+    }
+
+    static class MyPig {
+    }
+
+    @Test
+    public void testCreateLauncherLibPath() throws Exception {
+        services = new Services();
+        setSystemProps();
+        services.init();
+        ShareLibService shareLibService = Services.get().get(ShareLibService.class);
+        List<Path> launcherPath = shareLibService.getActionSystemLibCommonJars(JavaActionExecutor.OOZIE_COMMON_LIBDIR);
+        assertNotNull(launcherPath);
+        assertTrue(getFileSystem().exists(launcherPath.get(0)));
+        List<Path> pigLauncherPath = shareLibService.getActionSystemLibCommonJars("pig");
+        assertTrue(getFileSystem().exists(pigLauncherPath.get(0)));
+        services.destroy();
+    }
+
+    @Test
+    public void testAddShareLibDistributedCache() throws Exception {
+        services = new Services();
+        setSystemProps();
+        services.init();
+        String actionXml = "<java>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" +
+                "<name-node>" + getNameNodeUri() + "</name-node>" +
+                "</java>";
+        Element eActionXml = XmlUtils.parseXml(actionXml);
+        XConfiguration protoConf = new XConfiguration();
+        protoConf.set(WorkflowAppService.HADOOP_USER, getTestUser());
+        WorkflowJobBean wfj = new WorkflowJobBean();
+        wfj.setProtoActionConf(XmlUtils.prettyPrint(protoConf).toString());
+        wfj.setConf(XmlUtils.prettyPrint(new XConfiguration()).toString());
+        Context context = new TestJavaActionExecutor().new Context(wfj, new WorkflowActionBean());
+        PigActionExecutor ae = new PigActionExecutor();
+        Configuration jobConf = ae.createBaseHadoopConf(context, eActionXml);
+        ae.setLibFilesArchives(context, eActionXml, new Path("hdfs://dummyAppPath"), jobConf);
+
+        URI[] cacheFiles = DistributedCache.getCacheFiles(jobConf);
+        String cacheFilesStr = Arrays.toString(cacheFiles);
+        assertEquals(2, cacheFiles.length);
+        assertTrue(cacheFilesStr.contains(MyPig.class.getName() + ".jar"));
+        assertTrue(cacheFilesStr.contains(MyOozie.class.getName() + ".jar"));
+        services.destroy();
+
+    }
+
+    @Test
+    public void testPurgeShareLib() throws Exception {
+        services = new Services();
+        setSystemProps();
+        FileSystem fs = getFileSystem();
+        // for directory created 8 days back to be deleted
+        int expire1 = services.getConf().getInt(ShareLibService.LAUNCHERJAR_LIB_RETENTION, 7) + 1;
+        // for directory created 6 days back NOT to be deleted
+        int noexpire = services.getConf().getInt(ShareLibService.LAUNCHERJAR_LIB_RETENTION, 7) - 1;
+        // for directory created 5 days back NOT to be deleted
+        int noexpire1 = services.getConf().getInt(ShareLibService.LAUNCHERJAR_LIB_RETENTION, 7) - 2;
+
+        Date expireDate = new Date(System.currentTimeMillis() - (1000 * 60 * 60 * 24 * expire1));
+        Date noexpireDate = new Date(System.currentTimeMillis() - (1000 * 60 * 60 * 24 * noexpire));
+        Date noexpireDate1 = new Date(System.currentTimeMillis() - (1000 * 60 * 60 * 24 * noexpire1));
+        String expireTs = new SimpleDateFormat("yyyyMMddHHmmss").format(expireDate);
+        String noexpireTs = new SimpleDateFormat("yyyyMMddHHmmss").format(noexpireDate);
+        String noexpireTs1 = new SimpleDateFormat("yyyyMMddHHmmss").format(noexpireDate1);
+        Path basePath = new Path(services.getConf().get(WorkflowAppService.SYSTEM_LIB_PATH));
+        Path expirePath = new Path(basePath, "tmp-" + expireTs);
+        Path noexpirePath = new Path(basePath, "tmp-" + noexpireTs);
+        Path noexpirePath1 = new Path(basePath, "tmp-" + noexpireTs1);
+        fs.mkdirs(expirePath);
+        fs.mkdirs(noexpirePath);
+        fs.mkdirs(noexpirePath1);
+        services.init();
+        assertEquals(3, fs.listStatus(basePath).length);
+        assertTrue(fs.exists(noexpirePath));
+        assertTrue(fs.exists(noexpirePath1));
+        assertTrue(!fs.exists(expirePath));
+        services.destroy();
+    }
+
+}

Modified: oozie/trunk/core/src/test/java/org/apache/oozie/test/XFsTestCase.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/test/XFsTestCase.java?rev=1520624&r1=1520623&r2=1520624&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/test/XFsTestCase.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/test/XFsTestCase.java Fri Sep  6 16:17:17 2013
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

Modified: oozie/trunk/core/src/test/java/org/apache/oozie/test/XTestCase.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/test/XTestCase.java?rev=1520624&r1=1520623&r2=1520624&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/test/XTestCase.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/test/XTestCase.java Fri Sep  6 16:17:17 2013
@@ -73,6 +73,7 @@ import org.apache.oozie.store.StoreExcep
 import org.apache.oozie.test.MiniHCatServer.RUNMODE;
 import org.apache.oozie.util.IOUtils;
 import org.apache.oozie.util.ParamChecker;
+import org.apache.oozie.util.XConfiguration;
 import org.apache.oozie.util.XLog;
 
 /**
@@ -297,11 +298,15 @@ public abstract class XTestCase extends 
             }
         }
         // Copy the specified oozie-site file from oozieSiteSourceStream to the test case dir as oozie-site.xml
-        // We also need to inject oozie.action.ship.launcher.jar as false (if not already set) or else a lot of tests will fail in
-        // weird ways because the ActionExecutors can't find their corresponding Main classes
         Configuration oozieSiteConf = new Configuration(false);
         oozieSiteConf.addResource(oozieSiteSourceStream);
-        oozieSiteConf.setBooleanIfUnset("oozie.action.ship.launcher.jar", false);
+        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+        InputStream inputStream = classLoader.getResourceAsStream(ConfigurationService.DEFAULT_CONFIG_FILE);
+        XConfiguration configuration = new XConfiguration(inputStream);
+        String classes = configuration.get(Services.CONF_SERVICE_CLASSES);
+        // Disable sharelib service as it cannot find the sharelib jars
+        // as maven has target/classes in classpath and not the jar because test phase is before package phase
+        oozieSiteConf.set(Services.CONF_SERVICE_CLASSES, classes.replaceAll("org.apache.oozie.service.ShareLibService,",""));
         File target = new File(testCaseConfDir, "oozie-site.xml");
         oozieSiteConf.writeXml(new FileOutputStream(target));
 

Modified: oozie/trunk/release-log.txt
URL: http://svn.apache.org/viewvc/oozie/trunk/release-log.txt?rev=1520624&r1=1520623&r2=1520624&view=diff
==============================================================================
--- oozie/trunk/release-log.txt (original)
+++ oozie/trunk/release-log.txt Fri Sep  6 16:17:17 2013
@@ -1,5 +1,6 @@
 -- Oozie 4.1.0 release (trunk - unreleased)
 
+OOZIE-1461 provide an option to auto-deploy launcher jar onto HDFS system libpath (ryota,virag via virag)
 OOZIE-1520 Sequencefile Reader fails to use doas for reading action data file (rohini,mona via mona)
 OOZIE-1513 Workflow stays in running if Fork/join validation or loop detection fails (mona)
 OOZIE-1490 Remove unix OS enforcement from build (dwann via tucu)

Modified: oozie/trunk/sharelib/hive/src/test/java/org/apache/oozie/action/hadoop/TestHiveActionExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/sharelib/hive/src/test/java/org/apache/oozie/action/hadoop/TestHiveActionExecutor.java?rev=1520624&r1=1520623&r2=1520624&view=diff
==============================================================================
--- oozie/trunk/sharelib/hive/src/test/java/org/apache/oozie/action/hadoop/TestHiveActionExecutor.java (original)
+++ oozie/trunk/sharelib/hive/src/test/java/org/apache/oozie/action/hadoop/TestHiveActionExecutor.java Fri Sep  6 16:17:17 2013
@@ -17,7 +17,6 @@
  */
 package org.apache.oozie.action.hadoop;
 
-import java.io.File;
 import java.io.FileInputStream;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -25,6 +24,7 @@ import java.io.OutputStreamWriter;
 import java.io.StringReader;
 import java.io.Writer;
 import java.text.MessageFormat;
+import java.util.Arrays;
 import java.util.Map;
 
 import org.apache.hadoop.conf.Configuration;
@@ -67,43 +67,10 @@ public class TestHiveActionExecutor exte
                 HiveActionExecutor.class.getName());
     }
 
-    public void testSetupMethodsWithLauncherJar() throws Exception {
-        String defaultVal = Services.get().getConf().get("oozie.action.ship.launcher.jar");
-        try {
-            Services.get().getConf().set("oozie.action.ship.launcher.jar", "true");
-            _testSetupMethods(true);
-        }
-        finally {
-            // back to default
-            if (defaultVal != null) {
-                Services.get().getConf().set("oozie.action.ship.launcher.jar", defaultVal);
-            }
-        }
-     }
-
-    public void testSetupMethodsWithoutLauncherJar() throws Exception {
-        String defaultVal = Services.get().getConf().get("oozie.action.ship.launcher.jar");
-        try {
-            Services.get().getConf().set("oozie.action.ship.launcher.jar", "false");
-            _testSetupMethods(false);
-        }
-        finally {
-            // back to default
-            if (defaultVal != null) {
-                Services.get().getConf().set("oozie.action.ship.launcher.jar", defaultVal);
-            }
-        }
-    }
-
-    public void _testSetupMethods(boolean launcherJarShouldExist) throws Exception {
+    @SuppressWarnings("unchecked")
+    public void testSetupMethods() throws Exception {
         HiveActionExecutor ae = new HiveActionExecutor();
-        Path jar = new Path(ae.getOozieRuntimeDir(), ae.getLauncherJarName());
-        File fJar = new File(jar.toString());
-        fJar.delete();
-        assertFalse(fJar.exists());
-        ae.createLauncherJar();
-        assertEquals(launcherJarShouldExist, fJar.exists());
-
+        assertEquals(Arrays.asList(HiveMain.class), ae.getLauncherClasses());
         assertEquals("hive", ae.getType());
     }
 

Modified: oozie/trunk/sharelib/pig/src/test/java/org/apache/oozie/action/hadoop/TestPigActionExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/sharelib/pig/src/test/java/org/apache/oozie/action/hadoop/TestPigActionExecutor.java?rev=1520624&r1=1520623&r2=1520624&view=diff
==============================================================================
--- oozie/trunk/sharelib/pig/src/test/java/org/apache/oozie/action/hadoop/TestPigActionExecutor.java (original)
+++ oozie/trunk/sharelib/pig/src/test/java/org/apache/oozie/action/hadoop/TestPigActionExecutor.java Fri Sep  6 16:17:17 2013
@@ -35,8 +35,10 @@ import org.apache.oozie.service.HadoopAc
 import org.apache.oozie.util.XConfiguration;
 import org.apache.oozie.util.XmlUtils;
 import org.apache.oozie.util.IOUtils;
+import org.codehaus.jackson.JsonParser;
 import org.jdom.Element;
 import org.json.simple.JSONValue;
+import org.json.simple.parser.JSONParser;
 
 import java.io.File;
 import java.io.IOException;
@@ -81,60 +83,11 @@ public class TestPigActionExecutor exten
         setSystemProperty("oozie.service.ActionService.executor.classes", PigActionExecutor.class.getName());
     }
 
-    public void testSetupMethodsWithLauncherJar() throws Exception {
-        String defaultVal = Services.get().getConf().get("oozie.action.ship.launcher.jar");
-        try {
-            Services.get().getConf().set("oozie.action.ship.launcher.jar", "true");
-            _testSetupMethods(true);
-        }
-        finally {
-            // back to default
-            if (defaultVal != null) {
-                Services.get().getConf().set("oozie.action.ship.launcher.jar", defaultVal);
-            }
-        }
-     }
-
-    public void testSetupMethodsWithoutLauncherJar() throws Exception {
-        String defaultVal = Services.get().getConf().get("oozie.action.ship.launcher.jar");
-        try {
-            Services.get().getConf().set("oozie.action.ship.launcher.jar", "false");
-            _testSetupMethods(false);
-        }
-        finally {
-            // back to default
-            if (defaultVal != null) {
-                Services.get().getConf().set("oozie.action.ship.launcher.jar", defaultVal);
-            }
-        }
-    }
-
-    public void _testSetupMethods(boolean launcherJarShouldExist) throws Exception {
+    public void testSetupMethods() throws Exception {
         PigActionExecutor ae = new PigActionExecutor();
-        Path jar = new Path(ae.getOozieRuntimeDir(), ae.getLauncherJarName());
-        File fJar = new File(jar.toString());
-        fJar.delete();
-        assertFalse(fJar.exists());
-        ae.createLauncherJar();
-        assertEquals(launcherJarShouldExist, fJar.exists());
-
-        assertEquals("pig", ae.getType());
-
-        assertEquals("pig-launcher.jar", ae.getLauncherJarName());
-
         List<Class> classes = new ArrayList<Class>();
-        classes.add(LauncherMapper.class);
-        classes.add(LauncherSecurityManager.class);
-        classes.add(LauncherException.class);
-        classes.add(LauncherMainException.class);
-        classes.add(PrepareActionsDriver.class);
-        classes.addAll(Services.get().get(URIHandlerService.class).getClassesForLauncher());
-        classes.add(ActionStats.class);
-        classes.add(ActionType.class);
-        classes.add(LauncherMain.class);
-        classes.add(MapReduceMain.class);
         classes.add(PigMain.class);
-        classes.add(OoziePigStats.class);
+        classes.add(JSONParser.class);
         assertEquals(classes, ae.getLauncherClasses());
 
         Element actionXml = XmlUtils.parseXml("<pig>" +

Modified: oozie/trunk/sharelib/sqoop/src/test/java/org/apache/oozie/action/hadoop/TestSqoopActionExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/sharelib/sqoop/src/test/java/org/apache/oozie/action/hadoop/TestSqoopActionExecutor.java?rev=1520624&r1=1520623&r2=1520624&view=diff
==============================================================================
--- oozie/trunk/sharelib/sqoop/src/test/java/org/apache/oozie/action/hadoop/TestSqoopActionExecutor.java (original)
+++ oozie/trunk/sharelib/sqoop/src/test/java/org/apache/oozie/action/hadoop/TestSqoopActionExecutor.java Fri Sep  6 16:17:17 2013
@@ -123,43 +123,9 @@ public class TestSqoopActionExecutor ext
         setSystemProperty("oozie.service.ActionService.executor.classes", SqoopActionExecutor.class.getName());
     }
 
-    public void testSetupMethodsWithLauncherJar() throws Exception {
-        String defaultVal = Services.get().getConf().get("oozie.action.ship.launcher.jar");
-        try {
-            Services.get().getConf().set("oozie.action.ship.launcher.jar", "true");
-            _testSetupMethods(true);
-        }
-        finally {
-            // back to default
-            if (defaultVal != null) {
-                Services.get().getConf().set("oozie.action.ship.launcher.jar", defaultVal);
-            }
-        }
-     }
-
-    public void testSetupMethodsWithoutLauncherJar() throws Exception {
-        String defaultVal = Services.get().getConf().get("oozie.action.ship.launcher.jar");
-        try {
-            Services.get().getConf().set("oozie.action.ship.launcher.jar", "false");
-            _testSetupMethods(false);
-        }
-        finally {
-            // back to default
-            if (defaultVal != null) {
-                Services.get().getConf().set("oozie.action.ship.launcher.jar", defaultVal);
-            }
-        }
-    }
-
-    public void _testSetupMethods(boolean launcherJarShouldExist) throws Exception {
+    public void testSetupMethods() throws Exception {
         SqoopActionExecutor ae = new SqoopActionExecutor();
-        Path jar = new Path(ae.getOozieRuntimeDir(), ae.getLauncherJarName());
-        File fJar = new File(jar.toString());
-        fJar.delete();
-        assertFalse(fJar.exists());
-        ae.createLauncherJar();
-        assertEquals(launcherJarShouldExist, fJar.exists());
-
+        assertEquals(SqoopMain.class, ae.getLauncherClasses().get(0));
         assertEquals("sqoop", ae.getType());
     }
 

Modified: oozie/trunk/sharelib/streaming/src/test/java/org/apache/oozie/action/hadoop/TestMapReduceActionExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/sharelib/streaming/src/test/java/org/apache/oozie/action/hadoop/TestMapReduceActionExecutor.java?rev=1520624&r1=1520623&r2=1520624&view=diff
==============================================================================
--- oozie/trunk/sharelib/streaming/src/test/java/org/apache/oozie/action/hadoop/TestMapReduceActionExecutor.java (original)
+++ oozie/trunk/sharelib/streaming/src/test/java/org/apache/oozie/action/hadoop/TestMapReduceActionExecutor.java Fri Sep  6 16:17:17 2013
@@ -49,6 +49,7 @@ import java.io.OutputStreamWriter;
 import java.io.StringReader;
 import java.net.URI;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 import java.util.Scanner;
@@ -75,63 +76,10 @@ public class TestMapReduceActionExecutor
                 + "</configuration>" + "</map-reduce>");
     }
 
-    public void testSetupMethodsWithLauncherJar() throws Exception {
-        String defaultVal = Services.get().getConf().get("oozie.action.ship.launcher.jar");
-        try {
-            Services.get().getConf().set("oozie.action.ship.launcher.jar", "true");
-            _testSetupMethods(true);
-        }
-        finally {
-            // back to default
-            if (defaultVal != null) {
-                Services.get().getConf().set("oozie.action.ship.launcher.jar", defaultVal);
-            }
-        }
-     }
-
-    public void testSetupMethodsWithoutLauncherJar() throws Exception {
-        String defaultVal = Services.get().getConf().get("oozie.action.ship.launcher.jar");
-        try {
-            Services.get().getConf().set("oozie.action.ship.launcher.jar", "false");
-            _testSetupMethods(false);
-        }
-        finally {
-            // back to default
-            if (defaultVal != null) {
-                Services.get().getConf().set("oozie.action.ship.launcher.jar", defaultVal);
-            }
-        }
-    }
-
-    public void _testSetupMethods(boolean launcherJarShouldExist) throws Exception {
+    @SuppressWarnings("unchecked")
+    public void testSetupMethods() throws Exception {
         MapReduceActionExecutor ae = new MapReduceActionExecutor();
-        Path jar = new Path(ae.getOozieRuntimeDir(), ae.getLauncherJarName());
-        File fJar = new File(jar.toString());
-        fJar.delete();
-        assertFalse(fJar.exists());
-        ae.createLauncherJar();
-        assertEquals(launcherJarShouldExist, fJar.exists());
-
-        assertEquals("map-reduce", ae.getType());
-
-        assertEquals("map-reduce-launcher.jar", ae.getLauncherJarName());
-
-        if (launcherJarShouldExist) {
-            List<Class> classes = new ArrayList<Class>();
-            classes.add(LauncherMapper.class);
-            classes.add(LauncherSecurityManager.class);
-            classes.add(LauncherException.class);
-            classes.add(LauncherMainException.class);
-            classes.add(PrepareActionsDriver.class);
-            classes.addAll(Services.get().get(URIHandlerService.class).getClassesForLauncher());
-            classes.add(ActionStats.class);
-            classes.add(ActionType.class);
-            classes.add(LauncherMain.class);
-            classes.add(MapReduceMain.class);
-            classes.add(PipesMain.class);
-            classes.add(StreamingMain.class);
-            assertEquals(classes, ae.getLauncherClasses());
-        }
+        assertEquals(Arrays.asList(StreamingMain.class), ae.getLauncherClasses());
 
         Element actionXml = XmlUtils.parseXml("<map-reduce>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>"
                 + "<name-node>" + getNameNodeUri() + "</name-node>" + "<configuration>"

Modified: oozie/trunk/sharelib/streaming/src/test/java/org/apache/oozie/action/hadoop/TestMapReduceActionExecutorUberJar.java
URL: http://svn.apache.org/viewvc/oozie/trunk/sharelib/streaming/src/test/java/org/apache/oozie/action/hadoop/TestMapReduceActionExecutorUberJar.java?rev=1520624&r1=1520623&r2=1520624&view=diff
==============================================================================
--- oozie/trunk/sharelib/streaming/src/test/java/org/apache/oozie/action/hadoop/TestMapReduceActionExecutorUberJar.java (original)
+++ oozie/trunk/sharelib/streaming/src/test/java/org/apache/oozie/action/hadoop/TestMapReduceActionExecutorUberJar.java Fri Sep  6 16:17:17 2013
@@ -46,16 +46,6 @@ public class TestMapReduceActionExecutor
     }
 
     @Override
-    public void testSetupMethodsWithLauncherJar() throws Exception {
-        // skip test
-    }
-
-    @Override
-    public void testSetupMethodsWithoutLauncherJar() throws Exception {
-        // skip test
-    }
-
-    @Override
     public void testMapReduceWithCredentials() throws Exception {
         // skip test
     }