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

Merge branch '1490-chemical-targets-dialog-is-not-working-correctly' into 'master'

Resolve "chemical targets dialog is not working correctly"

Closes #1490

See merge request !1321
parents e470d392 4f852035
Pipeline #43415 failed with stage
in 20 minutes and 1 second
......@@ -26,6 +26,7 @@ minerva (16.0.0~beta.1) stable; urgency=medium
* Bug fix: top map was not selected properly sometimes (#1487)
* Bug fix: data overlays in comlex upload prevented error to be propagated
to user (#1499)
* Bug fix: searching for all chemicals by target did not work (#1490)
-- Piotr Gawron <piotr.gawron@uni.lu> Wed, 9 Jun 2021 15:00:00 +0200
......
......@@ -35,15 +35,16 @@ public class ChemicalRestImpl extends BaseRestImpl {
private Logger logger = LogManager.getLogger();
private IChemicalService chemicalService;
private IElementService elementService;
private MeSHParser meSHParser;
@Autowired
public ChemicalRestImpl(IChemicalService chemicalService, MeSHParser meSHParser) {
public ChemicalRestImpl(IChemicalService chemicalService, MeSHParser meSHParser, IElementService elementService) {
this.chemicalService = chemicalService;
this.meSHParser = meSHParser;
this.elementService = elementService;
}
public List<Map<String, Object>> getChemicalsByQuery(String projectId, String columns, String query)
......
......@@ -25,6 +25,8 @@ import com.google.gson.JsonParser;
import lcsb.mapviewer.model.Project;
import lcsb.mapviewer.model.map.MiriamData;
import lcsb.mapviewer.model.map.MiriamType;
import lcsb.mapviewer.model.map.species.Element;
import lcsb.mapviewer.model.map.species.SimpleMolecule;
import lcsb.mapviewer.services.interfaces.IProjectService;
@RunWith(SpringJUnit4ClassRunner.class)
......@@ -42,10 +44,12 @@ public class ChemicalControllerIntegrationTest extends ControllerIntegrationTest
@Autowired
private IProjectService projectService;
private Project project;
@Before
public void setup() {
assumeTrue("DAPI credentials are not provided", isDapiConfigurationAvailable());
createProject(TEST_PROJECT);
project = createProject(TEST_PROJECT);
}
@After
......@@ -159,6 +163,26 @@ public class ChemicalControllerIntegrationTest extends ControllerIntegrationTest
.andExpect(status().isNotFound());
}
@Test
public void testSearchChemicalsByTarget() throws Exception {
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
Element element = null;
for (Element e : project.getTopModel().getElements()) {
if (e instanceof SimpleMolecule) {
element = e;
}
}
RequestBuilder request = get("/projects/{projectId}/chemicals:search?target=ALIAS:{aliasId}",
TEST_PROJECT,
element.getId())
.session(session);
mockMvc.perform(request)
.andExpect(status().is2xxSuccessful());
}
@Test
public void testgGetSuggestedList() 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