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 2017/07/10 06:53:16 UTC

[14/50] polygene-java git commit: POLYGENE-265 - method argument names are now used in Constraint Violations. POLYGENE-264 - Consolidated how the ConstraintViolationException works. POLYGENE-262 - NoSuchCompositeException and subtypes changed name to NoS

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/559b38a5/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueVisibilityTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueVisibilityTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueVisibilityTest.java
index 500d255..35052b4 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueVisibilityTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueVisibilityTest.java
@@ -32,7 +32,7 @@ import org.apache.polygene.api.structure.Application;
 import org.apache.polygene.api.structure.Module;
 import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
-import org.apache.polygene.api.value.NoSuchValueException;
+import org.apache.polygene.api.value.NoSuchValueTypeException;
 import org.apache.polygene.api.value.ValueBuilder;
 import org.apache.polygene.api.value.ValueComposite;
 import org.apache.polygene.bootstrap.ApplicationAssemblerAdapter;
@@ -131,7 +131,7 @@ public class ValueVisibilityTest
         service.besideLayerVisible();
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromServiceWhenAccessingBesideModuleVisibleExpectException()
     {
         FromService service = module.findService( FromService.class ).get();
@@ -145,35 +145,35 @@ public class ValueVisibilityTest
         service.belowApplicationVisible();
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromServiceWhenAccessingBelowLayerVisibleExpectException()
     {
         FromService service = module.findService( FromService.class ).get();
         service.belowLayerVisible();
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromServiceWhenAccessingBelowModuleVisibleExpectException()
     {
         FromService service = module.findService( FromService.class ).get();
         service.belowModuleVisible();
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromServiceWhenAccessingAboveApplicationVisibleExpectException()
     {
         FromService service = module.findService( FromService.class ).get();
         service.aboveApplicationVisible();
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromServiceWhenAccessingAboveLayerVisibleExpectException()
     {
         FromService service = module.findService( FromService.class ).get();
         service.aboveLayerVisible();
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromServiceWhenAccessingAboveModuleVisibleExpectException()
     {
         FromService service = module.findService( FromService.class ).get();
@@ -270,7 +270,7 @@ public class ValueVisibilityTest
         }
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromEntityWhenAccessingBesideModuleVisibleExpectException()
     {
         UnitOfWork unitOfWork = uowf.newUnitOfWork();
@@ -306,7 +306,7 @@ public class ValueVisibilityTest
         }
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromEntityWhenAccessingBelowLayerVisibleExpectException()
     {
         UnitOfWork unitOfWork = uowf.newUnitOfWork();
@@ -324,7 +324,7 @@ public class ValueVisibilityTest
         }
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromEntityWhenAccessingBelowModuleVisibleExpectException()
     {
         UnitOfWork unitOfWork = uowf.newUnitOfWork();
@@ -342,7 +342,7 @@ public class ValueVisibilityTest
         }
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromEntityWhenAccessingAboveApplicationVisibleExpectException()
     {
         UnitOfWork unitOfWork = uowf.newUnitOfWork();
@@ -360,7 +360,7 @@ public class ValueVisibilityTest
         }
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromEntityWhenAccessingAboveLayerVisibleExpectException()
     {
         UnitOfWork unitOfWork = uowf.newUnitOfWork();
@@ -378,7 +378,7 @@ public class ValueVisibilityTest
         }
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromEntityWhenAccessingAboveModuleVisibleExpectException()
     {
         UnitOfWork unitOfWork = uowf.newUnitOfWork();
@@ -431,7 +431,7 @@ public class ValueVisibilityTest
         value.besideLayerVisible();
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromValueWhenAccessingBesideModuleVisibleExpectException()
     {
         FromValue value = module.newValue( FromValue.class );
@@ -445,35 +445,35 @@ public class ValueVisibilityTest
         value.belowApplicationVisible();
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromValueWhenAccessingBelowLayerVisibleExpectException()
     {
         FromValue value = module.newValue( FromValue.class );
         value.belowLayerVisible();
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromValueWhenAccessingBelowModuleVisibleExpectException()
     {
         FromValue value = module.newValue( FromValue.class );
         value.belowModuleVisible();
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromValueWhenAccessingAboveApplicationVisibleExpectException()
     {
         FromValue value = module.newValue( FromValue.class );
         value.aboveApplicationVisible();
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromValueWhenAccessingAboveLayerVisibleExpectException()
     {
         FromValue value = module.newValue( FromValue.class );
         value.aboveLayerVisible();
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromValueWhenAccessingAboveModuleVisibleExpectException()
     {
         FromValue value = module.newValue( FromValue.class );
@@ -515,7 +515,7 @@ public class ValueVisibilityTest
         transientt.besideLayerVisible();
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromTransientWhenAccessingBesideModuleVisibleExpectException()
     {
         FromTransient transientt = module.newTransient( FromTransient.class );
@@ -529,35 +529,35 @@ public class ValueVisibilityTest
         transientt.belowApplicationVisible();
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromTransientWhenAccessingBelowLayerVisibleExpectException()
     {
         FromTransient transientt = module.newTransient( FromTransient.class );
         transientt.belowLayerVisible();
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromTransientWhenAccessingBelowModuleVisibleExpectException()
     {
         FromTransient transientt = module.newTransient( FromTransient.class );
         transientt.belowModuleVisible();
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromTransientWhenAccessingAboveApplicationVisibleExpectException()
     {
         FromTransient transientt = module.newTransient( FromTransient.class );
         transientt.aboveApplicationVisible();
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromTransientWhenAccessingAboveLayerVisibleExpectException()
     {
         FromTransient transientt = module.newTransient( FromTransient.class );
         transientt.aboveLayerVisible();
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromTransientWhenAccessingAboveModuleVisibleExpectException()
     {
         FromTransient transientt = module.newTransient( FromTransient.class );
@@ -599,7 +599,7 @@ public class ValueVisibilityTest
         object.besideLayerVisible();
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromObjectWhenAccessingBesideModuleVisibleExpectException()
     {
         FromObject object = module.newObject( FromObject.class );
@@ -613,35 +613,35 @@ public class ValueVisibilityTest
         object.belowApplicationVisible();
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromObjectWhenAccessingBelowLayerVisibleExpectException()
     {
         FromObject object = module.newObject( FromObject.class );
         object.belowLayerVisible();
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromObjectWhenAccessingBelowModuleVisibleExpectException()
     {
         FromObject object = module.newObject( FromObject.class );
         object.belowModuleVisible();
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromObjectWhenAccessingAboveApplicationVisibleExpectException()
     {
         FromObject object = module.newObject( FromObject.class );
         object.aboveApplicationVisible();
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromObjectWhenAccessingAboveLayerVisibleExpectException()
     {
         FromObject object = module.newObject( FromObject.class );
         object.aboveLayerVisible();
     }
 
-    @Test( expected = NoSuchValueException.class )
+    @Test( expected = NoSuchValueTypeException.class )
     public void givenFromObjectWhenAccessingAboveModuleVisibleExpectException()
     {
         FromObject object = module.newObject( FromObject.class );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/559b38a5/core/testsupport/src/main/java/org/apache/polygene/test/cache/AbstractCachePoolTest.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/cache/AbstractCachePoolTest.java b/core/testsupport/src/main/java/org/apache/polygene/test/cache/AbstractCachePoolTest.java
index 937c03a..358070d 100644
--- a/core/testsupport/src/main/java/org/apache/polygene/test/cache/AbstractCachePoolTest.java
+++ b/core/testsupport/src/main/java/org/apache/polygene/test/cache/AbstractCachePoolTest.java
@@ -21,15 +21,18 @@ package org.apache.polygene.test.cache;
 
 import java.util.Collection;
 import java.util.Random;
-import org.apache.polygene.api.constraint.ConstraintViolation;
+import org.apache.polygene.api.constraint.ValueConstraintViolation;
 import org.apache.polygene.api.constraint.ConstraintViolationException;
 import org.apache.polygene.spi.cache.Cache;
 import org.apache.polygene.spi.cache.CachePool;
 import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 
+import static org.hamcrest.core.AnyOf.anyOf;
+import static org.hamcrest.core.IsEqual.equalTo;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
 import static org.junit.Assert.fail;
 
 /**
@@ -75,11 +78,11 @@ public abstract class AbstractCachePoolTest
         catch( ConstraintViolationException e )
         {
             // expected
-            Collection<ConstraintViolation> violations = e.constraintViolations();
+            Collection<ValueConstraintViolation> violations = e.constraintViolations();
             assertEquals( 1, violations.size() );
-            ConstraintViolation violation = violations.iterator().next();
+            ValueConstraintViolation violation = violations.iterator().next();
             assertEquals( "not optional", violation.constraint().toString() );
-            assertEquals( "param1", violation.name() );
+            assertThat( violation.name(), anyOf(equalTo("cacheId"), equalTo( "arg0" )) );  // depends on whether -parameters was given at compile time.
         }
     }
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/559b38a5/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/EntityStoreTestSuite.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/EntityStoreTestSuite.java b/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/EntityStoreTestSuite.java
index 8a004a7..20f0b1f 100644
--- a/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/EntityStoreTestSuite.java
+++ b/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/EntityStoreTestSuite.java
@@ -19,6 +19,9 @@
  */
 package org.apache.polygene.test.entity.model;
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import org.apache.polygene.api.association.NamedAssociation;
 import org.apache.polygene.api.common.Visibility;
 import org.apache.polygene.api.constraint.ConstraintViolationException;
@@ -33,6 +36,8 @@ import org.apache.polygene.api.unitofwork.NoSuchEntityException;
 import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
 import org.apache.polygene.api.usecase.UsecaseBuilder;
+import org.apache.polygene.api.value.ValueBuilder;
+import org.apache.polygene.api.value.ValueBuilderFactory;
 import org.apache.polygene.bootstrap.ApplicationAssembly;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.LayerAssembly;
@@ -45,6 +50,7 @@ import org.apache.polygene.test.entity.model.legal.Will;
 import org.apache.polygene.test.entity.model.legal.WillAmount;
 import org.apache.polygene.test.entity.model.legal.WillItem;
 import org.apache.polygene.test.entity.model.legal.WillPercentage;
+import org.apache.polygene.test.entity.model.monetary.Currency;
 import org.apache.polygene.test.entity.model.people.Address;
 import org.apache.polygene.test.entity.model.people.City;
 import org.apache.polygene.test.entity.model.people.Country;
@@ -69,6 +75,9 @@ public abstract class EntityStoreTestSuite extends AbstractPolygeneBaseTest
     @Structure
     private ObjectFactory obf;
 
+    @Structure
+    private ValueBuilderFactory vbf;
+
     @Service
     private LegalService legalService;
 
@@ -77,18 +86,7 @@ public abstract class EntityStoreTestSuite extends AbstractPolygeneBaseTest
 
     @Structure
     private UnitOfWorkFactory uowf;
-    private Identity baselId;
-    private Identity montpellierId;
-    private Identity hannoverId;
-    private Identity malmoId;
 
-    private Identity cherasId;
-    private Identity unknown3Id;
-    private Identity unknown2Id;
-    private Identity unknown1Id;
-    private Identity varnhemId;
-
-    private Identity canaryId;
     private Identity switzerlandId;
     private Identity franceId;
     private Identity denmarkId;
@@ -97,6 +95,20 @@ public abstract class EntityStoreTestSuite extends AbstractPolygeneBaseTest
     private Identity usId;
     private Identity malaysiaId;
 
+    private Identity kualaLumpurId;
+    private Identity cherasId;
+    private Identity zurichId;
+    private Identity malmoId;
+    private Identity montpellierId;
+
+    private Identity hannoverId;
+    private Identity canaryId;
+    private Identity angkasaImpian4Id;
+    private Identity varnhemId;
+    private Identity unknown1Id;
+    private Identity unknown2Id;
+    private Identity unknown3Id;
+
     @Before
     public void setupTestData()
     {
@@ -127,17 +139,24 @@ public abstract class EntityStoreTestSuite extends AbstractPolygeneBaseTest
     {
         try( UnitOfWork uow = uowf.newUnitOfWork( UsecaseBuilder.newUsecase( "Test - validateAllCitiesPresent" ) ) )
         {
-            assertThat( peopleRepository.findCity( baselId ).name().get(), equalTo( "Basel" ) );
+            assertThat( peopleRepository.findCity( zurichId ).name().get(), equalTo( "Zurich" ) );
             assertThat( peopleRepository.findCity( malmoId ).name().get(), equalTo( "Malmo" ) );
             assertThat( peopleRepository.findCity( cherasId ).name().get(), equalTo( "Cheras" ) );
             assertThat( peopleRepository.findCity( hannoverId ).name().get(), equalTo( "Hannover" ) );
             assertThat( peopleRepository.findCity( montpellierId ).name().get(), equalTo( "Montpellier" ) );
+            assertThat( peopleRepository.findCity( kualaLumpurId ).name().get(), equalTo( "Kuala Lumpur" ) );
         }
     }
 
     @Test
     public void validateAllAddressesPresent()
     {
+        Currency.Builder currencyBuilder = obf.newObject( Currency.Builder.class );
+        Currency eur1000 = currencyBuilder.create( 1000, "EUR" );
+        Currency eur1500 = currencyBuilder.create( 1500, "EUR" );
+        Currency chf2000 = currencyBuilder.create( 2000, "CHF" );
+        Currency myr3000 = currencyBuilder.create( 3000, "MYR" );
+        Currency sek9000 = currencyBuilder.create( 9000, "SEK" );
         try( UnitOfWork uow = uowf.newUnitOfWork( UsecaseBuilder.newUsecase( "Test - validateAllAddressesPresent" ) ) )
         {
             Address canary = peopleRepository.findAddress( canaryId );
@@ -145,30 +164,42 @@ public abstract class EntityStoreTestSuite extends AbstractPolygeneBaseTest
             assertThat( canary.country().get().identity().get(), equalTo( malaysiaId ) );
             assertThat( canary.city().get().identity().get(), equalTo( cherasId ) );
             assertThat( canary.zipCode().get(), equalTo( "43200" ) );
+            assertThat( canary.rent().get().amount().get(), equalTo( myr3000 ) );
 
             Address varnhem = peopleRepository.findAddress( varnhemId );
             assertThat( varnhem.street().get(), equalTo( "Varnhemsgatan 25" ) );
             assertThat( varnhem.city().get().identity().get(), equalTo( malmoId ) );
             assertThat( varnhem.country().get().identity().get(), equalTo( swedenId ) );
             assertThat( varnhem.zipCode().get(), equalTo( "215 00" ) );
+            assertThat( varnhem.rent().get().amount().get(), equalTo( sek9000 ) );
+
+            Address angkasaImpian = peopleRepository.findAddress( angkasaImpian4Id );
+            assertThat( angkasaImpian.street().get(), equalTo( "B-19-4, Jalan Sehabat" ) );
+            assertThat( angkasaImpian.country().get().identity().get(), equalTo( malaysiaId ) );
+            assertThat( angkasaImpian.city().get().identity().get(), equalTo( kualaLumpurId ) );
+            assertThat( angkasaImpian.zipCode().get(), equalTo( "50200" ) );
+            assertThat( angkasaImpian.rent().get().amount().get(), equalTo( myr3000 ) );
 
             Address unknown = peopleRepository.findAddress( unknown1Id );
             assertThat( unknown.street().get(), equalTo( "" ) );
             assertThat( unknown.city().get().identity().get(), equalTo( montpellierId ) );
             assertThat( unknown.country().get().identity().get(), equalTo( franceId ) );
             assertThat( unknown.zipCode().get(), equalTo( "" ) );
+            assertThat( unknown.rent().get().amount().get(), equalTo( eur1000 ) );
 
             unknown = peopleRepository.findAddress( unknown2Id );
             assertThat( unknown.street().get(), equalTo( "" ) );
             assertThat( unknown.city().get().identity().get(), equalTo( hannoverId ) );
             assertThat( unknown.country().get().identity().get(), equalTo( germanyId ) );
             assertThat( unknown.zipCode().get(), equalTo( "" ) );
+            assertThat( unknown.rent().get().amount().get(), equalTo( eur1500 ) );
 
             unknown = peopleRepository.findAddress( unknown3Id );
             assertThat( unknown.street().get(), equalTo( "" ) );
-            assertThat( unknown.city().get().identity().get(), equalTo( baselId ) );
+            assertThat( unknown.city().get().identity().get(), equalTo( zurichId ) );
             assertThat( unknown.country().get().identity().get(), equalTo( switzerlandId ) );
             assertThat( unknown.zipCode().get(), equalTo( "" ) );
+            assertThat( unknown.rent().get().amount().get(), equalTo( chf2000 ) );
         }
     }
 
@@ -195,6 +226,10 @@ public abstract class EntityStoreTestSuite extends AbstractPolygeneBaseTest
             assertThat( kalle.name().get(), equalTo( "Kalle" ) );
             Person andreas = peopleRepository.findPersonByName( "Andreas" );
             assertThat( andreas.name().get(), equalTo( "Andreas" ) );
+            Person lars = peopleRepository.findPersonByName( "Lars" );
+            assertThat( lars.name().get(), equalTo( "Lars" ) );
+            Person mia = peopleRepository.findPersonByName( "Mia" );
+            assertThat( mia.name().get(), equalTo( "Mia" ) );
         }
     }
 
@@ -241,7 +276,7 @@ public abstract class EntityStoreTestSuite extends AbstractPolygeneBaseTest
         try( UnitOfWork uow = uowf.newUnitOfWork( UsecaseBuilder.newUsecase( "Test - whenIteratingNamedAssociationExpectIterationToSucceed" ) ) )
         {
             Person niclas = peopleRepository.findPersonByName( "Niclas" );
-            assertThat( niclas.phoneNumbers(), containsInAnyOrder("Home", "Chinese", "Swedish", "German"));
+            assertThat( niclas.phoneNumbers(), containsInAnyOrder( "Home", "Chinese", "Swedish", "German" ) );
         }
     }
 
@@ -314,9 +349,9 @@ public abstract class EntityStoreTestSuite extends AbstractPolygeneBaseTest
             chinesePhoneId = niclas.phoneNumbers().get( "Chinese" ).identity().get();
             germanPhoneId = niclas.phoneNumbers().get( "German" ).identity().get();
 
-            City basel = peopleRepository.findCity( baselId );
+            City zurich = peopleRepository.findCity( zurichId );
             Country switzerland = peopleRepository.findCountryByCountryCode( "ch" );
-            niclas.movedToNewAddress( "DespairStreet 12A", "43HQ21", basel, switzerland, obf.newObject( Rent.Builder.class ).create( 1000, "EUR" ) );
+            niclas.movedToNewAddress( "DespairStreet 12A", "43HQ21", zurich, switzerland, obf.newObject( Rent.Builder.class ).create( 1000, "EUR" ) );
             uow.complete();
         }
         try( UnitOfWork uow = uowf.newUnitOfWork( UsecaseBuilder.newUsecase( "Test - whenRemovingEntityExpectAggregatedEntitiesToBeRemoved" ) ) )
@@ -410,6 +445,58 @@ public abstract class EntityStoreTestSuite extends AbstractPolygeneBaseTest
         peopleRepository.findCountryByIdentity( switzerlandId );
     }
 
+    @Test
+    public void givenEntityInheritanceWhenStoreRetrieveExpectSuccess()
+    {
+        Currency.Builder currencyBuilder = obf.newObject( Currency.Builder.class );
+        Identity willId;
+        try( UnitOfWork uow = uowf.newUnitOfWork( UsecaseBuilder.newUsecase( "Test - givenEntityInheritanceWhenStoreRetrieveExpectSuccess" ) ) )
+        {
+            Person peter = peopleRepository.findPersonByName( "Peter" );
+            Person kalle = peopleRepository.findPersonByName( "Kalle" );
+            Person oscar = peopleRepository.findPersonByName( "Oscar" );
+            Person niclas = peopleRepository.findPersonByName( "Niclas" );
+            Person andreas = peopleRepository.findPersonByName( "Andreas" );
+            Map<Person, Currency> amountsMap = new HashMap<>();
+            Map<Person, Float> percentagesMap = new HashMap<>();
+            Map<Person, String> specificItemsMap = new HashMap<>();
+            amountsMap.put( niclas, currencyBuilder.create( 10, "USD" ) );
+            percentagesMap.put( kalle, 50f );
+            percentagesMap.put( oscar, 50f );
+            specificItemsMap.put( niclas, "Toothpick Collection\n" );
+            specificItemsMap.put( andreas, "Black/Yellow Lederhosen\n" );
+            Will will = legalService.createWill( peter, amountsMap, percentagesMap, specificItemsMap );
+            willId = will.identity().get();
+            uow.complete();
+        }
+        try( UnitOfWork uow = uowf.newUnitOfWork( UsecaseBuilder.newUsecase( "Test - givenEntityInheritanceWhenStoreRetrieveExpectSuccess" ) ) )
+        {
+            Person kalle = peopleRepository.findPersonByName( "Kalle" );
+            Person oscar = peopleRepository.findPersonByName( "Oscar" );
+            Person niclas = peopleRepository.findPersonByName( "Niclas" );
+            Person andreas = peopleRepository.findPersonByName( "Andreas" );
+
+            Will will = legalService.findWillById(willId);
+            List<WillAmount> amounts = will.amounts().get();
+            List<WillPercentage> percentages = will.percentages().get();
+            List<WillItem> items = will.items().get();
+            assertThat( amounts.size(), equalTo( 1 ) );
+            assertThat( percentages.size(), equalTo( 2 ) );
+            assertThat( items.size(), equalTo( 2 ) );
+
+            WillAmount willAmount = amounts.get( 0 );
+            assertThat( willAmount.amount().get(), equalTo( currencyBuilder.create( 10, "USD" ) ) );
+
+            WillPercentage kallePercentage = legalService.createPercentage( kalle, 50 );
+            WillPercentage oscarPercentage = legalService.createPercentage( oscar, 50 );
+            assertThat( percentages, containsInAnyOrder( kallePercentage, oscarPercentage ) );
+
+            WillItem niclasItem = legalService.createItem( niclas, "Toothpick Collection\n" );
+            WillItem andreasItem = legalService.createItem( andreas, "Black/Yellow Lederhosen\n" );
+            assertThat( items, containsInAnyOrder( niclasItem, andreasItem ) );
+        }
+    }
+
     private void testData()
     {
         Country malaysia = peopleRepository.createCountry( "my", "Malaysia" );
@@ -434,14 +521,16 @@ public abstract class EntityStoreTestSuite extends AbstractPolygeneBaseTest
         hannoverId = hannover.identity().get();
         City montpellier = peopleRepository.createCity( "Montpellier" );
         montpellierId = montpellier.identity().get();
-        City basel = peopleRepository.createCity( "Basel" );
-        baselId = basel.identity().get();
+        City kualalumpur = peopleRepository.createCity( "Kuala Lumpur" );
+        kualaLumpurId = kualalumpur.identity().get();
+        City zurich = peopleRepository.createCity( "Zurich" );
+        zurichId = zurich.identity().get();
         Rent.Builder rentBuilder = obf.newObject( Rent.Builder.class );
         Rent rentCanary = rentBuilder.create( 3000, "MYR" );
         Rent rentVarnhem = rentBuilder.create( 9000, "SEK" );
-        Rent rentUnknown1 = rentBuilder.create( 1200, "EUR" );
-        Rent rentUnknown2 = rentBuilder.create( 900, "EUR" );
-        Rent rentUnknown3 = rentBuilder.create( 2200, "EUR" );
+        Rent rentUnknown1 = rentBuilder.create( 1000, "EUR" );
+        Rent rentUnknown2 = rentBuilder.create( 1500, "EUR" );
+        Rent rentUnknown3 = rentBuilder.create( 2000, "CHF" );
         Address canaryResidence = peopleRepository.createAddress( "10, CH5A, Jalan Cheras Hartamas", "43200", cheras, malaysia, rentCanary );
         canaryId = canaryResidence.identity().get();
         Address varnhem = peopleRepository.createAddress( "Varnhemsgatan 25", "215 00", malmo, sweden, rentVarnhem );
@@ -450,8 +539,10 @@ public abstract class EntityStoreTestSuite extends AbstractPolygeneBaseTest
         unknown1Id = unknown1.identity().get();
         Address unknown2 = peopleRepository.createAddress( "", "", hannover, germany, rentUnknown2 );
         unknown2Id = unknown2.identity().get();
-        Address unknown3 = peopleRepository.createAddress( "", "", basel, switzerland, rentUnknown3 );
+        Address unknown3 = peopleRepository.createAddress( "", "", zurich, switzerland, rentUnknown3 );
         unknown3Id = unknown3.identity().get();
+        Address angkasaImpian = peopleRepository.createAddress( "B-19-4, Jalan Sehabat", "50200", kualalumpur, malaysia, rentCanary );
+        angkasaImpian4Id = angkasaImpian.identity().get();
         Person eric = peopleRepository.createPerson( "Eric", malaysia, canaryResidence, null, null );
         Person niclas = peopleRepository.createPerson( "Niclas", sweden, canaryResidence, null, peopleRepository.createPhoneNumber( "+60-16-7636344" ) );
         niclas.children().add( eric );
@@ -465,6 +556,9 @@ public abstract class EntityStoreTestSuite extends AbstractPolygeneBaseTest
         Person toni = peopleRepository.createPerson( "Toni", france, unknown2, janna, peopleRepository.createPhoneNumber( "+49-12-99887766" ) );
         janna.spouse().set( toni );
         Person andreas = peopleRepository.createPerson( "Andreas", germany, unknown3, null, peopleRepository.createPhoneNumber( "+41-98-1234567" ) );
+        Person mia = peopleRepository.createPerson( "Mia", malaysia, angkasaImpian, null, null );
+        Person lars = peopleRepository.createPerson( "Lars", denmark, angkasaImpian, mia, null );
+        mia.spouse().set( lars );
         NamedAssociation<Person> niclasRels = niclas.relationships();
         niclasRels.put( FRIEND, peter );
         niclasRels.put( FRIEND, toni );
@@ -486,6 +580,7 @@ public abstract class EntityStoreTestSuite extends AbstractPolygeneBaseTest
         defineConfigModule( configLayer.module( "Configuration Module" ) );
         defineSerializationModule( configLayer.module( "Serialization Module" ) );
         defineStorageModule( infrastructureLayer.module( "Storage Module" ) );
+        defineMonetaryModule( domainLayer.module( "Monetary Module" ) );
         definePeopleModule( domainLayer.module( "People Module" ) );
         defineLegalModule( domainLayer.module( "Legal Module" ) );
         defineTestModule( accessLayer.module( "TestCase Module" ) );
@@ -509,8 +604,8 @@ public abstract class EntityStoreTestSuite extends AbstractPolygeneBaseTest
     protected void definePeopleModule( ModuleAssembly module )
     {
         module.defaultServices();
-        module.entities( Address.class, City.class, PhoneNumber.class );
-        module.entities( Country.class, Person.class );
+        module.entities( Address.class, Country.class, City.class, PhoneNumber.class );
+        module.entities( Person.class ).visibleIn( Visibility.layer );
         module.services( PeopleRepository.class ).visibleIn( Visibility.application );
         module.values( Rent.class );
         module.objects( Rent.Builder.class ).visibleIn( Visibility.application );
@@ -520,7 +615,15 @@ public abstract class EntityStoreTestSuite extends AbstractPolygeneBaseTest
     {
         module.defaultServices();
         module.services( LegalService.class ).visibleIn( Visibility.application );
-        module.entities( Will.class, WillItem.class, WillPercentage.class, WillAmount.class );
+        module.entities( Will.class );
+        module.values( WillAmount.class, WillItem.class, WillPercentage.class );
+    }
+
+    protected void defineMonetaryModule( ModuleAssembly module )
+    {
+        module.defaultServices();
+        module.values( Currency.class ).visibleIn( Visibility.layer );
+        module.objects( Currency.Builder.class ).visibleIn( Visibility.application );
     }
 
     protected void defineSerializationModule( ModuleAssembly module )

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/559b38a5/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/legal/LegalService.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/legal/LegalService.java b/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/legal/LegalService.java
index c90a64c..6079a2e 100644
--- a/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/legal/LegalService.java
+++ b/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/legal/LegalService.java
@@ -19,7 +19,8 @@
  */
 package org.apache.polygene.test.entity.model.legal;
 
-import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
 import org.apache.polygene.api.entity.EntityBuilder;
 import org.apache.polygene.api.identity.Identity;
@@ -31,13 +32,21 @@ import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
 import org.apache.polygene.api.unitofwork.concern.UnitOfWorkPropagation;
 import org.apache.polygene.api.value.ValueBuilder;
 import org.apache.polygene.api.value.ValueBuilderFactory;
+import org.apache.polygene.test.entity.model.monetary.Currency;
 import org.apache.polygene.test.entity.model.people.Person;
 
 @Mixins( LegalService.Mixin.class )
 public interface LegalService
 {
     @UnitOfWorkPropagation
-    Identity createWill( Person principal, Map<Person, BigDecimal> amounts, Map<Person, Float> percentages, Map<Person, String> specificItems );
+    Will findWillById( Identity willId );
+
+    @UnitOfWorkPropagation
+    Will createWill( Person principal, Map<Person, Currency> amounts, Map<Person, Float> percentages, Map<Person, String> specificItems );
+
+    WillPercentage createPercentage( Person beneficiary, float percentage );
+
+    WillItem createItem( Person beneficiary, String item );
 
     class Mixin
         implements LegalService
@@ -49,36 +58,46 @@ public interface LegalService
         private UnitOfWorkFactory uowf;
 
         @Override
-        public Identity createWill( Person principal, Map<Person, BigDecimal> amounts, Map<Person, Float> percentages, Map<Person, String> specificItems )
+        public Will findWillById( Identity willId )
+        {
+            UnitOfWork uow = uowf.currentUnitOfWork();
+            return uow.get( Will.class, willId );
+        }
+
+        @Override
+        public Will createWill( Person principal, Map<Person, Currency> amounts, Map<Person, Float> percentages, Map<Person, String> specificItems )
         {
             UnitOfWork uow = uowf.currentUnitOfWork();
             Identity identity = StringIdentity.identityOf( "will-" + principal.name().get() );
             EntityBuilder<Will> builder = uow.newEntityBuilder( Will.class, identity );
-            Will instance = builder.instance();
-            for( Map.Entry<Person, BigDecimal> entry : amounts.entrySet() )
+            List<WillAmount> amountsList = new ArrayList<>();
+            for( Map.Entry<Person, Currency> entry : amounts.entrySet() )
             {
                 WillAmount amount = createAmount( entry.getKey(), entry.getValue() );
-                instance.amounts().add( amount );
+                amountsList.add( amount );
             }
+            List<WillPercentage> percentagesList = new ArrayList<>();
             for( Map.Entry<Person, Float> entry : percentages.entrySet() )
             {
                 WillPercentage amount = createPercentage( entry.getKey(), entry.getValue() );
-                instance.percentages().add( amount );
+                percentagesList.add( amount );
             }
+            List<WillItem> itemsList = new ArrayList<>();
             for( Map.Entry<Person, String> entry : specificItems.entrySet() )
             {
                 String value = entry.getValue();
-                int pos = value.indexOf( '\n' );
-                String item = value.substring( 0, pos );
-                String description = value.substring( pos + 1 );
-                WillItem amount = createItem( entry.getKey(), item, description );
-                instance.items().add( amount );
+                WillItem amount = createItem( entry.getKey(), value );
+                itemsList.add( amount );
             }
-            builder.newInstance();
-            return identity;
+            Will instance = builder.instance();
+            instance.principal().set(principal);
+            instance.percentages().set( percentagesList );
+            instance.amounts().set( amountsList );
+            instance.items().set( itemsList );
+            return builder.newInstance();
         }
 
-        private WillAmount createAmount( Person beneficiary, BigDecimal amount )
+        private WillAmount createAmount( Person beneficiary, Currency amount )
         {
             ValueBuilder<WillAmount> builder = vbf.newValueBuilder( WillAmount.class );
             builder.prototype().amount().set( amount );
@@ -98,9 +117,26 @@ public interface LegalService
         {
             ValueBuilder<WillItem> builder = vbf.newValueBuilder( WillItem.class );
             builder.prototype().item().set( item );
-            builder.prototype().item().set( description );
+            builder.prototype().description().set( description );
             builder.prototype().beneficiary().set( beneficiary );
             return builder.newInstance();
         }
+
+        public WillItem createItem( Person beneficiary, String value )
+        {
+            int pos = value.indexOf( '\n' );
+            String item = value.substring( 0, pos );
+            String description = value.substring( pos + 1 );
+            return createItem( beneficiary, item, description );
+        }
+
+        public WillPercentage createPercentage( Person beneficiary, float percentage )
+        {
+            ValueBuilder<WillPercentage> builder = vbf.newValueBuilder( WillPercentage.class );
+            builder.prototype().beneficiary().set( beneficiary );
+            builder.prototype().percentage().set( percentage );
+            return builder.newInstance();
+        }
+
     }
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/559b38a5/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/legal/Will.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/legal/Will.java b/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/legal/Will.java
index 1c66efb..dd41bba 100644
--- a/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/legal/Will.java
+++ b/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/legal/Will.java
@@ -19,18 +19,22 @@
  */
 package org.apache.polygene.test.entity.model.legal;
 
+import java.util.List;
 import org.apache.polygene.api.association.Association;
 import org.apache.polygene.api.association.ManyAssociation;
+import org.apache.polygene.api.identity.HasIdentity;
+import org.apache.polygene.api.property.Property;
 import org.apache.polygene.test.entity.model.people.Person;
 
-public interface Will
+public interface Will extends HasIdentity
 {
-
     Association<Person> principal();
 
-    ManyAssociation<WillItem> items();
+    ManyAssociation<Person> witnesses();
+
+    Property<List<WillItem>> items();
 
-    ManyAssociation<WillPercentage> percentages();
+    Property<List<WillPercentage>> percentages();
 
-    ManyAssociation<WillAmount> amounts();
+    Property<List<WillAmount>> amounts();
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/559b38a5/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/legal/WillAmount.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/legal/WillAmount.java b/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/legal/WillAmount.java
index 6661375..52b4b58 100644
--- a/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/legal/WillAmount.java
+++ b/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/legal/WillAmount.java
@@ -21,8 +21,9 @@ package org.apache.polygene.test.entity.model.legal;
 
 import java.math.BigDecimal;
 import org.apache.polygene.api.property.Property;
+import org.apache.polygene.test.entity.model.monetary.Currency;
 
 public interface WillAmount extends WillBenefit
 {
-    Property<BigDecimal> amount();
+    Property<Currency> amount();
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/559b38a5/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/legal/WillBenefit.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/legal/WillBenefit.java b/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/legal/WillBenefit.java
index 0347a6c..3c44e7a 100644
--- a/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/legal/WillBenefit.java
+++ b/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/legal/WillBenefit.java
@@ -21,6 +21,7 @@ package org.apache.polygene.test.entity.model.legal;
 
 import org.apache.polygene.api.association.Association;
 import org.apache.polygene.api.common.Optional;
+import org.apache.polygene.api.identity.HasIdentity;
 import org.apache.polygene.api.property.Property;
 import org.apache.polygene.test.entity.model.people.Person;
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/559b38a5/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/monetary/Currency.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/monetary/Currency.java b/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/monetary/Currency.java
new file mode 100644
index 0000000..6ca2c9b
--- /dev/null
+++ b/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/monetary/Currency.java
@@ -0,0 +1,51 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.test.entity.model.monetary;
+
+import java.math.BigDecimal;
+import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.value.ValueBuilder;
+import org.apache.polygene.api.value.ValueBuilderFactory;
+
+public interface Currency
+{
+    Property<BigDecimal> amount();
+    Property<String> name();
+
+    class Builder
+    {
+        @Structure
+        private ValueBuilderFactory vbf;
+
+        public Currency create( int amount, String currencyName )
+        {
+            return create( new BigDecimal( amount ), currencyName );
+        }
+
+        public Currency create( BigDecimal amount, String currencyName )
+        {
+            ValueBuilder<Currency> builder = vbf.newValueBuilder( Currency.class );
+            builder.prototype().name().set( currencyName );
+            builder.prototype().amount().set( amount );
+            return builder.newInstance();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/559b38a5/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/people/Rent.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/people/Rent.java b/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/people/Rent.java
index 576b3dc..b05aec5 100644
--- a/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/people/Rent.java
+++ b/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/people/Rent.java
@@ -19,29 +19,33 @@
  */
 package org.apache.polygene.test.entity.model.people;
 
-import java.math.BigDecimal;
 import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.object.ObjectFactory;
 import org.apache.polygene.api.property.Property;
 import org.apache.polygene.api.value.ValueBuilder;
 import org.apache.polygene.api.value.ValueBuilderFactory;
+import org.apache.polygene.test.entity.model.monetary.Currency;
 
 public interface Rent
 {
-    Property<BigDecimal> amount();
-
-    Property<String> currency();
+    Property<Currency> amount();
 
     class Builder
     {
+        private final Currency.Builder currencyBuilder;
+
         @Structure
         private ValueBuilderFactory vbf;
 
-        public Rent create( Integer amount, String currency )
+        public Builder( @Structure ObjectFactory objectFactory)
+        {
+            currencyBuilder = objectFactory.newObject( Currency.Builder.class );
+        }
+
+        public Rent create( int amount, String currency )
         {
             ValueBuilder<Rent> builder = vbf.newValueBuilder( Rent.class );
-            Rent prototype = builder.prototype();
-            prototype.amount().set( new BigDecimal( amount ) );
-            prototype.currency().set( currency );
+            builder.prototype().amount().set( currencyBuilder.create( amount, currency ) );
             return builder.newInstance();
         }
     }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/559b38a5/core/testsupport/src/test/java/org/apache/polygene/test/cache/MemoryCacheTest.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/test/java/org/apache/polygene/test/cache/MemoryCacheTest.java b/core/testsupport/src/test/java/org/apache/polygene/test/cache/MemoryCacheTest.java
index c9e2fe1..d91c6c0 100644
--- a/core/testsupport/src/test/java/org/apache/polygene/test/cache/MemoryCacheTest.java
+++ b/core/testsupport/src/test/java/org/apache/polygene/test/cache/MemoryCacheTest.java
@@ -22,8 +22,7 @@ package org.apache.polygene.test.cache;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 
-public class MemoryCacheTest
-    extends AbstractCachePoolTest
+public class MemoryCacheTest extends AbstractCachePoolTest
 {
     @Override
     public void assemble( ModuleAssembly module )

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/559b38a5/internals/testsupport-internal/src/main/java/org/apache/polygene/test/docker/DockerRule.java
----------------------------------------------------------------------
diff --git a/internals/testsupport-internal/src/main/java/org/apache/polygene/test/docker/DockerRule.java b/internals/testsupport-internal/src/main/java/org/apache/polygene/test/docker/DockerRule.java
index 18fab0f..07cf07a 100644
--- a/internals/testsupport-internal/src/main/java/org/apache/polygene/test/docker/DockerRule.java
+++ b/internals/testsupport-internal/src/main/java/org/apache/polygene/test/docker/DockerRule.java
@@ -86,7 +86,7 @@ public class DockerRule
                 .builder()
                 .imageName( "org.apache.polygene:org.apache.polygene.internal.docker-" + image )
                 .publishAllPorts( true )
-                .waitForTimeout( 120 )
+                .waitForTimeout( 180 )
                 .waitFor( rule -> new AndChecker( rule, waitFor ) );
             environment.forEach( builder::env );
             dockerRule = builder.build();

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/559b38a5/libraries/constraints/src/test/java/org/apache/polygene/library/constraints/ConstraintTest.java
----------------------------------------------------------------------
diff --git a/libraries/constraints/src/test/java/org/apache/polygene/library/constraints/ConstraintTest.java b/libraries/constraints/src/test/java/org/apache/polygene/library/constraints/ConstraintTest.java
index 2c526b5..8b697b9 100644
--- a/libraries/constraints/src/test/java/org/apache/polygene/library/constraints/ConstraintTest.java
+++ b/libraries/constraints/src/test/java/org/apache/polygene/library/constraints/ConstraintTest.java
@@ -31,8 +31,7 @@ import org.junit.Test;
 
 import static org.junit.Assert.fail;
 
-public class ConstraintTest
-    extends AbstractPolygeneTest
+public class ConstraintTest extends AbstractPolygeneTest
 {
 
     @Override

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/559b38a5/libraries/rest-server/src/main/java/org/apache/polygene/library/rest/server/api/ContextResource.java
----------------------------------------------------------------------
diff --git a/libraries/rest-server/src/main/java/org/apache/polygene/library/rest/server/api/ContextResource.java b/libraries/rest-server/src/main/java/org/apache/polygene/library/rest/server/api/ContextResource.java
index 4b701fb..2fb2fe1 100644
--- a/libraries/rest-server/src/main/java/org/apache/polygene/library/rest/server/api/ContextResource.java
+++ b/libraries/rest-server/src/main/java/org/apache/polygene/library/rest/server/api/ContextResource.java
@@ -34,7 +34,7 @@ import java.util.stream.Stream;
 import org.apache.polygene.api.association.ManyAssociation;
 import org.apache.polygene.api.association.NamedAssociation;
 import org.apache.polygene.api.common.Optional;
-import org.apache.polygene.api.constraint.ConstraintViolation;
+import org.apache.polygene.api.constraint.ValueConstraintViolation;
 import org.apache.polygene.api.constraint.ConstraintViolationException;
 import org.apache.polygene.api.constraint.Name;
 import org.apache.polygene.api.entity.EntityComposite;
@@ -808,7 +808,7 @@ public class ContextResource
                 // CVE are considered client faults
                 String messages = "";
                 Locale locale = ObjectSelection.type( Locale.class );
-                for( ConstraintViolation constraintViolation : e.constraintViolations() )
+                for( ValueConstraintViolation constraintViolation : e.constraintViolations() )
                 {
                     if( !messages.isEmpty() )
                     {

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/559b38a5/libraries/rest-server/src/main/java/org/apache/polygene/library/rest/server/restlet/ConstraintViolationMessages.java
----------------------------------------------------------------------
diff --git a/libraries/rest-server/src/main/java/org/apache/polygene/library/rest/server/restlet/ConstraintViolationMessages.java b/libraries/rest-server/src/main/java/org/apache/polygene/library/rest/server/restlet/ConstraintViolationMessages.java
index 17b43d5..253284d 100644
--- a/libraries/rest-server/src/main/java/org/apache/polygene/library/rest/server/restlet/ConstraintViolationMessages.java
+++ b/libraries/rest-server/src/main/java/org/apache/polygene/library/rest/server/restlet/ConstraintViolationMessages.java
@@ -24,14 +24,14 @@ import java.util.Locale;
 import java.util.ResourceBundle;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
-import org.apache.polygene.api.constraint.ConstraintViolation;
+import org.apache.polygene.api.constraint.ValueConstraintViolation;
 
 /**
  * TODO
  */
 public class ConstraintViolationMessages
 {
-    public String getMessage( ConstraintViolation violation, Locale locale )
+    public String getMessage( ValueConstraintViolation violation, Locale locale )
         throws IllegalArgumentException
     {
         try

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/559b38a5/libraries/rest-server/src/main/java/org/apache/polygene/library/rest/server/restlet/InteractionConstraintsService.java
----------------------------------------------------------------------
diff --git a/libraries/rest-server/src/main/java/org/apache/polygene/library/rest/server/restlet/InteractionConstraintsService.java b/libraries/rest-server/src/main/java/org/apache/polygene/library/rest/server/restlet/InteractionConstraintsService.java
index b04edef..03d70c3 100644
--- a/libraries/rest-server/src/main/java/org/apache/polygene/library/rest/server/restlet/InteractionConstraintsService.java
+++ b/libraries/rest-server/src/main/java/org/apache/polygene/library/rest/server/restlet/InteractionConstraintsService.java
@@ -32,7 +32,7 @@ import org.apache.polygene.api.constraint.Constraint;
 import org.apache.polygene.api.constraint.ConstraintDeclaration;
 import org.apache.polygene.api.constraint.Constraints;
 import org.apache.polygene.api.injection.scope.Structure;
-import org.apache.polygene.api.object.NoSuchObjectException;
+import org.apache.polygene.api.object.NoSuchObjectTypeException;
 import org.apache.polygene.api.structure.Module;
 import org.apache.polygene.library.rest.server.api.ObjectSelection;
 import org.apache.polygene.library.rest.server.api.constraint.InteractionConstraint;
@@ -150,7 +150,7 @@ public class InteractionConstraintsService
                     {
                         constraint = module.newObject( constraintClass );
                     }
-                    catch( NoSuchObjectException e )
+                    catch( NoSuchObjectTypeException e )
                     {
                         constraint = constraintClass.newInstance();
                     }
@@ -214,7 +214,7 @@ public class InteractionConstraintsService
                     {
                         constraint = module.newObject( constraintClass );
                     }
-                    catch( NoSuchObjectException e )
+                    catch( NoSuchObjectTypeException e )
                     {
                         constraint = constraintClass.newInstance();
                     }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/559b38a5/manual/src/main/java/org/apache/polygene/manual/recipes/createConstraint/ParameterViolationConcern.java
----------------------------------------------------------------------
diff --git a/manual/src/main/java/org/apache/polygene/manual/recipes/createConstraint/ParameterViolationConcern.java b/manual/src/main/java/org/apache/polygene/manual/recipes/createConstraint/ParameterViolationConcern.java
index a7dd18d..eb03280 100644
--- a/manual/src/main/java/org/apache/polygene/manual/recipes/createConstraint/ParameterViolationConcern.java
+++ b/manual/src/main/java/org/apache/polygene/manual/recipes/createConstraint/ParameterViolationConcern.java
@@ -23,7 +23,7 @@ import java.lang.annotation.Annotation;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
 import org.apache.polygene.api.concern.ConcernOf;
-import org.apache.polygene.api.constraint.ConstraintViolation;
+import org.apache.polygene.api.constraint.ValueConstraintViolation;
 import org.apache.polygene.api.constraint.ConstraintViolationException;
 
 // START SNIPPET: report
@@ -39,7 +39,7 @@ public class ParameterViolationConcern extends ConcernOf<InvocationHandler>
         }
         catch( ConstraintViolationException e )
         {
-            for( ConstraintViolation violation : e.constraintViolations() )
+            for( ValueConstraintViolation violation : e.constraintViolations() )
             {
                 String name = violation.name();
                 Object value = violation.value();

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/559b38a5/manual/src/main/java/org/apache/polygene/manual/recipes/createConstraint/PhoneNumberParameterViolationConcern.java
----------------------------------------------------------------------
diff --git a/manual/src/main/java/org/apache/polygene/manual/recipes/createConstraint/PhoneNumberParameterViolationConcern.java b/manual/src/main/java/org/apache/polygene/manual/recipes/createConstraint/PhoneNumberParameterViolationConcern.java
index 92db8a2..82c27c0 100644
--- a/manual/src/main/java/org/apache/polygene/manual/recipes/createConstraint/PhoneNumberParameterViolationConcern.java
+++ b/manual/src/main/java/org/apache/polygene/manual/recipes/createConstraint/PhoneNumberParameterViolationConcern.java
@@ -22,7 +22,7 @@ package org.apache.polygene.manual.recipes.createConstraint;
 import java.util.Collection;
 import org.apache.polygene.api.concern.ConcernOf;
 import org.apache.polygene.api.concern.Concerns;
-import org.apache.polygene.api.constraint.ConstraintViolation;
+import org.apache.polygene.api.constraint.ValueConstraintViolation;
 import org.apache.polygene.api.constraint.ConstraintViolationException;
 import org.apache.polygene.api.property.Property;
 
@@ -44,7 +44,7 @@ public abstract class PhoneNumberParameterViolationConcern extends ConcernOf<Has
             }
             catch( ConstraintViolationException e )
             {
-                Collection<ConstraintViolation> violations = e.constraintViolations();
+                Collection<ValueConstraintViolation> violations = e.constraintViolations();
                 report( violations );
             }
         }
@@ -52,7 +52,7 @@ public abstract class PhoneNumberParameterViolationConcern extends ConcernOf<Has
 // END SNIPPET: property
 
 // START SNIPPET: property
-        private void report( Collection<ConstraintViolation> violations )
+        private void report( Collection<ValueConstraintViolation> violations )
         {
         }
     }