本文整理了Java中com.netflix.zuul.scriptManager.ZuulFilterDAO.getFilterInfoForFilter()
方法的一些代码示例,展示了ZuulFilterDAO.getFilterInfoForFilter()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZuulFilterDAO.getFilterInfoForFilter()
方法的具体详情如下:
包路径:com.netflix.zuul.scriptManager.ZuulFilterDAO
类名称:ZuulFilterDAO
方法名:getFilterInfoForFilter
暂无
代码示例来源:origin: com.netflix.zuul/zuul-netflix
@Test
public void testDownloadSingleScriptRevision() throws Exception {
/* setup mock */
String filter_id = "name:type";
String action = "DOWNLOAD";
when(request.getPathInfo()).thenReturn("?action=" + action + "&filter_id=" + filter_id + "&revision=2");
when(request.getMethod()).thenReturn("GET");
when(request.getParameter("action")).thenReturn(action);
when(request.getParameter("filter_id")).thenReturn(filter_id);
when(request.getParameter("revision")).thenReturn("2");
/* setup mock DAO */
ZuulFilterDAO dao = mock(ZuulFilterDAOCassandra.class);
FilterInfo script = mock(FilterInfo.class);
when(dao.getFilterInfoForFilter(filter_id, 2)).thenReturn(script);
String code = "code";
when(script.getFilterCode()).thenReturn(code);
FilterScriptManagerServlet servlet = getEndpointScriptManagerImplementation(dao);
servlet.service(request, response);
/* verify the default status is used */
verify(response, never()).setStatus(anyInt());
// verify mime-type
verify(response).setContentType("text/plain");
// verify the script is written to the response
verify(responseWriter).write("code");
}
代码示例来源:origin: com.netflix.zuul/zuul-netflix
@Test
public void testDownloadSingleScriptPlusErrorHandlerLatest() throws Exception {
/* setup mock */
String filter_id = "name:type";
String action = "DOWNLOAD";
when(request.getPathInfo()).thenReturn("?action=" + action + "&filter_id=" + filter_id);
when(request.getMethod()).thenReturn("GET");
when(request.getParameter("action")).thenReturn(action);
when(request.getParameter("filter_id")).thenReturn(filter_id);
/* setup mock DAO */
ZuulFilterDAO dao = mock(ZuulFilterDAOCassandra.class);
FilterInfo script = mock(FilterInfo.class);
when(dao.getLatestFilterInfoForFilter(filter_id)).thenReturn(script);
when(dao.getFilterInfoForFilter(filter_id, 2)).thenReturn(script);
when(script.getFilterCode()).thenReturn("code");
FilterScriptManagerServlet servlet = getEndpointScriptManagerImplementation(dao);
servlet.service(request, response);
/* verify the default status is used */
verify(response, never()).setStatus(anyInt());
// the writer should not be touched since we need binary, not text
verify(responseWriter).write(anyString());
}
代码示例来源:origin: com.netflix.zuul/zuul-netflix
@Test
public void testDownloadSingleScriptLatest() throws Exception {
/* setup mock */
String filter_id = "name:type";
String action = "DOWNLOAD";
when(request.getPathInfo()).thenReturn("?action=" + action + "&filter_id=" + filter_id);
when(request.getMethod()).thenReturn("GET");
when(request.getParameter("action")).thenReturn(action);
when(request.getParameter("filter_id")).thenReturn(filter_id);
/* setup mock DAO */
ZuulFilterDAO dao = mock(ZuulFilterDAOCassandra.class);
FilterInfo script = mock(FilterInfo.class);
when(dao.getLatestFilterInfoForFilter(filter_id)).thenReturn(script);
when(dao.getFilterInfoForFilter(filter_id, 2)).thenReturn(script);
when(script.getFilterCode()).thenReturn("code");
FilterScriptManagerServlet servlet = getEndpointScriptManagerImplementation(dao);
servlet.service(request, response);
/* verify the default status is used */
verify(response, never()).setStatus(anyInt());
// verify mime-type
verify(response).setContentType("text/plain");
// verify the script is written to the response
verify(responseWriter).write("code");
}
代码示例来源:origin: com.netflix.zuul/zuul-core
@Test
public void testGetScriptForEndpointAndRevisionReturnsNullWhenNotFound() {
ZuulFilterDAO dao = new ZuulFilterDAOCassandra(gateway);
// setup empty response
when(gateway.select(anyString())).thenReturn(response);
when(response.isEmpty()).thenReturn(true);
FilterInfo filterInfo = dao.getFilterInfoForFilter("/unknown/filter", 2);
assertNull(filterInfo);
}
代码示例来源:origin: com.netflix.zuul/zuul-netflix
@Test
public void testGetScriptForEndpointAndRevisionReturnsNullWhenNotFound() {
ZuulFilterDAO dao = new ZuulFilterDAOCassandra(gateway);
// setup empty response
when(gateway.select(anyString())).thenReturn(response);
when(response.isEmpty()).thenReturn(true);
FilterInfo filterInfo = dao.getFilterInfoForFilter("/unknown/filter", 2);
assertNull(filterInfo);
}
代码示例来源:origin: com.netflix.zuul/zuul-netflix
script = scriptDAO.getFilterInfoForFilter(filter_id, revisionNumber);
代码示例来源:origin: com.netflix.zuul/zuul-core
FilterInfo filterInfo = dao.getFilterInfoForFilter(filter, 3);
代码示例来源:origin: com.netflix.zuul/zuul-netflix
FilterInfo filterInfo = dao.getFilterInfoForFilter(filter, 3);
内容来源于网络,如有侵权,请联系作者删除!