You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2016/04/14 08:13:16 UTC
[10/34] zest-java git commit: ZEST-132,
ZEST-97 UnitOfWorkFactory as a customizable Service UnitOfWork as a
customizable Transient Class can be a Transient directly,
with itself as both the Composite Type and the Mixin. SideEffects declaratio
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/core/runtime/src/test/java/org/apache/zest/runtime/entity/EntityVisibilityTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/entity/EntityVisibilityTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/entity/EntityVisibilityTest.java
index 77baf16..0d0e6f1 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/entity/EntityVisibilityTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/entity/EntityVisibilityTest.java
@@ -16,6 +16,8 @@
package org.apache.zest.runtime.entity;
+import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
+import org.apache.zest.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -43,6 +45,7 @@ public class EntityVisibilityTest
private Energy4Java zest;
private Module module;
private Application app;
+ private UnitOfWorkFactory uowf;
@Before
public void setup()
@@ -76,6 +79,7 @@ public class EntityVisibilityTest
} );
app.activate();
module = app.findModule( "From Layer", "From" );
+ uowf = module.unitOfWorkFactory();
}
@After
@@ -172,7 +176,7 @@ public class EntityVisibilityTest
@Test
public void givenFromEntityWhenAccessingModuleApplicationVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -190,7 +194,7 @@ public class EntityVisibilityTest
@Test
public void givenFromEntityWhenAccessingModuleLayerVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -208,7 +212,7 @@ public class EntityVisibilityTest
@Test
public void givenFromEntityWhenAccessingModuleModuleVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -226,7 +230,7 @@ public class EntityVisibilityTest
@Test
public void givenFromEntityWhenAccessingBesideApplicationVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -244,7 +248,7 @@ public class EntityVisibilityTest
@Test
public void givenFromEntityWhenAccessingBesideLayerVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -262,7 +266,7 @@ public class EntityVisibilityTest
@Test( expected = EntityTypeNotFoundException.class )
public void givenFromEntityWhenAccessingBesideModuleVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -280,7 +284,7 @@ public class EntityVisibilityTest
@Test
public void givenFromEntityWhenAccessingBelowApplicationVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -298,7 +302,7 @@ public class EntityVisibilityTest
@Test( expected = EntityTypeNotFoundException.class )
public void givenFromEntityWhenAccessingBelowLayerVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -316,7 +320,7 @@ public class EntityVisibilityTest
@Test( expected = EntityTypeNotFoundException.class )
public void givenFromEntityWhenAccessingBelowModuleVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -334,7 +338,7 @@ public class EntityVisibilityTest
@Test( expected = EntityTypeNotFoundException.class )
public void givenFromEntityWhenAccessingAboveApplicationVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -352,7 +356,7 @@ public class EntityVisibilityTest
@Test( expected = EntityTypeNotFoundException.class )
public void givenFromEntityWhenAccessingAboveLayerVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -370,7 +374,7 @@ public class EntityVisibilityTest
@Test( expected = EntityTypeNotFoundException.class )
public void givenFromEntityWhenAccessingAboveModuleVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -655,6 +659,7 @@ public class EntityVisibilityTest
module.entities( ModuleApplicationVisible.class ).visibleIn( Visibility.application );
module.entities( ModuleLayerVisible.class ).visibleIn( Visibility.layer );
module.entities( ModuleModuleVisible.class ).visibleIn( Visibility.module );
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
}
@@ -672,6 +677,7 @@ public class EntityVisibilityTest
module.entities( BelowModuleVisible.class ).visibleIn( Visibility.module );
new EntityTestAssembler().visibleIn( Visibility.application ).assemble( module );
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
}
@@ -687,6 +693,7 @@ public class EntityVisibilityTest
module.entities( AboveApplicationVisible.class ).visibleIn( Visibility.application );
module.entities( AboveLayerVisible.class ).visibleIn( Visibility.layer );
module.entities( AboveModuleVisible.class ).visibleIn( Visibility.module );
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
}
@@ -701,6 +708,7 @@ public class EntityVisibilityTest
module.entities( BesideApplicationVisible.class ).visibleIn( Visibility.application );
module.entities( BesideLayerVisible.class ).visibleIn( Visibility.layer );
module.entities( BesideModuleVisible.class ).visibleIn( Visibility.module );
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
}
@@ -756,12 +764,12 @@ public class EntityVisibilityTest
implements From
{
@Structure
- private Module module;
+ private UnitOfWorkFactory uowf;
@Override
public void moduleApplicationVisible()
{
- UnitOfWork uow = module.newUnitOfWork();
+ UnitOfWork uow = uowf.newUnitOfWork();
try
{
ModuleApplicationVisible entity = uow.newEntity( ModuleApplicationVisible.class );
@@ -778,7 +786,7 @@ public class EntityVisibilityTest
@Override
public void moduleLayerVisible()
{
- UnitOfWork uow = module.newUnitOfWork();
+ UnitOfWork uow = uowf.newUnitOfWork();
try
{
ModuleLayerVisible entity = uow.newEntity( ModuleLayerVisible.class );
@@ -795,7 +803,7 @@ public class EntityVisibilityTest
@Override
public void moduleModuleVisible()
{
- UnitOfWork uow = module.newUnitOfWork();
+ UnitOfWork uow = uowf.newUnitOfWork();
try
{
ModuleModuleVisible entity = uow.newEntity( ModuleModuleVisible.class );
@@ -812,7 +820,7 @@ public class EntityVisibilityTest
@Override
public void besideApplicationVisible()
{
- UnitOfWork uow = module.newUnitOfWork();
+ UnitOfWork uow = uowf.newUnitOfWork();
try
{
BesideApplicationVisible entity = uow.newEntity( BesideApplicationVisible.class );
@@ -829,7 +837,7 @@ public class EntityVisibilityTest
@Override
public void besideLayerVisible()
{
- UnitOfWork uow = module.newUnitOfWork();
+ UnitOfWork uow = uowf.newUnitOfWork();
try
{
BesideLayerVisible entity = uow.newEntity( BesideLayerVisible.class );
@@ -846,7 +854,7 @@ public class EntityVisibilityTest
@Override
public void besideModuleVisible()
{
- UnitOfWork uow = module.newUnitOfWork();
+ UnitOfWork uow = uowf.newUnitOfWork();
try
{
BesideModuleVisible entity = uow.newEntity( BesideModuleVisible.class );
@@ -863,7 +871,7 @@ public class EntityVisibilityTest
@Override
public void belowApplicationVisible()
{
- UnitOfWork uow = module.newUnitOfWork();
+ UnitOfWork uow = uowf.newUnitOfWork();
try
{
BelowApplicationVisible entity = uow.newEntity( BelowApplicationVisible.class );
@@ -880,7 +888,7 @@ public class EntityVisibilityTest
@Override
public void belowLayerVisible()
{
- UnitOfWork uow = module.newUnitOfWork();
+ UnitOfWork uow = uowf.newUnitOfWork();
try
{
BelowLayerVisible entity = uow.newEntity( BelowLayerVisible.class );
@@ -897,7 +905,7 @@ public class EntityVisibilityTest
@Override
public void belowModuleVisible()
{
- UnitOfWork uow = module.newUnitOfWork();
+ UnitOfWork uow = uowf.newUnitOfWork();
try
{
BelowModuleVisible entity = uow.newEntity( BelowModuleVisible.class );
@@ -914,7 +922,7 @@ public class EntityVisibilityTest
@Override
public void aboveApplicationVisible()
{
- UnitOfWork uow = module.newUnitOfWork();
+ UnitOfWork uow = uowf.newUnitOfWork();
try
{
AboveApplicationVisible entity = uow.newEntity( AboveApplicationVisible.class );
@@ -931,7 +939,7 @@ public class EntityVisibilityTest
@Override
public void aboveLayerVisible()
{
- UnitOfWork uow = module.newUnitOfWork();
+ UnitOfWork uow = uowf.newUnitOfWork();
try
{
AboveLayerVisible entity = uow.newEntity( AboveLayerVisible.class );
@@ -948,7 +956,7 @@ public class EntityVisibilityTest
@Override
public void aboveModuleVisible()
{
- UnitOfWork uow = module.newUnitOfWork();
+ UnitOfWork uow = uowf.newUnitOfWork();
try
{
AboveModuleVisible entity = uow.newEntity( AboveModuleVisible.class );
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/core/runtime/src/test/java/org/apache/zest/runtime/entity/LifecycleTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/entity/LifecycleTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/entity/LifecycleTest.java
index 495bff8..e2b132c 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/entity/LifecycleTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/entity/LifecycleTest.java
@@ -51,7 +51,7 @@ public class LifecycleTest
public void whenEntityHasLifecycleWhenInstantiatedThenInvokeCreate()
throws UnitOfWorkCompletionException
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
EntityBuilder<TestEntity> builder = unitOfWork.newEntityBuilder( TestEntity.class );
@@ -70,7 +70,7 @@ public class LifecycleTest
public void whenEntityHasLifecycleWhenRemovedThenInvokeRemove()
throws UnitOfWorkCompletionException
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
EntityBuilder<TestEntity> builder = unitOfWork.newEntityBuilder( TestEntity.class );
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/core/runtime/src/test/java/org/apache/zest/runtime/entity/associations/AssociationTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/entity/associations/AssociationTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/entity/associations/AssociationTest.java
index a1627d7..8261004 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/entity/associations/AssociationTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/entity/associations/AssociationTest.java
@@ -52,7 +52,7 @@ public class AssociationTest
@Test
public void testAssociation()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/core/runtime/src/test/java/org/apache/zest/runtime/entity/associations/ImmutableAssociationTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/entity/associations/ImmutableAssociationTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/entity/associations/ImmutableAssociationTest.java
index 3dd855b..ad64912 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/entity/associations/ImmutableAssociationTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/entity/associations/ImmutableAssociationTest.java
@@ -44,7 +44,7 @@ public class ImmutableAssociationTest
public void givenEntityWithImmutableAssociationWhenBuildingThenNoException()
throws Exception
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
PersonEntity father = unitOfWork.newEntity( PersonEntity.class );
@@ -64,7 +64,7 @@ public class ImmutableAssociationTest
public void givenEntityWithImmutableAssociationWhenChangingValueThenThrowException()
throws Exception
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
EntityBuilder<PersonEntity> builder = unitOfWork.newEntityBuilder( PersonEntity.class );
@@ -89,7 +89,7 @@ public class ImmutableAssociationTest
public void givenEntityWithImmutableManyAssociationWhenBuildingThenNoException()
throws Exception
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
EntityBuilder<PersonEntity> builder = unitOfWork.newEntityBuilder( PersonEntity.class );
@@ -111,7 +111,7 @@ public class ImmutableAssociationTest
public void givenEntityWithImmutableManyAssociationWhenChangingValueThenThrowException()
throws Exception
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
EntityBuilder<PersonEntity> builder = unitOfWork.newEntityBuilder( PersonEntity.class );
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/core/runtime/src/test/java/org/apache/zest/runtime/injection/ConstructorInjectionOfThisTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/injection/ConstructorInjectionOfThisTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/injection/ConstructorInjectionOfThisTest.java
index 43ae9cb..be703e6 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/injection/ConstructorInjectionOfThisTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/injection/ConstructorInjectionOfThisTest.java
@@ -15,6 +15,7 @@
*/
package org.apache.zest.runtime.injection;
+import org.apache.zest.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
import org.junit.Test;
import org.apache.zest.api.activation.ActivationException;
import org.apache.zest.api.common.UseDefaults;
@@ -49,6 +50,7 @@ public class ConstructorInjectionOfThisTest
throws AssemblyException
{
module.values( Does.class ).withMixins( DoesMixin.class );
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
};
Module module = singletonAssembler.application().findModule( "Layer 1", "Module 1" );
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/core/runtime/src/test/java/org/apache/zest/runtime/injection/UnitOfWorkInjectionTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/injection/UnitOfWorkInjectionTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/injection/UnitOfWorkInjectionTest.java
index 7c3d2f0..93ba516 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/injection/UnitOfWorkInjectionTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/injection/UnitOfWorkInjectionTest.java
@@ -47,15 +47,15 @@ public class UnitOfWorkInjectionTest
throws Exception
{
Usecase usecase = UsecaseBuilder.newUsecase( "usecase1" );
- UnitOfWork uow = module.newUnitOfWork( usecase );
+ UnitOfWork uow = uowf.newUnitOfWork( usecase );
try
{
Trial trial = uow.newEntity( Trial.class, "123" );
trial.doSomething();
uow.complete();
- uow = module.newUnitOfWork( usecase );
+ uow = uowf.newUnitOfWork( usecase );
usecase = UsecaseBuilder.newUsecase( "usecase2" );
- UnitOfWork uow2 = module.newUnitOfWork( usecase );
+ UnitOfWork uow2 = uowf.newUnitOfWork( usecase );
trial = uow.get( trial );
trial.doSomething();
assertEquals( "123", ( (EntityComposite) trial ).identity().get() );
@@ -70,9 +70,9 @@ public class UnitOfWorkInjectionTest
{
try
{
- while( module.isUnitOfWorkActive() )
+ while( uowf.isUnitOfWorkActive() )
{
- uow = module.currentUnitOfWork();
+ uow = uowf.currentUnitOfWork();
uow.discard();
}
}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/core/runtime/src/test/java/org/apache/zest/runtime/instantiation/TransientInstantiationTests.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/instantiation/TransientInstantiationTests.java b/core/runtime/src/test/java/org/apache/zest/runtime/instantiation/TransientInstantiationTests.java
index bbb0197..bea66f9 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/instantiation/TransientInstantiationTests.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/instantiation/TransientInstantiationTests.java
@@ -58,7 +58,6 @@ public class TransientInstantiationTests
public static class MyMixin
implements My
{
-
public String doSomething()
{
return "Niclas";
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/core/runtime/src/test/java/org/apache/zest/runtime/mixin/AssemblyMixinTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/mixin/AssemblyMixinTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/mixin/AssemblyMixinTest.java
index d00f655..d3ec351 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/mixin/AssemblyMixinTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/mixin/AssemblyMixinTest.java
@@ -54,11 +54,11 @@ public class AssemblyMixinTest
public void testAssemblyMixinsEntity()
throws UnitOfWorkCompletionException
{
- UnitOfWork uow = module.newUnitOfWork();
+ UnitOfWork uow = uowf.newUnitOfWork();
FooEntity entity = uow.newEntity( FooEntity.class, "123" );
uow.complete();
- uow = module.newUnitOfWork();
+ uow = uowf.newUnitOfWork();
Foo foo = uow.get( Foo.class, "123" );
try
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/core/runtime/src/test/java/org/apache/zest/runtime/mixin/AssemblyRoleTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/mixin/AssemblyRoleTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/mixin/AssemblyRoleTest.java
index f8fb6a2..80efede 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/mixin/AssemblyRoleTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/mixin/AssemblyRoleTest.java
@@ -63,11 +63,11 @@ public class AssemblyRoleTest
public void testAssemblyMixinsEntity()
throws UnitOfWorkCompletionException
{
- UnitOfWork uow = module.newUnitOfWork();
- FooEntity entity = uow.newEntity( FooEntity.class, "123" );
+ UnitOfWork uow = uowf.newUnitOfWork();
+ uow.newEntity( FooEntity.class, "123" );
uow.complete();
- uow = module.newUnitOfWork();
+ uow = uowf.newUnitOfWork();
Foo foo = uow.get( Foo.class, "123" );
try
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/core/runtime/src/test/java/org/apache/zest/runtime/objects/ObjectVisibilityTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/objects/ObjectVisibilityTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/objects/ObjectVisibilityTest.java
index 22a733b..dcaa0c8 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/objects/ObjectVisibilityTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/objects/ObjectVisibilityTest.java
@@ -16,6 +16,8 @@
package org.apache.zest.runtime.objects;
+import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
+import org.apache.zest.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -42,6 +44,7 @@ public class ObjectVisibilityTest
private Energy4Java zest;
private Module module;
+ private UnitOfWorkFactory uowf;
private Application app;
@Before
@@ -76,6 +79,7 @@ public class ObjectVisibilityTest
} );
app.activate();
module = app.findModule( "From Layer", "From" );
+ uowf = module.unitOfWorkFactory();
}
@After
@@ -172,7 +176,7 @@ public class ObjectVisibilityTest
@Test
public void givenFromEntityWhenAccessingModuleApplicationVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -190,7 +194,7 @@ public class ObjectVisibilityTest
@Test
public void givenFromEntityWhenAccessingModuleLayerVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -208,7 +212,7 @@ public class ObjectVisibilityTest
@Test
public void givenFromEntityWhenAccessingModuleModuleVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -226,7 +230,7 @@ public class ObjectVisibilityTest
@Test
public void givenFromEntityWhenAccessingBesideApplicationVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -244,7 +248,7 @@ public class ObjectVisibilityTest
@Test
public void givenFromEntityWhenAccessingBesideLayerVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -262,7 +266,7 @@ public class ObjectVisibilityTest
@Test( expected = NoSuchObjectException.class )
public void givenFromEntityWhenAccessingBesideModuleVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -280,7 +284,7 @@ public class ObjectVisibilityTest
@Test
public void givenFromEntityWhenAccessingBelowApplicationVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -298,7 +302,7 @@ public class ObjectVisibilityTest
@Test( expected = NoSuchObjectException.class )
public void givenFromEntityWhenAccessingBelowLayerVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -316,7 +320,7 @@ public class ObjectVisibilityTest
@Test( expected = NoSuchObjectException.class )
public void givenFromEntityWhenAccessingBelowModuleVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -334,7 +338,7 @@ public class ObjectVisibilityTest
@Test( expected = NoSuchObjectException.class )
public void givenFromEntityWhenAccessingAboveApplicationVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -352,7 +356,7 @@ public class ObjectVisibilityTest
@Test( expected = NoSuchObjectException.class )
public void givenFromEntityWhenAccessingAboveLayerVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -370,7 +374,7 @@ public class ObjectVisibilityTest
@Test( expected = NoSuchObjectException.class )
public void givenFromEntityWhenAccessingAboveModuleVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -655,6 +659,8 @@ public class ObjectVisibilityTest
module.objects( ModuleApplicationVisible.class ).visibleIn( Visibility.application );
module.objects( ModuleLayerVisible.class ).visibleIn( Visibility.layer );
module.objects( ModuleModuleVisible.class ).visibleIn( Visibility.module );
+
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
}
@@ -672,6 +678,7 @@ public class ObjectVisibilityTest
module.objects( BelowModuleVisible.class ).visibleIn( Visibility.module );
new EntityTestAssembler().visibleIn( Visibility.application ).assemble( module );
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
}
@@ -687,6 +694,8 @@ public class ObjectVisibilityTest
module.objects( AboveApplicationVisible.class ).visibleIn( Visibility.application );
module.objects( AboveLayerVisible.class ).visibleIn( Visibility.layer );
module.objects( AboveModuleVisible.class ).visibleIn( Visibility.module );
+
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
}
@@ -701,6 +710,8 @@ public class ObjectVisibilityTest
module.objects( BesideApplicationVisible.class ).visibleIn( Visibility.application );
module.objects( BesideLayerVisible.class ).visibleIn( Visibility.layer );
module.objects( BesideModuleVisible.class ).visibleIn( Visibility.module );
+
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/core/runtime/src/test/java/org/apache/zest/runtime/property/ImmutablePropertyTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/property/ImmutablePropertyTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/property/ImmutablePropertyTest.java
index caed693..1ec9207 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/property/ImmutablePropertyTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/property/ImmutablePropertyTest.java
@@ -83,7 +83,7 @@ public final class ImmutablePropertyTest
@Test
public final void testImmutableEntityProperty()
{
- UnitOfWork uow = module.newUnitOfWork();
+ UnitOfWork uow = uowf.newUnitOfWork();
try
{
EntityBuilder<LocationEntity> builder = uow.newEntityBuilder( LocationEntity.class );
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/core/runtime/src/test/java/org/apache/zest/runtime/query/IterableQuerySourceTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/query/IterableQuerySourceTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/query/IterableQuerySourceTest.java
index f8737cc..726c14a 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/query/IterableQuerySourceTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/query/IterableQuerySourceTest.java
@@ -20,6 +20,7 @@ package org.apache.zest.runtime.query;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import org.apache.zest.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -89,12 +90,13 @@ public class IterableQuerySourceTest
module.values( ContactsValue.class, ContactValue.class );
new EntityTestAssembler().assemble( module );
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
};
- uow = assembler.module().newUnitOfWork();
+ uow = assembler.module().unitOfWorkFactory().newUnitOfWork();
Network.populate( uow, assembler.module() );
uow.complete();
- uow = assembler.module().newUnitOfWork();
+ uow = assembler.module().unitOfWorkFactory().newUnitOfWork();
Network.refresh( uow );
qbf = assembler.module();
}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/core/runtime/src/test/java/org/apache/zest/runtime/query/NonQueryableTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/query/NonQueryableTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/query/NonQueryableTest.java
index b876242..2e3b67b 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/query/NonQueryableTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/query/NonQueryableTest.java
@@ -42,7 +42,7 @@ public class NonQueryableTest
@Test
public void whenQuerableIsFalseOnPropertyThenExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
QueryBuilder<Abc> builder = module.newQueryBuilder( Abc.class );
@@ -63,7 +63,7 @@ public class NonQueryableTest
@Test
public void testQueryIterable()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
module.newQueryBuilder( Abc2.class );
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/core/runtime/src/test/java/org/apache/zest/runtime/service/AvailableServiceTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/service/AvailableServiceTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/service/AvailableServiceTest.java
index 47d4e0f..0e14d4a 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/service/AvailableServiceTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/service/AvailableServiceTest.java
@@ -14,6 +14,7 @@
package org.apache.zest.runtime.service;
+import org.apache.zest.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
import org.junit.Test;
import org.apache.zest.api.activation.ActivationException;
import org.apache.zest.api.common.Optional;
@@ -50,6 +51,7 @@ public class AvailableServiceTest
throws AssemblyException
{
module.services( TestServiceComposite1.class );
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
};
@@ -72,6 +74,7 @@ public class AvailableServiceTest
module.entities( TestServiceConfiguration.class );
new EntityTestAssembler().assemble( module );
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
};
@@ -100,6 +103,7 @@ public class AvailableServiceTest
module.entities( TestServiceConfiguration.class );
new EntityTestAssembler().assemble( module );
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
};
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/core/runtime/src/test/java/org/apache/zest/runtime/service/ConfigurationTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/service/ConfigurationTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/service/ConfigurationTest.java
index e5b947b..577dc80 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/service/ConfigurationTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/service/ConfigurationTest.java
@@ -58,7 +58,7 @@ public class ConfigurationTest
{
module.injectTo( this );
- UnitOfWork unit = module.newUnitOfWork();
+ UnitOfWork unit = uowf.newUnitOfWork();
EntityBuilder<HelloWorldConfiguration> entityBuilder = unit.newEntityBuilder( HelloWorldConfiguration.class, service
.identity() );
HelloWorldConfiguration config = entityBuilder.instance();
@@ -88,7 +88,7 @@ public class ConfigurationTest
HelloWorldConfiguration config;
{
- UnitOfWork unit = module.newUnitOfWork();
+ UnitOfWork unit = uowf.newUnitOfWork();
EntityBuilder<HelloWorldConfiguration> entityBuilder = unit.newEntityBuilder( HelloWorldConfiguration.class, service
.identity() );
config = entityBuilder.instance();
@@ -101,7 +101,7 @@ public class ConfigurationTest
assertThat( "result is correct", service.get().sayHello(), equalTo( "Hello World" ) );
{
- UnitOfWork unit = module.newUnitOfWork();
+ UnitOfWork unit = uowf.newUnitOfWork();
config = unit.get( config );
config.phrase().set( "Hey" );
config.name().set( "Universe" );
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/core/runtime/src/test/java/org/apache/zest/runtime/service/ServiceVisibilityTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/service/ServiceVisibilityTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/service/ServiceVisibilityTest.java
index e1d9ae6..92edd73 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/service/ServiceVisibilityTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/service/ServiceVisibilityTest.java
@@ -16,6 +16,8 @@
package org.apache.zest.runtime.service;
+import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
+import org.apache.zest.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -42,6 +44,7 @@ public class ServiceVisibilityTest
private Energy4Java zest;
private Module module;
private Application app;
+ private UnitOfWorkFactory uowf;
@Before
public void setup()
@@ -75,6 +78,7 @@ public class ServiceVisibilityTest
} );
app.activate();
module = app.findModule( "From Layer", "From" );
+ uowf = module.unitOfWorkFactory();
}
@After
@@ -171,7 +175,7 @@ public class ServiceVisibilityTest
@Test
public void givenFromEntityWhenAccessingModuleApplicationVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -189,7 +193,7 @@ public class ServiceVisibilityTest
@Test
public void givenFromEntityWhenAccessingModuleLayerVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -207,7 +211,7 @@ public class ServiceVisibilityTest
@Test
public void givenFromEntityWhenAccessingModuleModuleVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -225,7 +229,7 @@ public class ServiceVisibilityTest
@Test
public void givenFromEntityWhenAccessingBesideApplicationVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -243,7 +247,7 @@ public class ServiceVisibilityTest
@Test
public void givenFromEntityWhenAccessingBesideLayerVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -261,7 +265,7 @@ public class ServiceVisibilityTest
@Test( expected = NoSuchServiceException.class )
public void givenFromEntityWhenAccessingBesideModuleVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -279,7 +283,7 @@ public class ServiceVisibilityTest
@Test
public void givenFromEntityWhenAccessingBelowApplicationVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -297,7 +301,7 @@ public class ServiceVisibilityTest
@Test( expected = NoSuchServiceException.class )
public void givenFromEntityWhenAccessingBelowLayerVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -315,7 +319,7 @@ public class ServiceVisibilityTest
@Test( expected = NoSuchServiceException.class )
public void givenFromEntityWhenAccessingBelowModuleVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -333,7 +337,7 @@ public class ServiceVisibilityTest
@Test( expected = NoSuchServiceException.class )
public void givenFromEntityWhenAccessingAboveApplicationVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -351,7 +355,7 @@ public class ServiceVisibilityTest
@Test( expected = NoSuchServiceException.class )
public void givenFromEntityWhenAccessingAboveLayerVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -369,7 +373,7 @@ public class ServiceVisibilityTest
@Test( expected = NoSuchServiceException.class )
public void givenFromEntityWhenAccessingAboveModuleVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -654,6 +658,8 @@ public class ServiceVisibilityTest
module.services( ModuleApplicationVisible.class ).visibleIn( Visibility.application );
module.services( ModuleLayerVisible.class ).visibleIn( Visibility.layer );
module.services( ModuleModuleVisible.class ).visibleIn( Visibility.module );
+
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
}
@@ -671,6 +677,7 @@ public class ServiceVisibilityTest
module.services( BelowModuleVisible.class ).visibleIn( Visibility.module );
new EntityTestAssembler().visibleIn( Visibility.application ).assemble( module );
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
}
@@ -686,6 +693,7 @@ public class ServiceVisibilityTest
module.services( AboveApplicationVisible.class ).visibleIn( Visibility.application );
module.services( AboveLayerVisible.class ).visibleIn( Visibility.layer );
module.services( AboveModuleVisible.class ).visibleIn( Visibility.module );
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
}
@@ -700,6 +708,7 @@ public class ServiceVisibilityTest
module.services( BesideApplicationVisible.class ).visibleIn( Visibility.application );
module.services( BesideLayerVisible.class ).visibleIn( Visibility.layer );
module.services( BesideModuleVisible.class ).visibleIn( Visibility.module );
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/core/runtime/src/test/java/org/apache/zest/runtime/structure/TypeToCompositeLookupTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/structure/TypeToCompositeLookupTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/structure/TypeToCompositeLookupTest.java
index 520b528..d516ede 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/structure/TypeToCompositeLookupTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/structure/TypeToCompositeLookupTest.java
@@ -14,6 +14,8 @@
package org.apache.zest.runtime.structure;
import java.util.Iterator;
+import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
+import org.apache.zest.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
import org.junit.Test;
import org.apache.zest.api.activation.ActivationException;
import org.apache.zest.api.composite.AmbiguousTypeException;
@@ -96,6 +98,7 @@ public class TypeToCompositeLookupTest
throws AssemblyException
{
module.objects( SomeOtherFooImpl.class );
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
}.module();
@@ -117,6 +120,7 @@ public class TypeToCompositeLookupTest
throws AssemblyException
{
module.objects( SomeOtherFooImpl.class, BasicFooImpl.class );
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
}.module();
@@ -146,6 +150,7 @@ public class TypeToCompositeLookupTest
throws AssemblyException
{
module.transients( SomeOtherFoo.class );
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
}.module();
@@ -167,6 +172,7 @@ public class TypeToCompositeLookupTest
throws AssemblyException
{
module.transients( SomeOtherFoo.class, BasicFoo.class );
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
}.module();
@@ -196,6 +202,7 @@ public class TypeToCompositeLookupTest
throws AssemblyException
{
module.values( SomeOtherFoo.class );
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
}.module();
@@ -217,6 +224,7 @@ public class TypeToCompositeLookupTest
throws AssemblyException
{
module.values( SomeOtherFoo.class, BasicFoo.class );
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
}.module();
@@ -238,7 +246,7 @@ public class TypeToCompositeLookupTest
public void entities()
throws UnitOfWorkCompletionException, ActivationException, AssemblyException
{
- Module module = new SingletonAssembler()
+ UnitOfWorkFactory uowf = new SingletonAssembler()
{
@Override
@@ -247,11 +255,12 @@ public class TypeToCompositeLookupTest
{
new EntityTestAssembler().assemble( module );
module.entities( SomeOtherFoo.class );
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
- }.module();
+ }.module().unitOfWorkFactory();
- UnitOfWork uow = module.newUnitOfWork();
+ UnitOfWork uow = uowf.newUnitOfWork();
SomeOtherFoo someOtherFoo = uow.newEntityBuilder( SomeOtherFoo.class ).newInstance();
BasicFoo basicFoo = uow.newEntityBuilder( BasicFoo.class ).newInstance();
@@ -267,7 +276,7 @@ public class TypeToCompositeLookupTest
uow.complete();
- uow = module.newUnitOfWork();
+ uow = uowf.newUnitOfWork();
uow.get( SomeOtherFoo.class, someOtherFooIdentity );
uow.get( BasicFoo.class, basicFooIdentity );
@@ -280,7 +289,7 @@ public class TypeToCompositeLookupTest
public void entitiesAmbiguousDeclaration()
throws UnitOfWorkCompletionException, ActivationException, AssemblyException
{
- Module module = new SingletonAssembler()
+ UnitOfWorkFactory uowf = new SingletonAssembler()
{
@Override
@@ -289,11 +298,12 @@ public class TypeToCompositeLookupTest
{
new EntityTestAssembler().assemble( module );
module.entities( SomeOtherFoo.class, BasicFoo.class );
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
- }.module();
+ }.module().unitOfWorkFactory();
- UnitOfWork uow = module.newUnitOfWork();
+ UnitOfWork uow = uowf.newUnitOfWork();
SomeOtherFoo someOtherFoo = uow.newEntityBuilder( SomeOtherFoo.class ).newInstance();
BasicFoo basicFoo = uow.newEntityBuilder( BasicFoo.class ).newInstance();
@@ -317,7 +327,7 @@ public class TypeToCompositeLookupTest
uow.complete();
- uow = module.newUnitOfWork();
+ uow = uowf.newUnitOfWork();
assertEquals( CATHEDRAL, uow.get( SomeOtherFoo.class, someOtherFooIdentity ).bar() );
assertEquals( BAZAR, uow.get( BasicFoo.class, basicFooIdentity ).bar() );
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/core/runtime/src/test/java/org/apache/zest/runtime/transients/TransientVisibilityTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/transients/TransientVisibilityTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/transients/TransientVisibilityTest.java
index 798830c..ad27219 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/transients/TransientVisibilityTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/transients/TransientVisibilityTest.java
@@ -16,9 +16,6 @@
package org.apache.zest.runtime.transients;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
import org.apache.zest.api.common.Visibility;
import org.apache.zest.api.composite.NoSuchTransientException;
import org.apache.zest.api.composite.TransientBuilder;
@@ -30,19 +27,25 @@ import org.apache.zest.api.service.ServiceComposite;
import org.apache.zest.api.structure.Application;
import org.apache.zest.api.structure.Module;
import org.apache.zest.api.unitofwork.UnitOfWork;
+import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
import org.apache.zest.api.value.ValueComposite;
import org.apache.zest.bootstrap.ApplicationAssemblerAdapter;
import org.apache.zest.bootstrap.Assembler;
import org.apache.zest.bootstrap.AssemblyException;
import org.apache.zest.bootstrap.Energy4Java;
import org.apache.zest.bootstrap.ModuleAssembly;
+import org.apache.zest.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
import org.apache.zest.test.EntityTestAssembler;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
public class TransientVisibilityTest
{
private Energy4Java zest;
private Module module;
private Application app;
+ private UnitOfWorkFactory uowf;
@Before
public void setup()
@@ -60,7 +63,7 @@ public class TransientVisibilityTest
{ // Layer From
{ // From Module
new FromAssembler(),
- },
+ },
{ // Beside Module
new BesideAssembler()
}
@@ -76,6 +79,7 @@ public class TransientVisibilityTest
} );
app.activate();
module = app.findModule( "From Layer", "From" );
+ uowf = module.unitOfWorkFactory();
}
@After
@@ -172,7 +176,7 @@ public class TransientVisibilityTest
@Test
public void givenFromEntityWhenAccessingModuleApplicationVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -190,7 +194,7 @@ public class TransientVisibilityTest
@Test
public void givenFromEntityWhenAccessingModuleLayerVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -208,7 +212,7 @@ public class TransientVisibilityTest
@Test
public void givenFromEntityWhenAccessingModuleModuleVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -226,7 +230,7 @@ public class TransientVisibilityTest
@Test
public void givenFromEntityWhenAccessingBesideApplicationVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -244,7 +248,7 @@ public class TransientVisibilityTest
@Test
public void givenFromEntityWhenAccessingBesideLayerVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -262,7 +266,7 @@ public class TransientVisibilityTest
@Test( expected = NoSuchTransientException.class )
public void givenFromEntityWhenAccessingBesideModuleVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -280,7 +284,7 @@ public class TransientVisibilityTest
@Test
public void givenFromEntityWhenAccessingBelowApplicationVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -298,7 +302,7 @@ public class TransientVisibilityTest
@Test( expected = NoSuchTransientException.class )
public void givenFromEntityWhenAccessingBelowLayerVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -316,7 +320,7 @@ public class TransientVisibilityTest
@Test( expected = NoSuchTransientException.class )
public void givenFromEntityWhenAccessingBelowModuleVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -334,7 +338,7 @@ public class TransientVisibilityTest
@Test( expected = NoSuchTransientException.class )
public void givenFromEntityWhenAccessingAboveApplicationVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -352,7 +356,7 @@ public class TransientVisibilityTest
@Test( expected = NoSuchTransientException.class )
public void givenFromEntityWhenAccessingAboveLayerVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -370,7 +374,7 @@ public class TransientVisibilityTest
@Test( expected = NoSuchTransientException.class )
public void givenFromEntityWhenAccessingAboveModuleVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -655,6 +659,8 @@ public class TransientVisibilityTest
module.transients( ModuleApplicationVisible.class ).visibleIn( Visibility.application );
module.transients( ModuleLayerVisible.class ).visibleIn( Visibility.layer );
module.transients( ModuleModuleVisible.class ).visibleIn( Visibility.module );
+
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
}
@@ -672,6 +678,8 @@ public class TransientVisibilityTest
module.transients( BelowModuleVisible.class ).visibleIn( Visibility.module );
new EntityTestAssembler().visibleIn( Visibility.application ).assemble( module );
+
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
}
@@ -687,6 +695,8 @@ public class TransientVisibilityTest
module.transients( AboveApplicationVisible.class ).visibleIn( Visibility.application );
module.transients( AboveLayerVisible.class ).visibleIn( Visibility.layer );
module.transients( AboveModuleVisible.class ).visibleIn( Visibility.module );
+
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
}
@@ -701,6 +711,8 @@ public class TransientVisibilityTest
module.transients( BesideApplicationVisible.class ).visibleIn( Visibility.application );
module.transients( BesideLayerVisible.class ).visibleIn( Visibility.layer );
module.transients( BesideModuleVisible.class ).visibleIn( Visibility.module );
+
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/core/runtime/src/test/java/org/apache/zest/runtime/unitofwork/AutoCloseableUoWTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/unitofwork/AutoCloseableUoWTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/unitofwork/AutoCloseableUoWTest.java
index 82439f3..a489767 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/unitofwork/AutoCloseableUoWTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/unitofwork/AutoCloseableUoWTest.java
@@ -54,7 +54,7 @@ public class AutoCloseableUoWTest
public void givenGoodAutoCloseableUoWWhenTryWithResourceExpectSuccess()
throws UnitOfWorkCompletionException
{
- try( UnitOfWork uow = module.newUnitOfWork() )
+ try( UnitOfWork uow = uowf.newUnitOfWork() )
{
EntityBuilder<TestEntity> builder = uow.newEntityBuilder( TestEntity.class );
builder.instance().mandatory().set( "Mandatory property" );
@@ -67,7 +67,7 @@ public class AutoCloseableUoWTest
public void givenWrongAutoCloseableUoWWhenTryWithResourceExpectSuccess()
throws UnitOfWorkCompletionException
{
- try( UnitOfWork uow = module.newUnitOfWork() )
+ try( UnitOfWork uow = uowf.newUnitOfWork() )
{
uow.newEntity( TestEntity.class );
uow.complete();
@@ -77,7 +77,7 @@ public class AutoCloseableUoWTest
@After
public void afterEachTest()
{
- assertThat( module.isUnitOfWorkActive(), is( false ) );
+ assertThat( uowf.isUnitOfWorkActive(), is( false ) );
}
}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/core/runtime/src/test/java/org/apache/zest/runtime/unitofwork/PrivateEntityUnitOfWorkTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/unitofwork/PrivateEntityUnitOfWorkTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/unitofwork/PrivateEntityUnitOfWorkTest.java
index 86e2fba..1d81f68 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/unitofwork/PrivateEntityUnitOfWorkTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/unitofwork/PrivateEntityUnitOfWorkTest.java
@@ -14,7 +14,6 @@
package org.apache.zest.runtime.unitofwork;
-import org.junit.Test;
import org.apache.zest.api.association.Association;
import org.apache.zest.api.association.ManyAssociation;
import org.apache.zest.api.entity.EntityBuilder;
@@ -31,17 +30,14 @@ import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
import org.apache.zest.api.value.ValueBuilder;
import org.apache.zest.api.value.ValueBuilderFactory;
import org.apache.zest.api.value.ValueComposite;
-import org.apache.zest.bootstrap.ApplicationAssembler;
-import org.apache.zest.bootstrap.ApplicationAssembly;
-import org.apache.zest.bootstrap.ApplicationAssemblyFactory;
import org.apache.zest.bootstrap.Assembler;
-import org.apache.zest.bootstrap.AssemblyException;
import org.apache.zest.bootstrap.Energy4Java;
-import org.apache.zest.bootstrap.ModuleAssembly;
+import org.apache.zest.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
import org.apache.zest.test.EntityTestAssembler;
+import org.junit.Test;
-import static org.junit.Assert.fail;
import static org.apache.zest.api.common.Visibility.application;
+import static org.junit.Assert.fail;
/**
* JAVADOC
@@ -58,42 +54,29 @@ public class PrivateEntityUnitOfWorkTest
System.setProperty( "zest.compacttrace", "off" );
Energy4Java is = new Energy4Java();
- Application app = is.newApplication( new ApplicationAssembler()
- {
- public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
- throws AssemblyException
- {
- return applicationFactory.newApplicationAssembly( new Assembler[][][]{
+ Application app = is.newApplication(
+ applicationFactory ->
+ applicationFactory.newApplicationAssembly( new Assembler[][][]{
{
{
- new Assembler()
- {
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.objects( PrivateEntityUnitOfWorkTest.class );
- }
+ module -> {
+ module.objects( PrivateEntityUnitOfWorkTest.class );
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
}
},
{
{
- new Assembler()
- {
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.entities( ProductEntity.class );
- module.entities( ProductCatalogEntity.class ).visibleIn( application );
- module.values( ProductInfo.class );
- new EntityTestAssembler().assemble( module );
- }
+ module -> {
+ module.entities( ProductEntity.class );
+ module.entities( ProductCatalogEntity.class ).visibleIn( application );
+ module.values( ProductInfo.class );
+ new EntityTestAssembler().assemble( module );
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
}
}
- } );
- }
- } );
+ } ) );
app.activate();
Module module = app.findModule( "Layer 1", "Module 1" );
@@ -126,7 +109,7 @@ public class PrivateEntityUnitOfWorkTest
unitOfWork.discard();
}
- unitOfWork = module.newUnitOfWork();
+ unitOfWork = uowf.newUnitOfWork();
try
{
ProductCatalog catalog = unitOfWork.get( ProductCatalog.class, "1" );
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/core/runtime/src/test/java/org/apache/zest/runtime/unitofwork/RemovalTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/unitofwork/RemovalTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/unitofwork/RemovalTest.java
index d80267c..2cfaabc 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/unitofwork/RemovalTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/unitofwork/RemovalTest.java
@@ -46,14 +46,14 @@ public class RemovalTest
public void givenUnitOfWorkHasBeenCreateWhenCreatingNewEntityThenFindNewEntityWithGet()
throws Exception
{
- UnitOfWork uow = module.newUnitOfWork();
+ UnitOfWork uow = uowf.newUnitOfWork();
try
{
EntityBuilder<Abc> builder = uow.newEntityBuilder( Abc.class, "123" );
builder.instance().name().set( "Niclas" );
builder.newInstance();
uow.complete();
- uow = module.newUnitOfWork();
+ uow = uowf.newUnitOfWork();
Abc abc = uow.get( Abc.class, "123" );
assertEquals( "Niclas", abc.name().get() );
}
@@ -67,19 +67,19 @@ public class RemovalTest
public void givenEntityCreatedWhenRemovingEntityThenFindNewEntityShouldNotExist()
throws Exception
{
- UnitOfWork uow = module.newUnitOfWork();
+ UnitOfWork uow = uowf.newUnitOfWork();
try
{
EntityBuilder<Abc> builder = uow.newEntityBuilder( Abc.class, "123" );
builder.instance().name().set( "Niclas" );
builder.newInstance();
uow.complete();
- uow = module.newUnitOfWork();
+ uow = uowf.newUnitOfWork();
Abc abc = uow.get( Abc.class, "123" );
assertEquals( "Niclas", abc.name().get() );
uow.remove( abc );
uow.complete();
- uow = module.newUnitOfWork();
+ uow = uowf.newUnitOfWork();
uow.get( Abc.class, "123" );
fail( "This '123' entity should not exist." );
}
@@ -97,18 +97,18 @@ public class RemovalTest
public void givenDetachedEntityWhenRemovingEntityThenFindNewEntityShouldNotExist()
throws Exception
{
- UnitOfWork uow = module.newUnitOfWork();
+ UnitOfWork uow = uowf.newUnitOfWork();
try
{
EntityBuilder<Abc> builder = uow.newEntityBuilder( Abc.class, "123" );
builder.instance().name().set( "Niclas" );
Abc abc = builder.newInstance();
uow.complete();
- uow = module.newUnitOfWork();
+ uow = uowf.newUnitOfWork();
abc = uow.get( abc ); // Attach the detached entity to 'uow' session.
uow.remove( abc );
uow.complete();
- uow = module.newUnitOfWork();
+ uow = uowf.newUnitOfWork();
uow.get( Abc.class, "123" );
fail( "This '123' entity should not exist." );
}
@@ -126,7 +126,7 @@ public class RemovalTest
public void givenEntityCreatedWhenRemovingEntityBeforeCompletingUowThenFindNewEntityShouldNotExist()
throws Exception
{
- UnitOfWork uow = module.newUnitOfWork();
+ UnitOfWork uow = uowf.newUnitOfWork();
try
{
EntityBuilder<Abc> builder = uow.newEntityBuilder( Abc.class, "123" );
@@ -134,7 +134,7 @@ public class RemovalTest
Abc abc = builder.newInstance();
uow.remove( abc );
uow.complete();
- uow = module.newUnitOfWork();
+ uow = uowf.newUnitOfWork();
uow.get( Abc.class, "123" );
fail( "This '123' entity should not exist." );
}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/core/runtime/src/test/java/org/apache/zest/runtime/unitofwork/UnitOfWorkFactoryTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/unitofwork/UnitOfWorkFactoryTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/unitofwork/UnitOfWorkFactoryTest.java
index e084471..efd32bb 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/unitofwork/UnitOfWorkFactoryTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/unitofwork/UnitOfWorkFactoryTest.java
@@ -50,7 +50,7 @@ public class UnitOfWorkFactoryTest
public void testUnitOfWork()
throws Exception
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
// Create product
EntityBuilder<ProductEntity> cb = unitOfWork.newEntityBuilder( ProductEntity.class );
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueComposite2Test.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueComposite2Test.java b/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueComposite2Test.java
index 70c28d4..79f8151 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueComposite2Test.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueComposite2Test.java
@@ -18,6 +18,7 @@
package org.apache.zest.runtime.value;
import java.security.Guard;
+import org.apache.zest.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
import org.junit.Assert;
import org.junit.Test;
import org.apache.zest.api.activation.ActivationException;
@@ -47,6 +48,7 @@ public class ValueComposite2Test
{
module.values( SomeValue.class );
module.services( DummyService.class );
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
};
ValueBuilder<Some> builder = app.module().newValueBuilder( Some.class );
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueInjectionDeserializationTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueInjectionDeserializationTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueInjectionDeserializationTest.java
index fb98815..ceb8c7a 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueInjectionDeserializationTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueInjectionDeserializationTest.java
@@ -60,14 +60,14 @@ public class ValueInjectionDeserializationTest
builder.prototype().data().set( "Niclas" );
Some value = builder.newInstance();
- uow = module.newUnitOfWork();
+ uow = uowf.newUnitOfWork();
EntityBuilder<Niclas> eb = uow.newEntityBuilder( Niclas.class );
eb.instance().value().set( value );
Niclas niclas1 = eb.newInstance();
String id = niclas1.identity().get();
uow.complete();
- uow = module.newUnitOfWork();
+ uow = uowf.newUnitOfWork();
Niclas niclas2 = uow.get( Niclas.class, id );
Some someValue = niclas2.value().get();
Assert.assertEquals( someValue.data().get(), "Niclas" );
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueVisibilityTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueVisibilityTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueVisibilityTest.java
index 4c4cdba..aa14297 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueVisibilityTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueVisibilityTest.java
@@ -16,6 +16,8 @@
package org.apache.zest.runtime.value;
+import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
+import org.apache.zest.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -44,6 +46,7 @@ public class ValueVisibilityTest
private Energy4Java zest;
private Module module;
private Application app;
+ private UnitOfWorkFactory uowf;
@Before
public void setup()
@@ -77,6 +80,7 @@ public class ValueVisibilityTest
} );
app.activate();
module = app.findModule( "From Layer", "From" );
+ uowf = module.unitOfWorkFactory();
}
@After
@@ -173,7 +177,7 @@ public class ValueVisibilityTest
@Test
public void givenFromEntityWhenAccessingModuleApplicationVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -191,7 +195,7 @@ public class ValueVisibilityTest
@Test
public void givenFromEntityWhenAccessingModuleLayerVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -209,7 +213,7 @@ public class ValueVisibilityTest
@Test
public void givenFromEntityWhenAccessingModuleModuleVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -227,7 +231,7 @@ public class ValueVisibilityTest
@Test
public void givenFromEntityWhenAccessingBesideApplicationVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -245,7 +249,7 @@ public class ValueVisibilityTest
@Test
public void givenFromEntityWhenAccessingBesideLayerVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -263,7 +267,7 @@ public class ValueVisibilityTest
@Test( expected = NoSuchValueException.class )
public void givenFromEntityWhenAccessingBesideModuleVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -281,7 +285,7 @@ public class ValueVisibilityTest
@Test
public void givenFromEntityWhenAccessingBelowApplicationVisibleExpectSuccess()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -299,7 +303,7 @@ public class ValueVisibilityTest
@Test( expected = NoSuchValueException.class )
public void givenFromEntityWhenAccessingBelowLayerVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -317,7 +321,7 @@ public class ValueVisibilityTest
@Test( expected = NoSuchValueException.class )
public void givenFromEntityWhenAccessingBelowModuleVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -335,7 +339,7 @@ public class ValueVisibilityTest
@Test( expected = NoSuchValueException.class )
public void givenFromEntityWhenAccessingAboveApplicationVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -353,7 +357,7 @@ public class ValueVisibilityTest
@Test( expected = NoSuchValueException.class )
public void givenFromEntityWhenAccessingAboveLayerVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -371,7 +375,7 @@ public class ValueVisibilityTest
@Test( expected = NoSuchValueException.class )
public void givenFromEntityWhenAccessingAboveModuleVisibleExpectException()
{
- UnitOfWork unitOfWork = module.newUnitOfWork();
+ UnitOfWork unitOfWork = uowf.newUnitOfWork();
try
{
FromEntity entity = unitOfWork.newEntity( FromEntity.class, "123" );
@@ -656,6 +660,8 @@ public class ValueVisibilityTest
module.values( ModuleApplicationVisible.class ).visibleIn( Visibility.application );
module.values( ModuleLayerVisible.class ).visibleIn( Visibility.layer );
module.values( ModuleModuleVisible.class ).visibleIn( Visibility.module );
+
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
}
@@ -673,6 +679,7 @@ public class ValueVisibilityTest
module.values( BelowModuleVisible.class ).visibleIn( Visibility.module );
new EntityTestAssembler().visibleIn( Visibility.application ).assemble( module );
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
}
@@ -688,6 +695,8 @@ public class ValueVisibilityTest
module.values( AboveApplicationVisible.class ).visibleIn( Visibility.application );
module.values( AboveLayerVisible.class ).visibleIn( Visibility.layer );
module.values( AboveModuleVisible.class ).visibleIn( Visibility.module );
+
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
}
@@ -702,6 +711,8 @@ public class ValueVisibilityTest
module.values( BesideApplicationVisible.class ).visibleIn( Visibility.application );
module.values( BesideLayerVisible.class ).visibleIn( Visibility.layer );
module.values( BesideModuleVisible.class ).visibleIn( Visibility.module );
+
+ new DefaultUnitOfWorkAssembler().assemble( module );
}
}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a5be013f/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueWithAssociationTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueWithAssociationTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueWithAssociationTest.java
index 4afb9ce..c16af32 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueWithAssociationTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueWithAssociationTest.java
@@ -65,7 +65,7 @@ public class ValueWithAssociationTest extends AbstractZestTest
String identity1;
String identity2;
DualFaced value;
- try (UnitOfWork uow = module.newUnitOfWork())
+ try (UnitOfWork uow = uowf.newUnitOfWork())
{
EntityBuilder<SimpleName> builder1 = uow.newEntityBuilder( SimpleName.class );
builder1.instance().name().set( "Niclas" );
@@ -85,7 +85,7 @@ public class ValueWithAssociationTest extends AbstractZestTest
uow.complete();
}
- try (UnitOfWork uow = module.newUnitOfWork())
+ try (UnitOfWork uow = uowf.newUnitOfWork())
{
DualFaced entity = uow.get( DualFaced.class, identity2 );
AssociationStateHolder holder = spi.stateOf( (EntityComposite) entity );
@@ -118,13 +118,13 @@ public class ValueWithAssociationTest extends AbstractZestTest
builder.prototype().name().set( "Hedhman" );
DualFaced value = builder.newInstance();
- try (UnitOfWork uow = module.newUnitOfWork())
+ try (UnitOfWork uow = uowf.newUnitOfWork())
{
uow.toEntity( DualFaced.class, value );
uow.complete();
}
- try (UnitOfWork uow = module.newUnitOfWork())
+ try (UnitOfWork uow = uowf.newUnitOfWork())
{
DualFaced entity = uow.get( DualFaced.class, "1234" );
assertThat( entity.identity().get(), equalTo( "1234" ) );
@@ -139,7 +139,7 @@ public class ValueWithAssociationTest extends AbstractZestTest
{
String identity1;
String identity2;
- try (UnitOfWork uow = module.newUnitOfWork())
+ try (UnitOfWork uow = uowf.newUnitOfWork())
{
EntityBuilder<SimpleName> builder1 = uow.newEntityBuilder( SimpleName.class );
builder1.instance().name().set( "Niclas" );
@@ -169,7 +169,7 @@ public class ValueWithAssociationTest extends AbstractZestTest
vb2.prototype().namedSimples().put( "paul", simpleValue );
DualFaced dualValue = vb2.newInstance();
- try (UnitOfWork uow = module.newUnitOfWork())
+ try (UnitOfWork uow = uowf.newUnitOfWork())
{
DualFaced dualEntity = uow.toEntity( DualFaced.class, dualValue );
// The root entity is expected to have changed value,