You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by tu...@apache.org on 2012/05/22 06:02:51 UTC

svn commit: r1341298 - in /incubator/oozie/trunk: ./ client/src/main/resources/ core/src/main/java/org/apache/oozie/command/bundle/ core/src/main/java/org/apache/oozie/command/coord/ core/src/main/java/org/apache/oozie/command/wf/ core/src/main/java/or...

Author: tucu
Date: Tue May 22 04:02:50 2012
New Revision: 1341298

URL: http://svn.apache.org/viewvc?rev=1341298&view=rev
Log:
OOZIE-637 parametrization of 'name' attribute in workflow/coordinator/bundle (tucu)

Added:
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/ELUtils.java
Modified:
    incubator/oozie/trunk/client/src/main/resources/oozie-bundle-0.1.xsd
    incubator/oozie/trunk/client/src/main/resources/oozie-coordinator-0.1.xsd
    incubator/oozie/trunk/client/src/main/resources/oozie-coordinator-0.2.xsd
    incubator/oozie/trunk/client/src/main/resources/oozie-workflow-0.1.xsd
    incubator/oozie/trunk/client/src/main/resources/oozie-workflow-0.2.5.xsd
    incubator/oozie/trunk/client/src/main/resources/oozie-workflow-0.2.xsd
    incubator/oozie/trunk/client/src/main/resources/oozie-workflow-0.3.xsd
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleSubmitXCommand.java
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordSubmitXCommand.java
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/wf/SubmitXCommand.java
    incubator/oozie/trunk/core/src/main/resources/oozie-default.xml
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleStartXCommand.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordSubmitXCommand.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/wf/TestSubmitXCommand.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/test/XDataTestCase.java
    incubator/oozie/trunk/core/src/test/resources/bundle-submit-job.xml
    incubator/oozie/trunk/release-log.txt

Modified: incubator/oozie/trunk/client/src/main/resources/oozie-bundle-0.1.xsd
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/client/src/main/resources/oozie-bundle-0.1.xsd?rev=1341298&r1=1341297&r2=1341298&view=diff
==============================================================================
--- incubator/oozie/trunk/client/src/main/resources/oozie-bundle-0.1.xsd (original)
+++ incubator/oozie/trunk/client/src/main/resources/oozie-bundle-0.1.xsd Tue May 22 04:02:50 2012
@@ -30,7 +30,7 @@
             <xs:element name="controls" type="bundle:CONTROLS" minOccurs="0" maxOccurs="1"/>
             <xs:element name="coordinator" type="bundle:COORDINATOR" minOccurs="1" maxOccurs="unbounded"/>
         </xs:sequence>
-        <xs:attribute name="name" type="bundle:IDENTIFIER" use="required"/>
+        <xs:attribute name="name" type="xs:string" use="required"/>
     </xs:complexType>
     <xs:complexType name="CONTROLS">
         <xs:sequence minOccurs="0" maxOccurs="1">

Modified: incubator/oozie/trunk/client/src/main/resources/oozie-coordinator-0.1.xsd
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/client/src/main/resources/oozie-coordinator-0.1.xsd?rev=1341298&r1=1341297&r2=1341298&view=diff
==============================================================================
--- incubator/oozie/trunk/client/src/main/resources/oozie-coordinator-0.1.xsd (original)
+++ incubator/oozie/trunk/client/src/main/resources/oozie-coordinator-0.1.xsd Tue May 22 04:02:50 2012
@@ -34,7 +34,7 @@
             <xs:element name="output-events" type="coordinator:OUTPUTEVENTS" minOccurs="0" maxOccurs="1"/>
             <xs:element name="action" type="coordinator:ACTION" minOccurs="1" maxOccurs="1"/>
         </xs:sequence>
-        <xs:attribute name="name" type="coordinator:IDENTIFIER" use="required"/>
+        <xs:attribute name="name" type="xs:string" use="required"/>
         <xs:attribute name="frequency" type="xs:string" use="required"/>
         <xs:attribute name="start" type="xs:string" use="required"/>
         <xs:attribute name="end" type="xs:string" use="required"/>

