Package honeycrm.client.dto

Examples of honeycrm.client.dto.Dto


    assertEquals(100, r.getItemCount());
    assertEquals(100, r.getResults().length);
  }

  public void testFulltextSearchOnSingleModule() {
    final Dto contact = new Dto(Contact.class.getSimpleName());
    for (int i = 0; i < 10; i++) {
      contact.set("name", "foo" + i);
      createService.create(contact);
    }

    final ListQueryResult r = reader.fulltextSearchForModule(Contact.class.getSimpleName(), "foo", 0, 100);
View Full Code Here


    assertEquals(1, r2.getItemCount());
  }

  public void testFulltextSearchOnAllModules() {
    for (int i = 0; i < 10; i++) {
      final Dto c = new Dto("Contact");
      final Dto a = new Dto("Account");
      final Dto p = new Dto("Product");

      c.set("name", "contact" + i);
      a.set("name", "account" + i);
      p.set("name", "product" + i);

      if (i % 2 == 0) { // every second product has a description too
        p.set("description", "product description 42 " + i);
      }

      createService.create(c);
      createService.create(a);
      createService.create(p);
View Full Code Here

  }

  public void testGetByName() {
    final Entity e = createContact();

    final Dto dto = reader.getByName(Contact.class.getSimpleName(), e.getProperty("name").toString());
    assertEquals(e.getProperty("name").toString(), dto.get("name").toString());

    assertNull(reader.getByName(Contact.class.getSimpleName(), String.valueOf(random.nextDouble())));
    assertNull(reader.getByName(Contact.class.getSimpleName(), null));
  }
View Full Code Here

    final Entity account = createAccount();
    final Entity contact = createContact();
    contact.setProperty("accountId", account.getKey());
    db.put(contact);

    final Dto cwa = reader.get(Contact.class.getSimpleName(), contact.getKey().getId());
    assertTrue(null != cwa.get("accountId_resolved") && ((Dto) cwa.get("accountId_resolved")).get("name").equals(account.getProperty("name")));
  }
View Full Code Here

    final Entity contract = new Entity(Contract.class.getSimpleName());
    contract.setProperty("uniqueServices", serviceKeys);
    db.put(contract);

    final Dto contractDto = reader.get(Contract.class.getSimpleName(), contract.getKey().getId());
    assertEquals(1, ((List<?>) contractDto.get("uniqueServices")).size());
    assertTrue(((List<?>) contractDto.get("uniqueServices")).get(0) instanceof Dto);
    assertEquals(product.getKey().getId(), ((List<Dto>) contractDto.get("uniqueServices")).get(0).get("productID"));
  }
View Full Code Here

    }
    // Thread.sleep(1000 * 60 * 60);
  }
 
  public void testGetEntityContainingCycle() {
    final Dto p1 = new Dto(Product.class.getSimpleName());
    p1.set("name", "p1");
    final long p1Id = createService.create(p1);
   
    final Dto p2 = new Dto(Product.class.getSimpleName());
    p2.set("name", "p2");
    p2.set("predecessor", p1Id);
    final long p2Id = createService.create(p2);
   
    Dto p1Retrieved = reader.get(Product.class.getSimpleName(), p1Id);
    p1Retrieved.set("predecessor", p2Id);
    updateService.update(p1Retrieved);
   
    reader.get(Product.class.getSimpleName(), p1Id);
  }
View Full Code Here

   
    reader.get(Product.class.getSimpleName(), p1Id);
  }
 
  public void testGetEntityWithNonExistingReference() {
    final Dto p1 = new Dto(Product.class.getSimpleName());
    p1.set("name", "p1");
    final long p1Id = createService.create(p1);
   
    final Dto p2 = new Dto(Product.class.getSimpleName());
    p2.set("name", "p2");
    p2.set("predecessor", p1Id);
    final long p2Id = createService.create(p2);
   
    deleteService.delete(Product.class.getSimpleName(), p1Id);
   
    final Dto retrievedP2 = reader.get(Product.class.getSimpleName(), p2Id);
    assertNotNull(retrievedP2);
  }
View Full Code Here

public class CrudOperationTests extends DatastoreTest {
  private ReportServiceImpl reportService = new ReportServiceImpl();

  public void testCreating() {
    final Dto dto = new Dto(Contact.class.getSimpleName());
    assertTrue(createService.create(dto) > 0);
  }
View Full Code Here

    final long createTime = Timer.getTime(new Command() {
      @Override
      public void execute() {
        for (int i = 0; i < count; i++) {
          final Dto dto = new Dto();
          dto.setModule(Contact.class.getSimpleName());
          final String suffix = String.valueOf(r.nextLong());
          dto.set("name", "some contact" + suffix);
          dto.set("email", "email" + suffix);
          dto.set("name", "name" + suffix);
          dto.set("city", "city" + suffix);
          dto.set("phone", "phone" + suffix);
          dto.set("emailOptedOut", r.nextBoolean());
          dto.set("doNotCall", r.nextBoolean());
          dto.set("mobile", "mobile" + suffix);
          dto.set("doNotCallExplanation", "explanation" + suffix);
          dto.set("bankAccountData", "bank" + suffix);
          dto.set("profession", "Student" + suffix);
          dto.set("study", "Biology" + suffix);

          ids[i] = createService.create(dto);
        }
      }
    });
View Full Code Here

      System.out.println("getAll " + (1 + i) + "/" + getAllIterations + " times for " + count + " entities in " + getAllTime + "ms (" + (count / getAllTime) + " entities/ms)");
    }
  }

  public void testUpdating() {
    final Dto before = DemoDataProvider.contact();
    before.set("name", "before");

    final long id = createService.create(before);
    assertTrue(id > 0);

    final Dto loaded = readService.get(Contact.class.getSimpleName(), id);
    assertEquals("before", loaded.get("name"));
    loaded.set("name", "after");

    updateService.update(loaded);

    final Dto after = readService.get(Contact.class.getSimpleName(), id);
    assertEquals("after", after.get("name"));
  }
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.