You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/08/25 09:10:48 UTC

[GitHub] [nifi] aksharau opened a new pull request, #6335: NIFI-9920 Fetching all bulletins of a process group on update process…

aksharau opened a new pull request, #6335:
URL: https://github.com/apache/nifi/pull/6335

   … group
   
   <!-- Licensed to the Apache Software Foundation (ASF) under one or more -->
   <!-- contributor license agreements.  See the NOTICE file distributed with -->
   <!-- this work for additional information regarding copyright ownership. -->
   <!-- The ASF licenses this file to You under the Apache License, Version 2.0 -->
   <!-- (the "License"); you may not use this file except in compliance with -->
   <!-- the License.  You may obtain a copy of the License at -->
   <!--     http://www.apache.org/licenses/LICENSE-2.0 -->
   <!-- Unless required by applicable law or agreed to in writing, software -->
   <!-- distributed under the License is distributed on an "AS IS" BASIS, -->
   <!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -->
   <!-- See the License for the specific language governing permissions and -->
   <!-- limitations under the License. -->
   
   # Summary
   
   [NIFI-9920](https://issues.apache.org/jira/browse/NIFI-9920)
   
   # Tracking
   
   Please complete the following tracking steps prior to pull request creation.
   
   ### Issue Tracking
   
   - [ ] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue created
   
   ### Pull Request Tracking
   
   - [ ] Pull Request title starts with Apache NiFi Jira issue number, such as `NIFI-00000`
   - [ ] Pull Request commit message starts with Apache NiFi Jira issue number, as such `NIFI-00000`
   
   ### Pull Request Formatting
   
   - [ ] Pull Request based on current revision of the `main` branch
   - [ ] Pull Request refers to a feature branch with one commit containing changes
   
   # Verification
   
   Please indicate the verification steps performed prior to pull request creation.
   
   ### Build
   
   - [ ] Build completed using `mvn clean install -P contrib-check`
     - [ ] JDK 8
     - [ ] JDK 11
     - [ ] JDK 17
   
   ### Licensing
   
   - [ ] New dependencies are compatible with the [Apache License 2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License Policy](https://www.apache.org/legal/resolved.html)
   - [ ] New dependencies are documented in applicable `LICENSE` and `NOTICE` files
   
   ### Documentation
   
   - [ ] Documentation formatting appears as expected in rendered files
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] aksharau commented on pull request #6335: NIFI-9920 Fetching all bulletins of a process group on update process…

Posted by GitBox <gi...@apache.org>.
aksharau commented on PR #6335:
URL: https://github.com/apache/nifi/pull/6335#issuecomment-1240691673

   Thanks @doodzio for the suggestion. I have added the relevant test cases. Please do note that I had to bump up the mockito version as it was giving me below error for all the existing test cases.
   **Could not initialize plugin: interface org.mockito.plugins.MockMaker (alternate: null)**
   
   Should I bump up the mockito version for entire nifi? I saw that nifi-registry is also using a different mockito version, so did not venture into changing it for all of nifi and only updated it for the nifi-web-api module.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] doodzio commented on pull request #6335: NIFI-9920 Fetching all bulletins of a process group on update process…

Posted by GitBox <gi...@apache.org>.
doodzio commented on PR #6335:
URL: https://github.com/apache/nifi/pull/6335#issuecomment-1242793938

   Hi, I didn't have time recently ( I was AFK).
   
   It seems that your code have some formatting issues, It will be to many to point in review.
   Check this [guide](https://cwiki.apache.org/confluence/display/nifi/contributor+guide#ContributorGuide-CodeStyle) for details


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] doodzio commented on a diff in pull request #6335: NIFI-9920 Fetching all bulletins of a process group on update process…

Posted by GitBox <gi...@apache.org>.
doodzio commented on code in PR #6335:
URL: https://github.com/apache/nifi/pull/6335#discussion_r971265563


##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/StandardNiFiServiceFacadeTest.java:
##########
@@ -555,4 +583,179 @@ private RemoteProcessGroupDTO createRemoteProcessGroupDTO(String id, boolean tra
 
         return remoteProcessGroup;
     }
+
+
+    @Test
+    public void testUpdateProcessGroup_WithProcessorBulletin() {
+        //GIVEN
+        final String groupId = UUID.randomUUID().toString();
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName(GROUP_NAME_1);
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+        final DtoFactory dtoFactory = new DtoFactory();
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(groupId, GROUP_NAME_1, PROCESSOR_ID_1,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_1,BULLETIN_CATEGORY,BULLETIN_SEVERITY,BULLETIN_MESSAGE_1,PATH_TO_GROUP_1));
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(RANDOM_GROUP_ID,GROUP_NAME_2, PROCESSOR_ID_2,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_2, BULLETIN_CATEGORY,BULLETIN_SEVERITY, BULLETIN_MESSAGE_2,PATH_TO_GROUP_2));
+        //WHEN
+        ProcessGroupEntity result = serviceFacadeSpy.updateProcessGroup(revision, processGroupDTO);
+        //THEN
+        Assert.assertNotNull(result);
+        Assert.assertEquals(1,result.getBulletins().size());
+        Assert.assertEquals(groupId,result.getBulletins().get(0).getGroupId());
+    }
+
+    @Test
+    public void testUpdateProcessGroup_WithNoBulletinForProcessGroup() {
+
+        //GIVEN
+
+        final String groupId = UUID.randomUUID().toString();
+
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName("group-name-1");
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+
+        final DtoFactory dtoFactory = new DtoFactory();
+
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(RANDOM_GROUP_ID,GROUP_NAME_2, PROCESSOR_ID_2,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_2, BULLETIN_CATEGORY,BULLETIN_SEVERITY, BULLETIN_MESSAGE_2,PATH_TO_GROUP_2));
+
+        //WHEN
+        ProcessGroupEntity result = serviceFacadeSpy.updateProcessGroup(revision, processGroupDTO);
+
+        //THEN
+        Assert.assertNotNull(result);
+        Assert.assertEquals(0,result.getBulletins().size());
+    }
+
+    @Test
+    public void testUpdateProcessGroup_WithProcessorGroupBulletin() {
+
+        //GIVEN
+
+        final String groupId = UUID.randomUUID().toString();
+
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName("group-name-1");
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+
+        final DtoFactory dtoFactory = new DtoFactory();
+
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);

Review Comment:
   This factory is used only here, seems redundant, mock already have one.



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/StandardNiFiServiceFacadeTest.java:
##########
@@ -555,4 +583,179 @@ private RemoteProcessGroupDTO createRemoteProcessGroupDTO(String id, boolean tra
 
         return remoteProcessGroup;
     }
