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
449a72ce
Commit
449a72ce
authored
Feb 13, 2020
by
Piotr Gawron
Browse files
documentation for get map by id API call
parent
6509933d
Changes
3
Hide whitespace changes
Inline
Side-by-side
rest-api/src/main/java/lcsb/mapviewer/api/projects/models/ModelRestImpl.java
View file @
449a72ce
...
...
@@ -79,7 +79,6 @@ public class ModelRestImpl extends BaseRestImpl {
return
null
;
}
else
{
Map
<
String
,
Object
>
result
=
new
LinkedHashMap
<>();
result
.
put
(
"version"
,
null
);
result
.
put
(
"name"
,
submodel
.
getName
());
result
.
put
(
"idObject"
,
submodel
.
getId
());
result
.
put
(
"tileSize"
,
submodel
.
getTileSize
());
...
...
web/src/main/asciidoc/projects/project_maps.adoc
View file @
449a72ce
...
...
@@ -18,3 +18,18 @@ include::{snippets}/projects/project_maps/list/curl-request.adoc[]
=== Sample Response
include::{snippets}/projects/project_maps/list/response-body.adoc[]
== Get by id
Returns map identified by id.
=== Path Parameters
include::{snippets}/projects/project_maps/get_by_id/path-parameters.adoc[]
=== Response Fields
include::{snippets}/projects/project_maps/get_by_id/response-fields.adoc[]
=== CURL sample
include::{snippets}/projects/project_maps/get_by_id/curl-request.adoc[]
=== Sample Response
include::{snippets}/projects/project_maps/get_by_id/response-body.adoc[]
web/src/test/java/lcsb/mapviewer/web/MapControllerIntegrationTest.java
View file @
449a72ce
...
...
@@ -3,9 +3,11 @@ package lcsb.mapviewer.web;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
springframework
.
restdocs
.
mockmvc
.
MockMvcRestDocumentation
.
document
;
import
static
org
.
springframework
.
restdocs
.
mockmvc
.
RestDocumentationRequestBuilders
.*;
import
static
org
.
springframework
.
restdocs
.
mockmvc
.
RestDocumentationRequestBuilders
.
get
;
import
static
org
.
springframework
.
restdocs
.
mockmvc
.
RestDocumentationRequestBuilders
.
patch
;
import
static
org
.
springframework
.
restdocs
.
payload
.
PayloadDocumentation
.*;
import
static
org
.
springframework
.
restdocs
.
request
.
RequestDocumentation
.*;
import
static
org
.
springframework
.
restdocs
.
request
.
RequestDocumentation
.
parameterWithName
;
import
static
org
.
springframework
.
restdocs
.
request
.
RequestDocumentation
.
pathParameters
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.
status
;
import
org.apache.logging.log4j.LogManager
;
...
...
@@ -192,11 +194,30 @@ public class MapControllerIntegrationTest extends ControllerIntegrationTest {
public
void
testGetMapById
()
throws
Exception
{
userService
.
grantUserPrivilege
(
anonymous
,
PrivilegeType
.
READ_PROJECT
,
project
.
getProjectId
());
RequestBuilder
request
=
get
(
"/projects/"
+
TEST_PROJECT
+
"/models/"
+
map
.
getId
())
.
contentType
(
MediaType
.
APPLICATION_FORM_URLENCODED
);
RequestBuilder
request
=
get
(
"/projects/{projectId}/models/{mapId}"
,
TEST_PROJECT
,
map
.
getId
());
String
response
=
mockMvc
.
perform
(
request
)
.
andExpect
(
status
().
is2xxSuccessful
())
.
andDo
(
document
(
"projects/project_maps/get_by_id"
,
pathParameters
(
parameterWithName
(
"projectId"
).
description
(
"project identifier"
),
parameterWithName
(
"mapId"
).
description
(
"map identifier"
)),
responseFields
(
fieldWithPath
(
"name"
).
description
(
"name of the map"
).
type
(
"string"
),
fieldWithPath
(
"description"
).
description
(
"description"
).
type
(
"string"
),
fieldWithPath
(
"idObject"
).
description
(
"map id"
).
type
(
"number"
),
fieldWithPath
(
"width"
).
description
(
"map width"
).
type
(
"number"
),
fieldWithPath
(
"height"
).
description
(
"map height"
).
type
(
"number"
),
fieldWithPath
(
"tileSize"
).
description
(
"size of the png tile used to visualize in frontend"
).
type
(
"number"
),
fieldWithPath
(
"defaultCenterX"
).
description
(
"default x center used in frontend visualization"
).
type
(
"number"
),
fieldWithPath
(
"defaultCenterY"
).
description
(
"default y center used in frontend visualization"
).
type
(
"number"
),
fieldWithPath
(
"defaultZoomLevel"
).
description
(
"default zoom level used in frontend visualization"
).
type
(
"number"
),
fieldWithPath
(
"minZoom"
).
description
(
"minimum zoom level availbale for the map"
).
type
(
"number"
),
fieldWithPath
(
"maxZoom"
).
description
(
"maximum zoom level available for the map"
).
type
(
"number"
),
fieldWithPath
(
"submodelType"
).
description
(
"type of the submap"
).
type
(
"string"
),
fieldWithPath
(
"authors"
).
description
(
"list of authors"
).
type
(
"Array<Author>"
),
fieldWithPath
(
"references"
).
description
(
"list of references"
).
type
(
"Array<Reference>"
),
fieldWithPath
(
"creationDate"
).
description
(
"creation date"
).
type
(
"timestamp"
),
fieldWithPath
(
"modificationDates"
).
description
(
"modification dates"
).
type
(
"Array<timestamp>"
)
)))
.
andReturn
().
getResponse
().
getContentAsString
();
int
mapId
=
new
JsonParser
()
...
...
@@ -242,8 +263,7 @@ public class MapControllerIntegrationTest extends ControllerIntegrationTest {
.
andExpect
(
status
().
is2xxSuccessful
())
.
andDo
(
document
(
"projects/project_maps/list"
,
pathParameters
(
parameterWithName
(
"projectId"
).
description
(
"project identifier"
)),
responseFields
(
subsectionWithPath
(
"[]"
).
description
(
"list of maps"
).
type
(
"Array<Map>"
))))
.
andReturn
().
getResponse
().
getContentAsString
();
responseFields
(
subsectionWithPath
(
"[]"
).
description
(
"list of maps"
).
type
(
"Array<Map>"
))));
}
@Test
...
...
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