use of org.jivesoftware.smack.XMPPException.XMPPErrorException in project Smack by igniterealtime.
the class IntTestUtil method disconnectAndMaybeDelete.
public static void disconnectAndMaybeDelete(XMPPTCPConnection connection, Configuration config) throws InterruptedException {
try {
if (!config.isAccountRegistrationPossible()) {
return;
}
Configuration.AccountRegistration accountDeletionMethod = config.accountRegistration;
AccountManager accountManager = AccountManager.getInstance(connection);
try {
if (accountManager.isSupported()) {
accountDeletionMethod = AccountRegistration.inBandRegistration;
}
} catch (NoResponseException | XMPPErrorException | NotConnectedException e) {
LOGGER.log(Level.WARNING, "Could not test if XEP-0077 account deletion is possible", e);
}
switch(accountDeletionMethod) {
case inBandRegistration:
deleteViaIbr(connection);
break;
case serviceAdministration:
deleteViaServiceAdministration(connection, config);
break;
default:
throw new AssertionError();
}
} finally {
connection.disconnect();
}
}
use of org.jivesoftware.smack.XMPPException.XMPPErrorException in project Smack by igniterealtime.
the class EntityCapsTest method testEntityCaps.
@SmackIntegrationTest
public void testEntityCaps() throws XMPPException, InterruptedException, NoResponseException, NotConnectedException, TimeoutException {
final String dummyFeature = getNewDummyFeature();
dropWholeEntityCapsCache();
performActionAndWaitUntilStanzaReceived(new Runnable() {
@Override
public void run() {
sdmTwo.addFeature(dummyFeature);
}
}, connection, new AndFilter(PresenceTypeFilter.AVAILABLE, FromMatchesFilter.create(conTwo.getUser())));
waitUntilTrue(new Condition() {
@Override
public boolean evaluate() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
DiscoverInfo info = sdmOne.discoverInfo(conTwo.getUser());
return info.containsFeature(dummyFeature);
}
});
DiscoverInfo info = sdmOne.discoverInfo(conTwo.getUser());
String u1ver = EntityCapsManager.getNodeVersionByJid(conTwo.getUser());
assertNotNull(u1ver);
DiscoverInfo entityInfo = EntityCapsManager.CAPS_CACHE.lookup(u1ver);
assertNotNull(entityInfo);
assertEquals(info.toXML(), entityInfo.toXML());
}
Aggregations