Examples of NullDataJPA


Examples of com.google.appengine.datanucleus.test.jpa.NullDataJPA

  public void testFetchNullData() {
    Entity e = new Entity(NullDataJPA.class.getSimpleName());
    ds.put(e);
    beginTxn();
    NullDataJPA pojo = em.find(NullDataJPA.class, KeyFactory.keyToString(e.getKey()));
    assertNotNull(pojo.getArray());
    assertEquals(0, pojo.getArray().length);
    assertNotNull(pojo.getList());
    assertTrue(pojo.getList().isEmpty());
    assertTrue(pojo.getSet().isEmpty());
    assertTrue(pojo.getIntegerList().isEmpty());
    assertTrue(pojo.getIntegerSet().isEmpty());
    assertNull(pojo.getString());
    commitTxn();
  }
View Full Code Here

Examples of com.google.appengine.datanucleus.test.jpa.NullDataJPA

  public void testFetchNullValue() {
    Entity e = new Entity(NullDataJPA.class.getSimpleName());
    e.setProperty("list", null);
    ds.put(e);
    beginTxn();
    NullDataJPA pojo = em.find(NullDataJPA.class, e.getKey());
    assertNotNull(pojo.getList());
    assertNotNull(pojo.getSet());
    assertNotNull(pojo.getIntegerList());
    assertNotNull(pojo.getIntegerSet());
    assertTrue(pojo.getList().isEmpty());
    assertTrue(pojo.getSet().isEmpty());
    assertTrue(pojo.getIntegerList().isEmpty());
    assertTrue(pojo.getIntegerSet().isEmpty());
  }
View Full Code Here

Examples of com.google.appengine.datanucleus.test.jpa.NullDataJPA

    e.setProperty("set", Utils.newArrayList((String) null));
    e.setProperty("integerList", Utils.newArrayList((Integer) null));
    e.setProperty("integerSet", Utils.newArrayList((Integer) null));
    ds.put(e);
    beginTxn();
    NullDataJPA pojo = em.find(NullDataJPA.class, e.getKey());
    assertNotNull(pojo.getList());
    assertEquals(1, pojo.getList().size());
    assertNull(pojo.getList().get(0));
    assertNotNull(pojo.getSet());
    assertEquals(1, pojo.getSet().size());
    assertNull(pojo.getSet().iterator().next());

    assertNotNull(pojo.getIntegerList());
    assertEquals(1, pojo.getIntegerList().size());
    assertNull(pojo.getIntegerList().get(0));
    assertNotNull(pojo.getIntegerSet());
    assertEquals(1, pojo.getIntegerSet().size());
    assertNull(pojo.getIntegerSet().iterator().next());
  }
View Full Code Here

Examples of com.google.appengine.datanucleus.test.jpa.NullDataJPA

    assertNull(pojo.getIntegerSet().iterator().next());
  }


  public void testInsertNullData() throws EntityNotFoundException {
    NullDataJPA pojo = new NullDataJPA();
    beginTxn();
    em.persist(pojo);
    commitTxn();
    Entity e = ds.get(KeyFactory.createKey(NullDataJPA.class.getSimpleName(), pojo.getId()));
    Set<String> props = e.getProperties().keySet();
    assertEquals(Utils.newHashSet("string", "array", "list", "set", "integerList", "integerSet"), props);
    for (Object val : e.getProperties().values()) {
      assertNull(val);
    }
View Full Code Here

Examples of com.google.appengine.datanucleus.test.jpa.NullDataJPA

      assertNull(val);
    }
  }

  public void testInsertContainersWithOneNullElement() throws EntityNotFoundException {
    NullDataJPA pojo = new NullDataJPA();
    List<String> list = Utils.newArrayList();
    list.add(null);
    pojo.setList(list);
    Set<String> set = Utils.newHashSet();
    set.add(null);
    pojo.setSet(set);
    List<Integer> integerList = Utils.newArrayList();
    integerList.add(null);
    pojo.setIntegerList(integerList);
    Set<Integer> integerSet = Utils.newHashSet();
    integerSet.add(null);
    pojo.setIntegerSet(integerSet);
    pojo.setArray(new String[] {null});
    beginTxn();
    em.persist(pojo);
    commitTxn();
    Entity e = ds.get(KeyFactory.createKey(NullDataJPA.class.getSimpleName(), pojo.getId()));
    assertEquals(1, ((List<?>)e.getProperty("array")).size());
    assertEquals(1, ((List<?>)e.getProperty("list")).size());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.