Search in sources :

Example 1 with ThrowingRunnable

use of org.jivesoftware.smack.util.Async.ThrowingRunnable in project Smack by igniterealtime.

the class SoftwareInfoIntegrationTest method test.

@SmackIntegrationTest
public void test() throws Exception {
    SoftwareInfoForm softwareInfoSent = createSoftwareInfoForm();
    performActionAndWaitForPresence(conTwo, conOne, new ThrowingRunnable() {

        @Override
        public void runOrThrow() throws Exception {
            sim1.publishSoftwareInformationForm(softwareInfoSent);
        }
    });
    SoftwareInfoForm softwareInfoFormReceived = sim2.fromJid(conOne.getUser());
    assertEquals(softwareInfoSent, softwareInfoFormReceived);
}
Also used : SoftwareInfoForm(org.jivesoftware.smackx.softwareinfo.form.SoftwareInfoForm) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException) XmlPullParserException(org.jivesoftware.smack.xml.XmlPullParserException) SmackParsingException(org.jivesoftware.smack.parsing.SmackParsingException) ThrowingRunnable(org.jivesoftware.smack.util.Async.ThrowingRunnable) AbstractSmackIntegrationTest(org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest) SmackIntegrationTest(org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest)

Example 2 with ThrowingRunnable

use of org.jivesoftware.smack.util.Async.ThrowingRunnable in project Smack by igniterealtime.

the class EntityCapsTest method addFeatureAndWaitForPresence.

/**
 * Adds 'feature' to conB and waits until conA observes a presence form conB.
 *
 * @param conA the connection to observe the presence on.
 * @param conB the connection to add the feature to.
 * @param feature the feature to add.
 * @throws Exception in case of an exception.
 */
private void addFeatureAndWaitForPresence(XMPPConnection conA, XMPPConnection conB, String feature) throws Exception {
    final ServiceDiscoveryManager sdmB = ServiceDiscoveryManager.getInstanceFor(conB);
    ThrowingRunnable action = new ThrowingRunnable() {

        @Override
        public void runOrThrow() throws Exception {
            sdmB.addFeature(feature);
        }
    };
    performActionAndWaitForPresence(conA, conB, action);
}
Also used : ServiceDiscoveryManager(org.jivesoftware.smackx.disco.ServiceDiscoveryManager) ThrowingRunnable(org.jivesoftware.smack.util.Async.ThrowingRunnable)

Aggregations

ThrowingRunnable (org.jivesoftware.smack.util.Async.ThrowingRunnable)2 IOException (java.io.IOException)1 URISyntaxException (java.net.URISyntaxException)1 AbstractSmackIntegrationTest (org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest)1 SmackIntegrationTest (org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest)1 SmackParsingException (org.jivesoftware.smack.parsing.SmackParsingException)1 XmlPullParserException (org.jivesoftware.smack.xml.XmlPullParserException)1 ServiceDiscoveryManager (org.jivesoftware.smackx.disco.ServiceDiscoveryManager)1 SoftwareInfoForm (org.jivesoftware.smackx.softwareinfo.form.SoftwareInfoForm)1