use of com.github.lybgeek.shorturl.dto.ShortUrlDTO in project springboot-learning by lyb-geek.
the class ElasticsearchApplicationTest method testSaveAndReturnShortUrl.
@Test
public void testSaveAndReturnShortUrl() {
ShortUrlDTO shortUrlDTO = ShortUrlDTO.builder().longUrl("https://www.baidu.com").urlName("百度").remark("百度一下,你就知道").build();
String shortUrl = shortUrlService.saveAndReturnShortUrl(shortUrlDTO);
Assert.assertNotNull(shortUrl);
System.out.println(shortUrl);
}
use of com.github.lybgeek.shorturl.dto.ShortUrlDTO in project springboot-learning by lyb-geek.
the class ElasticsearchEvent method syncShortUrlToEs.
@Async
@EventListener
public void syncShortUrlToEs(ShortUrl shortUrl) {
ShortUrlDTO shortUrlDO = new ShortUrlDTO();
BeanUtils.copyProperties(shortUrl, shortUrlDO);
log.info("syncShortUrlToEs -> {}", shortUrlDO);
EsEntity esEntity = EsEntity.builder().id(shortUrlDO.getId().toString()).data(shortUrlDO).build();
elasticsearchHelper.saveOrUpdate(ElasticsearchConstant.SHORT_URL_INDEX, esEntity);
}
use of com.github.lybgeek.shorturl.dto.ShortUrlDTO in project springboot-learning by lyb-geek.
the class ElasticsearchApplicationTest method testUpdateShortUrl.
@Test
public void testUpdateShortUrl() {
ShortUrlDTO shortUrlDTO = ShortUrlDTO.builder().id(1L).longUrl("https://www.baidu.com").urlName("百度").remark("百度搜索引擎").build();
ShortUrlDTO shortUrl = shortUrlService.saveShortUrl(shortUrlDTO);
Assert.assertNotNull(shortUrl);
System.out.println(shortUrl);
}
use of com.github.lybgeek.shorturl.dto.ShortUrlDTO in project springboot-learning by lyb-geek.
the class ElasticsearchApplicationTest method testSaveShortUrl.
@Test
public void testSaveShortUrl() {
ShortUrlDTO shortUrlDTO = ShortUrlDTO.builder().longUrl("https://music.wangyiyun.com").urlName("网易云").remark("网易云音乐").build();
ShortUrlDTO shortUrl = shortUrlService.saveShortUrl(shortUrlDTO);
Assert.assertNotNull(shortUrl);
System.out.println(shortUrl);
}
Aggregations