Author: kamrul
Date: Sat Dec 10 10:55:55 2011
New Revision: 1212768

URL: http://svn.apache.org/viewvc?rev=1212768&view=rev
Log:
OOZIE-15  Coordinator input/output event instance should limit 1 instance. 
(Mona via Mohammad)

Added:
    
incubator/oozie/trunk/core/src/test/resources/coord-multiple-input-instance1.xml
    
incubator/oozie/trunk/core/src/test/resources/coord-multiple-input-instance2.xml
    
incubator/oozie/trunk/core/src/test/resources/coord-multiple-input-instance3.xml
    
incubator/oozie/trunk/core/src/test/resources/coord-multiple-output-instance1.xml
    
incubator/oozie/trunk/core/src/test/resources/coord-multiple-output-instance2.xml
    
incubator/oozie/trunk/core/src/test/resources/coord-multiple-output-instance3.xml
Modified:
    
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordSubmitXCommand.java
    
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordSubmitXCommand.java
    incubator/oozie/trunk/release-log.txt

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=1212768&r1=1212767&r2=1212768&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
 Sat Dec 10 10:55:55 2011
@@ -28,6 +28,7 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -101,6 +102,10 @@ public class CoordSubmitXCommand extends
 
     public static final String CONFIG_DEFAULT = "coord-config-default.xml";
     public static final String COORDINATOR_XML_FILE = "coordinator.xml";
+    public final String COORD_INPUT_EVENTS ="input-events";
+    public final String COORD_OUTPUT_EVENTS = "output-events";
+    public final String COORD_INPUT_EVENTS_DATA_IN ="data-in";
+    public final String COORD_OUTPUT_EVENTS_DATA_OUT = "data-out";
 
     private static final Set<String> DISALLOWED_USER_PROPERTIES = new 
HashSet<String>();
     private static final Set<String> DISALLOWED_DEFAULT_PROPERTIES = new 
HashSet<String>();
@@ -211,6 +216,12 @@ public class CoordSubmitXCommand extends
             appXml = XmlUtils.removeComments(appXml);
             initEvaluators();
             Element eJob = basicResolveAndIncludeDS(appXml, conf, coordJob);
+
+            // checking if the coordinator application data input/output events
+            // specify multiple data instance values in erroneous manner
+            checkMultipleTimeInstances(eJob, COORD_INPUT_EVENTS, 
COORD_INPUT_EVENTS_DATA_IN);
+            checkMultipleTimeInstances(eJob, COORD_OUTPUT_EVENTS, 
COORD_OUTPUT_EVENTS_DATA_OUT);
+
             LOG.debug("jobXml after all validation " + 
XmlUtils.prettyPrint(eJob).toString());
 
             jobId = storeToDB(eJob, coordJob);
@@ -279,6 +290,43 @@ public class CoordSubmitXCommand extends
         return jobId;
     }
 
