Spring JPA: getting ready for test with H2 and docker
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 10 Jul 2016 18:56:40 +0000 (20:56 +0200)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 10 Jul 2016 18:56:40 +0000 (20:56 +0200)
SpringJava/JPA/pom.xml
SpringJava/JPA/src/test/resources/datasource-test-configuration.xml [new file with mode: 0644]

index aebecc9..e7137b6 100644 (file)
                        <version>2.0.11-beta</version>
                        <scope>test</scope>
                </dependency>
+               <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-test</artifactId>
+            <version>${spring.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.h2database</groupId>
+            <artifactId>h2</artifactId>
+            <version>1.4.192</version>
+            <scope>test</scope>
+        </dependency>
        </dependencies>
        <build>
                <plugins>
diff --git a/SpringJava/JPA/src/test/resources/datasource-test-configuration.xml b/SpringJava/JPA/src/test/resources/datasource-test-configuration.xml
new file mode 100644 (file)
index 0000000..75daa1e
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<beans xmlns="http://www.springframework.org/schema/beans"\r
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+       xmlns:util="http://www.springframework.org/schema/util"\r
+       xmlns:tx="http://www.springframework.org/schema/tx"\r
+       xmlns:jee="http://www.springframework.org/schema/jee"\r
+       xsi:schemaLocation="http://www.springframework.org/schema/beans\r
+        http://www.springframework.org/schema/beans/spring-beans.xsd\r
+        http://www.springframework.org/schema/util\r
+        http://www.springframework.org/schema/util/spring-util.xsd\r
+        http://www.springframework.org/schema/tx \r
+        http://www.springframework.org/schema/tx/spring-tx.xsd\r
+        http://www.springframework.org/schema/jee\r
+        http://www.springframework.org/schema/jee/spring-jee.xsd">\r
+\r
+       \r
+       <!--  \r
+    <jdbc:embedded-database id="dataSource" type="H2" />\r
+       -->\r
+   <beans profile="default,development,integration,preproduction,production">\r
+        <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">\r
+            <property name="driverClassName" value="org.h2.Driver" />\r
+            <property name="url" value="jdbc:h2:mem:mybatis_example;INIT=create schema if not exists mybatis_example\;SET SCHEMA mybatis_example;MODE=DB2;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE" />\r
+            <property name="username" value="mybatis" />\r
+            <property name="password" value="" />\r
+        </bean>\r
+    </beans>\r
+       \r
+</beans>\r