polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject zest-qi4j git commit: Added testcase from ZEST-23
Date Fri, 12 Jun 2015 01:07:36 GMT
Repository: zest-qi4j
Updated Branches:
  refs/heads/develop cf53af164 -> b4e655ff2


Added testcase from 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/b4e655ff
Tree: http://git-wip-us.apache.org/repos/asf/zest-qi4j/tree/b4e655ff
Diff: http://git-wip-us.apache.org/repos/asf/zest-qi4j/diff/b4e655ff

Branch: refs/heads/develop
Commit: b4e655ff20e7209c9bbd39528d8ebba4816194df
Parents: cf53af1
Author: Niclas Hedhman <niclas@hedhman.org>
Authored: Fri Jun 12 09:07:18 2015 +0800
Committer: Niclas Hedhman <niclas@hedhman.org>
Committed: Fri Jun 12 09:07:18 2015 +0800

----------------------------------------------------------------------
 .../value/ValueSerializationRegressionTest.java | 59 ++++++++++++++++++++
 1 file changed, 59 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b4e655ff/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
new file mode 100644
index 0000000..799e7b3
--- /dev/null
+++ b/core/runtime/src/test/java/org/qi4j/runtime/value/ValueSerializationRegressionTest.java
@@ -0,0 +1,59 @@
+package org.qi4j.runtime.value;
+
+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.entity.Identity;
+import org.qi4j.api.property.Property;
+import org.qi4j.api.unitofwork.UnitOfWorkCompletionException;
+import org.qi4j.api.value.ValueBuilder;
+import org.qi4j.api.value.ValueSerialization;
+import org.qi4j.bootstrap.AssemblyException;
+import org.qi4j.bootstrap.ModuleAssembly;
+import org.qi4j.entitystore.memory.MemoryEntityStoreService;
+import org.qi4j.spi.uuid.UuidIdentityGeneratorService;
+import org.qi4j.test.AbstractQi4jTest;
+import org.qi4j.valueserialization.orgjson.OrgJsonValueSerializationService;
+
+public class ValueSerializationRegressionTest extends AbstractQi4jTest
+{
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        module.entities( SimpleEntity.class );
+        module.entities( DualFaced.class );
+        module.values( DualFaced.class );
+        module.services( MemoryEntityStoreService.class );
+        module.services( UuidIdentityGeneratorService.class );
+        module.services( OrgJsonValueSerializationService.class ).taggedWith( ValueSerialization.Formats.JSON
);
+    }
+
+    @Test
+    public void givenNewValueWhenConvertingToEntityExpectNewEntityInStore()
+        throws UnitOfWorkCompletionException
+    {
+        ValueBuilder<DualFaced> builder = module.newValueBuilder( DualFaced.class );
+        builder.prototype().identity().set( "1234" );
+        builder.prototype().name().set( "Hedhman" );
+        DualFaced value = builder.newInstance();
+    }
+
+    public interface SimpleEntity extends Identity
+    {
+        Property<String> name();
+    }
+
+    public interface DualFaced extends Identity
+    {
+        Property<String> name();
+
+        Association<SimpleEntity> simple();
+
+        ManyAssociation<SimpleEntity> simples();
+
+        NamedAssociation<SimpleEntity> namedSimples();
+    }
+}
+


Mime
View raw message