Search in sources :

Example 6 with ShortUrlDTO

use of com.github.lybgeek.shorturl.dto.ShortUrlDTO in project springboot-learning by lyb-geek.

the class ElasticsearchApplicationTest method testCustomGetShortUrl.

@Test
public void testCustomGetShortUrl() {
    ShortUrlDTO shortUrlDTO = customShortUrlEsService.getShortUrlById(2L);
    Assert.assertNotNull(shortUrlDTO);
    System.out.println(shortUrlDTO);
}
Also used : ShortUrlDTO(com.github.lybgeek.shorturl.dto.ShortUrlDTO) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 7 with ShortUrlDTO

use of com.github.lybgeek.shorturl.dto.ShortUrlDTO in project springboot-learning by lyb-geek.

the class ElasticsearchApplicationTest method testListShortUrl.

@Test
public void testListShortUrl() {
    ShortUrlDTO dto = new ShortUrlDTO();
    // dto.setUrlName("百度");
    List<ShortUrlDTO> shortUrlDTOS = shortUrlService.listShortUrls(dto);
    System.out.println(shortUrlDTOS);
}
Also used : ShortUrlDTO(com.github.lybgeek.shorturl.dto.ShortUrlDTO) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 8 with ShortUrlDTO

use of com.github.lybgeek.shorturl.dto.ShortUrlDTO in project springboot-learning by lyb-geek.

the class ElasticsearchApplicationTest method testSaveShortUrlEs.

@Test
public void testSaveShortUrlEs() {
    ShortUrlDTO shortUrlDTO = ShortUrlDTO.builder().longUrl("https://www.baidu.com").urlName("百度").remark("百度一下,你就知道").build();
    ShortUrlVO shortUrlVO = shortUrlEsService.save(shortUrlDTO);
    Assert.assertNotNull(shortUrlVO);
    System.out.println(shortUrlVO);
}
Also used : ShortUrlVO(com.github.lybgeek.elasticsearch.model.ShortUrlVO) ShortUrlDTO(com.github.lybgeek.shorturl.dto.ShortUrlDTO) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 9 with ShortUrlDTO

use of com.github.lybgeek.shorturl.dto.ShortUrlDTO in project springboot-learning by lyb-geek.

the class ElasticsearchApplicationTest method testCustomSaveShortUrlEs.

@Test
public void testCustomSaveShortUrlEs() {
    ShortUrlDTO shortUrlDTO = ShortUrlDTO.builder().longUrl("https://www.meituan.com").urlName("美团外卖").remark("美团外卖APP").build();
    boolean isSuccess = customShortUrlEsService.saveShortUrl(shortUrlDTO);
    Assert.assertTrue(isSuccess);
}
Also used : ShortUrlDTO(com.github.lybgeek.shorturl.dto.ShortUrlDTO) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 10 with ShortUrlDTO

use of com.github.lybgeek.shorturl.dto.ShortUrlDTO in project springboot-learning by lyb-geek.

the class ElasticsearchApplicationTest method testCustomSaveShortUrlEsAndReturnId.

@Test
public void testCustomSaveShortUrlEsAndReturnId() {
    ShortUrlDTO shortUrlDTO = ShortUrlDTO.builder().id(20L).longUrl("https://music.wangyiyun.com/").urlName("网易云").remark("网易云音乐").build();
    String id = customShortUrlEsService.save(shortUrlDTO);
    Assert.assertNotNull(id);
}
Also used : ShortUrlDTO(com.github.lybgeek.shorturl.dto.ShortUrlDTO) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

ShortUrlDTO (com.github.lybgeek.shorturl.dto.ShortUrlDTO)14 Test (org.junit.Test)11 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)11 PageQuery (com.github.lybgeek.common.model.PageQuery)2 ShortUrlVO (com.github.lybgeek.elasticsearch.model.ShortUrlVO)2 BoolQueryBuilder (org.elasticsearch.index.query.BoolQueryBuilder)2 QueryBuilder (org.elasticsearch.index.query.QueryBuilder)2 EsEntity (com.github.lybgeek.common.elasticsearch.model.EsEntity)1 SearchSourceBuilder (org.elasticsearch.search.builder.SearchSourceBuilder)1 HighlightBuilder (org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder)1 EventListener (org.springframework.context.event.EventListener)1 Pageable (org.springframework.data.domain.Pageable)1 Sort (org.springframework.data.domain.Sort)1 NativeSearchQueryBuilder (org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder)1 Async (org.springframework.scheduling.annotation.Async)1