forked from rongchao/epmet-cloud-rizhao
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							66 lines
						
					
					
						
							2.5 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							66 lines
						
					
					
						
							2.5 KiB
						
					
					
				| package com.epmet; | |
| import com.epmet.commons.tools.security.dto.TokenDto; | |
| import com.epmet.constant.DraftConstant; | |
| import com.epmet.dto.form.DraftAttrFromDTO; | |
| import com.epmet.dto.form.DraftContentFromDTO; | |
| import com.epmet.service.ArticleService; | |
| import org.junit.Test; | |
| import org.junit.runner.RunWith; | |
| import org.springframework.beans.factory.annotation.Autowired; | |
| import org.springframework.boot.test.context.SpringBootTest; | |
| import org.springframework.test.context.junit4.SpringRunner; | |
| 
 | |
| import java.util.ArrayList; | |
| import java.util.Arrays; | |
| import java.util.List; | |
| 
 | |
| @RunWith(SpringRunner.class) | |
| @SpringBootTest | |
| public class ArticleServiceTest { | |
| 
 | |
|     | |
| 
 | |
|     @Autowired | |
|     private ArticleService articleService; | |
| 
 | |
|     @Test | |
|     public void saveOrUpdateContent() { | |
|         TokenDto tokenDto = new TokenDto(); | |
|         tokenDto.setCustomerId("1"); | |
|         tokenDto.setUserId("1"); | |
|         DraftContentFromDTO draftContentFromDTO = new DraftContentFromDTO(); | |
|         //draftContentFromDTO.setDraftId("1"); | |
|         draftContentFromDTO.setTitle("testTitle"); | |
|         List<DraftContentFromDTO.DraftContentDTO> list = new ArrayList<>(); | |
|         for (int i = 0; i <2 ; i++) { | |
|             DraftContentFromDTO.DraftContentDTO contentDTO = new DraftContentFromDTO.DraftContentDTO(); | |
|             contentDTO.setDraftContentId(""); | |
|             contentDTO.setContent("内容"+i); | |
|             contentDTO.setContentType("text"); | |
|             contentDTO.setOrderNum(1+i); | |
|             list.add(contentDTO); | |
|         } | |
|             draftContentFromDTO.setContentList(list); | |
|         String s = articleService.saveOrUpdateContent(tokenDto, draftContentFromDTO); | |
|         System.out.println(s); | |
|     } | |
| 
 | |
|     @Test | |
|     public void saveOrUpdateAttr() { | |
|         TokenDto tokenDto = new TokenDto(); | |
|         tokenDto.setCustomerId("1"); | |
|         tokenDto.setUserId("1"); | |
|         DraftAttrFromDTO draftAttrFromDTO = new DraftAttrFromDTO(); | |
|         draftAttrFromDTO.setDraftId("f93b9fa4e78eadc97164fb5203aa580a"); | |
|         draftAttrFromDTO.setCoverImg("http://www.baidu.com"); | |
|         draftAttrFromDTO.setTagNameList(Arrays.asList("标签1","标签2")); | |
|         draftAttrFromDTO.setIsTop(DraftConstant.UN_TOP); | |
|         draftAttrFromDTO.setGridIdList(Arrays.asList("b3f5c5464ad3634982116c174b22ee35")); | |
|         draftAttrFromDTO.setPublisher("1"); | |
|         draftAttrFromDTO.setPublishDate("2020-06-03"); | |
|         draftAttrFromDTO.setPublisherType("agency"); | |
| 
 | |
|         Boolean aBoolean = articleService.saveDraftAttr(tokenDto, draftAttrFromDTO); | |
|         System.out.println(aBoolean); | |
|     } | |
| }
 | |
| 
 |