+    /*
+     * Check against multiple data instance values inside a single <instance> 
tag
+     * If found, the job is not submitted and user is informed to correct the 
error, instead of defaulting to the first instance value in the list
+     */
+    private void checkMultipleTimeInstances(Element eCoordJob, String 
eventType, String dataType) throws CoordinatorJobException {
+        Element eventsSpec, dataSpec, instance;
+        List<Element> instanceSpecList;
+        Namespace ns = eCoordJob.getNamespace();
+        String instanceValue;
+        eventsSpec = eCoordJob.getChild(eventType, ns);
+        if (eventsSpec != null) {
+            dataSpec = eventsSpec.getChild(dataType, ns);
+            if (dataSpec != null) {
+                // In case of input-events, there can be multiple child 
<instance> datasets. Iterating to ensure none of them have errors
+                instanceSpecList = dataSpec.getChildren("instance", ns);
+                Iterator instanceIter = instanceSpecList.iterator();
+                while(instanceIter.hasNext()) {
+                    instance = ((Element) instanceIter.next());
+                    if(instance.getContentSize() == 0) { //empty string or 
whitespace
+                        throw new CoordinatorJobException(ErrorCode.E1021, 
"<instance> tag within " + eventType + " is empty!");
+                    }
+                    instanceValue = instance.getContent(0).toString();
+                    if (instanceValue.contains(",")) { // reaching this block 
implies instance is not empty i.e. length > 0
+                        String correctAction = null;
+                        if(dataType.equals(COORD_INPUT_EVENTS_DATA_IN)) {
+                            correctAction = "Coordinator app definition should 
have separate <instance> tag per data-in instance";
+                        } else 
if(dataType.equals(COORD_OUTPUT_EVENTS_DATA_OUT)) {
+                            correctAction = "Coordinator app definition can 
have only one <instance> tag per data-out instance";
+                        }
+                        throw new CoordinatorJobException(ErrorCode.E1021, 
eventType + " instance '" + instanceValue
+                                + "' contains more than one date instance. 
Coordinator job NOT SUBMITTED. " + correctAction);
+                    }
+                }
+            }
+        }
+    }
+
     /**
      * Read the application XML and validate against coordinator Schema
      *

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=1212768&r1=1212767&r2=1212768&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
 Sat Dec 10 10:55:55 2011
@@ -21,6 +21,8 @@ import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.io.Reader;
+import java.io.Writer;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.oozie.CoordinatorJobBean;
@@ -33,6 +35,7 @@ import org.apache.oozie.executor.jpa.JPA
 import org.apache.oozie.service.JPAService;
 import org.apache.oozie.service.Services;
 import org.apache.oozie.test.XDataTestCase;
+import org.apache.oozie.util.IOUtils;
 import org.apache.oozie.util.XConfiguration;
 
 public class TestCoordSubmitXCommand extends XDataTestCase {
@@ -92,6 +95,128 @@ public class TestCoordSubmitXCommand ext
     }
 
     /**
+     * Testing for when user tries to submit a coordinator application having 
data-in events
+     * that erroneously specify multiple input data instances inside a single 
<instance> tag.
+     * Job gives submission error and indicates appropriate correction
+     * Testing both negative(error) and well as positive(success) cases
+     */
+    public void testBasicSubmitWithMultipleInstancesInputEvent() throws 
Exception {
+        Configuration conf = new XConfiguration();
+        String appPath = getTestCaseDir() + File.separator + "coordinator.xml";
+
+        // CASE 1: Failure case i.e. multiple data-in instances
+        Reader reader = 
IOUtils.getResourceAsReader("coord-multiple-input-instance1.xml", -1);
+        Writer writer = new FileWriter(appPath);
+        IOUtils.copyCharStream(reader, writer);
+        conf.set(OozieClient.COORDINATOR_APP_PATH, appPath);
+        conf.set(OozieClient.USER_NAME, getTestUser());
+        conf.set(OozieClient.GROUP_NAME, "other");
+        CoordSubmitXCommand sc = new CoordSubmitXCommand(conf, "UNIT_TESTING");
+
+        try {
+            sc.call();
+            fail("Expected to catch errors due to incorrectly specified input 
data set instances");
+        }
+        catch (CommandException e) {
+            assertEquals(sc.getJob().getStatus(), Job.Status.FAILED);
+            assertEquals(e.getErrorCode(), ErrorCode.E1021);
+            assertTrue(e.getMessage().contains(sc.COORD_INPUT_EVENTS) && 
e.getMessage().contains("per data-in instance"));
+        }
+
+        // CASE 2: Multiple data-in instances specified as separate <instance> 
tags, but one or more tags are empty. Check works for whitespace in the tags too
+        reader = 
IOUtils.getResourceAsReader("coord-multiple-input-instance2.xml", -1);
+        writer = new FileWriter(appPath);
+        IOUtils.copyCharStream(reader, writer);
+        sc = new CoordSubmitXCommand(conf, "UNIT_TESTING");
+
+        try {
+            sc.call();
+            fail("Expected to catch errors due to incorrectly specified input 
data set instances");
+        }
+        catch (CommandException e) {
+            assertEquals(sc.getJob().getStatus(), Job.Status.FAILED);
+            assertEquals(e.getErrorCode(), ErrorCode.E1021);
+            assertTrue(e.getMessage().contains(sc.COORD_INPUT_EVENTS) && 
e.getMessage().contains("is empty"));
+        }
+
+        // CASE 3: Success case i.e. Multiple data-in instances specified 
correctly as separate <instance> tags
+        reader = 
IOUtils.getResourceAsReader("coord-multiple-input-instance3.xml", -1);
+        writer = new FileWriter(appPath);
+        IOUtils.copyCharStream(reader, writer);
+        sc = new CoordSubmitXCommand(conf, "UNIT_TESTING");
+
+        try {
+            sc.call();
+        }
+        catch (CommandException e) {
+            fail("Unexpected failure: " + e);
+        }
+    }
+
+    /**
+     * Testing for when user tries to submit a coordinator application having 
data-out events
+     * that erroneously specify multiple output data instances inside a single 
<instance> tag.
+     * Job gives submission error and indicates appropriate correction
+     * Testing negative(error) cases. Positive(success) case is covered in 
another test case "testBasicSubmit".
+     */
+    public void testBasicSubmitWithMultipleInstancesOutputEvent() throws 
Exception {
+        Configuration conf = new XConfiguration();
+        String appPath = getTestCaseDir() + File.separator + "coordinator.xml";
+
+        // CASE 1: Failure case i.e. multiple data-out instances
+        Reader reader = 
IOUtils.getResourceAsReader("coord-multiple-output-instance1.xml", -1);
+        Writer writer = new FileWriter(appPath);
+        IOUtils.copyCharStream(reader, writer);
+
+        conf.set(OozieClient.COORDINATOR_APP_PATH, appPath);
+        conf.set(OozieClient.USER_NAME, getTestUser());
+        conf.set(OozieClient.GROUP_NAME, "other");
+        CoordSubmitXCommand sc = new CoordSubmitXCommand(conf, "UNIT_TESTING");
+
+        try {
+            sc.call();
+            fail("Expected to catch errors due to incorrectly specified output 
data set instances");
+        }
+        catch (CommandException e) {
+            assertEquals(sc.getJob().getStatus(), Job.Status.FAILED);
+            assertEquals(e.getErrorCode(), ErrorCode.E1021);
+            assertTrue(e.getMessage().contains(sc.COORD_OUTPUT_EVENTS) && 
e.getMessage().contains("per data-out instance"));
+        }
+
+        // CASE 2: Data-out instance tag is empty. Check works for whitespace 
in the tag too
+        reader = 
IOUtils.getResourceAsReader("coord-multiple-output-instance2.xml", -1);
+        writer = new FileWriter(appPath);
+        IOUtils.copyCharStream(reader, writer);
+        sc = new CoordSubmitXCommand(conf, "UNIT_TESTING");
+
+        try {
+            sc.call();
+            fail("Expected to catch errors due to incorrectly specified output 
data set instances");
+        }
+        catch (CommandException e) {
+            assertEquals(sc.getJob().getStatus(), Job.Status.FAILED);
+            assertEquals(e.getErrorCode(), ErrorCode.E1021);
+            assertTrue(e.getMessage().contains(sc.COORD_OUTPUT_EVENTS) && 
e.getMessage().contains("is empty"));
+        }
+
+        // CASE 3: Multiple <instance> tags within data-out should fail 
coordinator schema validation - different error than above is expected
+        reader = 
IOUtils.getResourceAsReader("coord-multiple-output-instance3.xml", -1);
+        writer = new FileWriter(appPath);
+        IOUtils.copyCharStream(reader, writer);
+        sc = new CoordSubmitXCommand(conf, "UNIT_TESTING");
+
+        try {
+            sc.call();
+            fail("Expected to catch errors due to incorrectly specified output 
data set instances");
+        }
+        catch (CommandException e) {
+            assertEquals(sc.getJob().getStatus(), Job.Status.FAILED);
+            assertEquals(e.getErrorCode(), ErrorCode.E0701);
+            assertTrue(e.getMessage().contains("No child element is expected 
at this point"));
+        }
+    }
+
+    /**
      * Basic coordinator submit test with bundleId
      *
      * @throws Exception

Added: 
incubator/oozie/trunk/core/src/test/resources/coord-multiple-input-instance1.xml
URL: 
http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/resources/coord-multiple-input-instance1.xml?rev=1212768&view=auto
==============================================================================
--- 
incubator/oozie/trunk/core/src/test/resources/coord-multiple-input-instance1.xml
 (added)
+++ 
incubator/oozie/trunk/core/src/test/resources/coord-multiple-input-instance1.xml
 Sat Dec 10 10:55:55 2011
@@ -0,0 +1,56 @@
+<!--
+  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.
+-->
+<coordinator-app xmlns="uri:oozie:coordinator:0.2" name="NAME" 
frequency="${coord:days(1)}" start="2009-02-01T01:00Z" end="2009-02-03T23:59Z" 
timezone="UTC">
+  <controls>
+    <concurrency>2</concurrency>
+    <execution>LIFO</execution>
+  </controls>
+  <datasets>
+    <dataset name="a" frequency="${coord:days(7)}" 
initial-instance="2009-02-01T01:00Z" timezone="UTC">
+        <uri-template>file:///tmp/coord/workflows/${YEAR}/${DAY}</uri-template>
+    </dataset>
+    <dataset name="local_a" frequency="${coord:days(7)}" 
initial-instance="2009-02-01T01:00Z" timezone="UTC">
+        <uri-template>file:///tmp/coord/workflows/${YEAR}/${DAY}</uri-template>
+    </dataset>
+  </datasets>
+  <input-events>
+    <data-in name="A" dataset="a">
+    <instance>${coord:latest(0)},${coord:latest(-1)}</instance>
+    </data-in>
+  </input-events>
+  <output-events>
+    <data-out name="LOCAL_A" dataset="local_a">
+      <instance>${coord:current(-1)}</instance>
+    </data-out>
+  </output-events>
+  <action>
+    <workflow>
+      <app-path>hdfs:///tmp/workflows/</app-path>
+      <configuration>
+        <property>
+          <name>inputA</name>
+          <value>${coord:dataIn('A')}</value>
+        </property>
+        <property>
+          <name>inputB</name>
+          <value>${coord:dataOut('LOCAL_A')}</value>
+        </property>
+      </configuration>
+    </workflow>
+  </action>
+</coordinator-app>
\ No newline at end of file

Added: 
incubator/oozie/trunk/core/src/test/resources/coord-multiple-input-instance2.xml
URL: 
http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/resources/coord-multiple-input-instance2.xml?rev=1212768&view=auto
==============================================================================
--- 
incubator/oozie/trunk/core/src/test/resources/coord-multiple-input-instance2.xml
 (added)
+++ 
incubator/oozie/trunk/core/src/test/resources/coord-multiple-input-instance2.xml
 Sat Dec 10 10:55:55 2011
@@ -0,0 +1,57 @@
+<!--
+  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.
+-->
+<coordinator-app xmlns="uri:oozie:coordinator:0.2" name="NAME" 
frequency="${coord:days(1)}" start="2009-02-01T01:00Z" end="2009-02-03T23:59Z" 
timezone="UTC">
+  <controls>
+    <concurrency>2</concurrency>
+    <execution>LIFO</execution>
+  </controls>
+  <datasets>
+    <dataset name="a" frequency="${coord:days(7)}" 
initial-instance="2009-02-01T01:00Z" timezone="UTC">
+        <uri-template>file:///tmp/coord/workflows/${YEAR}/${DAY}</uri-template>
+    </dataset>
+    <dataset name="local_a" frequency="${coord:days(7)}" 
initial-instance="2009-02-01T01:00Z" timezone="UTC">
+        <uri-template>file:///tmp/coord/workflows/${YEAR}/${DAY}</uri-template>
+    </dataset>
+  </datasets>
+  <input-events>
+    <data-in name="A" dataset="a">
+    <instance>${coord:latest(0)}</instance>
+    <instance></instance>
+    </data-in>
+  </input-events>
+  <output-events>
+    <data-out name="LOCAL_A" dataset="local_a">
+      <instance>${coord:current(-1)}</instance>
+    </data-out>
+  </output-events>
+  <action>
+    <workflow>
+      <app-path>hdfs:///tmp/workflows/</app-path>
+      <configuration>
+        <property>
+          <name>inputA</name>
+          <value>${coord:dataIn('A')}</value>
+        </property>
+        <property>
+          <name>inputB</name>
+          <value>${coord:dataOut('LOCAL_A')}</value>
+        </property>
+      </configuration>
+    </workflow>
+  </action>
+</coordinator-app>
\ No newline at end of file

Added: 
incubator/oozie/trunk/core/src/test/resources/coord-multiple-input-instance3.xml
URL: 
http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/resources/coord-multiple-input-instance3.xml?rev=1212768&view=auto
==============================================================================
--- 
incubator/oozie/trunk/core/src/test/resources/coord-multiple-input-instance3.xml
 (added)
+++ 
incubator/oozie/trunk/core/src/test/resources/coord-multiple-input-instance3.xml
 Sat Dec 10 10:55:55 2011
@@ -0,0 +1,57 @@
+<!--
+  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.
+-->
+<coordinator-app xmlns="uri:oozie:coordinator:0.2" name="NAME" 
frequency="${coord:days(1)}" start="2009-02-01T01:00Z" end="2009-02-03T23:59Z" 
timezone="UTC">
+  <controls>
+    <concurrency>2</concurrency>
+    <execution>LIFO</execution>
+  </controls>
+  <datasets>
+    <dataset name="a" frequency="${coord:days(7)}" 
initial-instance="2009-02-01T01:00Z" timezone="UTC">
+        <uri-template>file:///tmp/coord/workflows/${YEAR}/${DAY}</uri-template>
+    </dataset>
+    <dataset name="local_a" frequency="${coord:days(7)}" 
initial-instance="2009-02-01T01:00Z" timezone="UTC">
+        <uri-template>file:///tmp/coord/workflows/${YEAR}/${DAY}</uri-template>
+    </dataset>
+  </datasets>
+  <input-events>
+    <data-in name="A" dataset="a">
+    <instance>${coord:latest(0)}</instance>
+    <instance>${coord:latest(-1)}</instance>
+    </data-in>
+  </input-events>
+  <output-events>
+    <data-out name="LOCAL_A" dataset="local_a">
+      <instance>${coord:current(-1)}</instance>
+    </data-out>
+  </output-events>
+  <action>
+    <workflow>
+      <app-path>hdfs:///tmp/workflows/</app-path>
+      <configuration>
+        <property>
+          <name>inputA</name>
+          <value>${coord:dataIn('A')}</value>
+        </property>
+        <property>
+          <name>inputB</name>
+          <value>${coord:dataOut('LOCAL_A')}</value>
+        </property>
+      </configuration>
+    </workflow>
+  </action>
+</coordinator-app>
\ No newline at end of file

Added: 
incubator/oozie/trunk/core/src/test/resources/coord-multiple-output-instance1.xml
URL: 
http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/resources/coord-multiple-output-instance1.xml?rev=1212768&view=auto
==============================================================================
--- 
incubator/oozie/trunk/core/src/test/resources/coord-multiple-output-instance1.xml
 (added)
+++ 
incubator/oozie/trunk/core/src/test/resources/coord-multiple-output-instance1.xml
 Sat Dec 10 10:55:55 2011
@@ -0,0 +1,56 @@
+<!--
+  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.
+-->
+<coordinator-app xmlns="uri:oozie:coordinator:0.2" name="NAME" 
frequency="${coord:days(1)}" start="2009-02-01T01:00Z" end="2009-02-03T23:59Z" 
timezone="UTC">
+  <controls>
+    <concurrency>2</concurrency>
+    <execution>LIFO</execution>
+  </controls>
+  <datasets>
+    <dataset name="a" frequency="${coord:days(7)}" 
initial-instance="2009-02-01T01:00Z" timezone="UTC">
+        <uri-template>file:///tmp/coord/workflows/${YEAR}/${DAY}</uri-template>
+    </dataset>
+    <dataset name="local_a" frequency="${coord:days(7)}" 
initial-instance="2009-02-01T01:00Z" timezone="UTC">
+        <uri-template>file:///tmp/coord/workflows/${YEAR}/${DAY}</uri-template>
+    </dataset>
+  </datasets>
+  <input-events>
+    <data-in name="A" dataset="a">
+    <instance>${coord:latest(0)}</instance>
+    </data-in>
+  </input-events>
+  <output-events>
+    <data-out name="LOCAL_A" dataset="local_a">
+      <instance>${coord:current(-1)},${coord:latest(-2)}</instance>
+    </data-out>
+  </output-events>
+  <action>
+    <workflow>
+      <app-path>hdfs:///tmp/workflows/</app-path>
+      <configuration>
+        <property>
+          <name>inputA</name>
+          <value>${coord:dataIn('A')}</value>
+        </property>
+        <property>
+          <name>inputB</name>
+          <value>${coord:dataOut('LOCAL_A')}</value>
+        </property>
+      </configuration>
+    </workflow>
+  </action>
+</coordinator-app>
\ No newline at end of file

Added: 
incubator/oozie/trunk/core/src/test/resources/coord-multiple-output-instance2.xml
URL: 
http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/resources/coord-multiple-output-instance2.xml?rev=1212768&view=auto
==============================================================================
--- 
incubator/oozie/trunk/core/src/test/resources/coord-multiple-output-instance2.xml
 (added)
+++ 
incubator/oozie/trunk/core/src/test/resources/coord-multiple-output-instance2.xml
 Sat Dec 10 10:55:55 2011
@@ -0,0 +1,56 @@
+<!--
+  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.
+-->
+<coordinator-app xmlns="uri:oozie:coordinator:0.2" name="NAME" 
frequency="${coord:days(1)}" start="2009-02-01T01:00Z" end="2009-02-03T23:59Z" 
timezone="UTC">
+  <controls>
+    <concurrency>2</concurrency>
+    <execution>LIFO</execution>
+  </controls>
+  <datasets>
+    <dataset name="a" frequency="${coord:days(7)}" 
initial-instance="2009-02-01T01:00Z" timezone="UTC">
+        <uri-template>file:///tmp/coord/workflows/${YEAR}/${DAY}</uri-template>
+    </dataset>
+    <dataset name="local_a" frequency="${coord:days(7)}" 
initial-instance="2009-02-01T01:00Z" timezone="UTC">
+        <uri-template>file:///tmp/coord/workflows/${YEAR}/${DAY}</uri-template>
+    </dataset>
+  </datasets>
+  <input-events>
+    <data-in name="A" dataset="a">
+    <instance>${coord:latest(0)}</instance>
+    </data-in>
+  </input-events>
+  <output-events>
+    <data-out name="LOCAL_A" dataset="local_a">
+      <instance></instance>
+    </data-out>
+  </output-events>
+  <action>
+    <workflow>
+      <app-path>hdfs:///tmp/workflows/</app-path>
+      <configuration>
+        <property>
+          <name>inputA</name>
+          <value>${coord:dataIn('A')}</value>
+        </property>
+        <property>
+          <name>inputB</name>
+          <value>${coord:dataOut('LOCAL_A')}</value>
+        </property>
+      </configuration>
+    </workflow>
+  </action>
+</coordinator-app>
\ No newline at end of file

Added: 
incubator/oozie/trunk/core/src/test/resources/coord-multiple-output-instance3.xml
URL: 
http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/resources/coord-multiple-output-instance3.xml?rev=1212768&view=auto
==============================================================================
--- 
incubator/oozie/trunk/core/src/test/resources/coord-multiple-output-instance3.xml
 (added)
+++ 
incubator/oozie/trunk/core/src/test/resources/coord-multiple-output-instance3.xml
 Sat Dec 10 10:55:55 2011
@@ -0,0 +1,57 @@
+<!--
+  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.
+-->
+<coordinator-app xmlns="uri:oozie:coordinator:0.2" name="NAME" 
frequency="${coord:days(1)}" start="2009-02-01T01:00Z" end="2009-02-03T23:59Z" 
timezone="UTC">
+  <controls>
+    <concurrency>2</concurrency>
+    <execution>LIFO</execution>
+  </controls>
+  <datasets>
+    <dataset name="a" frequency="${coord:days(7)}" 
initial-instance="2009-02-01T01:00Z" timezone="UTC">
+        <uri-template>file:///tmp/coord/workflows/${YEAR}/${DAY}</uri-template>
+    </dataset>
+    <dataset name="local_a" frequency="${coord:days(7)}" 
initial-instance="2009-02-01T01:00Z" timezone="UTC">
+        <uri-template>file:///tmp/coord/workflows/${YEAR}/${DAY}</uri-template>
+    </dataset>
+  </datasets>
+  <input-events>
+    <data-in name="A" dataset="a">
+    <instance>${coord:latest(0)}</instance>
+    </data-in>
+  </input-events>
+  <output-events>
+    <data-out name="LOCAL_A" dataset="local_a">
+      <instance></instance>
+      <instance></instance>
+    </data-out>
+  </output-events>
+  <action>
+    <workflow>
+      <app-path>hdfs:///tmp/workflows/</app-path>
+      <configuration>
+        <property>
+          <name>inputA</name>
+          <value>${coord:dataIn('A')}</value>
+        </property>
+        <property>
+          <name>inputB</name>
+          <value>${coord:dataOut('LOCAL_A')}</value>
+        </property>
+      </configuration>
+    </workflow>
+  </action>
+</coordinator-app>
\ No newline at end of file

Modified: incubator/oozie/trunk/release-log.txt
URL: 
http://svn.apache.org/viewvc/incubator/oozie/trunk/release-log.txt?rev=1212768&r1=1212767&r2=1212768&view=diff
==============================================================================
--- incubator/oozie/trunk/release-log.txt (original)
+++ incubator/oozie/trunk/release-log.txt Sat Dec 10 10:55:55 2011
@@ -1,5 +1,6 @@
 -- Oozie 3.2.0 release
 
+OOZIE-15  Coordinator input/output event instance should limit 1 instance. 
(Mona via Mohammad)
 OOZIE-633 Create sharelib directory for oozie.(Mohammad)
 OOZIE-625 Oozie server not starting due to missing sl4j library for 
Authenticationfilter. (tucu)
 OOZIE-617 Add back Ssh action as extension. (tucu)


Reply via email to