|
|
|
@ -34,6 +34,7 @@ import java.util.List; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.Optional; |
|
|
|
import java.util.Optional; |
|
|
|
import java.util.Set; |
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
import java.util.function.Consumer; |
|
|
|
import java.util.stream.Stream; |
|
|
|
import java.util.stream.Stream; |
|
|
|
|
|
|
|
|
|
|
|
import org.junit.jupiter.api.BeforeEach; |
|
|
|
import org.junit.jupiter.api.BeforeEach; |
|
|
|
@ -41,6 +42,7 @@ import org.junit.jupiter.api.Test; |
|
|
|
import org.junit.jupiter.params.ParameterizedTest; |
|
|
|
import org.junit.jupiter.params.ParameterizedTest; |
|
|
|
import org.junit.jupiter.params.provider.Arguments; |
|
|
|
import org.junit.jupiter.params.provider.Arguments; |
|
|
|
import org.junit.jupiter.params.provider.MethodSource; |
|
|
|
import org.junit.jupiter.params.provider.MethodSource; |
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.config.PropertiesFactoryBean; |
|
|
|
import org.springframework.beans.factory.config.PropertiesFactoryBean; |
|
|
|
import org.springframework.context.ApplicationListener; |
|
|
|
import org.springframework.context.ApplicationListener; |
|
|
|
@ -50,7 +52,16 @@ import org.springframework.context.annotation.Import; |
|
|
|
import org.springframework.core.io.ClassPathResource; |
|
|
|
import org.springframework.core.io.ClassPathResource; |
|
|
|
import org.springframework.dao.IncorrectResultSizeDataAccessException; |
|
|
|
import org.springframework.dao.IncorrectResultSizeDataAccessException; |
|
|
|
import org.springframework.data.annotation.Id; |
|
|
|
import org.springframework.data.annotation.Id; |
|
|
|
import org.springframework.data.domain.*; |
|
|
|
import org.springframework.data.domain.Example; |
|
|
|
|
|
|
|
import org.springframework.data.domain.ExampleMatcher; |
|
|
|
|
|
|
|
import org.springframework.data.domain.Limit; |
|
|
|
|
|
|
|
import org.springframework.data.domain.Page; |
|
|
|
|
|
|
|
import org.springframework.data.domain.PageRequest; |
|
|
|
|
|
|
|
import org.springframework.data.domain.Pageable; |
|
|
|
|
|
|
|
import org.springframework.data.domain.ScrollPosition; |
|
|
|
|
|
|
|
import org.springframework.data.domain.Slice; |
|
|
|
|
|
|
|
import org.springframework.data.domain.Sort; |
|
|
|
|
|
|
|
import org.springframework.data.domain.Window; |
|
|
|
import org.springframework.data.jdbc.core.mapping.AggregateReference; |
|
|
|
import org.springframework.data.jdbc.core.mapping.AggregateReference; |
|
|
|
import org.springframework.data.jdbc.repository.query.Modifying; |
|
|
|
import org.springframework.data.jdbc.repository.query.Modifying; |
|
|
|
import org.springframework.data.jdbc.repository.query.Query; |
|
|
|
import org.springframework.data.jdbc.repository.query.Query; |
|
|
|
@ -107,18 +118,6 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
|
|
|
|
|
|
|
|
@Autowired WithDelimitedColumnRepository withDelimitedColumnRepository; |
|
|
|
@Autowired WithDelimitedColumnRepository withDelimitedColumnRepository; |
|
|
|
|
|
|
|
|
|
|
|
private static DummyEntity createDummyEntity() { |
|
|
|
|
|
|
|
return createDummyEntity("Entity Name"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static DummyEntity createDummyEntity(String entityName) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DummyEntity entity = new DummyEntity(); |
|
|
|
|
|
|
|
entity.setName(entityName); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return entity; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@BeforeEach |
|
|
|
@BeforeEach |
|
|
|
public void before() { |
|
|
|
public void before() { |
|
|
|
|
|
|
|
|
|
|
|
@ -130,7 +129,7 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // DATAJDBC-95
|
|
|
|
@Test // DATAJDBC-95
|
|
|
|
public void savesAnEntity() { |
|
|
|
public void savesAnEntity() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity entity = repository.save(createDummyEntity()); |
|
|
|
DummyEntity entity = repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
assertThat(JdbcTestUtils.countRowsInTableWhere(template.getJdbcOperations(), "dummy_entity", |
|
|
|
assertThat(JdbcTestUtils.countRowsInTableWhere(template.getJdbcOperations(), "dummy_entity", |
|
|
|
"id_Prop = " + entity.getIdProp())).isEqualTo(1); |
|
|
|
"id_Prop = " + entity.getIdProp())).isEqualTo(1); |
|
|
|
@ -139,7 +138,7 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // DATAJDBC-95
|
|
|
|
@Test // DATAJDBC-95
|
|
|
|
public void saveAndLoadAnEntity() { |
|
|
|
public void saveAndLoadAnEntity() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity entity = repository.save(createDummyEntity()); |
|
|
|
DummyEntity entity = repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
assertThat(repository.findById(entity.getIdProp())).hasValueSatisfying(it -> { |
|
|
|
assertThat(repository.findById(entity.getIdProp())).hasValueSatisfying(it -> { |
|
|
|
|
|
|
|
|
|
|
|
@ -151,8 +150,8 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // DATAJDBC-97
|
|
|
|
@Test // DATAJDBC-97
|
|
|
|
public void insertsManyEntities() { |
|
|
|
public void insertsManyEntities() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity entity = createDummyEntity(); |
|
|
|
DummyEntity entity = createEntity(); |
|
|
|
DummyEntity other = createDummyEntity(); |
|
|
|
DummyEntity other = createEntity(); |
|
|
|
|
|
|
|
|
|
|
|
repository.saveAll(asList(entity, other)); |
|
|
|
repository.saveAll(asList(entity, other)); |
|
|
|
|
|
|
|
|
|
|
|
@ -164,7 +163,7 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // DATAJDBC-97
|
|
|
|
@Test // DATAJDBC-97
|
|
|
|
public void existsReturnsTrueIffEntityExists() { |
|
|
|
public void existsReturnsTrueIffEntityExists() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity entity = repository.save(createDummyEntity()); |
|
|
|
DummyEntity entity = repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
assertThat(repository.existsById(entity.getIdProp())).isTrue(); |
|
|
|
assertThat(repository.existsById(entity.getIdProp())).isTrue(); |
|
|
|
assertThat(repository.existsById(entity.getIdProp() + 1)).isFalse(); |
|
|
|
assertThat(repository.existsById(entity.getIdProp() + 1)).isFalse(); |
|
|
|
@ -173,8 +172,8 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // DATAJDBC-97
|
|
|
|
@Test // DATAJDBC-97
|
|
|
|
public void findAllFindsAllEntities() { |
|
|
|
public void findAllFindsAllEntities() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity entity = repository.save(createDummyEntity()); |
|
|
|
DummyEntity entity = repository.save(createEntity()); |
|
|
|
DummyEntity other = repository.save(createDummyEntity()); |
|
|
|
DummyEntity other = repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
Iterable<DummyEntity> all = repository.findAll(); |
|
|
|
Iterable<DummyEntity> all = repository.findAll(); |
|
|
|
|
|
|
|
|
|
|
|
@ -186,8 +185,8 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // DATAJDBC-97
|
|
|
|
@Test // DATAJDBC-97
|
|
|
|
public void findAllFindsAllSpecifiedEntities() { |
|
|
|
public void findAllFindsAllSpecifiedEntities() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity entity = repository.save(createDummyEntity()); |
|
|
|
DummyEntity entity = repository.save(createEntity()); |
|
|
|
DummyEntity other = repository.save(createDummyEntity()); |
|
|
|
DummyEntity other = repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
assertThat(repository.findAllById(asList(entity.getIdProp(), other.getIdProp())))//
|
|
|
|
assertThat(repository.findAllById(asList(entity.getIdProp(), other.getIdProp())))//
|
|
|
|
.extracting(DummyEntity::getIdProp)//
|
|
|
|
.extracting(DummyEntity::getIdProp)//
|
|
|
|
@ -197,9 +196,9 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // DATAJDBC-97
|
|
|
|
@Test // DATAJDBC-97
|
|
|
|
public void countsEntities() { |
|
|
|
public void countsEntities() { |
|
|
|
|
|
|
|
|
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
assertThat(repository.count()).isEqualTo(3L); |
|
|
|
assertThat(repository.count()).isEqualTo(3L); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -207,9 +206,9 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // DATAJDBC-97
|
|
|
|
@Test // DATAJDBC-97
|
|
|
|
public void deleteById() { |
|
|
|
public void deleteById() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity one = repository.save(createDummyEntity()); |
|
|
|
DummyEntity one = repository.save(createEntity()); |
|
|
|
DummyEntity two = repository.save(createDummyEntity()); |
|
|
|
DummyEntity two = repository.save(createEntity()); |
|
|
|
DummyEntity three = repository.save(createDummyEntity()); |
|
|
|
DummyEntity three = repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
repository.deleteById(two.getIdProp()); |
|
|
|
repository.deleteById(two.getIdProp()); |
|
|
|
|
|
|
|
|
|
|
|
@ -221,9 +220,9 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // DATAJDBC-97
|
|
|
|
@Test // DATAJDBC-97
|
|
|
|
public void deleteByEntity() { |
|
|
|
public void deleteByEntity() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity one = repository.save(createDummyEntity()); |
|
|
|
DummyEntity one = repository.save(createEntity()); |
|
|
|
DummyEntity two = repository.save(createDummyEntity()); |
|
|
|
DummyEntity two = repository.save(createEntity()); |
|
|
|
DummyEntity three = repository.save(createDummyEntity()); |
|
|
|
DummyEntity three = repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
repository.delete(one); |
|
|
|
repository.delete(one); |
|
|
|
|
|
|
|
|
|
|
|
@ -235,9 +234,9 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // DATAJDBC-97
|
|
|
|
@Test // DATAJDBC-97
|
|
|
|
public void deleteByList() { |
|
|
|
public void deleteByList() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity one = repository.save(createDummyEntity()); |
|
|
|
DummyEntity one = repository.save(createEntity()); |
|
|
|
DummyEntity two = repository.save(createDummyEntity()); |
|
|
|
DummyEntity two = repository.save(createEntity()); |
|
|
|
DummyEntity three = repository.save(createDummyEntity()); |
|
|
|
DummyEntity three = repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
repository.deleteAll(asList(one, three)); |
|
|
|
repository.deleteAll(asList(one, three)); |
|
|
|
|
|
|
|
|
|
|
|
@ -249,9 +248,9 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // DATAJDBC-629
|
|
|
|
@Test // DATAJDBC-629
|
|
|
|
public void deleteByIdList() { |
|
|
|
public void deleteByIdList() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity one = repository.save(createDummyEntity()); |
|
|
|
DummyEntity one = repository.save(createEntity()); |
|
|
|
DummyEntity two = repository.save(createDummyEntity()); |
|
|
|
DummyEntity two = repository.save(createEntity()); |
|
|
|
DummyEntity three = repository.save(createDummyEntity()); |
|
|
|
DummyEntity three = repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
repository.deleteAllById(asList(one.idProp, three.idProp)); |
|
|
|
repository.deleteAllById(asList(one.idProp, three.idProp)); |
|
|
|
|
|
|
|
|
|
|
|
@ -263,9 +262,9 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // DATAJDBC-97
|
|
|
|
@Test // DATAJDBC-97
|
|
|
|
public void deleteAll() { |
|
|
|
public void deleteAll() { |
|
|
|
|
|
|
|
|
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
assertThat(repository.findAll()).isNotEmpty(); |
|
|
|
assertThat(repository.findAll()).isNotEmpty(); |
|
|
|
|
|
|
|
|
|
|
|
@ -277,7 +276,7 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // DATAJDBC-98
|
|
|
|
@Test // DATAJDBC-98
|
|
|
|
public void update() { |
|
|
|
public void update() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity entity = repository.save(createDummyEntity()); |
|
|
|
DummyEntity entity = repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
entity.setName("something else"); |
|
|
|
entity.setName("something else"); |
|
|
|
DummyEntity saved = repository.save(entity); |
|
|
|
DummyEntity saved = repository.save(entity); |
|
|
|
@ -290,8 +289,8 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // DATAJDBC-98
|
|
|
|
@Test // DATAJDBC-98
|
|
|
|
public void updateMany() { |
|
|
|
public void updateMany() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity entity = repository.save(createDummyEntity()); |
|
|
|
DummyEntity entity = repository.save(createEntity()); |
|
|
|
DummyEntity other = repository.save(createDummyEntity()); |
|
|
|
DummyEntity other = repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
entity.setName("something else"); |
|
|
|
entity.setName("something else"); |
|
|
|
other.setName("others Name"); |
|
|
|
other.setName("others Name"); |
|
|
|
@ -306,9 +305,9 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-537
|
|
|
|
@Test // GH-537
|
|
|
|
void insertsOrUpdatesManyEntities() { |
|
|
|
void insertsOrUpdatesManyEntities() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity entity = repository.save(createDummyEntity()); |
|
|
|
DummyEntity entity = repository.save(createEntity()); |
|
|
|
entity.setName("something else"); |
|
|
|
entity.setName("something else"); |
|
|
|
DummyEntity other = createDummyEntity(); |
|
|
|
DummyEntity other = createEntity(); |
|
|
|
other.setName("others name"); |
|
|
|
other.setName("others name"); |
|
|
|
repository.saveAll(asList(other, entity)); |
|
|
|
repository.saveAll(asList(other, entity)); |
|
|
|
|
|
|
|
|
|
|
|
@ -342,7 +341,7 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // DATAJDBC-318
|
|
|
|
@Test // DATAJDBC-318
|
|
|
|
public void queryMethodShouldEmitEvents() { |
|
|
|
public void queryMethodShouldEmitEvents() { |
|
|
|
|
|
|
|
|
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
eventListener.events.clear(); |
|
|
|
eventListener.events.clear(); |
|
|
|
|
|
|
|
|
|
|
|
repository.findAllWithSql(); |
|
|
|
repository.findAllWithSql(); |
|
|
|
@ -353,7 +352,7 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // DATAJDBC-318
|
|
|
|
@Test // DATAJDBC-318
|
|
|
|
public void queryMethodWithCustomRowMapperDoesNotEmitEvents() { |
|
|
|
public void queryMethodWithCustomRowMapperDoesNotEmitEvents() { |
|
|
|
|
|
|
|
|
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
eventListener.events.clear(); |
|
|
|
eventListener.events.clear(); |
|
|
|
|
|
|
|
|
|
|
|
repository.findAllWithCustomMapper(); |
|
|
|
repository.findAllWithCustomMapper(); |
|
|
|
@ -364,14 +363,14 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // DATAJDBC-234
|
|
|
|
@Test // DATAJDBC-234
|
|
|
|
public void findAllByQueryName() { |
|
|
|
public void findAllByQueryName() { |
|
|
|
|
|
|
|
|
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
assertThat(repository.findAllByNamedQuery()).hasSize(1); |
|
|
|
assertThat(repository.findAllByNamedQuery()).hasSize(1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
void findAllByFirstnameWithLock() { |
|
|
|
void findAllByFirstnameWithLock() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity dummyEntity = createDummyEntity(); |
|
|
|
DummyEntity dummyEntity = createEntity(); |
|
|
|
repository.save(dummyEntity); |
|
|
|
repository.save(dummyEntity); |
|
|
|
assertThat(repository.findAllByName(dummyEntity.getName())).hasSize(1); |
|
|
|
assertThat(repository.findAllByName(dummyEntity.getName())).hasSize(1); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -379,14 +378,14 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-1022
|
|
|
|
@Test // GH-1022
|
|
|
|
public void findAllByCustomQueryName() { |
|
|
|
public void findAllByCustomQueryName() { |
|
|
|
|
|
|
|
|
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
assertThat(repository.findAllByCustomNamedQuery()).hasSize(1); |
|
|
|
assertThat(repository.findAllByCustomNamedQuery()).hasSize(1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test // DATAJDBC-341
|
|
|
|
@Test // DATAJDBC-341
|
|
|
|
public void findWithMissingQuery() { |
|
|
|
public void findWithMissingQuery() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity dummy = repository.save(createDummyEntity()); |
|
|
|
DummyEntity dummy = repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity loaded = repository.withMissingColumn(dummy.idProp); |
|
|
|
DummyEntity loaded = repository.withMissingColumn(dummy.idProp); |
|
|
|
|
|
|
|
|
|
|
|
@ -398,7 +397,7 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // DATAJDBC-529
|
|
|
|
@Test // DATAJDBC-529
|
|
|
|
public void existsWorksAsExpected() { |
|
|
|
public void existsWorksAsExpected() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity dummy = repository.save(createDummyEntity()); |
|
|
|
DummyEntity dummy = repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
assertSoftly(softly -> { |
|
|
|
assertSoftly(softly -> { |
|
|
|
|
|
|
|
|
|
|
|
@ -414,7 +413,7 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // DATAJDBC-604
|
|
|
|
@Test // DATAJDBC-604
|
|
|
|
public void existsInWorksAsExpected() { |
|
|
|
public void existsInWorksAsExpected() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity dummy = repository.save(createDummyEntity()); |
|
|
|
DummyEntity dummy = repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
assertSoftly(softly -> { |
|
|
|
assertSoftly(softly -> { |
|
|
|
|
|
|
|
|
|
|
|
@ -430,7 +429,7 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // DATAJDBC-604
|
|
|
|
@Test // DATAJDBC-604
|
|
|
|
public void existsNotInWorksAsExpected() { |
|
|
|
public void existsNotInWorksAsExpected() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity dummy = repository.save(createDummyEntity()); |
|
|
|
DummyEntity dummy = repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
assertSoftly(softly -> { |
|
|
|
assertSoftly(softly -> { |
|
|
|
|
|
|
|
|
|
|
|
@ -446,10 +445,10 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // DATAJDBC-534
|
|
|
|
@Test // DATAJDBC-534
|
|
|
|
public void countByQueryDerivation() { |
|
|
|
public void countByQueryDerivation() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity one = createDummyEntity(); |
|
|
|
DummyEntity one = createEntity(); |
|
|
|
DummyEntity two = createDummyEntity(); |
|
|
|
DummyEntity two = createEntity(); |
|
|
|
two.name = "other"; |
|
|
|
two.name = "other"; |
|
|
|
DummyEntity three = createDummyEntity(); |
|
|
|
DummyEntity three = createEntity(); |
|
|
|
|
|
|
|
|
|
|
|
repository.saveAll(asList(one, two, three)); |
|
|
|
repository.saveAll(asList(one, two, three)); |
|
|
|
|
|
|
|
|
|
|
|
@ -458,7 +457,7 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
|
|
|
|
|
|
|
|
@Test // GH-619
|
|
|
|
@Test // GH-619
|
|
|
|
public void findBySpElWorksAsExpected() { |
|
|
|
public void findBySpElWorksAsExpected() { |
|
|
|
DummyEntity r = repository.save(createDummyEntity()); |
|
|
|
DummyEntity r = repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
// assign the new id to the global ID provider holder; this is similar to Spring Security's SecurityContextHolder
|
|
|
|
// assign the new id to the global ID provider holder; this is similar to Spring Security's SecurityContextHolder
|
|
|
|
MyIdContextProvider.ExtensionRoot.ID = r.getIdProp(); |
|
|
|
MyIdContextProvider.ExtensionRoot.ID = r.getIdProp(); |
|
|
|
@ -530,7 +529,7 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-971
|
|
|
|
@Test // GH-971
|
|
|
|
public void stringQueryProjectionShouldReturnProjectedEntities() { |
|
|
|
public void stringQueryProjectionShouldReturnProjectedEntities() { |
|
|
|
|
|
|
|
|
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
List<DummyProjection> result = repository.findProjectedWithSql(DummyProjection.class); |
|
|
|
List<DummyProjection> result = repository.findProjectedWithSql(DummyProjection.class); |
|
|
|
|
|
|
|
|
|
|
|
@ -541,7 +540,7 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-971
|
|
|
|
@Test // GH-971
|
|
|
|
public void stringQueryProjectionShouldReturnDtoProjectedEntities() { |
|
|
|
public void stringQueryProjectionShouldReturnDtoProjectedEntities() { |
|
|
|
|
|
|
|
|
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
List<DtoProjection> result = repository.findProjectedWithSql(DtoProjection.class); |
|
|
|
List<DtoProjection> result = repository.findProjectedWithSql(DtoProjection.class); |
|
|
|
|
|
|
|
|
|
|
|
@ -552,7 +551,7 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-971
|
|
|
|
@Test // GH-971
|
|
|
|
public void partTreeQueryProjectionShouldReturnProjectedEntities() { |
|
|
|
public void partTreeQueryProjectionShouldReturnProjectedEntities() { |
|
|
|
|
|
|
|
|
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
List<DummyProjection> result = repository.findProjectedByName("Entity Name"); |
|
|
|
List<DummyProjection> result = repository.findProjectedByName("Entity Name"); |
|
|
|
|
|
|
|
|
|
|
|
@ -563,7 +562,7 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-971
|
|
|
|
@Test // GH-971
|
|
|
|
public void pageQueryProjectionShouldReturnProjectedEntities() { |
|
|
|
public void pageQueryProjectionShouldReturnProjectedEntities() { |
|
|
|
|
|
|
|
|
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
Page<DummyProjection> result = repository.findPageProjectionByName("Entity Name", PageRequest.ofSize(10)); |
|
|
|
Page<DummyProjection> result = repository.findPageProjectionByName("Entity Name", PageRequest.ofSize(10)); |
|
|
|
|
|
|
|
|
|
|
|
@ -581,8 +580,8 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-908
|
|
|
|
@Test // GH-908
|
|
|
|
void derivedQueryWithBooleanLiteralFindsCorrectValues() { |
|
|
|
void derivedQueryWithBooleanLiteralFindsCorrectValues() { |
|
|
|
|
|
|
|
|
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
DummyEntity entity = createDummyEntity(); |
|
|
|
DummyEntity entity = createEntity(); |
|
|
|
entity.flag = true; |
|
|
|
entity.flag = true; |
|
|
|
entity = repository.save(entity); |
|
|
|
entity = repository.save(entity); |
|
|
|
|
|
|
|
|
|
|
|
@ -594,8 +593,8 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-987
|
|
|
|
@Test // GH-987
|
|
|
|
void queryBySimpleReference() { |
|
|
|
void queryBySimpleReference() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity one = repository.save(createDummyEntity()); |
|
|
|
DummyEntity one = repository.save(createEntity()); |
|
|
|
DummyEntity two = createDummyEntity(); |
|
|
|
DummyEntity two = createEntity(); |
|
|
|
two.ref = AggregateReference.to(one.idProp); |
|
|
|
two.ref = AggregateReference.to(one.idProp); |
|
|
|
two = repository.save(two); |
|
|
|
two = repository.save(two); |
|
|
|
|
|
|
|
|
|
|
|
@ -607,8 +606,8 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-987
|
|
|
|
@Test // GH-987
|
|
|
|
void queryByAggregateReference() { |
|
|
|
void queryByAggregateReference() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity one = repository.save(createDummyEntity()); |
|
|
|
DummyEntity one = repository.save(createEntity()); |
|
|
|
DummyEntity two = createDummyEntity(); |
|
|
|
DummyEntity two = createEntity(); |
|
|
|
two.ref = AggregateReference.to(one.idProp); |
|
|
|
two.ref = AggregateReference.to(one.idProp); |
|
|
|
two = repository.save(two); |
|
|
|
two = repository.save(two); |
|
|
|
|
|
|
|
|
|
|
|
@ -620,7 +619,7 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-1167
|
|
|
|
@Test // GH-1167
|
|
|
|
void stringResult() { |
|
|
|
void stringResult() { |
|
|
|
|
|
|
|
|
|
|
|
repository.save(createDummyEntity()); // just ensure we have data in the table
|
|
|
|
repository.save(createEntity()); // just ensure we have data in the table
|
|
|
|
|
|
|
|
|
|
|
|
assertThat(repository.returnInput("HELLO")).isEqualTo("HELLO"); |
|
|
|
assertThat(repository.returnInput("HELLO")).isEqualTo("HELLO"); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -628,7 +627,7 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-1167
|
|
|
|
@Test // GH-1167
|
|
|
|
void nullStringResult() { |
|
|
|
void nullStringResult() { |
|
|
|
|
|
|
|
|
|
|
|
repository.save(createDummyEntity()); // just ensure we have data in the table
|
|
|
|
repository.save(createEntity()); // just ensure we have data in the table
|
|
|
|
|
|
|
|
|
|
|
|
assertThat(repository.returnInput(null)).isNull(); |
|
|
|
assertThat(repository.returnInput(null)).isNull(); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -726,11 +725,11 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-1192
|
|
|
|
@Test // GH-1192
|
|
|
|
void findOneByExampleShouldGetOne() { |
|
|
|
void findOneByExampleShouldGetOne() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity dummyEntity1 = createDummyEntity(); |
|
|
|
DummyEntity dummyEntity1 = createEntity(); |
|
|
|
dummyEntity1.setFlag(true); |
|
|
|
dummyEntity1.setFlag(true); |
|
|
|
repository.save(dummyEntity1); |
|
|
|
repository.save(dummyEntity1); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity dummyEntity2 = createDummyEntity(); |
|
|
|
DummyEntity dummyEntity2 = createEntity(); |
|
|
|
dummyEntity2.setName("Diego"); |
|
|
|
dummyEntity2.setName("Diego"); |
|
|
|
repository.save(dummyEntity2); |
|
|
|
repository.save(dummyEntity2); |
|
|
|
|
|
|
|
|
|
|
|
@ -743,10 +742,10 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-1192
|
|
|
|
@Test // GH-1192
|
|
|
|
void findOneByExampleMultipleMatchShouldGetOne() { |
|
|
|
void findOneByExampleMultipleMatchShouldGetOne() { |
|
|
|
|
|
|
|
|
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
Example<DummyEntity> example = Example.of(createDummyEntity()); |
|
|
|
Example<DummyEntity> example = Example.of(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
assertThatThrownBy(() -> repository.findOne(example)).isInstanceOf(IncorrectResultSizeDataAccessException.class) |
|
|
|
assertThatThrownBy(() -> repository.findOne(example)).isInstanceOf(IncorrectResultSizeDataAccessException.class) |
|
|
|
.hasMessageContaining("expected 1, actual 2"); |
|
|
|
.hasMessageContaining("expected 1, actual 2"); |
|
|
|
@ -755,7 +754,7 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-1192
|
|
|
|
@Test // GH-1192
|
|
|
|
void findOneByExampleShouldGetNone() { |
|
|
|
void findOneByExampleShouldGetNone() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity dummyEntity1 = createDummyEntity(); |
|
|
|
DummyEntity dummyEntity1 = createEntity(); |
|
|
|
dummyEntity1.setFlag(true); |
|
|
|
dummyEntity1.setFlag(true); |
|
|
|
repository.save(dummyEntity1); |
|
|
|
repository.save(dummyEntity1); |
|
|
|
|
|
|
|
|
|
|
|
@ -769,11 +768,11 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-1192
|
|
|
|
@Test // GH-1192
|
|
|
|
void findAllByExampleShouldGetOne() { |
|
|
|
void findAllByExampleShouldGetOne() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity dummyEntity1 = createDummyEntity(); |
|
|
|
DummyEntity dummyEntity1 = createEntity(); |
|
|
|
dummyEntity1.setFlag(true); |
|
|
|
dummyEntity1.setFlag(true); |
|
|
|
repository.save(dummyEntity1); |
|
|
|
repository.save(dummyEntity1); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity dummyEntity2 = createDummyEntity(); |
|
|
|
DummyEntity dummyEntity2 = createEntity(); |
|
|
|
dummyEntity2.setName("Diego"); |
|
|
|
dummyEntity2.setName("Diego"); |
|
|
|
repository.save(dummyEntity2); |
|
|
|
repository.save(dummyEntity2); |
|
|
|
|
|
|
|
|
|
|
|
@ -788,10 +787,10 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-1192
|
|
|
|
@Test // GH-1192
|
|
|
|
void findAllByExampleMultipleMatchShouldGetOne() { |
|
|
|
void findAllByExampleMultipleMatchShouldGetOne() { |
|
|
|
|
|
|
|
|
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
Example<DummyEntity> example = Example.of(createDummyEntity()); |
|
|
|
Example<DummyEntity> example = Example.of(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
Iterable<DummyEntity> allFound = repository.findAll(example); |
|
|
|
Iterable<DummyEntity> allFound = repository.findAll(example); |
|
|
|
|
|
|
|
|
|
|
|
@ -804,7 +803,7 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-1192
|
|
|
|
@Test // GH-1192
|
|
|
|
void findAllByExampleShouldGetNone() { |
|
|
|
void findAllByExampleShouldGetNone() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity dummyEntity1 = createDummyEntity(); |
|
|
|
DummyEntity dummyEntity1 = createEntity(); |
|
|
|
dummyEntity1.setFlag(true); |
|
|
|
dummyEntity1.setFlag(true); |
|
|
|
|
|
|
|
|
|
|
|
repository.save(dummyEntity1); |
|
|
|
repository.save(dummyEntity1); |
|
|
|
@ -819,12 +818,12 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-1192
|
|
|
|
@Test // GH-1192
|
|
|
|
void findAllByExamplePageableShouldGetOne() { |
|
|
|
void findAllByExamplePageableShouldGetOne() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity dummyEntity1 = createDummyEntity(); |
|
|
|
DummyEntity dummyEntity1 = createEntity(); |
|
|
|
dummyEntity1.setFlag(true); |
|
|
|
dummyEntity1.setFlag(true); |
|
|
|
|
|
|
|
|
|
|
|
repository.save(dummyEntity1); |
|
|
|
repository.save(dummyEntity1); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity dummyEntity2 = createDummyEntity(); |
|
|
|
DummyEntity dummyEntity2 = createEntity(); |
|
|
|
dummyEntity2.setName("Diego"); |
|
|
|
dummyEntity2.setName("Diego"); |
|
|
|
|
|
|
|
|
|
|
|
repository.save(dummyEntity2); |
|
|
|
repository.save(dummyEntity2); |
|
|
|
@ -841,10 +840,10 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-1192
|
|
|
|
@Test // GH-1192
|
|
|
|
void findAllByExamplePageableMultipleMatchShouldGetOne() { |
|
|
|
void findAllByExamplePageableMultipleMatchShouldGetOne() { |
|
|
|
|
|
|
|
|
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
Example<DummyEntity> example = Example.of(createDummyEntity()); |
|
|
|
Example<DummyEntity> example = Example.of(createEntity()); |
|
|
|
Pageable pageRequest = PageRequest.of(0, 10); |
|
|
|
Pageable pageRequest = PageRequest.of(0, 10); |
|
|
|
|
|
|
|
|
|
|
|
Iterable<DummyEntity> allFound = repository.findAll(example, pageRequest); |
|
|
|
Iterable<DummyEntity> allFound = repository.findAll(example, pageRequest); |
|
|
|
@ -858,7 +857,7 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-1192
|
|
|
|
@Test // GH-1192
|
|
|
|
void findAllByExamplePageableShouldGetNone() { |
|
|
|
void findAllByExamplePageableShouldGetNone() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity dummyEntity1 = createDummyEntity(); |
|
|
|
DummyEntity dummyEntity1 = createEntity(); |
|
|
|
dummyEntity1.setFlag(true); |
|
|
|
dummyEntity1.setFlag(true); |
|
|
|
|
|
|
|
|
|
|
|
repository.save(dummyEntity1); |
|
|
|
repository.save(dummyEntity1); |
|
|
|
@ -874,10 +873,10 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-1192
|
|
|
|
@Test // GH-1192
|
|
|
|
void findAllByExamplePageableOutsidePageShouldGetNone() { |
|
|
|
void findAllByExamplePageableOutsidePageShouldGetNone() { |
|
|
|
|
|
|
|
|
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
Example<DummyEntity> example = Example.of(createDummyEntity()); |
|
|
|
Example<DummyEntity> example = Example.of(createEntity()); |
|
|
|
Pageable pageRequest = PageRequest.of(10, 10); |
|
|
|
Pageable pageRequest = PageRequest.of(10, 10); |
|
|
|
|
|
|
|
|
|
|
|
Iterable<DummyEntity> allFound = repository.findAll(example, pageRequest); |
|
|
|
Iterable<DummyEntity> allFound = repository.findAll(example, pageRequest); |
|
|
|
@ -892,14 +891,14 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
void findAllByExamplePageable(Pageable pageRequest, int size, int totalPages, List<String> notContains) { |
|
|
|
void findAllByExamplePageable(Pageable pageRequest, int size, int totalPages, List<String> notContains) { |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 100; i++) { |
|
|
|
for (int i = 0; i < 100; i++) { |
|
|
|
DummyEntity dummyEntity = createDummyEntity(); |
|
|
|
DummyEntity dummyEntity = createEntity(); |
|
|
|
dummyEntity.setFlag(true); |
|
|
|
dummyEntity.setFlag(true); |
|
|
|
dummyEntity.setName("" + i); |
|
|
|
dummyEntity.setName("" + i); |
|
|
|
|
|
|
|
|
|
|
|
repository.save(dummyEntity); |
|
|
|
repository.save(dummyEntity); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity dummyEntityExample = createDummyEntity(); |
|
|
|
DummyEntity dummyEntityExample = createEntity(); |
|
|
|
dummyEntityExample.setName(null); |
|
|
|
dummyEntityExample.setName(null); |
|
|
|
dummyEntityExample.setFlag(true); |
|
|
|
dummyEntityExample.setFlag(true); |
|
|
|
|
|
|
|
|
|
|
|
@ -939,11 +938,11 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-1192
|
|
|
|
@Test // GH-1192
|
|
|
|
void existsByExampleShouldGetOne() { |
|
|
|
void existsByExampleShouldGetOne() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity dummyEntity1 = createDummyEntity(); |
|
|
|
DummyEntity dummyEntity1 = createEntity(); |
|
|
|
dummyEntity1.setFlag(true); |
|
|
|
dummyEntity1.setFlag(true); |
|
|
|
repository.save(dummyEntity1); |
|
|
|
repository.save(dummyEntity1); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity dummyEntity2 = createDummyEntity(); |
|
|
|
DummyEntity dummyEntity2 = createEntity(); |
|
|
|
dummyEntity2.setName("Diego"); |
|
|
|
dummyEntity2.setName("Diego"); |
|
|
|
repository.save(dummyEntity2); |
|
|
|
repository.save(dummyEntity2); |
|
|
|
|
|
|
|
|
|
|
|
@ -957,13 +956,13 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-1192
|
|
|
|
@Test // GH-1192
|
|
|
|
void existsByExampleMultipleMatchShouldGetOne() { |
|
|
|
void existsByExampleMultipleMatchShouldGetOne() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity dummyEntity1 = createDummyEntity(); |
|
|
|
DummyEntity dummyEntity1 = createEntity(); |
|
|
|
repository.save(dummyEntity1); |
|
|
|
repository.save(dummyEntity1); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity dummyEntity2 = createDummyEntity(); |
|
|
|
DummyEntity dummyEntity2 = createEntity(); |
|
|
|
repository.save(dummyEntity2); |
|
|
|
repository.save(dummyEntity2); |
|
|
|
|
|
|
|
|
|
|
|
Example<DummyEntity> example = Example.of(createDummyEntity()); |
|
|
|
Example<DummyEntity> example = Example.of(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
boolean exists = repository.exists(example); |
|
|
|
boolean exists = repository.exists(example); |
|
|
|
assertThat(exists).isTrue(); |
|
|
|
assertThat(exists).isTrue(); |
|
|
|
@ -972,7 +971,7 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-1192
|
|
|
|
@Test // GH-1192
|
|
|
|
void existsByExampleShouldGetNone() { |
|
|
|
void existsByExampleShouldGetNone() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity dummyEntity1 = createDummyEntity(); |
|
|
|
DummyEntity dummyEntity1 = createEntity(); |
|
|
|
dummyEntity1.setFlag(true); |
|
|
|
dummyEntity1.setFlag(true); |
|
|
|
|
|
|
|
|
|
|
|
repository.save(dummyEntity1); |
|
|
|
repository.save(dummyEntity1); |
|
|
|
@ -989,14 +988,14 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
|
|
|
|
|
|
|
|
Instant pointInTime = Instant.now().truncatedTo(ChronoUnit.MILLIS).minusSeconds(10000); |
|
|
|
Instant pointInTime = Instant.now().truncatedTo(ChronoUnit.MILLIS).minusSeconds(10000); |
|
|
|
|
|
|
|
|
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity two = createDummyEntity(); |
|
|
|
DummyEntity two = createEntity(); |
|
|
|
two.setName("Diego"); |
|
|
|
two.setName("Diego"); |
|
|
|
two.setPointInTime(pointInTime); |
|
|
|
two.setPointInTime(pointInTime); |
|
|
|
repository.save(two); |
|
|
|
repository.save(two); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity exampleEntitiy = createDummyEntity(); |
|
|
|
DummyEntity exampleEntitiy = createEntity(); |
|
|
|
exampleEntitiy.setName("Diego"); |
|
|
|
exampleEntitiy.setName("Diego"); |
|
|
|
exampleEntitiy.setPointInTime(pointInTime); |
|
|
|
exampleEntitiy.setPointInTime(pointInTime); |
|
|
|
|
|
|
|
|
|
|
|
@ -1009,12 +1008,12 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-1192
|
|
|
|
@Test // GH-1192
|
|
|
|
void countByExampleShouldGetOne() { |
|
|
|
void countByExampleShouldGetOne() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity dummyEntity1 = createDummyEntity(); |
|
|
|
DummyEntity dummyEntity1 = createEntity(); |
|
|
|
dummyEntity1.setFlag(true); |
|
|
|
dummyEntity1.setFlag(true); |
|
|
|
|
|
|
|
|
|
|
|
repository.save(dummyEntity1); |
|
|
|
repository.save(dummyEntity1); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity dummyEntity2 = createDummyEntity(); |
|
|
|
DummyEntity dummyEntity2 = createEntity(); |
|
|
|
dummyEntity2.setName("Diego"); |
|
|
|
dummyEntity2.setName("Diego"); |
|
|
|
|
|
|
|
|
|
|
|
repository.save(dummyEntity2); |
|
|
|
repository.save(dummyEntity2); |
|
|
|
@ -1029,13 +1028,13 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-1192
|
|
|
|
@Test // GH-1192
|
|
|
|
void countByExampleMultipleMatchShouldGetOne() { |
|
|
|
void countByExampleMultipleMatchShouldGetOne() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity dummyEntity1 = createDummyEntity(); |
|
|
|
DummyEntity dummyEntity1 = createEntity(); |
|
|
|
repository.save(dummyEntity1); |
|
|
|
repository.save(dummyEntity1); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity dummyEntity2 = createDummyEntity(); |
|
|
|
DummyEntity dummyEntity2 = createEntity(); |
|
|
|
repository.save(dummyEntity2); |
|
|
|
repository.save(dummyEntity2); |
|
|
|
|
|
|
|
|
|
|
|
Example<DummyEntity> example = Example.of(createDummyEntity()); |
|
|
|
Example<DummyEntity> example = Example.of(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
long count = repository.count(example); |
|
|
|
long count = repository.count(example); |
|
|
|
assertThat(count).isEqualTo(2); |
|
|
|
assertThat(count).isEqualTo(2); |
|
|
|
@ -1044,7 +1043,7 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-1192
|
|
|
|
@Test // GH-1192
|
|
|
|
void countByExampleShouldGetNone() { |
|
|
|
void countByExampleShouldGetNone() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity dummyEntity1 = createDummyEntity(); |
|
|
|
DummyEntity dummyEntity1 = createEntity(); |
|
|
|
dummyEntity1.setFlag(true); |
|
|
|
dummyEntity1.setFlag(true); |
|
|
|
|
|
|
|
|
|
|
|
repository.save(dummyEntity1); |
|
|
|
repository.save(dummyEntity1); |
|
|
|
@ -1060,14 +1059,14 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
void countByExampleComplex() { |
|
|
|
void countByExampleComplex() { |
|
|
|
|
|
|
|
|
|
|
|
Instant pointInTime = Instant.now().minusSeconds(10000).truncatedTo(ChronoUnit.MILLIS); |
|
|
|
Instant pointInTime = Instant.now().minusSeconds(10000).truncatedTo(ChronoUnit.MILLIS); |
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity two = createDummyEntity(); |
|
|
|
DummyEntity two = createEntity(); |
|
|
|
two.setName("Diego"); |
|
|
|
two.setName("Diego"); |
|
|
|
two.setPointInTime(pointInTime); |
|
|
|
two.setPointInTime(pointInTime); |
|
|
|
repository.save(two); |
|
|
|
repository.save(two); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity exampleEntitiy = createDummyEntity(); |
|
|
|
DummyEntity exampleEntitiy = createEntity(); |
|
|
|
exampleEntitiy.setName("Diego"); |
|
|
|
exampleEntitiy.setName("Diego"); |
|
|
|
exampleEntitiy.setPointInTime(pointInTime); |
|
|
|
exampleEntitiy.setPointInTime(pointInTime); |
|
|
|
|
|
|
|
|
|
|
|
@ -1083,7 +1082,7 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
String searchName = "Diego"; |
|
|
|
String searchName = "Diego"; |
|
|
|
Instant now = Instant.now().truncatedTo(ChronoUnit.MILLIS); |
|
|
|
Instant now = Instant.now().truncatedTo(ChronoUnit.MILLIS); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity two = createDummyEntity(); |
|
|
|
DummyEntity two = createEntity(); |
|
|
|
|
|
|
|
|
|
|
|
two.setName(searchName); |
|
|
|
two.setName(searchName); |
|
|
|
two.setPointInTime(now.minusSeconds(10000)); |
|
|
|
two.setPointInTime(now.minusSeconds(10000)); |
|
|
|
@ -1092,7 +1091,7 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
// I'm looking at you MariaDb.
|
|
|
|
// I'm looking at you MariaDb.
|
|
|
|
two = repository.findById(two.idProp).orElseThrow(); |
|
|
|
two = repository.findById(two.idProp).orElseThrow(); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity third = createDummyEntity(); |
|
|
|
DummyEntity third = createEntity(); |
|
|
|
third.setName(searchName); |
|
|
|
third.setName(searchName); |
|
|
|
third.setPointInTime(now.minusSeconds(200000)); |
|
|
|
third.setPointInTime(now.minusSeconds(200000)); |
|
|
|
third = repository.save(third); |
|
|
|
third = repository.save(third); |
|
|
|
@ -1100,7 +1099,7 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
// I'm looking at you MariaDb.
|
|
|
|
// I'm looking at you MariaDb.
|
|
|
|
third = repository.findById(third.idProp).orElseThrow(); |
|
|
|
third = repository.findById(third.idProp).orElseThrow(); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity exampleEntitiy = createDummyEntity(); |
|
|
|
DummyEntity exampleEntitiy = createEntity(); |
|
|
|
exampleEntitiy.setName(searchName); |
|
|
|
exampleEntitiy.setName(searchName); |
|
|
|
|
|
|
|
|
|
|
|
Example<DummyEntity> example = Example.of(exampleEntitiy); |
|
|
|
Example<DummyEntity> example = Example.of(exampleEntitiy); |
|
|
|
@ -1151,20 +1150,20 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
String searchName = "Diego"; |
|
|
|
String searchName = "Diego"; |
|
|
|
Instant now = Instant.now(); |
|
|
|
Instant now = Instant.now(); |
|
|
|
|
|
|
|
|
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity two = createDummyEntity(); |
|
|
|
DummyEntity two = createEntity(); |
|
|
|
|
|
|
|
|
|
|
|
two.setName(searchName); |
|
|
|
two.setName(searchName); |
|
|
|
two.setPointInTime(now.minusSeconds(10000)); |
|
|
|
two.setPointInTime(now.minusSeconds(10000)); |
|
|
|
repository.save(two); |
|
|
|
repository.save(two); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity third = createDummyEntity(); |
|
|
|
DummyEntity third = createEntity(); |
|
|
|
third.setName(searchName); |
|
|
|
third.setName(searchName); |
|
|
|
third.setPointInTime(now.minusSeconds(200000)); |
|
|
|
third.setPointInTime(now.minusSeconds(200000)); |
|
|
|
repository.save(third); |
|
|
|
repository.save(third); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity exampleEntitiy = createDummyEntity(); |
|
|
|
DummyEntity exampleEntitiy = createEntity(); |
|
|
|
exampleEntitiy.setName(searchName); |
|
|
|
exampleEntitiy.setName(searchName); |
|
|
|
|
|
|
|
|
|
|
|
Example<DummyEntity> example = Example.of(exampleEntitiy); |
|
|
|
Example<DummyEntity> example = Example.of(exampleEntitiy); |
|
|
|
@ -1179,9 +1178,9 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
String searchName = "Diego"; |
|
|
|
String searchName = "Diego"; |
|
|
|
Instant now = Instant.now().truncatedTo(ChronoUnit.MILLIS); |
|
|
|
Instant now = Instant.now().truncatedTo(ChronoUnit.MILLIS); |
|
|
|
|
|
|
|
|
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity two = createDummyEntity(); |
|
|
|
DummyEntity two = createEntity(); |
|
|
|
|
|
|
|
|
|
|
|
two.setName(searchName); |
|
|
|
two.setName(searchName); |
|
|
|
two.setPointInTime(now.minusSeconds(10000)); |
|
|
|
two.setPointInTime(now.minusSeconds(10000)); |
|
|
|
@ -1190,12 +1189,12 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
// I'm looking at you MariaDb.
|
|
|
|
// I'm looking at you MariaDb.
|
|
|
|
two = repository.findById(two.idProp).orElseThrow(); |
|
|
|
two = repository.findById(two.idProp).orElseThrow(); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity third = createDummyEntity(); |
|
|
|
DummyEntity third = createEntity(); |
|
|
|
third.setName(searchName); |
|
|
|
third.setName(searchName); |
|
|
|
third.setPointInTime(now.minusSeconds(200000)); |
|
|
|
third.setPointInTime(now.minusSeconds(200000)); |
|
|
|
repository.save(third); |
|
|
|
repository.save(third); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity exampleEntity = createDummyEntity(); |
|
|
|
DummyEntity exampleEntity = createEntity(); |
|
|
|
exampleEntity.setName(searchName); |
|
|
|
exampleEntity.setName(searchName); |
|
|
|
|
|
|
|
|
|
|
|
Example<DummyEntity> example = Example.of(exampleEntity); |
|
|
|
Example<DummyEntity> example = Example.of(exampleEntity); |
|
|
|
@ -1212,19 +1211,19 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
String searchName = "Diego"; |
|
|
|
String searchName = "Diego"; |
|
|
|
Instant now = Instant.now(); |
|
|
|
Instant now = Instant.now(); |
|
|
|
|
|
|
|
|
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity two = createDummyEntity(); |
|
|
|
DummyEntity two = createEntity(); |
|
|
|
two.setName(searchName); |
|
|
|
two.setName(searchName); |
|
|
|
two.setPointInTime(now.minusSeconds(10000)); |
|
|
|
two.setPointInTime(now.minusSeconds(10000)); |
|
|
|
repository.save(two); |
|
|
|
repository.save(two); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity third = createDummyEntity(); |
|
|
|
DummyEntity third = createEntity(); |
|
|
|
third.setName(searchName); |
|
|
|
third.setName(searchName); |
|
|
|
third.setPointInTime(now.minusSeconds(200000)); |
|
|
|
third.setPointInTime(now.minusSeconds(200000)); |
|
|
|
repository.save(third); |
|
|
|
repository.save(third); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity exampleEntitiy = createDummyEntity(); |
|
|
|
DummyEntity exampleEntitiy = createEntity(); |
|
|
|
exampleEntitiy.setName(searchName); |
|
|
|
exampleEntitiy.setName(searchName); |
|
|
|
|
|
|
|
|
|
|
|
Example<DummyEntity> example = Example.of(exampleEntitiy); |
|
|
|
Example<DummyEntity> example = Example.of(exampleEntitiy); |
|
|
|
@ -1239,9 +1238,9 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
String searchName = "Diego"; |
|
|
|
String searchName = "Diego"; |
|
|
|
Instant now = Instant.now().truncatedTo(ChronoUnit.MILLIS); |
|
|
|
Instant now = Instant.now().truncatedTo(ChronoUnit.MILLIS); |
|
|
|
|
|
|
|
|
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity two = createDummyEntity(); |
|
|
|
DummyEntity two = createEntity(); |
|
|
|
two.setName(searchName); |
|
|
|
two.setName(searchName); |
|
|
|
two.setPointInTime(now.minusSeconds(10000)); |
|
|
|
two.setPointInTime(now.minusSeconds(10000)); |
|
|
|
two = repository.save(two); |
|
|
|
two = repository.save(two); |
|
|
|
@ -1249,7 +1248,7 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
// I'm looking at you MariaDb.
|
|
|
|
// I'm looking at you MariaDb.
|
|
|
|
two = repository.findById(two.idProp).orElseThrow(); |
|
|
|
two = repository.findById(two.idProp).orElseThrow(); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity exampleEntitiy = createDummyEntity(); |
|
|
|
DummyEntity exampleEntitiy = createEntity(); |
|
|
|
exampleEntitiy.setName(searchName); |
|
|
|
exampleEntitiy.setName(searchName); |
|
|
|
|
|
|
|
|
|
|
|
Example<DummyEntity> example = Example.of(exampleEntitiy); |
|
|
|
Example<DummyEntity> example = Example.of(exampleEntitiy); |
|
|
|
@ -1265,14 +1264,14 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
String searchName = "Diego"; |
|
|
|
String searchName = "Diego"; |
|
|
|
Instant now = Instant.now(); |
|
|
|
Instant now = Instant.now(); |
|
|
|
|
|
|
|
|
|
|
|
repository.save(createDummyEntity()); |
|
|
|
repository.save(createEntity()); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity two = createDummyEntity(); |
|
|
|
DummyEntity two = createEntity(); |
|
|
|
two.setName(searchName); |
|
|
|
two.setName(searchName); |
|
|
|
two.setPointInTime(now.minusSeconds(10000)); |
|
|
|
two.setPointInTime(now.minusSeconds(10000)); |
|
|
|
two = repository.save(two); |
|
|
|
two = repository.save(two); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity exampleEntity = createDummyEntity(); |
|
|
|
DummyEntity exampleEntity = createEntity(); |
|
|
|
exampleEntity.setName(searchName); |
|
|
|
exampleEntity.setName(searchName); |
|
|
|
|
|
|
|
|
|
|
|
Example<DummyEntity> example = Example.of(exampleEntity); |
|
|
|
Example<DummyEntity> example = Example.of(exampleEntity); |
|
|
|
@ -1333,9 +1332,9 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@EnabledOnFeature(TestDatabaseFeatures.Feature.WHERE_IN_TUPLE) |
|
|
|
@EnabledOnFeature(TestDatabaseFeatures.Feature.WHERE_IN_TUPLE) |
|
|
|
void queryWithTupleIn() { |
|
|
|
void queryWithTupleIn() { |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity one = repository.save(createDummyEntity("one")); |
|
|
|
DummyEntity one = repository.save(createEntity("one")); |
|
|
|
DummyEntity two = repository.save(createDummyEntity("two")); |
|
|
|
DummyEntity two = repository.save(createEntity("two")); |
|
|
|
DummyEntity three = repository.save(createDummyEntity("three")); |
|
|
|
DummyEntity three = repository.save(createEntity("three")); |
|
|
|
|
|
|
|
|
|
|
|
List<Object[]> tuples = List.of(new Object[] { two.idProp, "two" }, // matches "two"
|
|
|
|
List<Object[]> tuples = List.of(new Object[] { two.idProp, "two" }, // matches "two"
|
|
|
|
new Object[] { three.idProp, "two" } // matches nothing
|
|
|
|
new Object[] { three.idProp, "two" } // matches nothing
|
|
|
|
@ -1349,22 +1348,12 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-1900
|
|
|
|
@Test // GH-1900
|
|
|
|
void queryByListOfByteArray() { |
|
|
|
void queryByListOfByteArray() { |
|
|
|
|
|
|
|
|
|
|
|
byte[] oneBytes = { 1, 2, 3, 4, 5, 6, 7, 8 }; |
|
|
|
DummyEntity one = repository.save(createEntity("one", it -> it.setBytes(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }))); |
|
|
|
DummyEntity one = createDummyEntity("one"); |
|
|
|
DummyEntity two = repository.save(createEntity("two", it -> it.setBytes(new byte[] { 8, 7, 6, 5, 4, 3, 2, 1 }))); |
|
|
|
one.setBytes(oneBytes); |
|
|
|
DummyEntity three = repository |
|
|
|
one = repository.save(one); |
|
|
|
.save(createEntity("three", it -> it.setBytes(new byte[] { 3, 3, 3, 3, 3, 3, 3, 3 }))); |
|
|
|
|
|
|
|
|
|
|
|
byte[] twoBytes = { 8, 7, 6, 5, 4, 3, 2, 1 }; |
|
|
|
|
|
|
|
DummyEntity two = createDummyEntity("two"); |
|
|
|
|
|
|
|
two.setBytes(twoBytes); |
|
|
|
|
|
|
|
two = repository.save(two); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] threeBytes = { 3, 3, 3, 3, 3, 3, 3, 3 }; |
|
|
|
List<DummyEntity> result = repository.findByBytesIn(List.of(three.getBytes(), one.getBytes())); |
|
|
|
DummyEntity three = createDummyEntity("three"); |
|
|
|
|
|
|
|
three.setBytes(threeBytes); |
|
|
|
|
|
|
|
three = repository.save(three); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<DummyEntity> result = repository.findByBytesIn(List.of(threeBytes, oneBytes)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertThat(result).extracting("idProp").containsExactlyInAnyOrder(one.idProp, three.idProp); |
|
|
|
assertThat(result).extracting("idProp").containsExactlyInAnyOrder(one.idProp, three.idProp); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1372,22 +1361,12 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
@Test // GH-1900
|
|
|
|
@Test // GH-1900
|
|
|
|
void queryByByteArray() { |
|
|
|
void queryByByteArray() { |
|
|
|
|
|
|
|
|
|
|
|
byte[] oneBytes = { 1, 2, 3, 4, 5, 6, 7, 8 }; |
|
|
|
DummyEntity one = repository.save(createEntity("one", it -> it.setBytes(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }))); |
|
|
|
DummyEntity one = createDummyEntity("one"); |
|
|
|
DummyEntity two = repository.save(createEntity("two", it -> it.setBytes(new byte[] { 8, 7, 6, 5, 4, 3, 2, 1 }))); |
|
|
|
one.setBytes(oneBytes); |
|
|
|
DummyEntity three = repository |
|
|
|
one = repository.save(one); |
|
|
|
.save(createEntity("three", it -> it.setBytes(new byte[] { 3, 3, 3, 3, 3, 3, 3, 3 }))); |
|
|
|
|
|
|
|
|
|
|
|
byte[] twoBytes = { 8, 7, 6, 5, 4, 3, 2, 1 }; |
|
|
|
|
|
|
|
DummyEntity two = createDummyEntity("two"); |
|
|
|
|
|
|
|
two.setBytes(twoBytes); |
|
|
|
|
|
|
|
two = repository.save(two); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] threeBytes = { 3, 3, 3, 3, 3, 3, 3, 3 }; |
|
|
|
|
|
|
|
DummyEntity three = createDummyEntity("three"); |
|
|
|
|
|
|
|
three.setBytes(threeBytes); |
|
|
|
|
|
|
|
three = repository.save(three); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<DummyEntity> result = repository.findByBytes(twoBytes); |
|
|
|
List<DummyEntity> result = repository.findByBytes(two.getBytes()); |
|
|
|
|
|
|
|
|
|
|
|
assertThat(result).extracting("idProp").containsExactly(two.idProp); |
|
|
|
assertThat(result).extracting("idProp").containsExactly(two.idProp); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1419,7 +1398,7 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
|
|
|
|
|
|
|
|
Instant now = Instant.now(); |
|
|
|
Instant now = Instant.now(); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity first = createDummyEntity(); |
|
|
|
DummyEntity first = createEntity(); |
|
|
|
Instant earlier = now.minusSeconds(1000L); |
|
|
|
Instant earlier = now.minusSeconds(1000L); |
|
|
|
OffsetDateTime earlierPlus3 = earlier.atOffset(ZoneOffset.ofHours(3)); |
|
|
|
OffsetDateTime earlierPlus3 = earlier.atOffset(ZoneOffset.ofHours(3)); |
|
|
|
first.setPointInTime(earlier); |
|
|
|
first.setPointInTime(earlier); |
|
|
|
@ -1427,7 +1406,7 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
|
|
|
|
|
|
|
|
first.setName("first"); |
|
|
|
first.setName("first"); |
|
|
|
|
|
|
|
|
|
|
|
DummyEntity second = createDummyEntity(); |
|
|
|
DummyEntity second = createEntity(); |
|
|
|
Instant later = now.plusSeconds(1000L); |
|
|
|
Instant later = now.plusSeconds(1000L); |
|
|
|
OffsetDateTime laterPlus3 = later.atOffset(ZoneOffset.ofHours(3)); |
|
|
|
OffsetDateTime laterPlus3 = later.atOffset(ZoneOffset.ofHours(3)); |
|
|
|
second.setPointInTime(later); |
|
|
|
second.setPointInTime(later); |
|
|
|
@ -1842,6 +1821,24 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static DummyEntity createEntity() { |
|
|
|
|
|
|
|
return createEntity("Entity Name"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static DummyEntity createEntity(String entityName) { |
|
|
|
|
|
|
|
return createEntity(entityName, it -> {}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static DummyEntity createEntity(String entityName, Consumer<DummyEntity> customizer) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DummyEntity entity = new DummyEntity(); |
|
|
|
|
|
|
|
entity.setName(entityName); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
customizer.accept(entity); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return entity; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static class DummyEntity { |
|
|
|
static class DummyEntity { |
|
|
|
|
|
|
|
|
|
|
|
String name; |
|
|
|
String name; |
|
|
|
@ -1936,6 +1933,10 @@ public class JdbcRepositoryIntegrationTests { |
|
|
|
this.bytes = bytes; |
|
|
|
this.bytes = bytes; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public byte[] getBytes() { |
|
|
|
|
|
|
|
return bytes; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public String toString() { |
|
|
|
public String toString() { |
|
|
|
return "DummyEntity{" + "name='" + name + '\'' + ", idProp=" + idProp + '}'; |
|
|
|
return "DummyEntity{" + "name='" + name + '\'' + ", idProp=" + idProp + '}'; |
|
|
|
|