Search in sources :

Example 1 with SoftwareInfoForm

use of org.jivesoftware.smackx.softwareinfo.form.SoftwareInfoForm in project Smack by igniterealtime.

the class SoftwareInfoManagerTest method buildSoftwareInfoFromDataForm.

public static SoftwareInfoForm buildSoftwareInfoFromDataForm() throws URISyntaxException {
    DataForm.Builder dataFormBuilder = DataForm.builder(DataForm.Type.result);
    dataFormBuilder.addField(FormField.buildHiddenFormType(SoftwareInfoForm.FORM_TYPE));
    dataFormBuilder.addField(FormField.builder("icon").addFormFieldChildElement(createMediaElement()).build());
    dataFormBuilder.addField(FormField.builder("os").setValue("Windows").build());
    dataFormBuilder.addField(FormField.builder("os_version").setValue("XP").build());
    dataFormBuilder.addField(FormField.builder("software").setValue("Exodus").build());
    dataFormBuilder.addField(FormField.builder("software_version").setValue("0.9.1").build());
    SoftwareInfoForm softwareInfoForm = SoftwareInfoForm.getBuilder().setDataForm(dataFormBuilder.build()).build();
    return softwareInfoForm;
}
Also used : SoftwareInfoForm(org.jivesoftware.smackx.softwareinfo.form.SoftwareInfoForm) DataForm(org.jivesoftware.smackx.xdata.packet.DataForm)

Example 2 with SoftwareInfoForm

use of org.jivesoftware.smackx.softwareinfo.form.SoftwareInfoForm in project Smack by igniterealtime.

the class SoftwareInfoManagerTest method buildSoftwareInfoFormUsingBuilder.

public static SoftwareInfoForm buildSoftwareInfoFormUsingBuilder() throws URISyntaxException {
    SoftwareInfoForm.Builder builder = SoftwareInfoForm.getBuilder();
    MediaElement mediaElement = createMediaElement();
    builder.setIcon(mediaElement);
    builder.setOS("Windows");
    builder.setOSVersion("XP");
    builder.setSoftware("Exodus");
    builder.setSoftwareVersion("0.9.1");
    return builder.build();
}
Also used : MediaElement(org.jivesoftware.smackx.mediaelement.element.MediaElement) SoftwareInfoForm(org.jivesoftware.smackx.softwareinfo.form.SoftwareInfoForm)

Example 3 with SoftwareInfoForm

use of org.jivesoftware.smackx.softwareinfo.form.SoftwareInfoForm in project Smack by igniterealtime.

the class SoftwareInfoFormTest method createSoftwareInfoFormUsingDataForm.

public static SoftwareInfoForm createSoftwareInfoFormUsingDataForm() throws URISyntaxException {
    DataForm.Builder dataFormBuilder = DataForm.builder(DataForm.Type.result);
    TextSingleFormField formField = FormField.buildHiddenFormType(SoftwareInfoForm.FORM_TYPE);
    dataFormBuilder.addField(formField);
    dataFormBuilder.addField(FormField.builder("icon").addFormFieldChildElement(createMediaElement()).build());
    dataFormBuilder.addField(FormField.builder("os").setValue("Windows").build());
    dataFormBuilder.addField(FormField.builder("os_version").setValue("XP").build());
    dataFormBuilder.addField(FormField.builder("software").setValue("Exodus").build());
    dataFormBuilder.addField(FormField.builder("software_version").setValue("0.9.1").build());
    SoftwareInfoForm softwareInfoForm = SoftwareInfoForm.getBuilder().setDataForm(dataFormBuilder.build()).build();
    return softwareInfoForm;
}
Also used : TextSingleFormField(org.jivesoftware.smackx.xdata.TextSingleFormField) SoftwareInfoForm(org.jivesoftware.smackx.softwareinfo.form.SoftwareInfoForm) DataForm(org.jivesoftware.smackx.xdata.packet.DataForm)

Example 4 with SoftwareInfoForm

use of org.jivesoftware.smackx.softwareinfo.form.SoftwareInfoForm 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 5 with SoftwareInfoForm

use of org.jivesoftware.smackx.softwareinfo.form.SoftwareInfoForm in project Smack by igniterealtime.

the class SoftwareInfoIntegrationTest method createSoftwareInfoForm.

private static SoftwareInfoForm createSoftwareInfoForm() throws URISyntaxException {
    SoftwareInfoForm.Builder builder = SoftwareInfoForm.getBuilder();
    MediaElement mediaElement = MediaElement.builder().addUri(new MediaElement.Uri(new URI("http://example.org"), "test-type")).setHeightAndWidth(16, 16).build();
    SoftwareInfoForm softwareInfoForm = builder.setIcon(mediaElement).setOS("Linux").setOSVersion("Debian").setSoftware("Gajim").setSoftwareVersion("1.4.0").build();
    return softwareInfoForm;
}
Also used : MediaElement(org.jivesoftware.smackx.mediaelement.element.MediaElement) SoftwareInfoForm(org.jivesoftware.smackx.softwareinfo.form.SoftwareInfoForm) URI(java.net.URI)

Aggregations

SoftwareInfoForm (org.jivesoftware.smackx.softwareinfo.form.SoftwareInfoForm)7 MediaElement (org.jivesoftware.smackx.mediaelement.element.MediaElement)2 DataForm (org.jivesoftware.smackx.xdata.packet.DataForm)2 Test (org.junit.jupiter.api.Test)2 IOException (java.io.IOException)1 URI (java.net.URI)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 ThrowingRunnable (org.jivesoftware.smack.util.Async.ThrowingRunnable)1 XmlPullParserException (org.jivesoftware.smack.xml.XmlPullParserException)1 TextSingleFormField (org.jivesoftware.smackx.xdata.TextSingleFormField)1