Package com.google.appengine.datanucleus.test.jdo

Examples of com.google.appengine.datanucleus.test.jdo.Person


    Entity e = ds.get(TestUtils.createKey(pojo, pojo.getId()));
    assertEquals("c", ((List<?>)e.getProperty("array")).get(0));
  }

  public void testEmbeddable() throws EntityNotFoundException {
    Person p = new Person();
    p.setName(new Name());
    p.getName().setFirst("jimmy");
    p.getName().setLast("jam");
    p.setAnotherName(new Name());
    p.getAnotherName().setFirst("anotherjimmy");
    p.getAnotherName().setLast("anotherjam");
    makePersistentInTxn(p, TXN_START_END);

    assertNotNull(p.getId());

    beginTxn();
    p = pm.getObjectById(Person.class, p.getId());
    p.getName().setLast("not jam");
    p.getName().setFirst("not jimmy");
    commitTxn();

    Entity entity = ds.get(TestUtils.createKey(p, p.getId()));
    assertNotNull(entity);
    assertEquals("not jimmy", entity.getProperty("first"));
    assertEquals("not jam", entity.getProperty("last"));
    assertEquals("anotherjimmy", entity.getProperty("anotherFirst"));
    assertEquals("anotherjam", entity.getProperty("anotherLast"));
View Full Code Here


    e.setProperty("anotherFirst", "anotherjimmy");
    e.setProperty("anotherLast", "anotherjam");
    ds.put(e);
    commitTxn();
    beginTxn();
    Person p = pm.getObjectById(Person.class, KeyFactory.keyToString(e.getKey()));
    assertNotNull(p);
    assertNotNull(p.getName());
    assertEquals("jimmy", p.getName().getFirst());
    assertEquals("jam", p.getName().getLast());
    assertNotNull(p.getAnotherName());
    assertEquals("anotherjimmy", p.getAnotherName().getFirst());
    assertEquals("anotherjam", p.getAnotherName().getLast());
  }
View Full Code Here

    e.setProperty("first", "jimmy");
    e.setProperty("last", "jam");
    ds.put(e);
    commitTxn();
    beginTxn();
    Person p = pm.getObjectById(Person.class, KeyFactory.keyToString(e.getKey()));
    assertNotNull(p);
    assertNotNull(p.getName());
    assertEquals("jimmy", p.getName().getFirst());
    assertEquals("jam", p.getName().getLast());
    assertNotNull(p.getAnotherName());
    assertNull(p.getAnotherName().getFirst());
    assertNull(p.getAnotherName().getLast());
  }
View Full Code Here

    assertNotNull(hk.getKey());
    assertEquals("name", hk.getKey().getName());
  }

  public void testEmbeddable() throws EntityNotFoundException {
    Person p = new Person();
    p.setName(new Name());
    p.getName().setFirst("jimmy");
    p.getName().setLast("jam");
    p.setAnotherName(new Name());
    p.getAnotherName().setFirst("anotherjimmy");
    p.getAnotherName().setLast("anotherjam");
    makePersistentInTxn(p, TXN_START_END);

    assertNotNull(p.getId());

    Entity entity = ds.get(KeyFactory.createKey(Person.class.getSimpleName(), p.getId()));
    assertNotNull(entity);
    assertEquals("jimmy", entity.getProperty("first"));
    assertEquals("jam", entity.getProperty("last"));
    assertEquals("anotherjimmy", entity.getProperty("anotherFirst"));
    assertEquals("anotherjam", entity.getProperty("anotherLast"));
View Full Code Here

    assertEquals("anotherjimmy", entity.getProperty("anotherFirst"));
    assertEquals("anotherjam", entity.getProperty("anotherLast"));
  }

  public void testNullEmbeddable() throws EntityNotFoundException {
    Person p = new Person();
    p.setName(new Name());
    p.getName().setFirst("jimmy");
    p.getName().setLast("jam");
    makePersistentInTxn(p, TXN_START_END);

    assertNotNull(p.getId());

    Entity entity = ds.get(KeyFactory.createKey(Person.class.getSimpleName(), p.getId()));
    assertNotNull(entity);
    assertEquals("jimmy", entity.getProperty("first"));
    assertEquals("jam", entity.getProperty("last"));
    assertNull(entity.getProperty("anotherFirst"));
    assertNull(entity.getProperty("anotherLast"));
View Full Code Here

TOP

Related Classes of com.google.appengine.datanucleus.test.jdo.Person

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.