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/10/12 00:51:36 UTC
svn commit: r1397353 - in /oozie/trunk:
core/src/test/java/org/apache/oozie/workflow/lite/TestLiteWorkflowAppParser.java
core/src/test/resources/wf-race-condition.xml release-log.txt
Author: tucu
Date: Thu Oct 11 22:51:36 2012
New Revision: 1397353
URL: http://svn.apache.org/viewvc?rev=1397353&view=rev
Log:
OOZIE-1017 Add test to make sure old version of Xerces isn't being used (rkanter via tucu)
Added:
oozie/trunk/core/src/test/resources/wf-race-condition.xml
Modified:
oozie/trunk/core/src/test/java/org/apache/oozie/workflow/lite/TestLiteWorkflowAppParser.java
oozie/trunk/release-log.txt
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/workflow/lite/TestLiteWorkflowAppParser.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/workflow/lite/TestLiteWorkflowAppParser.java?rev=1397353&r1=1397352&r2=1397353&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/workflow/lite/TestLiteWorkflowAppParser.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/workflow/lite/TestLiteWorkflowAppParser.java Thu Oct 11 22:51:36 2012
@@ -49,6 +49,7 @@ public class TestLiteWorkflowAppParser e
@Override
protected void setUp() throws Exception {
super.setUp();
+ setSystemProperty("oozie.service.SchemaService.wf.ext.schemas", "hive-action-0.2.xsd");
new Services().init();
Services.get().get(ActionService.class).register(HiveActionExecutor.class);
Services.get().get(ActionService.class).register(DistcpActionExecutor.class);
@@ -921,4 +922,59 @@ public class TestLiteWorkflowAppParser e
validateForkJoin.invoke(parser, def);
}
+ // If Xerces 2.10.0 is not explicitly listed as a dependency in the poms, then Java will revert to an older version that has
+ // a race conditon in the validator. This test is to make sure we don't accidently remove the dependency.
+ public void testRaceConditionWithOldXerces() throws Exception {
+ javax.xml.validation.Schema schema = Services.get().get(SchemaService.class).getSchema(SchemaService.SchemaName.WORKFLOW);
+ final int numThreads = 20;
+ final RCThread[] threads = new RCThread[numThreads];
+ for (int i = 0; i < numThreads; i++) {
+ LiteWorkflowAppParser parser = new LiteWorkflowAppParser(schema,
+ LiteWorkflowStoreService.LiteControlNodeHandler.class,
+ LiteWorkflowStoreService.LiteDecisionHandler.class,
+ LiteWorkflowStoreService.LiteActionHandler.class);
+ threads[i] = new RCThread(parser);
+ }
+ for (int i = 0; i < numThreads; i++) {
+ threads[i].start();
+ }
+ waitFor(120 * 1000, new Predicate() {
+ @Override
+ public boolean evaluate() throws Exception {
+ boolean allDone = true;
+ for (int i = 0; i < numThreads; i++) {
+ allDone = allDone & threads[i].done;
+ }
+ return allDone;
+ }
+ });
+ boolean error = false;
+ for (int i = 0; i < numThreads; i++) {
+ error = error || threads[i].error;
+ }
+ assertFalse(error);
+ }
+
+ public class RCThread extends Thread {
+
+ private LiteWorkflowAppParser parser;
+ boolean done = false;
+ boolean error = false;
+
+ public RCThread(LiteWorkflowAppParser parser) {
+ this.parser = parser;
+ }
+
+ @Override
+ public void run() {
+ try {
+ parser.validateAndParse(IOUtils.getResourceAsReader("wf-race-condition.xml", -1), new Configuration());
+ }
+ catch (Exception e) {
+ error = true;
+ e.printStackTrace();
+ }
+ done = true;
+ }
+ }
}
Added: oozie/trunk/core/src/test/resources/wf-race-condition.xml
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/resources/wf-race-condition.xml?rev=1397353&view=auto
==============================================================================
--- oozie/trunk/core/src/test/resources/wf-race-condition.xml (added)
+++ oozie/trunk/core/src/test/resources/wf-race-condition.xml Thu Oct 11 22:51:36 2012
@@ -0,0 +1,52 @@
+<!--
+ Copyright (c) 2010 Yahoo! Inc. All rights reserved.
+ Licensed 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. See accompanying LICENSE file.
+-->
+<workflow-app xmlns="uri:oozie:workflow:0.1" name="wf-name">
+ <start to="a"/>
+
+ <fork name="a">
+ <path start="b1"/>
+ <path start="b2"/>
+ </fork>
+
+ <action name="b1">
+ <sub-workflow>
+ <app-path>foo/bar</app-path>
+ </sub-workflow>
+ <ok to="c"/>
+ <error to="fail"/>
+ </action>
+
+ <action name="b2">
+ <map-reduce>
+ <job-tracker>foo</job-tracker>
+ <name-node>bar</name-node>
+ <streaming>
+ <mapper>foo.sh</mapper>
+ <reducer>bar.sh</reducer>
+ </streaming>
+ </map-reduce>
+
+ <ok to="c"/>
+ <error to="fail"/>
+ </action>
+
+ <join name="c" to="end"/>
+
+ <kill name="fail">
+ <message>fail</message>
+ </kill>
+
+ <end name="end"/>
+</workflow-app>
Modified: oozie/trunk/release-log.txt
URL: http://svn.apache.org/viewvc/oozie/trunk/release-log.txt?rev=1397353&r1=1397352&r2=1397353&view=diff
==============================================================================
--- oozie/trunk/release-log.txt (original)
+++ oozie/trunk/release-log.txt Thu Oct 11 22:51:36 2012
@@ -1,5 +1,6 @@
-- Oozie 3.4.0 release (trunk - unreleased)
+OOZIE-1017 Add test to make sure old version of Xerces isn't being used (rkanter via tucu)
OOZIE-949 Allow the user to set 'mapred.job.name' (jrkinley via tucu)
OOZIE-1009 Documentation pages should use default ports for Oozie/JT/NN (tucu)
OOZIE-669 Deprecate oozie-start.sh, oozie-stop.sh & oozie-run.sh scripts (rkanter via tucu)