You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Nicolas Dufour <nr...@gmail.com> on 2007/04/16 19:20:58 UTC

Problem between Spring, Jackrabbit and JUnit

Hello Guys

I have written a bunch of test using the excellent class from Spring :
AbstractDependencyInjectionSpringContextTests to test my JCR Dao.
The problem is : when a test is launched, it doesnt want to exit. I have to
kill the program and then of course my .lock is deletable.

Any idea ?

Nicolas

Re: Problem between Spring, Jackrabbit and JUnit

Posted by Nicolas Dufour <nr...@gmail.com>.
Responding to myself :)

It works if I put a normal RepositoryBean instead of a
TranscientRepositoryBean !

Nicolas

On 4/16/07, Nicolas Dufour <nr...@gmail.com> wrote:
>
> oops I forgot to put my bean file ;)
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans "
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xmlns:aop="http://www.springframework.org/schema/aop "
>     xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> http://www.springframework.org/schema/aop
> http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
>
>     <!-- JCR REPOSITORY BEANS -->
>
>     <bean id="repository"
>         class="
> org.springmodules.jcr.jackrabbit.TransientRepositoryFactoryBean ">
>         <property name="configuration" value="classpath:jcr/jackrabbit-
> repo.xml"/>
>         <property name="homeDir" value="/jcr/repository"/>
>     </bean>
>
>     <bean id="sessionFactory" class="tips.cma.jcr.TipsSessionFactory">
>         <property name="repository" ref="repository" />
>         <property name="credentials">
>             <bean class="javax.jcr.SimpleCredentials">
>                 <constructor-arg index="0" value="bogus" />
>                 <constructor-arg index="1" ref="password" />
>             </bean>
>         </property>
>     </bean>
>
>     <!-- create the password to return it as a char[] -->
>     <bean id="password" class="java.lang.String">
>         <constructor-arg index="0" value="pass" />
>     </bean>
>
>     <bean id="jcrTemplate" class="org.springmodules.jcr.JcrTemplate">
>         <property name="sessionFactory" ref="sessionFactory" />
>         <property name="allowCreate" value="true" />
>     </bean>
>
>
> </beans>
>
> If the test is launched with only this file, the test will stay running
> ... !
>
> Nicolas
>
> On 4/16/07, Nicolas Dufour <nr...@gmail.com> wrote:
> >
> > Hello Guys
> >
> > I have written a bunch of test using the excellent class from Spring :
> > AbstractDependencyInjectionSpringContextTests to test my JCR Dao.
> > The problem is : when a test is launched, it doesnt want to exit. I have
> > to kill the program and then of course my .lock is deletable.
> >
> > Any idea ?
> >
> > Nicolas
> >
>
>

Re: Problem between Spring, Jackrabbit and JUnit

Posted by Nicolas Dufour <nr...@gmail.com>.
oops I forgot to put my bean file ;)

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">

    <!-- JCR REPOSITORY BEANS -->

    <bean id="repository"
        class="
org.springmodules.jcr.jackrabbit.TransientRepositoryFactoryBean">
        <property name="configuration" value="classpath:jcr/jackrabbit-
repo.xml"/>
        <property name="homeDir" value="/jcr/repository"/>
    </bean>

    <bean id="sessionFactory" class="tips.cma.jcr.TipsSessionFactory">
        <property name="repository" ref="repository" />
        <property name="credentials">
            <bean class="javax.jcr.SimpleCredentials">
                <constructor-arg index="0" value="bogus" />
                <constructor-arg index="1" ref="password" />
            </bean>
        </property>
    </bean>

    <!-- create the password to return it as a char[] -->
    <bean id="password" class="java.lang.String">
        <constructor-arg index="0" value="pass" />
    </bean>

    <bean id="jcrTemplate" class="org.springmodules.jcr.JcrTemplate">
        <property name="sessionFactory" ref="sessionFactory" />
        <property name="allowCreate" value="true" />
    </bean>


</beans>

If the test is launched with only this file, the test will stay running ...
!

Nicolas

On 4/16/07, Nicolas Dufour <nr...@gmail.com> wrote:
>
> Hello Guys
>
> I have written a bunch of test using the excellent class from Spring :
> AbstractDependencyInjectionSpringContextTests to test my JCR Dao.
> The problem is : when a test is launched, it doesnt want to exit. I have
> to kill the program and then of course my .lock is deletable.
>
> Any idea ?
>
> Nicolas
>