Browse Source

DATAJDBC-386 - Polishing.

Tests that used the `@Column` annotation to map multiple properties to a single database column failed.
Mapping multiple values to one column is possible to allow for entities inside an aggregate to have the id of the aggregate as ID or as part of the ID.

The reason for the test failures was that columns get referred to by different ways:
Once per DerivedSqlIdentifier (i.e. with normalized spelling).
And Once per `@Column` annotation.

SqlIdentifier from an `@Column` annotation have always the same spelling, while the normalized version depends on the `Dialect`.

In order to make the tests work for all databases all references to the column in question had to get a `@Column` annotation.
This in turn required the create scripts to also use quoting when the normal case of the database did not match the case chosen in the annotation.

Finally there were some tests that used hand coded SQL which now uses `SqlIdentifier` and an injected `Dialect` to arrive at the correct SQL syntax.

Removed a couple of `@Ignore` annotations that got left in the code.

Original pull request: #182.
pull/187/head
Jens Schauder 6 years ago committed by Mark Paluch
parent
commit
36b419e712
No known key found for this signature in database
GPG Key ID: 51A00FA751B91849
  1. 2
      spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/AggregateChangeIdGenerationImmutableUnitTests.java
  2. 2
      spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/JdbcAggregateTemplateIntegrationTests.java
  3. 1
      spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/DefaultDataAccessStrategyUnitTests.java
  4. 1
      spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/SqlIdentifierParameterSourceUnitTests.java
  5. 1
      spring-data-jdbc/src/test/java/org/springframework/data/jdbc/mybatis/MyBatisDataAccessStrategyUnitTests.java
  6. 39
      spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryEmbeddedNotInAggregateRootIntegrationTests.java
  7. 46
      spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryEmbeddedWithCollectionIntegrationTests.java
  8. 37
      spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryEmbeddedWithReferenceIntegrationTests.java
  9. 2
      spring-data-jdbc/src/test/resources/logback.xml
  10. 19
      spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.core/JdbcAggregateTemplateIntegrationTests-postgres.sql
  11. 13
      spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedNotInAggregateRootIntegrationTests-mysql.sql
  12. 13
      spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedNotInAggregateRootIntegrationTests-postgres.sql
  13. 15
      spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedWithCollectionIntegrationTests-postgres.sql
  14. 22
      spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedWithReferenceIntegrationTests-postgres.sql
  15. 1
      spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/CompositeSqlIdentifier.java
  16. 2
      spring-data-relational/src/test/java/org/springframework/data/relational/domain/IdentifierUnitTests.java

2
spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/AggregateChangeIdGenerationImmutableUnitTests.java

