Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
0f014818
Commit
0f014818
authored
Jan 29, 2019
by
Piotr Gawron
Browse files
Merge branch 'drug-issue' into 'devel_12.1.x'
Drug issue See merge request
!602
parents
148531c7
c4d7bc22
Pipeline
#8521
passed with stages
in 14 minutes and 42 seconds
Changes
4
Pipelines
2
Show whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
0f014818
...
...
@@ -4,8 +4,11 @@ minerva (12.1.6) stable; urgency=medium
properly
*
Bug
fix
:
upload
of
data
overlays
without
privileges
triggers
proper
error
message
also
in
situation
when
user
cannot
create
projects
*
Bug
fix
:
first
login
on
website
when
there
is
Term
of
use
to
accept
raised
error
for
regular
users
*
Bug
fix
:
fetching
some
drugs
via
API
could
cause
500
--
Piotr
Gawron
<
piotr
.
gawron
@
uni
.
lu
>
Tue
,
2
2
Jan
2019
1
4
:
00
:
00
+
0200
--
Piotr
Gawron
<
piotr
.
gawron
@
uni
.
lu
>
Mon
,
2
8
Jan
2019
1
6
:
00
:
00
+
0200
minerva
(
12.1.5
)
stable
;
urgency
=
medium
*
Bug
fix
:
Drugbank
changed
output
format
which
crashed
drug
connector
...
...
annotation/src/main/java/lcsb/mapviewer/annotation/services/PubmedParser.java
View file @
0f014818
...
...
@@ -205,6 +205,13 @@ public class PubmedParser extends CachableInterface implements IExternalService
return
result
;
}
public
Article
getPubmedArticleById
(
String
id
)
throws
PubmedSearchException
{
if
(
id
==
null
)
{
return
null
;
}
return
getPubmedArticleById
(
Integer
.
valueOf
(
id
.
trim
()));
}
/**
* This method return html \< a\ > tag with link for pubmed id (with some
* additional information).
...
...
rest-api/src/main/java/lcsb/mapviewer/api/BaseRestImpl.java
View file @
0f014818
...
...
@@ -58,7 +58,7 @@ public abstract class BaseRestImpl {
/**
* Default class logger.
*/
private
Logger
logger
=
Logger
.
getLogger
(
BaseRestImpl
.
class
);
private
static
Logger
logger
=
Logger
.
getLogger
(
BaseRestImpl
.
class
);
@Autowired
private
IModelService
modelService
;
...
...
@@ -118,7 +118,7 @@ public abstract class BaseRestImpl {
}
if
(
MiriamType
.
PUBMED
.
equals
(
annotation
.
getDataType
()))
{
try
{
Article
article
=
pubmedParser
.
getPubmedArticleById
(
Integer
.
valueOf
(
annotation
.
getResource
())
)
;
Article
article
=
pubmedParser
.
getPubmedArticleById
(
annotation
.
getResource
());
result
.
put
(
"article"
,
article
);
}
catch
(
PubmedSearchException
e
)
{
logger
.
error
(
"Problem with accessing info about pubmed"
,
e
);
...
...
@@ -387,4 +387,20 @@ public abstract class BaseRestImpl {
this
.
configurationService
=
configurationService
;
}
public
MiriamConnector
getMiriamConnector
()
{
return
miriamConnector
;
}
public
void
setMiriamConnector
(
MiriamConnector
miriamConnector
)
{
this
.
miriamConnector
=
miriamConnector
;
}
public
PubmedParser
getPubmedParser
()
{
return
pubmedParser
;
}
public
void
setPubmedParser
(
PubmedParser
pubmedParser
)
{
this
.
pubmedParser
=
pubmedParser
;
}
}
rest-api/src/test/java/lcsb/mapviewer/api/BaseRestImplTest.java
View file @
0f014818
...
...
@@ -6,13 +6,27 @@ import static org.junit.Assert.assertNotNull;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
mockito
.
Mockito
.
CALLS_REAL_METHODS
;
import
java.util.Map
;
import
org.apache.log4j.Logger
;
import
org.junit.Test
;
import
org.mockito.Mockito
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
lcsb.mapviewer.annotation.services.MiriamConnector
;
import
lcsb.mapviewer.annotation.services.PubmedParser
;
import
lcsb.mapviewer.model.map.MiriamData
;
import
lcsb.mapviewer.model.map.MiriamType
;
public
class
BaseRestImplTest
extends
RestTestFunctions
{
Logger
logger
=
Logger
.
getLogger
(
BaseRestImplTest
.
class
);
@Autowired
MiriamConnector
mc
;
@Autowired
PubmedParser
pubmedParser
;
@Test
public
void
testMathMLToPresentationML
()
throws
Exception
{
BaseRestImpl
controller
=
Mockito
.
mock
(
BaseRestImpl
.
class
,
CALLS_REAL_METHODS
);
...
...
@@ -39,6 +53,15 @@ public class BaseRestImplTest extends RestTestFunctions {
assertFalse
(
presentationXml
.
startsWith
(
"<?xml"
));
}
@Test
public
void
testCreateAnnotationWithWhitespace
()
throws
Exception
{
BaseRestImpl
controller
=
Mockito
.
mock
(
BaseRestImpl
.
class
,
CALLS_REAL_METHODS
);
controller
.
setMiriamConnector
(
mc
);
controller
.
setPubmedParser
(
pubmedParser
);
Map
<
String
,
Object
>
response
=
controller
.
createAnnotation
(
new
MiriamData
(
MiriamType
.
PUBMED
,
"28255955 "
));
assertNotNull
(
response
);
}
}
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