Repository: oozie
Updated Branches:
  refs/heads/master e68ffd984 -> fc2ecf474


OOZIE-1789 Support backward compatibility of oozie share lib (shwethags)


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

Branch: refs/heads/master
Commit: fc2ecf4745e87a0761d2585be1cb56ac96991449
Parents: e68ffd9
Author: Shwetha GS <[email protected]>
Authored: Thu Oct 30 16:23:32 2014 +0530
Committer: Shwetha GS <[email protected]>
Committed: Thu Oct 30 16:23:32 2014 +0530

----------------------------------------------------------------------
 .../apache/oozie/service/ShareLibService.java   |  7 ++++--
 .../oozie/service/TestShareLibService.java      | 25 ++++++++++++++++++--
 release-log.txt                                 |  1 +
 3 files changed, 29 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oozie/blob/fc2ecf47/core/src/main/java/org/apache/oozie/service/ShareLibService.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/service/ShareLibService.java 
b/core/src/main/java/org/apache/oozie/service/ShareLibService.java
index 63c5a41..ea500c5 100644
--- a/core/src/main/java/org/apache/oozie/service/ShareLibService.java
+++ b/core/src/main/java/org/apache/oozie/service/ShareLibService.java
@@ -116,8 +116,7 @@ public class ShareLibService implements Service, 
Instrumentable {
         } catch(Throwable e) {
             if (failOnfailure) {
                 LOG.error("Sharelib initialization fails", e);
-                throw new ServiceException(ErrorCode.E0104, 
getClass().getName(), "Sharelib initialization fails. "
-                        + e.getMessage());
+                throw new ServiceException(ErrorCode.E0104, 
getClass().getName(), "Sharelib initialization fails. ", e);
             }
             else {
                 // We don't want to actually fail init by throwing an 
Exception, so only create the ServiceException and
@@ -606,6 +605,10 @@ public class ShareLibService implements Service, 
Instrumentable {
                 max = d;
             }
         }
+        //If there are no timestamped directories, fall back to root directory
+        if (path == null) {
+            path = rootDir;
+        }
         return path;
     }
 

http://git-wip-us.apache.org/repos/asf/oozie/blob/fc2ecf47/core/src/test/java/org/apache/oozie/service/TestShareLibService.java
----------------------------------------------------------------------
diff --git 
a/core/src/test/java/org/apache/oozie/service/TestShareLibService.java 
b/core/src/test/java/org/apache/oozie/service/TestShareLibService.java
index 68cb357..67bb2e5 100644
--- a/core/src/test/java/org/apache/oozie/service/TestShareLibService.java
+++ b/core/src/test/java/org/apache/oozie/service/TestShareLibService.java
@@ -395,13 +395,34 @@ public class TestShareLibService extends XFsTestCase {
     }
 
     @Test
-    public void testGetShareLibPath() throws Exception {
+    public void testGetShareLibCompatible() throws Exception {
         services = new Services();
         setSystemProps();
         FileSystem fs = getFileSystem();
-        Date time = new Date(System.currentTimeMillis());
+        Path basePath = new 
Path(services.getConf().get(WorkflowAppService.SYSTEM_LIB_PATH));
+
+        //Use basepath if there is no timestamped directory
+        fs.mkdirs(basePath);
+        Path pigPath = new Path(basePath.toString() + Path.SEPARATOR + "pig");
+        fs.mkdirs(pigPath);
+        try {
+            services.init();
+            ShareLibService shareLibService = 
Services.get().get(ShareLibService.class);
+            assertNotNull(shareLibService.getShareLibJars("pig"));
+        } finally {
+            services.destroy();
+        }
+    }
 
+    @Test
+    public void testGetShareLibPath() throws Exception {
+        services = new Services();
+        setSystemProps();
+        FileSystem fs = getFileSystem();
         Path basePath = new 
Path(services.getConf().get(WorkflowAppService.SYSTEM_LIB_PATH));
+
+        //Use timedstamped directory if available
+        Date time = new Date(System.currentTimeMillis());
         Path libpath = new Path(basePath, ShareLibService.SHARED_LIB_PREFIX + 
ShareLibService.dateFormat.format(time));
         fs.mkdirs(libpath);
 

http://git-wip-us.apache.org/repos/asf/oozie/blob/fc2ecf47/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index b1bb2e5..022ba0a 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -40,6 +40,7 @@ OOZIE-1943 Bump up trunk to 4.2.0-SNAPSHOT (bzhang)
 
 -- Oozie 4.1.0 release (4.1 - unreleased)
 
+OOZIE-1789 Support backward compatibility of oozie share lib (shwethags)
 OOZIE-2034 Disable SSLv3 (POODLEbleed vulnerability) (rkanter)
 OOZIE-2005 Coordinator rerun fails to initialize error code and message (ryota)
 OOZIE-2026 fix synchronization in SLACalculatorMemory.addJobStatus to avoid 
duplicated SLA message (ryota)

Reply via email to