本文整理了Java中com.netflix.zuul.scriptManager.ZuulFilterDAO.getFilterIdsIndex()
方法的一些代码示例,展示了ZuulFilterDAO.getFilterIdsIndex()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZuulFilterDAO.getFilterIdsIndex()
方法的具体详情如下:
包路径:com.netflix.zuul.scriptManager.ZuulFilterDAO
类名称:ZuulFilterDAO
方法名:getFilterIdsIndex
暂无
代码示例来源:origin: com.netflix.zuul/zuul-netflix
@SuppressWarnings("unchecked")
@Test
public void testGetFilterIdsIndex() {
ZuulFilterDAO dao = new ZuulFilterDAOCassandra(gateway);
// setup empty response
String fids = "filter1|filter2|filter3";
/* create mock response data */
Row<String, String> row0 = mockRow();
ColumnList<String> columnList0 = mockColumnList(row0);
mockColumn(columnList0, "filter_ids", fids);
// when(response.getRowByIndex(0)).thenReturn(row0);
Iterator<Row<String, String>> iterator = (Iterator<Row<String, String>>) mock(Iterator.class);
when(response.iterator()).thenReturn(iterator);
when(iterator.hasNext()).thenReturn(true, false); // 1 row
when(iterator.next()).thenReturn(row0, (Row) null);
when(gateway.select(anyString())).thenReturn(response);
when(response.isEmpty()).thenReturn(false);
when(response.size()).thenReturn(1);
/* exercise the method we're testing */
List<String> list = dao.getFilterIdsIndex("index");
/* validate responses */
assertEquals(list.size(), 3);
assertEquals(list.get(0), "filter1");
assertEquals(list.get(1), "filter2");
assertEquals(list.get(2), "filter3");
}
代码示例来源:origin: com.netflix.zuul/zuul-core
@SuppressWarnings("unchecked")
@Test
public void testGetFilterIdsIndex() {
ZuulFilterDAO dao = new ZuulFilterDAOCassandra(gateway);
// setup empty response
String fids = "filter1|filter2|filter3";
/* create mock response data */
Row<String, String> row0 = mockRow();
ColumnList<String> columnList0 = mockColumnList(row0);
mockColumn(columnList0, "filter_ids", fids);
// when(response.getRowByIndex(0)).thenReturn(row0);
Iterator<Row<String, String>> iterator = (Iterator<Row<String, String>>) mock(Iterator.class);
when(response.iterator()).thenReturn(iterator);
when(iterator.hasNext()).thenReturn(true, false); // 1 row
when(iterator.next()).thenReturn(row0, (Row) null);
when(gateway.select(anyString())).thenReturn(response);
when(response.isEmpty()).thenReturn(false);
when(response.size()).thenReturn(1);
/* exercise the method we're testing */
List<String> list = dao.getFilterIdsIndex("index");
/* validate responses */
assertEquals(list.size(), 3);
assertEquals(list.get(0), "filter1");
assertEquals(list.get(1), "filter2");
assertEquals(list.get(2), "filter3");
}
内容来源于网络,如有侵权,请联系作者删除!