use of org.qi4j.api.unitofwork.UnitOfWork in project qi4j-sdk by Qi4j.
the class AppliesToOrConditionQI241Test method testMultiConcerns1.
@Test
public void testMultiConcerns1() {
UnitOfWork uow = module.newUnitOfWork();
try {
ServiceReference<SomeServiceCompositeWithFirstAnnotation> refWithFirst = module.findService(SomeServiceCompositeWithFirstAnnotation.class);
SomeServiceCompositeWithFirstAnnotation someWithFirst = refWithFirst.get();
someWithFirst.doStuff();
assertTrue("AppliesTo did not match with first annotation", someWithFirst.concernHasBeenPlayed());
} finally {
uow.discard();
}
}
use of org.qi4j.api.unitofwork.UnitOfWork in project qi4j-sdk by Qi4j.
the class EntityVisibilityTest method givenFromEntityWhenAccessingAboveApplicationVisibleExpectException.
@Test(expected = EntityTypeNotFoundException.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 EntityVisibilityTest method givenFromEntityWhenAccessingBelowLayerVisibleExpectException.
@Test(expected = EntityTypeNotFoundException.class)
public void givenFromEntityWhenAccessingBelowLayerVisibleExpectException() {
UnitOfWork unitOfWork = module.newUnitOfWork();
try {
FromEntity entity = unitOfWork.newEntity(FromEntity.class, "123");
entity.belowLayerVisible();
} finally {
if (unitOfWork.isOpen()) {
unitOfWork.discard();
}
}
}
use of org.qi4j.api.unitofwork.UnitOfWork in project qi4j-sdk by Qi4j.
the class EntityVisibilityTest 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 EntityVisibilityTest method givenFromEntityWhenAccessingBesideModuleVisibleExpectException.
@Test(expected = EntityTypeNotFoundException.class)
public void givenFromEntityWhenAccessingBesideModuleVisibleExpectException() {
UnitOfWork unitOfWork = module.newUnitOfWork();
try {
FromEntity entity = unitOfWork.newEntity(FromEntity.class, "123");
entity.besideModuleVisible();
} finally {
if (unitOfWork.isOpen()) {
unitOfWork.discard();
}
}
}
Aggregations