use of org.apache.nifi.web.ComponentDetails in project nifi by apache.
the class TestTransformJSONResource method testValidateWithCustomInvalidSpec.
@Test
public void testValidateWithCustomInvalidSpec() {
final NiFiWebConfigurationContext niFiWebConfigurationContext = mock(NiFiWebConfigurationContext.class);
final Map<String, String> properties = new HashMap<>();
properties.put("jolt-transform", "jolt-transform-custom");
final ComponentDetails componentDetails = new ComponentDetails.Builder().properties(properties).build();
Mockito.when(servletContext.getAttribute(Mockito.anyString())).thenReturn(niFiWebConfigurationContext);
Mockito.when(niFiWebConfigurationContext.getComponentDetails(any(NiFiWebRequestContext.class))).thenReturn(componentDetails);
JoltSpecificationDTO joltSpecificationDTO = new JoltSpecificationDTO("jolt-transform-custom", "{ \"operation\": \"default\", \"spec\":{ \"custom-id\" :4 }}");
joltSpecificationDTO.setCustomClass("TestCustomJoltTransform");
joltSpecificationDTO.setModules("src/test/resources/TestTransformJSONResource/TestCustomJoltTransform.jar");
ValidationDTO validate = client().target(getBaseUri()).path("/standard/transformjson/validate").request().post(Entity.json(joltSpecificationDTO), ValidationDTO.class);
assertNotNull(validate);
assertTrue(!validate.isValid());
}
Aggregations