Examples of VCardImpl


Examples of net.sourceforge.cardme.vcard.VCardImpl

    assertTrue(result.contains("ORG:Acme\\, Inc."));   
  }
 
  @Test
  public void testAddress() throws VCardBuildException {
    VCardImpl vcard = new VCardImpl();
    appyBasicName(vcard);
    AdrType address = new AdrType();
    address.setGroup("work");
    address.setCountryName("US");
    address.setPostalCode("55555-0123");
    address.setLocality("Anytown");
    address.setStreetAddress("555 Some Street Address");
   
    vcard.addAdr(address);
    String result = getSerializedString(vcard);
    assertTrue(result.contains("work.ADR:;;555 Some Street Address;Anytown;;55555-0123;US"));   
  }
View Full Code Here

Examples of net.sourceforge.cardme.vcard.VCardImpl

    assertTrue(result.contains("work.ADR:;;555 Some Street Address;Anytown;;55555-0123;US"));   
  }
 
  @Test
  public void testEmailAddress() throws VCardBuildException {
    VCardImpl vcard = new VCardImpl();
    appyBasicName(vcard);
    vcard.addEmail(new EmailType("joe@example.org"));
    String result = getSerializedString(vcard);
    assertTrue(result.contains("EMAIL:joe@example.org"));   
  }
View Full Code Here

Examples of net.sourceforge.cardme.vcard.VCardImpl

    assertTrue(result.contains("EMAIL:joe@example.org"));   
  }
 
  @Test
  public void testURL() throws VCardBuildException {
    VCardImpl vcard = new VCardImpl();
    appyBasicName(vcard);
    vcard.addUrl(new UrlType("http://www.example.org/"));
    String result = getSerializedString(vcard);
    assertTrue(result.contains("URL:http://www.example.org/"));
   
    vcard.addUrl(new UrlType("ftp://ftp.example.org/"));
    result = getSerializedString(vcard);
    assertTrue(result.contains("URL:ftp://ftp.example.org/"));
   
    vcard.addUrl(new UrlType("this is free form text"));
    result = getSerializedString(vcard);
    assertTrue(result.contains("URL:this is free form text"));
  }
View Full Code Here

Examples of net.sourceforge.cardme.vcard.VCardImpl

    assertTrue(result.contains("URL:this is free form text"));
  }
 
  @Test
  public void testPhoneNumber() throws VCardBuildException {
    VCardImpl vcard = new VCardImpl();
    appyBasicName(vcard);
   
    vcard.addTel(new TelType("+1 (555) 555-1232").addParam(TelParamType.WORK));
    vcard.addTel(new TelType("+1 (555) 555-1233").addParam(TelParamType.FAX));
    vcard.addTel(new TelType("+1 (555) 555-1234").addParam(TelParamType.CELL));
    vcard.addTel(new TelType("+1 (555) 555-1234").addParam(TelParamType.HOME));
   
    String result = getSerializedString(vcard);
    assertTrue(result.contains("TEL;TYPE=WORK:+1 (555) 555-1232"))
    assertTrue(result.contains("TEL;TYPE=FAX:+1 (555) 555-1233"))
    assertTrue(result.contains("TEL;TYPE=CELL:+1 (555) 555-1234"))
View Full Code Here

Examples of net.sourceforge.cardme.vcard.VCardImpl

    assertTrue(result.contains("TEL;TYPE=HOME:+1 (555) 555-1234"))
  }
 
  @Test
  public void testLinkedProfileImage() throws URISyntaxException, VCardBuildException {
    VCardImpl vcard = new VCardImpl();
    appyBasicName(vcard);
   
    PhotoType photo = new PhotoType();
    photo.setPhotoURI(new URI("http://www.google.com/intl/en_com/images/srpr/logo3w.png"));
    photo.setImageMediaType(ImageMediaType.PNG);
    vcard.addPhoto(photo);
    String result = getSerializedString(vcard);
   
    //Changed path to full URI as per http://www.ietf.org/rfc/rfc2426.txt, section 3.1.4
    assertTrue(result.contains("PHOTO;VALUE=URI:http://www.google.com/intl/en_com/images/srpr/logo3w.png"));
  }
View Full Code Here

Examples of net.sourceforge.cardme.vcard.VCardImpl

    assertTrue(result.contains("PHOTO;VALUE=URI:http://www.google.com/intl/en_com/images/srpr/logo3w.png"));
  }
 
  @Test
  public void testProfileImage() throws IOException, VCardBuildException {
    VCardImpl vcard = new VCardImpl();
    appyBasicName(vcard);
   
    PhotoType photo = new PhotoType();
    photo.setImageMediaType(ImageMediaType.PNG);
    photo.setEncodingType(EncodingType.BASE64);
    photo.setCompression(true);

    byte[] tuxPicture1 = Util.getFileAsBytes(new File("test/images/smallTux.png"));
    photo.setPhoto(tuxPicture1);
   
    vcard.addPhoto(photo);
    String result = getSerializedString(vcard);
    assertTrue(result.contains("PHOTO;ENCODING=BASE64;TYPE=PNG:"));
  }
View Full Code Here

Examples of net.sourceforge.cardme.vcard.VCardImpl

    assertTrue(result.contains("PHOTO;ENCODING=BASE64;TYPE=PNG:"));
  }
 
  @Test
  public void testKey() throws VCardBuildException {
    VCardImpl vcard = new VCardImpl();
    appyBasicName(vcard);
   
    KeyType key = new KeyType("plain text key", KeyTextType.PGP);
    vcard.addKey(key);
    key = new KeyType("binary data".getBytes(), KeyTextType.X509);
    vcard.addKey(key);

    String result = getSerializedString(vcard);
    assertTrue(result.contains("KEY;TYPE=PGP:plain text key"));
    assertTrue(result.contains("KEY;ENCODING=B;TYPE=X509:YmluYXJ5IGRhdGE="));
  }
View Full Code Here

Examples of net.sourceforge.cardme.vcard.VCardImpl

      f = it.get(6);
      assertEquals("X-EVOLUTION-ANNIVERSARY", f.getExtendedName());
      assertEquals("1980-03-22", f.getExtendedValue());
    }
   
    VCardImpl vcard2 = (VCardImpl)vcard;
   
    if(vcard2.hasErrors()) {
      List<VCardError> errors = vcard2.getErrors();
      for(VCardError error : errors) {
        System.out.println(error.getErrorMessage());
        System.out.println(error.getSeverity());
        System.out.println(StringUtil.formatException(error.getError()));
      }
View Full Code Here

Examples of net.sourceforge.cardme.vcard.VCardImpl

      assertEquals("item2", f.getGroup());
      assertEquals("X-ABLABEL", f.getExtendedName());
      assertEquals("_$!<Spouse>!$_", f.getExtendedValue());
    }
   
    VCardImpl vcard2 = (VCardImpl)vcard;
   
    if(vcard2.hasErrors()) {
      List<VCardError> errors = vcard2.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

      assertEquals("item5", f.getGroup());
      assertEquals("X-ABLABEL", f.getExtendedName());
      assertEquals("_$!<HomePage>!$_", f.getExtendedValue());
    }
   
    VCardImpl vcard2 = (VCardImpl)vcard;
   
    if(vcard2.hasErrors()) {
      List<VCardError> errors = vcard2.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
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.