1

I need run arquillian+junit tests on a remote Glassfish 4.1 server. The database tables for these test cases needs to be
(1) created in-memory,
(2) with embedded JavaDB and
(3) dropped after the test execution.

Would the following glassfish-resources.xml work?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC
    "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN"
    "http://glassfish.org/dtds/glassfish-resources_1_5.dtd">
<resources>
    <jdbc-resource pool-name="ArquillianEmbeddedDerbyPool"
                   jndi-name="java:app/jdbc/chapter2" />
    <jdbc-connection-pool name="ArquillianEmbeddedDerbyPool"
                          res-type="javax.sql.DataSource"
                          datasource-classname="org.apache.derby.jdbc.EmbeddedDataSource"
                          is-isolation-level-guaranteed="false">
        <property name="databaseName" value="memory:action-bazaar-db"/>
        <property name="createDatabase" value="create"/>
    </jdbc-connection-pool>
</resources>

I did try it but not sure if the database is created in-memory. I keep getting the below error every time I run the tests. How to get rid of this error?

PER01000: Got SQLException executing statement "CREATE TABLE SEQUENCE (SEQ_NAME VARCHAR(50) NOT NULL, SEQ_COUNT DECIMAL(15), PRIMARY KEY (SEQ_NAME))": java.sql.SQLException: Table/View 'SEQUENCE' already exists in Schema 'APP'

Kiran Mohan
  • 2,696
  • 6
  • 36
  • 62

1 Answers1

0

If you are using Maven for your build, you can use the derby-maven-plugin, which I wrote and is available on GitHub and via Maven Central.

You can check here for my answer to a similar question.

Community
  • 1
  • 1
carlspring
  • 31,231
  • 29
  • 115
  • 197