Search in sources :

Example 26 with BoardHistoryDTO

use of com.worksmobile.Assignment.Domain.BoardHistoryDTO in project Assignment by WMPeople.

the class VersionManagementTest method testCreateTempArticle.

@Test
public void testCreateTempArticle() throws IOException {
    BoardDTO tempArticle = new BoardDTO();
    tempArticle.setSubject("임시저장중...");
    tempArticle.setContent("temp article content");
    tempArticle.setBoard_id(defaultCreatedDTO.getBoard_id());
    versionManagementService.createTempArticleOverwrite(tempArticle);
    BoardDTO dbTempArticle = boardMapper.viewDetail(new NodePtrDTO(tempArticle.getBoard_id(), 0).toMap());
    Utils.assertConvertToJsonObject(tempArticle.toMap(), dbTempArticle.toMap());
    Utils.assertConvertToJsonObject(tempArticle, dbTempArticle);
    BoardHistoryDTO dbTempHistoryDTO = boardHistoryMapper.getHistory(tempArticle);
    Utils.assertConvertToJsonObject(tempArticle.toMap(), dbTempHistoryDTO.toMap());
    assertEquals(tempArticle.getSubject(), dbTempHistoryDTO.getHistory_subject());
    String decompressedContent = Compress.deCompress(dbTempHistoryDTO.getHistory_content());
    assertEquals(tempArticle.getContent(), decompressedContent);
}
Also used : NodePtrDTO(com.worksmobile.Assignment.Domain.NodePtrDTO) BoardDTO(com.worksmobile.Assignment.Domain.BoardDTO) BoardHistoryDTO(com.worksmobile.Assignment.Domain.BoardHistoryDTO) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 27 with BoardHistoryDTO

use of com.worksmobile.Assignment.Domain.BoardHistoryDTO in project Assignment by WMPeople.

the class VersionManagementTest method testDeleteLeapNode.

@Test
public void testDeleteLeapNode() throws JsonProcessingException {
    NodePtrDTO rootPtrDTO = defaultCreatedDTO;
    NodePtrDTO deletePtrDTO = makeChild(rootPtrDTO);
    versionManagementService.deleteVersion(deletePtrDTO);
    List<BoardHistoryDTO> children = boardHistoryMapper.getChildren(rootPtrDTO);
    assertEquals(0, children.size());
}
Also used : NodePtrDTO(com.worksmobile.Assignment.Domain.NodePtrDTO) BoardHistoryDTO(com.worksmobile.Assignment.Domain.BoardHistoryDTO) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

BoardHistoryDTO (com.worksmobile.Assignment.Domain.BoardHistoryDTO)27 Test (org.junit.Test)17 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)17 NodePtrDTO (com.worksmobile.Assignment.Domain.NodePtrDTO)16 BoardDTO (com.worksmobile.Assignment.Domain.BoardDTO)12 ArrayList (java.util.ArrayList)6 IOException (java.io.IOException)4 HashMap (java.util.HashMap)3 Transactional (org.springframework.transaction.annotation.Transactional)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 ModelAndView (org.springframework.web.servlet.ModelAndView)2 FileDTO (com.worksmobile.Assignment.Domain.FileDTO)1