@Test public void testDeletePattern() throws Exception { // Search for :"name:chefutil-*"; String search = "name%3A" + name1.substring(0, 9) + "*"; search = "name%3A" + "rds-default*"; final List<String> nodes = ChefUtil.searchNodes(search); // final JsonNode jsonNodes = JsonUtil.load(nodes); for (String node : nodes) { JsonNode json = JsonUtil.load(node); ChefUtil.deleteNode(json.get("name").getTextValue()); logger.debug("Deleted: " + json.get("name").getTextValue()); } search = "name%3A" + name1.substring(0, 9) + "*"; search = "name%3A" + "rds-*"; final List<String> clients = ChefUtil.searchClients(search); // final JsonNode jsonNodes = JsonUtil.load(nodes); for (String client : clients) { JsonNode json = JsonUtil.load(client); ChefUtil.deleteClient(json.get("name").getTextValue()); logger.debug("Deleted: " + json.get("name").getTextValue()); } }
@AfterClass public static void cleanupCreated() throws Exception { try { ChefUtil.deleteClient(name1); } catch (Exception e) { // ignore. } try { ChefUtil.deleteDatabag(bag1); } catch (Exception e) { // ignore. } try { ChefUtil.deleteNode(name1); } catch (Exception e) { // ignore. } }