Skip to content

Commit 4abe92c

Browse files
Fix TestRestTemplate
1 parent 61534f4 commit 4abe92c

3 files changed

Lines changed: 20 additions & 0 deletions

File tree

spring-data-eclipse-store-demo/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@
6767
<artifactId>spring-boot-resttestclient</artifactId>
6868
<scope>test</scope>
6969
</dependency>
70+
<dependency>
71+
<groupId>org.springframework.boot</groupId>
72+
<artifactId>spring-boot-starter-restclient</artifactId>
73+
<scope>test</scope>
74+
</dependency>
7075
</dependencies>
7176

7277
<build>

spring-data-eclipse-store-demo/src/test/java/software/xdev/spring/data/eclipse/store/demo/complex/ComplexDemoApplicationTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
import org.junit.jupiter.api.Test;
1010
import org.springframework.beans.factory.annotation.Autowired;
1111
import org.springframework.boot.resttestclient.TestRestTemplate;
12+
import org.springframework.boot.resttestclient.autoconfigure.AutoConfigureTestRestTemplate;
1213
import org.springframework.boot.test.context.SpringBootTest;
1314
import org.springframework.boot.test.web.server.LocalServerPort;
1415

1516
import software.xdev.spring.data.eclipse.store.demo.TestUtil;
1617
import software.xdev.spring.data.eclipse.store.repository.config.EclipseStoreClientConfiguration;
1718

1819

20+
@AutoConfigureTestRestTemplate
1921
@SpringBootTest(
2022
classes = ComplexDemoApplication.class,
2123
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT

spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/EclipseStoreRepositoryFactory.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@
1515
*/
1616
package software.xdev.spring.data.eclipse.store.repository.support;
1717

18+
import java.util.Optional;
19+
1820
import jakarta.annotation.Nonnull;
1921
import jakarta.validation.Validator;
2022

23+
import org.jspecify.annotations.Nullable;
2124
import org.springframework.data.core.TypeInformation;
2225
import org.springframework.data.mapping.model.BasicPersistentEntity;
2326
import org.springframework.data.repository.core.EntityInformation;
@@ -26,6 +29,8 @@
2629
import org.springframework.data.repository.core.support.PersistentEntityInformation;
2730
import org.springframework.data.repository.core.support.RepositoryComposition;
2831
import org.springframework.data.repository.core.support.RepositoryFactorySupport;
32+
import org.springframework.data.repository.query.QueryLookupStrategy;
33+
import org.springframework.data.repository.query.ValueExpressionDelegate;
2934
import org.springframework.transaction.PlatformTransactionManager;
3035

3136
import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage;
@@ -69,6 +74,14 @@ public <T, ID> EntityInformation<T, ID> getEntityInformation(@Nonnull final Clas
6974
return new PersistentEntityInformation<>(new BasicPersistentEntity<>(TypeInformation.of(domainClass)));
7075
}
7176

77+
@Override
78+
protected Optional<QueryLookupStrategy> getQueryLookupStrategy(
79+
final QueryLookupStrategy.@Nullable Key key,
80+
final ValueExpressionDelegate valueExpressionDelegate)
81+
{
82+
return Optional.of(new EclipseStoreQueryLookupStrategy(this.storage, this::createWorkingCopier));
83+
}
84+
7285
private <T> WorkingCopier<T> createWorkingCopier(
7386
final Class<T> domainType,
7487
final EclipseStoreStorage storage)

0 commit comments

Comments
 (0)