+
+
+    @Test
+    public void testUpdateProcessGroup_WithProcessorBulletin() {
+        //GIVEN
+        final String groupId = UUID.randomUUID().toString();
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName(GROUP_NAME_1);
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+        final DtoFactory dtoFactory = new DtoFactory();
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(groupId, GROUP_NAME_1, PROCESSOR_ID_1,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_1,BULLETIN_CATEGORY,BULLETIN_SEVERITY,BULLETIN_MESSAGE_1,PATH_TO_GROUP_1));
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(RANDOM_GROUP_ID,GROUP_NAME_2, PROCESSOR_ID_2,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_2, BULLETIN_CATEGORY,BULLETIN_SEVERITY, BULLETIN_MESSAGE_2,PATH_TO_GROUP_2));
+        //WHEN
+        ProcessGroupEntity result = serviceFacadeSpy.updateProcessGroup(revision, processGroupDTO);
+        //THEN
+        Assert.assertNotNull(result);
+        Assert.assertEquals(1,result.getBulletins().size());
+        Assert.assertEquals(groupId,result.getBulletins().get(0).getGroupId());
+    }
+
+    @Test
+    public void testUpdateProcessGroup_WithNoBulletinForProcessGroup() {
+
+        //GIVEN
+
+        final String groupId = UUID.randomUUID().toString();
+
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName("group-name-1");
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+
+        final DtoFactory dtoFactory = new DtoFactory();
+
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);

Review Comment:
   This factory is used only here, seems redundant, mock already have one..



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/StandardNiFiServiceFacadeTest.java:
##########
@@ -555,4 +583,179 @@ private RemoteProcessGroupDTO createRemoteProcessGroupDTO(String id, boolean tra
 
         return remoteProcessGroup;
     }
+
+
+    @Test
+    public void testUpdateProcessGroup_WithProcessorBulletin() {
+        //GIVEN
+        final String groupId = UUID.randomUUID().toString();
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName(GROUP_NAME_1);
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+        final DtoFactory dtoFactory = new DtoFactory();
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);

Review Comment:
   This factory is used only here, seems redundant, mock already have one..



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] markap14 merged pull request #6335: NIFI-9920 Fetching all bulletins of a process group on update process…

Posted by GitBox <gi...@apache.org>.
markap14 merged PR #6335:
URL: https://github.com/apache/nifi/pull/6335


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] doodzio commented on pull request #6335: NIFI-9920 Fetching all bulletins of a process group on update process…

Posted by GitBox <gi...@apache.org>.
doodzio commented on PR #6335:
URL: https://github.com/apache/nifi/pull/6335#issuecomment-1236348425

   My suggestion:
   
   Maybe additional test should be created here: https://github.com/apache/nifi/blob/main/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/StandardNiFiServiceFacadeTest.java?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] aksharau commented on a diff in pull request #6335: NIFI-9920 Fetching all bulletins of a process group on update process…

Posted by GitBox <gi...@apache.org>.
aksharau commented on code in PR #6335:
URL: https://github.com/apache/nifi/pull/6335#discussion_r971684990


##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/StandardNiFiServiceFacadeTest.java:
##########
@@ -555,4 +583,179 @@ private RemoteProcessGroupDTO createRemoteProcessGroupDTO(String id, boolean tra
 
         return remoteProcessGroup;
     }
+
+
+    @Test
+    public void testUpdateProcessGroup_WithProcessorBulletin() {
+        //GIVEN
+        final String groupId = UUID.randomUUID().toString();
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName(GROUP_NAME_1);
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+        final DtoFactory dtoFactory = new DtoFactory();
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(groupId, GROUP_NAME_1, PROCESSOR_ID_1,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_1,BULLETIN_CATEGORY,BULLETIN_SEVERITY,BULLETIN_MESSAGE_1,PATH_TO_GROUP_1));
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(RANDOM_GROUP_ID,GROUP_NAME_2, PROCESSOR_ID_2,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_2, BULLETIN_CATEGORY,BULLETIN_SEVERITY, BULLETIN_MESSAGE_2,PATH_TO_GROUP_2));
+        //WHEN
+        ProcessGroupEntity result = serviceFacadeSpy.updateProcessGroup(revision, processGroupDTO);
+        //THEN
+        Assert.assertNotNull(result);
+        Assert.assertEquals(1,result.getBulletins().size());
+        Assert.assertEquals(groupId,result.getBulletins().get(0).getGroupId());
+    }
+
+    @Test
+    public void testUpdateProcessGroup_WithNoBulletinForProcessGroup() {
+
+        //GIVEN
+
+        final String groupId = UUID.randomUUID().toString();
+
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName("group-name-1");
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+
+        final DtoFactory dtoFactory = new DtoFactory();
+
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(RANDOM_GROUP_ID,GROUP_NAME_2, PROCESSOR_ID_2,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_2, BULLETIN_CATEGORY,BULLETIN_SEVERITY, BULLETIN_MESSAGE_2,PATH_TO_GROUP_2));
+
+        //WHEN
+        ProcessGroupEntity result = serviceFacadeSpy.updateProcessGroup(revision, processGroupDTO);
+
+        //THEN
+        Assert.assertNotNull(result);
+        Assert.assertEquals(0,result.getBulletins().size());
+    }
+
+    @Test
+    public void testUpdateProcessGroup_WithProcessorGroupBulletin() {
+
+        //GIVEN

Review Comment:
   done



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/StandardNiFiServiceFacadeTest.java:
##########
@@ -555,4 +583,179 @@ private RemoteProcessGroupDTO createRemoteProcessGroupDTO(String id, boolean tra
 
         return remoteProcessGroup;
     }
+
+
+    @Test
+    public void testUpdateProcessGroup_WithProcessorBulletin() {
+        //GIVEN
+        final String groupId = UUID.randomUUID().toString();
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName(GROUP_NAME_1);
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+        final DtoFactory dtoFactory = new DtoFactory();
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(groupId, GROUP_NAME_1, PROCESSOR_ID_1,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_1,BULLETIN_CATEGORY,BULLETIN_SEVERITY,BULLETIN_MESSAGE_1,PATH_TO_GROUP_1));
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(RANDOM_GROUP_ID,GROUP_NAME_2, PROCESSOR_ID_2,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_2, BULLETIN_CATEGORY,BULLETIN_SEVERITY, BULLETIN_MESSAGE_2,PATH_TO_GROUP_2));
+        //WHEN
+        ProcessGroupEntity result = serviceFacadeSpy.updateProcessGroup(revision, processGroupDTO);
+        //THEN
+        Assert.assertNotNull(result);
+        Assert.assertEquals(1,result.getBulletins().size());
+        Assert.assertEquals(groupId,result.getBulletins().get(0).getGroupId());
+    }
+
+    @Test
+    public void testUpdateProcessGroup_WithNoBulletinForProcessGroup() {
+
+        //GIVEN
+
+        final String groupId = UUID.randomUUID().toString();
+
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName("group-name-1");
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+
+        final DtoFactory dtoFactory = new DtoFactory();
+
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(RANDOM_GROUP_ID,GROUP_NAME_2, PROCESSOR_ID_2,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_2, BULLETIN_CATEGORY,BULLETIN_SEVERITY, BULLETIN_MESSAGE_2,PATH_TO_GROUP_2));
+
+        //WHEN
+        ProcessGroupEntity result = serviceFacadeSpy.updateProcessGroup(revision, processGroupDTO);
+
+        //THEN
+        Assert.assertNotNull(result);
+        Assert.assertEquals(0,result.getBulletins().size());
+    }
+
+    @Test
+    public void testUpdateProcessGroup_WithProcessorGroupBulletin() {
+
+        //GIVEN
+
+        final String groupId = UUID.randomUUID().toString();
+
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName("group-name-1");
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+
+        final DtoFactory dtoFactory = new DtoFactory();
+
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(groupId, GROUP_NAME_1, groupId,
+        ComponentType.PROCESSOR,GROUP_NAME_1,BULLETIN_CATEGORY,BULLETIN_SEVERITY,BULLETIN_MESSAGE_1,PATH_TO_GROUP_1));
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(RANDOM_GROUP_ID,GROUP_NAME_2, PROCESSOR_ID_2,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_2, BULLETIN_CATEGORY,BULLETIN_SEVERITY, BULLETIN_MESSAGE_2,PATH_TO_GROUP_2));
+
+        //WHEN
+        ProcessGroupEntity result = serviceFacadeSpy.updateProcessGroup(revision, processGroupDTO);
+
+        //THEN
+        Assert.assertNotNull(result);
+        Assert.assertEquals(1,result.getBulletins().size());
+        Assert.assertEquals(groupId,result.getBulletins().get(0).getGroupId());
+    }
+
+    private static class MockTestBulletinRepository extends MockBulletinRepository {
+
+        List<Bulletin> bulletinList;
+
+        public MockTestBulletinRepository() {
+            bulletinList = new ArrayList<>();
+        }
+
+        @Override
+        public void addBulletin(Bulletin bulletin) {
+            bulletinList.add(bulletin);
+        }
+
+        public List<Bulletin> findBulletinsForGroupBySource(String groupId) {
+            List<Bulletin> ans  = new ArrayList<Bulletin>();

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] aksharau commented on a diff in pull request #6335: NIFI-9920 Fetching all bulletins of a process group on update process…

Posted by GitBox <gi...@apache.org>.
aksharau commented on code in PR #6335:
URL: https://github.com/apache/nifi/pull/6335#discussion_r971684239


##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/StandardNiFiServiceFacadeTest.java:
##########
@@ -555,4 +583,179 @@ private RemoteProcessGroupDTO createRemoteProcessGroupDTO(String id, boolean tra
 
         return remoteProcessGroup;
     }
+

Review Comment:
   removed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] aksharau commented on a diff in pull request #6335: NIFI-9920 Fetching all bulletins of a process group on update process…

