Author: tucu
Date: Wed Mar 14 20:45:56 2012
New Revision: 1300715

URL: http://svn.apache.org/viewvc?rev=1300715&view=rev
Log:
OOZIE-761 Fixes in CoordELFunctions and testcases for Hadoop 0.23 (tucu)

Modified:
    
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/coord/CoordELFunctions.java
    
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/wf/TestSubmitMRXCommand.java
    
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/coord/TestCoordELEvaluator.java
    
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestHadoopAccessorService.java
    incubator/oozie/trunk/release-log.txt

Modified: 
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/coord/CoordELFunctions.java
URL: 
http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/coord/CoordELFunctions.java?rev=1300715&r1=1300714&r2=1300715&view=diff
==============================================================================
--- 
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/coord/CoordELFunctions.java
 (original)
+++ 
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/coord/CoordELFunctions.java
 Wed Mar 14 20:45:56 2012
@@ -244,8 +244,6 @@ public class CoordELFunctions {
             boolean resolved = false;
             String user = ParamChecker
                     .notEmpty((String) 
eval.getVariable(OozieClient.USER_NAME), OozieClient.USER_NAME);
-            String group = ParamChecker.notEmpty((String) 
eval.getVariable(OozieClient.GROUP_NAME),
-                    OozieClient.GROUP_NAME);
             String doneFlag = ds.getDoneFlag();
             while (instance >= checkedInstance) {
                 ELEvaluator uriEval = getUriEvaluator(nominalInstanceCal);
@@ -254,7 +252,7 @@ public class CoordELFunctions {
                 if (doneFlag.length() > 0) {
                     pathWithDoneFlag += "/" + doneFlag;
                 }
-                if (isPathAvailable(pathWithDoneFlag, user, group, conf)) {
+                if (isPathAvailable(pathWithDoneFlag, user, null, conf)) {
                     XLog.getLog(CoordELFunctions.class).debug("Found future(" 
+ available + "): " + pathWithDoneFlag);
                     if (available == n) {
                         XLog.getLog(CoordELFunctions.class).debug("Found 
future File: " + pathWithDoneFlag);
@@ -758,8 +756,6 @@ public class CoordELFunctions {
             boolean resolved = false;
             String user = ParamChecker
                     .notEmpty((String) 
eval.getVariable(OozieClient.USER_NAME), OozieClient.USER_NAME);
-            String group = ParamChecker.notEmpty((String) 
eval.getVariable(OozieClient.GROUP_NAME),
-                                                 OozieClient.GROUP_NAME);
             String doneFlag = ds.getDoneFlag();
             while (nominalInstanceCal.compareTo(initInstance) >= 0) {
                 ELEvaluator uriEval = getUriEvaluator(nominalInstanceCal);
@@ -768,7 +764,7 @@ public class CoordELFunctions {
                 if (doneFlag.length() > 0) {
                     pathWithDoneFlag += "/" + doneFlag;
                 }
-                if (isPathAvailable(pathWithDoneFlag, user, group, conf)) {
+                if (isPathAvailable(pathWithDoneFlag, user, null, conf)) {
                     XLog.getLog(CoordELFunctions.class).debug("Found latest(" 
+ available + "): " + pathWithDoneFlag);
                     if (available == offset) {
                         XLog.getLog(CoordELFunctions.class).debug("Found 
Latest File: " + pathWithDoneFlag);

Modified: 
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/wf/TestSubmitMRXCommand.java
URL: 
http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/wf/TestSubmitMRXCommand.java?rev=1300715&r1=1300714&r2=1300715&view=diff
==============================================================================
--- 
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/wf/TestSubmitMRXCommand.java
 (original)
+++ 
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/wf/TestSubmitMRXCommand.java
 Wed Mar 14 20:45:56 2012
@@ -21,11 +21,17 @@ import org.apache.hadoop.conf.Configurat
 import org.apache.oozie.client.OozieClient;
 import org.apache.oozie.local.LocalOozie;
 import org.apache.oozie.client.XOozieClient;
+import org.apache.oozie.service.Services;
+import org.apache.oozie.service.WorkflowAppService;
 import org.apache.oozie.test.XFsTestCase;
 import org.apache.oozie.util.XLog;
 import org.apache.oozie.util.XmlUtils;
 import org.apache.oozie.service.XLogService;
 import org.jdom.Element;
+import org.jdom.Namespace;
+
+import java.util.HashMap;
+import java.util.Map;
 
 public class TestSubmitMRXCommand extends XFsTestCase {
     @Override
@@ -59,42 +65,32 @@ public class TestSubmitMRXCommand extend
 
         XLog.getLog(getClass()).info("xml = " + xml);
 
-        StringBuilder sb = new StringBuilder();
-        sb.append("<workflow-app xmlns=\"uri:oozie:workflow:0.2\" 
name=\"oozie-mapreduce\">");
-        sb.append("<start to=\"hadoop1\" />");
-        sb.append("<action name=\"hadoop1\">");
-        sb.append("<map-reduce>");
-        sb.append("<job-tracker>jobtracker</job-tracker>");
-        sb.append("<name-node>namenode</name-node>");
-        sb.append("<configuration>");
-        sb.append("<property>");
-        sb.append("<name>mapred.mapper.class</name>");
-        sb.append("<value>A.Mapper</value>");
-        sb.append("</property>");
-        sb.append("<property>");
-        sb.append("<name>mapred.reducer.class</name>");
-        sb.append("<value>A.Reducer</value>");
-        sb.append("</property>");
-        sb.append("</configuration>");
-        sb.append("<file>/user/oozie/input1.txt#input1.txt</file>");
-        sb.append("<file>/user/oozie/input2.txt#my.txt</file>");
-        sb.append("<archive>/user/oozie/udf1.jar#udf1.jar</archive>");
-        sb.append("<archive>/user/oozie/udf2.jar#my.jar</archive>");
-        sb.append("</map-reduce>");
-        sb.append("<ok to=\"end\" />");
-        sb.append("<error to=\"fail\" />");
-        sb.append("</action>");
-        sb.append("<kill name=\"fail\">");
-        sb.append("<message>Map/Reduce failed, error 
message[${wf:errorMessage(wf:lastErrorNode())}]</message>");
-        sb.append("</kill>");
-        sb.append("<end name=\"end\" />");
-        sb.append("</workflow-app>");
-
-        Element root = XmlUtils.parseXml(sb.toString());
-        String reference = XmlUtils.prettyPrint(root).toString();
+        //verifying is a valid WF
+        WorkflowAppService wps = Services.get().get(WorkflowAppService.class);
+        wps.parseDef(xml);
+
+        Element wfE = XmlUtils.parseXml(xml);
+        Namespace ns = wfE.getNamespace();
+        Element actionE = wfE.getChild("action", ns).getChild("map-reduce", 
ns);
+        Element confE = actionE.getChild("configuration", ns);
+        Map<String, String> props = new HashMap<String, String>();
+        for (Object prop : confE.getChildren("property", ns)) {
+            Element propE = (Element) prop;
+            String name = propE.getChild("name", ns).getTextTrim();
+            String value = propE.getChild("value", ns).getTextTrim();
+            props.put(name, value);
+        }
+        Map<String, String> expected = new HashMap<String, String>();
+        expected.put("mapred.mapper.class", "A.Mapper");
+        expected.put("mapred.reducer.class", "A.Reducer");
+        for (Map.Entry<String, String> entry : expected.entrySet()) {
+            assertEquals(entry.getValue(), expected.get(entry.getKey()));
+        }
+        assertEquals("/user/oozie/input1.txt#input1.txt", 
((Element)actionE.getChildren("file", ns).get(0)).getTextTrim());
+        assertEquals("/user/oozie/input2.txt#my.txt", 
((Element)actionE.getChildren("file", ns).get(1)).getTextTrim());
+        assertEquals("/user/oozie/udf1.jar#udf1.jar", 
((Element)actionE.getChildren("archive", ns).get(0)).getTextTrim());
+        assertEquals("/user/oozie/udf2.jar#my.jar", 
((Element)actionE.getChildren("archive", ns).get(1)).getTextTrim());
 
-        XLog.getLog(getClass()).info("reference xml = " + reference);
-        assertTrue(xml.equals(reference));
     }
 
     public void testWFXmlGenerationNegative1() throws Exception {

Modified: 
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/coord/TestCoordELEvaluator.java
URL: 
http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/java/org/apache/oozie/coord/TestCoordELEvaluator.java?rev=1300715&r1=1300714&r2=1300715&view=diff
==============================================================================
--- 
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/coord/TestCoordELEvaluator.java
 (original)
+++ 
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/coord/TestCoordELEvaluator.java
 Wed Mar 14 20:45:56 2012
@@ -33,10 +33,21 @@ import org.apache.oozie.util.XmlUtils;
 import org.jdom.Element;
 
 public class TestCoordELEvaluator extends XTestCase {
-    public void testSetup() throws Exception {
+
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
         new Services().init();
     }
 
+    @Override
+    protected void tearDown() throws Exception {
+        if (Services.get() != null) {
+            Services.get().destroy();
+        }
+        super.tearDown();
+    }
+
     public void testCreateFreqELValuator() throws Exception {
         // System.out.println("CP :" + System.getProperty("java.class.path"));
         // Configuration conf = new
@@ -219,7 +230,6 @@ public class TestCoordELEvaluator extend
                         + "<property> <name>end</name> 
<value>2009-02-03T23:59Z</value> </property> "
                         + "<property> <name>timezone</name> <value>UTC</value> 
</property> "
                         + "<property> <name>user.name</name> 
<value>test_user</value> </property> "
-                        + "<property> <name>group.name</name> 
<value>test_group</value> </property> "
                         + "<property> <name>timeout</name>  <value>180</value> 
 </property> "
                         + "<property> <name>concurrency_level</name> 
<value>1</value> </property> "
                         + "<property> <name>execution_order</name> 
<value>LIFO</value> </property>"

Modified: 
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestHadoopAccessorService.java
URL: 
http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestHadoopAccessorService.java?rev=1300715&r1=1300714&r2=1300715&view=diff
==============================================================================
--- 
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestHadoopAccessorService.java
 (original)
+++ 
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestHadoopAccessorService.java
 Wed Mar 14 20:45:56 2012
@@ -38,7 +38,7 @@ public class TestHadoopAccessorService e
         OutputStream os = new FileOutputStream(new File(getTestCaseConfDir() + 
"/hadoop-confx", "core-site.xml"));
         IOUtils.copyStream(is, os);
         
setSystemProperty("oozie.service.HadoopAccessorService.hadoop.configurations",
-                          "*=hadoop-conf,test=hadoop-confx");
+                          "*=hadoop-conf,jt=hadoop-confx");
         if (System.getProperty("oozie.test.hadoop.security", 
"simple").equals("kerberos")) {
             
setSystemProperty("oozie.service.HadoopAccessorService.kerberos.enabled", 
"true");
             
setSystemProperty("oozie.service.HadoopAccessorService.keytab.file", 
getKeytabFile());
@@ -58,8 +58,8 @@ public class TestHadoopAccessorService e
         HadoopAccessorService has = services.get(HadoopAccessorService.class);
         assertNotNull(has);
         assertNotNull(has.createJobConf("*"));
-        assertNotNull(has.createJobConf("test"));
-        assertEquals("bar", has.createJobConf("test").get("foo"));
+        assertNotNull(has.createJobConf("jt"));
+        assertEquals("bar", has.createJobConf("jt").get("foo"));
     }
     public void testAccessor() throws Exception {
         Services services = Services.get();

Modified: incubator/oozie/trunk/release-log.txt
URL: 
http://svn.apache.org/viewvc/incubator/oozie/trunk/release-log.txt?rev=1300715&r1=1300714&r2=1300715&view=diff
==============================================================================
--- incubator/oozie/trunk/release-log.txt (original)
+++ incubator/oozie/trunk/release-log.txt Wed Mar 14 20:45:56 2012
@@ -1,5 +1,6 @@
 -- Oozie 3.2.0 release
 
+OOZIE-761 Fixes in CoordELFunctions and testcases for Hadoop 0.23 (tucu)
 OOZIE-760 oozied.sh needs to be able to pick up CATALINA_HOME (rvs via tucu)
 OOZIE-757 hive-contrib version should use ${hive.version} (abayer via tucu)
 OOZIE-274 move callback HTTP endpoint outside of the versioned WS endpoints 
(tucu)


Reply via email to