Package com.google.code.magja.model.customer

Examples of com.google.code.magja.model.customer.Customer


    }

    @Test
    public void testSetCustomer() {
        try {
            Customer customer = generateCustomer();
            customerService.save(customer);

            Cart cart = service.create(0);
            System.out.println("Created cart " + cart);
            cart.setCustomer(customer);
View Full Code Here


    }

    @Test
    public void testGetById() {
        try {
            Customer customer = generateCustomer();
            customerService.save(customer);

            Cart cart = service.create(0);
            cart.setCustomer(customer);
            service.setCustomer(cart);
View Full Code Here

    @Test
    public void testCreateOrderFromCart() {
        try {
            System.out.println("Creating customer");
            Customer customer = generateCustomer();
            customerService.save(customer);

            CustomerAddress shipAddr = generateAddress();
            CustomerAddress billAddr = generateAddress();
            shipAddr.setCustomer(customer);
View Full Code Here

            fail(e.getMessage());
        }
    }

    public static Customer generateCustomer() {
        Customer cust = new Customer();

        cust.setFirstName(MagjaStringUtils.randomString(5, 10));
        cust.setMiddleName(MagjaStringUtils.randomString(5, 10));
        cust.setLastName(MagjaStringUtils.randomString(5, 10));
        cust.setPassword("test12");
        cust.setPrefix("Herr");
        cust.setWebsiteId(1);
        cust.setGroupId(1);
        cust.setGender(Gender.MALE);
        String email = MagjaStringUtils.randomString(4, 5) + "@" + MagjaStringUtils.randomString(4, 5) + ".com";
        cust.setEmail(email.toLowerCase());

        // this include the date of birth on the customer, and it's works,
        // but, that attribute isn't listed when getting a customer from magento
        cust.set("dob", "1980-08-17 20:53:04");

        return cust;
    }
View Full Code Here

    for (Map.Entry<String, Object> att : attributes.entrySet())
      order.set(att.getKey(), att.getValue());

    // customer
    if (attributes.get("customer_id") != null) {
      Customer customer = new Customer();

      customer.setId(new Integer((String) attributes.get("customer_id")));
      if (attributes.get("customer_email") != null)
        customer.setEmail((String) attributes.get("customer_email"));
      if (attributes.get("customer_prefix") != null)
        customer.setPrefix((String) attributes.get("customer_prefix"));
      if (attributes.get("customer_firstname") != null)
        customer.setFirstName((String) attributes
            .get("customer_firstname"));
      if (attributes.get("customer_middlename") != null)
        customer.setMiddleName((String) attributes
            .get("customer_middlename"));
      if (attributes.get("customer_lastname") != null)
        customer.setLastName((String) attributes
            .get("customer_lastname"));
      if (attributes.get("customer_lastname") != null)
        customer.setLastName((String) attributes
            .get("customer_lastname"));
      if (attributes.get("customer_group_id") != null)
        customer.setGroupId(new Integer((String) attributes
            .get("customer_group_id")));
      if (attributes.get("customer_gender") != null) {
        Integer gender = new Integer((String) attributes
            .get("customer_gender"));
        customer.setGender(gender.equals(new Integer(1)) ? Gender.MALE
            : Gender.FEMALE);
      }

      order.setCustomer(customer);
    }
View Full Code Here

  public void setUp() throws Exception {
    service = RemoteServiceFactory.getCustomerRemoteService();
  }

  public static Customer generateCustomer() {
    Customer cust = new Customer();

    cust.setFirstName(MagjaStringUtils.randomString(5, 10));
    cust.setMiddleName(MagjaStringUtils.randomString(5, 10));
    cust.setLastName(MagjaStringUtils.randomString(5, 10));
    cust.setPassword("test12");
    cust.setPrefix("Mr.");
    cust.setWebsiteId(1);
    cust.setGroupId(1);
    cust.setGender(Gender.MALE);
    String email = MagjaStringUtils.randomString(4, 5) + "@" + MagjaStringUtils.randomString(4, 5) + ".com";
    cust.setEmail(email.toLowerCase());
   
    // this include the date of birth on the customer, and it's works,
    // but, that attribute isn't listed when getting a customer from magento
    cust.set("dob", "1980-08-17 20:53:04");

    return cust;
  }
View Full Code Here

   */
  @Test
  public void testSave() {

    // test creating a new customer
    Customer cust = generateCustomer();
    first_name = cust.getFirstName();

    try {
      service.save(cust);
      customer_id = cust.getId();
    } catch (ServiceException e) {
      fail(e.getMessage());
    }
  }
View Full Code Here

   */
  @Test
  public void testSaveAndUpdate() {

    // test creating a new customer
    Customer cust = generateCustomer();

    try {
      service.save(cust);
      customer_id = cust.getId();
    } catch (ServiceException e) {
      fail(e.getMessage());
    }

    // now update that customer with new data
    cust.setFirstName("John");
    cust.setMiddleName("Mark");
    cust.setLastName("Holland");
    cust.setPassword("abcd123");

    try {
      service.save(cust);
    } catch (ServiceException e) {
      fail(e.getMessage());
View Full Code Here

   */
  @Test
  public void testGetById() {
    testSave();
    try {
      Customer cust = service.getById(customer_id);
      System.out.println(cust.toString());
    } catch (ServiceException e) {
      fail(e.getMessage());
    }
  }
View Full Code Here

   */
  @Test
  public void testListCustomer() {
    testSave();

    Customer filter = new Customer();
    filter.setFirstName(first_name);

    try {
      List<Customer> results = service.list(filter);
      assertEquals(results.get(0).getId(), customer_id);

View Full Code Here

TOP

Related Classes of com.google.code.magja.model.customer.Customer

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.