Glassfish JPA , , maven-surefire-plugin ( ). Embedded Glassfish , , ScatteredArchive. java.io.tmpdir, gfembed<a_random_number>tmp, Glassfish Glassfish Glassfish.
Glassfish , , , , ( ), . GF_EMBED_DOMAIN_HOME/applications/<application_name>. persistence.xml src/main/resources/META-INF src/test/resources/META-INF <application-name>/META-INF. , , , , , , JPA . src/main/resources/META-INF.
:
1. Glassfish
(domain.xml), jdbc/mylog. , , , . :
Map<String, Object> props = new HashMap<String, Object>();
props.put("org.glassfish.ejb.embedded.glassfish.installation.root", "./glassfish-install/glassfish");
container = EJBContainer.createEJBContainer(props);
context = container.getContext();
datasource = (DataSource) context.lookup("jdbc/mylog");
glassfish-install glassfish Maven ( ); glassfish domain1/config Glassfish domain1. . (JAR- JDBC- JAR ..) Glassfish, Glassfish, .

Glassfish , Glassfish, ( , , , ):
<domain log-root="${com.sun.aas.instanceRoot}/logs" application-root="${com.sun.aas.instanceRoot}/applications" version="10.0">
<system-applications/>
<applications/>
<resources>
<jdbc-resource pool-name="MyPool" jndi-name="jdbc/mylog"/>
...
<jdbc-connection-pool driver-classname="" datasource-classname="org.apache.derby.jdbc.ClientDataSource" res-type="javax.sql.DataSource" description="" name="MyPool" ping="true">
<property name="User" value="APP"></property>
<property name="RetrieveMessageText" value="true"></property>
<property name="CreateDatabase" value="true"></property>
<property name="ServerName" value="localhost"></property>
<property name="Ssl" value="off"></property>
<property name="SecurityMechanism" value="4"></property>
<property name="TraceFileAppend" value="false"></property>
<property name="TraceLevel" value="-1"></property>
<property name="PortNumber" value="1527"></property>
<property name="LoginTimeout" value="0"></property>
<property name="Password" value="APP"></property>
<property name="databaseName" value="MYDB"></property>
</jdbc-connection-pool>
...
</resources>
<servers>
<server name="server" config-ref="server-config">
<resource-ref ref="jdbc/__TimerPool"/>
<resource-ref ref="jdbc/__default"/>
<resource-ref ref="jdbc/mylog"/>
</server>
</servers>
...
...
domain.xml java.net , , Glassfish.
2. persistence.xml
Maven MOM persistence.xml src/test/resources/META-INF src/main/resources/META-INF, test. . , fooobar.com/questions/86862/.... , , , persistence.xml, . - , JPA persistence.xml target/classes target/test-classes, , . Hibernate JPA, TRACE org.hibernate.ejb ( Ejb3Configuration ) , test-classes .
:
Glassfish 3.1, .