Search in sources :

Example 1 with TestNotPossibleException

use of org.igniterealtime.smack.inttest.TestNotPossibleException in project Smack by igniterealtime.

the class IoTDiscoveryIntegrationTest method checkPrerequisites.

static void checkPrerequisites(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, TestNotPossibleException {
    IoTDiscoveryManager discoveryManager = IoTDiscoveryManager.getInstanceFor(connection);
    Jid registry = discoveryManager.findRegistry();
    if (registry == null) {
        throw new TestNotPossibleException("Could not find IoT Registry");
    }
}
Also used : TestNotPossibleException(org.igniterealtime.smack.inttest.TestNotPossibleException) Jid(org.jxmpp.jid.Jid) IoTDiscoveryManager(org.jivesoftware.smackx.iot.discovery.IoTDiscoveryManager)

Example 2 with TestNotPossibleException

use of org.igniterealtime.smack.inttest.TestNotPossibleException in project Smack by igniterealtime.

the class MultiUserChatLowLevelIntegrationTest method testMucBookmarksAutojoin.

@SmackIntegrationTest
public void testMucBookmarksAutojoin(XMPPTCPConnection connection) throws InterruptedException, TestNotPossibleException, XMPPException, SmackException, IOException {
    final BookmarkManager bookmarkManager = BookmarkManager.getBookmarkManager(connection);
    if (!bookmarkManager.isSupported()) {
        throw new TestNotPossibleException("Private data storage not supported");
    }
    final MultiUserChatManager multiUserChatManager = MultiUserChatManager.getInstanceFor(connection);
    final Resourcepart mucNickname = Resourcepart.from("Nick-" + StringUtils.randomString(6));
    final String randomMucName = StringUtils.randomString(6);
    final DomainBareJid mucComponent = multiUserChatManager.getXMPPServiceDomains().get(0);
    final MultiUserChat muc = multiUserChatManager.getMultiUserChat(JidCreate.entityBareFrom(Localpart.from(randomMucName), mucComponent));
    MucCreateConfigFormHandle handle = muc.createOrJoin(mucNickname);
    if (handle != null) {
        handle.makeInstant();
    }
    muc.leave();
    bookmarkManager.addBookmarkedConference("Smack Inttest: " + testRunId, muc.getRoom(), true, mucNickname, null);
    connection.disconnect();
    connection.connect().login();
    // MucBookmarkAutojoinManager is also able to do its task automatically
    // after every login, it's not determinstic when this will be finished.
    // So we trigger it manually here.
    MucBookmarkAutojoinManager.getInstanceFor(connection).autojoinBookmarkedConferences();
    assertTrue(muc.isJoined());
    // If the test went well, leave the MUC
    muc.leave();
}
Also used : TestNotPossibleException(org.igniterealtime.smack.inttest.TestNotPossibleException) DomainBareJid(org.jxmpp.jid.DomainBareJid) MucCreateConfigFormHandle(org.jivesoftware.smackx.muc.MultiUserChat.MucCreateConfigFormHandle) BookmarkManager(org.jivesoftware.smackx.bookmarks.BookmarkManager) Resourcepart(org.jxmpp.jid.parts.Resourcepart) SmackIntegrationTest(org.igniterealtime.smack.inttest.SmackIntegrationTest)

Aggregations

TestNotPossibleException (org.igniterealtime.smack.inttest.TestNotPossibleException)2 SmackIntegrationTest (org.igniterealtime.smack.inttest.SmackIntegrationTest)1 BookmarkManager (org.jivesoftware.smackx.bookmarks.BookmarkManager)1 IoTDiscoveryManager (org.jivesoftware.smackx.iot.discovery.IoTDiscoveryManager)1 MucCreateConfigFormHandle (org.jivesoftware.smackx.muc.MultiUserChat.MucCreateConfigFormHandle)1 DomainBareJid (org.jxmpp.jid.DomainBareJid)1 Jid (org.jxmpp.jid.Jid)1 Resourcepart (org.jxmpp.jid.parts.Resourcepart)1