Package wicket.contrib.phonebook

Examples of wicket.contrib.phonebook.Contact


{
    @Test
  public void testLoad() throws Exception
  {
    ContactDao dao = EasyMock.createMock(ContactDao.class);
    Contact expected = new Contact();
    expected.setId(007);
    expected.setFirstname("James");
    expected.setLastname("Bond");
    expected.setEmail("james.bond@mi5.gov.uk");
    EasyMock.expect(dao.load(expected.getId())).andReturn(expected);
    EasyMock.replay(dao);
    DetachableContactModel model = new DetachableContactModel(expected, dao);
    assertEquals(expected, model.load());
    EasyMock.verify(dao);
  }
View Full Code Here


  @Test
  public void testFind() throws Exception
  {
    QueryParam qp = new QueryParam(0, 10, "foo", true);
    Contact contact = createMockContext();
    Iterator<Contact> expected = createContactResultList(contact);
    EasyMock.expect(dao.find(qp, contact)).andReturn(expected);
    EasyMock.replay(dao);
    ContactsDataProvider provider = new ContactsDataProvider(dao);
    provider.setQueryParam(qp);
View Full Code Here

    assertEquals(expected, result);
  }

  private Contact createMockContext()
  {
    Contact contact = new Contact();
    contact.setFirstname("James");
    contact.setLastname("Bond");
    return contact;
  }
View Full Code Here

  public void addStubs(MockContext context)
  {
    context.putBean("contactDao", contactData.getContactDao());
    for (int i = 0; i < 30; i++)
    {
      Contact contact = new Contact();
      contact.setFirstname(randomString(FIRSTNAMES));
      contact.setLastname(randomString(LASTNAMES));
      contact.setPhone(generatePhoneNumber());
      contact.setEmail(createEmail(contact));
      contactData.newContact(contact);
    }
  }
View Full Code Here

       * Go to the Edit page when the link is clicked, passing an empty Contact details
       */
      @Override
      public void onClick()
      {
        setResponsePage(new EditContactPage(getPage(), Model.of(new Contact())));
      }
    });
  }
View Full Code Here

   */
  public EditContactPage(Page backPage, IModel<?> contactModel)
  {
    this.backPage = backPage;

    Contact contact = (Contact)contactModel.getObject();
    Form<Contact> form = new Form<Contact>("contactForm", new CompoundPropertyModel<Contact>(
      contact));
    add(form);

    form.add(newRequiredTextField("firstname", 32));
View Full Code Here

    }

    @Override
    public void onSubmit()
    {
      Contact contact = (Contact)getForm().getModelObject();
      contactDao.save(contact);
      String msg = MapVariableInterpolator.interpolate(
        getLocalizer().getString("status.save", this), new MicroMap<String, String>("name",
          contact.getFullName()));
      getSession().info(msg);
      setResponsePage(backPage);
    }
View Full Code Here

  private PhonebookApplicationForTesting app;
  private PhonebookFixture fixture;

  private static final Page getTestPage()
  {
    Contact contact = new Contact();
    contact.setId(99);
    contact.setFirstname("James");
    contact.setLastname("Bond");
    return new EditContactPage(new ListContactsPage(), Model.of(contact));
  }
View Full Code Here

      private static final long serialVersionUID = 1L;

      @Override
      public void onClick()
      {
        final Contact deleted = getContact();
        contactDao.delete(deleted.getId());
        String msg = MapVariableInterpolator.interpolate(
          getLocalizer().getString("status.deleted", this), new MicroMap<String, String>(
            "name", deleted.getFullName()));
        getSession().info(msg);
        setResponsePage(backPage);
      }
    };
    confirmLink.add(new AttributeModifier("value", new ResourceModel("confirm")));
View Full Code Here

  private PhonebookApplicationForTesting app;
  private PhonebookFixture fixture;

  private static final Page getTestPage()
  {
    Contact contact = new Contact();
    contact.setId(99);
    contact.setFirstname("Kare");
    contact.setLastname("Nuorteva");
    return new DeleteContactPage(new ListContactsPage(), new Model<Contact>(contact));
  }
View Full Code Here

TOP

Related Classes of wicket.contrib.phonebook.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.