Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
ed786945
Commit
ed786945
authored
Aug 24, 2020
by
Piotr Gawron
Browse files
documentation for taxonomy API call
parent
ef729f1b
Changes
3
Hide whitespace changes
Inline
Side-by-side
web/src/main/asciidoc/taxonomy.adoc
0 → 100644
View file @
ed786945
= Rest API Documentation - Taxonomy
Piotr Gawron
v{project-version} {build-time}
:toc: left
:sectnums:
== Get information about taxonomy
=== CURL sample
include::{snippets}/taxonomy/get_taxonomy/curl-request.adoc[]
=== Path Parameters
include::{snippets}/taxonomy/get_taxonomy/path-parameters.adoc[]
=== Response Fields
include::{snippets}/taxonomy/get_taxonomy/response-fields.adoc[]
=== Sample Response
include::{snippets}/taxonomy/get_taxonomy/response-body.adoc[]
web/src/test/java/lcsb/mapviewer/web/ControllerIntegrationTest.java
View file @
ed786945
...
...
@@ -140,7 +140,7 @@ abstract public class ControllerIntegrationTest {
.
operationPreprocessors
()
.
withResponseDefaults
(
Preprocessors
.
prettyPrint
())
.
and
()
.
uris
().
withHost
(
"minerva-
dev
.lcsb.uni.lu
"
).
withPort
(
80
)
.
uris
().
withHost
(
"minerva-
service
.lcsb.uni.lu
/minerva/api"
).
withPort
(
443
).
withScheme
(
"https"
)
.
and
().
snippets
().
withDefaults
(
CliDocumentation
.
curlRequest
(
new
CommandFormatterWithReplacingPostFilenameHeader
(
" \\%n "
)),
CliDocumentation
.
httpieRequest
(),
...
...
web/src/test/java/lcsb/mapviewer/web/TaxonomiesControllerIntegrationTest.java
View file @
ed786945
package
lcsb.mapviewer.web
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
get
;
import
static
org
.
springframework
.
restdocs
.
mockmvc
.
MockMvcRestDocumentation
.
document
;
import
static
org
.
springframework
.
restdocs
.
mockmvc
.
RestDocumentationRequestBuilders
.
get
;
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
.
pathParameters
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.
status
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.junit.*
;
import
org.junit.runner.RunWith
;
import
org.springframework.http.MediaType
;
import
org.springframework.test.annotation.Rollback
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.web.servlet.RequestBuilder
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.google.gson.JsonParser
;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@Transactional
@Rollback
...
...
@@ -32,19 +33,21 @@ public class TaxonomiesControllerIntegrationTest extends ControllerIntegrationTe
}
@Test
public
void
testGetTaxonomies
()
throws
Exception
{
RequestBuilder
request
=
get
(
"/genomics/taxonomies/"
).
contentType
(
MediaType
.
APPLICATION_FORM_URLENCODED
);
String
response
=
mockMvc
.
perform
(
request
)
.
andExpect
(
status
().
is2xxSuccessful
())
.
andReturn
().
getResponse
().
getContentAsString
();
int
taxonomies
=
new
JsonParser
()
.
parse
(
response
)
.
getAsJsonArray
().
size
();
assertTrue
(
"list of taxonomies shouldn't be empty"
,
taxonomies
>
0
);
public
void
testGetTaxonomy
()
throws
Exception
{
RequestBuilder
request
=
get
(
"/taxonomy/{taxonomyId}/"
,
"9606"
);
mockMvc
.
perform
(
request
)
.
andDo
(
document
(
"taxonomy/get_taxonomy"
,
pathParameters
(
parameterWithName
(
"taxonomyId"
).
description
(
"mesh id"
)),
responseFields
(
fieldWithPath
(
"name"
)
.
description
(
"name"
)
.
type
(
"String"
),
fieldWithPath
(
"id"
)
.
description
(
"mesh id"
)
.
type
(
"String"
))))
.
andExpect
(
status
().
is2xxSuccessful
());
}
}
Write
Preview
Supports
Markdown
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!
Cancel
Please
register
or
sign in
to comment