Posted by GitBox <gi...@apache.org>.
aksharau commented on code in PR #6335:
URL: https://github.com/apache/nifi/pull/6335#discussion_r971684738


##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/StandardNiFiServiceFacadeTest.java:
##########
@@ -555,4 +583,179 @@ private RemoteProcessGroupDTO createRemoteProcessGroupDTO(String id, boolean tra
 
         return remoteProcessGroup;
     }
+
+
+    @Test
+    public void testUpdateProcessGroup_WithProcessorBulletin() {
+        //GIVEN
+        final String groupId = UUID.randomUUID().toString();
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName(GROUP_NAME_1);
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+        final DtoFactory dtoFactory = new DtoFactory();
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(groupId, GROUP_NAME_1, PROCESSOR_ID_1,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_1,BULLETIN_CATEGORY,BULLETIN_SEVERITY,BULLETIN_MESSAGE_1,PATH_TO_GROUP_1));
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(RANDOM_GROUP_ID,GROUP_NAME_2, PROCESSOR_ID_2,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_2, BULLETIN_CATEGORY,BULLETIN_SEVERITY, BULLETIN_MESSAGE_2,PATH_TO_GROUP_2));
+        //WHEN

Review Comment:
   done, I split it to multiple lines also added comments



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] markap14 commented on pull request #6335: NIFI-9920 Fetching all bulletins of a process group on update process…

Posted by GitBox <gi...@apache.org>.
markap14 commented on PR #6335:
URL: https://github.com/apache/nifi/pull/6335#issuecomment-1322326871

   Thanks @aksharau looks good to me. +1 merged to main


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] doodzio commented on a diff in pull request #6335: NIFI-9920 Fetching all bulletins of a process group on update process…

Posted by GitBox <gi...@apache.org>.
doodzio commented on code in PR #6335:
URL: https://github.com/apache/nifi/pull/6335#discussion_r972339643


##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/StandardNiFiServiceFacadeTest.java:
##########
@@ -555,4 +580,183 @@ private RemoteProcessGroupDTO createRemoteProcessGroupDTO(String id, boolean tra
 
         return remoteProcessGroup;
     }
