[jboss-svn-commits] JBL Code SVN: r34793 - in labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src: test/java/org/drools and 3 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Aug 19 10:40:46 EDT 2010


Author: diegoll
Date: 2010-08-19 10:40:45 -0400 (Thu, 19 Aug 2010)
New Revision: 34793

Added:
   labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/Person.java
   labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/PersonInterface.java
   labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/persistence/jpa/exceptionhandling/
   labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/persistence/jpa/exceptionhandling/PersistentProcessNodeExceptionOccurredEventTest.java
   labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/resources/ProcessNodeExceptionOccurredEventTest_2.rf
Modified:
   labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/main/java/org/drools/persistence/session/SingleSessionCommandService.java
Log:
[JBRULES-2595] throw original runtime exception when using singlesessioncommandservice

Modified: labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/main/java/org/drools/persistence/session/SingleSessionCommandService.java
===================================================================
--- labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/main/java/org/drools/persistence/session/SingleSessionCommandService.java	2010-08-19 14:30:35 UTC (rev 34792)
+++ labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/main/java/org/drools/persistence/session/SingleSessionCommandService.java	2010-08-19 14:40:45 UTC (rev 34793)
@@ -34,7 +34,7 @@
     implements
     org.drools.command.SingleSessionCommandService {
     
-    Logger                               logger                                            = LoggerFactory.getLogger( getClass() );    
+    Logger                               logger                                            = LoggerFactory.getLogger(SingleSessionCommandService.class);    
 
     private SessionInfo                 sessionInfo;
     private JPASessionMarshallingHelper marshallingHelper;
@@ -276,22 +276,19 @@
             //this.appScopedEntityManager.joinTransaction();
             registerRollbackSync();
 
+            logger.debug("Executing [{}] command", command.getClass().getSimpleName());
             T result = ((GenericCommand<T>) command).execute( this.kContext );
 
             txm.commit();
 
             return result;
 
+        }catch (RuntimeException re){
+            rollbackTransaction(re);
+            throw re;
         } catch ( Exception t1 ) {
-            try {
-                txm.rollback();
-            } catch ( Exception t2 ) {
-                logger.error("Could not commit session or rollback. Original exception:",t1);
-                throw new RuntimeException( "Could not commit session or rollback",
-                                            t2 );
-            }
-            throw new RuntimeException( "Could not commit session",
-                                        t1 );
+            rollbackTransaction(t1);
+            throw new RuntimeException("Wrapped exception see cause", t1);
         } finally {
             if ( command instanceof DisposeCommand ) {
                 this.jpm.dispose();
@@ -299,6 +296,15 @@
         }
     }
 
