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

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


        final String name = "should_create_any_query_by_name";
        builder.createSimple(name);
        builder.createSimple(name);

        // when
        Simple result1 = repo.findAnyByName(name);
        Simple result2 = repo.findAnyByName(name + "_doesnt_exist");

        // then
        assertNotNull(result1);
        assertEquals(name, result1.getName());
        assertNull(result2);
View Full Code Here


        final String name = "should_create_any_query_by_annotation";
        builder.createSimple(name);
        builder.createSimple(name);

        // when
        Simple result1 = repo.findByNameAny(name);
        Simple result2 = repo.findByNameAny(name + "_doesnt_exist");

        // then
        assertNotNull(result1);
        assertEquals(name, result1.getName());
        assertNull(result2);
View Full Code Here

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

        // when
        TimestampsProvider provider = new TimestampsProvider();
        provider.prePersist(entity);
        provider.preUpdate(entity);
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

        // given
        final String name = "should_create_select_criteria_with_optional_result";
        createSimple(name, 10);

        // when
        Simple result1 = repo.queryOptional(name);
        Simple result2 = repo.queryOptional(name + "_doesnt exist");

        // then
        assertNotNull(result1);
        assertEquals(name, result1.getName());
        assertNull(result2);
View Full Code Here

        final String name = "should_create_select_criteria_with_any_result";
        createSimple(name, 10);
        createSimple(name, 10);

        // when
        Simple result1 = repo.queryAny(name);
        Simple result2 = repo.queryAny(name + "_doesnt exist");

        // then
        assertNotNull(result1);
        assertEquals(name, result1.getName());
        assertNull(result2);
View Full Code Here

        return entityManager;
    }

    private Simple createSimple(String name, Integer counter)
    {
        Simple result = new Simple(name);
        result.setCounter(counter);
        entityManager.persist(result);
        entityManager.flush();
        return result;
    }
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 = testData.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.