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
753341c9
Commit
753341c9
authored
Dec 03, 2015
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test for enabling Undertow's access log and verify the file name
See gh-4670
parent
e233ea7f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
UndertowEmbeddedServletContainerFactoryTests.java
...ndertow/UndertowEmbeddedServletContainerFactoryTests.java
+20
-0
No files found.
spring-boot/src/test/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactoryTests.java
View file @
753341c9
...
@@ -16,6 +16,9 @@
...
@@ -16,6 +16,9 @@
package
org
.
springframework
.
boot
.
context
.
embedded
.
undertow
;
package
org
.
springframework
.
boot
.
context
.
embedded
.
undertow
;
import
java.io.File
;
import
java.io.IOException
;
import
java.net.URISyntaxException
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.HashSet
;
import
java.util.HashSet
;
...
@@ -39,6 +42,8 @@ import org.springframework.boot.context.embedded.ServletRegistrationBean;
...
@@ -39,6 +42,8 @@ import org.springframework.boot.context.embedded.ServletRegistrationBean;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.test.util.ReflectionTestUtils
;
import
org.springframework.test.util.ReflectionTestUtils
;
import
static
org
.
hamcrest
.
Matchers
.
arrayContaining
;
import
static
org
.
hamcrest
.
Matchers
.
arrayWithSize
;
import
static
org
.
hamcrest
.
Matchers
.
equalTo
;
import
static
org
.
hamcrest
.
Matchers
.
equalTo
;
import
static
org
.
hamcrest
.
Matchers
.
is
;
import
static
org
.
hamcrest
.
Matchers
.
is
;
import
static
org
.
hamcrest
.
Matchers
.
not
;
import
static
org
.
hamcrest
.
Matchers
.
not
;
...
@@ -172,6 +177,21 @@ public class UndertowEmbeddedServletContainerFactoryTests
...
@@ -172,6 +177,21 @@ public class UndertowEmbeddedServletContainerFactoryTests
is
(
not
(
equalTo
(
getServletContainerFromNewFactory
()))));
is
(
not
(
equalTo
(
getServletContainerFromNewFactory
()))));
}
}
@Test
public
void
accessLogCanBeEnabled
()
throws
IOException
,
URISyntaxException
{
UndertowEmbeddedServletContainerFactory
factory
=
getFactory
();
factory
.
setAccessLogEnabled
(
true
);
File
accessLogDirectory
=
this
.
temporaryFolder
.
getRoot
();
factory
.
setAccessLogDirectory
(
accessLogDirectory
);
assertThat
(
accessLogDirectory
.
listFiles
(),
is
(
arrayWithSize
(
0
)));
this
.
container
=
factory
.
getEmbeddedServletContainer
(
new
ServletRegistrationBean
(
new
ExampleServlet
(),
"/hello"
));
this
.
container
.
start
();
assertThat
(
getResponse
(
getLocalUrl
(
"/hello"
)),
equalTo
(
"Hello World"
));
assertThat
(
accessLogDirectory
.
listFiles
(),
is
(
arrayContaining
(
new
File
(
accessLogDirectory
,
"access_log.log"
))));
}
@Override
@Override
protected
Object
getJspServlet
()
{
protected
Object
getJspServlet
()
{
return
null
;
// Undertow does not support JSPs
return
null
;
// Undertow does not support JSPs
...
...
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