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/11/11 12:25:52 UTC

[GitHub] [nifi] krisztina-zsihovszki opened a new pull request, #6653: NIFI-10793 Comment is not populated when process group is created via…

krisztina-zsihovszki opened a new pull request, #6653:
URL: https://github.com/apache/nifi/pull/6653

   … API
   
   <!-- 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-10793](https://issues.apache.org/jira/browse/NIFI-10793)
   
   # Tracking
   
   Please complete the following tracking steps prior to pull request creation.
   
   ### Issue Tracking
   
   - [x] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue created
   
   ### Pull Request Tracking
   
   - [x] Pull Request title starts with Apache NiFi Jira issue number, such as `NIFI-00000`
   - [x] Pull Request commit message starts with Apache NiFi Jira issue number, as such `NIFI-00000`
   
   ### Pull Request Formatting
   
   - [x] Pull Request based on current revision of the `main` branch
   - [x] 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
   
   - [x] 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] asfgit closed pull request #6653: NIFI-10793 Comment is not populated when process group is created via…

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #6653: NIFI-10793 Comment is not populated when process group is created via…
URL: https://github.com/apache/nifi/pull/6653


-- 
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] tpalfy commented on a diff in pull request #6653: NIFI-10793 Comment is not populated when process group is created via…

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


##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/dao/impl/TestStandardProcessGroupDAO.java:
##########
@@ -0,0 +1,82 @@
+/*
+ * 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.
+ */
+
+package org.apache.nifi.web.dao.impl;

Review Comment:
   In general mock is best left to be used for logic, not data. Data structures can simply be created.
   
   ```java
   /*
    * 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.
    */
   
   package org.apache.nifi.web.dao.impl;
   
   import org.apache.nifi.connectable.Position;
   import org.apache.nifi.controller.FlowController;
   import org.apache.nifi.groups.ProcessGroup;
   import org.apache.nifi.parameter.ParameterContext;
   import org.apache.nifi.web.api.dto.PositionDTO;
   import org.apache.nifi.web.api.dto.ProcessGroupDTO;
   import org.apache.nifi.web.api.entity.ParameterContextReferenceEntity;
   import org.junit.jupiter.api.BeforeEach;
   import org.junit.jupiter.api.Test;
   import org.mockito.Answers;
   import org.mockito.Mock;
   import org.mockito.MockitoAnnotations;
   
   import static org.mockito.ArgumentMatchers.any;
   import static org.mockito.Mockito.verify;
   import static org.mockito.Mockito.when;
   
   public class TestStandardProcessGroupDAO {
       private static final String PARENT_PROCESS_GROUP_ID = "parentId";
       private static final String PROCESS_GROUP_ID = "pgId";
       private static final String PROCESS_GROUP_NAME = "pgName";
       private static final String PROCESS_GROUP_COMMENTS = "This is a comment";
       private static final String PARAMETER_CONTEXT_ID = "paramContext";
   
       private StandardProcessGroupDAO testSubject;
   
       @Mock(answer = Answers.RETURNS_DEEP_STUBS)
       private FlowController flowController;
   
       @Mock
       private ProcessGroup parentProcessGroup;
       @Mock
       private ParameterContext parameterContext;
   
       @BeforeEach
       void setUp() {
           MockitoAnnotations.openMocks(this);
   
           testSubject = new StandardProcessGroupDAO();
           testSubject.setFlowController(flowController);
   
           when(flowController
                   .getFlowManager()
                   .getGroup(PARENT_PROCESS_GROUP_ID)
           ).thenReturn(parentProcessGroup);
   
           when(flowController
                   .getFlowManager()
                   .getParameterContextManager()
                   .getParameterContext(PARAMETER_CONTEXT_ID)
           ).thenReturn(parameterContext);
       }
   
       @Test
       public void testCreateProcessGroup() {
           // GIVEN
           ParameterContextReferenceEntity parameterContextReferenceEntity = new ParameterContextReferenceEntity();
           parameterContextReferenceEntity.setId(PARAMETER_CONTEXT_ID);
   
           ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
           processGroupDTO.setId(PROCESS_GROUP_ID);
           processGroupDTO.setName(PROCESS_GROUP_NAME);
           processGroupDTO.setComments(PROCESS_GROUP_COMMENTS);
           processGroupDTO.setPosition(new PositionDTO(10.0, 20.0));
           processGroupDTO.setParameterContext(parameterContextReferenceEntity);
   
           // WHEN
           ProcessGroup createdProcessGroup = testSubject.createProcessGroup(PARENT_PROCESS_GROUP_ID, processGroupDTO);
   
           // THEN
           verify(createdProcessGroup).setParent(parentProcessGroup);
           verify(createdProcessGroup).setParameterContext(parameterContext);
           verify(createdProcessGroup).setName(PROCESS_GROUP_NAME);
           verify(createdProcessGroup).setComments(PROCESS_GROUP_COMMENTS);
           verify(createdProcessGroup).setPosition(any(Position.class));
   
           verify(parentProcessGroup).addProcessGroup(createdProcessGroup);
       }
   }
   ```



