5 Replies Latest reply on Apr 25, 2012 5:33 AM by mano_seba

    Arquillian @UsingScript problem





      I have a problem whit the arquillian h2 database,  the @UsingScript("import.sql") it doesn't insert the data into prjtest database. I can save in the prjtest database but cant add data using import.sql

      Can someone give me an idea how can I make this work?


      I added the dependecy arquillian-persistence-api and if I comment the @UsingScript("import.sql") it will give me error....and this makes me realize that the annotaions is working...so what might be the problem?







                  <version>1.0.0.CR7</version> <!-- 1.0.0.CR7 -->













      public class LocationServiceTest extends Arquillian{

      private final String TEST_VALUE = "test";



             public static WebArchive createTestArchive() {

               return      ShrinkWrap.create( WebArchive.class,"test.war").addPackages(true,"org.joda.time").addPackages(true, "javax.jcr").addClasses(com.mysql.jdbc.log.Log.class,com.project.Location).addPackage("org.slf4j").addPackage("org.slf4j.spi").addPackage("org.slf4j.helpers").addAsWebInfResource("test-persistence.xml", "classes/META-INF/persistence.xml").addAsWebInfResource("beans.xml", "META-INF/beans.xml");






           public void setUp()



      private Location loc;



      public void LocationTest(){


            Marking mk = new Marking();









      <?xml version="1.0" encoding="UTF-8"?>

      <!-- Persistence deployment descriptor for dev profile -->


      <persistence version="2.0"

          xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

          xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">


          <persistence-unit name="prj-unit">




                  <property name="hibernate.hbm2ddl.auto" value="update" />

                  <property name="hibernate.show_sql" value="true" />









      <datasource jndi-name="java:jboss/datasources/prjtest" pool-name="prjtest" enabled="true">

















                driver name="h2" module="com.h2database.h2">














      How can I insert the data from TEMPLATE into the prjtest h2 database.



      Best Regards

        • 1. Re: Arquillian @UsingScript problem

          Hi Sebastian,


          you should also add arquillian-persistence-impl artifact to your dependencies. Try to put the annotation on the test method, or alternatively put it on the class level so it will be executed for each test (if the test itself does not have the same annotation, then it takes precedence).


          Hope that helps.




          • 2. Re: Arquillian @UsingScript problem

            Hi Majsak,


            Thank you for your response,I have the arquillian-persistence-impl artefact just forgot to mention this.








            If the annotation is deleted then the warning appears:Cannot use this JDK-based implementation to export as ZIP an archive with no content .... so the arquillian-persistence-impl is working.

            I tried to add the annotation on the test method and on the class...but for the moment the @UsingScript doesen't work. The database works, the tables are created....but the insert does not happen.



            Best Regards

            • 3. Re: Arquillian @UsingScript problem

              Do you think you would be able to isolate this problem and shared simplified project so I can have a look? (GitHub would work perfectly so I can clone your repo and if I fix it I can send pull request )




              • 4. Re: Arquillian @UsingScript problem

                Please try to update to Alpha4 version and use @ApplyScriptBefore annotation on test level. For Alpha5 I'm currently working on the class-level annotation where you can define you schema creation and any other SQL script. Let me know if A4 solved your problem.

                • 5. Re: Arquillian @UsingScript problem

                  Thank you very much for your help, I will try as soon as possible and I will tell you if it worked.