polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paulmer...@apache.org
Subject [1/8] zest-java git commit: cache clone test, split
Date Mon, 27 Jul 2015 15:12:35 GMT
Repository: zest-java
Updated Branches:
  refs/heads/develop 298282644 -> 5d3d759d5


cache clone test, split


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

Branch: refs/heads/develop
Commit: 965c7694285daa1fab346bd73298419e3f3af09f
Parents: 5378de5
Author: tbml <tibor.mlynarik@adleritech.com>
Authored: Fri Jul 24 06:53:32 2015 +0200
Committer: Paul Merlin <paulmerlin@apache.org>
Committed: Mon Jul 27 17:09:01 2015 +0200

----------------------------------------------------------------------
 .../qi4j/cache/ehcache/JSONEntityStoreTest.java | 32 +++++++++++++++++---
 1 file changed, 27 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/965c7694/extensions/cache-ehcache/src/test/java/org/qi4j/cache/ehcache/JSONEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/cache-ehcache/src/test/java/org/qi4j/cache/ehcache/JSONEntityStoreTest.java
b/extensions/cache-ehcache/src/test/java/org/qi4j/cache/ehcache/JSONEntityStoreTest.java
index 13670c2..14250ce 100644
--- a/extensions/cache-ehcache/src/test/java/org/qi4j/cache/ehcache/JSONEntityStoreTest.java
+++ b/extensions/cache-ehcache/src/test/java/org/qi4j/cache/ehcache/JSONEntityStoreTest.java
@@ -68,7 +68,7 @@ public class JSONEntityStoreTest
     }
 
     @Test
-    public void cacheJSONGlobalStateTest()
+    public void cached_NEW_State()
             throws Exception
     {
 
@@ -78,22 +78,44 @@ public class JSONEntityStoreTest
         b.instance().name().set("account1");
         b.instance().balance().set( BigDecimal.ZERO );
 
-        Account account1 = b.newInstance();
+        String accountId = b.newInstance().identity().get();
 
         uow1.complete();
 
         UnitOfWork uow2 = assembler.module().newUnitOfWork();
-        Account account2 = uow2.get(account1);
+        Account account2 = uow2.get(Account.class, accountId);
+        account2.balance().set( BigDecimal.ONE);
+        uow2.complete();
+
+    }
+
+    @Test
+    public void globalStateClone()
+            throws Exception
+    {
+
+        UnitOfWork uow1 = assembler.module().newUnitOfWork();
+        EntityBuilder<Account> b = uow1.newEntityBuilder(Account.class);
+
+        b.instance().name().set("account1");
+        b.instance().balance().set( BigDecimal.ZERO );
+
+        String accountId = b.newInstance().identity().get();
+
+        uow1.complete();
+
+        UnitOfWork uow2 = assembler.module().newUnitOfWork();
+        Account account2 = uow2.get( Account.class, accountId);
         account2.balance().set( BigDecimal.ONE);
         uow2.complete();
 
         UnitOfWork uow3 = assembler.module().newUnitOfWork();
-        Account account3 = uow3.get(account1);
+        Account account3 = uow3.get( Account.class, accountId);
         account3.balance().set( BigDecimal.TEN);
         uow3.discard();
 
         UnitOfWork uow4 = assembler.module().newUnitOfWork();
-        Account account4 = uow4.get(account1);
+        Account account4 = uow4.get( Account.class, accountId);
 
         assertEquals( BigDecimal.ONE, account4.balance().get());
 


Mime
View raw message