use of org.apache.nifi.web.ComponentDescriptor in project nifi by apache.
the class TestProcessorResource method testGetProcessorDetails.
@Test
public void testGetProcessorDetails() {
final NiFiWebConfigurationContext niFiWebConfigurationContext = mock(NiFiWebConfigurationContext.class);
final Map<String, String> allowableValues = new HashMap<>();
final ComponentDescriptor descriptor = new ComponentDescriptor.Builder().name("test-name").allowableValues(allowableValues).build();
final Map<String, ComponentDescriptor> descriptors = new HashMap<>();
descriptors.put("jolt-transform", descriptor);
final ComponentDetails componentDetails = new ComponentDetails.Builder().name("mytransform").type("org.apache.nifi.processors.standard.JoltTransformJSON").descriptors(descriptors).build();
Mockito.when(servletContext.getAttribute(Mockito.anyString())).thenReturn(niFiWebConfigurationContext);
Mockito.when(niFiWebConfigurationContext.getComponentDetails(any(NiFiWebRequestContext.class))).thenReturn(componentDetails);
JsonNode value = client().target(getBaseUri()).path("/standard/processor/details").queryParam("processorId", "1").request().get(JsonNode.class);
assertNotNull(value);
try {
assertTrue(value.get("name").asText().equals("mytransform"));
} catch (Exception e) {
fail("Failed due to: " + e.toString());
}
}
Aggregations