You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by ms...@apache.org on 2007/01/02 20:21:24 UTC

svn commit: r491904 - in /incubator/ode/trunk/bpel-test: build.xml pom.xml src/test/java/org/apache/ode/test/BPELTest.java

Author: mszefler
Date: Tue Jan  2 11:21:23 2007
New Revision: 491904

URL: http://svn.apache.org/viewvc?view=rev&rev=491904
Log:
Some things that were missed in the test scheduler fix.
Fixed bpel-test pom.

Modified:
    incubator/ode/trunk/bpel-test/build.xml
    incubator/ode/trunk/bpel-test/pom.xml
    incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTest.java

Modified: incubator/ode/trunk/bpel-test/build.xml
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/build.xml?view=diff&rev=491904&r1=491903&r2=491904
==============================================================================
--- incubator/ode/trunk/bpel-test/build.xml (original)
+++ incubator/ode/trunk/bpel-test/build.xml Tue Jan  2 11:21:23 2007
@@ -25,8 +25,8 @@
     <property name="derby.target.sql" value="${database.dir}/derby.sql" />
 
 
-    <target name="db" >
-        <delete dir="${database.dir}"/>
+    <target name="db" >
+        <delete dir="${database.dir}"/>
         <mkdir dir="${database.dir}"/>
         <antcall inheritRefs="true" target="gen-schemas" />
         <sql driver="org.apache.derby.jdbc.EmbeddedDriver"
@@ -41,7 +41,7 @@
     <target name="gen-schemas">
         <java classname="org.apache.openjpa.jdbc.meta.MappingTool">
             <arg line="-p ${descriptors.dir}/persistence.xml"/>
-            <arg line="-sa build"/>
+            <arg line="-sa build"/>
             <arg line="-fk true"/>
             <arg line="-sql ${derby.target.sql}"/>
             <classpath>

Modified: incubator/ode/trunk/bpel-test/pom.xml
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/pom.xml?view=diff&rev=491904&r1=491903&r2=491904
==============================================================================
--- incubator/ode/trunk/bpel-test/pom.xml (original)
+++ incubator/ode/trunk/bpel-test/pom.xml Tue Jan  2 11:21:23 2007
@@ -1,34 +1,34 @@
-<?xml version="1.0"?>
-<!--
-  ~ 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.
-  -->
-<project>
-    <groupId>org.apache.ode</groupId>
-    <artifactId>ode-test</artifactId>
-    <name>ODE :: BPEL Tests</name>
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.ode</groupId>
-        <artifactId>ode</artifactId>
-        <version>2.0-SNAPSHOT</version>
-    </parent>
-    <version>2.0-SNAPSHOT</version>
-    <build>
+<?xml version="1.0"?>
+<!--
+  ~ 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.
+  -->
+<project>
+    <groupId>org.apache.ode</groupId>
+    <artifactId>ode-test</artifactId>
+    <name>ODE :: BPEL Tests</name>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.ode</groupId>
+        <artifactId>ode</artifactId>
+        <version>2.0-SNAPSHOT</version>
+    </parent>
+    <version>2.0-SNAPSHOT</version>
+    <build>
         <plugins>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
@@ -37,36 +37,40 @@
                 <configuration>
                     <useProjectReferences>false</useProjectReferences>
                 </configuration>
-            </plugin>
+            </plugin>
 
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-antrun-plugin</artifactId>
-                <version>1.0</version>
-                <executions>
+                <version>1.0</version>
+                <executions>
+                    <!-- This is causing a problem, file not found derby.sql
+                         Let's move this into a separate test module. -Maciej1/2/07 
                     <execution>
                         <id>Generate Derby DB</id>
                         <phase>compile</phase>
+
+                             
                         <configuration>
                             <tasks>
                                 <ant antfile="build.xml" target="db" inheritRefs="true"/>
                             </tasks>
-                        </configuration>
+                        </configuration>
                         <goals>
                             <goal>run</goal>
                         </goals>
                     </execution>
+                    -->
 
-
-                    <!-- Having some problems with this because the embedded DB is created
+                    <!-- Having some problems with this because the embedded DB is created
                         relative to the build path - see persistent.xml URL
                     <execution>
                         <phase>compile</phase>
                         <id>OpenJPA Mapping Tool</id>
                         <configuration>
                             <tasks>
-                                <java classname="org.apache.openjpa.jdbc.meta.MappingTool">
-                                    <arg line="-p ${basedir}/src/test/resources/META-INF/persistence.xml"/>
+                                <java classname="org.apache.openjpa.jdbc.meta.MappingTool">
+                                    <arg line="-p ${basedir}/src/test/resources/META-INF/persistence.xml"/>
                                     <arg line="-a buildSchema"/>
                                     <arg line="-fk true"/>
                                     <classpath>
@@ -78,36 +82,41 @@
                         <goals>
                             <goal>run</goal>
                         </goals>
