javax.cache.configuration.MutableConfiguration Java Examples
The following examples show how to use
javax.cache.configuration.MutableConfiguration.
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: CacheMBStatisticsBeanTest.java From cache2k with Apache License 2.0 | 6 votes |
@Test public void testExpiryOnCreation() throws Exception { // close cache since need to configure cache with ExpireOnCreationPolicy CacheManager mgr = cache.getCacheManager(); mgr.destroyCache(cache.getName()); MutableConfiguration<Long, String> config = new MutableConfiguration<Long, String>(); config.setStatisticsEnabled(true); config.setTypes(Long.class, String.class); config.setExpiryPolicyFactory(FactoryBuilder.factoryOf(ExpireOnCreationPolicy.class)); cache = mgr.createCache(getTestCacheName(), config); cache.put(1L, "hello"); assertEquals(0L, lookupManagementAttribute(cache, CacheStatistics, "CachePuts")); Map<Long, String> map = new HashMap<Long, String>(); map.put(2L, "goodbye"); map.put(3L, "world"); cache.putAll(map); assertEquals(0L, lookupManagementAttribute(cache, CacheStatistics, "CachePuts")); }
Example #2
Source File: EhCachingProviderTest.java From ehcache3 with Apache License 2.0 | 6 votes |
@Test public void testCacheUsesCacheManagerClassLoaderForDefaultURI() { CachingProvider cachingProvider = Caching.getCachingProvider(); LimitedClassLoader limitedClassLoader = new LimitedClassLoader(cachingProvider.getDefaultClassLoader()); CacheManager cacheManager = cachingProvider.getCacheManager(cachingProvider.getDefaultURI(), limitedClassLoader); MutableConfiguration<Object, Object> configuration = new MutableConfiguration<>(); Cache<Object, Object> cache = cacheManager.createCache("test", configuration); cache.put(1L, new Customer(1L)); try { cache.get(1L); fail("Expected AssertionError"); } catch (AssertionError e) { assertThat(e.getMessage(), is("No com.pany here")); } }
Example #3
Source File: CacheWriterTest.java From blazingcache with Apache License 2.0 | 6 votes |
@Test public void testNoWriteThrough() { CachingProvider cachingProvider = Caching.getCachingProvider(); Properties p = new Properties(); try (CacheManager cacheManager = cachingProvider.getCacheManager(cachingProvider.getDefaultURI(), cachingProvider.getDefaultClassLoader(), p)) { MockCacheWriter external = new MockCacheWriter(); MutableConfiguration<String, String> config = new MutableConfiguration<String, String>() .setTypes(String.class, String.class) .setCacheWriterFactory(new FactoryBuilder.SingletonFactory<>(external)) .setWriteThrough(false); Cache<String, String> cache = cacheManager.createCache("simpleCache", config); String key = "key"; cache.put(key, "some_datum"); String result = external.database.get(key); assertNull(result); } }
Example #4
Source File: CaffeineConfiguration.java From caffeine with Apache License 2.0 | 6 votes |
public CaffeineConfiguration(CompleteConfiguration<K, V> configuration) { delegate = new MutableConfiguration<>(configuration); if (configuration instanceof CaffeineConfiguration<?, ?>) { CaffeineConfiguration<K, V> config = (CaffeineConfiguration<K, V>) configuration; refreshAfterWriteNanos = config.refreshAfterWriteNanos; expireAfterAccessNanos = config.expireAfterAccessNanos; expireAfterWriteNanos = config.expireAfterWriteNanos; executorFactory = config.executorFactory; expiryFactory = config.expiryFactory; copierFactory = config.copierFactory; tickerFactory = config.tickerFactory; weigherFactory = config.weigherFactory; maximumWeight = config.maximumWeight; maximumSize = config.maximumSize; } else { tickerFactory = SYSTEM_TICKER; executorFactory = COMMON_POOL; copierFactory = JAVA_COPIER; } }
Example #5
Source File: ConfigStatsManagementActivationTest.java From ehcache3 with Apache License 2.0 | 6 votes |
@Test public void testManagementDisabledOverriddenFromTemplate() throws Exception { CacheManager cacheManager = provider.getCacheManager(getClass().getResource("/ehcache-107-mbeans-template-config.xml") .toURI(), provider.getDefaultClassLoader()); MutableConfiguration<Long, String> configuration = new MutableConfiguration<>(); configuration.setTypes(Long.class, String.class); configuration.setManagementEnabled(false); configuration.setStatisticsEnabled(false); Cache<Long, String> cache = cacheManager.createCache("enables-mbeans", configuration); @SuppressWarnings("unchecked") Eh107Configuration<Long, String> eh107Configuration = cache.getConfiguration(Eh107Configuration.class); assertThat(eh107Configuration.isManagementEnabled(), is(true)); assertThat(eh107Configuration.isStatisticsEnabled(), is(true)); assertThat(isMbeanRegistered("enables-mbeans", MBEAN_MANAGEMENT_TYPE), is(true)); assertThat(isMbeanRegistered("enables-mbeans", MBEAN_STATISTICS_TYPE), is(true)); }
Example #6
Source File: ConfigurationMergerTest.java From ehcache3 with Apache License 2.0 | 6 votes |
@Test public void jsr107LoaderGetsOverriddenByTemplate() throws Exception { when(jsr107Service.getTemplateNameForCache("cache")).thenReturn("cacheTemplate"); when(xmlConfiguration.newCacheConfigurationBuilderFromTemplate("cacheTemplate", Object.class, Object.class)).thenReturn( newCacheConfigurationBuilder(Object.class, Object.class, heap(10)).withService(new DefaultCacheLoaderWriterConfiguration((Class)null)) ); MutableConfiguration<Object, Object> configuration = new MutableConfiguration<>(); CacheLoader<Object, Object> mock = mock(CacheLoader.class); RecordingFactory<CacheLoader<Object, Object>> factory = factoryOf(mock); configuration.setReadThrough(true).setCacheLoaderFactory(factory); ConfigurationMerger.ConfigHolder<Object, Object> configHolder = merger.mergeConfigurations("cache", configuration); assertThat(factory.called, is(false)); assertThat(configHolder.cacheResources.getCacheLoaderWriter(), nullValue()); }
Example #7
Source File: CacheManagerTest.java From cache2k with Apache License 2.0 | 6 votes |
@Test public void createCacheSameName() { CacheManager cacheManager = getCacheManager(); String name1 = "c1"; cacheManager.createCache(name1, new MutableConfiguration()); Cache cache1 = cacheManager.getCache(name1); assertEquals(cache1, cacheManager.getCache(name1)); ensureOpen(cache1); try { cacheManager.createCache(name1, new MutableConfiguration()); } catch (CacheException e) { //expected } Cache cache2 = cacheManager.getCache(name1); }
Example #8
Source File: JSRExamplesTest.java From blazingcache with Apache License 2.0 | 6 votes |
@Test public void testJSRExample1() { CachingProvider cachingProvider = Caching.getCachingProvider(); Properties p = new Properties(); try (CacheManager cacheManager = cachingProvider.getCacheManager(cachingProvider.getDefaultURI(), cachingProvider.getDefaultClassLoader(), p)) { MutableConfiguration<String, Integer> config = new MutableConfiguration<String, Integer>() .setTypes(String.class, Integer.class) .setExpiryPolicyFactory(AccessedExpiryPolicy.factoryOf(ONE_HOUR)) .setStatisticsEnabled(true); Cache<String, Integer> cache = cacheManager.createCache("simpleCache", config); String key = "key"; Integer value1 = 1; cache.put("key", value1); Integer value2 = cache.get(key); assertEquals(value1, value2); cache.remove(key); assertNull(cache.get(key)); } }
Example #9
Source File: CacheLoaderTest.java From blazingcache with Apache License 2.0 | 6 votes |
@Test public void shouldNotLoadWithNullKeyUsingLoadAll() throws Exception { HashSet<String> keys = new HashSet<>(); keys.add(null); CachingProvider cachingProvider = Caching.getCachingProvider(); Properties p = new Properties(); try (CacheManager cacheManager = cachingProvider.getCacheManager(cachingProvider.getDefaultURI(), cachingProvider.getDefaultClassLoader(), p)) { MutableConfiguration<String, String> config = new MutableConfiguration<String, String>() .setTypes(String.class, String.class) .setCacheLoaderFactory(new FactoryBuilder.ClassFactory(MockCacheLoader.class)) .setReadThrough(true); Cache<String, String> cache = cacheManager.createCache("test", config); CompletionListenerFuture future = new CompletionListenerFuture(); cache.loadAll(keys, false, future); fail("Expected a NullPointerException"); } catch (NullPointerException e) { //SKIP: expected } finally { // assertThat(cacheLoader.getLoadCount(), is(0)); } }
Example #10
Source File: CacheManagerTest.java From cache2k with Apache License 2.0 | 6 votes |
@Test public void getCaches_MutateReturn() { CacheManager cacheManager = getCacheManager(); cacheManager.createCache("c1", new MutableConfiguration()); Cache cache1 = cacheManager.getCache("c1"); try { Iterator iterator = cacheManager.getCacheNames().iterator(); iterator.next(); iterator.remove(); fail(); } catch (UnsupportedOperationException e) { // immutable } }
Example #11
Source File: ConfigStatsManagementActivationTest.java From ehcache3 with Apache License 2.0 | 6 votes |
@Test public void basicJsr107StillWorks() throws Exception { CacheManager cacheManager = provider.getCacheManager(); MutableConfiguration<Long, String> configuration = new MutableConfiguration<>(); configuration.setTypes(Long.class, String.class); configuration.setManagementEnabled(true); configuration.setStatisticsEnabled(true); Cache<Long, String> cache = cacheManager.createCache("cache", configuration); @SuppressWarnings("unchecked") Eh107Configuration<Long, String> eh107Configuration = cache.getConfiguration(Eh107Configuration.class); assertThat(eh107Configuration.isManagementEnabled(), is(true)); assertThat(eh107Configuration.isStatisticsEnabled(), is(true)); assertThat(isMbeanRegistered("cache", MBEAN_MANAGEMENT_TYPE), is(true)); assertThat(isMbeanRegistered("cache", MBEAN_STATISTICS_TYPE), is(true)); }
Example #12
Source File: EhCache107ConfigurationIntegrationDocTest.java From ehcache3 with Apache License 2.0 | 6 votes |
@Test public void testTemplateOverridingStoreByRef() throws Exception { cacheManager = cachingProvider.getCacheManager( getClass().getResource("/org/ehcache/docs/ehcache-jsr107-template-override.xml").toURI(), getClass().getClassLoader()); MutableConfiguration<Long, Client> mutableConfiguration = new MutableConfiguration<>(); mutableConfiguration.setTypes(Long.class, Client.class).setStoreByValue(false); Cache<Long, Client> myCache; Client client1 = new Client("client1", 1); myCache = cacheManager.createCache("anotherCache", mutableConfiguration); myCache.put(1L, client1); assertSame(client1, myCache.get(1L)); myCache = cacheManager.createCache("byValCache", mutableConfiguration); myCache.put(1L, client1); assertNotSame(client1, myCache.get(1L)); }
Example #13
Source File: CacheListenerTest.java From cache2k with Apache License 2.0 | 6 votes |
@Override protected MutableConfiguration<Long, String> extraSetup(MutableConfiguration<Long, String> configuration) { cacheEntryListenerServer = new CacheEntryListenerServer<Long, String>(10011, Long.class, String.class); try { cacheEntryListenerServer.open(); } catch (IOException e) { e.printStackTrace(); } //establish and open a CacheEntryListenerServer to handle cache //cache entry events from a CacheEntryListenerClient listener = new MyCacheEntryListener<Long, String>(); cacheEntryListenerServer.addCacheEventListener(listener); //establish a CacheEntryListenerClient that a Cache can use for CacheEntryListening //(via the CacheEntryListenerServer) CacheEntryListenerClient<Long, String> clientListener = new CacheEntryListenerClient<>(cacheEntryListenerServer.getInetAddress(), cacheEntryListenerServer.getPort()); listenerConfiguration = new MutableCacheEntryListenerConfiguration<Long, String>(FactoryBuilder.factoryOf(clientListener), null, true, true); return configuration.addCacheEntryListenerConfiguration(listenerConfiguration); }
Example #14
Source File: TestJCache.java From jframe with Apache License 2.0 | 6 votes |
@Test public void cacheConfigTest() { CachingProvider provider = Caching.getCachingProvider(); CacheManager cacheManager = provider.getCacheManager(); MutableConfiguration<Long, String> configuration = new MutableConfiguration<Long, String>(); configuration.setTypes(Long.class, String.class); Cache<Long, String> cache = cacheManager.createCache("someCache", configuration); CompleteConfiguration<Long, String> completeConfiguration = cache.getConfiguration(CompleteConfiguration.class); Eh107Configuration<Long, String> eh107Configuration = cache.getConfiguration(Eh107Configuration.class); CacheRuntimeConfiguration<Long, String> runtimeConfiguration = eh107Configuration .unwrap(CacheRuntimeConfiguration.class); }
Example #15
Source File: TCKCacheManagerTest.java From blazingcache with Apache License 2.0 | 6 votes |
@Test public void createCacheSameName() { CacheManager cacheManager = getCacheManager(); String name1 = "c1"; cacheManager.createCache(name1, new MutableConfiguration()); Cache cache1 = cacheManager.getCache(name1); assertEquals(cache1, cacheManager.getCache(name1)); ensureOpen(cache1); try { cacheManager.createCache(name1, new MutableConfiguration()); } catch (CacheException e) { //expected } Cache cache2 = cacheManager.getCache(name1); }
Example #16
Source File: ConfigurationMergerTest.java From ehcache3 with Apache License 2.0 | 6 votes |
@Test public void jsr107DefaultEh107IdentityCopierForImmutableTypesWithCMLevelDefaults() { XmlConfiguration xmlConfiguration = new XmlConfiguration(getClass().getResource("/ehcache-107-immutable-types-cm-level-copiers.xml")); DefaultJsr107Service jsr107Service = new DefaultJsr107Service(ServiceUtils.findSingletonAmongst(Jsr107Configuration.class, xmlConfiguration.getServiceCreationConfigurations())); merger = new ConfigurationMerger(xmlConfiguration, jsr107Service, mock(Eh107CacheLoaderWriterProvider.class)); MutableConfiguration<Long, String> stringCacheConfiguration = new MutableConfiguration<>(); stringCacheConfiguration.setTypes(Long.class, String.class); ConfigurationMerger.ConfigHolder<Long, String> configHolder1 = merger.mergeConfigurations("stringCache", stringCacheConfiguration); assertThat(configHolder1.cacheConfiguration.getServiceConfigurations().isEmpty(), is(true)); for (ServiceCreationConfiguration<?, ?> serviceCreationConfiguration : xmlConfiguration.getServiceCreationConfigurations()) { if (serviceCreationConfiguration instanceof DefaultCopyProviderConfiguration) { DefaultCopyProviderConfiguration copierConfig = (DefaultCopyProviderConfiguration)serviceCreationConfiguration; assertThat(copierConfig.getDefaults().size(), is(6)); assertThat(copierConfig.getDefaults().get(Long.class).getClazz().isAssignableFrom(IdentityCopier.class), is(true)); assertThat(copierConfig.getDefaults().get(String.class).getClazz().isAssignableFrom(Eh107IdentityCopier.class), is(true)); assertThat(copierConfig.getDefaults().get(Float.class).getClazz().isAssignableFrom(Eh107IdentityCopier.class), is(true)); assertThat(copierConfig.getDefaults().get(Double.class).getClazz().isAssignableFrom(Eh107IdentityCopier.class), is(true)); assertThat(copierConfig.getDefaults().get(Character.class).getClazz().isAssignableFrom(Eh107IdentityCopier.class), is(true)); assertThat(copierConfig.getDefaults().get(Integer.class).getClazz().isAssignableFrom(Eh107IdentityCopier.class), is(true)); } } }
Example #17
Source File: EhCache107ConfigurationIntegrationDocTest.java From ehcache3 with Apache License 2.0 | 6 votes |
@Test public void basicConfiguration() throws Exception { // tag::basicConfigurationExample[] CachingProvider provider = Caching.getCachingProvider(); // <1> CacheManager cacheManager = provider.getCacheManager(); // <2> MutableConfiguration<Long, String> configuration = new MutableConfiguration<Long, String>() // <3> .setTypes(Long.class, String.class) // <4> .setStoreByValue(false) // <5> .setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(Duration.ONE_MINUTE)); // <6> Cache<Long, String> cache = cacheManager.createCache("jCache", configuration); // <7> cache.put(1L, "one"); // <8> String value = cache.get(1L); // <9> // end::basicConfigurationExample[] assertThat(value, is("one")); }
Example #18
Source File: CacheHelper.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
public static <K, V> MutableConfiguration<K, V> createCacheConfig( @Nullable final Class<K> keyType, @Nullable final Class<V> valueType, final Factory<? extends ExpiryPolicy> expiryPolicyFactory) { MutableConfiguration<K, V> config = new MutableConfiguration<K, V>() .setStoreByValue(false) .setExpiryPolicyFactory(expiryPolicyFactory) .setManagementEnabled(true) .setStatisticsEnabled(true); if (keyType != null && valueType != null) { config.setTypes(keyType, valueType); } return config; }
Example #19
Source File: CacheConfiguration.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override public MutableConfiguration<K, V> addCacheEntryListenerConfiguration( CacheEntryListenerConfiguration<K, V> cacheEntryLsnrCfg) { synchronized (this) { return super.addCacheEntryListenerConfiguration(cacheEntryLsnrCfg); } }
Example #20
Source File: CacheLoaderTest.java From blazingcache with Apache License 2.0 | 5 votes |
@Test public void testLoadallNoReplaceExisting() throws Exception { CachingProvider cachingProvider = Caching.getCachingProvider(); Properties p = new Properties(); try (CacheManager cacheManager = cachingProvider.getCacheManager(cachingProvider.getDefaultURI(), cachingProvider.getDefaultClassLoader(), p)) { MutableConfiguration<String, String> config = new MutableConfiguration<String, String>() .setTypes(String.class, String.class) .setCacheLoaderFactory(new FactoryBuilder.ClassFactory(MockCacheLoader.class)) .setReadThrough(false); Cache<String, String> cache = cacheManager.createCache("simpleCache", config); cache.put("one", "not_to_be_replaced"); Set<String> keys = new HashSet<>(); keys.add("one"); keys.add("two"); keys.add("three"); CompletionListenerFuture future = new CompletionListenerFuture(); cache.loadAll(keys, false, future); future.get(); for (String key : keys) { String result = cache.get(key); if (key.equals("one")) { assertEquals("not_to_be_replaced", result); } else { assertEquals("LOADED_" + key, result); } } } }
Example #21
Source File: TCKCacheManagerTest.java From blazingcache with Apache License 2.0 | 5 votes |
@Test public void removeCache_There() { CacheManager cacheManager = getCacheManager(); String name1 = "c1"; cacheManager.createCache(name1, new MutableConfiguration()); cacheManager.destroyCache(name1); assertFalse(cacheManager.getCacheNames().iterator().hasNext()); }
Example #22
Source File: TCKCacheManagerTest.java From blazingcache with Apache License 2.0 | 5 votes |
@Test public void createCache_Different() { String name1 = "c1"; CacheManager cacheManager = getCacheManager(); cacheManager.createCache(name1, new MutableConfiguration()); Cache cache1 = cacheManager.getCache(name1); String name2 = "c2"; cacheManager.createCache(name2, new MutableConfiguration()); Cache cache2 = cacheManager.getCache(name2); assertEquals(cache1, cacheManager.getCache(name1)); assertEquals(cache2, cacheManager.getCache(name2)); }
Example #23
Source File: CacheManagerTest.java From cache2k with Apache License 2.0 | 5 votes |
@Test public void create_empty_config() { CachingProvider p = Caching.getCachingProvider(); CacheManager cm = p.getCacheManager(); MutableConfiguration<String, BigDecimal> mc = new ExtendedMutableConfiguration<String, BigDecimal>(); mc.setTypes(String.class, BigDecimal.class); Cache<String, BigDecimal> c = cm.createCache("aCache", mc); assertEquals("aCache", c.getName()); assertEquals(String.class, c.getConfiguration(Configuration.class).getKeyType()); assertEquals(BigDecimal.class, c.getConfiguration(Configuration.class).getValueType()); c.close(); }
Example #24
Source File: TCKCacheManagerTest.java From blazingcache with Apache License 2.0 | 5 votes |
@Test public void containsKeyShouldNotCallExpiryPolicyMethods() { CountingExpiryPolicy expiryPolicy = new CountingExpiryPolicy(); MutableConfiguration<Integer, Integer> config = new MutableConfiguration<>(); config.setExpiryPolicyFactory(FactoryBuilder.factoryOf(expiryPolicy)); Cache<Integer, Integer> cache = getCacheManager().createCache("test", config); cache.containsKey(1); assertThat(expiryPolicy.getCreationCount(), is(0)); assertThat(expiryPolicy.getAccessCount(), is(0)); assertThat(expiryPolicy.getUpdatedCount(), is(0)); cache.put(1, 1); assertTrue(expiryPolicy.getCreationCount() >= 1); assertThat(expiryPolicy.getAccessCount(), is(0)); assertThat(expiryPolicy.getUpdatedCount(), is(0)); expiryPolicy.resetCount(); cache.containsKey(1); assertThat(expiryPolicy.getCreationCount(), is(0)); assertThat(expiryPolicy.getAccessCount(), is(0)); assertThat(expiryPolicy.getUpdatedCount(), is(0)); }
Example #25
Source File: CacheManagerTest.java From cache2k with Apache License 2.0 | 5 votes |
@Test(expected = IllegalArgumentException.class) public void create_cache2k_config_key_type_mismatch() { CachingProvider p = Caching.getCachingProvider(); CacheManager cm = p.getCacheManager(); MutableConfiguration cfg = ExtendedMutableConfiguration.of(new Cache2kBuilder<Long, Double>(){}); Cache<Integer, Double> cache = cm.createCache("aCache", cfg.setTypes(Integer.class, Double.class)); cache.close(); }
Example #26
Source File: ConfigurationMergerTest.java From ehcache3 with Apache License 2.0 | 5 votes |
@Test public void loadsTemplateWhenNameFound() throws Exception { when(jsr107Service.getTemplateNameForCache("cache")).thenReturn("cacheTemplate"); merger.mergeConfigurations("cache", new MutableConfiguration<>()); verify(xmlConfiguration).newCacheConfigurationBuilderFromTemplate("cacheTemplate", Object.class, Object.class); }
Example #27
Source File: TCKCacheManagerTest.java From blazingcache with Apache License 2.0 | 5 votes |
@Test public void createCache_Same() { String name = "c1"; CacheManager cacheManager = getCacheManager(); try { cacheManager.createCache(name, new MutableConfiguration()); Cache cache1 = cacheManager.getCache(name); cacheManager.createCache(name, new MutableConfiguration()); Cache cache2 = cacheManager.getCache(name); fail(); } catch (CacheException exception) { //expected } }
Example #28
Source File: LoaderWriterConfigTest.java From ehcache3 with Apache License 2.0 | 5 votes |
private MutableConfiguration<Long, String> getConfiguration(final boolean readThrough, final CacheLoader<Long, String> cacheLoader, final boolean writeThrough, final CacheWriter<Long, String> cacheWriter) { MutableConfiguration<Long, String> config = new MutableConfiguration<>(); config.setTypes(Long.class, String.class); config.setReadThrough(readThrough); config.setCacheLoaderFactory(() -> cacheLoader); config.setWriteThrough(writeThrough); config.setCacheWriterFactory(() -> cacheWriter); return config; }
Example #29
Source File: SerializableEntityCache.java From requery with Apache License 2.0 | 5 votes |
protected <K, T> Cache<K, SerializedEntity<T>> createCache(String cacheName, Type<T> type) { Class keyClass = getKeyClass(type); if (keyClass == null) { throw new IllegalStateException(); } MutableConfiguration<K, SerializedEntity<T>> configuration = new MutableConfiguration<>(); configuration.setTypes(keyClass, (Class) SerializedEntity.class); configure(configuration); return cacheManager.createCache(cacheName, configuration); }
Example #30
Source File: TestCollector.java From javamelody with Apache License 2.0 | 5 votes |
/** Test. * @throws SchedulerException e */ @Test public void testToString() throws SchedulerException { final Collector collector = createCollectorWithOneCounter(); assertToStringNotEmpty("collector", collector); assertToStringNotEmpty("java", new JavaInformations(null, false)); assertToStringNotEmpty("thread", new ThreadInformations(Thread.currentThread(), Arrays.asList(Thread.currentThread().getStackTrace()), 100, 1000, false, Parameters.getHostAddress())); assertToStringNotEmpty("session", new SessionInformations(new SessionTestImpl(true), true)); assertToStringNotEmpty("memory", new MemoryInformations()); CacheManager.getInstance().addCache("testToString"); try { assertToStringNotEmpty("cache", new CacheInformations( CacheManager.getInstance().getEhcache("testToString"), false)); } finally { CacheManager.getInstance().shutdown(); } final MutableConfiguration<Object, Object> conf = new MutableConfiguration<Object, Object>(); conf.setManagementEnabled(true); conf.setStatisticsEnabled(true); Caching.getCachingProvider().getCacheManager().createCache("cache", conf); try { assertToStringNotEmpty("cache", new JCacheInformations("cache")); } finally { Caching.getCachingProvider().getCacheManager().close(); } final Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler(); final JobDetail job = new JobDetail("job", null, JobTestImpl.class); assertToStringNotEmpty("job", new JobInformations(job, null, scheduler)); assertToStringNotEmpty("connectionInfos", new ConnectionInformations()); }