Author: rebody
Date: 2010-05-15 22:20:34 -0400 (Sat, 15 May 2010)
New Revision: 6348
Added:
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/binding/
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/binding/TypesBindingTest.java
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/internal/wire/binding/
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/internal/wire/binding/invalid.jbpm.variable.types.xml
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java
Log:
JBPM-2596 let nested parse exception raise to parent parse problem list
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java 2010-05-15
14:18:26 UTC (rev 6347)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java 2010-05-16
02:20:34 UTC (rev 6348)
@@ -377,6 +377,7 @@
// import the element into the destination element
destination.appendChild(destination.getOwnerDocument().importNode(e, true));
}
+ importedParse.checkErrors(destination.getTagName());
} catch (Exception e) {
importingParse.addProblem("couldn't import "+importedStreamInput,
e);
Added:
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/binding/TypesBindingTest.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/binding/TypesBindingTest.java
(rev 0)
+++
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/binding/TypesBindingTest.java 2010-05-16
02:20:34 UTC (rev 6348)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.wire.binding;
+
+import java.util.List;
+import org.jbpm.test.BaseJbpmTestCase;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.jbpm.pvm.internal.xml.Bindings;
+import org.jbpm.pvm.internal.xml.Problem;
+
+
+/**
+ * @author Huisheng Xu
+ */
+public class TypesBindingTest extends BaseJbpmTestCase {
+ public void testParse() {
+ Parser parser = new Parser();
+ Bindings bindings = new Bindings();
+ parser.setBindings(bindings);
+ parser.getBindings().addBinding(new TypesBinding());
+
+ String xml = "<types
resource='org/jbpm/pvm/internal/wire/binding/invalid.jbpm.variable.types.xml'
/>";
+
+ List<Problem> problems = parser
+ .createParse()
+ .setString(xml)
+ .execute()
+ .getProblems();
+
+ assertTextPresent(
+ "couldn't import
resource://org/jbpm/pvm/internal/wire/binding/invalid.jbpm.variable.types.xml",
+ problems.get(0).getMsg());
+ }
+}
Added:
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/internal/wire/binding/invalid.jbpm.variable.types.xml
===================================================================
---
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/internal/wire/binding/invalid.jbpm.variable.types.xml
(rev 0)
+++
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/internal/wire/binding/invalid.jbpm.variable.types.xml 2010-05-16
02:20:34 UTC (rev 6348)
@@ -0,0 +1,34 @@
+<types>
+
+ <!-- types stored in a native column -->
+ <type name="string" class="java.lang.String"
variable-class="org.jbpm.pvm.internal.type.variable.StringVariable" >
+ <type name="long" class="java.lang.Long"
variable-class="org.jbpm.pvm.internal.type.variable.LongVariable" />
+ <type name="double" class="java.lang.Double"
variable-class="org.jbpm.pvm.internal.type.variable.DoubleVariable" />
+
+ <!-- types converted to a string -->
+ <type name="date" class="java.util.Date"
converter="org.jbpm.pvm.internal.type.converter.DateToStringConverter"
variable-class="org.jbpm.pvm.internal.type.variable.StringVariable" />
+ <type name="boolean" class="java.lang.Boolean"
converter="org.jbpm.pvm.internal.type.converter.BooleanToStringConverter"
variable-class="org.jbpm.pvm.internal.type.variable.StringVariable" />
+ <type name="char" class="java.lang.Character"
converter="org.jbpm.pvm.internal.type.converter.CharacterToStringConverter"
variable-class="org.jbpm.pvm.internal.type.variable.StringVariable" />
+
+ <!-- types converted to a long -->
+ <type name="byte" class="java.lang.Byte"
converter="org.jbpm.pvm.internal.type.converter.ByteToLongConverter"
variable-class="org.jbpm.pvm.internal.type.variable.LongVariable" />
+ <type name="short" class="java.lang.Short"
converter="org.jbpm.pvm.internal.type.converter.ShortToLongConverter"
variable-class="org.jbpm.pvm.internal.type.variable.LongVariable" />
+ <type name="integer" class="java.lang.Integer"
converter="org.jbpm.pvm.internal.type.converter.IntegerToLongConverter"
variable-class="org.jbpm.pvm.internal.type.variable.LongVariable" />
+
+ <!-- types converted to a double -->
+ <type name="float" class="java.lang.Float"
converter="org.jbpm.pvm.internal.type.converter.FloatToDoubleConverter"
variable-class="org.jbpm.pvm.internal.type.variable.DoubleVariable" />
+
+ <!-- byte[] and char[] -->
+ <type name="byte[]" class="[B"
variable-class="org.jbpm.pvm.internal.type.variable.BlobVariable" />
+ <type name="char[]" class="[C"
variable-class="org.jbpm.pvm.internal.type.variable.TextVariable" />
+
+ <type name="hibernate-long-id" class="hibernatable"
id-type="long"
variable-class="org.jbpm.pvm.internal.type.variable.HibernateLongVariable"
/>
+ <type name="hibernate-string-id" class="hibernatable"
id-type="string"
variable-class="org.jbpm.pvm.internal.type.variable.HibernateStringVariable"
/>
+
+ <type name="serializable" class="serializable"
converter="org.jbpm.pvm.internal.type.converter.SerializableToBytesConverter"
variable-class="org.jbpm.pvm.internal.type.variable.BlobVariable" />
+
+ <!-- TODO: add ejb3 entity bean support -->
+ <!-- TODO: add JCR activity support -->
+ <!-- TODO: add collection support -->
+
+</types>