+
+    @Test
+    public void testUpdateProcessGroup_WithProcessorBulletin() {
+        //GIVEN
+        final String groupId = UUID.randomUUID().toString();
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName(GROUP_NAME_1);
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L, "a", "b");
+        final FlowModification lastModification = new FlowModification(revision, "a");
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO, lastModification);
+        when(revisionManager.updateRevision(any(), any(), any())).thenReturn((RevisionUpdate<Object> )snapshot);
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+
+        //add a bulletin for a processor in the current processor group
+        bulletinRepository.addBulletin(
+            BulletinFactory.createBulletin(groupId, GROUP_NAME_1, PROCESSOR_ID_1,
+                ComponentType.PROCESSOR, PROCESSOR_NAME_1,
+                BULLETIN_CATEGORY, BULLETIN_SEVERITY, BULLETIN_MESSAGE_1, PATH_TO_GROUP_1));
+
+        //add a bulletin for a processor in a different processor group
+        bulletinRepository.addBulletin(
+            BulletinFactory.createBulletin(RANDOM_GROUP_ID, GROUP_NAME_2, PROCESSOR_ID_2,
+                ComponentType.PROCESSOR, PROCESSOR_NAME_2,
+                BULLETIN_CATEGORY, BULLETIN_SEVERITY, BULLETIN_MESSAGE_2, PATH_TO_GROUP_2));
+
+        //WHEN
+        ProcessGroupEntity result = serviceFacadeSpy.updateProcessGroup(revision, processGroupDTO);
+
+        //THEN
+        Assert.assertNotNull(result);
+        Assert.assertEquals(1, result.getBulletins().size());
+        Assert.assertEquals(groupId, result.getBulletins().get(0).getGroupId());
+    }
+
+    @Test
+    public void testUpdateProcessGroup_WithNoBulletinForProcessGroup() {
+        //GIVEN
+        final String groupId = UUID.randomUUID().toString();
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName(GROUP_NAME_1);
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L, "a", "b");
+        final FlowModification lastModification = new FlowModification(revision, "a");
+
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(), any(), any())).thenReturn((RevisionUpdate<Object> )snapshot);
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+
+        //add a bulletin for a processor in a different processor group
+        bulletinRepository.addBulletin(
+            BulletinFactory.createBulletin(RANDOM_GROUP_ID, GROUP_NAME_2, PROCESSOR_ID_2,
+                ComponentType.PROCESSOR, PROCESSOR_NAME_2,
+                BULLETIN_CATEGORY, BULLETIN_SEVERITY, BULLETIN_MESSAGE_2, PATH_TO_GROUP_2));
+
+        //WHEN
+        ProcessGroupEntity result = serviceFacadeSpy.updateProcessGroup(revision, processGroupDTO);
+
+        //THEN
+        Assert.assertNotNull(result);
+        Assert.assertEquals(0, result.getBulletins().size());
+    }
+
+    @Test
+    public void testUpdateProcessGroup_WithProcessorGroupBulletin() {
+        //GIVEN
+        final String groupId = UUID.randomUUID().toString();
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName(GROUP_NAME_1);
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L, "a", "b");
+        final FlowModification lastModification = new FlowModification(revision, "a");
+
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(), any(), any())).thenReturn((RevisionUpdate<Object> )snapshot);
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+
+         //add a bulletin for current processor group, meaning the source is also the process group
+        bulletinRepository.addBulletin(
+            BulletinFactory.createBulletin(groupId, GROUP_NAME_1, groupId,
+                ComponentType.PROCESSOR, GROUP_NAME_1,
+                BULLETIN_CATEGORY, BULLETIN_SEVERITY, BULLETIN_MESSAGE_1, PATH_TO_GROUP_1));
+
+         //add a bulletin for a processor in a different processor group
+        bulletinRepository.addBulletin(
+            BulletinFactory.createBulletin(RANDOM_GROUP_ID,GROUP_NAME_2, PROCESSOR_ID_2,
+                ComponentType.PROCESSOR, PROCESSOR_NAME_2,
+                BULLETIN_CATEGORY, BULLETIN_SEVERITY, BULLETIN_MESSAGE_2, PATH_TO_GROUP_2));
+
+        //WHEN
+        ProcessGroupEntity result = serviceFacadeSpy.updateProcessGroup(revision, processGroupDTO);
+
+        //THEN
+        Assert.assertNotNull(result);
+        Assert.assertEquals(1, result.getBulletins().size());
+        Assert.assertEquals(groupId, result.getBulletins().get(0).getGroupId());
+    }
+
+
+    private static class MockTestBulletinRepository extends MockBulletinRepository {
+
+        List<Bulletin> bulletinList;
+
+        public MockTestBulletinRepository() {
+            bulletinList = new ArrayList<>();
+        }
+
+        @Override
+        public void addBulletin(Bulletin bulletin) {
+            bulletinList.add(bulletin);
+        }
+
+        public List<Bulletin> findBulletinsForGroupBySource(String groupId) {

Review Comment:
   I didn't catch this previously.
   
   Seems that you missed `@Override` annotation.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] aksharau commented on a diff in pull request #6335: NIFI-9920 Fetching all bulletins of a process group on update process…

Posted by GitBox <gi...@apache.org>.
aksharau commented on code in PR #6335:
URL: https://github.com/apache/nifi/pull/6335#discussion_r971686097


##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/StandardNiFiServiceFacadeTest.java:
##########
@@ -555,4 +583,179 @@ private RemoteProcessGroupDTO createRemoteProcessGroupDTO(String id, boolean tra
 
         return remoteProcessGroup;
     }
+
+
+    @Test
+    public void testUpdateProcessGroup_WithProcessorBulletin() {
+        //GIVEN
+        final String groupId = UUID.randomUUID().toString();
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName(GROUP_NAME_1);
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+        final DtoFactory dtoFactory = new DtoFactory();
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(groupId, GROUP_NAME_1, PROCESSOR_ID_1,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_1,BULLETIN_CATEGORY,BULLETIN_SEVERITY,BULLETIN_MESSAGE_1,PATH_TO_GROUP_1));
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(RANDOM_GROUP_ID,GROUP_NAME_2, PROCESSOR_ID_2,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_2, BULLETIN_CATEGORY,BULLETIN_SEVERITY, BULLETIN_MESSAGE_2,PATH_TO_GROUP_2));
+        //WHEN
+        ProcessGroupEntity result = serviceFacadeSpy.updateProcessGroup(revision, processGroupDTO);
+        //THEN
+        Assert.assertNotNull(result);
+        Assert.assertEquals(1,result.getBulletins().size());
+        Assert.assertEquals(groupId,result.getBulletins().get(0).getGroupId());
+    }
+
+    @Test
+    public void testUpdateProcessGroup_WithNoBulletinForProcessGroup() {
+
+        //GIVEN
+
+        final String groupId = UUID.randomUUID().toString();
+
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName("group-name-1");
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+
+        final DtoFactory dtoFactory = new DtoFactory();
+
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);

Review Comment:
   done, removed the redundant factory



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/StandardNiFiServiceFacadeTest.java:
##########
@@ -555,4 +583,179 @@ private RemoteProcessGroupDTO createRemoteProcessGroupDTO(String id, boolean tra
 
         return remoteProcessGroup;
     }
+
+
+    @Test
+    public void testUpdateProcessGroup_WithProcessorBulletin() {
+        //GIVEN
+        final String groupId = UUID.randomUUID().toString();
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName(GROUP_NAME_1);
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+        final DtoFactory dtoFactory = new DtoFactory();
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(groupId, GROUP_NAME_1, PROCESSOR_ID_1,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_1,BULLETIN_CATEGORY,BULLETIN_SEVERITY,BULLETIN_MESSAGE_1,PATH_TO_GROUP_1));
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(RANDOM_GROUP_ID,GROUP_NAME_2, PROCESSOR_ID_2,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_2, BULLETIN_CATEGORY,BULLETIN_SEVERITY, BULLETIN_MESSAGE_2,PATH_TO_GROUP_2));
+        //WHEN
+        ProcessGroupEntity result = serviceFacadeSpy.updateProcessGroup(revision, processGroupDTO);
+        //THEN
+        Assert.assertNotNull(result);
+        Assert.assertEquals(1,result.getBulletins().size());
+        Assert.assertEquals(groupId,result.getBulletins().get(0).getGroupId());
+    }
+
+    @Test
+    public void testUpdateProcessGroup_WithNoBulletinForProcessGroup() {
+
+        //GIVEN
+

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] aksharau commented on a diff in pull request #6335: NIFI-9920 Fetching all bulletins of a process group on update process…

Posted by GitBox <gi...@apache.org>.
aksharau commented on code in PR #6335:
URL: https://github.com/apache/nifi/pull/6335#discussion_r975350052


