use of org.qi4j.api.unitofwork.UnitOfWork in project qi4j-sdk by Qi4j.
the class ServiceVisibilityTest method givenFromEntityWhenAccessingAboveApplicationVisibleExpectException.
@Test(expected = NoSuchServiceException.class)
public void givenFromEntityWhenAccessingAboveApplicationVisibleExpectException() {
UnitOfWork unitOfWork = module.newUnitOfWork();
try {
FromEntity entity = unitOfWork.newEntity(FromEntity.class, "123");
entity.aboveApplicationVisible();
} finally {
if (unitOfWork.isOpen()) {
unitOfWork.discard();
}
}
}
use of org.qi4j.api.unitofwork.UnitOfWork in project qi4j-sdk by Qi4j.
the class NonQueryableTest method testQueryIterable.
@Test
public void testQueryIterable() {
UnitOfWork unitOfWork = module.newUnitOfWork();
try {
module.newQueryBuilder(Abc2.class);
Assert.fail("Exception was expected.");
} catch (QueryException e) {
// expected!!
} finally {
unitOfWork.discard();
}
}
use of org.qi4j.api.unitofwork.UnitOfWork in project qi4j-sdk by Qi4j.
the class AssemblyRoleTest method testAssemblyMixinsEntity.
@Test
public void testAssemblyMixinsEntity() throws UnitOfWorkCompletionException {
UnitOfWork uow = module.newUnitOfWork();
FooEntity entity = uow.newEntity(FooEntity.class, "123");
uow.complete();
uow = module.newUnitOfWork();
Foo foo = uow.get(Foo.class, "123");
try {
assertThat("Default mixin has executed", foo.test("Foo", 42), equalTo("Foo 42"));
} finally {
uow.discard();
}
}
use of org.qi4j.api.unitofwork.UnitOfWork in project qi4j-sdk by Qi4j.
the class ObjectVisibilityTest method givenFromEntityWhenAccessingBesideApplicationVisibleExpectSuccess.
@Test
public void givenFromEntityWhenAccessingBesideApplicationVisibleExpectSuccess() {
UnitOfWork unitOfWork = module.newUnitOfWork();
try {
FromEntity entity = unitOfWork.newEntity(FromEntity.class, "123");
entity.besideApplicationVisible();
} finally {
if (unitOfWork.isOpen()) {
unitOfWork.discard();
}
}
}
use of org.qi4j.api.unitofwork.UnitOfWork in project qi4j-sdk by Qi4j.
the class ObjectVisibilityTest method givenFromEntityWhenAccessingBelowApplicationVisibleExpectSuccess.
@Test
public void givenFromEntityWhenAccessingBelowApplicationVisibleExpectSuccess() {
UnitOfWork unitOfWork = module.newUnitOfWork();
try {
FromEntity entity = unitOfWork.newEntity(FromEntity.class, "123");
entity.belowApplicationVisible();
} finally {
if (unitOfWork.isOpen()) {
unitOfWork.discard();
}
}
}
Aggregations