Modified: incubator/oozie/trunk/client/src/main/resources/oozie-coordinator-0.2.xsd
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/client/src/main/resources/oozie-coordinator-0.2.xsd?rev=1341298&r1=1341297&r2=1341298&view=diff
==============================================================================
--- incubator/oozie/trunk/client/src/main/resources/oozie-coordinator-0.2.xsd (original)
+++ incubator/oozie/trunk/client/src/main/resources/oozie-coordinator-0.2.xsd Tue May 22 04:02:50 2012
@@ -34,7 +34,7 @@
             <xs:element name="output-events" type="coordinator:OUTPUTEVENTS" minOccurs="0" maxOccurs="1"/>
             <xs:element name="action" type="coordinator:ACTION" minOccurs="1" maxOccurs="1"/>
         </xs:sequence>
-        <xs:attribute name="name" type="coordinator:IDENTIFIER" use="required"/>
+        <xs:attribute name="name" type="xs:string" use="required"/>
         <xs:attribute name="frequency" type="xs:string" use="required"/>
         <xs:attribute name="start" type="xs:string" use="required"/>
         <xs:attribute name="end" type="xs:string" use="required"/>

Modified: incubator/oozie/trunk/client/src/main/resources/oozie-workflow-0.1.xsd
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/client/src/main/resources/oozie-workflow-0.1.xsd?rev=1341298&r1=1341297&r2=1341298&view=diff
==============================================================================
--- incubator/oozie/trunk/client/src/main/resources/oozie-workflow-0.1.xsd (original)
+++ incubator/oozie/trunk/client/src/main/resources/oozie-workflow-0.1.xsd Tue May 22 04:02:50 2012
@@ -39,7 +39,7 @@
             </xs:choice>
             <xs:element name="end" type="workflow:END" minOccurs="1" maxOccurs="1"/>
         </xs:sequence>
-        <xs:attribute name="name" type="workflow:IDENTIFIER" use="required"/>
+        <xs:attribute name="name" type="xs:string" use="required"/>
     </xs:complexType>
 
     <xs:complexType name="START">

Modified: incubator/oozie/trunk/client/src/main/resources/oozie-workflow-0.2.5.xsd
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/client/src/main/resources/oozie-workflow-0.2.5.xsd?rev=1341298&r1=1341297&r2=1341298&view=diff
==============================================================================
--- incubator/oozie/trunk/client/src/main/resources/oozie-workflow-0.2.5.xsd (original)
+++ incubator/oozie/trunk/client/src/main/resources/oozie-workflow-0.2.5.xsd Tue May 22 04:02:50 2012
@@ -41,7 +41,7 @@
             <xs:element name="end" type="workflow:END" minOccurs="1" maxOccurs="1"/>
             <xs:any namespace="uri:oozie:sla:0.1" minOccurs="0" maxOccurs="1"/>
         </xs:sequence>
-        <xs:attribute name="name" type="workflow:IDENTIFIER" use="required"/>
+        <xs:attribute name="name" type="xs:string" use="required"/>
     </xs:complexType>
 
     <xs:complexType name="START">

Modified: incubator/oozie/trunk/client/src/main/resources/oozie-workflow-0.2.xsd
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/client/src/main/resources/oozie-workflow-0.2.xsd?rev=1341298&r1=1341297&r2=1341298&view=diff
==============================================================================
--- incubator/oozie/trunk/client/src/main/resources/oozie-workflow-0.2.xsd (original)
+++ incubator/oozie/trunk/client/src/main/resources/oozie-workflow-0.2.xsd Tue May 22 04:02:50 2012
@@ -40,7 +40,7 @@
             <xs:element name="end" type="workflow:END" minOccurs="1" maxOccurs="1"/>
             <xs:any namespace="uri:oozie:sla:0.1" minOccurs="0" maxOccurs="1"/>
         </xs:sequence>
