Package org.infinispan.marshall.core

Examples of org.infinispan.marshall.core.MarshalledEntryImpl


         public Void call() throws Exception {
            for (Object key : batch) {
               if (taskContext.isStopped())
                  break;
               MarshalledEntry marshalledEntry = !loadEntry && !loadMetadata ?
                     new MarshalledEntryImpl(key, (Object) null, null, ctx.getMarshaller()) :
                     load(key);
               if (marshalledEntry != null) {
                  cacheLoaderTask.processEntry(marshalledEntry, taskContext);
               }
            }
View Full Code Here


   public MarshalledEntry load(Object key) {
      try {
         InternalCacheEntry load = loader.load(key);
         if (load == null)
            return null;
         return new MarshalledEntryImpl(key, load.getValue(), new InternalMetadataImpl(load), ctx.getMarshaller());
      } catch (CacheLoaderException e) {
         throw newPersistenceException(e);
      }
   }
View Full Code Here

   }

   public void testStoreWithJpaGoodKey() {
     TestObject obj = createTestObject("testStoreWithJpaGoodKey");
     assertFalse(cs.contains(obj.getKey()));
     MarshalledEntryImpl me = createEntry(obj);
     cs.write(me);
   }
View Full Code Here

   }

   public void testLoadAndStoreImmortal() {
      TestObject obj = createTestObject("testLoadAndStoreImmortal");
      assertFalse(cs.contains(obj.getKey()));
      MarshalledEntryImpl me = createEntry(obj);
      cs.write(me);

      assertTrue(cs.contains(obj.getKey()));
      assertEquals(obj.getValue(), cs.load(obj.getKey()).getValue());
      assertNull(cs.load(obj.getKey()).getMetadata());
View Full Code Here

   public void testActivationOnGet(Method m) throws Exception {
      assertActivationCount(0);
      assert cache.get(k(m)) == null;
      assertActivationCount(0);
      loader.write(new MarshalledEntryImpl(k(m), v(m), null, marshaller()));
      assert loader.contains(k(m));
      assert cache.get(k(m)).equals(v(m));
      assertActivationCount(1);
      assert !loader.contains(k(m));
   }
View Full Code Here

   public void testActivationOnPut(Method m) throws Exception {
      assertActivationCount(0);
      assert cache.get(k(m)) == null;
      assertActivationCount(0);
      loader.write(new MarshalledEntryImpl(k(m), v(m), null, marshaller()));
      assert loader.contains(k(m));
      cache.put(k(m), v(m, 2));
      assert cache.get(k(m)).equals(v(m, 2));
      assertActivationCount(1);
      assert !loader.contains(k(m)) : "this should only be persisted on evict";
View Full Code Here

   public void testActivationOnReplace(Method m) throws Exception {
      assertActivationCount(0);
      assert cache.get(k(m)) == null;
      assertActivationCount(0);
      loader.write(new MarshalledEntryImpl(k(m), v(m), null, marshaller()));
      assert loader.contains(k(m));
      assert cache.replace(k(m), v(m, 2)).equals(v(m));
      assertActivationCount(1);
      assert !loader.contains(k(m));
   }
View Full Code Here

   public void testActivationOnPutMap(Method m) throws Exception {
      assertActivationCount(0);
      assert cache.get(k(m)) == null;
      assertActivationCount(0);
      loader.write(new MarshalledEntryImpl(k(m), v(m), null, marshaller()));
      assert loader.contains(k(m));

      Map<String, String> toAdd = new HashMap<String, String>();
      toAdd.put(k(m), v(m, 2));
      cache.putAll(toAdd);
View Full Code Here

      cache.put("key", "value");
      assertStoreAccess(0, 0, 1);
      cache.put("key", "value2");
      assertStoreAccess(0, 0, 2);

      store.write(new MarshalledEntryImpl("a", "b", null, marshaller()));
      cache.put("a", "c");
      assertStoreAccess(1, 0, 3);
      assert store.load("a").getValue().equals("c");
   }
View Full Code Here

      assertStoreAccess(0, 0, 1);

      assert cache.get("key").equals("value");
      assertStoreAccess(0, 0, 1);

      store.write(new MarshalledEntryImpl("a", "b", null, marshaller()));
      assert cache.get("a").equals("b");
      assertStoreAccess(1, 0, 1);

      assert cache.get("no_such_key") == null;
      assertStoreAccess(1, 1, 1);
View Full Code Here

TOP

Related Classes of org.infinispan.marshall.core.MarshalledEntryImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.