@ -486,8 +486,6 @@ public class AggregateChangeIdGenerationImmutableUnitTests { @@ -486,8 +486,6 @@ public class AggregateChangeIdGenerationImmutableUnitTests {
@With
@AllArgsConstructor
private static class ContentNoId {
// "foo_bar_single"
// "FOO_BAR_TAG_SET"
@Column("single") Tag single;
Set<Tag> tagSet;
List<Tag> tagList;

2
spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/JdbcAggregateTemplateIntegrationTests.java

@ -821,6 +821,7 @@ public class JdbcAggregateTemplateIntegrationTests { @@ -821,6 +821,7 @@ public class JdbcAggregateTemplateIntegrationTests {
return jdbcTemplate.queryForObject("SELECT COUNT(*) FROM " + tableName, emptyMap(), Long.class);
}
@Table("ARRAY_OWNER")
private static class ArrayOwner {
@Id Long id;
@ -1039,7 +1040,6 @@ public class JdbcAggregateTemplateIntegrationTests { @@ -1039,7 +1040,6 @@ public class JdbcAggregateTemplateIntegrationTests {
@Id private Long id;
@Version private final Long version;
}
@Data

1
spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/DefaultDataAccessStrategyUnitTests.java

@ -50,7 +50,6 @@ import org.springframework.jdbc.support.KeyHolder; @@ -50,7 +50,6 @@ import org.springframework.jdbc.support.KeyHolder;
* @author Jens Schauder
* @author Mark Paluch
*/
@Ignore
public class DefaultDataAccessStrategyUnitTests {
public static final long ID_FROM_ADDITIONAL_VALUES = 23L;

1
spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/SqlIdentifierParameterSourceUnitTests.java

@ -16,7 +16,6 @@ @@ -16,7 +16,6 @@
package org.springframework.data.jdbc.core.convert;
import org.assertj.core.api.SoftAssertions;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.data.relational.core.sql.IdentifierProcessing;
import org.springframework.data.relational.core.sql.SqlIdentifier;

1
spring-data-jdbc/src/test/java/org/springframework/data/jdbc/mybatis/MyBatisDataAccessStrategyUnitTests.java

@ -47,7 +47,6 @@ import org.springframework.data.relational.core.sql.IdentifierProcessing; @@ -47,7 +47,6 @@ import org.springframework.data.relational.core.sql.IdentifierProcessing;
* @author Mark Paluch
* @author Tyler Van Gorder
*/
@Ignore
public class MyBatisDataAccessStrategyUnitTests {
RelationalMappingContext context = new JdbcMappingContext();

39
spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryEmbeddedNotInAggregateRootIntegrationTests.java

@ -20,6 +20,8 @@ import static org.assertj.core.api.Assertions.*; @@ -20,6 +20,8 @@ import static org.assertj.core.api.Assertions.*;
import lombok.Data;
import java.sql.SQLException;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
@ -30,6 +32,7 @@ import org.springframework.context.annotation.Import; @@ -30,6 +32,7 @@ import org.springframework.context.annotation.Import;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.repository.support.JdbcRepositoryFactory;
import org.springframework.data.jdbc.testing.TestConfiguration;
import org.springframework.data.relational.core.dialect.Dialect;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Embedded;
import org.springframework.data.relational.core.mapping.Embedded.OnEmpty;
@ -75,17 +78,24 @@ public class JdbcRepositoryEmbeddedNotInAggregateRootIntegrationTests { @@ -75,17 +78,24 @@ public class JdbcRepositoryEmbeddedNotInAggregateRootIntegrationTests {
@Autowired NamedParameterJdbcTemplate template;
@Autowired DummyEntityRepository repository;
@Autowired Dialect dialect;
@Test // DATAJDBC-111
public void savesAnEntity() {
public void savesAnEntity() throws SQLException {
DummyEntity entity = repository.save(createDummyEntity());
assertThat(JdbcTestUtils.countRowsInTableWhere((JdbcTemplate) template.getJdbcOperations(), "dummy_entity",
"id = " + entity.getId())).isEqualTo(1);
assertThat(countRowsInTable("dummy_entity", entity.getId())).isEqualTo(1);
assertThat(countRowsInTable("dummy_entity2", entity.getId())).isEqualTo(1);
}
private int countRowsInTable(String name, long idValue) {
SqlIdentifier id = SqlIdentifier.quoted("ID");
String whereClause = id.toSql(dialect.getIdentifierProcessing()) + " = " + idValue;
assertThat(JdbcTestUtils.countRowsInTableWhere((JdbcTemplate) template.getJdbcOperations(), "dummy_entity2",
"id = " + entity.getId())).isEqualTo(1);
return JdbcTestUtils.countRowsInTableWhere((JdbcTemplate) template.getJdbcOperations(),
name, whereClause);
}
@Test // DATAJDBC-111
@ -96,7 +106,8 @@ public class JdbcRepositoryEmbeddedNotInAggregateRootIntegrationTests { @@ -96,7 +106,8 @@ public class JdbcRepositoryEmbeddedNotInAggregateRootIntegrationTests {
assertThat(repository.findById(entity.getId())).hasValueSatisfying(it -> {
assertThat(it.getId()).isEqualTo(entity.getId());
assertThat(it.getDummyEntity2().getTest()).isEqualTo(entity.getDummyEntity2().getTest());
assertThat(it.getDummyEntity2().getEmbeddable().getAttr()).isEqualTo(entity.getDummyEntity2().getEmbeddable().getAttr());
assertThat(it.getDummyEntity2().getEmbeddable().getAttr())
.isEqualTo(entity.getDummyEntity2().getEmbeddable().getAttr());
});
}
@ -131,7 +142,8 @@ public class JdbcRepositoryEmbeddedNotInAggregateRootIntegrationTests { @@ -131,7 +142,8 @@ public class JdbcRepositoryEmbeddedNotInAggregateRootIntegrationTests {
assertThat(repository.findById(entity.getId())).hasValueSatisfying(it -> {
assertThat(it.getDummyEntity2().getTest()).isEqualTo(saved.getDummyEntity2().getTest());
assertThat(it.getDummyEntity2().getEmbeddable().getAttr()).isEqualTo(saved.getDummyEntity2().getEmbeddable().getAttr());
assertThat(it.getDummyEntity2().getEmbeddable().getAttr())
.isEqualTo(saved.getDummyEntity2().getEmbeddable().getAttr());
});
}
@ -155,7 +167,8 @@ public class JdbcRepositoryEmbeddedNotInAggregateRootIntegrationTests { @@ -155,7 +167,8 @@ public class JdbcRepositoryEmbeddedNotInAggregateRootIntegrationTests {
assertThat(repository.findAll()) //
.extracting(d -> d.getDummyEntity2().getEmbeddable().getAttr()) //
.containsExactlyInAnyOrder(entity.getDummyEntity2().getEmbeddable().getAttr(), other.getDummyEntity2().getEmbeddable().getAttr());
.containsExactlyInAnyOrder(entity.getDummyEntity2().getEmbeddable().getAttr(),
other.getDummyEntity2().getEmbeddable().getAttr());
}
@Test // DATAJDBC-111
@ -234,22 +247,20 @@ public class JdbcRepositoryEmbeddedNotInAggregateRootIntegrationTests { @@ -234,22 +247,20 @@ public class JdbcRepositoryEmbeddedNotInAggregateRootIntegrationTests {
@Data
static class DummyEntity {
@Id Long id;
@Column("ID") @Id Long id;
String test;
@Column("ID")
DummyEntity2 dummyEntity2;
@Column("ID") DummyEntity2 dummyEntity2;
}
@Data
static class DummyEntity2 {
@Id Long id;
@Column("ID") @Id Long id;
String test;
@Embedded(onEmpty = OnEmpty.USE_NULL, prefix = "prefix_")
Embeddable embeddable;
@Embedded(onEmpty = OnEmpty.USE_NULL, prefix = "prefix_") Embeddable embeddable;
}
@Data

46
spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryEmbeddedWithCollectionIntegrationTests.java

@ -20,6 +20,10 @@ import static org.assertj.core.api.Assertions.*; @@ -20,6 +20,10 @@ import static org.assertj.core.api.Assertions.*;
import lombok.Data;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
@ -30,6 +34,7 @@ import org.springframework.context.annotation.Import; @@ -30,6 +34,7 @@ import org.springframework.context.annotation.Import;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.repository.support.JdbcRepositoryFactory;
import org.springframework.data.jdbc.testing.TestConfiguration;
import org.springframework.data.relational.core.dialect.Dialect;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Embedded;
import org.springframework.data.relational.core.mapping.Embedded.OnEmpty;
@ -44,9 +49,6 @@ import org.springframework.test.context.junit4.rules.SpringMethodRule; @@ -44,9 +49,6 @@ import org.springframework.test.context.junit4.rules.SpringMethodRule;
import org.springframework.test.jdbc.JdbcTestUtils;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
* Very simple use cases for creation and usage of JdbcRepositories with test {@link Embedded} annotation in Entities.
*
@ -79,17 +81,23 @@ public class JdbcRepositoryEmbeddedWithCollectionIntegrationTests { @@ -79,17 +81,23 @@ public class JdbcRepositoryEmbeddedWithCollectionIntegrationTests {
@Autowired NamedParameterJdbcTemplate template;
@Autowired DummyEntityRepository repository;
@Autowired Dialect dialect;
@Test // DATAJDBC-111
public void savesAnEntity() {
public void savesAnEntity() throws SQLException {
DummyEntity entity = repository.save(createDummyEntity());
assertThat(JdbcTestUtils.countRowsInTableWhere((JdbcTemplate) template.getJdbcOperations(), "dummy_entity",
"id = " + entity.getId())).isEqualTo(1);
assertThat(countRowsInTable("dummy_entity", entity.getId())).isEqualTo(1);
assertThat(countRowsInTable("dummy_entity2", entity.getId())).isEqualTo(2);
}
private int countRowsInTable(String name, long idValue) {
SqlIdentifier id = SqlIdentifier.quoted("ID");
String whereClause = id.toSql(dialect.getIdentifierProcessing()) + " = " + idValue;
assertThat(JdbcTestUtils.countRowsInTableWhere((JdbcTemplate) template.getJdbcOperations(), "dummy_entity2",
"id = " + entity.getId())).isEqualTo(2);
return JdbcTestUtils.countRowsInTableWhere((JdbcTemplate) template.getJdbcOperations(), name, whereClause);
}
@Test // DATAJDBC-111
@ -101,8 +109,10 @@ public class JdbcRepositoryEmbeddedWithCollectionIntegrationTests { @@ -101,8 +109,10 @@ public class JdbcRepositoryEmbeddedWithCollectionIntegrationTests {
assertThat(it.getId()).isEqualTo(entity.getId());
assertThat(it.getEmbeddable().getTest()).isEqualTo(entity.getEmbeddable().getTest());
assertThat(it.getEmbeddable().getList().size()).isEqualTo(entity.getEmbeddable().getList().size());
assertThat(it.getEmbeddable().getList().get(0).getTest()).isEqualTo(entity.getEmbeddable().getList().get(0).getTest());
assertThat(it.getEmbeddable().getList().get(1).getTest()).isEqualTo(entity.getEmbeddable().getList().get(1).getTest());
assertThat(it.getEmbeddable().getList().get(0).getTest())
.isEqualTo(entity.getEmbeddable().getList().get(0).getTest());
assertThat(it.getEmbeddable().getList().get(1).getTest())
.isEqualTo(entity.getEmbeddable().getList().get(1).getTest());
});
}
@ -139,8 +149,10 @@ public class JdbcRepositoryEmbeddedWithCollectionIntegrationTests { @@ -139,8 +149,10 @@ public class JdbcRepositoryEmbeddedWithCollectionIntegrationTests {
assertThat(it.getId()).isEqualTo(saved.getId());
assertThat(it.getEmbeddable().getTest()).isEqualTo(saved.getEmbeddable().getTest());
assertThat(it.getEmbeddable().getList().size()).isEqualTo(saved.getEmbeddable().getList().size());
assertThat(it.getEmbeddable().getList().get(0).getTest()).isEqualTo(saved.getEmbeddable().getList().get(0).getTest());
assertThat(it.getEmbeddable().getList().get(1).getTest()).isEqualTo(saved.getEmbeddable().getList().get(1).getTest());
assertThat(it.getEmbeddable().getList().get(0).getTest())
.isEqualTo(saved.getEmbeddable().getList().get(0).getTest());
assertThat(it.getEmbeddable().getList().get(1).getTest())
.isEqualTo(saved.getEmbeddable().getList().get(1).getTest());
});
}
@ -164,7 +176,8 @@ public class JdbcRepositoryEmbeddedWithCollectionIntegrationTests { @@ -164,7 +176,8 @@ public class JdbcRepositoryEmbeddedWithCollectionIntegrationTests {
assertThat(repository.findAll()) //
.extracting(d -> d.getEmbeddable().getList().get(0).getTest()) //
.containsExactlyInAnyOrder(entity.getEmbeddable().getList().get(0).getTest(), other.getEmbeddable().getList().get(0).getTest());
.containsExactlyInAnyOrder(entity.getEmbeddable().getList().get(0).getTest(),
other.getEmbeddable().getList().get(0).getTest());
}
@Test // DATAJDBC-111
@ -247,18 +260,17 @@ public class JdbcRepositoryEmbeddedWithCollectionIntegrationTests { @@ -247,18 +260,17 @@ public class JdbcRepositoryEmbeddedWithCollectionIntegrationTests {
@Data
private static class DummyEntity {
@Column("ID")
@Id Long id;
String test;
@Embedded(onEmpty = OnEmpty.USE_NULL, prefix = "PREFIX_")
Embeddable embeddable;
@Embedded(onEmpty = OnEmpty.USE_NULL, prefix = "PREFIX_") Embeddable embeddable;
}
@Data
private static class Embeddable {
@MappedCollection(idColumn = "ID", keyColumn = "ORDER_KEY")
List<DummyEntity2> list = new ArrayList<>();
@MappedCollection(idColumn = "ID", keyColumn = "ORDER_KEY") List<DummyEntity2> list = new ArrayList<>();
String test;
}

37
spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryEmbeddedWithReferenceIntegrationTests.java

@ -20,6 +20,8 @@ import static org.assertj.core.api.Assertions.*; @@ -20,6 +20,8 @@ import static org.assertj.core.api.Assertions.*;
import lombok.Data;
import java.sql.SQLException;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
@ -30,6 +32,7 @@ import org.springframework.context.annotation.Import; @@ -30,6 +32,7 @@ import org.springframework.context.annotation.Import;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.repository.support.JdbcRepositoryFactory;
import org.springframework.data.jdbc.testing.TestConfiguration;
import org.springframework.data.relational.core.dialect.Dialect;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Embedded;
import org.springframework.data.relational.core.mapping.Embedded.OnEmpty;
@ -75,17 +78,23 @@ public class JdbcRepositoryEmbeddedWithReferenceIntegrationTests { @@ -75,17 +78,23 @@ public class JdbcRepositoryEmbeddedWithReferenceIntegrationTests {
@Autowired NamedParameterJdbcTemplate template;
@Autowired DummyEntityRepository repository;
@Autowired Dialect dialect;
@Test // DATAJDBC-111
public void savesAnEntity() {
DummyEntity entity = repository.save(createDummyEntity());
assertThat(JdbcTestUtils.countRowsInTableWhere((JdbcTemplate) template.getJdbcOperations(), "dummy_entity",
"id = " + entity.getId())).isEqualTo(1);
assertThat(countRowsInTable("dummy_entity", entity.getId())).isEqualTo(1);
assertThat(countRowsInTable("dummy_entity2", entity.getId())).isEqualTo(1);
}
private int countRowsInTable(String name, long idValue) {
assertThat(JdbcTestUtils.countRowsInTableWhere((JdbcTemplate) template.getJdbcOperations(), "dummy_entity2",
"id = " + entity.getId())).isEqualTo(1);
SqlIdentifier id = SqlIdentifier.quoted("ID");
String whereClause = id.toSql(dialect.getIdentifierProcessing()) + " = " + idValue;
return JdbcTestUtils.countRowsInTableWhere((JdbcTemplate) template.getJdbcOperations(), name, whereClause);
}
@Test // DATAJDBC-111
@ -96,7 +105,8 @@ public class JdbcRepositoryEmbeddedWithReferenceIntegrationTests { @@ -96,7 +105,8 @@ public class JdbcRepositoryEmbeddedWithReferenceIntegrationTests {
assertThat(repository.findById(entity.getId())).hasValueSatisfying(it -> {
assertThat(it.getId()).isEqualTo(entity.getId());
assertThat(it.getEmbeddable().getTest()).isEqualTo(entity.getEmbeddable().getTest());
assertThat(it.getEmbeddable().getDummyEntity2().getTest()).isEqualTo(entity.getEmbeddable().getDummyEntity2().getTest());
assertThat(it.getEmbeddable().getDummyEntity2().getTest())
.isEqualTo(entity.getEmbeddable().getDummyEntity2().getTest());
});
}
@ -131,7 +141,8 @@ public class JdbcRepositoryEmbeddedWithReferenceIntegrationTests { @@ -131,7 +141,8 @@ public class JdbcRepositoryEmbeddedWithReferenceIntegrationTests {
assertThat(repository.findById(entity.getId())).hasValueSatisfying(it -> {
assertThat(it.getEmbeddable().getTest()).isEqualTo(saved.getEmbeddable().getTest());
assertThat(it.getEmbeddable().getDummyEntity2().getTest()).isEqualTo(saved.getEmbeddable().getDummyEntity2().getTest());
assertThat(it.getEmbeddable().getDummyEntity2().getTest())
.isEqualTo(saved.getEmbeddable().getDummyEntity2().getTest());
});
}
@ -155,7 +166,8 @@ public class JdbcRepositoryEmbeddedWithReferenceIntegrationTests { @@ -155,7 +166,8 @@ public class JdbcRepositoryEmbeddedWithReferenceIntegrationTests {
assertThat(repository.findAll()) //
.extracting(d -> d.getEmbeddable().getDummyEntity2().getTest()) //
.containsExactlyInAnyOrder(entity.getEmbeddable().getDummyEntity2().getTest(), other.getEmbeddable().getDummyEntity2().getTest());
.containsExactlyInAnyOrder(entity.getEmbeddable().getDummyEntity2().getTest(),
other.getEmbeddable().getDummyEntity2().getTest());
}
@Test // DATAJDBC-111
@ -234,19 +246,18 @@ public class JdbcRepositoryEmbeddedWithReferenceIntegrationTests { @@ -234,19 +246,18 @@ public class JdbcRepositoryEmbeddedWithReferenceIntegrationTests {
@Data
private static class DummyEntity {
@Id Long id;
@Column("ID") @Id Long id;
String test;
@Embedded(onEmpty = OnEmpty.USE_NULL, prefix = "PREFIX_")
Embeddable embeddable;
@Embedded(onEmpty = OnEmpty.USE_NULL, prefix = "PREFIX_") Embeddable embeddable;
}
@Data
private static class Embeddable {
@Column("ID")
DummyEntity2 dummyEntity2;
@Column("ID") DummyEntity2 dummyEntity2;
String test;
}
@ -254,7 +265,7 @@ public class JdbcRepositoryEmbeddedWithReferenceIntegrationTests { @@ -254,7 +265,7 @@ public class JdbcRepositoryEmbeddedWithReferenceIntegrationTests {
@Data
private static class DummyEntity2 {
@Id Long id;
@Column("ID") @Id Long id;
String test;
}

2
spring-data-jdbc/src/test/resources/logback.xml

@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
</appender>
<!--<logger name="org.springframework.data" level="info" />-->
<!--<logger name="org.springframework.jdbc.core" level="trace" />-->
<logger name="org.springframework.jdbc.core" level="trace" />
<!--<logger name="org.springframework.data.jdbc.mybatis.DummyEntityMapper" level="trace" />-->
<root level="warn">

19
spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.core/JdbcAggregateTemplateIntegrationTests-postgres.sql

@ -15,12 +15,12 @@ DROP TABLE WITH_READ_ONLY; @@ -15,12 +15,12 @@ DROP TABLE WITH_READ_ONLY;
CREATE TABLE LEGO_SET
(
"id1" SERIAL PRIMARY KEY,
NAME VARCHAR(30)
"id1" SERIAL PRIMARY KEY,
NAME VARCHAR(30)
);
CREATE TABLE MANUAL
(
"id2" SERIAL PRIMARY KEY,
"id2" SERIAL PRIMARY KEY,
LEGO_SET BIGINT,
ALTERNATIVE BIGINT,
CONTENT VARCHAR(2000)
@ -32,7 +32,7 @@ ALTER TABLE MANUAL @@ -32,7 +32,7 @@ ALTER TABLE MANUAL
CREATE TABLE ONE_TO_ONE_PARENT
(
"id3" SERIAL PRIMARY KEY,
"id3" SERIAL PRIMARY KEY,
content VARCHAR(30)
);
CREATE TABLE Child_No_Id
@ -43,9 +43,10 @@ CREATE TABLE Child_No_Id @@ -43,9 +43,10 @@ CREATE TABLE Child_No_Id
CREATE TABLE LIST_PARENT
(
"id4" SERIAL PRIMARY KEY,
NAME VARCHAR(100)
"id4" SERIAL PRIMARY KEY,
NAME VARCHAR(100)
);
CREATE TABLE element_no_id
(
content VARCHAR(100),
@ -53,14 +54,14 @@ CREATE TABLE element_no_id @@ -53,14 +54,14 @@ CREATE TABLE element_no_id
LIST_PARENT INTEGER
);
CREATE TABLE ARRAY_OWNER
CREATE TABLE "ARRAY_OWNER"
(
ID SERIAL PRIMARY KEY,
DIGITS VARCHAR(20)[10],
MULTIDIMENSIONAL VARCHAR(20)[10][10]
);
CREATE TABLE BYTE_ARRAY_OWNER RelationalPersistentEntityImplUnitTests.
CREATE TABLE BYTE_ARRAY_OWNER
(
ID SERIAL PRIMARY KEY,
BINARY_DATA BYTEA NOT NULL
@ -305,7 +306,7 @@ CREATE TABLE NO_ID_MAP_CHAIN0 @@ -305,7 +306,7 @@ CREATE TABLE NO_ID_MAP_CHAIN0
)
);
CREATE TABLE VERSIONED_AGGREGATE
CREATE TABLE "VERSIONED_AGGREGATE"
(
ID SERIAL PRIMARY KEY,
VERSION BIGINT

13
spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedNotInAggregateRootIntegrationTests-mysql.sql

@ -1,2 +1,11 @@ @@ -1,2 +1,11 @@
CREATE TABLE dummy_entity (id BIGINT AUTO_INCREMENT PRIMARY KEY, TEST VARCHAR(100));
CREATE TABLE dummy_entity2 (id BIGINT AUTO_INCREMENT PRIMARY KEY, TEST VARCHAR(100), PREFIX_ATTR BIGINT);
CREATE TABLE dummy_entity
(
ID BIGINT AUTO_INCREMENT PRIMARY KEY,
TEST VARCHAR(100)
);
CREATE TABLE dummy_entity2
(
ID BIGINT PRIMARY KEY,
TEST VARCHAR(100),
PREFIX_ATTR BIGINT
);

13
spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedNotInAggregateRootIntegrationTests-postgres.sql

@ -1,4 +1,13 @@ @@ -1,4 +1,13 @@
DROP TABLE dummy_entity;
CREATE TABLE dummy_entity (id SERIAL PRIMARY KEY, TEST VARCHAR(100));
CREATE TABLE dummy_entity
(
"ID" SERIAL PRIMARY KEY,
TEST VARCHAR(100)
);
DROP TABLE dummy_entity2;
CREATE TABLE dummy_entity2 (id SERIAL PRIMARY KEY, TEST VARCHAR(100), PREFIX_ATTR BIGINT);
CREATE TABLE dummy_entity2
(
"ID" INTEGER PRIMARY KEY,
TEST VARCHAR(100),
PREFIX_ATTR BIGINT
);

15
spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedWithCollectionIntegrationTests-postgres.sql

@ -1,4 +1,15 @@ @@ -1,4 +1,15 @@
DROP TABLE dummy_entity;
CREATE TABLE dummy_entity (id SERIAL PRIMARY KEY, TEST VARCHAR(100), PREFIX_TEST VARCHAR(100));
CREATE TABLE dummy_entity
(
"ID" SERIAL PRIMARY KEY,
TEST VARCHAR(100),
PREFIX_TEST VARCHAR(100)
);
DROP TABLE dummy_entity2;
CREATE TABLE dummy_entity2 (id BIGINT, ORDER_KEY BIGINT, TEST VARCHAR(100), PRIMARY KEY (id, ORDER_KEY));
CREATE TABLE dummy_entity2
(
"ID" BIGINT,
"ORDER_KEY" BIGINT,
TEST VARCHAR(100),
PRIMARY KEY ("ID", "ORDER_KEY")
);

22
spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryEmbeddedWithReferenceIntegrationTests-postgres.sql

@ -1,4 +1,22 @@ @@ -1,4 +1,22 @@
DROP TABLE dummy_entity;
CREATE TABLE dummy_entity (id SERIAL PRIMARY KEY, TEST VARCHAR(100), PREFIX_TEST VARCHAR(100));
CREATE TABLE dummy_entity
(
"ID" SERIAL PRIMARY KEY,
TEST VARCHAR(100),
PREFIX_TEST VARCHAR(100)
);
DROP TABLE dummy_entity2;
CREATE TABLE dummy_entity2 (id SERIAL PRIMARY KEY, TEST VARCHAR(100));
CREATE TABLE dummy_entity2
(
"ID" SERIAL PRIMARY KEY,
TEST VARCHAR(100)
);
--
-- SELECT "dummy_entity"."ID" AS "ID",
-- "dummy_entity"."test" AS "test",
-- "dummy_entity"."prefix_test" AS "prefix_test",
-- "PREFIX_dummyEntity2"."id" AS "prefix_dummyentity2_id",
-- "PREFIX_dummyEntity2"."test" AS "prefix_dummyentity2_test"
-- FROM "dummy_entity"
-- LEFT OUTER JOIN "dummy_entity2" AS "PREFIX_dummyEntity2" ON
-- "PREFIX_dummyEntity2"."ID" = "dummy_entity"."ID"

1
spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/CompositeSqlIdentifier.java

@ -32,6 +32,7 @@ class CompositeSqlIdentifier implements SqlIdentifier { @@ -32,6 +32,7 @@ class CompositeSqlIdentifier implements SqlIdentifier {
private final SqlIdentifier[] parts;
CompositeSqlIdentifier(SqlIdentifier... parts) {
Assert.notNull(parts, "SqlIdentifier parts must not be null");
Assert.noNullElements(parts, "SqlIdentifier parts must not contain null elements");
Assert.isTrue(parts.length > 0, "SqlIdentifier parts must not be empty");

2
spring-data-relational/src/test/java/org/springframework/data/relational/domain/IdentifierUnitTests.java

@ -23,7 +23,6 @@ import java.util.Collections; @@ -23,7 +23,6 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.data.relational.core.sql.IdentifierProcessing;
@ -35,7 +34,6 @@ import org.springframework.data.relational.core.sql.SqlIdentifier; @@ -35,7 +34,6 @@ import org.springframework.data.relational.core.sql.SqlIdentifier;
* @author Jens Schauder
* @author Mark Paluch
*/
@Ignore
public class IdentifierUnitTests {
@Test // DATAJDBC-326

Loading…
Cancel
Save