+    private void rollbackTransaction(Exception t1) {
+        try {
+            txm.rollback();
+        } catch ( Exception t2 ) {
+            logger.error("Could not commit session or rollback. Original exception:",t1);
+            throw new RuntimeException( "Could not commit session or rollback", t2 );
+        }
+    }
+
     public void dispose() {
         if ( ksession != null ) {
             ksession.dispose();

Added: labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/Person.java
===================================================================
--- labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/Person.java	                        (rev 0)
+++ labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/Person.java	2010-08-19 14:40:45 UTC (rev 34793)
@@ -0,0 +1,298 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * 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.
+ */
+package org.drools;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+public class Person
+    implements
+    Serializable,
+    PersonInterface {
+    /**
+     *
+     */
+    private static final long serialVersionUID = 510l;
+    private String            name;
+    private String            likes;
+    private int               age;
+    private BigDecimal        bigDecimal;
+    private BigInteger        bigInteger;
+    private String            hair;
+
+    private char              sex;
+
+    private boolean           alive;
+    private boolean           happy;
+
+    private String            status;
+
+    private Cheese            cheese;
+
+    private List<Address>     addresses        = new ArrayList<Address>();
+
+    //    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+    //        name    = (String)in.readObject();
+    //        likes    = (String)in.readObject();
+    //        age     = in.readInt();
+    //        bigDecimal    = (BigDecimal)in.readObject();
+    //        bigInteger    = (BigInteger)in.readObject();
+    //        hair    = (String)in.readObject();
+    //        sex     = in.readChar();
+    //        alive   = in.readBoolean();
+    //        status    = (String)in.readObject();
+    //        cheese    = (Cheese)in.readObject();
+    //        addresses    = (List)in.readObject();
+    //    }
+    //
+    //    public void writeExternal(ObjectOutput out) throws IOException {
+    //        out.writeObject(name);
+    //        out.writeObject(likes);
+    //        out.writeObject(bigDecimal);
+    //        out.writeObject(bigInteger);
+    //        out.writeObject(hair);
+    //        out.writeChar(sex);
+    //        out.writeBoolean(alive);
+    //        out.writeObject(status);
+    //        out.writeObject(cheese);
+    //        out.writeObject(addresses);
+    //    }
+
+    public Person() {
+
+    }
+
+    public Person(String name,
+                  int age) {
+        super();
+        this.name = name;
+        this.age = age;
+    }
+
+    public Person(final String name) {
+        this( name,
+              "",
+              0 );
+    }
+
+    public List<Address> getAddresses() {
+        return addresses;
+    }
+
+    public void setAddresses(List<Address> addresses) {
+        this.addresses = addresses;
+    }
+
+    public void addAddress(Address address) {
+        this.addresses.add( address );
+    }
+
+    public Person(final String name,
+                  final String likes) {
+        this( name,
+              likes,
+              0 );
+    }
+
+    public Person(final String name,
+                  final String likes,
+                  final int age) {
+        this.name = name;
+        this.likes = likes;
+        this.age = age;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#getStatus()
+     */
+    public String getStatus() {
+        return this.status;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#setStatus(java.lang.String)
+     */
+    public void setStatus(final String status) {
+        this.status = status;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#getLikes()
+     */
+    public String getLikes() {
+        return this.likes;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#getName()
+     */
+    public String getName() {
+        return this.name;
+    }
+
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#getAge()
+     */
+    public int getAge() {
+        return this.age;
+    }
+
+    public void setAge(final int age) {
+        this.age = age;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#isAlive()
+     */
+    public boolean isAlive() {
+        return this.alive;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#setAlive(boolean)
+     */
+    public void setAlive(final boolean alive) {
+        this.alive = alive;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#getSex()
+     */
+    public char getSex() {
+        return this.sex;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#setSex(char)
+     */
+    public void setSex(final char sex) {
+        this.sex = sex;
+    }
+
+    public String getHair() {
+        return this.hair;
+    }
+
+    public void setHair(final String hair) {
+        this.hair = hair;
+    }
+
+    public String toString() {
+        return "[Person name='" + this.name + " age='" + this.age + "' likes='" + likes + "']";
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public int hashCode() {
+        final int PRIME = 31;
+        int result = 1;
+        result = PRIME * result + this.age;
+        result = PRIME * result + (this.alive ? 1231 : 1237);
+        result = PRIME * result + ((this.name == null) ? 0 : this.name.hashCode());
+        result = PRIME * result + this.sex;
+        return result;
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public boolean equals(final Object obj) {
+        if ( this == obj ) {
+            return true;
+        }
+        if ( obj == null ) {
+            return false;
+        }
+        if ( getClass() != obj.getClass() ) {
+            return false;
+        }
+        final Person other = (Person) obj;
+        if ( this.age != other.age ) {
+            return false;
+        }
+        if ( this.alive != other.alive ) {
+            return false;
+        }
+        if ( this.name == null ) {
+            if ( other.name != null ) {
+                return false;
+            }
+        } else if ( !this.name.equals( other.name ) ) {
+            return false;
+        }
+        if ( this.sex != other.sex ) {
+            return false;
+        }
+        return true;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#getBigDecimal()
+     */
+    public BigDecimal getBigDecimal() {
+        return this.bigDecimal;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#setBigDecimal(java.math.BigDecimal)
+     */
+    public void setBigDecimal(final BigDecimal bigDecimal) {
+        this.bigDecimal = bigDecimal;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#getBigInteger()
+     */
+    public BigInteger getBigInteger() {
+        return this.bigInteger;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#setBigInteger(java.math.BigInteger)
+     */
+    public void setBigInteger(final BigInteger bigInteger) {
+        this.bigInteger = bigInteger;
+    }
+
+    public void setLikes(final String likes) {
+        this.likes = likes;
+    }
+
+    public Cheese getCheese() {
+        return this.cheese;
+    }
+
+    public void setCheese(final Cheese cheese) {
+        this.cheese = cheese;
+    }
+
+    public boolean isHappy() {
+        return happy;
+    }
+
+    public void setHappy(boolean happy) {
+        this.happy = happy;
+    }
+
+}


Property changes on: labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/Person.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/PersonInterface.java
===================================================================
--- labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/PersonInterface.java	                        (rev 0)
+++ labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/PersonInterface.java	2010-08-19 14:40:45 UTC (rev 34793)
@@ -0,0 +1,34 @@
+package org.drools;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+public interface PersonInterface {
+
+    public abstract String getStatus();
+
+    public abstract void setStatus(String status);
+
+    public abstract String getLikes();
+
+    public abstract String getName();
+
+    public abstract int getAge();
+
+    public abstract boolean isAlive();
+
+    public abstract void setAlive(boolean alive);
+
+    public abstract char getSex();
+
+    public abstract void setSex(char sex);
+
+    public abstract BigDecimal getBigDecimal();
+
+    public abstract void setBigDecimal(BigDecimal bigDecimal);
+
+    public abstract BigInteger getBigInteger();
+
+    public abstract void setBigInteger(BigInteger bigInteger);
+
+}
\ No newline at end of file


Property changes on: labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/PersonInterface.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/persistence/jpa/exceptionhandling/PersistentProcessNodeExceptionOccurredEventTest.java
===================================================================
--- labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/persistence/jpa/exceptionhandling/PersistentProcessNodeExceptionOccurredEventTest.java	                        (rev 0)
+++ labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/persistence/jpa/exceptionhandling/PersistentProcessNodeExceptionOccurredEventTest.java	2010-08-19 14:40:45 UTC (rev 34793)
@@ -0,0 +1,280 @@
+package org.drools.persistence.jpa.exceptionhandling;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+
+import org.drools.KnowledgeBase;
+import org.drools.KnowledgeBaseFactory;
+import org.drools.Person;
+import org.drools.builder.KnowledgeBuilder;
+import org.drools.builder.KnowledgeBuilderError;
+import org.drools.builder.KnowledgeBuilderFactory;
+import org.drools.builder.ResourceType;
+import org.drools.event.process.DefaultProcessEventListener;
+import org.drools.event.process.ProcessNodeExceptionOccurredEvent;
+import org.drools.impl.EnvironmentFactory;
+import org.drools.io.ResourceFactory;
+import org.drools.persistence.jpa.JPAKnowledgeService;
+import org.drools.process.instance.impl.demo.DoNothingWorkItemHandler;
+import org.drools.runtime.Environment;
+import org.drools.runtime.EnvironmentName;
+import org.drools.runtime.StatefulKnowledgeSession;
+import org.drools.runtime.process.WorkItem;
+import org.drools.runtime.process.WorkItemHandler;
+import org.drools.runtime.process.WorkItemManager;
+import org.drools.workflow.instance.impl.ProcessNodeExecutionException;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import bitronix.tm.TransactionManagerServices;
+import bitronix.tm.resource.jdbc.PoolingDataSource;
+
+public class PersistentProcessNodeExceptionOccurredEventTest {
+    private EntityManagerFactory emf;
+    private PoolingDataSource ds1;
+    private int exceptionCount;
+    
+    @Before
+    public void setUp() {
+        ds1 = new PoolingDataSource();
+        ds1.setUniqueName("jdbc/testDS1");
+        ds1.setClassName( "org.h2.jdbcx.JdbcDataSource" );
+        ds1.setMaxPoolSize( 3 );
+        ds1.setAllowLocalTransactions( true );
+        ds1.getDriverProperties().put( "user", "sa" );
+        ds1.getDriverProperties().put( "password", "sasa" );
+        ds1.getDriverProperties().put( "URL", "jdbc:h2:mem:mydb" );
+        ds1.init();
+        
+        //create entity manager factory
+        emf = Persistence.createEntityManagerFactory("org.drools.persistence.jpa");
+    }
+
+    @After
+    public void tearDown() {
+        emf.close();
+        ds1.close();
+    }
+    
+    @Test
+    public void testListenerException(){
+        //Create a new kbase with the given flow.
+        KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
+        kbuilder.add(ResourceFactory.newClassPathResource("ProcessNodeExceptionOccurredEventTest_2.rf"), ResourceType.DRF);
+        if (kbuilder.hasErrors()) {
+            StringBuilder builder = new StringBuilder();
+            for (KnowledgeBuilderError error : kbuilder.getErrors()) {
+                builder.append(error.getMessage());
+            }
+            Assert.fail(builder.toString());
+        }
+        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
+        kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
+
+        final StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
+        
+        ksession.addEventListener(new DefaultProcessEventListener(){
+
+            @Override
+            public void onNodeException(ProcessNodeExceptionOccurredEvent event) {
+                if (event.getError() instanceof MyBusinessException){
+                    return;
+                }
+                System.out.println("\t"+event.getNodeInstance().getNodeName());
+                exceptionCount++;
+                throw new MyBusinessException(event);
+            }
+
+        });
+        
+        //Insert all the needed globals. Inserting a person will make that the
+        //Action node works fine.
+        List<String> list = new ArrayList<String>();
+        Person person = new Person();
+        person.setName("John");
+        ksession.setGlobal("person", person);
+        ksession.setGlobal("list", list);
+
+        //Register a WorkItemHandler. This handler will throw an exception when
+        //invoked.
+        ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new FailWorkItemHandler());
+
+        //ExpectedResult expectedResult = new ExpectedResult("flow","HumanTask", "MyBusinessException");
+        try {
+            ksession.startProcess("org.drools.test.process1");
+            fail("An exception should occurr!");
+        } catch (MyBusinessException ex) {
+            System.out.println("\tMyBusinessException");
+            assertEquals("flow", ex.getProcessName());
+            assertEquals("HumanTask", ex.getNodeName());
+        } catch (Exception ex){
+            ex.printStackTrace();
+            fail("Unexpected Exception: "+ex);
+        }
+        assertEquals(1, this.exceptionCount);
+        this.exceptionCount = 0;
+
+        ///Register a real handler that never completes the WI
+        final List<Long> workItemIds = new ArrayList<Long>();
+        ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new DoNothingWorkItemHandler(){
+
+            @Override
+            public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
+                workItemIds.add(workItem.getId());
+                super.executeWorkItem(workItem, manager);
+            }
+            
+        });
+
+        //no exceptions now
+        ksession.startProcess("org.drools.test.process1");
+
+        assertEquals(1, workItemIds.size());
+        try {
+            //After the WI is completed, an action node is executed. This
+            //Action Node is suposed to fail (throws an error).
+            ksession.getWorkItemManager().completeWorkItem(workItemIds.get(0), null);
+            fail("An error should occurr!");
+        } catch (MyBusinessException ex) {
+            System.out.println("\tMyBusinessException");
+            assertEquals("flow", ex.getProcessName());
+            assertEquals("Illegal Action Node", ex.getNodeName());
+        } catch (Exception ex){
+            ex.printStackTrace();
+            fail("Unexpected Exception: "+ex);
+        }
+        assertEquals(1, this.exceptionCount);
+        this.exceptionCount = 0;
+
+        ksession.dispose();
+    }
+    
+    private StatefulKnowledgeSession createKnowledgeSession(KnowledgeBase kbase) {
+        Environment environment = EnvironmentFactory.newEnvironment();
+        environment.set(EnvironmentName.ENTITY_MANAGER_FACTORY, Persistence.createEntityManagerFactory("org.drools.persistence.jpa"));
+        environment.set(EnvironmentName.TRANSACTION_MANAGER, TransactionManagerServices.getTransactionManager());
+
+        StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, environment);
+        //StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(null, environment);
+        return ksession;
+    }
+
+    private class MyBusinessException extends ProcessNodeExecutionException{
+        private ProcessNodeExceptionOccurredEvent source;
+        private String processName;
+        private String nodeName;
+
+        public MyBusinessException(ProcessNodeExceptionOccurredEvent source){
+            super(source.getError());
+            this.source = source;
+            this.processName = source.getProcessInstance().getProcessName();
+            this.nodeName = source.getNodeInstance().getNodeName();
+        }
+
+        public String getProcessName(){
+            return this.processName;
+        }
+
+        public String getNodeName(){
+            return this.nodeName;
+        }
+
+        public Throwable getOriginalException(){
+            return this.source.getError();
+        }
+
+        @Override
+        public String toString() {
+            return "MyBusinessException{" + "Original Exception= '" + this.getOriginalException().toString() + "', Process= '"+this.getProcessName()+"', Process= '"+this.getProcessName()+"}";
+        }
+    }
+    
+    /**
+     * A custom WorkItemHandler that will throw an exception when invoked.
+     */
+    private static class FailWorkItemHandler implements WorkItemHandler {
+
+        public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
+            throw new UnsupportedOperationException("Not supported yet.");
+        }
+
+        public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
+        }
+    }
+
+    /**
+     * Internal class to express an expected result of a process exception.
+     */
+    private static class ExpectedResult {
+
+        /**
+         * The expected process name where the exception occurred.
+         */
+        private String processName;
+        /**
+         * The expected node name where the exception occurred.
+         */
+        private String nodeName;
+        /**
+         * The expected exception name.
+         */
+        private String expectedException;
+
+        /**
+         * Creates a new ExpectedResult instance
+         * @param processName The expected process name where the exception occurred.
+         * @param nodeName The expected node name where the exception occurred.
+         * @param expectedException The expected exception name.
+         */
+        public ExpectedResult(String processName ,String nodeName, String expectedException) {
+            this.processName = processName;
+            this.nodeName = nodeName;
+            this.expectedException = expectedException;
+        }
+
+        /**
+         * Validates this ExpectedResult instance against a ProcessNodeExceptionOccurredEvent
+         * @param event the ProcessNodeExceptionOccurredEvent triggered by the process
+         */
+        public void validate(ProcessNodeExceptionOccurredEvent event) {
+
+            //Process name validation
+            if (this.processName != null) {
+                assertEquals(this.processName, event.getProcessInstance().getProcessName());
+            }
+
+            //Node name validation
+            if (this.nodeName != null) {
+                assertEquals(this.nodeName, event.getNodeInstance().getNodeName());
+            }
+
+            //Exception name validation. The real exception could not be the
+            //top-level exception of ProcessNodeExceptionOccurredEvent. That is
+            //why we need to navigate through the original exception.
+            if (this.expectedException != null) {
+                boolean found = false;
+                Throwable t = event.getError();
+                while (t != null) {
+                    if (t.toString().contains(this.expectedException)) {
+                        found = true;
+                        break;
+                    }
+                    t = t.getCause();
+                }
+
+                if (!found) {
+                    fail(this.expectedException + " wasn't found!");
+                }
+            }
+        }
+    }
+
+}


Property changes on: labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/persistence/jpa/exceptionhandling/PersistentProcessNodeExceptionOccurredEventTest.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/resources/ProcessNodeExceptionOccurredEventTest_2.rf
===================================================================
--- labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/resources/ProcessNodeExceptionOccurredEventTest_2.rf	                        (rev 0)
+++ labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/resources/ProcessNodeExceptionOccurredEventTest_2.rf	2010-08-19 14:40:45 UTC (rev 34793)
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?> 
+<process xmlns="http://drools.org/drools-5.0/process"
+         xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+         xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-5.0.xsd"
+         type="RuleFlow" name="flow" package-name="org.drools.test.process1" id="org.drools.test.process1">
+
+  <header>
+  
+  	<imports>
+      <import name="org.drools.Person" />
+    </imports>
+    <globals>
+      <global identifier="person" type="org.drools.Person" />
+      <global identifier="list" type="java.util.List" />
+    </globals>
+  
+  </header>
+
+  <nodes>
+    <start id="1" name="Start" x="100" y="100" width="48" height="48" />
+     <actionNode id="2" name="Some Script" x="186" y="97" width="80" height="48" >
+      <action type="expression" dialect="java" >
+        System.out.println("Hello "+person.getName());        
+      </action>
+    </actionNode>
+
+
+
+     <workItem id="3" name="HumanTask" >
+      <work name="Human Task" >
+        <parameter name="ActorId" >
+          <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+          <value>John Doe</value>
+        </parameter>
+        <parameter name="TaskName" >
+          <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+          <value>Do something</value>
+        </parameter>
+        <parameter name="Priority" >
+          <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+        </parameter>
+        <parameter name="Comment" >
+          <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+        </parameter>
+      </work>
+      <onEntry>
+        <action type="expression" name="Print" dialect="mvel" >list.add("Executing on entry action");</action>
+      </onEntry>
+      <onExit>
+        <action type="expression" name="Print" dialect="java" >list.add("Executing on exit action1");</action>
+        <action type="expression" name="Print" dialect="java" >list.add("Executing on exit action2");</action>
+      </onExit>
+    </workItem>
+
+    <actionNode id="4" name="Illegal Action Node" x="186" y="97" width="80" height="48" >
+      <action type="expression" dialect="java" >
+        throw new java.lang.IllegalAccessError("This is illegal!");
+      </action>
+    </actionNode>
+
+    <end id="5" name="End" x="357" y="92" width="48" height="48" />
+  </nodes>
+
+  <connections>
+    <connection from="1" to="2" />
+    <connection from="2" to="3" />
+    <connection from="3" to="4" />
+    <connection from="4" to="5" />
+  </connections>
+
+</process>
\ No newline at end of file


Property changes on: labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/resources/ProcessNodeExceptionOccurredEventTest_2.rf
___________________________________________________________________
Name: svn:eol-style
   + native



More information about the jboss-svn-commits mailing list