Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
minerva
core
Commits
59b201ae
Commit
59b201ae
authored
5 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
log levels are restored properly
parent
c7fdb6b6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!836
Resolve "Implement Spring Security"
Pipeline
#11868
passed
5 years ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
web/src/test/java/lcsb/mapviewer/web/EndPointsInputValidationTests.java
+20
-7
20 additions, 7 deletions
...ava/lcsb/mapviewer/web/EndPointsInputValidationTests.java
with
20 additions
and
7 deletions
web/src/test/java/lcsb/mapviewer/web/EndPointsInputValidationTests.java
+
20
−
7
View file @
59b201ae
...
...
@@ -3,25 +3,25 @@ package lcsb.mapviewer.web;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.*;
import
java.net.URI
;
import
java.util.*
;
import
javax.servlet.ServletContext
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.logging.log4j.*
;
import
org.apache.logging.log4j.core.LoggerContext
;
import
org.apache.logging.log4j.core.config.Configurator
;
import
org.junit.
Test
;
import
org.junit.
*
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.web.servlet.RequestBuilder
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver
;
import
org.springframework.web.servlet.mvc.method.RequestMappingInfo
;
import
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
;
import
lcsb.mapviewer.api.BaseController
;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
public
class
EndPointsInputValidationTests
extends
ControllerIntegrationTest
{
...
...
@@ -34,10 +34,24 @@ public class EndPointsInputValidationTests extends ControllerIntegrationTest {
@Autowired
public
RequestMappingHandlerMapping
requestMappingHandlerMapping
;
@Autowired
ServletContext
container
;
@Before
public
void
setUp
()
throws
Exception
{
Configurator
.
setAllLevels
(
LogManager
.
getRootLogger
().
getName
(),
Level
.
FATAL
);
}
@After
public
void
tearDown
()
throws
Exception
{
String
file
=
"src/test/resources/log4j2.properties"
;
LoggerContext
context
=
(
org
.
apache
.
logging
.
log4j
.
core
.
LoggerContext
)
org
.
apache
.
logging
.
log4j
.
LogManager
.
getContext
(
false
);
context
.
setConfigLocation
(
new
URI
(
file
));
}
@Test
public
void
testResponseStatusCodeFromEndpoints
()
throws
Exception
{
Configurator
.
setAllLevels
(
LogManager
.
getRootLogger
().
getName
(),
Level
.
FATAL
);
for
(
RequestMappingInfo
t
:
requestMappingHandlerMapping
.
getHandlerMethods
().
keySet
())
{
for
(
String
url
:
t
.
getPatternsCondition
().
getPatterns
())
{
for
(
RequestMethod
method
:
t
.
getMethodsCondition
().
getMethods
())
{
...
...
@@ -45,7 +59,6 @@ public class EndPointsInputValidationTests extends ControllerIntegrationTest {
}
}
}
Configurator
.
setAllLevels
(
LogManager
.
getRootLogger
().
getName
(),
Level
.
INFO
);
}
private
void
testUrl
(
String
url
,
RequestMethod
method
)
throws
Exception
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment