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

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


    @Test
    @InSequence(3)
    public void should_find_with_lockmode_in_transaction() throws Exception
    {
        // when
        Simple simple = repository.findByName(NAME);

        // then
        assertNotNull(simple);
        assertTrue(wrapper.isRunInTx());
    }
View Full Code Here


    @Test
    @InSequence(4)
    public void should_find_no_lock_without_transaction() throws Exception
    {
        // when
        Simple simple = repository.findByNameNoLock(NAME);

        // then
        assertNotNull(simple);
        assertTrue(wrapper.isRunInNonTx());
    }
View Full Code Here

    private EntityManager entityManager;

    @Test
    public void should_delete_detached_entity() {
        // given
        Simple simple = testData.createSimple("should_merge_entity");
        Long id = simple.getId();

        // when
        repository.detach(simple);
        repository.remove(repository.merge(simple));

        // then
        assertNotNull(id);
        Simple search = repository.findBy(id);
        assertNull(search);
    }
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

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

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

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

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

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

        // then
        assertNotNull(result1);
        assertEquals(name, result1.getName());
        assertNull(result2);
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.