Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
Project
Overview
Details
Activity
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
openSource
spring-cloud-netflix
Commits
87e98edd
Unverified
Commit
87e98edd
authored
Sep 28, 2017
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move test security uname/pswd to constants.
parent
61513287
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
11 deletions
+7
-11
HystrixOnlyTests.java
...ringframework/cloud/netflix/hystrix/HystrixOnlyTests.java
+3
-10
TestAutoConfiguration.java
...ngframework/cloud/netflix/test/TestAutoConfiguration.java
+4
-1
No files found.
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/HystrixOnlyTests.java
View file @
87e98edd
...
...
@@ -22,7 +22,6 @@ import java.util.Map;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.test.context.SpringBootTest
;
...
...
@@ -47,6 +46,8 @@ import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
springframework
.
cloud
.
netflix
.
test
.
TestAutoConfiguration
.
PASSWORD
;
import
static
org
.
springframework
.
cloud
.
netflix
.
test
.
TestAutoConfiguration
.
USER
;
/**
* @author Spencer Gibb
...
...
@@ -60,12 +61,6 @@ public class HystrixOnlyTests {
@LocalServerPort
private
int
port
;
//FIXME: 2.0.0
private
String
username
=
"user"
;
//FIXME: 2.0.0
private
String
password
=
"password"
;
@Test
public
void
testNormalExecution
()
{
ResponseEntity
<
String
>
res
=
new
TestRestTemplate
()
...
...
@@ -99,12 +94,10 @@ public class HystrixOnlyTests {
map
.
containsKey
(
"discovery"
));
}
private
Map
getHealth
()
{
return
new
TestRestTemplate
().
exchange
(
"http://localhost:"
+
this
.
port
+
"/admin/health"
,
HttpMethod
.
GET
,
new
HttpEntity
<
Void
>(
createBasicAuthHeader
(
username
,
password
)),
new
HttpEntity
<
Void
>(
createBasicAuthHeader
(
USER
,
PASSWORD
)),
Map
.
class
).
getBody
();
}
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/test/TestAutoConfiguration.java
View file @
87e98edd
...
...
@@ -38,6 +38,9 @@ import org.springframework.security.provisioning.InMemoryUserDetailsManager;
@AutoConfigureBefore
(
SecurityAutoConfiguration
.
class
)
public
class
TestAutoConfiguration
{
public
static
final
String
USER
=
"user"
;
public
static
final
String
PASSWORD
=
"password"
;
@Configuration
@Order
(
Ordered
.
HIGHEST_PRECEDENCE
)
protected
static
class
TestSecurityConfiguration
extends
WebSecurityConfigurerAdapter
{
...
...
@@ -50,7 +53,7 @@ public class TestAutoConfiguration {
@Bean
public
UserDetailsService
userDetailsService
()
{
InMemoryUserDetailsManager
manager
=
new
InMemoryUserDetailsManager
();
manager
.
createUser
(
User
.
withUsername
(
"user"
).
password
(
"password"
).
roles
(
"USER"
).
build
());
manager
.
createUser
(
User
.
withUsername
(
USER
).
password
(
PASSWORD
).
roles
(
"USER"
).
build
());
return
manager
;
}
...
...
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