Ignore:
Timestamp:
12/01/11 15:04:15 (13 years ago)
Author:
jeafer
Message:

Jean-Charles branch commit3,
Changes regarding comment on the ComponentRegistry service.
Delete_comment from RestService? to Database access (CommentsDao?) implemented.
Post_comment from RestService? to Database access (CommentsDao?) implemented. (Not yet tested)
Comment class updated
CommentsDao? updated
CommentTest? class implemented (New Class)
Test classes ComponentRegistryRestServiceTest? and RegistryHelperTest? starting to implement tests for Comment validation (insertion, deletion)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ComponentRegistry/branches/jeaferversion/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/impl/database/CommentsDaoTest.java

    r1633 r1635  
    4343    @Test
    4444    public void testInsertComment() {
    45         Comment testComment = createTestComment();
     45        Comment comment = createTestComment();
    4646
    4747
    4848
    49         String regDate = Comment.createNewDate();
    5049
    5150        //testComment.setId(TEST_COMMENT_ID);
    52         testComment.setComment("test");
    53         //testComment.setUserID("1");
     51       
     52        //comment.setUserId("1");
    5453        //testComment.setComponentDescriptionId("A component1");
    5554        //testComment.setProfileDescriptionId("A profile1");
    56         testComment.setCommentDate(regDate);
    5755
     56        String testComment = comment.getComment();
    5857        assertEquals(0, commentsDao.getAllComments().size());
    59         Number newId = commentsDao.insertComment(testComment);
     58        Number newId = commentsDao.insertComment(comment, testComment, Integer.parseInt(TEST_COMMENT_USER_ID));
    6059        assertNotNull(newId);
    61 
     60     
    6261        List<Comment> comments = commentsDao.getAllComments();
     62        assertNotNull(comments);
    6363        assertEquals(1, comments.size());
    6464
    6565        assertEquals(TEST_COMMENT_NAME, comments.get(0).getComment());
    6666       // assertEquals("A component1", comments.get(0).getComponentDescriptionId());
    67         //assertEquals("A profile1", comments.get(0).getProfileDescriptionId());
    68         assertEquals(regDate, comments.get(0).getCommentDate());
    69        // assertEquals("1", comments.get(0).getUserId());
    70        // assertEquals(TEST_COMMENT_ID, comments.get(0).getId());
     67        assertEquals(TEST_COMMENT_PROFILE_ID, comments.get(0).getProfileDescriptionId());
     68        assertEquals(TEST_COMMENT_DATE, comments.get(0).getCommentDate());
     69        assertEquals(TEST_COMMENT_USER_ID, comments.get(0).getUserId());
     70        //assertEquals(TEST_COMMENT_ID, comments.get(0).getId());
    7171    }
    7272   
     
    9090    @Test
    9191    public void testGetComment() {
    92         Comment testComment = createTestComment();
    93         commentsDao.insertComment(testComment);
     92        Comment comment = createTestComment();
     93        String testComment = comment.getComment();
     94        commentsDao.insertComment(comment, testComment, 8);
    9495
    9596        assertNotNull(commentsDao.getByComment(TEST_COMMENT_NAME));
     
    109110   
    110111    public void testSetDelete(){
    111         Comment testComment = createTestComment();
     112        Comment comment = createTestComment();
     113        String testComment = comment.getComment();
    112114        int count = commentsDao.getAllComments().size();
    113115       
    114         commentsDao.insertComment(testComment);
     116        commentsDao.insertComment(comment, testComment, 8);
    115117        assertEquals(count + 1, commentsDao.getAllComments().size());
    116118
    117         commentsDao.deleteComment(testComment, true);
     119        commentsDao.deleteComment(comment, true);
    118120        assertEquals(count, commentsDao.getAllComments().size());
    119121       
Note: See TracChangeset for help on using the changeset viewer.