Package stubs.cglib

Examples of stubs.cglib.SimpleInnerEntity


    @BeforeClass
    public static void setUp() throws Exception {
        factory = Persistence.createEntityManagerFactory("CGLIB");
        entityManager = factory.createEntityManager();
        entityManager.getTransaction().begin();
        SimpleInnerEntity sub = new SimpleInnerEntity();
        sub.setName("simple inner entity");
        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();
View Full Code Here


        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

Related Classes of stubs.cglib.SimpleInnerEntity

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.