@Test public void testSetProperties() throws JSONException{ 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); ClientResponse response = client().resource(getBaseURI()).path("/standard/processor/properties") .queryParam("processorId","1") .queryParam("clientId","1") .queryParam("revisionId","1") .type(MediaType.APPLICATION_JSON_TYPE) .put(ClientResponse.class,JsonUtils.toJsonString(properties)); assertNotNull(response); JSONObject jsonObject = response.getEntity(JSONObject.class); assertNotNull(jsonObject); assertTrue(jsonObject.getJSONObject("properties").get("jolt-transform").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, Map<String,String> properties){ final NiFiWebConfigurationContext nifiWebContext = getWebConfigurationContext(); final NiFiWebConfigurationRequestContext niFiRequestContext = ProcessorWebUtils.getRequestContext(processorId,revisionId,clientId,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, Map<String,String> properties){ final NiFiWebConfigurationContext nifiWebContext = getWebConfigurationContext(); final NiFiWebConfigurationRequestContext niFiRequestContext = ProcessorWebUtils.getRequestContext(processorId,revisionId,clientId,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, Map<String,String> properties){ final NiFiWebConfigurationContext nifiWebContext = getWebConfigurationContext(); final NiFiWebConfigurationRequestContext niFiRequestContext = ProcessorWebUtils.getRequestContext(processorId,revisionId,clientId,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, Map<String,String> properties){ final NiFiWebConfigurationContext nifiWebContext = getWebConfigurationContext(); final NiFiWebConfigurationRequestContext niFiRequestContext = ProcessorWebUtils.getRequestContext(processorId,revisionId,clientId,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, 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, Map<String,String> properties){ final NiFiWebConfigurationContext nifiWebContext = getWebConfigurationContext(); final NiFiWebConfigurationRequestContext niFiRequestContext = ProcessorWebUtils.getRequestContext(processorId,revisionId,clientId,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, Map<String,String> properties);  }