Search in sources :

Example 1 with AccountComposite

use of org.qi4j.index.rdf.qi64.AccountComposite in project qi4j-sdk by Qi4j.

the class IssueTest method testUnitOfWorkWithUnitOfWorkInitialized.

@Test
public final void testUnitOfWorkWithUnitOfWorkInitialized() throws Throwable {
    // Bootstrap the account
    String id = newQi4jAccount();
    // Make sure there's no unit of work
    assertFalse(module.isUnitOfWorkActive());
    UnitOfWork parentUnitOfWork = module.newUnitOfWork();
    AccountComposite account = accountService.getAccountById(id);
    assertNotNull(account);
    UnitOfWork currentUnitOfWork = module.currentUnitOfWork();
    assertEquals(parentUnitOfWork, currentUnitOfWork);
    assertTrue(currentUnitOfWork.isOpen());
    // Close the parent unit of work
    parentUnitOfWork.complete();
}
Also used : UnitOfWork(org.qi4j.api.unitofwork.UnitOfWork) AccountComposite(org.qi4j.index.rdf.qi64.AccountComposite) Test(org.junit.Test) AbstractIssueTest(org.qi4j.index.rdf.qi64.AbstractIssueTest)

Example 2 with AccountComposite

use of org.qi4j.index.rdf.qi64.AccountComposite in project qi4j-sdk by Qi4j.

the class IssueTest method testUnitOfWorkInitialized.

@Test
public final void testUnitOfWorkInitialized() throws Throwable {
    // Bootstrap the account
    String id = newQi4jAccount();
    // Make sure there's no unit of work
    assertFalse(module.isUnitOfWorkActive());
    UnitOfWork parentUnitOfWork = module.newUnitOfWork();
    AccountComposite account = accountService.getAccountById(id);
    assertNotNull(account);
    UnitOfWork currentUnitOfWork = module.currentUnitOfWork();
    assertEquals(parentUnitOfWork, currentUnitOfWork);
    assertTrue(currentUnitOfWork.isOpen());
    // Close the parent unit of work
    parentUnitOfWork.complete();
}
Also used : UnitOfWork(org.qi4j.api.unitofwork.UnitOfWork) AccountComposite(org.qi4j.index.rdf.qi64.AccountComposite) Test(org.junit.Test) AbstractIssueTest(org.qi4j.index.rdf.qi64.AbstractIssueTest)

Example 3 with AccountComposite

use of org.qi4j.index.rdf.qi64.AccountComposite in project qi4j-sdk by Qi4j.

the class IssueTest method testUnitOfWorkWithUnitOfWorkInitialized.

@Test
public final void testUnitOfWorkWithUnitOfWorkInitialized() throws Throwable {
    // Bootstrap the account
    String id = newQi4jAccount();
    // Make sure there's no unit of work
    assertFalse(module.isUnitOfWorkActive());
    UnitOfWork parentUnitOfWork = module.newUnitOfWork();
    AccountComposite account = accountService.getAccountById(id);
    assertNotNull(account);
    UnitOfWork currentUnitOfWork = module.currentUnitOfWork();
    assertEquals(parentUnitOfWork, currentUnitOfWork);
    assertTrue(currentUnitOfWork.isOpen());
    // Close the parent unit of work
    parentUnitOfWork.complete();
}
Also used : UnitOfWork(org.qi4j.api.unitofwork.UnitOfWork) AccountComposite(org.qi4j.index.rdf.qi64.AccountComposite) Test(org.junit.Test) AbstractIssueTest(org.qi4j.index.rdf.qi64.AbstractIssueTest)

Example 4 with AccountComposite

use of org.qi4j.index.rdf.qi64.AccountComposite in project qi4j-sdk by Qi4j.

the class IssueTest method testUnitOfWorkWithUnitOfWorkNotInitialized.

@Test
public final void testUnitOfWorkWithUnitOfWorkNotInitialized() throws Throwable {
    // Bootstrap the account
    String id = newQi4jAccount();
    // Make sure there's no unit of work
    assertFalse(module.isUnitOfWorkActive());
    AccountComposite account = accountService.getAccountById(id);
    assertNotNull(account);
    assertFalse(module.isUnitOfWorkActive());
}
Also used : AccountComposite(org.qi4j.index.rdf.qi64.AccountComposite) Test(org.junit.Test) AbstractIssueTest(org.qi4j.index.rdf.qi64.AbstractIssueTest)

Example 5 with AccountComposite

use of org.qi4j.index.rdf.qi64.AccountComposite in project qi4j-sdk by Qi4j.

the class IssueTest method testUnitOfWorkNotInitialized.

@Test
public final void testUnitOfWorkNotInitialized() throws Throwable {
    // Bootstrap the account
    String id = newQi4jAccount();
    // Make sure there's no unit of work
    assertFalse(module.isUnitOfWorkActive());
    AccountComposite account = accountService.getAccountById(id);
    assertNotNull(account);
    assertFalse(module.isUnitOfWorkActive());
}
Also used : AccountComposite(org.qi4j.index.rdf.qi64.AccountComposite) Test(org.junit.Test) AbstractIssueTest(org.qi4j.index.rdf.qi64.AbstractIssueTest)

Aggregations

Test (org.junit.Test)5 AbstractIssueTest (org.qi4j.index.rdf.qi64.AbstractIssueTest)5 AccountComposite (org.qi4j.index.rdf.qi64.AccountComposite)5 UnitOfWork (org.qi4j.api.unitofwork.UnitOfWork)3