Commit de688dc6 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

download submap as model/image did not work

parent 7b79fe7b
Pipeline #48890 failed with stage
in 13 minutes and 16 seconds
......@@ -185,7 +185,7 @@ public class ModelRestImpl extends BaseRestImpl {
ConverterException, InconsistentModelException {
Model originalModel = getModelService().getAndFetchModelByMapId(projectId, parseInteger(modelId, "modelId"));
originalModel.setProject(null);
Path2D polygon = stringToPolygon(polygonString, originalModel);
Set<Integer> elementIdsList = stringListToIntegerSet(elementIds);
......@@ -283,6 +283,8 @@ public class ModelRestImpl extends BaseRestImpl {
}
Model originalModel = getModelService().getAndFetchModelByMapId(projectId, mapId);
boolean sbgn = originalModel.getProject().isSbgnFormat();
originalModel.setProject(null);
Model colorModel = new CopyCommand(originalModel).execute();
......@@ -344,7 +346,7 @@ public class ModelRestImpl extends BaseRestImpl {
Params params = new Params().x(minX).y(minY).height((maxY - minY) /
scale).width((maxX - minX) / scale)
.level(level - Configuration.MIN_ZOOM_LEVEL).nested(false). // automatically set nested view as invalid
scale(scale).colorExtractor(colorExtractor).sbgn(originalModel.getProject().isSbgnFormat()).model(part);
scale(scale).colorExtractor(colorExtractor).sbgn(sbgn).model(part);
if (background != null) {
params.nested(background.isHierarchicalView());
}
......
......@@ -675,6 +675,38 @@ public class MapControllerIntegrationTest extends ControllerIntegrationTest {
.andExpect(status().is2xxSuccessful());
}
@Test
public void testDownloadSubmapImage() throws Exception {
ModelData submap = getSubmap();
RequestBuilder request = get("/projects/{projectId}/models/{mapId}:downloadImage?" +
"handlerClass=" + PngImageGenerator.class.getCanonicalName(), TEST_PROJECT, submap.getId());
mockMvc.perform(request)
.andExpect(status().is2xxSuccessful());
}
private ModelData getSubmap() {
ModelData submap = null;
for (ModelData modelData : project.getModels()) {
if (modelData != map) {
submap = modelData;
}
}
return submap;
}
@Test
public void testDownloadSubmapModel() throws Exception {
ModelData submap = getSubmap();
RequestBuilder request = get("/projects/{projectId}/models/{mapId}:downloadModel?" +
"handlerClass=" + CellDesignerXmlParser.class.getCanonicalName(), TEST_PROJECT, submap.getId());
mockMvc.perform(request)
.andExpect(status().is2xxSuccessful());
}
@Test
public void testDownloadImageDataOverlay() throws Exception {
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment