Search in sources :

Example 1 with QueryRequest

use of org.nextprot.api.solr.QueryRequest in project nextprot-api by calipho-sib.

the class SearchServiceTest method shouldExportEntries.

@Test
public void shouldExportEntries() throws Exception {
    QueryRequest request = new QueryRequest();
    request.setQuality("gold");
    request.setQuery("insulin");
    Set<String> accs = service.getAccessions(request);
    assertTrue(accs.contains("NX_P01308"));
}
Also used : QueryRequest(org.nextprot.api.solr.QueryRequest) WebIntegrationBaseTest(org.nextprot.api.web.dbunit.base.mvc.WebIntegrationBaseTest) Test(org.junit.Test)

Example 2 with QueryRequest

use of org.nextprot.api.solr.QueryRequest in project nextprot-api by calipho-sib.

the class SearchServiceTest method shouldNotContainThatManyEntries.

@Test
public void shouldNotContainThatManyEntries() throws Exception {
    QueryRequest request = new QueryRequest();
    request.setQuery("daniel teixeiracarvalho ");
    request.setQuality("quality=gold-and-silver");
    Set<String> accs = service.getAccessions(request);
    assertTrue(accs.size() < 10);
}
Also used : QueryRequest(org.nextprot.api.solr.QueryRequest) WebIntegrationBaseTest(org.nextprot.api.web.dbunit.base.mvc.WebIntegrationBaseTest) Test(org.junit.Test)

Example 3 with QueryRequest

use of org.nextprot.api.solr.QueryRequest in project nextprot-api by calipho-sib.

the class SolrServiceTest method shouldReturnResultsFromSparqlQuery.

@Test
public void shouldReturnResultsFromSparqlQuery() throws Exception {
    QueryRequest qr = new QueryRequest();
    qr.setMode("advanced");
    qr.setQuality("gold");
    qr.setSparqlEngine("Jena");
    qr.setSparql("#Proteins phosphorylated and located in the cytoplasm\nselect distinct ?entry where {\n  ?entry :isoform ?iso.\n  ?iso :keyword / :term cv:KW-0597.\n  ?iso :cellularComponent /:term /:childOf cv:SL-0086.\n}");
    Query q = queryBuilderService.buildQueryForSearch(qr, "entry");
    SearchResult result = service.executeQuery(q);
    assertTrue(result.getFound() >= 5636);
}
Also used : QueryRequest(org.nextprot.api.solr.QueryRequest) Query(org.nextprot.api.solr.Query) SearchResult(org.nextprot.api.solr.SearchResult) WebUnitBaseTest(org.nextprot.api.web.dbunit.base.mvc.WebUnitBaseTest) Test(org.junit.Test)

Example 4 with QueryRequest

use of org.nextprot.api.solr.QueryRequest in project nextprot-api by calipho-sib.

the class SolrServiceTest method shouldReturnResultsFromSharedProteinList.

@Test
public void shouldReturnResultsFromSharedProteinList() throws Exception {
    QueryRequest qr = new QueryRequest();
    qr.setQuality("gold");
    qr.setListId("Y7JPIEVH");
    qr.setListOwner("Guest");
    Query q = queryBuilderService.buildQueryForSearch(qr, "entry");
    SearchResult result = service.executeQuery(q);
    assertEquals(1, result.getFound());
}
Also used : QueryRequest(org.nextprot.api.solr.QueryRequest) Query(org.nextprot.api.solr.Query) SearchResult(org.nextprot.api.solr.SearchResult) WebUnitBaseTest(org.nextprot.api.web.dbunit.base.mvc.WebUnitBaseTest) Test(org.junit.Test)

Example 5 with QueryRequest

use of org.nextprot.api.solr.QueryRequest in project nextprot-api by calipho-sib.

the class SolrServiceTest method shouldReturnResultsFromSharedQueryList.

@Test
public void shouldReturnResultsFromSharedQueryList() throws Exception {
    QueryRequest qr = new QueryRequest();
    qr.setQuality("gold");
    qr.setMode("advanced");
    qr.setQueryId("3K8W9PJT");
    Query q = queryBuilderService.buildQueryForSearch(qr, "entry");
    SearchResult result = service.executeQuery(q);
    assertTrue(result.getFound() >= 5636);
}
Also used : QueryRequest(org.nextprot.api.solr.QueryRequest) Query(org.nextprot.api.solr.Query) SearchResult(org.nextprot.api.solr.SearchResult) WebUnitBaseTest(org.nextprot.api.web.dbunit.base.mvc.WebUnitBaseTest) Test(org.junit.Test)

Aggregations

QueryRequest (org.nextprot.api.solr.QueryRequest)21 Test (org.junit.Test)16 Query (org.nextprot.api.solr.Query)16 SearchResult (org.nextprot.api.solr.SearchResult)16 WebUnitBaseTest (org.nextprot.api.web.dbunit.base.mvc.WebUnitBaseTest)14 NextProtException (org.nextprot.api.commons.exception.NextProtException)2 WebIntegrationBaseTest (org.nextprot.api.web.dbunit.base.mvc.WebIntegrationBaseTest)2 HashSet (java.util.HashSet)1 ApiMethod (org.jsondoc.core.annotation.ApiMethod)1 Ignore (org.junit.Ignore)1 SearchQueryException (org.nextprot.api.commons.exception.SearchQueryException)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1