Examples of SimpleEntity


Examples of org.apache.openjpa.persistence.query.SimpleEntity

    public void testCollectionPC() {
        OpenJPAEntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        ManagedIface pc = em.createInstance(ManagedIface.class);
        Set set = new HashSet();
        set.add(new SimpleEntity("a", "3"));
        set.add(new SimpleEntity("b", "4"));
        set.add(new SimpleEntity("c", "5"));
        pc.setSetPC(set);
        em.persist(pc);
        Object oid = em.getObjectId(pc);
        em.getTransaction().commit();
        em.close();

        em = emf.createEntityManager();
        pc = em.find(ManagedIface.class, oid);
        set = pc.getSetPC();
        assertEquals(3, set.size());
        Collection seen = new ArrayList();
        SimpleEntity rel;
        SimpleEntity toRem = null;
        for (Iterator it = set.iterator(); it.hasNext();) {
            rel = (SimpleEntity) it.next();
            seen.add(rel.getName());
            if (rel.getValue().equals("4"))
                toRem = rel;
        }
        assertEquals(3, seen.size());
        assertTrue(seen.contains("a"));
        assertTrue(seen.contains("b"));
        assertTrue(seen.contains("c"));
        em.getTransaction().begin();
        assertNotNull(toRem);
        set.remove(toRem);
        set.add(new SimpleEntity("x", "14"));
        set.add(new SimpleEntity("y", "15"));
        em.getTransaction().commit();
        em.close();

        em = emf.createEntityManager();
        pc = em.find(ManagedIface.class, oid);
View Full Code Here

Examples of org.apache.openjpa.persistence.query.SimpleEntity

    protected Class<SimpleEntity> getManagedType() {
        return SimpleEntity.class;
    }

    protected SimpleEntity newManagedInstance() {
        SimpleEntity e = new SimpleEntity();
        e.setName("foo");
        e.setValue("bar");
        return e;
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.query.SimpleEntity

    public void testCollectionPC() {
        OpenJPAEntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        ManagedIface pc = em.createInstance(ManagedIface.class);
        Set set = new HashSet();
        set.add(new SimpleEntity("a", "3"));
        set.add(new SimpleEntity("b", "4"));
        set.add(new SimpleEntity("c", "5"));
        pc.setSetPC(set);
        em.persist(pc);
        Object oid = em.getObjectId(pc);
        em.getTransaction().commit();
        em.close();

        em = emf.createEntityManager();
        pc = em.find(ManagedIface.class, oid);
        set = pc.getSetPC();
        assertEquals(3, set.size());
        Collection seen = new ArrayList();
        SimpleEntity rel;
        SimpleEntity toRem = null;
        for (Iterator it = set.iterator(); it.hasNext();) {
            rel = (SimpleEntity) it.next();
            seen.add(rel.getName());
            if (rel.getValue().equals("4"))
                toRem = rel;
        }
        assertEquals(3, seen.size());
        assertTrue(seen.contains("a"));
        assertTrue(seen.contains("b"));
        assertTrue(seen.contains("c"));
        em.getTransaction().begin();
        assertNotNull(toRem);
        set.remove(toRem);
        set.add(new SimpleEntity("x", "14"));
        set.add(new SimpleEntity("y", "15"));
        em.getTransaction().commit();
        em.close();

        em = emf.createEntityManager();
        pc = em.find(ManagedIface.class, oid);
View Full Code Here

Examples of org.jboss.seam.test.unit.entity.SimpleEntity

   @Test
   public void testCreateInstance() {
      SimpleEntityHomeWithMessageStubs home = new SimpleEntityHomeWithMessageStubs();
      // emulate @Create method
      home.create();
      SimpleEntity entity = home.getInstance();
      assert entity != null : "Excepting a non-null instance";
      assert entity.getClass().equals(SimpleEntity.class) : "Expecting entity class to be " + SimpleEntity.class + " but got " + entity.getClass();
   }
View Full Code Here

Examples of org.jboss.test.bench.interfaces.SimpleEntity

      }

      public void run() {
        for (int i=0; i<numBeans; i++) {
          try {
            SimpleEntity bean = home.create(startId + i);
          } catch (Exception e) {
          }
        }
      }
    }
View Full Code Here

Examples of org.jboss.test.bench.interfaces.SimpleEntity

      }

      public void run() {
        for (int i=0; i<numBeans; i++) {
          try {
            SimpleEntity bean = home.create(startId + i);
          } catch (Exception e) {
          }
        }
      }
View Full Code Here

Examples of org.mongodb.morphia.entities.SimpleEntity

    }

    @Test
    public void shouldAllowValueWithEntityAnnotationAndTypeOfKey() {
        // expect
        assertThat(QueryValidator.isCompatibleForOperator(null, Key.class, EQUAL, new SimpleEntity(), new ArrayList<ValidationFailure>()),
                   is(true));
    }
View Full Code Here

Examples of org.ow2.easybeans.tests.common.ejbs.entity.simpleentity.SimpleEntity

        // verifies if the list returned has the same number of entities that
        // was created
        assertEquals(MAX_ENTITIES, queryResult.size(), "The method did not returned all entities.");

        for (int i = 0; i < queryResult.size(); i++) {
            SimpleEntity simpleEntity = (SimpleEntity) queryResult.get(i);
            assertEquals(simpleEntity.getId(), i, "The bean id was not correctly returned");
            assertEquals(simpleEntity.getName(), ENTITY_NAME_ROOT + Integer.toString(i),
                    "The bean name was not correctly returned");
        }
    }
View Full Code Here

Examples of org.ow2.easybeans.tests.common.ejbs.entity.simpleentity.SimpleEntity

    /**
     * Removes all entities that have the same id used in the beans under test.
     */
    private void removeBean() {
        for (int i = 0; i < MAX_ENTITIES; i++) {
            SimpleEntity simpleEntity = entityManager.find(SimpleEntity.class, new Integer(i));
            if (simpleEntity != null) {
                entityManager.remove(simpleEntity);
            }
            entityManager.flush();
        }
View Full Code Here

Examples of org.ow2.easybeans.tests.common.ejbs.entity.simpleentity.SimpleEntity

     * Create the entity beans used during the test.
     */
    private void createBeanTest() {

        for (int i = 0; i < MAX_ENTITIES; i++) {
            SimpleEntity simpleEntity = new SimpleEntity();
            simpleEntity.setId(i);
            simpleEntity.setName(ENTITY_NAME_ROOT + Integer.toString(i));
            entityManager.persist(simpleEntity);
            entityManager.flush();
       }

    }
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.