Search in sources :

Example 16 with UserProteinList

use of org.nextprot.api.user.domain.UserProteinList in project nextprot-api by calipho-sib.

the class UserProteinListDaoTest method testCreateUserProteinListAccessions.

@Test
public void testCreateUserProteinListAccessions() {
    proteinListDao.createUserProteinListItems(156, Sets.newHashSet("prot1", "prot2"));
    UserProteinList list = proteinListDao.getUserProteinListById(156);
    assertExpectedProteinList(list, 156, "mylist", "my proteins", username, 23, 5, Sets.newHashSet("NX_Q14249", "NX_Q8N5Z0", "NX_P05165", "prot1", "prot2"), "ZZZZZU8V");
}
Also used : UserProteinList(org.nextprot.api.user.domain.UserProteinList) UserResourceBaseTest(org.nextprot.api.user.dao.test.base.UserResourceBaseTest) Test(org.junit.Test)

Example 17 with UserProteinList

use of org.nextprot.api.user.domain.UserProteinList in project nextprot-api by calipho-sib.

the class UserProteinListDaoTest method testGetUserProteinListByPublicId.

@Test
public void testGetUserProteinListByPublicId() {
    UserProteinList list = proteinListDao.getUserProteinListByPublicId("ZZZZZU8V");
    assertExpectedProteinList(list, 156, "mylist", "my proteins", username, 23, 3, Sets.newHashSet("NX_Q14249", "NX_Q8N5Z0", "NX_P05165"), "ZZZZZU8V");
}
Also used : UserProteinList(org.nextprot.api.user.domain.UserProteinList) UserResourceBaseTest(org.nextprot.api.user.dao.test.base.UserResourceBaseTest) Test(org.junit.Test)

Example 18 with UserProteinList

use of org.nextprot.api.user.domain.UserProteinList in project nextprot-api by calipho-sib.

the class UserProteinListDaoTest method testGetUserProteinListByName.

@Test
public void testGetUserProteinListByName() {
    UserProteinList list = proteinListDao.getUserProteinListByName(username, "mylist");
    assertNotNull(list);
    assertExpectedProteinList(list, 156, "mylist", "my proteins", username, 23, 3, Sets.newHashSet("NX_Q14249", "NX_Q8N5Z0", "NX_P05165"), "ZZZZZU8V");
}
Also used : UserProteinList(org.nextprot.api.user.domain.UserProteinList) UserResourceBaseTest(org.nextprot.api.user.dao.test.base.UserResourceBaseTest) Test(org.junit.Test)

Example 19 with UserProteinList

use of org.nextprot.api.user.domain.UserProteinList in project nextprot-api by calipho-sib.

the class UserProteinListDaoTest method testCreate2UserProteinListsWithDuplicatePublicIdFail.

@Test(expected = DuplicateKeyException.class)
public void testCreate2UserProteinListsWithDuplicatePublicIdFail() {
    UserProteinList list = new UserProteinList();
    list.setOwnerId(24);
    list.setPublicId("00000001");
    long id = proteinListDao.createUserProteinList(list);
    assertTrue(id > 0);
    list = new UserProteinList();
    list.setOwnerId(124);
    list.setPublicId("00000001");
    proteinListDao.createUserProteinList(list);
}
Also used : UserProteinList(org.nextprot.api.user.domain.UserProteinList) UserResourceBaseTest(org.nextprot.api.user.dao.test.base.UserResourceBaseTest) Test(org.junit.Test)

Example 20 with UserProteinList

use of org.nextprot.api.user.domain.UserProteinList in project nextprot-api by calipho-sib.

the class UserProteinListDaoTest method testUpdateUserProteinList.

@Test
public void testUpdateUserProteinList() {
    UserProteinList l = new UserProteinList();
    l.setId(156);
    l.setName("ma liste");
    l.setDescription("la liste de bob leponge");
    proteinListDao.updateUserProteinListMetadata(l);
    UserProteinList l2 = proteinListDao.getUserProteinListById(l.getId());
    assertTrue(156 == l2.getId());
    assertEquals(l.getName(), l2.getName());
    assertEquals(l.getDescription(), l2.getDescription());
}
Also used : UserProteinList(org.nextprot.api.user.domain.UserProteinList) UserResourceBaseTest(org.nextprot.api.user.dao.test.base.UserResourceBaseTest) Test(org.junit.Test)

Aggregations

UserProteinList (org.nextprot.api.user.domain.UserProteinList)51 Test (org.junit.Test)38 UserResourceBaseTest (org.nextprot.api.user.dao.test.base.UserResourceBaseTest)13 UserProteinListServiceTest.createUserProteinList (org.nextprot.api.user.service.UserProteinListServiceTest.createUserProteinList)9 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)8 MVCBaseSecurityTest (org.nextprot.api.web.dbunit.base.mvc.MVCBaseSecurityTest)8 HashSet (java.util.HashSet)5 AbstractUnitBaseTest (org.nextprot.api.commons.dbunit.AbstractUnitBaseTest)4 DuplicateKeyException (org.springframework.dao.DuplicateKeyException)3 NamedParameterJdbcTemplate (org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate)3 ApiMethod (org.jsondoc.core.annotation.ApiMethod)2 NextProtException (org.nextprot.api.commons.exception.NextProtException)2 UserQuery (org.nextprot.api.user.domain.UserQuery)2 MapSqlParameterSource (org.springframework.jdbc.core.namedparam.MapSqlParameterSource)2 SqlParameterSource (org.springframework.jdbc.core.namedparam.SqlParameterSource)2 IOException (java.io.IOException)1 List (java.util.List)1 AutocompleteSearchResult (org.nextprot.api.solr.AutocompleteSearchResult)1 Query (org.nextprot.api.solr.Query)1 SearchResult (org.nextprot.api.solr.SearchResult)1