Announcement Announcement Module
No announcement yet.
Testing mode: no SQL inserts Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Testing mode: no SQL inserts

    I am running some test jobs using JUnit.
    However, no matter if I take HSQL (standalone, file, memory) or MySQL, I just don't get any records into the table batch_job_execution - although I am using exactly the same application context along with its properties.

    Do you have an idea of what could go wrong here? Are Properties implicitely overwritten?

    Best regards

    excerpt from datasources.xml:
    <!-- Initialise the database before every test case: -->
    <bean id="dataSourceInitializer" class="">
    <property name="dataSource" ref="dataSource"/>
    <property name="initScripts">
    <property name="destroyScripts">

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="${batch.jdbc.driver}" />
    <property name="url" value="${batch.jdbc.url}" />
    <property name="username" value="${batch.jdbc.user}" />
    <property name="password" value="${batch.jdbc.password}" />

    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSou rceTransactionManager" lazy-init="true">
    <property name="dataSource" ref="dataSource" />

    <!-- Set up or detect a System property called " nitializer.ENVIRONMENT" used to construct a properties file on the classpath.
    The default is "hsql". -->
    <bean id="environment"
    class=" pertyInitializer">
    <property name="defaultValue" value="hsql"/>

    <!-- Use this to set additional properties on beans at run time -->
    <bean id="overrideProperties" class="org.springframework.beans.factory.config.Pr opertyOverrideConfigurer"
    <property name="location" value="classpath:batch-${ Initializer.ENVIRONMENT}.properties" />
    <!-- Allow system properties (-D) to override those from file -->
    <property name="localOverride" value="true" />
    <property name="properties">
    <bean class="java.lang.System" factory-method="getProperties" />
    <property name="ignoreInvalidKeys" value="true" />
    <property name="order" value="2" />

    <bean id="placeholderProperties" class="org.springframework.beans.factory.config.Pr opertyPlaceholderConfigurer"
    <property name="location" value="classpath:batch-${ Initializer.ENVIRONMENT}.properties" />
    <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
    <property name="ignoreUnresolvablePlaceholders" value="true" />
    <property name="order" value="1" />

    <bean id="lobHandler" class="${batch.lob.handler.class}" />

    <bean id="incrementerParent" class="${batch.database.incrementer.class}">
    <property name="dataSource" ref="dataSource" />
    <property name="incrementerName" value="ID" />

  • #2
    What's your ${batch.drop.script}? Is it wiping the tables when the context closes.


    • #3
      My mistake

      ... it's my mistake - I used the wrong jobRepository ... MapJobRepositoryFactoryBean instead of JobRepositoryFactoryBean.