##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/StandardNiFiServiceFacadeTest.java:
##########
@@ -555,4 +580,183 @@ private RemoteProcessGroupDTO createRemoteProcessGroupDTO(String id, boolean tra
 
         return remoteProcessGroup;
     }
+
+    @Test
+    public void testUpdateProcessGroup_WithProcessorBulletin() {
+        //GIVEN
+        final String groupId = UUID.randomUUID().toString();
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName(GROUP_NAME_1);
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L, "a", "b");
+        final FlowModification lastModification = new FlowModification(revision, "a");
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO, lastModification);
+        when(revisionManager.updateRevision(any(), any(), any())).thenReturn((RevisionUpdate<Object> )snapshot);
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+
+        //add a bulletin for a processor in the current processor group
+        bulletinRepository.addBulletin(
+            BulletinFactory.createBulletin(groupId, GROUP_NAME_1, PROCESSOR_ID_1,
+                ComponentType.PROCESSOR, PROCESSOR_NAME_1,
+                BULLETIN_CATEGORY, BULLETIN_SEVERITY, BULLETIN_MESSAGE_1, PATH_TO_GROUP_1));
+
+        //add a bulletin for a processor in a different processor group
+        bulletinRepository.addBulletin(
+            BulletinFactory.createBulletin(RANDOM_GROUP_ID, GROUP_NAME_2, PROCESSOR_ID_2,
+                ComponentType.PROCESSOR, PROCESSOR_NAME_2,
+                BULLETIN_CATEGORY, BULLETIN_SEVERITY, BULLETIN_MESSAGE_2, PATH_TO_GROUP_2));
+
+        //WHEN
+        ProcessGroupEntity result = serviceFacadeSpy.updateProcessGroup(revision, processGroupDTO);
+
+        //THEN
+        Assert.assertNotNull(result);
+        Assert.assertEquals(1, result.getBulletins().size());
+        Assert.assertEquals(groupId, result.getBulletins().get(0).getGroupId());
+    }
+
+    @Test
+    public void testUpdateProcessGroup_WithNoBulletinForProcessGroup() {
+        //GIVEN
+        final String groupId = UUID.randomUUID().toString();
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName(GROUP_NAME_1);
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L, "a", "b");
+        final FlowModification lastModification = new FlowModification(revision, "a");
+
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(), any(), any())).thenReturn((RevisionUpdate<Object> )snapshot);
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+
+        //add a bulletin for a processor in a different processor group
+        bulletinRepository.addBulletin(
+            BulletinFactory.createBulletin(RANDOM_GROUP_ID, GROUP_NAME_2, PROCESSOR_ID_2,
+                ComponentType.PROCESSOR, PROCESSOR_NAME_2,
+                BULLETIN_CATEGORY, BULLETIN_SEVERITY, BULLETIN_MESSAGE_2, PATH_TO_GROUP_2));
+
+        //WHEN
+        ProcessGroupEntity result = serviceFacadeSpy.updateProcessGroup(revision, processGroupDTO);
+
+        //THEN
+        Assert.assertNotNull(result);
+        Assert.assertEquals(0, result.getBulletins().size());
+    }
+
+    @Test
+    public void testUpdateProcessGroup_WithProcessorGroupBulletin() {
+        //GIVEN
+        final String groupId = UUID.randomUUID().toString();
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName(GROUP_NAME_1);
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L, "a", "b");
+        final FlowModification lastModification = new FlowModification(revision, "a");
+
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(), any(), any())).thenReturn((RevisionUpdate<Object> )snapshot);
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+
+         //add a bulletin for current processor group, meaning the source is also the process group
+        bulletinRepository.addBulletin(
+            BulletinFactory.createBulletin(groupId, GROUP_NAME_1, groupId,
+                ComponentType.PROCESSOR, GROUP_NAME_1,
+                BULLETIN_CATEGORY, BULLETIN_SEVERITY, BULLETIN_MESSAGE_1, PATH_TO_GROUP_1));
+
+         //add a bulletin for a processor in a different processor group
+        bulletinRepository.addBulletin(
+            BulletinFactory.createBulletin(RANDOM_GROUP_ID,GROUP_NAME_2, PROCESSOR_ID_2,
+                ComponentType.PROCESSOR, PROCESSOR_NAME_2,
+                BULLETIN_CATEGORY, BULLETIN_SEVERITY, BULLETIN_MESSAGE_2, PATH_TO_GROUP_2));
+
+        //WHEN
+        ProcessGroupEntity result = serviceFacadeSpy.updateProcessGroup(revision, processGroupDTO);
+
+        //THEN
+        Assert.assertNotNull(result);
+        Assert.assertEquals(1, result.getBulletins().size());
+        Assert.assertEquals(groupId, result.getBulletins().get(0).getGroupId());
+    }
+
+
+    private static class MockTestBulletinRepository extends MockBulletinRepository {
+
+        List<Bulletin> bulletinList;
+
+        public MockTestBulletinRepository() {
+            bulletinList = new ArrayList<>();
+        }
+
+        @Override
+        public void addBulletin(Bulletin bulletin) {
+            bulletinList.add(bulletin);
+        }
+
+        public List<Bulletin> findBulletinsForGroupBySource(String groupId) {

Review Comment:
   Thanks @doodzio for the deep review. Have added the annotation



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] aksharau commented on pull request #6335: NIFI-9920 Fetching all bulletins of a process group on update process…

Posted by GitBox <gi...@apache.org>.
aksharau commented on PR #6335:
URL: https://github.com/apache/nifi/pull/6335#issuecomment-1242891002

   Thanks much @doodzio for your comments and guidance. I have applied the formatting changes by checking it with ``` mvn checkstyle:check ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] aksharau commented on pull request #6335: NIFI-9920 Fetching all bulletins of a process group on update process…

Posted by GitBox <gi...@apache.org>.
aksharau commented on PR #6335:
URL: https://github.com/apache/nifi/pull/6335#issuecomment-1241474229

   Thanks @doodzio for checking. Without adding 4.7.0 as dependency, the unit tests failed at my end, even the ones that existed earlier. Hence I had to change the version to 4.7.0.
   I had also mailed the dev mailing list, I got a suggestion to try with Java 11, will try with that and update.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] doodzio commented on pull request #6335: NIFI-9920 Fetching all bulletins of a process group on update process…

Posted by GitBox <gi...@apache.org>.
doodzio commented on PR #6335:
URL: https://github.com/apache/nifi/pull/6335#issuecomment-1241034797

   I see that you added additional dependencies, this can be the reason, as you can see, there are already usages of `org.mockito.` therefore, it is imported as dependency by another library.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] aksharau commented on a diff in pull request #6335: NIFI-9920 Fetching all bulletins of a process group on update process…

Posted by GitBox <gi...@apache.org>.
aksharau commented on code in PR #6335:
URL: https://github.com/apache/nifi/pull/6335#discussion_r971685749


##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/StandardNiFiServiceFacadeTest.java:
##########
@@ -555,4 +583,179 @@ private RemoteProcessGroupDTO createRemoteProcessGroupDTO(String id, boolean tra
 
         return remoteProcessGroup;
     }
+
+
+    @Test
+    public void testUpdateProcessGroup_WithProcessorBulletin() {
+        //GIVEN
+        final String groupId = UUID.randomUUID().toString();
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName(GROUP_NAME_1);
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+        final DtoFactory dtoFactory = new DtoFactory();
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);

Review Comment:
   done, removed the redundant factory



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/StandardNiFiServiceFacadeTest.java:
##########
@@ -555,4 +583,179 @@ private RemoteProcessGroupDTO createRemoteProcessGroupDTO(String id, boolean tra
 
         return remoteProcessGroup;
     }
+
+
+    @Test
+    public void testUpdateProcessGroup_WithProcessorBulletin() {
+        //GIVEN
+        final String groupId = UUID.randomUUID().toString();
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName(GROUP_NAME_1);
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+        final DtoFactory dtoFactory = new DtoFactory();
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(groupId, GROUP_NAME_1, PROCESSOR_ID_1,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_1,BULLETIN_CATEGORY,BULLETIN_SEVERITY,BULLETIN_MESSAGE_1,PATH_TO_GROUP_1));
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(RANDOM_GROUP_ID,GROUP_NAME_2, PROCESSOR_ID_2,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_2, BULLETIN_CATEGORY,BULLETIN_SEVERITY, BULLETIN_MESSAGE_2,PATH_TO_GROUP_2));
+        //WHEN
+        ProcessGroupEntity result = serviceFacadeSpy.updateProcessGroup(revision, processGroupDTO);
+        //THEN
+        Assert.assertNotNull(result);
+        Assert.assertEquals(1,result.getBulletins().size());
+        Assert.assertEquals(groupId,result.getBulletins().get(0).getGroupId());
+    }
+
+    @Test
+    public void testUpdateProcessGroup_WithNoBulletinForProcessGroup() {
+
+        //GIVEN
+
+        final String groupId = UUID.randomUUID().toString();
+
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName("group-name-1");
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+
+        final DtoFactory dtoFactory = new DtoFactory();
+
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(RANDOM_GROUP_ID,GROUP_NAME_2, PROCESSOR_ID_2,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_2, BULLETIN_CATEGORY,BULLETIN_SEVERITY, BULLETIN_MESSAGE_2,PATH_TO_GROUP_2));
+
+        //WHEN
+        ProcessGroupEntity result = serviceFacadeSpy.updateProcessGroup(revision, processGroupDTO);
+
+        //THEN
+        Assert.assertNotNull(result);
+        Assert.assertEquals(0,result.getBulletins().size());
+    }
+
+    @Test
+    public void testUpdateProcessGroup_WithProcessorGroupBulletin() {
+
+        //GIVEN
+
+        final String groupId = UUID.randomUUID().toString();
+
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName("group-name-1");
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+
+        final DtoFactory dtoFactory = new DtoFactory();
+
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);

Review Comment:
   done, removed the redundant factory



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] doodzio commented on a diff in pull request #6335: NIFI-9920 Fetching all bulletins of a process group on update process…

Posted by GitBox <gi...@apache.org>.
doodzio commented on code in PR #6335:
URL: https://github.com/apache/nifi/pull/6335#discussion_r970107044


##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/StandardNiFiServiceFacadeTest.java:
##########
@@ -114,6 +127,21 @@ public class StandardNiFiServiceFacadeTest {
     private static final Integer ACTION_ID_2 = 2;
     private static final String PROCESSOR_ID_2 = "processor-2";
 
+    private static final String GROUP_NAME_1 = "group-name-1";
+    private static final String GROUP_NAME_2 = "group-name-2";
+    private static final String PROCESSOR_NAME_1 = "Processor1";
+    private static final String PROCESSOR_NAME_2 = "Processor2";
+    private static final String BULLETIN_CATEGORY = "Log Message";
+    private static final String BULLETIN_SEVERITY = "ERROR";
+    private static final String BULLETIN_MESSAGE_1 = "Error1";
+    private static final String BULLETIN_MESSAGE_2 = "Error2";
+    private static final String PATH_TO_GROUP_1 = "Path1";
+    private static final String PATH_TO_GROUP_2 = "Path2";
+    private static final String RANDOM_GROUP_ID = "randomGroupId";
+
+
+
+

Review Comment:
   Unnecessary empty lines 142 - 143
   



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/StandardNiFiServiceFacadeTest.java:
##########
@@ -555,4 +583,179 @@ private RemoteProcessGroupDTO createRemoteProcessGroupDTO(String id, boolean tra
 
         return remoteProcessGroup;
     }
+
+
+    @Test
+    public void testUpdateProcessGroup_WithProcessorBulletin() {
+        //GIVEN
+        final String groupId = UUID.randomUUID().toString();
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName(GROUP_NAME_1);
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+        final DtoFactory dtoFactory = new DtoFactory();
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(groupId, GROUP_NAME_1, PROCESSOR_ID_1,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_1,BULLETIN_CATEGORY,BULLETIN_SEVERITY,BULLETIN_MESSAGE_1,PATH_TO_GROUP_1));
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(RANDOM_GROUP_ID,GROUP_NAME_2, PROCESSOR_ID_2,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_2, BULLETIN_CATEGORY,BULLETIN_SEVERITY, BULLETIN_MESSAGE_2,PATH_TO_GROUP_2));
+        //WHEN
+        ProcessGroupEntity result = serviceFacadeSpy.updateProcessGroup(revision, processGroupDTO);
+        //THEN
+        Assert.assertNotNull(result);
+        Assert.assertEquals(1,result.getBulletins().size());
+        Assert.assertEquals(groupId,result.getBulletins().get(0).getGroupId());
+    }
+
+    @Test
+    public void testUpdateProcessGroup_WithNoBulletinForProcessGroup() {
+
+        //GIVEN
+

Review Comment:
   Unnecessary empt line before and after `//Given`



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/StandardNiFiServiceFacadeTest.java:
##########
@@ -555,4 +583,179 @@ private RemoteProcessGroupDTO createRemoteProcessGroupDTO(String id, boolean tra
 
         return remoteProcessGroup;
     }
+
+
+    @Test
+    public void testUpdateProcessGroup_WithProcessorBulletin() {
+        //GIVEN
+        final String groupId = UUID.randomUUID().toString();
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName(GROUP_NAME_1);
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+        final DtoFactory dtoFactory = new DtoFactory();
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(groupId, GROUP_NAME_1, PROCESSOR_ID_1,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_1,BULLETIN_CATEGORY,BULLETIN_SEVERITY,BULLETIN_MESSAGE_1,PATH_TO_GROUP_1));
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(RANDOM_GROUP_ID,GROUP_NAME_2, PROCESSOR_ID_2,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_2, BULLETIN_CATEGORY,BULLETIN_SEVERITY, BULLETIN_MESSAGE_2,PATH_TO_GROUP_2));
+        //WHEN
+        ProcessGroupEntity result = serviceFacadeSpy.updateProcessGroup(revision, processGroupDTO);
+        //THEN
+        Assert.assertNotNull(result);
+        Assert.assertEquals(1,result.getBulletins().size());
+        Assert.assertEquals(groupId,result.getBulletins().get(0).getGroupId());
+    }
+
+    @Test
+    public void testUpdateProcessGroup_WithNoBulletinForProcessGroup() {
+
+        //GIVEN
+
+        final String groupId = UUID.randomUUID().toString();
+
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName("group-name-1");
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+
+        final DtoFactory dtoFactory = new DtoFactory();
+
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(RANDOM_GROUP_ID,GROUP_NAME_2, PROCESSOR_ID_2,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_2, BULLETIN_CATEGORY,BULLETIN_SEVERITY, BULLETIN_MESSAGE_2,PATH_TO_GROUP_2));
+
+        //WHEN
+        ProcessGroupEntity result = serviceFacadeSpy.updateProcessGroup(revision, processGroupDTO);
+
+        //THEN
+        Assert.assertNotNull(result);
+        Assert.assertEquals(0,result.getBulletins().size());
+    }
+
+    @Test
+    public void testUpdateProcessGroup_WithProcessorGroupBulletin() {
+
+        //GIVEN
+
+        final String groupId = UUID.randomUUID().toString();
+
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName("group-name-1");
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+
+        final DtoFactory dtoFactory = new DtoFactory();
+
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(groupId, GROUP_NAME_1, groupId,
+        ComponentType.PROCESSOR,GROUP_NAME_1,BULLETIN_CATEGORY,BULLETIN_SEVERITY,BULLETIN_MESSAGE_1,PATH_TO_GROUP_1));
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(RANDOM_GROUP_ID,GROUP_NAME_2, PROCESSOR_ID_2,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_2, BULLETIN_CATEGORY,BULLETIN_SEVERITY, BULLETIN_MESSAGE_2,PATH_TO_GROUP_2));
+
+        //WHEN
+        ProcessGroupEntity result = serviceFacadeSpy.updateProcessGroup(revision, processGroupDTO);
+
+        //THEN
+        Assert.assertNotNull(result);
+        Assert.assertEquals(1,result.getBulletins().size());
+        Assert.assertEquals(groupId,result.getBulletins().get(0).getGroupId());
+    }
+
+    private static class MockTestBulletinRepository extends MockBulletinRepository {
+
+        List<Bulletin> bulletinList;
+
+        public MockTestBulletinRepository() {
+            bulletinList = new ArrayList<>();
+        }
+
+        @Override
+        public void addBulletin(Bulletin bulletin) {
+            bulletinList.add(bulletin);
+        }
+
+        public List<Bulletin> findBulletinsForGroupBySource(String groupId) {
+            List<Bulletin> ans  = new ArrayList<Bulletin>();

Review Comment:
   Can be simplified
   
   List<Bulletin> ans = new ArrayList<>();



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/StandardNiFiServiceFacadeTest.java:
##########
@@ -555,4 +583,179 @@ private RemoteProcessGroupDTO createRemoteProcessGroupDTO(String id, boolean tra
 
         return remoteProcessGroup;
     }
+
+
+    @Test
+    public void testUpdateProcessGroup_WithProcessorBulletin() {
+        //GIVEN
+        final String groupId = UUID.randomUUID().toString();
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName(GROUP_NAME_1);
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+        final DtoFactory dtoFactory = new DtoFactory();
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);

Review Comment:
   This factory is used only here, seems redundant, mock already similar one.



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/StandardNiFiServiceFacadeTest.java:
##########
@@ -555,4 +583,179 @@ private RemoteProcessGroupDTO createRemoteProcessGroupDTO(String id, boolean tra
 
         return remoteProcessGroup;
     }
+
+
+    @Test
+    public void testUpdateProcessGroup_WithProcessorBulletin() {
+        //GIVEN
+        final String groupId = UUID.randomUUID().toString();
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName(GROUP_NAME_1);
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+        final DtoFactory dtoFactory = new DtoFactory();
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(groupId, GROUP_NAME_1, PROCESSOR_ID_1,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_1,BULLETIN_CATEGORY,BULLETIN_SEVERITY,BULLETIN_MESSAGE_1,PATH_TO_GROUP_1));
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(RANDOM_GROUP_ID,GROUP_NAME_2, PROCESSOR_ID_2,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_2, BULLETIN_CATEGORY,BULLETIN_SEVERITY, BULLETIN_MESSAGE_2,PATH_TO_GROUP_2));
+        //WHEN
+        ProcessGroupEntity result = serviceFacadeSpy.updateProcessGroup(revision, processGroupDTO);
+        //THEN
+        Assert.assertNotNull(result);
+        Assert.assertEquals(1,result.getBulletins().size());
+        Assert.assertEquals(groupId,result.getBulletins().get(0).getGroupId());
+    }
+
+    @Test
+    public void testUpdateProcessGroup_WithNoBulletinForProcessGroup() {
+
+        //GIVEN
+
+        final String groupId = UUID.randomUUID().toString();
+
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName("group-name-1");
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+
+        final DtoFactory dtoFactory = new DtoFactory();
+
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(RANDOM_GROUP_ID,GROUP_NAME_2, PROCESSOR_ID_2,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_2, BULLETIN_CATEGORY,BULLETIN_SEVERITY, BULLETIN_MESSAGE_2,PATH_TO_GROUP_2));
+
+        //WHEN
+        ProcessGroupEntity result = serviceFacadeSpy.updateProcessGroup(revision, processGroupDTO);
+
+        //THEN
+        Assert.assertNotNull(result);
+        Assert.assertEquals(0,result.getBulletins().size());
+    }
+
+    @Test
+    public void testUpdateProcessGroup_WithProcessorGroupBulletin() {
+
+        //GIVEN

Review Comment:
   Unnecessary empt line before and after //Given



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/StandardNiFiServiceFacadeTest.java:
##########
@@ -555,4 +583,179 @@ private RemoteProcessGroupDTO createRemoteProcessGroupDTO(String id, boolean tra
 
         return remoteProcessGroup;
     }
+
+
+    @Test
+    public void testUpdateProcessGroup_WithProcessorBulletin() {
+        //GIVEN
+        final String groupId = UUID.randomUUID().toString();
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName(GROUP_NAME_1);
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+        final DtoFactory dtoFactory = new DtoFactory();
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(groupId, GROUP_NAME_1, PROCESSOR_ID_1,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_1,BULLETIN_CATEGORY,BULLETIN_SEVERITY,BULLETIN_MESSAGE_1,PATH_TO_GROUP_1));
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(RANDOM_GROUP_ID,GROUP_NAME_2, PROCESSOR_ID_2,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_2, BULLETIN_CATEGORY,BULLETIN_SEVERITY, BULLETIN_MESSAGE_2,PATH_TO_GROUP_2));
+        //WHEN

