@Test public void testSetProperties() { final NiFiWebConfigurationContext niFiWebConfigurationContext = mock(NiFiWebConfigurationContext.class); final Map<String,String> properties = new HashMap<>(); properties.put("jolt-transform","jolt-transform-chain"); final ComponentDetails componentDetails = new ComponentDetails.Builder().properties(properties).build(); Mockito.when(servletContext.getAttribute(Mockito.anyString())).thenReturn(niFiWebConfigurationContext); Mockito.when(niFiWebConfigurationContext.updateComponent(any(NiFiWebConfigurationRequestContext.class),any(String.class),any(Map.class))).thenReturn(componentDetails); Response response = client().target(getBaseUri()) .path("/standard/processor/properties") .queryParam("processorId","1") .queryParam("clientId","1") .queryParam("revisionId","1") .request() .put(Entity.json(JsonUtils.toJsonString(properties))); assertNotNull(response); JsonNode jsonNode = response.readEntity(JsonNode.class); assertNotNull(jsonNode); assertTrue(jsonNode.get("properties").get("jolt-transform").asText().equals("jolt-transform-chain")); }
@PUT @Produces({MediaType.APPLICATION_JSON}) @Consumes({MediaType.APPLICATION_JSON}) @Path("/properties") public Response setProperties(@QueryParam("processorId") final String processorId, @QueryParam("revisionId") final Long revisionId, @QueryParam("clientId") final String clientId, @QueryParam("disconnectedNodeAcknowledged") final Boolean isDisconnectionAcknowledged, Map<String,String> properties){ final NiFiWebConfigurationContext nifiWebContext = getWebConfigurationContext(); final NiFiWebConfigurationRequestContext niFiRequestContext = ProcessorWebUtils.getRequestContext(processorId,revisionId,clientId,isDisconnectionAcknowledged,request); final ComponentDetails componentDetails = nifiWebContext.updateComponent(niFiRequestContext,null,properties); final Response.ResponseBuilder response = ProcessorWebUtils.applyCacheControl(Response.ok(componentDetails)); return response.build(); }
ProcessorResource extends AbstractStandardResource { @PUT @Produces({MediaType.APPLICATION_JSON}) @Consumes({MediaType.APPLICATION_JSON}) @Path("/properties") public Response setProperties(@QueryParam("processorId") final String processorId, @QueryParam("revisionId") final Long revisionId, @QueryParam("clientId") final String clientId, @QueryParam("disconnectedNodeAcknowledged") final Boolean isDisconnectionAcknowledged, Map<String,String> properties){ final NiFiWebConfigurationContext nifiWebContext = getWebConfigurationContext(); final NiFiWebConfigurationRequestContext niFiRequestContext = ProcessorWebUtils.getRequestContext(processorId,revisionId,clientId,isDisconnectionAcknowledged,request); final ComponentDetails componentDetails = nifiWebContext.updateComponent(niFiRequestContext,null,properties); final Response.ResponseBuilder response = ProcessorWebUtils.applyCacheControl(Response.ok(componentDetails)); return response.build(); } }
ProcessorResource extends AbstractStandardResource { @PUT @Produces({MediaType.APPLICATION_JSON}) @Consumes({MediaType.APPLICATION_JSON}) @Path("/properties") public Response setProperties(@QueryParam("processorId") final String processorId, @QueryParam("revisionId") final Long revisionId, @QueryParam("clientId") final String clientId, @QueryParam("disconnectedNodeAcknowledged") final Boolean isDisconnectionAcknowledged, Map<String,String> properties){ final NiFiWebConfigurationContext nifiWebContext = getWebConfigurationContext(); final NiFiWebConfigurationRequestContext niFiRequestContext = ProcessorWebUtils.getRequestContext(processorId,revisionId,clientId,isDisconnectionAcknowledged,request); final ComponentDetails componentDetails = nifiWebContext.updateComponent(niFiRequestContext,null,properties); final Response.ResponseBuilder response = ProcessorWebUtils.applyCacheControl(Response.ok(componentDetails)); return response.build(); }  }
ProcessorResource extends AbstractStandardResource { @PUT @Produces({MediaType.APPLICATION_JSON}) @Consumes({MediaType.APPLICATION_JSON}) @Path("/properties") public Response setProperties(@QueryParam("processorId") final String processorId, @QueryParam("revisionId") final Long revisionId, @QueryParam("clientId") final String clientId, @QueryParam("disconnectedNodeAcknowledged") final Boolean isDisconnectionAcknowledged, Map<String,String> properties){ final NiFiWebConfigurationContext nifiWebContext = getWebConfigurationContext(); final NiFiWebConfigurationRequestContext niFiRequestContext = ProcessorWebUtils.getRequestContext(processorId,revisionId,clientId,isDisconnectionAcknowledged,request); final ComponentDetails componentDetails = nifiWebContext.updateComponent(niFiRequestContext,null,properties); final Response.ResponseBuilder response = ProcessorWebUtils.applyCacheControl(Response.ok(componentDetails)); return response.build(); }  @GET @Produces({MediaType.APPLICATION_JSON}) @Path("/details") Response getDetails(@QueryParam("processorId") final String processorId); @PUT @Produces({MediaType.APPLICATION_JSON}) @Consumes({MediaType.APPLICATION_JSON}) @Path("/properties") Response setProperties(@QueryParam("processorId") final String processorId, @QueryParam("revisionId") final Long revisionId,
                                  @QueryParam("clientId") final String clientId, @QueryParam("disconnectedNodeAcknowledged") final Boolean isDisconnectionAcknowledged,
                                  Map<String,String> properties); }
ProcessorResource extends AbstractStandardResource { @PUT @Produces({MediaType.APPLICATION_JSON}) @Consumes({MediaType.APPLICATION_JSON}) @Path("/properties") public Response setProperties(@QueryParam("processorId") final String processorId, @QueryParam("revisionId") final Long revisionId, @QueryParam("clientId") final String clientId, @QueryParam("disconnectedNodeAcknowledged") final Boolean isDisconnectionAcknowledged, Map<String,String> properties){ final NiFiWebConfigurationContext nifiWebContext = getWebConfigurationContext(); final NiFiWebConfigurationRequestContext niFiRequestContext = ProcessorWebUtils.getRequestContext(processorId,revisionId,clientId,isDisconnectionAcknowledged,request); final ComponentDetails componentDetails = nifiWebContext.updateComponent(niFiRequestContext,null,properties); final Response.ResponseBuilder response = ProcessorWebUtils.applyCacheControl(Response.ok(componentDetails)); return response.build(); }  @GET @Produces({MediaType.APPLICATION_JSON}) @Path("/details") Response getDetails(@QueryParam("processorId") final String processorId); @PUT @Produces({MediaType.APPLICATION_JSON}) @Consumes({MediaType.APPLICATION_JSON}) @Path("/properties") Response setProperties(@QueryParam("processorId") final String processorId, @QueryParam("revisionId") final Long revisionId,
                                  @QueryParam("clientId") final String clientId, @QueryParam("disconnectedNodeAcknowledged") final Boolean isDisconnectionAcknowledged,
                                  Map<String,String> properties);  }