You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by je...@apache.org on 2010/05/02 19:03:00 UTC

svn commit: r940263 [4/16] - in /ode/trunk: ./ axis2-war/ axis2-war/src/main/assembly/ axis2-war/src/main/webapp/WEB-INF/conf.hib-derby/ axis2-war/src/main/webapp/WEB-INF/conf.jpa-derby/ axis2-war/src/main/webapp/WEB-INF/conf/ axis2-war/src/test/java/o...

Modified: ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java?rev=940263&r1=940262&r2=940263&view=diff
==============================================================================
--- ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java (original)
+++ ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java Sun May  2 17:02:51 2010
@@ -18,9 +18,12 @@
  */
 package org.apache.ode.store;
 
+import org.apache.ode.dao.store.ProcessConfDAO;
+import org.apache.ode.dao.store.DeploymentUnitDAO;
+import org.apache.ode.dao.store.ConfStoreDAOConnectionFactory;
+import org.apache.ode.dao.store.ConfStoreDAOConnection;
 import java.io.File;
 import java.io.IOException;
-import java.sql.SQLException;
 import java.util.*;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.ExecutorService;
@@ -31,8 +34,8 @@ import java.util.concurrent.locks.ReadWr
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+import javax.transaction.TransactionManager;
 
-import javax.sql.DataSource;
 import javax.xml.namespace.QName;
 
 import org.apache.commons.logging.Log;
@@ -42,12 +45,9 @@ import org.apache.ode.bpel.extension.Ext
 import org.apache.ode.bpel.dd.DeployDocument;
 import org.apache.ode.bpel.dd.TDeployment;
 import org.apache.ode.bpel.iapi.*;
-import org.apache.ode.il.config.OdeConfigProperties;
 import org.apache.ode.store.DeploymentUnitDir.CBPInfo;
 import org.apache.ode.utils.DOMUtils;
-import org.apache.ode.utils.GUID;
 import org.apache.ode.utils.msg.MessageBundle;
-import org.hsqldb.jdbc.jdbcDataSource;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -86,12 +86,11 @@ public class ProcessStoreImpl implements
     /** Guards access to the _processes and _deploymentUnits */
     private final ReadWriteLock _rw = new ReentrantReadWriteLock();
 
-    /** GUID used to create a unique in-memory db. */
-    private String _guid = new GUID().toString();
+    final private ConfStoreDAOConnectionFactory _cf;
 
-    private ConfStoreConnectionFactory _cf;
+    final private EndpointReferenceContext _eprContext;
 
-    private EndpointReferenceContext eprContext;
+    final private TransactionManager _txm;
 
     protected File _deployDir;
 
@@ -106,51 +105,16 @@ public class ProcessStoreImpl implements
     private ExecutorService _executor = Executors.newSingleThreadExecutor(new SimpleThreadFactory());
 
     /**
-     * In-memory DataSource, or <code>null</code> if we are using a real DS. We need this to shutdown the DB.
-     */
-    private DataSource _inMemDs;
-
-    public ProcessStoreImpl() {
-        this(null, null, "", new OdeConfigProperties(new Properties(), ""), true);
-    }
-
-    public ProcessStoreImpl(EndpointReferenceContext eprContext, DataSource ds, String persistenceType, OdeConfigProperties props, boolean createDatamodel) {
-        this.eprContext = eprContext;
-        if (ds != null) {
-            // ugly hack
-            if (persistenceType.toLowerCase().indexOf("hib") != -1)
-                _cf = new org.apache.ode.store.hib.DbConfStoreConnectionFactory(ds, props.getProperties(), createDatamodel);
-            else
-                _cf = new org.apache.ode.store.jpa.DbConfStoreConnectionFactory(ds, createDatamodel);
-        } else {
-            // If the datasource is not provided, then we create a HSQL-based in-memory
-            // database. Makes testing a bit simpler.
-            DataSource hsqlds = createInternalDS(_guid);
-            if ("hibernate".equalsIgnoreCase(persistenceType))
-                _cf = new org.apache.ode.store.hib.DbConfStoreConnectionFactory(hsqlds, props.getProperties(), createDatamodel);
-            else
-                _cf = new org.apache.ode.store.jpa.DbConfStoreConnectionFactory(hsqlds, createDatamodel);
-            _inMemDs = hsqlds;
-        }
-
-    }
-
-    /**
      * Constructor that hardwires OpenJPA on a new in-memory database. Suitable for tests.
      */
-    public ProcessStoreImpl(EndpointReferenceContext eprContext, DataSource inMemDs) {
-        this.eprContext = eprContext;
-        DataSource hsqlds = createInternalDS(new GUID().toString());
-        //when in memory we always create the model as we are starting from scratch
-        _cf = new org.apache.ode.store.jpa.DbConfStoreConnectionFactory(hsqlds, true);
-        _inMemDs = hsqlds;
+    public <E> ProcessStoreImpl(EndpointReferenceContext eprContext, TransactionManager mgr, ConfStoreDAOConnectionFactory cf) {
+        _eprContext = eprContext;
+        _txm = mgr;
+        _cf=cf;
     }
 
     public void shutdown() {
-        if (_inMemDs != null) {
-            shutdownInternalDB(_inMemDs);
-            _inMemDs = null;
-        }
+        
     }
 
     @Override
@@ -191,7 +155,7 @@ public class ProcessStoreImpl implements
         _rw.writeLock().lock();
         // Process and DU use a monotonically increased single version number.
         long version = exec(new Callable<Long>() {
-            public Long call(ConfStoreConnection conn) {
+            public Long call(ConfStoreDAOConnection conn) {
                 return conn.getNextVersion();
             }
         });
@@ -226,7 +190,7 @@ public class ProcessStoreImpl implements
                 }
 
                 ProcessConfImpl pconf = new ProcessConfImpl(pid, processDD.getName(), version, du, processDD, deployDate,
-                        calcInitialProperties(processDD), calcInitialState(processDD), eprContext, _configDir);
+                        calcInitialProperties(processDD), calcInitialState(processDD), _eprContext, _configDir);
                 processes.add(pconf);
             }
 
