Search in sources :

Example 6 with NiFiWebRequestContext

use of org.apache.nifi.web.NiFiWebRequestContext in project nifi by apache.

the class TestProcessorWebUtils method testGetRequestContextForProcessorWithSpecificClientRevision.

@Test
@SuppressWarnings("unchecked")
public void testGetRequestContextForProcessorWithSpecificClientRevision() throws NoSuchMethodException, IOException, InvocationTargetException, IllegalAccessException {
    Method method = ProcessorWebUtils.class.getDeclaredMethod("getRequestContext", String.class, Long.class, String.class, HttpServletRequest.class);
    method.setAccessible(true);
    NiFiWebRequestContext requestContext = (NiFiWebRequestContext) method.invoke(null, "1", 1L, "client1", mock(HttpServletRequest.class));
    assertTrue(requestContext instanceof HttpServletConfigurationRequestContext);
    assertTrue(requestContext.getId().equals("1"));
    assertTrue(((HttpServletConfigurationRequestContext) requestContext).getRevision().getClientId().equals("client1"));
    assertTrue(((HttpServletConfigurationRequestContext) requestContext).getRevision().getVersion().equals(1L));
}
Also used : Method(java.lang.reflect.Method) HttpServletConfigurationRequestContext(org.apache.nifi.web.HttpServletConfigurationRequestContext) NiFiWebRequestContext(org.apache.nifi.web.NiFiWebRequestContext) Test(org.junit.Test)

Aggregations

NiFiWebRequestContext (org.apache.nifi.web.NiFiWebRequestContext)6 GET (javax.ws.rs.GET)4 Path (javax.ws.rs.Path)4 Produces (javax.ws.rs.Produces)4 ResponseBuilder (javax.ws.rs.core.Response.ResponseBuilder)4 Criteria (org.apache.nifi.update.attributes.Criteria)4 NiFiWebConfigurationContext (org.apache.nifi.web.NiFiWebConfigurationContext)4 Rule (org.apache.nifi.update.attributes.Rule)3 RuleDTO (org.apache.nifi.update.attributes.dto.RuleDTO)3 Method (java.lang.reflect.Method)2 RulesEntity (org.apache.nifi.update.attributes.entity.RulesEntity)2 Test (org.junit.Test)2 Collator (java.text.Collator)1 NotFoundException (javax.ws.rs.NotFoundException)1 EvaluationContextEntity (org.apache.nifi.update.attributes.entity.EvaluationContextEntity)1 RuleEntity (org.apache.nifi.update.attributes.entity.RuleEntity)1 HttpServletConfigurationRequestContext (org.apache.nifi.web.HttpServletConfigurationRequestContext)1 HttpServletRequestContext (org.apache.nifi.web.HttpServletRequestContext)1