Hot questions for Using GlassFish in jboss arquillian

Top Java Programmings / GlassFish / jboss arquillian

Question:

i was following this tutorial but i have some problem to set jdbc connection.

in my arquillian.xml i wrote:

...
<container qualifier="payara-remote" default="true">
    <configuration>
        <property name="resourcesXml">
            src/test/resources-payara-remote/glassfish-resources.xml
        </property>
    </configuration>
</container>
...

when i run my test i get this warning:

AVVERTENZA: Configuration contain properties not supported by the backing object org.jboss.arquillian.container.glassfish.remote_3_1.GlassFishRestConfiguration
Unused property entries: {resourcesXml=
            src/test/resources-payara-remote/glassfish-resources.xml
        }
Supported property names: [adminHttps, remoteServerHttpPort, libraries, type, remoteServerAddress, target, remoteServerAdminPort, remoteServerAdminHttps, adminUser, authorisation, adminPort, properties, adminHost, adminPassword]

so i think "resourceXml" isn't supported... how i can tell arquillian to use that file?

moreover, in that file i declare a jdbc/test. What i have to write in persistence.xml to use that db connection?

thank you in advance

UPDATE

I wish to use my test-db declaring jdbc connection in the "src/test/resources-payara-remote/glassfish-resources.xml" (without create a jdbc connection in the remote server), but i don't know how to set arquillian to use jdbc connection declared in the .xml file.


Answer:

If you want to create a JDBC resource on a remote GlasFish/Payara server, the best way to do it is to package glassfish-resources.xml into your deployment inside your test (in @Deployment method, use .addAsWebInfResource("glassfish-resources.xml"). When the server finds this file glassfish-resources.xml in WEB-INF folder of the application, it will create the resources temporarily, until the arquillian test suite undeploys the application.

The GlassFish/Payara remote arquillian connector doesn't provide setting up resources from an xml. This feature is only provided by the glassfish-embedded connector, which runs GlassFish/Payara inside your test JVM. The embedded connector is what is used in the tutorial you said you followed. Actualy, if you want to run your tests against a remote GlassFish/Payara server, you should compare the steps to test against remote WildFly in the tutorial. It also includes adding a XML with resources into the deployment: .addAsWebInfResource("jbossas-ds.xml")

If you want to use GlassFish embedded connector with Payara, just add the following dependencies in maven pom.xml:

            <dependency>
                <groupId>org.jboss.arquillian.container</groupId>
                <artifactId>arquillian-glassfish-embedded-3.1</artifactId>
                <version>1.0.0.Final</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>fish.payara.extras</groupId>
                <artifactId>payara-embedded-all</artifactId>
                <version>4.1.1.163.0.1</version>
                <scope>test</scope>
            </dependency>