@@ -245,7 +209,7 @@ public class ProcessStoreImpl implements
         // Do the deployment in the DB. We need this so that we remember deployments across system shutdowns.
         // We don't fail if there is a DB error, simply print some errors.
         deployed = exec(new Callable<Collection<QName>>() {
-            public Collection<QName> call(ConfStoreConnection conn) {
+            public Collection<QName> call(ConfStoreDAOConnection conn) {
                 // Check that this deployment unit is not deployed.
                 DeploymentUnitDAO dudao = conn.getDeploymentUnit(du.getName());
                 if (dudao != null) {
@@ -337,7 +301,7 @@ public class ProcessStoreImpl implements
     public Collection<QName> undeploy(final File dir) {
         try {
             exec(new Callable<Collection<QName>>() {
-                public Collection<QName> call(ConfStoreConnection conn) {
+                public Collection<QName> call(ConfStoreDAOConnection conn) {
                     DeploymentUnitDAO dudao = conn.getDeploymentUnit(dir.getName());
                     if (dudao != null)
                         dudao.delete();
@@ -411,7 +375,7 @@ public class ProcessStoreImpl implements
 
         // Update in the database.
         ProcessState old = exec(new Callable<ProcessState>() {
-            public ProcessState call(ConfStoreConnection conn) {
+            public ProcessState call(ConfStoreDAOConnection conn) {
                 DeploymentUnitDAO dudao = conn.getDeploymentUnit(dudir.getName());
                 if (dudao == null) {
                     String errmsg = __msgs.msgProcessNotFound(pid);
@@ -472,7 +436,7 @@ public class ProcessStoreImpl implements
 
         final DeploymentUnitDir dudir = pconf.getDeploymentUnit();
         exec(new ProcessStoreImpl.Callable<Object>() {
-            public Object call(ConfStoreConnection conn) {
+            public Object call(ConfStoreDAOConnection conn) {
                 DeploymentUnitDAO dudao = conn.getDeploymentUnit(dudir.getName());
                 if (dudao == null)
                     return null;
@@ -494,7 +458,7 @@ public class ProcessStoreImpl implements
     public void loadAll() {
         final ArrayList<ProcessConfImpl> loaded = new ArrayList<ProcessConfImpl>();
         exec(new Callable<Object>() {
-            public Object call(ConfStoreConnection conn) {
+            public Object call(ConfStoreDAOConnection conn) {
                 Collection<DeploymentUnitDAO> dus = conn.getDeploymentUnits();
                 for (DeploymentUnitDAO du : dus)
                     try {
@@ -539,7 +503,7 @@ public class ProcessStoreImpl implements
 
     public long getCurrentVersion() {
         long version = exec(new Callable<Long>() {
-            public Long call(ConfStoreConnection conn) {
+            public Long call(ConfStoreDAOConnection conn) {
                 return conn.getNextVersion();
             }
         });
@@ -597,7 +561,7 @@ public class ProcessStoreImpl implements
         }
     }
 
-    private ConfStoreConnection getConnection() {
+    private ConfStoreDAOConnection getConnection() {
         return _cf.getConnection();
     }
 
@@ -678,7 +642,7 @@ public class ProcessStoreImpl implements
                 // TODO: update the props based on the values in the DB.
 
                 ProcessConfImpl pconf = new ProcessConfImpl(p.getPID(), p.getType(), p.getVersion(), dud, pinfo, dudao
-                        .getDeployDate(), props, p.getState(), eprContext, _configDir);
+                        .getDeployDate(), props, p.getState(), _eprContext, _configDir);
                 version = p.getVersion();
 
                 _processes.put(pconf.getProcessId(), pconf);
@@ -722,7 +686,7 @@ public class ProcessStoreImpl implements
 
         try {
             return exec(new Callable<Boolean>() {
-                public Boolean call(ConfStoreConnection conn) {
+                public Boolean call(ConfStoreDAOConnection conn) {
                     DeploymentUnitDAO dudao = conn.getDeploymentUnit(duName);
                     if (dudao == null)
                         return false;
@@ -748,30 +712,31 @@ public class ProcessStoreImpl implements
     abstract class Callable<V> implements java.util.concurrent.Callable<V> {
         public V call() {
             boolean success = false;
-            ConfStoreConnection conn = getConnection();
+            ConfStoreDAOConnection conn = _cf.getConnection();
             try {
-                conn.begin();
+                if (_txm!=null)
+                    _txm.begin();
                 V r = call(conn);
-                conn.commit();
+                if (_txm!=null)
+                    _txm.commit();
                 success = true;
                 return r;
+            }catch (Exception e){
+                __log.error("TxError",e);
+                return null;
             } finally {
-                if (!success)
+                if (!success && _txm != null)
                     try {
-                        conn.rollback();
+                        _txm.rollback();
                     } catch (Exception ex) {
-                        __log.error("DbError", ex);
+                        __log.error("TxError", ex);
                     }
-                try {
                     conn.close();
-                } catch (Exception ex) {
-                    __log.error("DbError", ex);
-                }
             }
 
         }
 
-        abstract V call(ConfStoreConnection conn);
+        abstract V call(ConfStoreDAOConnection conn);
     }
 
     public void setDeployDir(File depDir) {
@@ -794,22 +759,7 @@ public class ProcessStoreImpl implements
         this._configDir = configDir;
     }
 
-    public static DataSource createInternalDS(String guid) {
-        jdbcDataSource hsqlds = new jdbcDataSource();
-        hsqlds.setDatabase("jdbc:hsqldb:mem:" + guid);
-        hsqlds.setUser("sa");
-        hsqlds.setPassword("");
-        return hsqlds;
-    }
-
-    public static void shutdownInternalDB(DataSource ds) {
-        try {
-            ds.getConnection().createStatement().execute("SHUTDOWN;");
-        } catch (SQLException e) {
-            __log.error("Error shutting down.", e);
-        }
-    }
-
+    
     private List<QName> toPids(Collection<QName> processTypes, long version) {
         ArrayList<QName> result = new ArrayList<QName>();
         for (QName pqName : processTypes) {

Added: ode/trunk/bpel-store/src/test/java/org/apache/ode/store/DaoTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-store/src/test/java/org/apache/ode/store/DaoTest.java?rev=940263&view=auto
==============================================================================
--- ode/trunk/bpel-store/src/test/java/org/apache/ode/store/DaoTest.java (added)
+++ ode/trunk/bpel-store/src/test/java/org/apache/ode/store/DaoTest.java Sun May  2 17:02:51 2010
@@ -0,0 +1,206 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.ode.store;
+
+import java.util.Properties;
+import javax.transaction.TransactionManager;
+import junit.framework.TestCase;
+import javax.xml.namespace.QName;
+import org.apache.ode.dao.store.ConfStoreDAOConnection;
+import org.apache.ode.dao.store.ConfStoreDAOConnectionFactory;
+import org.apache.ode.dao.store.DeploymentUnitDAO;
+import org.apache.ode.dao.store.ProcessConfDAO;
+import org.apache.ode.il.config.OdeConfigProperties;
+import org.apache.ode.il.dbutil.Database;
+import org.apache.ode.il.txutil.TxManager;
+
+public class DaoTest extends TestCase {
+
+  
+  Database _db;
+  ConfStoreDAOConnectionFactory _cf;
+  TransactionManager _txm;
+
+  @Override
+  public void setUp() throws Exception {
+    Properties props = new Properties();
+    props.setProperty(OdeConfigProperties.PROP_DAOCF_STORE,System.getProperty(OdeConfigProperties.PROP_DAOCF_STORE,OdeConfigProperties.DEFAULT_DAOCF_STORE_CLASS));
+    OdeConfigProperties odeProps = new OdeConfigProperties(props, "");
+    TxManager tx = new TxManager(odeProps);
+    _txm = tx.createTransactionManager();
+    _db = new Database(odeProps);
+    _db.setTransactionManager(_txm);
+    _db.start();
+    _cf = _db.createDaoStoreCF();
+  }
+
+  @Override
+  public void tearDown() throws Exception {
+    _cf.shutdown();
+    _db.shutdown();
+
+  }
+
+  public void testEmpty() throws Exception {
+    ConfStoreDAOConnection conn = _cf.getConnection();
+    _txm.begin();
+    assertEquals(0, conn.getDeploymentUnits().size());
+    assertNull(conn.getDeploymentUnit("foobar"));
+    _txm.commit();
+    conn.close();
+  }
+
+  public void testCreateDU() throws Exception {
+    ConfStoreDAOConnection conn = _cf.getConnection();
+    _txm.begin();
+    try {
+      DeploymentUnitDAO du = conn.createDeploymentUnit("foo");
+      assertNotNull(du);
+      assertEquals("foo", du.getName());
+      assertNotNull(du.getDeployDate());
+    } finally {
+      _txm.commit();
+      conn.close();
+    }
+
+    conn = _cf.getConnection();
+    _txm.begin();
+    try {
+      DeploymentUnitDAO du = conn.getDeploymentUnit("foo");
+      assertNotNull(du);
+      assertEquals("foo", du.getName());
+    } finally {
+      _txm.commit();
+    }
+
+  }
+
+  public void testRollback() throws Exception {
+    ConfStoreDAOConnection conn = _cf.getConnection();
+    _txm.begin();
+    try {
+      DeploymentUnitDAO du = conn.createDeploymentUnit("foo");
+      assertNotNull(du);
+      assertEquals("foo", du.getName());
+      assertNotNull(du.getDeployDate());
+    } finally {
+      _txm.rollback();
+      conn.close();
+    }
+
+    conn = _cf.getConnection();
+    _txm.begin();
+    try {
+      DeploymentUnitDAO du = conn.getDeploymentUnit("foo");
+      assertNull(du);
+    } finally {
+      _txm.commit();
+    }
+
+  }
+
+  public void testGetDeploymentUnits() throws Exception {
+    ConfStoreDAOConnection conn = _cf.getConnection();
+    _txm.begin();
+    try {
+      conn.createDeploymentUnit("foo1");
+      conn.createDeploymentUnit("foo2");
+      conn.createDeploymentUnit("foo3");
+      conn.createDeploymentUnit("foo4");
+    } finally {
+      _txm.commit();
+      conn.close();
+    }
+    conn = _cf.getConnection();
+    _txm.begin();
+    try {
+      assertNotNull(conn.getDeploymentUnit("foo1"));
+      assertNotNull(conn.getDeploymentUnit("foo2"));
+      assertNotNull(conn.getDeploymentUnit("foo3"));
+      assertNotNull(conn.getDeploymentUnit("foo4"));
+      assertNull(conn.getDeploymentUnit("foo5"));
+    } finally {
+      _txm.commit();
+    }
+  }
+
+  public void testCreateProcess() throws Exception{
+    QName foobar = new QName("foo", "bar");
+    ConfStoreDAOConnection conn = _cf.getConnection();
+    _txm.begin();
+    try {
+      DeploymentUnitDAO du = conn.createDeploymentUnit("foo1");
+      ProcessConfDAO p = du.createProcess(foobar, foobar, 1);
+      assertEquals(foobar, p.getPID());
+      assertEquals(foobar, p.getType());
+      assertNotNull(p.getDeploymentUnit());
+      assertEquals("foo1", p.getDeploymentUnit().getName());
+    } finally {
+      _txm.commit();
+      conn.close();
+    }
+
+    conn = _cf.getConnection();
+    _txm.begin();
+    try {
+      DeploymentUnitDAO du = conn.getDeploymentUnit("foo1");
+      ProcessConfDAO p = du.getProcess(foobar);
+      assertNotNull(p);
+      assertNotNull(du.getProcesses());
+
+      assertEquals(foobar, p.getPID());
+      assertEquals(foobar, p.getType());
+
+    } finally {
+      _txm.commit();
+      conn.close();
+    }
+
+  }
+
+  public void testProcessProperties() throws Exception{
+    QName foobar = new QName("foo", "bar");
+    ConfStoreDAOConnection conn = _cf.getConnection();
+    _txm.begin();
+    try {
+      DeploymentUnitDAO du = conn.createDeploymentUnit("foo1");
+      ProcessConfDAO p = du.createProcess(foobar, foobar, 1);
+      p.setProperty(foobar, "baz");
+    } finally {
+      _txm.commit();
+      conn.close();
+    }
+
+    conn = _cf.getConnection();
+    _txm.begin();
+    try {
+      DeploymentUnitDAO du = conn.getDeploymentUnit("foo1");
+      ProcessConfDAO p = du.getProcess(foobar);
+      assertNotNull(p.getProperty(foobar));
+      assertEquals("baz", p.getProperty(foobar));
+      assertNotNull(p.getPropertyNames());
+      assertTrue(p.getPropertyNames().contains(foobar));
+    } finally {
+      _txm.commit();
+      conn.close();
+    }
+
+
+  }
+}

Modified: ode/trunk/bpel-store/src/test/java/org/apache/ode/store/ProcessStoreTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-store/src/test/java/org/apache/ode/store/ProcessStoreTest.java?rev=940263&r1=940262&r2=940263&view=diff
==============================================================================
--- ode/trunk/bpel-store/src/test/java/org/apache/ode/store/ProcessStoreTest.java (original)
+++ ode/trunk/bpel-store/src/test/java/org/apache/ode/store/ProcessStoreTest.java Sun May  2 17:02:51 2010
@@ -22,66 +22,82 @@ import java.io.File;
 import java.net.URI;
 import java.util.Collection;
 import java.util.List;
+import java.util.Properties;
+import javax.transaction.TransactionManager;
 
 import javax.xml.namespace.QName;
 
 import junit.framework.TestCase;
 
 import org.apache.ode.bpel.iapi.ProcessConf;
+import org.apache.ode.dao.store.ConfStoreDAOConnectionFactory;
+import org.apache.ode.il.config.OdeConfigProperties;
+import org.apache.ode.il.dbutil.Database;
+import org.apache.ode.il.txutil.TxManager;
 import org.apache.ode.utils.DOMUtils;
 
 public class ProcessStoreTest extends TestCase {
 
-    ProcessStoreImpl _ps;
-    private File _testdd;
-    
-    public void setUp() throws Exception {
-        System.setProperty("openjpa.properties", "/openjpa.xml");
-        _ps = new ProcessStoreImpl();
-        _ps.loadAll();
-        URI tdd= getClass().getResource("/testdd/deploy.xml").toURI();
-        _testdd = new File(tdd.getPath()).getParentFile();
-    } 
-    
-    public void tearDown() throws Exception {
-        _ps.shutdown();
-    }
-     
-    public void testSanity() {
-        assertEquals(0,_ps.getProcesses().size());
-        assertEquals(0,_ps.getPackages().size());
-        assertNull(_ps.listProcesses("foobar"));
-    }
-    
-    public void testDeploy() {
-        Collection<QName> deployed = _ps.deploy(_testdd);
-        assertNotNull(deployed);
-        assertEquals(1,deployed.size());
-    }
-    
-    public void testGetProcess() {
-        Collection<QName> deployed = _ps.deploy(_testdd);
-        QName pname = deployed.iterator().next();
-        assertNotNull(deployed);
-        assertEquals(1,deployed.size());
-        ProcessConf pconf = _ps.getProcessConfiguration(pname);
-        assertNotNull(pconf);
-        assertEquals(_testdd.getName(),pconf.getPackage());
-        assertEquals(pname, pconf.getProcessId());
-        assertEquals(1, pconf.getPropagationRules().size());
-        assertEquals(1, pconf.getContextInterceptors().keySet().size());
-        assertNotNull(pconf.getContextInterceptors().get("org.apache.ode.bpel.context.TestInterceptor"));
-        assertEquals("myparam1", DOMUtils.getElementContent(pconf.getContextInterceptors().get("org.apache.ode.bpel.context.TestInterceptor")).getLocalName());
-    } 
-    
-    public void testGetProcesses() {
-        Collection<QName> deployed = _ps.deploy(_testdd);
-        QName pname = deployed.iterator().next();
-        assertNotNull(deployed);
-        assertEquals(1,deployed.size());
-        List<QName> pconfs = _ps.getProcesses();
-        assertEquals(pname,pconfs.get(0));
-    }
-    
-    
+  ProcessStoreImpl _ps;
+  Database _db;
+  ConfStoreDAOConnectionFactory _cf;
+  private File _testdd;
+
+  public void setUp() throws Exception {
+     Properties props = new Properties();
+     props.setProperty(OdeConfigProperties.PROP_DAOCF_STORE,System.getProperty(OdeConfigProperties.PROP_DAOCF_STORE,OdeConfigProperties.DEFAULT_DAOCF_STORE_CLASS));
+     OdeConfigProperties odeProps = new OdeConfigProperties(props, "");
+     _db = new Database(odeProps);
+     TxManager tx = new TxManager(odeProps);
+     TransactionManager txm = tx.createTransactionManager();
+     _db.setTransactionManager(txm);
+     _db.start();
+     _cf = _db.createDaoStoreCF();
+     _ps = new ProcessStoreImpl(null,txm,  _cf);
+     _ps.loadAll();
+     URI tdd = getClass().getResource("/testdd/deploy.xml").toURI();
+     _testdd = new File(tdd.getPath()).getParentFile();
+  }
+
+  public void tearDown() throws Exception {
+    _ps.shutdown();
+    _cf.shutdown();
+    _db.shutdown();
+  }
+
+  public void testSanity() {
+    assertEquals(0, _ps.getProcesses().size());
+    assertEquals(0, _ps.getPackages().size());
+    assertNull(_ps.listProcesses("foobar"));
+  }
+
+  public void testDeploy() {
+    Collection<QName> deployed = _ps.deploy(_testdd);
+    assertNotNull(deployed);
+    assertEquals(1, deployed.size());
+  }
+
+  public void testGetProcess() {
+    Collection<QName> deployed = _ps.deploy(_testdd);
+    QName pname = deployed.iterator().next();
+    assertNotNull(deployed);
+    assertEquals(1, deployed.size());
+    ProcessConf pconf = _ps.getProcessConfiguration(pname);
+    assertNotNull(pconf);
+    assertEquals(_testdd.getName(), pconf.getPackage());
+    assertEquals(pname, pconf.getProcessId());
+    assertEquals(1, pconf.getPropagationRules().size());
+    assertEquals(1, pconf.getContextInterceptors().keySet().size());
+    assertNotNull(pconf.getContextInterceptors().get("org.apache.ode.bpel.context.TestInterceptor"));
+    assertEquals("myparam1", DOMUtils.getElementContent(pconf.getContextInterceptors().get("org.apache.ode.bpel.context.TestInterceptor")).getLocalName());
+  }
+
+  public void testGetProcesses() {
+    Collection<QName> deployed = _ps.deploy(_testdd);
+    QName pname = deployed.iterator().next();
+    assertNotNull(deployed);
+    assertEquals(1, deployed.size());
+    List<QName> pconfs = _ps.getProcesses();
+    assertEquals(pname, pconfs.get(0));
+  }
 }

Added: ode/trunk/bpel-store/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-store/src/test/resources/log4j.properties?rev=940263&view=auto
==============================================================================
--- ode/trunk/bpel-store/src/test/resources/log4j.properties (added)
+++ ode/trunk/bpel-store/src/test/resources/log4j.properties Sun May  2 17:02:51 2010
@@ -0,0 +1,34 @@
+#
+#    Licensed to the Apache Software Foundation (ASF) under one or more
+#    contributor license agreements.  See the NOTICE file distributed with
+#    this work for additional information regarding copyright ownership.
+#    The ASF licenses this file to You 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.
+#
+
+# Set root logger level to WARN and its only appender to CONSOLE
+log4j.rootLogger=WARN, CONSOLE, FILE
+
+# log4j properties to work with commandline tools.
+log4j.category.org.apache.ode=ERROR
+
+# Console appender
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%p - %C{1}.%M(%L) | %m%n
+
+log4j.appender.FILE=org.apache.log4j.FileAppender
+log4j.appender.FILE.File=target/store-test.log
+log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.FILE.layout.ConversionPattern=%d{MM-dd@HH:mm:ss} %-5p (%13F:%L) %3x - %m%n
+log4j.appender.FILE.append=false
+

Modified: ode/trunk/bpel-test/pom.xml
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/pom.xml?rev=940263&r1=940262&r2=940263&view=diff
==============================================================================
--- ode/trunk/bpel-test/pom.xml (original)
+++ ode/trunk/bpel-test/pom.xml Sun May  2 17:02:51 2010
@@ -19,153 +19,239 @@
   -->
 
 <project>
-    <modelVersion>4.0.0</modelVersion>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.ode</groupId>
+  <artifactId>ode-bpel-test</artifactId>
+  <name>ODE :: BPEL Tests</name>
+  <parent>
     <groupId>org.apache.ode</groupId>
-    <artifactId>ode-bpel-test</artifactId>
-    <name>ODE :: BPEL Tests</name>
-    <parent>
-        <groupId>org.apache.ode</groupId>
-        <artifactId>ode</artifactId>
-        <version>2.0-SNAPSHOT</version>
-    </parent>
+    <artifactId>ode</artifactId>
+    <version>2.0-SNAPSHOT</version>
+  </parent>
 
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.ode</groupId>
-            <artifactId>ode-bpel-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.ode</groupId>
-            <artifactId>ode-bpel-compiler</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.ode</groupId>
-            <artifactId>ode-bpel-dao</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.ode</groupId>
-            <artifactId>ode-engine</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.ode</groupId>
-            <artifactId>ode-bpel-store</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.ode</groupId>
-            <artifactId>ode-utils</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.ode</groupId>
-            <artifactId>ode-il-common</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.ode</groupId>
-            <artifactId>ode-dao-jpa</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.ode</groupId>
-            <artifactId>ode-runtimes</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.ode</groupId>
-            <artifactId>ode-jacob</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.ode</groupId>
-            <artifactId>ode-bpel-schemas</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.ode</groupId>
-            <artifactId>ode-bpel-scripts</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.ode</groupId>
-            <artifactId>ode-scheduler-simple</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-          <groupId>commons-collections</groupId>
-          <artifactId>commons-collections</artifactId>
-        </dependency>
-        <dependency>
-          <groupId>commons-logging</groupId>
-          <artifactId>commons-logging</artifactId>
-        </dependency>
-        <dependency>
-          <groupId>commons-httpclient</groupId>
-          <artifactId>commons-httpclient</artifactId>
-        </dependency>
-        <dependency>
-          <groupId>commons-lang</groupId>
-          <artifactId>commons-lang</artifactId>
-        </dependency>
-        <dependency>
-          <groupId>jaxen</groupId>
-          <artifactId>jaxen</artifactId>
-        </dependency>
-        <dependency>
-          <groupId>org.apache.geronimo.specs</groupId>
-          <artifactId>geronimo-jta_1.1_spec</artifactId>
-        </dependency>
-        <dependency>
-          <groupId>org.apache.geronimo.specs</groupId>
-          <artifactId>geronimo-stax-api_1.0_spec</artifactId>
-        </dependency>
-        <dependency>
-          <groupId>javax.persistence</groupId>
-          <artifactId>persistence-api</artifactId>
-        </dependency>
-        <dependency>
-          <groupId>wsdl4j</groupId>
-          <artifactId>wsdl4j</artifactId>
-        </dependency>
-        <dependency>
-          <groupId>org.apache.xmlbeans</groupId>
-          <artifactId>xmlbeans</artifactId>
-        </dependency>
-        <dependency>
-          <groupId>net.sf.saxon</groupId>
-          <artifactId>saxon</artifactId>
-        </dependency>
-        <dependency>
-          <groupId>net.sf.saxon</groupId>
-          <artifactId>saxon-xpath</artifactId>
-        </dependency>
-        <dependency>
-          <groupId>net.sf.saxon</groupId>
-          <artifactId>saxon-dom</artifactId>
-        </dependency>
-        <dependency>
-          <groupId>net.sf.saxon</groupId>
-          <artifactId>saxon-xqj</artifactId>
-        </dependency>
-        <dependency>
-          <groupId>xerces</groupId>
-          <artifactId>xercesImpl</artifactId>
-        </dependency>
-        <dependency>
-          <groupId>junit</groupId>
-          <artifactId>junit</artifactId>
-        </dependency>
-    </dependencies>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.ode</groupId>
+      <artifactId>ode-bpel-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.ode</groupId>
+      <artifactId>ode-bpel-compiler</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.ode</groupId>
+      <artifactId>ode-bpel-dao</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.ode</groupId>
+      <artifactId>ode-engine</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.ode</groupId>
+      <artifactId>ode-bpel-store</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.ode</groupId>
+      <artifactId>ode-utils</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.ode</groupId>
+      <artifactId>ode-il-common</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.ode</groupId>
+      <artifactId>ode-dao-jpa-ojpa</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.ode</groupId>
+      <artifactId>ode-runtimes</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-collections</groupId>
+      <artifactId>commons-collections</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-httpclient</groupId>
+      <artifactId>commons-httpclient</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>jaxen</groupId>
+      <artifactId>jaxen</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-jta_1.1_spec</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.components</groupId>
+      <artifactId>geronimo-transaction</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-stax-api_1.0_spec</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>javax.persistence</groupId>
+      <artifactId>persistence-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>wsdl4j</groupId>
+      <artifactId>wsdl4j</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.xmlbeans</groupId>
+      <artifactId>xmlbeans</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>net.sf.saxon</groupId>
+      <artifactId>saxon</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>net.sf.saxon</groupId>
+      <artifactId>saxon-xpath</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>net.sf.saxon</groupId>
+      <artifactId>saxon-dom</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>net.sf.saxon</groupId>
+      <artifactId>saxon-xqj</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>xerces</groupId>
+      <artifactId>xercesImpl</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.ode</groupId>
+      <artifactId>ode-jacob</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.ode</groupId>
+      <artifactId>ode-bpel-schemas</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.ode</groupId>
+      <artifactId>ode-bpel-scripts</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.ode</groupId>
+      <artifactId>ode-scheduler-simple</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.h2database</groupId>
+      <artifactId>h2</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <!-- for the integration tests - seems to work with the openjpa enhanced enities -->
+    <dependency>
+      <groupId>org.apache.ode</groupId>
+      <artifactId>ode-dao-jpa-hibernate</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.ode</groupId>
+      <artifactId>ode-dao-hibernate</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
 
-   <build>
-     <plugins>
-       <plugin>
-	<artifactId>maven-surefire-plugin</artifactId>
-	<configuration>
-           <!-- FIXME: temporary skip it, 3 failed test cases (2 in JDK6, 3 in JDK5): testIMA, testRetireOld, testIsolated**-->
-	  <excludes>
-	    <exclude>**/MessageRouting20Test.java</exclude>
-	    <exclude>**/VersionedRedeployTest.java</exclude>
-		<exclude>**/StructuredActivities20Test.java</exclude>
-	  </excludes>
-	</configuration>
-       </plugin>
-     </plugins>
-   </build>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <!-- FIXME: temporary skip it, 3 failed test cases (2 in JDK6, 3 in JDK5): testIMA, testRetireOld, testIsolated**-->
+          <excludes>
+            <exclude>**/MessageRouting20Test.java</exclude>
+            <exclude>**/VersionedRedeployTest.java</exclude>
+            <exclude>**/StructuredActivities20Test.java</exclude>
+          </excludes>
+        </configuration>
+        <executions>
+          <execution>
+            <id>hibernate-jpa</id>
+            <phase>integration-test</phase>
+            <goals>
+              <goal>test</goal>
+            </goals>
+            <configuration>
+              <reportsDirectory>${project.build.directory}/surefire-reports/hibernate-jpa</reportsDirectory>
+              <systemProperties>
+                <property>
+                  <name>dao.factory</name>
+                  <value>org.apache.ode.dao.jpa.hibernate.BpelDAOConnectionFactoryImpl</value>
+                </property>
+                <property>
+                  <name>dao.factory.store</name>
+                  <value>org.apache.ode.dao.jpa.hibernate.ConfStoreDAOConnectionFactoryImpl</value>
+                </property>
+              </systemProperties>
+              <includes>
+                <include>**/dao/bpel/*Test.java</include>
+                <include>**/dao/bpel/*Test.java</include>
+              </includes>
+            </configuration>
+          </execution>
+          <execution>
+            <id>hibernate</id>
+            <phase>integration-test</phase>
+            <goals>
+              <goal>test</goal>
+            </goals>
+            <configuration>
+              <reportsDirectory>${project.build.directory}/surefire-reports/hibernate</reportsDirectory>
+              <systemProperties>
+                <property>
+                  <name>dao.factory</name>
+                  <value>org.apache.ode.dao.hib.bpel.BpelDAOConnectionFactoryImpl</value>
+                </property>
+                <property>
+                  <name>dao.factory.store</name>
+                  <value>org.apache.ode.dao.hib.store.ConfStoreDAOConnectionFactoryImpl</value>
+                </property>
+              </systemProperties>
+              <includes>
+                <include>**/dao/bpel/*Test.java</include>
+                <include>**/dao/bpel/*Test.java</include>
+              </includes>
+            </configuration>
+          </execution>
+        </executions>
+    </plugin>
+    <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <executions>
+            <execution>
+                <phase>package</phase>
+                <goals>
+                    <goal>test-jar</goal>
+                </goals>
+                <configuration>
+                    <testClassesDirectory>src/test/resources/bpel/2.0</testClassesDirectory>
+                </configuration>
+            </execution>
+        </executions>
+    </plugin>
+</plugins>
+  </build>
 
 </project>
+

Modified: ode/trunk/bpel-test/src/main/java/org/apache/ode/test/BPELTestAbstract.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/main/java/org/apache/ode/test/BPELTestAbstract.java?rev=940263&r1=940262&r2=940263&view=diff
==============================================================================
--- ode/trunk/bpel-test/src/main/java/org/apache/ode/test/BPELTestAbstract.java (original)
+++ ode/trunk/bpel-test/src/main/java/org/apache/ode/test/BPELTestAbstract.java Sun May  2 17:02:51 2010
@@ -34,7 +34,6 @@ import javax.persistence.EntityManagerFa
 import javax.xml.namespace.QName;
 
 import org.apache.commons.lang.exception.ExceptionUtils;
-import org.apache.ode.bpel.dao.BpelDAOConnectionFactory;
 import org.apache.ode.bpel.engine.BpelServerImpl;
 import org.apache.ode.bpel.evtproc.DebugBpelEventListener;
 import org.apache.ode.bpel.iapi.*;
@@ -43,9 +42,11 @@ import org.apache.ode.bpel.iapi.MessageE
 import org.apache.ode.bpel.iapi.MyRoleMessageExchange.CorrelationStatus;
 import org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl;
 import org.apache.ode.bpel.rtrep.common.extension.AbstractExtensionBundle;
-import org.apache.ode.dao.jpa.BPELDAOConnectionFactoryImpl;
+import org.apache.ode.dao.bpel.BpelDAOConnectionFactory;
+import org.apache.ode.dao.store.ConfStoreDAOConnectionFactory;
 import org.apache.ode.il.MockScheduler;
 import org.apache.ode.il.config.OdeConfigProperties;
+import org.apache.ode.il.dbutil.Database;
 import org.apache.ode.store.ProcessConfImpl;
 import org.apache.ode.store.ProcessStoreImpl;
 import org.apache.ode.utils.DOMUtils;
@@ -70,7 +71,9 @@ public abstract class BPELTestAbstract {
 
     protected MockScheduler scheduler;
 
-    protected BpelDAOConnectionFactory _cf;
+    protected BpelDAOConnectionFactory _bcf;
+
+    protected ConfStoreDAOConnectionFactory _scf;
 
     /** Failures that have been detected. */
     protected List<Failure> _failures;
@@ -86,6 +89,8 @@ public abstract class BPELTestAbstract {
 
     private MockTransactionManager _txm;
 
+    private Database _db;
+
     @Before
     public void setUp() throws Exception {
         _failures = new CopyOnWriteArrayList<Failure>();
@@ -94,21 +99,22 @@ public abstract class BPELTestAbstract {
         _deployments = new ArrayList<Deployment>();
         _invocations = new ArrayList<Invocation>();
         _deployed = new ArrayList<Deployment>();
+        _txm = new MockTransactionManager();
+        Properties props = new Properties();
+        props.setProperty(OdeConfigProperties.PROP_DAOCF_STORE, System.getProperty(OdeConfigProperties.PROP_DAOCF_STORE,OdeConfigProperties.DEFAULT_DAOCF_STORE_CLASS));
+         OdeConfigProperties odeProps = new OdeConfigProperties(props,"");
+		_db = new Database(odeProps);
+                _db.setTransactionManager(_txm);
+        _db.start();
 
         if (Boolean.getBoolean("org.apache.ode.test.persistent")) {
-
-            _server.setDaoConnectionFactory(_cf);
-            _txm = new MockTransactionManager();
-
-            BPELDAOConnectionFactoryImpl cf = new BPELDAOConnectionFactoryImpl();
-            cf.setTransactionManager(_txm);
-            // cf.setDataSource(datasource);
+            _server.setDaoConnectionFactory(_bcf);
             scheduler = new MockScheduler(_txm);
         } else {
-            _txm = new MockTransactionManager();
             scheduler = new MockScheduler(_txm);
-            _cf = new BpelDAOConnectionFactoryImpl(_txm);
-            _server.setDaoConnectionFactory(_cf);
+            _bcf = new BpelDAOConnectionFactoryImpl();
+            _bcf.init(null,_txm, _txm);
+            _server.setDaoConnectionFactory(_bcf);
         }
         _server.setScheduler(scheduler);
         _server.setBindingContext(new BindingContextImpl());
@@ -128,7 +134,8 @@ public abstract class BPELTestAbstract {
                 return Collections.EMPTY_MAP;
             }
         };
-        store = new ProcessStoreImpl(eprContext, null, "jpa", new OdeConfigProperties(new Properties(), ""), true);
+        _scf = _db.createDaoStoreCF();
+        store = new ProcessStoreImpl(eprContext, _txm, _scf);
         // not needed: we do eclipcitly in doDeployment
 //        store.registerListener(new ProcessStoreListener() {
 //            public void onProcessStoreEvent(ProcessStoreEvent event) {
@@ -167,6 +174,9 @@ public abstract class BPELTestAbstract {
         _deployed = null;
         _deployments = null;
         _invocations = null;
+        _bcf.shutdown();
+        _scf.shutdown();
+        _db.shutdown();
     }
 
     public void registerExtensionBundle(AbstractExtensionBundle bundle) {

Modified: ode/trunk/bpel-test/src/test/java/org/apache/ode/test/ExternalVariableTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/ExternalVariableTest.java?rev=940263&r1=940262&r2=940263&view=diff
==============================================================================
--- ode/trunk/bpel-test/src/test/java/org/apache/ode/test/ExternalVariableTest.java (original)
+++ ode/trunk/bpel-test/src/test/java/org/apache/ode/test/ExternalVariableTest.java Sun May  2 17:02:51 2010
@@ -3,12 +3,14 @@ package org.apache.ode.test;
 import java.sql.Connection;
 import java.sql.SQLException;
 import java.sql.Statement;
+import java.util.Properties;
 
 import javax.sql.DataSource;
 import javax.xml.namespace.QName;
 
-import org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource;
 import org.apache.ode.bpel.extvar.jdbc.JdbcExternalVariableModule;
+import org.apache.ode.il.config.OdeConfigProperties;
+import org.apache.ode.il.dbutil.Database;
 import org.junit.Test;
 
 /**
@@ -17,21 +19,21 @@ import org.junit.Test;
 public class ExternalVariableTest extends BPELTestAbstract {
 
     private JdbcExternalVariableModule _jdbcext;
-    private DataSource _ds;
+    private Database _db;
 
+    @Override
     public void setUp() throws Exception {
         super.setUp();
-        
-        EmbeddedConnectionPoolDataSource ds = new EmbeddedConnectionPoolDataSource();
-        ds.setCreateDatabase("create");
-        ds.setDatabaseName("target/ExternalVariableTest");
-        _ds = ds;
+
+        OdeConfigProperties props = new OdeConfigProperties(new Properties(),"");
+		_db = new Database(props);
+        _db.start();
 
         _jdbcext = new JdbcExternalVariableModule();
-        _jdbcext.registerDataSource("testds", _ds);
+        _jdbcext.registerDataSource("testds", _db.getDataSource());
         _server.registerExternalVariableEngine(_jdbcext);
 
-        Connection conn = _ds.getConnection();
+        Connection conn = _db.getDataSource().getConnection();
         Statement s = conn.createStatement();
         
         dropTable(s, "extvartable1");
@@ -54,6 +56,14 @@ public class ExternalVariableTest extend
 
         conn.close();
     }
+
+  @Override
+  public void tearDown() throws Exception {
+    super.tearDown();
+    _db.shutdown();
+  }
+
+
     
     private static void dropTable(Statement s, String name) {
         try {

Modified: ode/trunk/bpel-test/src/test/java/org/apache/ode/test/VersionedRedeployTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/VersionedRedeployTest.java?rev=940263&r1=940262&r2=940263&view=diff
==============================================================================
--- ode/trunk/bpel-test/src/test/java/org/apache/ode/test/VersionedRedeployTest.java (original)
+++ ode/trunk/bpel-test/src/test/java/org/apache/ode/test/VersionedRedeployTest.java Sun May  2 17:02:51 2010
@@ -63,24 +63,24 @@ public class VersionedRedeployTest exten
         // Checking for each step that all instances still exist and that each process got one execution
         // so no instance has been created after a process has been retired.
         go("/bpel/2.0/TestVersionedRedeploy/HelloWorld-1");
-        Assert.assertEquals(1, _cf.getConnection().getProcess(qName1).getNumInstances());
+        Assert.assertEquals(1, _bcf.getConnection().getProcess(qName1).getNumInstances());
 
         // clean up deployment and invocations
         _deployments.clear();
         _invocations.clear();
         
         go("/bpel/2.0/TestVersionedRedeploy/HelloWorld-2");
-        Assert.assertEquals(1, _cf.getConnection().getProcess(qName1).getNumInstances());
-        Assert.assertEquals(1, _cf.getConnection().getProcess(qName2).getNumInstances());
+        Assert.assertEquals(1, _bcf.getConnection().getProcess(qName1).getNumInstances());
+        Assert.assertEquals(1, _bcf.getConnection().getProcess(qName2).getNumInstances());
         
         // clean up deployment and invocations
         _deployments.clear();
         _invocations.clear();
         
         go("/bpel/2.0/TestVersionedRedeploy/HelloWorld-3");
-        Assert.assertEquals(1, _cf.getConnection().getProcess(qName1).getNumInstances());
-        Assert.assertEquals(1, _cf.getConnection().getProcess(qName2).getNumInstances());
-        Assert.assertEquals(1, _cf.getConnection().getProcess(qName3).getNumInstances());
+        Assert.assertEquals(1, _bcf.getConnection().getProcess(qName1).getNumInstances());
+        Assert.assertEquals(1, _bcf.getConnection().getProcess(qName2).getNumInstances());
+        Assert.assertEquals(1, _bcf.getConnection().getProcess(qName3).getNumInstances());
     }
 
     @Test public void testVersionedUndeployDeploy() throws Throwable {
@@ -95,7 +95,7 @@ public class VersionedRedeployTest exten
         Assert.assertNull(store.getProcessConfiguration(qName1));
         Assert.assertNull(store.getProcessConfiguration(qName3));
         
-        Assert.assertEquals(1, _cf.getConnection().getProcess(qName2).getNumInstances());
+        Assert.assertEquals(1, _bcf.getConnection().getProcess(qName2).getNumInstances());
     }
 
 }

Added: ode/trunk/bpel-test/src/test/java/org/apache/ode/test/dao/bpel/BaseTestDAO.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/dao/bpel/BaseTestDAO.java?rev=940263&view=auto
==============================================================================
--- ode/trunk/bpel-test/src/test/java/org/apache/ode/test/dao/bpel/BaseTestDAO.java (added)
+++ ode/trunk/bpel-test/src/test/java/org/apache/ode/test/dao/bpel/BaseTestDAO.java Sun May  2 17:02:51 2010
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.ode.test.dao.bpel;
+
+import java.util.Properties;
+import javax.transaction.TransactionManager;
+
+import junit.framework.TestCase;
+import org.apache.ode.dao.bpel.BpelDAOConnection;
+import org.apache.ode.dao.bpel.BpelDAOConnectionFactory;
+import org.apache.ode.dao.jpa.openjpa.BpelDAOConnectionFactoryImpl;
+
+import org.apache.ode.il.EmbeddedGeronimoFactory;
+//import org.hsqldb.jdbc.jdbcDataSource;
+
+import org.apache.ode.il.config.OdeConfigProperties;
+import org.apache.ode.il.dbutil.Database;
+
+
+/**
+ * Testing BpelDAOConnectionImpl.listInstance. We're just producing a lot
+ * of different filter combinations and test if they execute ok. To really
+ * test that the result is the one expected would take a huge test database
+ * (with at least a process and an instance for every possible combination).
+ */
+public class BaseTestDAO extends TestCase {
+
+    protected BpelDAOConnection daoConn;
+    protected TransactionManager _txm;
+    private Database _db;
+    protected BpelDAOConnectionFactory _factoryImpl;
+
+    protected void initTM() throws Exception {
+        _txm = new EmbeddedGeronimoFactory().getTransactionManager();
+        Properties props = new Properties();
+        props.setProperty(OdeConfigProperties.PROP_DAOCF, System.getProperty(OdeConfigProperties.PROP_DAOCF,OdeConfigProperties.DEFAULT_DAOCF_CLASS));
+        OdeConfigProperties odeProps = new OdeConfigProperties(props,"");
+		_db = new Database(odeProps);
+        _db.setTransactionManager(_txm);
+        _db.start();
+        //txm.begin();
+        
+        _factoryImpl = _db.createDaoCF();
+        
+        _txm.begin();
+        daoConn = _factoryImpl.getConnection();
+        
+    }
+
+    protected void stopTM() throws Exception {
+     _txm.commit();
+     daoConn.close();
+      //txm.commit();
+     _factoryImpl.shutdown();
+     _db.shutdown();
+      
+
+    }
+
+    protected TransactionManager getTransactionManager() {
+        return _txm;
+    }
+
+}
\ No newline at end of file

Added: ode/trunk/bpel-test/src/test/java/org/apache/ode/test/dao/bpel/InsertObjectTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/dao/bpel/InsertObjectTest.java?rev=940263&view=auto
==============================================================================
--- ode/trunk/bpel-test/src/test/java/org/apache/ode/test/dao/bpel/InsertObjectTest.java (added)
+++ ode/trunk/bpel-test/src/test/java/org/apache/ode/test/dao/bpel/InsertObjectTest.java Sun May  2 17:02:51 2010
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.ode.test.dao.bpel;
+
+import org.apache.ode.bpel.common.CorrelationKey;
+import org.apache.ode.bpel.iapi.MessageExchange.MessageExchangePattern;
+import org.apache.ode.bpel.iapi.MessageExchange.Status;
+import org.apache.ode.utils.DOMUtils;
+import org.xml.sax.SAXException;
+
+import javax.xml.namespace.QName;
+import java.io.IOException;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import org.apache.ode.dao.bpel.BpelDAOConnection;
+import org.apache.ode.dao.bpel.CorrelationSetDAO;
+import org.apache.ode.dao.bpel.CorrelatorDAO;
+import org.apache.ode.dao.bpel.MessageDAO;
+import org.apache.ode.dao.bpel.MessageExchangeDAO;
+import org.apache.ode.dao.bpel.PartnerLinkDAO;
+import org.apache.ode.dao.bpel.ProcessDAO;
+import org.apache.ode.dao.bpel.ProcessInstanceDAO;
+import org.apache.ode.dao.bpel.ScopeDAO;
+import org.apache.ode.dao.bpel.ScopeStateEnum;
+import org.apache.ode.dao.bpel.XmlDataDAO;
+
+public class InsertObjectTest extends BaseTestDAO {
+	
+	private static final String TEST_NS = "http://org.apache.ode.jpa.test";
+	private static final String CORRELATOR_ID1 = "testCorrelator1";
+	private static final String CORRELATOR_ID2 = "testCorrelator2";
+	private static final Calendar cal = new GregorianCalendar();
+
+    ProcessDAO _process;
+
+    @Override
+	protected void setUp() throws Exception {
+       initTM();
+    }
+	
+	public void testStart() throws Exception {
+        createStuff(daoConn);
+    }
+
+    void createStuff(BpelDAOConnection conn) throws Exception {
+
+        CorrelatorDAO corr = createProcess(conn,"testPID1","testType");
+		ProcessInstanceDAO pi1 = createProcessInstance(_process, corr);
+    }
+
+    @Override
+	protected void tearDown() throws Exception {
+       stopTM();
+    }
+	
+	private MessageExchangeDAO createMessageExchange(ProcessDAO p, ProcessInstanceDAO pi, PartnerLinkDAO pl ) throws SAXException, IOException {
+		MessageExchangeDAO me = pi.getConnection().createMessageExchange("testId", MessageExchangeDAO.DIR_BPEL_INVOKES_PARTNERROLE);
+
+		me.setCallee(new QName(TEST_NS,"testCallee"));
+		me.setChannel("testChannel");
+		//me.setCorrelationId("testCorrelationId");
+		me.setCorrelationStatus("testCorrelationStatus");
+		me.setEPR(DOMUtils.stringToDOM("<testEPR>EPR</testEPR>"));
+		me.setFault(new QName("testFault"));
+		me.setFaultExplanation("testFaultExplanation");
+		me.setInstance(pi);
+		me.setOperation("testOperation");
+		me.setPartnerLink(pl);
+		me.setPartnerLinkModelId(1);
+		me.setPattern(MessageExchangePattern.UNKNOWN);
+		me.setPortType(new QName(TEST_NS,"testPortType"));
+		me.setProcess(p);
+		me.setProperty("testProp1Key", "testProp1");
+		me.setProperty("testProp2Key", "testProp2");
+		me.setRequest(createMessage(me,"testRequest"));
+		me.setResponse(createMessage(me,"testResponse"));
+		me.setStatus(Status.NEW);
+
+		return me;
+	}
+
+	private MessageDAO createMessage(MessageExchangeDAO me, String name) throws SAXException, IOException {
+		MessageDAO m = me.createMessage(new QName(TEST_NS,name));
+
+		m.setType(new QName(TEST_NS,name));
+		m.setData(DOMUtils.stringToDOM("<testData>some test data</testData>"));
+
+		return m;
+	}
+
+	private CorrelatorDAO createProcess(BpelDAOConnection conn, String pid, String type) {
+		_process = conn.createProcess(new QName(TEST_NS,pid), new QName(TEST_NS,type),"GUID1",1);
+		CorrelatorDAO corr = _process.addCorrelator(CORRELATOR_ID1);
+		_process.addCorrelator(CORRELATOR_ID2);
+		return corr;
+	}
+
+	private ProcessInstanceDAO createProcessInstance(ProcessDAO process, CorrelatorDAO corr) throws SAXException, IOException {
+		ProcessInstanceDAO pi = null;
+		String[] actions = { "action1","action2" };
+		String[] correlationKeys = { "key1", "key2" };
+		CorrelationKey key1 = new CorrelationKey(1,correlationKeys);
+		CorrelationKey key2 = new CorrelationKey(2,correlationKeys);
+		CorrelationKey[] corrkeys = {key1,key2};
+		QName[] names = { new QName(TEST_NS,"name1"), new QName(TEST_NS,"name2") };
+
+        pi = process.createInstance(corr);
+
+		pi.setExecutionState(new String("test execution state").getBytes());
+		pi.setFault(new QName(TEST_NS,"testFault"), "testExplanation", 1, 1, DOMUtils.stringToDOM("<testFaultMessage>testMessage</testFaultMessage>"));
+		pi.setLastActiveTime(cal.getTime());
+		pi.setState((short) 1);
+
+		pi.createActivityRecovery("testChannel1", 3, "testReason1", cal.getTime(), DOMUtils.stringToDOM("<testData>testData1</testData>"), actions, 2);
+		pi.createActivityRecovery("testChannel2", 4, "testReason2", cal.getTime(), DOMUtils.stringToDOM("<testData>testData2</testData>"), actions, 2);
+
+		ScopeDAO root = pi.createScope(null, "Root", 1);
+		root.setState(ScopeStateEnum.ACTIVE);
+		ScopeDAO child1 = pi.createScope(root, "Child1", 2);
+		child1.setState(ScopeStateEnum.ACTIVE);
+		XmlDataDAO var1 = child1.getVariable("var1");
+		var1.set(DOMUtils.stringToDOM("<testData>testData</testData>"));
+		var1.setProperty("key1", "prop1");
+		var1.setProperty("key2", "prop2");
+		XmlDataDAO var2 = child1.getVariable("var2");
+		var2.set(DOMUtils.stringToDOM("<testData>testData</testData>"));
+		var2.setProperty("key1", "prop1");
+		var2.setProperty("key2", "prop2");
+
+		CorrelationSetDAO cs1 = child1.getCorrelationSet("TestCorrelationSet1");
+		cs1.setValue(names,key1);
+
+		PartnerLinkDAO pl1 = child1.createPartnerLink(1, "Test PartnerLink1", "MyRole1", "PartnerRole1");
+		pl1.setMyEPR(DOMUtils.stringToDOM("<testEPR>testMyEPR</testEPR>"));
+		pl1.setMyRoleServiceName(new QName(TEST_NS,"testRoleService"));
+		pl1.setMySessionId("TestMySessionID");
+		pl1.setPartnerEPR(DOMUtils.stringToDOM("<testEPR>testPartnerEPR</testEPR>"));
+		pl1.setPartnerSessionId("TestPartnerSessionID");
+
+		MessageExchangeDAO mex = createMessageExchange(process,pi,pl1);
+
+		corr.addRoute("testRoute", pi, 1, key1);
+		corr.enqueueMessage(mex, corrkeys);
+
+		return pi;
+	}
+
+}

Added: ode/trunk/bpel-test/src/test/java/org/apache/ode/test/dao/bpel/ListInstanceTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/dao/bpel/ListInstanceTest.java?rev=940263&view=auto
==============================================================================
--- ode/trunk/bpel-test/src/test/java/org/apache/ode/test/dao/bpel/ListInstanceTest.java (added)
+++ ode/trunk/bpel-test/src/test/java/org/apache/ode/test/dao/bpel/ListInstanceTest.java Sun May  2 17:02:51 2010
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.ode.test.dao.bpel;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ode.bpel.common.InstanceFilter;
+
+/**
+ * Testing BpelDAOConnectionImpl.listInstance. We're just producing a lot
+ * of different filter combinations and test if they execute ok. To really
+ * test that the result is the one expected would take a huge test database
+ * (with at least a process and an instance for every possible combination).
+ */
+public class ListInstanceTest extends BaseTestDAO {
+
+  private Map<String, List> filterElmts;
+  private ArrayList<String> order;
+
+  protected void setUp() throws Exception {
+    initTM();
+    buildFilterElements();
+  }
+
+  protected void tearDown() throws Exception {
+    stopTM();
+  }
+
+  public void testListInstance() throws Exception {
+    for (int index = 0; index < 7; index++) {
+      StringBuffer filter = new StringBuffer();
+      for (Map.Entry<String, List> entry : filterElmts.entrySet()) {
+        filter.append(entry.getKey());
+        filter.append(entry.getValue().get((index < entry.getValue().size()) ? index : index % entry.getValue().size()));
+        InstanceFilter ifilter = new InstanceFilter(filter.toString(),
+                order.get((index < order.size()) ? index : index % order.size()), 0);
+        daoConn.instanceQuery(ifilter);
+      }
+    }
+  }
+
+  private void buildFilterElements() {
+    filterElmts = new HashMap<String, List>();
+    ArrayList<String> nameList = new ArrayList<String>();
+    nameList.add("=Hello* ");
+    nameList.add("=HelloWorld ");
+    filterElmts.put("name", nameList);
+
+    ArrayList<String> namespaceList = new ArrayList<String>();
+    namespaceList.add("=http://ode* ");
+    namespaceList.add("=http://ode ");
+    filterElmts.put("namespace", namespaceList);
+
+    ArrayList<String> statusList = new ArrayList<String>();
+    statusList.add("=active ");
+    statusList.add("=suspended ");
+    statusList.add("=error ");
+    statusList.add("=completed|terminated ");
+    statusList.add("=faulted|terminated ");
+    statusList.add("=error|active ");
+    filterElmts.put("status", statusList);
+
+    ArrayList<String> startedList = new ArrayList<String>();
+    startedList.add(">=2005-11-29T15:11 ");
+    startedList.add("<=2005-11-29T15:11 ");
+    startedList.add("<2005-11-29T15:11 started>=2005-11-29T15:11 ");
+    startedList.add(">2005-11-29T15:11 started<=2005-11-29T15:11 ");
+    startedList.add("=2005-11-29T15:11 ");
+    filterElmts.put("started", startedList);
+
+    ArrayList<String> lastActiveList = new ArrayList<String>();
+    lastActiveList.add(">=2005-11-29T15:11 ");
+    lastActiveList.add("<=2005-11-29T15:11 ");
+    lastActiveList.add("<2005-11-29T15:11 last-active>=2005-11-29T15:11 ");
+    lastActiveList.add(">2005-11-29T15:11 last-active<=2005-11-29T15:11 ");
+    lastActiveList.add("=2005-11-29T15:11 ");
+    filterElmts.put("last-active", lastActiveList);
+
+    order = new ArrayList<String>();
+    order.add("pid");
+    order.add("name pid");
+    order.add("namespace -name");
+    order.add("version -pid +name");
+    order.add("status namespace");
+    order.add("-started -version status");
+    order.add("+last-active name -pid +version -status namespace");
+  }
+
+}

Added: ode/trunk/bpel-test/src/test/java/org/apache/ode/test/dao/bpel/SelectObjectTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/dao/bpel/SelectObjectTest.java?rev=940263&view=auto
==============================================================================
--- ode/trunk/bpel-test/src/test/java/org/apache/ode/test/dao/bpel/SelectObjectTest.java (added)
+++ ode/trunk/bpel-test/src/test/java/org/apache/ode/test/dao/bpel/SelectObjectTest.java Sun May  2 17:02:51 2010
@@ -0,0 +1,267 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.ode.test.dao.bpel;
+
+import org.apache.ode.bpel.common.CorrelationKey;
+import org.apache.ode.bpel.iapi.MessageExchange.MessageExchangePattern;
+import org.apache.ode.bpel.iapi.MessageExchange.Status;
+
+import javax.persistence.EntityManager;
+import javax.xml.namespace.QName;
+import java.util.Collection;
+import org.apache.ode.dao.bpel.ActivityRecoveryDAO;
+import org.apache.ode.dao.bpel.CorrelationSetDAO;
+import org.apache.ode.dao.bpel.CorrelatorDAO;
+import org.apache.ode.dao.bpel.FaultDAO;
+import org.apache.ode.dao.bpel.MessageDAO;
+import org.apache.ode.dao.bpel.MessageExchangeDAO;
+import org.apache.ode.dao.bpel.MessageRouteDAO;
+import org.apache.ode.dao.bpel.PartnerLinkDAO;
+import org.apache.ode.dao.bpel.ProcessDAO;
+import org.apache.ode.dao.bpel.ProcessInstanceDAO;
+import org.apache.ode.dao.bpel.ScopeDAO;
+import org.apache.ode.dao.bpel.ScopeStateEnum;
+import org.apache.ode.dao.bpel.XmlDataDAO;
+
+public class SelectObjectTest extends BaseTestDAO {
+	
+	private static final String TEST_NS = "http://org.apache.ode.jpa.test";
+	private String[] correlationKeys = { "key1", "key2" };
+	private String[] actions = { "action1","action2" };
+	private CorrelationKey key1 = new CorrelationKey(1,correlationKeys);
+	private static final String CORRELATOR_ID1 = "testCorrelator1";
+	private static final String CORRELATOR_ID2 = "testCorrelator2";
+
+    @Override
+	protected void setUp() throws Exception {
+      initTM();
+	}
+
+	public void testGetObject() throws Exception {
+        new InsertObjectTest().createStuff(daoConn);
+
+        _txm.commit();
+        _txm.begin();
+        daoConn = _factoryImpl.getConnection();
+
+		// Assert the ProcessDAO
+		ProcessDAO p = daoConn.getProcess(new QName(TEST_NS,"testPID1"));
+		assertNotNull( p );
+		Collection<ProcessInstanceDAO> insts = p.findInstance(key1);
+		assertNotNull( insts );
+		assertTrue( insts.size() > 0 );
+		assertNotNull(p.getType());
+		assertNotNull(p.getProcessId());
+		assertEquals( p.getVersion() , 1 );
+
+		// Assert the CorrelatorDAO
+		CorrelatorDAO corr = p.getCorrelator(CORRELATOR_ID1);
+		assertNotNull( corr );
+		assertEquals(corr.getCorrelatorId(),CORRELATOR_ID1);
+
+		// Assert the MessageRouteDAO
+		MessageRouteDAO route = corr.findRoute(key1);
+		assertNotNull( route );
+		assertEquals(route.getGroupId(),"testRoute" );
+		assertEquals(route.getIndex() , 1 );
+		assertNotNull(route.getTargetInstance() );
+
+		// Assert the ProcessInstanceDAO
+		for ( ProcessInstanceDAO inst : insts ) {
+			Long id = inst.getInstanceId();
+			assertNotNull( id );
+
+			ProcessInstanceDAO inst2 = daoConn.getInstance(id);
+			assertEquals(inst2,inst);
+
+			ProcessInstanceDAO inst3 = p.getInstance(id);
+			assertEquals( inst3 , inst );
+
+			Long mon = inst.genMonotonic();
+			assertEquals(inst.getActivityFailureCount() , 2);
+			assertNotNull(inst.getActivityFailureDateTime() );
+			assertNotNull(inst.getCreateTime() );
+			assertTrue(inst.getExecutionState().length > 0 );
+			assertNotNull(inst.getLastActiveTime() );
+			assertEquals(inst.getProcess() , p );
+			assertEquals(inst.getPreviousState() , 0);
+			assertEquals(inst.getState() , 1);
+
+			// Assert the Root ScopeDAO
+			ScopeDAO rs = inst.getRootScope();
+			assertNotNull( rs );
+			assertNotNull(rs.getChildScopes());
+			ScopeDAO child1 = null;
+			for ( ScopeDAO childItr : rs.getChildScopes()){
+				child1 = childItr;
+				break;
+			}
+			assertNotNull(child1);
+			assertNotNull(rs.getCorrelationSets());
+			assertEquals(rs.getCorrelationSets().size() , 0 );
+			assertEquals(rs.getModelId(),1);
+			assertEquals(rs.getName(),"Root");
+			assertTrue(rs.getParentScope() == null);
+			assertNotNull(rs.getPartnerLinks());
+			assertEquals(rs.getPartnerLinks().size() ,0);
+			assertEquals(rs.getProcessInstance(),inst);
+			assertNotNull(rs.getScopeInstanceId());
+			assertEquals(rs.getState(),ScopeStateEnum.ACTIVE);
+			assertNotNull(rs.getVariables());
+			assertEquals(rs.getVariables().size(),0);
+
+
+			// Assert the ActivityRecoveryDAO
+			assertNotNull(inst.getActivityRecoveries());
+			ActivityRecoveryDAO rec1 = null;
+      for (ActivityRecoveryDAO recItr : inst.getActivityRecoveries()) {
+        if(recItr.getActivityId()==3){
+          rec1 = recItr;
+          break;
+        }
+      }
+
+      assertNotNull(rec1);
+			String tmpAct = rec1.getActions();
+//			assertEquals(rec1.getActionsList(),actions);
+			assertEquals(rec1.getActivityId(),3);
+			assertEquals(rec1.getChannel(),"testChannel1");
+			assertNotNull(rec1.getDateTime());
+//			assertNotNull(rec1.getDetails());
+			assertEquals(rec1.getReason(),"testReason1");
+			assertEquals(rec1.getRetries(),2);
+
+			// Assert the CorrelationSetDAO
+			//assertNotNull(inst.getCorrelationSets());
+			//CorrelationSetDAO cs1 = null;
+			//for ( CorrelationSetDAO csItr : inst.getCorrelationSets() ) {
+			//	cs1 = csItr;
+			//	break;
+			//}
+			//assertNotNull(cs1);
+
+			// Assert the FaultDAO
+			FaultDAO fault = inst.getFault();
+			assertNotNull(fault);
+			assertEquals(fault.getActivityId(),1);
+			assertNotNull(fault.getData());
+			assertEquals(fault.getExplanation(),"testExplanation");
+			assertEquals(fault.getLineNo(),1);
+			assertEquals(fault.getName(),new QName(TEST_NS,"testFault"));
+
+			// Assert MessageExchangeDAO
+			CorrelatorDAO ic = inst.getInstantiatingCorrelator();
+			assertNotNull(ic);
+			assertEquals(ic.getCorrelatorId(),CORRELATOR_ID1);
+			// The message is dequeued but not persisted
+			MessageExchangeDAO me = ic.dequeueMessage(key1);
+			assertNotNull(me);
+			assertEquals(me.getCallee(),new QName(TEST_NS,"testCallee"));
+			//XXX assertEquals(me.getPropagateTransactionFlag(),false);
+			assertEquals(me.getChannel(),"testChannel");
+			//XXX assertEquals(me.getCorrelationId(),"testCorrelationId");
+			//assertNotNull(me.getCreateTime());
+			assertEquals(me.getDirection(), MessageExchangeDAO.DIR_BPEL_INVOKES_PARTNERROLE);
+			assertEquals(me.getMessageExchangeId(), "testId");
+			assertNotNull(me.getEPR());
+			assertEquals(me.getFault().toString(),"testFault");
+			assertEquals(me.getFaultExplanation(),"testFaultExplanation");
+			assertEquals(me.getInstance(),inst);
+			assertEquals(me.getOperation(),"testOperation");
+			assertNotNull(me.getPartnerLink());
+			assertEquals(me.getPartnerLinkModelId(),1);
+			assertEquals(me.getPattern(), MessageExchangePattern.UNKNOWN);
+			assertEquals(me.getPortType(),new QName(TEST_NS,"testPortType"));
+			assertEquals(me.getProcess(),p);
+			assertEquals(me.getProperty("testProp1Key"),"testProp1");
+			assertNotNull(me.getRequest());
+			assertNotNull(me.getResponse());
+			assertEquals(me.getStatus(), Status.NEW);
+
+			// Assert MessageDAO
+			MessageDAO m = me.getRequest();
+			assertNotNull(m.getData());
+			//XXX assertEquals(m.getMessageExchange(),me);
+			assertEquals(m.getType(),new QName(TEST_NS,"testRequest"));
+
+
+			//Assert Child ScopeDAO
+			assertNotNull(inst.getScopes());
+			assertTrue(inst.getScopes().size() > 0);
+			assertNotNull(inst.getScopes("Child1"));
+			assertTrue(inst.getScopes("Child1").size() == 1);
+			ScopeDAO childS = inst.getScopes("Child1").iterator().next();
+			assertEquals(childS,child1);
+			assertEquals(childS.getParentScope(),rs);
+			assertNotNull(childS.getChildScopes());
+			assertEquals(childS.getChildScopes().size(), 0);
+			assertNotNull(childS.getVariables());
+			assertTrue(childS.getVariables().size() > 0);
+			assertNotNull(childS.getVariable("var1"));
+			XmlDataDAO chsVar = childS.getVariable("var1");
+			assertNotNull(childS.getPartnerLinks());
+			assertTrue(childS.getPartnerLinks().size() > 0);
+			PartnerLinkDAO spl = childS.getPartnerLinks().iterator().next();
+			assertEquals(spl,me.getPartnerLink());
+			assertEquals(spl,childS.getPartnerLink(spl.getPartnerLinkModelId()));
+			assertNotNull(childS.getCorrelationSets());
+			assertTrue(childS.getCorrelationSets().size() > 0);
+			assertNotNull(childS.getCorrelationSet("TestCorrelationSet1"));
+
+			// Assert CorrelationSetDAO
+			CorrelationSetDAO cs = childS.getCorrelationSet("TestCorrelationSet1");
+			assertEquals(cs.getName(),"TestCorrelationSet1");
+			assertNotNull(cs.getProperties());
+			assertTrue(cs.getProperties().size() > 0);
+			assertEquals(cs.getScope(),childS);
+			assertNotNull(cs.getValue());
+			assertEquals(cs.getProperties().get(new QName(TEST_NS,"name1")),"key1");
+
+
+			// Assert PartnerLinkDAO
+			assertNotNull(spl.getMyEPR());
+			assertEquals(spl.getMyRoleName(),"MyRole1");
+			assertEquals(spl.getMyRoleServiceName(),new QName(TEST_NS,"testRoleService"));
+			assertEquals(spl.getMySessionId(),"TestMySessionID");
+			assertNotNull(spl.getPartnerEPR());
+			assertEquals(spl.getPartnerLinkModelId(),1);
+			assertEquals(spl.getPartnerLinkName(),"Test PartnerLink1");
+			assertEquals(spl.getPartnerRoleName(),"PartnerRole1");
+			assertEquals(spl.getPartnerSessionId(),"TestPartnerSessionID");
+
+			// Assert Variables
+			assertNotNull(inst.getVariables("var1", 2));
+			assertEquals(inst.getVariables("var1", 2).length,1);
+			XmlDataDAO[] vars = inst.getVariables("var1", 2);
+			assertEquals(chsVar,vars[0]);
+			assertNotNull(vars[0].get());
+			assertEquals(vars[0].getName(),"var1");
+			assertEquals(vars[0].getProperty("key1"),"prop1");
+			assertEquals(vars[0].getScopeDAO(),childS);
+
+		}
+	}
+
+	@Override
+	protected void tearDown() throws Exception {
+        stopTM();
+    }
+	
+}

Added: ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestDAODeploymentDescriptor/HelloWorld2.bpel
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestDAODeploymentDescriptor/HelloWorld2.bpel?rev=940263&view=auto
==============================================================================
--- ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestDAODeploymentDescriptor/HelloWorld2.bpel (added)
+++ ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestDAODeploymentDescriptor/HelloWorld2.bpel Sun May  2 17:02:51 2010
@@ -0,0 +1,67 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you 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.
+  -->
+<process name="HelloWorld2"
+    targetNamespace="http://ode/bpel/unit-test" 
+    xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+    xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+    xmlns:tns="http://ode/bpel/unit-test"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:test="http://ode/bpel/unit-test.wsdl">
+
+  <import location="HelloWorld2.wsdl"
+     namespace="http://ode/bpel/unit-test.wsdl"
+     importType="http://schemas.xmlsoap.org/wsdl/" />
+
+   <partnerLinks>
+      <partnerLink name="helloPartnerLink" 
+         partnerLinkType="test:HelloPartnerLinkType" 
+         myRole="me" />
+   </partnerLinks>
+    
+   <variables>
+     <variable name="myVar" messageType="test:HelloMessage"/>
+     <variable name="tmpVar" type="xsd:string"/>
+   </variables>
+        
+   <sequence>   
+       <receive 
+          name="start"
+          partnerLink="helloPartnerLink"
+          portType="test:HelloPortType"
+          operation="hello"
+          variable="myVar"
+          createInstance="yes"/>
+
+      <assign name="assign1">
+         <copy>
+            <from variable="myVar" part="TestPart"/>
+            <to variable="tmpVar"/>
+         </copy>
+         <copy>
+             <from>concat($tmpVar,' World')"</from>
+             <to variable="myVar" part="TestPart"/>
+         </copy>
+      </assign>
+       <reply name="end"  
+              partnerLink="helloPartnerLink"
+              portType="test:HelloPortType" 
+              operation="hello"
+              variable="myVar"/>
+   </sequence>
+</process>

Added: ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestDAODeploymentDescriptor/HelloWorld2.wsdl
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestDAODeploymentDescriptor/HelloWorld2.wsdl?rev=940263&view=auto
==============================================================================
--- ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestDAODeploymentDescriptor/HelloWorld2.wsdl (added)
+++ ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestDAODeploymentDescriptor/HelloWorld2.wsdl Sun May  2 17:02:51 2010
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you 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.
+  -->
+
+<wsdl:definitions 
+    targetNamespace="http://ode/bpel/unit-test.wsdl"
+    xmlns="http://schemas.xmlsoap.org/wsdl/"
+    xmlns:tns="http://ode/bpel/unit-test.wsdl"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+    xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+    xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+    
+    <wsdl:message name="HelloMessage">
+        <wsdl:part name="TestPart" type="xsd:string"/>
+    </wsdl:message>
+    
+    <wsdl:portType name="HelloPortType">
+        <wsdl:operation name="hello">
+            <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+            <wsdl:output message="tns:HelloMessage" name="TestOut"/>
+        </wsdl:operation>    
+    </wsdl:portType>
+    
+     <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
+        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+        <wsdl:operation name="hello">
+            <soap:operation soapAction="" style="rpc"/>
+            <wsdl:input>
+                <soap:body
+                    namespace="http://ode/bpel/unit-test.wsdl"
+                    use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body
+                    namespace="http://ode/bpel/unit-test.wsdl" 
+                    use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+    <wsdl:service name="HelloService">
+		<wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
+     		<soap:address location="http://localhost:8080/ode/processes/helloWorld"/>
+		</wsdl:port>
+    </wsdl:service>
+    
+   <plnk:partnerLinkType name="HelloPartnerLinkType">
+       <plnk:role name="me" portType="tns:HelloPortType"/>
+       <plnk:role name="you" portType="tns:HelloPortType"/>
+   </plnk:partnerLinkType>
+</wsdl:definitions>
+

Added: ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestDAODeploymentDescriptor/deploy.xml
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestDAODeploymentDescriptor/deploy.xml?rev=940263&view=auto
==============================================================================
--- ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestDAODeploymentDescriptor/deploy.xml (added)
+++ ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestDAODeploymentDescriptor/deploy.xml Sun May  2 17:02:51 2010
@@ -0,0 +1,40 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you 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.
+  -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+	xmlns:pns="http://ode/bpel/unit-test" 
+	xmlns:wns="http://ode/bpel/unit-test.wsdl">
+
+
+	<process name="pns:HelloWorld2">
+		<active>true</active>
+		<provide partnerLink="helloPartnerLink">
+			<service name="wns:HelloService" port="HelloPort"/>
+		</provide>
+		<context>
+			<propagate from="helloPartnerLink" to="helloPartnerLink" context="*"/>
+			<interceptor>
+				<class-name>org.apache.ode.bpel.context.TestInterceptor</class-name>
+				<config>
+					<myparam1>x</myparam1>
+					<myparam2>y</myparam2>
+				</config>
+			</interceptor>
+		</context>
+	</process>
+</deploy>

Added: ode/trunk/bpel-test/src/test/resources/integration-layer.properties
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/integration-layer.properties?rev=940263&view=auto
==============================================================================
--- ode/trunk/bpel-test/src/test/resources/integration-layer.properties (added)
+++ ode/trunk/bpel-test/src/test/resources/integration-layer.properties Sun May  2 17:02:51 2010
@@ -0,0 +1,55 @@
+# All properties follow this pattern:
+#  [servicename[.portname].ode.]property
+#
+# If service name is mentioned but port name omitted, the value will apply to all ports of the service.
+# If service name and port name are omitted, the value will apply to all services.
+
+# For instance:
+# Service-specific values
+# my-soap-service1.ode.http.connection.timeout=50000
+# my-http-service1.ode.http.protocol.max-redirects=40
+#
+# Port-specific values
+# my-http-service1.portA.ode.http.protocol.max-redirects=60
+
+
+# 3 minutes
+mex.timeout=180000
+
+# true/false
+http.request.chunk=true
+
+# HTTP/1.1 / HTTP/1.0
+http.protocol.version=HTTP/1.1
+
+# true/false
+# will not apply to http-bound services TBD
+http.request.gzip=false
+
+# true/false
+# Append gzip to the Accept-Encoding header
+http.accept.gzip=false
+
+http.protocol.encoding=UTF-8
+
+
+# You must define one property per header, prefixed with 'http.default-headers'
+# These values will override any values already set for a given header.
+http.default-headers.User-Agent=your-agent
+http.default-headers.foo=bar
+
+# timeout in milliseconds until a connection is etablished
+http.connection.timeout=40000
+# timeout in milliseconds for waiting for data
+http.socket.timeout=40000
+
+http.protocol.max-redirects=10
+
+# To disable proxy set the host to null
+http.proxy.host=myproxy.org
+http.proxy.port=8080
+http.proxy.domain=mydomain
+http.proxy.user=johndoe
+http.proxy.password=topsecret
+
+

Modified: ode/trunk/bpel-test/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/log4j.properties?rev=940263&r1=940262&r2=940263&view=diff
==============================================================================
--- ode/trunk/bpel-test/src/test/resources/log4j.properties (original)
+++ ode/trunk/bpel-test/src/test/resources/log4j.properties Sun May  2 17:02:51 2010
@@ -19,6 +19,13 @@
 log4j.rootLogger=WARN, CONSOLE, FILE
 
 # log4j properties to work with commandline tools.
+
+log4j.category.org.apache.ode.bpel.engine=ERROR
+log4j.category.org.apache.ode.bpel.epr=INFO
+log4j.category.org.apache.ode.bpel.extvar.jdbc=ERROR
+log4j.category.org.apache.ode.bpel.runtime=ERROR
+log4j.category.org.apache.ode=ERROR
+
 log4j.category.org.mortbay=ERROR
 log4j.category.org.hibernate.type=WARN
 log4j.category.org.objectweb=ERROR
@@ -36,7 +43,7 @@ log4j.appender.CONSOLE.layout=org.apache
 log4j.appender.CONSOLE.layout.ConversionPattern=%p - %C{1}.%M(%L) | %m%n
 
 log4j.appender.FILE=org.apache.log4j.FileAppender
-log4j.appender.FILE.File=bpel-test.log
+log4j.appender.FILE.File=target/bpel-test.log
 log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
 log4j.appender.FILE.layout.ConversionPattern=%d{MM-dd@HH:mm:ss} %-5p (%13F:%L) %3x - %m%n
 log4j.appender.FILE.append=false

Modified: ode/trunk/dao-hibernate-db/build.xml
URL: http://svn.apache.org/viewvc/ode/trunk/dao-hibernate-db/build.xml?rev=940263&r1=940262&r2=940263&view=diff
==============================================================================
--- ode/trunk/dao-hibernate-db/build.xml (original)
+++ ode/trunk/dao-hibernate-db/build.xml Sun May  2 17:02:51 2010
@@ -21,8 +21,7 @@
 
 	<property name="db.scripts.dir" value="${basedir}/target" />
 	<property name="sql.dir" value="${basedir}/src/main/sql"/>
-        <property name="dao-hibernate.classes" value="${basedir}/../dao-hibernate/target/classes" />
-	<property name="bpel-store.classes" value="${basedir}/../bpel-store/target/classes" />
+    <property name="dao-hibernate.classes" value="${basedir}/../dao-hibernate/target/classes" />
 
 	<path id="classpath">
 	  <pathelement path="${maven.runtime.classpath}"/>
@@ -88,11 +87,8 @@
 		    <include name="**/*.hbm.xml"/>
                     <exclude name="**/HMessageExchangeProperty.hbm.xml" />
 		</fileset>
-		<fileset dir="${bpel-store.classes}/">
-		    <include name="**/*.hbm.xml"/>
-		</fileset>
 	    </schemaexport>
-        <concat destfile="${db.scripts.dir}/@{db}.sql">
+        <concat destfile="${db.scripts.dir}/scripts/@{db}-hib.sql">
           <fileset file="${sql.dir}/simplesched-@{db}.sql"/>
           <fileset file="${db.scripts.dir}/partial.@{db}.sql"/>
         </concat>
@@ -103,3 +99,4 @@
 
 </project>
 
+