1 package org.jivesoftware.smackx; 2 3 import org.jivesoftware.smack.test.SmackTestCase; 4 import org.jivesoftware.smack.XMPPException; 5 import org.jivesoftware.smackx.packet.VCard; 6 7 14 public class VCardTest extends SmackTestCase { 15 16 public VCardTest(String arg0) { 17 super(arg0); 18 } 19 20 public void testBigFunctional() { 21 VCard origVCard = new VCard(); 22 23 origVCard.setFirstName("kir"); 24 origVCard.setLastName("max"); 25 origVCard.setEmailHome("foo@fee.bar"); 26 origVCard.setJabberId("jabber@id.org"); 27 origVCard.setOrganization("Jetbrains, s.r.o"); 28 origVCard.setNickName("KIR"); 29 30 origVCard.setField("TITLE", "Mr"); 31 origVCard.setAddressFieldHome("STREET", "Some street"); 32 origVCard.setPhoneWork("FAX", "3443233"); 33 34 origVCard.save(getConnection(0)); 35 36 VCard loaded = new VCard(); 37 try { 38 loaded.load(getConnection(0)); 39 } catch (XMPPException e) { 40 e.printStackTrace(); 41 fail(e.getMessage()); 42 } 43 44 assertEquals("Should load own VCard successfully", origVCard, loaded); 45 46 loaded = new VCard(); 47 try { 48 loaded.load(getConnection(1), getBareJID(0)); 49 } catch (XMPPException e) { 50 e.printStackTrace(); 51 fail(e.getMessage()); 52 } 53 54 assertEquals("Should load another user's VCard successfully", origVCard, loaded); 55 } 56 57 protected int getMaxConnections() { 58 return 2; 59 } 60 } 61 | Popular Tags |