Package org.apache.rave.persistence

Examples of org.apache.rave.persistence.BasicEntity


    private static final Long INVALID_ENTITY_ID = -1L;

    @Test
    public void getById_validId() {
        for (Repository repository : repositories) {
            BasicEntity entity = (BasicEntity)repository.get(VALID_ENTITY_ID);
            assertThat(entity, is(notNullValue()));
            assertThat(entity.getId(), is(equalTo(VALID_ENTITY_ID)));
        }
    }
View Full Code Here


    }

    @Test
    public void getById_invalidId() {
        for (Repository repository : repositories) {
            BasicEntity entity = (BasicEntity)repository.get(INVALID_ENTITY_ID);
            assertThat(entity, is(nullValue()));
        }
    }
View Full Code Here

    @Test
    @Rollback(true)
    public void save_newEntity() throws Exception {
        for (Repository repository : repositories) {
            BasicEntity entity = constructNewEntityForRepository(repository);           
            RepositoryTestUtils.populateAllRequiredFieldsInEntity(sharedManager, entity);           
            BasicEntity saved = (BasicEntity)repository.save(entity);
            sharedManager.flush();
            assertThat(saved, is(sameInstance(entity)));
            assertThat(saved.getId(), is(notNullValue()));
        }
    }
View Full Code Here

    @Test
    @Rollback(true)
    public void save_existingEntity() {
        for (Repository repository : repositories) {
            BasicEntity entity = constructNewEntityForRepository(repository);
            entity.setId(VALID_ENTITY_ID);
            BasicEntity saved = (BasicEntity)repository.save(entity);
            sharedManager.flush();
            assertThat(saved, is(not(sameInstance(entity))));
            assertThat(saved.getId(), is(equalTo(entity.getId())));
        }

    }
View Full Code Here

    private static final Long INVALID_ENTITY_ID = -1L;

    @Test
    public void getById_validId() {
        for (Repository repository : repositories) {
            BasicEntity entity = (BasicEntity)repository.get(VALID_ENTITY_ID);
            assertThat(entity, is(notNullValue()));
            assertThat(entity.getEntityId(), is(equalTo(VALID_ENTITY_ID)));
        }
    }
View Full Code Here

    }

    @Test
    public void getById_invalidId() {
        for (Repository repository : repositories) {
            BasicEntity entity = (BasicEntity)repository.get(INVALID_ENTITY_ID);
            assertThat(entity, is(nullValue()));
        }
    }
View Full Code Here

    @Test
    @Rollback(true)
    public void save_newEntity() throws Exception {
        for (Repository repository : repositories) {
            BasicEntity entity = constructNewEntityForRepository(repository);           
            RepositoryTestUtils.populateAllRequiredFieldsInEntity(sharedManager, entity);           
            BasicEntity saved = (BasicEntity)repository.save(entity);
            sharedManager.flush();
            assertThat(saved, is(sameInstance(entity)));
            assertThat(saved.getEntityId(), is(notNullValue()));
        }
    }
View Full Code Here

    @Test
    @Rollback(true)
    public void save_existingEntity() {
        for (Repository repository : repositories) {
            BasicEntity entity = constructNewEntityForRepository(repository);
            entity.setEntityId(VALID_ENTITY_ID);
            BasicEntity saved = (BasicEntity)repository.save(entity);
            sharedManager.flush();
            assertThat(saved, is(not(sameInstance(entity))));
            assertThat(saved.getEntityId(), is(equalTo(entity.getEntityId())));
        }

    }
View Full Code Here

TOP

Related Classes of org.apache.rave.persistence.BasicEntity

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.