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
383640d5
Commit
383640d5
authored
Apr 18, 2017
by
Phillip Webb
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.5.x'
parents
757be57d
b2ae6b5f
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
45 additions
and
31 deletions
+45
-31
HealthMvcEndpointAutoConfigurationTests.java
...utoconfigure/HealthMvcEndpointAutoConfigurationTests.java
+6
-2
FreeMarkerTemplateAvailabilityProvider.java
...re/freemarker/FreeMarkerTemplateAvailabilityProvider.java
+2
-2
GroovyTemplateAvailabilityProvider.java
...e/groovy/template/GroovyTemplateAvailabilityProvider.java
+2
-2
PathBasedTemplateAvailabilityProvider.java
...igure/template/PathBasedTemplateAvailabilityProvider.java
+4
-3
ExampleJsonObjectWithView.java
...ot/test/autoconfigure/json/ExampleJsonObjectWithView.java
+0
-1
JsonTestIntegrationTests.java
...oot/test/autoconfigure/json/JsonTestIntegrationTests.java
+3
-2
AbstractJsonMarshalTester.java
...ngframework/boot/test/json/AbstractJsonMarshalTester.java
+4
-0
JacksonTester.java
...ava/org/springframework/boot/test/json/JacksonTester.java
+4
-3
ExampleObject.java
...ava/org/springframework/boot/test/json/ExampleObject.java
+0
-1
JacksonTesterIntegrationTests.java
...amework/boot/test/json/JacksonTesterIntegrationTests.java
+17
-12
SpringApplicationAdminMXBean.java
...ingframework/boot/admin/SpringApplicationAdminMXBean.java
+3
-3
No files found.
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthMvcEndpointAutoConfigurationTests.java
View file @
383640d5
...
...
@@ -108,7 +108,8 @@ public class HealthMvcEndpointAutoConfigurationTests {
public
void
endpointConditionalOnMissingBean
()
throws
Exception
{
this
.
context
=
new
AnnotationConfigWebApplicationContext
();
this
.
context
.
setServletContext
(
new
MockServletContext
());
this
.
context
.
register
(
TestConfiguration
.
class
,
TestHealthMvcEndpointConfiguration
.
class
);
this
.
context
.
register
(
TestConfiguration
.
class
,
TestHealthMvcEndpointConfiguration
.
class
);
this
.
context
.
refresh
();
MockHttpServletRequest
request
=
new
MockHttpServletRequest
();
Health
health
=
(
Health
)
this
.
context
.
getBean
(
HealthMvcEndpoint
.
class
)
...
...
@@ -141,6 +142,7 @@ public class HealthMvcEndpointAutoConfigurationTests {
public
HealthMvcEndpoint
endpoint
(
HealthEndpoint
endpoint
)
{
return
new
TestHealthMvcEndpoint
(
endpoint
);
}
}
static
class
TestHealthMvcEndpoint
extends
HealthMvcEndpoint
{
...
...
@@ -150,9 +152,11 @@ public class HealthMvcEndpointAutoConfigurationTests {
}
@Override
protected
boolean
exposeHealthDetails
(
HttpServletRequest
request
,
Principal
principal
)
{
protected
boolean
exposeHealthDetails
(
HttpServletRequest
request
,
Principal
principal
)
{
return
true
;
}
}
static
class
TestHealthIndicator
extends
AbstractHealthIndicator
{
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProvider.java
View file @
383640d5
...
...
@@ -20,7 +20,7 @@ import java.util.ArrayList;
import
java.util.Arrays
;
import
java.util.List
;
import
org.springframework.boot.autoconfigure.template.
Abstract
TemplateAvailabilityProvider
;
import
org.springframework.boot.autoconfigure.template.
PathBased
TemplateAvailabilityProvider
;
import
org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvider
;
/**
...
...
@@ -31,7 +31,7 @@ import org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvi
* @since 1.1.0
*/
public
class
FreeMarkerTemplateAvailabilityProvider
extends
Abstract
TemplateAvailabilityProvider
{
extends
PathBased
TemplateAvailabilityProvider
{
public
FreeMarkerTemplateAvailabilityProvider
()
{
super
(
"freemarker.template.Configuration"
,
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAvailabilityProvider.java
View file @
383640d5
...
...
@@ -20,7 +20,7 @@ import java.util.ArrayList;
import
java.util.Arrays
;
import
java.util.List
;
import
org.springframework.boot.autoconfigure.template.
Abstract
TemplateAvailabilityProvider
;
import
org.springframework.boot.autoconfigure.template.
PathBased
TemplateAvailabilityProvider
;
import
org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvider
;
/**
...
...
@@ -31,7 +31,7 @@ import org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvi
* @since 1.1.0
*/
public
class
GroovyTemplateAvailabilityProvider
extends
Abstract
TemplateAvailabilityProvider
{
extends
PathBased
TemplateAvailabilityProvider
{
public
GroovyTemplateAvailabilityProvider
()
{
super
(
"groovy.text.TemplateEngine"
,
GroovyTemplateAvailabilityProperties
.
class
,
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/
Abstract
TemplateAvailabilityProvider.java
→
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/
PathBased
TemplateAvailabilityProvider.java
View file @
383640d5
...
...
@@ -27,13 +27,14 @@ import org.springframework.core.io.ResourceLoader;
import
org.springframework.util.ClassUtils
;
/**
* Abstract base class for {@link TemplateAvailabilityProvider} implementations.
* Abstract base class for {@link TemplateAvailabilityProvider} implementations that find
* templates from paths.
*
* @author Andy Wilkinson
* @author Phillip Webb
* @since 1.4.6
*/
public
abstract
class
Abstract
TemplateAvailabilityProvider
public
abstract
class
PathBased
TemplateAvailabilityProvider
implements
TemplateAvailabilityProvider
{
private
final
String
className
;
...
...
@@ -42,7 +43,7 @@ public abstract class AbstractTemplateAvailabilityProvider
private
final
String
propertyPrefix
;
public
Abstract
TemplateAvailabilityProvider
(
String
className
,
public
PathBased
TemplateAvailabilityProvider
(
String
className
,
Class
<?
extends
TemplateAvailabilityProperties
>
propertiesClass
,
String
propertyPrefix
)
{
this
.
className
=
className
;
...
...
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/ExampleJsonObjectWithView.java
View file @
383640d5
...
...
@@ -73,4 +73,3 @@ public class ExampleJsonObjectWithView {
}
}
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/JsonTestIntegrationTests.java
View file @
383640d5
...
...
@@ -32,6 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* Integration tests for {@link JsonTest}.
*
* @author Phillip Webb
* @author Madhura Bhave
*/
@RunWith
(
SpringRunner
.
class
)
@JsonTest
...
...
@@ -82,9 +83,9 @@ public class JsonTestIntegrationTests {
ExampleJsonObjectWithView
object
=
new
ExampleJsonObjectWithView
();
object
.
setValue
(
"spring"
);
JsonContent
<
ExampleJsonObjectWithView
>
content
=
this
.
jacksonWithViewJson
.
forView
(
ExampleJsonObjectWithView
.
TestView
.
class
)
.
write
(
object
);
.
forView
(
ExampleJsonObjectWithView
.
TestView
.
class
).
write
(
object
);
assertThat
(
content
).
doesNotHaveJsonPathValue
(
"id"
);
assertThat
(
content
).
isEqualToJson
(
"example.json"
);
}
}
spring-boot-test/src/main/java/org/springframework/boot/test/json/AbstractJsonMarshalTester.java
View file @
383640d5
...
...
@@ -113,6 +113,10 @@ public abstract class AbstractJsonMarshalTester<T> {
return
this
.
type
;
}
/**
* Return class used to load relative resources.
* @return the resource load class
*/
protected
final
Class
<?>
getResourceLoadClass
()
{
return
this
.
resourceLoadClass
;
}
...
...
spring-boot-test/src/main/java/org/springframework/boot/test/json/JacksonTester.java
View file @
383640d5
...
...
@@ -152,13 +152,14 @@ public class JacksonTester<T> extends AbstractJsonMarshalTester<T> {
}
/**
* Returns a new instance of {@link JacksonTester} with the view
*
that should be used
for json serialization/deserialization.
* Returns a new instance of {@link JacksonTester} with the view
that should be used
* for json serialization/deserialization.
* @param view the view class
* @return the new instance
*/
public
JacksonTester
<
T
>
forView
(
Class
<?>
view
)
{
return
new
JacksonTester
<
T
>(
this
.
getResourceLoadClass
(),
this
.
getType
(),
this
.
objectMapper
,
view
);
return
new
JacksonTester
<
T
>(
this
.
getResourceLoadClass
(),
this
.
getType
(),
this
.
objectMapper
,
view
);
}
/**
...
...
spring-boot-test/src/test/java/org/springframework/boot/test/json/ExampleObject.java
View file @
383640d5
...
...
@@ -64,4 +64,3 @@ public class ExampleObject {
}
}
spring-boot-test/src/test/java/org/springframework/boot/test/json/JacksonTesterIntegrationTests.java
View file @
383640d5
...
...
@@ -35,6 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* Integration tests for {@link JacksonTester}. Shows typical usage.
*
* @author Phillip Webb
* @author Madhura Bhave
*/
public
class
JacksonTesterIntegrationTests
{
...
...
@@ -56,6 +57,13 @@ public class JacksonTesterIntegrationTests {
JacksonTester
.
initFields
(
this
,
this
.
objectMapper
);
}
@Test
public
void
typicalTest
()
throws
Exception
{
String
example
=
JSON
;
assertThat
(
this
.
simpleJson
.
parse
(
example
).
getObject
().
getName
())
.
isEqualTo
(
"Spring"
);
}
@Test
public
void
typicalListTest
()
throws
Exception
{
String
example
=
"["
+
JSON
+
"]"
;
...
...
@@ -79,10 +87,9 @@ public class JacksonTesterIntegrationTests {
ExampleObjectWithView
object
=
new
ExampleObjectWithView
();
object
.
setName
(
"Spring"
);
object
.
setAge
(
123
);
JsonContent
<
ExampleObjectWithView
>
content
=
this
.
jsonWithView
.
forView
(
ExampleObjectWithView
.
TestView
.
class
).
write
(
object
);
assertThat
(
content
).
extractingJsonPathStringValue
(
"@.name"
)
.
isEqualTo
(
"Spring"
);
JsonContent
<
ExampleObjectWithView
>
content
=
this
.
jsonWithView
.
forView
(
ExampleObjectWithView
.
TestView
.
class
).
write
(
object
);
assertThat
(
content
).
extractingJsonPathStringValue
(
"@.name"
).
isEqualTo
(
"Spring"
);
assertThat
(
content
).
doesNotHaveJsonPathValue
(
"age"
);
}
...
...
@@ -90,10 +97,9 @@ public class JacksonTesterIntegrationTests {
public
void
readWithResourceAndView
()
throws
Exception
{
this
.
objectMapper
.
disable
(
MapperFeature
.
DEFAULT_VIEW_INCLUSION
);
ByteArrayResource
resource
=
new
ByteArrayResource
(
JSON
.
getBytes
());
ObjectContent
<
ExampleObjectWithView
>
content
=
this
.
jsonWithView
.
forView
(
ExampleObjectWithView
.
TestView
.
class
).
read
(
resource
);
assertThat
(
content
.
getObject
().
getName
())
.
isEqualTo
(
"Spring"
);
ObjectContent
<
ExampleObjectWithView
>
content
=
this
.
jsonWithView
.
forView
(
ExampleObjectWithView
.
TestView
.
class
).
read
(
resource
);
assertThat
(
content
.
getObject
().
getName
()).
isEqualTo
(
"Spring"
);
assertThat
(
content
.
getObject
().
getAge
()).
isEqualTo
(
0
);
}
...
...
@@ -101,10 +107,9 @@ public class JacksonTesterIntegrationTests {
public
void
readWithReaderAndView
()
throws
Exception
{
this
.
objectMapper
.
disable
(
MapperFeature
.
DEFAULT_VIEW_INCLUSION
);
Reader
reader
=
new
StringReader
(
JSON
);
ObjectContent
<
ExampleObjectWithView
>
content
=
this
.
jsonWithView
.
forView
(
ExampleObjectWithView
.
TestView
.
class
).
read
(
reader
);
assertThat
(
content
.
getObject
().
getName
())
.
isEqualTo
(
"Spring"
);
ObjectContent
<
ExampleObjectWithView
>
content
=
this
.
jsonWithView
.
forView
(
ExampleObjectWithView
.
TestView
.
class
).
read
(
reader
);
assertThat
(
content
.
getObject
().
getName
()).
isEqualTo
(
"Spring"
);
assertThat
(
content
.
getObject
().
getAge
()).
isEqualTo
(
0
);
}
...
...
spring-boot/src/main/java/org/springframework/boot/admin/SpringApplicationAdminMXBean.java
View file @
383640d5
...
...
@@ -33,9 +33,9 @@ public interface SpringApplicationAdminMXBean {
boolean
isReady
();
/**
* Specify if the application runs in an embedded web container. Return
*
{@code false} on a web application that hasn't fully started yet, so it is
*
preferable to wait for
the application to be {@link #isReady() ready}.
* Specify if the application runs in an embedded web container. Return
{@code false}
*
on a web application that hasn't fully started yet, so it is preferable to wait for
* the application to be {@link #isReady() ready}.
* @return {@code true} if the application runs in an embedded web container
* @see #isReady()
*/
...
...
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