Examples of SimpleEntity


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

        Query query = entityManager.createNamedQuery("findByName");
        query.setParameter("entityName", ENTITY_NAME_ROOT + Integer.toString((MAX_ENTITIES - 1)));
        List simpleEntityResult = query.getResultList();
        assertEquals(simpleEntityResult.size(), 1, "The query did not return any value.");
        for (int i = 0; i < simpleEntityResult.size(); i++) {
            SimpleEntity simpleEntity = (SimpleEntity) simpleEntityResult.get(i);
            assertEquals(simpleEntity.getId(), MAX_ENTITIES - 1, "The bean was not correctly returned");
         }
    }
View Full Code Here

Examples of stubs.cglib.SimpleEntity

        SimpleCollectionEntity col = new SimpleCollectionEntity();
        SimpleCollectionEntity col2 = new SimpleCollectionEntity();
        Collection<SimpleCollectionEntity> cols = new ArrayList<SimpleCollectionEntity>();
        cols.add(col);
        cols.add(col2);
        SimpleEntity e = new SimpleEntity();
        col.setSimpleEntity(e);
        col2.setSimpleEntity(e);
        sub.setEntity(new ArrayList<SimpleEntity>());
        sub.getEntity().add(e);
        e.setName("a name");
        e.setSimpleCollection(cols);
        e.setCglibEntity(sub);
        entityManager.persist(e);
        pk = e.getId();
        entityManager.getTransaction().commit();
        entityManager.close();
    }
View Full Code Here

Examples of stubs.cglib.SimpleEntity

    }

    @Test
    public void testCopyProperties() {
        assertNull("Null is cloned as null", BeanUtils.copyProperties(null));
        SimpleEntity e = entityManager.find(SimpleEntity.class, pk);
        SimpleEntity target = new SimpleEntity();
        BeanUtils.copyProperties(e, target);
        assertEquals("String copied", "a name", target.getName());
        assertNull("Non initialized object is not copied", target.getCglibEntity());
        assertNull("Non initialized collection is not copied", target.getSimpleCollection());
        SimpleInnerEntity inner = BeanUtils.copyProperties(e.getCglibEntity());
        assertNull("Non initialized CGLIB object is not cloned", inner);
        e.getSimpleCollection().size();
        e.getCglibEntity().getName();
        target = new SimpleEntity();
        BeanUtils.copyProperties(e, target);
        assertTrue("Initialized collection is copied", target.getSimpleCollection().size() == 2);
        assertNotNull("Initialized object is copied", target.getCglibEntity().getId());
        assertEquals("Initialized object is copied", "simple inner entity", target.getCglibEntity().getName());
        inner = BeanUtils.copyProperties(e.getCglibEntity());
        assertEquals("CGLIB objects are copied", "simple inner entity", inner.getName());
        target = new SimpleEntity();
        BeanUtils.copyProperties(e, target, Arrays.asList("name"));
        assertNull("Properties are ignored", target.getName());
    }
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.