Package honeycrm.client.dto

Examples of honeycrm.client.dto.Dto


    for (final Dto product : DemoDataProvider.getProducts(100)) {
      productIds.add(createService.create(product));
    }

    final Dto contract = getContract(count, productIds);

    long lastId = -1;

    System.out.print("creating.. ");
    for (int i=0; i<100; i++) {
      lastId = createService.create(contract);
    }
    System.out.println("done.");

    System.out.print("get all.. ");
    for (int i=0; i<10; i++) {
      readService.getAll(contractModule, 0, 100);
    }
    System.out.println("done.");
   
    System.out.print("get.. ");
    for (int i = 0; i < 1000; i++) {
      final Dto retrieved = readService.get(contractModule, lastId);
      assertNotNull(retrieved);
    }
    System.out.println("done.");

    // for profiling this might be useful..
View Full Code Here


    for (final Dto service : services) {
      service.set("productID", productIds.get(random.nextInt(count)));
    }

    final Dto contract = new Dto();
    contract.setModule(Contract.class.getSimpleName());
    contract.set("uniqueServices", services);
    return contract;
  }
View Full Code Here

  }

  private ArrayList<Dto> getDtos() {
    final ArrayList<Dto> dtos = new ArrayList<Dto>();
    for (int i = 0; i < 4; i++) {
      final Dto dto = new Dto(module);
      dto.set("price", i % 2 == 0 ? (int) i : (long) i); // every 2nd dto uses Long instead of Integer
      dto.set("quantity", i % 2 == 0 ? (int) i : (long) i);
      dtos.add(dto);
    }
    return dtos;
  }
View Full Code Here

    presenter.setValue(new ArrayList<Dto>());
    assertTrue(presenter.getValue().isEmpty());
  }

  public void testSumForSingleRow() {
    final Dto s = new Dto(module);
    s.set("price", 2);
    s.set("discount", 1);
    s.set("kindOfDiscount", "abs");
    s.set("quantity", 3);

    assertEquals((2 - 1) * 3, (int) presenter.getSumForSingleDto(s));
  }
View Full Code Here

  public void testRowChanged() {
    presenter.setValue(getDtos());
  }

  public void testEnumFieldsHaveValidDefaultsSet() {
    final Dto newDto = DtoModuleRegistry.instance().get(UniqueService.class.getSimpleName()).createDto();

    for (final String field : new String[] { "unit", "kindOfDiscount" }) {
      final Serializable value = newDto.get(field);

      assertNotNull(value);
      assertFalse(value.toString().isEmpty());
    }
  }
View Full Code Here

      assertFalse(value.toString().isEmpty());
    }
  }

  public void testOnItemUpdate() {
    final Dto s = new Dto(UniqueService.class.getSimpleName());
    presenter.onItemUpdated(0, s);
  }
View Full Code Here

  public void testAdd() {
    presenter.add();
  }

  public void testSetGetValue() {
    final Dto service = new Dto(UniqueService.class.getSimpleName());
    service.set("price", 23);
    service.set("quantity", 1);
    service.set("productCode", "foo");
   
    final ArrayList<Dto> list = new ArrayList<Dto>();
    list.add(service);

    presenter.setValue(list);

    assertFalse(presenter.getValue().isEmpty());
    assertEquals(service.get("price"), presenter.getValue().get(0).get("price"));
    assertEquals(service.get("productCode"), presenter.getValue().get(0).get("productCode"));
  }
View Full Code Here

  private final CreateServiceImpl create = new CreateServiceImpl();
  private final UpdateServiceImpl updater = new UpdateServiceImpl();
  private final ReadServiceImpl reader = new ReadServiceImpl();

  public void testUpdating() {
    final Dto contact = new Dto("Contact");
    contact.set("name", "Foo");

    final long contactId = create.create(contact);

    final Dto retrievedContact1 = reader.get("Contact", contactId);
    assertEquals("Foo", retrievedContact1.get("name"));
   
    contact.setId(contactId);
    contact.set("name", "Bar");

    updater.update(contact);

    final Dto retrievedContact2 = reader.get("Contact", contactId);
    assertEquals("Bar", retrievedContact2.get("name"));
  }
View Full Code Here

    final Dto retrievedContact2 = reader.get("Contact", contactId);
    assertEquals("Bar", retrievedContact2.get("name"));
  }
 
  public void testUpdatingRelateField() {
    final Dto contact = new Dto("Contact");
    final long id = create.create(contact);
   
    final Dto retrievedContact = reader.get("Contact", id);
    retrievedContact.set("accountId", 0L); // <- this indicates that nothing has been selected yet. so no Key should be created either.
    updater.update(retrievedContact);
 
    final Dto retrievedContact2 = reader.get("Contact", id);
    assertEquals(retrievedContact.get("accountId"), retrievedContact2.get("accountId"));
  }
View Full Code Here

    final Dto retrievedContact2 = reader.get("Contact", id);
    assertEquals(retrievedContact.get("accountId"), retrievedContact2.get("accountId"));
  }

  public void testUpdatingRelateField2() {
    final Dto contact = new Dto("Contact");
    final long contactId = create.create(contact);
   
    final Dto offering = new Dto("Offering");
    offering.set("contactId", contactId);
    final long offeringId = create.create(offering);
   
    final Dto retrievedOffering = reader.get("Offering", offeringId);
   
    retrievedOffering.set("someupdatedfield", 42);
    updater.update(retrievedOffering);
   
    create.create(retrievedOffering);
  }
View Full Code Here

TOP

Related Classes of honeycrm.client.dto.Dto

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.