Examples of SearchServiceImpl


Examples of com.common.platform.solr.client.search.impl.SearchServiceImpl

    /*
     * @see java.lang.Runnable#run()
     */
    @Override
    public void run() {
        SearchService searchService = new SearchServiceImpl();
        searchService.setStoreName(this.indexStoreName);
       
        // 索引MAP数据结构
        if(null != indexDataList && !indexDataList.isEmpty()){
            // 调用搜索引擎接口
            boolean isSuccess = searchService.saveOrUpdate(indexDataList);
            if(isSuccess){
                // 更新已索引资源状态
                IndexTasksRequest taskRequest = new IndexTasksRequest();
                taskRequest.updateIndexedStatus(indexDataList);
            }
        }
       
        // 索引bean数据结构
        if(null != indexBeanList && !indexBeanList.isEmpty()){
            // 调用搜索引擎接口
            boolean isSuccess = searchService.saveOrUpdateBeans(indexBeanList);
            if(isSuccess){
                // 更新已索引资源状态
                IndexTasksRequest taskRequest = new IndexTasksRequest();
                taskRequest.updateBeansIndexedStatus(indexBeanList);
            }
View Full Code Here

Examples of com.streamreduce.core.service.SearchServiceImpl

    public void testSearchMessages() throws Exception {
        String json = JSONUtils.readJSONFromClasspath("/com/streamreduce/search/elastic_search_raw_payload.json");
        JSONObject elasticSearchPayload = JSONObject.fromObject(json);

        //Set these fields through reflection (mock prevents setters from working) to dummy values.
        SearchServiceImpl searchService = mock(SearchServiceImpl.class);
        ReflectionTestUtils.setField(searchService,"elasticSearchHost","doesNotMatter");
        ReflectionTestUtils.setField(searchService,"elasticSearchPort",666);
        ReflectionTestUtils.setField(searchService,"messageDatabaseName","nodeablemsgdb");
        ReflectionTestUtils.setField(searchService,"enabled",true);


        //Make sure calls to searchMessages uses the real implementation
        when(searchService.searchMessages(any(Account.class), anyString(), anyMap(), any(JSONObject.class))).thenCallRealMethod();
        //Make call to makeRequest so that it returns the elasticSearchPayload
        when(searchService.makeRequest(anyString(),any(JSONObject.class),anyMap(),anyString())).thenReturn(elasticSearchPayload);


        Account a = new Account.Builder().name("testAccount").build();
        a.setId(new ObjectId());

        List<SobaMessage> sobaMessages = searchService.searchMessages(a,"resource", null,null);

        //Expected number of hits in json:
        int expectedSize = elasticSearchPayload.getJSONObject("hits").getJSONArray("hits").size();
        Assert.assertEquals(expectedSize,sobaMessages.size());
    }
View Full Code Here

Examples of com.streamreduce.core.service.SearchServiceImpl

        Assert.assertEquals(expectedSize,sobaMessages.size());
    }

    @Test(expected = IllegalArgumentException.class)
    public void testCreateRiverForNullAccount() {
        SearchService searchService = new SearchServiceImpl();
        ReflectionTestUtils.setField(searchService,"enabled",true);
        searchService.createRiverForAccount(null);
    }
View Full Code Here

Examples of com.streamreduce.core.service.SearchServiceImpl

        Account acctWithoutId = new Account.Builder()
                .name("foo")
                .build();
        acctWithoutId.setId(null);

        SearchService searchService = new SearchServiceImpl();
        ReflectionTestUtils.setField(searchService,"enabled",true);
        searchService.createRiverForAccount(acctWithoutId);
    }
View Full Code Here

Examples of org.vosao.service.front.impl.SearchServiceImpl

  }

  @Override
  public SearchService getSearchService() {
    if (searchService == null) {
      searchService = new SearchServiceImpl();
    }
    return searchService;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.