Repository: oozie
Updated Branches:
  refs/heads/master e9d3d3cb2 -> a6ed8d77a


OOZIE-2512 ShareLibservice returns incorrect path for jar


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

Branch: refs/heads/master
Commit: a6ed8d77a11fe19e360d1577a1ab0a55de8c89f8
Parents: e9d3d3c
Author: Purshotam Shah <[email protected]>
Authored: Tue May 10 09:51:41 2016 -0700
Committer: Purshotam Shah <[email protected]>
Committed: Tue May 10 09:51:41 2016 -0700

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


http://git-wip-us.apache.org/repos/asf/oozie/blob/a6ed8d77/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 81a9f2d..ccf9549 100644
--- a/core/src/main/java/org/apache/oozie/service/ShareLibService.java
+++ b/core/src/main/java/org/apache/oozie/service/ShareLibService.java
@@ -287,12 +287,12 @@ public class ShareLibService implements Service, 
Instrumentable {
         try {
             if (fs.isFile(new Path(new URI(rootDir.toString()).getPath()))) {
                 Path filePath = new Path(new 
URI(rootDir.toString()).getPath());
-
+                Path hdfsFilePath = new Path(
+                        fs.getFileStatus(filePath).getPath().getParent() + "/" 
+ rootDir.getName());
                 if (isFilePartOfConfList(rootDir)) {
                     cachePropertyFile(filePath, shareLibKey, 
shareLibConfigMap);
                 }
-
-                listOfPaths.add(rootDir);
+                listOfPaths.add(hdfsFilePath);
                 return;
             }
 

http://git-wip-us.apache.org/repos/asf/oozie/blob/a6ed8d77/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 842b2d5..b245d35 100644
--- a/core/src/test/java/org/apache/oozie/service/TestShareLibService.java
+++ b/core/src/test/java/org/apache/oozie/service/TestShareLibService.java
@@ -494,6 +494,12 @@ public class TestShareLibService extends XFsTestCase {
             ShareLibService shareLibService = 
Services.get().get(ShareLibService.class);
             
assertTrue(shareLibService.getShareLibJars("something_new").get(0).getName().endsWith("somethingNew.jar"));
             
assertTrue(shareLibService.getShareLibJars("pig").get(0).getName().endsWith("pig.jar"));
+            
assertTrue(shareLibService.getShareLibJars("directjar").get(0).getName().endsWith("direct.jar"));
+            
assertTrue(shareLibService.getShareLibJars("linkFile").get(0).getName().endsWith("#renamedLinkFile.xml"));
+            List<Path> listOfPaths = 
shareLibService.getShareLibJars("directjar");
+            for (Path p : listOfPaths) {
+                assertTrue(p.toString().startsWith("hdfs"));
+            }
             fs.delete(new Path("shareLibPath/"), true);
         }
         finally {
@@ -755,16 +761,28 @@ public class TestShareLibService extends XFsTestCase {
             String testPath = "shareLibPath/";
 
             Path basePath = new Path(testPath + Path.SEPARATOR + "testPath");
-
             Path somethingNew = new Path(testPath + Path.SEPARATOR + 
"something_new");
+            Path directJarDir = new Path(testPath + Path.SEPARATOR + 
"directJarDir");
+            Path linkDir = new Path(testPath + Path.SEPARATOR + "linkDir");
+
             fs.mkdirs(basePath);
             fs.mkdirs(somethingNew);
+            fs.mkdirs(directJarDir);
+            fs.mkdirs(linkDir);
 
             createFile(basePath.toString() + Path.SEPARATOR + "pig" + 
Path.SEPARATOR + "pig.jar");
             createFile(somethingNew.toString() + Path.SEPARATOR + 
"somethingNew" + Path.SEPARATOR + "somethingNew.jar");
+            String directJarPath = directJarDir.toString() + Path.SEPARATOR + 
"direct.jar";
+            String linkFilePath = linkDir.toString() + Path.SEPARATOR + 
"linkFile.xml";
+            createFile(directJarPath);
+            createFile(linkFilePath);
 
             prop.put(ShareLibService.SHARE_LIB_CONF_PREFIX + ".pig", 
"/user/test/" + basePath.toString());
             prop.put(ShareLibService.SHARE_LIB_CONF_PREFIX + ".something_new", 
"/user/test/" + somethingNew.toString());
+            prop.put(ShareLibService.SHARE_LIB_CONF_PREFIX + ".directjar",
+                    "/user/test/" + directJarPath.toString());
+            prop.put(ShareLibService.SHARE_LIB_CONF_PREFIX + ".linkFile",
+                    "/user/test/" + linkFilePath.toString() + 
"#renamedLinkFile.xml");
             createTestShareLibMetaFile(fs, prop);
 
         }

http://git-wip-us.apache.org/repos/asf/oozie/blob/a6ed8d77/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index e9aa963..035bc12 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
 -- Oozie 4.3.0 release (trunk - unreleased)
 
+OOZIE-2512 ShareLibservice returns incorrect path for jar (satishsaley via 
puru)
 OOZIE-2471 Show child job url tab for distcp (satishsaley via puru)
 OOZIE-2511 SubWorkflow missing variable set from option if config-default is 
present in parent workflow (asasvari via rkanter)
 OOZIE-2391 spark-opts value in workflow.xml is not parsed properly (gezapeti 
via rkanter)

Reply via email to