use of org.broadleafcommerce.profile.web.core.model.PhoneNameForm in project BroadleafCommerce by BroadleafCommerce.
the class CustomerPhoneControllerTestDataProvider method createCustomerPhone.
@DataProvider(name = "setupCustomerPhoneControllerData")
public static Object[][] createCustomerPhone() {
PhoneNameForm pnf1 = new PhoneNameForm();
Phone phone1 = new PhoneImpl();
phone1.setPhoneNumber("111-222-3333");
pnf1.setPhone(phone1);
pnf1.setPhoneName("phone_1");
PhoneNameForm pnf2 = new PhoneNameForm();
Phone phone2 = new PhoneImpl();
phone2.setPhoneNumber("222-333-4444");
pnf2.setPhone(phone2);
pnf2.setPhoneName("phone_2");
return new Object[][] { new Object[] { pnf1 }, new Object[] { pnf2 } };
}
use of org.broadleafcommerce.profile.web.core.model.PhoneNameForm in project BroadleafCommerce by BroadleafCommerce.
the class CustomerPhoneControllerTest method viewExistingCustomerPhoneFromController.
@Test(groups = "viewExistingCustomerPhoneFromController", dependsOnGroups = "createCustomerPhoneFromController")
@Transactional
public void viewExistingCustomerPhoneFromController() {
List<CustomerPhone> phones_1 = customerPhoneService.readAllCustomerPhonesByCustomerId(userId);
PhoneNameForm pnf = new PhoneNameForm();
BindingResult errors = new BeanPropertyBindingResult(pnf, "phoneNameForm");
Customer customer = customerService.readCustomerByUsername("customer1");
request = this.getNewServletInstance();
request.setAttribute(CustomerStateRequestProcessor.getCustomerRequestAttributeName(), customer);
String view = customerPhoneController.viewPhone(phones_1.get(0).getId(), request, pnf, errors);
assert (view.indexOf(SUCCESS) >= 0);
assert (request.getAttribute("customerPhoneId").equals(phones_1.get(0).getId()));
}
use of org.broadleafcommerce.profile.web.core.model.PhoneNameForm in project BroadleafCommerce by BroadleafCommerce.
the class CustomerPhoneControllerTest method viewCustomerPhoneFromController.
@Test(groups = "viewCustomerPhoneFromController")
public void viewCustomerPhoneFromController() {
PhoneNameForm pnf = new PhoneNameForm();
BindingResult errors = new BeanPropertyBindingResult(pnf, "phoneNameForm");
request = this.getNewServletInstance();
String view = customerPhoneController.viewPhone(null, request, pnf, errors);
assert (view.indexOf(SUCCESS) >= 0);
assert (request.getAttribute("customerPhoneId") == null);
}
use of org.broadleafcommerce.profile.web.core.model.PhoneNameForm in project BroadleafCommerce by BroadleafCommerce.
the class CustomerPhoneController method initPhoneNameForm.
/**
* Called before each and every request comes into the controller, and is placed on the request for use by those methods.
*
* @param request
* @param model
*
* @return
*/
@ModelAttribute("phoneNameForm")
public PhoneNameForm initPhoneNameForm(HttpServletRequest request, Model model) {
PhoneNameForm form = new PhoneNameForm();
form.setPhone((Phone) entityConfiguration.createEntityInstance("org.broadleafcommerce.profile.core.domain.Phone"));
return form;
}
Aggregations