/** * Delete our metadata node. * * @param pepManager The PEP manager. * * @throws XMPPException.XMPPErrorException in case of an XMPP protocol error. * @throws SmackException.NotConnectedException if we are not connected. * @throws InterruptedException if the thread is interrupted. * @throws SmackException.NoResponseException if the server doesn't respond. * @return <code>true</code> if the node existed and was deleted, <code>false</code> if the node did not exist. */ public static boolean deletePubkeysListNode(PepManager pepManager) throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException { PubSubManager pm = pepManager.getPepPubSubManager(); return pm.deleteNode(PEP_NODE_PUBLIC_KEYS); }
/** * Delete the private backup node. * * @param pepManager the PEP manager. * * @throws XMPPException.XMPPErrorException if there is an XMPP protocol related issue * @throws SmackException.NotConnectedException if we are not connected * @throws InterruptedException if the thread gets interrupted * @throws SmackException.NoResponseException if the server sends no response * @return <code>true</code> if the node existed and was deleted, <code>false</code> if the node did not exist. */ public static boolean deleteSecretKeyNode(PepManager pepManager) throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException { PubSubManager pm = pepManager.getPepPubSubManager(); return pm.deleteNode(PEP_NODE_SECRET_KEY); }
/** * Delete the public key node of the key with fingerprint {@code fingerprint}. * * @param pepManager The PEP manager. * @param fingerprint fingerprint of the key we want to delete * * @throws XMPPException.XMPPErrorException in case of an XMPP protocol error. * @throws SmackException.NotConnectedException if we are not connected. * @throws InterruptedException if the thread gets interrupted. * @throws SmackException.NoResponseException if the server doesn't respond. * @return <code>true</code> if the node existed and was deleted, <code>false</code> if the node did not exist. */ public static boolean deletePublicKeyNode(PepManager pepManager, OpenPgpV4Fingerprint fingerprint) throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException { PubSubManager pm = pepManager.getPepPubSubManager(); return pm.deleteNode(PEP_NODE_PUBLIC_KEY(fingerprint)); }
} finally { if (leafNode != null) { deleteNode(leafNode.getId());
@SmackIntegrationTest public void simplePubSubNodeTest() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { final String nodename = "sinttest-simple-nodename-" + testRunId; final String itemId = "sintest-simple-itemid-" + testRunId; ConfigureForm defaultConfiguration = pubSubManagerOne.getDefaultConfiguration(); ConfigureForm config = new ConfigureForm(defaultConfiguration.createAnswerForm()); // Configure the node as "Notification-Only Node", which in turn means that // items do not need payload, to prevent payload-required error responses when // publishing the item. config.setDeliverPayloads(false); config.setPersistentItems(true); Node node = pubSubManagerOne.createNode(nodename, config); try { LeafNode leafNode = (LeafNode) node; leafNode.publish(new Item(itemId)); List<Item> items = leafNode.getItems(); assertEquals(1, items.size()); Item item = items.get(0); assertEquals(itemId, item.getId()); } finally { pubSubManagerOne.deleteNode(nodename); } } }
pm.deleteNode(OmemoConstants.PEP_NODE_BUNDLE_FROM_DEVICE_ID(id)); } catch (SmackException.NoResponseException | InterruptedException | SmackException.NotConnectedException | XMPPException.XMPPErrorException e) { pm.deleteNode(OmemoConstants.PEP_NODE_DEVICE_LIST); } catch (SmackException.NoResponseException | InterruptedException | SmackException.NotConnectedException | XMPPException.XMPPErrorException e) {
@Test public void deleteNodeTest() throws InterruptedException, SmackException, IOException, XMPPException { ThreadedDummyConnection con = ThreadedDummyConnection.newInstance(); PubSubManager mgr = new PubSubManager(con, DUMMY_PUBSUB_SERVICE); mgr.deleteNode("foo@bar.org"); PubSub pubSubDeleteRequest = con.getSentPacket(); assertEquals("http://jabber.org/protocol/pubsub#owner", pubSubDeleteRequest.getChildElementNamespace()); assertEquals("pubsub", pubSubDeleteRequest.getChildElementName()); } }
/** * Delete specified node * @param nodepath - path to node */ public synchronized void deleteNode(String nodepath) { if ((xmppCon == null) || (!xmppCon.isConnected())) login(); logger.info("Deleting node " + nodepath); try { Node n = manager.getNode(nodepath); if ((n != null) && (n instanceof LeafNode)){ LeafNode ln = (LeafNode)n; ln.deleteAllItems(); } else logger.info("Unable to delete items of node " + nodepath); manager.deleteNode(nodepath); } catch (XMPPException e) { logger.error("Error deleting node: " + e); } }
/** * Delete all nodes */ public synchronized void deleteAllNodes() { if ((xmppCon == null) || (!xmppCon.isConnected())) login(); try { DiscoverItems dItems = manager.discoverNodes(null); Iterator<DiscoverItems.Item> iItems = dItems.getItems(); while(iItems.hasNext()) { DiscoverItems.Item it = iItems.next(); logger.debug("Deleting node " + it.getNode()); try { Node n = manager.getNode(it.getNode()); if ((n != null) && (n instanceof LeafNode)){ LeafNode ln = (LeafNode)n; ln.deleteAllItems(); } else logger.info("Unable to delete items of node " + it.getNode()); manager.deleteNode(it.getNode()); } catch (XMPPException e) { logger.error("Error deleting node: " + e); } } } catch (XMPPException e) { logger.error("Error deleting nodes: " + e); } }