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
24ef2e50
Commit
24ef2e50
authored
Jun 22, 2015
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.2.x'
parents
074771ec
8681a8ad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
RabbitProperties.java
...ngframework/boot/autoconfigure/amqp/RabbitProperties.java
+2
-1
RabbitPropertiesTests.java
...mework/boot/autoconfigure/amqp/RabbitPropertiesTests.java
+12
-2
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java
View file @
24ef2e50
...
@@ -29,6 +29,7 @@ import org.springframework.util.StringUtils;
...
@@ -29,6 +29,7 @@ import org.springframework.util.StringUtils;
* @author Greg Turnquist
* @author Greg Turnquist
* @author Dave Syer
* @author Dave Syer
* @author Stephane Nicoll
* @author Stephane Nicoll
* @author Andy Wilkinson
*/
*/
@ConfigurationProperties
(
prefix
=
"spring.rabbitmq"
)
@ConfigurationProperties
(
prefix
=
"spring.rabbitmq"
)
public
class
RabbitProperties
{
public
class
RabbitProperties
{
...
@@ -127,7 +128,7 @@ public class RabbitProperties {
...
@@ -127,7 +128,7 @@ public class RabbitProperties {
}
}
int
index
=
address
.
indexOf
(
"/"
);
int
index
=
address
.
indexOf
(
"/"
);
if
(
index
>=
0
&&
index
<
address
.
length
())
{
if
(
index
>=
0
&&
index
<
address
.
length
())
{
this
.
virtualHost
=
address
.
substring
(
index
+
1
);
setVirtualHost
(
address
.
substring
(
index
+
1
)
);
address
=
address
.
substring
(
0
,
index
);
address
=
address
.
substring
(
0
,
index
);
}
}
if
(!
address
.
contains
(
":"
))
{
if
(!
address
.
contains
(
":"
))
{
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitPropertiesTests.java
View file @
24ef2e50
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
5
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.
...
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertNull;
...
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertNull;
* Tests for {@link RabbitProperties}.
* Tests for {@link RabbitProperties}.
*
*
* @author Dave Syer
* @author Dave Syer
* @author Andy Wilkinson
*/
*/
public
class
RabbitPropertiesTests
{
public
class
RabbitPropertiesTests
{
...
@@ -85,6 +86,15 @@ public class RabbitPropertiesTests {
...
@@ -85,6 +86,15 @@ public class RabbitPropertiesTests {
assertEquals
(
"lemur.cloudamqp.com:5672"
,
this
.
properties
.
getAddresses
());
assertEquals
(
"lemur.cloudamqp.com:5672"
,
this
.
properties
.
getAddresses
());
}
}
@Test
public
void
addressWithTrailingSlash
()
{
this
.
properties
.
setAddresses
(
"amqp://root:password@otherhost:1111/"
);
assertEquals
(
"otherhost"
,
this
.
properties
.
getHost
());
assertEquals
(
1111
,
this
.
properties
.
getPort
());
assertEquals
(
"root"
,
this
.
properties
.
getUsername
());
assertEquals
(
"/"
,
this
.
properties
.
getVirtualHost
());
}
@Test
@Test
public
void
testDefaultVirtualHost
()
{
public
void
testDefaultVirtualHost
()
{
this
.
properties
.
setVirtualHost
(
"/"
);
this
.
properties
.
setVirtualHost
(
"/"
);
...
@@ -92,7 +102,7 @@ public class RabbitPropertiesTests {
...
@@ -92,7 +102,7 @@ public class RabbitPropertiesTests {
}
}
@Test
@Test
public
void
test
e
mptyVirtualHost
()
{
public
void
test
E
mptyVirtualHost
()
{
this
.
properties
.
setVirtualHost
(
""
);
this
.
properties
.
setVirtualHost
(
""
);
assertEquals
(
"/"
,
this
.
properties
.
getVirtualHost
());
assertEquals
(
"/"
,
this
.
properties
.
getVirtualHost
());
}
}
...
...
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