Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ARSnova Backend
Manage
Activity
Members
Labels
Plan
Issues
27
Issue boards
Milestones
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Privacy
Imprint
Contact
Snippets
Groups
Projects
Show more breadcrumbs
ARSnova
ARSnova Backend
Commits
d54b3263
There was a problem fetching the pipeline stages.
Commit
d54b3263
authored
7 years ago
by
Daniel Gerhardt
Browse files
Options
Downloads
Patches
Plain Diff
Remove broken statistics test for now
parent
21864cc2
Branches
Branches containing commit
1 merge request
!68
Migration to Ektorp and refactoring of the database layer
Pipeline
#9317
passed with stages
in 3 minutes and 2 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/de/thm/arsnova/controller/StatisticsControllerTest.java
+0
-97
0 additions, 97 deletions
...a/de/thm/arsnova/controller/StatisticsControllerTest.java
with
0 additions
and
97 deletions
src/test/java/de/thm/arsnova/controller/StatisticsControllerTest.java
deleted
100644 → 0
+
0
−
97
View file @
21864cc2
/*
* This file is part of ARSnova Backend.
* Copyright (C) 2012-2017 The ARSnova Team
*
* ARSnova Backend is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ARSnova Backend is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
de.thm.arsnova.controller
;
import
org.hamcrest.Matchers
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
import
org.springframework.test.web.servlet.MockMvc
;
import
org.springframework.test.web.servlet.setup.MockMvcBuilders
;
import
org.springframework.web.context.WebApplicationContext
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
get
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.*;
public
class
StatisticsControllerTest
extends
AbstractControllerTest
{
@Autowired
private
StatisticsController
statisticsController
;
private
MockMvc
mockMvc
;
@Autowired
private
WebApplicationContext
webApplicationContext
;
@Before
public
void
setup
()
{
mockMvc
=
MockMvcBuilders
.
webAppContextSetup
(
webApplicationContext
).
build
();
}
@Test
public
void
testShouldGetCurrentOnlineUsers
()
throws
Exception
{
mockMvc
.
perform
(
get
(
"/statistics/activeusercount"
).
accept
(
MediaType
.
TEXT_PLAIN
))
.
andExpect
(
status
().
isOk
())
.
andExpect
(
content
().
contentTypeCompatibleWith
(
"text/plain"
));
}
@Test
public
void
testShouldSendXDeprecatedApiForGetCurrentOnlineUsers
()
throws
Exception
{
mockMvc
.
perform
(
get
(
"/statistics/activeusercount"
).
accept
(
MediaType
.
TEXT_PLAIN
))
.
andExpect
(
status
().
isOk
())
.
andExpect
(
content
().
contentTypeCompatibleWith
(
"text/plain"
))
.
andExpect
(
header
().
string
(
AbstractController
.
X_DEPRECATED_API
,
"1"
));
}
@Test
public
void
testShouldGetSessionCount
()
throws
Exception
{
mockMvc
.
perform
(
get
(
"/statistics/sessioncount"
).
accept
(
MediaType
.
TEXT_PLAIN
))
.
andExpect
(
status
().
isOk
())
.
andExpect
(
content
().
contentTypeCompatibleWith
(
"text/plain"
))
.
andExpect
(
content
().
string
(
Matchers
.
greaterThanOrEqualTo
(
"0"
)));
}
@Test
public
void
testShouldSendXDeprecatedApiForGetSessionCount
()
throws
Exception
{
mockMvc
.
perform
(
get
(
"/statistics/sessioncount"
).
accept
(
MediaType
.
TEXT_PLAIN
))
.
andExpect
(
status
().
isOk
())
.
andExpect
(
content
().
contentTypeCompatibleWith
(
"text/plain"
))
.
andExpect
(
header
().
string
(
AbstractController
.
X_DEPRECATED_API
,
"1"
));
}
@Test
public
void
testShouldGetStatistics
()
throws
Exception
{
mockMvc
.
perform
(
get
(
"/statistics"
).
accept
(
MediaType
.
APPLICATION_JSON
))
.
andExpect
(
status
().
isOk
())
.
andExpect
(
content
().
contentTypeCompatibleWith
(
MediaType
.
APPLICATION_JSON
))
.
andExpect
(
jsonPath
(
"$.answers"
).
exists
())
.
andExpect
(
jsonPath
(
"$.questions"
).
exists
())
.
andExpect
(
jsonPath
(
"$.openSessions"
).
exists
())
.
andExpect
(
jsonPath
(
"$.closedSessions"
).
exists
())
.
andExpect
(
jsonPath
(
"$.activeUsers"
).
exists
())
.
andExpect
(
jsonPath
(
"$.interposedQuestions"
).
exists
());
}
@Test
public
void
testShouldGetCacheControlHeaderForStatistics
()
throws
Exception
{
mockMvc
.
perform
(
get
(
"/statistics"
).
accept
(
MediaType
.
APPLICATION_JSON
))
.
andExpect
(
status
().
isOk
())
.
andExpect
(
header
().
string
(
"cache-control"
,
"public, max-age=60"
));
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
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