-        <xs:attribute name="name" type="workflow:IDENTIFIER" use="required"/>
+        <xs:attribute name="name" type="xs:string" use="required"/>
     </xs:complexType>
 
     <xs:complexType name="START">

Modified: incubator/oozie/trunk/client/src/main/resources/oozie-workflow-0.3.xsd
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/client/src/main/resources/oozie-workflow-0.3.xsd?rev=1341298&r1=1341297&r2=1341298&view=diff
==============================================================================
--- incubator/oozie/trunk/client/src/main/resources/oozie-workflow-0.3.xsd (original)
+++ incubator/oozie/trunk/client/src/main/resources/oozie-workflow-0.3.xsd Tue May 22 04:02:50 2012
@@ -41,7 +41,7 @@
             <xs:element name="end" type="workflow:END" minOccurs="1" maxOccurs="1"/>
             <xs:any namespace="uri:oozie:sla:0.1" minOccurs="0" maxOccurs="1"/>
         </xs:sequence>
-        <xs:attribute name="name" type="workflow:IDENTIFIER" use="required"/>
+        <xs:attribute name="name" type="xs:string" use="required"/>
     </xs:complexType>
 
     <xs:complexType name="START">

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleSubmitXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleSubmitXCommand.java?rev=1341298&r1=1341297&r2=1341298&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleSubmitXCommand.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleSubmitXCommand.java Tue May 22 04:02:50 2012
@@ -56,6 +56,7 @@ import org.apache.oozie.service.UUIDServ
 import org.apache.oozie.util.ConfigUtils;
 import org.apache.oozie.util.DateUtils;
 import org.apache.oozie.util.ELEvaluator;
+import org.apache.oozie.util.ELUtils;
 import org.apache.oozie.util.IOUtils;
 import org.apache.oozie.util.InstrumentUtils;
 import org.apache.oozie.util.LogUtils;
@@ -399,8 +400,9 @@ public class BundleSubmitXCommand extend
 
             bundleJob.setId(jobId);
             bundleJob.setAuthToken(this.authToken);
-            bundleJob.setAppName(XmlUtils.parseXml(bundleBean.getOrigJobXml()).getAttributeValue("name"));
-            bundleJob.setAppName(bundleJob.getAppName());
+            String name = XmlUtils.parseXml(bundleBean.getOrigJobXml()).getAttributeValue("name");
+            name = ELUtils.resolveAppName(name, conf);
+            bundleJob.setAppName(name);
             bundleJob.setAppPath(conf.get(OozieClient.BUNDLE_APP_PATH));
             // bundleJob.setStatus(BundleJob.Status.PREP); //This should be set in parent class.
             bundleJob.setCreatedTime(new Date());

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordSubmitXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordSubmitXCommand.java?rev=1341298&r1=1341297&r2=1341298&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordSubmitXCommand.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordSubmitXCommand.java Tue May 22 04:02:50 2012
@@ -72,6 +72,7 @@ import org.apache.oozie.service.UUIDServ
 import org.apache.oozie.util.ConfigUtils;
 import org.apache.oozie.util.DateUtils;
 import org.apache.oozie.util.ELEvaluator;
+import org.apache.oozie.util.ELUtils;
 import org.apache.oozie.util.IOUtils;
 import org.apache.oozie.util.InstrumentUtils;
 import org.apache.oozie.util.LogUtils;
