Package org.infinispan.marshall.core

Examples of org.infinispan.marshall.core.MarshalledEntryImpl


      assert "v2".equals(cache.remove("k2"));
   }

   public void testLoadingToMemory() throws PersistenceException {
      assertNotInCacheAndStore("k1", "k2");
      store.write(new MarshalledEntryImpl("k1", "v1", null, sm));
      store.write(new MarshalledEntryImpl("k2", "v2", null, sm));

      assertInStoreNotInCache("k1", "k2");

      assert "v1".equals(cache.get("k1"));
      assert "v2".equals(cache.get("k2"));
View Full Code Here


      CacheWriter writer = TestingUtil.getFirstWriter(cache2);


      assert cache1.get("key") == null;
      assert cache2.get("key") == null;
      writer.write(new MarshalledEntryImpl("key", "value", null, cache2.getAdvancedCache().getComponentRegistry().getCacheMarshaller()));
      assert ((CacheLoader)writer).load("key").getValue().equals("value");
      assert cache1.get("key").equals("value");
   }
View Full Code Here

      final List<String> keys = new ArrayList<String>(NUM_KEYS);
      for (int j = 0; j < NUM_KEYS; j++) {
         String key = "key" + j;
         String value = key + "_value_" + j;
         keys.add(key);
         MarshalledEntryImpl entry = new MarshalledEntryImpl<String, String>(key, value, null, marshaller);
         store.write(entry);
      }

      final CountDownLatch stopLatch = new CountDownLatch(1);
      Future[] writeFutures = new Future[NUM_WRITER_THREADS];
View Full Code Here

      }
   }

   public void testStoreSizeExceeded() throws Exception {
      assertStoreSize(0, 0);
      store.write(new MarshalledEntryImpl(1, "v1", null, new TestObjectStreamMarshaller()));
      store.write(new MarshalledEntryImpl(2, "v2", null, new TestObjectStreamMarshaller()));
      assertStoreSize(1, 1);
   }
View Full Code Here

   }

   public void testRepeatedLoads() throws PersistenceException {
      CountingStore countingCS = getCountingCacheStore();
      store.write(new MarshalledEntryImpl("k1", "v1", null, marshaller(cache)));

      assert countingCS.numLoads == 0;
      assert countingCS.numContains == 0;

      assert "v1".equals(cache.get("k1"));
View Full Code Here

      if (onCache1) {
         cacheWriter = (CacheWriter) TestingUtil.getCacheLoader(cache1);
      } else {
         cacheWriter = (CacheWriter) TestingUtil.getCacheLoader(cache(1, cacheName()));
      }
      cacheWriter.write(new MarshalledEntryImpl(key, value, null, TestingUtil.marshaller(cache1)));
   }
View Full Code Here

   public static Set<MarshalledEntry> allEntries(AdvancedLoadWriteStore cl) {
      return allEntries(cl, null);
   }

   public static MarshalledEntry marshalledEntry(InternalCacheEntry ice, StreamingMarshaller marshaller) {
      return new MarshalledEntryImpl(ice.getKey(), ice.getValue(), PersistenceUtil.internalMetadata(ice), marshaller);
   }
View Full Code Here

   public static <K, V> void writeToAllStores(K key, V value, Cache<K, V> cache) {
      AdvancedCache<K, V> advCache = cache.getAdvancedCache();
      PersistenceManager pm = advCache.getComponentRegistry().getComponent(PersistenceManager.class);
      StreamingMarshaller marshaller = advCache.getComponentRegistry().getCacheMarshaller();
      pm.writeToAllStores(new MarshalledEntryImpl(key, value, null, marshaller), false);
   }
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

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.