Package org.infinispan.marshall.core

Examples of org.infinispan.marshall.core.MarshalledEntryImpl


      assertStringsRowCount(0);
      TestingUtil.killCacheManagers(cacheManager);
   }

   public void testMixedStore() throws Exception {
      cacheStore.write(new MarshalledEntryImpl("String", "someValue", null, getMarshaller()));
      assertStringsRowCount(1);
      assertBinaryRowCount(0);
      cacheStore.write(new MarshalledEntryImpl(MIRCEA, "value", null, getMarshaller()));
      assertStringsRowCount(1);
      assertStringsRowCount(1);
      assert cacheStore.load(MIRCEA).getValue().equals("value");
      assert cacheStore.load("String").getValue().equals("someValue");
   }
View Full Code Here


   public void testMultipleEntriesWithSameHashCode() throws Exception {
      Person one = new Person("Mircea", "Markus", 28);
      Person two = new Person("Manik", "Surtani", 28);
      one.setHashCode(100);
      two.setHashCode(100);
      cacheStore.write(new MarshalledEntryImpl(one, "value", null, getMarshaller()));
      assertBinaryRowCount(1);
      assertStringsRowCount(0);
      cacheStore.write(new MarshalledEntryImpl(two, "otherValue",null, getMarshaller()));
      assertBinaryRowCount(1); //both go to same bucket
      assertStringsRowCount(0);
      assert cacheStore.load(one).getValue().equals("value");
      assert cacheStore.load(two).getValue().equals("otherValue");
   }
View Full Code Here

      assert cacheStore.load(one).getValue().equals("value");
      assert cacheStore.load(two).getValue().equals("otherValue");
   }

   public void testClear() throws Exception {
      cacheStore.write(new MarshalledEntryImpl("String", "someValue",null, getMarshaller()));
      assertRowCounts(0, 1);
      cacheStore.write(new MarshalledEntryImpl(MIRCEA, "value", null, getMarshaller()));
      assertRowCounts(1, 1);
      cacheStore.clear();
      assertRowCounts(0, 0);
   }
View Full Code Here

      cacheStore.clear();
      assertRowCounts(0, 0);
   }

   private MarshalledEntryImpl marshalledEntry(Object key, Object value) {
      return new MarshalledEntryImpl(key, value, null, getMarshaller());
   }
View Full Code Here

   private MarshalledEntryImpl marshalledEntry(Object key, Object value) {
      return new MarshalledEntryImpl(key, value, null, getMarshaller());
   }

   public void testLoadAll() throws Exception {
      MarshalledEntryImpl first = marshalledEntry("String", "someValue");
      MarshalledEntryImpl second = marshalledEntry("String2", "someValue");
      MarshalledEntryImpl third = marshalledEntry(MIRCEA, "value1");
      MarshalledEntryImpl forth = marshalledEntry(MANIK, "value2");
      cacheStore.write(first);
      cacheStore.write(second);
      cacheStore.write(third);
      cacheStore.write(forth);
      assertRowCounts(2, 2);
View Full Code Here

      assert entries.contains(forth);
   }


   public void testPurgeExpired() throws Exception {
      MarshalledEntryImpl first = new MarshalledEntryImpl("String", "someValue", internalMetadata(1000l, null), getMarshaller());
      MarshalledEntryImpl second = new MarshalledEntryImpl(MIRCEA, "value1", internalMetadata(1000l, null), getMarshaller());
      cacheStore.write(first);
      cacheStore.write(second);
      assertRowCounts(1, 1);
      Thread.sleep(1200);
      cacheStore.purge(new WithinThreadExecutor(), null);
View Full Code Here

      cacheStore.purge(new WithinThreadExecutor(), null);
      assertRowCounts(0, 0);
   }

   public void testPurgeExpiredWithRemainingEntries() throws Exception {
      MarshalledEntryImpl first = new MarshalledEntryImpl("String", "someValue", internalMetadata(1000l, null), getMarshaller());
      MarshalledEntryImpl second = marshalledEntry("String2", "someValue");
      MarshalledEntryImpl third = new MarshalledEntryImpl(MIRCEA, "value1", internalMetadata(1000l, null), getMarshaller());
      MarshalledEntryImpl forth = marshalledEntry(MANIK, "value1");;

      cacheStore.write(first);
      cacheStore.write(second);
      cacheStore.write(third);
      cacheStore.write(forth);
View Full Code Here

   protected StreamingMarshaller getMarshaller() {
      return marshaller;
   }

   private MarshalledEntryImpl createEntry(Object key, Object value) {
      return new MarshalledEntryImpl(key, value, null, getMarshaller());
   }
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.