You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2017/06/22 17:05:54 UTC
[2/4] camel git commit: CAMEL-11404: Add Hibernate test profile to
camel-jpa
CAMEL-11404: Add Hibernate test profile to camel-jpa
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/22ffa47b
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/22ffa47b
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/22ffa47b
Branch: refs/heads/master
Commit: 22ffa47b3bec9ea7256d11f59a69d0dea71f9a3f
Parents: 7762e67
Author: James Netherton <ja...@gmail.com>
Authored: Tue Jun 20 14:05:20 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jun 22 19:05:44 2017 +0200
----------------------------------------------------------------------
components/camel-jpa/pom.xml | 187 +++++++++++--------
.../component/jpa/AbstractJpaMethodTest.java | 12 +-
.../camel/component/jpa/JpaUsePersistTest.java | 55 +++---
.../component/jpa/JpaWithNamedQueryTest.java | 7 +-
.../java/org/apache/camel/examples/Order.java | 64 +++++++
.../jpa/JpaRouteSharedEntityManagerTest.java | 11 +-
.../src/test/resources/META-INF/persistence.xml | 7 +-
.../jpa/springJpaRouteSkipLockedTest.xml | 3 -
.../profiles/hibernate/META-INF/persistence.xml | 96 ++++++++++
.../camel/itest/springboot/CamelJpaTest.java | 4 +
10 files changed, 335 insertions(+), 111 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/22ffa47b/components/camel-jpa/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-jpa/pom.xml b/components/camel-jpa/pom.xml
index 09748e8..6a08296 100644
--- a/components/camel-jpa/pom.xml
+++ b/components/camel-jpa/pom.xml
@@ -82,17 +82,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa-persistence-jdbc</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jpa_2.0_spec</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<scope>test</scope>
@@ -101,7 +90,7 @@
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<scope>test</scope>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
@@ -124,69 +113,121 @@
</dependency>
</dependencies>
- <build>
- <pluginManagement>
- <plugins>
- <!-- Eclipse m2e Lifecycle Management -->
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>${lifecycle-mapping-version}</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa-maven-plugin</artifactId>
- <versionRange>${openjpa-version}</versionRange>
- <goals>
- <goal>enhance</goal>
- <goal>test-enhance</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore />
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa-maven-plugin</artifactId>
- <version>${openjpa-version}</version>
- <configuration>
- <persistenceXmlFile>${project.basedir}/src/test/resources/META-INF/persistence.xml</persistenceXmlFile>
- <includes>org/apache/camel/examples/*.class</includes>
- <addDefaultConstructor>true</addDefaultConstructor>
- <enforcePropertyRestrictions>true</enforcePropertyRestrictions>
- </configuration>
- <executions>
- <execution>
- <id>test enhancer</id>
- <phase>process-test-classes</phase>
- <goals>
- <goal>test-enhance</goal>
- </goals>
- </execution>
- </executions>
- <dependencies>
- <dependency>
+ <profiles>
+ <profile>
+ <id>openjpa</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <!-- Eclipse m2e Lifecycle Management -->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>${lifecycle-mapping-version}</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-maven-plugin</artifactId>
+ <versionRange>${openjpa-version}</versionRange>
+ <goals>
+ <goal>enhance</goal>
+ <goal>test-enhance</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore />
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
<groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa</artifactId>
+ <artifactId>openjpa-maven-plugin</artifactId>
<version>${openjpa-version}</version>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
-
- <profiles>
+ <configuration>
+ <persistenceXmlFile>${project.basedir}/src/test/resources/META-INF/persistence.xml</persistenceXmlFile>
+ <includes>org/apache/camel/examples/*.class</includes>
+ <addDefaultConstructor>true</addDefaultConstructor>
+ <enforcePropertyRestrictions>true</enforcePropertyRestrictions>
+ </configuration>
+ <executions>
+ <execution>
+ <id>test enhancer</id>
+ <phase>process-test-classes</phase>
+ <goals>
+ <goal>test-enhance</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa</artifactId>
+ <version>${openjpa-version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-persistence-jdbc</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jpa_2.0_spec</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>hibernate</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-hibernate-persistence-xml</id>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <phase>generate-test-resources</phase>
+ <configuration>
+ <resources>
+ <resource>
+ <directory>${project.basedir}/src/test/resources/profiles/hibernate/META-INF</directory>
+ </resource>
+ </resources>
+ <outputDirectory>${project.build.testOutputDirectory}/META-INF</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
<profile>
<id>java9</id>
<activation>
http://git-wip-us.apache.org/repos/asf/camel/blob/22ffa47b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/AbstractJpaMethodTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/AbstractJpaMethodTest.java b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/AbstractJpaMethodTest.java
index cf95e519..3129249 100644
--- a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/AbstractJpaMethodTest.java
+++ b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/AbstractJpaMethodTest.java
@@ -112,7 +112,10 @@ public abstract class AbstractJpaMethodTest extends CamelTestSupport {
final Customer customer = createDefaultCustomer();
save(customer);
-
+
+ assertEntitiesInDatabase(1, Customer.class.getName());
+ assertEntitiesInDatabase(1, Address.class.getName());
+
final CountDownLatch latch = new CountDownLatch(1);
consumer = endpoint.createConsumer(new Processor() {
@@ -162,18 +165,15 @@ public abstract class AbstractJpaMethodTest extends CamelTestSupport {
assertEntitiesInDatabase(0, Address.class.getName());
}
- protected void save(final Customer customer) {
+ protected void save(final Object persistable) {
transactionTemplate.execute(new TransactionCallback<Object>() {
public Object doInTransaction(TransactionStatus status) {
entityManager.joinTransaction();
- entityManager.persist(customer);
+ entityManager.persist(persistable);
entityManager.flush();
return null;
}
});
-
- assertEntitiesInDatabase(1, Customer.class.getName());
- assertEntitiesInDatabase(1, Address.class.getName());
}
protected void assertEntitiesInDatabase(int count, String entity) {
http://git-wip-us.apache.org/repos/asf/camel/blob/22ffa47b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaUsePersistTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaUsePersistTest.java b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaUsePersistTest.java
index 657895f..e2e0942 100644
--- a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaUsePersistTest.java
+++ b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaUsePersistTest.java
@@ -16,43 +16,52 @@
*/
package org.apache.camel.component.jpa;
-import org.apache.camel.examples.Address;
-import org.apache.camel.examples.Customer;
+import javax.persistence.PersistenceException;
+
+import org.apache.camel.examples.Order;
+import org.hamcrest.CoreMatchers;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
/**
* @version
*/
public class JpaUsePersistTest extends AbstractJpaMethodTest {
-
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
public boolean usePersist() {
return true;
}
@Test
public void produceExistingEntityShouldThrowAnException() throws Exception {
- setUp("jpa://" + Customer.class.getName() + "?usePersist=true");
+ setUp("jpa://" + Order.class.getName() + "?usePersist=true");
- Customer customer = createDefaultCustomer();
- save(customer);
- long id = customer.getId();
+ Order order = createOrder();
+ save(order);
// and adjust some values
- customer = createDefaultCustomer();
- customer.setId(id);
- customer.setName("Max Mustermann");
- customer.getAddress().setAddressLine1("Musterstr. 1");
- customer.getAddress().setAddressLine2("11111 Enterhausen");
-
- try {
- // we cannot store the 2nd customer as its using the same id as the 1st
- template.requestBody(endpoint, customer);
- fail("Should throw exception");
- } catch (Exception e) {
- // expected
- }
-
- assertEntitiesInDatabase(1, Customer.class.getName());
- assertEntitiesInDatabase(1, Address.class.getName());
+ order = createOrder();
+ order.setProductName("Cheese");
+ order.setProductSku("54321");
+ order.setQuantity(2);
+
+ // we cannot store the 2nd order as its using the same id as the 1st
+ expectedException.expectCause(CoreMatchers.instanceOf(PersistenceException.class));
+ template.requestBody(endpoint, order);
+
+ assertEntitiesInDatabase(1, Order.class.getName());
+ }
+
+ private Order createOrder() {
+ Order order = new Order();
+ order.setId(1L);
+ order.setProductName("Beer");
+ order.setProductSku("12345");
+ order.setQuantity(5);
+ return order;
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/22ffa47b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java
index e91dac6..0e66265 100644
--- a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java
+++ b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java
@@ -113,7 +113,10 @@ public class JpaWithNamedQueryTest extends Assert {
transactionTemplate.execute(new TransactionCallback<Object>() {
public Object doInTransaction(TransactionStatus status) {
// make use of the EntityManager having the relevant persistence-context
- EntityManager entityManager2 = receivedExchange.getIn().getHeader(JpaConstants.ENTITYMANAGER, EntityManager.class);
+ EntityManager entityManager2 = receivedExchange.getIn().getHeader(JpaConstants.ENTITY_MANAGER, EntityManager.class);
+ if (!entityManager2.isOpen()) {
+ entityManager2 = endpoint.getEntityManagerFactory().createEntityManager();
+ }
entityManager2.joinTransaction();
// now lets assert that there are still 2 entities left
@@ -169,7 +172,7 @@ public class JpaWithNamedQueryTest extends Assert {
endpoint = (JpaEndpoint)value;
transactionTemplate = endpoint.createTransactionTemplate();
- entityManager = endpoint.createEntityManager();
+ entityManager = endpoint.getEntityManagerFactory().createEntityManager();
}
protected String getEndpointUri() {
http://git-wip-us.apache.org/repos/asf/camel/blob/22ffa47b/components/camel-jpa/src/test/java/org/apache/camel/examples/Order.java
----------------------------------------------------------------------
diff --git a/components/camel-jpa/src/test/java/org/apache/camel/examples/Order.java b/components/camel-jpa/src/test/java/org/apache/camel/examples/Order.java
new file mode 100644
index 0000000..1ec16f2
--- /dev/null
+++ b/components/camel-jpa/src/test/java/org/apache/camel/examples/Order.java
@@ -0,0 +1,64 @@
+/**
+ * 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.camel.examples;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "orders")
+public class Order {
+
+ @Id
+ private Long id;
+ private String productName;
+ private String productSku;
+ private Integer quantity;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getProductName() {
+ return productName;
+ }
+
+ public void setProductName(String productName) {
+ this.productName = productName;
+ }
+
+ public String getProductSku() {
+ return productSku;
+ }
+
+ public void setProductSku(String productSku) {
+ this.productSku = productSku;
+ }
+
+ public Integer getQuantity() {
+ return quantity;
+ }
+
+ public void setQuantity(Integer quantity) {
+ this.quantity = quantity;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/22ffa47b/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaRouteSharedEntityManagerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaRouteSharedEntityManagerTest.java b/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaRouteSharedEntityManagerTest.java
index c534da1..ebcfaa0 100644
--- a/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaRouteSharedEntityManagerTest.java
+++ b/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaRouteSharedEntityManagerTest.java
@@ -26,6 +26,8 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.examples.SendEmail;
import org.apache.camel.spring.SpringRouteBuilder;
+import org.apache.camel.util.ObjectHelper;
+import org.junit.Assume;
import org.junit.Test;
import org.springframework.context.expression.BeanFactoryResolver;
import org.springframework.expression.Expression;
@@ -41,7 +43,14 @@ import static org.hamcrest.CoreMatchers.equalTo;
public class JpaRouteSharedEntityManagerTest extends AbstractJpaTest {
protected static final String SELECT_ALL_STRING = "select x from " + SendEmail.class.getName() + " x";
private CountDownLatch latch = new CountDownLatch(1);
-
+
+ @Override
+ public void setUp() throws Exception {
+ // Don't run on Hibernate
+ Assume.assumeTrue(ObjectHelper.loadClass("org.hibernate.Hibernate") == null);
+ super.setUp();
+ }
+
@Test
public void testRouteJpaShared() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
http://git-wip-us.apache.org/repos/asf/camel/blob/22ffa47b/components/camel-jpa/src/test/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/components/camel-jpa/src/test/resources/META-INF/persistence.xml b/components/camel-jpa/src/test/resources/META-INF/persistence.xml
index 89c5a8b..acd8de6 100644
--- a/components/camel-jpa/src/test/resources/META-INF/persistence.xml
+++ b/components/camel-jpa/src/test/resources/META-INF/persistence.xml
@@ -17,11 +17,11 @@
limitations under the License.
-->
-<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- version="2.0"
+ version="2.1"
xsi:schemaLocation="
- http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
+ http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="camel" transaction-type="RESOURCE_LOCAL">
<!--
@@ -38,6 +38,7 @@
<class>org.apache.camel.examples.SendEmail</class>
<class>org.apache.camel.examples.Customer</class>
<class>org.apache.camel.examples.Address</class>
+ <class>org.apache.camel.examples.Order</class>
<properties>
<property name="openjpa.ConnectionURL" value="jdbc:derby:target/derby;create=true"/>
http://git-wip-us.apache.org/repos/asf/camel/blob/22ffa47b/components/camel-jpa/src/test/resources/org/apache/camel/processor/jpa/springJpaRouteSkipLockedTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-jpa/src/test/resources/org/apache/camel/processor/jpa/springJpaRouteSkipLockedTest.xml b/components/camel-jpa/src/test/resources/org/apache/camel/processor/jpa/springJpaRouteSkipLockedTest.xml
index 2731aee..6ba4c2d 100644
--- a/components/camel-jpa/src/test/resources/org/apache/camel/processor/jpa/springJpaRouteSkipLockedTest.xml
+++ b/components/camel-jpa/src/test/resources/org/apache/camel/processor/jpa/springJpaRouteSkipLockedTest.xml
@@ -30,9 +30,6 @@
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
<property name="persistenceUnitName" value="skipLockedEntiy"/>
- <!--property name="jpaDialect">
- <bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect" />
- </property-->
</bean>
<bean class="org.apache.camel.component.jpa.JpaComponent" id="jpa">
http://git-wip-us.apache.org/repos/asf/camel/blob/22ffa47b/components/camel-jpa/src/test/resources/profiles/hibernate/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/components/camel-jpa/src/test/resources/profiles/hibernate/META-INF/persistence.xml b/components/camel-jpa/src/test/resources/profiles/hibernate/META-INF/persistence.xml
new file mode 100644
index 0000000..83b1ffd
--- /dev/null
+++ b/components/camel-jpa/src/test/resources/profiles/hibernate/META-INF/persistence.xml
@@ -0,0 +1,96 @@
+<?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.
+
+-->
+<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ version="2.1"
+ xsi:schemaLocation="
+ http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
+
+ <persistence-unit name="camel" transaction-type="RESOURCE_LOCAL">
+ <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
+
+ <class>org.apache.camel.examples.MultiSteps</class>
+ <class>org.apache.camel.examples.SendEmail</class>
+ <class>org.apache.camel.examples.Customer</class>
+ <class>org.apache.camel.examples.Address</class>
+ <class>org.apache.camel.examples.Order</class>
+
+ <properties>
+ <property name="hibernate.dialect" value="org.hibernate.dialect.DerbyTenSevenDialect"/>
+ <property name="hibernate.connection.driver_class" value="org.apache.derby.jdbc.EmbeddedDriver"/>
+ <property name="hibernate.connection.url" value="jdbc:derby:target/derby;create=true"/>
+ <property name="hibernate.hbm2ddl.auto" value="create"/>
+ </properties>
+ </persistence-unit>
+
+ <persistence-unit name="custom" transaction-type="RESOURCE_LOCAL">
+ <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
+
+ <class>org.apache.camel.examples.MultiSteps</class>
+ <class>org.apache.camel.examples.SendEmail</class>
+
+ <properties>
+ <property name="hibernate.dialect" value="org.hibernate.dialect.DerbyTenSevenDialect"/>
+ <property name="hibernate.connection.driver_class" value="org.apache.derby.jdbc.EmbeddedDriver"/>
+ <property name="hibernate.connection.url" value="jdbc:derby:target/custom;create=true"/>
+ <property name="hibernate.hbm2ddl.auto" value="create"/>
+ </properties>
+ </persistence-unit>
+
+ <persistence-unit name="idempotentDb" transaction-type="RESOURCE_LOCAL">
+ <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
+
+ <class>org.apache.camel.processor.idempotent.jpa.MessageProcessed</class>
+
+ <properties>
+ <property name="hibernate.dialect" value="org.hibernate.dialect.DerbyTenSevenDialect"/>
+ <property name="hibernate.connection.driver_class" value="org.apache.derby.jdbc.EmbeddedDriver"/>
+ <property name="hibernate.connection.url" value="jdbc:derby:target/idempotentTest;create=true"/>
+ <property name="hibernate.hbm2ddl.auto" value="create"/>
+ </properties>
+ </persistence-unit>
+
+ <persistence-unit name="trace" transaction-type="RESOURCE_LOCAL">
+ <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
+
+ <class>org.apache.camel.processor.interceptor.jpa.JpaTraceEventMessage</class>
+
+ <properties>
+ <property name="hibernate.dialect" value="org.hibernate.dialect.DerbyTenSevenDialect"/>
+ <property name="hibernate.connection.driver_class" value="org.apache.derby.jdbc.EmbeddedDriver"/>
+ <property name="hibernate.connection.url" value="jdbc:derby:target/trace;create=true"/>
+ <property name="hibernate.hbm2ddl.auto" value="create"/>
+ </properties>
+ </persistence-unit>
+
+ <persistence-unit name="skipLockedEntiy" transaction-type="RESOURCE_LOCAL">
+ <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
+
+ <class>org.apache.camel.examples.VersionedItem</class>
+
+ <properties>
+ <property name="hibernate.dialect" value="org.hibernate.dialect.DerbyTenSevenDialect"/>
+ <property name="hibernate.connection.driver_class" value="org.apache.derby.jdbc.EmbeddedDriver"/>
+ <property name="hibernate.connection.url" value="jdbc:derby:target/derby;create=true"/>
+ <property name="hibernate.hbm2ddl.auto" value="create"/>
+ </properties>
+ </persistence-unit>
+
+</persistence>
http://git-wip-us.apache.org/repos/asf/camel/blob/22ffa47b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelJpaTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelJpaTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelJpaTest.java
index 467c47a..c033883 100644
--- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelJpaTest.java
+++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelJpaTest.java
@@ -17,6 +17,7 @@
package org.apache.camel.itest.springboot;
import org.apache.camel.itest.springboot.util.ArquillianPackager;
+import org.apache.camel.itest.springboot.util.DependencyResolver;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.Archive;
@@ -35,6 +36,9 @@ public class CamelJpaTest extends AbstractSpringBootTestSupport {
public static ITestConfig createTestConfig() {
return new ITestConfigBuilder()
.module(inferModuleName(CamelJpaTest.class))
+ .dependency("org.apache.openjpa:openjpa:" + DependencyResolver.resolveParentProperty("${openjpa-version}"))
+ .dependency("org.apache.openjpa:openjpa-persistence-jdbc")
+ .exclusion("org.apache.geronimo.specs:geronimo-jpa_2.0_spec")
// Exclude tests which require build time enhancement of @Entity annotated classes
.unitTestExclusionPattern(".*(.*Idempotent.*Test$|JpaUsePersistTest$|JpaTraceEventMessageTest$)")
.build();