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
a9a31107
Commit
a9a31107
authored
Mar 24, 2017
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Align with API changes in latest Spring Data Kay snapshots
See gh-7461
parent
83df8e47
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
11 deletions
+21
-11
MongoDataAutoConfigurationTests.java
...configure/data/mongo/MongoDataAutoConfigurationTests.java
+10
-3
CityRepositoryIntegrationTests.java
...mple/data/jpa/service/CityRepositoryIntegrationTests.java
+1
-1
HotelRepositoryIntegrationTests.java
...ple/data/jpa/service/HotelRepositoryIntegrationTests.java
+2
-3
CityRepositoryIntegrationTests.java
...ple/data/rest/service/CityRepositoryIntegrationTests.java
+2
-2
FlightRepository.java
.../java/sample/secure/oauth2/resource/FlightRepository.java
+3
-1
FlightRepository.java
.../src/main/java/sample/secure/oauth2/FlightRepository.java
+3
-1
No files found.
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfigurationTests.java
View file @
a9a31107
...
@@ -18,6 +18,7 @@ package org.springframework.boot.autoconfigure.data.mongo;
...
@@ -18,6 +18,7 @@ package org.springframework.boot.autoconfigure.data.mongo;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Optional
;
import
java.util.Set
;
import
java.util.Set
;
import
com.mongodb.Mongo
;
import
com.mongodb.Mongo
;
...
@@ -44,8 +45,9 @@ import org.springframework.data.mapping.model.FieldNamingStrategy;
...
@@ -44,8 +45,9 @@ import org.springframework.data.mapping.model.FieldNamingStrategy;
import
org.springframework.data.mapping.model.PropertyNameFieldNamingStrategy
;
import
org.springframework.data.mapping.model.PropertyNameFieldNamingStrategy
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.convert.CustomConversions
;
import
org.springframework.data.mongodb.core.convert.CustomConversions
;
import
org.springframework.data.mongodb.core.mapping.BasicMongoPersistentEntity
;
import
org.springframework.data.mongodb.core.mapping.MongoMappingContext
;
import
org.springframework.data.mongodb.core.mapping.MongoMappingContext
;
import
org.springframework.data.mongodb.core.mapping.MongoPersistent
Enti
ty
;
import
org.springframework.data.mongodb.core.mapping.MongoPersistent
Proper
ty
;
import
org.springframework.data.mongodb.gridfs.GridFsTemplate
;
import
org.springframework.data.mongodb.gridfs.GridFsTemplate
;
import
org.springframework.test.util.ReflectionTestUtils
;
import
org.springframework.test.util.ReflectionTestUtils
;
...
@@ -165,8 +167,13 @@ public class MongoDataAutoConfigurationTests {
...
@@ -165,8 +167,13 @@ public class MongoDataAutoConfigurationTests {
MongoDataAutoConfiguration
.
class
);
MongoDataAutoConfiguration
.
class
);
this
.
context
.
refresh
();
this
.
context
.
refresh
();
MongoMappingContext
context
=
this
.
context
.
getBean
(
MongoMappingContext
.
class
);
MongoMappingContext
context
=
this
.
context
.
getBean
(
MongoMappingContext
.
class
);
MongoPersistentEntity
<?>
entity
=
context
.
getPersistentEntity
(
Sample
.
class
);
Optional
<
BasicMongoPersistentEntity
<?>>
entity
=
context
assertThat
(
entity
.
getPersistentProperty
(
"date"
).
isEntity
()).
isFalse
();
.
getPersistentEntity
(
Sample
.
class
);
assertThat
(
entity
).
isPresent
();
Optional
<
MongoPersistentProperty
>
dateProperty
=
entity
.
get
()
.
getPersistentProperty
(
"date"
);
assertThat
(
dateProperty
).
isPresent
();
assertThat
(
dateProperty
.
get
().
isEntity
()).
isFalse
();
}
}
public
void
testFieldNamingStrategy
(
String
strategy
,
public
void
testFieldNamingStrategy
(
String
strategy
,
...
...
spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/CityRepositoryIntegrationTests.java
View file @
a9a31107
...
@@ -42,7 +42,7 @@ public class CityRepositoryIntegrationTests {
...
@@ -42,7 +42,7 @@ public class CityRepositoryIntegrationTests {
@Test
@Test
public
void
findsFirstPageOfCities
()
{
public
void
findsFirstPageOfCities
()
{
Page
<
City
>
cities
=
this
.
repository
.
findAll
(
new
PageRequest
(
0
,
10
));
Page
<
City
>
cities
=
this
.
repository
.
findAll
(
PageRequest
.
of
(
0
,
10
));
assertThat
(
cities
.
getTotalElements
()).
isGreaterThan
(
20L
);
assertThat
(
cities
.
getTotalElements
()).
isGreaterThan
(
20L
);
}
}
}
}
spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/HotelRepositoryIntegrationTests.java
View file @
a9a31107
...
@@ -51,12 +51,11 @@ public class HotelRepositoryIntegrationTests {
...
@@ -51,12 +51,11 @@ public class HotelRepositoryIntegrationTests {
@Test
@Test
public
void
executesQueryMethodsCorrectly
()
{
public
void
executesQueryMethodsCorrectly
()
{
City
city
=
this
.
cityRepository
City
city
=
this
.
cityRepository
.
findAll
(
new
PageRequest
(
0
,
1
,
Direction
.
ASC
,
"name"
)).
getContent
()
.
findAll
(
PageRequest
.
of
(
0
,
1
,
Direction
.
ASC
,
"name"
)).
getContent
().
get
(
0
);
.
get
(
0
);
assertThat
(
city
.
getName
()).
isEqualTo
(
"Atlanta"
);
assertThat
(
city
.
getName
()).
isEqualTo
(
"Atlanta"
);
Page
<
HotelSummary
>
hotels
=
this
.
repository
.
findByCity
(
city
,
Page
<
HotelSummary
>
hotels
=
this
.
repository
.
findByCity
(
city
,
new
PageRequest
(
0
,
10
,
Direction
.
ASC
,
"name"
));
PageRequest
.
of
(
0
,
10
,
Direction
.
ASC
,
"name"
));
Hotel
hotel
=
this
.
repository
.
findByCityAndName
(
city
,
Hotel
hotel
=
this
.
repository
.
findByCityAndName
(
city
,
hotels
.
getContent
().
get
(
0
).
getName
());
hotels
.
getContent
().
get
(
0
).
getName
());
assertThat
(
hotel
.
getName
()).
isEqualTo
(
"Doubletree"
);
assertThat
(
hotel
.
getName
()).
isEqualTo
(
"Doubletree"
);
...
...
spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/rest/service/CityRepositoryIntegrationTests.java
View file @
a9a31107
...
@@ -44,7 +44,7 @@ public class CityRepositoryIntegrationTests {
...
@@ -44,7 +44,7 @@ public class CityRepositoryIntegrationTests {
@Test
@Test
public
void
findsFirstPageOfCities
()
{
public
void
findsFirstPageOfCities
()
{
Page
<
City
>
cities
=
this
.
repository
.
findAll
(
new
PageRequest
(
0
,
10
));
Page
<
City
>
cities
=
this
.
repository
.
findAll
(
PageRequest
.
of
(
0
,
10
));
assertThat
(
cities
.
getTotalElements
()).
isGreaterThan
(
20L
);
assertThat
(
cities
.
getTotalElements
()).
isGreaterThan
(
20L
);
}
}
...
@@ -60,7 +60,7 @@ public class CityRepositoryIntegrationTests {
...
@@ -60,7 +60,7 @@ public class CityRepositoryIntegrationTests {
public
void
findContaining
()
{
public
void
findContaining
()
{
Page
<
City
>
cities
=
this
.
repository
Page
<
City
>
cities
=
this
.
repository
.
findByNameContainingAndCountryContainingAllIgnoringCase
(
""
,
"UK"
,
.
findByNameContainingAndCountryContainingAllIgnoringCase
(
""
,
"UK"
,
new
PageRequest
(
0
,
10
));
PageRequest
.
of
(
0
,
10
));
assertThat
(
cities
.
getTotalElements
()).
isEqualTo
(
3L
);
assertThat
(
cities
.
getTotalElements
()).
isEqualTo
(
3L
);
}
}
}
}
spring-boot-samples/spring-boot-sample-secure-oauth2-resource/src/main/java/sample/secure/oauth2/resource/FlightRepository.java
View file @
a9a31107
...
@@ -16,6 +16,8 @@
...
@@ -16,6 +16,8 @@
package
sample
.
secure
.
oauth2
.
resource
;
package
sample
.
secure
.
oauth2
.
resource
;
import
java.util.Optional
;
import
org.springframework.data.repository.CrudRepository
;
import
org.springframework.data.repository.CrudRepository
;
/**
/**
...
@@ -30,7 +32,7 @@ public interface FlightRepository extends CrudRepository<Flight, Long> {
...
@@ -30,7 +32,7 @@ public interface FlightRepository extends CrudRepository<Flight, Long> {
Iterable
<
Flight
>
findAll
();
Iterable
<
Flight
>
findAll
();
@Override
@Override
Flight
findOne
(
Long
aLong
);
Optional
<
Flight
>
findOne
(
Long
aLong
);
@Override
@Override
<
S
extends
Flight
>
S
save
(
S
entity
);
<
S
extends
Flight
>
S
save
(
S
entity
);
...
...
spring-boot-samples/spring-boot-sample-secure-oauth2/src/main/java/sample/secure/oauth2/FlightRepository.java
View file @
a9a31107
...
@@ -16,6 +16,8 @@
...
@@ -16,6 +16,8 @@
package
sample
.
secure
.
oauth2
;
package
sample
.
secure
.
oauth2
;
import
java.util.Optional
;
import
org.springframework.data.repository.CrudRepository
;
import
org.springframework.data.repository.CrudRepository
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
...
@@ -33,7 +35,7 @@ public interface FlightRepository extends CrudRepository<Flight, Long> {
...
@@ -33,7 +35,7 @@ public interface FlightRepository extends CrudRepository<Flight, Long> {
@Override
@Override
@PreAuthorize
(
"#oauth2.hasScope('read')"
)
@PreAuthorize
(
"#oauth2.hasScope('read')"
)
Flight
findOne
(
Long
aLong
);
Optional
<
Flight
>
findOne
(
Long
aLong
);
@Override
@Override
@PreAuthorize
(
"#oauth2.hasScope('write')"
)
@PreAuthorize
(
"#oauth2.hasScope('write')"
)
...
...
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