Uli

On 11/11/2011 5:05 AM, Juan Pablo Gardella wrote:
I use H2. Here you have a sample. https://bitbucket.org/gardellajuanpablo/gwt-sample/wiki/Home

The only part relevant to you is H2 configuration.

Juan

Just to elaborate a bit on what Juan is saying. You can use java only databases such as H2 or HSQLDB (GIYF) and configure them so that for testing purposes they are loaded and run entirely in memory.

Good Java practices recommend that you use DI (Dependency Injection) to enable you to test your POJOs without having to rely on the startup of the database each time. Search for Guice and Springframework for possible help - but you don't *have* to use a framework - for a simple application you can do the DI directly by defining interfaces and using setters or constructor injection. If you find that you have to change your design a bit to make it easier with DI then that's a good thing - it will be more maintainable and more testable.

I've found that the best approach is to do as much as you can with POJOs, then build junit integration tests that exercise database transactions using in-memory H2 or similar databases, and then using Htlmunit or selenium to test out the final server build.

Another tip is that you use a java property such as my.module.mode = "DEV" or "PROD" and use that to switch in properties files to configure the database accordingly. This means you can add a -Dmy.module.mode=DEV to your server invocation.

Alan





2011/11/11 [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>>

    Hello,

    I started an other thread dealing with file write access on the server
    side. After reading the responses I am assured that the better
    solution would be to store the available data in a database.

    I am able to find some information on how to access a sql database in
    general. But I have no idea how to test database access in development
    mode. I am using eclipse to develop my gwt application. Does anyone
    has some input on this topic?

    Thanks and best regards

    Uli

    --
    You received this message because you are subscribed to the Google
    Groups "Google Web Toolkit" group.
    To post to this group, send email to
    [email protected]
    <mailto:[email protected]>.
    To unsubscribe from this group, send email to
    [email protected]
    <mailto:google-web-toolkit%[email protected]>.
    For more options, visit this group at
    http://groups.google.com/group/google-web-toolkit?hl=en.


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

--
You received this message because you are subscribed to the Google Groups "Google 
Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to