polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [18/34] zest-java git commit: ZEST-136 - Massive changes to the Runtime, refactoring the Model and Instance relationship.
Date Thu, 14 Apr 2016 06:13:24 GMT
http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractNamedQueryTest.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractNamedQueryTest.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractNamedQueryTest.java
index cb82864..cac1c7e 100755
--- a/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractNamedQueryTest.java
+++ b/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractNamedQueryTest.java
@@ -22,8 +22,10 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.function.Predicate;
 import org.apache.zest.api.composite.Composite;
+import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.query.Query;
 import org.apache.zest.api.query.grammar.OrderBy;
+import org.apache.zest.api.structure.Module;
 import org.apache.zest.spi.query.EntityFinderException;
 import org.apache.zest.spi.query.IndexExporter;
 import org.apache.zest.test.indexing.model.Domain;
@@ -48,6 +50,8 @@ import static org.junit.Assert.assertThat;
 public abstract class AbstractNamedQueryTest
     extends AbstractAnyQueryTest
 {
+    @Structure
+    Module moduleInstance;
 
     protected final Map<String, Predicate<Composite>> queries = new HashMap<>();
 
@@ -74,7 +78,7 @@ public abstract class AbstractNamedQueryTest
     public void showNetwork()
         throws IOException
     {
-        IndexExporter indexerExporter = module.findService( IndexExporter.class ).get();
+        IndexExporter indexerExporter = moduleInstance.findService( IndexExporter.class ).get();
         indexerExporter.exportReadableToStream( System.out );
     }
 
@@ -82,7 +86,7 @@ public abstract class AbstractNamedQueryTest
     public void script01()
         throws EntityFinderException
     {
-        final Query<Person> query = unitOfWork.newQuery( this.module
+        final Query<Person> query = unitOfWork.newQuery( this.moduleInstance
             .newQueryBuilder( Person.class )
             .where( queries.get( "script01" ) ) );
         System.out.println( "*** script01: " + query );
@@ -93,7 +97,7 @@ public abstract class AbstractNamedQueryTest
     public void script02()
         throws EntityFinderException
     {
-        final Query<Domain> query = unitOfWork.newQuery( this.module
+        final Query<Domain> query = unitOfWork.newQuery( this.moduleInstance
             .newQueryBuilder( Domain.class )
             .where( queries.get( "script02" ) ) );
         System.out.println( "*** script02: " + query );
@@ -104,7 +108,7 @@ public abstract class AbstractNamedQueryTest
     public void script03()
         throws EntityFinderException
     {
-        final Query<Nameable> query = unitOfWork.newQuery( this.module
+        final Query<Nameable> query = unitOfWork.newQuery( this.moduleInstance
             .newQueryBuilder( Nameable.class )
             .where( queries.get( "script03" ) ) );
         System.out.println( "*** script03: " + query );
@@ -116,7 +120,7 @@ public abstract class AbstractNamedQueryTest
     public void script04()
         throws EntityFinderException
     {
-        final Query<Person> query = unitOfWork.newQuery( this.module
+        final Query<Person> query = unitOfWork.newQuery( this.moduleInstance
             .newQueryBuilder( Person.class )
             .where( queries.get( "script04" ) ) );
         System.out.println( "*** script04: " + query );
@@ -127,7 +131,7 @@ public abstract class AbstractNamedQueryTest
     public void script05()
         throws EntityFinderException
     {
-        final Query<Person> query = unitOfWork.newQuery( this.module
+        final Query<Person> query = unitOfWork.newQuery( this.moduleInstance
             .newQueryBuilder( Person.class )
             .where( queries.get( "script05" ) ) );
         System.out.println( "*** script05: " + query );
@@ -138,7 +142,7 @@ public abstract class AbstractNamedQueryTest
     public void script06()
         throws EntityFinderException
     {
-        final Query<Person> query = unitOfWork.newQuery( this.module
+        final Query<Person> query = unitOfWork.newQuery( this.moduleInstance
             .newQueryBuilder( Person.class )
             .where( queries.get( "script06" ) ) );
         System.out.println( "*** script06: " + query );
@@ -149,7 +153,7 @@ public abstract class AbstractNamedQueryTest
     public void script07()
         throws EntityFinderException
     {
-        final Query<Nameable> query = unitOfWork.newQuery( this.module
+        final Query<Nameable> query = unitOfWork.newQuery( this.moduleInstance
             .newQueryBuilder( Nameable.class )
             .where( queries.get( "script07" ) ) );
         System.out.println( "*** script07: " + query );
@@ -160,7 +164,7 @@ public abstract class AbstractNamedQueryTest
     public void script08()
         throws EntityFinderException
     {
-        final Query<Person> query = unitOfWork.newQuery( this.module
+        final Query<Person> query = unitOfWork.newQuery( this.moduleInstance
             .newQueryBuilder( Person.class )
             .where( queries.get( "script08" ) ) );
         System.out.println( "*** script08: " + query );
@@ -171,7 +175,7 @@ public abstract class AbstractNamedQueryTest
     public void script09()
         throws EntityFinderException
     {
-        final Query<Female> query = unitOfWork.newQuery( this.module
+        final Query<Female> query = unitOfWork.newQuery( this.moduleInstance
             .newQueryBuilder( Female.class )
             .where( queries.get( "script09" ) ) );
         System.out.println( "*** script09: " + query );
@@ -182,7 +186,7 @@ public abstract class AbstractNamedQueryTest
     public void script10()
         throws EntityFinderException
     {
-        final Query<Person> query = unitOfWork.newQuery( this.module
+        final Query<Person> query = unitOfWork.newQuery( this.moduleInstance
             .newQueryBuilder( Person.class )
             .where( queries.get( "script10" ) ) );
         System.out.println( "*** script10: " + query );
@@ -193,7 +197,7 @@ public abstract class AbstractNamedQueryTest
     public void script11()
         throws EntityFinderException
     {
-        final Query<Person> query = unitOfWork.newQuery( this.module
+        final Query<Person> query = unitOfWork.newQuery( this.moduleInstance
             .newQueryBuilder( Person.class )
             .where( queries.get( "script11" ) ) );
         System.out.println( "*** script11: " + query );
@@ -204,7 +208,7 @@ public abstract class AbstractNamedQueryTest
     public void script12()
         throws EntityFinderException
     {
-        final Query<Person> query = unitOfWork.newQuery( this.module
+        final Query<Person> query = unitOfWork.newQuery( this.moduleInstance
             .newQueryBuilder( Person.class )
             .where( queries.get( "script12" ) ) );
         System.out.println( "*** script12: " + query );
@@ -215,7 +219,7 @@ public abstract class AbstractNamedQueryTest
     public void script13()
         throws EntityFinderException
     {
-        final Query<Person> query = unitOfWork.newQuery( this.module
+        final Query<Person> query = unitOfWork.newQuery( this.moduleInstance
             .newQueryBuilder( Person.class )
             .where( queries.get( "script13" ) ) );
         System.out.println( "*** script13: " + query );
@@ -226,7 +230,7 @@ public abstract class AbstractNamedQueryTest
     public void script14()
         throws EntityFinderException
     {
-        final Query<Male> query = unitOfWork.newQuery( this.module
+        final Query<Male> query = unitOfWork.newQuery( this.moduleInstance
             .newQueryBuilder( Male.class )
             .where( queries.get( "script14" ) ) );
         System.out.println( "*** script14: " + query );
@@ -237,7 +241,7 @@ public abstract class AbstractNamedQueryTest
     public void script15()
         throws EntityFinderException
     {
-        final Query<Person> query = unitOfWork.newQuery( this.module
+        final Query<Person> query = unitOfWork.newQuery( this.moduleInstance
             .newQueryBuilder( Person.class )
             .where( queries.get( "script15" ) ) );
         System.out.println( "*** script15: " + query );
@@ -249,7 +253,7 @@ public abstract class AbstractNamedQueryTest
         throws EntityFinderException
     {
         Nameable nameable = templateFor( Nameable.class );
-        final Query<Nameable> query = unitOfWork.newQuery( this.module
+        final Query<Nameable> query = unitOfWork.newQuery( this.moduleInstance
             .newQueryBuilder( Nameable.class )
             .where( queries.get( "script16" ) ) );
         query.orderBy( orderBy( nameable.name() ) );
@@ -263,7 +267,7 @@ public abstract class AbstractNamedQueryTest
         throws EntityFinderException
     {
         Nameable nameable = templateFor( Nameable.class );
-        final Query<Nameable> query = unitOfWork.newQuery( this.module
+        final Query<Nameable> query = unitOfWork.newQuery( this.moduleInstance
             .newQueryBuilder( Nameable.class )
             .where( queries.get( "script17" ) ) );
         query.orderBy( orderBy( nameable.name() ) );
@@ -278,7 +282,7 @@ public abstract class AbstractNamedQueryTest
         throws EntityFinderException
     {
         Nameable nameable = templateFor( Nameable.class );
-        final Query<Nameable> query = unitOfWork.newQuery( this.module
+        final Query<Nameable> query = unitOfWork.newQuery( this.moduleInstance
             .newQueryBuilder( Nameable.class )
             .where( queries.get( "script18" ) ) );
         query.orderBy( orderBy( nameable.name() ) );
@@ -292,7 +296,7 @@ public abstract class AbstractNamedQueryTest
         throws EntityFinderException
     {
         Nameable nameable = templateFor( Nameable.class );
-        final Query<Nameable> query = unitOfWork.newQuery( this.module
+        final Query<Nameable> query = unitOfWork.newQuery( this.moduleInstance
             .newQueryBuilder( Nameable.class )
             .where( queries.get( "script19" ) ) );
         query.orderBy( orderBy( nameable.name() ) );
@@ -305,7 +309,7 @@ public abstract class AbstractNamedQueryTest
         throws EntityFinderException
     {
         Person person = templateFor( Person.class );
-        final Query<Person> query = unitOfWork.newQuery( this.module
+        final Query<Person> query = unitOfWork.newQuery( this.moduleInstance
             .newQueryBuilder( Person.class )
             .where( queries.get( "script20" ) ) );
         query.orderBy( orderBy( person.name(), OrderBy.Order.DESCENDING ) );
@@ -318,7 +322,7 @@ public abstract class AbstractNamedQueryTest
         throws EntityFinderException
     {
         Person person = templateFor( Person.class );
-        final Query<Person> query = unitOfWork.newQuery( this.module
+        final Query<Person> query = unitOfWork.newQuery( this.moduleInstance
             .newQueryBuilder( Person.class )
             .where( queries.get( "script21" ) ) );
         query.orderBy( orderBy( person.placeOfBirth().get().name() ), orderBy( person.yearOfBirth() ) );
@@ -330,7 +334,7 @@ public abstract class AbstractNamedQueryTest
     public void script22()
         throws EntityFinderException
     {
-        final Query<Nameable> query = unitOfWork.newQuery( this.module
+        final Query<Nameable> query = unitOfWork.newQuery( this.moduleInstance
             .newQueryBuilder( Nameable.class )
             .where( queries.get( "script22" ) ) );
         System.out.println( "*** script22: " + query );
@@ -341,7 +345,7 @@ public abstract class AbstractNamedQueryTest
     public void script24()
         throws EntityFinderException
     {
-        final Query<Domain> query = unitOfWork.newQuery( this.module
+        final Query<Domain> query = unitOfWork.newQuery( this.moduleInstance
             .newQueryBuilder( Domain.class )
             .where( queries.get( "script24" ) ) );
         query.setVariable( "domain", "Gaming" );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractQueryTest.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractQueryTest.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractQueryTest.java
index e071204..852094a 100644
--- a/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractQueryTest.java
+++ b/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractQueryTest.java
@@ -24,6 +24,8 @@ import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.HashMap;
 import java.util.Map;
+import org.apache.zest.api.injection.scope.Structure;
+import org.apache.zest.api.structure.Module;
 import org.joda.time.DateTime;
 import org.joda.time.LocalDate;
 import org.joda.time.LocalDateTime;
@@ -75,12 +77,15 @@ import static org.apache.zest.test.indexing.NameableAssert.verifyUnorderedResult
 public abstract class AbstractQueryTest
     extends AbstractAnyQueryTest
 {
+    @Structure
+    Module moduleInstance;
+
 
     @Test
     public void showNetwork()
         throws IOException
     {
-        IndexExporter indexerExporter = module.findService( IndexExporter.class ).get();
+        IndexExporter indexerExporter = moduleInstance.findService( IndexExporter.class ).get();
         indexerExporter.exportReadableToStream( System.out );
     }
 
@@ -88,7 +93,7 @@ public abstract class AbstractQueryTest
     public void script01()
         throws EntityFinderException
     {
-        final QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        final QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         final Query<Person> query = unitOfWork.newQuery( qb );
         System.out.println( "*** script01: " + query );
         verifyUnorderedResults( query, "Joe Doe", "Ann Doe", "Jack Doe" );
@@ -98,7 +103,7 @@ public abstract class AbstractQueryTest
     public void script02()
         throws EntityFinderException
     {
-        final QueryBuilder<Domain> qb = this.module.newQueryBuilder( Domain.class );
+        final QueryBuilder<Domain> qb = this.moduleInstance.newQueryBuilder( Domain.class );
         final Nameable nameable = templateFor( Nameable.class );
         final Query<Domain> query = unitOfWork.newQuery( qb.where( eq( nameable.name(), "Gaming" ) ) );
         System.out.println( "*** script02: " + query );
@@ -109,7 +114,7 @@ public abstract class AbstractQueryTest
     public void script03()
         throws EntityFinderException
     {
-        QueryBuilder<Nameable> qb = this.module.newQueryBuilder( Nameable.class );
+        QueryBuilder<Nameable> qb = this.moduleInstance.newQueryBuilder( Nameable.class );
         Query<Nameable> query = unitOfWork.newQuery( qb );
         System.out.println( "*** script03: " + query );
         verifyUnorderedResults( query, "Joe Doe", "Ann Doe", "Jack Doe", "Penang", "Kuala Lumpur", "Cooking", "Gaming",
@@ -120,7 +125,7 @@ public abstract class AbstractQueryTest
     public void script04()
         throws EntityFinderException
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person personTemplate = templateFor( Person.class );
         City placeOfBirth = personTemplate.placeOfBirth().get();
         Query<Person> query = unitOfWork.newQuery( qb.where( eq( placeOfBirth.name(), "Kuala Lumpur" ) ) );
@@ -132,7 +137,7 @@ public abstract class AbstractQueryTest
     public void script04_ne()
         throws EntityFinderException
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person personTemplate = templateFor( Person.class );
         City placeOfBirth = personTemplate.placeOfBirth().get();
         Query<Person> query = unitOfWork.newQuery( qb.where( ne( placeOfBirth.name(), "Kuala Lumpur" ) ) );
@@ -144,7 +149,7 @@ public abstract class AbstractQueryTest
     public void script05()
         throws EntityFinderException
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where( eq( person.mother()
             .get()
@@ -160,7 +165,7 @@ public abstract class AbstractQueryTest
     public void script06()
         throws EntityFinderException
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where( ge( person.yearOfBirth(), 1973 ) ) );
         System.out.println( "*** script06: " + query );
@@ -172,7 +177,7 @@ public abstract class AbstractQueryTest
     public void script07()
         throws EntityFinderException
     {
-        QueryBuilder<Nameable> qb = this.module.newQueryBuilder( Nameable.class );
+        QueryBuilder<Nameable> qb = this.moduleInstance.newQueryBuilder( Nameable.class );
         Person person = templateFor( Person.class );
         Query<Nameable> query = unitOfWork.newQuery( qb.where(
             and( ge( person.yearOfBirth(), 1900 ), eq( person.placeOfBirth().get().name(), "Penang" ) ) ) );
@@ -185,7 +190,7 @@ public abstract class AbstractQueryTest
     public void script08()
         throws EntityFinderException
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where( or( eq( person.yearOfBirth(), 1970 ), eq( person.yearOfBirth(), 1975 ) ) )
         );
@@ -198,7 +203,7 @@ public abstract class AbstractQueryTest
     public void script09()
         throws EntityFinderException
     {
-        QueryBuilder<Female> qb = this.module.newQueryBuilder( Female.class );
+        QueryBuilder<Female> qb = this.moduleInstance.newQueryBuilder( Female.class );
         Person person = templateFor( Person.class );
         Query<Female> query = unitOfWork.newQuery( qb.where( or( eq( person.yearOfBirth(), 1970 ), eq( person.yearOfBirth(), 1975 ) ) )
         );
@@ -210,7 +215,7 @@ public abstract class AbstractQueryTest
     public void script10()
         throws EntityFinderException
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where( not( eq( person.yearOfBirth(), 1975 ) ) ) );
         System.out.println( "*** script10: " + query );
@@ -221,7 +226,7 @@ public abstract class AbstractQueryTest
     public void script11()
         throws EntityFinderException
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where( isNotNull( person.email() ) ) );
         System.out.println( "*** script11: " + query );
@@ -232,7 +237,7 @@ public abstract class AbstractQueryTest
     public void script12()
         throws EntityFinderException
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where( isNull( person.email() ) ) );
         System.out.println( "*** script12: " + query );
@@ -243,7 +248,7 @@ public abstract class AbstractQueryTest
     public void script12_ne()
         throws EntityFinderException
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where( ne( person.email(), "joe@thedoes.net" ) ) );
         System.out.println( "*** script12_ne: " + query );
@@ -254,7 +259,7 @@ public abstract class AbstractQueryTest
     public void script13()
         throws EntityFinderException
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Male person = templateFor( Male.class );
         Query<Person> query = unitOfWork.newQuery( qb.where( isNotNull( person.wife() ) ) );
         System.out.println( "*** script13: " + query );
@@ -265,7 +270,7 @@ public abstract class AbstractQueryTest
     public void script14()
         throws EntityFinderException
     {
-        QueryBuilder<Male> qb = this.module.newQueryBuilder( Male.class );
+        QueryBuilder<Male> qb = this.moduleInstance.newQueryBuilder( Male.class );
         Male person = templateFor( Male.class );
         Query<Male> query = unitOfWork.newQuery( qb.where( isNull( person.wife() ) ) );
         System.out.println( "*** script14: " + query );
@@ -276,7 +281,7 @@ public abstract class AbstractQueryTest
     public void script15()
         throws EntityFinderException
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Male person = templateFor( Male.class );
         Query<Person> query = unitOfWork.newQuery( qb.where( isNull( person.wife() ) ) );
         System.out.println( "*** script15: " + query );
@@ -287,7 +292,7 @@ public abstract class AbstractQueryTest
     public void script16()
         throws EntityFinderException
     {
-        QueryBuilder<Nameable> qb = this.module.newQueryBuilder( Nameable.class );
+        QueryBuilder<Nameable> qb = this.moduleInstance.newQueryBuilder( Nameable.class );
         // should return only 2 entities
         Nameable nameable = templateFor( Nameable.class );
         Query<Nameable> query = unitOfWork.newQuery( qb );
@@ -301,7 +306,7 @@ public abstract class AbstractQueryTest
     public void script17()
         throws EntityFinderException
     {
-        QueryBuilder<Nameable> qb = this.module.newQueryBuilder( Nameable.class );
+        QueryBuilder<Nameable> qb = this.moduleInstance.newQueryBuilder( Nameable.class );
         // should return only 3 entities starting with forth one
         Nameable nameable = templateFor( Nameable.class );
         Query<Nameable> query = unitOfWork.newQuery( qb );
@@ -316,7 +321,7 @@ public abstract class AbstractQueryTest
     public void script18()
         throws EntityFinderException
     {
-        QueryBuilder<Nameable> qb = this.module.newQueryBuilder( Nameable.class );
+        QueryBuilder<Nameable> qb = this.moduleInstance.newQueryBuilder( Nameable.class );
         // should return all Nameable entities sorted by name
         Nameable nameable = templateFor( Nameable.class );
         Query<Nameable> query = unitOfWork.newQuery( qb );
@@ -330,7 +335,7 @@ public abstract class AbstractQueryTest
     public void script19()
         throws EntityFinderException
     {
-        QueryBuilder<Nameable> qb = this.module.newQueryBuilder( Nameable.class );
+        QueryBuilder<Nameable> qb = this.moduleInstance.newQueryBuilder( Nameable.class );
         // should return all Nameable entities with a name > "D" sorted by name
         Nameable nameable = templateFor( Nameable.class );
         Query<Nameable> query = unitOfWork.newQuery( qb.where( gt( nameable.name(), "D" ) ) );
@@ -343,7 +348,7 @@ public abstract class AbstractQueryTest
     public void script20()
         throws EntityFinderException
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         // should return all Persons born after 1973 (Ann and Joe Doe) sorted descending by name
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where( gt( person.yearOfBirth(), 1973 ) ) );
@@ -356,7 +361,7 @@ public abstract class AbstractQueryTest
     public void script21()
         throws EntityFinderException
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         // should return all Persons sorted by name of the city they were born, and then by year they were born
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb );
@@ -369,7 +374,7 @@ public abstract class AbstractQueryTest
     public void script22()
         throws EntityFinderException
     {
-        QueryBuilder<Nameable> qb = this.module.newQueryBuilder( Nameable.class );
+        QueryBuilder<Nameable> qb = this.moduleInstance.newQueryBuilder( Nameable.class );
         Nameable nameable = templateFor( Nameable.class );
         // should return Jack and Joe Doe
         Query<Nameable> query = unitOfWork.newQuery( qb.where( matches( nameable.name(), "J.*Doe" ) ) );
@@ -381,7 +386,7 @@ public abstract class AbstractQueryTest
     public void script23()
         throws EntityFinderException
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Domain interests = oneOf( person.interests() );
         Query<Person> query = unitOfWork.newQuery( qb.where( eq( interests.name(), "Cars" ) ) );
@@ -393,7 +398,7 @@ public abstract class AbstractQueryTest
     public void script24()
         throws EntityFinderException
     {
-        final QueryBuilder<Domain> qb = this.module.newQueryBuilder( Domain.class );
+        final QueryBuilder<Domain> qb = this.moduleInstance.newQueryBuilder( Domain.class );
         final Nameable nameable = templateFor( Nameable.class );
         final Query<Domain> query = unitOfWork.newQuery( qb.where( eq( nameable.name(), "Gaming" ) ) );
         System.out.println( "*** script24: " + query );
@@ -403,13 +408,13 @@ public abstract class AbstractQueryTest
     @Test( expected = NotQueryableException.class )
     public void script25()
     {
-        this.module.newQueryBuilder( File.class );
+        this.moduleInstance.newQueryBuilder( File.class );
     }
 
     @Test( expected = NotQueryableException.class )
     public void script26()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         qb.where( eq( person.personalWebsite().get().file().get().value(), "some/path" ) );
     }
@@ -417,7 +422,7 @@ public abstract class AbstractQueryTest
     @Test( expected = NotQueryableException.class )
     public void script27()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         qb.where( eq( person.personalWebsite().get().host().get().value(), "zest.apache.org" ) );
     }
@@ -425,7 +430,7 @@ public abstract class AbstractQueryTest
     @Test( expected = NotQueryableException.class )
     public void script28()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         qb.where( eq( person.personalWebsite().get().port().get().value(), 8080 ) );
     }
@@ -433,7 +438,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script29()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where( eq( person.personalWebsite()
             .get()
@@ -451,7 +456,7 @@ public abstract class AbstractQueryTest
     @SuppressWarnings( "unchecked" )
     public void script30()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         QueryParam queryParam = null; // oneOf( person.personalWebsite().get().queryParams() );
         Query<Person> query = unitOfWork.newQuery( qb.where( and( eq( queryParam.name(), "foo" ), eq( queryParam.value(), "bar" ) ) ) );
@@ -463,7 +468,7 @@ public abstract class AbstractQueryTest
     @Ignore( "Equality on Property<Map<?,?>> not implemented" )
     public void script31()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Map<String, String> info = new HashMap<>( 0 );
         Query<Person> query = unitOfWork.newQuery( qb.where( eq( person.additionalInfo(), info ) ) );
@@ -474,7 +479,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script32()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where( eq( person.address().get().line1(), "Qi Alley 4j" ) ) );
         System.out.println( "*** script32: " + query );
@@ -484,7 +489,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script33()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Domain gaming = unitOfWork.get( Domain.class, "Gaming" );
         Query<Person> query = unitOfWork.newQuery( qb.where( contains( person.interests(), gaming ) ) );
@@ -496,7 +501,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script34()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Female annDoe = unitOfWork.get( Female.class, "anndoe" );
         Query<Person> query = unitOfWork.newQuery( qb.where( eq( person.mother(), annDoe ) ) );
@@ -508,7 +513,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script35()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where( containsName( person.accounts(), "anns" ) ) );
         System.out.println( "*** script35: " + query );
@@ -519,7 +524,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script36()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Account anns = unitOfWork.get( Account.class, "accountOfAnnDoe" );
         Query<Person> query = unitOfWork.newQuery( qb.where( contains( person.accounts(), anns ) ) );
@@ -532,7 +537,7 @@ public abstract class AbstractQueryTest
     @Ignore( "Traversing of NamedAssociations is not implemented" )
     public void script37()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where( eq( person.accounts().get( "anns" ).number(),
                                                                  "accountOfAnnDoe" ) ) );
@@ -544,7 +549,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script38()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where( eq( person.title(), Person.Title.DR ) ) );
         System.out.println( "*** script38: " + query );
@@ -555,7 +560,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script39()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where( ne( person.title(), Person.Title.DR ) ) );
         System.out.println( "*** script39: " + query );
@@ -566,7 +571,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script40_Date()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where(
             eq( person.dateValue(), new DateTime( "2010-03-04T13:24:35", UTC ).toDate() ) ) );
@@ -578,7 +583,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script41_Date()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where(
             ne( person.dateValue(), new DateTime( "2010-03-04T13:24:35", UTC ).toDate() ) ) );
@@ -590,7 +595,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script42_Date()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where(
             ne( person.dateValue(), new DateTime( "2010-03-04T14:24:35", forID( "CET" ) ).toDate() ) ) );
@@ -602,7 +607,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script43_Date()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where(
             and( gt( person.dateValue(), new DateTime( "2005-03-04T13:24:35", UTC ).toDate() ),
@@ -615,7 +620,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script40_DateTime()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where(
             eq( person.dateTimeValue(), new DateTime( "2010-03-04T13:24:35", UTC ) ) ) );
@@ -627,7 +632,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script41_DateTime()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where(
             ne( person.dateTimeValue(), new DateTime( "2010-03-04T13:24:35", UTC ) ) ) );
@@ -639,7 +644,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script42_DateTime()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where(
             ne( person.dateTimeValue(), new DateTime( "2010-03-04T14:24:35", forID( "CET" ) ) ) ) );
@@ -651,7 +656,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script43_DateTime()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where(
             and( gt( person.dateTimeValue(), new DateTime( "2005-03-04T13:24:35", UTC ) ),
@@ -664,7 +669,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script40_LocalDateTime()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where(
             eq( person.localDateTimeValue(), new LocalDateTime( "2010-03-04T13:23:00", UTC ) ) ) );
@@ -676,7 +681,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script41_LocalDateTime()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where(
             ne( person.localDateTimeValue(), new LocalDateTime( "2010-03-04T13:23:00", UTC ) ) ) );
@@ -688,7 +693,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script42_LocalDateTime()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where(
             ne( person.localDateTimeValue(), new LocalDateTime( "2010-03-04T13:23:00", forID( "CET" ) ) ) ) );
@@ -700,7 +705,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script43_LocalDateTime()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where(
             and( gt( person.localDateTimeValue(), new LocalDateTime( "2005-03-04T13:24:35", UTC ) ),
@@ -713,7 +718,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script40_LocalDate()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where(
             eq( person.localDateValue(), new LocalDate( "2010-03-04", UTC ) ) ) );
@@ -725,7 +730,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script41_LocalDate()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where(
             ne( person.localDateValue(), new LocalDate( "2010-03-04", UTC ) ) ) );
@@ -737,7 +742,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script42_LocalDate()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where(
             ne( person.localDateValue(), new LocalDate( "2010-03-04", forID( "CET" ) ) ) ) );
@@ -749,7 +754,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script43_LocalDate()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where(
             and( gt( person.localDateValue(), new LocalDate( "2005-03-04", UTC ) ),
@@ -762,7 +767,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script50_BigInteger()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where(
             eq( person.bigInteger(), new BigInteger( "23232323232323232323232323" ) ) ) );
@@ -774,7 +779,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script51_BigInteger()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where(
             ne( person.bigInteger(), new BigInteger( "23232323232323232323232323" ) ) ) );
@@ -786,7 +791,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script52_BigInteger()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where(
             ge( person.bigInteger(), new BigInteger( "23232323232323232323232323" ) ) ) );
@@ -798,7 +803,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script50_BigDecimal()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where(
             eq( person.bigDecimal(), new BigDecimal( "2342.76931348623157e+307" ) ) ) );
@@ -810,7 +815,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script51_BigDecimal()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where(
             ne( person.bigDecimal(), new BigDecimal( "2342.76931348623157e+307" ) ) ) );
@@ -822,7 +827,7 @@ public abstract class AbstractQueryTest
     @Test
     public void script52_BigDecimal()
     {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder( Person.class );
+        QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
         Person person = templateFor( Person.class );
         Query<Person> query = unitOfWork.newQuery( qb.where(
             ge( person.bigDecimal(), new BigDecimal( "2342.76931348623157e+307" ) ) ) );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/core/testsupport/src/main/java/org/apache/zest/test/value/AbstractCollectionSerializationTest.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/zest/test/value/AbstractCollectionSerializationTest.java b/core/testsupport/src/main/java/org/apache/zest/test/value/AbstractCollectionSerializationTest.java
index ac0e1c9..e0a4778 100644
--- a/core/testsupport/src/main/java/org/apache/zest/test/value/AbstractCollectionSerializationTest.java
+++ b/core/testsupport/src/main/java/org/apache/zest/test/value/AbstractCollectionSerializationTest.java
@@ -26,8 +26,6 @@ import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import org.junit.Before;
-import org.junit.Test;
 import org.apache.zest.api.common.Optional;
 import org.apache.zest.api.injection.scope.Service;
 import org.apache.zest.api.property.Property;
@@ -41,13 +39,15 @@ import org.apache.zest.bootstrap.AssemblyException;
 import org.apache.zest.bootstrap.ModuleAssembly;
 import org.apache.zest.functional.Iterables;
 import org.apache.zest.test.AbstractZestTest;
+import org.junit.Test;
 
-import static org.junit.Assert.*;
 import static org.apache.zest.io.Inputs.iterable;
 import static org.apache.zest.io.Inputs.text;
 import static org.apache.zest.io.Outputs.collection;
 import static org.apache.zest.io.Outputs.text;
 import static org.apache.zest.io.Transforms.map;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
 
 /**
  * Assert that ValueSerialization behaviour on Collections and Maps is correct.
@@ -64,12 +64,6 @@ public class AbstractCollectionSerializationTest
         module.values( SomeValue.class );
     }
 
-    @Before
-    public void before()
-    {
-        module.injectTo( this );
-    }
-
     @Service
     @SuppressWarnings( "ProtectedField" )
     protected ValueSerialization valueSerialization;
@@ -82,8 +76,8 @@ public class AbstractCollectionSerializationTest
         iterable( byteCollection() ).transferTo( map( valueSerialization.serialize(), text( sb ) ) );
         String output = sb.toString();
 
-        List<Byte> list = new ArrayList<Byte>();
-        text( output ).transferTo( map( valueSerialization.deserialize( Byte.class ), collection( list ) ) );
+        List<Byte> list = new ArrayList<>();
+        text( output ).transferTo( map( valueSerialization.deserialize( module, Byte.class ), collection( list ) ) );
         assertEquals( byteCollection(), list );
     }
 
@@ -96,7 +90,7 @@ public class AbstractCollectionSerializationTest
             23, 42, -23, -42
         };
         String output = valueSerialization.serialize( primitiveArray );
-        int[] deserialized = valueSerialization.deserialize( int[].class, output );
+        int[] deserialized = valueSerialization.deserialize( module, int[].class, output );
         assertArrayEquals( primitiveArray, deserialized );
     }
 
@@ -109,7 +103,7 @@ public class AbstractCollectionSerializationTest
             9, null, -12, -12, 127, -128, 73
         };
         String output = valueSerialization.serialize( array );
-        Byte[] deserialized = valueSerialization.deserialize( Byte[].class, output );
+        Byte[] deserialized = valueSerialization.deserialize( module, Byte[].class, output );
         assertArrayEquals( array, deserialized );
     }
 
@@ -119,7 +113,7 @@ public class AbstractCollectionSerializationTest
     {
         String output = valueSerialization.serialize( Iterables.iterable( byteCollection().toArray() ) );
         CollectionType collectionType = new CollectionType( List.class, new ValueType( Byte.class ) );
-        List<Byte> list = valueSerialization.deserialize( collectionType, output );
+        List<Byte> list = valueSerialization.deserialize( module, collectionType, output );
         assertEquals( byteCollection(), list );
     }
 
@@ -129,8 +123,8 @@ public class AbstractCollectionSerializationTest
     {
         String output = valueSerialization.serialize( byteCollection() );
         CollectionType collectionType = new CollectionType( Set.class, new ValueType( Byte.class ) );
-        Set<Byte> list = valueSerialization.deserialize( collectionType, output );
-        assertEquals( new LinkedHashSet<Byte>( byteCollection() ), list );
+        Set<Byte> list = valueSerialization.deserialize( module, collectionType, output );
+        assertEquals( new LinkedHashSet<>( byteCollection() ), list );
     }
 
     @Test
@@ -139,7 +133,7 @@ public class AbstractCollectionSerializationTest
     {
         String output = valueSerialization.serialize( characterCollection() );
         CollectionType collectionType = new CollectionType( List.class, new ValueType( Character.class ) );
-        List<Character> list = valueSerialization.deserialize( collectionType, output );
+        List<Character> list = valueSerialization.deserialize( module, collectionType, output );
         assertEquals( characterCollection(), list );
     }
 
@@ -149,7 +143,7 @@ public class AbstractCollectionSerializationTest
     {
         String output = valueSerialization.serialize( shortCollection() );
         CollectionType collectionType = new CollectionType( List.class, new ValueType( Short.class ) );
-        List<Short> list = valueSerialization.deserialize( collectionType, output );
+        List<Short> list = valueSerialization.deserialize( module, collectionType, output );
         assertEquals( shortCollection(), list );
     }
 
@@ -159,7 +153,7 @@ public class AbstractCollectionSerializationTest
     {
         String output = valueSerialization.serialize( integerCollection() );
         CollectionType collectionType = new CollectionType( List.class, new ValueType( Integer.class ) );
-        List<Integer> list = valueSerialization.deserialize( collectionType, output );
+        List<Integer> list = valueSerialization.deserialize( module, collectionType, output );
         assertEquals( integerCollection(), list );
     }
 
@@ -169,7 +163,7 @@ public class AbstractCollectionSerializationTest
     {
         String output = valueSerialization.serialize( longCollection() );
         CollectionType collectionType = new CollectionType( List.class, new ValueType( Long.class ) );
-        List<Long> list = valueSerialization.deserialize( collectionType, output );
+        List<Long> list = valueSerialization.deserialize( module, collectionType, output );
         assertEquals( longCollection(), list );
     }
 
@@ -179,7 +173,7 @@ public class AbstractCollectionSerializationTest
     {
         String output = valueSerialization.serialize( floatCollection() );
         CollectionType collectionType = new CollectionType( List.class, new ValueType( Float.class ) );
-        List<Float> list = valueSerialization.deserialize( collectionType, output );
+        List<Float> list = valueSerialization.deserialize( module, collectionType, output );
         assertEquals( floatCollection(), list );
     }
 
@@ -189,7 +183,7 @@ public class AbstractCollectionSerializationTest
     {
         String output = valueSerialization.serialize( doubleCollection() );
         CollectionType collectionType = new CollectionType( List.class, new ValueType( Double.class ) );
-        List<Double> list = valueSerialization.deserialize( collectionType, output );
+        List<Double> list = valueSerialization.deserialize( module, collectionType, output );
         assertEquals( doubleCollection(), list );
 
     }
@@ -200,7 +194,7 @@ public class AbstractCollectionSerializationTest
     {
         String output = valueSerialization.serialize( bigIntegerCollection() );
         CollectionType collectionType = new CollectionType( List.class, new ValueType( BigInteger.class ) );
-        List<BigInteger> list = valueSerialization.deserialize( collectionType, output );
+        List<BigInteger> list = valueSerialization.deserialize( module, collectionType, output );
         assertEquals( bigIntegerCollection(), list );
     }
 
@@ -210,7 +204,7 @@ public class AbstractCollectionSerializationTest
     {
         String output = valueSerialization.serialize( bigDecimalCollection() );
         CollectionType collectionType = new CollectionType( Collection.class, new ValueType( BigDecimal.class ) );
-        Collection<BigDecimal> collection = valueSerialization.deserialize( collectionType, output );
+        Collection<BigDecimal> collection = valueSerialization.deserialize( module, collectionType, output );
         assertEquals( bigDecimalCollection(), collection );
     }
 
@@ -220,7 +214,7 @@ public class AbstractCollectionSerializationTest
     {
         String output = valueSerialization.serialize( stringByteMap() );
         MapType mapType = new MapType( Map.class, new ValueType( String.class ), new ValueType( Byte.class ) );
-        Map<String, Byte> value = valueSerialization.deserialize( mapType, output );
+        Map<String, Byte> value = valueSerialization.deserialize( module, mapType, output );
         assertEquals( stringByteMap(), value );
     }
 
@@ -231,7 +225,7 @@ public class AbstractCollectionSerializationTest
         String output = valueSerialization.serialize( stringMultiMap() );
         CollectionType collectionType = new CollectionType( List.class, new ValueType( String.class ) );
         MapType mapType = new MapType( Map.class, new ValueType( String.class ), collectionType );
-        Map<String, List<String>> value = valueSerialization.deserialize( mapType, output );
+        Map<String, List<String>> value = valueSerialization.deserialize( module, mapType, output );
         assertEquals( stringMultiMap(), value );
     }
 
@@ -242,7 +236,7 @@ public class AbstractCollectionSerializationTest
         String output = valueSerialization.serialize( stringListOfMaps() );
         ValueType stringType = new ValueType( String.class );
         CollectionType collectionType = new CollectionType( List.class, new MapType( Map.class, stringType, stringType ) );
-        List<Map<String, String>> value = valueSerialization.deserialize( collectionType, output );
+        List<Map<String, String>> value = valueSerialization.deserialize( module, collectionType, output );
         assertEquals( stringListOfMaps(), value );
     }
 
@@ -253,13 +247,13 @@ public class AbstractCollectionSerializationTest
         String output = valueSerialization.serialize( valueCompositesList() );
         ValueCompositeType valueType = module.valueDescriptor( SomeValue.class.getName() ).valueType();
         CollectionType collectionType = new CollectionType( List.class, valueType );
-        List<SomeValue> value = valueSerialization.deserialize( collectionType, output );
+        List<SomeValue> value = valueSerialization.deserialize( module, collectionType, output );
         assertEquals( valueCompositesList(), value );
     }
 
     private ArrayList<Byte> byteCollection()
     {
-        ArrayList<Byte> value = new ArrayList<Byte>();
+        ArrayList<Byte> value = new ArrayList<>();
         value.add( (byte) 9 );
         value.add( null );
         value.add( (byte) -12 );
@@ -272,7 +266,7 @@ public class AbstractCollectionSerializationTest
 
     private List<Character> characterCollection()
     {
-        List<Character> value = new ArrayList<Character>();
+        List<Character> value = new ArrayList<>();
         value.add( 'Q' );
         value.add( 'i' );
         value.add( null );
@@ -283,7 +277,7 @@ public class AbstractCollectionSerializationTest
 
     private Collection<Short> shortCollection()
     {
-        Collection<Short> value = new ArrayList<Short>();
+        Collection<Short> value = new ArrayList<>();
         value.add( (short) -32768 );
         value.add( (short) 32767 );
         value.add( (short) -82 );
@@ -293,7 +287,7 @@ public class AbstractCollectionSerializationTest
 
     private Collection<Integer> integerCollection()
     {
-        Collection<Integer> value = new ArrayList<Integer>();
+        Collection<Integer> value = new ArrayList<>();
         value.add( Integer.MAX_VALUE );
         value.add( -283 );
         value.add( null );
@@ -304,7 +298,7 @@ public class AbstractCollectionSerializationTest
 
     private Collection<Long> longCollection()
     {
-        Collection<Long> value = new ArrayList<Long>();
+        Collection<Long> value = new ArrayList<>();
         value.add( 98239723L );
         value.add( -1298233L );
         value.add( -1L );
@@ -318,7 +312,7 @@ public class AbstractCollectionSerializationTest
 
     private Collection<Float> floatCollection()
     {
-        Collection<Float> value = new ArrayList<Float>();
+        Collection<Float> value = new ArrayList<>();
         value.add( -1f );
         value.add( 1f );
         value.add( 1f );
@@ -333,7 +327,7 @@ public class AbstractCollectionSerializationTest
 
     private Collection<Double> doubleCollection()
     {
-        Collection<Double> value = new ArrayList<Double>();
+        Collection<Double> value = new ArrayList<>();
         value.add( -1.0 );
         value.add( 1.0 );
         value.add( 0.0 );
@@ -347,7 +341,7 @@ public class AbstractCollectionSerializationTest
 
     private Collection<BigInteger> bigIntegerCollection()
     {
-        Collection<BigInteger> value = new ArrayList<BigInteger>();
+        Collection<BigInteger> value = new ArrayList<>();
         value.add( new BigInteger( "-1" ) );
         value.add( BigInteger.ZERO );
         value.add( BigInteger.ONE );
@@ -360,7 +354,7 @@ public class AbstractCollectionSerializationTest
 
     private Collection<BigDecimal> bigDecimalCollection()
     {
-        Collection<BigDecimal> value = new ArrayList<BigDecimal>();
+        Collection<BigDecimal> value = new ArrayList<>();
         value.add( new BigDecimal( "1.2" ) );
         value.add( new BigDecimal( "3.4" ) );
         value.add( null );
@@ -370,7 +364,7 @@ public class AbstractCollectionSerializationTest
 
     private Map<String, Byte> stringByteMap()
     {
-        Map<String, Byte> value = new LinkedHashMap<String, Byte>();
+        Map<String, Byte> value = new LinkedHashMap<>();
         value.put( "a", (byte) 9 );
         value.put( "b", null );
         value.put( "c", (byte) -12 );
@@ -379,8 +373,8 @@ public class AbstractCollectionSerializationTest
 
     private Map<String, List<String>> stringMultiMap()
     {
-        Map<String, List<String>> value = new LinkedHashMap<String, List<String>>();
-        List<String> list = new ArrayList<String>();
+        Map<String, List<String>> value = new LinkedHashMap<>();
+        List<String> list = new ArrayList<>();
         list.add( "foo" );
         list.add( "bar" );
         list.add( null );
@@ -394,8 +388,8 @@ public class AbstractCollectionSerializationTest
 
     private List<Map<String, String>> stringListOfMaps()
     {
-        List<Map<String, String>> value = new ArrayList<Map<String, String>>();
-        Map<String, String> map = new LinkedHashMap<String, String>();
+        List<Map<String, String>> value = new ArrayList<>();
+        Map<String, String> map = new LinkedHashMap<>();
         map.put( "foo", "bar" );
         map.put( "cathedral", "bazar" );
         map.put( "yield", null );
@@ -408,14 +402,14 @@ public class AbstractCollectionSerializationTest
 
     private List<SomeValue> valueCompositesList()
     {
-        List<SomeValue> list = new ArrayList<SomeValue>();
+        List<SomeValue> list = new ArrayList<>();
         list.add( newSomeValue( "", "bazar" ) );
         list.add( null );
         list.add( newSomeValue( "bar", null ) );
         return list;
     }
 
-    public static interface SomeValue
+    public interface SomeValue
     {
 
         Property<String> foo();
@@ -426,7 +420,7 @@ public class AbstractCollectionSerializationTest
 
     private SomeValue newSomeValue( String foo, String cathedral )
     {
-        ValueBuilder<SomeValue> builder = module.newValueBuilder( SomeValue.class );
+        ValueBuilder<SomeValue> builder = module.instance().newValueBuilder( SomeValue.class );
         SomeValue value = builder.prototype();
         value.foo().set( foo );
         if( cathedral != null )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/core/testsupport/src/main/java/org/apache/zest/test/value/AbstractJsonDateFormatTest.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/zest/test/value/AbstractJsonDateFormatTest.java b/core/testsupport/src/main/java/org/apache/zest/test/value/AbstractJsonDateFormatTest.java
index 9a65bd3..a345eb8 100644
--- a/core/testsupport/src/main/java/org/apache/zest/test/value/AbstractJsonDateFormatTest.java
+++ b/core/testsupport/src/main/java/org/apache/zest/test/value/AbstractJsonDateFormatTest.java
@@ -49,12 +49,6 @@ public class AbstractJsonDateFormatTest
     {
     }
 
-    @Before
-    public void before()
-    {
-        module.injectTo( this );
-    }
-
     @Service
     protected ValueDeserializer valueDeserializer;
 
@@ -63,7 +57,7 @@ public class AbstractJsonDateFormatTest
         throws Exception
     {
         CollectionType collectionType = new CollectionType( List.class, dateType );
-        List<Date> value = valueDeserializer.deserialize( collectionType, "[\"2009-08-12T14:54:27.895+0800\"]" );
+        List<Date> value = valueDeserializer.deserialize( module, collectionType, "[\"2009-08-12T14:54:27.895+0800\"]" );
         assertEquals( new DateTime( "2009-08-12T06:54:27.895Z", DateTimeZone.UTC ).toDate(), value.get( 0 ) );
     }
 
@@ -73,7 +67,7 @@ public class AbstractJsonDateFormatTest
     {
         long tstamp = System.currentTimeMillis();
         CollectionType collectionType = new CollectionType( List.class, dateType );
-        List<Date> value = valueDeserializer.deserialize( collectionType, "[\"@" + tstamp + "@\"]" );
+        List<Date> value = valueDeserializer.deserialize( module, collectionType, "[\"@" + tstamp + "@\"]" );
         assertEquals( new Date( tstamp ), value.get( 0 ) );
     }
 
@@ -83,7 +77,7 @@ public class AbstractJsonDateFormatTest
     {
         long tstamp = System.currentTimeMillis();
         CollectionType collectionType = new CollectionType( List.class, dateType );
-        List<Date> value = valueDeserializer.deserialize( collectionType, "[\"/Date(" + tstamp + ")/\"]" );
+        List<Date> value = valueDeserializer.deserialize( module, collectionType, "[\"/Date(" + tstamp + ")/\"]" );
         assertEquals( new Date( tstamp ), value.get( 0 ) );
     }
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/core/testsupport/src/main/java/org/apache/zest/test/value/AbstractPlainValueSerializationTest.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/zest/test/value/AbstractPlainValueSerializationTest.java b/core/testsupport/src/main/java/org/apache/zest/test/value/AbstractPlainValueSerializationTest.java
index a30ae27..129dcad 100644
--- a/core/testsupport/src/main/java/org/apache/zest/test/value/AbstractPlainValueSerializationTest.java
+++ b/core/testsupport/src/main/java/org/apache/zest/test/value/AbstractPlainValueSerializationTest.java
@@ -19,15 +19,14 @@ package org.apache.zest.test.value;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.Date;
-import org.joda.time.DateTime;
-import org.joda.time.LocalDate;
-import org.joda.time.LocalDateTime;
-import org.junit.Before;
-import org.junit.Test;
 import org.apache.zest.api.entity.EntityReference;
 import org.apache.zest.api.injection.scope.Service;
 import org.apache.zest.api.value.ValueSerialization;
 import org.apache.zest.test.AbstractZestTest;
+import org.joda.time.DateTime;
+import org.joda.time.LocalDate;
+import org.joda.time.LocalDateTime;
+import org.junit.Test;
 
 import static org.hamcrest.core.IsEqual.equalTo;
 import static org.hamcrest.core.IsNot.not;
@@ -43,11 +42,6 @@ public abstract class AbstractPlainValueSerializationTest
     extends AbstractZestTest
 {
 
-    @Before
-    public void before()
-    {
-        module.injectTo( this );
-    }
     @Service
     @SuppressWarnings( "ProtectedField" )
     protected ValueSerialization valueSerialization;
@@ -58,7 +52,7 @@ public abstract class AbstractPlainValueSerializationTest
         String serialized = valueSerialization.serialize( 'q' );
         assertThat( "Serialized", serialized, equalTo( "q" ) );
 
-        Character deserialized = valueSerialization.deserialize( Character.class, serialized );
+        Character deserialized = valueSerialization.deserialize( module, Character.class, serialized );
         assertThat( "Deserialized", deserialized, equalTo( 'q' ) );
     }
 
@@ -68,7 +62,7 @@ public abstract class AbstractPlainValueSerializationTest
         String serialized = valueSerialization.serialize( "" );
         assertThat( "Serialized", serialized, equalTo( "" ) );
 
-        String deserialized = valueSerialization.deserialize( String.class, serialized );
+        String deserialized = valueSerialization.deserialize( module, String.class, serialized );
         assertThat( "Deserialized", deserialized, equalTo( "" ) );
     }
 
@@ -78,7 +72,7 @@ public abstract class AbstractPlainValueSerializationTest
         String serialized = valueSerialization.serialize( "test" );
         assertThat( serialized, equalTo( "test" ) );
 
-        String deserialized = valueSerialization.deserialize( String.class, serialized );
+        String deserialized = valueSerialization.deserialize( module, String.class, serialized );
         assertThat( deserialized, equalTo( "test" ) );
     }
 
@@ -88,7 +82,7 @@ public abstract class AbstractPlainValueSerializationTest
         String serialized = valueSerialization.serialize( Boolean.TRUE );
         assertThat( serialized, equalTo( "true" ) );
 
-        Boolean deserialized = valueSerialization.deserialize( Boolean.class, serialized );
+        Boolean deserialized = valueSerialization.deserialize( module, Boolean.class, serialized );
         assertThat( deserialized, equalTo( Boolean.TRUE ) );
     }
 
@@ -97,7 +91,7 @@ public abstract class AbstractPlainValueSerializationTest
     {
         String serialized = valueSerialization.serialize( 42 );
         assertThat( serialized, equalTo( "42" ) );
-        Integer deserialized = valueSerialization.deserialize( Integer.class, serialized );
+        Integer deserialized = valueSerialization.deserialize( module, Integer.class, serialized );
         assertThat( deserialized, equalTo( 42 ) );
     }
 
@@ -107,7 +101,7 @@ public abstract class AbstractPlainValueSerializationTest
         String serialized = valueSerialization.serialize( 42L );
         assertThat( serialized, equalTo( "42" ) );
 
-        Long deserialized = valueSerialization.deserialize( Long.class, serialized );
+        Long deserialized = valueSerialization.deserialize( module, Long.class, serialized );
         assertThat( deserialized, equalTo( 42L ) );
     }
 
@@ -117,7 +111,7 @@ public abstract class AbstractPlainValueSerializationTest
         String serialized = valueSerialization.serialize( (short) 42 );
         assertThat( serialized, equalTo( "42" ) );
 
-        Short deserialized = valueSerialization.deserialize( Short.class, serialized );
+        Short deserialized = valueSerialization.deserialize( module, Short.class, serialized );
         assertThat( deserialized, equalTo( (short) 42 ) );
     }
 
@@ -126,7 +120,7 @@ public abstract class AbstractPlainValueSerializationTest
     {
         String serialized = valueSerialization.serialize( (byte) 42 );
         assertThat( serialized, equalTo( "42" ) );
-        Byte deserialized = valueSerialization.deserialize( Byte.class, serialized );
+        Byte deserialized = valueSerialization.deserialize( module, Byte.class, serialized );
         assertThat( deserialized, equalTo( (byte) 42 ) );
     }
 
@@ -136,7 +130,7 @@ public abstract class AbstractPlainValueSerializationTest
         String serialized = valueSerialization.serialize( 42F );
         assertThat( serialized, equalTo( "42.0" ) );
 
-        Float deserialized = valueSerialization.deserialize( Float.class, serialized );
+        Float deserialized = valueSerialization.deserialize( module, Float.class, serialized );
         assertThat( deserialized, equalTo( 42F ) );
     }
 
@@ -146,7 +140,7 @@ public abstract class AbstractPlainValueSerializationTest
         String serialized = valueSerialization.serialize( 42D );
         assertThat( serialized, equalTo( "42.0" ) );
 
-        Double deserialized = valueSerialization.deserialize( Double.class, serialized );
+        Double deserialized = valueSerialization.deserialize( module, Double.class, serialized );
         assertThat( deserialized, equalTo( 42D ) );
     }
 
@@ -159,7 +153,7 @@ public abstract class AbstractPlainValueSerializationTest
         String serialized = valueSerialization.serialize( bigInteger );
         assertThat( serialized, equalTo( "42424242424242424242424242" ) );
 
-        BigInteger deserialized = valueSerialization.deserialize( BigInteger.class, serialized );
+        BigInteger deserialized = valueSerialization.deserialize( module, BigInteger.class, serialized );
         assertThat( deserialized, equalTo( bigInteger ) );
     }
 
@@ -172,7 +166,7 @@ public abstract class AbstractPlainValueSerializationTest
         String serialized = valueSerialization.serialize( bigDecimal );
         assertThat( serialized, equalTo( "4.22376931348623157E+310" ) );
 
-        BigDecimal deserialized = valueSerialization.deserialize( BigDecimal.class, serialized );
+        BigDecimal deserialized = valueSerialization.deserialize( module, BigDecimal.class, serialized );
         assertThat( deserialized, equalTo( bigDecimal ) );
     }
 
@@ -182,7 +176,7 @@ public abstract class AbstractPlainValueSerializationTest
         String serialized = valueSerialization.serialize( new DateTime( "2020-03-04T13:24:35", forID( "CET" ) ).toDate() );
         assertThat( serialized, equalTo( "2020-03-04T12:24:35.000Z" ) );
 
-        Date deserialized = valueSerialization.deserialize( Date.class, serialized );
+        Date deserialized = valueSerialization.deserialize( module, Date.class, serialized );
         assertThat( deserialized, equalTo( new DateTime( "2020-03-04T13:24:35", forID( "CET" ) ).toDate() ) );
         assertThat( deserialized, equalTo( new DateTime( "2020-03-04T12:24:35", UTC ).toDate() ) );
     }
@@ -194,7 +188,7 @@ public abstract class AbstractPlainValueSerializationTest
         // See https://github.com/JodaOrg/joda-time/issues/106
         String serialized = valueSerialization.serialize( new DateTime( "2020-03-04T13:24:35", forOffsetHours( 1 ) ) );
         assertThat( serialized, equalTo( "2020-03-04T13:24:35.000+01:00" ) );
-        DateTime deserialized = valueSerialization.deserialize( DateTime.class, serialized );
+        DateTime deserialized = valueSerialization.deserialize( module, DateTime.class, serialized );
         assertThat( deserialized, equalTo( new DateTime( "2020-03-04T13:24:35", forOffsetHours( 1 ) ) ) );
     }
 
@@ -205,7 +199,7 @@ public abstract class AbstractPlainValueSerializationTest
         String serialized = valueSerialization.serialize( new LocalDateTime( "2020-03-04T13:23:00", forID( "CET" ) ) );
         assertThat( serialized, equalTo( "2020-03-04T13:23:00.000" ) );
 
-        LocalDateTime deserialized = valueSerialization.deserialize( LocalDateTime.class, serialized );
+        LocalDateTime deserialized = valueSerialization.deserialize( module, LocalDateTime.class, serialized );
         assertThat( deserialized, equalTo( new LocalDateTime( "2020-03-04T13:23:00", UTC ) ) );
     }
 
@@ -215,7 +209,7 @@ public abstract class AbstractPlainValueSerializationTest
         String serialized = valueSerialization.serialize( new LocalDate( "2020-03-04" ) );
         assertThat( serialized, equalTo( "2020-03-04" ) );
 
-        LocalDate deserialized = valueSerialization.deserialize( LocalDate.class, serialized );
+        LocalDate deserialized = valueSerialization.deserialize( module, LocalDate.class, serialized );
         assertThat( deserialized, equalTo( new LocalDate( "2020-03-04" ) ) );
     }
 
@@ -225,7 +219,7 @@ public abstract class AbstractPlainValueSerializationTest
         String serialized = valueSerialization.serialize( EntityReference.parseEntityReference( "ABCD-1234" ) );
         assertThat( serialized, equalTo( "ABCD-1234" ) );
 
-        EntityReference deserialized = valueSerialization.deserialize( EntityReference.class, serialized );
+        EntityReference deserialized = valueSerialization.deserialize( module, EntityReference.class, serialized );
         assertThat( deserialized, equalTo( EntityReference.parseEntityReference( "ABCD-1234" ) ) );
     }
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/core/testsupport/src/main/java/org/apache/zest/test/value/AbstractValueCompositeSerializationTest.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/zest/test/value/AbstractValueCompositeSerializationTest.java b/core/testsupport/src/main/java/org/apache/zest/test/value/AbstractValueCompositeSerializationTest.java
index 7ff7406..179806d 100644
--- a/core/testsupport/src/main/java/org/apache/zest/test/value/AbstractValueCompositeSerializationTest.java
+++ b/core/testsupport/src/main/java/org/apache/zest/test/value/AbstractValueCompositeSerializationTest.java
@@ -23,11 +23,12 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import org.apache.zest.api.injection.scope.Structure;
+import org.apache.zest.api.structure.Module;
 import org.joda.time.DateTime;
 import org.joda.time.DateTimeZone;
 import org.joda.time.LocalDate;
 import org.joda.time.LocalDateTime;
-import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TestName;
@@ -68,6 +69,9 @@ public abstract class AbstractValueCompositeSerializationTest
     @Rule
     public TestName testName = new TestName();
 
+    @Structure
+    Module moduleInstance;
+
     @Override
     public void assemble( ModuleAssembly module )
         throws AssemblyException
@@ -79,12 +83,6 @@ public abstract class AbstractValueCompositeSerializationTest
         module.entities( BarEntity.class );
     }
 
-    @Before
-    public void before()
-    {
-        module.injectTo( this );
-    }
-
     @Service
     protected ValueSerialization valueSerialization;
 
@@ -103,7 +101,7 @@ public abstract class AbstractValueCompositeSerializationTest
             String stateString = output.toString( "UTF-8" );
 
             // Deserialize using Module API
-            SomeValue some2 = module.newValueFromSerializedState( SomeValue.class, stateString );
+            SomeValue some2 = moduleInstance.newValueFromSerializedState( SomeValue.class, stateString );
 
             assertThat( "Same value toString", some.toString(), equalTo( some2.toString() ) );
             assertThat( "Same value", some, equalTo( some2 ) );
@@ -130,11 +128,11 @@ public abstract class AbstractValueCompositeSerializationTest
      */
     private SomeValue buildSomeValue()
     {
-        ValueBuilder<SomeValue> builder = module.newValueBuilder( SomeValue.class );
+        ValueBuilder<SomeValue> builder = moduleInstance.newValueBuilder( SomeValue.class );
         SomeValue proto = builder.prototype();
-        proto.anotherList().get().add( module.newValue( AnotherValue.class ) );
+        proto.anotherList().get().add( moduleInstance.newValue( AnotherValue.class ) );
 
-        ValueBuilder<SpecificCollection> specificColBuilder = module.newValueBuilder( SpecificCollection.class );
+        ValueBuilder<SpecificCollection> specificColBuilder = moduleInstance.newValueBuilder( SpecificCollection.class );
         SpecificCollection specificColProto = specificColBuilder.prototype();
         List<String> genericList = new ArrayList<>( 2 );
         genericList.add( "Some" );
@@ -173,10 +171,10 @@ public abstract class AbstractValueCompositeSerializationTest
         proto.another().set( anotherValue1 );
         // proto.arrayOfValues().set( new AnotherValue[] { anotherValue1, anotherValue2, anotherValue3 } );
         proto.serializable().set( new SerializableObject() );
-        proto.foo().set( module.newValue( FooValue.class ) );
-        proto.fooValue().set( module.newValue( FooValue.class ) );
-        proto.customFoo().set( module.newValue( CustomFooValue.class ) );
-        proto.customFooValue().set( module.newValue( CustomFooValue.class ) );
+        proto.foo().set( moduleInstance.newValue( FooValue.class ) );
+        proto.fooValue().set( moduleInstance.newValue( FooValue.class ) );
+        proto.customFoo().set( moduleInstance.newValue( CustomFooValue.class ) );
+        proto.customFooValue().set( moduleInstance.newValue( CustomFooValue.class ) );
 
         // Arrays
         // TODO FIXME Disabled as ValueComposite equality fails here
@@ -206,7 +204,7 @@ public abstract class AbstractValueCompositeSerializationTest
 
     private AnotherValue createAnotherValue( String val1, String val2 )
     {
-        ValueBuilder<AnotherValue> valueBuilder = module.newValueBuilder( AnotherValue.class );
+        ValueBuilder<AnotherValue> valueBuilder = moduleInstance.newValueBuilder( AnotherValue.class );
         valueBuilder.prototype().val1().set( val1 );
         valueBuilder.prototypeFor( AnotherValueInternalState.class ).val2().set( val2 );
         return valueBuilder.newInstance();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/extensions/entitystore-jdbm/src/test/java/org/apache/zest/entitystore/jdbm/JdbmEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jdbm/src/test/java/org/apache/zest/entitystore/jdbm/JdbmEntityStoreTest.java b/extensions/entitystore-jdbm/src/test/java/org/apache/zest/entitystore/jdbm/JdbmEntityStoreTest.java
index f41579d..8660948 100644
--- a/extensions/entitystore-jdbm/src/test/java/org/apache/zest/entitystore/jdbm/JdbmEntityStoreTest.java
+++ b/extensions/entitystore-jdbm/src/test/java/org/apache/zest/entitystore/jdbm/JdbmEntityStoreTest.java
@@ -35,7 +35,7 @@ public class JdbmEntityStoreTest
     @Before
     public void testDataCleanup()
     {
-        FileConfiguration fileConfig = module.findService( FileConfiguration.class ).get();
+        FileConfiguration fileConfig = serviceFinder.findService( FileConfiguration.class ).get();
         FileConfigurationDataWiper.registerApplicationPassivationDataWiper( fileConfig, application );
     }
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/extensions/entitystore-jdbm/src/test/java/org/apache/zest/entitystore/jdbm/JdbmEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jdbm/src/test/java/org/apache/zest/entitystore/jdbm/JdbmEntityStoreWithCacheTest.java b/extensions/entitystore-jdbm/src/test/java/org/apache/zest/entitystore/jdbm/JdbmEntityStoreWithCacheTest.java
index c27c835..d1b677b 100644
--- a/extensions/entitystore-jdbm/src/test/java/org/apache/zest/entitystore/jdbm/JdbmEntityStoreWithCacheTest.java
+++ b/extensions/entitystore-jdbm/src/test/java/org/apache/zest/entitystore/jdbm/JdbmEntityStoreWithCacheTest.java
@@ -34,7 +34,7 @@ public class JdbmEntityStoreWithCacheTest
     @Before
     public void testDataCleanup()
     {
-        FileConfiguration fileConfig = module.findService( FileConfiguration.class ).get();
+        FileConfiguration fileConfig = serviceFinder.findService( FileConfiguration.class ).get();
         FileConfigurationDataWiper.registerApplicationPassivationDataWiper( fileConfig, application );
     }
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/extensions/entitystore-mongodb/src/test/java/org/apache/zest/entitystore/mongodb/MongoMapEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/test/java/org/apache/zest/entitystore/mongodb/MongoMapEntityStoreTest.java b/extensions/entitystore-mongodb/src/test/java/org/apache/zest/entitystore/mongodb/MongoMapEntityStoreTest.java
index 4c84fab..d9b7267 100644
--- a/extensions/entitystore-mongodb/src/test/java/org/apache/zest/entitystore/mongodb/MongoMapEntityStoreTest.java
+++ b/extensions/entitystore-mongodb/src/test/java/org/apache/zest/entitystore/mongodb/MongoMapEntityStoreTest.java
@@ -73,7 +73,7 @@ public class MongoMapEntityStoreTest
         throws Exception
     {
         super.setUp();
-        MongoMapEntityStoreService es = module.findService( MongoMapEntityStoreService.class ).get();
+        MongoMapEntityStoreService es = serviceFinder.findService( MongoMapEntityStoreService.class ).get();
         mongo = es.mongoInstanceUsed();
         dbName = es.dbInstanceUsed().getName();
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/extensions/entitystore-mongodb/src/test/java/org/apache/zest/entitystore/mongodb/MongoMapEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/test/java/org/apache/zest/entitystore/mongodb/MongoMapEntityStoreWithCacheTest.java b/extensions/entitystore-mongodb/src/test/java/org/apache/zest/entitystore/mongodb/MongoMapEntityStoreWithCacheTest.java
index cd25cf0..e37db9a 100644
--- a/extensions/entitystore-mongodb/src/test/java/org/apache/zest/entitystore/mongodb/MongoMapEntityStoreWithCacheTest.java
+++ b/extensions/entitystore-mongodb/src/test/java/org/apache/zest/entitystore/mongodb/MongoMapEntityStoreWithCacheTest.java
@@ -67,7 +67,7 @@ public class MongoMapEntityStoreWithCacheTest
         throws Exception
     {
         super.setUp();
-        MongoMapEntityStoreService es = module.findService( MongoMapEntityStoreService.class ).get();
+        MongoMapEntityStoreService es = serviceFinder.findService( MongoMapEntityStoreService.class ).get();
         mongo = es.mongoInstanceUsed();
         dbName = es.dbInstanceUsed().getName();
 


Mime
View raw message