5 Replies Latest reply on Apr 25, 2012 2:07 AM by b69

    help required for use of derby DB with glassfish-embedded-3.1

    b69 Newbie

      Starting point:

      My Arquillian test finally runs on managed AS 7.1.2.SNAPSHOT and data source configured for MySQL DB.


      The tests write data into this DB which must be deleted manually after the tests.

      It’s a development DB, hence it's unknown what kind of data it contains, which is bad for JUnit tests Asserts.

      The tests are running in a separate VM, which means test coverage cannot be reported to maven site.

      Glassfish and Java DB is better known by me, than Jboss and H2. Hence, a little personal preference for this configuration shown in the attachments.


      How and where the DB accessed from glassfish embedded can be configured.

      The data-source is declared as jdbc/__defautl

      It seems, the connection to the db is successful, but the tables required are not created and hence missing, though declared in the persistence.xml!

      Beside! The targeted derby DB do have the tables declared missing. So, either another schema, or another db is accessed!

      Of course, if somebody shows me an easy solution with jboss-embedded and the related db, I would switch to such a solution. But I must mention, I have the AS 7 installed, but no AS 6, which seems to be used for embedded testing. I would need a hint what this means w.r.t. additional setup work.

      Thanks for helping to overcome these obstacles.

        • 1. Re: help required for use of derby DB with glassfish-embedded-3.1
          Vineet Reynolds Apprentice

          Going by your description, you're attempting the use of the embedded JavaDB/Derby instance with embedded GlassFish server. Is it possible for you to provide the logs of embedded GlassFish server (the same as the one in your console), so that we could see what is the failure?

          • 2. Re: help required for use of derby DB with glassfish-embedded-3.1
            Bartosz Majsak Master

            I think JBoss AS 7 is fast enough to use for testing. Based on my experience it's even faster than GF Embedded.


            Have a look at persistence extension - should help overcome problems you described. Integration tests module is using various configuration, including JBoss AS 7 with H2, JBoss AS 7 with MS SQL 2008 Express. Also GF Embedded with HSQLDB.


            Let me know if you will need more help.




            • 3. Re: help required for use of derby DB with glassfish-embedded-3.1
              b69 Newbie


              Thanks for both answers.

              Please let me emphasize, it’s not a question of speed and as mentioned only a small preference for GF / Derby, due to the actual knowledge.

              The point is, to use a memory based java DB, to start always from known conditions, and not an absolute must, but a strong desire is to have the test coverage shown in the maven site, as it was possible with the mok-tests used so far. Arquillian should help to replace those moks, which are tedious to write and to maintain. With regard to test coverage documentation, by actual experience, it remains empty, when running on managed AS. Hence, I suspect this is due to the fact being running in another VM. So the only motif, to run on an embedded AS, versus running on a managed / remote one, is to stay within the same VM. However if you could tell me, how to get the test coverage information while running in managed or remote AS, I’ll forget the embedded solution without any regret.

              So, the hint to the persistence extension is a good one as a starting point. From another hint I got the link to the Arquillian Guides, where I hope to find the information missing up to now. So at first, I’ll dig this documentation. However if you have a hint to the test coverage question, I’m grateful, because I’m not sure if this question is covered in the documentation.

              • 4. Re: help required for use of derby DB with glassfish-embedded-3.1
                Bartosz Majsak Master

                Please have a look at jacoco plugin - it's been discussed in the forum several times already. This might solve your problem with managed / remote containers code coverage.

                • 5. Re: help required for use of derby DB with glassfish-embedded-3.1
                  b69 Newbie

                  The http://arquillian.org/guides/ was really what was missing. Without this documentation, it was possible to do a Hello Earthling example, but not bridge the gap to a real world application!

                  Well, now it works with my application, and yesterday I wrote a lot of tests which were planned for realizing back in January! It works! Stand for Derby DB with glassfish-embedded-3.1. And the documentation showed me a lot of tricky configurations, which you can never find out if you were not involved within the development of Arquillian.

                  Sure more questions will rise, as for the moment I know how to do it, but I feel, there is still a gap to fill until to know why to do it in a given way. So my wish is, the Arquillian reference will be updated to give more background information and to understand the why!

                  Thanks to all of you.