3 Replies Latest reply on Oct 25, 2013 1:54 PM by Bartosz Majsak

    Persistence extension's @UsingDataSet with @ApplyScriptBefore

    Xavi Arias Newbie

      Hello,

       

      I'm trying to run a test with both @ApplyScriptBefore and @UsingDataSet at class level. They may do different things, for example executing a PL-SQL before populating the database. Why this is not possible?

       

      Regards,

      xavier

        • 1. Re: Persistence extension's @UsingDataSet with @ApplyScriptBefore
          Bartosz Majsak Master

          Hey,

           

          What do you mean exactly when you say it is not possible? It should be, as it will basically always apply scripts first and then use datasets for each and every test in the class, unless it contains his own @ApplyScriptBefore and @UsingDataSet (it takes precedence).

           

          Are you getting some exception?

          1 of 1 people found this helpful
          • 2. Re: Re: Persistence extension's @UsingDataSet with @ApplyScriptBefore
            Xavi Arias Newbie

            Hi Bartosz,

             

            If you say it should be then the problem must be on my side

             

            My script is being executed since DBUnit does no complain anymore after some minor corrections to adapt Oracle SQL to H2. But then, the dataset is not loaded anymore into the tables. The only information I get is that the em.find(id, Class) returns null, but there are no exceptions. Before this data was correctly inserted in JPA Eclipselink auto-generated tables and tests passed.

             

            Logs in DEBUG level seem to process @UsingDataSet annotation and XML data files though. Maybe this line gives some hint:

             

            org.dbunit.database.DatabaseConnection.<init> Schema is null. Nothing to validate.

             

            The examples I have found do not combine both annotations, only @ApplyScriptBefore with @ShouldMatchDataSet at method level, so I guessed is not possible to do so but maybe there is a problem with the schemas. Nor entities specify table schema, neither CREATE TABLEs in script, not also XML datasets.

             

            @Entity

            @Table(name="TEST")

            public class Test {...}

             

            CREATE TABLE TEST (...);


            <dataset> <TEST ... /> </dataset>


            This is all the available information I have.


            Regards,

            Xavier

            • 3. Re: Re: Persistence extension's @UsingDataSet with @ApplyScriptBefore
              Bartosz Majsak Master

              If I say "should be" it can also mean that there is a bug

              I will take a closer look at your use case and keep you posted.

              1 of 1 people found this helpful