Skip to content

Refine JDBC integration tests #1621

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

Closed
wants to merge 5 commits into from
Closed
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
24 changes: 23 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.springframework.data</groupId>
<artifactId>spring-data-relational-parent</artifactId>
<version>3.2.0-SNAPSHOT</version>
<version>3.2.0-GH-1620-SNAPSHOT</version>
<packaging>pom</packaging>

<name>Spring Data Relational Parent</name>
Expand Down Expand Up @@ -168,6 +168,28 @@
<includes>
<include>**/*Tests.java</include>
</includes>
<excludes>
<exclude>**/*IntegrationTests.java</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>default-test</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<includes>
<include>**/*IntegrationTests.java</include>
</includes>
</configuration>
</execution>
</executions>
Expand Down
2 changes: 1 addition & 1 deletion spring-data-jdbc-distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-relational-parent</artifactId>
<version>3.2.0-SNAPSHOT</version>
<version>3.2.0-GH-1620-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
86 changes: 42 additions & 44 deletions spring-data-jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>

<artifactId>spring-data-jdbc</artifactId>
<version>3.2.0-SNAPSHOT</version>
<version>3.2.0-GH-1620-SNAPSHOT</version>

<name>Spring Data JDBC</name>
<description>Spring Data module for JDBC repositories.</description>
Expand All @@ -15,7 +15,7 @@
<parent>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-relational-parent</artifactId>
<version>3.2.0-SNAPSHOT</version>
<version>3.2.0-GH-1620-SNAPSHOT</version>
</parent>

<properties>
Expand Down Expand Up @@ -235,6 +235,28 @@

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>default-test</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<systemPropertyVariables>
<spring.profiles.active>hsql</spring.profiles.active>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
Expand All @@ -243,21 +265,18 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>postgres-test</id>
<phase>test</phase>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
<goal>integration-test</goal>
</goals>
<configuration>
<includes>
<include>**/*IntegrationTests.java</include>
</includes>
<excludes>
<exclude>**/*HsqlIntegrationTests.java</exclude>
</excludes>
<systemPropertyVariables>
<spring.profiles.active>postgres</spring.profiles.active>
</systemPropertyVariables>
Expand All @@ -274,129 +293,108 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>h2-test</id>
<phase>test</phase>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
<goal>integration-test</goal>
</goals>
<configuration>
<includes>
<include>**/*IntegrationTests.java</include>
</includes>
<excludes>
<exclude>**/*HsqlIntegrationTests.java</exclude>
</excludes>
<systemPropertyVariables>
<spring.profiles.active>h2</spring.profiles.active>
</systemPropertyVariables>
</configuration>
</execution>
<execution>
<id>mysql-test</id>
<phase>test</phase>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
<goal>integration-test</goal>
</goals>
<configuration>
<includes>
<include>**/*IntegrationTests.java</include>
</includes>
<excludes>
<exclude>**/*HsqlIntegrationTests.java</exclude>
</excludes>
<systemPropertyVariables>
<spring.profiles.active>mysql</spring.profiles.active>
</systemPropertyVariables>
</configuration>
</execution>
<execution>
<id>postgres-test</id>
<phase>test</phase>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
<goal>integration-test</goal>
</goals>
<configuration>
<includes>
<include>**/*IntegrationTests.java</include>
</includes>
<excludes>
<exclude>**/*HsqlIntegrationTests.java</exclude>
</excludes>
<systemPropertyVariables>
<spring.profiles.active>postgres</spring.profiles.active>
</systemPropertyVariables>
</configuration>
</execution>
<execution>
<id>mariadb-test</id>
<phase>test</phase>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
<goal>integration-test</goal>
</goals>
<configuration>
<includes>
<include>**/*IntegrationTests.java</include>
</includes>
<excludes>
<exclude>**/*HsqlIntegrationTests.java</exclude>
</excludes>
<systemPropertyVariables>
<spring.profiles.active>mariadb</spring.profiles.active>
</systemPropertyVariables>
</configuration>
</execution>
<execution>
<id>db2-test</id>
<phase>test</phase>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
<goal>integration-test</goal>
</goals>
<configuration>
<includes>
<include>**/*IntegrationTests.java</include>
</includes>
<excludes>
<exclude>**/*HsqlIntegrationTests.java</exclude>
</excludes>
<systemPropertyVariables>
<spring.profiles.active>db2</spring.profiles.active>
</systemPropertyVariables>
</configuration>
</execution>
<execution>
<id>oracle-test</id>
<phase>test</phase>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
<goal>integration-test</goal>
</goals>
<configuration>
<includes>
<include>**/*IntegrationTests.java</include>
</includes>
<excludes>
<exclude>**/*HsqlIntegrationTests.java</exclude>
</excludes>
<systemPropertyVariables>
<spring.profiles.active>oracle</spring.profiles.active>
</systemPropertyVariables>
</configuration>
</execution>
<execution>
<id>mssql-test</id>
<phase>test</phase>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
<goal>integration-test</goal>
</goals>
<configuration>
<includes>
<include>**/*IntegrationTests.java</include>
</includes>
<excludes>
<exclude>**/*HsqlIntegrationTests.java</exclude>
</excludes>
<systemPropertyVariables>
<spring.profiles.active>mssql</spring.profiles.active>
</systemPropertyVariables>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import static org.assertj.core.api.SoftAssertions.*;
import static org.springframework.data.jdbc.testing.TestConfiguration.*;
import static org.springframework.data.jdbc.testing.TestDatabaseFeatures.Feature.*;
import static org.springframework.test.context.TestExecutionListeners.MergeMode.*;

import java.time.LocalDateTime;
import java.util.ArrayList;
Expand All @@ -38,7 +37,6 @@

import org.assertj.core.api.SoftAssertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.annotation.Bean;
Expand All @@ -55,9 +53,8 @@
import org.springframework.data.domain.Sort;
import org.springframework.data.jdbc.core.convert.DataAccessStrategy;
import org.springframework.data.jdbc.core.convert.JdbcConverter;
import org.springframework.data.jdbc.testing.AssumeFeatureTestExecutionListener;
import org.springframework.data.jdbc.testing.CombiningActiveProfileResolver;
import org.springframework.data.jdbc.testing.EnabledOnFeature;
import org.springframework.data.jdbc.testing.IntegrationTest;
import org.springframework.data.jdbc.testing.TestConfiguration;
import org.springframework.data.jdbc.testing.TestDatabaseFeatures;
import org.springframework.data.mapping.context.InvalidPersistentPropertyPath;
Expand All @@ -69,10 +66,6 @@
import org.springframework.data.relational.core.mapping.Table;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.transaction.annotation.Transactional;

/**
* Integration tests for {@link JdbcAggregateTemplate}.
Expand All @@ -89,10 +82,7 @@
* @author Chirag Tailor
* @author Vincent Galloy
*/
@ContextConfiguration
@Transactional
@TestExecutionListeners(value = AssumeFeatureTestExecutionListener.class, mergeMode = MERGE_WITH_DEFAULTS)
@ExtendWith(SpringExtension.class)
@IntegrationTest
abstract class AbstractJdbcAggregateTemplateIntegrationTests {

@Autowired JdbcAggregateOperations template;
Expand Down Expand Up @@ -1611,6 +1601,7 @@ public boolean isNew() {
return getId() == null;
}

@Override
public Long getId() {
return this.id;
}
Expand Down Expand Up @@ -1658,18 +1649,15 @@ public Long getVersion() {
public boolean equals(final Object o) {
if (o == this)
return true;
if (!(o instanceof AggregateWithImmutableVersion))
if (!(o instanceof final AggregateWithImmutableVersion other))
return false;
final AggregateWithImmutableVersion other = (AggregateWithImmutableVersion) o;
final Object this$id = this.id;
final Object other$id = other.id;
if (this$id == null ? other$id != null : !this$id.equals(other$id))
if (!Objects.equals(this$id, other$id))
return false;
final Object this$version = this.getVersion();
final Object other$version = other.getVersion();
if (this$version == null ? other$version != null : !this$version.equals(other$version))
return false;
return true;
return Objects.equals(this$version, other$version);
}

public int hashCode() {
Expand Down Expand Up @@ -1722,18 +1710,15 @@ public String toString() {
public boolean equals(final Object o) {
if (o == this)
return true;
if (!(o instanceof ConstructorInvocation))
if (!(o instanceof final ConstructorInvocation other))
return false;
final ConstructorInvocation other = (ConstructorInvocation) o;
final Object this$id = this.id;
final Object other$id = other.id;
if (this$id == null ? other$id != null : !this$id.equals(other$id))
if (!Objects.equals(this$id, other$id))
return false;
final Object this$version = this.getVersion();
final Object other$version = other.getVersion();
if (this$version == null ? other$version != null : !this$version.equals(other$version))
return false;
return true;
return Objects.equals(this$version, other$version);
}

public int hashCode() {
Expand All @@ -1757,6 +1742,7 @@ void setVersion(Number newVersion) {
this.version = (Long) newVersion;
}

@Override
public Long getVersion() {
return this.version;
}
Expand Down Expand Up @@ -1788,6 +1774,7 @@ void setVersion(Number newVersion) {
this.version = (Integer) newVersion;
}

@Override
public Integer getVersion() {
return this.version;
}
Expand Down Expand Up @@ -1819,6 +1806,7 @@ void setVersion(Number newVersion) {
this.version = (Short) newVersion;
}

@Override
public Short getVersion() {
return this.version;
}
Expand Down Expand Up @@ -1876,7 +1864,7 @@ JdbcAggregateOperations operations(ApplicationEventPublisher publisher, Relation

static class JdbcAggregateTemplateIntegrationTests extends AbstractJdbcAggregateTemplateIntegrationTests {}

@ActiveProfiles(value = PROFILE_SINGLE_QUERY_LOADING, resolver = CombiningActiveProfileResolver.class)
@ActiveProfiles(value = PROFILE_SINGLE_QUERY_LOADING)
static class JdbcAggregateTemplateSingleQueryLoadingIntegrationTests
extends AbstractJdbcAggregateTemplateIntegrationTests {

Expand Down
Loading