-- 
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] tpalfy commented on a diff in pull request #6653: NIFI-10793 Comment is not populated when process group is created via…

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


##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/dao/impl/TestStandardProcessGroupDAO.java:
##########
@@ -0,0 +1,82 @@
+/*
+ * 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.
+ */
+
+package org.apache.nifi.web.dao.impl;

Review Comment:
   In general mock is best left to be used for logic, not data. Data structures can simply be created.
   
   ```java
   /*
    * 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.
    */
   
   package org.apache.nifi.web.dao.impl;
   
   import org.apache.nifi.connectable.Position;
   import org.apache.nifi.controller.FlowController;
   import org.apache.nifi.groups.ProcessGroup;
   import org.apache.nifi.parameter.ParameterContext;
   import org.apache.nifi.web.api.dto.PositionDTO;
   import org.apache.nifi.web.api.dto.ProcessGroupDTO;
   import org.apache.nifi.web.api.entity.ParameterContextReferenceEntity;
   import org.junit.jupiter.api.BeforeEach;
   import org.junit.jupiter.api.Test;
   import org.mockito.Answers;
   import org.mockito.Mock;
   import org.mockito.MockitoAnnotations;
   
   import static org.mockito.ArgumentMatchers.any;
   import static org.mockito.Mockito.verify;
   import static org.mockito.Mockito.when;
   
   public class TestStandardProcessGroupDAO {
       private static final String PARENT_PROCESS_GROUP_ID = "parentId";
       private static final String PROCESS_GROUP_ID = "pgId";
       private static final String PROCESS_GROUP_NAME = "pgName";
       private static final String PROCESS_GROUP_COMMENTS = "This is a comment";
       private static final String PARAMETER_CONTEXT_ID = "paramContext";
   
       private StandardProcessGroupDAO testSubject;
   
       @Mock(answer = Answers.RETURNS_DEEP_STUBS)
       private FlowController flowController;
   
       @Mock
       private ProcessGroup parentProcessGroup;
       @Mock
       private ParameterContext parameterContext;
   
       @BeforeEach
       void setUp() {
           MockitoAnnotations.openMocks(this);
   
           testSubject = new StandardProcessGroupDAO();
           testSubject.setFlowController(flowController);
       }
   
       @Test
       public void testCreateProcessGroup() {
           // GIVEN
           ParameterContextReferenceEntity parameterContextReferenceEntity = new ParameterContextReferenceEntity();
           parameterContextReferenceEntity.setId(PARAMETER_CONTEXT_ID);
   
           ProcessGroupDTO processGroupDTO = new ProcessGroupDTO();
           processGroupDTO.setId(PROCESS_GROUP_ID);
           processGroupDTO.setName(PROCESS_GROUP_NAME);
           processGroupDTO.setComments(PROCESS_GROUP_COMMENTS);
           processGroupDTO.setPosition(new PositionDTO(10.0, 20.0));
           processGroupDTO.setParameterContext(parameterContextReferenceEntity);
   
           when(flowController
                   .getFlowManager()
                   .getGroup(PARENT_PROCESS_GROUP_ID)
           ).thenReturn(parentProcessGroup);
   
           when(flowController
                   .getFlowManager()
                   .getParameterContextManager()
                   .getParameterContext(PARAMETER_CONTEXT_ID)
           ).thenReturn(parameterContext);
   
           // WHEN
           ProcessGroup createdProcessGroup = testSubject.createProcessGroup(PARENT_PROCESS_GROUP_ID, processGroupDTO);
   
           // THEN
           verify(createdProcessGroup).setParent(parentProcessGroup);
           verify(createdProcessGroup).setParameterContext(parameterContext);
           verify(createdProcessGroup).setName(PROCESS_GROUP_NAME);
           verify(createdProcessGroup).setComments(PROCESS_GROUP_COMMENTS);
           verify(createdProcessGroup).setPosition(any(Position.class));
   
           verify(parentProcessGroup).addProcessGroup(createdProcessGroup);
       }
   }
   
   ```



-- 
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] tpalfy commented on pull request #6653: NIFI-10793 Comment is not populated when process group is created via…

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

   LGTM
   Thank you for your work @krisztina-zsihovszki!
   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