Package org.spw.model

Examples of org.spw.model.Contact


public class MailMergerTest extends TestCase {

  public void testGetTokensNames() throws IntrospectionException {
    System.out.println("Test:" + getName());
    MailMerger merger = new MailMerger();
    Contact contact = new Contact();
   
    merger.setModel(contact);
    assertTrue("Property name not found",
        merger.getTokensNames().contains("$name"));
    assertTrue("Property address1 not found",
View Full Code Here


  }
 
  public void testGetFormatedContent() throws IntrospectionException {
    System.out.println("Test:" + getName());
    MailMerger merger = new MailMerger();
    Contact contact = new Contact();
    contact.setFirstName("MyFirstNameTest");
    contact.setLastName("MyLastNameTest");
    contact.setEmail("myemail@test.org");
   
    merger.setContent("This is a test about $title $firstName " +
        "$lastName with email $email");
    merger.setModel(contact);
    assertEquals("This is a test about  MyFirstNameTest " +
View Full Code Here

    protected void tearDown() throws Exception {
        ctrl.delete(ctrl.read(TEST_ID_NO_REMINDER));
        ctrl.delete(ctrl.read(TEST_ID_REMINDER_FUTURE));
        ctrl.delete(ctrl.read(TEST_ID_REMINDER_PASSED));
        ctrl.delete(ctrl.read(TEST_ID_REMINDER_TODAY));
        Contact contact = contactCtrl.read(TEST_ID_NO_REMINDER);
        if (contact != null) contactCtrl.delete(contact);
    }
View Full Code Here

   * @throws IntrospectionException
   */
  public void testGetHeaders() throws IntrospectionException {
    System.out.println("Test " + getName());
   
    MailExporter exporter = new MailExporter(new Contact());
    assertEquals(
        "address1,address2,country,email,fax,firstName,idContact,lastName,"
            + "locality,mobile,name,note,positionOccupied,postalCode,stateAddress,title,workPhone",
        exporter.getHeaders());
  }
View Full Code Here

   * @throws IntrospectionException
   */
  public void testGetValues() throws IntrospectionException {
    System.out.println("Test " + getName());

    Contact contact = new Contact();
    MailExporter exporter = new MailExporter(contact);
    contact.setAddress1("address1");
    contact.setAddress2("address2");
    Country australia = new Country("AU", "Australia");
    contact.setCountry(australia);
    contact.setEmail("email");
    contact.setFax("fax");
    contact.setFirstName("firstName");
    contact.setIdContact(9999999L);
    contact.setLastName("lastName");
    contact.setLocality("locality");
    contact.setMobile("mobile");
    contact.setNote("note");
    contact.setPositionOccupied("positionOccupied");
    contact.setPostalCode("postalCode");
    contact.setStateAddress("stateAddress");
    contact.setTitle("title");
    contact.setWorkPhone("workPhone");
    exporter.setModel(contact);
    assertEquals(
        "\"address1\",\"address2\",\"Australia\",\"email\",\"fax\","
            + "\"firstName\",9999999,\"lastName\","
            + "\"locality\",\"mobile\",\"firstName, lastName[9999999]\","
            + "\"note\",\"positionOccupied\",\"postalCode\",\"stateAddress\","
            + "\"title\",\"workPhone\"", exporter.getValues());
    Contact volunteer = new Volunteer();
    volunteer.setAddress1("address1");
    volunteer.setAddress2("address2");
    volunteer.setCountry(australia);
    volunteer.setEmail("email");
    volunteer.setFax("fax");
    volunteer.setFirstName("firstName");
    volunteer.setIdContact(9999999L);
    volunteer.setLastName("lastName");
    volunteer.setLocality("locality");
    volunteer.setMobile("mobile");
    volunteer.setNote("note");
    volunteer.setPositionOccupied("positionOccupied");
    volunteer.setPostalCode("postalCode");
    volunteer.setStateAddress("stateAddress");
    volunteer.setTitle("title");
    volunteer.setWorkPhone("workPhone");
    exporter.setModel(volunteer);
    assertEquals(
        "\"address1\",\"address2\",\"Australia\",\"email\",\"fax\","
            + "\"firstName\",9999999,\"lastName\","
            + "\"locality\",\"mobile\",\"firstName, lastName[9999999]\","
View Full Code Here

    final private List<Contact> aList;

    public ContactDataProvider() {
        // Put in dummy data for design time
        aList = new ArrayList();
        aList.add(new Contact());       
        // Wrap the list
        setList(aList);
    }
View Full Code Here

        }
    }
   
    public String buttonPreview_action() {
        if (!getSessionBean1().getEmailChoices().isEmpty()) {
            Contact contact = (Contact) getSessionBean1().
                    getEmailChoices().iterator().next();
            MailMerger merger = new MailMerger();
            merger.setContent((String) content.getText());
            try {
                merger.setModel(contact);
View Full Code Here

   
    public String buttonTokens_action() {
        MailMerger merger = new MailMerger();
        StringBuffer buffer= new StringBuffer();
        try {
            merger.setModel(new Contact());
            List<String> tokenList = merger.getTokensNames();
            for (String aToken : tokenList) {
                buffer.append(aToken);
                buffer.append("\n");
            }
View Full Code Here

TOP

Related Classes of org.spw.model.Contact

Copyright © 2018 www.massapicom. 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.