Examples of NullDataJDO


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

    Entity e = ds.get(TestUtils.createKey(pojo, pojo.getId()));
    assertEquals(3, ((List<?>)e.getProperty("strSortedSet")).size());
  }

  public void testUpdateArray_Reset() throws EntityNotFoundException {
    NullDataJDO pojo = new NullDataJDO();
    String[] array = new String[] {"a", "b"};
    pojo.setArray(array);
    beginTxn();
    pm.makePersistent(pojo);
    commitTxn();
    pm.close();
    pm = pmf.getPersistenceManager();
    beginTxn();
    pojo = pm.getObjectById(NullDataJDO.class, pojo.getId());
    array = new String[] {"a", "b", "c"};
    pojo.setArray(array);
    commitTxn();
    Entity e = ds.get(TestUtils.createKey(pojo, pojo.getId()));
    assertEquals(3, ((List<?>)e.getProperty("array")).size());
  }
View Full Code Here

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

  }

  // There's really no way to make this pass since we can't intercept
  // calls that modify array elements.
  public void xxxtestUpdateArray_ModifyExistingElement() throws EntityNotFoundException {
    NullDataJDO pojo = new NullDataJDO();
    String[] array = new String[] {"a", "b"};
    pojo.setArray(array);
    beginTxn();
    pm.makePersistent(pojo);
    commitTxn();
    pm.close();
    pm = pmf.getPersistenceManager();
    beginTxn();
    pojo = pm.getObjectById(NullDataJDO.class, pojo.getId());
    pojo.getArray()[0] = "c";
    pojo.setArray(array);
    commitTxn();
    Entity e = ds.get(TestUtils.createKey(pojo, pojo.getId()));
    assertEquals("c", ((List<?>)e.getProperty("array")).get(0));
  }
View Full Code Here

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

  public void testFetchNullValue() {
    Entity e = new Entity(NullDataJDO.class.getSimpleName());
    e.setProperty("list", null);
    ds.put(e);
    beginTxn();
    NullDataJDO pojo = pm.getObjectById(NullDataJDO.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.jdo.NullDataJDO

    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();
    NullDataJDO pojo = pm.getObjectById(NullDataJDO.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.jdo.NullDataJDO

    assertEquals(1, pojo.getIntegerSet().size());
    assertNull(pojo.getIntegerSet().iterator().next());
  }

  public void testInsertNullData() throws EntityNotFoundException {
    NullDataJDO pojo = new NullDataJDO();
    beginTxn();
    pm.makePersistent(pojo);
    commitTxn();
    Entity e = ds.get(KeyFactory.createKey(NullDataJDO.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.jdo.NullDataJDO

      assertNull(val);
    }
  }

  public void testInsertContainersWithOneNullElement() throws EntityNotFoundException {
    NullDataJDO pojo = new NullDataJDO();
    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();
    pm.makePersistent(pojo);
    commitTxn();
    Entity e = ds.get(KeyFactory.createKey(NullDataJDO.class.getSimpleName(), pojo.getId()));
    assertEquals(1, ((List<?>)e.getProperty("array")).size());
    assertEquals(1, ((List<?>)e.getProperty("list")).size());
  }
View Full Code Here

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

  public void testFetchNullData() {
    Entity e = new Entity(NullDataJDO.class.getSimpleName());
    ds.put(e);
    beginTxn();
    NullDataJDO pojo = pm.getObjectById(NullDataJDO.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
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.