Commit 154d945d authored by Piotr Gawron's avatar Piotr Gawron
Browse files

reaction must be initialized

parent ce16bdba
Pipeline #52728 passed with stage
in 17 minutes and 9 seconds
......@@ -5,6 +5,7 @@ minerva (16.1.0~beta.1) stable; urgency=medium
exception was thrown (#1638)
* Bug fix: users that logged out or when session expired are marked as not
logged in (#1639)
* Bug fix: reaction search result caused an exception (#1640)
-- Piotr Gawron <piotr.gawron@uni.lu> Fri, 18 Feb 2022 11:00:00 +0200
......
......@@ -121,6 +121,7 @@ public class SearchService implements ISearchService {
result.add(reaction);
for (final ReactionNode node : reaction.getReactionNodes()) {
result.add(node.getElement());
Hibernate.initialize(node.getElement());
}
return result;
}
......@@ -253,7 +254,7 @@ public class SearchService implements ISearchService {
result.add(tmpList.get(i).getReference());
}
}
for (BioEntity bioEntity: result) {
for (BioEntity bioEntity : result) {
Hibernate.initialize(bioEntity);
}
return result;
......
......@@ -577,6 +577,19 @@ public class MapControllerIntegrationTest extends ControllerIntegrationTest {
}
@Test
public void testSearchReaction() throws Exception {
RequestBuilder request = get(
"/api/projects/{projectId}/models/{mapId}/bioEntities:search?query=reaction:re1", TEST_PROJECT, "*");
String response = mockMvc.perform(request)
.andExpect(status().is2xxSuccessful())
.andReturn().getResponse().getContentAsString();
List<?> result = objectMapper.readValue(response, new TypeReference<List<?>>() {
});
assertEquals(4, result.size());
}
@Test
public void testSuggestedQueryListWithUndefinedProject() 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