Search in sources :

Example 21 with InSequence

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());
}
Also used : Simple(org.apache.deltaspike.data.test.domain.Simple) Test(org.junit.Test) InSequence(org.jboss.arquillian.junit.InSequence)

Example 22 with InSequence

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"));
}
Also used : House(org.apache.deltaspike.data.test.ee7.domain.House) Test(org.junit.Test) InSequence(org.jboss.arquillian.junit.InSequence)

Example 23 with InSequence

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"));
}
Also used : PersistenceUnitUtil(javax.persistence.PersistenceUnitUtil) House(org.apache.deltaspike.data.test.ee7.domain.House) Test(org.junit.Test) InSequence(org.jboss.arquillian.junit.InSequence)

Example 24 with InSequence

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"));
}
Also used : Flat(org.apache.deltaspike.data.test.ee7.domain.Flat) House(org.apache.deltaspike.data.test.ee7.domain.House) Test(org.junit.Test) InSequence(org.jboss.arquillian.junit.InSequence)

Example 25 with InSequence

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);
}
Also used : Connection(java.sql.Connection) DataSource(javax.sql.DataSource) Test(org.junit.Test) InSequence(org.jboss.arquillian.junit.InSequence)

Aggregations

InSequence (org.jboss.arquillian.junit.InSequence)103 Test (org.junit.Test)103 Simple (org.apache.deltaspike.data.test.ee7.domain.Simple)18 ModelNode (org.jboss.dmr.ModelNode)14 URL (java.net.URL)13 ModelControllerClient (org.jboss.as.controller.client.ModelControllerClient)8 PartitionManager (org.picketlink.idm.PartitionManager)7 StringTokenizer (java.util.StringTokenizer)6 IdentityManager (org.picketlink.idm.IdentityManager)6 RouteBuilder (org.apache.camel.builder.RouteBuilder)5 House (org.apache.deltaspike.data.test.ee7.domain.House)5 HttpResponse (org.apache.http.HttpResponse)5 HttpGet (org.apache.http.client.methods.HttpGet)5 OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)5 ManagementClient (org.jboss.as.arquillian.container.ManagementClient)5 EntityTest (org.jboss.as.test.integration.jpa.hibernate.EntityTest)5 User (org.picketlink.idm.model.basic.User)5 Date (java.util.Date)4 InitialContext (javax.naming.InitialContext)4 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)4