InfinispanPropertyCache implements PropertyService, ServiceLifecycle { @Override public Property get(String tenantId, String id) { Property<?> property = propertyCache.get(id); if (property == null) { property = getFromSystemOrEnvVariables(id); if (property == null) { return null; } try { store(tenantId, property); } catch (CacheException e) { log.severe(String.format("Could not store environmental property: %s to cache", property)); } } if (log.isLoggable(Level.FINEST)) { log.finest("Get property [id=" + id + "] = " + property); } return property; } InfinispanPropertyCache();  InfinispanPropertyCache(CacheContainer cacheContainer); @Override @PostConstruct void init(); @Override Property get(String tenantId, String id); @Override void store(String tenantId, List<Property<?>> properties); @Override void store(String tenantId, Property<?> property); @Override void remove(String tenantId, String id); @Override void addObserver(String tenantId, String id, Observer observer); @Override void removeObserver(String tenantId, String id, Observer observer);  }
@Test public void testGetNonExisting() { Property property = propertyCache.get(null, "id"); Assert.assertNull(property); }
@Test public void testSystemProp() { System.setProperty("strProp", "foo"); Assert.assertEquals("foo", propertyCache.get(null, "strProp").getValue()); System.clearProperty("strProp"); System.setProperty("intProp", "2"); Assert.assertEquals("2", propertyCache.get(null, "intProp").getValue()); System.clearProperty("intProp"); }