Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
0eb60cbd
Commit
0eb60cbd
authored
Mar 05, 2020
by
Piotr Gawron
Browse files
documentation for get data overlays API call
parent
0b5f46cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
web/src/test/java/lcsb/mapviewer/web/OverlayControllerIntegrationTest.java
View file @
0eb60cbd
...
...
@@ -2,7 +2,12 @@ package lcsb.mapviewer.web;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.*;
import
static
org
.
springframework
.
restdocs
.
mockmvc
.
MockMvcRestDocumentation
.
document
;
import
static
org
.
springframework
.
restdocs
.
mockmvc
.
RestDocumentationRequestBuilders
.*;
import
static
org
.
springframework
.
restdocs
.
payload
.
PayloadDocumentation
.
fieldWithPath
;
import
static
org
.
springframework
.
restdocs
.
payload
.
PayloadDocumentation
.
responseFields
;
import
static
org
.
springframework
.
restdocs
.
request
.
RequestDocumentation
.
parameterWithName
;
import
static
org
.
springframework
.
restdocs
.
request
.
RequestDocumentation
.
requestParameters
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.
status
;
import
java.util.Arrays
;
...
...
@@ -17,6 +22,8 @@ import org.junit.runner.RunWith;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
import
org.springframework.mock.web.MockHttpSession
;
import
org.springframework.restdocs.payload.ResponseFieldsSnippet
;
import
org.springframework.restdocs.request.RequestParametersSnippet
;
import
org.springframework.test.annotation.Rollback
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.web.servlet.RequestBuilder
;
...
...
@@ -87,10 +94,14 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
MockHttpSession
session
=
createSession
(
BUILT_IN_TEST_ADMIN_LOGIN
,
BUILT_IN_TEST_ADMIN_PASSWORD
);
RequestBuilder
request
=
get
(
"/projects/
"
+
TEST_PROJECT
+
"
/overlays/?creator="
+
TEST_CURATOR_LOGIN
)
RequestBuilder
request
=
get
(
"/projects/
{projectId}
/overlays/?creator="
+
TEST_CURATOR_LOGIN
,
TEST_PROJECT
)
.
session
(
session
);
String
response
=
mockMvc
.
perform
(
request
)
.
andDo
(
document
(
"projects/project_overlays/get_all_by_creator"
,
getProjectPathParameters
(),
getOverlayFilter
(),
listOfOverlayFields
()))
.
andExpect
(
status
().
is2xxSuccessful
())
.
andReturn
().
getResponse
().
getContentAsString
();
...
...
@@ -185,10 +196,14 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
MockHttpSession
session
=
createSession
(
TEST_CURATOR_LOGIN
,
TEST_CURATOR_PASSWORD
);
RequestBuilder
request
=
get
(
"/projects/
"
+
TEST_PROJECT
+
"/overlays/"
)
RequestBuilder
request
=
get
(
"/projects/
{projectId}/overlays/"
,
TEST_PROJECT
)
.
session
(
session
);
String
response
=
mockMvc
.
perform
(
request
)
.
andDo
(
document
(
"projects/project_overlays/get_all"
,
getProjectPathParameters
(),
getOverlayFilter
(),
listOfOverlayFields
()))
.
andExpect
(
status
().
is2xxSuccessful
())
.
andReturn
().
getResponse
().
getContentAsString
();
...
...
@@ -1215,7 +1230,7 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
new
BasicNameValuePair
(
"googleLicenseConsent"
,
"overlay name"
),
new
BasicNameValuePair
(
"type"
,
"GENERIC"
))));
RequestBuilder
request
=
post
(
"/projects/"
+
TEST_PROJECT
+
"/overlays/"
)
RequestBuilder
request
=
post
(
"/projects/"
+
TEST_PROJECT
+
"/overlays/"
)
.
contentType
(
MediaType
.
APPLICATION_FORM_URLENCODED
)
.
content
(
body
)
.
session
(
session
);
...
...
@@ -1224,5 +1239,54 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
.
andExpect
(
status
().
isForbidden
());
}
protected
RequestParametersSnippet
getOverlayFilter
()
{
return
requestParameters
(
parameterWithName
(
"creator"
)
.
description
(
"login of the user who created the overlay"
)
.
optional
(),
parameterWithName
(
"publicOverlay"
)
.
description
(
"true/false - are we interested in public overlays or private custom data sets (default: false)"
)
.
optional
());
}
private
ResponseFieldsSnippet
listOfOverlayFields
()
{
return
responseFields
(
fieldWithPath
(
"[].name"
)
.
description
(
"name"
)
.
type
(
"string"
),
fieldWithPath
(
"[].description"
)
.
description
(
"description"
)
.
type
(
"string"
),
fieldWithPath
(
"[].defaultOverlay"
)
.
description
(
"should the overlay be used as default (at most one per project should be marked with true)"
)
.
type
(
"boolean"
),
fieldWithPath
(
"[].idObject"
)
.
description
(
"identifier"
)
.
type
(
"number"
),
fieldWithPath
(
"[].inputDataAvailable"
)
.
description
(
"is the source data for the overlay available"
)
.
type
(
"string"
),
fieldWithPath
(
"[].publicOverlay"
)
.
description
(
"is the data overlay publicaly available to all users"
)
.
type
(
"boolean"
),
fieldWithPath
(
"[].googleLicenseConsent"
)
.
description
(
"did creator accepted license required by Google Maps API"
)
.
type
(
"boolean"
),
fieldWithPath
(
"[].images"
)
.
description
(
"in case the data overlay is a background data overlay this object contains map between submaps and folders where background images are stored"
)
.
type
(
"string"
),
fieldWithPath
(
"[].deprecatedColumns"
)
.
description
(
"list of columns in the input datasource that are deprecated and should be avoided"
)
.
type
(
"Array<String>"
),
fieldWithPath
(
"[].order"
)
.
description
(
"sort order"
)
.
type
(
"number"
),
fieldWithPath
(
"[].creator"
)
.
description
(
"login of the user who uploaded data overlay"
)
.
type
(
"string"
)
.
optional
());
}
}
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