Search in sources :

Example 21 with PostDTO

use of com.nixmash.blog.jpa.dto.PostDTO in project nixmash-blog by mintster.

the class PostServiceTests method updatedPostContainsNewlyAssignedCategory.

@Test
public void updatedPostContainsNewlyAssignedCategory() throws DuplicatePostNameException, PostNotFoundException {
    Post post = postService.getPostById(1L);
    assertEquals(post.getCategory().getCategoryValue(), "Uncategorized");
    PostDTO postDTO = PostUtils.postToPostDTO(post);
    postDTO.setCategoryId(2L);
    post = postService.update(postDTO);
    assertEquals(post.getCategory().getCategoryValue(), "Java");
}
Also used : Post(com.nixmash.blog.jpa.model.Post) PostUtils.postDtoToPost(com.nixmash.blog.jpa.utils.PostUtils.postDtoToPost) PostDTO(com.nixmash.blog.jpa.dto.PostDTO) Test(org.junit.Test)

Example 22 with PostDTO

use of com.nixmash.blog.jpa.dto.PostDTO in project nixmash-blog by mintster.

the class PostServiceTests method builderShouldReturnDomainAsPostSourceFromLink.

@Test
public void builderShouldReturnDomainAsPostSourceFromLink() {
    PostDTO postDTO = PostDTO.getBuilder(USER_ID, POST_TITLE, POST_NAME, "http://wellformed.link", POST_CONTENT, POST_TYPE, DISPLAY_TYPE, CATEGORY_ID, TWITTER_CARD_SUMMARY).build();
    assertEquals(postDTO.getPostSource(), "wellformed.link");
}
Also used : PostDTO(com.nixmash.blog.jpa.dto.PostDTO) Test(org.junit.Test)

Example 23 with PostDTO

use of com.nixmash.blog.jpa.dto.PostDTO in project nixmash-blog by mintster.

the class PostServiceTests method builderShouldReturn_Null_ForMalformedLink.

@Test
public void builderShouldReturn_Null_ForMalformedLink() {
    PostDTO postDTO = PostDTO.getBuilder(USER_ID, POST_TITLE, POST_NAME, "malformed.link", POST_CONTENT, POST_TYPE, DISPLAY_TYPE, CATEGORY_ID, TWITTER_CARD_SUMMARY).build();
    assertEquals(postDTO.getPostSource(), null);
}
Also used : PostDTO(com.nixmash.blog.jpa.dto.PostDTO) Test(org.junit.Test)

Example 24 with PostDTO

use of com.nixmash.blog.jpa.dto.PostDTO in project nixmash-blog by mintster.

the class JsoupPostMetaTests method updatePostMeta.

@Test
public void updatePostMeta() throws PostNotFoundException {
    String NA = "na";
    PostMeta postMeta = postService.getPostMetaById(1L);
    assertEquals(postMeta.getTwitterDescription(), NA);
    PostDTO postDTO = PostUtils.postToPostDTO(postService.getPostById(1L));
    jsoupService.updatePostMeta(postDTO);
    postMeta = postService.getPostMetaById(1L);
    assertNotEquals(postMeta.getTwitterDescription(), NA);
}
Also used : PostMeta(com.nixmash.blog.jpa.model.PostMeta) PostDTO(com.nixmash.blog.jpa.dto.PostDTO) JsoupPostDTO(com.nixmash.blog.jsoup.dto.JsoupPostDTO) Test(org.junit.Test)

Aggregations

PostDTO (com.nixmash.blog.jpa.dto.PostDTO)24 Test (org.junit.Test)15 Post (com.nixmash.blog.jpa.model.Post)14 PostUtils.postDtoToPost (com.nixmash.blog.jpa.utils.PostUtils.postDtoToPost)9 TagDTO (com.nixmash.blog.jpa.dto.TagDTO)2 PostType (com.nixmash.blog.jpa.enums.PostType)1 Category (com.nixmash.blog.jpa.model.Category)1 PostMeta (com.nixmash.blog.jpa.model.PostMeta)1 JsoupPostDTO (com.nixmash.blog.jsoup.dto.JsoupPostDTO)1 PostLink (com.nixmash.blog.mvc.containers.PostLink)1 ArrayList (java.util.ArrayList)1 FlatFileItemWriter (org.springframework.batch.item.file.FlatFileItemWriter)1 BeanWrapperFieldExtractor (org.springframework.batch.item.file.transform.BeanWrapperFieldExtractor)1 DelimitedLineAggregator (org.springframework.batch.item.file.transform.DelimitedLineAggregator)1 Bean (org.springframework.context.annotation.Bean)1 FileSystemResource (org.springframework.core.io.FileSystemResource)1