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
cd5266ac
Commit
cd5266ac
authored
Feb 23, 2018
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
80ac4f85
Changes
28
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
71 additions
and
70 deletions
+71
-70
ManagementServerPropertiesTests.java
...configure/web/server/ManagementServerPropertiesTests.java
+1
-1
DataSourceInitializerPostProcessor.java
...utoconfigure/jdbc/DataSourceInitializerPostProcessor.java
+1
-1
GroovyTemplateAutoConfigurationTests.java
...groovy/template/GroovyTemplateAutoConfigurationTests.java
+1
-1
DataSourceAutoConfigurationTests.java
.../autoconfigure/jdbc/DataSourceAutoConfigurationTests.java
+1
-1
ActiveMQAutoConfigurationTests.java
...onfigure/jms/activemq/ActiveMQAutoConfigurationTests.java
+1
-1
ActiveMQPropertiesTests.java
...t/autoconfigure/jms/activemq/ActiveMQPropertiesTests.java
+1
-1
ServerPropertiesTests.java
...amework/boot/autoconfigure/web/ServerPropertiesTests.java
+1
-1
ReactiveWebServerFactoryAutoConfigurationTests.java
...ctive/ReactiveWebServerFactoryAutoConfigurationTests.java
+25
-35
LocalDevToolsAutoConfigurationTests.java
...ls/autoconfigure/LocalDevToolsAutoConfigurationTests.java
+1
-1
DefinitionsParserTests.java
...mework/boot/test/mock/mockito/DefinitionsParserTests.java
+1
-1
DelegatingFilterProxyRegistrationBeanTests.java
...b/servlet/DelegatingFilterProxyRegistrationBeanTests.java
+1
-1
City.java
...e-data-jpa/src/main/java/sample/data/jpa/domain/City.java
+2
-1
Hotel.java
...-data-jpa/src/main/java/sample/data/jpa/domain/Hotel.java
+2
-1
Rating.java
...data-jpa/src/main/java/sample/data/jpa/domain/Rating.java
+2
-0
Review.java
...data-jpa/src/main/java/sample/data/jpa/domain/Review.java
+2
-1
ReviewDetails.java
...a/src/main/java/sample/data/jpa/domain/ReviewDetails.java
+2
-1
TripType.java
...ta-jpa/src/main/java/sample/data/jpa/domain/TripType.java
+3
-1
CitySearchCriteria.java
...main/java/sample/data/jpa/service/CitySearchCriteria.java
+2
-1
CityServiceImpl.java
...rc/main/java/sample/data/jpa/service/CityServiceImpl.java
+2
-1
HotelServiceImpl.java
...c/main/java/sample/data/jpa/service/HotelServiceImpl.java
+3
-1
CityRepositoryIntegrationTests.java
...mple/data/jpa/service/CityRepositoryIntegrationTests.java
+2
-2
HotelRepositoryIntegrationTests.java
...ple/data/jpa/service/HotelRepositoryIntegrationTests.java
+3
-3
City.java
...data-rest/src/main/java/sample/data/rest/domain/City.java
+2
-1
Hotel.java
...ata-rest/src/main/java/sample/data/rest/domain/Hotel.java
+2
-1
CitySearchCriteria.java
...ain/java/sample/data/rest/service/CitySearchCriteria.java
+2
-1
SampleDataRestApplicationTests.java
...java/sample/data/rest/SampleDataRestApplicationTests.java
+1
-3
CityRepositoryIntegrationTests.java
...ple/data/rest/service/CityRepositoryIntegrationTests.java
+2
-2
SampleSolrApplicationTests.java
...est/java/sample/data/solr/SampleSolrApplicationTests.java
+2
-4
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementServerPropertiesTests.java
View file @
cd5266ac
/*
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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.
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializerPostProcessor.java
View file @
cd5266ac
/*
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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.
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java
View file @
cd5266ac
/*
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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.
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java
View file @
cd5266ac
/*
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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.
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java
View file @
cd5266ac
/*
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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.
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQPropertiesTests.java
View file @
cd5266ac
/*
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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.
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java
View file @
cd5266ac
/*
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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.
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/ReactiveWebServerFactoryAutoConfigurationTests.java
View file @
cd5266ac
...
@@ -40,34 +40,31 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -40,34 +40,31 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
*/
public
class
ReactiveWebServerFactoryAutoConfigurationTests
{
public
class
ReactiveWebServerFactoryAutoConfigurationTests
{
private
ReactiveWebApplicationContextRunner
contextRunner
=
private
ReactiveWebApplicationContextRunner
contextRunner
=
new
ReactiveWebApplicationContextRunner
(
new
ReactiveWebApplicationContextRunner
(
AnnotationConfigReactiveWebServerApplicationContext:
:
new
)
AnnotationConfigReactiveWebServerApplicationContext:
:
new
)
.
withConfiguration
(
AutoConfigurations
.
of
(
ReactiveWebServerFactoryAutoConfiguration
.
class
));
.
withConfiguration
(
AutoConfigurations
.
of
(
ReactiveWebServerFactoryAutoConfiguration
.
class
));
@Test
@Test
public
void
createFromConfigClass
()
{
public
void
createFromConfigClass
()
{
this
.
contextRunner
this
.
contextRunner
.
withUserConfiguration
(
MockWebServerAutoConfiguration
.
class
,
.
withUserConfiguration
(
MockWebServerAutoConfiguration
.
class
,
HttpHandlerConfiguration
.
class
).
run
((
context
)
->
{
HttpHandlerConfiguration
.
class
)
.
run
(
context
->
{
assertThat
(
context
.
getBeansOfType
(
ReactiveWebServerFactory
.
class
))
assertThat
(
context
.
getBeansOfType
(
ReactiveWebServerFactory
.
class
))
.
hasSize
(
1
);
.
hasSize
(
1
);
assertThat
(
context
.
getBeansOfType
(
WebServerFactoryCustomizer
.
class
))
assertThat
(
context
.
getBeansOfType
(
WebServerFactoryCustomizer
.
class
))
.
hasSize
(
1
);
.
hasSize
(
1
);
assertThat
(
context
.
getBeansOfType
(
ReactiveWebServerFactoryCustomizer
.
class
))
assertThat
(
context
.
hasSize
(
1
);
.
getBeansOfType
(
ReactiveWebServerFactoryCustomizer
.
class
))
.
hasSize
(
1
);
});
});
}
}
@Test
@Test
public
void
missingHttpHandler
()
{
public
void
missingHttpHandler
()
{
this
.
contextRunner
this
.
contextRunner
.
withUserConfiguration
(
MockWebServerAutoConfiguration
.
class
)
.
withUserConfiguration
(
MockWebServerAutoConfiguration
.
class
)
.
run
((
context
)
->
assertThat
(
context
.
getStartupFailure
())
.
run
(
context
->
{
.
isInstanceOf
(
ApplicationContextException
.
class
)
assertThat
(
context
.
getStartupFailure
())
.
hasMessageContaining
(
"missing HttpHandler bean"
));
.
isInstanceOf
(
ApplicationContextException
.
class
)
.
hasMessageContaining
(
"missing HttpHandler bean"
);
});
}
}
@Test
@Test
...
@@ -75,34 +72,27 @@ public class ReactiveWebServerFactoryAutoConfigurationTests {
...
@@ -75,34 +72,27 @@ public class ReactiveWebServerFactoryAutoConfigurationTests {
this
.
contextRunner
this
.
contextRunner
.
withUserConfiguration
(
MockWebServerAutoConfiguration
.
class
,
.
withUserConfiguration
(
MockWebServerAutoConfiguration
.
class
,
HttpHandlerConfiguration
.
class
,
TooManyHttpHandlers
.
class
)
HttpHandlerConfiguration
.
class
,
TooManyHttpHandlers
.
class
)
.
run
(
context
->
{
.
run
((
context
)
->
assertThat
(
context
.
getStartupFailure
())
assertThat
(
context
.
getStartupFailure
())
.
isInstanceOf
(
ApplicationContextException
.
class
)
.
isInstanceOf
(
ApplicationContextException
.
class
)
.
hasMessageContaining
(
"multiple HttpHandler beans : "
.
hasMessageContaining
(
"multiple HttpHandler beans : "
+
+
"httpHandler,additionalHttpHandler"
));
"httpHandler,additionalHttpHandler"
);
});
}
}
@Test
@Test
public
void
customizeReactiveWebServer
()
{
public
void
customizeReactiveWebServer
()
{
this
.
contextRunner
this
.
contextRunner
.
withUserConfiguration
(
MockWebServerAutoConfiguration
.
class
,
.
withUserConfiguration
(
MockWebServerAutoConfiguration
.
class
,
HttpHandlerConfiguration
.
class
,
ReactiveWebServerCustomization
.
class
)
HttpHandlerConfiguration
.
class
,
ReactiveWebServerCustomization
.
class
)
.
run
((
context
)
->
assertThat
(
.
run
(
context
->
{
context
.
getBean
(
MockReactiveWebServerFactory
.
class
).
getPort
())
assertThat
(
context
.
getBean
(
MockReactiveWebServerFactory
.
class
).
getPort
())
.
isEqualTo
(
9000
));
.
isEqualTo
(
9000
);
});
}
}
@Test
@Test
public
void
defaultWebServerIsTomcat
()
{
public
void
defaultWebServerIsTomcat
()
{
// Tomcat should be chosen over Netty if the Tomcat library is present.
// Tomcat should be chosen over Netty if the Tomcat library is present.
this
.
contextRunner
this
.
contextRunner
.
withUserConfiguration
(
HttpHandlerConfiguration
.
class
).
run
(
.
withUserConfiguration
(
HttpHandlerConfiguration
.
class
)
(
context
)
->
assertThat
(
context
.
getBean
(
ReactiveWebServerFactory
.
class
))
.
run
(
context
->
{
.
isInstanceOf
(
TomcatReactiveWebServerFactory
.
class
));
assertThat
(
context
.
getBean
(
ReactiveWebServerFactory
.
class
))
.
isInstanceOf
(
TomcatReactiveWebServerFactory
.
class
);
});
}
}
@Configuration
@Configuration
...
...
spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java
View file @
cd5266ac
/*
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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.
...
...
spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java
View file @
cd5266ac
/*
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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.
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/DelegatingFilterProxyRegistrationBeanTests.java
View file @
cd5266ac
/*
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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.
...
...
spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/City.java
View file @
cd5266ac
/*
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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.
...
@@ -74,4 +74,5 @@ public class City implements Serializable {
...
@@ -74,4 +74,5 @@ public class City implements Serializable {
public
String
toString
()
{
public
String
toString
()
{
return
getName
()
+
","
+
getState
()
+
","
+
getCountry
();
return
getName
()
+
","
+
getState
()
+
","
+
getCountry
();
}
}
}
}
spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Hotel.java
View file @
cd5266ac
/*
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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.
...
@@ -80,4 +80,5 @@ public class Hotel implements Serializable {
...
@@ -80,4 +80,5 @@ public class Hotel implements Serializable {
public
String
getZip
()
{
public
String
getZip
()
{
return
this
.
zip
;
return
this
.
zip
;
}
}
}
}
spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Rating.java
View file @
cd5266ac
...
@@ -17,5 +17,7 @@
...
@@ -17,5 +17,7 @@
package
sample
.
data
.
jpa
.
domain
;
package
sample
.
data
.
jpa
.
domain
;
public
enum
Rating
{
public
enum
Rating
{
TERRIBLE
,
POOR
,
AVERAGE
,
GOOD
,
EXCELLENT
TERRIBLE
,
POOR
,
AVERAGE
,
GOOD
,
EXCELLENT
}
}
spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Review.java
View file @
cd5266ac
/*
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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.
...
@@ -128,4 +128,5 @@ public class Review implements Serializable {
...
@@ -128,4 +128,5 @@ public class Review implements Serializable {
public
void
setDetails
(
String
details
)
{
public
void
setDetails
(
String
details
)
{
this
.
details
=
details
;
this
.
details
=
details
;
}
}
}
}
spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/ReviewDetails.java
View file @
cd5266ac
/*
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
8
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.
...
@@ -75,4 +75,5 @@ public class ReviewDetails implements Serializable {
...
@@ -75,4 +75,5 @@ public class ReviewDetails implements Serializable {
public
void
setDetails
(
String
details
)
{
public
void
setDetails
(
String
details
)
{
this
.
details
=
details
;
this
.
details
=
details
;
}
}
}
}
spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/TripType.java
View file @
cd5266ac
/*
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
8
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.
...
@@ -17,5 +17,7 @@
...
@@ -17,5 +17,7 @@
package
sample
.
data
.
jpa
.
domain
;
package
sample
.
data
.
jpa
.
domain
;
public
enum
TripType
{
public
enum
TripType
{
BUSINESS
,
COUPLES
,
FAMILY
,
FRIENDS
,
SOLO
BUSINESS
,
COUPLES
,
FAMILY
,
FRIENDS
,
SOLO
}
}
spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CitySearchCriteria.java
View file @
cd5266ac
/*
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
8
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,4 +41,5 @@ public class CitySearchCriteria implements Serializable {
...
@@ -41,4 +41,5 @@ public class CitySearchCriteria implements Serializable {
public
void
setName
(
String
name
)
{
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
this
.
name
=
name
;
}
}
}
}
spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CityServiceImpl.java
View file @
cd5266ac
/*
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
8
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.
...
@@ -75,4 +75,5 @@ class CityServiceImpl implements CityService {
...
@@ -75,4 +75,5 @@ class CityServiceImpl implements CityService {
Assert
.
notNull
(
city
,
"City must not be null"
);
Assert
.
notNull
(
city
,
"City must not be null"
);
return
this
.
hotelRepository
.
findByCity
(
city
,
pageable
);
return
this
.
hotelRepository
.
findByCity
(
city
,
pageable
);
}
}
}
}
spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/HotelServiceImpl.java
View file @
cd5266ac
/*
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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.
...
@@ -94,5 +94,7 @@ class HotelServiceImpl implements HotelService {
...
@@ -94,5 +94,7 @@ class HotelServiceImpl implements HotelService {
Long
count
=
this
.
ratingCount
.
get
(
rating
);
Long
count
=
this
.
ratingCount
.
get
(
rating
);
return
count
==
null
?
0
:
count
;
return
count
==
null
?
0
:
count
;
}
}
}
}
}
}
spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/CityRepositoryIntegrationTests.java
View file @
cd5266ac
/*
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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,8 +41,8 @@ public class CityRepositoryIntegrationTests {
...
@@ -41,8 +41,8 @@ public class CityRepositoryIntegrationTests {
@Test
@Test
public
void
findsFirstPageOfCities
()
{
public
void
findsFirstPageOfCities
()
{
Page
<
City
>
cities
=
this
.
repository
.
findAll
(
PageRequest
.
of
(
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 @
cd5266ac
/*
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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,6 +45,7 @@ public class HotelRepositoryIntegrationTests {
...
@@ -45,6 +45,7 @@ public class HotelRepositoryIntegrationTests {
@Autowired
@Autowired
CityRepository
cityRepository
;
CityRepository
cityRepository
;
@Autowired
@Autowired
HotelRepository
repository
;
HotelRepository
repository
;
...
@@ -53,16 +54,15 @@ public class HotelRepositoryIntegrationTests {
...
@@ -53,16 +54,15 @@ public class HotelRepositoryIntegrationTests {
City
city
=
this
.
cityRepository
City
city
=
this
.
cityRepository
.
findAll
(
PageRequest
.
of
(
0
,
1
,
Direction
.
ASC
,
"name"
)).
getContent
().
get
(
0
);
.
findAll
(
PageRequest
.
of
(
0
,
1
,
Direction
.
ASC
,
"name"
)).
getContent
().
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
,
PageRequest
.
of
(
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"
);
List
<
RatingCount
>
counts
=
this
.
repository
.
findRatingCounts
(
hotel
);
List
<
RatingCount
>
counts
=
this
.
repository
.
findRatingCounts
(
hotel
);
assertThat
(
counts
).
hasSize
(
1
);
assertThat
(
counts
).
hasSize
(
1
);
assertThat
(
counts
.
get
(
0
).
getRating
()).
isEqualTo
(
Rating
.
AVERAGE
);
assertThat
(
counts
.
get
(
0
).
getRating
()).
isEqualTo
(
Rating
.
AVERAGE
);
assertThat
(
counts
.
get
(
0
).
getCount
()).
isGreaterThan
(
1L
);
assertThat
(
counts
.
get
(
0
).
getCount
()).
isGreaterThan
(
1L
);
}
}
}
}
spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/domain/City.java
View file @
cd5266ac
/*
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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.
...
@@ -74,4 +74,5 @@ public class City implements Serializable {
...
@@ -74,4 +74,5 @@ public class City implements Serializable {
public
String
toString
()
{
public
String
toString
()
{
return
getName
()
+
","
+
getState
()
+
","
+
getCountry
();
return
getName
()
+
","
+
getState
()
+
","
+
getCountry
();
}
}
}
}
spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/domain/Hotel.java
View file @
cd5266ac
/*
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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.
...
@@ -74,4 +74,5 @@ public class Hotel implements Serializable {
...
@@ -74,4 +74,5 @@ public class Hotel implements Serializable {
public
String
getZip
()
{
public
String
getZip
()
{
return
this
.
zip
;
return
this
.
zip
;
}
}
}
}
spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/service/CitySearchCriteria.java
View file @
cd5266ac
/*
/*
* Copyright 2012-201
5
the original author or authors.
* Copyright 2012-201
8
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,4 +41,5 @@ public class CitySearchCriteria implements Serializable {
...
@@ -41,4 +41,5 @@ public class CitySearchCriteria implements Serializable {
public
void
setName
(
String
name
)
{
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
this
.
name
=
name
;
}
}
}
}
spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/rest/SampleDataRestApplicationTests.java
View file @
cd5266ac
...
@@ -58,14 +58,12 @@ public class SampleDataRestApplicationTests {
...
@@ -58,14 +58,12 @@ public class SampleDataRestApplicationTests {
@Test
@Test
public
void
testHome
()
throws
Exception
{
public
void
testHome
()
throws
Exception
{
this
.
mvc
.
perform
(
get
(
"/api"
)).
andExpect
(
status
().
isOk
())
this
.
mvc
.
perform
(
get
(
"/api"
)).
andExpect
(
status
().
isOk
())
.
andExpect
(
content
().
string
(
containsString
(
"hotels"
)));
.
andExpect
(
content
().
string
(
containsString
(
"hotels"
)));
}
}
@Test
@Test
public
void
findByNameAndCountry
()
throws
Exception
{
public
void
findByNameAndCountry
()
throws
Exception
{
this
.
mvc
.
perform
(
get
(
this
.
mvc
.
perform
(
get
(
"/api/cities/search/findByNameAndCountryAllIgnoringCase?name=Melbourne&country=Australia"
))
"/api/cities/search/findByNameAndCountryAllIgnoringCase?name=Melbourne&country=Australia"
))
.
andExpect
(
status
().
isOk
())
.
andExpect
(
status
().
isOk
())
...
@@ -75,10 +73,10 @@ public class SampleDataRestApplicationTests {
...
@@ -75,10 +73,10 @@ public class SampleDataRestApplicationTests {
@Test
@Test
public
void
findByContaining
()
throws
Exception
{
public
void
findByContaining
()
throws
Exception
{
this
.
mvc
.
perform
(
get
(
this
.
mvc
.
perform
(
get
(
"/api/cities/search/findByNameContainingAndCountryContainingAllIgnoringCase?name=&country=UK"
))
"/api/cities/search/findByNameContainingAndCountryContainingAllIgnoringCase?name=&country=UK"
))
.
andExpect
(
status
().
isOk
())
.
andExpect
(
status
().
isOk
())
.
andExpect
(
jsonPath
(
"_embedded.cities"
,
hasSize
(
3
)));
.
andExpect
(
jsonPath
(
"_embedded.cities"
,
hasSize
(
3
)));
}
}
}
}
spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/rest/service/CityRepositoryIntegrationTests.java
View file @
cd5266ac
/*
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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.
...
@@ -43,7 +43,6 @@ public class CityRepositoryIntegrationTests {
...
@@ -43,7 +43,6 @@ public class CityRepositoryIntegrationTests {
@Test
@Test
public
void
findsFirstPageOfCities
()
{
public
void
findsFirstPageOfCities
()
{
Page
<
City
>
cities
=
this
.
repository
.
findAll
(
PageRequest
.
of
(
0
,
10
));
Page
<
City
>
cities
=
this
.
repository
.
findAll
(
PageRequest
.
of
(
0
,
10
));
assertThat
(
cities
.
getTotalElements
()).
isGreaterThan
(
20L
);
assertThat
(
cities
.
getTotalElements
()).
isGreaterThan
(
20L
);
}
}
...
@@ -63,4 +62,5 @@ public class CityRepositoryIntegrationTests {
...
@@ -63,4 +62,5 @@ public class CityRepositoryIntegrationTests {
PageRequest
.
of
(
0
,
10
));
PageRequest
.
of
(
0
,
10
));
assertThat
(
cities
.
getTotalElements
()).
isEqualTo
(
3L
);
assertThat
(
cities
.
getTotalElements
()).
isEqualTo
(
3L
);
}
}
}
}
spring-boot-samples/spring-boot-sample-data-solr/src/test/java/sample/data/solr/SampleSolrApplicationTests.java
View file @
cd5266ac
/*
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
8
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.
...
@@ -31,7 +31,6 @@ public class SampleSolrApplicationTests {
...
@@ -31,7 +31,6 @@ public class SampleSolrApplicationTests {
@Test
@Test
public
void
testDefaultSettings
()
throws
Exception
{
public
void
testDefaultSettings
()
throws
Exception
{
try
{
try
{
SampleSolrApplication
.
main
(
new
String
[
0
]);
SampleSolrApplication
.
main
(
new
String
[
0
]);
}
}
...
@@ -44,9 +43,8 @@ public class SampleSolrApplicationTests {
...
@@ -44,9 +43,8 @@ public class SampleSolrApplicationTests {
assertThat
(
output
).
contains
(
"name=Sony Playstation"
);
assertThat
(
output
).
contains
(
"name=Sony Playstation"
);
}
}
@SuppressWarnings
(
"serial"
)
private
boolean
serverNotRunning
(
IllegalStateException
ex
)
{
private
boolean
serverNotRunning
(
IllegalStateException
ex
)
{
@SuppressWarnings
(
"serial"
)
NestedCheckedException
nested
=
new
NestedCheckedException
(
"failed"
,
ex
)
{
NestedCheckedException
nested
=
new
NestedCheckedException
(
"failed"
,
ex
)
{
};
};
Throwable
root
=
nested
.
getRootCause
();
Throwable
root
=
nested
.
getRootCause
();
...
...
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