rliszli commented on code in PR #6281:
URL: https://github.com/apache/nifi/pull/6281#discussion_r948702181
##########
c2/c2-client-bundle/c2-client-service/src/test/java/org/apache/nifi/c2/client/service/operation/UpdateConfigurationOperationHandlerTest.java:
##########
@@ -62,12 +61,34 @@ void testUpdateConfigurationOperationHandlerCreateSuccess()
{
}
@Test
- void testHandleThrowsExceptionForIncorrectArg() {
+ void testHandleIncorrectArg() {
UpdateConfigurationOperationHandler handler = new
UpdateConfigurationOperationHandler(null, null, null);
C2Operation operation = new C2Operation();
operation.setArgs(INCORRECT_LOCATION_MAP);
- IllegalStateException exception =
assertThrows(IllegalStateException.class, () -> handler.handle(operation));
+ C2OperationAck response = handler.handle(operation);
+
+ assertEquals(C2OperationState.OperationState.NOT_APPLIED,
response.getOperationState().getState());
+ }
+
+ @Test
+ void testHandleFlowIdInArg() {
+ Function<byte[], Boolean> successUpdate = x -> true;
+ when(flowIdHolder.getFlowId()).thenReturn(FLOW_ID);
+
when(client.retrieveUpdateContent(any())).thenReturn(Optional.of("content".getBytes()));
+ UpdateConfigurationOperationHandler handler = new
UpdateConfigurationOperationHandler(client, flowIdHolder, successUpdate);
+ C2Operation operation = new C2Operation();
+ operation.setIdentifier(OPERATION_ID);
+
+ Map<String, String> args = new HashMap<>();
+ args.putAll(INCORRECT_LOCATION_MAP);
+ args.put("flowId", "argsFlowId");
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]