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
98d0da97
Commit
98d0da97
authored
Jul 25, 2014
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clarify serviceUrls
parent
bd7ffe99
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
89 additions
and
1 deletion
+89
-1
EurekaClientConfigBean.java
...ework/platform/netflix/eureka/EurekaClientConfigBean.java
+0
-1
EurekaClientConfigBeanTests.java
.../platform/netflix/eureka/EurekaClientConfigBeanTests.java
+89
-0
No files found.
spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/eureka/EurekaClientConfigBean.java
View file @
98d0da97
...
@@ -154,7 +154,6 @@ public class EurekaClientConfigBean implements EurekaClientConfig {
...
@@ -154,7 +154,6 @@ public class EurekaClientConfigBean implements EurekaClientConfig {
String
serviceUrls
=
serviceUrl
.
get
(
myZone
);
String
serviceUrls
=
serviceUrl
.
get
(
myZone
);
if
(
serviceUrls
==
null
||
serviceUrls
.
isEmpty
())
{
if
(
serviceUrls
==
null
||
serviceUrls
.
isEmpty
())
{
serviceUrls
=
serviceUrl
.
get
(
"default"
);
serviceUrls
=
serviceUrl
.
get
(
"default"
);
}
}
if
(
serviceUrls
!=
null
)
{
if
(
serviceUrls
!=
null
)
{
return
Arrays
.
asList
(
serviceUrls
.
split
(
","
));
return
Arrays
.
asList
(
serviceUrls
.
split
(
","
));
...
...
spring-platform-netflix-core/src/test/java/org/springframework/platform/netflix/eureka/EurekaClientConfigBeanTests.java
0 → 100644
View file @
98d0da97
/*
* Copyright 2013-2014 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
org
.
springframework
.
platform
.
netflix
.
eureka
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
org.junit.After
;
import
org.junit.Test
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.boot.test.EnvironmentTestUtils
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.context.annotation.Configuration
;
/**
* @author Dave Syer
*
*/
public
class
EurekaClientConfigBeanTests
{
private
AnnotationConfigApplicationContext
context
=
new
AnnotationConfigApplicationContext
();
@After
public
void
init
()
{
if
(
context
!=
null
)
{
context
.
close
();
}
}
@Test
public
void
basicBinding
()
{
EnvironmentTestUtils
.
addEnvironment
(
context
,
"eureka.client.proxyHost=example.com"
);
context
.
register
(
PropertyPlaceholderAutoConfiguration
.
class
,
TestConfiguration
.
class
);
context
.
refresh
();
assertEquals
(
"example.com"
,
context
.
getBean
(
EurekaClientConfigBean
.
class
)
.
getProxyHost
());
}
@Test
public
void
serviceUrl
()
{
EnvironmentTestUtils
.
addEnvironment
(
context
,
"eureka.client.serviceUrl.defaultZone:http://example.com"
);
context
.
register
(
PropertyPlaceholderAutoConfiguration
.
class
,
TestConfiguration
.
class
);
context
.
refresh
();
assertEquals
(
"{defaultZone=http://example.com}"
,
context
.
getBean
(
EurekaClientConfigBean
.
class
).
getServiceUrl
().
toString
());
assertEquals
(
"[http://example.com]"
,
context
.
getBean
(
EurekaClientConfigBean
.
class
)
.
getEurekaServerServiceUrls
(
"defaultZone"
).
toString
());
}
@Test
public
void
serviceUrlWithDefault
()
{
EnvironmentTestUtils
.
addEnvironment
(
context
,
"eureka.client.serviceUrl.defaultZone:"
,
"eureka.client.serviceUrl.default:http://example.com"
);
context
.
register
(
PropertyPlaceholderAutoConfiguration
.
class
,
TestConfiguration
.
class
);
context
.
refresh
();
assertEquals
(
"[http://example.com]"
,
context
.
getBean
(
EurekaClientConfigBean
.
class
)
.
getEurekaServerServiceUrls
(
"defaultZone"
).
toString
());
}
@Configuration
@EnableConfigurationProperties
(
EurekaClientConfigBean
.
class
)
protected
static
class
TestConfiguration
{
}
}
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