return new PubSubOwnerDeleteNodeHandler(serviceConfiguration);
}
public void testDelete() throws Exception {
String testNode = "test";
LeafNode node = new LeafNode(serviceConfiguration, testNode, client);
root.add(node);
node.subscribe("someid", client); // make the owner subscriber
node.subscribe("otherid1", new EntityImpl("yoda", "starwars.com", "spaceship"));
node.subscribe("otherid2", new EntityImpl("r2d2", "starwars.com", "desert"));
node.subscribe("otherid3", new EntityImpl("anakin", "starwars.com", "deathstar"));
assertNotNull(root.find(testNode));
// make sure we have 4 subscribers
assertEquals(4, node.countSubscriptions());
AbstractStanzaGenerator sg = getDefaultStanzaGenerator();
Stanza stanza = sg.getStanza(client, pubsubService, "id123", testNode);
ResponseStanzaContainer result = sendStanza(stanza, true);
assertTrue(result.hasResponse());
IQStanza response = new IQStanza(result.getResponseStanza());
assertEquals(IQStanzaType.RESULT.value(), response.getType());
assertEquals("id123", response.getAttributeValue("id")); // IDs must match
LeafNode n = root.find(testNode);
assertNull(n);
// check that the subscribers got a notification
assertEquals(4, relay.getCountRelayed());
}