/** * Returns a collection with the XMPP addresses of the Multi-User Chat services. * * @return a collection with the XMPP addresses of the Multi-User Chat services. * @throws XMPPErrorException * @throws NoResponseException * @throws NotConnectedException * @throws InterruptedException * @deprecated use {@link #getMucServiceDomains()} instead. */ // TODO: Remove in Smack 4.5 @Deprecated public List<DomainBareJid> getXMPPServiceDomains() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { return getMucServiceDomains(); }
@Override public void connectionCallback(XMPPTCPConnection connection) throws Exception { if (MultiUserChatManager.getInstanceFor(connection).getMucServiceDomains().isEmpty()) { throw new TestNotPossibleException("MUC component not offered by service"); } } });
public MultiUserChatIntegrationTest(SmackIntegrationTestEnvironment environment) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, TestNotPossibleException { super(environment); mucManagerOne = MultiUserChatManager.getInstanceFor(conOne); mucManagerTwo = MultiUserChatManager.getInstanceFor(conTwo); List<DomainBareJid> services = mucManagerOne.getMucServiceDomains(); if (services.isEmpty()) { throw new TestNotPossibleException("No MUC (XEP-45) service found"); } else { mucService = services.get(0); } }
@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.getMucServiceDomains().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 deterministic 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(); }