Author: rkanter
Date: Thu Dec  5 02:07:55 2013
New Revision: 1547994

URL: http://svn.apache.org/r1547994
Log:
OOZIE-1633 Test failures related to sharelib when running against Hadoop 2 
(rkanter)

Modified:
    
oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java
    
oozie/trunk/core/src/test/java/org/apache/oozie/service/TestShareLibService.java
    oozie/trunk/release-log.txt

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=1547994&r1=1547993&r2=1547994&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
 Thu Dec  5 02:07:55 2013
@@ -1246,8 +1246,14 @@ public class TestJavaActionExecutor exte
 
         // Set sharelib to a relative path (i.e. no scheme nor authority)
         Services.get().destroy();
-        setSystemProperty(WorkflowAppService.SYSTEM_LIB_PATH, "/user/" + 
getOozieUser() + "/share/");
+        setSystemProperty(WorkflowAppService.SYSTEM_LIB_PATH, "/user/" + 
getTestUser()+ "/share/");
         new Services().init();
+        // Create the dir
+        WorkflowAppService wps = Services.get().get(WorkflowAppService.class);
+        Path systemLibPath = new Path(wps.getSystemLibPath(), 
ShareLibService.SHARED_LIB_PREFIX
+                + new SimpleDateFormat("yyyyMMddHHmmss").format(new 
Date()).toString());
+        Path javaShareLibPath = new Path(systemLibPath, 
"java-action-executor");
+        getFileSystem().mkdirs(javaShareLibPath);
         Services.get().setService(ShareLibService.class);
 
         Path appPath = getAppPath();
@@ -1262,6 +1268,7 @@ public class TestJavaActionExecutor exte
         // invalid, and not the sharelib path because it doesn't have a scheme 
or authority
         try {
             ae.addShareLib(appPath, conf, new 
String[]{"java-action-executor"});
+            fail();
         }
         catch (ActionExecutorException aee) {
             assertEquals("E0902", aee.getErrorCode());
@@ -1270,7 +1277,7 @@ public class TestJavaActionExecutor exte
 
         // Set sharelib to a full path (i.e. include scheme and authority)
         Services.get().destroy();
-        setSystemProperty(WorkflowAppService.SYSTEM_LIB_PATH, getNameNodeUri() 
+ "/user/" + getOozieUser() + "/share/");
+        setSystemProperty(WorkflowAppService.SYSTEM_LIB_PATH, getNameNodeUri() 
+ "/user/" + getTestUser() + "/share/");
         new Services().init();
         Services.get().setService(ShareLibService.class);
         appPath = new Path("foo://bar:1234/blah");

Modified: 
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=1547994&r1=1547993&r2=1547994&view=diff
==============================================================================
--- 
oozie/trunk/core/src/test/java/org/apache/oozie/service/TestShareLibService.java
 (original)
+++ 
oozie/trunk/core/src/test/java/org/apache/oozie/service/TestShareLibService.java
 Thu Dec  5 02:07:55 2013
@@ -173,8 +173,17 @@ public class TestShareLibService extends
         ae.setLibFilesArchives(context, eActionXml, new 
Path("hdfs://dummyAppPath"), jobConf);
 
         URI[] cacheFiles = DistributedCache.getCacheFiles(jobConf);
-        assertEquals(2, cacheFiles.length);
-        assertTrue(cacheFiles[0].getPath().endsWith("MyPig.jar") || 
cacheFiles[1].getPath().endsWith("MyPig.jar"));
+        String cacheFilesStr = Arrays.toString(cacheFiles);
+        assertTrue(cacheFilesStr.contains("MyPig.jar"));
+        assertTrue(cacheFilesStr.contains("MyOozie.jar"));
+        // Hadoop 2 has two extra jars
+        if (cacheFiles.length == 4) {
+            assertTrue(cacheFilesStr.contains("MRAppJar.jar"));
+            
assertTrue(cacheFilesStr.contains("hadoop-mapreduce-client-jobclient-"));
+        }
+        else {
+            assertEquals(2, cacheFiles.length);
+        }
         services.destroy();
 
     }
@@ -221,9 +230,18 @@ public class TestShareLibService extends
         ae.setLibFilesArchives(context, eActionXml, new 
Path("hdfs://dummyAppPath"), jobConf);
 
         URI[] cacheFiles = DistributedCache.getCacheFiles(jobConf);
-        assertEquals(3, cacheFiles.length);
-        assertTrue(cacheFiles[0].getPath().endsWith("pig-10.jar") || 
cacheFiles[1].getPath().endsWith("pig-10.jar")
-                || cacheFiles[2].getPath().endsWith("pig-10.jar"));
+        String cacheFilesStr = Arrays.toString(cacheFiles);
+        assertTrue(cacheFilesStr.contains("MyPig.jar"));
+        assertTrue(cacheFilesStr.contains("MyOozie.jar"));
+        assertTrue(cacheFilesStr.contains("pig-10.jar"));
+        // Hadoop 2 has two extra jars
+        if (cacheFiles.length == 5) {
+            assertTrue(cacheFilesStr.contains("MRAppJar.jar"));
+            
assertTrue(cacheFilesStr.contains("hadoop-mapreduce-client-jobclient-"));
+        }
+        else {
+            assertEquals(3, cacheFiles.length);
+        }
         services.destroy();
 
     }
@@ -418,8 +436,17 @@ public class TestShareLibService extends
         jobConf.set("oozie.action.sharelib.for.pig", "pig_10");
         ae.setLibFilesArchives(context, eActionXml, new 
Path("hdfs://dummyAppPath"), jobConf);
         URI[] cacheFiles = DistributedCache.getCacheFiles(jobConf);
-        assertEquals(2, cacheFiles.length);
-        assertTrue(cacheFiles[0].getPath().endsWith("pig-10.jar") || 
cacheFiles[1].getPath().endsWith("pig-10.jar"));
+        String cacheFilesStr = Arrays.toString(cacheFiles);
+        assertTrue(cacheFilesStr.contains("pig-10.jar"));
+        assertTrue(cacheFilesStr.contains("oozie_luncher.jar"));
+        // Hadoop 2 has two extra jars
+        if (cacheFiles.length == 4) {
+            assertTrue(cacheFilesStr.contains("MRAppJar.jar"));
+            
assertTrue(cacheFilesStr.contains("hadoop-mapreduce-client-jobclient-"));
+        }
+        else {
+            assertEquals(2, cacheFiles.length);
+        }
         services.destroy();
 
     }

Modified: oozie/trunk/release-log.txt
URL: 
http://svn.apache.org/viewvc/oozie/trunk/release-log.txt?rev=1547994&r1=1547993&r2=1547994&view=diff
==============================================================================
--- oozie/trunk/release-log.txt (original)
+++ oozie/trunk/release-log.txt Thu Dec  5 02:07:55 2013
@@ -1,5 +1,6 @@
 -- Oozie 4.1.0 release (trunk - unreleased)
 
+OOZIE-1633 Test failures related to sharelib when running against Hadoop 2 
(rkanter)
 OOZIE-1598 enable html email in email action (puru via ryota)
 OOZIE-1631 Tools module should have a direct dependency on mockito (rkanter)
 OOZIE-1491 Make sure HA works with a secure ZooKeeper (rkanter)


Reply via email to