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 2016/08/02 09:50:23 UTC

camel git commit: CAMEL-10207: Fixed test configuration for Bam. Added repetition in case of failure.

Repository: camel
Updated Branches:
  refs/heads/master 47ff272f3 -> 6a73e5c00


CAMEL-10207: Fixed test configuration for Bam. Added repetition in case of failure.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6a73e5c0
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6a73e5c0
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6a73e5c0

Branch: refs/heads/master
Commit: 6a73e5c00a3ba11347b2af54ff4f2461d13e4554
Parents: 47ff272
Author: Nicola Ferraro <ni...@gmail.com>
Authored: Tue Aug 2 11:42:41 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Aug 2 11:50:15 2016 +0200

----------------------------------------------------------------------
 tests/camel-itest-spring-boot/pom.xml           |  2 +-
 .../itest/springboot/ITestApplication.java      |  3 ++
 .../itest/springboot/ITestXmlConfiguration.java | 14 +++++++
 .../camel/itest/springboot/CamelBamTest.java    |  2 +
 .../resources/components/bam-persistence.xml    | 35 +++++++++++++++++
 .../test/resources/components/bam-spring.xml    | 40 ++++++++++++++++++++
 6 files changed, 95 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/6a73e5c0/tests/camel-itest-spring-boot/pom.xml
----------------------------------------------------------------------
diff --git a/tests/camel-itest-spring-boot/pom.xml b/tests/camel-itest-spring-boot/pom.xml
index 77388db..5cdbf11 100644
--- a/tests/camel-itest-spring-boot/pom.xml
+++ b/tests/camel-itest-spring-boot/pom.xml
@@ -147,7 +147,7 @@
         <configuration>
           <childDelegation>false</childDelegation>
           <forkedProcessTimeoutInSeconds>15000</forkedProcessTimeoutInSeconds>
-          <rerunFailingTestsCount>0</rerunFailingTestsCount>
+          <rerunFailingTestsCount>1</rerunFailingTestsCount>
           <includes>
             <include>**/*Test.java</include>
           </includes>

http://git-wip-us.apache.org/repos/asf/camel/blob/6a73e5c0/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestApplication.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestApplication.java b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestApplication.java
index 036510b..0fab80e 100644
--- a/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestApplication.java
+++ b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestApplication.java
@@ -26,6 +26,8 @@ import ch.qos.logback.core.util.StatusPrinter;
 import org.slf4j.LoggerFactory;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Import;
+import org.springframework.context.annotation.ImportResource;
 import org.springframework.scheduling.annotation.EnableAsync;
 
 /**
@@ -34,6 +36,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
  */
 @SpringBootApplication
 @EnableAsync
+@Import(ITestXmlConfiguration.class)
 public class ITestApplication {
 
     public static void main(String[] args) throws Exception {

http://git-wip-us.apache.org/repos/asf/camel/blob/6a73e5c0/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestXmlConfiguration.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestXmlConfiguration.java b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestXmlConfiguration.java
new file mode 100644
index 0000000..43eab78
--- /dev/null
+++ b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestXmlConfiguration.java
@@ -0,0 +1,14 @@
+package org.apache.camel.itest.springboot;
+
+import org.springframework.boot.autoconfigure.condition.ConditionalOnResource;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.ImportResource;
+
+/**
+ * Loads 'META-INF/spring/spring.xml' if present.
+ */
+@Configuration
+@ConditionalOnResource(resources = "META-INF/spring/spring.xml")
+@ImportResource("META-INF/spring/spring.xml")
+public class ITestXmlConfiguration {
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/6a73e5c0/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelBamTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelBamTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelBamTest.java
index 80732b9..a4a6067 100644
--- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelBamTest.java
+++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelBamTest.java
@@ -35,6 +35,8 @@ public class CamelBamTest extends AbstractSpringBootTestSupport {
     public static ITestConfig createTestConfig() {
         return new ITestConfigBuilder()
                 .module(inferModuleName(CamelBamTest.class))
+                .resource("components/bam-persistence.xml", "META-INF/persistence.xml")
+                .resource("components/bam-spring.xml", "META-INF/spring/spring.xml")
                 .build();
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/6a73e5c0/tests/camel-itest-spring-boot/src/test/resources/components/bam-persistence.xml
----------------------------------------------------------------------
diff --git a/tests/camel-itest-spring-boot/src/test/resources/components/bam-persistence.xml b/tests/camel-itest-spring-boot/src/test/resources/components/bam-persistence.xml
new file mode 100644
index 0000000..1ee96e3
--- /dev/null
+++ b/tests/camel-itest-spring-boot/src/test/resources/components/bam-persistence.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2006 The Apache Software Foundation.
+
+ Licensed 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://java.sun.com/xml/ns/persistence"
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+             version="1.0">
+
+  <persistence-unit name="bam" transaction-type="RESOURCE_LOCAL">
+    <class>org.apache.camel.bam.model.ActivityDefinition</class>
+    <class>org.apache.camel.bam.model.ActivityState</class>
+    <class>org.apache.camel.bam.model.ProcessDefinition</class>
+    <class>org.apache.camel.bam.model.ProcessInstance</class>
+
+    <properties>
+      <property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect"/>
+      <property name="hibernate.connection.driver_class" value="org.apache.derby.jdbc.EmbeddedDriver"/>
+      <property name="hibernate.connection.url" value="jdbc:derby:target/test/database;create=true"/>
+      <property name="hibernate.hbm2ddl.auto" value="create"/>
+    </properties>
+
+  </persistence-unit>
+</persistence>

http://git-wip-us.apache.org/repos/asf/camel/blob/6a73e5c0/tests/camel-itest-spring-boot/src/test/resources/components/bam-spring.xml
----------------------------------------------------------------------
diff --git a/tests/camel-itest-spring-boot/src/test/resources/components/bam-spring.xml b/tests/camel-itest-spring-boot/src/test/resources/components/bam-spring.xml
new file mode 100644
index 0000000..40de6de
--- /dev/null
+++ b/tests/camel-itest-spring-boot/src/test/resources/components/bam-spring.xml
@@ -0,0 +1,40 @@
+<?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.
+	-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+	<bean id="transactionTemplate"
+		class="org.springframework.transaction.support.TransactionTemplate">
+		<property name="transactionManager">
+			<bean class="org.springframework.orm.jpa.JpaTransactionManager">
+				<property name="entityManagerFactory" ref="entityManagerFactory" />
+			</bean>
+		</property>
+	</bean>
+
+	<bean id="entityManagerFactory"	class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
+		<property name="persistenceUnitName" value="bam" />
+		<property name="jpaVendorAdapter" ref="jpaAdapter"/>
+	</bean>
+	
+	<!-- Hibernate addapter -->
+	<bean id="jpaAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
+		<property name="databasePlatform" value="org.hibernate.dialect.DerbyDialect" />
+	</bean>
+	
+</beans>