Search in sources :

Example 1 with MainNames

use of org.nextprot.api.core.domain.MainNames in project nextprot-api by calipho-sib.

the class MainNamesDaoTest method testMapContentForIsoformShort.

@Test
public void testMapContentForIsoformShort() {
    Map<String, MainNames> namesMap = this.mainNamesDao.getMainNamesMap();
    MainNames names = namesMap.get("NX_12345-1");
    assertEquals("NX_12345-1", names.getAccession());
    assertEquals("https://www.nextprot.org/entry/NX_12345-1", names.getUrl());
    assertEquals("Short", names.getName());
    assertEquals(1, names.getGeneNameList().size());
    assertEquals("GENE1", names.getGeneNameList().get(0));
}
Also used : MainNames(org.nextprot.api.core.domain.MainNames) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Example 2 with MainNames

use of org.nextprot.api.core.domain.MainNames in project nextprot-api by calipho-sib.

the class MainNamesDaoTest method testMapContentForIsoformLong.

@Test
public void testMapContentForIsoformLong() {
    Map<String, MainNames> namesMap = this.mainNamesDao.getMainNamesMap();
    MainNames names = namesMap.get("NX_12345-2");
    assertEquals("NX_12345-2", names.getAccession());
    assertEquals("https://www.nextprot.org/entry/NX_12345-2", names.getUrl());
    assertEquals("Long", names.getName());
    assertEquals(1, names.getGeneNameList().size());
    assertEquals("GENE1", names.getGeneNameList().get(0));
}
Also used : MainNames(org.nextprot.api.core.domain.MainNames) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Example 3 with MainNames

use of org.nextprot.api.core.domain.MainNames in project nextprot-api by calipho-sib.

the class MainNamesDaoTest method testMapContentForMasterWithMulitpleGeneNames.

@Test
public void testMapContentForMasterWithMulitpleGeneNames() {
    Map<String, MainNames> namesMap = this.mainNamesDao.getMainNamesMap();
    MainNames names = namesMap.get("NX_12347");
    assertEquals(3, names.getGeneNameList().size());
    assertEquals("GENE3", names.getGeneNameList().get(0));
    assertEquals("GENE4", names.getGeneNameList().get(1));
    assertEquals("GENE5", names.getGeneNameList().get(2));
}
Also used : MainNames(org.nextprot.api.core.domain.MainNames) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Example 4 with MainNames

use of org.nextprot.api.core.domain.MainNames in project nextprot-api by calipho-sib.

the class ConsistencyResourceTest method shouldFindANameForEveryAllEntriesAndIsoformsAndMemoryUsed.

@Test
public void shouldFindANameForEveryAllEntriesAndIsoformsAndMemoryUsed() {
    int isoCnt = 0;
    int masCnt = 0;
    System.gc();
    Runtime rt = Runtime.getRuntime();
    long usedMB = (rt.totalMemory() - rt.freeMemory()) / 1024 / 1024;
    System.out.println("Memory used before getting map: " + usedMB);
    // 
    Map<String, MainNames> namesMap = mainNamesService.findIsoformOrEntryMainName();
    // 
    System.gc();
    usedMB = (rt.totalMemory() - rt.freeMemory()) / 1024 / 1024;
    System.out.println("Memory used after  getting map: " + usedMB);
    for (String ac : namesMap.keySet()) {
        MainNames n = namesMap.get(ac);
        Assert.assertTrue(n.getName().length() > 0);
        if (n.getAccession().contains("-"))
            isoCnt++;
        else
            masCnt++;
    }
    System.out.println("Mas cnt:" + masCnt);
    System.out.println("Iso cnt:" + isoCnt);
}
Also used : MainNames(org.nextprot.api.core.domain.MainNames) Test(org.junit.Test)

Example 5 with MainNames

use of org.nextprot.api.core.domain.MainNames in project nextprot-api by calipho-sib.

the class MainNamesDaoTest method testMapContentForIsoformWithNumericName.

@Test
public void testMapContentForIsoformWithNumericName() {
    Map<String, MainNames> namesMap = this.mainNamesDao.getMainNamesMap();
    MainNames names = namesMap.get("NX_12346-1");
    assertEquals("Iso 1", names.getName());
}
Also used : MainNames(org.nextprot.api.core.domain.MainNames) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Aggregations

MainNames (org.nextprot.api.core.domain.MainNames)9 Test (org.junit.Test)6 CoreUnitBaseTest (org.nextprot.api.core.test.base.CoreUnitBaseTest)5 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 NextProtException (org.nextprot.api.commons.exception.NextProtException)1 NamedParameterJdbcTemplate (org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate)1