Arquillian Chameleon and JDBC drivers
szymonk92 Jan 8, 2019 11:13 AMI am configuring the project to user Arquillian with Chameleon. Simple!
However, I struggle deploying JDBC driver on WildFly. Previously I did it using standalone.xml and placing JAR in module folder. However, it cannot be done this way with Chameleon because WildFly is being downloaded and deployed automatically.
How can I add PostgreSQL driver?
My current configuration:
Wildfly11.class :
@Target({ ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented @Inherited @ChameleonTarget("wildfly:11.0.0.Final:managed") public @interface Wildfly11 { }
@Target({ ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@ChameleonTarget("wildfly:11.0.0.Final:managed")
public @interface Wildfly11 {
}
AbstractWildflyTestCase.class
@Wildfly11
@RunWith(ArquillianChameleon.class)
public abstract class AbstractWildflyTestCase {
@Deployment
public static Archive<?> createDeployment(){
return ShrinkWrap
.create(WebArchive.class, "X_test.war")
.addPackage(AbstractWildflyTestCase.class.getPackage().getName())
.addAsResource("META-INF/test-persistence.xml", "META-INF/persistence.xml")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsWebInfResource("wildfly-ds.xml");
}
}
arquillian.xml
<?xml version="1.0" encoding="UTF-8"?> <arquillian xmlns="http://jboss.org/schema/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd"> <defaultProtocol type="Servlet 3.0"/> <extension qualifier="persistence-dbunit"> <property name="datatypeFactory">org.dbunit.ext.postgresql.PostgresqlDataTypeFactory</property> <property name="excludeTablesFromCleanup">hibernate_sequence</property> <property name="filterTables">true</property> </extension> </arquillian>
test-persistence.xml
<?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd" version="2.1"> <persistence-unit name="xperidesk"> <jta-data-source>java:jboss/datasources/SumDS</jta-data-source> <properties> <property name="hibernate.show_sql" value="false" /> <property name="hibernate.format_sql" value="true" /> <property name="hibernate.hbm2ddl.auto" value="update"/> </properties> </persistence-unit> </persistence>