Search in sources :

Example 11 with QuickSearch

use of nl.knaw.huygens.timbuctoo.core.dto.QuickSearch in project timbuctoo by HuygensING.

the class TimbuctooActionsGetTest method doQuickSearchReturnsTheValueOfDataStoreOperations.

@Test
public void doQuickSearchReturnsTheValueOfDataStoreOperations() {
    List<QuickSearchResult> entities = Lists.newArrayList();
    QuickSearch query = QuickSearch.fromQueryString("");
    Collection collection = collWithCollectionName("coll");
    int limit = 1;
    when(dataStoreOperations.doQuickSearch(collection, query, limit)).thenReturn(entities);
    List<QuickSearchResult> searchResult = instance.doQuickSearch(collection, query, null, limit);
    assertThat(searchResult, is(sameInstance(entities)));
}
Also used : QuickSearchResult(nl.knaw.huygens.timbuctoo.core.dto.QuickSearchResult) QuickSearch(nl.knaw.huygens.timbuctoo.core.dto.QuickSearch) Collection(nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection) Test(org.junit.Test)

Example 12 with QuickSearch

use of nl.knaw.huygens.timbuctoo.core.dto.QuickSearch in project timbuctoo by HuygensING.

the class TimbuctooActionsGetTest method doQuickSearchCallsDoKeywordQuickSearchWhenTheCollectionIsAKeywordCollection.

@Test
public void doQuickSearchCallsDoKeywordQuickSearchWhenTheCollectionIsAKeywordCollection() {
    List<QuickSearchResult> entities = Lists.newArrayList();
    QuickSearch query = QuickSearch.fromQueryString("");
    String keywordType = "";
    Collection collection = keywordCollWithCollectionName("coll");
    int limit = 1;
    when(dataStoreOperations.doKeywordQuickSearch(collection, keywordType, query, limit)).thenReturn(entities);
    List<QuickSearchResult> searchResult = instance.doQuickSearch(collection, query, keywordType, limit);
    assertThat(searchResult, is(sameInstance(entities)));
}
Also used : QuickSearchResult(nl.knaw.huygens.timbuctoo.core.dto.QuickSearchResult) QuickSearch(nl.knaw.huygens.timbuctoo.core.dto.QuickSearch) Collection(nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection) Test(org.junit.Test)

Aggregations

QuickSearch (nl.knaw.huygens.timbuctoo.core.dto.QuickSearch)12 Collection (nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection)12 Test (org.junit.Test)11 Optional (java.util.Optional)10 UUID (java.util.UUID)9 OptionalPresentMatcher.present (nl.knaw.huygens.hamcrest.OptionalPresentMatcher.present)9 TinkerPopGraphManager (nl.knaw.huygens.timbuctoo.server.TinkerPopGraphManager)9 EdgeMatcher.likeEdge (nl.knaw.huygens.timbuctoo.util.EdgeMatcher.likeEdge)9 TestGraphBuilder.newGraph (nl.knaw.huygens.timbuctoo.util.TestGraphBuilder.newGraph)9 VertexMatcher.likeVertex (nl.knaw.huygens.timbuctoo.util.VertexMatcher.likeVertex)9 Edge (org.apache.tinkerpop.gremlin.structure.Edge)9 Vertex (org.apache.tinkerpop.gremlin.structure.Vertex)9 Matchers.containsInAnyOrder (org.hamcrest.Matchers.containsInAnyOrder)9 Matchers.empty (org.hamcrest.Matchers.empty)9 Matchers.is (org.hamcrest.Matchers.is)9 Matchers.not (org.hamcrest.Matchers.not)9 Mockito.mock (org.mockito.Mockito.mock)9 Mockito.when (org.mockito.Mockito.when)9 QuickSearchResult (nl.knaw.huygens.timbuctoo.core.dto.QuickSearchResult)7 List (java.util.List)5