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
65295e0e
Commit
65295e0e
authored
Sep 19, 2018
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.0.x'
parents
32c46710
bff93a67
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
1 deletion
+67
-1
ClassLoaderFilesResourcePatternResolver.java
...ools/restart/ClassLoaderFilesResourcePatternResolver.java
+1
-1
DevToolsIntegrationTests.java
...amework/boot/devtools/tests/DevToolsIntegrationTests.java
+66
-0
No files found.
spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ClassLoaderFilesResourcePatternResolver.java
View file @
65295e0e
...
...
@@ -130,7 +130,7 @@ final class ClassLoaderFilesResourcePatternResolver implements ResourcePatternRe
for
(
Entry
<
String
,
ClassLoaderFile
>
entry
:
sourceFolder
.
getFilesEntrySet
())
{
String
name
=
entry
.
getKey
();
ClassLoaderFile
file
=
entry
.
getValue
();
if
(
file
.
getKind
()
==
Kind
.
ADD
ED
if
(
entry
.
getValue
().
getKind
()
!=
Kind
.
DELET
ED
&&
this
.
antPathMatcher
.
match
(
trimmedLocationPattern
,
name
))
{
URL
url
=
new
URL
(
"reloaded"
,
null
,
-
1
,
"/"
+
name
,
new
ClassLoaderFileURLStreamHandler
(
file
));
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java
View file @
65295e0e
...
...
@@ -125,6 +125,53 @@ public class DevToolsIntegrationTests {
}
@Test
public
void
createAControllerAndThenAddARequestMapping
()
throws
Exception
{
TestRestTemplate
template
=
new
TestRestTemplate
();
String
urlBase
=
"http://localhost:"
+
awaitServerPort
();
assertThat
(
template
.
getForObject
(
urlBase
+
"/one"
,
String
.
class
))
.
isEqualTo
(
"one"
);
assertThat
(
template
.
getForEntity
(
urlBase
+
"/two"
,
String
.
class
).
getStatusCode
())
.
isEqualTo
(
HttpStatus
.
NOT_FOUND
);
controller
(
"com.example.ControllerTwo"
).
withRequestMapping
(
"two"
).
build
();
assertThat
(
template
.
getForObject
(
urlBase
+
"/one"
,
String
.
class
))
.
isEqualTo
(
"one"
);
assertThat
(
template
.
getForObject
(
"http://localhost:"
+
awaitServerPort
()
+
"/two"
,
String
.
class
)).
isEqualTo
(
"two"
);
controller
(
"com.example.ControllerTwo"
).
withRequestMapping
(
"two"
)
.
withRequestMapping
(
"three"
).
build
();
assertThat
(
template
.
getForObject
(
"http://localhost:"
+
awaitServerPort
()
+
"/three"
,
String
.
class
))
.
isEqualTo
(
"three"
);
}
@Test
public
void
createAControllerAndThenAddARequestMappingToAnExistingController
()
throws
Exception
{
TestRestTemplate
template
=
new
TestRestTemplate
();
String
urlBase
=
"http://localhost:"
+
awaitServerPort
();
assertThat
(
template
.
getForObject
(
urlBase
+
"/one"
,
String
.
class
))
.
isEqualTo
(
"one"
);
assertThat
(
template
.
getForEntity
(
urlBase
+
"/two"
,
String
.
class
).
getStatusCode
())
.
isEqualTo
(
HttpStatus
.
NOT_FOUND
);
controller
(
"com.example.ControllerTwo"
).
withRequestMapping
(
"two"
).
build
();
assertThat
(
template
.
getForObject
(
urlBase
+
"/one"
,
String
.
class
))
.
isEqualTo
(
"one"
);
assertThat
(
template
.
getForObject
(
"http://localhost:"
+
awaitServerPort
()
+
"/two"
,
String
.
class
)).
isEqualTo
(
"two"
);
controller
(
"com.example.ControllerOne"
).
withRequestMapping
(
"one"
)
.
withRequestMapping
(
"three"
).
build
();
int
port
=
awaitServerPort
();
assertThat
(
template
.
getForObject
(
"http://localhost:"
+
port
+
"/one"
,
String
.
class
))
.
isEqualTo
(
"one"
);
assertThat
(
template
.
getForObject
(
"http://localhost:"
+
port
+
"/two"
,
String
.
class
))
.
isEqualTo
(
"two"
);
assertThat
(
template
.
getForObject
(
"http://localhost:"
+
port
+
"/three"
,
String
.
class
)).
isEqualTo
(
"three"
);
}
@Test
public
void
deleteAController
()
throws
Exception
{
TestRestTemplate
template
=
new
TestRestTemplate
();
...
...
@@ -137,6 +184,25 @@ public class DevToolsIntegrationTests {
}
@Test
public
void
createAControllerAndThenDeleteIt
()
throws
Exception
{
TestRestTemplate
template
=
new
TestRestTemplate
();
String
urlBase
=
"http://localhost:"
+
awaitServerPort
();
assertThat
(
template
.
getForObject
(
urlBase
+
"/one"
,
String
.
class
))
.
isEqualTo
(
"one"
);
assertThat
(
template
.
getForEntity
(
urlBase
+
"/two"
,
String
.
class
).
getStatusCode
())
.
isEqualTo
(
HttpStatus
.
NOT_FOUND
);
controller
(
"com.example.ControllerTwo"
).
withRequestMapping
(
"two"
).
build
();
assertThat
(
template
.
getForObject
(
urlBase
+
"/one"
,
String
.
class
))
.
isEqualTo
(
"one"
);
assertThat
(
template
.
getForObject
(
"http://localhost:"
+
awaitServerPort
()
+
"/two"
,
String
.
class
)).
isEqualTo
(
"two"
);
assertThat
(
new
File
(
this
.
launchedApplication
.
getClassesDirectory
(),
"com/example/ControllerTwo.class"
).
delete
()).
isTrue
();
assertThat
(
template
.
getForEntity
(
"http://localhost:"
+
awaitServerPort
()
+
"/two"
,
String
.
class
).
getStatusCode
()).
isEqualTo
(
HttpStatus
.
NOT_FOUND
);
}
private
int
awaitServerPort
()
throws
Exception
{
long
end
=
System
.
currentTimeMillis
()
+
30000
;
while
(
this
.
serverPortFile
.
length
()
==
0
)
{
...
...
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