Laki roganovic <laki.roganovic <at> gmail.com> writes:

> 
> Hello Geert,
> 
> Geert Bevin a écrit :
> > Hi Laki,
> >
> > can you give some hints where you're stuck exactly?
> >
> I totally misunderstood the wiki entry about non-web apps : i thought 
> i'd have to implement Participant.
> Didn't know i just have to call Rep.initialize() !
> 

Hi Laki, I don't know if you have everything you need now, but I thought I 
would add on to earn points with Geert ;-}

I have done something similar, testing my own abstractions of Rife 
persistence.  A couple of key snippets:

I created a seperate repository, under the tests folder, which has just the 
stuff I need for unit testing:
<rep>
        <property 
name="datasource"><datasource>test_derby</datasource></property>

   <participant param="rep/config-base.xml">ParticipantConfig</participant>
    <participant 
param="rep/datasources.xml">ParticipantDatasources</participant>
</rep>
This points to hacked versions of config-base.xml and datasources.xml, with 
the settings for the test database.

Then, in before attempting to hit any persistence code, I init off of that 
file:
        Rep.initialize("rep/participants.xml");

Also, if you are using Meta Data Merging, you have to do the 
RunWithEngineClassloader trick.  In Eclipse, I put the following in the Run 
config "Program arguments:"  com.uwyn.rife.test.RunWithEngineClassloader.  And 
I set my Working directory to /tests.
http://rifers.org/wiki/display/RIFE/Out+of+container+testing

Hope this helps, somebody.

 - JT


> Thanks a lot.
> 
> > Best regards,
> >
> > Geert
> >
> > On 04 Jun 2006, at 10:04, Laki roganovic wrote:
> >
> >> Hello,
> >>
> >> I use RIFE's persistence layer in my web app, but would like to test 
> >> it outside my servlet container.
> >> I had a look at this entry 
> >> http://rifers.org/wiki/display/RIFE/GuideCookbookNonweb, but i still 
> >> can't figure out how to apply it to solve my problem.
> >> My DAO looks like this :
> >>
> >> public class PersonDAO {
> >>    static final Logger logger = Logger.getLogger(PersonDAO.class);
> >>
> >>    static GenericQueryManager manager = GenericQueryManagerFactory
> >>            
> >> .getInstance(Datasources.getRepInstance().getDatasource("mysql"),
> >>                    Person.class);
> >>
> >>    public static long insert(Person person) {
> >>        try {
> >>            manager.install();
> >>        } catch (Throwable t) {
> >>
> >>        }
> >>        return manager.save(person);
> >>    }
> >>
> >> }
> >>
> >> Thanks for your help.
> >>
> >>
> >> Laki
> >> _______________________________________________
> >> Rife-users mailing list
> >> Rife-users <at> uwyn.com
> >> http://lists.uwyn.com/mailman/listinfo/rife-users
> >>
> >
> > -- 
> > Geert Bevin
> > Uwyn "Use what you need" - http://uwyn.com
> > RIFE Java application framework - http://rifers.org
> > Music and words - http://gbevin.com
> >
> >
> > _______________________________________________
> > Rife-users mailing list
> > Rife-users <at> uwyn.com
> > http://lists.uwyn.com/mailman/listinfo/rife-users
> >
> 




_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users

Reply via email to