You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by se...@apache.org on 2009/04/06 23:53:27 UTC

svn commit: r762523 [2/9] - in /ode/trunk: ./ axis2-war/src/main/webapp/WEB-INF/classes/ 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.template/ axis2-war/src/...

Added: ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/FailureInvokeTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/FailureInvokeTest.java?rev=762523&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/FailureInvokeTest.java (added)
+++ ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/FailureInvokeTest.java Mon Apr  6 21:53:20 2009
@@ -0,0 +1,59 @@
+package org.apache.ode.axis2;
+
+import org.apache.axis2.AxisFault;
+import org.testng.annotations.Test;
+
+/**
+ * This test requires very specific timing values to work which is why it's set to ignored, it
+ * probably wouldn't work on most machines. BpelRuntimeContextImpl.scheduleInvokeCheck also has to
+ * use a timer value of 5s instead of 180s (a bit too long for testing).
+ */
+public class FailureInvokeTest extends Axis2TestBase {
+
+  @Test(enabled = true)
+    public void testSimpleFaultCatch() throws Exception {
+        String bundleName = "TestFailureInInvoke";
+        // deploy the required service
+        server.deployService(DummyService.class.getCanonicalName());
+        if (server.isDeployed(bundleName)) server.undeployProcess(bundleName);
+        server.deployProcess(bundleName);
+
+        try {
+            new Thread(new Killer(this)).start();
+            try {
+                String response = server.sendRequestFile("http://localhost:8888/processes/invokeFailureTest",
+                        bundleName, "testRequest.soap");
+                System.out.println("=> " + response);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+
+            startServer();
+            Thread.sleep(15000);
+        } finally {
+            server.undeployProcess(bundleName);
+        }
+    }
+
+    private class Killer implements Runnable {
+        private FailureInvokeTest test;
+
+        private Killer(FailureInvokeTest test) {
+            this.test = test;
+        }
+
+        public void run() {
+            try {
+                Thread.sleep(5000);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+            try {
+                test.stopServer();
+            } catch (AxisFault axisFault) {
+                axisFault.printStackTrace();
+            }
+        }
+    }
+
+}

Added: ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/ODEConfigDirAware.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/ODEConfigDirAware.java?rev=762523&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/ODEConfigDirAware.java (added)
+++ ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/ODEConfigDirAware.java Mon Apr  6 21:53:20 2009
@@ -0,0 +1,5 @@
+package org.apache.ode.axis2;
+
+public interface ODEConfigDirAware {
+	String getODEConfigDir();
+}
\ No newline at end of file

Added: ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanFailureHibTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanFailureHibTest.java?rev=762523&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanFailureHibTest.java (added)
+++ ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanFailureHibTest.java Mon Apr  6 21:53:20 2009
@@ -0,0 +1,30 @@
+package org.apache.ode.axis2.instancecleanup;
+
+import org.apache.ode.bpel.dao.ProcessDAO;
+import org.apache.ode.bpel.dao.ProcessInstanceDAO;
+import org.hibernate.Query;
+
+public class CleanFailureHibTest extends CleanFailureTest {
+	@Override
+	public String getODEConfigDir() {
+		return getClass().getClassLoader().getResource("webapp").getFile() + "/WEB-INF/conf.hib-derby";
+	}
+
+	@Override
+	protected ProcessInstanceDAO getInstance() {
+        return HibDaoConnectionFactoryImpl.getInstance();
+	}
+
+	@Override
+	protected ProcessDAO getProcess() {
+        return HibDaoConnectionFactoryImpl.getProcess();
+	}
+
+	@Override
+	protected int getLargeDataCount(int echoCount) throws Exception {
+        initTM();
+		Query query = HibDaoConnectionFactoryImpl.getSession().createQuery("select count(id) from HLargeData as l");
+		
+		return ((Long)query.uniqueResult()).intValue();
+	}
+}
\ No newline at end of file

Added: ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanFailureTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanFailureTest.java?rev=762523&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanFailureTest.java (added)
+++ ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanFailureTest.java Mon Apr  6 21:53:20 2009
@@ -0,0 +1,42 @@
+package org.apache.ode.axis2.instancecleanup;
+
+import org.apache.ode.axis2.DummyService;
+import org.apache.ode.bpel.dao.ProcessDAO;
+import org.apache.ode.bpel.dao.ProcessInstanceDAO;
+import org.testng.annotations.Test;
+
+public class CleanFailureTest extends CleanTestBase {
+//	@Test(dataProvider="configs")
+    public void testCleanAll() throws Exception {
+        String bundleName = "TestCleanFailure";
+        // deploy the required service
+        server.deployService(DummyService.class.getCanonicalName());
+        if (server.isDeployed(bundleName)) server.undeployProcess(bundleName);
+        server.deployProcess(bundleName);
+        try {
+        	initialLargeDataCount = getLargeDataCount(0);
+            server.sendRequestFile("http://localhost:8888/processes/helloWorld", bundleName, "testRequest.soap");
+        } finally {
+        	ProcessDAO process = getProcess();
+            server.undeployProcess(bundleName);
+            assertProcessCleanup(process);
+        }
+    }
+
+	public String getODEConfigDir() {
+		return getClass().getClassLoader().getResource("webapp").getFile() + "/WEB-INF/conf.jpa-derby";
+	}
+	
+	protected ProcessInstanceDAO getInstance() {
+        return JpaDaoConnectionFactoryImpl.getInstance();
+	}
+
+	protected ProcessDAO getProcess() {
+        return JpaDaoConnectionFactoryImpl.getProcess();
+	}
+
+	@Override
+	protected int getLargeDataCount(int echoCount) throws Exception {
+		return echoCount;
+	}
+}
\ No newline at end of file

Added: ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanFaultHibTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanFaultHibTest.java?rev=762523&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanFaultHibTest.java (added)
+++ ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanFaultHibTest.java Mon Apr  6 21:53:20 2009
@@ -0,0 +1,24 @@
+package org.apache.ode.axis2.instancecleanup;
+
+import org.apache.ode.bpel.dao.ProcessInstanceDAO;
+import org.hibernate.Query;
+
+public class CleanFaultHibTest extends CleanFaultTest {
+	@Override
+	public String getODEConfigDir() {
+		return getClass().getClassLoader().getResource("webapp").getFile() + "/WEB-INF/conf.hib-derby";	
+	}
+	
+	@Override
+	protected ProcessInstanceDAO getInstance() {
+        return HibDaoConnectionFactoryImpl.getInstance();
+	}
+
+	@Override
+	protected int getLargeDataCount(int echoCount) throws Exception {
+        initTM();
+		Query query = HibDaoConnectionFactoryImpl.getSession().createQuery("select count(id) from HLargeData as l");
+		
+		return ((Long)query.uniqueResult()).intValue();
+	}
+}
\ No newline at end of file

Added: ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanFaultTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanFaultTest.java?rev=762523&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanFaultTest.java (added)
+++ ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanFaultTest.java Mon Apr  6 21:53:20 2009
@@ -0,0 +1,86 @@
+package org.apache.ode.axis2.instancecleanup;
+
+import static org.testng.AssertJUnit.fail;
+
+import org.apache.ode.axis2.DummyService;
+import org.apache.ode.bpel.dao.ProcessDAO;
+import org.apache.ode.bpel.dao.ProcessInstanceDAO;
+import org.apache.ode.bpel.iapi.ContextException;
+import org.testng.annotations.Test;
+
+public class CleanFaultTest extends CleanTestBase {
+//   	@Test(dataProvider="configs")
+    public void testCleanNone() throws Exception {
+    	go("TestCleanFault_None", 1, 0, 0, 1, 1, 0, 2, 2, 3, 2, 41, 47);
+    }
+
+//  	@Test(dataProvider="configs")
+	public void testCleanInstance() throws Exception {
+    	try {
+    		go("TestCleanSuccess_Instance", 0, 0, 0, 0, 3, 0, 6, 2, 3, 6, 41, 70);
+    		fail("Shoud throw a runtime exception: you cannot use the instance category without the variables and correlations categories.");
+    	} catch(ContextException re) {}
+    }
+
+//    @Test(dataProvider="configs")
+    public void testCleanVariables() throws Exception {
+        go("TestCleanFault_Variables", 1, 0, 0, 1, 1, 0, 2, 0, 0, 0, 41, 45);
+    }
+
+//    @Test(dataProvider="configs")
+    public void testCleanMessages() throws Exception {
+        go("TestCleanFault_Messages", 1, 0, 0, 1, 0, 0, 0, 2, 3, 2, 41, 41);
+    }
+
+//    @Test(dataProvider="configs")
+    public void testCleanCorrelations() throws Exception {
+        go("TestCleanFault_Correlations", 1, 0, 0, 1, 1, 0, 2, 2, 3, 2, 41, 47);
+    }
+
+//    @Test(dataProvider="configs")
+    public void testCleanEvents() throws Exception {
+        go("TestCleanFault_Events", 1, 0, 0, 1, 1, 0, 2, 2, 3, 2, 0, 9);
+    }
+
+//    @Test(dataProvider="configs")
+    public void testCleanMessageCorrEvents() throws Exception {
+        go("TestCleanFault_MessageCorrEvents", 1, 0, 0, 1, 0, 0, 0, 2, 3, 2, 0, 3);
+    }
+
+//    @Test(dataProvider="configs")
+    public void testCleanAll() throws Exception {
+        go("TestCleanFault_All", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+    }
+
+    protected void go(String bundleName, int instances, int activityRecoveries, int correlationSets, int faults, int exchanges, int routes, int messsages, int partnerLinks, int scopes, int variables, int events, int largeData) throws Exception {
+        // deploy the required service
+        server.deployService(DummyService.class.getCanonicalName());
+        if (server.isDeployed(bundleName)) server.undeployProcess(bundleName);
+        server.deployProcess(bundleName);
+        ProcessDAO process = null;
+        try {
+        	initialLargeDataCount = getLargeDataCount(0);
+        	
+            server.sendRequestFile("http://localhost:8888/processes/helloWorld", bundleName, "testRequest.soap");
+            assertInstanceCleanup(instances, activityRecoveries, correlationSets, faults, exchanges, routes, messsages, partnerLinks, scopes, variables, events, largeData);
+            process = assertInstanceCleanup(instances, activityRecoveries, correlationSets, faults, exchanges, routes, messsages, partnerLinks, scopes, variables, events, largeData);
+        } finally {
+            server.undeployProcess(bundleName);
+            assertProcessCleanup(process);
+        }
+    }
+
+	public String getODEConfigDir() {
+		return getClass().getClassLoader().getResource("webapp").getFile() + "/WEB-INF/conf.jpa-derby";	
+	}
+
+	@Override
+	protected ProcessInstanceDAO getInstance() {
+        return JpaDaoConnectionFactoryImpl.getInstance();
+	}
+
+	@Override
+	protected int getLargeDataCount(int echoCount) throws Exception {
+		return echoCount;
+	}
+}
\ No newline at end of file

Added: ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanSuccessHibTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanSuccessHibTest.java?rev=762523&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanSuccessHibTest.java (added)
+++ ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanSuccessHibTest.java Mon Apr  6 21:53:20 2009
@@ -0,0 +1,24 @@
+package org.apache.ode.axis2.instancecleanup;
+
+import org.apache.ode.bpel.dao.ProcessInstanceDAO;
+import org.hibernate.Query;
+
+public class CleanSuccessHibTest extends CleanSuccessTest {
+	@Override
+	public String getODEConfigDir() {
+		return getClass().getClassLoader().getResource("webapp").getFile() + "/WEB-INF/conf.hib-derby";	
+	}
+
+	@Override
+	protected ProcessInstanceDAO getInstance() {
+        return HibDaoConnectionFactoryImpl.getInstance();
+	}
+
+	@Override
+	protected int getLargeDataCount(int echoCount) throws Exception {
+        initTM();
+		Query query = HibDaoConnectionFactoryImpl.getSession().createQuery("select count(id) from HLargeData as l");
+		
+		return ((Long)query.uniqueResult()).intValue();
+	}
+}
\ No newline at end of file

Added: ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanSuccessTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanSuccessTest.java?rev=762523&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanSuccessTest.java (added)
+++ ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanSuccessTest.java Mon Apr  6 21:53:20 2009
@@ -0,0 +1,81 @@
+package org.apache.ode.axis2.instancecleanup;
+
+import org.apache.ode.bpel.dao.ProcessDAO;
+import org.apache.ode.bpel.dao.ProcessInstanceDAO;
+import org.apache.ode.bpel.iapi.ContextException;
+import org.testng.annotations.Test;
+
+import static org.testng.AssertJUnit.fail;
+
+public class CleanSuccessTest extends CleanTestBase {
+//	@Test(dataProvider="configs")
+    public void testCleanNone() throws Exception {
+    	go("TestCleanSuccess_None", 1, 0, 0, 0, 2, 0, 6, 2, 3, 6, 60, 76);
+    }
+
+//	@Test(dataProvider="configs")
+    public void testCleanInstance() throws Exception {
+    	try {
+    		go("TestCleanSuccess_Instance", 0, 0, 0, 0, 3, 0, 6, 2, 3, 6, 60, 70);
+    		fail("Shoud throw a runtime exception: you cannot use the instance category without the variables and correlations categories.");
+    	} catch(ContextException re) {}
+    }
+
+//	@Test(dataProvider="configs")
+    public void testCleanVariables() throws Exception {
+        go("TestCleanSuccess_Variables", 1, 0, 0, 0, 3, 0, 6, 0, 0, 0, 60, 70);
+    }
+
+//	@Test(dataProvider="configs")
+    public void testCleanMessages() throws Exception {
+        go("TestCleanSuccess_Messages", 1, 0, 0, 0, 0, 0, 0, 2, 3, 6, 60, 65);
+    }
+
+//	@Test(dataProvider="configs")
+    public void testCleanCorrelations() throws Exception {
+        go("TestCleanSuccess_Correlations", 1, 0, 0, 0, 3, 0, 6, 2, 3, 6, 60, 76);
+    }
+
+//	@Test(dataProvider="configs")
+    public void testCleanEvents() throws Exception {
+        go("TestCleanSuccess_Events", 1, 0, 0, 0, 3, 0, 6, 2, 3, 6, 0, 17);
+    }
+
+//	@Test(dataProvider="configs")
+    public void testCleanMessageCorrEvents() throws Exception {
+        go("TestCleanSuccess_MessageCorrEvents", 1, 0, 0, 0, 0, 0, 0, 2, 3, 6, 0, 6);
+    }
+
+//	@Test(dataProvider="configs")
+    public void testCleanAll() throws Exception {
+        go("TestCleanSuccess_All", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+    }
+
+    protected void go(String bundleName, int instances, int activityRecoveries, int correlationSets, int faults, int exchanges, int routes, int messsages, int partnerLinks, int scopes, int variables, int events, int largeData) throws Exception {
+        if (server.isDeployed(bundleName)) server.undeployProcess(bundleName);
+        server.deployProcess(bundleName);
+        ProcessDAO process = null;
+        try {
+        	initialLargeDataCount = getLargeDataCount(0);
+        	
+            server.sendRequestFile("http://localhost:8888/processes/FirstProcess/FirstProcess/FirstProcess/Client", bundleName, "testRequest.soap");
+            process = assertInstanceCleanup(instances, activityRecoveries, correlationSets, faults, exchanges, routes, messsages, partnerLinks, scopes, variables, events, largeData);
+        } finally {
+            server.undeployProcess(bundleName);
+            assertProcessCleanup(process);
+        }
+    }
+
+	public String getODEConfigDir() {
+		return getClass().getClassLoader().getResource("webapp").getFile() + "/WEB-INF/conf.jpa-derby";	
+	}
+	
+	protected ProcessInstanceDAO getInstance() {
+        return JpaDaoConnectionFactoryImpl.getInstance();
+	}
+	
+	@Override
+	protected int getLargeDataCount(int echoCount) throws Exception {
+		return echoCount;
+	}
+}
\ No newline at end of file

Added: ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanTestBase.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanTestBase.java?rev=762523&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanTestBase.java (added)
+++ ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanTestBase.java Mon Apr  6 21:53:20 2009
@@ -0,0 +1,128 @@
+package org.apache.ode.axis2.instancecleanup;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.io.File;
+
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.axis2.Axis2TestBase;
+import org.apache.ode.axis2.ODEConfigDirAware;
+import org.apache.ode.axis2.ODEConfigProperties;
+import org.apache.ode.bpel.dao.ProcessDAO;
+import org.apache.ode.bpel.dao.ProcessInstanceDAO;
+import org.apache.ode.bpel.dao.ProcessInstanceProfileDAO;
+import org.apache.ode.bpel.dao.ProcessProfileDAO;
+import org.apache.ode.il.EmbeddedGeronimoFactory;
+import org.apache.ode.il.dbutil.Database;
+import org.testng.annotations.AfterMethod;
+
+import javax.transaction.TransactionManager;
+
+public abstract class CleanTestBase extends Axis2TestBase implements ODEConfigDirAware {
+    protected ProfilingBpelDAOConnection daoConn;
+    protected TransactionManager txm;
+	protected int initialLargeDataCount = 0;
+	
+    @AfterMethod
+    protected void tearDown() throws Exception {
+        stopTM();
+        super.tearDown();
+    }
+    
+    protected void initTM() throws Exception {
+    	if( txm != null ) {
+    		try {
+    			txm.commit();
+    		} catch( Exception e ) {
+    			//ignore 
+    		}
+    	}
+        EmbeddedGeronimoFactory factory = new EmbeddedGeronimoFactory();
+        txm = factory.getTransactionManager();
+        Database db = getDatabase();
+        db.setTransactionManager(txm);
+		db.start();
+        txm.begin();
+
+        daoConn = (ProfilingBpelDAOConnection)db.createDaoCF().getConnection();
+    }
+
+    protected void stopTM() throws Exception {
+    	if( txm != null ) {
+    		try {
+    			txm.commit();
+    		} catch( Exception e ) { 
+    			//ignore 
+    		}
+	        txm = null;
+    	}
+    }
+
+    protected Database getDatabase() throws Exception {
+    	String odeConfigDir = getODEConfigDir();
+    	if( config == null || DO_NOT_OVERRIDE_CONFIG.equals(config) || "<jpa>".equals(config) || "<hib>".equals(config) ) {
+        	System.out.println("Profiling config, default: " + odeConfigDir);
+    	} else {
+        	System.out.println("Profiling config: " + config + ".");
+    		odeConfigDir = config;
+    	}
+		File configFile = new File(odeConfigDir);
+		ODEConfigProperties odeProps = new ODEConfigProperties(configFile);
+		odeProps.load();
+		Database db = new Database(odeProps);
+		String webappPath = getClass().getClassLoader().getResource("webapp").getFile();
+		db.setWorkRoot(new File(webappPath, "/WEB-INF"));
+		
+		return db;
+    }
+
+    protected TransactionManager getTransactionManager() {
+        return txm;
+    }
+
+    protected ProcessDAO assertInstanceCleanup(int instances, int activityRecoveries, int correlationSets, int faults, int exchanges, int routes, int messsages, int partnerLinks, int scopes, int variables, int events, int largeData) throws Exception {
+        initTM();
+        ProcessInstanceProfileDAO profile = daoConn.createProcessInstanceProfile(getInstance());
+
+		assertEquals("Number of instances", instances, profile.findInstancesByProcess().size());
+		assertEquals("Number of activity recoveries", activityRecoveries, profile.findActivityRecoveriesByInstance().size());
+        assertEquals("Number of correlation sets", correlationSets, profile.findCorrelationSetsByInstance().size());
+        assertEquals("Number of faults", faults, profile.findFaultsByInstance().size());
+        assertEquals("Number of message exchanges", exchanges, profile.findMessageExchangesByInstance().size());
+        assertEquals("Number of message routes", routes, profile.findMessageRoutesByInstance().size());
+        assertEquals("Number of messages", messsages, profile.findMessagesByInstance().size());
+        assertEquals("Number of partner links", partnerLinks, profile.findPartnerLinksByInstance().size());
+        assertEquals("Number of scopes", scopes, profile.findScopesByInstance().size());
+        assertEquals("Number of variables", variables, profile.findXmlDataByInstance().size());
+		assertEquals("Number of events", events, profile.countEventsByInstance());
+		assertEquals("Number of large data", largeData, getLargeDataCount(largeData) - initialLargeDataCount);
+
+		return profile.getProcess();
+    }
+
+    protected void assertProcessCleanup(ProcessDAO process) throws Exception {
+        if( process != null ) {
+            initTM();
+            ProcessProfileDAO profile = daoConn.createProcessProfile(process);
+            assertTrue("Process should have been deleted.", !profile.doesProcessExist());
+            assertEquals("Number of instances", 0, profile.findInstancesByProcess().size());
+    		assertEquals("Number of activity recoveries", 0, profile.findActivityRecoveriesByProcess().size());
+            assertEquals("Number of correlation sets", 0, profile.findCorrelationSetsByProcess().size());
+            assertEquals("Number of correlators", 0, profile.findCorrelatorsByProcess().size());
+            assertEquals("Number of faults", 0, profile.findFaultsByProcess().size());
+            assertEquals("Number of message exchanges", 0, profile.findMessageExchangesByProcess().size());
+            assertEquals("Number of message routes", 0, profile.findMessageRoutesByProcess().size());
+            assertEquals("Number of messages", 0, profile.findMessagesByProcess().size());
+            assertEquals("Number of partner links", 0, profile.findPartnerLinksByProcess().size());
+            assertEquals("Number of scopes", 0, profile.findScopesByProcess().size());
+            assertEquals("Number of variables", 0, profile.findXmlDataByProcess().size());
+    		assertEquals("Number of events", 0, profile.countEventsByProcess());
+    		assertEquals("Number of large data", 0, getLargeDataCount(0) - initialLargeDataCount);
+        }
+    }
+
+	protected abstract ProcessInstanceDAO getInstance();
+	
+	protected abstract int getLargeDataCount(int echoCount) throws Exception;
+}
\ No newline at end of file

Added: ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/HibDaoConnectionFactoryImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/HibDaoConnectionFactoryImpl.java?rev=762523&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/HibDaoConnectionFactoryImpl.java (added)
+++ ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/HibDaoConnectionFactoryImpl.java Mon Apr  6 21:53:20 2009
@@ -0,0 +1,85 @@
+package org.apache.ode.axis2.instancecleanup;
+
+import java.util.Properties;
+
+import javax.sql.DataSource;
+import javax.transaction.TransactionManager;
+
+import org.apache.ode.bpel.dao.BpelDAOConnection;
+import org.apache.ode.bpel.dao.ProcessDAO;
+import org.apache.ode.bpel.dao.ProcessInstanceDAO;
+import org.apache.ode.bpel.dao.ProcessInstanceProfileDAO;
+import org.apache.ode.bpel.dao.ProcessProfileDAO;
+import org.apache.ode.daohib.SessionManager;
+import org.apache.ode.daohib.bpel.BpelDAOConnectionFactoryImpl;
+import org.apache.ode.daohib.bpel.BpelDAOConnectionImpl;
+import org.apache.ode.daohib.bpel.ProcessDaoImpl;
+import org.apache.ode.daohib.bpel.ProcessInstanceDaoImpl;
+import org.apache.ode.daohib.bpel.ProcessInstanceProfileDaoImpl;
+import org.apache.ode.daohib.bpel.ProcessProfileDaoImpl;
+import org.apache.ode.daohib.bpel.hobj.HProcess;
+import org.apache.ode.daohib.bpel.hobj.HProcessInstance;
+import org.hibernate.MappingException;
+import org.hibernate.Session;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.event.PostInsertEvent;
+import org.hibernate.event.PostInsertEventListener;
+
+@SuppressWarnings("serial")
+public class HibDaoConnectionFactoryImpl extends BpelDAOConnectionFactoryImpl implements PostInsertEventListener {
+    private static SessionManager _staticSessionManager;
+    private static ProcessInstanceDaoImpl instance;
+    private static ProcessDaoImpl process;
+    
+    @Override
+    protected SessionManager createSessionManager(Properties properties, DataSource ds, TransactionManager tm) {
+        _staticSessionManager = new SessionManager(properties, ds, tm) {
+            @Override
+            public Configuration getDefaultConfiguration() throws MappingException {
+                Configuration conf = super.getDefaultConfiguration();
+                conf.setListener("post-insert", HibDaoConnectionFactoryImpl.this);
+                return conf;
+            }
+        };
+        
+        return _staticSessionManager;
+    }
+
+    public BpelDAOConnection getConnection() {
+        return new ProfilingBpelDAOConnectionImpl(_sessionManager);
+    }
+    
+    public static Session getSession() {
+        return _staticSessionManager.getSession();
+    }
+    
+    public static ProcessInstanceDAO getInstance() {
+        return instance;
+    }
+    
+    public static ProcessDaoImpl getProcess() {
+        return process;
+    }
+
+    public void onPostInsert(PostInsertEvent e) {
+        if( HProcessInstance.class.equals( e.getEntity().getClass() ) ) {
+            instance = new ProcessInstanceDaoImpl(_sessionManager, (HProcessInstance)e.getEntity());
+        } else if( HProcess.class.equals( e.getEntity().getClass() ) ) {
+            process = new ProcessDaoImpl(_sessionManager, (HProcess)e.getEntity());
+        }
+    }
+
+    public static class ProfilingBpelDAOConnectionImpl extends BpelDAOConnectionImpl implements ProfilingBpelDAOConnection {
+        ProfilingBpelDAOConnectionImpl(SessionManager sm) {
+            super(sm);
+        }
+        
+        public ProcessProfileDAO createProcessProfile(ProcessDAO process) {
+            return new ProcessProfileDaoImpl(_sm, (ProcessDaoImpl)process);
+        }
+
+        public ProcessInstanceProfileDAO createProcessInstanceProfile(ProcessInstanceDAO instance) {
+            return new ProcessInstanceProfileDaoImpl(_sm, (ProcessInstanceDaoImpl)instance);
+        }
+    }
+}
\ No newline at end of file

Added: ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/JpaDaoConnectionFactoryImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/JpaDaoConnectionFactoryImpl.java?rev=762523&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/JpaDaoConnectionFactoryImpl.java (added)
+++ ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/JpaDaoConnectionFactoryImpl.java Mon Apr  6 21:53:20 2009
@@ -0,0 +1,70 @@
+package org.apache.ode.axis2.instancecleanup;
+
+import java.util.Properties;
+
+import javax.persistence.EntityManager;
+
+import org.apache.ode.bpel.dao.ProcessDAO;
+import org.apache.ode.bpel.dao.ProcessInstanceDAO;
+import org.apache.ode.bpel.dao.ProcessInstanceProfileDAO;
+import org.apache.ode.bpel.dao.ProcessProfileDAO;
+import org.apache.ode.dao.jpa.BPELDAOConnectionFactoryImpl;
+import org.apache.ode.dao.jpa.BPELDAOConnectionImpl;
+import org.apache.ode.dao.jpa.ProcessDAOImpl;
+import org.apache.ode.dao.jpa.ProcessInstanceDAOImpl;
+import org.apache.ode.dao.jpa.ProcessInstanceProfileDAOImpl;
+import org.apache.ode.dao.jpa.ProcessProfileDAOImpl;
+import org.apache.openjpa.event.LifecycleEvent;
+import org.apache.openjpa.event.PersistListener;
+import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
+
+public class JpaDaoConnectionFactoryImpl extends BPELDAOConnectionFactoryImpl implements PersistListener {
+    private static ProcessInstanceDAO instance;
+    private static ProcessDAO process;
+    
+    public static ProcessInstanceDAO getInstance() {
+        return instance;
+    }
+
+    public static ProcessDAO getProcess() {
+        return process;
+    }
+
+    @Override
+    public void init(Properties properties) {
+        super.init(properties);
+        if( _emf instanceof OpenJPAEntityManagerFactorySPI ) {
+            ((OpenJPAEntityManagerFactorySPI)_emf).addLifecycleListener(this, ProcessInstanceDAOImpl.class, ProcessDAOImpl.class);
+        }
+    }
+    
+    @Override
+    protected BPELDAOConnectionImpl createBPELDAOConnection(EntityManager em) {
+        return new ProfilingBPELDAOConnectionImpl(em);
+    }
+
+    public void afterPersist(LifecycleEvent event) {
+        if( event.getSource() instanceof ProcessInstanceDAOImpl ) {
+            instance = (ProcessInstanceDAOImpl)event.getSource();
+        } else {
+            process = (ProcessDAOImpl)event.getSource();
+        }
+    }
+
+    public void beforePersist(LifecycleEvent event) {
+    }
+    
+    public static class ProfilingBPELDAOConnectionImpl extends BPELDAOConnectionImpl implements ProfilingBpelDAOConnection {
+        public ProfilingBPELDAOConnectionImpl(EntityManager em) {
+            super(em);
+        }
+        
+        public ProcessProfileDAO createProcessProfile(ProcessDAO process) {
+            return new ProcessProfileDAOImpl(_em, (ProcessDAOImpl)process);
+        }
+
+        public ProcessInstanceProfileDAO createProcessInstanceProfile(ProcessInstanceDAO instance) {
+            return new ProcessInstanceProfileDAOImpl(_em, (ProcessInstanceDAOImpl)instance);
+        }
+    }
+}
\ No newline at end of file

Added: ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/ProfilingBpelDAOConnection.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/ProfilingBpelDAOConnection.java?rev=762523&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/ProfilingBpelDAOConnection.java (added)
+++ ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/ProfilingBpelDAOConnection.java Mon Apr  6 21:53:20 2009
@@ -0,0 +1,13 @@
+package org.apache.ode.axis2.instancecleanup;
+
+import org.apache.ode.bpel.dao.BpelDAOConnection;
+import org.apache.ode.bpel.dao.ProcessDAO;
+import org.apache.ode.bpel.dao.ProcessInstanceDAO;
+import org.apache.ode.bpel.dao.ProcessInstanceProfileDAO;
+import org.apache.ode.bpel.dao.ProcessProfileDAO;
+
+public interface ProfilingBpelDAOConnection extends BpelDAOConnection {
+      ProcessProfileDAO createProcessProfile(ProcessDAO instance);
+      
+      ProcessInstanceProfileDAO createProcessInstanceProfile(ProcessInstanceDAO instance);
+}

Added: ode/trunk/axis2-war/src/test/java/org/apache/ode/bpel/dao/ProcessInstanceProfileDAO.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/java/org/apache/ode/bpel/dao/ProcessInstanceProfileDAO.java?rev=762523&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/java/org/apache/ode/bpel/dao/ProcessInstanceProfileDAO.java (added)
+++ ode/trunk/axis2-war/src/test/java/org/apache/ode/bpel/dao/ProcessInstanceProfileDAO.java Mon Apr  6 21:53:20 2009
@@ -0,0 +1,46 @@
+/*
+ * 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.bpel.dao;
+
+import java.util.List;
+
+public interface ProcessInstanceProfileDAO extends ProcessProfileDAO {
+	ProcessDAO getProcess();
+	
+	List<ActivityRecoveryDAO> findActivityRecoveriesByInstance();
+
+	List<CorrelationSetDAO> findCorrelationSetsByInstance();
+
+	List<FaultDAO> findFaultsByInstance();
+
+	List<MessageDAO> findMessagesByInstance();
+
+	List<MessageExchangeDAO> findMessageExchangesByInstance();
+
+	List<MessageRouteDAO> findMessageRoutesByInstance();
+
+	List<PartnerLinkDAO> findPartnerLinksByInstance();
+
+	List<ScopeDAO> findScopesByInstance();
+
+	List<XmlDataDAO> findXmlDataByInstance();
+	
+	int countEventsByInstance();
+}
\ No newline at end of file

Added: ode/trunk/axis2-war/src/test/java/org/apache/ode/bpel/dao/ProcessProfileDAO.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/java/org/apache/ode/bpel/dao/ProcessProfileDAO.java?rev=762523&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/java/org/apache/ode/bpel/dao/ProcessProfileDAO.java (added)
+++ ode/trunk/axis2-war/src/test/java/org/apache/ode/bpel/dao/ProcessProfileDAO.java Mon Apr  6 21:53:20 2009
@@ -0,0 +1,50 @@
+/*
+ * 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.bpel.dao;
+
+import java.util.List;
+
+public interface ProcessProfileDAO {
+	boolean doesProcessExist();
+	
+	List<ProcessInstanceDAO> findInstancesByProcess();
+
+	List<ActivityRecoveryDAO> findActivityRecoveriesByProcess();
+
+	List<CorrelationSetDAO> findCorrelationSetsByProcess();
+
+	List<CorrelatorDAO> findCorrelatorsByProcess();
+
+	List<FaultDAO> findFaultsByProcess();
+
+	List<MessageDAO> findMessagesByProcess();
+
+	List<MessageExchangeDAO> findMessageExchangesByProcess();
+
+	List<MessageRouteDAO> findMessageRoutesByProcess();
+
+	List<PartnerLinkDAO> findPartnerLinksByProcess();
+
+	List<ScopeDAO> findScopesByProcess();
+
+	List<XmlDataDAO> findXmlDataByProcess();
+
+	int countEventsByProcess();
+}
\ No newline at end of file

Added: ode/trunk/axis2-war/src/test/java/org/apache/ode/dao/jpa/ProcessInstanceProfileDAOImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/java/org/apache/ode/dao/jpa/ProcessInstanceProfileDAOImpl.java?rev=762523&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/java/org/apache/ode/dao/jpa/ProcessInstanceProfileDAOImpl.java (added)
+++ ode/trunk/axis2-war/src/test/java/org/apache/ode/dao/jpa/ProcessInstanceProfileDAOImpl.java Mon Apr  6 21:53:20 2009
@@ -0,0 +1,120 @@
+/*
+ * 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.dao.jpa;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.bpel.dao.ActivityRecoveryDAO;
+import org.apache.ode.bpel.dao.CorrelationSetDAO;
+import org.apache.ode.bpel.dao.FaultDAO;
+import org.apache.ode.bpel.dao.MessageDAO;
+import org.apache.ode.bpel.dao.MessageExchangeDAO;
+import org.apache.ode.bpel.dao.MessageRouteDAO;
+import org.apache.ode.bpel.dao.PartnerLinkDAO;
+import org.apache.ode.bpel.dao.ProcessDAO;
+import org.apache.ode.bpel.dao.ProcessInstanceProfileDAO;
+import org.apache.ode.bpel.dao.ScopeDAO;
+import org.apache.ode.bpel.dao.XmlDataDAO;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+/**
+ * OpenJPA based {@link ProcessInstanceProfileDAO} implementation
+ */
+public class ProcessInstanceProfileDAOImpl extends ProcessProfileDAOImpl implements ProcessInstanceProfileDAO {
+	@SuppressWarnings("unused")
+	private static final Log __log = LogFactory.getLog(ProcessInstanceProfileDAOImpl.class);
+	
+	private ProcessInstanceDAOImpl instance;
+
+    public ProcessInstanceProfileDAOImpl(EntityManager em, ProcessInstanceDAOImpl instance) {
+        super(em, (ProcessDAOImpl)instance.getProcess());
+        this.instance = instance;
+    }
+    
+    public ProcessDAO getProcess() {
+    	return process;
+    }
+    
+	public List<MessageExchangeDAO> findMessageExchangesByInstance() {
+		return findByInstance("select x from MessageExchangeDAOImpl as x where x._processInst = :instance");
+	}
+
+	public List<MessageRouteDAO> findMessageRoutesByInstance() {
+		return findByInstance("select r from MessageRouteDAOImpl as r where r._processInst = :instance");
+	}
+
+	public List<MessageDAO> findMessagesByInstance() {
+	    // not quite efficient, this will have to load up the entire messages
+	    List<MessageDAO> messages = new ArrayList<MessageDAO>();
+	    
+	    for( Object message : findByInstance("select x._request from MessageExchangeDAOImpl as x where x._processInst = :instance")) {
+	        messages.add((MessageDAO)message);
+	    }
+        for( Object message : findByInstance("select x._response from MessageExchangeDAOImpl as x where x._processInst = :instance")) {
+            messages.add((MessageDAO)message);
+        }
+        
+        return messages;
+	}
+
+	public List<PartnerLinkDAO> findPartnerLinksByInstance() {
+		return findByInstance("select p from PartnerLinkDAOImpl as p where p._scope._processInstance = :instance");
+	}
+
+	public List<ScopeDAO> findScopesByInstance() {
+		return findByInstance("select s from ScopeDAOImpl as s where s._processInstance = :instance");
+	}
+
+	public List<XmlDataDAO> findXmlDataByInstance() {
+		return findByInstance("select x from XmlDataDAOImpl as x where x._scope._processInstance = :instance");
+	}
+
+    public List<ActivityRecoveryDAO> findActivityRecoveriesByInstance() {
+    	return findByInstance("select a from ActivityRecoveryDAOImpl as a where a._instance = :instance");
+    }
+
+    public List<CorrelationSetDAO> findCorrelationSetsByInstance() {
+    	return findByInstance("select s from CorrelationSetDAOImpl as s where s._scope._processInstance = :instance");
+    }
+
+    public List<FaultDAO> findFaultsByInstance() {
+    	return findByInstance("select f from FaultDAOImpl as f where f._id in (select i._fault from ProcessInstanceDAOImpl as i where i = :instance and i._fault is not null)");
+    }
+
+    public int countEventsByInstance() {
+		Query query = em.createQuery("select count(e._id) from EventDAOImpl as e where e._instance = :instance");
+		query.setParameter("instance", instance);
+		
+		return ((Long)query.getSingleResult()).intValue();
+    }
+    
+    @SuppressWarnings("unchecked")
+    protected <D> List<D> findByInstance(String queryString) {
+		Query query = em.createQuery(queryString);
+		query.setParameter("instance", instance);
+		
+		return query.getResultList();
+	}
+}
\ No newline at end of file

Added: ode/trunk/axis2-war/src/test/java/org/apache/ode/dao/jpa/ProcessProfileDAOImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/java/org/apache/ode/dao/jpa/ProcessProfileDAOImpl.java?rev=762523&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/java/org/apache/ode/dao/jpa/ProcessProfileDAOImpl.java (added)
+++ ode/trunk/axis2-war/src/test/java/org/apache/ode/dao/jpa/ProcessProfileDAOImpl.java Mon Apr  6 21:53:20 2009
@@ -0,0 +1,133 @@
+/*
+ * 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.dao.jpa;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.bpel.dao.ActivityRecoveryDAO;
+import org.apache.ode.bpel.dao.CorrelationSetDAO;
+import org.apache.ode.bpel.dao.CorrelatorDAO;
+import org.apache.ode.bpel.dao.FaultDAO;
+import org.apache.ode.bpel.dao.MessageDAO;
+import org.apache.ode.bpel.dao.MessageExchangeDAO;
+import org.apache.ode.bpel.dao.MessageRouteDAO;
+import org.apache.ode.bpel.dao.PartnerLinkDAO;
+import org.apache.ode.bpel.dao.ProcessInstanceDAO;
+import org.apache.ode.bpel.dao.ProcessProfileDAO;
+import org.apache.ode.bpel.dao.ScopeDAO;
+import org.apache.ode.bpel.dao.XmlDataDAO;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+/**
+ * OpenJPA based {@link ProcessProfileDAO} implementation
+ */
+public class ProcessProfileDAOImpl extends OpenJPADAO implements ProcessProfileDAO {
+	@SuppressWarnings("unused")
+	private static final Log __log = LogFactory.getLog(ProcessProfileDAOImpl.class);
+	
+	protected EntityManager em;
+	protected ProcessDAOImpl process;
+
+    public ProcessProfileDAOImpl(EntityManager em, ProcessDAOImpl process) {
+        assert process != null;
+        this.process = process;
+        this.em = em;
+    }
+    
+    public boolean doesProcessExist() {
+		Query query = em.createQuery("select count(p._id) from ProcessDAOImpl as p where p._guid = :guid");
+		query.setParameter("guid", process.getGuid());
+		
+		return ((Long)query.getSingleResult()) > 0;
+	}
+    
+	public List<ProcessInstanceDAO> findInstancesByProcess() {
+		return findByProcess("select i from ProcessInstanceDAOImpl as i where i._process = :process");
+	}
+
+	public List<MessageExchangeDAO> findMessageExchangesByProcess() {
+		return findByProcess("select x from MessageExchangeDAOImpl as x where x._processInst._process = :process");
+	}
+
+	public List<MessageRouteDAO> findMessageRoutesByProcess() {
+		return findByProcess("select r from MessageRouteDAOImpl as r where r._processInst._process = :process");
+	}
+
+	public List<MessageDAO> findMessagesByProcess() {
+        // not quite efficient, this will have to load up the entire messages
+        List<MessageDAO> messages = new ArrayList<MessageDAO>();
+        
+        for( Object message : findByProcess("select x._request from MessageExchangeDAOImpl as x where x._process = :process")) {
+            messages.add((MessageDAO)message);
+        }
+        for( Object message : findByProcess("select x._response from MessageExchangeDAOImpl as x where x._process = :process")) {
+            messages.add((MessageDAO)message);
+        }
+        
+        return messages;
+	}
+
+	public List<PartnerLinkDAO> findPartnerLinksByProcess() {
+		return findByProcess("select p from PartnerLinkDAOImpl as p where p._scope._processInstance._process = :process");
+	}
+
+	public List<ScopeDAO> findScopesByProcess() {
+		return findByProcess("select s from ScopeDAOImpl as s where s._processInstance._process = :process");
+	}
+
+	public List<XmlDataDAO> findXmlDataByProcess() {
+		return findByProcess("select x from XmlDataDAOImpl as x where x._scope._processInstance._process = :process");
+	}
+	
+    public List<ActivityRecoveryDAO> findActivityRecoveriesByProcess() {
+    	return findByProcess("select a from ActivityRecoveryDAOImpl as a where a._instance._process = :process");
+    }
+
+    public List<CorrelationSetDAO> findCorrelationSetsByProcess() {
+    	return findByProcess("select s from CorrelationSetDAOImpl as s where s._scope._processInstance._process = :process");
+    }
+
+    public List<CorrelatorDAO> findCorrelatorsByProcess() {
+    	return findByProcess("select c from CorrelatorDAOImpl as c where c._process = :process");
+    }
+
+    public List<FaultDAO> findFaultsByProcess() {
+    	return findByProcess("select f from FaultDAOImpl as f where f._id in(select i._fault from ProcessInstanceDAOImpl as i where i._process = :process and i._fault is not null)");
+    }
+
+    public int countEventsByProcess() {
+		Query query = em.createQuery("select count(e._id) from EventDAOImpl as e where e._instance._process = :process");
+		query.setParameter("process", process);
+		
+		return ((Long)query.getSingleResult()).intValue();
+    }
+    
+    @SuppressWarnings("unchecked")
+	protected <D> List<D> findByProcess(String queryString) {
+		Query query = em.createQuery(queryString);
+		query.setParameter("process", process);
+		return query.getResultList();
+	}
+}
\ No newline at end of file

Added: ode/trunk/axis2-war/src/test/java/org/apache/ode/daohib/bpel/ProcessInstanceProfileDaoImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/java/org/apache/ode/daohib/bpel/ProcessInstanceProfileDaoImpl.java?rev=762523&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/java/org/apache/ode/daohib/bpel/ProcessInstanceProfileDaoImpl.java (added)
+++ ode/trunk/axis2-war/src/test/java/org/apache/ode/daohib/bpel/ProcessInstanceProfileDaoImpl.java Mon Apr  6 21:53:20 2009
@@ -0,0 +1,135 @@
+/*
+ * 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.daohib.bpel;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.bpel.dao.ActivityRecoveryDAO;
+import org.apache.ode.bpel.dao.CorrelationSetDAO;
+import org.apache.ode.bpel.dao.FaultDAO;
+import org.apache.ode.bpel.dao.MessageDAO;
+import org.apache.ode.bpel.dao.MessageExchangeDAO;
+import org.apache.ode.bpel.dao.MessageRouteDAO;
+import org.apache.ode.bpel.dao.PartnerLinkDAO;
+import org.apache.ode.bpel.dao.ProcessDAO;
+import org.apache.ode.bpel.dao.ProcessInstanceProfileDAO;
+import org.apache.ode.bpel.dao.ScopeDAO;
+import org.apache.ode.bpel.dao.XmlDataDAO;
+import org.apache.ode.daohib.SessionManager;
+import org.apache.ode.daohib.bpel.hobj.HActivityRecovery;
+import org.apache.ode.daohib.bpel.hobj.HCorrelationSet;
+import org.apache.ode.daohib.bpel.hobj.HCorrelatorSelector;
+import org.apache.ode.daohib.bpel.hobj.HFaultData;
+import org.apache.ode.daohib.bpel.hobj.HMessage;
+import org.apache.ode.daohib.bpel.hobj.HMessageExchange;
+import org.apache.ode.daohib.bpel.hobj.HPartnerLink;
+import org.apache.ode.daohib.bpel.hobj.HScope;
+import org.apache.ode.daohib.bpel.hobj.HXmlData;
+import org.hibernate.Query;
+
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Hibernate based {@link ProcessInstanceProfileDao} implementation
+ */
+public class ProcessInstanceProfileDaoImpl extends ProcessProfileDaoImpl implements ProcessInstanceProfileDAO {
+	@SuppressWarnings("unused")
+	private static final Log __log = LogFactory.getLog(ProcessInstanceProfileDaoImpl.class);
+	
+	private ProcessInstanceDaoImpl instance;
+
+    public ProcessInstanceProfileDaoImpl(SessionManager sm, ProcessInstanceDaoImpl instance) {
+        super(sm, (ProcessDaoImpl)instance.getProcess());
+        entering("ProcessInstanceProfileDaoImpl.ProcessInstanceProfileDaoImpl");
+        this.instance = instance;
+    }
+    
+    public SessionManager getSessionManager() {
+    	return _sm;
+    }
+    
+    public ProcessDAO getProcess() {
+    	return process;
+    }
+    
+	public List<MessageExchangeDAO> findMessageExchangesByInstance() {
+		return findByInstance("from HMessageExchange as x where x.instance = :instance)", MessageExchangeDaoImpl.class, HMessageExchange.class);
+	}
+
+	public List<MessageRouteDAO> findMessageRoutesByInstance() {
+		return findByInstance("from HCorrelatorSelector as s where s.instance = :instance", MessageRouteDaoImpl.class, HCorrelatorSelector.class);
+	}
+
+	public List<MessageDAO> findMessagesByInstance() {
+		return findByInstance("from HMessage as m where m.messageExchange.instance = :instance)", MessageDaoImpl.class, HMessage.class);
+	}
+
+	public List<PartnerLinkDAO> findPartnerLinksByInstance() {
+		return findByInstance("from HPartnerLink as p where p.scope.instance = :instance)", PartnerLinkDAOImpl.class, HPartnerLink.class);
+	}
+
+	public List<ScopeDAO> findScopesByInstance() {
+		return findByInstance("from HScope as s where s.instance = :instance)", ScopeDaoImpl.class, HScope.class);
+	}
+
+	public List<XmlDataDAO> findXmlDataByInstance() {
+		return findByInstance("from HXmlData as x where x.instance = :instance", XmlDataDaoImpl.class, HXmlData.class);
+	}
+
+    public List<ActivityRecoveryDAO> findActivityRecoveriesByInstance() {
+    	return findByInstance("from HActivityRecovery as a where a.instance = :instance", ActivityRecoveryDaoImpl.class, HActivityRecovery.class);
+    }
+
+    public List<CorrelationSetDAO> findCorrelationSetsByInstance() {
+    	return findByInstance("from HCorrelationSet as s where s.instance = :instance", CorrelationSetDaoImpl.class, HCorrelationSet.class);
+    }
+
+    public List<FaultDAO> findFaultsByInstance() {
+    	return findByInstance("from HFaultData as f where f in (select i.fault from HProcessInstance as i where i = :instance and i.fault is not null)", FaultDAOImpl.class, HFaultData.class);
+    }
+
+    public int countEventsByInstance() {
+		Query query = getSession().createQuery("select count(id) from HBpelEvent as e where e.instance = :instance");
+		query.setParameter("instance", instance._hobj);
+		
+		return ((Long)query.uniqueResult()).intValue();
+    }
+    
+    @SuppressWarnings("unchecked")
+    protected <D, H> List<D> findByInstance(String queryString, Class daoClass, Class hibClass) {
+		List<D> results = new ArrayList<D>();
+
+		try {
+			Query query = getSession().createQuery(queryString);
+			query.setParameter("instance", instance._hobj);
+			for( H hibObj : (Collection<H>)query.list()) {
+				Constructor<D> c = daoClass.getConstructor(SessionManager.class, hibClass);
+				results.add( c.newInstance(_sm, hibObj) );
+			}
+		} catch( Exception e ) {
+			throw new RuntimeException(e);
+		}
+
+		return results;
+	}
+}
\ No newline at end of file

Added: ode/trunk/axis2-war/src/test/java/org/apache/ode/daohib/bpel/ProcessProfileDaoImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/java/org/apache/ode/daohib/bpel/ProcessProfileDaoImpl.java?rev=762523&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/java/org/apache/ode/daohib/bpel/ProcessProfileDaoImpl.java (added)
+++ ode/trunk/axis2-war/src/test/java/org/apache/ode/daohib/bpel/ProcessProfileDaoImpl.java Mon Apr  6 21:53:20 2009
@@ -0,0 +1,156 @@
+/*
+ * 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.daohib.bpel;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.bpel.dao.ActivityRecoveryDAO;
+import org.apache.ode.bpel.dao.CorrelationSetDAO;
+import org.apache.ode.bpel.dao.CorrelatorDAO;
+import org.apache.ode.bpel.dao.FaultDAO;
+import org.apache.ode.bpel.dao.MessageDAO;
+import org.apache.ode.bpel.dao.MessageExchangeDAO;
+import org.apache.ode.bpel.dao.MessageRouteDAO;
+import org.apache.ode.bpel.dao.PartnerLinkDAO;
+import org.apache.ode.bpel.dao.ProcessInstanceDAO;
+import org.apache.ode.bpel.dao.ProcessProfileDAO;
+import org.apache.ode.bpel.dao.ScopeDAO;
+import org.apache.ode.bpel.dao.XmlDataDAO;
+import org.apache.ode.daohib.SessionManager;
+import org.apache.ode.daohib.bpel.hobj.HActivityRecovery;
+import org.apache.ode.daohib.bpel.hobj.HCorrelationSet;
+import org.apache.ode.daohib.bpel.hobj.HCorrelator;
+import org.apache.ode.daohib.bpel.hobj.HCorrelatorSelector;
+import org.apache.ode.daohib.bpel.hobj.HFaultData;
+import org.apache.ode.daohib.bpel.hobj.HMessage;
+import org.apache.ode.daohib.bpel.hobj.HMessageExchange;
+import org.apache.ode.daohib.bpel.hobj.HPartnerLink;
+import org.apache.ode.daohib.bpel.hobj.HProcess;
+import org.apache.ode.daohib.bpel.hobj.HProcessInstance;
+import org.apache.ode.daohib.bpel.hobj.HScope;
+import org.apache.ode.daohib.bpel.hobj.HXmlData;
+import org.hibernate.Query;
+
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Hibernate based {@link ProcessProfileDAO} implementation
+ */
+public class ProcessProfileDaoImpl extends HibernateDao implements ProcessProfileDAO {
+	@SuppressWarnings("unused")
+	private static final Log __log = LogFactory.getLog(ProcessProfileDaoImpl.class);
+	
+	protected ProcessDaoImpl process;
+
+    public ProcessProfileDaoImpl(SessionManager sm, ProcessDaoImpl process) {
+        super(sm, process._hobj);
+        entering("ProcessProfileDaoImpl.ProcessProfileDaoImpl");
+        this.process = process;
+    }
+    
+    public SessionManager getSessionManager() {
+    	return _sm;
+    }
+    
+    @SuppressWarnings("unchecked")
+    public boolean doesProcessExist() {
+    	boolean exists = false;
+    	
+		Query query = getSession().createQuery("select count(id) from HProcess as p where p.guid = :guid");
+		query.setParameter("guid", ((HProcess)process._hobj).getGuid());
+		for( Long cnt : (List<Long>)query.list()) {
+			exists = cnt.intValue() > 0;
+		}
+		
+		return exists;
+    }
+    
+	public List<ProcessInstanceDAO> findInstancesByProcess() {
+		return findByProcess("from HProcessInstance as i where i.process = :process)", ProcessInstanceDaoImpl.class, HProcessInstance.class);
+	}
+
+	public List<MessageExchangeDAO> findMessageExchangesByProcess() {
+		return findByProcess("from HMessageExchange as x where x.instance.process = :process)", MessageExchangeDaoImpl.class, HMessageExchange.class);
+	}
+
+	public List<MessageRouteDAO> findMessageRoutesByProcess() {
+		return findByProcess("from HCorrelatorSelector as s where s.instance.process = :process)", MessageRouteDaoImpl.class, HCorrelatorSelector.class);
+	}
+
+	public List<MessageDAO> findMessagesByProcess() {
+		return findByProcess("from HMessage as m where m.messageExchange.process = :process)", MessageDaoImpl.class, HMessage.class);
+	}
+
+	public List<PartnerLinkDAO> findPartnerLinksByProcess() {
+		return findByProcess("from HPartnerLink as p where p.process = :process)", PartnerLinkDAOImpl.class, HPartnerLink.class);
+	}
+
+	public List<ScopeDAO> findScopesByProcess() {
+		return findByProcess("from HScope as s where s.instance.process = :process", ScopeDaoImpl.class, HScope.class);
+	}
+
+	public List<XmlDataDAO> findXmlDataByProcess() {
+		return findByProcess("from HXmlData as x where x.instance.process = :process", XmlDataDaoImpl.class, HXmlData.class);
+	}
+	
+    public List<ActivityRecoveryDAO> findActivityRecoveriesByProcess() {
+    	return findByProcess("from HActivityRecovery as a where a.instance.process = :process", ActivityRecoveryDaoImpl.class, HActivityRecovery.class);
+    }
+
+    public List<CorrelationSetDAO> findCorrelationSetsByProcess() {
+    	return findByProcess("from HCorrelationSet as s where s.process = :process", CorrelationSetDaoImpl.class, HCorrelationSet.class);
+    }
+
+    public List<CorrelatorDAO> findCorrelatorsByProcess() {
+    	return findByProcess("from HCorrelator as c where c.process = :process", CorrelatorDaoImpl.class, HCorrelator.class);
+    }
+
+    public List<FaultDAO> findFaultsByProcess() {
+    	return findByProcess("from HFaultData as f where f in (select i.fault from HProcessInstance as i where i.process = :process and i.fault is not null)", FaultDAOImpl.class, HFaultData.class);
+    }
+
+    public int countEventsByProcess() {
+		Query query = getSession().createQuery("select count(id) from HBpelEvent as e where e.instance.process = :process");
+		query.setParameter("process", process._hobj);
+
+		return ((Long)query.uniqueResult()).intValue();
+    }
+    
+    @SuppressWarnings("unchecked")
+	protected <D, H> List<D> findByProcess(String queryString, Class daoClass, Class hibClass) {
+		List<D> results = new ArrayList<D>();
+
+		try {
+			Query query = getSession().createQuery(queryString);
+			query.setParameter("process", process._hobj);
+			for( H hibObj : (Collection<H>)query.list()) {
+				Constructor<D> c = daoClass.getConstructor(SessionManager.class, hibClass);
+				results.add( c.newInstance(_sm, hibObj) );
+			}
+		} catch( Exception e ) {
+			throw new RuntimeException(e);
+		}
+
+		return results;
+	}
+}
\ No newline at end of file

Added: ode/trunk/axis2-war/src/test/resources/TestCleanCorrelation_None/TestCorrelation1.bpel
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestCleanCorrelation_None/TestCorrelation1.bpel?rev=762523&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestCleanCorrelation_None/TestCorrelation1.bpel (added)
+++ ode/trunk/axis2-war/src/test/resources/TestCleanCorrelation_None/TestCorrelation1.bpel Mon Apr  6 21:53:20 2009
@@ -0,0 +1,85 @@
+<!--
+  ~ 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="TestCorrelation1"
+  targetNamespace="http://ode/bpel/unit-test"
+    xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+    xmlns:tns="http://ode/bpel/unit-test"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:test="http://ode/bpel/unit-test.wsdl"
+    xmlns:dummy="http://axis2.ode.apache.org"
+    queryLanguage="urn:oasis:names:tc:ws2.0:sublang:xpath2.0"
+    expressionLanguage="urn:oasis:names:tc:ws2.0:sublang:xpath2.0">
+  
+  <import location="TestCorrelation1.wsdl"
+    namespace="http://ode/bpel/unit-test/testCorrelation1.wsdl"
+    importType="http://schemas.xmlsoap.org/wsdl/" />
+  
+  <partnerLinks>
+    <partnerLink name="testCorrelation1PL" partnerLinkType="test:testCorrelation1Request" myRole="testCorrelation1Service"/>
+  </partnerLinks>
+  <scope name="scope1">
+    <variables>
+      <variable messageType="test:operation1Request" name="input1"/>
+      <variable messageType="test:operation2Request" name="input2"/>
+      <variable messageType="test:operation3Request" name="input3"/>
+      <variable messageType="test:operation3Response" name="output3"/>
+    </variables>
+    <correlationSets>
+      <correlationSet name="correlationSet1" properties="test:testCorrelation1Variable1"/>
+    </correlationSets>
+    <flow>
+      <sequence>
+        <receive name="receive1" createInstance="yes" operation="operation1" partnerLink="testCorrelation1PL" portType="test:testCorrelation1PT" variable="input1">
+          <correlations>
+            <correlation set="correlationSet1" initiate="yes"></correlation>
+          </correlations>
+        </receive>
+        <scope name="scope2">
+          <correlationSets>
+            <correlationSet name="correlationSet2" properties="test:testCorrelation1Variable1"/>
+         </correlationSets>
+          <flow>
+            <sequence>
+              <receive name="receive2" createInstance="no" operation="operation2" partnerLink="testCorrelation1PL" portType="test:testCorrelation1PT" variable="input2">
+                <correlations>
+                  <correlation set="correlationSet1" initiate="no"></correlation>
+                  <correlation initiate="yes" set="correlationSet2"/>
+                </correlations>
+              </receive>
+              <receive name="receive3" createInstance="no" operation="operation3" partnerLink="testCorrelation1PL" portType="test:testCorrelation1PT" variable="input3">
+                <correlations>
+                  <correlation initiate="no" set="correlationSet2"/>
+                </correlations>
+              </receive>
+              <assign name="assign1">
+                <copy>
+                  <from>$input2.newParameter1/ns0:from</from>
+                  <to part="newParameter2" variable="output3"/>
+                </copy>
+              </assign>
+              <reply name="reply" operation="operation3" partnerLink="testCorrelation1PL" portType="test:testCorrelation1PT" variable="output3"/>
+            </sequence>
+          </flow>
+        </scope>
+      </sequence>
+    </flow>
+  </scope>
+</process>
\ No newline at end of file

Added: ode/trunk/axis2-war/src/test/resources/TestCleanCorrelation_None/TestCorrelation1.wsdl
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestCleanCorrelation_None/TestCorrelation1.wsdl?rev=762523&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestCleanCorrelation_None/TestCorrelation1.wsdl (added)
+++ ode/trunk/axis2-war/src/test/resources/TestCleanCorrelation_None/TestCorrelation1.wsdl Mon Apr  6 21:53:20 2009
@@ -0,0 +1,106 @@
+<!--
+  ~ 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:ns0="http://www.w3schools.com" 
+	xmlns:ns1="http://ode/bpel/unit-test/testCorrelation1.wsdl.types" 
+	xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+	xmlns:prop="http://docs.oasis-open.org/wsbpel/2.0/varprop" 
+    xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype">
+    <wsdl:types>
+        <xsd:schema targetNamespace="http://ode/bpel/unit-test/testCorrelation1.wsdl.types" xmlns="http://ode/bpel/unit-test/testCorrelation1.wsdl.types" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+            <xsd:element name="simpleString" type="xsd:string"/>
+        </xsd:schema>
+        <xs:schema elementFormDefault="qualified" targetNamespace="http://www.w3schools.com" xmlns="http://www.w3schools.com" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+            <xs:element name="note">
+                <xs:complexType>
+                    <xs:sequence>
+                        <xs:element name="to" type="xs:string"/>
+                        <xs:element name="from" type="xs:string"/>
+                        <xs:element name="heading" type="xs:string"/>
+                        <xs:element name="body" type="xs:string"/>
+                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
+
+        </xs:schema>
+    </wsdl:types>
+    <wsdl:message name="operation2Request">
+        <wsdl:part name="newParameter1" element="ns0:note"/>
+    </wsdl:message>
+    <wsdl:message name="operation3Request">
+        <wsdl:part name="newParameter1" element="ns1:simpleString"/>
+    </wsdl:message>
+    <wsdl:message name="operation1Request">
+        <wsdl:part name="newParameter1" type="xsd:string"/>
+    </wsdl:message>
+    <wsdl:message name="operation3Response">
+        <wsdl:part name="newParameter2" type="xsd:string"/>
+    </wsdl:message>
+    <wsdl:portType name="testCorrelation1PT">
+        <wsdl:operation name="operation3">
+            <wsdl:input name="operation3Input" message="tns:operation3Request"/>
+            <wsdl:output name="operation3Output" message="tns:operation3Response"/>
+        </wsdl:operation>
+        <wsdl:operation name="operation2">
+            <wsdl:input name="operation2Input" message="tns:operation2Request"/>
+        </wsdl:operation>
+        <wsdl:operation name="operation1">
+            <wsdl:input name="operation1Input" message="tns:operation1Request"/>
+        </wsdl:operation>
+    </wsdl:portType>
+    <wsdl:binding name="testCorrelation1Binding" type="tns:testCorrelation1PT">
+        <wsdl:operation name="operation3">
+            <wsdl:input name="operation3Input"> </wsdl:input>
+            <wsdl:output name="operation3Output"> </wsdl:output>
+        </wsdl:operation>
+        <wsdl:operation name="operation2">
+            <wsdl:input name="operation2Input"> </wsdl:input>
+        </wsdl:operation>
+        <wsdl:operation name="operation1">
+            <wsdl:input name="operation1Input"> </wsdl:input>
+        </wsdl:operation>
+    </wsdl:binding>
+    <wsdl:service name="testCorrelation1Service">
+        <wsdl:port name="testCorrelation1Port" binding="tns:testCorrelation1Binding">
+        	<soap:address location="http://localhost:8888/ode/processes/helloWorld"/>
+        </wsdl:port>
+    </wsdl:service>
+
+    <plnk:partnerLinkType name="testCorrelation1Request">
+        <plnk:role name="testCorrelation1Service" portType="testCorrelation1PT"/>
+    </plnk:partnerLinkType>
+
+    <prop:property name="testCorrelation1Variable1" type="xsd:string"/>
+    <prop:propertyAlias messageType="tns:operation2Request" part="newParameter1" propertyName="tns:testCorrelation1Variable1">
+        <prop:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">ns0:to</prop:query>
+    </prop:propertyAlias>
+    <prop:propertyAlias messageType="tns:operation3Request" part="newParameter1" propertyName="tns:testCorrelation1Variable1">
+    </prop:propertyAlias>
+    <prop:propertyAlias messageType="tns:operation1Request" part="newParameter1" propertyName="tns:testCorrelation1Variable1">
+    </prop:propertyAlias>
+</wsdl:definitions>

Added: ode/trunk/axis2-war/src/test/resources/TestCleanCorrelation_None/deploy.xml
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestCleanCorrelation_None/deploy.xml?rev=762523&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestCleanCorrelation_None/deploy.xml (added)
+++ ode/trunk/axis2-war/src/test/resources/TestCleanCorrelation_None/deploy.xml Mon Apr  6 21:53:20 2009
@@ -0,0 +1,31 @@
+<!--
+	~ 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/testCorrelation1" 
+	xmlns:wns="http://ode/bpel/unit-test/testCorrelation1.wsdl">
+
+
+	<process name="pns:TestCorrelation1">
+		<active>true</active>
+		<provide partnerLink="testCorrelation1PL">
+			<service name="wns:testCorrelation1Service" port="testCorrelation1Port"/>
+		</provide>
+	</process>
+</deploy>

Added: ode/trunk/axis2-war/src/test/resources/TestCleanCorrelation_None/test1.properties
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestCleanCorrelation_None/test1.properties?rev=762523&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestCleanCorrelation_None/test1.properties (added)
+++ ode/trunk/axis2-war/src/test/resources/TestCleanCorrelation_None/test1.properties Mon Apr  6 21:53:20 2009
@@ -0,0 +1,21 @@
+#
+#    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.
+#
+
+namespace=http://ode/bpel/unit-test/testCorrelation1.wsdl
+service=testCorrelation1Service
+operation=operation1
+request1=<message><newParameter1>To Test</newParameter1></message>
\ No newline at end of file

Added: ode/trunk/axis2-war/src/test/resources/TestCleanCorrelation_None/test2.properties
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestCleanCorrelation_None/test2.properties?rev=762523&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestCleanCorrelation_None/test2.properties (added)
+++ ode/trunk/axis2-war/src/test/resources/TestCleanCorrelation_None/test2.properties Mon Apr  6 21:53:20 2009
@@ -0,0 +1,21 @@
+#
+#    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.
+#
+
+namespace=http://ode/bpel/unit-test/testCorrelation1.wsdl
+service=testCorrelation1Service
+operation=operation2
+request1=<message><newParameter1><tns2:note xmlns:tns2="http://www.w3schools.com"><tns2:to>To Test</tns2:to><tns2:from>From Test</tns2:from><tns2:heading>x</tns2:heading><tns2:body>x</tns2:body></tns2:note></newParameter1></message>
\ No newline at end of file

Added: ode/trunk/axis2-war/src/test/resources/TestCleanCorrelation_None/test3.properties
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestCleanCorrelation_None/test3.properties?rev=762523&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestCleanCorrelation_None/test3.properties (added)
+++ ode/trunk/axis2-war/src/test/resources/TestCleanCorrelation_None/test3.properties Mon Apr  6 21:53:20 2009
@@ -0,0 +1,22 @@
+#
+#    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.
+#
+
+namespace=http://ode/bpel/unit-test/testCorrelation1.wsdl
+service=testCorrelation1Service
+operation=operation3
+request1=<message><newParameter1><ns0:simpleString xmlns:ns0="http://ode/bpel/unit-test/testCorrelation1.wsdl.types">To Test</ns0:simpleString></newParameter1></message>
+response1=.*From Test.*
\ No newline at end of file

Added: ode/trunk/axis2-war/src/test/resources/TestCleanCorrelation_None/testRequest.soap
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestCleanCorrelation_None/testRequest.soap?rev=762523&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestCleanCorrelation_None/testRequest.soap (added)
+++ ode/trunk/axis2-war/src/test/resources/TestCleanCorrelation_None/testRequest.soap Mon Apr  6 21:53:20 2009
@@ -0,0 +1,28 @@
+<?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.
+  -->
+
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
+  <!-- test soap message -->
+  <SOAP-ENV:Body>
+    <ns1:hello xmlns:ns1="http://ode/bpel/unit-test.wsdl">
+        <message><requestMessageData><requestID>Start Test5.1</requestID><requestText>Event Start Test5.1</requestText><requestEnd>no</requestEnd></requestMessageData></message>
+    </ns1:hello>
+  </SOAP-ENV:Body>
+</SOAP-ENV:Envelope>

Added: ode/trunk/axis2-war/src/test/resources/TestCleanFailure/FirstProcess-FirstProcess.bpel
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestCleanFailure/FirstProcess-FirstProcess.bpel?rev=762523&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestCleanFailure/FirstProcess-FirstProcess.bpel (added)
+++ ode/trunk/axis2-war/src/test/resources/TestCleanFailure/FirstProcess-FirstProcess.bpel Mon Apr  6 21:53:20 2009
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpel:process xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:vprop="http://docs.oasis-open.org/wsbpel/2.0/varprop" xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:pnlk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:Client="http://example.com/FirstProcess/Client" xmlns:this="http://example.com/FirstProcess/FirstProcess" xmlns:TimeServer="http://example.com/FirstProcess/TimeServer" xmlns:TimeService="http://ws.intalio.com/TimeService/" xmlns:diag="http://example.com/FirstProcess" xmlns:ns="http://bpms.intalio.com/FirstProcess/Time" xmlns:bpmn="http://www.intalio.com/bpms" xmlns:atomic="http://ode.apache.org/atomicScope" queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0" expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0" bpmn:label="FirstProcess" bpmn:id="_MmE9YDEV
 EdyJMOclT3liPQ" name="FirstProcess" targetNamespace="http://example.com/FirstProcess/FirstProcess">
+  <bpel:import namespace="http://example.com/FirstProcess" location="FirstProcess.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/>
+  <bpel:import namespace="http://example.com/FirstProcess/FirstProcess" location="FirstProcess-FirstProcess.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/>
+  <bpel:import namespace="http://ws.intalio.com/TimeService/" location="TimeService.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/>
+  <bpel:partnerLinks>
+    <bpel:partnerLink name="firstProcessAndClientPlkVar" partnerLinkType="diag:FirstProcessAndClient" myRole="FirstProcess_for_Client"/>
+    <bpel:partnerLink name="timeServerAndFirstProcessForPortTimeServiceSoapPlkVar" partnerLinkType="diag:TimeServerAndFirstProcessForPortTimeServiceSoapPlk" initializePartnerRole="true" partnerRole="TimeServer_for_FirstProcess"/>
+  </bpel:partnerLinks>
+  <bpel:variables>
+    <bpel:variable name="timeServiceGetCityTimeResponseMsg" messageType="TimeService:getCityTimeSoapOut"/>
+    <bpel:variable name="timeServiceGetCityTimeRequestMsg" messageType="TimeService:getCityTimeSoapIn"/>
+    <bpel:variable name="timeServiceGetUTCTimeResponseMsg" messageType="TimeService:getUTCTimeSoapOut"/>
+    <bpel:variable name="timeServiceGetUTCTimeRequestMsg" messageType="TimeService:getUTCTimeSoapIn"/>
+    <bpel:variable name="thisEventStartMessageRequest" messageType="this:EventStartMessageRequest"/>
+    <bpel:variable name="thisEventStartMessageResponse" messageType="this:EventStartMessageResponse"/>
+  </bpel:variables>
+  <bpel:sequence>
+    <bpel:receive partnerLink="firstProcessAndClientPlkVar" portType="this:ForClient" operation="EventStartMessage" variable="thisEventStartMessageRequest" createInstance="yes" bpmn:label="EventStartMessage" bpmn:id="_PodJQDEVEdyJMOclT3liPQ"></bpel:receive>
+    <bpel:assign name="init-variables-FirstProcess">
+      <bpel:copy bpmn:label="$timeServiceGetCityTimeRequestMsg">
+        <bpel:from>
+          <bpel:literal>
+<TimeService:getCityTime>
+  <TimeService:city></TimeService:city>
+</TimeService:getCityTime></bpel:literal>
+        </bpel:from>
+        <bpel:to>$timeServiceGetCityTimeRequestMsg.parameters</bpel:to>
+      </bpel:copy>
+      <bpel:copy bpmn:label="$timeServiceGetUTCTimeRequestMsg">
+        <bpel:from>
+          <bpel:literal>
+<TimeService:getUTCTime></TimeService:getUTCTime></bpel:literal>
+        </bpel:from>
+        <bpel:to>$timeServiceGetUTCTimeRequestMsg.parameters</bpel:to>
+      </bpel:copy>
+      <bpel:copy bpmn:label="$thisEventStartMessageResponse">
+        <bpel:from>
+          <bpel:literal>
+<ns:TimeResponse>
+  <ns:UTCTime></ns:UTCTime>
+  <ns:cityTime></ns:cityTime>
+</ns:TimeResponse></bpel:literal>
+        </bpel:from>
+        <bpel:to>$thisEventStartMessageResponse.body</bpel:to>
+      </bpel:copy>
+    </bpel:assign>
+    <bpel:invoke partnerLink="timeServerAndFirstProcessForPortTimeServiceSoapPlkVar" portType="TimeService:TimeServiceSoap" operation="getUTCTime" inputVariable="timeServiceGetUTCTimeRequestMsg" outputVariable="timeServiceGetUTCTimeResponseMsg" bpmn:label="getUTCTime" bpmn:id="_dyOQkDEmEdyJMOclT3liPQ"></bpel:invoke>
+    <bpel:assign bpmn:label="getCityTime" bpmn:id="_SsKx4DEVEdyJMOclT3liPQ">
+      <bpel:copy>
+        <bpel:from>$thisEventStartMessageRequest.body/ns:city</bpel:from>
+        <bpel:to>$timeServiceGetCityTimeRequestMsg.parameters/TimeService:city</bpel:to>
+      </bpel:copy>
+    </bpel:assign>
+    <bpel:invoke partnerLink="timeServerAndFirstProcessForPortTimeServiceSoapPlkVar" portType="TimeService:TimeServiceSoap" operation="getCityTime" inputVariable="timeServiceGetCityTimeRequestMsg" outputVariable="timeServiceGetCityTimeResponseMsg" bpmn:label="getCityTime" bpmn:id="_SsKx4DEVEdyJMOclT3liPQ"></bpel:invoke>
+    <bpel:assign bpmn:label="EventEndMessage" bpmn:id="_UAjK4DEVEdyJMOclT3liPQ">
+      <bpel:copy>
+        <bpel:from>$timeServiceGetCityTimeResponseMsg.parameters/TimeService:getCityTimeResult</bpel:from>
+        <bpel:to>$thisEventStartMessageResponse.body/ns:cityTime</bpel:to>
+      </bpel:copy>
+      <bpel:copy>
+        <bpel:from>$timeServiceGetUTCTimeResponseMsg.parameters/TimeService:getUTCTimeResult</bpel:from>
+        <bpel:to>$thisEventStartMessageResponse.body/ns:UTCTime</bpel:to>
+      </bpel:copy>
+    </bpel:assign>
+    <bpel:reply partnerLink="firstProcessAndClientPlkVar" portType="this:ForClient" operation="EventStartMessage" variable="thisEventStartMessageResponse" bpmn:label="EventEndMessage" bpmn:id="_UAjK4DEVEdyJMOclT3liPQ"></bpel:reply>
+  </bpel:sequence>
+</bpel:process>
\ No newline at end of file