本文整理了Java中com.netflix.zuul.scriptManager.ZuulFilterDAOCassandra.<init>()
方法的一些代码示例,展示了ZuulFilterDAOCassandra.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZuulFilterDAOCassandra.<init>()
方法的具体详情如下:
包路径:com.netflix.zuul.scriptManager.ZuulFilterDAOCassandra
类名称:ZuulFilterDAOCassandra
方法名:<init>
暂无
代码示例来源:origin: com.netflix.zuul/zuul-netflix
/**
* Default constructor that instantiates default dependencies (ie. the ones that are functional as opposed to those for testing).
*/
public FilterScriptManagerServlet() {
super();
if (scriptDAO == null) scriptDAO = new ZuulFilterDAOCassandra(ZuulFilterDAOCassandra.getCassKeyspace());
}
代码示例来源:origin: com.netflix.zuul/zuul-core
@Test
public void testGetScriptForLatestEndpointReturnsNullWhenNotFound() {
ZuulFilterDAO dao = new ZuulFilterDAOCassandra(gateway);
// setup empty response
when(gateway.select(anyString())).thenReturn(response);
when(response.isEmpty()).thenReturn(true);
FilterInfo filterInfo = dao.getLatestFilterInfoForFilter("/unknown/filter");
assertNull(filterInfo);
}
代码示例来源: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
@Test
public void testGetScriptForLatestEndpointReturnsNullWhenNotFound() {
ZuulFilterDAO dao = new ZuulFilterDAOCassandra(gateway);
// setup empty response
when(gateway.select(anyString())).thenReturn(response);
when(response.isEmpty()).thenReturn(true);
FilterInfo filterInfo = dao.getLatestFilterInfoForFilter("/unknown/filter");
assertNull(filterInfo);
}
代码示例来源:origin: com.netflix.zuul/zuul-netflix
/**
* We don't want a NULL when there are no Filters, instead we want an empty list.
*/
@Test
public void testGetAllFiltersReturnsEmptyListInsteadOfNullWhenNoFilters() {
ZuulFilterDAO dao = new ZuulFilterDAOCassandra(gateway);
// setup empty response
when(gateway.select(anyString())).thenReturn(response);
when(response.isEmpty()).thenReturn(true);
List<String> list = dao.getAllFilterIDs();
assertNotNull(list);
assertEquals(0, list.size());
}
代码示例来源:origin: com.netflix.zuul/zuul-netflix
/**
* We don't want a NULL when an filter is not found, instead we want an empty list.
*/
@Test
public void testGetScriptForEndpointReturnsEmptyListInsteadOfNullWhenEndpointNotFound() {
ZuulFilterDAO dao = new ZuulFilterDAOCassandra(gateway);
// setup empty response
when(gateway.select(anyString())).thenReturn(response);
when(response.isEmpty()).thenReturn(true);
List<FilterInfo> list = dao.getZuulFiltersForFilterId("/unknown/Filter");
assertNotNull(list);
assertEquals(0, list.size());
}
代码示例来源:origin: com.netflix.zuul/zuul-core
/**
* We don't want a NULL when an filter is not found, instead we want an empty list.
*/
@Test
public void testGetScriptForEndpointReturnsEmptyListInsteadOfNullWhenEndpointNotFound() {
ZuulFilterDAO dao = new ZuulFilterDAOCassandra(gateway);
// setup empty response
when(gateway.select(anyString())).thenReturn(response);
when(response.isEmpty()).thenReturn(true);
List<FilterInfo> list = dao.getZuulFiltersForFilterId("/unknown/Filter");
assertNotNull(list);
assertEquals(0, list.size());
}
代码示例来源:origin: com.netflix.zuul/zuul-core
/**
* We don't want a NULL when there are no Filters, instead we want an empty list.
*/
@Test
public void testGetAllFiltersReturnsEmptyListInsteadOfNullWhenNoFilters() {
ZuulFilterDAO dao = new ZuulFilterDAOCassandra(gateway);
// setup empty response
when(gateway.select(anyString())).thenReturn(response);
when(response.isEmpty()).thenReturn(true);
List<String> list = dao.getAllFilterIDs();
assertNotNull(list);
assertEquals(0, list.size());
}
代码示例来源:origin: com.netflix.zuul/zuul-netflix
@SuppressWarnings("unchecked")
@Test
public void testGetFilterIdsRawIndex() {
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 */
String list = dao.getFilterIdsRaw("index");
/* validate responses */
assertEquals(fids, list);
}
代码示例来源:origin: com.netflix.zuul/zuul-core
@SuppressWarnings("unchecked")
@Test
public void testGetFilterIdsRawIndex() {
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 */
String list = dao.getFilterIdsRaw("index");
/* validate responses */
assertEquals(fids, list);
}
代码示例来源:origin: com.netflix.zuul/zuul-netflix
/**
* We can't unit test the CQL query or how Cassandra will behave, that will have to be manually confirmed.
* We can however test that whatever rows are returned do end up in the List<EndpointURI> that we expect.
*/
@SuppressWarnings("unchecked")
@Test
public void testGetAllEndpointsReturnsResults() {
ZuulFilterDAO dao = new ZuulFilterDAOCassandra(gateway);
// setup empty response
String fids = "filter1|filter2";
/* 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.getAllFilterIDs();
/* validate responses */
assertEquals("filter1", list.get(0));
assertEquals("filter2", list.get(1));
}
代码示例来源: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
/**
* We can't unit test the CQL query or how Cassandra will behave, that will have to be manually confirmed.
* We can however test that whatever rows are returned do end up in the List<EndpointURI> that we expect.
*/
@SuppressWarnings("unchecked")
@Test
public void testGetAllEndpointsReturnsResults() {
ZuulFilterDAO dao = new ZuulFilterDAOCassandra(gateway);
// setup empty response
String fids = "filter1|filter2";
/* 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.getAllFilterIDs();
/* validate responses */
assertEquals("filter1", list.get(0));
assertEquals("filter2", list.get(1));
}
代码示例来源: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");
}
代码示例来源:origin: com.netflix.zuul/zuul-core
ZuulFilterDAO dao = new ZuulFilterDAOCassandra(testGateway);
dao = spy(dao);
doReturn("name:in").when(dao).getFilterIdsRaw(anyString());
代码示例来源:origin: com.netflix.zuul/zuul-core
ZuulFilterDAO dao = new ZuulFilterDAOCassandra(gateway);
String filter = "name:in";
代码示例来源:origin: com.netflix.zuul/zuul-netflix
@Test
public void testGetScriptForLatestEndpoint() {
ZuulFilterDAO dao = new ZuulFilterDAOCassandra(gateway);
String filter = "name:type";
代码示例来源:origin: com.netflix.zuul/zuul-core
ZuulFilterDAO dao = new ZuulFilterDAOCassandra(gateway);
String filter = "name:in";
代码示例来源:origin: com.netflix.zuul/zuul-netflix
ZuulFilterDAO dao = new ZuulFilterDAOCassandra(gateway);
String filter = "name:type";
内容来源于网络,如有侵权,请联系作者删除!