com.netflix.zuul.scriptManager.ZuulFilterDAO.getFilterIdsIndex()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(99)

本文整理了Java中com.netflix.zuul.scriptManager.ZuulFilterDAO.getFilterIdsIndex()方法的一些代码示例,展示了ZuulFilterDAO.getFilterIdsIndex()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZuulFilterDAO.getFilterIdsIndex()方法的具体详情如下:
包路径:com.netflix.zuul.scriptManager.ZuulFilterDAO
类名称:ZuulFilterDAO
方法名:getFilterIdsIndex

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");
}

相关文章