From 66e7d985557957a708b802f14c56be4aee51fb12 Mon Sep 17 00:00:00 2001 From: slaws Date: Fri, 26 Jun 2009 15:19:21 +0000 Subject: TUSCANY-3099 log an error if an invalid header priority is entered TUSCANY-3098 don't throw an NPE is a property doesn't have a name git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@788735 13f79535-47bb-0310-9956-ffa450edef68 --- .../jms/impl/JMSBindingProcessorTestCase.java | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'branches/sca-java-1.x/modules/binding-jms/src/test/java/org') diff --git a/branches/sca-java-1.x/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCase.java b/branches/sca-java-1.x/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCase.java index 7c294b645a..42a669b9ab 100644 --- a/branches/sca-java-1.x/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCase.java +++ b/branches/sca-java-1.x/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCase.java @@ -77,6 +77,20 @@ public class JMSBindingProcessorTestCase extends TestCase { + " " + " " + ""; + + public static final String HEADERS_INVALID_PRIORITY = + "" + + "" + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + ""; public static final String PROPERTIES1 = "" @@ -476,6 +490,22 @@ public class JMSBindingProcessorTestCase extends TestCase { assertTrue( e.getClass().isAssignableFrom( JMSBindingException.class ) ); } } + + public void testParsingValidationErrors2() throws Exception { + // Composite with invalid priority + XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(HEADERS_INVALID_PRIORITY)); + + try { + Composite composite = (Composite)staxProcessor.read(reader); + } catch(Exception e) { + // JMSBindingExceptions are expected with invalid composite. + if ( !e.getClass().isAssignableFrom( JMSBindingException.class ) ) + throw e; + // Do assertion to make sure test registers results. + assertTrue( e.getClass().isAssignableFrom( JMSBindingException.class ) ); + return; + } + } /** Test various model validation requirements. */ public void testValidationErrors1() throws Exception { -- cgit v1.2.3