polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [6/6] zest-qi4j git commit: Fix for ZEST-23
Date Thu, 21 May 2015 10:25:05 GMT
Fix for ZEST-23


Project: http://git-wip-us.apache.org/repos/asf/zest-qi4j/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-qi4j/commit/59156256
Tree: http://git-wip-us.apache.org/repos/asf/zest-qi4j/tree/59156256
Diff: http://git-wip-us.apache.org/repos/asf/zest-qi4j/diff/59156256

Branch: refs/heads/ZEST-22_toEntity-toValue
Commit: 591562568e2c8d10121bd7b73b54367b758535ae
Parents: 15e1e72
Author: Niclas Hedhman <niclas@hedhman.org>
Authored: Thu May 21 18:24:26 2015 +0800
Committer: Niclas Hedhman <niclas@hedhman.org>
Committed: Thu May 21 18:24:26 2015 +0800

----------------------------------------------------------------------
 .../entity/associations/AssociationTest.java    |  1 -
 .../value/ValueSerializationRegressionTest.java |  3 ++
 .../runtime/value/ValueWithAssociationTest.java | 39 +-------------------
 .../qi4j/spi/value/ValueSerializerAdapter.java  |  4 +-
 4 files changed, 7 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/59156256/core/runtime/src/test/java/org/qi4j/runtime/entity/associations/AssociationTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/qi4j/runtime/entity/associations/AssociationTest.java
b/core/runtime/src/test/java/org/qi4j/runtime/entity/associations/AssociationTest.java
index ac321c9..7772245 100644
--- a/core/runtime/src/test/java/org/qi4j/runtime/entity/associations/AssociationTest.java
+++ b/core/runtime/src/test/java/org/qi4j/runtime/entity/associations/AssociationTest.java
@@ -101,7 +101,6 @@ public class AssociationTest
 
     public interface Friend<T>
     {
-        @Optional
         Association<T> friend();
     }
 

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/59156256/core/runtime/src/test/java/org/qi4j/runtime/value/ValueSerializationRegressionTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/qi4j/runtime/value/ValueSerializationRegressionTest.java
b/core/runtime/src/test/java/org/qi4j/runtime/value/ValueSerializationRegressionTest.java
index 5761ff9..5a84cc5 100644
--- a/core/runtime/src/test/java/org/qi4j/runtime/value/ValueSerializationRegressionTest.java
+++ b/core/runtime/src/test/java/org/qi4j/runtime/value/ValueSerializationRegressionTest.java
@@ -4,6 +4,8 @@ import org.junit.Test;
 import org.qi4j.api.association.Association;
 import org.qi4j.api.association.ManyAssociation;
 import org.qi4j.api.association.NamedAssociation;
+import org.qi4j.api.common.Optional;
+import org.qi4j.api.common.UseDefaults;
 import org.qi4j.api.entity.Identity;
 import org.qi4j.api.property.Property;
 import org.qi4j.api.unitofwork.UnitOfWorkCompletionException;
@@ -49,6 +51,7 @@ public class ValueSerializationRegressionTest extends AbstractQi4jTest
     {
         Property<String> name();
 
+        @Optional
         Association<SimpleEntity> simple();
 
         ManyAssociation<SimpleEntity> simples();

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/59156256/core/runtime/src/test/java/org/qi4j/runtime/value/ValueWithAssociationTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/qi4j/runtime/value/ValueWithAssociationTest.java
b/core/runtime/src/test/java/org/qi4j/runtime/value/ValueWithAssociationTest.java
index a7f88b3..5d699d5 100644
--- a/core/runtime/src/test/java/org/qi4j/runtime/value/ValueWithAssociationTest.java
+++ b/core/runtime/src/test/java/org/qi4j/runtime/value/ValueWithAssociationTest.java
@@ -1,11 +1,11 @@
 package org.qi4j.runtime.value;
 
-import org.junit.Ignore;
 import org.junit.Test;
 import org.qi4j.api.association.Association;
 import org.qi4j.api.association.AssociationStateHolder;
 import org.qi4j.api.association.ManyAssociation;
 import org.qi4j.api.association.NamedAssociation;
+import org.qi4j.api.common.Optional;
 import org.qi4j.api.entity.EntityBuilder;
 import org.qi4j.api.entity.EntityComposite;
 import org.qi4j.api.entity.EntityReference;
@@ -114,42 +114,6 @@ public class ValueWithAssociationTest extends AbstractQi4jTest
         }
     }
 
-    @Test
-    public void givenEntityInStoreWhenConvertingValueExpectEntityToBeUpdated()
-        throws UnitOfWorkCompletionException
-    {
-        String identity1;
-        String identity2;
-        DualFaced value;
-        try (UnitOfWork uow = module.newUnitOfWork())
-        {
-            EntityBuilder<SimpleName> builder1 = uow.newEntityBuilder( SimpleName.class
);
-            builder1.instance().name().set( "Niclas" );
-            SimpleName simpleEntity = builder1.newInstance();
-            identity1 = simpleEntity.identity().get();
-
-            EntityBuilder<DualFaced> builder2 = uow.newEntityBuilder( DualFaced.class
);
-            DualFaced proto = builder2.instance();
-            proto.name().set( "Hedhman" );
-            proto.simple().set( simpleEntity );
-            proto.simples().add( simpleEntity );
-            proto.namedSimples().put( "niclas", simpleEntity );
-            DualFaced entity = builder2.newInstance();
-            value = spi.toValue( DualFaced.class, entity );
-            uow.complete();
-        }
-
-        SimpleName simple = value.simple().get();
-
-//        ValueBuilder<DualFaced> builder = module.newValueBuilder( DualFaced.class
);
-//        DualFaced prototype = builder.prototype();
-//        prototype.name().set( "Paul" );
-//        DualFaced value = builder.newInstance();
-//        try (UnitOfWork uow = module.newUnitOfWork())
-//        {
-//        }
-    }
-
     public interface SimpleName extends Identity
     {
         Property<String> name();
@@ -159,6 +123,7 @@ public class ValueWithAssociationTest extends AbstractQi4jTest
     {
         Property<String> name();
 
+        @Optional
         Association<SimpleName> simple();
 
         ManyAssociation<SimpleName> simples();

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/59156256/core/spi/src/main/java/org/qi4j/spi/value/ValueSerializerAdapter.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/qi4j/spi/value/ValueSerializerAdapter.java b/core/spi/src/main/java/org/qi4j/spi/value/ValueSerializerAdapter.java
index 8b6246f..c392214 100644
--- a/core/spi/src/main/java/org/qi4j/spi/value/ValueSerializerAdapter.java
+++ b/core/spi/src/main/java/org/qi4j/spi/value/ValueSerializerAdapter.java
@@ -473,7 +473,7 @@ public abstract class ValueSerializerAdapter<OutputType>
             NamedAssociation<?> namedAssociation = state.namedAssociationFor( associationDescriptor.accessor()
);
             onFieldStart( output, associationDescriptor.qualifiedName().name() );
             onValueStart( output );
-            onObjectStart( output );
+            onArrayStart( output );
             for( String name : namedAssociation )
             {
                 onFieldStart( output, name );
@@ -482,7 +482,7 @@ public abstract class ValueSerializerAdapter<OutputType>
                 onValueEnd( output );
                 onFieldEnd( output );
             }
-            onObjectEnd( output );
+            onArrayEnd( output );
             onValueEnd( output );
             onFieldEnd( output );
         }


Mime
View raw message