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

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


    // TODO(maxr,bslatkin): Remove this next line once this test
    // is actually working properly.
    pm.currentTransaction().setRetainValues(false);
   
    try {
      HasPromotedTypesJDO pojo = new HasPromotedTypesJDO();
      pojo.setIntVal(33);
      pojo.setIntegerVal(34);
      pojo.setIntArray(new int[] {0, 1, 2});
      pojo.setIntegerArray(new Integer[] {3, 4, 5});
      pojo.setIntList(Utils.newArrayList(3, 4, 5));
      pojo.setIntSet(Utils.newHashSet(3, 4, 5));
      pojo.setIntLinkedList(Utils.newLinkedList(31, 41, 51));
      pojo.setIntLinkedHashSet(Utils.newLinkedHashSet(31, 41, 51));
      pojo.setLongPrimVal(35L);
      pojo.setLongVal(36L);
      pojo.setLongPrimArray(new long[] {6L, 7L, 8L});
      pojo.setLongArray(new Long[] {9L, 10L, 11L});
      pojo.setLongList(Utils.newArrayList(12L, 13L, 14L));
      pojo.setLongSet(Utils.newHashSet(12L, 13L, 14L));
      pojo.setLongLinkedList(Utils.newLinkedList(121L, 131L, 141L));
      pojo.setLongLinkedHashSet(Utils.newLinkedHashSet(121L, 131L, 141L));
      pm.currentTransaction().begin();
      pm.makePersistent(pojo);
      pm.currentTransaction().commit();

      pojo = pm.getObjectById(HasPromotedTypesJDO.class, pojo.getId());
      assertEquals(33, pojo.getIntVal());
      assertEquals(Integer.valueOf(34), pojo.getIntegerVal());
      assertTrue(Arrays.equals(new int[] {0, 1, 2}, pojo.getIntArray()));
      assertTrue(Arrays.equals(new Integer[] {3, 4, 5}, pojo.getIntegerArray()));
      assertEquals(Utils.newArrayList(3, 4, 5), pojo.getIntList());
      assertEquals(Utils.newHashSet(3, 4, 5), pojo.getIntSet());
      assertEquals(Utils.newLinkedList(31, 41, 51), pojo.getIntLinkedList());
      assertEquals(Utils.newLinkedHashSet(31, 41, 51), pojo.getIntLinkedHashSet());
      assertEquals(35L, pojo.getLongPrimVal());
      assertEquals(Long.valueOf(36L), pojo.getLongVal());
      assertTrue(Arrays.equals(new long[] {6L, 7L, 8L}, pojo.getLongPrimArray()));
      assertTrue(Arrays.equals(new Long[] {9L, 10L, 11L}, pojo.getLongArray()));
      assertEquals(Utils.newArrayList(12L, 13L, 14L), pojo.getLongList());
      assertEquals(Utils.newHashSet(12L, 13L, 14L), pojo.getLongSet());
      assertEquals(Utils.newLinkedList(121L, 131L, 141L), pojo.getLongLinkedList());
      assertEquals(Utils.newLinkedHashSet(121L, 131L, 141L), pojo.getLongLinkedHashSet());
    } finally {
      pm.close();
      pmf.close();
    }
  }
View Full Code Here

TOP

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

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.