Review Comment:
   Can you make these lines more readable 621-623.
   
   Also, please add empty line before `//WHEN` 



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/StandardNiFiServiceFacadeTest.java:
##########
@@ -555,4 +583,179 @@ private RemoteProcessGroupDTO createRemoteProcessGroupDTO(String id, boolean tra
 
         return remoteProcessGroup;
     }
+
+
+    @Test
+    public void testUpdateProcessGroup_WithProcessorBulletin() {
+        //GIVEN
+        final String groupId = UUID.randomUUID().toString();
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName(GROUP_NAME_1);
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+        final DtoFactory dtoFactory = new DtoFactory();
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(groupId, GROUP_NAME_1, PROCESSOR_ID_1,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_1,BULLETIN_CATEGORY,BULLETIN_SEVERITY,BULLETIN_MESSAGE_1,PATH_TO_GROUP_1));
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(RANDOM_GROUP_ID,GROUP_NAME_2, PROCESSOR_ID_2,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_2, BULLETIN_CATEGORY,BULLETIN_SEVERITY, BULLETIN_MESSAGE_2,PATH_TO_GROUP_2));
+        //WHEN
+        ProcessGroupEntity result = serviceFacadeSpy.updateProcessGroup(revision, processGroupDTO);
+        //THEN
+        Assert.assertNotNull(result);
+        Assert.assertEquals(1,result.getBulletins().size());
+        Assert.assertEquals(groupId,result.getBulletins().get(0).getGroupId());
+    }
+
+    @Test
+    public void testUpdateProcessGroup_WithNoBulletinForProcessGroup() {
+
+        //GIVEN
+
+        final String groupId = UUID.randomUUID().toString();
+
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName("group-name-1");
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+
+        final DtoFactory dtoFactory = new DtoFactory();
+
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(RANDOM_GROUP_ID,GROUP_NAME_2, PROCESSOR_ID_2,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_2, BULLETIN_CATEGORY,BULLETIN_SEVERITY, BULLETIN_MESSAGE_2,PATH_TO_GROUP_2));
+
+        //WHEN
+        ProcessGroupEntity result = serviceFacadeSpy.updateProcessGroup(revision, processGroupDTO);
+
+        //THEN
+        Assert.assertNotNull(result);
+        Assert.assertEquals(0,result.getBulletins().size());
+    }
+
+    @Test
+    public void testUpdateProcessGroup_WithProcessorGroupBulletin() {
+
+        //GIVEN
+
+        final String groupId = UUID.randomUUID().toString();
+
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName("group-name-1");
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+
+        final DtoFactory dtoFactory = new DtoFactory();
+
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);

