<?xml version="1.0" encoding="UTF-8"?>

<!--
========================================================================================================================
beans-datasource-it.xml

Copyright (c) 2013 Manning Publications Co.

Willie Wheeler (willie.wheeler@gmail.com)

Book: http://manning.com/wheeler/
Blog: http://springinpractice.com/
Code: https://github.com/springinpractice
========================================================================================================================
-->
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:jdbc="http://www.springframework.org/schema/jdbc"
	xmlns:p="http://www.springframework.org/schema/p"
	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-3.1.xsd
		http://www.springframework.org/schema/context
		http://www.springframework.org/schema/context/spring-context-3.1.xsd
		http://www.springframework.org/schema/jdbc
		http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd">
	
	<context:property-placeholder location="classpath:/spring/sip10-it.properties" />
	
	<bean id="dataSource"
		class="org.apache.commons.dbcp.BasicDataSource"
		destroy-method="close"
		p:driverClassName="${dataSource.driverClassName}"
		p:url="${dataSource.url}"
		p:username="${dataSource.username}"
		p:password="${dataSource.password}" />

	<!-- Get rid of the ignore-failures="DROPS" part if you don't want this to
	     automatically reset your test database when you run integration tests.
	     Or you can get rid of this config element altogether if you want to
	     handle the test database manually. -->		
	<jdbc:initialize-database data-source="dataSource" ignore-failures="DROPS">
		<jdbc:script location="classpath:/mysql/sip10-schema-mysql.sql" />
		<jdbc:script location="classpath:/mysql/sip10-test-data-mysql.sql" />
	</jdbc:initialize-database>
</beans>
