Package org.ow2.easybeans.tests.common.ejbs.entity.ebstore

Examples of org.ow2.easybeans.tests.common.ejbs.entity.ebstore.EBStore


     * @output the method execution without error.
     */
    @Test
    public void removeNew() {
        slsbEntityManagerTester.removeEBStoreNew(PRIMARY_KEY, ENTITY_NAME);
        EBStore ebstore = slsbEntityManagerTester.findEBStore(PRIMARY_KEY);
        assertNull(ebstore, "The remove operation was not ignored.");
    }
View Full Code Here


     * @output the method execution without error.
     */
    @Test
    public void removeManaged() {
        slsbEntityManagerTester.removeEBStoreManaged(PRIMARY_KEY, ENTITY_NAME);
        EBStore ebstore = slsbEntityManagerTester.findEBStore(PRIMARY_KEY);
        assertNull(ebstore, "The remove operation failed.");
    }
View Full Code Here

     * @output the method execution without error.
     */
    @Test
    public void removeRemoved() {
        slsbEntityManagerTester.removeEBStoreManaged(PRIMARY_KEY, ENTITY_NAME);
        EBStore ebstore = slsbEntityManagerTester.findEBStore(PRIMARY_KEY);
        assertNull(ebstore, "The remove operation was not ignored.");
    }
View Full Code Here

     * Test if the method contains verifies if the entity is in the db.
     * @param id the entity primary key.
     * @param name the entity name.
     */
    public void containsEBStore(final int id, final String name) {
        EBStore ebstore = completeEBStore(id, name);
        em.persist(ebstore);
        assertTrue(em.contains(ebstore), "The contains methos does not work properly");
    }
View Full Code Here

     * @param id the entity primary key.
     * @param name the entity name.
     * @param newName the name that the entity receives after to be detached.
     */
    public void refreshEBStore(final int id, final String name, final String newName) {
        EBStore ebstore = completeEBStore(id, name);
        em.persist(ebstore);
        //makes the entity detached
        em.clear();
        //changes the entity name
        ebstore.setName(newName);
        //makes a refresh
        em.refresh(ebstore);
        //verifies if the container got the values from the database.
        assertEquals(ebstore.getName(), name, "The entity was not refreshed");
    }
View Full Code Here

     * Removes the entity from the database.
     *
     */
    @TransactionAttribute(TransactionAttributeType.REQUIRED)
    private void removeEntity() {
        EBStore ebstore = entityManager.find(EBStore.class, ENTITY_ID);
        if (ebstore != null) {
            entityManager.remove(ebstore);
        }
    }
View Full Code Here

     * Removes the entity in the database avoiding an insertion error and
     * inserts a new entity to make the tests.
     */
    public void startup() {
        removeEntity();
        EBStore ebstore = new EBStore();
        ebstore.setId(ENTITY_ID.intValue());
        ebstore.setName(ENTITY_NAME);
        entityManager.persist(ebstore);
    }
View Full Code Here

    /**
     * Removes the entity that is in the database.
     * @param id the entity primary key.
     */
    public void removeEBStore(final int id) {
        EBStore ebstore = em.find(EBStore.class, new Integer(id));
        if(ebstore != null){
            em.remove(ebstore);
        }
    }
View Full Code Here

    public void setFlushModeAuto() {
        entityManager.setFlushMode(FlushModeType.AUTO);
        assertEquals(entityManager.getFlushMode(), FlushModeType.AUTO,
        "The flush mode was not set.");

        EBStore ebstoreBeforeChange = entityManager.find(EBStore.class, ENTITY_ID);
        ebstoreBeforeChange.setName(ENTITY_NAME_2);
        // forces a flush
        entityManager.createQuery("SELECT e FROM EBStore e");
        // verifies if the flush was made
        EBStore ebstoreAfterChange = entityManager.find(EBStore.class, ENTITY_ID);
        assertEquals(ebstoreAfterChange.getName(), ENTITY_NAME_2, "The container did not make a flush after the query");
    }
View Full Code Here

    public void setFlushModeCommit() {
        entityManager.setFlushMode(FlushModeType.COMMIT);
        assertEquals(entityManager.getFlushMode(), FlushModeType.COMMIT,
        "The flush mode was not set.");

        EBStore ebstoreBeforeChange = entityManager.find(EBStore.class, ENTITY_ID);
        ebstoreBeforeChange.setName(ENTITY_NAME_2);
        // forces a flush
        entityManager.createQuery("SELECT e FROM EBStore e");
        // verifies if the flush was not made
        EBStore ebstoreAfterChange = entityManager.find(EBStore.class, ENTITY_ID);
        assertEquals(ebstoreAfterChange.getName(), ENTITY_NAME, "The container made a flush after the query");
    }
View Full Code Here

TOP

Related Classes of org.ow2.easybeans.tests.common.ejbs.entity.ebstore.EBStore

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.