org.apache.ibatis.cache.decorators.LoggingCache Java Examples

The following examples show how to use org.apache.ibatis.cache.decorators.LoggingCache. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BaseCacheTest.java    From mybaties with Apache License 2.0 6 votes vote down vote up
@Test
public void shouldDemonstrateEqualsAndHashCodeForVariousCacheTypes() {
  PerpetualCache cache = new PerpetualCache("test_cache");
  assertTrue(cache.equals(cache));
  assertTrue(cache.equals(new SynchronizedCache(cache)));
  assertTrue(cache.equals(new SerializedCache(cache)));
  assertTrue(cache.equals(new LoggingCache(cache)));
  assertTrue(cache.equals(new ScheduledCache(cache)));

  assertEquals(cache.hashCode(), new SynchronizedCache(cache).hashCode());
  assertEquals(cache.hashCode(), new SerializedCache(cache).hashCode());
  assertEquals(cache.hashCode(), new LoggingCache(cache).hashCode());
  assertEquals(cache.hashCode(), new ScheduledCache(cache).hashCode());

  Set<Cache> caches = new HashSet<Cache>();
  caches.add(cache);
  caches.add(new SynchronizedCache(cache));
  caches.add(new SerializedCache(cache));
  caches.add(new LoggingCache(cache));
  caches.add(new ScheduledCache(cache));
  assertEquals(1, caches.size());
}
 
Example #2
Source File: BaseCacheTest.java    From mybatis with Apache License 2.0 6 votes vote down vote up
@Test
public void shouldDemonstrateEqualsAndHashCodeForVariousCacheTypes() {
  PerpetualCache cache = new PerpetualCache("test_cache");
  assertTrue(cache.equals(cache));
  assertTrue(cache.equals(new SynchronizedCache(cache)));
  assertTrue(cache.equals(new SerializedCache(cache)));
  assertTrue(cache.equals(new LoggingCache(cache)));
  assertTrue(cache.equals(new ScheduledCache(cache)));

  assertEquals(cache.hashCode(), new SynchronizedCache(cache).hashCode());
  assertEquals(cache.hashCode(), new SerializedCache(cache).hashCode());
  assertEquals(cache.hashCode(), new LoggingCache(cache).hashCode());
  assertEquals(cache.hashCode(), new ScheduledCache(cache).hashCode());

  Set<Cache> caches = new HashSet<Cache>();
  caches.add(cache);
  caches.add(new SynchronizedCache(cache));
  caches.add(new SerializedCache(cache));
  caches.add(new LoggingCache(cache));
  caches.add(new ScheduledCache(cache));
  assertEquals(1, caches.size());
}