Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-6073

Case Service getComments method not returning desired page

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Minor
    • None
    • None
    • KieServer
    • None
    • NEW
    • NEW
    • Hide

      In jbpm workbench, modify the getComments method in RemoteCaseManagementServiceImpl class to accept page and pageSize parameters:

      RemoteCaseManagementServiceImpl.java
      @Override
      public List<CaseCommentSummary> getComments(final String serverTemplateId, final String containerId, final String caseId, final int page, final int pageSize) {
              final List<CaseComment> caseComments = client.getComments(containerId, caseId, page, pageSize);
              return caseComments.stream().map(new CaseCommentMapper()).collect(toList());
          }
      

      The following tests fail:

      RemoteCaseManagementServiceImplTest.java
      @Test
      public void testGetComments_getFirstPage() {
              
              int page = 0;
              int pageSize = 20;
              
              List<CaseComment> commentList = new ArrayList<>();
              
              for (int i = 0; i < 35; i++) {
                  CaseComment caseComment = createTestComment();
                  commentList.add(caseComment);
              }
              
              when(clientMock.getComments(containerId, caseId, page, pageSize)).thenReturn(commentList);
      
              final List<CaseCommentSummary> commentsFromService = testedService.getComments(serverTemplateId, containerId, caseId, page, pageSize);
              assertNotNull(commentsFromService);
              assertEquals(20, commentsFromService.size());
      }
          
      @Test
      public void testGetComments_getSecondPage() {
              
              int page = 1;
              int pageSize = 20;
              
              List<CaseComment> commentList = new ArrayList<>();
              
              for (int i = 0; i < 35; i++) {
                  CaseComment caseComment = createTestComment();
                  commentList.add(caseComment);
              }
              
              when(clientMock.getComments(containerId, caseId, page, pageSize)).thenReturn(commentList);
      
              final List<CaseCommentSummary> commentsFromService = testedService.getComments(serverTemplateId, containerId, caseId, page, pageSize);
              assertNotNull(commentsFromService);
              assertEquals(15, commentsFromService.size());
      }
      

      java.lang.AssertionError: expected:<20> but was:<35>
      java.lang.AssertionError: expected:<15> but was:<35>

      Show
      In jbpm workbench, modify the getComments method in RemoteCaseManagementServiceImpl class to accept page and pageSize parameters: RemoteCaseManagementServiceImpl.java @Override public List<CaseCommentSummary> getComments( final String serverTemplateId, final String containerId, final String caseId, final int page, final int pageSize) { final List<CaseComment> caseComments = client.getComments(containerId, caseId, page, pageSize); return caseComments.stream().map( new CaseCommentMapper()).collect(toList()); } The following tests fail: RemoteCaseManagementServiceImplTest.java @Test public void testGetComments_getFirstPage() { int page = 0; int pageSize = 20; List<CaseComment> commentList = new ArrayList<>(); for ( int i = 0; i < 35; i++) { CaseComment caseComment = createTestComment(); commentList.add(caseComment); } when(clientMock.getComments(containerId, caseId, page, pageSize)).thenReturn(commentList); final List<CaseCommentSummary> commentsFromService = testedService.getComments(serverTemplateId, containerId, caseId, page, pageSize); assertNotNull(commentsFromService); assertEquals(20, commentsFromService.size()); } @Test public void testGetComments_getSecondPage() { int page = 1; int pageSize = 20; List<CaseComment> commentList = new ArrayList<>(); for ( int i = 0; i < 35; i++) { CaseComment caseComment = createTestComment(); commentList.add(caseComment); } when(clientMock.getComments(containerId, caseId, page, pageSize)).thenReturn(commentList); final List<CaseCommentSummary> commentsFromService = testedService.getComments(serverTemplateId, containerId, caseId, page, pageSize); assertNotNull(commentsFromService); assertEquals(15, commentsFromService.size()); } java.lang.AssertionError: expected:<20> but was:<35> java.lang.AssertionError: expected:<15> but was:<35>
    • 2017 Week 22-23, 2017 Week 24-25

    Description

      getComments method in CaseServicesClientImpl is not returning the desired page, when inputting page and pageSize parameters. Regardless of what is input for page or pageSize, all comments will be returned.

      Attachments

        Issue Links

          Activity

            People

              anbaker_jira Anna Baker (Inactive)
              anbaker_jira Anna Baker (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: