Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix and cleanup #91

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@
<description>Extension for controlling data sources</description>

<properties>
<version.cdi>1.0-SP1</version.cdi>
<version.jta>1.1</version.jta>
<version.junit_params>1.0.4</version.junit_params>
<version.junit_params>1.1.0</version.junit_params>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public void should_insert_special_entities_with_custom_end_line() throws Excepti
verify(connection.createStatement(), times(1)).execute(statementsCaptor.capture());
assertThat(statementsCaptor.getAllValues()).containsSequence(
"insert into useraccount (id, firstname, lastname, username, password)" +
" values (1, 'John', 'Smith & Company', 'doovde;;', '&amp;test&copy;')\nGO"
" values (1, 'John', 'Smith & Company', 'doovde;;', '&amp;test&copy;')" + System.lineSeparator() +"GO"
);
}

Expand Down
10 changes: 6 additions & 4 deletions dbunit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
<version.snakeyaml>1.17</version.snakeyaml>
<version.jackson>1.9.11</version.jackson>
<version.poi>3.14</version.poi>
<version.cdi>1.0-SP1</version.cdi>
<version.jta>1.1</version.jta>
<version.slf4j>1.7.20</version.slf4j>
<version.junit_params>1.0.4</version.junit_params>
<version.jta>1.1</version.jta>
<version.junit_params>1.1.0</version.junit_params>
</properties>

