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
01e66ecb
Commit
01e66ecb
authored
Nov 05, 2016
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.4.x' into 1.5.x
parents
389acb09
4311cf33
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
66 additions
and
174 deletions
+66
-174
ManagementServerPropertiesAutoConfigurationNoSecurityTests.java
...mentServerPropertiesAutoConfigurationNoSecurityTests.java
+65
-0
ManagementServerPropertiesAutoConfigurationTests.java
...ure/ManagementServerPropertiesAutoConfigurationTests.java
+1
-9
pom.xml
spring-boot-samples/pom.xml
+0
-1
pom.xml
...t-samples/spring-boot-sample-actuator-no-security/pom.xml
+0
-44
SampleActuatorNoSecurityApplication.java
...uator/nosecurity/SampleActuatorNoSecurityApplication.java
+0
-49
application.properties
...tor-no-security/src/main/resources/application.properties
+0
-2
bootstrap.min.css
...-security/src/main/resources/static/css/bootstrap.min.css
+0
-11
error.ftl
...tuator-no-security/src/main/resources/templates/error.ftl
+0
-32
home.ftl
...ctuator-no-security/src/main/resources/templates/home.ftl
+0
-26
No files found.
spring-boot-
samples/spring-boot-sample-actuator-no-security/src/test/java/sample/actuator/nosecurity/SampleActuatorNoSecurityApplication
Tests.java
→
spring-boot-
actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementServerPropertiesAutoConfigurationNoSecurity
Tests.java
View file @
01e66ecb
...
...
@@ -14,58 +14,52 @@
* limitations under the License.
*/
package
sample
.
actuator
.
nosecurity
;
import
java.util.Arrays
;
import
java.util.Map
;
package
org
.
springframework
.
boot
.
actuate
.
autoconfigure
;
import
org.junit.After
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.context.SpringBootTest.WebEnvironment
;
import
org.springframework.boot.test.web.client.TestRestTemplate
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.boot.test.util.EnvironmentTestUtils
;
import
org.springframework.boot.testutil.ClassPathExclusions
;
import
org.springframework.boot.testutil.FilteredClassPathRunner
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
/**
* Basic integration tests for demo application.
* Tests for {@link ManagementServerPropertiesAutoConfiguration} when Spring Security is
* not present.
*
* @author
Phillip Webb
* @author
Stephane Nicoll
*/
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
webEnvironment
=
WebEnvironment
.
RANDOM_PORT
)
@DirtiesContext
public
class
SampleActuatorNoSecurityApplicationTests
{
@RunWith
(
FilteredClassPathRunner
.
class
)
@ClassPathExclusions
(
"spring-security-*.jar"
)
public
class
ManagementServerPropertiesAutoConfigurationNoSecurityTests
{
@Autowired
private
TestRestTemplate
restTemplate
;
private
AnnotationConfigApplicationContext
context
;
@Test
public
void
testHome
()
throws
Exception
{
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setAccept
(
Arrays
.
asList
(
MediaType
.
TEXT_HTML
));
ResponseEntity
<
String
>
entity
=
this
.
restTemplate
.
exchange
(
"/"
,
HttpMethod
.
GET
,
new
HttpEntity
<
Void
>(
headers
),
String
.
class
);
assertThat
(
entity
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
OK
);
assertThat
(
entity
.
getBody
()).
contains
(
"<title>Hello"
);
@After
public
void
close
()
{
if
(
this
.
context
!=
null
)
{
this
.
context
.
close
();
}
}
@Test
public
void
testMetrics
()
throws
Exception
{
@SuppressWarnings
(
"rawtypes"
)
ResponseEntity
<
Map
>
entity
=
this
.
restTemplate
.
getForEntity
(
"/metrics"
,
Map
.
class
);
assertThat
(
entity
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
OK
);
public
void
securitySettingsIgnoredWithoutSpringSecurity
()
{
ManagementServerProperties
properties
=
load
(
"management.security.enabled=false"
);
assertThat
(
properties
.
getSecurity
().
isEnabled
()).
isFalse
();
}
public
ManagementServerProperties
load
(
String
...
environment
)
{
AnnotationConfigApplicationContext
ctx
=
new
AnnotationConfigApplicationContext
();
EnvironmentTestUtils
.
addEnvironment
(
ctx
,
environment
);
ctx
.
register
(
ManagementServerPropertiesAutoConfiguration
.
class
);
ctx
.
refresh
();
this
.
context
=
ctx
;
return
this
.
context
.
getBean
(
ManagementServerProperties
.
class
);
}
}
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementServerPropertiesAutoConfigurationTests.java
View file @
01e66ecb
...
...
@@ -19,10 +19,8 @@ package org.springframework.boot.actuate.autoconfigure;
import
org.junit.After
;
import
org.junit.Test
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.boot.test.util.EnvironmentTestUtils
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.context.annotation.Configuration
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
...
...
@@ -89,16 +87,10 @@ public class ManagementServerPropertiesAutoConfigurationTests {
public
ManagementServerProperties
load
(
String
...
environment
)
{
AnnotationConfigApplicationContext
ctx
=
new
AnnotationConfigApplicationContext
();
EnvironmentTestUtils
.
addEnvironment
(
ctx
,
environment
);
ctx
.
register
(
Test
Configuration
.
class
);
ctx
.
register
(
ManagementServerPropertiesAuto
Configuration
.
class
);
ctx
.
refresh
();
this
.
context
=
ctx
;
return
this
.
context
.
getBean
(
ManagementServerProperties
.
class
);
}
@Configuration
@EnableConfigurationProperties
(
ManagementServerProperties
.
class
)
static
class
TestConfiguration
{
}
}
spring-boot-samples/pom.xml
View file @
01e66ecb
...
...
@@ -25,7 +25,6 @@
<module>
spring-boot-sample-activemq
</module>
<module>
spring-boot-sample-actuator
</module>
<module>
spring-boot-sample-actuator-log4j2
</module>
<module>
spring-boot-sample-actuator-no-security
</module>
<module>
spring-boot-sample-actuator-noweb
</module>
<module>
spring-boot-sample-actuator-ui
</module>
<module>
spring-boot-sample-amqp
</module>
...
...
spring-boot-samples/spring-boot-sample-actuator-no-security/pom.xml
deleted
100644 → 0
View file @
389acb09
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<!-- Your own application should inherit from spring-boot-starter-parent -->
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-samples
</artifactId>
<version>
1.5.0.BUILD-SNAPSHOT
</version>
</parent>
<artifactId>
spring-boot-sample-actuator-no-security
</artifactId>
<name>
Spring Boot Actuator UI Sample
</name>
<description>
Spring Boot Actuator No Security Sample
</description>
<url>
http://projects.spring.io/spring-boot/
</url>
<organization>
<name>
Pivotal Software, Inc.
</name>
<url>
http://www.spring.io
</url>
</organization>
<properties>
<main.basedir>
${basedir}/../..
</main.basedir>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-freemarker
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
</plugins>
</build>
</project>
spring-boot-samples/spring-boot-sample-actuator-no-security/src/main/java/sample/actuator/nosecurity/SampleActuatorNoSecurityApplication.java
deleted
100644 → 0
View file @
389acb09
/*
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
sample
.
actuator
.
nosecurity
;
import
java.util.Date
;
import
java.util.Map
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
@SpringBootApplication
@Controller
public
class
SampleActuatorNoSecurityApplication
{
@GetMapping
(
"/"
)
public
String
home
(
Map
<
String
,
Object
>
model
)
{
model
.
put
(
"message"
,
"Hello World"
);
model
.
put
(
"title"
,
"Hello Home"
);
model
.
put
(
"date"
,
new
Date
());
return
"home"
;
}
@RequestMapping
(
"/foo"
)
public
String
foo
()
{
throw
new
RuntimeException
(
"Expected exception in controller"
);
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
SpringApplication
.
run
(
SampleActuatorNoSecurityApplication
.
class
,
args
);
}
}
spring-boot-samples/spring-boot-sample-actuator-no-security/src/main/resources/application.properties
deleted
100644 → 0
View file @
389acb09
health.diskspace.enabled
=
false
management.security.role
=
superuser
spring-boot-samples/spring-boot-sample-actuator-no-security/src/main/resources/static/css/bootstrap.min.css
deleted
100644 → 0
View file @
389acb09
This diff is collapsed.
Click to expand it.
spring-boot-samples/spring-boot-sample-actuator-no-security/src/main/resources/templates/error.ftl
deleted
100644 → 0
View file @
389acb09
<
#
import
"/
spring
.
ftl
"
as
spring
/>
<!DOCTYPE html>
<html>
<head>
<title>
Error
</title>
<
#
assign
home
><
@
spring
.
url
relativeUrl=
"/"
/></
#
assign>
<
#
assign
bootstrap
><
@
spring
.
url
relativeUrl=
"/css/bootstrap.min.css"
/></
#
assign>
<link
rel=
"stylesheet"
href=
"${bootstrap}"
/>
</head>
<body>
<div
class=
"container"
>
<div
class=
"navbar"
>
<div
class=
"navbar-inner"
>
<a
class=
"brand"
href=
"http://freemarker.org/"
>
FreeMarker -
Plain
</a>
<ul
class=
"nav"
>
<li><a
href=
"${home}"
>
Home
</a></li>
</ul>
</div>
</div>
<h1>
Error Page
</h1>
<div
id=
"created"
>
${timestamp?datetime}
</div>
<div>
There was an unexpected error (type=${error}, status=${status}).
</div>
<div>
${message}
</div>
<div>
Please contact the operator with the above information.
</div>
</div>
</body>
</html>
spring-boot-samples/spring-boot-sample-actuator-no-security/src/main/resources/templates/home.ftl
deleted
100644 → 0
View file @
389acb09
<
#
import
"/
spring
.
ftl
"
as
spring
/>
<!DOCTYPE html>
<html>
<head>
<title>
${title}
</title>
<
#
assign
home
><
@
spring
.
url
relativeUrl=
"/"
/></
#
assign>
<
#
assign
bootstrap
><
@
spring
.
url
relativeUrl=
"/css/bootstrap.min.css"
/></
#
assign>
<link
rel=
"stylesheet"
href=
"${bootstrap}"
/>
</head>
<body>
<div
class=
"container"
>
<div
class=
"navbar"
>
<div
class=
"navbar-inner"
>
<a
class=
"brand"
href=
"http://freemarker.org/"
>
FreeMarker -
Plain
</a>
<ul
class=
"nav"
>
<li><a
href=
"${home}"
>
Home
</a></li>
</ul>
</div>
</div>
<h1>
${title}
</h1>
<div>
${message}
</div>
<div
id=
"created"
>
${date?datetime}
</div>
</div>
</body>
</html>
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