Search in sources :

Example 21 with Simple

use of org.apache.deltaspike.data.test.domain.Simple in project deltaspike by apache.

the class FullEntityRepositoryTest method should_save_with_merge_abstract.

@Test
public void should_save_with_merge_abstract() throws Exception {
    // given
    Simple simple = testData.createSimple("testMerge");
    Long id = simple.getId();
    // when
    final String newName = "testMergeUpdated";
    simple.setName(newName);
    simple = repoAbstract.save(simple);
    // then
    assertEquals(id, simple.getId());
    assertEquals(newName, simple.getName());
}
Also used : Simple(org.apache.deltaspike.data.test.domain.Simple) Test(org.junit.Test)

Example 22 with Simple

use of org.apache.deltaspike.data.test.domain.Simple in project deltaspike by apache.

the class FullEntityRepositoryTest method should_find_by_criteria.

@Test
public void should_find_by_criteria() throws Exception {
    // given
    Simple simple = new Simple("criteria");
    // when
    simple = repoAbstract.saveAndFlush(simple);
    Simple fetch = repoAbstract.fetchByName("criteria");
    // then
    assertEquals(simple.getId(), fetch.getId());
}
Also used : Simple(org.apache.deltaspike.data.test.domain.Simple) Test(org.junit.Test)

Example 23 with Simple

use of org.apache.deltaspike.data.test.domain.Simple in project deltaspike by apache.

the class FullEntityRepositoryTest method should_save_with_merge.

@Test
public void should_save_with_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());
}
Also used : Simple(org.apache.deltaspike.data.test.domain.Simple) Test(org.junit.Test)

Example 24 with Simple

use of org.apache.deltaspike.data.test.domain.Simple in project deltaspike by apache.

the class QueryHandlerTest method should_create_query_delete_by_method_name_with_multiply_params.

@Test
public void should_create_query_delete_by_method_name_with_multiply_params() {
    // given
    final String name = "testCreateQueryByMethodName";
    builder.createSimple(name);
    // when
    repo.deleteByNameAndEnabled(name, Boolean.TRUE);
    repo.flush();
    Simple result = repo.findAnyByName(name);
    // then
    assertNull(result);
}
Also used : Simple(org.apache.deltaspike.data.test.domain.Simple) Test(org.junit.Test)

Example 25 with Simple

use of org.apache.deltaspike.data.test.domain.Simple in project deltaspike by apache.

the class QueryHandlerTest method should_create_query_delete_by_method_name.

@Test
public void should_create_query_delete_by_method_name() {
    // given
    final String name = "testCreateQueryByMethodName";
    builder.createSimple(name);
    // when
    repo.deleteByName(name);
    repo.flush();
    Simple result = repo.findAnyByName(name);
    // then
    assertNull(result);
}
Also used : Simple(org.apache.deltaspike.data.test.domain.Simple) Test(org.junit.Test)

Aggregations

Simple (org.apache.deltaspike.data.test.domain.Simple)67 Test (org.junit.Test)64 SimpleDto (org.apache.deltaspike.data.test.domain.dto.SimpleDto)6 InSequence (org.jboss.arquillian.junit.InSequence)3 SingularAttribute (javax.persistence.metamodel.SingularAttribute)2 SimpleId (org.apache.deltaspike.data.test.domain.dto.SimpleId)2 Calendar (java.util.Calendar)1 Date (java.util.Date)1 BooleanWrapper (org.apache.deltaspike.data.test.domain.dto.BooleanWrapper)1