Examples of VCardImpl


Examples of net.sourceforge.cardme.vcard.VCardImpl

    sb.append("KEY;GPG;ENCODING=QUOTED-PRINTABLE:quoted printable=0D=0A=\r\n");
    sb.append(" key\r\n");
    sb.append("KEY;ENCODING=BASE64;X509:YmluYXJ5IGRhdGE=\r\n");
    sb.append("END:VCARD\r\n");

    VCardImpl vcard = (VCardImpl)vCardEngine.parse(sb.toString());

    List<KeyType> list = vcard.getKeys();

    KeyType f = list.get(0);
    assertEquals(KeyTextType.PGP, f.getKeyTextType());
    assertArrayEquals("plain text key".getBytes(), f.getKey());
    assertEquals(EncodingType.EIGHT_BIT, f.getEncodingType());
View Full Code Here

Examples of net.sourceforge.cardme.vcard.VCardImpl

    assertEquals(EncodingType.BINARY, f.getEncodingType());
  }
 
  @Test
  public void testInvalidVCard() throws Exception {
    VCardImpl vcard = (VCardImpl)vCardEngine.parse(getInvalidVCard());
    assertTrue(vcard.hasErrors());
   
    assertTrue(vcard.getBegin() != null);
    assertTrue(vcard.getVersion() != null);
    assertTrue(vcard.getN() != null);
    assertTrue(vcard.getFN() != null);
    assertTrue(vcard.getEnd() != null);
   
    assertEquals("John", vcard.getN().getGivenName());
    assertEquals("Doe", vcard.getN().getFamilyName());
    assertEquals("John Doe", vcard.getFN().getFormattedName());
  }
View Full Code Here

Examples of net.sourceforge.cardme.vcard.VCardImpl

  private AgentType agentType = null;
  private VCard agentVCard = null;
 
  @Before
  public void setUp() throws Exception {
    agentVCard = new VCardImpl();
    agentVCard.setN(new NType("Doe", "John"));
    agentVCard.setFN(new FNType("John Doe"));
   
    agentType = new AgentType();
    agentType.setAgent(agentVCard);
View Full Code Here

Examples of net.sourceforge.cardme.vcard.VCardImpl

    assertEquals(VCardTypeName.AGENT.getType(), agentType.getVCardTypeName().getType());
  }
 
  @Test
  public void testEquals() {
    VCard agentVCard2 = new VCardImpl();
    agentVCard2.setN(new NType("Doe", "John"));
    agentVCard2.setFN(new FNType("John Doe"));
   
    AgentType agentType2 = new AgentType();
    agentType2.setAgent(agentVCard2);
   
    assertTrue(agentType.equals(agentType2));
View Full Code Here

Examples of net.sourceforge.cardme.vcard.VCardImpl

    assertTrue(agentType.equals(agentType2));
  }
 
  @Test
  public void testHashcode() {
    VCard agentVCard2 = new VCardImpl();
    agentVCard2.setN(new NType("Doe", "John"));
    agentVCard2.setFN(new FNType("John Doe"));
   
    AgentType agentType2 = new AgentType();
    agentType2.setAgent(agentVCard2);
   
    int hcode1 = agentType.hashCode();
View Full Code Here

Examples of net.sourceforge.cardme.vcard.VCardImpl

    assertEquals(hcode1, hcode2);
  }
 
  @Test
  public void testCompareTo() {
    VCard agentVCard2 = new VCardImpl();
    agentVCard2.setN(new NType("Doe", "John"));
    agentVCard2.setFN(new FNType("John Doe"));
   
    AgentType agentType2 = new AgentType();
    agentType2.setAgent(agentVCard2);
   
    assertTrue(agentType.compareTo(agentType2) == 0);
View Full Code Here

Examples of net.sourceforge.cardme.vcard.VCardImpl

    writer.setCompatibilityMode(CompatibilityMode.RFC2426);
    writer.setFoldingScheme(FoldingScheme.MIME_DIR);
    writer.setBinaryfoldingScheme(BinaryFoldingScheme.MIME_DIR);
   
    for(int i = 0; i < vcards.size(); i++) {
      VCardImpl vcard = (VCardImpl)vcards.get(i);
     
      if(vcard.hasErrors()) {
        System.out.println("VCard "+i+" has some errors ...");
        List<VCardError> errors = vcard.getErrors();
        for(int j = 0; j < errors.size(); j++) {
          System.out.println(errors.get(j).getErrorMessage());
          System.out.println(errors.get(j).getSeverity());
          System.out.println(StringUtil.formatException(errors.get(j).getError()));
        }
      }
     
      writer.setVCard(vcard);
      String vstring = writer.buildVCardString();
     
      if(writer.hasErrors()) {
        List<VCardError> errors = vcard.getErrors();
        for(int j = 0; j < errors.size(); j++) {
          System.out.println(errors.get(j).getErrorMessage());
          System.out.println(errors.get(j).getSeverity());
          System.out.println(StringUtil.formatException(errors.get(j).getError()));
        }
View Full Code Here

Examples of net.sourceforge.cardme.vcard.VCardImpl

*/
public class TestVcardFieldMarshalling {

  @Test
  public void testVCardName() throws VCardBuildException {
    VCardImpl vcard = new VCardImpl();
    appyBasicName(vcard);
    String result = getSerializedString(vcard);
    assertNotNull(result);
    assertTrue(result.contains("BEGIN:VCARD"));
    assertTrue(result.contains("VERSION:3.0"));
View Full Code Here

Examples of net.sourceforge.cardme.vcard.VCardImpl

    assertTrue(result.contains("END:VCARD"));
  }
 
  @Test
  public void testCategory() throws VCardBuildException {
    VCardImpl vcard = new VCardImpl();
    appyBasicName(vcard);
    vcard.setCategories(new CategoriesType("work"));
    String result = getSerializedString(vcard);
    assertTrue(result.contains("CATEGORIES:work"));
  }
View Full Code Here

Examples of net.sourceforge.cardme.vcard.VCardImpl

    assertTrue(result.contains("CATEGORIES:work"));
  }
 
  @Test
  public void testOrganization() throws VCardBuildException {
    VCardImpl vcard = new VCardImpl();
    appyBasicName(vcard);
    vcard.setOrg(new OrgType("Acme, Inc."));
    String result = getSerializedString(vcard);
    assertTrue(result.contains("ORG:Acme\\, Inc."));   
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.