11 Replies Latest reply on Jan 12, 2014 1:04 PM by Bartosz Majsak

    How to use a sql script to populate test database before test

    claudinei Newbie

      I'm using Arquillian with TestNG I have created a test-persistence.xml and a MySQL test Database like this:



      <?xml version="1.0" encoding="UTF-8"?>
      <persistence version="2.0"
                xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                <persistence-unit name="ERPSystem-PU" transaction-type="JTA">
                                    <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
                                    <property name="hibernate.hbm2ddl.auto" value="create-drop" />


      The test Database schema is created and droped like it should be, but how i can auto populate the database with the sql script like this:



      INSERT INTO language(name, locale) VALUES('Português', 'pt');
      INSERT INTO language(name, locale) VALUES('Inglês', 'en');
      INSERT INTO language(name, locale) VALUES('Espanhol', 'es');
      INSERT INTO language(name, locale) VALUES('Chinês', 'ch');


      How I configure Arquillian to run a sql script?