Author: davsclaus
Date: Thu Sep 15 08:44:54 2011
New Revision: 1171007

URL: http://svn.apache.org/viewvc?rev=1171007&view=rev
Log:
CAMEL-3742: Fixed tests. Must use ant task for OpenJPA enhancement to better 
control what happens

Modified:
    camel/trunk/components/camel-jpa/pom.xml

Modified: camel/trunk/components/camel-jpa/pom.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-jpa/pom.xml?rev=1171007&r1=1171006&r2=1171007&view=diff
==============================================================================
--- camel/trunk/components/camel-jpa/pom.xml (original)
+++ camel/trunk/components/camel-jpa/pom.xml Thu Sep 15 08:44:54 2011
@@ -105,26 +105,64 @@
 
     <build>
         <plugins>
-            <!-- lets enhance the classes for OpenJPA (shame it can't do it at 
runtime!) -->
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>openjpa-maven-plugin</artifactId>
-                <version>1.2</version>
-                <configuration>
-                    <includes>org/apache/camel/examples/*.class</includes>
-                    <addDefaultConstructor>true</addDefaultConstructor>
-                    
<enforcePropertyRestrictions>true</enforcePropertyRestrictions>
-                </configuration>
-                <executions>
-                    <execution>
-                        <id>enhancer</id>
-                        <phase>process-test-classes</phase>
-                        <goals>
-                            <goal>test-enhance</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
+
+      <!-- lets enhance the classes for OpenJPA (shame it can't do it at 
runtime!) -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <dependencies>
+          <dependency>
+            <groupId>org.apache.openjpa</groupId>
+            <artifactId>openjpa-persistence-jdbc</artifactId>
+            <version>${openjpa-version}</version>
+          </dependency>
+        </dependencies>
+
+        <executions>
+          <execution>
+            <phase>process-test-classes</phase>
+            <configuration>
+              <tasks>
+                <path id="cp">
+                  <path refid="maven.test.classpath" />
+                  <path refid="maven.compile.classpath" />
+                  <path refid="maven.dependency.classpath" />
+                </path>
+                <taskdef name="openjpac" 
classname="org.apache.openjpa.ant.PCEnhancerTask">
+                  <classpath refid="cp" />
+                </taskdef>
+
+                <mkdir dir="${basedir}/target/jpa-test-classes" />
+
+                <openjpac directory="${basedir}/target/jpa-test-classes">
+                  <classpath refid="cp" />
+                    <fileset dir="${basedir}/target/classes">
+                      <include 
name="org/apache/camel/processor/**/MessageProcessed.class" />
+                      <include 
name="org/apache/camel/processor/**/JpaTraceEventMessage.class" />
+                    </fileset>
+                  <config 
propertiesFile="${basedir}/src/test/resources/META-INF/persistence.xml" />
+                </openjpac>
+
+                <openjpac directory="${basedir}/target/jpa-test-classes">
+                  <classpath refid="cp" />
+                    <fileset dir="${basedir}/target/test-classes">
+                      <include name="org/apache/camel/examples/*.class" />
+                    </fileset>
+                  <config 
propertiesFile="${basedir}/src/test/resources/META-INF/persistence.xml" />
+                </openjpac>
+
+                <copy overwrite="true" todir="${basedir}/target/test-classes">
+                  <fileset dir="${basedir}/target/jpa-test-classes" />
+                </copy>
+              </tasks>
+            </configuration>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
         </plugins>
     </build>
 </project>


Reply via email to