Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
ce95fd68
Commit
ce95fd68
authored
Mar 26, 2020
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish "Use @DynamicPropertySource for Neo4J and Redis data tests"
See gh-20676
parent
d84422a4
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
27 deletions
+27
-27
DataNeo4jTestIntegrationTests.java
...toconfigure/data/neo4j/DataNeo4jTestIntegrationTests.java
+6
-6
DataNeo4jTestPropertiesIntegrationTests.java
...e/data/neo4j/DataNeo4jTestPropertiesIntegrationTests.java
+4
-4
DataNeo4jTestWithIncludeFilterIntegrationTests.java
...neo4j/DataNeo4jTestWithIncludeFilterIntegrationTests.java
+4
-4
DataRedisTestIntegrationTests.java
...toconfigure/data/redis/DataRedisTestIntegrationTests.java
+5
-5
DataRedisTestPropertiesIntegrationTests.java
...e/data/redis/DataRedisTestPropertiesIntegrationTests.java
+3
-3
DataRedisTestWithIncludeFilterIntegrationTests.java
...redis/DataRedisTestWithIncludeFilterIntegrationTests.java
+5
-5
No files found.
spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/neo4j/DataNeo4jTestIntegrationTests.java
View file @
ce95fd68
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -45,11 +45,6 @@ class DataNeo4jTestIntegrationTests {
...
@@ -45,11 +45,6 @@ class DataNeo4jTestIntegrationTests {
@Container
@Container
static
final
Neo4jContainer
<?>
neo4j
=
new
Neo4jContainer
<>().
withoutAuthentication
();
static
final
Neo4jContainer
<?>
neo4j
=
new
Neo4jContainer
<>().
withoutAuthentication
();
@DynamicPropertySource
static
void
neo4jProperties
(
DynamicPropertyRegistry
registry
)
{
registry
.
add
(
"spring.data.neo4j.uri"
,
neo4j:
:
getBoltUrl
);
}
@Autowired
@Autowired
private
Session
session
;
private
Session
session
;
...
@@ -59,6 +54,11 @@ class DataNeo4jTestIntegrationTests {
...
@@ -59,6 +54,11 @@ class DataNeo4jTestIntegrationTests {
@Autowired
@Autowired
private
ApplicationContext
applicationContext
;
private
ApplicationContext
applicationContext
;
@DynamicPropertySource
static
void
neo4jProperties
(
DynamicPropertyRegistry
registry
)
{
registry
.
add
(
"spring.data.neo4j.uri"
,
neo4j:
:
getBoltUrl
);
}
@Test
@Test
void
testRepository
()
{
void
testRepository
()
{
ExampleGraph
exampleGraph
=
new
ExampleGraph
();
ExampleGraph
exampleGraph
=
new
ExampleGraph
();
...
...
spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/neo4j/DataNeo4jTestPropertiesIntegrationTests.java
View file @
ce95fd68
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -41,14 +41,14 @@ class DataNeo4jTestPropertiesIntegrationTests {
...
@@ -41,14 +41,14 @@ class DataNeo4jTestPropertiesIntegrationTests {
@Container
@Container
static
final
Neo4jContainer
<?>
neo4j
=
new
Neo4jContainer
<>().
withoutAuthentication
();
static
final
Neo4jContainer
<?>
neo4j
=
new
Neo4jContainer
<>().
withoutAuthentication
();
@Autowired
private
Environment
environment
;
@DynamicPropertySource
@DynamicPropertySource
static
void
neo4jProperties
(
DynamicPropertyRegistry
registry
)
{
static
void
neo4jProperties
(
DynamicPropertyRegistry
registry
)
{
registry
.
add
(
"spring.data.neo4j.uri"
,
neo4j:
:
getBoltUrl
);
registry
.
add
(
"spring.data.neo4j.uri"
,
neo4j:
:
getBoltUrl
);
}
}
@Autowired
private
Environment
environment
;
@Test
@Test
void
environmentWithNewProfile
()
{
void
environmentWithNewProfile
()
{
assertThat
(
this
.
environment
.
getActiveProfiles
()).
containsExactly
(
"test"
);
assertThat
(
this
.
environment
.
getActiveProfiles
()).
containsExactly
(
"test"
);
...
...
spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/neo4j/DataNeo4jTestWithIncludeFilterIntegrationTests.java
View file @
ce95fd68
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -42,14 +42,14 @@ class DataNeo4jTestWithIncludeFilterIntegrationTests {
...
@@ -42,14 +42,14 @@ class DataNeo4jTestWithIncludeFilterIntegrationTests {
@Container
@Container
static
final
Neo4jContainer
<?>
neo4j
=
new
Neo4jContainer
<>().
withoutAuthentication
();
static
final
Neo4jContainer
<?>
neo4j
=
new
Neo4jContainer
<>().
withoutAuthentication
();
@Autowired
private
ExampleService
service
;
@DynamicPropertySource
@DynamicPropertySource
static
void
neo4jProperties
(
DynamicPropertyRegistry
registry
)
{
static
void
neo4jProperties
(
DynamicPropertyRegistry
registry
)
{
registry
.
add
(
"spring.data.neo4j.uri"
,
neo4j:
:
getBoltUrl
);
registry
.
add
(
"spring.data.neo4j.uri"
,
neo4j:
:
getBoltUrl
);
}
}
@Autowired
private
ExampleService
service
;
@Test
@Test
void
testService
()
{
void
testService
()
{
assertThat
(
this
.
service
.
hasNode
(
ExampleGraph
.
class
)).
isFalse
();
assertThat
(
this
.
service
.
hasNode
(
ExampleGraph
.
class
)).
isFalse
();
...
...
spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/redis/DataRedisTestIntegrationTests.java
View file @
ce95fd68
...
@@ -49,11 +49,6 @@ class DataRedisTestIntegrationTests {
...
@@ -49,11 +49,6 @@ class DataRedisTestIntegrationTests {
@Container
@Container
static
RedisContainer
redis
=
new
RedisContainer
();
static
RedisContainer
redis
=
new
RedisContainer
();
@DynamicPropertySource
static
void
redisProperties
(
DynamicPropertyRegistry
registry
)
{
registry
.
add
(
"spring.redis.port"
,
redis:
:
getFirstMappedPort
);
}
@Autowired
@Autowired
private
RedisOperations
<
Object
,
Object
>
operations
;
private
RedisOperations
<
Object
,
Object
>
operations
;
...
@@ -63,6 +58,11 @@ class DataRedisTestIntegrationTests {
...
@@ -63,6 +58,11 @@ class DataRedisTestIntegrationTests {
@Autowired
@Autowired
private
ApplicationContext
applicationContext
;
private
ApplicationContext
applicationContext
;
@DynamicPropertySource
static
void
redisProperties
(
DynamicPropertyRegistry
registry
)
{
registry
.
add
(
"spring.redis.port"
,
redis:
:
getFirstMappedPort
);
}
@Test
@Test
void
testRepository
()
{
void
testRepository
()
{
PersonHash
personHash
=
new
PersonHash
();
PersonHash
personHash
=
new
PersonHash
();
...
...
spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/redis/DataRedisTestPropertiesIntegrationTests.java
View file @
ce95fd68
...
@@ -41,14 +41,14 @@ class DataRedisTestPropertiesIntegrationTests {
...
@@ -41,14 +41,14 @@ class DataRedisTestPropertiesIntegrationTests {
@Container
@Container
static
final
RedisContainer
redis
=
new
RedisContainer
();
static
final
RedisContainer
redis
=
new
RedisContainer
();
@Autowired
private
Environment
environment
;
@DynamicPropertySource
@DynamicPropertySource
static
void
redisProperties
(
DynamicPropertyRegistry
registry
)
{
static
void
redisProperties
(
DynamicPropertyRegistry
registry
)
{
registry
.
add
(
"spring.redis.port"
,
redis:
:
getFirstMappedPort
);
registry
.
add
(
"spring.redis.port"
,
redis:
:
getFirstMappedPort
);
}
}
@Autowired
private
Environment
environment
;
@Test
@Test
void
environmentWithNewProfile
()
{
void
environmentWithNewProfile
()
{
assertThat
(
this
.
environment
.
getActiveProfiles
()).
containsExactly
(
"test"
);
assertThat
(
this
.
environment
.
getActiveProfiles
()).
containsExactly
(
"test"
);
...
...
spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/redis/DataRedisTestWithIncludeFilterIntegrationTests.java
View file @
ce95fd68
...
@@ -41,17 +41,17 @@ class DataRedisTestWithIncludeFilterIntegrationTests {
...
@@ -41,17 +41,17 @@ class DataRedisTestWithIncludeFilterIntegrationTests {
@Container
@Container
static
final
RedisContainer
redis
=
new
RedisContainer
();
static
final
RedisContainer
redis
=
new
RedisContainer
();
@DynamicPropertySource
static
void
redisProperties
(
DynamicPropertyRegistry
registry
)
{
registry
.
add
(
"spring.redis.port"
,
redis:
:
getFirstMappedPort
);
}
@Autowired
@Autowired
private
ExampleRepository
exampleRepository
;
private
ExampleRepository
exampleRepository
;
@Autowired
@Autowired
private
ExampleService
service
;
private
ExampleService
service
;
@DynamicPropertySource
static
void
redisProperties
(
DynamicPropertyRegistry
registry
)
{
registry
.
add
(
"spring.redis.port"
,
redis:
:
getFirstMappedPort
);
}
@Test
@Test
void
testService
()
{
void
testService
()
{
PersonHash
personHash
=
new
PersonHash
();
PersonHash
personHash
=
new
PersonHash
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment