use of org.jboss.arquillian.junit.InSequence in project deltaspike by apache.
the class TransactionalQueryRunnerTest method should_save_in_transaction.
@Test
@InSequence(2)
public void should_save_in_transaction() throws Exception {
// given
Simple simple = new Simple(NAME);
// when
simple = repository.save(simple);
// then
assertNotNull(simple.getId());
assertTrue(wrapper.isRunInTx());
}
use of org.jboss.arquillian.junit.InSequence in project deltaspike by apache.
the class HouseRepositoryTest method should_run_modifying_in_transaction.
@Test
@InSequence(1)
public void should_run_modifying_in_transaction() throws Exception {
House house = repository.findByName("Bellevue");
assertNotNull(house);
assertNotNull(house.getId());
assertEquals("Bellevue", house.getName());
assertTrue(puu.isLoaded(house, "flats"));
assertFalse(puu.isLoaded(house, "garages"));
}
use of org.jboss.arquillian.junit.InSequence in project deltaspike by apache.
the class HouseRepositoryTest method shouldNotLoadLazyAssociationsWithoutGraph.
@Test
@InSequence(2)
public void shouldNotLoadLazyAssociationsWithoutGraph() throws Exception {
House house = repository.findOptionalByName("Bellevue");
assertNotNull(house);
PersistenceUnitUtil puu = entityManager.getEntityManagerFactory().getPersistenceUnitUtil();
assertFalse(puu.isLoaded(house, "flats"));
assertFalse(puu.isLoaded(house, "garages"));
}
use of org.jboss.arquillian.junit.InSequence in project deltaspike by apache.
the class HouseRepositoryTest method should_build_dynamic_graph_from_paths.
@Test
@InSequence(5)
public void should_build_dynamic_graph_from_paths() throws Exception {
House house = repository.fetchByNameWithDynamicGraph("Bellevue");
assertNotNull(house);
assertTrue(puu.isLoaded(house, "flats"));
assertTrue(puu.isLoaded(house, "garages"));
assertEquals(2, house.getFlats().size());
assertEquals(2, house.getGarages().size());
Flat flat = house.getFlats().get(0);
assertFalse(puu.isLoaded(flat, "tenants"));
}
use of org.jboss.arquillian.junit.InSequence in project wildfly by wildfly.
the class JPA2LCTestCase method testMultipleNonTXTransactionalEntityManagerInvocations.
@Test
@InSequence(1)
public void testMultipleNonTXTransactionalEntityManagerInvocations() throws Exception {
SFSB1 sfsb1 = lookup("SFSB1", SFSB1.class);
sfsb1.createEmployee("Kelly Smith", "Watford, England", 1000);
sfsb1.createEmployee("Alex Scott", "London, England", 2000);
sfsb1.getEmployeeNoTX(1000);
sfsb1.getEmployeeNoTX(2000);
DataSource ds = rawLookup("java:jboss/datasources/ExampleDS", DataSource.class);
Connection conn = ds.getConnection();
try {
int deleted = conn.prepareStatement("delete from Employee").executeUpdate();
// verify that delete worked (or test is invalid)
assertTrue("was able to delete added rows. delete count=" + deleted, deleted > 1);
} finally {
conn.close();
}
// read deleted data from second level cache
Employee emp = sfsb1.getEmployeeNoTX(1000);
assertTrue("was able to read deleted database row from second level cache", emp != null);
}
Aggregations