Results 1 to 3 of 3

Thread: Testing mode: no SQL inserts

  1. #1
    Join Date
    Oct 2008
    Posts
    3

    Question 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
    Georg

    excerpt from datasources.xml:
    <!-- Initialise the database before every test case: -->
    <bean id="dataSourceInitializer" class="de.xyz.test.jdbc.DataSourceInitializer">
    <property name="dataSource" ref="dataSource"/>
    <property name="initScripts">
    <list><value>${batch.schema.script}</value></list>
    </property>
    <property name="destroyScripts">
    <list><value>${batch.drop.script}</value></list>
    </property>
    </bean>

    <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>


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


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

    <!-- Use this to set additional properties on beans at run time -->
    <bean id="overrideProperties" class="org.springframework.beans.factory.config.Pr opertyOverrideConfigurer"
    depends-on="environment">
    <property name="location" value="classpath:batch-${org.springframework.batch.support.SystemProperty 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>
    <property name="ignoreInvalidKeys" value="true" />
    <property name="order" value="2" />
    </bean>

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

    <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" />
    </bean>
    Best regards,
    Georg

  2. #2
    Join Date
    Jun 2005
    Posts
    4,230

    Default

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

  3. #3
    Join Date
    Oct 2008
    Posts
    3

    Smile My mistake

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •