Package org.apache.deltaspike.data.test.domain

Examples of org.apache.deltaspike.data.test.domain.Simple


    @Test
    public void should_not_fail_on_non_audited_entity()
    {
        // given
        Simple entity = new Simple();

        // when
        TimestampsProvider provider = new TimestampsProvider();
        provider.prePersist(entity);
        provider.preUpdate(entity);
View Full Code Here


    @Test
    public void should_create_named_query_named()
    {
        // given
        final String name = "testCreateNamedQueryNamed";
        Simple simple = builder.createSimple(name);

        // when
        Simple result = repo.findByNamedQueryNamed(simple.getId(), Boolean.TRUE);

        // then
        assertNotNull(result);
        assertEquals(name, result.getName());
    }
View Full Code Here

        // given
        final String name = "testRunAnnotatedQuery";
        builder.createSimple(name);

        // when
        Simple result = repo.findByQuery(name);

        // then
        assertNotNull(result);
        assertEquals(name, result.getName());
    }
View Full Code Here

        // given
        final String name = "testCreateQueryByMethodName";
        builder.createSimple(name);

        // when
        Simple result = repo.findByNameAndEnabled(name, Boolean.TRUE);

        // then
        assertNotNull(result);
        assertEquals(name, result.getName());
    }
View Full Code Here

    public void should_restrict_result_size_by_parameters()
    {
        // given
        final String name = "testRestrictResultSizeByParameters";
        builder.createSimple(name);
        Simple second = builder.createSimple(name);

        // when
        List<Simple> result = repo.findByNamedQueryRestricted(name, Boolean.TRUE, 1, 1);

        // then
        assertNotNull(result);
        assertEquals(1, result.size());
        assertEquals(second.getId(), result.get(0).getId());
    }
View Full Code Here

    public void should_execute_update()
    {
        // given
        final String name = "testFindWithNativeQuery";
        final String newName = "testFindWithNativeQueryUpdated" + System.currentTimeMillis();
        Simple s = builder.createSimple(name);

        // when
        int count = repo.updateNameForId(newName, s.getId());

        // then
        assertEquals(1, count);
    }
View Full Code Here

    @Test
    public void should_call_delegate()
    {
        // given
        Simple simple = new Simple("test_call_delegate");

        // when
        simple = repo.saveAndFlushAndRefresh(simple);

        // then
        assertNotNull(simple.getId());
    }
View Full Code Here

    @Test
    public void should_save() throws Exception
    {
        // given
        Simple simple = new Simple("test");

        // when
        simple = repo.save(simple);

        // then
        assertNotNull(simple.getId());
    }
View Full Code Here

    @Test
    public void should_merge() throws Exception
    {
        // given
        Simple simple = createSimple("testMerge");
        Long id = simple.getId();

        // when
        final String newName = "testMergeUpdated";
        simple.setName(newName);
        simple = repo.save(simple);

        // then
        assertEquals(id, simple.getId());
        assertEquals(newName, simple.getName());
    }
View Full Code Here

    @Test
    public void should_save_and_flush() throws Exception
    {
        // given
        Simple simple = new Simple("test");

        // when
        simple = repo.saveAndFlush(simple);
        Simple fetch = (Simple) entityManager
                .createNativeQuery("select * from simple_table where id = ?", Simple.class)
                .setParameter(1, simple.getId())
                .getSingleResult();

        // then
        assertEquals(simple.getId(), fetch.getId());
    }
View Full Code Here

TOP

Related Classes of org.apache.deltaspike.data.test.domain.Simple

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.