Search in sources :

Example 1 with HttpServletConfigurationRequestContext

use of org.apache.nifi.web.HttpServletConfigurationRequestContext 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

Method (java.lang.reflect.Method)1 HttpServletConfigurationRequestContext (org.apache.nifi.web.HttpServletConfigurationRequestContext)1 NiFiWebRequestContext (org.apache.nifi.web.NiFiWebRequestContext)1 Test (org.junit.Test)1