-
Notifications
You must be signed in to change notification settings - Fork 416
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3444 from mapfish/ClusteredMapPrinterServletTest
Tests context with h2 datasource
- Loading branch information
Showing
7 changed files
with
81 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
core/src/test/java/org/mapfish/print/servlet/ClusteredMapPrinterServletTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
package org.mapfish.print.servlet; | ||
|
||
import org.junit.Ignore; | ||
import org.springframework.test.context.ContextConfiguration; | ||
|
||
@ContextConfiguration(locations = {ClusteredMapPrinterServletTest.CLUSTERED_CONTEXT}) | ||
@Ignore // db must be set up to run this test | ||
public class ClusteredMapPrinterServletTest extends MapPrinterServletTest { | ||
|
||
public static final String CLUSTERED_CONTEXT = | ||
"classpath:org/mapfish/print/servlet/mapfish-spring-application-context-clustered.xml"; | ||
"classpath:org/mapfish/print/servlet/mapfish-spring-application-context-clustered-test.xml"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:tx="http://www.springframework.org/schema/tx" default-lazy-init="true" | ||
xmlns="http://www.springframework.org/schema/beans" | ||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd | ||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"> | ||
|
||
<bean id="mfSessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"> | ||
<property name="dataSource" ref="mfDataSource"/> | ||
<property name="annotatedClasses"> | ||
<list> | ||
<value>org.mapfish.print.servlet.job.impl.PrintJobEntryImpl</value> | ||
<value>org.mapfish.print.servlet.job.impl.PrintJobStatusImpl</value> | ||
<value>org.mapfish.print.servlet.job.impl.PrintJobResultImpl</value> | ||
<value>org.mapfish.print.servlet.job.impl.hibernate.PrintJobStatusExtImpl</value> | ||
<value>org.mapfish.print.servlet.job.impl.hibernate.PrintJobResultExtImpl</value> | ||
<value>org.mapfish.print.servlet.job.HibernateAccountingEntry</value> | ||
</list> | ||
</property> | ||
<property name="hibernateProperties"> | ||
<value> | ||
hibernate.hbm2ddl.auto=update | ||
hibernate.dialect=org.hibernate.dialect.H2Dialect | ||
hibernate.default_schema=${db.schema} | ||
<!-- hibernate.show_sql=true --> | ||
</value> | ||
</property> | ||
</bean> | ||
|
||
<bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager"> | ||
<property name="sessionFactory" ref="mfSessionFactory"/> | ||
</bean> | ||
<tx:annotation-driven transaction-manager="transactionManager"/> | ||
|
||
<bean id="printJobDao" class="org.mapfish.print.servlet.job.impl.hibernate.PrintJobDao"/> | ||
|
||
</beans> |
23 changes: 23 additions & 0 deletions
23
...urces/org/mapfish/print/servlet/abstract-mapfish-spring-application-context-clustered.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<beans default-lazy-init="true" 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-3.0.xsd"> | ||
|
||
<!-- At this point, there can be two flavours of this conf. the one with postgres datasource and the one with h2 datasource. Both import this file so to shared beans to be instantiated. --> | ||
|
||
<bean id="jobQueue" class="org.mapfish.print.servlet.job.impl.hibernate.HibernateJobQueue" /> | ||
|
||
<bean class="org.springframework.beans.factory.config.PropertyOverrideConfigurer" > | ||
<property name="ignoreResourceNotFound" value="true"/> | ||
<property name="properties"> | ||
<props> | ||
<prop key="jobManager.clustered">true</prop> | ||
<prop key="jobManager.oldFileCleanUp">false</prop> | ||
</props> | ||
</property> | ||
</bean> | ||
|
||
<bean id="printJobPrototype" class="org.mapfish.print.servlet.job.impl.hibernate.HibernatePrintJob" scope="prototype"/> | ||
<bean id="fileReportLoader" class="org.mapfish.print.servlet.job.impl.hibernate.HibernateReportLoader"/> | ||
|
||
</beans> |
14 changes: 14 additions & 0 deletions
14
...resources/org/mapfish/print/servlet/mapfish-spring-application-context-clustered-test.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<beans default-lazy-init="true" 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-3.0.xsd"> | ||
|
||
<bean id="mfDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> | ||
<property name="driverClassName" value="org.h2.Driver" /> | ||
<property name="url" value="jdbc:h2:mem:dbtest;DB_CLOSE_DELAY=-1" /> | ||
<property name="username" value="jobs" /> | ||
<property name="password" value="jobs" /> | ||
</bean> | ||
|
||
<import resource="classpath:org/mapfish/print/servlet/abstract-mapfish-spring-application-context-clustered.xml"/> | ||
</beans> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters