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:57:38 UTC
svn commit: r1397357 - in /oozie/trunk: ./
client/src/test/java/org/apache/oozie/cli/ client/src/test/resources/
core/src/test/java/org/apache/oozie/service/
core/src/test/java/org/apache/oozie/workflow/lite/
Author: tucu
Date: Thu Oct 11 22:57:37 2012
New Revision: 1397357
URL: http://svn.apache.org/viewvc?rev=1397357&view=rev
Log:
OOZIE-1016 Tests that use junit assert or fail in a new thread report success when they are actually failing (rkanter via tucu)
Removed:
oozie/trunk/client/src/test/resources/timeout.xml
Modified:
oozie/trunk/client/src/test/java/org/apache/oozie/cli/TestValidation.java
oozie/trunk/core/src/test/java/org/apache/oozie/service/TestSchemaService.java
oozie/trunk/core/src/test/java/org/apache/oozie/workflow/lite/TestLiteWorkflowAppParser.java
oozie/trunk/release-log.txt
Modified: oozie/trunk/client/src/test/java/org/apache/oozie/cli/TestValidation.java
URL: http://svn.apache.org/viewvc/oozie/trunk/client/src/test/java/org/apache/oozie/cli/TestValidation.java?rev=1397357&r1=1397356&r2=1397357&view=diff
==============================================================================
--- oozie/trunk/client/src/test/java/org/apache/oozie/cli/TestValidation.java (original)
+++ oozie/trunk/client/src/test/java/org/apache/oozie/cli/TestValidation.java Thu Oct 11 22:57:37 2012
@@ -21,7 +21,6 @@ import junit.framework.TestCase;
import java.net.URL;
import java.net.URI;
-import java.util.concurrent.TimeoutException;
import java.io.File;
public class TestValidation extends TestCase {
@@ -42,23 +41,4 @@ public class TestValidation extends Test
String[] args = new String[]{"validate", getPath("invalid.xml")};
assertEquals(-1, new OozieCLI().run(args));
}
-
- // Test for Validation of workflow definition against pattern defined in schema to complete within 3 seconds
- public void testTimeout() throws Exception {
- final String[] args = new String[] { "validate", getPath("timeout.xml") };
- Thread testThread = new Thread() {
- public void run() {
- assertEquals(-1, new OozieCLI().run(args));
- }
- };
- testThread.start();
- Thread.sleep(3000);
- // Timeout if validation takes more than 3 seconds
- testThread.interrupt();
-
- if (testThread.isInterrupted()) {
- throw new TimeoutException("The pattern validation took too long to complete");
- }
- }
-
}
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/service/TestSchemaService.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestSchemaService.java?rev=1397357&r1=1397356&r2=1397357&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/service/TestSchemaService.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/service/TestSchemaService.java Thu Oct 11 22:57:37 2012
@@ -22,23 +22,15 @@ import org.apache.oozie.service.SchemaSe
import org.apache.oozie.test.XTestCase;
import org.apache.oozie.util.XmlUtils;
import org.jdom.Element;
-import org.xml.sax.SAXParseException;
import javax.xml.validation.Validator;
import javax.xml.transform.stream.StreamSource;
import java.io.StringReader;
-import java.util.concurrent.TimeoutException;
public class TestSchemaService extends XTestCase {
- public static final String LONG_STRING_PATTERN_VALIDATION = "I_am_long_string_with_a_period_._which_is_not_allowed_according_to_schema";
- public static final String APP_NEG_TEST = "<workflow-app xmlns='uri:oozie:workflow:0.1' name='"+LONG_STRING_PATTERN_VALIDATION+"'>" +
- "<start to='end'/>" +
- "<end name='end'/>" +
- "</workflow-app>";
-
- private static final String APP1 = "<workflow-app xmlns='uri:oozie:workflow:0.1' name='app'>" +
+ private static final String APP1 = "<workflow-app xmlns='uri:oozie:workflow:0.1' name='app'>" +
"<start to='end'/>" +
"<end name='end'/>" +
"</workflow-app>";
@@ -136,34 +128,6 @@ public class TestSchemaService extends X
validator.validate(new StreamSource(new StringReader(WF_4_MULTIPLE_JAVA_OPTS)));
}
- // Test for validation of workflow definition against pattern defined in schema to complete within 3 seconds
- public void testWfSchemaFailure() throws Exception {
- SchemaService wss = Services.get().get(SchemaService.class);
- final Validator validator = wss.getSchema(SchemaName.WORKFLOW).newValidator();
- Thread testThread = new Thread() {
- public void run() {
- try {
- // Validate against wf def
- validator.validate(new StreamSource(new StringReader(APP_NEG_TEST)));
- fail("Expected to catch ParseException but didn't encounter any");
- } catch (SAXParseException saxpe) {
- // Expected
- } catch (Exception e) {
- fail("Expected to catch ParseException but an unexpected error happened " + e.getMessage());
- }
- }
- };
-
- testThread.start();
- Thread.sleep(3000);
- // Timeout if validation takes more than 3 seconds
- testThread.interrupt();
-
- if (testThread.isInterrupted()) {
- throw new TimeoutException("the pattern validation took too long to complete");
- }
- }
-
public void testWfSchemaV2() throws Exception {
SchemaService wss = Services.get().get(SchemaService.class);
Validator validator = wss.getSchema(SchemaName.WORKFLOW).newValidator();
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=1397357&r1=1397356&r2=1397357&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:57:37 2012
@@ -18,21 +18,16 @@
package org.apache.oozie.workflow.lite;
-import java.io.StringReader;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
-import java.util.concurrent.TimeoutException;
import org.apache.oozie.service.ActionService;
import org.apache.oozie.service.LiteWorkflowStoreService;
-import org.apache.oozie.service.SchemaService;
import org.apache.oozie.service.Services;
-import org.apache.oozie.service.SchemaService.SchemaName;
-import org.apache.oozie.service.TestSchemaService;
import org.apache.oozie.workflow.WorkflowException;
import org.apache.oozie.workflow.lite.TestLiteWorkflowLib.TestActionNodeHandler;
import org.apache.oozie.workflow.lite.TestLiteWorkflowLib.TestDecisionNodeHandler;
@@ -331,38 +326,6 @@ public class TestLiteWorkflowAppParser e
}
}
- // Test for validation of workflow definition against pattern defined in schema to complete within 3 seconds
- public void testWfValidationFailure() throws Exception {
- SchemaService wss = Services.get().get(SchemaService.class);
- final LiteWorkflowAppParser parser = new LiteWorkflowAppParser(wss.getSchema(SchemaName.WORKFLOW),
- LiteWorkflowStoreService.LiteControlNodeHandler.class,
- LiteWorkflowStoreService.LiteDecisionHandler.class, LiteWorkflowStoreService.LiteActionHandler.class);
-
- Thread testThread = new Thread() {
- public void run() {
- try {
- // Validate against wf def
- parser.validateAndParse(new StringReader(TestSchemaService.APP_NEG_TEST), new Configuration());
- fail("Expected to catch WorkflowException but didn't encounter any");
- } catch (WorkflowException we) {
- assertEquals(ErrorCode.E0701, we.getErrorCode());
- assertTrue(we.getCause().toString().contains("SAXParseException"));
- } catch (Exception e) {
- fail("Expected to catch WorkflowException but an unexpected error happened");
- }
-
- }
- };
- testThread.start();
- Thread.sleep(3000);
- // Timeout if validation takes more than 3 seconds
- testThread.interrupt();
-
- if (testThread.isInterrupted()) {
- throw new TimeoutException("the pattern validation took too long to complete");
- }
- }
-
/*
* 1->ok->2
* 2->ok->end
Modified: oozie/trunk/release-log.txt
URL: http://svn.apache.org/viewvc/oozie/trunk/release-log.txt?rev=1397357&r1=1397356&r2=1397357&view=diff
==============================================================================
--- oozie/trunk/release-log.txt (original)
+++ oozie/trunk/release-log.txt Thu Oct 11 22:57:37 2012
@@ -1,5 +1,6 @@
-- Oozie 3.4.0 release (trunk - unreleased)
+OOZIE-1016 Tests that use junit assert or fail in a new thread report success when they are actually failing (rkanter via tucu)
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)