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
f238fef8
Commit
f238fef8
authored
Feb 24, 2020
by
Piotr Gawron
Browse files
export map with glyphs crashed
parent
8d21b8da
Pipeline
#21414
failed with stage
in 19 minutes and 29 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
f238fef8
...
...
@@ -11,6 +11,7 @@ minerva (14.0.9) stable; urgency=medium
*
Bug
fix
:
when
data
overlay
name
in
zip
uploaded
zip
file
is
not
present
the
name
of
a
file
is
used
as
overlay
name
(#
1065
)
*
Bug
fix
:
uploading
empty
data
overlay
resulted
in
an
error
(#
1123
)
*
Bug
fix
:
exporting
map
with
glyphs
crashed
(#
1130
)
--
Piotr
Gawron
<
piotr
.
gawron
@
uni
.
lu
>
Mon
,
3
Feb
2020
15
:
00
:
00
+
0200
...
...
model/src/main/java/lcsb/mapviewer/model/map/layout/graphics/Glyph.java
View file @
f238fef8
...
...
@@ -69,6 +69,8 @@ public class Glyph implements Serializable {
public
Glyph
(
Glyph
original
)
{
// we should reference to the same file
setFile
(
original
.
getFile
());
//make sure that the content is available
original
.
getFile
().
getFileContent
();
}
public
UploadedFileEntry
getFile
()
{
...
...
web/src/test/java/lcsb/mapviewer/web/AllIntegrationTests.java
View file @
f238fef8
...
...
@@ -16,6 +16,7 @@ import org.junit.runners.Suite.SuiteClasses;
FileControllerIntegrationTestWithoutTransaction
.
class
,
FunctionControllerIntegrationTest
.
class
,
MapControllerIntegrationTest
.
class
,
MapControllerIntegrationTestWithoutTransaction
.
class
,
MiRnaControllerIntegrationTest
.
class
,
OverlayControllerIntegrationTest
.
class
,
OverlayControllerIntegrationTestWithoutTransaction
.
class
,
...
...
web/src/test/java/lcsb/mapviewer/web/ControllerIntegrationTest.java
View file @
f238fef8
...
...
@@ -4,6 +4,9 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.
status
;
import
java.awt.geom.Point2D
;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.nio.file.Paths
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.concurrent.*
;
...
...
@@ -34,6 +37,7 @@ import lcsb.mapviewer.model.graphics.PolylineData;
import
lcsb.mapviewer.model.map.Comment
;
import
lcsb.mapviewer.model.map.layout.ColorSchemaType
;
import
lcsb.mapviewer.model.map.layout.Layout
;
import
lcsb.mapviewer.model.map.layout.graphics.Glyph
;
import
lcsb.mapviewer.model.map.model.ModelData
;
import
lcsb.mapviewer.model.map.reaction.*
;
import
lcsb.mapviewer.model.map.reaction.type.TransportReaction
;
...
...
@@ -189,6 +193,33 @@ abstract public class ControllerIntegrationTest {
return
user
;
}
protected
Project
createProjectWithGlyph
(
String
projectId
)
throws
IOException
{
User
admin
=
userService
.
getUserByLogin
(
BUILT_IN_TEST_ADMIN_LOGIN
);
Project
project
=
new
Project
(
projectId
);
project
.
setOwner
(
admin
);
UploadedFileEntry
file
=
createFile
(
Files
.
readAllBytes
(
Paths
.
get
(
"./src/test/resources/empty.png"
)),
admin
);
ModelData
map
=
new
ModelData
();
map
.
setTileSize
(
256
);
map
.
setWidth
(
100
);
map
.
setHeight
(
100
);
Element
element
=
new
GenericProtein
(
"p1"
);
element
.
setWidth
(
100.0
);
element
.
setHeight
(
20.0
);
element
.
setX
(
10
);
element
.
setX
(
20
);
element
.
setZ
(
2
);
Glyph
g
=
new
Glyph
();
g
.
setFile
(
file
);
element
.
setGlyph
(
g
);
map
.
addElement
(
element
);
project
.
addModel
(
map
);
project
.
addGlyph
(
g
);
projectDao
.
add
(
project
);
return
project
;
}
protected
Project
createProject
(
String
projectId
)
{
Project
project
=
new
Project
(
projectId
);
project
.
setOwner
(
userService
.
getUserByLogin
(
BUILT_IN_TEST_ADMIN_LOGIN
));
...
...
web/src/test/java/lcsb/mapviewer/web/MapControllerIntegrationTestWithoutTransaction.java
0 → 100644
View file @
f238fef8
package
lcsb.mapviewer.web
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
get
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.
status
;
import
java.io.IOException
;
import
java.util.function.Supplier
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.junit.*
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.mock.web.MockHttpSession
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.web.servlet.RequestBuilder
;
import
lcsb.mapviewer.converter.graphics.PngImageGenerator
;
import
lcsb.mapviewer.model.Project
;
import
lcsb.mapviewer.model.map.model.ModelData
;
import
lcsb.mapviewer.services.interfaces.IModelService
;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
public
class
MapControllerIntegrationTestWithoutTransaction
extends
ControllerIntegrationTest
{
private
static
final
String
TEST_PROJECT
=
"test_project"
;
Logger
logger
=
LogManager
.
getLogger
();
private
Project
project
;
private
ModelData
map
;
@Autowired
private
IModelService
modelService
;
@Before
public
void
setup
()
throws
Exception
{
callInSeparateThread
(
new
Supplier
<
Void
>()
{
@Override
public
Void
get
()
{
try
{
project
=
createProjectWithGlyph
(
TEST_PROJECT
);
map
=
project
.
getModels
().
iterator
().
next
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
});
assertNotNull
(
project
);
modelService
.
removeModelFromCache
(
map
);
}
@After
public
void
tearDown
()
throws
Exception
{
removeProjectInSeparateThread
(
project
);
}
@Test
public
void
testDownloadImageWithGlyphs
()
throws
Exception
{
MockHttpSession
session
=
createSession
(
BUILT_IN_TEST_ADMIN_LOGIN
,
BUILT_IN_TEST_ADMIN_PASSWORD
);
//fetch the map (but don't do anything with glyphs)
RequestBuilder
request2
=
get
(
"/projects/"
+
TEST_PROJECT
+
"/models/"
)
.
session
(
session
);
mockMvc
.
perform
(
request2
)
.
andExpect
(
status
().
is2xxSuccessful
());
RequestBuilder
request
=
get
(
"/projects/"
+
TEST_PROJECT
+
"/models/"
+
map
.
getId
()
+
":downloadImage?"
+
"handlerClass="
+
PngImageGenerator
.
class
.
getCanonicalName
())
.
session
(
session
);
mockMvc
.
perform
(
request
)
.
andExpect
(
status
().
is2xxSuccessful
());
}
}
web/src/test/resources/empty.png
0 → 100644
View file @
f238fef8
97 Bytes
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