public BlacklistedNodesInfo(AppContext appContext) { blacklistedNodes = appContext.getBlacklistedNodes(); }
public BlacklistedNodesInfo(AppContext appContext) { blacklistedNodes = appContext.getBlacklistedNodes(); }
public BlacklistedNodesInfo(AppContext appContext) { blacklistedNodes = appContext.getBlacklistedNodes(); }
public void verifyBlacklistedNodesInfoXML(String xml, AppContext ctx) throws JSONException, Exception { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); InputSource is = new InputSource(); is.setCharacterStream(new StringReader(xml)); Document dom = db.parse(is); NodeList infonodes = dom.getElementsByTagName("blacklistednodesinfo"); assertEquals("incorrect number of elements", 1, infonodes.getLength()); NodeList nodes = dom.getElementsByTagName("blacklistedNodes"); Set<String> blacklistedNodes = ctx.getBlacklistedNodes(); assertEquals("incorrect number of elements", blacklistedNodes.size(), nodes.getLength()); for (int i = 0; i < nodes.getLength(); i++) { Element element = (Element) nodes.item(i); assertTrue( blacklistedNodes.contains(element.getFirstChild().getNodeValue())); } } }
public void verifyBlacklistedNodesInfo(JSONObject blacklist, AppContext ctx) throws JSONException, Exception{ JSONArray array = blacklist.getJSONArray("blacklistedNodes"); assertEquals(array.length(), ctx.getBlacklistedNodes().size()); for (int i = 0; i < array.length(); i++) { assertTrue(ctx.getBlacklistedNodes().contains(array.getString(i))); } }