Search in sources :

Example 6 with Search

use of org.orcid.jaxb.model.v3.dev1.search.Search in project ORCID-Source by ORCID.

the class OrcidSearchManagerImplTest method testFindOrcidIds.

@Test
public void testFindOrcidIds() {
    when(mockSolrDao.findByDocumentCriteria(Matchers.<Map<String, List<String>>>any())).thenReturn(multipleResultsForQuery());
    Search search = orcidSearchManager.findOrcidIds(new HashMap<>());
    assertNotNull(search);
    assertEquals(2, search.getResults().size());
    assertEquals(Long.valueOf(2), search.getNumFound());
    assertEquals("5678", search.getResults().get(0).getOrcidIdentifier().getPath());
    assertEquals("6789", search.getResults().get(1).getOrcidIdentifier().getPath());
}
Also used : Search(org.orcid.jaxb.model.v3.dev1.search.Search) List(java.util.List) ArrayList(java.util.ArrayList) FundingList(org.orcid.jaxb.model.message.FundingList) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 7 with Search

use of org.orcid.jaxb.model.v3.dev1.search.Search in project ORCID-Source by ORCID.

the class OrcidSearchManagerImplTest method testFindOrcidIdsNoResults.

@Test
public void testFindOrcidIdsNoResults() {
    when(mockSolrDao.findByDocumentCriteria(Matchers.<Map<String, List<String>>>any())).thenReturn(new OrcidSolrResults());
    Search search = orcidSearchManager.findOrcidIds(new HashMap<>());
    assertNotNull(search);
    assertEquals(Long.valueOf(0), search.getNumFound());
    assertEquals(0, search.getResults().size());
}
Also used : Search(org.orcid.jaxb.model.v3.dev1.search.Search) List(java.util.List) ArrayList(java.util.ArrayList) FundingList(org.orcid.jaxb.model.message.FundingList) OrcidSolrResults(org.orcid.utils.solr.entities.OrcidSolrResults) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 8 with Search

use of org.orcid.jaxb.model.v3.dev1.search.Search in project ORCID-Source by ORCID.

the class MemberV3ApiServiceDelegatorImpl method searchByQuery.

@Override
public Response searchByQuery(Map<String, List<String>> solrParams) {
    orcidSecurityManager.checkScopes(ScopePathType.READ_PUBLIC);
    validateSearchParams(solrParams);
    Search search = orcidSearchManager.findOrcidIds(solrParams);
    return Response.ok(search).build();
}
Also used : Search(org.orcid.jaxb.model.v3.dev1.search.Search)

Aggregations

Search (org.orcid.jaxb.model.v3.dev1.search.Search)8 List (java.util.List)6 ArrayList (java.util.ArrayList)5 Test (org.junit.Test)5 OrcidSearchManager (org.orcid.core.manager.v3.OrcidSearchManager)4 Response (javax.ws.rs.core.Response)3 OrcidSecurityManager (org.orcid.core.manager.v3.OrcidSecurityManager)3 FundingList (org.orcid.jaxb.model.message.FundingList)3 Result (org.orcid.jaxb.model.v3.dev1.search.Result)3 PublicV3ApiServiceDelegatorImpl (org.orcid.api.publicV3.server.delegator.impl.PublicV3ApiServiceDelegatorImpl)2 BaseTest (org.orcid.core.BaseTest)2 OrcidIdentifier (org.orcid.jaxb.model.v3.dev1.common.OrcidIdentifier)2 DBUnitTest (org.orcid.test.DBUnitTest)2 OrcidSolrResults (org.orcid.utils.solr.entities.OrcidSolrResults)2 BufferedReader (java.io.BufferedReader)1 IOException (java.io.IOException)1 Reader (java.io.Reader)1 Arrays (java.util.Arrays)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1