-                    </execution>
+                    </execution>
                     -->
                 </executions>
 
-            </plugin>
+            </plugin>
 
         </plugins>
     </build>
 
-    <dependencies>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <version>3.8.1</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.ode</groupId>
-            <artifactId>ode-bpel-runtime</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.ode</groupId>
-            <artifactId>ode-bpel-store</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.ode</groupId>
-            <artifactId>ode-dao-jpa-ojpa-derby</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
-    </dependencies>
-</project>
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>3.8.1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.ode</groupId>
+            <artifactId>ode-bpel-runtime</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.ode</groupId>
+            <artifactId>ode-bpel-store</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.ode</groupId>
+            <artifactId>ode-dao-jpa-ojpa-derby</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+<dependency>
+                <groupId>org.apache.derby</groupId>
+                <artifactId>derby</artifactId>
+            </dependency>
+
+
+    </dependencies>
+</project>

Modified: incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTest.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTest.java?view=diff&rev=491904&r1=491903&r2=491904
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTest.java (original)
+++ incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTest.java Tue Jan  2 11:21:23 2007
@@ -18,25 +18,32 @@
  */
 package org.apache.ode.test;
 
+import java.io.File;
+import java.util.Collection;
+import java.util.Properties;
+import java.util.regex.Pattern;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+import javax.xml.namespace.QName;
+
 import junit.framework.TestCase;
+
 import org.apache.ode.bpel.engine.BpelServerImpl;
-import org.apache.ode.bpel.iapi.*;
+import org.apache.ode.bpel.iapi.BpelEngineException;
+import org.apache.ode.bpel.iapi.Message;
+import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
+import org.apache.ode.bpel.iapi.ProcessStore;
+import org.apache.ode.bpel.iapi.ProcessStoreEvent;
+import org.apache.ode.bpel.iapi.ProcessStoreListener;
+import org.apache.ode.bpel.iapi.Scheduler;
 import org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl;
-import org.apache.ode.dao.jpa.ojpa.BPELDAOConnectionFactoryImpl;
 import org.apache.ode.store.ProcessStoreImpl;
 import org.apache.ode.test.scheduler.TestScheduler;
 import org.apache.ode.utils.DOMUtils;
 import org.w3c.dom.Element;
 
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Persistence;
-import javax.xml.namespace.QName;
-import java.io.File;
-import java.util.Collection;
-import java.util.Properties;
-import java.util.regex.Pattern;
-
 public abstract class BPELTest extends TestCase {
 
 	private BpelServerImpl server;
@@ -44,6 +51,7 @@
 	private MessageExchangeContextImpl mexContext;
 	private EntityManager em;
 	private EntityManagerFactory emf;
+    private TestScheduler scheduler;
 
 	@Override
 	protected void setUp() throws Exception {
@@ -56,11 +64,26 @@
 			em = emf.createEntityManager();
 			String pr = Persistence.PERSISTENCE_PROVIDER;
 			server.setDaoConnectionFactory(new org.apache.ode.dao.jpa.ojpa.BPELDAOConnectionFactoryImpl(em));
+            scheduler = new TestScheduler() {
+                @Override
+                public void begin() {
+                    super.begin();
+                    em.getTransaction().begin();
+                }
+
+                @Override
+                public void commit() {
+                    super.commit();
+                    em.getTransaction().commit();
+                }
+                
+            };
 		} else {
 			server.setDaoConnectionFactory(new BpelDAOConnectionFactoryImpl());
+            scheduler = new TestScheduler();
 		}
         server.setInMemDaoConnectionFactory(new BpelDAOConnectionFactoryImpl());
-        server.setScheduler(new TestScheduler());
+        server.setScheduler(scheduler);
 		server.setBindingContext(new BindingContextImpl());
 		server.setMessageExchangeContext(mexContext);
         store = new ProcessStoreImpl();
@@ -118,7 +141,7 @@
 			}
 		}
 
-		if ( em != null ) em.getTransaction().begin();
+		scheduler.begin();
 		try {
 			Collection<QName> procs =  store.deploy(new File(deployDir));
             for (QName procName : procs) {
@@ -135,11 +158,11 @@
 			e.printStackTrace();
 			fail();
 		}
-		if ( em != null ) em.getTransaction().commit();
+		scheduler.commit();
         
 		while (testPropsFile.exists()) {
 
-			if ( em != null ) em.getTransaction().begin();
+			scheduler.begin();
 			
 			Properties testProps = new Properties();
 			testProps.load(testPropsFile.toURL().openStream());
@@ -241,7 +264,7 @@
 			propsFileCnt++;
 			testPropsFile = new File(deployDir + "/test" + propsFileCnt
 					+ ".properties");
-			if ( em != null ) em.getTransaction().commit();
+			scheduler.commit();
 		}
 	}