<dependencies>
Expand Down Expand Up @@ -62,6 +60,10 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,12 @@ public void createDatasets(@Observes(precedence = 1000) EventContext<BeforePersi

private void createDatabaseConnection() {

if (databaseConnectionProducer.get() == null) {
configureDatabaseConnection();
try {
if (databaseConnectionProducer.get() == null || databaseConnectionProducer.get().getConnection().isClosed()) {
configureDatabaseConnection();
}
} catch (SQLException e) {
throw new DBUnitInitializationException("Unable to createDatabaseConnection database connection for DBUnit module.", e);
}
}

Expand Down
17 changes: 15 additions & 2 deletions int-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@
<description>Demonstrates usage of Arquillian Persistence extension.</description>

<properties>
<version.cdi>1.0-SP1</version.cdi>
<version.validation.api>1.0.0.GA</version.validation.api>
<version.javaee-api.openejb>6.0-5</version.javaee-api.openejb>
<version.chameleon>1.0.0.Beta1</version.chameleon>
<version.poi>3.14</version.poi>
<version.maven-dependency-plugin>2.3</version.maven-dependency-plugin>
<version.maven-dependency-plugin>3.0</version.maven-dependency-plugin>
<server.version>8.1.0.Final</server.version>
<!-- Chameleon container mode -->
<mode>managed</mode>
Expand Down Expand Up @@ -82,6 +81,13 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
Expand All @@ -94,6 +100,13 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.25</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public static Archive<?> createDeploymentPackage() {
.addClass(Query.class)
// required for remote containers in order to run tests with FEST-Asserts
.addPackages(true, "org.assertj.core")
.addPackages(true, "org.apache.tools")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsResource("test-persistence.xml", "META-INF/persistence.xml");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public static Archive<?> createDeploymentPackage() {
.addClass(Query.class)
// required for remote containers in order to run tests with FEST-Asserts
.addPackages(true, "org.assertj.core")
.addPackages(true, "org.apache.tools")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsResource("test-persistence.xml", "META-INF/persistence.xml");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public static Archive<?> createDeploymentPackage() {
.addClass(Query.class)
// required for remote containers in order to run tests with FEST-Asserts
.addPackages(true, "org.assertj.core")
.addPackages(true, "org.apache.tools")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsResource("test-persistence.xml", "META-INF/persistence.xml");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public static Archive<?> createDeploymentPackage() {
.addClass(Query.class)
// required for remote containers in order to run tests with FEST-Asserts
.addPackages(true, "org.assertj.core")
.addPackages(true, "org.apache.tools")
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsManifestResource("test-persistence.xml", "persistence.xml");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public static Archive<?> createDeploymentPackage() {
.addPackage(UserAccount.class.getPackage())
.addClass(Query.class)
.addPackages(true, "org.assertj.core")
.addPackages(true, "org.apache.tools")
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsManifestResource("test-persistence.xml", "persistence.xml");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public static Archive<?> createDeploymentPackage() {
.addClass(Query.class)
// required for remote containers in order to run tests with FEST-Asserts
.addPackages(true, "org.assertj.core")
.addPackages(true, "org.apache.tools")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsResource("test-persistence.xml", "META-INF/persistence.xml");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public static Archive<?> createDeploymentPackage() {
.addClass(Query.class)
// required for remote containers in order to run tests with FEST-Asserts
.addPackages(true, "org.assertj.core")
.addPackages(true, "org.apache.tools")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsResource("test-persistence.xml", "META-INF/persistence.xml");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public static Archive<?> createDeploymentPackage() {
.addClass(Query.class)
// required for remote containers in order to run tests with FEST-Asserts
.addPackages(true, "org.assertj.core")
.addPackages(true, "org.apache.tools")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsResource("test-persistence.xml", "META-INF/persistence.xml");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public static Archive<?> createDeploymentPackage() {
.addClasses(Query.class, UserPersistenceAssertion.class)
// required for remote containers in order to run tests with FEST-Asserts
.addPackages(true, "org.assertj.core")
.addPackages(true, "org.apache.tools")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsResource("test-persistence.xml", "META-INF/persistence.xml");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public static Archive<?> createDeploymentPackage() {
.addClasses(Query.class, UserPersistenceAssertion.class)
// required for remote containers in order to run tests with FEST-Asserts
.addPackages(true, "org.assertj.core")
.addPackages(true, "org.apache.tools")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsResource("test-persistence.xml", "META-INF/persistence.xml");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public static Archive<?> createDeploymentPackage() {
.addClasses(Query.class, UserPersistenceAssertion.class)
// required for remote containers in order to run tests with FEST-Asserts
.addPackages(true, "org.assertj.core")
.addPackages(true, "org.apache.tools")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsResource("test-persistence.xml", "META-INF/persistence.xml");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public static Archive<?> createDeploymentPackage() {
.addPackage(UserAccount.class.getPackage())
// required for remote containers in order to run tests with FEST-Asserts
.addPackages(true, "org.assertj.core")
.addPackages(true, "org.apache.tools")
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsManifestResource("test-persistence.xml", "persistence.xml");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public static Archive<?> createDeploymentPackage() {
.addClass(Query.class)
// required for remote containers in order to run tests with FEST-Asserts
.addPackages(true, "org.assertj.core")
.addPackages(true, "org.apache.tools")
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsManifestResource("test-persistence.xml", "persistence.xml");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public static Archive<?> createDeploymentPackage() {
.addPackage(UserAccount.class.getPackage())
// required for remote containers in order to run tests with FEST-Asserts
.addPackages(true, "org.assertj.core")
.addPackages(true, "org.apache.tools")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsResource("test-persistence.xml", "META-INF/persistence.xml");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,16 @@
*/
package org.jboss.arquillian.integration.persistence.test.cleanup;

import static org.assertj.core.api.Assertions.assertThat;
import static org.jboss.arquillian.persistence.BuiltInCleanupStrategy.STRICT;
import static org.jboss.arquillian.persistence.BuiltInCleanupStrategy.USED_ROWS_ONLY;
import static org.jboss.arquillian.persistence.BuiltInCleanupStrategy.USED_TABLES_ONLY;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.integration.persistence.example.Address;
import org.jboss.arquillian.integration.persistence.example.UserAccount;
Expand All @@ -42,11 +49,6 @@
import org.junit.Test;
import org.junit.runner.RunWith;

import static org.assertj.core.api.Assertions.assertThat;
import static org.jboss.arquillian.persistence.BuiltInCleanupStrategy.STRICT;
import static org.jboss.arquillian.persistence.BuiltInCleanupStrategy.USED_ROWS_ONLY;
import static org.jboss.arquillian.persistence.BuiltInCleanupStrategy.USED_TABLES_ONLY;

@RunWith(Arquillian.class)
public class DataCleanupStrategiesTest {

Expand All @@ -60,6 +62,7 @@ public static Archive<?> createDeploymentPackage() {
.addClass(Query.class)
// required for remote containers in order to run tests with FEST-Asserts
.addPackages(true, "org.assertj.core")
.addPackages(true, "org.apache.tools")
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsManifestResource("test-persistence.xml", "persistence.xml");
}
Expand Down Expand Up @@ -117,9 +120,8 @@ public void should_cleanup_all_tables_defined_in_data_set() {
@DatabaseShouldContainAfterTest({"expected-address.yml"})
@ShouldBeEmptyAfterTest("useraccount")
public void should_seed_using_both_custom_scripts_and_datasets_and_cleanup_all_tables_defined_in_data_set() {
final List<UserAccount> users =
(List<UserAccount>) em.createQuery(Query.selectAllInJPQL(UserAccount.class)).getResultList();
final List<Address> addresses = em.createQuery(Query.selectAllInJPQL(Address.class)).getResultList();
final List<UserAccount> users = em.createQuery(Query.selectAllInJPQL(UserAccount.class), UserAccount.class).getResultList();
final List<Address> addresses = em.createQuery(Query.selectAllInJPQL(Address.class), Address.class).getResultList();

assertThat(users).hasSize(3);
assertThat(addresses).hasSize(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public static Archive<?> createDeploymentPackage() {
.addPackage(UserAccount.class.getPackage())
// required for remote containers in order to run tests with FEST-Asserts
.addPackages(true, "org.assertj.core")
.addPackages(true, "org.apache.tools")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsResource("test-persistence.xml", "META-INF/persistence.xml");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public static Archive<?> createDeploymentPackage() {
.addClass(Query.class)
// required for remote containers in order to run tests with FEST-Asserts
.addPackages(true, "org.assertj.core")
.addPackages(true, "org.apache.tools")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsResource("test-persistence-no-generate.xml", "META-INF/persistence.xml");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public static Archive<?> createDeploymentPackage() {
.addClass(Query.class)
// required for remote containers in order to run tests with FEST-Asserts
.addPackages(true, "org.assertj.core")
.addPackages(true, "org.apache.tools")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsResource("test-persistence-no-generate.xml", "META-INF/persistence.xml");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public static Archive<?> createDeploymentPackage() {
.addPackage(UserAccount.class.getPackage())
// required for remote containers in order to run tests with FEST-Asserts
.addPackages(true, "org.assertj.core")
.addPackages(true, "org.apache.tools")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsResource("test-persistence.xml", "META-INF/persistence.xml");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public static Archive<?> createDeploymentPackage() {
.addPackage(UserAccount.class.getPackage())
.addClass(Query.class)
.addPackages(true, "org.assertj.core")
.addPackages(true, "org.apache.tools")
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsManifestResource("test-persistence-no-generate.xml", "persistence.xml");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ public class InContainerConfigurationEnricherTest {
@Deployment
public static Archive<?> createDeployment() {
return ShrinkWrap.create(JavaArchive.class, "dummy.jar")
.addClass(org.jboss.arquillian.integration.persistence.test.enricher.InContainerConfigurationEnricherTest.class)
.addPackages(true, "org.assertj.core")
.addPackages(true, "org.apache.tools")
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsManifestResource("test-persistence.xml", "persistence.xml");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public static Archive<?> createDeploymentPackage() {
.addPackage(UserAccount.class.getPackage())
.addClass(Query.class)
.addPackages(true, "org.assertj.core")
.addPackages(true, "org.apache.tools")
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsManifestResource("test-persistence.xml", "persistence.xml");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ protected Archive<?> buildArchive() {
PersistenceExtensionTester.class),
this.getClass().getPackage())
.addPackages(true, "org.assertj.core")
.addPackages(true, "org.apache.tools")
.addAsServiceProvider(RemoteLoadableExtension.class, PersistenceExtensionRemoteTester.class);
}
}
23 changes: 17 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,16 @@
<version.arquillian_core>1.1.13.Final</version.arquillian_core>
<version.arquillian_transaction>1.0.3.Final</version.arquillian_transaction>
<version.shrinkwrap.resolver>3.0.0-alpha-4</version.shrinkwrap.resolver>
<version.shrinkwrap.descriptors>2.0.0</version.shrinkwrap.descriptors>
<version.jbossas_spec>3.0.1.Final</version.jbossas_spec>
<version.dbunit>2.5.3</version.dbunit>
<version.mysql.driver>5.1.21</version.mysql.driver>

<version.slf4j>1.7.20</version.slf4j>
<!-- Testing dependencies -->
<version.findbugs.annotations>3.0.0</version.findbugs.annotations>
<version.assertj.core>2.6.0</version.assertj.core>
<version.mockito>1.10.19</version.mockito>
<version.cdi>2.0</version.cdi>

<!-- Containers -->
<version.arq.container.glassfish>1.0.0.CR4</version.arq.container.glassfish>
Expand All @@ -86,12 +88,12 @@

<!-- Maven plugins -->
<version.docker.plugin>0.15.16</version.docker.plugin>
<version.build.helper.plugin>1.10</version.build.helper.plugin>
<version.build.helper.plugin>3.0.0</version.build.helper.plugin>

<!-- Overridden from parent -->
<jdk.min.version>1.5</jdk.min.version>
<maven.compiler.target>1.5</maven.compiler.target>
<maven.compiler.source>1.5</maven.compiler.source>
<jdk.min.version>1.7</jdk.min.version>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.source>1.7</maven.compiler.source>
</properties>

<dependencyManagement>
Expand All @@ -103,6 +105,15 @@
<scope>import</scope>
<type>pom</type>
</dependency>

<dependency>
<groupId>org.jboss.shrinkwrap.descriptors</groupId>
<artifactId>shrinkwrap-descriptors-bom</artifactId>
<version>${version.shrinkwrap.descriptors}</version>
<scope>import</scope>
<type>pom</type>
</dependency>

<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
Expand Down Expand Up @@ -165,7 +176,7 @@
<scope>test</scope>
</dependency>
</dependencies>

<build>
<testResources>
<testResource>
Expand Down