Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Devrim Gunyel
core
Commits
7beed54e
Commit
7beed54e
authored
Jun 07, 2019
by
Piotr Gawron
Browse files
when changing data overlay name is obligatory
parent
8d1e6acf
Changes
3
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
7beed54e
...
...
@@ -9,6 +9,7 @@ minerva (14.0.0~alpha.0) unstable; urgency=low
uploading
project
(#
202
)
*
Small
improvement
:
when
removing
overlay
in
admin
panel
there
is
a
confirmation
dialog
(#
696
)
*
Small
improvement
:
overlay
name
is
obligatory
(#
698
)
*
Bug
fix
:
export
to
CellDesigner
of
reaction
with
two
modifiers
connected
with
boolean
operator
resulted
was
skipping
some
layout
information
*
Bug
fix
:
reaction
in
SBGNML
file
containing
two
products
was
improperly
...
...
rest-api/src/main/java/lcsb/mapviewer/api/projects/overlays/OverlayRestImpl.java
View file @
7beed54e
...
...
@@ -227,6 +227,9 @@ public class OverlayRestImpl extends BaseRestImpl {
if
(
key
.
equalsIgnoreCase
(
"description"
))
{
layout
.
setDescription
((
String
)
value
);
}
else
if
(
key
.
equalsIgnoreCase
(
"name"
))
{
if
(
value
==
null
||
((
String
)
value
).
trim
().
isEmpty
())
{
throw
new
QueryException
(
"name cannot be empty"
);
}
layout
.
setTitle
((
String
)
value
);
}
else
if
(
key
.
equalsIgnoreCase
(
"order"
))
{
layout
.
setOrderIndex
(
parseInteger
(
value
));
...
...
@@ -334,7 +337,7 @@ public class OverlayRestImpl extends BaseRestImpl {
throw
new
QueryException
(
"Either content or fileId must be provided"
);
}
if
(
name
==
null
||
name
.
trim
().
isEmpty
())
{
if
(
name
==
null
||
name
.
trim
().
isEmpty
())
{
throw
new
QueryException
(
"Name cannot be empty"
);
}
try
{
...
...
rest-api/src/test/java/lcsb/mapviewer/api/projects/overlays/OverlayRestImplTest.java
View file @
7beed54e
...
...
@@ -2,6 +2,7 @@ package lcsb.mapviewer.api.projects.overlays;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.junit.Test
;
...
...
@@ -69,6 +70,51 @@ public class OverlayRestImplTest extends RestTestFunctions {
}
}
@Test
public
void
testUpdateDataOverlay
()
throws
Exception
{
try
{
User
admin
=
userService
.
getUserByLogin
(
"admin"
);
Project
project
=
createProject
(
"testFiles/model/sample.xml"
,
projectId
);
userService
.
setUserPrivilege
(
admin
,
new
Privilege
(
100
,
PrivilegeType
.
CUSTOM_LAYOUTS
,
admin
));
userService
.
setUserPrivilege
(
admin
,
new
ObjectPrivilege
(
project
,
1
,
PrivilegeType
.
VIEW_PROJECT
,
admin
));
Map
<
String
,
Object
>
result
=
overlayRest
.
addOverlay
(
adminToken
,
projectId
,
"x"
,
"desc"
,
"s1"
,
null
,
null
,
ColorSchemaType
.
GENERIC
.
name
(),
"true"
);
String
id
=
result
.
get
(
"idObject"
).
toString
();
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
data
.
put
(
"name"
,
"xyz"
);
result
=
overlayRest
.
updateOverlay
(
adminToken
,
projectId
,
id
,
data
);
assertNotNull
(
result
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
finally
{
projectService
.
removeProject
(
projectDao
.
getProjectByProjectId
(
projectId
),
null
,
false
,
adminToken
);
}
}
@Test
(
expected
=
QueryException
.
class
)
public
void
testUpdateDataOverlayWithInvalidName
()
throws
Exception
{
try
{
User
admin
=
userService
.
getUserByLogin
(
"admin"
);
Project
project
=
createProject
(
"testFiles/model/sample.xml"
,
projectId
);
userService
.
setUserPrivilege
(
admin
,
new
Privilege
(
100
,
PrivilegeType
.
CUSTOM_LAYOUTS
,
admin
));
userService
.
setUserPrivilege
(
admin
,
new
ObjectPrivilege
(
project
,
1
,
PrivilegeType
.
VIEW_PROJECT
,
admin
));
Map
<
String
,
Object
>
result
=
overlayRest
.
addOverlay
(
adminToken
,
projectId
,
"x"
,
"desc"
,
"s1"
,
null
,
null
,
ColorSchemaType
.
GENERIC
.
name
(),
"true"
);
String
id
=
result
.
get
(
"idObject"
).
toString
();
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
data
.
put
(
"name"
,
""
);
result
=
overlayRest
.
updateOverlay
(
adminToken
,
projectId
,
id
,
data
);
assertNotNull
(
result
);
}
finally
{
projectService
.
removeProject
(
projectDao
.
getProjectByProjectId
(
projectId
),
null
,
false
,
adminToken
);
}
}
private
Project
createProject
(
String
string
,
String
projectId
)
throws
Exception
{
Project
project
=
new
Project
(
projectId
);
Model
model
=
super
.
getModelForFile
(
string
,
false
);
...
...
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