Review Comment:
   This factory is used only here, seems redundant, mock already similar one.



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/StandardNiFiServiceFacadeTest.java:
##########
@@ -555,4 +583,179 @@ private RemoteProcessGroupDTO createRemoteProcessGroupDTO(String id, boolean tra
 
         return remoteProcessGroup;
     }
+

Review Comment:
   Unnecessary empty line



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/StandardNiFiServiceFacadeTest.java:
##########
@@ -555,4 +583,179 @@ private RemoteProcessGroupDTO createRemoteProcessGroupDTO(String id, boolean tra
 
         return remoteProcessGroup;
     }
+
+
+    @Test
+    public void testUpdateProcessGroup_WithProcessorBulletin() {
+        //GIVEN
+        final String groupId = UUID.randomUUID().toString();
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName(GROUP_NAME_1);
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+        final DtoFactory dtoFactory = new DtoFactory();
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);
+
+        MockTestBulletinRepository bulletinRepository = new MockTestBulletinRepository();
+        serviceFacadeSpy.setBulletinRepository(bulletinRepository);
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(groupId, GROUP_NAME_1, PROCESSOR_ID_1,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_1,BULLETIN_CATEGORY,BULLETIN_SEVERITY,BULLETIN_MESSAGE_1,PATH_TO_GROUP_1));
+        bulletinRepository.addBulletin(BulletinFactory.createBulletin(RANDOM_GROUP_ID,GROUP_NAME_2, PROCESSOR_ID_2,
+        ComponentType.PROCESSOR,PROCESSOR_NAME_2, BULLETIN_CATEGORY,BULLETIN_SEVERITY, BULLETIN_MESSAGE_2,PATH_TO_GROUP_2));
+        //WHEN
+        ProcessGroupEntity result = serviceFacadeSpy.updateProcessGroup(revision, processGroupDTO);
+        //THEN
+        Assert.assertNotNull(result);
+        Assert.assertEquals(1,result.getBulletins().size());
+        Assert.assertEquals(groupId,result.getBulletins().get(0).getGroupId());
+    }
+
+    @Test
+    public void testUpdateProcessGroup_WithNoBulletinForProcessGroup() {
+
+        //GIVEN
+
+        final String groupId = UUID.randomUUID().toString();
+
+        final ProcessGroup processGroup = mock(ProcessGroup.class);
+        when(processGroup.getIdentifier()).thenReturn(groupId);
+
+        ProcessGroupStatus processGroupStatus = new ProcessGroupStatus();
+        processGroupStatus.setId(groupId);
+        processGroupStatus.setName("group-name-1");
+
+        final ControllerFacade controllerFacade = mock(ControllerFacade.class);
+        when(controllerFacade.getProcessGroupStatus(any())).thenReturn(processGroupStatus);
+
+        final StandardNiFiServiceFacade serviceFacadeSpy = spy(serviceFacade);
+        serviceFacadeSpy.setControllerFacade(controllerFacade);
+
+        final DtoFactory dtoFactory = new DtoFactory();
+
+        ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
+        processGroupDTO.setId(groupId);
+        when(processGroupDAO.getProcessGroup(groupId)).thenReturn(processGroup);
+        when(processGroupDAO.updateProcessGroup(processGroupDTO)).thenReturn(processGroup);
+
+        final RevisionManager revisionManager = mock(RevisionManager.class);
+        Revision revision = new Revision(1L,"a","b");
+        final FlowModification lastModification = new FlowModification(revision,"a");
+
+        RevisionUpdate<Object> snapshot = new StandardRevisionUpdate<>(processGroupDTO,lastModification);
+        when(revisionManager.updateRevision(any(),any(),any())).thenReturn((RevisionUpdate<Object> )snapshot);
+
+        serviceFacadeSpy.setRevisionManager(revisionManager);
+        serviceFacadeSpy.setDtoFactory(dtoFactory);

Review Comment:
   This factory is used only here, seems redundant, mock already similar one.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org