Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 44DFA200C5D for ; Mon, 13 Mar 2017 11:34:57 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 439BB160B8B; Mon, 13 Mar 2017 10:34:57 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 3B0B7160BB6 for ; Mon, 13 Mar 2017 11:34:56 +0100 (CET) Received: (qmail 86311 invoked by uid 500); 13 Mar 2017 10:34:55 -0000 Mailing-List: contact commits-help@polygene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@polygene.apache.org Delivered-To: mailing list commits@polygene.apache.org Received: (qmail 85907 invoked by uid 99); 13 Mar 2017 10:34:55 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Mar 2017 10:34:55 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 13E30DFF72; Mon, 13 Mar 2017 10:34:55 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: paulmerlin@apache.org To: commits@polygene.apache.org Date: Mon, 13 Mar 2017 10:35:39 -0000 Message-Id: <535be09347ac4c1d9404c103763c2046@git.apache.org> In-Reply-To: <750dbb6da232464ca42236ae6d962acf@git.apache.org> References: <750dbb6da232464ca42236ae6d962acf@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [47/50] [abbrv] polygene-java git commit: Trigger UoW completion in AbstractValueCompositeSerializationTest archived-at: Mon, 13 Mar 2017 10:34:57 -0000 Trigger UoW completion in AbstractValueCompositeSerializationTest Add complex value composite in entity under test. Exercise entity state serialization in test. POLYGENE-231 Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/0a23e9f7 Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/0a23e9f7 Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/0a23e9f7 Branch: refs/heads/serialization-3.0 Commit: 0a23e9f750691e3170ed3070b3fae1b98ed1c41b Parents: a94e465 Author: Paul Merlin Authored: Mon Mar 13 09:10:29 2017 +0100 Committer: Paul Merlin Committed: Mon Mar 13 11:24:42 2017 +0100 ---------------------------------------------------------------------- ...AbstractValueCompositeSerializationTest.java | 50 ++++++++++++-------- 1 file changed, 30 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0a23e9f7/core/testsupport/src/main/java/org/apache/polygene/test/serialization/AbstractValueCompositeSerializationTest.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/serialization/AbstractValueCompositeSerializationTest.java b/core/testsupport/src/main/java/org/apache/polygene/test/serialization/AbstractValueCompositeSerializationTest.java index a0975ee..2642198 100644 --- a/core/testsupport/src/main/java/org/apache/polygene/test/serialization/AbstractValueCompositeSerializationTest.java +++ b/core/testsupport/src/main/java/org/apache/polygene/test/serialization/AbstractValueCompositeSerializationTest.java @@ -50,7 +50,6 @@ import org.apache.polygene.api.structure.Module; import org.apache.polygene.api.unitofwork.UnitOfWork; import org.apache.polygene.api.value.ValueBuilder; import org.apache.polygene.api.value.ValueComposite; -import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; import org.apache.polygene.test.AbstractPolygeneTest; import org.apache.polygene.test.EntityTestAssembler; @@ -89,12 +88,8 @@ public abstract class AbstractValueCompositeSerializationTest System.out.println( "# END " + testName.getMethodName() ); } - @Structure - protected Module moduleInstance; - @Override public void assemble( ModuleAssembly module ) - throws AssemblyException { module.values( Some.class, SomeExtended.class, SomeShuffled.class, AnotherValue.class, FooValue.class, CustomFooValue.class, @@ -104,6 +99,9 @@ public abstract class AbstractValueCompositeSerializationTest module.entities( Some.class, BarEntity.class ); } + @Structure + protected Module moduleInstance; + @Service protected Serialization serialization; @@ -141,6 +139,8 @@ public abstract class AbstractValueCompositeSerializationTest is( true ) ); assertThat( "Value equality", some, equalTo( some2 ) ); + + uow.complete(); } } @@ -156,6 +156,8 @@ public abstract class AbstractValueCompositeSerializationTest Some deserialized = serialization.deserialize( module, Some.class, serialized ); System.out.println( deserialized ); + + uow.complete(); } } @@ -171,6 +173,8 @@ public abstract class AbstractValueCompositeSerializationTest SomeExtended deserialized = serialization.deserialize( module, SomeExtended.class, serialized ); System.out.println( deserialized ); + + uow.complete(); } } @@ -196,6 +200,8 @@ public abstract class AbstractValueCompositeSerializationTest serialization.deserialize( module, SomeExtended.class, serialized ); System.out.println( deserialized ); + + uow.complete(); } } @@ -268,9 +274,9 @@ public abstract class AbstractValueCompositeSerializationTest proto.identity().set( StringIdentity.fromString( identity ) ); setSomeValueState( module, uow, proto ); proto.extraProperty().set( "extra property" ); - proto.extraAssociation().set( buildBarEntity( uow, "extra association" ) ); - proto.extraManyAssociation().add( buildBarEntity( uow, "extra many association" ) ); - proto.extraNamedAssociation().put( "extra", buildBarEntity( uow, "extra named association" ) ); + proto.extraAssociation().set( buildBarEntity( module, uow, "extra association" ) ); + proto.extraManyAssociation().add( buildBarEntity( module, uow, "extra many association" ) ); + proto.extraNamedAssociation().put( "extra", buildBarEntity( module, uow, "extra named association" ) ); return builder.newInstance(); } @@ -314,7 +320,7 @@ public abstract class AbstractValueCompositeSerializationTest // maintain a certain order but it's not the case on some JVMs. On OpenJDK 8 they are reversed for example. // This should not be enforced tough as both the Map API and the JSON specification state that name-value pairs // are unordered. - // As a consequence this test should be enhanced to be Map order independant. + // As a consequence this test should be enhanced to be Map order independent. // // proto.stringIntMap().get().put( "bar", 67 ); @@ -330,18 +336,19 @@ public abstract class AbstractValueCompositeSerializationTest some.customFooValue().set( module.newValue( CustomFooValue.class ) ); // NestedEntities - some.barAssociation().set( buildBarEntity( uow, "bazar in barAssociation" ) ); - some.barEntityAssociation().set( buildBarEntity( uow, "bazar in barEntityAssociation" ) ); - some.barManyAssociation().add( buildBarEntity( uow, "bazar ONE in barManyAssociation" ) ); - some.barManyAssociation().add( buildBarEntity( uow, "bazar TWO in barManyAssociation" ) ); - some.barEntityManyAssociation().add( buildBarEntity( uow, "bazar ONE in barEntityManyAssociation" ) ); - some.barEntityManyAssociation().add( buildBarEntity( uow, "bazar TWO in barEntityManyAssociation" ) ); - some.barNamedAssociation().put( "bazar", buildBarEntity( uow, "bazar in barNamedAssociation" ) ); - some.barNamedAssociation().put( "cathedral", buildBarEntity( uow, "cathedral in barNamedAssociation" ) ); + some.barAssociation().set( buildBarEntity( module, uow, "bazar in barAssociation" ) ); + some.barEntityAssociation().set( buildBarEntity( module, uow, "bazar in barEntityAssociation" ) ); + some.barManyAssociation().add( buildBarEntity( module, uow, "bazar ONE in barManyAssociation" ) ); + some.barManyAssociation().add( buildBarEntity( module, uow, "bazar TWO in barManyAssociation" ) ); + some.barEntityManyAssociation().add( buildBarEntity( module, uow, "bazar ONE in barEntityManyAssociation" ) ); + some.barEntityManyAssociation().add( buildBarEntity( module, uow, "bazar TWO in barEntityManyAssociation" ) ); + some.barNamedAssociation().put( "bazar", buildBarEntity( module, uow, "bazar in barNamedAssociation" ) ); + some.barNamedAssociation().put( "cathedral", + buildBarEntity( module, uow, "cathedral in barNamedAssociation" ) ); some.barEntityNamedAssociation().put( "bazar", - buildBarEntity( uow, "bazar in barEntityNamedAssociation" ) ); + buildBarEntity( module, uow, "bazar in barEntityNamedAssociation" ) ); some.barEntityNamedAssociation().put( "cathedral", - buildBarEntity( uow, "cathedral in barEntityNamedAssociation" ) ); + buildBarEntity( module, uow, "cathedral in barEntityNamedAssociation" ) ); } private static AnotherValue createAnotherValue( Module module, String val1, String val2 ) @@ -352,10 +359,11 @@ public abstract class AbstractValueCompositeSerializationTest return valueBuilder.newInstance(); } - private static BarEntity buildBarEntity( UnitOfWork uow, String cathedral ) + private static BarEntity buildBarEntity( Module module, UnitOfWork uow, String cathedral ) { EntityBuilder barBuilder = uow.newEntityBuilder( BarEntity.class ); barBuilder.instance().cathedral().set( cathedral ); + barBuilder.instance().another().set( createAnotherValue( module, "nested", "value" ) ); return barBuilder.newInstance(); } @@ -574,6 +582,8 @@ public abstract class AbstractValueCompositeSerializationTest { @UseDefaults Property cathedral(); + + Property another(); } public interface BarEntity