Search in sources :

Example 26 with UserQuery

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

the class UserQueryDaoTest method testGetUserQueryById.

@Test
public void testGetUserQueryById() {
    UserQuery userQuery = userQueryDao.getUserQueryById(15);
    assertExpectedUserQuery(userQuery, 15, "spongebob", "myquery", "my first query", false, "sparql query", "00000001", new HashSet<String>());
}
Also used : UserQuery(org.nextprot.api.user.domain.UserQuery) UserResourceBaseTest(org.nextprot.api.user.dao.test.base.UserResourceBaseTest) Test(org.junit.Test)

Example 27 with UserQuery

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

the class UserQueryDaoTest method testDeleteUserQueryTags2.

@Test
public void testDeleteUserQueryTags2() {
    Set<String> accs = new HashSet<String>();
    accs.add("pim");
    accs.add("pam");
    accs.add("poum");
    int count = userQueryDao.deleteUserQueryTags(16, accs);
    UserQuery query = userQueryDao.getUserQueryById(16);
    assertEquals(0, count);
    assertExpectedUserQuery(query, 16, "spongebob", "myquery2", "my second query", true, "another sparql query", "ZZZZZU8V", Sets.newHashSet("public"));
}
Also used : UserQuery(org.nextprot.api.user.domain.UserQuery) UserResourceBaseTest(org.nextprot.api.user.dao.test.base.UserResourceBaseTest) Test(org.junit.Test)

Example 28 with UserQuery

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

the class UserQueryDaoTest method testCreateUserQueryAllField.

@Test
public void testCreateUserQueryAllField() {
    UserQuery query = new UserQuery();
    query.setTitle("ma requete");
    query.setDescription("une simple requete");
    query.setSparql("yet another sparql query");
    query.setPublished(true);
    query.setPublicId("00000003");
    query.setOwnerId(24);
    long id = userQueryDao.createUserQuery(query);
    assertTrue(id > 0);
    UserQuery query2 = userQueryDao.getUserQueryById(id);
    assertExpectedUserQuery(query2, id, "tahitibob", "ma requete", "une simple requete", true, "yet another sparql query", "00000003", Sets.<String>newHashSet());
}
Also used : UserQuery(org.nextprot.api.user.domain.UserQuery) UserResourceBaseTest(org.nextprot.api.user.dao.test.base.UserResourceBaseTest) Test(org.junit.Test)

Example 29 with UserQuery

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

the class UserQueryServiceTest method createUserQuery.

public static UserQuery createUserQuery(String title, String desc, String sparql, boolean published) {
    UserQuery query = new UserQuery();
    query.setTitle(title);
    query.setDescription(desc);
    query.setSparql(sparql);
    query.setPublished(published);
    return query;
}
Also used : UserQuery(org.nextprot.api.user.domain.UserQuery)

Example 30 with UserQuery

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

the class UserQueryServiceTest method testCreateUserQuery.

@Test
public void testCreateUserQuery() {
    final UserQuery userQuery = createUserQuery("ma requete", "une simple requete", "yet another sparql query", true);
    dressMockedUserQueryDao(userQuery, 10);
    UserQuery created = userQueryService.createUserQuery(userQuery);
    assertEquals(10, created.getUserQueryId());
    assertEquals("ma requete", created.getTitle());
    Mockito.verify(stringGenerator, times(1)).generateString();
}
Also used : UserQuery(org.nextprot.api.user.domain.UserQuery) Test(org.junit.Test) AbstractUnitBaseTest(org.nextprot.api.commons.dbunit.AbstractUnitBaseTest)

Aggregations

UserQuery (org.nextprot.api.user.domain.UserQuery)33 Test (org.junit.Test)20 UserResourceBaseTest (org.nextprot.api.user.dao.test.base.UserResourceBaseTest)10 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)5 MVCBaseSecurityTest (org.nextprot.api.web.dbunit.base.mvc.MVCBaseSecurityTest)4 ResultSet (java.sql.ResultSet)3 Date (java.util.Date)3 HashMap (java.util.HashMap)3 NextProtException (org.nextprot.api.commons.exception.NextProtException)3 NamedParameterJdbcTemplate (org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate)3 HashSet (java.util.HashSet)2 Map (java.util.Map)2 ApiMethod (org.jsondoc.core.annotation.ApiMethod)2 AbstractUnitBaseTest (org.nextprot.api.commons.dbunit.AbstractUnitBaseTest)2 MapSqlParameterSource (org.springframework.jdbc.core.namedparam.MapSqlParameterSource)2 PrintWriter (java.io.PrintWriter)1 URL (java.net.URL)1 List (java.util.List)1 SearchQueryException (org.nextprot.api.commons.exception.SearchQueryException)1 SparqlEndpoint (org.nextprot.api.rdf.service.SparqlEndpoint)1