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

speed up of unit test

parent 736532db
No related branches found
No related tags found
2 merge requests!630WIP: Resolve "The privileges of a new user are not saved in some cases",!386Resolve "Continous integration tests"
......@@ -59,10 +59,12 @@ public class DrugRestImpl extends BaseRestImpl {
organism = TaxonomyBackend.HUMAN_TAXONOMY;
}
Drug drug = drugService.getByName(query, new DbSearchCriteria().project(project).organisms(organism).colorSet(0));
logger.debug(drug);
if (drug != null) {
List<Model> models = getModels(projectId, "*", token);
result.add(prepareDrug(drug, columnSet, models));
}
logger.debug(result);
return result;
}
......
......@@ -67,7 +67,7 @@ import lcsb.mapviewer.services.interfaces.IUserService;
"/applicationContext-service.xml", //
"/applicationContext-rest.xml", //
"/test-applicationContext.xml", //
"/dataSource.xml", //
"/test-dataSource.xml", //
})
@RunWith(SpringJUnit4ClassRunner.class)
public abstract class RestTestFunctions {
......
......@@ -21,19 +21,13 @@ import lcsb.mapviewer.model.map.MiriamData;
import lcsb.mapviewer.model.map.MiriamType;
import lcsb.mapviewer.model.map.model.Model;
import lcsb.mapviewer.services.interfaces.IModelService;
import lcsb.mapviewer.services.search.DbSearchCriteria;
import lcsb.mapviewer.services.search.chemical.IChemicalService;
public class ChemicalRestImplTest extends RestTestFunctions {
Logger logger = Logger.getLogger(ChemicalRestImplTest.class);
@Autowired
private ChemicalRestImpl _drugRestImpl;
@Autowired
private IChemicalService chemicalService;
@AfterClass
public static void tearDownAfterClass() throws Exception {
}
......@@ -63,8 +57,10 @@ public class ChemicalRestImplTest extends RestTestFunctions {
@Test
public void testPrepareChemicalWithProblematicMesh() throws Exception {
try {
Chemical chemical = chemicalService.getByName("Tetrachlorodibenzodioxin",
new DbSearchCriteria().disease(new MiriamData(MiriamType.MESH_2012, "D010300")));
Chemical chemical = new Chemical();
chemical.setChemicalId(new MiriamData(MiriamType.MESH_2012, "invalidID"));
Map<String, Object> result = _drugRestImpl.prepareChemical(chemical, _drugRestImpl.createChemicalColumnSet(""),
new ArrayList<>());
assertNotNull(result);
......
......@@ -42,8 +42,8 @@ public class DrugRestImplTest extends RestTestFunctions {
@SuppressWarnings("unchecked")
public void testGetDrugsByQuery() throws Exception {
try {
DrugRestImpl drugRestImpl = createMockProjectRest("testFiles/model/sample.xml");
Map<String, Object> result = drugRestImpl.getDrugsByQuery(token, "sample", "", "nadh").get(0);
DrugRestImpl drugRestImpl = createMockProjectRest("testFiles/model/drug_target.xml");
Map<String, Object> result = drugRestImpl.getDrugsByQuery(token, "drug_target", "", "Selisistat").get(0);
List<Map<String, Object>> references = (List<Map<String, Object>>) result.get("references");
Map<String, Object> reference = references.get(0);
assertNotNull(reference.get("type"));
......
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd">
<context:property-placeholder location="classpath:test-db.properties" />
<!-- Data Source Declaration -->
<bean id="DataSource"
class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="org.postgresql.Driver" />
<property name="jdbcUrl" value="${database.uri}" />
<property name="user" value="${database.username}" />
<property name="password" value="${database.password}" />
<property name="maxPoolSize" value="90" />
<property name="maxStatements" value="5" />
<property name="minPoolSize" value="5" />
</bean>
<bean id="DbInit" class="lcsb.mapviewer.persist.CustomDatabasePopulator">
<property name="dataSource"><ref bean="DataSource"/></property>
</bean>
<bean id="startupScripts" class="org.springframework.jdbc.datasource.init.DataSourceInitializer">
<property name="dataSource"><ref bean="DataSource"/></property>
<property name="databasePopulator"><ref bean="DbInit"/></property>
<property name="enabled" value="true"/>
</bean>
</beans>
database.uri=jdbc:postgresql://localhost:5432/map_viewer-test
database.username=map_viewer
database.password=123qweasdzxc
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level2/version4" xmlns:celldesigner="http://www.sbml.org/2001/ns/celldesigner" level="2" version="4">
<model metaid="untitled" id="untitled">
<annotation>
<celldesigner:extension>
<celldesigner:modelVersion>4.0</celldesigner:modelVersion>
<celldesigner:modelDisplay sizeX="1308" sizeY="600"/>
<celldesigner:listOfCompartmentAliases/>
<celldesigner:listOfComplexSpeciesAliases/>
<celldesigner:listOfSpeciesAliases>
<celldesigner:speciesAlias id="sa15" species="s16">
<celldesigner:activity>inactive</celldesigner:activity>
<celldesigner:bounds x="328.0" y="248.0" w="119.0" h="63.0"/>
<celldesigner:font size="12"/>
<celldesigner:view state="usual"/>
<celldesigner:usualView>
<celldesigner:innerPosition x="0.0" y="0.0"/>
<celldesigner:boxSize width="119.0" height="63.0"/>
<celldesigner:singleLine width="1.0"/>
<celldesigner:paint color="ffccffcc" scheme="Color"/>
</celldesigner:usualView>
<celldesigner:briefView>
<celldesigner:innerPosition x="0.0" y="0.0"/>
<celldesigner:boxSize width="80.0" height="60.0"/>
<celldesigner:singleLine width="1.0"/>
<celldesigner:paint color="3fff0000" scheme="Color"/>
</celldesigner:briefView>
<celldesigner:info state="empty" angle="-1.5707963267948966"/>
</celldesigner:speciesAlias>
</celldesigner:listOfSpeciesAliases>
<celldesigner:listOfGroups/>
<celldesigner:listOfProteins>
<celldesigner:protein id="pr7" name="SIRT1" type="GENERIC"/>
</celldesigner:listOfProteins>
<celldesigner:listOfGenes/>
<celldesigner:listOfRNAs/>
<celldesigner:listOfAntisenseRNAs/>
<celldesigner:listOfLayers/>
<celldesigner:listOfBlockDiagrams/>
</celldesigner:extension>
</annotation>
<listOfUnitDefinitions>
<unitDefinition metaid="substance" id="substance" name="substance">
<listOfUnits>
<unit metaid="CDMT00069" kind="mole"/>
</listOfUnits>
</unitDefinition>
<unitDefinition metaid="volume" id="volume" name="volume">
<listOfUnits>
<unit metaid="CDMT00070" kind="litre"/>
</listOfUnits>
</unitDefinition>
<unitDefinition metaid="area" id="area" name="area">
<listOfUnits>
<unit metaid="CDMT00071" kind="metre" exponent="2"/>
</listOfUnits>
</unitDefinition>
<unitDefinition metaid="length" id="length" name="length">
<listOfUnits>
<unit metaid="CDMT00072" kind="metre"/>
</listOfUnits>
</unitDefinition>
<unitDefinition metaid="time" id="time" name="time">
<listOfUnits>
<unit metaid="CDMT00073" kind="second"/>
</listOfUnits>
</unitDefinition>
</listOfUnitDefinitions>
<listOfCompartments>
<compartment metaid="default" id="default" size="1" units="volume"/>
</listOfCompartments>
<listOfSpecies>
<species metaid="s16" id="s16" name="SIRT1" compartment="default" initialAmount="0">
<annotation>
<celldesigner:extension>
<celldesigner:positionToCompartment>inside</celldesigner:positionToCompartment>
<celldesigner:speciesIdentity>
<celldesigner:class>PROTEIN</celldesigner:class>
<celldesigner:proteinReference>pr7</celldesigner:proteinReference>
</celldesigner:speciesIdentity>
</celldesigner:extension>
</annotation>
</species>
</listOfSpecies>
</model>
</sbml>
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