@@ -574,8 +575,8 @@ public class CoordSubmitXCommand extends
 
         // Application name
         if (this.coordName == null) {
-            val = resolveAttribute("name", eAppXml, evalNofuncs);
-            coordJob.setAppName(val);
+            String name = ELUtils.resolveAppName(eAppXml.getAttribute("name").getValue(), conf);
+            coordJob.setAppName(name);
         }
         else {
             // this coord job is created from bundle

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/wf/SubmitXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/wf/SubmitXCommand.java?rev=1341298&r1=1341297&r2=1341298&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/wf/SubmitXCommand.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/wf/SubmitXCommand.java Tue May 22 04:02:50 2012
@@ -30,6 +30,7 @@ import org.apache.oozie.service.HadoopAc
 import org.apache.oozie.service.Services;
 import org.apache.oozie.service.DagXLogInfoService;
 import org.apache.oozie.util.ConfigUtils;
+import org.apache.oozie.util.ELUtils;
 import org.apache.oozie.util.LogUtils;
 import org.apache.oozie.util.XLog;
 import org.apache.oozie.util.ParamChecker;
@@ -151,7 +152,7 @@ public class SubmitXCommand extends Work
 
             WorkflowJobBean workflow = new WorkflowJobBean();
             workflow.setId(wfInstance.getId());
-            workflow.setAppName(app.getName());
+            workflow.setAppName(ELUtils.resolveAppName(app.getName(), conf));
             workflow.setAppPath(conf.get(OozieClient.APP_PATH));
             workflow.setConf(XmlUtils.prettyPrint(conf).toString());
             workflow.setProtoActionConf(protoActionConf.toXmlString());

Added: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/ELUtils.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/ELUtils.java?rev=1341298&view=auto
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/ELUtils.java (added)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/ELUtils.java Tue May 22 04:02:50 2012
@@ -0,0 +1,53 @@
+/**
+ * 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.util;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.oozie.service.ELService;
+import org.apache.oozie.service.Services;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * EL utilities
+ */
+public class ELUtils {
+
+    /**
+     * Resolves the application name using the configuration properties to resolve any EL variable.
+     *
+     * @param name name to EL resolve.
+     * @param conf configuration to use for resolving any EL variable in the name.
+     *
+     * @return the resolved application name.
+     *
+     * @throws Exception thrown if the name could not be EL resolved.
+     */
+    public static String resolveAppName(String name, Configuration conf) throws Exception {
+        ELService elService = Services.get().get(ELService.class);
+        ELEvaluator elEvaluator = elService.createEvaluator("job-submit");
+        Map<String, Object> map = new HashMap<String, Object>();
+        for (Map.Entry<String, String> entry : conf) {
+            map.put(entry.getKey(), entry.getValue());
+        }
+        elEvaluator.getContext().setVariables(map);
+        return elEvaluator.evaluate(name, String.class);
+    }
+
+}

Modified: incubator/oozie/trunk/core/src/main/resources/oozie-default.xml
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/resources/oozie-default.xml?rev=1341298&r1=1341297&r2=1341298&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/resources/oozie-default.xml (original)
+++ incubator/oozie/trunk/core/src/main/resources/oozie-default.xml Tue May 22 04:02:50 2012
@@ -384,10 +384,28 @@
     <!--  List of supported groups for ELService -->
 	<property>
         <name>oozie.service.ELService.groups</name>
-        <value>workflow,wf-sla-submit,coord-job-submit-freq,coord-job-submit-nofuncs,coord-job-submit-data,coord-job-submit-instances,coord-sla-submit,coord-action-create,coord-action-create-inst,coord-sla-create,coord-action-start</value>
+        <value>job-submit,workflow,wf-sla-submit,coord-job-submit-freq,coord-job-submit-nofuncs,coord-job-submit-data,coord-job-submit-instances,coord-sla-submit,coord-action-create,coord-action-create-inst,coord-sla-create,coord-action-start</value>
         <description>List of groups for different ELServices</description>
     </property>
 
+    <property>
+        <name>oozie.service.ELService.constants.job-submit</name>
+        <value>
+        </value>
+        <description>
+            EL constant declarations, separated by commas, format is [PREFIX:]NAME=CLASS#CONSTANT.
+        </description>
+    </property>
+
+    <property>
+        <name>oozie.service.ELService.functions.job-submit</name>
+        <value>
+        </value>
+        <description>
+          EL functions declarations, separated by commas, format is [PREFIX:]NAME=CLASS#METHOD.
+        </description>
+    </property>
+
 <!-- Workflow specifics -->
     <property>
         <name>oozie.service.ELService.constants.workflow</name>

Modified: incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleStartXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleStartXCommand.java?rev=1341298&r1=1341297&r2=1341298&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleStartXCommand.java (original)
+++ incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleStartXCommand.java Tue May 22 04:02:50 2012
@@ -113,6 +113,9 @@ public class TestBundleStartXCommand ext
 
         BundleJobGetJPAExecutor bundleJobGetExecutor = new BundleJobGetJPAExecutor(submitCmd.getJob().getId());
         job = jpaService.execute(bundleJobGetExecutor);
+        assertEquals("bundle-app-name", job.getAppName());
+        job = jpaService.execute(bundleJobGetExecutor);
+
         assertEquals(job.getStatus(), Job.Status.PREP);
 
         new BundleStartXCommand(job.getId()).call();

Modified: incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordSubmitXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordSubmitXCommand.java?rev=1341298&r1=1341297&r2=1341298&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordSubmitXCommand.java (original)
+++ incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordSubmitXCommand.java Tue May 22 04:02:50 2012
@@ -65,7 +65,7 @@ public class TestCoordSubmitXCommand ext
     public void testBasicSubmit() throws Exception {
         Configuration conf = new XConfiguration();
         String appPath = "file://" + getTestCaseDir() + File.separator + "coordinator.xml";
-        String appXml = "<coordinator-app name=\"NAME\" frequency=\"${coord:days(1)}\" start=\"2009-02-01T01:00Z\" end=\"2009-02-03T23:59Z\" timezone=\"UTC\" "
+        String appXml = "<coordinator-app name=\"${appName}-foo\" frequency=\"${coord:days(1)}\" start=\"2009-02-01T01:00Z\" end=\"2009-02-03T23:59Z\" timezone=\"UTC\" "
                 + "xmlns=\"uri:oozie:coordinator:0.2\"> <controls> "
                 + "<execution>LIFO</execution> </controls> <datasets> "
                 + "<dataset name=\"a\" frequency=\"${coord:days(7)}\" initial-instance=\"2009-02-01T01:00Z\" "
@@ -83,17 +83,18 @@ public class TestCoordSubmitXCommand ext
         writeToFile(appXml, appPath);
         conf.set(OozieClient.COORDINATOR_APP_PATH, appPath);
         conf.set(OozieClient.USER_NAME, getTestUser());
+        conf.set("appName", "var-app-name");
         CoordSubmitXCommand sc = new CoordSubmitXCommand(conf, "UNIT_TESTING");
         String jobId = sc.call();
 
         assertEquals(jobId.substring(jobId.length() - 2), "-C");
         CoordinatorJobBean job = checkCoordJobs(jobId);
-        if (job != null) {
-            assertEquals(job.getTimeout(), Services.get().getConf().getInt(
-                    "oozie.service.coord.normal.default.timeout", -2));
-            assertEquals(job.getConcurrency(), Services.get().getConf().getInt(
-                    "oozie.service.coord.default.concurrency", 1));
-        }
+        assertNotNull(job);
+        assertEquals("var-app-name-foo", job.getAppName());
+        assertEquals(job.getTimeout(), Services.get().getConf().getInt(
+                "oozie.service.coord.normal.default.timeout", -2));
+        assertEquals(job.getConcurrency(), Services.get().getConf().getInt(
+                "oozie.service.coord.default.concurrency", 1));
     }
 
     /**

Modified: incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/wf/TestSubmitXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/wf/TestSubmitXCommand.java?rev=1341298&r1=1341297&r2=1341298&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/wf/TestSubmitXCommand.java (original)
+++ incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/wf/TestSubmitXCommand.java Tue May 22 04:02:50 2012
@@ -23,9 +23,13 @@ import java.io.IOException;
 import java.io.PrintWriter;
 
 import org.apache.hadoop.conf.Configuration;
+import org.apache.oozie.WorkflowJobBean;
 import org.apache.oozie.local.LocalOozie;
 import org.apache.oozie.client.OozieClient;
 import org.apache.oozie.command.CommandException;
+import org.apache.oozie.service.Services;
+import org.apache.oozie.service.WorkflowStoreService;
+import org.apache.oozie.store.WorkflowStore;
 import org.apache.oozie.test.XDataTestCase;
 import org.apache.oozie.util.XConfiguration;
 import org.apache.oozie.service.XLogService;
@@ -44,6 +48,24 @@ public class TestSubmitXCommand extends 
         super.tearDown();
     }
 
+  public void testSubmitAppName() throws Exception {
+      Configuration conf = new XConfiguration();
+      String appPath = getTestCaseDir();
+      String appXml = "<workflow-app xmlns='uri:oozie:workflow:0.1' name='${appName}-foo'> " + "<start to='end' /> "
+              + "<end name='end' /> " + "</workflow-app>";
+
+      writeToFile(appXml, appPath + "/workflow.xml");
+      conf.set(OozieClient.APP_PATH, "file://" + appPath + "/workflow.xml");
+      conf.set(OozieClient.USER_NAME, getTestUser());
+      conf.set("appName", "var-app-name");
+      SubmitXCommand sc = new SubmitXCommand(conf, "UNIT_TESTING");
+      String jobId = sc.call();
+      WorkflowStoreService wss = Services.get().get(WorkflowStoreService.class);
+      WorkflowStore ws = wss.create();
+      WorkflowJobBean wfb = ws.getWorkflow(jobId, false);
+      assertEquals("var-app-name-foo", wfb.getAppName());
+  }
+
     public void testSubmitReservedVars() throws Exception {
         Configuration conf = new XConfiguration();
         String appPath = getTestCaseDir();

Modified: incubator/oozie/trunk/core/src/test/java/org/apache/oozie/test/XDataTestCase.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/java/org/apache/oozie/test/XDataTestCase.java?rev=1341298&r1=1341297&r2=1341298&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/test/java/org/apache/oozie/test/XDataTestCase.java (original)
+++ incubator/oozie/trunk/core/src/test/java/org/apache/oozie/test/XDataTestCase.java Tue May 22 04:02:50 2012
@@ -1015,7 +1015,7 @@ public abstract class XDataTestCase exte
         conf.set(OozieClient.USER_NAME, getTestUser());
         conf.set("jobTracker", getJobTrackerUri());
         conf.set("nameNode", getNameNodeUri());
-
+        conf.set("appName", "bundle-app-name");
 
         BundleJobBean bundle = new BundleJobBean();
         bundle.setId(Services.get().get(UUIDService.class).generateId(ApplicationType.BUNDLE));

Modified: incubator/oozie/trunk/core/src/test/resources/bundle-submit-job.xml
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/resources/bundle-submit-job.xml?rev=1341298&r1=1341297&r2=1341298&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/test/resources/bundle-submit-job.xml (original)
+++ incubator/oozie/trunk/core/src/test/resources/bundle-submit-job.xml Tue May 22 04:02:50 2012
@@ -15,7 +15,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<bundle-app name='BUNDLE-TEST' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns='uri:oozie:bundle:0.1'>
+<bundle-app name='${appName}' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns='uri:oozie:bundle:0.1'>
           <controls> 
                  <kick-off-time>2099-02-01T00:00Z</kick-off-time>
           </controls>

Modified: incubator/oozie/trunk/release-log.txt
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/release-log.txt?rev=1341298&r1=1341297&r2=1341298&view=diff
==============================================================================
--- incubator/oozie/trunk/release-log.txt (original)
+++ incubator/oozie/trunk/release-log.txt Tue May 22 04:02:50 2012
@@ -1,5 +1,6 @@
 -- Oozie 3.3.0 release (trunk - unreleased)
 
+OOZIE-637 parametrization of 'name' attribute in workflow/coordinator/bundle (tucu)
 OOZIE-603 Invalid regex expression for IDENTIFIER type in xsd files (navis via tucu)
 OOZIE-842 Update trunk POMs version to 3.3.0-SNAPSHOT (tucu)
 OOZIE-818 CoordChangeXCommand deletes past coordinator actions (shwethags via tucu)