From f1c38d67d733045ac5dc77840eb416fd54b6141b Mon Sep 17 00:00:00 2001 From: Gaston Dombiak Date: Thu, 5 Aug 2004 16:57:57 +0000 Subject: [PATCH] Adds new test for discovering if a server supports publishing of items. SMACK-150 git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2351 b35dd754-fafc-0310-a699-88a17e54d16e --- .../smackx/ServiceDiscoveryManagerTest.java | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/test/org/jivesoftware/smackx/ServiceDiscoveryManagerTest.java b/test/org/jivesoftware/smackx/ServiceDiscoveryManagerTest.java index 9130bb361..6ae39291f 100644 --- a/test/org/jivesoftware/smackx/ServiceDiscoveryManagerTest.java +++ b/test/org/jivesoftware/smackx/ServiceDiscoveryManagerTest.java @@ -123,13 +123,24 @@ public class ServiceDiscoveryManagerTest extends SmackTestCase { } /** - * Tests publishing items to another entity. + * Tests support for publishing items to another entity. + */ + public void testDiscoverPublishItemsSupport() { + try { + boolean canPublish = ServiceDiscoveryManager.getInstanceFor(getConnection(0)) + .canPublishItems(getHost()); + assertFalse("Messenger does not support publishing...so far!!", canPublish); + } + catch (Exception e) { + fail(e.getMessage()); + } + + } + + /** + * Tests publishing items to another entity. */ /*public void testPublishItems() { - // TODO Remove this line when the "additional services for extensions" are - // implemented - new ServiceDiscoveryManager(getConnection(0)); - DiscoverItems itemsToPublish = new DiscoverItems(); DiscoverItems.Item itemToPublish = new DiscoverItems.Item("pubsub.shakespeare.lit"); itemToPublish.setName("Avatar"); @@ -138,9 +149,10 @@ public class ServiceDiscoveryManagerTest extends SmackTestCase { itemsToPublish.addItem(itemToPublish); try { - ServiceDiscoveryManager.getInstanceFor(getConnection(0)).publishItems("host", itemsToPublish); + ServiceDiscoveryManager.getInstanceFor(getConnection(0)).publishItems(getHost(), + itemsToPublish); } - catch (XMPPException e) { + catch (Exception e) { fail(e.getMessage()); }