target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void testEquals() { Element element = new Element("key", "value"); assertFalse(element.equals("dog")); assertTrue(element.equals(element)); assertFalse(element.equals(null)); assertFalse(element.equals(new Element("cat", "hat"))); } | public final boolean equals(Object object) { if (object == null || !(object instanceof Element)) { return false; } Element element = (Element) object; if (key == null || element.getObjectKey() == null) { return false; } return key.equals(element.getObjectKey()); } | Element implements Serializable, Cloneable { public final boolean equals(Object object) { if (object == null || !(object instanceof Element)) { return false; } Element element = (Element) object; if (key == null || element.getObjectKey() == null) { return false; } return key.equals(element.getObjectKey()); } } | Element implements Serializable, Cloneable { public final boolean equals(Object object) { if (object == null || !(object instanceof Element)) { return false; } Element element = (Element) object; if (key == null || element.getObjectKey() == null) { return false; } return key.equals(element.getObjectKey()); } Element(Se... | Element implements Serializable, Cloneable { public final boolean equals(Object object) { if (object == null || !(object instanceof Element)) { return false; } Element element = (Element) object; if (key == null || element.getObjectKey() == null) { return false; } return key.equals(element.getObjectKey()); } Element(Se... | Element implements Serializable, Cloneable { public final boolean equals(Object object) { if (object == null || !(object instanceof Element)) { return false; } Element element = (Element) object; if (key == null || element.getObjectKey() == null) { return false; } return key.equals(element.getObjectKey()); } Element(Se... |
@Test public void testMaximumDatagram() throws IOException { String payload = createReferenceString(); final byte[] compressed = PayloadUtil.gzip(payload.getBytes()); int length = compressed.length; LOG.info("gzipped size: " + length); assertTrue("Heartbeat too big for one Datagram " + length, length <= 1500); } | public static byte[] gzip(byte[] ungzipped) { final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); try { final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(bytes); gzipOutputStream.write(ungzipped); gzipOutputStream.close(); } catch (IOException e) { LOG.severe("Could not gzip " + ungzipped); } ... | PayloadUtil { public static byte[] gzip(byte[] ungzipped) { final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); try { final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(bytes); gzipOutputStream.write(ungzipped); gzipOutputStream.close(); } catch (IOException e) { LOG.severe("Could not gzip " + ... | PayloadUtil { public static byte[] gzip(byte[] ungzipped) { final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); try { final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(bytes); gzipOutputStream.write(ungzipped); gzipOutputStream.close(); } catch (IOException e) { LOG.severe("Could not gzip " + ... | PayloadUtil { public static byte[] gzip(byte[] ungzipped) { final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); try { final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(bytes); gzipOutputStream.write(ungzipped); gzipOutputStream.close(); } catch (IOException e) { LOG.severe("Could not gzip " + ... | PayloadUtil { public static byte[] gzip(byte[] ungzipped) { final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); try { final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(bytes); gzipOutputStream.write(ungzipped); gzipOutputStream.close(); } catch (IOException e) { LOG.severe("Could not gzip " + ... |
@Test public void testGzipSanityAndPerformance() throws IOException, InterruptedException { String payload = createReferenceString(); for (int i = 0; i < 10; i++) { byte[] compressed = PayloadUtil.gzip(payload.getBytes()); assertTrue(compressed.length > 300); Thread.sleep(20); } int hashCode = payload.hashCode(); StopW... | public static byte[] gzip(byte[] ungzipped) { final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); try { final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(bytes); gzipOutputStream.write(ungzipped); gzipOutputStream.close(); } catch (IOException e) { LOG.severe("Could not gzip " + ungzipped); } ... | PayloadUtil { public static byte[] gzip(byte[] ungzipped) { final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); try { final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(bytes); gzipOutputStream.write(ungzipped); gzipOutputStream.close(); } catch (IOException e) { LOG.severe("Could not gzip " + ... | PayloadUtil { public static byte[] gzip(byte[] ungzipped) { final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); try { final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(bytes); gzipOutputStream.write(ungzipped); gzipOutputStream.close(); } catch (IOException e) { LOG.severe("Could not gzip " + ... | PayloadUtil { public static byte[] gzip(byte[] ungzipped) { final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); try { final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(bytes); gzipOutputStream.write(ungzipped); gzipOutputStream.close(); } catch (IOException e) { LOG.severe("Could not gzip " + ... | PayloadUtil { public static byte[] gzip(byte[] ungzipped) { final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); try { final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(bytes); gzipOutputStream.write(ungzipped); gzipOutputStream.close(); } catch (IOException e) { LOG.severe("Could not gzip " + ... |
@Test public void testGetCache() throws CacheException { CacheManager manager = new CacheManager(new Configuration().cache(new CacheConfiguration("foo", 100))); try { assertNotNull(manager.getCache("foo")); } finally { manager.shutdown(); } } | public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); Ehcache ehcache = ehcaches.get(name); return ehcache instanceof Cache ? (Cache) ehcache : null; } | CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); Ehcache ehcache = ehcaches.get(name); return ehcache instanceof Cache ? (Cache) ehcache : null; } } | CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); Ehcache ehcache = ehcaches.get(name); return ehcache instanceof Cache ? (Cache) ehcache : null; } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL ... | CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); Ehcache ehcache = ehcaches.get(name); return ehcache instanceof Cache ? (Cache) ehcache : null; } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL ... | CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); Ehcache ehcache = ehcaches.get(name); return ehcache instanceof Cache ? (Cache) ehcache : null; } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL ... |
@Test public void testDeleteElement() throws Exception { long beforeCreated = System.currentTimeMillis(); Thread.sleep(10); String originalString = "The rain in Spain falls mainly on the plain"; ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(originalString.getBytes()); int status = HttpUtil.put("h... | @DELETE public void deleteElement() throws NotFoundException { LOG.log(Level.FINE, "DELETE element {0}", element); net.sf.ehcache.Cache ehcache = lookupCache(); if (element.equals("*")) { ehcache.removeAll(); } else { boolean removed = ehcache.remove(element); if (!removed) { throw new NotFoundException("Element " + el... | ElementResource { @DELETE public void deleteElement() throws NotFoundException { LOG.log(Level.FINE, "DELETE element {0}", element); net.sf.ehcache.Cache ehcache = lookupCache(); if (element.equals("*")) { ehcache.removeAll(); } else { boolean removed = ehcache.remove(element); if (!removed) { throw new NotFoundExcepti... | ElementResource { @DELETE public void deleteElement() throws NotFoundException { LOG.log(Level.FINE, "DELETE element {0}", element); net.sf.ehcache.Cache ehcache = lookupCache(); if (element.equals("*")) { ehcache.removeAll(); } else { boolean removed = ehcache.remove(element); if (!removed) { throw new NotFoundExcepti... | ElementResource { @DELETE public void deleteElement() throws NotFoundException { LOG.log(Level.FINE, "DELETE element {0}", element); net.sf.ehcache.Cache ehcache = lookupCache(); if (element.equals("*")) { ehcache.removeAll(); } else { boolean removed = ehcache.remove(element); if (!removed) { throw new NotFoundExcepti... | ElementResource { @DELETE public void deleteElement() throws NotFoundException { LOG.log(Level.FINE, "DELETE element {0}", element); net.sf.ehcache.Cache ehcache = lookupCache(); if (element.equals("*")) { ehcache.removeAll(); } else { boolean removed = ehcache.remove(element); if (!removed) { throw new NotFoundExcepti... |
@Test public void testGetElement() throws Exception { HttpURLConnection result = HttpUtil.get("http: assertEquals(200, result.getResponseCode()); assertEquals("application/xml", result.getContentType()); JAXBContext jaxbContext = new JAXBContextResolver().getContext(Caches.class); Unmarshaller unmarshaller = jaxbContex... | @GET public Response getElement() throws NotFoundException { LOG.log(Level.FINE, "GET element {}", element); net.sf.ehcache.Cache ehcache = lookupCache(); net.sf.ehcache.Element ehcacheElement = lookupElement(ehcache); Element localElement = new Element(ehcacheElement, uriInfo.getAbsolutePath().toString()); Date lastMo... | ElementResource { @GET public Response getElement() throws NotFoundException { LOG.log(Level.FINE, "GET element {}", element); net.sf.ehcache.Cache ehcache = lookupCache(); net.sf.ehcache.Element ehcacheElement = lookupElement(ehcache); Element localElement = new Element(ehcacheElement, uriInfo.getAbsolutePath().toStri... | ElementResource { @GET public Response getElement() throws NotFoundException { LOG.log(Level.FINE, "GET element {}", element); net.sf.ehcache.Cache ehcache = lookupCache(); net.sf.ehcache.Element ehcacheElement = lookupElement(ehcache); Element localElement = new Element(ehcacheElement, uriInfo.getAbsolutePath().toStri... | ElementResource { @GET public Response getElement() throws NotFoundException { LOG.log(Level.FINE, "GET element {}", element); net.sf.ehcache.Cache ehcache = lookupCache(); net.sf.ehcache.Element ehcacheElement = lookupElement(ehcache); Element localElement = new Element(ehcacheElement, uriInfo.getAbsolutePath().toStri... | ElementResource { @GET public Response getElement() throws NotFoundException { LOG.log(Level.FINE, "GET element {}", element); net.sf.ehcache.Cache ehcache = lookupCache(); net.sf.ehcache.Element ehcacheElement = lookupElement(ehcache); Element localElement = new Element(ehcacheElement, uriInfo.getAbsolutePath().toStri... |
@Test public void testGetCache() throws Exception { HttpURLConnection result = HttpUtil.get("http: assertEquals(200, result.getResponseCode()); assertEquals("application/xml", result.getContentType()); JAXBContext jaxbContext = new JAXBContextResolver().getContext(Caches.class); Unmarshaller unmarshaller = jaxbContext.... | @GET public Cache getCache() { LOG.log(Level.FINE, "GET Cache {}" + cache); net.sf.ehcache.Cache ehcache = MANAGER.getCache(cache); if (ehcache == null) { throw new NotFoundException("Cache not found"); } String cacheAsString = ehcache.toString(); cacheAsString = cacheAsString.substring(0, cacheAsString.length() - 1); ... | CacheResource { @GET public Cache getCache() { LOG.log(Level.FINE, "GET Cache {}" + cache); net.sf.ehcache.Cache ehcache = MANAGER.getCache(cache); if (ehcache == null) { throw new NotFoundException("Cache not found"); } String cacheAsString = ehcache.toString(); cacheAsString = cacheAsString.substring(0, cacheAsString... | CacheResource { @GET public Cache getCache() { LOG.log(Level.FINE, "GET Cache {}" + cache); net.sf.ehcache.Cache ehcache = MANAGER.getCache(cache); if (ehcache == null) { throw new NotFoundException("Cache not found"); } String cacheAsString = ehcache.toString(); cacheAsString = cacheAsString.substring(0, cacheAsString... | CacheResource { @GET public Cache getCache() { LOG.log(Level.FINE, "GET Cache {}" + cache); net.sf.ehcache.Cache ehcache = MANAGER.getCache(cache); if (ehcache == null) { throw new NotFoundException("Cache not found"); } String cacheAsString = ehcache.toString(); cacheAsString = cacheAsString.substring(0, cacheAsString... | CacheResource { @GET public Cache getCache() { LOG.log(Level.FINE, "GET Cache {}" + cache); net.sf.ehcache.Cache ehcache = MANAGER.getCache(cache); if (ehcache == null) { throw new NotFoundException("Cache not found"); } String cacheAsString = ehcache.toString(); cacheAsString = cacheAsString.substring(0, cacheAsString... |
@Test public void testDeleteCache() throws Exception { HttpURLConnection urlConnection = HttpUtil.put("http: urlConnection = HttpUtil.delete("http: assertEquals(200, urlConnection.getResponseCode()); if (urlConnection.getHeaderField("Server").matches("(.*)Glassfish(.*)")) { assertTrue(urlConnection.getContentType().mat... | @DELETE public Response deleteCache() { LOG.log(Level.FINE, "DELETE Cache {}" + cache); net.sf.ehcache.Cache ehcache = MANAGER.getCache(cache); Response response; if (ehcache == null) { throw new NotFoundException("Cache not found " + cache); } else { CacheManager.getInstance().removeCache(cache); response = Response.o... | CacheResource { @DELETE public Response deleteCache() { LOG.log(Level.FINE, "DELETE Cache {}" + cache); net.sf.ehcache.Cache ehcache = MANAGER.getCache(cache); Response response; if (ehcache == null) { throw new NotFoundException("Cache not found " + cache); } else { CacheManager.getInstance().removeCache(cache); respo... | CacheResource { @DELETE public Response deleteCache() { LOG.log(Level.FINE, "DELETE Cache {}" + cache); net.sf.ehcache.Cache ehcache = MANAGER.getCache(cache); Response response; if (ehcache == null) { throw new NotFoundException("Cache not found " + cache); } else { CacheManager.getInstance().removeCache(cache); respo... | CacheResource { @DELETE public Response deleteCache() { LOG.log(Level.FINE, "DELETE Cache {}" + cache); net.sf.ehcache.Cache ehcache = MANAGER.getCache(cache); Response response; if (ehcache == null) { throw new NotFoundException("Cache not found " + cache); } else { CacheManager.getInstance().removeCache(cache); respo... | CacheResource { @DELETE public Response deleteCache() { LOG.log(Level.FINE, "DELETE Cache {}" + cache); net.sf.ehcache.Cache ehcache = MANAGER.getCache(cache); Response response; if (ehcache == null) { throw new NotFoundException("Cache not found " + cache); } else { CacheManager.getInstance().removeCache(cache); respo... |
@Test public void testCacheNames() throws Exception, IOException, ParserConfigurationException, SAXException { HttpURLConnection result = HttpUtil.get("http: assertEquals(200, result.getResponseCode()); JAXBContext jaxbContext = new JAXBContextResolver().getContext(Caches.class); Unmarshaller unmarshaller = jaxbContext... | @GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).build().normalize()... | CachesResource { @GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).bu... | CachesResource { @GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).bu... | CachesResource { @GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).bu... | CachesResource { @GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).bu... |
@Test public void testGetCaches() throws IOException, ParserConfigurationException, SAXException, XPathExpressionException { HttpURLConnection result = HttpUtil.get("http: assertEquals(200, result.getResponseCode()); DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document d... | @GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).build().normalize()... | CachesResource { @GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).bu... | CachesResource { @GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).bu... | CachesResource { @GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).bu... | CachesResource { @GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).bu... |
@Test public void testGetCachesJaxb() throws Exception, SAXException, XPathExpressionException, JAXBException { HttpURLConnection result = HttpUtil.get("http: assertEquals(200, result.getResponseCode()); JAXBContext jaxbContext = new JAXBContextResolver().getContext(Caches.class); Unmarshaller unmarshaller = jaxbContex... | @GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).build().normalize()... | CachesResource { @GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).bu... | CachesResource { @GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).bu... | CachesResource { @GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).bu... | CachesResource { @GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).bu... |
@Test public void testParseBadDate() { HttpDateFormatter httpDateFormatter = new HttpDateFormatter(); String dateString1 = "dddddddddd^^^3s"; Date date = httpDateFormatter.parseDateFromHttpDate(dateString1); assertEquals(new Date(0), date); } | public synchronized Date parseDateFromHttpDate(String date) { try { return httpDateFormat.parse(date); } catch (ParseException e) { LOG.log(Level.FINE, "ParseException on date {0}. 1/1/1970 will be returned", date); return new Date(0); } } | HttpDateFormatter { public synchronized Date parseDateFromHttpDate(String date) { try { return httpDateFormat.parse(date); } catch (ParseException e) { LOG.log(Level.FINE, "ParseException on date {0}. 1/1/1970 will be returned", date); return new Date(0); } } } | HttpDateFormatter { public synchronized Date parseDateFromHttpDate(String date) { try { return httpDateFormat.parse(date); } catch (ParseException e) { LOG.log(Level.FINE, "ParseException on date {0}. 1/1/1970 will be returned", date); return new Date(0); } } HttpDateFormatter(); } | HttpDateFormatter { public synchronized Date parseDateFromHttpDate(String date) { try { return httpDateFormat.parse(date); } catch (ParseException e) { LOG.log(Level.FINE, "ParseException on date {0}. 1/1/1970 will be returned", date); return new Date(0); } } HttpDateFormatter(); synchronized String formatHttpDate(Date... | HttpDateFormatter { public synchronized Date parseDateFromHttpDate(String date) { try { return httpDateFormat.parse(date); } catch (ParseException e) { LOG.log(Level.FINE, "ParseException on date {0}. 1/1/1970 will be returned", date); return new Date(0); } } HttpDateFormatter(); synchronized String formatHttpDate(Date... |
@Test(expected = IllegalStateException.class) public void testDeleteThrowsWhenNotStarted() { AsyncWriteBehind writeBehind = createAsyncWriteBehind(); writeBehind.delete(new CacheEntry("", new Element("", ""))); } | public void delete(CacheEntry entry) { readLock.lock(); try { status.checkRunning(); async.add(new DeleteAsyncOperation(createKeySnapshot(entry.getKey()), createElementSnapshot(entry.getElement()))); } finally { readLock.unlock(); } } | AsyncWriteBehind implements WriteBehind { public void delete(CacheEntry entry) { readLock.lock(); try { status.checkRunning(); async.add(new DeleteAsyncOperation(createKeySnapshot(entry.getKey()), createElementSnapshot(entry.getElement()))); } finally { readLock.unlock(); } } } | AsyncWriteBehind implements WriteBehind { public void delete(CacheEntry entry) { readLock.lock(); try { status.checkRunning(); async.add(new DeleteAsyncOperation(createKeySnapshot(entry.getKey()), createElementSnapshot(entry.getElement()))); } finally { readLock.unlock(); } } AsyncWriteBehind(AsyncCoordinator async, Eh... | AsyncWriteBehind implements WriteBehind { public void delete(CacheEntry entry) { readLock.lock(); try { status.checkRunning(); async.add(new DeleteAsyncOperation(createKeySnapshot(entry.getKey()), createElementSnapshot(entry.getElement()))); } finally { readLock.unlock(); } } AsyncWriteBehind(AsyncCoordinator async, Eh... | AsyncWriteBehind implements WriteBehind { public void delete(CacheEntry entry) { readLock.lock(); try { status.checkRunning(); async.add(new DeleteAsyncOperation(createKeySnapshot(entry.getKey()), createElementSnapshot(entry.getElement()))); } finally { readLock.unlock(); } } AsyncWriteBehind(AsyncCoordinator async, Eh... |
@Test(expected = IllegalStateException.class) public void testWriteThrowsWhenNotStarted() { AsyncWriteBehind writeBehind = createAsyncWriteBehind(); writeBehind.write(new Element("", "")); } | public void write(Element element) { readLock.lock(); try { status.checkRunning(); ElementSnapshot snapshot = createElementSnapshot(element); async.add(new WriteAsyncOperation(snapshot)); } finally { readLock.unlock(); } } | AsyncWriteBehind implements WriteBehind { public void write(Element element) { readLock.lock(); try { status.checkRunning(); ElementSnapshot snapshot = createElementSnapshot(element); async.add(new WriteAsyncOperation(snapshot)); } finally { readLock.unlock(); } } } | AsyncWriteBehind implements WriteBehind { public void write(Element element) { readLock.lock(); try { status.checkRunning(); ElementSnapshot snapshot = createElementSnapshot(element); async.add(new WriteAsyncOperation(snapshot)); } finally { readLock.unlock(); } } AsyncWriteBehind(AsyncCoordinator async, Ehcache cache,... | AsyncWriteBehind implements WriteBehind { public void write(Element element) { readLock.lock(); try { status.checkRunning(); ElementSnapshot snapshot = createElementSnapshot(element); async.add(new WriteAsyncOperation(snapshot)); } finally { readLock.unlock(); } } AsyncWriteBehind(AsyncCoordinator async, Ehcache cache,... | AsyncWriteBehind implements WriteBehind { public void write(Element element) { readLock.lock(); try { status.checkRunning(); ElementSnapshot snapshot = createElementSnapshot(element); async.add(new WriteAsyncOperation(snapshot)); } finally { readLock.unlock(); } } AsyncWriteBehind(AsyncCoordinator async, Ehcache cache,... |
@Test public void given_clustered_cache__cacheSampler_getSize_returns_quick_size() throws Exception { cacheConfiguration.terracotta(new TerracottaConfiguration().clustered(true)); CacheSamplerImpl cacheSampler = new CacheSamplerImpl(cache); assertThat(cacheSampler.getSize(), equalTo(QUICK_SIZE)); } | @Override public long getSize() { if (cache.getCacheConfiguration().isTerracottaClustered()) { return getRemoteSizeSample().getMostRecentSample().getCounterValue(); } try { return cache.getStatistics().getSize(); } catch (RuntimeException e) { throw Utils.newPlainException(e); } } | CacheSamplerImpl implements CacheSampler, CacheConfigurationListener { @Override public long getSize() { if (cache.getCacheConfiguration().isTerracottaClustered()) { return getRemoteSizeSample().getMostRecentSample().getCounterValue(); } try { return cache.getStatistics().getSize(); } catch (RuntimeException e) { throw... | CacheSamplerImpl implements CacheSampler, CacheConfigurationListener { @Override public long getSize() { if (cache.getCacheConfiguration().isTerracottaClustered()) { return getRemoteSizeSample().getMostRecentSample().getCounterValue(); } try { return cache.getStatistics().getSize(); } catch (RuntimeException e) { throw... | CacheSamplerImpl implements CacheSampler, CacheConfigurationListener { @Override public long getSize() { if (cache.getCacheConfiguration().isTerracottaClustered()) { return getRemoteSizeSample().getMostRecentSample().getCounterValue(); } try { return cache.getStatistics().getSize(); } catch (RuntimeException e) { throw... | CacheSamplerImpl implements CacheSampler, CacheConfigurationListener { @Override public long getSize() { if (cache.getCacheConfiguration().isTerracottaClustered()) { return getRemoteSizeSample().getMostRecentSample().getCounterValue(); } try { return cache.getStatistics().getSize(); } catch (RuntimeException e) { throw... |
@Test public void given_unclustered_cache__cacheSampler_getSize_returns_exact_size() throws Exception { cacheConfiguration.terracotta(new TerracottaConfiguration().clustered(false)); CacheSamplerImpl cacheSampler = new CacheSamplerImpl(cache); assertThat(cacheSampler.getSize(), equalTo(EXACT_SIZE)); } | @Override public long getSize() { if (cache.getCacheConfiguration().isTerracottaClustered()) { return getRemoteSizeSample().getMostRecentSample().getCounterValue(); } try { return cache.getStatistics().getSize(); } catch (RuntimeException e) { throw Utils.newPlainException(e); } } | CacheSamplerImpl implements CacheSampler, CacheConfigurationListener { @Override public long getSize() { if (cache.getCacheConfiguration().isTerracottaClustered()) { return getRemoteSizeSample().getMostRecentSample().getCounterValue(); } try { return cache.getStatistics().getSize(); } catch (RuntimeException e) { throw... | CacheSamplerImpl implements CacheSampler, CacheConfigurationListener { @Override public long getSize() { if (cache.getCacheConfiguration().isTerracottaClustered()) { return getRemoteSizeSample().getMostRecentSample().getCounterValue(); } try { return cache.getStatistics().getSize(); } catch (RuntimeException e) { throw... | CacheSamplerImpl implements CacheSampler, CacheConfigurationListener { @Override public long getSize() { if (cache.getCacheConfiguration().isTerracottaClustered()) { return getRemoteSizeSample().getMostRecentSample().getCounterValue(); } try { return cache.getStatistics().getSize(); } catch (RuntimeException e) { throw... | CacheSamplerImpl implements CacheSampler, CacheConfigurationListener { @Override public long getSize() { if (cache.getCacheConfiguration().isTerracottaClustered()) { return getRemoteSizeSample().getMostRecentSample().getCounterValue(); } try { return cache.getStatistics().getSize(); } catch (RuntimeException e) { throw... |
@Test public void testRemoveCache() throws CacheException { Configuration config = new Configuration().cache(new CacheConfiguration("foo", 100)); CacheManager manager = new CacheManager(config); try { assertEquals(1, manager.getConfiguration().getCacheConfigurations().size()); assertNotNull(manager.getCache("foo")); ma... | public synchronized void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); runtimeCfg.removeCache(cac... | CacheManager { public synchronized void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); runtimeCfg.... | CacheManager { public synchronized void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); runtimeCfg.... | CacheManager { public synchronized void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); runtimeCfg.... | CacheManager { public synchronized void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); runtimeCfg.... |
@Test public void testAddCache() throws CacheException { Configuration config = new Configuration().defaultCache(new CacheConfiguration().maxEntriesLocalHeap(0)); CacheManager manager = new CacheManager(config); try { assertEquals(0, manager.getConfiguration().getCacheConfigurations().size()); manager.addCache("test");... | public synchronized void addCache(String cacheName) throws IllegalStateException, ObjectExistsException, CacheException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } if (ehcaches.get(cacheName) != null) { throw new ObjectExistsException("Cache " + cacheName + " already exists"); } Ehcac... | CacheManager { public synchronized void addCache(String cacheName) throws IllegalStateException, ObjectExistsException, CacheException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } if (ehcaches.get(cacheName) != null) { throw new ObjectExistsException("Cache " + cacheName + " already ex... | CacheManager { public synchronized void addCache(String cacheName) throws IllegalStateException, ObjectExistsException, CacheException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } if (ehcaches.get(cacheName) != null) { throw new ObjectExistsException("Cache " + cacheName + " already ex... | CacheManager { public synchronized void addCache(String cacheName) throws IllegalStateException, ObjectExistsException, CacheException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } if (ehcaches.get(cacheName) != null) { throw new ObjectExistsException("Cache " + cacheName + " already ex... | CacheManager { public synchronized void addCache(String cacheName) throws IllegalStateException, ObjectExistsException, CacheException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } if (ehcaches.get(cacheName) != null) { throw new ObjectExistsException("Cache " + cacheName + " already ex... |
@Test public void testAddCacheIfAbsent() { Configuration config = new Configuration().defaultCache(new CacheConfiguration().maxEntriesLocalHeap(100)); CacheManager manager = new CacheManager(config); try { manager.addCache("present"); assertThat(manager.addCacheIfAbsent(new Cache(new CacheConfiguration("present", 1000)... | public synchronized Ehcache addCacheIfAbsent(final Ehcache cache) { checkStatus(); return cache == null ? null : addCacheNoCheck(cache, false); } | CacheManager { public synchronized Ehcache addCacheIfAbsent(final Ehcache cache) { checkStatus(); return cache == null ? null : addCacheNoCheck(cache, false); } } | CacheManager { public synchronized Ehcache addCacheIfAbsent(final Ehcache cache) { checkStatus(); return cache == null ? null : addCacheNoCheck(cache, false); } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL); CacheManager(InputStream configur... | CacheManager { public synchronized Ehcache addCacheIfAbsent(final Ehcache cache) { checkStatus(); return cache == null ? null : addCacheNoCheck(cache, false); } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL); CacheManager(InputStream configur... | CacheManager { public synchronized Ehcache addCacheIfAbsent(final Ehcache cache) { checkStatus(); return cache == null ? null : addCacheNoCheck(cache, false); } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL); CacheManager(InputStream configur... |
@Test public void testMultipleCacheManagers() { CacheManager managerOne = new CacheManager(makeCacheManagerConfig("cm1")); try { new CacheManager(makeCacheManagerConfig("cm2")).shutdown(); } finally { managerOne.shutdown(); } } | public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedException ie) { Thr... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... |
@Test public void testRuntimeConfigRemovalDuringShutdown() throws Exception { Configuration configuration = new Configuration(); CacheManager cacheManager = new CacheManager(configuration); cacheManager.shutdown(); Configuration.RuntimeCfg runtimeCfg = configuration.setupFor(cacheManager, "expecting CacheManager name i... | public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedException ie) { Thr... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... |
@Test public void testConfigurationCannotBeSharedAcrossRunningCacheManagers() { Configuration configuration = new Configuration(); configuration.setupFor(mock(CacheManager.class), "one"); try { configuration.setupFor(mock(CacheManager.class), "two"); } catch (IllegalStateException e) { assertThat(e.getMessage(), contai... | public RuntimeCfg setupFor(final CacheManager cacheManager, final String fallbackName) throws InvalidConfigurationException { if (cfg != null) { if (cfg.cacheManager == cacheManager) { return cfg; } else if (cfg.cacheManager.getStatus() != Status.STATUS_SHUTDOWN) { throw new IllegalStateException("You cannot share a Co... | Configuration { public RuntimeCfg setupFor(final CacheManager cacheManager, final String fallbackName) throws InvalidConfigurationException { if (cfg != null) { if (cfg.cacheManager == cacheManager) { return cfg; } else if (cfg.cacheManager.getStatus() != Status.STATUS_SHUTDOWN) { throw new IllegalStateException("You c... | Configuration { public RuntimeCfg setupFor(final CacheManager cacheManager, final String fallbackName) throws InvalidConfigurationException { if (cfg != null) { if (cfg.cacheManager == cacheManager) { return cfg; } else if (cfg.cacheManager.getStatus() != Status.STATUS_SHUTDOWN) { throw new IllegalStateException("You c... | Configuration { public RuntimeCfg setupFor(final CacheManager cacheManager, final String fallbackName) throws InvalidConfigurationException { if (cfg != null) { if (cfg.cacheManager == cacheManager) { return cfg; } else if (cfg.cacheManager.getStatus() != Status.STATUS_SHUTDOWN) { throw new IllegalStateException("You c... | Configuration { public RuntimeCfg setupFor(final CacheManager cacheManager, final String fallbackName) throws InvalidConfigurationException { if (cfg != null) { if (cfg.cacheManager == cacheManager) { return cfg; } else if (cfg.cacheManager.getStatus() != Status.STATUS_SHUTDOWN) { throw new IllegalStateException("You c... |
@Test public void testConfigurationCanBeReusedAfterCacheManagerShutdown() { Configuration configuration = new Configuration(); CacheManager mock = mock(CacheManager.class); when(mock.getStatus()).thenReturn(Status.STATUS_SHUTDOWN); configuration.setupFor(mock, "one"); configuration.setupFor(mock(CacheManager.class), "t... | public RuntimeCfg setupFor(final CacheManager cacheManager, final String fallbackName) throws InvalidConfigurationException { if (cfg != null) { if (cfg.cacheManager == cacheManager) { return cfg; } else if (cfg.cacheManager.getStatus() != Status.STATUS_SHUTDOWN) { throw new IllegalStateException("You cannot share a Co... | Configuration { public RuntimeCfg setupFor(final CacheManager cacheManager, final String fallbackName) throws InvalidConfigurationException { if (cfg != null) { if (cfg.cacheManager == cacheManager) { return cfg; } else if (cfg.cacheManager.getStatus() != Status.STATUS_SHUTDOWN) { throw new IllegalStateException("You c... | Configuration { public RuntimeCfg setupFor(final CacheManager cacheManager, final String fallbackName) throws InvalidConfigurationException { if (cfg != null) { if (cfg.cacheManager == cacheManager) { return cfg; } else if (cfg.cacheManager.getStatus() != Status.STATUS_SHUTDOWN) { throw new IllegalStateException("You c... | Configuration { public RuntimeCfg setupFor(final CacheManager cacheManager, final String fallbackName) throws InvalidConfigurationException { if (cfg != null) { if (cfg.cacheManager == cacheManager) { return cfg; } else if (cfg.cacheManager.getStatus() != Status.STATUS_SHUTDOWN) { throw new IllegalStateException("You c... | Configuration { public RuntimeCfg setupFor(final CacheManager cacheManager, final String fallbackName) throws InvalidConfigurationException { if (cfg != null) { if (cfg.cacheManager == cacheManager) { return cfg; } else if (cfg.cacheManager.getStatus() != Status.STATUS_SHUTDOWN) { throw new IllegalStateException("You c... |
@Test public void testIsRegionCacheOrphanEvictionEnabled() { assertThat(stats.isRegionCacheOrphanEvictionEnabled("sampleCache1"), is(false)); } | public boolean isRegionCacheOrphanEvictionEnabled(String region) { Cache cache = this.cacheManager.getCache(region); if (cache != null && cache.isTerracottaClustered()) { return cache.getCacheConfiguration().getTerracottaConfiguration().getOrphanEviction(); } else { return false; } } | EhcacheStatsImpl extends BaseEmitterBean implements EhcacheStats { public boolean isRegionCacheOrphanEvictionEnabled(String region) { Cache cache = this.cacheManager.getCache(region); if (cache != null && cache.isTerracottaClustered()) { return cache.getCacheConfiguration().getTerracottaConfiguration().getOrphanEvictio... | EhcacheStatsImpl extends BaseEmitterBean implements EhcacheStats { public boolean isRegionCacheOrphanEvictionEnabled(String region) { Cache cache = this.cacheManager.getCache(region); if (cache != null && cache.isTerracottaClustered()) { return cache.getCacheConfiguration().getTerracottaConfiguration().getOrphanEvictio... | EhcacheStatsImpl extends BaseEmitterBean implements EhcacheStats { public boolean isRegionCacheOrphanEvictionEnabled(String region) { Cache cache = this.cacheManager.getCache(region); if (cache != null && cache.isTerracottaClustered()) { return cache.getCacheConfiguration().getTerracottaConfiguration().getOrphanEvictio... | EhcacheStatsImpl extends BaseEmitterBean implements EhcacheStats { public boolean isRegionCacheOrphanEvictionEnabled(String region) { Cache cache = this.cacheManager.getCache(region); if (cache != null && cache.isTerracottaClustered()) { return cache.getCacheConfiguration().getTerracottaConfiguration().getOrphanEvictio... |
@Test public void testRetrievingExistingClusteredCacheManagerEntity() { String name = "existing"; net.sf.ehcache.config.Configuration configuration = new net.sf.ehcache.config.Configuration(); Toolkit toolkit = getMockToolkit(); when(toolkit.getMap(anyString(), eq(String.class), eq(ClusteredCache.class))).thenReturn(mo... | @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getR... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... |
@Test public void testMustBeInactiveByDefault() { final ToolkitCacheInternal<String, String> delegate = mock(ToolkitCacheInternal.class); final ToolkitMap<String, Serializable> configMap = new MockToolkitMap<String, Serializable>(); final WanAwareToolkitCache<String, String> cache = new WanAwareToolkitCache<String, Str... | @Override public V put(final K key, final V value, final int createTimeInSecs, final int customMaxTTISeconds, final int customMaxTTLSeconds) { if (isActive()) { return delegate.put(key, value, createTimeInSecs, customMaxTTISeconds, customMaxTTLSeconds); } else { throw new IllegalStateException(NOT_ACTIVE_MSG); } } | WanAwareToolkitCache implements ToolkitCacheInternal<K, V> { @Override public V put(final K key, final V value, final int createTimeInSecs, final int customMaxTTISeconds, final int customMaxTTLSeconds) { if (isActive()) { return delegate.put(key, value, createTimeInSecs, customMaxTTISeconds, customMaxTTLSeconds); } els... | WanAwareToolkitCache implements ToolkitCacheInternal<K, V> { @Override public V put(final K key, final V value, final int createTimeInSecs, final int customMaxTTISeconds, final int customMaxTTLSeconds) { if (isActive()) { return delegate.put(key, value, createTimeInSecs, customMaxTTISeconds, customMaxTTLSeconds); } els... | WanAwareToolkitCache implements ToolkitCacheInternal<K, V> { @Override public V put(final K key, final V value, final int createTimeInSecs, final int customMaxTTISeconds, final int customMaxTTLSeconds) { if (isActive()) { return delegate.put(key, value, createTimeInSecs, customMaxTTISeconds, customMaxTTLSeconds); } els... | WanAwareToolkitCache implements ToolkitCacheInternal<K, V> { @Override public V put(final K key, final V value, final int createTimeInSecs, final int customMaxTTISeconds, final int customMaxTTLSeconds) { if (isActive()) { return delegate.put(key, value, createTimeInSecs, customMaxTTISeconds, customMaxTTLSeconds); } els... |
@Test public void testAddCacheEntityInfo() { factory.addCacheEntityInfo(CACHE_NAME, new CacheConfiguration(), "testTKCacheName"); } | void addCacheEntityInfo(final String cacheName, final CacheConfiguration ehcacheConfig, String toolkitCacheName) { if (clusteredCacheManagerEntity == null) { throw new IllegalStateException(format("ClusteredCacheManger entity not configured for cache %s", cacheName)); } ClusteredCache cacheEntity = clusteredCacheManage... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { void addCacheEntityInfo(final String cacheName, final CacheConfiguration ehcacheConfig, String toolkitCacheName) { if (clusteredCacheManagerEntity == null) { throw new IllegalStateException(format("ClusteredCacheManger entity not configured for cache %s", c... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { void addCacheEntityInfo(final String cacheName, final CacheConfiguration ehcacheConfig, String toolkitCacheName) { if (clusteredCacheManagerEntity == null) { throw new IllegalStateException(format("ClusteredCacheManger entity not configured for cache %s", c... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { void addCacheEntityInfo(final String cacheName, final CacheConfiguration ehcacheConfig, String toolkitCacheName) { if (clusteredCacheManagerEntity == null) { throw new IllegalStateException(format("ClusteredCacheManger entity not configured for cache %s", c... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { void addCacheEntityInfo(final String cacheName, final CacheConfiguration ehcacheConfig, String toolkitCacheName) { if (clusteredCacheManagerEntity == null) { throw new IllegalStateException(format("ClusteredCacheManger entity not configured for cache %s", c... |
@Test public void testRetrievingExistingClusteredCacheManagerEntity() { String name = "existing"; net.sf.ehcache.config.Configuration configuration = new net.sf.ehcache.config.Configuration(); Toolkit toolkit = mock(Toolkit.class); when(toolkit.getMap(anyString(), eq(String.class), eq(ClusteredCache.class))).thenReturn... | @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); if (clusteredCacheManager == null) { ToolkitReadWriteLock cmRWL... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ... |
@Test public void testCreatingNewClusteredCacheManagerEntity() { String name = "newCM"; net.sf.ehcache.config.Configuration configuration = new net.sf.ehcache.config.Configuration(); ClusteredEntityManager clusteredEntityManager = mock(ClusteredEntityManager.class); doAnswer(new Answer() { @Override public Object answe... | @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); if (clusteredCacheManager == null) { ToolkitReadWriteLock cmRWL... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ... |
@Test public void testTryingToCreateNewClusteredCacheManagerEntityButLooseRace() { String name = "newCM"; net.sf.ehcache.config.Configuration configuration = new net.sf.ehcache.config.Configuration(); ClusteredEntityManager clusteredEntityManager = mock(ClusteredEntityManager.class); doThrow(new IllegalStateException("... | @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); if (clusteredCacheManager == null) { ToolkitReadWriteLock cmRWL... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ... |
@Test public void testConfigurationSavedContainsNoCachesAnymore() { String name = "newCM"; net.sf.ehcache.config.Configuration configuration = new net.sf.ehcache.config.Configuration(); configuration.addCache(new CacheConfiguration("test", 1)); ClusteredEntityManager clusteredEntityManager = mock(ClusteredEntityManager... | @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); if (clusteredCacheManager == null) { ToolkitReadWriteLock cmRWL... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ... |
@Test public void testConfigurationSavedContainsCacheManagerName() { String name = "newCM"; net.sf.ehcache.config.Configuration configuration = new net.sf.ehcache.config.Configuration(); configuration.addCache(new CacheConfiguration("test", 1)); Toolkit toolkit = mock(Toolkit.class); ClusteredEntityManager clusteredEnt... | @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); if (clusteredCacheManager == null) { ToolkitReadWriteLock cmRWL... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ... |
@Test public void testGetRegionCacheOrphanEvictionPeriod() { assertThat(stats.getRegionCacheOrphanEvictionPeriod("sampleCache1"), is(-1)); } | public int getRegionCacheOrphanEvictionPeriod(String region) { Cache cache = this.cacheManager.getCache(region); if (cache != null && cache.isTerracottaClustered()) { return cache.getCacheConfiguration().getTerracottaConfiguration().getOrphanEvictionPeriod(); } else { return -1; } } | EhcacheStatsImpl extends BaseEmitterBean implements EhcacheStats { public int getRegionCacheOrphanEvictionPeriod(String region) { Cache cache = this.cacheManager.getCache(region); if (cache != null && cache.isTerracottaClustered()) { return cache.getCacheConfiguration().getTerracottaConfiguration().getOrphanEvictionPer... | EhcacheStatsImpl extends BaseEmitterBean implements EhcacheStats { public int getRegionCacheOrphanEvictionPeriod(String region) { Cache cache = this.cacheManager.getCache(region); if (cache != null && cache.isTerracottaClustered()) { return cache.getCacheConfiguration().getTerracottaConfiguration().getOrphanEvictionPer... | EhcacheStatsImpl extends BaseEmitterBean implements EhcacheStats { public int getRegionCacheOrphanEvictionPeriod(String region) { Cache cache = this.cacheManager.getCache(region); if (cache != null && cache.isTerracottaClustered()) { return cache.getCacheConfiguration().getTerracottaConfiguration().getOrphanEvictionPer... | EhcacheStatsImpl extends BaseEmitterBean implements EhcacheStats { public int getRegionCacheOrphanEvictionPeriod(String region) { Cache cache = this.cacheManager.getCache(region); if (cache != null && cache.isTerracottaClustered()) { return cache.getCacheConfiguration().getTerracottaConfiguration().getOrphanEvictionPer... |
@Test public void testGetKeyThrowsCacheExceptionOnAccessingNonSerializableKey() { Object key = new Object() { @Override public String toString() { return "HAHA!"; } }; Object value = new Object(); Element element = new Element(key, value); try { element.getKey(); fail("element.getKey() did not throw"); } catch (CacheEx... | @Deprecated public final Serializable getKey() throws CacheException { try { return (Serializable) getObjectKey(); } catch (ClassCastException e) { throw new CacheException("The key " + getObjectKey() + " is not Serializable. Consider using Element.getObjectKey()"); } } | Element implements Serializable, Cloneable { @Deprecated public final Serializable getKey() throws CacheException { try { return (Serializable) getObjectKey(); } catch (ClassCastException e) { throw new CacheException("The key " + getObjectKey() + " is not Serializable. Consider using Element.getObjectKey()"); } } } | Element implements Serializable, Cloneable { @Deprecated public final Serializable getKey() throws CacheException { try { return (Serializable) getObjectKey(); } catch (ClassCastException e) { throw new CacheException("The key " + getObjectKey() + " is not Serializable. Consider using Element.getObjectKey()"); } } Elem... | Element implements Serializable, Cloneable { @Deprecated public final Serializable getKey() throws CacheException { try { return (Serializable) getObjectKey(); } catch (ClassCastException e) { throw new CacheException("The key " + getObjectKey() + " is not Serializable. Consider using Element.getObjectKey()"); } } Elem... | Element implements Serializable, Cloneable { @Deprecated public final Serializable getKey() throws CacheException { try { return (Serializable) getObjectKey(); } catch (ClassCastException e) { throw new CacheException("The key " + getObjectKey() + " is not Serializable. Consider using Element.getObjectKey()"); } } Elem... |
@Test public void testGetValueThrowsCacheExceptionOnAccessingNonSerializableValue() { Object key = new Object() { @Override public String toString() { return "daKey"; } }; Object value = new Object() { @Override public String toString() { return "HOHO!"; } }; Element element = new Element(key, value); try { element.get... | @Deprecated public final Serializable getValue() throws CacheException { try { return (Serializable) getObjectValue(); } catch (ClassCastException e) { throw new CacheException("The value " + getObjectValue() + " for key " + getObjectKey() + " is not Serializable. Consider using Element.getObjectValue()"); } } | Element implements Serializable, Cloneable { @Deprecated public final Serializable getValue() throws CacheException { try { return (Serializable) getObjectValue(); } catch (ClassCastException e) { throw new CacheException("The value " + getObjectValue() + " for key " + getObjectKey() + " is not Serializable. Consider u... | Element implements Serializable, Cloneable { @Deprecated public final Serializable getValue() throws CacheException { try { return (Serializable) getObjectValue(); } catch (ClassCastException e) { throw new CacheException("The value " + getObjectValue() + " for key " + getObjectKey() + " is not Serializable. Consider u... | Element implements Serializable, Cloneable { @Deprecated public final Serializable getValue() throws CacheException { try { return (Serializable) getObjectValue(); } catch (ClassCastException e) { throw new CacheException("The value " + getObjectValue() + " for key " + getObjectKey() + " is not Serializable. Consider u... | Element implements Serializable, Cloneable { @Deprecated public final Serializable getValue() throws CacheException { try { return (Serializable) getObjectValue(); } catch (ClassCastException e) { throw new CacheException("The value " + getObjectValue() + " for key " + getObjectKey() + " is not Serializable. Consider u... |
@Test public void testNullsAreSerializable() { Element element = new Element(null, null); assertTrue(element.isSerializable()); Element elementWithNullValue = new Element("1", null); assertTrue(elementWithNullValue.isSerializable()); Element elementWithNullKey = new Element(null, "1"); assertTrue(elementWithNullKey.isS... | public final boolean isSerializable() { return isKeySerializable() && (value instanceof Serializable || value == null); } | Element implements Serializable, Cloneable { public final boolean isSerializable() { return isKeySerializable() && (value instanceof Serializable || value == null); } } | Element implements Serializable, Cloneable { public final boolean isSerializable() { return isKeySerializable() && (value instanceof Serializable || value == null); } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, final long version); @Depre... | Element implements Serializable, Cloneable { public final boolean isSerializable() { return isKeySerializable() && (value instanceof Serializable || value == null); } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, final long version); @Depre... | Element implements Serializable, Cloneable { public final boolean isSerializable() { return isKeySerializable() && (value instanceof Serializable || value == null); } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, final long version); @Depre... |
@Test public void testWarnTieredSizing() { final AtomicReference<String> ref = new AtomicReference<String>(); try { Class.forName("org.slf4j.impl.JDK14LoggerFactory"); } catch (ClassNotFoundException e) { fail("Could not load org.slf4j.impl.JDK14LoggerFactory, required for test to work. Is slf4j-jdk14 in test dependenc... | private void warnTieredSizing() { if (isOverflowToOffHeap()) { if (getMaxBytesLocalHeap() >= getMaxBytesLocalOffHeap() && getMaxBytesLocalOffHeap() != 0) { LOG.warn("Configuration problem for cache " + getName() + ": MaxBytesLocalHeap equal or greater than MaxBytesLocalOffHeap. " + "This will result in useless off heap... | CacheConfiguration implements Cloneable { private void warnTieredSizing() { if (isOverflowToOffHeap()) { if (getMaxBytesLocalHeap() >= getMaxBytesLocalOffHeap() && getMaxBytesLocalOffHeap() != 0) { LOG.warn("Configuration problem for cache " + getName() + ": MaxBytesLocalHeap equal or greater than MaxBytesLocalOffHeap.... | CacheConfiguration implements Cloneable { private void warnTieredSizing() { if (isOverflowToOffHeap()) { if (getMaxBytesLocalHeap() >= getMaxBytesLocalOffHeap() && getMaxBytesLocalOffHeap() != 0) { LOG.warn("Configuration problem for cache " + getName() + ": MaxBytesLocalHeap equal or greater than MaxBytesLocalOffHeap.... | CacheConfiguration implements Cloneable { private void warnTieredSizing() { if (isOverflowToOffHeap()) { if (getMaxBytesLocalHeap() >= getMaxBytesLocalOffHeap() && getMaxBytesLocalOffHeap() != 0) { LOG.warn("Configuration problem for cache " + getName() + ": MaxBytesLocalHeap equal or greater than MaxBytesLocalOffHeap.... | CacheConfiguration implements Cloneable { private void warnTieredSizing() { if (isOverflowToOffHeap()) { if (getMaxBytesLocalHeap() >= getMaxBytesLocalOffHeap() && getMaxBytesLocalOffHeap() != 0) { LOG.warn("Configuration problem for cache " + getName() + ": MaxBytesLocalHeap equal or greater than MaxBytesLocalOffHeap.... |
@Test public void testOnlyPopulatesOnce() throws InterruptedException, BrokenBarrierException { final int threadCount = Runtime.getRuntime().availableProcessors() * 2; final CachingTier<String, String> cache = new OnHeapCachingTier<String, String>(new CountBasedBackEnd<String, Object>(threadCount * 2)); final AtomicBoo... | @Override public V get(final K key, final Callable<V> source, final boolean updateStats) { if (updateStats) { getObserver.begin(); } Object cachedValue = backEnd.get(key); if (cachedValue == null) { if (updateStats) { getObserver.end(GetOutcome.MISS); } Fault<V> f = new Fault<V>(source); cachedValue = backEnd.putIfAbse... | OnHeapCachingTier implements CachingTier<K, V> { @Override public V get(final K key, final Callable<V> source, final boolean updateStats) { if (updateStats) { getObserver.begin(); } Object cachedValue = backEnd.get(key); if (cachedValue == null) { if (updateStats) { getObserver.end(GetOutcome.MISS); } Fault<V> f = new ... | OnHeapCachingTier implements CachingTier<K, V> { @Override public V get(final K key, final Callable<V> source, final boolean updateStats) { if (updateStats) { getObserver.begin(); } Object cachedValue = backEnd.get(key); if (cachedValue == null) { if (updateStats) { getObserver.end(GetOutcome.MISS); } Fault<V> f = new ... | OnHeapCachingTier implements CachingTier<K, V> { @Override public V get(final K key, final Callable<V> source, final boolean updateStats) { if (updateStats) { getObserver.begin(); } Object cachedValue = backEnd.get(key); if (cachedValue == null) { if (updateStats) { getObserver.end(GetOutcome.MISS); } Fault<V> f = new ... | OnHeapCachingTier implements CachingTier<K, V> { @Override public V get(final K key, final Callable<V> source, final boolean updateStats) { if (updateStats) { getObserver.begin(); } Object cachedValue = backEnd.get(key); if (cachedValue == null) { if (updateStats) { getObserver.end(GetOutcome.MISS); } Fault<V> f = new ... |
@Test public void given_no_copy_when_isCopyActive_then_false() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(false, false, null); assertThat(copyStrategyHandler.isCopyActive(), is(false)); } | boolean isCopyActive() { return copyOnRead || copyOnWrite; } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy); } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy); Element copyElementForReadIfNeeded(Element element); } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy); Element copyElementForReadIfNeeded(Element element); } |
@Test public void given_copy_on_read_when_isCopyActive_then_false() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(true, false, copyStrategy); assertThat(copyStrategyHandler.isCopyActive(), is(true)); } | boolean isCopyActive() { return copyOnRead || copyOnWrite; } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy); } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy); Element copyElementForReadIfNeeded(Element element); } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy); Element copyElementForReadIfNeeded(Element element); } |
@Test public void testSerializableIsSerializable() { Element element = new Element("I'm with", "idiot"); assertTrue(element.isSerializable()); } | public final boolean isSerializable() { return isKeySerializable() && (value instanceof Serializable || value == null); } | Element implements Serializable, Cloneable { public final boolean isSerializable() { return isKeySerializable() && (value instanceof Serializable || value == null); } } | Element implements Serializable, Cloneable { public final boolean isSerializable() { return isKeySerializable() && (value instanceof Serializable || value == null); } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, final long version); @Depre... | Element implements Serializable, Cloneable { public final boolean isSerializable() { return isKeySerializable() && (value instanceof Serializable || value == null); } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, final long version); @Depre... | Element implements Serializable, Cloneable { public final boolean isSerializable() { return isKeySerializable() && (value instanceof Serializable || value == null); } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, final long version); @Depre... |
@Test public void given_copy_on_write_when_isCopyActive_then_false() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(true, false, copyStrategy); assertThat(copyStrategyHandler.isCopyActive(), is(true)); } | boolean isCopyActive() { return copyOnRead || copyOnWrite; } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy); } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy); Element copyElementForReadIfNeeded(Element element); } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy); Element copyElementForReadIfNeeded(Element element); } |
@Test public void given_copy_on_read_and_write_when_isCopyActive_then_false() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(true, false, copyStrategy); assertThat(copyStrategyHandler.isCopyActive(), is(true)); } | boolean isCopyActive() { return copyOnRead || copyOnWrite; } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy); } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy); Element copyElementForReadIfNeeded(Element element); } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy); Element copyElementForReadIfNeeded(Element element); } |
@Test public void given_no_copy_when_copyElementForReadIfNeeded_with_Element_then_returns_same() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(false, false, null); Element element = new Element("key", "value"); assertThat(copyStrategyHandler.copyElementForReadIfNeeded(element), sameInstance(elemen... | public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } } | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } C... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } C... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } C... |
@Test public void given_no_copy_when_copyElementForReadIfNeeded_with_null_then_returns_null() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(false, false, null); assertThat(copyStrategyHandler.copyElementForReadIfNeeded(null), nullValue()); } | public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } } | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } C... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } C... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } C... |
@Test public void given_no_copy_when_copyElementForWriteIfNeeded_with_Element_then_returns_same() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(false, false, null); Element element = new Element("key", "value"); assertThat(copyStrategyHandler.copyElementForWriteIfNeeded(element), sameInstance(elem... | Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } } | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } CopyS... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } CopyS... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } CopyS... |
@Test public void given_no_copy_when_copyElementForWriteIfNeeded_with_null_then_returns_null() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(false, false, null); assertThat(copyStrategyHandler.copyElementForWriteIfNeeded(null), nullValue()); } | Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } } | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } CopyS... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } CopyS... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } CopyS... |
@Test public void given_no_copy_when_copyElementForRemovalIfNeeded_with_Element_then_returns_same() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(false, false, null); Element element = new Element("key", "value"); assertThat(copyStrategyHandler.copyElementForRemovalIfNeeded(element), sameInstance(... | Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copySt... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copySt... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copySt... |
@Test public void given_no_copy_when_copyElementForRemovalIfNeeded_with_null_then_returns_null() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(false, false, null); assertThat(copyStrategyHandler.copyElementForRemovalIfNeeded(null), nullValue()); } | Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copySt... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copySt... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copySt... |
@Test public void given_copy_on_read_when_copyElementForReadIfNeeded_with_Element_then_returns_different() { Element element = new Element("key", "value"); Element serial = new Element("key", new byte[] { }); when(copyStrategy.copyForWrite(element)).thenReturn(serial); when(copyStrategy.copyForRead(serial)).thenReturn(... | public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } } | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } C... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } C... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } C... |
@Test public void given_copy_on_read_when_copyElementForReadIfNeeded_with_null_then_returns_null() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(true, false, copyStrategy); assertThat(copyStrategyHandler.copyElementForReadIfNeeded(null), nullValue()); } | public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } } | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } C... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } C... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } C... |
@Test public void testNonSerializableAreNotSerializable() { Element elementWithObjectKey = new Element(new Object(), "1"); assertFalse(elementWithObjectKey.isSerializable()); Element elementWithObjectValue = new Element("1", new Object()); assertFalse(elementWithObjectValue.isSerializable()); Element elementWithObjectK... | public final boolean isSerializable() { return isKeySerializable() && (value instanceof Serializable || value == null); } | Element implements Serializable, Cloneable { public final boolean isSerializable() { return isKeySerializable() && (value instanceof Serializable || value == null); } } | Element implements Serializable, Cloneable { public final boolean isSerializable() { return isKeySerializable() && (value instanceof Serializable || value == null); } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, final long version); @Depre... | Element implements Serializable, Cloneable { public final boolean isSerializable() { return isKeySerializable() && (value instanceof Serializable || value == null); } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, final long version); @Depre... | Element implements Serializable, Cloneable { public final boolean isSerializable() { return isKeySerializable() && (value instanceof Serializable || value == null); } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, final long version); @Depre... |
@Test public void given_copy_on_read_when_copyElementForWriteIfNeeded_with_Element_then_returns_same() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(true, false, copyStrategy); Element element = new Element("key", "value"); assertThat(copyStrategyHandler.copyElementForWriteIfNeeded(element), sameI... | Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } } | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } CopyS... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } CopyS... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } CopyS... |
@Test public void given_copy_on_read_when_copyElementForWriteIfNeeded_with_null_then_returns_null() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(true, false, copyStrategy); assertThat(copyStrategyHandler.copyElementForWriteIfNeeded(null), nullValue()); } | Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } } | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } CopyS... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } CopyS... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } CopyS... |
@Test public void given_copy_on_read_when_copyElementForRemovalIfNeeded_with_Element_then_returns_same() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(true, false, copyStrategy); Element element = new Element("key", "value"); assertThat(copyStrategyHandler.copyElementForRemovalIfNeeded(element), s... | Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copySt... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copySt... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copySt... |
@Test public void given_copy_on_read_when_copyElementForRemovalIfNeeded_with_null_then_returns_null() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(true, false, copyStrategy); assertThat(copyStrategyHandler.copyElementForRemovalIfNeeded(null), nullValue()); } | Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copySt... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copySt... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copySt... |
@Test public void given_copy_on_write_when_copyElementForReadIfNeeded_with_Element_then_returns_same() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(false, true, copyStrategy); Element element = new Element("key", "value"); assertThat(copyStrategyHandler.copyElementForReadIfNeeded(element), sameIn... | public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } } | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } C... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } C... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } C... |
@Test public void given_copy_on_write_when_copyElementForReadIfNeeded_with_null_then_returns_null() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(false, true, copyStrategy); assertThat(copyStrategyHandler.copyElementForReadIfNeeded(null), nullValue()); } | public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } } | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } C... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } C... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } C... |
@Test public void given_copy_on_write_when_copyElementForWriteIfNeeded_with_Element_then_returns_different() { Element element = new Element("key", "value"); Element serial = new Element("key", new byte[] { }); when(copyStrategy.copyForWrite(element)).thenReturn(serial); when(copyStrategy.copyForRead(serial)).thenRetur... | Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } } | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } CopyS... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } CopyS... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } CopyS... |
@Test public void given_copy_on_write_when_copyElementForWriteIfNeeded_with_null_then_returns_null() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(false, true, copyStrategy); assertThat(copyStrategyHandler.copyElementForWriteIfNeeded(null), nullValue()); } | Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } } | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } CopyS... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } CopyS... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } CopyS... |
@Test public void given_copy_on_write_when_copyElementForRemovalIfNeeded_with_Element_then_returns_same() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(false, true, copyStrategy); Element element = new Element("key", "value"); assertThat(copyStrategyHandler.copyElementForRemovalIfNeeded(element), ... | Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copySt... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copySt... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copySt... |
@Test public void given_copy_on_write_when_copyElementForRemovalIfNeeded_with_null_then_returns_null() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(false, true, copyStrategy); assertThat(copyStrategyHandler.copyElementForRemovalIfNeeded(null), nullValue()); } | Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copySt... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copySt... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copySt... |
@Test public void testEquals() { Element element = new Element("key", "value"); assertTrue(element.equals(element)); assertTrue(element.equals(new Element("key", "hat"))); assertFalse(element.equals("dog")); assertFalse(element.equals(null)); assertFalse(element.equals(new Element("cat", "hat"))); } | @Override public final boolean equals(final Object object) { if (object == null || !(object instanceof Element)) { return false; } Element element = (Element) object; if (key == null || element.getObjectKey() == null) { return false; } return key.equals(element.getObjectKey()); } | Element implements Serializable, Cloneable { @Override public final boolean equals(final Object object) { if (object == null || !(object instanceof Element)) { return false; } Element element = (Element) object; if (key == null || element.getObjectKey() == null) { return false; } return key.equals(element.getObjectKey(... | Element implements Serializable, Cloneable { @Override public final boolean equals(final Object object) { if (object == null || !(object instanceof Element)) { return false; } Element element = (Element) object; if (key == null || element.getObjectKey() == null) { return false; } return key.equals(element.getObjectKey(... | Element implements Serializable, Cloneable { @Override public final boolean equals(final Object object) { if (object == null || !(object instanceof Element)) { return false; } Element element = (Element) object; if (key == null || element.getObjectKey() == null) { return false; } return key.equals(element.getObjectKey(... | Element implements Serializable, Cloneable { @Override public final boolean equals(final Object object) { if (object == null || !(object instanceof Element)) { return false; } Element element = (Element) object; if (key == null || element.getObjectKey() == null) { return false; } return key.equals(element.getObjectKey(... |
@Test public void given_copy_on_read_and_write_when_copyElementForReadIfNeeded_with_Element_then_returns_different() { Element element = new Element("key", "value"); Element serial = new Element("key", new byte[] { }); when(copyStrategy.copyForRead(serial)).thenReturn(new Element("key", "value")); CopyStrategyHandler c... | public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } } | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } C... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } C... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } C... |
@Test public void given_copy_on_read_and_write_when_copyElementForReadIfNeeded_with_null_then_returns_null() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(true, true, copyStrategy); assertThat(copyStrategyHandler.copyElementForReadIfNeeded(null), nullValue()); } | public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } } | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } C... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } C... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } C... |
@Test public void given_copy_on_read_and_write_when_copyElementForWriteIfNeeded_with_Element_then_returns_different() { Element element = new Element("key", "value"); Element serial = new Element("key", new byte[] { }); when(copyStrategy.copyForWrite(element)).thenReturn(new Element("key", new byte[] { })); CopyStrateg... | Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } } | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } CopyS... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } CopyS... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } CopyS... |
@Test public void given_copy_on_read_and_write_when_copyElementForWriteIfNeeded_with_null_then_returns_null() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(true, true, copyStrategy); assertThat(copyStrategyHandler.copyElementForWriteIfNeeded(null), nullValue()); } | Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } } | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } CopyS... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } CopyS... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return element; } } CopyS... |
@Test public void given_copy_on_read_and_write_when_copyElementForRemovalIfNeeded_with_Element_then_returns_different() { Element element = new Element("key", "value"); Element serial = new Element("key", new byte[] { }); when(copyStrategy.copyForWrite(element)).thenReturn(new Element("key", new byte[] { })); CopyStrat... | Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copySt... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copySt... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copySt... |
@Test public void given_copy_on_read_and_write_when_copyElementForRemovalIfNeeded_with_null_then_returns_null() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(true, true, copyStrategy); assertThat(copyStrategyHandler.copyElementForRemovalIfNeeded(null), nullValue()); } | Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copySt... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copySt... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copySt... |
@Test public void testEqualsCharacterizationTestWithWhichWeDoNotAgree() { Element element = new Element(null, "value"); assertFalse(element.equals(new Element(null, "hat"))); assertFalse(element.equals(element)); } | @Override public final boolean equals(final Object object) { if (object == null || !(object instanceof Element)) { return false; } Element element = (Element) object; if (key == null || element.getObjectKey() == null) { return false; } return key.equals(element.getObjectKey()); } | Element implements Serializable, Cloneable { @Override public final boolean equals(final Object object) { if (object == null || !(object instanceof Element)) { return false; } Element element = (Element) object; if (key == null || element.getObjectKey() == null) { return false; } return key.equals(element.getObjectKey(... | Element implements Serializable, Cloneable { @Override public final boolean equals(final Object object) { if (object == null || !(object instanceof Element)) { return false; } Element element = (Element) object; if (key == null || element.getObjectKey() == null) { return false; } return key.equals(element.getObjectKey(... | Element implements Serializable, Cloneable { @Override public final boolean equals(final Object object) { if (object == null || !(object instanceof Element)) { return false; } Element element = (Element) object; if (key == null || element.getObjectKey() == null) { return false; } return key.equals(element.getObjectKey(... | Element implements Serializable, Cloneable { @Override public final boolean equals(final Object object) { if (object == null || !(object instanceof Element)) { return false; } Element element = (Element) object; if (key == null || element.getObjectKey() == null) { return false; } return key.equals(element.getObjectKey(... |
@Test public void testSetsCreationTimeAtConstruction() throws InterruptedException { final long initialValue = new Random().nextLong(); final AtomicLong now = new AtomicLong(initialValue); Element element = new Element("", "") { @Override long getCurrentTime() { return now.get(); } }; assertThat(element.getCreationTime... | public final long getCreationTime() { return creationTime; } | Element implements Serializable, Cloneable { public final long getCreationTime() { return creationTime; } } | Element implements Serializable, Cloneable { public final long getCreationTime() { return creationTime; } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, final long version); @Deprecated Element(final Object key, final Object value, final lo... | Element implements Serializable, Cloneable { public final long getCreationTime() { return creationTime; } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, final long version); @Deprecated Element(final Object key, final Object value, final lo... | Element implements Serializable, Cloneable { public final long getCreationTime() { return creationTime; } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, final long version); @Deprecated Element(final Object key, final Object value, final lo... |
@Test public void testGetLatestOfCreationAndUpdateTimeReturnsCreationWhenNotUpdated() { final long initialValue = new Random().nextLong(); final AtomicLong now = new AtomicLong(initialValue); Element element = new Element("", "") { @Override long getCurrentTime() { return now.get(); } }; assertThat(element.getLatestOfC... | public final long getLatestOfCreationAndUpdateTime() { if (0 == lastUpdateTime) { return creationTime; } else { return lastUpdateTime; } } | Element implements Serializable, Cloneable { public final long getLatestOfCreationAndUpdateTime() { if (0 == lastUpdateTime) { return creationTime; } else { return lastUpdateTime; } } } | Element implements Serializable, Cloneable { public final long getLatestOfCreationAndUpdateTime() { if (0 == lastUpdateTime) { return creationTime; } else { return lastUpdateTime; } } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, final long... | Element implements Serializable, Cloneable { public final long getLatestOfCreationAndUpdateTime() { if (0 == lastUpdateTime) { return creationTime; } else { return lastUpdateTime; } } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, final long... | Element implements Serializable, Cloneable { public final long getLatestOfCreationAndUpdateTime() { if (0 == lastUpdateTime) { return creationTime; } else { return lastUpdateTime; } } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, final long... |
@Test public void testCreatingNewClusteredCacheManagerEntity() { String name = "newCM"; net.sf.ehcache.config.Configuration configuration = new net.sf.ehcache.config.Configuration(); ClusteredEntityManager clusteredEntityManager = mock(ClusteredEntityManager.class); doAnswer(new Answer() { @Override public Object answe... | @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getR... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... |
@Test public void testInitialiseFailures() { final String name = "testInitialiseFailures2"; Cache cache = new Cache(name, 1, false, false, 5, 1); manager.addCache(cache); try { cache.initialise(); fail("Calling cache.initialise() multiple times should fail with IllegalStateException"); } catch (IllegalStateException e)... | public void initialise() { synchronized (this) { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } Pool onHeapPool; if (configuration.getMaxBytesLocalHeap() > 0) { PoolEvictor evictor = new... | Cache implements InternalEhcache, StoreListener { public void initialise() { synchronized (this) { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } Pool onHeapPool; if (configuration.getMa... | Cache implements InternalEhcache, StoreListener { public void initialise() { synchronized (this) { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } Pool onHeapPool; if (configuration.getMa... | Cache implements InternalEhcache, StoreListener { public void initialise() { synchronized (this) { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } Pool onHeapPool; if (configuration.getMa... | Cache implements InternalEhcache, StoreListener { public void initialise() { synchronized (this) { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } Pool onHeapPool; if (configuration.getMa... |
@Test public void testExpirationTimeWhenNotSet() { final Element element = new Element("foo", "bar"); assertThat(element.getExpirationTime(), is(Long.MAX_VALUE)); } | public long getExpirationTime() { if (!isLifespanSet() || isEternal()) { return Long.MAX_VALUE; } long expirationTime = 0; long ttlExpiry = creationTime + TimeUtil.toMillis(getTimeToLive()); long mostRecentTime = Math.max(creationTime, lastAccessTime); long ttiExpiry = mostRecentTime + TimeUtil.toMillis(getTimeToIdle()... | Element implements Serializable, Cloneable { public long getExpirationTime() { if (!isLifespanSet() || isEternal()) { return Long.MAX_VALUE; } long expirationTime = 0; long ttlExpiry = creationTime + TimeUtil.toMillis(getTimeToLive()); long mostRecentTime = Math.max(creationTime, lastAccessTime); long ttiExpiry = mostR... | Element implements Serializable, Cloneable { public long getExpirationTime() { if (!isLifespanSet() || isEternal()) { return Long.MAX_VALUE; } long expirationTime = 0; long ttlExpiry = creationTime + TimeUtil.toMillis(getTimeToLive()); long mostRecentTime = Math.max(creationTime, lastAccessTime); long ttiExpiry = mostR... | Element implements Serializable, Cloneable { public long getExpirationTime() { if (!isLifespanSet() || isEternal()) { return Long.MAX_VALUE; } long expirationTime = 0; long ttlExpiry = creationTime + TimeUtil.toMillis(getTimeToLive()); long mostRecentTime = Math.max(creationTime, lastAccessTime); long ttiExpiry = mostR... | Element implements Serializable, Cloneable { public long getExpirationTime() { if (!isLifespanSet() || isEternal()) { return Long.MAX_VALUE; } long expirationTime = 0; long ttlExpiry = creationTime + TimeUtil.toMillis(getTimeToLive()); long mostRecentTime = Math.max(creationTime, lastAccessTime); long ttiExpiry = mostR... |
@Test public void testDoesNotDefaultToEternal() { final Element element = new Element("key", "bar"); assertThat(element.isEternal(), is(false)); } | public boolean isEternal() { return (0 == timeToIdle) && (0 == timeToLive); } | Element implements Serializable, Cloneable { public boolean isEternal() { return (0 == timeToIdle) && (0 == timeToLive); } } | Element implements Serializable, Cloneable { public boolean isEternal() { return (0 == timeToIdle) && (0 == timeToLive); } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, final long version); @Deprecated Element(final Object key, final Objec... | Element implements Serializable, Cloneable { public boolean isEternal() { return (0 == timeToIdle) && (0 == timeToLive); } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, final long version); @Deprecated Element(final Object key, final Objec... | Element implements Serializable, Cloneable { public boolean isEternal() { return (0 == timeToIdle) && (0 == timeToLive); } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, final long version); @Deprecated Element(final Object key, final Objec... |
@Test public void testIdNotSetByDefault() { Element e = new Element("foo", "bar"); assertThat(e.hasId(), is(false)); } | boolean hasId() { return id != NOT_SET_ID; } | Element implements Serializable, Cloneable { boolean hasId() { return id != NOT_SET_ID; } } | Element implements Serializable, Cloneable { boolean hasId() { return id != NOT_SET_ID; } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, final long version); @Deprecated Element(final Object key, final Object value, final long version,
... | Element implements Serializable, Cloneable { boolean hasId() { return id != NOT_SET_ID; } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, final long version); @Deprecated Element(final Object key, final Object value, final long version,
... | Element implements Serializable, Cloneable { boolean hasId() { return id != NOT_SET_ID; } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, final long version); @Deprecated Element(final Object key, final Object value, final long version,
... |
@Test public void testEnumValue() throws CustomParseException { MEnum<Foo> enumVal = new MValue.MEnum<Foo>(null, Foo.class.getName(), "Bar"); Enum<Foo> obj = enumVal.asJavaObject(); Assert.assertEquals(Foo.Bar, obj); try { new MValue.MEnum<Foo>(null, Foo.class.getName(), "Barr"); Assert.fail(); } catch (Exception e) { ... | public T asJavaObject() { return javaObject; } | MValue implements ModelElement<T> { public T asJavaObject() { return javaObject; } } | MValue implements ModelElement<T> { public T asJavaObject() { return javaObject; } MValue(Token tok, String typeName, Message errMessage, String value); } | MValue implements ModelElement<T> { public T asJavaObject() { return javaObject; } MValue(Token tok, String typeName, Message errMessage, String value); T asJavaObject(); T asEhcacheObject(); @Override String toString(); String getTypeName(); String getValue(); @Override int hashCode(); @Override boolean equals(Object ... | MValue implements ModelElement<T> { public T asJavaObject() { return javaObject; } MValue(Token tok, String typeName, Message errMessage, String value); T asJavaObject(); T asEhcacheObject(); @Override String toString(); String getTypeName(); String getValue(); @Override int hashCode(); @Override boolean equals(Object ... |
@Test public void testSetIdThrowsWhenSetToZero() { Element e = new Element("foo", "bar"); try { e.setId(0); fail(); } catch (IllegalArgumentException _) { } } | void setId(final long id) { if (id == NOT_SET_ID) { throw new IllegalArgumentException("Id cannot be set to " + id); } this.id = id; } | Element implements Serializable, Cloneable { void setId(final long id) { if (id == NOT_SET_ID) { throw new IllegalArgumentException("Id cannot be set to " + id); } this.id = id; } } | Element implements Serializable, Cloneable { void setId(final long id) { if (id == NOT_SET_ID) { throw new IllegalArgumentException("Id cannot be set to " + id); } this.id = id; } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, final long ver... | Element implements Serializable, Cloneable { void setId(final long id) { if (id == NOT_SET_ID) { throw new IllegalArgumentException("Id cannot be set to " + id); } this.id = id; } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, final long ver... | Element implements Serializable, Cloneable { void setId(final long id) { if (id == NOT_SET_ID) { throw new IllegalArgumentException("Id cannot be set to " + id); } this.id = id; } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, final long ver... |
@Test public void testDefaultsToProperDefaultClass() { try { newQueryManagerBuilder(); } catch (CacheException e) { Assert.assertTrue(e.getCause().getClass() == ClassNotFoundException.class); } } | public static QueryManagerBuilder newQueryManagerBuilder() { return new QueryManagerBuilder(); } | QueryManagerBuilder { public static QueryManagerBuilder newQueryManagerBuilder() { return new QueryManagerBuilder(); } } | QueryManagerBuilder { public static QueryManagerBuilder newQueryManagerBuilder() { return new QueryManagerBuilder(); } private QueryManagerBuilder(); QueryManagerBuilder(Class<? extends QueryManager> implementationClass); } | QueryManagerBuilder { public static QueryManagerBuilder newQueryManagerBuilder() { return new QueryManagerBuilder(); } private QueryManagerBuilder(); QueryManagerBuilder(Class<? extends QueryManager> implementationClass); static QueryManagerBuilder newQueryManagerBuilder(); QueryManagerBuilder addCache(Ehcache cache... | QueryManagerBuilder { public static QueryManagerBuilder newQueryManagerBuilder() { return new QueryManagerBuilder(); } private QueryManagerBuilder(); QueryManagerBuilder(Class<? extends QueryManager> implementationClass); static QueryManagerBuilder newQueryManagerBuilder(); QueryManagerBuilder addCache(Ehcache cache... |
@Test public void testMaximumDatagram() throws IOException { String payload = createReferenceString(); final byte[] compressed = PayloadUtil.gzip(payload.getBytes()); int length = compressed.length; LOG.info("gzipped size: " + length); assertTrue("Heartbeat too big for one Datagram " + length, length <= 1500); } | public static byte[] gzip(byte[] ungzipped) { final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); try { final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(bytes); gzipOutputStream.write(ungzipped); gzipOutputStream.close(); } catch (IOException e) { LOG.error("Could not gzip " + Arrays.toString... | PayloadUtil { public static byte[] gzip(byte[] ungzipped) { final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); try { final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(bytes); gzipOutputStream.write(ungzipped); gzipOutputStream.close(); } catch (IOException e) { LOG.error("Could not gzip " + A... | PayloadUtil { public static byte[] gzip(byte[] ungzipped) { final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); try { final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(bytes); gzipOutputStream.write(ungzipped); gzipOutputStream.close(); } catch (IOException e) { LOG.error("Could not gzip " + A... | PayloadUtil { public static byte[] gzip(byte[] ungzipped) { final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); try { final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(bytes); gzipOutputStream.write(ungzipped); gzipOutputStream.close(); } catch (IOException e) { LOG.error("Could not gzip " + A... | PayloadUtil { public static byte[] gzip(byte[] ungzipped) { final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); try { final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(bytes); gzipOutputStream.write(ungzipped); gzipOutputStream.close(); } catch (IOException e) { LOG.error("Could not gzip " + A... |
@Test public void testBigPayload() throws RemoteException { List<CachePeer> bigPayloadList = new ArrayList<CachePeer>(); int peers = 5000; int minCacheNameSize = 50; int maxCacheNameSize = 500; for (int i = 0; i < peers; i++) { bigPayloadList.add(new PayloadUtilTestCachePeer(getRandomName(minCacheNameSize, maxCacheName... | public static List<byte[]> createCompressedPayloadList(final List<CachePeer> localCachePeers, final int maximumPeersPerSend) { List<byte[]> rv = new ArrayList<byte[]>(); int iters = (int) Math.ceil((double) localCachePeers.size() / maximumPeersPerSend); for (int i = 0; i < iters; i++) { int fromIndex = maximumPeersPerS... | PayloadUtil { public static List<byte[]> createCompressedPayloadList(final List<CachePeer> localCachePeers, final int maximumPeersPerSend) { List<byte[]> rv = new ArrayList<byte[]>(); int iters = (int) Math.ceil((double) localCachePeers.size() / maximumPeersPerSend); for (int i = 0; i < iters; i++) { int fromIndex = ma... | PayloadUtil { public static List<byte[]> createCompressedPayloadList(final List<CachePeer> localCachePeers, final int maximumPeersPerSend) { List<byte[]> rv = new ArrayList<byte[]>(); int iters = (int) Math.ceil((double) localCachePeers.size() / maximumPeersPerSend); for (int i = 0; i < iters; i++) { int fromIndex = ma... | PayloadUtil { public static List<byte[]> createCompressedPayloadList(final List<CachePeer> localCachePeers, final int maximumPeersPerSend) { List<byte[]> rv = new ArrayList<byte[]>(); int iters = (int) Math.ceil((double) localCachePeers.size() / maximumPeersPerSend); for (int i = 0; i < iters; i++) { int fromIndex = ma... | PayloadUtil { public static List<byte[]> createCompressedPayloadList(final List<CachePeer> localCachePeers, final int maximumPeersPerSend) { List<byte[]> rv = new ArrayList<byte[]>(); int iters = (int) Math.ceil((double) localCachePeers.size() / maximumPeersPerSend); for (int i = 0; i < iters; i++) { int fromIndex = ma... |
@Test public void testSerialization() throws IOException, ClassNotFoundException { RmiEventMessage eventMessage = new RmiEventMessage(null, RmiEventType.PUT, "key", new Element("key", "element")); ByteArrayOutputStream bout = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bout); oos.writeO... | public final Serializable getSerializableKey() { return key; } | EventMessage implements Serializable { public final Serializable getSerializableKey() { return key; } } | EventMessage implements Serializable { public final Serializable getSerializableKey() { return key; } EventMessage(Ehcache cache, Serializable key); } | EventMessage implements Serializable { public final Serializable getSerializableKey() { return key; } EventMessage(Ehcache cache, Serializable key); final Ehcache getEhcache(); final Serializable getSerializableKey(); } | EventMessage implements Serializable { public final Serializable getSerializableKey() { return key; } EventMessage(Ehcache cache, Serializable key); final Ehcache getEhcache(); final Serializable getSerializableKey(); } |
@Test public void testNotifyTerracottaStoreOfListenerChangeOnRegister() throws Exception { TerracottaStore store = mock(TerracottaStore.class); RegisteredEventListeners registeredEventListeners = createRegisteredEventListeners(store); CacheEventListener listener = mock(CacheEventListener.class); registeredEventListener... | public final boolean registerListener(CacheEventListener cacheEventListener) { return registerListener(cacheEventListener, NotificationScope.ALL); } | RegisteredEventListeners { public final boolean registerListener(CacheEventListener cacheEventListener) { return registerListener(cacheEventListener, NotificationScope.ALL); } } | RegisteredEventListeners { public final boolean registerListener(CacheEventListener cacheEventListener) { return registerListener(cacheEventListener, NotificationScope.ALL); } RegisteredEventListeners(Cache cache); RegisteredEventListeners(Ehcache cache, CacheStoreHelper helper); } | RegisteredEventListeners { public final boolean registerListener(CacheEventListener cacheEventListener) { return registerListener(cacheEventListener, NotificationScope.ALL); } RegisteredEventListeners(Cache cache); RegisteredEventListeners(Ehcache cache, CacheStoreHelper helper); final void notifyElementUpdatedOrdered... | RegisteredEventListeners { public final boolean registerListener(CacheEventListener cacheEventListener) { return registerListener(cacheEventListener, NotificationScope.ALL); } RegisteredEventListeners(Cache cache); RegisteredEventListeners(Ehcache cache, CacheStoreHelper helper); final void notifyElementUpdatedOrdered... |
@Test public void testEnumValue() throws CustomParseException { MEnum<Foo> enumVal = new MValue.MEnum<Foo>(null, Foo.class.getName(), "Bar"); Enum<Foo> obj = enumVal.asEhcacheObject(getClass().getClassLoader()); Assert.assertEquals(Foo.Bar, obj); try { MEnum<Foo> mEnum = new MValue.MEnum<Foo>(null, Foo.class.getName(),... | public T asEhcacheObject(ClassLoader loader) { return javaObject; } | MValue implements ModelElement<T> { public T asEhcacheObject(ClassLoader loader) { return javaObject; } } | MValue implements ModelElement<T> { public T asEhcacheObject(ClassLoader loader) { return javaObject; } MValue(Token tok, String typeName, Message errMessage, String value); } | MValue implements ModelElement<T> { public T asEhcacheObject(ClassLoader loader) { return javaObject; } MValue(Token tok, String typeName, Message errMessage, String value); T asEhcacheObject(ClassLoader loader); @Override String toString(); String getTypeName(); String getValue(); @Override int hashCode(); @Override b... | MValue implements ModelElement<T> { public T asEhcacheObject(ClassLoader loader) { return javaObject; } MValue(Token tok, String typeName, Message errMessage, String value); T asEhcacheObject(ClassLoader loader); @Override String toString(); String getTypeName(); String getValue(); @Override int hashCode(); @Override b... |
@Test public void testTryingToCreateNewClusteredCacheManagerEntityButLooseRace() { String name = "newCM"; net.sf.ehcache.config.Configuration configuration = new net.sf.ehcache.config.Configuration(); ClusteredEntityManager clusteredEntityManager = mock(ClusteredEntityManager.class); when(clusteredEntityManager.addRoot... | @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getR... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... |
@Test public void testNonEnumValue() throws CustomParseException { try { MEnum<Foo> mEnum = new MValue.MEnum<Foo>(null, Boolean.class.getName(), "TRUE"); mEnum.asEhcacheObject(getClass().getClassLoader()); Assert.fail(); } catch (Exception e) { } } | public T asEhcacheObject(ClassLoader loader) { return javaObject; } | MValue implements ModelElement<T> { public T asEhcacheObject(ClassLoader loader) { return javaObject; } } | MValue implements ModelElement<T> { public T asEhcacheObject(ClassLoader loader) { return javaObject; } MValue(Token tok, String typeName, Message errMessage, String value); } | MValue implements ModelElement<T> { public T asEhcacheObject(ClassLoader loader) { return javaObject; } MValue(Token tok, String typeName, Message errMessage, String value); T asEhcacheObject(ClassLoader loader); @Override String toString(); String getTypeName(); String getValue(); @Override int hashCode(); @Override b... | MValue implements ModelElement<T> { public T asEhcacheObject(ClassLoader loader) { return javaObject; } MValue(Token tok, String typeName, Message errMessage, String value); T asEhcacheObject(ClassLoader loader); @Override String toString(); String getTypeName(); String getValue(); @Override int hashCode(); @Override b... |
@Test public void testAccessorDoesNotThrowException() throws Exception { CacheManager cm = new CacheManager(); try { ClusteredInstanceFactoryAccessor.getClusteredInstanceFactory(cm); } finally { cm.shutdown(); } } | public static ClusteredInstanceFactory getClusteredInstanceFactory(CacheManager cacheManager) { try { Field field = CacheManager.class.getDeclaredField("terracottaClient"); field.setAccessible(true); TerracottaClient terracottaClient = (TerracottaClient)field.get(cacheManager); return terracottaClient.getClusteredInsta... | ClusteredInstanceFactoryAccessor { public static ClusteredInstanceFactory getClusteredInstanceFactory(CacheManager cacheManager) { try { Field field = CacheManager.class.getDeclaredField("terracottaClient"); field.setAccessible(true); TerracottaClient terracottaClient = (TerracottaClient)field.get(cacheManager); return... | ClusteredInstanceFactoryAccessor { public static ClusteredInstanceFactory getClusteredInstanceFactory(CacheManager cacheManager) { try { Field field = CacheManager.class.getDeclaredField("terracottaClient"); field.setAccessible(true); TerracottaClient terracottaClient = (TerracottaClient)field.get(cacheManager); return... | ClusteredInstanceFactoryAccessor { public static ClusteredInstanceFactory getClusteredInstanceFactory(CacheManager cacheManager) { try { Field field = CacheManager.class.getDeclaredField("terracottaClient"); field.setAccessible(true); TerracottaClient terracottaClient = (TerracottaClient)field.get(cacheManager); return... | ClusteredInstanceFactoryAccessor { public static ClusteredInstanceFactory getClusteredInstanceFactory(CacheManager cacheManager) { try { Field field = CacheManager.class.getDeclaredField("terracottaClient"); field.setAccessible(true); TerracottaClient terracottaClient = (TerracottaClient)field.get(cacheManager); return... |
@Test public void testCreateCacheEntitiesDisablesNonStop() throws Exception { repositoryService.createCacheEntities(Collections.singleton("testCacheManager"), Collections.singleton("testCache1"), Collections.singleton("Size")); verify(clusteredInstanceFactory, times(2)).enableNonStopForCurrentThread(anyBoolean()); } | @Override public Collection<CacheEntity> createCacheEntities(Set<String> cacheManagerNames, Set<String> cacheNames, Set<String> attributes) { CacheEntityBuilder builder = null; Collection<CacheEntity> entities; cacheManagerSamplerRepoLock.readLock().lock(); List<SamplerRepoEntry> disabledSamplerRepoEntries = new ArrayL... | DfltSamplerRepositoryService extends AbstractRemoteAgentEndpointImpl implements SamplerRepositoryService, EntityResourceFactory, CacheManagerService, CacheService, AgentService,
DfltSamplerRepositoryServiceMBean { @Override public Collection<CacheEntity> createCacheEntities(Set<String> cacheManagerNames, Set<String... | DfltSamplerRepositoryService extends AbstractRemoteAgentEndpointImpl implements SamplerRepositoryService, EntityResourceFactory, CacheManagerService, CacheService, AgentService,
DfltSamplerRepositoryServiceMBean { @Override public Collection<CacheEntity> createCacheEntities(Set<String> cacheManagerNames, Set<String... | DfltSamplerRepositoryService extends AbstractRemoteAgentEndpointImpl implements SamplerRepositoryService, EntityResourceFactory, CacheManagerService, CacheService, AgentService,
DfltSamplerRepositoryServiceMBean { @Override public Collection<CacheEntity> createCacheEntities(Set<String> cacheManagerNames, Set<String... | DfltSamplerRepositoryService extends AbstractRemoteAgentEndpointImpl implements SamplerRepositoryService, EntityResourceFactory, CacheManagerService, CacheService, AgentService,
DfltSamplerRepositoryServiceMBean { @Override public Collection<CacheEntity> createCacheEntities(Set<String> cacheManagerNames, Set<String... |
@Test public void testCreateCacheStatisticSampleEntityDisablesNonStop() throws Exception { repositoryService.createCacheStatisticSampleEntity(Collections.singleton("testCacheManager"), Collections.singleton("testCache1"), Collections.singleton("Size")); verify(clusteredInstanceFactory, times(2)).enableNonStopForCurrent... | @Override public Collection<CacheStatisticSampleEntity> createCacheStatisticSampleEntity(Set<String> cacheManagerNames, Set<String> cacheNames, Set<String> sampleNames) { CacheStatisticSampleEntityBuilder builder = CacheStatisticSampleEntityBuilder.createWith(sampleNames); cacheManagerSamplerRepoLock.readLock().lock();... | DfltSamplerRepositoryService extends AbstractRemoteAgentEndpointImpl implements SamplerRepositoryService, EntityResourceFactory, CacheManagerService, CacheService, AgentService,
DfltSamplerRepositoryServiceMBean { @Override public Collection<CacheStatisticSampleEntity> createCacheStatisticSampleEntity(Set<String> c... | DfltSamplerRepositoryService extends AbstractRemoteAgentEndpointImpl implements SamplerRepositoryService, EntityResourceFactory, CacheManagerService, CacheService, AgentService,
DfltSamplerRepositoryServiceMBean { @Override public Collection<CacheStatisticSampleEntity> createCacheStatisticSampleEntity(Set<String> c... | DfltSamplerRepositoryService extends AbstractRemoteAgentEndpointImpl implements SamplerRepositoryService, EntityResourceFactory, CacheManagerService, CacheService, AgentService,
DfltSamplerRepositoryServiceMBean { @Override public Collection<CacheStatisticSampleEntity> createCacheStatisticSampleEntity(Set<String> c... | DfltSamplerRepositoryService extends AbstractRemoteAgentEndpointImpl implements SamplerRepositoryService, EntityResourceFactory, CacheManagerService, CacheService, AgentService,
DfltSamplerRepositoryServiceMBean { @Override public Collection<CacheStatisticSampleEntity> createCacheStatisticSampleEntity(Set<String> c... |
@Test public void testClearCacheDisablesNonStop() throws Exception { repositoryService.clearCache("testCacheManager", "testCache1"); verify(clusteredInstanceFactory, times(2)).enableNonStopForCurrentThread(anyBoolean()); } | @Override public void clearCache(String cacheManagerName, String cacheName) { cacheManagerSamplerRepoLock.readLock().lock(); SamplerRepoEntry entry = cacheManagerSamplerRepo.get(cacheManagerName); try { enableNonStopFor(entry, false); if (entry != null) entry.clearCache(cacheName); } finally { enableNonStopFor(entry, t... | DfltSamplerRepositoryService extends AbstractRemoteAgentEndpointImpl implements SamplerRepositoryService, EntityResourceFactory, CacheManagerService, CacheService, AgentService,
DfltSamplerRepositoryServiceMBean { @Override public void clearCache(String cacheManagerName, String cacheName) { cacheManagerSamplerRepoL... | DfltSamplerRepositoryService extends AbstractRemoteAgentEndpointImpl implements SamplerRepositoryService, EntityResourceFactory, CacheManagerService, CacheService, AgentService,
DfltSamplerRepositoryServiceMBean { @Override public void clearCache(String cacheManagerName, String cacheName) { cacheManagerSamplerRepoL... | DfltSamplerRepositoryService extends AbstractRemoteAgentEndpointImpl implements SamplerRepositoryService, EntityResourceFactory, CacheManagerService, CacheService, AgentService,
DfltSamplerRepositoryServiceMBean { @Override public void clearCache(String cacheManagerName, String cacheName) { cacheManagerSamplerRepoL... | DfltSamplerRepositoryService extends AbstractRemoteAgentEndpointImpl implements SamplerRepositoryService, EntityResourceFactory, CacheManagerService, CacheService, AgentService,
DfltSamplerRepositoryServiceMBean { @Override public void clearCache(String cacheManagerName, String cacheName) { cacheManagerSamplerRepoL... |
@Test public void testGetClasses() throws Exception { List<String> classpathElements = getClasspathElements(); ApplicationEhCache applicationEhCache = new ApplicationEhCache(); Set<Class<?>> applicationClasses = applicationEhCache.getClasses(); Set<Class<?>> allClassesFound = new HashSet<Class<?>>(); for (String cpElem... | public Set<Class<?>> getClasses() { Set<Class<?>> s = new HashSet<Class<?>>(super.getClasses()); s.add(net.sf.ehcache.management.resource.services.ElementsResourceServiceImpl.class); s.add(net.sf.ehcache.management.resource.services.CacheStatisticSamplesResourceServiceImpl.class); s.add(net.sf.ehcache.management.resour... | ApplicationEhCache extends DefaultApplication { public Set<Class<?>> getClasses() { Set<Class<?>> s = new HashSet<Class<?>>(super.getClasses()); s.add(net.sf.ehcache.management.resource.services.ElementsResourceServiceImpl.class); s.add(net.sf.ehcache.management.resource.services.CacheStatisticSamplesResourceServiceImp... | ApplicationEhCache extends DefaultApplication { public Set<Class<?>> getClasses() { Set<Class<?>> s = new HashSet<Class<?>>(super.getClasses()); s.add(net.sf.ehcache.management.resource.services.ElementsResourceServiceImpl.class); s.add(net.sf.ehcache.management.resource.services.CacheStatisticSamplesResourceServiceImp... | ApplicationEhCache extends DefaultApplication { public Set<Class<?>> getClasses() { Set<Class<?>> s = new HashSet<Class<?>>(super.getClasses()); s.add(net.sf.ehcache.management.resource.services.ElementsResourceServiceImpl.class); s.add(net.sf.ehcache.management.resource.services.CacheStatisticSamplesResourceServiceImp... | ApplicationEhCache extends DefaultApplication { public Set<Class<?>> getClasses() { Set<Class<?>> s = new HashSet<Class<?>>(super.getClasses()); s.add(net.sf.ehcache.management.resource.services.ElementsResourceServiceImpl.class); s.add(net.sf.ehcache.management.resource.services.CacheStatisticSamplesResourceServiceImp... |
@Test public void testConfigurationSavedContainsNoCachesAnymore() { String name = "newCM"; net.sf.ehcache.config.Configuration configuration = new net.sf.ehcache.config.Configuration(); configuration.addCache(new CacheConfiguration("test", 1)); ClusteredEntityManager clusteredEntityManager = mock(ClusteredEntityManager... | @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getR... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... |
@Test(expected = UnsupportedOperationException.class) public void clusteredStore_putIfAbsent_throw_in_eventual_consistency() { clusteredStore.putIfAbsent(new Element("key", "value")); } | @Override public Element putIfAbsent(Element element) throws NullPointerException { if (isEventual && !EVENTUAL_CAS_ENABLED) { throw new UnsupportedOperationException("CAS operations are not supported in eventual consistency mode, consider using a StronglyConsistentCacheAccessor"); } String pKey = generatePortableKeyFo... | ClusteredStore implements TerracottaStore, StoreListener { @Override public Element putIfAbsent(Element element) throws NullPointerException { if (isEventual && !EVENTUAL_CAS_ENABLED) { throw new UnsupportedOperationException("CAS operations are not supported in eventual consistency mode, consider using a StronglyConsi... | ClusteredStore implements TerracottaStore, StoreListener { @Override public Element putIfAbsent(Element element) throws NullPointerException { if (isEventual && !EVENTUAL_CAS_ENABLED) { throw new UnsupportedOperationException("CAS operations are not supported in eventual consistency mode, consider using a StronglyConsi... | ClusteredStore implements TerracottaStore, StoreListener { @Override public Element putIfAbsent(Element element) throws NullPointerException { if (isEventual && !EVENTUAL_CAS_ENABLED) { throw new UnsupportedOperationException("CAS operations are not supported in eventual consistency mode, consider using a StronglyConsi... | ClusteredStore implements TerracottaStore, StoreListener { @Override public Element putIfAbsent(Element element) throws NullPointerException { if (isEventual && !EVENTUAL_CAS_ENABLED) { throw new UnsupportedOperationException("CAS operations are not supported in eventual consistency mode, consider using a StronglyConsi... |
@Test(expected = UnsupportedOperationException.class) public void clusteredStore_replace_1_arg_throw_in_eventual_consistency() { clusteredStore.replace(new Element("key", "value")); } | @Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual) { return replaceEventual(old, element, comparator); } String pKey = generatePortableKeyFor(element.getKey()); ToolkitReadWriteLock lock = backend.crea... | ClusteredStore implements TerracottaStore, StoreListener { @Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual) { return replaceEventual(old, element, comparator); } String pKey = generatePortableKeyFor(... | ClusteredStore implements TerracottaStore, StoreListener { @Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual) { return replaceEventual(old, element, comparator); } String pKey = generatePortableKeyFor(... | ClusteredStore implements TerracottaStore, StoreListener { @Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual) { return replaceEventual(old, element, comparator); } String pKey = generatePortableKeyFor(... | ClusteredStore implements TerracottaStore, StoreListener { @Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual) { return replaceEventual(old, element, comparator); } String pKey = generatePortableKeyFor(... |
@Test(expected = UnsupportedOperationException.class) public void clusteredStore_replace_2_args_throw_in_eventual_consistency() { clusteredStore.replace(new Element("key", "value"), new Element("key", "other"), new DefaultElementValueComparator(cacheConfiguration)); } | @Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual) { return replaceEventual(old, element, comparator); } String pKey = generatePortableKeyFor(element.getKey()); ToolkitReadWriteLock lock = backend.crea... | ClusteredStore implements TerracottaStore, StoreListener { @Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual) { return replaceEventual(old, element, comparator); } String pKey = generatePortableKeyFor(... | ClusteredStore implements TerracottaStore, StoreListener { @Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual) { return replaceEventual(old, element, comparator); } String pKey = generatePortableKeyFor(... | ClusteredStore implements TerracottaStore, StoreListener { @Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual) { return replaceEventual(old, element, comparator); } String pKey = generatePortableKeyFor(... | ClusteredStore implements TerracottaStore, StoreListener { @Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual) { return replaceEventual(old, element, comparator); } String pKey = generatePortableKeyFor(... |
@Test(expected = UnsupportedOperationException.class) public void clusteredStore_removeElement_throw_in_eventual_consistency() { clusteredStore.removeElement(new Element("key", "value"), new DefaultElementValueComparator(cacheConfiguration)); } | @Override public Element removeElement(Element element, ElementValueComparator comparator) throws NullPointerException { if (isEventual) { return removeElementEventual(element, comparator); } String pKey = generatePortableKeyFor(element.getKey()); ToolkitReadWriteLock lock = backend.createLockForKey(pKey); lock.writeLo... | ClusteredStore implements TerracottaStore, StoreListener { @Override public Element removeElement(Element element, ElementValueComparator comparator) throws NullPointerException { if (isEventual) { return removeElementEventual(element, comparator); } String pKey = generatePortableKeyFor(element.getKey()); ToolkitReadWr... | ClusteredStore implements TerracottaStore, StoreListener { @Override public Element removeElement(Element element, ElementValueComparator comparator) throws NullPointerException { if (isEventual) { return removeElementEventual(element, comparator); } String pKey = generatePortableKeyFor(element.getKey()); ToolkitReadWr... | ClusteredStore implements TerracottaStore, StoreListener { @Override public Element removeElement(Element element, ElementValueComparator comparator) throws NullPointerException { if (isEventual) { return removeElementEventual(element, comparator); } String pKey = generatePortableKeyFor(element.getKey()); ToolkitReadWr... | ClusteredStore implements TerracottaStore, StoreListener { @Override public Element removeElement(Element element, ElementValueComparator comparator) throws NullPointerException { if (isEventual) { return removeElementEventual(element, comparator); } String pKey = generatePortableKeyFor(element.getKey()); ToolkitReadWr... |
@Test public void testConfigurationSavedContainsCacheManagerName() { String name = "newCM"; net.sf.ehcache.config.Configuration configuration = new net.sf.ehcache.config.Configuration(); configuration.addCache(new CacheConfiguration("test", 1)); Toolkit toolkit = getMockToolkit(); ClusteredEntityManager clusteredEntity... | @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getR... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... |
@Test public void testAdjustsPoolSizeDynamically() throws Exception { Configuration configuration = new Configuration(); CacheManager cacheManager = new CacheManager(configuration.maxBytesLocalHeap(10, MemoryUnit.MEGABYTES).name("new-cacheManager")); CacheConfiguration cacheConfiguration = new CacheConfiguration("three... | public CacheConfiguration getCacheConfiguration() { return configuration; } | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } } | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventListeners,
BootstrapCacheLoa... | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventListeners,
BootstrapCacheLoa... | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventListeners,
BootstrapCacheLoa... |
@Test public void testMultipleDispose() { Ehcache cache = new Cache("testCache", 1, true, false, 5, 2); manager.addCache(cache); cache.dispose(); for (int i = 0; i < 10; i++) { cache.dispose(); } } | public synchronized void dispose() throws IllegalStateException { if (checkStatusAlreadyDisposed()) { return; } if (bootstrapCacheLoader != null && bootstrapCacheLoader instanceof Disposable) { ((Disposable)bootstrapCacheLoader).dispose(); } if (executorService != null) { executorService.shutdown(); } disposeRegistered... | Cache implements InternalEhcache, StoreListener { public synchronized void dispose() throws IllegalStateException { if (checkStatusAlreadyDisposed()) { return; } if (bootstrapCacheLoader != null && bootstrapCacheLoader instanceof Disposable) { ((Disposable)bootstrapCacheLoader).dispose(); } if (executorService != null)... | Cache implements InternalEhcache, StoreListener { public synchronized void dispose() throws IllegalStateException { if (checkStatusAlreadyDisposed()) { return; } if (bootstrapCacheLoader != null && bootstrapCacheLoader instanceof Disposable) { ((Disposable)bootstrapCacheLoader).dispose(); } if (executorService != null)... | Cache implements InternalEhcache, StoreListener { public synchronized void dispose() throws IllegalStateException { if (checkStatusAlreadyDisposed()) { return; } if (bootstrapCacheLoader != null && bootstrapCacheLoader instanceof Disposable) { ((Disposable)bootstrapCacheLoader).dispose(); } if (executorService != null)... | Cache implements InternalEhcache, StoreListener { public synchronized void dispose() throws IllegalStateException { if (checkStatusAlreadyDisposed()) { return; } if (bootstrapCacheLoader != null && bootstrapCacheLoader instanceof Disposable) { ((Disposable)bootstrapCacheLoader).dispose(); } if (executorService != null)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.