Skip to content
Snippets Groups Projects
Commit d6fad8c4 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

unit tests fixed + subclasses use proper discrimantor

parent 60984743
No related branches found
No related tags found
1 merge request!345Resolve "Genes annotations don't show"
......@@ -120,7 +120,7 @@ public class ApplySimpleLayoutModelCommand extends ApplyLayoutModelCommand {
Set<Species> elementToAlign = new HashSet<>();
Map<Compartment, Set<Element>> elementsByStaticCompartment = new HashMap<>();
for (Element element : elements) {
if (element.getWidth() == 0) {
if (element.getWidth() == null || element.getWidth() == 0) {
element.setWidth(SPECIES_WIDTH);
element.setHeight(SPECIES_HEIGHT);
......@@ -360,7 +360,9 @@ public class ApplySimpleLayoutModelCommand extends ApplyLayoutModelCommand {
protected Dimension2D estimateDimension(Collection<BioEntity> bioEntites) {
double suggestedSize = Math.max(100 * bioEntites.size() / 4,
Math.sqrt((SPECIES_WIDTH + 10) * (SPECIES_HEIGHT + 10) * bioEntites.size()));
suggestedSize = Math.max(suggestedSize, 2 * (SPECIES_WIDTH + 10));
if (bioEntites.size() > 0) {
suggestedSize = Math.max(suggestedSize, 2 * (SPECIES_WIDTH + 10));
}
return new DoubleDimension(suggestedSize, suggestedSize);
}
......
package lcsb.mapviewer.commands;
import lcsb.mapviewer.commands.layout.AllLayoutTests;
import lcsb.mapviewer.commands.properties.AllPropertyCommandTests;
import org.junit.runner.RunWith;
......@@ -7,12 +8,13 @@ import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses({ AllPropertyCommandTests.class, //
ColorModelCommandTest.class, //
CopyCommandTest.class, //
CreateHierarchyCommandTest.class, //
MoveElementsCommandTest.class, //
SubModelCommandTest.class,//
@SuiteClasses({ AllLayoutTests.class, //
AllPropertyCommandTests.class, //
ColorModelCommandTest.class, //
CopyCommandTest.class, //
CreateHierarchyCommandTest.class, //
MoveElementsCommandTest.class, //
SubModelCommandTest.class,//
})
public class AllCommandsTests {
......
......@@ -22,7 +22,7 @@ import lcsb.mapviewer.model.map.species.Species;
*
*/
@Entity
@DiscriminatorValue("MODIFICATION_SITE")
@DiscriminatorValue("BINDING_REGION")
public class BindingRegion extends AbstractRegionModification implements Serializable {
/**
......
......@@ -26,7 +26,7 @@ import lcsb.mapviewer.model.map.species.Species;
*
*/
@Entity
@DiscriminatorValue("MODIFICATION_SITE")
@DiscriminatorValue("CODING_REGION")
public class CodingRegion extends AbstractRegionModification implements Serializable {
/**
......
......@@ -24,7 +24,7 @@ import lcsb.mapviewer.model.map.species.Species;
*
*/
@Entity
@DiscriminatorValue("MODIFICATION_SITE")
@DiscriminatorValue("PROTEIN_BINDING_DOMAIN")
public class ProteinBindingDomain extends AbstractRegionModification implements Serializable {
/**
......
......@@ -22,7 +22,7 @@ import lcsb.mapviewer.model.map.species.Species;
*
*/
@Entity
@DiscriminatorValue("MODIFICATION_SITE")
@DiscriminatorValue("REGULATORY_REGION")
public class RegulatoryRegion extends AbstractRegionModification implements Serializable {
/**
......
......@@ -39,15 +39,12 @@ public class DrugRestImpl extends BaseRestImpl {
@Autowired
private IDrugService drugService;
@Autowired
private IModelService modelService;
@Autowired
private IUserService userService;
public List<Map<String, Object>> getDrugsByQuery(String token, String projectId, String columns, String query)
throws SecurityException, QueryException {
Model model = modelService.getLastModelByProjectId(projectId, token);
Model model = getModelService().getLastModelByProjectId(projectId, token);
if (model == null) {
throw new QueryException("Project with given id doesn't exist");
}
......@@ -87,23 +84,6 @@ public class DrugRestImpl extends BaseRestImpl {
this.userService = userService;
}
/**
* @return the modelService
* @see #modelService
*/
public IModelService getModelService() {
return modelService;
}
/**
* @param modelService
* the modelService to set
* @see #modelService
*/
public void setModelService(IModelService modelService) {
this.modelService = modelService;
}
private Map<String, Object> prepareDrug(Drug drug, Set<String> columnsSet, List<Model> models) {
Map<String, Object> result = new TreeMap<>();
for (String string : columnsSet) {
......@@ -171,7 +151,7 @@ public class DrugRestImpl extends BaseRestImpl {
public List<Map<String, Object>> getDrugsByTarget(String token, String projectId, String targetType, String targetId,
String columns) throws SecurityException, QueryException {
Model model = modelService.getLastModelByProjectId(projectId, token);
Model model = getModelService().getLastModelByProjectId(projectId, token);
if (model == null) {
throw new QueryException("Project with given id doesn't exist");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment