Search in sources :

Example 16 with BoardHistoryDTO

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

the class VersionManagementService method findAncestorHaveAnotherChild.

public NodePtrDTO findAncestorHaveAnotherChild(NodePtrDTO curPtrDTO) {
    List<BoardHistoryDTO> children;
    do {
        BoardHistoryDTO boardHistoryDTO = boardHistoryMapper.getHistory(curPtrDTO);
        curPtrDTO = boardHistoryDTO.getParentPtrAndRoot();
        children = boardHistoryMapper.getChildren(curPtrDTO);
    } while (children.size() != 1);
    return curPtrDTO;
}
Also used : BoardHistoryDTO(com.worksmobile.Assignment.Domain.BoardHistoryDTO)

Example 17 with BoardHistoryDTO

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

the class BoardHistoryMapperTest method testGetFileCount.

@Test
public void testGetFileCount() {
    BoardHistoryDTO boardHistoryDTO = null;
    boardHistoryDTO = boardHistoryMapper.getHistory(defaultNodePtrDTO);
    if (boardHistoryDTO == null) {
        boardHistoryMapper.createHistory(defaultHistoryDTO);
        boardHistoryDTO = boardHistoryMapper.getHistory(defaultNodePtrDTO);
    }
    assertNotNull(boardHistoryDTO);
    int file_id = boardHistoryDTO.getFile_id();
    int fileCount = boardHistoryMapper.getFileCount(file_id);
    assertEquals(1, fileCount);
}
Also used : BoardHistoryDTO(com.worksmobile.Assignment.Domain.BoardHistoryDTO) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 18 with BoardHistoryDTO

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

the class BoardHistoryMapperTest method testGetHistory.

@Test
public void testGetHistory() {
    BoardHistoryDTO historyDTO = null;
    historyDTO = boardHistoryMapper.getHistory(defaultNodePtrDTO);
    if (historyDTO == null) {
        boardHistoryMapper.createHistory(defaultHistoryDTO);
    }
    historyDTO = boardHistoryMapper.getHistory(defaultNodePtrDTO);
    assertNotNull(historyDTO);
}
Also used : BoardHistoryDTO(com.worksmobile.Assignment.Domain.BoardHistoryDTO) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 19 with BoardHistoryDTO

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

the class BoardHistoryMapperTest method testCreateHistory.

@Test
public void testCreateHistory() throws IOException {
    BoardDTO article = new BoardDTO();
    article.setBoard_id(defaultNodePtrDTO.getBoard_id());
    article.setSubject("testInsert");
    article.setContent("testContent");
    BoardHistoryDTO createdHistoryDTO = new BoardHistoryDTO(article, defaultNodePtrDTO, BoardHistoryDTO.STATUS_CREATED);
    createdHistoryDTO.setHistory_content(Compress.compressArticleContent(article));
    BoardHistoryDTO check = boardHistoryMapper.getHistory(defaultNodePtrDTO);
    if (check != null) {
        boardHistoryMapper.deleteHistory(defaultNodePtrDTO);
    }
    int createdCnt = boardHistoryMapper.createHistory(createdHistoryDTO);
    assertEquals(1, createdCnt);
    BoardHistoryDTO insertedDTO = null;
    insertedDTO = boardHistoryMapper.getHistory(createdHistoryDTO);
    Utils.assertConvertToJsonObject(createdHistoryDTO, insertedDTO);
}
Also used : BoardDTO(com.worksmobile.Assignment.Domain.BoardDTO) BoardHistoryDTO(com.worksmobile.Assignment.Domain.BoardHistoryDTO) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 20 with BoardHistoryDTO

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

the class BoardHistoryMapperTest method testDeleteSpecificOne.

@Test
public void testDeleteSpecificOne() {
    boardHistoryDTO = createBoardHistoryIfNotExists();
    boardMapper.boardDelete(defaultNodePtrDTO.toMap());
    int deletedColCnt = boardHistoryMapper.deleteHistory(defaultNodePtrDTO);
    assertEquals(1, deletedColCnt);
    BoardHistoryDTO deletedHistoryDTO = null;
    deletedHistoryDTO = boardHistoryMapper.getHistory(defaultNodePtrDTO);
    assertNull(deletedHistoryDTO);
}
Also used : 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