Java Code Examples for org.ehcache.core.spi.store.tiering.CachingTier

Following code examples demonstrate how to use org.ehcache.core.spi.store.tiering.CachingTier from ehcache. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use org.ehcache.core.spi.store.tiering.CachingTier and various code implementation of this class.
Example 1
Project : ehcache Source File : ServiceProviderTest.java View Source Code on GitHub

  public void testSupportsMultipleAuthoritativeTierProviders() throws Exception {

    ServiceLocator.DependencySet dependencySet = dependencySet();

    OnHeapStore.Provider cachingTierProvider = new OnHeapStore.Provider();
    OffHeapStore.Provider authoritativeTierProvider = new OffHeapStore.Provider();
    OffHeapDiskStore.Provider diskStoreProvider = new OffHeapDiskStore.Provider();

    dependencySet.with(cachingTierProvider);
    dependencySet.with(authoritativeTierProvider);
    dependencySet.with(diskStoreProvider);
    dependencySet.with(mock(DiskResourceService.class));

    ServiceLocator serviceLocator = dependencySet.build();
    serviceLocator.startAllServices();

    assertThat(serviceLocator.getServicesOfType(CachingTier.Provider.class),
      IsCollectionContaining.<CachingTier.Provider>hasItem(IsSame.<CachingTier.Provider>sameInstance(cachingTierProvider)));
    assertThat(serviceLocator.getServicesOfType(AuthoritativeTier.Provider.class),
      IsCollectionContaining.<AuthoritativeTier.Provider>hasItem(IsSame.<AuthoritativeTier.Provider>sameInstance(authoritativeTierProvider)));
    assertThat(serviceLocator.getServicesOfType(OffHeapDiskStore.Provider.class),
      IsCollectionContaining.<OffHeapDiskStore.Provider>hasItem(IsSame.<OffHeapDiskStore.Provider>sameInstance(diskStoreProvider)));
  }