evictionObserver = mock(OperationObserver.class);
- DiskStorageFactory diskStorageFactory = mock(DiskStorageFactory.class);
-
- Segment segment = new Segment(10, .95f, diskStorageFactory, mock(CacheConfiguration.class), onHeapAccessor, mock(PoolAccessor.class), cacheEventNotificationService, evictionObserver);
- Element element = new Element("key", "value");
- when(diskStorageFactory.create(element)).thenReturn(new DiskStorageFactory.DiskMarker(diskStorageFactory, 0L, 0, element));
- segment.put("key", 12, element, false, false);
- verify(listener).notifyElementEvicted(any(Ehcache.class), eq(element));
- verify(evictionObserver).end(CacheOperationOutcomes.EvictionOutcome.SUCCESS);
- }
-}
Index: rctags/ehcache-2.10.9.0.371/system-tests/src/test/resources/net/sf/ehcache/osgi/ehcache-scheduled-refresh.xml
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/system-tests/src/test/resources/net/sf/ehcache/osgi/ehcache-scheduled-refresh.xml (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/system-tests/src/test/resources/net/sf/ehcache/osgi/ehcache-scheduled-refresh.xml (revision 0)
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/AggregateCacheRegionStats.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/AggregateCacheRegionStats.java (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/AggregateCacheRegionStats.java (revision 0)
@@ -1,62 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.sf.ehcache.hibernate.management.impl;
-
-/**
- * @author gkeim
- *
- */
-public class AggregateCacheRegionStats extends CacheRegionStats {
- private int nodeCount;
-
- /**
- * @param region
- */
- public AggregateCacheRegionStats(String region) {
- super(region);
- }
-
- /**
- * @param stats
- */
- public void aggregate(CacheRegionStats stats) {
- nodeCount++;
- hitCount += stats.getHitCount();
- missCount += stats.getMissCount();
- putCount += stats.getPutCount();
- hitRatio = determineHitRatio();
-
- // just add the in memory count together, an average will be returned when the getter is used
- elementCountInMemory += stats.getElementCountInMemory();
-
- // the largest element count on disk is the one that is the most correct
- if (stats.getElementCountOnDisk() > elementCountOnDisk) {
- elementCountOnDisk = stats.getElementCountOnDisk();
- }
- // elementCountTotal is the same for each node, since it's the total count in the cluster
- // no real aggregation is needed, just use the same total count
- elementCountTotal = stats.getElementCountTotal();
- }
-
- /**
- * @see net.sf.ehcache.hibernate.management.impl.CacheRegionStats#getElementCountInMemory()
- */
- @Override
- public long getElementCountInMemory() {
- return elementCountInMemory / nodeCount;
- }
-}
Index: rctags/ehcache-2.10.9.0.371/ehcache-core/src/test/java/net/sf/ehcache/pool/sizeof/filter/annotations/CustomAnnotation.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/ehcache-core/src/test/java/net/sf/ehcache/pool/sizeof/filter/annotations/CustomAnnotation.java (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/ehcache-core/src/test/java/net/sf/ehcache/pool/sizeof/filter/annotations/CustomAnnotation.java (revision 0)
@@ -1,32 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.sf.ehcache.pool.sizeof.filter.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.FIELD, ElementType.TYPE, ElementType.PACKAGE })
-public @interface CustomAnnotation {
- boolean deprecated() default true;
- short differentReturnType() default 10;
- Class aClass() default Integer.class;
- ExampleEnum anEnum() default ExampleEnum.TWO;
- Deprecated anAnnotation() default @Deprecated;
-}
Index: rctags/ehcache-2.10.9.0.371/ehcache-core/src/test/java/net/sf/ehcache/distribution/RMICacheReplicatorWithLargePayloadIT.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/ehcache-core/src/test/java/net/sf/ehcache/distribution/RMICacheReplicatorWithLargePayloadIT.java (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/ehcache-core/src/test/java/net/sf/ehcache/distribution/RMICacheReplicatorWithLargePayloadIT.java (revision 0)
@@ -1,269 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.sf.ehcache.distribution;
-
-import static net.sf.ehcache.util.RetryAssert.assertBy;
-import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.notNullValue;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.hamcrest.number.OrderingComparison.greaterThan;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.Callable;
-import java.util.concurrent.TimeUnit;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import net.sf.ehcache.AbstractCacheTest;
-import net.sf.ehcache.CacheException;
-import net.sf.ehcache.CacheManager;
-import net.sf.ehcache.Element;
-import net.sf.ehcache.config.CacheConfiguration;
-import net.sf.ehcache.config.Configuration;
-import net.sf.ehcache.util.RetryAssert;
-
-import org.hamcrest.collection.IsEmptyCollection;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Tests replication of Cache events with large payloads exceeding MTU
- *
- * Note these tests need a live network interface running in multicast mode to work
- *
- *
- * @author Abhishek Sanoujam
- */
-public class RMICacheReplicatorWithLargePayloadIT extends AbstractRMITest {
-
- private static final Logger LOG = Logger.getLogger(RMICacheReplicatorWithLargePayloadIT.class.getName());
-
- private static int MB = 1024 * 1024;
-
- /**
- * {@inheritDoc} Sets up two caches: cache1 is local. cache2 is to be receive updates
- *
- * @throws Exception
- */
- @Before
- public void setUp() throws Exception {
- failFastInsufficientMemory();
- assertThat(getActiveReplicationThreads(), IsEmptyCollection.empty());
- }
-
- private void failFastInsufficientMemory() {
- // fail fast if running with insufficient heap
- long totalMemory = Runtime.getRuntime().totalMemory();
- if (totalMemory < 200 * MB) {
- String msg = "Insufficient heap (approx. " + (totalMemory / MB) + " MB detected), this test requires at least 256 MB to run.\n";
- msg += "Steps to take:\n";
- msg += " 1) If you are running with eclipse: specify \"-Xms256m -Xmx256m\" as VM arguments in the \"Run Confuguration\" for this test\n";
- msg += " 2) If you are running using mvn with \"mvn test -Dtest=" + this.getClass().getSimpleName()
- + "\", add this in the command line: -DargLine=\"-Xms256m -Xmx256m\"\n";
- msg += " Run the test like: mvn test -Dtest=" + this.getClass().getSimpleName() + " -DargLine=\"-Xms256m -Xmx256m\"";
- LOG.log(Level.WARNING, msg);
- fail(msg);
- }
- }
-
- @After
- public void noReplicationThreads() throws Exception {
- RetryAssert.assertBy(30, TimeUnit.SECONDS, new Callable>() {
- @Override
- public Set call() throws Exception {
- return getActiveReplicationThreads();
- }
- }, IsEmptyCollection.empty());
- }
-
- private static List createCluster(int size, String ... caches){
- LOG.info("Creating Cluster");
- Collection required = Arrays.asList(caches);
- List configurations = new ArrayList(size);
- for (int i = 1; i <= size; i++) {
- Configuration config = getConfiguration(AbstractCacheTest.TEST_CONFIG_DIR + "distribution/ehcache-distributed-big-payload-" + i + ".xml").name("cm" + i);
- if (!required.isEmpty()) {
- for (Iterator> it = config.getCacheConfigurations().entrySet().iterator(); it.hasNext(); ) {
- if (!required.contains(it.next().getKey())) {
- it.remove();
- }
- }
- }
- configurations.add(config);
- }
- LOG.info("Created Configurations");
-
- List members = startupManagers(configurations);
- try {
- LOG.info("Created Managers");
- if (required.isEmpty()) {
- waitForClusterMembership(10, TimeUnit.SECONDS, members);
- LOG.info("Cluster Membership Complete");
- emptyCaches(10, TimeUnit.SECONDS, members);
- LOG.info("Caches Emptied");
- } else {
- waitForClusterMembership(10, TimeUnit.SECONDS, required, members);
- emptyCaches(10, TimeUnit.SECONDS, required, members);
- }
- return members;
- } catch (RuntimeException e) {
- destroyCluster(members);
- throw e;
- } catch (Error e) {
- destroyCluster(members);
- throw e;
- }
- }
-
- private static void destroyCluster(List members) {
- for (CacheManager manager : members) {
- if (manager != null) {
- manager.shutdown();
- }
- }
- }
-
- @Test
- public void testAssertBigPayload() {
- List cluster = createCluster(3);
- try {
- for (CacheManager manager : cluster) {
- List localPeers = cluster.get(0).getCachePeerListener("RMI").getBoundCachePeers();
- List payloadList = PayloadUtil.createCompressedPayloadList(localPeers, 150);
- assertThat(manager.getName(), payloadList, hasSize(greaterThan(1)));
- }
-
- cluster.add(new CacheManager(AbstractCacheTest.TEST_CONFIG_DIR + "distribution/ehcache-distributed-big-payload-4.xml"));
-
- List localPeers = cluster.get(3).getCachePeerListener("RMI").getBoundCachePeers();
- List payloadList = PayloadUtil.createCompressedPayloadList(localPeers, 150);
- assertThat(payloadList, hasSize(greaterThan(1)));
- } finally {
- destroyCluster(cluster);
- }
- }
-
- /**
- * Does a new cache manager in the cluster get detected?
- */
- @Test
- public void testRemoteCachePeersDetectsNewCacheManager() throws InterruptedException {
- List cluster = createCluster(3);
- try {
- //Add new CacheManager to cluster
- cluster.add(new CacheManager(AbstractCacheTest.TEST_CONFIG_DIR + "distribution/ehcache-distributed-big-payload-4.xml"));
-
- //Allow detection to occur
- waitForClusterMembership(10020, TimeUnit.MILLISECONDS, cluster);
- } finally {
- destroyCluster(cluster);
- }
- }
-
- /**
- * Does a down cache manager in the cluster get removed?
- */
- @Test
- public void testRemoteCachePeersDetectsDownCacheManager() throws InterruptedException {
- List cluster = createCluster(3);
- try {
- MulticastKeepaliveHeartbeatSender.setHeartBeatStaleTime(3000);
- //Drop a CacheManager from the cluster
- cluster.remove(2).shutdown();
- assertThat(cluster, hasSize(2));
-
- //Allow change detection to occur. Heartbeat 1 second and is not stale until 5000
- waitForClusterMembership(11020, TimeUnit.MILLISECONDS, cluster);
- } finally {
- destroyCluster(cluster);
- }
- }
-
- /**
- * Does a down cache manager in the cluster get removed?
- */
- @Test
- public void testRemoteCachePeersDetectsDownCacheManagerSlow() throws InterruptedException {
- List cluster = createCluster(3);
- try {
- CacheManager manager = cluster.get(0);
-
- Thread.sleep(2000);
-
- //Drop a CacheManager from the cluster
- cluster.remove(2).shutdown();
-
- //Insufficient time for it to timeout
- CacheManagerPeerProvider provider = manager.getCacheManagerPeerProvider("RMI");
- for (String cacheName : manager.getCacheNames()) {
- List remotePeersOfCache1 = provider.listRemoteCachePeers(manager.getCache(cacheName));
- assertThat((List>) remotePeersOfCache1, hasSize(2));
- }
- } finally {
- destroyCluster(cluster);
- }
- }
-
- /**
- * Tests put and remove initiated from cache1 in a cluster
- *
- * This test goes into an infinite loop if the chain of notifications is not somehow broken.
- */
- @Test
- public void testPutProgagatesFromAndToEveryCacheManagerAndCache() throws CacheException, InterruptedException {
- final List cluster = createCluster(3);
- try {
- final CacheManager manager0 = cluster.get(0);
- //Put
- final String[] cacheNames = manager0.getCacheNames();
- Arrays.sort(cacheNames);
- for (int i = 0; i < cacheNames.length; i++) {
- String name = cacheNames[i];
- manager0.getCache(name).put(new Element(Integer.toString(i), Integer.valueOf(i)));
- //Add some non serializable elements that should not get propagated
- manager0.getCache(name).put(new Element("nonSerializable" + i, new Object()));
- }
-
- assertBy(10, TimeUnit.SECONDS, new Callable() {
-
- public Boolean call() throws Exception {
- for (int i = 0; i < cacheNames.length; i++) {
- String name = cacheNames[i];
- for (CacheManager manager : cluster.subList(1, cluster.size())) {
- assertThat("Cache : " + name, manager.getCache(name).get(Integer.toString(i)), notNullValue());
- assertThat(manager.getCache(name).get("nonSerializable" + i), nullValue());
- }
- }
- return Boolean.TRUE;
- }
- }, is(Boolean.TRUE));
- } finally {
- destroyCluster(cluster);
- }
-
- }
-}
Index: rctags/ehcache-2.10.9.0.371/management-ehcache-v2/src/main/java/net/sf/ehcache/management/resource/CacheEntityV2.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/management-ehcache-v2/src/main/java/net/sf/ehcache/management/resource/CacheEntityV2.java (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/management-ehcache-v2/src/main/java/net/sf/ehcache/management/resource/CacheEntityV2.java (revision 0)
@@ -1,23 +0,0 @@
-/* All content copyright (c) 2003-2012 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.*/
-
-package net.sf.ehcache.management.resource;
-
-import java.util.HashMap;
-import java.util.Map;
-
-
-/**
- *
- * An entity representing a cache resource from the management API.
- *
- *
- * @author brandony
- *
- */
-public class CacheEntityV2 extends AbstractCacheEntityV2 {
- private Map attributes = new HashMap();
-
- public Map getAttributes() {
- return attributes;
- }
-}
Index: rctags/ehcache-2.10.9.0.371/ehcache/src/main/resources/META-INF/terracotta/public-api-types
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/ehcache/src/main/resources/META-INF/terracotta/public-api-types (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/ehcache/src/main/resources/META-INF/terracotta/public-api-types (revision 0)
@@ -1 +0,0 @@
-# Don't remove this line -- if file is empty then everything will become an API type
Index: rctags/ehcache-2.10.9.0.371/system-tests/src/test/java/org/terracotta/ehcache/tests/ClientArrayValues1.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/system-tests/src/test/java/org/terracotta/ehcache/tests/ClientArrayValues1.java (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/system-tests/src/test/java/org/terracotta/ehcache/tests/ClientArrayValues1.java (revision 0)
@@ -1,27 +0,0 @@
-package org.terracotta.ehcache.tests;
-
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.Element;
-
-import org.terracotta.toolkit.Toolkit;
-
-public class ClientArrayValues1 extends ClientBase {
-
- public ClientArrayValues1(String[] args) {
- super("test", args);
- }
-
- public static void main(String[] args) {
- new ClientArrayValues1(args).run();
- }
-
- @Override
- protected void runTest(Cache cache, Toolkit toolkit) throws Throwable {
- cache.put(new Element("key", new String[] { "a", "b", "c" }));
-// } else {
-// Element elem = cache.get("key");
-// assertNotNull()
-// String[] value = elem.getValue();
-// }
- }
-}
Index: rctags/ehcache-2.10.9.0.371/ehcache-core/src/test/resources/ehcache-no-update.xml
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/ehcache-core/src/test/resources/ehcache-no-update.xml (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/ehcache-core/src/test/resources/ehcache-no-update.xml (revision 0)
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
Index: rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/writer/writebehind/OperationConverter.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/writer/writebehind/OperationConverter.java (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/writer/writebehind/OperationConverter.java (revision 0)
@@ -1,34 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.ehcache.writer.writebehind;
-
-/**
- * Interface that allows an converter to be implemented that can create an operation based
- * on an arbitrary object.
- *
- * @param the operation type that should be converted to
- * @author Geert Bevin
- * @version $Id: OperationConverter.java 5594 2012-05-07 16:04:31Z cdennis $
- */
-public interface OperationConverter {
- /**
- * Convert an arbitrary object
- *
- * @param source the object to convert
- * @return the converted operation instance
- */
- public T convert(Object source);
-}
Index: rctags/ehcache-2.10.9.0.371/system-tests/src/test/java/net/sf/ehcache/osgi/OsgiHibernateTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/system-tests/src/test/java/net/sf/ehcache/osgi/OsgiHibernateTest.java (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/system-tests/src/test/java/net/sf/ehcache/osgi/OsgiHibernateTest.java (revision 0)
@@ -1,348 +0,0 @@
-/*
- * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
- */
-package net.sf.ehcache.osgi;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.notNullValue;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.ops4j.pax.exam.CoreOptions.bootDelegationPackages;
-import static org.ops4j.pax.exam.CoreOptions.maven;
-import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.systemProperty;
-import static org.ops4j.pax.exam.CoreOptions.wrappedBundle;
-import static org.terracotta.test.OsgiUtil.commonOptions;
-import static org.terracotta.test.OsgiUtil.getMavenBundle;
-
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.CacheManager;
-import net.sf.ehcache.Status;
-
-import org.hibernate.HibernateException;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.cache.access.SoftLock;
-import org.hibernate.cfg.Configuration;
-import org.hibernate.stat.QueryStatistics;
-import org.hibernate.stat.SecondLevelCacheStatistics;
-import org.hibernate.stat.Statistics;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.ProbeBuilder;
-import org.ops4j.pax.exam.TestProbeBuilder;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
-import org.ops4j.pax.exam.spi.reactors.PerMethod;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.terracotta.ehcache.tests.container.hibernate.domain.Event;
-import org.terracotta.ehcache.tests.container.hibernate.domain.EventManager;
-import org.terracotta.ehcache.tests.container.hibernate.domain.Item;
-import org.terracotta.ehcache.tests.container.hibernate.domain.Person;
-import org.terracotta.ehcache.tests.container.hibernate.domain.PhoneNumber;
-import org.terracotta.ehcache.tests.container.hibernate.domain.VersionedItem;
-import org.terracotta.test.OsgiUtil;
-
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import javax.inject.Inject;
-
-/**
- * @author Chris Dennis
- * @author hhuynh
- */
-@RunWith(PaxExam.class)
-@ExamReactorStrategy(PerMethod.class)
-@Ignore
-public class OsgiHibernateTest {
-
- private SessionFactory sessionFactory;
- private Configuration config;
-
- /**
- * Injected BundleContext
- */
- @Inject
- protected BundleContext bc;
-
- public OsgiHibernateTest() {
- //
- }
-
- public void testBundle() {
- assertThat(bc, is(notNullValue()));
- System.out.println(Arrays.asList(bc.getBundles()));
- }
-
- @org.ops4j.pax.exam.Configuration
- public Option[] config() {
- return options(bootDelegationPackages("sun.*,jdk.*,javax.naming,javax.naming.spi,javax.naming.event,javax.management"),
- commonOptions(),
- wrappedBundle(maven("javax.transaction", "jta").versionAsInProject())
- .exports("javax.transaction;version=1.1"),
- getMavenBundle("net.sf.ehcache", "ehcache-ee", "ehcache"),
- getMavenBundle("net.sf.ehcache.test", "hibernate-ehcache-ee-bundle", "hibernate-ehcache-bundle").noStart(),
- wrappedBundle(maven("org.apache.derby", "derby").versionAsInProject()),
- systemProperty("derby.system.home").value("derby"));
- }
-
- @ProbeBuilder
- public TestProbeBuilder extendProbe(TestProbeBuilder builder) {
- builder.setHeader(Constants.IMPORT_PACKAGE,
- "javax.transaction;version=1.1,org.hibernate,org.osgi.framework,org.slf4j");
- builder.setHeader(Constants.DYNAMICIMPORT_PACKAGE, "*");
- return builder;
- }
-
- public synchronized SessionFactory getSessionFactory() {
- if (sessionFactory == null) {
- try {
- sessionFactory = config.buildSessionFactory();
- } catch (HibernateException ex) {
- System.err.println("Initial SessionFactory creation failed." + ex);
- throw new ExceptionInInitializerError(ex);
- }
- }
- return sessionFactory;
- }
-
- private void printBundles() {
- for (Bundle b : bc.getBundles()) {
- System.out.println("XXX Bundle " + b.getSymbolicName() + ", " + b.getVersion() + ", state: " + b.getState());
- }
- }
-
- @Before
- public void setUp() throws Exception {
- printBundles();
-
- ClassLoader prev = Thread.currentThread().getContextClassLoader();
- try {
- Thread.currentThread().setContextClassLoader(OsgiHibernateTest.class.getClassLoader());
- config = new Configuration().configure(OsgiHibernateTest.class
- .getResource("/net/sf/ehcache/osgi/hibernate.cfg.xml"));
-
- config.setProperty("hibernate.hbm2ddl.auto", "create-drop");
- getSessionFactory(); // call for side effect of initializing the session factory
- } finally {
- Thread.currentThread().setContextClassLoader(prev);
- }
-
- getSessionFactory().getStatistics().setStatisticsEnabled(true);
- removeCaches();
- }
-
- @After
- public void tearDown() {
- getSessionFactory().close();
- }
-
- private void removeCaches() {
- for (CacheManager manager : CacheManager.ALL_CACHE_MANAGERS) {
- for (String s : manager.getCacheNames()) {
- final Cache cache = manager.getCache(s);
- if (cache.getStatus() == Status.STATUS_ALIVE) {
- cache.removeAll();
- }
- }
- }
- }
-
- @Test
- public void testQueryCacheInvalidation() throws Exception {
- Session s = getSessionFactory().openSession();
- Transaction t = s.beginTransaction();
- Item i = new Item();
- i.setName("widget");
- i.setDescription("A really top-quality, full-featured widget.");
- s.persist(i);
- t.commit();
- s.close();
-
- SecondLevelCacheStatistics slcs = s.getSessionFactory().getStatistics()
- .getSecondLevelCacheStatistics(Item.class.getName());
-
- assertEquals(1, slcs.getPutCount());
- assertEquals(1, slcs.getElementCountInMemory());
- assertEquals(1, slcs.getEntries().size());
-
- s = getSessionFactory().openSession();
- t = s.beginTransaction();
- i = (Item) s.get(Item.class, i.getId());
-
- assertEquals(1, slcs.getHitCount());
- assertEquals(0, slcs.getMissCount());
-
- i.setDescription("A bog standard item");
-
- t.commit();
- s.close();
-
- assertEquals(2, slcs.getPutCount());
-
- Object entry = slcs.getEntries().get(i.getId());
- Map map;
- if (entry instanceof Map) {
- map = (Map) entry;
- } else {
- Method valueMethod = entry.getClass().getDeclaredMethod("getValue", (Class[]) null);
- valueMethod.setAccessible(true);
- map = (Map) valueMethod.invoke(entry, (Object[]) null);
- }
- assertTrue(map.get("description").equals("A bog standard item"));
- assertTrue(map.get("name").equals("widget"));
-
- // cleanup
- s = getSessionFactory().openSession();
- t = s.beginTransaction();
- s.delete(i);
- t.commit();
- s.close();
- }
-
- @Test
- public void testEmptySecondLevelCacheEntry() throws Exception {
- getSessionFactory().evictEntity(Item.class.getName());
- Statistics stats = getSessionFactory().getStatistics();
- stats.clear();
- SecondLevelCacheStatistics statistics = stats.getSecondLevelCacheStatistics(Item.class.getName());
- Map cacheEntries = statistics.getEntries();
- assertEquals(0, cacheEntries.size());
- }
-
- @Test
- public void testStaleWritesLeaveCacheConsistent() {
- Session s = getSessionFactory().openSession();
- Transaction txn = s.beginTransaction();
- VersionedItem item = new VersionedItem();
- item.setName("steve");
- item.setDescription("steve's item");
- s.save(item);
- txn.commit();
- s.close();
-
- Long initialVersion = item.getVersion();
-
- // manually revert the version property
- item.setVersion(new Long(item.getVersion().longValue() - 1));
-
- try {
- s = getSessionFactory().openSession();
- txn = s.beginTransaction();
- s.update(item);
- txn.commit();
- s.close();
- fail("expected stale write to fail");
- } catch (Throwable expected) {
- // expected behavior here
- if (txn != null) {
- try {
- txn.rollback();
- } catch (Throwable ignore) {
- //
- }
- }
- } finally {
- if (s != null && s.isOpen()) {
- try {
- s.close();
- } catch (Throwable ignore) {
- //
- }
- }
- }
-
- // check the version value in the cache...
- SecondLevelCacheStatistics slcs = getSessionFactory().getStatistics()
- .getSecondLevelCacheStatistics(VersionedItem.class.getName());
-
- Object entry = slcs.getEntries().get(item.getId());
- Long cachedVersionValue;
- if (entry instanceof SoftLock) {
- // FIXME don't know what to test here
- // cachedVersionValue = new Long( ( (ReadWriteCache.Lock)
- // entry).getUnlockTimestamp() );
- } else {
- cachedVersionValue = (Long) ((Map) entry).get("_version");
- assertEquals(initialVersion.longValue(), cachedVersionValue.longValue());
- }
-
- // cleanup
- s = getSessionFactory().openSession();
- txn = s.beginTransaction();
- item = (VersionedItem) s.load(VersionedItem.class, item.getId());
- s.delete(item);
- txn.commit();
- s.close();
-
- }
-
- @Test
- public void testGeneralUsage() throws Exception {
- EventManager mgr = new EventManager(getSessionFactory());
- Statistics stats = getSessionFactory().getStatistics();
-
- // create 3 persons Steve, Orion, Tim
- Person stevePerson = new Person();
- stevePerson.setFirstname("Steve");
- stevePerson.setLastname("Harris");
- Long steveId = mgr.createAndStorePerson(stevePerson);
- mgr.addEmailToPerson(steveId, "steve@tc.com");
- mgr.addEmailToPerson(steveId, "sharrif@tc.com");
- mgr.addTalismanToPerson(steveId, "rabbit foot");
- mgr.addTalismanToPerson(steveId, "john de conqueroo");
-
- PhoneNumber p1 = new PhoneNumber();
- p1.setNumberType("Office");
- p1.setPhone(111111);
- mgr.addPhoneNumberToPerson(steveId, p1);
-
- PhoneNumber p2 = new PhoneNumber();
- p2.setNumberType("Home");
- p2.setPhone(222222);
- mgr.addPhoneNumberToPerson(steveId, p2);
-
- Person orionPerson = new Person();
- orionPerson.setFirstname("Orion");
- orionPerson.setLastname("Letizi");
- Long orionId = mgr.createAndStorePerson(orionPerson);
- mgr.addEmailToPerson(orionId, "orion@tc.com");
- mgr.addTalismanToPerson(orionId, "voodoo doll");
-
- Long timId = mgr.createAndStorePerson("Tim", "Teck");
- mgr.addEmailToPerson(timId, "teck@tc.com");
- mgr.addTalismanToPerson(timId, "magic decoder ring");
-
- Long engMeetingId = mgr.createAndStoreEvent("Eng Meeting", stevePerson, new Date());
- mgr.addPersonToEvent(steveId, engMeetingId);
- mgr.addPersonToEvent(orionId, engMeetingId);
- mgr.addPersonToEvent(timId, engMeetingId);
-
- Long docMeetingId = mgr.createAndStoreEvent("Doc Meeting", orionPerson, new Date());
- mgr.addPersonToEvent(steveId, docMeetingId);
- mgr.addPersonToEvent(orionId, docMeetingId);
-
- for (Event event : (List) mgr.listEvents()) {
- mgr.listEmailsOfEvent(event.getId());
- }
-
- QueryStatistics queryStats = stats.getQueryStatistics("from Event");
- assertEquals("Cache Miss Count", 1L, queryStats.getCacheMissCount());
- assertEquals("Cache Hit Count", 0L, queryStats.getCacheHitCount());
- assertEquals("Cache Put Count", 1L, queryStats.getCachePutCount());
- }
-}
Index: rctags/ehcache-2.10.9.0.371/system-tests/src/test/resources/hibernate-config/nontransactional/domain/HolidayCalendar.hbm.xml
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/system-tests/src/test/resources/hibernate-config/nontransactional/domain/HolidayCalendar.hbm.xml (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/system-tests/src/test/resources/hibernate-config/nontransactional/domain/HolidayCalendar.hbm.xml (revision 0)
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: rctags/ehcache-2.10.9.0.371/distribution/events/src/assemble/bin/stop-sample.bat
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/distribution/events/src/assemble/bin/stop-sample.bat (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/distribution/events/src/assemble/bin/stop-sample.bat (revision 0)
@@ -1,13 +0,0 @@
-@echo off
-
-setlocal
-
-set root=%~d0%~p0..
-set root="%root:"=%"
-
-cd %root%
-
-call bin/stop-jetty.bat 9081
-call bin/stop-jetty.bat 9082
-
-endlocal
\ No newline at end of file
Index: rctags/ehcache-2.10.9.0.371/management-ehcache-v1/src/main/java/net/sf/ehcache/management/resource/CacheManagerConfigEntity.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/management-ehcache-v1/src/main/java/net/sf/ehcache/management/resource/CacheManagerConfigEntity.java (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/management-ehcache-v1/src/main/java/net/sf/ehcache/management/resource/CacheManagerConfigEntity.java (revision 0)
@@ -1,39 +0,0 @@
-package net.sf.ehcache.management.resource;
-
-import org.terracotta.management.resource.VersionedEntity;
-
-/**
- * @author brandony
- */
-public class CacheManagerConfigEntity extends VersionedEntity {
- private String cacheManagerName;
- private String agentId;
-
- private String xml;
-
- public String getCacheManagerName() {
- return cacheManagerName;
- }
-
- public void setCacheManagerName(String cacheManagerName) {
- this.cacheManagerName = cacheManagerName;
- }
-
- public String getXml() {
- return xml;
- }
-
- public void setXml(String xml) {
- this.xml = xml;
- }
-
- @Override
- public String getAgentId() {
- return agentId;
- }
-
- @Override
- public void setAgentId(String agentId) {
- this.agentId = agentId;
- }
-}
Index: rctags/ehcache-2.10.9.0.371/system-tests/src/test/resources/servermap/servermap-l2-eviction-reaches-l1-test.xml
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/system-tests/src/test/resources/servermap/servermap-l2-eviction-reaches-l1-test.xml (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/system-tests/src/test/resources/servermap/servermap-l2-eviction-reaches-l1-test.xml (revision 0)
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: rctags/ehcache-2.10.9.0.371/ehcache-core/src/test/resources/ehcache-unloadablecachemanagerlistenerclass.xml
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/ehcache-core/src/test/resources/ehcache-unloadablecachemanagerlistenerclass.xml (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/ehcache-core/src/test/resources/ehcache-unloadablecachemanagerlistenerclass.xml (revision 0)
@@ -1,175 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/statistics/beans/AttributeProxy.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/statistics/beans/AttributeProxy.java (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/statistics/beans/AttributeProxy.java (revision 0)
@@ -1,116 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.sf.ehcache.statistics.beans;
-
-/**
- * The Class AttributeProxy, used to proxy operations from a dynamic mbean to a POJO object.
- * Override get()/set() as needed.
- *
- * @param the return type/set type for the attribute
- *
- * @author cschanck
- */
-public abstract class AttributeProxy {
- private final String name;
- private final Class clazz;
- private final boolean isWrite;
- private final boolean isRead;
- private final String description;
-
- /**
- * Instantiates a new attribute proxy.
- *
- * @param clazz the clazz of the return type
- * @param name the name
- * @param description the description
- * @param isRead readable
- * @param isWrite writable
- */
- public AttributeProxy(Class clazz, String name, String description, boolean isRead, boolean isWrite) {
- this.name = name;
- this.description = description;
- this.clazz = clazz;
- this.isWrite = isWrite;
- this.isRead = isRead;
- }
-
- /**
- * Gets the description.
- *
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Gets the type class.
- *
- * @return the type class
- */
- public Class> getTypeClass() {
- return clazz;
- }
-
- /**
- * Gets the name.
- *
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Gets the value.
- *
- * @param name the name
- * @return the value
- */
- public T get(String name) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Sets the value.
- *
- * @param name the name
- * @param t the value
- */
- public void set(String name, T t) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Checks if is readable.
- *
- * @return true, if is read
- */
- public boolean isRead() {
- return isRead;
- }
-
- /**
- * Checks if is writable.
- *
- * @return true, if is writable
- */
- public boolean isWrite() {
- return isWrite;
- }
-
-}
Index: rctags/ehcache-2.10.9.0.371/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapL2EvictionReachesL1Test.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapL2EvictionReachesL1Test.java (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapL2EvictionReachesL1Test.java (revision 0)
@@ -1,21 +0,0 @@
-package org.terracotta.ehcache.tests.servermap;
-
-import org.terracotta.ehcache.tests.AbstractCacheTestBase;
-
-import com.tc.test.config.model.TestConfig;
-
-public class ServerMapL2EvictionReachesL1Test extends AbstractCacheTestBase {
-
- public ServerMapL2EvictionReachesL1Test(TestConfig testConfig) {
- super("/servermap/servermap-l2-eviction-reaches-l1-test.xml", testConfig,
- ServerMapL2EvictionReachesL1TestClient.class);
- testConfig.setDgcEnabled(true);
- testConfig.setDgcIntervalInSec(60);
- testConfig.addTcProperty("ehcache.evictor.logging.enabled", "true");
-
- testConfig.getClientConfig().addExtraClientJvmArg("-Dcom.tc.l1.cachemanager.enabled=false");
- testConfig.getClientConfig().addExtraClientJvmArg("-Dcom.tc.ehcache.evictor.logging.enabled=true");
- testConfig.getClientConfig().addExtraClientJvmArg("-Dcom.tc.l1.lockmanager.timeout.interval=60000");
- }
-
-}
Index: rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/hibernate/nonstop/HibernateNonstopCacheExceptionHandler.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/hibernate/nonstop/HibernateNonstopCacheExceptionHandler.java (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/hibernate/nonstop/HibernateNonstopCacheExceptionHandler.java (revision 0)
@@ -1,82 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.sf.ehcache.hibernate.nonstop;
-
-import net.sf.ehcache.constructs.nonstop.NonStopCacheException;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Class that takes care of {@link NonStopCacheException} that happens in hibernate module
- *
- * @author Abhishek Sanoujam
- *
- */
-public final class HibernateNonstopCacheExceptionHandler {
- /**
- * Property name which set as "true" will throw exceptions on timeout with hibernate
- */
- public static final String HIBERNATE_THROW_EXCEPTION_ON_TIMEOUT_PROPERTY = "ehcache.hibernate.propagateNonStopCacheException";
-
- /**
- * Property name for logging the stack trace of the nonstop cache exception too. False by default
- */
- public static final String HIBERNATE_LOG_EXCEPTION_STACK_TRACE_PROPERTY = "ehcache.hibernate.logNonStopCacheExceptionStackTrace";
-
- private static final Logger LOGGER = LoggerFactory.getLogger(HibernateNonstopCacheExceptionHandler.class);
-
- private static final HibernateNonstopCacheExceptionHandler INSTANCE = new HibernateNonstopCacheExceptionHandler();
-
- /**
- * private constructor
- */
- private HibernateNonstopCacheExceptionHandler() {
- // private
- }
-
- /**
- * Returns the singleton instance
- *
- * @return the singleton instance
- */
- public static HibernateNonstopCacheExceptionHandler getInstance() {
- return INSTANCE;
- }
-
- /**
- * Handle {@link NonStopCacheException}.
- * If {@link HibernateNonstopCacheExceptionHandler#HIBERNATE_THROW_EXCEPTION_ON_TIMEOUT_PROPERTY} system property is set to true,
- * rethrows the {@link NonStopCacheException}, otherwise logs the exception. While logging, if
- * {@link HibernateNonstopCacheExceptionHandler#HIBERNATE_LOG_EXCEPTION_STACK_TRACE_PROPERTY} is set to true, logs the exception stack
- * trace too, otherwise logs the exception message only
- *
- * @param nonStopCacheException
- */
- public void handleNonstopCacheException(NonStopCacheException nonStopCacheException) {
- if (Boolean.getBoolean(HIBERNATE_THROW_EXCEPTION_ON_TIMEOUT_PROPERTY)) {
- throw nonStopCacheException;
- } else {
- if (Boolean.getBoolean(HIBERNATE_LOG_EXCEPTION_STACK_TRACE_PROPERTY)) {
- LOGGER.debug("Ignoring NonstopCacheException - " + nonStopCacheException.getMessage(), nonStopCacheException);
- } else {
- LOGGER.debug("Ignoring NonstopCacheException - " + nonStopCacheException.getMessage());
- }
- }
- }
-
-}
Index: rctags/ehcache-2.10.9.0.371/management-ehcache-v2/src/main/java/net/sf/ehcache/management/resource/CacheStatisticSampleEntityV2.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/management-ehcache-v2/src/main/java/net/sf/ehcache/management/resource/CacheStatisticSampleEntityV2.java (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/management-ehcache-v2/src/main/java/net/sf/ehcache/management/resource/CacheStatisticSampleEntityV2.java (revision 0)
@@ -1,33 +0,0 @@
-/*
- * All content copyright (c) 2003-2012 Terracotta, Inc., except as may otherwise be noted in a separate copyright
- * notice. All rights reserved.
- */
-package net.sf.ehcache.management.resource;
-
-import java.util.Map;
-
-/**
- * @author brandony
- */
-public class CacheStatisticSampleEntityV2 extends AbstractCacheEntityV2{
-
- private String statName;
-
- private Map statValueByTimeMillis;
-
- public String getStatName() {
- return statName;
- }
-
- public void setStatName(String statName) {
- this.statName = statName;
- }
-
- public Map getStatValueByTimeMillis() {
- return statValueByTimeMillis;
- }
-
- public void setStatValueByTimeMillis(Map statValueByTimeMillis) {
- this.statValueByTimeMillis = statValueByTimeMillis;
- }
-}
Index: rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/constructs/classloader/package.html
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/constructs/classloader/package.html (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/constructs/classloader/package.html (revision 0)
@@ -1,10 +0,0 @@
-
-
-
-
-ClassLoader contstructs package
-
-This package contains decorators that are concerned with classloaders
-
-
-
Index: rctags/ehcache-2.10.9.0.371/management-ehcache-impl/management-ehcache-common/impl/CacheManagerConfigurationEntityBuilderV2.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/management-ehcache-impl/management-ehcache-common/impl/CacheManagerConfigurationEntityBuilderV2.java (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/management-ehcache-impl/management-ehcache-common/impl/CacheManagerConfigurationEntityBuilderV2.java (revision 0)
@@ -1,57 +0,0 @@
-/*
- * All content copyright (c) 2003-2012 Terracotta, Inc., except as may otherwise be noted in a separate copyright
- * notice. All rights reserved.
- */
-package net.sf.ehcache.management.service.impl;
-
-import net.sf.ehcache.management.resource.CacheManagerConfigEntityV2;
-import net.sf.ehcache.management.sampled.CacheManagerSampler;
-
-import org.terracotta.management.resource.AgentEntityV2;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * @author brandony
- */
-final class CacheManagerConfigurationEntityBuilderV2 {
- private final List cmSamplers = new ArrayList();
-
- static CacheManagerConfigurationEntityBuilderV2 createWith(CacheManagerSampler sampler) {
- return new CacheManagerConfigurationEntityBuilderV2(sampler);
- }
-
- private CacheManagerConfigurationEntityBuilderV2(CacheManagerSampler sampler) {
- addSampler(sampler);
- }
-
- CacheManagerConfigurationEntityBuilderV2 add(CacheManagerSampler sampler) {
- addSampler(sampler);
- return this;
- }
-
- Collection build() {
- Collection cmces = new ArrayList(cmSamplers.size());
-
- for (CacheManagerSampler sampler : cmSamplers) {
- CacheManagerConfigEntityV2 cmce = new CacheManagerConfigEntityV2();
- cmce.setCacheManagerName(sampler.getName());
- cmce.setAgentId(AgentEntityV2.EMBEDDED_AGENT_ID);
- // cmce.setVersion(this.getClass().getPackage().getImplementationVersion());
- cmce.setXml(sampler.generateActiveConfigDeclaration());
-
- cmces.add(cmce);
- }
-
- return cmces;
- }
-
- private void addSampler(CacheManagerSampler sampler) {
- if (sampler == null) {
- throw new IllegalArgumentException("sampler == null");
- }
- cmSamplers.add(sampler);
- }
-}
Index: rctags/ehcache-2.10.9.0.371/ehcache-core/src/test/java/net/sf/ehcache/config/generator/xsom/XSDAttributeValueType.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/ehcache-core/src/test/java/net/sf/ehcache/config/generator/xsom/XSDAttributeValueType.java (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/ehcache-core/src/test/java/net/sf/ehcache/config/generator/xsom/XSDAttributeValueType.java (revision 0)
@@ -1,264 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.sf.ehcache.config.generator.xsom;
-
-import net.sf.ehcache.config.MemoryUnit;
-
-import java.util.Iterator;
-import java.util.Random;
-
-import com.sun.xml.xsom.XSAttributeDecl;
-import com.sun.xml.xsom.XSFacet;
-import com.sun.xml.xsom.XSRestrictionSimpleType;
-import com.sun.xml.xsom.XSSimpleType;
-
-public abstract class XSDAttributeValueType {
-
- protected static final Random RANDOM = new Random(System.currentTimeMillis());
- protected String pattern;
- public enum XsdType {
- BOOLEAN, INTEGER, POSITIVE_INTEGER, NON_NEGATIVE_INTEGER, STRING, ANY_SIMPLE_TYPE, ENUMERATION;
- }
- protected String maxValue;
- protected String minValue;
- protected String length;
- protected String maxLength;
- protected String minLength;
-
- protected String totalDigits;
-
- private final XsdType type;
-
- public XSDAttributeValueType(XsdType type) {
- this.type = type;
- }
-
- public abstract String getRandomAllowedValue();
-
- protected void fillUpRestrictions(XSAttributeDecl attributeDecl) {
- XSSimpleType localType = attributeDecl.getType();
- XSRestrictionSimpleType restriction = localType.asRestriction();
- if (restriction != null) {
- Iterator extends XSFacet> i = restriction.getDeclaredFacets().iterator();
- while (i.hasNext()) {
- XSFacet facet = i.next();
- if (facet.getName().equals(XSFacet.FACET_MAXINCLUSIVE)) {
- maxValue = facet.getValue().value;
- }
- if (facet.getName().equals(XSFacet.FACET_MININCLUSIVE)) {
- minValue = facet.getValue().value;
- }
- if (facet.getName().equals(XSFacet.FACET_MAXEXCLUSIVE)) {
- maxValue = String.valueOf(Integer.parseInt(facet.getValue().value) - 1);
- }
- if (facet.getName().equals(XSFacet.FACET_MINEXCLUSIVE)) {
- minValue = String.valueOf(Integer.parseInt(facet.getValue().value) + 1);
- }
- if (facet.getName().equals(XSFacet.FACET_LENGTH)) {
- length = facet.getValue().value;
- }
- if (facet.getName().equals(XSFacet.FACET_MAXLENGTH)) {
- maxLength = facet.getValue().value;
- }
- if (facet.getName().equals(XSFacet.FACET_MINLENGTH)) {
- minLength = facet.getValue().value;
- }
- if (facet.getName().equals(XSFacet.FACET_PATTERN)) {
- pattern = facet.getValue().value;
- }
- if (facet.getName().equals(XSFacet.FACET_TOTALDIGITS)) {
- totalDigits = facet.getValue().value;
- }
- }
- }
- }
-
- public static class XSDAttributeValueBooleanType extends XSDAttributeValueType {
-
- public XSDAttributeValueBooleanType() {
- super(XsdType.BOOLEAN);
- }
-
- @Override
- public String getRandomAllowedValue() {
- return RANDOM.nextInt() % 2 == 0 ? getTrue() : getFalse();
- }
-
- public String getTrue() {
- return String.valueOf(true);
- }
-
- public String getFalse() {
- return String.valueOf(false);
- }
-
- }
-
- public static class XSDAttributeValueIntegerType extends XSDAttributeValueType {
-
- public XSDAttributeValueIntegerType() {
- super(XsdType.INTEGER);
- }
-
- @Override
- public String getRandomAllowedValue() {
- return String.valueOf(RANDOM.nextInt());
- }
-
- }
-
- public static class XSDAttributeValuePositiveIntegerType extends XSDAttributeValueType {
-
- public XSDAttributeValuePositiveIntegerType() {
- super(XsdType.POSITIVE_INTEGER);
- }
-
- @Override
- public String getRandomAllowedValue() {
- return String.valueOf(Math.abs(RANDOM.nextInt() + 1));
- }
-
- }
-
- public static class XSDAttributeValueNonNegativeIntegerType extends XSDAttributeValueType {
-
- public XSDAttributeValueNonNegativeIntegerType() {
- super(XsdType.NON_NEGATIVE_INTEGER);
- }
-
- @Override
- public String getRandomAllowedValue() {
- return String.valueOf(Math.abs(RANDOM.nextInt()));
- }
-
- }
-
- public static class XSDAttributeValueMemoryUnitType extends XSDAttributeValueType {
-
- public static final char[] unitChars;
-
- static {
- MemoryUnit[] values = MemoryUnit.values();
- char [] chars = new char[values.length * 2];
- int i = 0;
- for (MemoryUnit memoryUnit : values) {
- chars[i++] = Character.toLowerCase(memoryUnit.getUnit());
- chars[i++] = Character.toUpperCase(memoryUnit.getUnit());
- }
- unitChars = chars;
- }
-
- public XSDAttributeValueMemoryUnitType() {
- super(XsdType.NON_NEGATIVE_INTEGER);
- }
-
- @Override
- public String getRandomAllowedValue() {
- int index = RANDOM.nextInt(unitChars.length + 1);
- if(index < unitChars.length) {
- return String.valueOf(Math.abs(RANDOM.nextInt())) + unitChars[index];
- }
- return String.valueOf(Math.abs(RANDOM.nextInt()));
- }
-
- }
-
- public static class XSDAttributeValueMemoryUnitOrPercentageType extends XSDAttributeValueType {
-
- public static final char[] unitChars;
-
- static {
- MemoryUnit[] values = MemoryUnit.values();
- char [] chars = new char[values.length * 2 + 1];
- int i = 0;
- for (MemoryUnit memoryUnit : values) {
- chars[i++] = Character.toLowerCase(memoryUnit.getUnit());
- chars[i++] = Character.toUpperCase(memoryUnit.getUnit());
- }
- chars[i] = '%';
- unitChars = chars;
- }
-
- public XSDAttributeValueMemoryUnitOrPercentageType() {
- super(XsdType.NON_NEGATIVE_INTEGER);
- }
-
- @Override
- public String getRandomAllowedValue() {
- int index = RANDOM.nextInt(unitChars.length + 1);
- if(index < unitChars.length) {
- switch (unitChars[index]) {
- case '%' :
- return String.valueOf(Math.abs(RANDOM.nextInt(100) + 1)) + unitChars[index];
- default:
- return String.valueOf(Math.abs(RANDOM.nextInt())) + unitChars[index];
- }
- }
- return String.valueOf(Math.abs(RANDOM.nextInt()));
- }
-
- }
-
- public static class XSDAttributeValueStringType extends XSDAttributeValueType {
-
- private static final String[] RANDOM_VALUES = {"random_string_one", "random_string_two", "random_string_three", "random_string_four",
- "random_string_five", };
-
- public XSDAttributeValueStringType() {
- super(XsdType.STRING);
- }
-
- @Override
- public String getRandomAllowedValue() {
- return RANDOM_VALUES[RANDOM.nextInt(RANDOM_VALUES.length)];
- }
-
- }
-
- public static class XSDAttributeValueAnySimpleType extends XSDAttributeValueType {
-
- private static final String[] RANDOM_VALUES = {"any_simple_type_random_one", "any_simple_type_random_two",
- "any_simple_type_random_three", "any_simple_type_random_four", "any_simple_type_random_five", };
-
- public XSDAttributeValueAnySimpleType() {
- super(XsdType.ANY_SIMPLE_TYPE);
- }
-
- @Override
- public String getRandomAllowedValue() {
- return RANDOM_VALUES[RANDOM.nextInt(RANDOM_VALUES.length)];
- }
-
- }
-
- public static class XSDAttributeValueEnumerationType extends XSDAttributeValueType {
-
- private final String[] enumeration;
-
- public XSDAttributeValueEnumerationType(String[] enumeration) {
- super(XsdType.ENUMERATION);
- this.enumeration = enumeration;
- }
-
- @Override
- public String getRandomAllowedValue() {
- return enumeration[RANDOM.nextInt(enumeration.length)];
- }
-
- }
-
-}
Index: rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/constructs/eventual/package.html
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/constructs/eventual/package.html (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/constructs/eventual/package.html (revision 0)
@@ -1,10 +0,0 @@
-
-
-
-
-Construct related to eventual operations
-
-This package contains a decorator which offers a strong view on an eventual consistent cache.
-
-
-
Index: rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/package.html
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/package.html (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/package.html (revision 0)
@@ -1,5 +0,0 @@
-
-
- This package contains utility classes encapsulating ideas of Elements and Attributes from the ehcache.xsd
-
-
Index: rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/ExtendedStatistics.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/ExtendedStatistics.java (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/ExtendedStatistics.java (revision 0)
@@ -1,552 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.sf.ehcache.statistics.extended;
-
-import net.sf.ehcache.CacheOperationOutcomes;
-import net.sf.ehcache.store.StoreOperationOutcomes;
-import net.sf.ehcache.transaction.xa.XaCommitOutcome;
-import net.sf.ehcache.transaction.xa.XaRecoveryOutcome;
-import net.sf.ehcache.transaction.xa.XaRollbackOutcome;
-import org.terracotta.statistics.archive.Timestamped;
-
-import java.util.EnumSet;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-/**
- * The ExtendedStatistics interface.
- *
- * @author cschanck
- */
-public interface ExtendedStatistics {
-
- /** The Constant ALL_CACHE_PUT_OUTCOMES. */
- static final Set ALL_CACHE_PUT_OUTCOMES = EnumSet.allOf(CacheOperationOutcomes.PutOutcome.class);
-
- /** The Constant ALL_CACHE_GET_OUTCOMES. */
- static final Set ALL_CACHE_GET_OUTCOMES = EnumSet.allOf(CacheOperationOutcomes.GetOutcome.class);
-
- /** The Constant ALL_CACHE_MISS_OUTCOMES. */
- static final Set ALL_CACHE_MISS_OUTCOMES = EnumSet.of(
- CacheOperationOutcomes.GetOutcome.MISS_EXPIRED, CacheOperationOutcomes.GetOutcome.MISS_NOT_FOUND);
-
- /** The Constant ALL_STORE_PUT_OUTCOMES. */
- static final Set ALL_STORE_PUT_OUTCOMES = EnumSet.allOf(StoreOperationOutcomes.PutOutcome.class);
-
- /**
- * Sets the time to disable.
- *
- * @param time the time
- * @param unit the unit
- */
- void setTimeToDisable(long time, TimeUnit unit);
-
- /**
- * Sets the always on.
- *
- * @param alwaysOn the new always on
- */
- void setAlwaysOn(boolean alwaysOn);
-
- /**
- * Gets the.
- *
- * @return the operation
- */
- Operation get();
-
- /**
- * Put.
- *
- * @return the operation
- */
- Operation put();
-
- /**
- * Removes the.
- *
- * @return the operation
- */
- Operation remove();
-
- /**
- * single arg replace operation
- * @return
- */
- Operation replaceOneArg();
-
- /**
- * two arg replace operation
- * @return
- */
- Operation replaceTwoArg();
-
- /**
- * put if absent operation
- * @return
- */
- Operation putIfAbsent();
-
- /**
- * remove element operation
- * @return
- */
- Operation removeElement();
-
- /**
- * Heap get.
- *
- * @return the operation
- */
- Operation heapGet();
-
- /**
- * Offheap get.
- *
- * @return the operation
- */
- Operation offheapGet();
-
- /**
- * Disk get.
- *
- * @return the operation
- */
- Operation diskGet();
-
- /**
- * Heap put.
- *
- * @return the operation
- */
- Operation heapPut();
-
- /**
- * Offheap put.
- *
- * @return the operation
- */
- Operation offheapPut();
-
- /**
- * Disk put.
- *
- * @return the operation
- */
- Operation diskPut();
-
- /**
- * Heap remove.
- *
- * @return the operation
- */
- Operation heapRemove();
-
- /**
- * Offheap remove.
- *
- * @return the operation
- */
- Operation offheapRemove();
-
- /**
- * Disk remove.
- *
- * @return the operation
- */
- Operation diskRemove();
-
- /**
- * Search.
- *
- * @return the operation
- */
- Operation search();
-
- /**
- * Xa commit.
- *
- * @return the operation
- */
- Operation xaCommit();
-
- /**
- * Xa rollback.
- *
- * @return the operation
- */
- Operation xaRollback();
-
- /**
- * Xa recovery.
- *
- * @return the operation
- */
- Operation xaRecovery();
-
- /**
- * Eviction.
- *
- * @return the operation
- */
- Operation eviction();
-
- /**
- * Expiry.
- *
- * @return the operation
- */
- Operation expiry();
-
- /**
- * Cluster events
- *
- * @return the operation
- */
- Operation clusterEvent();
-
- /**
- * Nonstop events
- *
- * @return the operation
- */
- Operation nonstop();
-
- /**
- * All get.
- *
- * @return the result
- */
- Result allGet();
-
- /**
- * All miss.
- *
- * @return the result
- */
- Result allMiss();
-
- /**
- * All put.
- *
- * @return the result
- */
- Result allPut();
-
- /**
- * Heap all put.
- *
- * @return the result
- */
- Result heapAllPut();
-
- /**
- * Off heap all put.
- *
- * @return the result
- */
- Result offHeapAllPut();
-
- /**
- * Disk all put.
- *
- * @return the result
- */
- Result diskAllPut();
-
- /**
- * Cache hit ratio.
- * @return
- */
- Statistic cacheHitRatio();
-
- /**
- * Nonstop timeout ratio
- * @return
- */
- Statistic nonstopTimeoutRatio();
-
- /**
- * Operations.
- *
- * @param the generic type
- * @param outcome the outcome
- * @param name the name
- * @param tags the tags
- * @return the sets the
- */
- > Set> operations(Class outcome, String name, String... tags);
-
- /**
- * Get the set of cache specific pass thru statistics for a nam/tags pair. Used for
- * custom pass thru statistics, as opposed to well known standard ones.
- * @param name name
- * @param tags set of tags
- * @return
- */
- Set> passthru(String name, Set tags);
-
- /**
- * The Interface Operation.
- *
- * @param the generic type
- */
- public interface Operation> {
-
- /**
- * Type.
- *
- * @return the class
- */
- Class type();
-
- /**
- * Component.
- *
- * @param result the result
- * @return the result
- */
- Result component(T result);
-
- /**
- * Compound.
- *
- * @param results the results
- * @return the result
- */
- Result compound(Set results);
-
- /**
- * Ratio of.
- *
- * @param numerator the numerator
- * @param denomiator the denomiator
- * @return the statistic
- */
- Statistic ratioOf(Set numerator, Set denomiator);
-
- /**
- * Sets the always on.
- *
- * @param enable the new always on
- */
- void setAlwaysOn(boolean enable);
-
- /**
- * Checks if is always on.
- *
- * @return true, if is always on
- */
- boolean isAlwaysOn();
-
- /**
- * Sets the window.
- *
- * @param time the time
- * @param unit the unit
- */
- void setWindow(long time, TimeUnit unit);
-
- /**
- * Sets the history.
- *
- * @param samples the samples
- * @param time the time
- * @param unit the unit
- */
- void setHistory(int samples, long time, TimeUnit unit);
-
- /**
- * Gets the window size.
- *
- * @param unit the unit
- * @return the window size
- */
- long getWindowSize(TimeUnit unit);
-
- /**
- * Gets the history sample size.
- *
- * @return the history sample size
- */
- int getHistorySampleSize();
-
- /**
- * Gets the history sample time.
- *
- * @param unit the unit
- * @return the history sample time
- */
- long getHistorySampleTime(TimeUnit unit);
-
- }
-
- /**
- * The Interface Result.
- */
- public interface Result {
-
- /**
- * Count.
- *
- * @return the statistic
- */
- Statistic count();
-
- /**
- * Rate.
- *
- * @return the statistic
- */
- Statistic rate();
-
- /**
- * Latency.
- *
- * @return the latency
- */
- Latency latency();
- }
-
- /**
- * The Latency interface. Provides min/max/average.
- */
- public interface Latency {
-
- /**
- * Minimum latency observed.
- *
- * @return Minimum observed latency. NULL if no operation was observed.
- */
- Statistic minimum();
-
- /**
- * Maximum latency observed.
- *
- * @return Maximum observed latency. NULL if no operation was observed.
- */
- Statistic maximum();
-
- /**
- * Average observed latency.
- *
- * @return Average observed latency. NULL if no operation was observed.
- */
- Statistic average();
- }
-
- /**
- * The Interface Statistic.
- *
- * @param the generic type
- */
- public interface Statistic {
-
- /**
- * Active.
- *
- * @return true, if successful
- */
- boolean active();
-
- /**
- * Value.
- *
- * @return the t
- */
- T value();
-
- /**
- * History.
- *
- * @return the list
- */
- List> history();
- }
-
- /**
- * Gets the size.
- *
- * @return the size
- */
- Statistic size();
-
- /**
- * Gets the local heap size.
- *
- * @return the local heap size
- */
- Statistic localHeapSize();
-
- /**
- * Gets the local heap size in bytes.
- *
- * @return the local heap size in bytes
- */
- Statistic localHeapSizeInBytes();
-
- /**
- * Gets the local off heap size.
- *
- * @return the local off heap size
- */
- Statistic localOffHeapSize();
-
- /**
- * Gets the local off heap size in bytes.
- *
- * @return the local off heap size in bytes
- */
- Statistic localOffHeapSizeInBytes();
-
- /**
- * Gets the local disk size.
- *
- * @return the local disk size
- */
- Statistic localDiskSize();
-
- /**
- * Gets the local disk size in bytes.
- *
- * @return the local disk size in bytes
- */
- Statistic localDiskSizeInBytes();
-
- /**
- * Gets the remote size.
- *
- * @return the remote size
- */
- Statistic remoteSize();
-
- /**
- * Gets the writer queue length.
- *
- * @return the writer queue length
- */
- Statistic writerQueueLength();
-
- /**
- * Get the timestamp (millis) of the last cluster rejoin event
- *
- * @return statistic for cluster rejoin timestamp
- */
- Statistic mostRecentRejoinTimeStampMillis();
-
-}
\ No newline at end of file
Index: rctags/ehcache-2.10.9.0.371/ehcache/src/test/java/net/sf/ehcache/terracotta/upgradability/serialization/ClusteredTransactionIDSerializationTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/ehcache/src/test/java/net/sf/ehcache/terracotta/upgradability/serialization/ClusteredTransactionIDSerializationTest.java (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/ehcache/src/test/java/net/sf/ehcache/terracotta/upgradability/serialization/ClusteredTransactionIDSerializationTest.java (revision 0)
@@ -1,59 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.sf.ehcache.terracotta.upgradability.serialization;
-
-import java.lang.reflect.Field;
-import java.util.Comparator;
-import java.util.Map;
-
-import net.sf.ehcache.CacheManager;
-import net.sf.ehcache.transaction.TransactionIDFactory;
-import net.sf.ehcache.transaction.TransactionIDSerializedForm;
-import org.junit.Test;
-import org.terracotta.modules.ehcache.transaction.ClusteredTransactionID;
-
-import static org.mockito.Matchers.refEq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import static org.terracotta.upgradability.serialization.SerializationUpgradabilityTesting.validateSerializedForm;
-
-/**
- *
- * @author cdennis
- */
-public class ClusteredTransactionIDSerializationTest {
-
- private static final Comparator COMPARATOR = new Comparator() {
- @Override
- public int compare(ClusteredTransactionID o1, ClusteredTransactionID o2) {
- return o1.equals(o2) && o1.getOwnerID().equals(o2.getOwnerID()) ? 0 : -1;
- }
- };
-
- @Test
- public void testBasic() throws Exception {
- Field MANAGERS_MAP = CacheManager.class.getDeclaredField("CACHE_MANAGERS_MAP");
- MANAGERS_MAP.setAccessible(true);
- CacheManager manager = mock(CacheManager.class);
- ((Map) MANAGERS_MAP.get(null)).put("manager", manager);
- TransactionIDFactory txnIdFactory = mock(TransactionIDFactory.class);
- when(txnIdFactory.restoreTransactionID(refEq(new TransactionIDSerializedForm("manager", "cluster", "owner", 42L, 2))))
- .thenReturn(new ClusteredTransactionID("owner", "cluster", "manager", 42L, 2));
- when(manager.getOrCreateTransactionIDFactory()).thenReturn(txnIdFactory);
- validateSerializedForm(new ClusteredTransactionID("owner", "cluster", "manager", 42L, 2), COMPARATOR, "serializedforms/ClusteredTransactionIDSerializationTest.testBasic.ser");
- }
-}
Index: rctags/ehcache-2.10.9.0.371/system-tests/src/test/java/org/terracotta/modules/ehcache/store/BlockingCacheTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/system-tests/src/test/java/org/terracotta/modules/ehcache/store/BlockingCacheTest.java (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/system-tests/src/test/java/org/terracotta/modules/ehcache/store/BlockingCacheTest.java (revision 0)
@@ -1,135 +0,0 @@
-/*
- * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
- */
-package org.terracotta.modules.ehcache.store;
-
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.CacheException;
-import net.sf.ehcache.Ehcache;
-import net.sf.ehcache.Element;
-import net.sf.ehcache.constructs.blocking.BlockingCache;
-
-import org.terracotta.ehcache.tests.AbstractCacheTestBase;
-import org.terracotta.ehcache.tests.ClientBase;
-import org.terracotta.toolkit.Toolkit;
-import org.terracotta.toolkit.concurrent.ToolkitBarrier;
-
-import com.tc.test.config.model.TestConfig;
-
-import java.io.Serializable;
-
-import junit.framework.Assert;
-
-/**
- * @author Alex Snaps
- */
-public class BlockingCacheTest extends AbstractCacheTestBase {
-
- public BlockingCacheTest(TestConfig testConfig) {
- super("blocking-cache.xml", testConfig, App.class, App.class, App.class);
- }
-
- public static class App extends ClientBase {
- private static final String KEY_1 = "funkyKey";
- private static final Serializable VALUE_1 = "A really cool value";
- private static final String KEY_2 = "otherFunkyKey";
- private static final Serializable VALUE_2 = "Even cooler value";
- private static final String KEY_3 = "theUeberFunkyKey";
- private static final Serializable VALUE_3 = "can't get any cooler value";
- private final ToolkitBarrier barrier;
-
- public App(String[] args) {
- super("test1", args);
- this.barrier = getClusteringToolkit().getBarrier("test-barrier", getParticipantCount());
- }
-
- public static void main(String[] args) {
- new App(args).run();
- }
-
- @Override
- protected void runTest(Cache testcache, Toolkit clusteringToolkit) throws Throwable {
- final int index = barrier.await();
-
- Ehcache cache = cacheManager.getCache("test1");
- Assert.assertNotNull("There should be a cache test from that manager!", cache);
- BlockingCache blockingCache = new BlockingCache(cache);
- cacheManager.replaceCacheWithDecoratedCache(cache, blockingCache);
- cache = cacheManager.getEhcache("test1");
-
- if (index == 0) {
- // Node 0 blocks all other read to the key
- Assert.assertNull("Key " + KEY_1 + " should not be present in the cache yet", cache.get(KEY_1));
- cache.put(new Element(KEY_2, VALUE_2));
- }
-
- barrier.await();
-
- if (index != 0) {
- // This call should block, until node 0 puts en element for KEY in the cache
- Element element = cache.get(KEY_1);
- Assert.assertNotNull("Node 0 should have put key " + KEY_1 + " in the cache", element);
- Assert.assertEquals("Value for key " + KEY_1 + " should be " + VALUE_1, VALUE_1, element.getValue());
- } else {
- Thread.sleep(2000); // Thinking about the meaning of life for a while
- cache.put(new Element(KEY_1, VALUE_1));
- }
- Element element = cache.get(KEY_2);
- Assert.assertNotNull(element);
- Assert.assertEquals("Value for key " + KEY_2 + " should be " + VALUE_2, VALUE_2, element.getValue());
-
- barrier.await();
-
- blockingCache.setTimeoutMillis(3000);
- if (index == 0) {
- // Should block all other get to the same key
- cache.get(KEY_3);
- }
-
- barrier.await();
-
- switch (index) {
- case 2:
- Thread.sleep(2000);
- Assert.assertNotNull(cache.get(KEY_3));
- break;
- case 1:
- try {
- cache.get(KEY_3);
- Assert.fail();
- } catch (CacheException e) {
- // We failed aquiring the lock
- }
- break;
- case 0:
- Thread.sleep(3500);
- cache.put(new Element(KEY_3, VALUE_3));
- break;
- }
-
- barrier.await();
-
- // This tests inline eviction (EHC-420)
- Thread.sleep(22000);
-
- switch (index) {
- case 0:
- Assert.assertNull(cache.get(KEY_3));
- break;
- }
-
- barrier.await();
- blockingCache.setTimeoutMillis(10000);
- switch (index) {
- case 0:
- Thread.sleep(1500);
- cache.put(new Element(KEY_3, VALUE_3));
- break;
- default:
- Assert.assertNotNull(cache.get(KEY_3));
- Assert.assertEquals(VALUE_3, cache.get(KEY_3).getValue());
- }
- }
-
- }
-}
Index: rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/util/counter/sampled/SampledCounterConfig.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/util/counter/sampled/SampledCounterConfig.java (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/util/counter/sampled/SampledCounterConfig.java (revision 0)
@@ -1,95 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.sf.ehcache.util.counter.sampled;
-
-import net.sf.ehcache.util.counter.Counter;
-import net.sf.ehcache.util.counter.CounterConfig;
-
-/**
- * Config for a {@link SampledCounter}
- *
- * @author Abhishek Sanoujam
- * @since 1.7
- *
- */
-public class SampledCounterConfig extends CounterConfig {
- private final int intervalSecs;
- private final int historySize;
- private final boolean isReset;
-
- /**
- * Make a new timed counter config (duh)
- *
- * @param intervalSecs
- * the interval (in seconds) between sampling
- * @param historySize
- * number of counter samples that will be retained in memory
- * @param isResetOnSample
- * true if the counter should be reset to 0 upon each sample
- * @param initialValue
- * the initial value given to this counter
- */
- public SampledCounterConfig(int intervalSecs, int historySize, boolean isResetOnSample, long initialValue) {
- super(initialValue);
- if (intervalSecs < 1) {
- throw new IllegalArgumentException("Interval (" + intervalSecs + ") must be greater than or equal to 1");
- }
- if (historySize < 1) {
- throw new IllegalArgumentException("History size (" + historySize + ") must be greater than or equal to 1");
- }
-
- this.intervalSecs = intervalSecs;
- this.historySize = historySize;
- this.isReset = isResetOnSample;
- }
-
- /**
- * Returns the history size
- *
- * @return The history size
- */
- public int getHistorySize() {
- return historySize;
- }
-
- /**
- * Returns the interval time (seconds)
- *
- * @return Interval of the sampling thread in seconds
- */
- public int getIntervalSecs() {
- return intervalSecs;
- }
-
- /**
- * Returns true if counters created from this config will reset on each
- * sample
- *
- * @return true if values are reset to the initial value after each sample
- */
- public boolean isResetOnSample() {
- return this.isReset;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Counter createCounter() {
- return new SampledCounterImpl(this);
- }
-}
Index: rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/pool/PoolAccessor.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/pool/PoolAccessor.java (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/pool/PoolAccessor.java (revision 0)
@@ -1,123 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.sf.ehcache.pool;
-
-/**
- * PoolAccessors are used by stores to tell the pools about their resource consumption
- *
- * @param Type representing this "other" side of this accessor (i.e. a store), so the evictor can interact with it
- *
- * @author Ludovic Orban
- * @author Alex Snaps
- *
- */
-public interface PoolAccessor {
-
- /**
- * Add an element to the pool.
- *
- * @param key the key of the element
- * @param value the value of the element
- * @param container the element-container object
- * @param force true if the pool should accept adding the element, even if it's out of resources
- * @return how many bytes have been added to the pool or -1 if add failed.
- */
- long add(Object key, Object value, Object container, boolean force);
-
- /**
- * Check if there is enough room in the pool to add an element without provoking any eviction
- * @param key the key of the element
- * @param value the value of the element
- * @param container the element-container object
- * @return true if there is enough room left
- */
- boolean canAddWithoutEvicting(Object key, Object value, Object container);
-
- /**
- * Delete a fixed number of bytes from the pool.
- *
- * @param size number of bytes
- * @return how many bytes have been freed from the pool.
- * @throws IllegalArgumentException when sizeOf is negative
- */
- long delete(long size) throws IllegalArgumentException;
-
- /**
- * Delete a fixed number of bytes from the pool with the given objects.
- *
- * @param currentSize the size of the object(s) being replaced
- * @param key the key of the element
- * @param value the value of the element
- * @param container the element-container object
- * @param force true if the pool should accept replacing the element, even if it's out of resources
- * @return the change in size of the pool, or {@link Long#MIN_VALUE} if replace failed.
- */
- long replace(long currentSize, Object key, Object value, Object container, boolean force);
-
- /**
- * Return how many bytes this accessor consumes from the pool.
- *
- * @return how many bytes this accessor consumes from the pool.
- */
- long getSize();
-
- /**
- * unlink this PoolAccessor from its pool.
- */
- void unlink();
-
- /**
- * Free resources used by this accessor.
- */
- void clear();
-
- /**
- * Return the store that uses this accessor
- *
- * @return store using this accessor
- */
- T getParticipant();
-
- /**
- * Sets the max size for this pool
- *
- * @param newValue the value in bytes
- */
- void setMaxSize(long newValue);
-
- /**
- * Returns the occupied size for this pool.
- *
- * @return occupied pool size
- */
- long getPoolOccupancy();
-
- /**
- * Returns the size of this pool.
- *
- * @return pool size
- */
- long getPoolSize();
-
- /**
- * Check if the store may contain elements which the SizeOf engine could not fully size.
- *
- * @return true if the store may contain partially sized objects
- */
- boolean hasAbortedSizeOf();
-
-}
Index: rctags/ehcache-2.10.9.0.371/ehcache-core/src/test/resources/nonstop/basic-cache-test.xml
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/ehcache-core/src/test/resources/nonstop/basic-cache-test.xml (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/ehcache-core/src/test/resources/nonstop/basic-cache-test.xml (revision 0)
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: rctags/ehcache-2.10.9.0.371/system-tests/.settings/org.eclipse.jdt.ui.prefs
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/system-tests/.settings/org.eclipse.jdt.ui.prefs (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/system-tests/.settings/org.eclipse.jdt.ui.prefs (revision 0)
@@ -1,72 +0,0 @@
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=false
-formatter_profile=_Terracotta profile
-formatter_settings_version=11
-org.eclipse.jdt.ui.exception.name=e
-org.eclipse.jdt.ui.gettersetter.use.is=true
-org.eclipse.jdt.ui.ignorelowercasenames=true
-org.eclipse.jdt.ui.importorder=org;com;java;javax;
-org.eclipse.jdt.ui.javadoc=false
-org.eclipse.jdt.ui.keywordthis=false
-org.eclipse.jdt.ui.ondemandthreshold=99
-org.eclipse.jdt.ui.overrideannotation=true
-org.eclipse.jdt.ui.staticondemandthreshold=99
-org.eclipse.jdt.ui.text.custom_code_templates=/**\r\n * \r\n *//**\r\n * \r\n *//*\r\n * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.\r\n */\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}throw ${exception_var};throw new ImplementMe();\r\n${body_statement}${body_statement}return ${field};${field} \= ${param};/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */\r\n\r\n\r\n\r\n/**\r\n * @return the ${bare_field_name}\r\n *//**\r\n * @param ${param} the ${bare_field_name} to set\r\n *//**\r\n * ${tags}\r\n *//**\r\n * \r\n *//**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n *//**\r\n * \r\n *//**\r\n * ${tags}\r\n *//* (non-Jsdoc)\r\n * ${see_to_overridden}\r\n *//**\r\n * ${tags}\r\n * ${see_to_target}\r\n */${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}\r\n// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();// ${todo} Auto-generated function stub\r\n${body_statement}${body_statement}\r\n// ${todo} Auto-generated constructor stubreturn ${field};${field} \= ${param};
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=true
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=true
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_functional_interfaces=false
-sp_cleanup.convert_to_enhanced_for_loop=true
-sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=true
-sp_cleanup.format_source_code_changes_only=true
-sp_cleanup.insert_inferred_type_arguments=false
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=true
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=true
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_redundant_type_arguments=false
-sp_cleanup.remove_trailing_whitespaces=true
-sp_cleanup.remove_trailing_whitespaces_all=false
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=true
-sp_cleanup.remove_unnecessary_casts=true
-sp_cleanup.remove_unnecessary_nls_tags=false
-sp_cleanup.remove_unused_imports=true
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_anonymous_class_creation=false
-sp_cleanup.use_blocks=false
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_lambda=false
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=false
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
-sp_cleanup.use_type_arguments=false
Index: rctags/ehcache-2.10.9.0.371/management-ehcache-impl/management-ehcache-common/impl/ConstrainableEntityBuilderSupportV2.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/management-ehcache-impl/management-ehcache-common/impl/ConstrainableEntityBuilderSupportV2.java (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/management-ehcache-impl/management-ehcache-common/impl/ConstrainableEntityBuilderSupportV2.java (revision 0)
@@ -1,136 +0,0 @@
-/*
- * All content copyright (c) 2003-2012 Terracotta, Inc., except as may otherwise be noted in a separate copyright
- * notice. All rights reserved.
- */
-package net.sf.ehcache.management.service.impl;
-
-import net.sf.ehcache.management.service.AccessorPrefix;
-import net.sf.ehcache.util.counter.Counter;
-import net.sf.ehcache.util.counter.sampled.SampledCounter;
-import org.slf4j.Logger;
-
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-/**
-* @author brandony
-*/
-abstract class ConstrainableEntityBuilderSupportV2 {
-
- private static final Set SIZE_ATTRIBUTE_NAMES =
- Collections.unmodifiableSet(new HashSet(Arrays.asList("Size", "SizeSample", "RemoteSizeSample")));
-
- private Set constraints;
-
- abstract Logger getLog();
-
- protected void addConstraints(Set constraints) {
- if (constraints == null) throw new IllegalArgumentException("constraints == null");
-
- if (this.constraints == null) {
- this.constraints = constraints;
- } else {
- this.constraints.addAll(constraints);
- }
- }
-
- protected Set getAttributeConstraints() {
- return constraints;
- }
-
- protected void buildAttributeMapByAttribute(Class> api,
- SAMPLER sampler,
- Map attributeMap,
- Collection attributes,
- String nameAccessor) {
- Set excludedNames = getExcludedAttributeNames(sampler);
-
- for (String attribute : attributes) {
- Method method = null;
- for (AccessorPrefix prefix : AccessorPrefix.values()) {
- try {
- method = api.getMethod(prefix + attribute);
- break;
- } catch (NoSuchMethodException e) {
- //This is not the accessor you were looking for....move along
- }
- }
-
- if (method != null && !nameAccessor.equals(method.getName())) {
- if (excludedNames.contains(attribute)) {
- attributeMap.put(attribute, 0);
- continue;
- }
-
- addAttribute(sampler, attributeMap, attribute, method);
- }
- }
- }
-
- protected void buildAttributeMapByApi(Class> api,
- SAMPLER sampler,
- Map attributeMap,
- Collection attributes,
- String nameAccessor) {
- Set excludedNames = getExcludedAttributeNames(sampler);
-
- for (Method method : api.getMethods()) {
- String name = method.getName();
- String trimmedName = AccessorPrefix.trimPrefix(name);
- if (!nameAccessor.equals(name) && AccessorPrefix.isAccessor(name) && (attributes == null || attributes.contains(
- trimmedName))) {
-
- if (excludedNames.contains(trimmedName)) {
- attributeMap.put(trimmedName, 0);
- continue;
- }
-
- addAttribute(sampler, attributeMap, trimmedName, method);
- }
- }
- }
-
- protected abstract Set getExcludedAttributeNames(SAMPLER sampler);
-
- protected Set getUnsignedIntAttributeNames(SAMPLER sampler) {
- return SIZE_ATTRIBUTE_NAMES;
- }
-
- private void addAttribute(SAMPLER sampler,
- Map attributeMap,
- String attribute,
- Method method) {
- Object value = null;
- try {
- value = method.invoke(sampler);
-
- // stats reflection "helper" code
- if (value instanceof SampledCounter) {
- value = ((SampledCounter)value).getMostRecentSample().getCounterValue();
- } else if (value instanceof Counter) {
- value = ((Counter)value).getValue();
- }
-
- if (getUnsignedIntAttributeNames(sampler).contains(attribute) && value instanceof Number) {
- value = coerceUnsignedIntToLong(((Number)value).intValue());
- }
- } catch (Exception e) {
- value = null;
- String msg = String.format("Failed to invoke method %s while constructing entity.", method.getName());
- getLog().warn(msg);
- getLog().debug(msg, e);
- } finally {
- attributeMap.put(attribute, value);
- }
- }
-
- private static long coerceUnsignedIntToLong(int value) {
- return value < 0 ? ((long)Integer.MAX_VALUE) + (value - Integer.MIN_VALUE + 1) : value;
- }
-
-}
Index: rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/EhcacheHibernateMbeanNames.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/EhcacheHibernateMbeanNames.java (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/EhcacheHibernateMbeanNames.java (revision 0)
@@ -1,77 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.sf.ehcache.hibernate.management.impl;
-
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-/**
- * Utility class used for getting {@link ObjectName}'s for ehcache hibernate MBeans
- *
- *
- *
- * @author Abhishek Sanoujam
- * @since 1.7
- *
- */
-public abstract class EhcacheHibernateMbeanNames {
-
- /**
- * Group id for all sampled mbeans registered
- */
- public static final String GROUP_ID = "net.sf.ehcache.hibernate";
-
- /**
- * Type for the ehcache backed hibernate second level cache statistics mbean
- */
- public static final String EHCACHE_HIBERNATE_TYPE = "EhcacheHibernateStats";
-
- /**
- * Filter out invalid ObjectName characters from s.
- *
- * @param s
- * @return A valid JMX ObjectName attribute value.
- */
- public static String mbeanSafe(String s) {
- return s == null ? "" : s.replaceAll(",|:|=|\n", ".");
- }
-
- /**
- * Returns an ObjectName for the passed name
- *
- * @param name
- * @return An {@link ObjectName} using the input name of cache manager
- * @throws MalformedObjectNameException
- */
- public static ObjectName getCacheManagerObjectName(String cacheManagerClusterUUID, String name) throws MalformedObjectNameException {
- ObjectName objectName = new ObjectName(GROUP_ID + ":type=" + EHCACHE_HIBERNATE_TYPE + ",name=" + mbeanSafe(name)
- + getBeanNameSuffix(cacheManagerClusterUUID));
- return objectName;
- }
-
- private static String getBeanNameSuffix(String cacheManagerClusterUUID) {
- String suffix = "";
- if (!isBlank(cacheManagerClusterUUID)) {
- suffix = ",node=" + cacheManagerClusterUUID;
- }
- return suffix;
- }
-
- private static boolean isBlank(String param) {
- return param == null || "".equals(param.trim());
- }
-}
Index: rctags/ehcache-2.10.9.0.371/ehcache-core/src/test/java/net/sf/ehcache/distribution/ManualRMIPeerProviderIT.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/ehcache-core/src/test/java/net/sf/ehcache/distribution/ManualRMIPeerProviderIT.java (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/ehcache-core/src/test/java/net/sf/ehcache/distribution/ManualRMIPeerProviderIT.java (revision 0)
@@ -1,89 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.sf.ehcache.distribution;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-import net.sf.ehcache.CacheManager;
-import net.sf.ehcache.config.Configuration;
-import net.sf.ehcache.config.FactoryConfiguration;
-
-import org.junit.Before;
-
-import static net.sf.ehcache.distribution.AbstractRMITest.createAsynchronousCache;
-
-/**
- * @author Greg Luck
- * @version $Id: ManualRMIPeerProviderIT.java 8870 2014-04-03 20:27:43Z cdennis $
- */
-public class ManualRMIPeerProviderIT extends MulticastRMIPeerProviderIT {
-
- /**
- * {@inheritDoc}
- */
- @Override
- @Before
- public void setUp() throws Exception {
- List configurations = new ArrayList();
- configurations.add(new Configuration()
- .cacheManagerPeerListenerFactory(new FactoryConfiguration()
- .className("net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory")
- .properties("hostName=localhost, port=5011, socketTimeoutMillis=2000"))
- .cacheManagerPeerProviderFactory(new FactoryConfiguration()
- .className("net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory")
- .properties("peerDiscovery=manual,rmiUrls=//localhost:5012/asynchronousCache|//localhost:5013/asynchronousCache"))
- .cache(createAsynchronousCache().name("asynchronousCache"))
- .name("ManualRMIPeerProviderTest-1"));
-
- configurations.add(new Configuration()
- .cacheManagerPeerListenerFactory(new FactoryConfiguration()
- .className("net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory")
- .properties("hostName=localhost, port=5012, socketTimeoutMillis=2000"))
- .cacheManagerPeerProviderFactory(new FactoryConfiguration()
- .className("net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory")
- .properties("peerDiscovery=manual,rmiUrls=//localhost:5011/asynchronousCache|//localhost:5013/asynchronousCache"))
- .cache(createAsynchronousCache().name("asynchronousCache"))
- .name("ManualRMIPeerProviderTest-2"));
-
- configurations.add(new Configuration()
- .cacheManagerPeerListenerFactory(new FactoryConfiguration()
- .className("net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory")
- .properties("hostName=localhost, port=5013, socketTimeoutMillis=2000"))
- .cacheManagerPeerProviderFactory(new FactoryConfiguration()
- .className("net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory")
- .properties("peerDiscovery=manual"))
- .cache(createAsynchronousCache().name("asynchronousCache"))
- .name("ManualRMIPeerProviderTest-3"));
-
- List managers = startupManagers(configurations);
- manager1 = managers.get(0);
- manager2 = managers.get(1);
- manager3 = managers.get(2);
-
- /* manager3 has an empty manual configuration, which is topped up by adding manual entries.
- * The sampleCache1 from manager3 is added to the rmiUrls list for manager1 and manager2
- */
- CacheManagerPeerProvider peerProvider = manager3.getCacheManagerPeerProvider("RMI");
- peerProvider.registerPeer("//localhost:5011/asynchronousCache");
- peerProvider.registerPeer("//localhost:5012/asynchronousCache");
-
- //Allow cluster setup
- waitForClusterMembership(10, TimeUnit.SECONDS, manager1, manager2, manager3);
- }
-}
Index: rctags/ehcache-2.10.9.0.371/system-tests/src/test/java/org/terracotta/modules/ehcache/bulkops/BulkOpsGenericSanityTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.371/system-tests/src/test/java/org/terracotta/modules/ehcache/bulkops/BulkOpsGenericSanityTest.java (revision 11341)
+++ rctags/ehcache-2.10.9.0.371/system-tests/src/test/java/org/terracotta/modules/ehcache/bulkops/BulkOpsGenericSanityTest.java (revision 0)
@@ -1,133 +0,0 @@
-/*
- * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
- */
-package org.terracotta.modules.ehcache.bulkops;
-
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.CacheManager;
-import net.sf.ehcache.Element;
-import net.sf.ehcache.config.CacheConfiguration;
-import net.sf.ehcache.config.TerracottaConfiguration;
-import net.sf.ehcache.config.TerracottaConfiguration.Consistency;
-
-import org.junit.Assert;
-import org.terracotta.ehcache.tests.AbstractCacheTestBase;
-import org.terracotta.ehcache.tests.ClientBase;
-import org.terracotta.toolkit.Toolkit;
-import org.terracotta.toolkit.concurrent.ToolkitBarrier;
-
-import com.tc.test.config.model.TestConfig;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.BrokenBarrierException;
-
-public class BulkOpsGenericSanityTest extends AbstractCacheTestBase {
- private static final int NODE_COUNT = 2;
-
- public BulkOpsGenericSanityTest(TestConfig testConfig) {
- super(testConfig, BulkOpsGenericSanityTestClient.class, BulkOpsGenericSanityTestClient.class);
- }
-
- public static class BulkOpsGenericSanityTestClient extends ClientBase {
- private ToolkitBarrier barrier;
-
- public BulkOpsGenericSanityTestClient(String[] args) {
- super(args);
- }
-
- public static void main(String[] args) {
- new BulkOpsGenericSanityTestClient(args).run();
- }
-
- @Override
- protected void runTest(Cache cache, Toolkit clusteringToolkit) throws Throwable {
- this.barrier = clusteringToolkit.getBarrier("test-barrier", NODE_COUNT);
-
- Cache dcv2StrongIdentity = createCache("dcv2StrongIdentity", cacheManager, Consistency.STRONG);
- testBulkOpsSanity(dcv2StrongIdentity);
- }
-
- private void testBulkOpsSanity(Cache cache) throws InterruptedException, BrokenBarrierException {
- int index = barrier.await();
- int numOfElements = 10;
- Set elements = new HashSet();
- for (int i = 0; i < numOfElements; i++) {
- elements.add(new Element("key" + i, "val" + i, i));
- }
- if (index == 0) {
- cache.putAll(elements);
- }
-
- barrier.await();
- while (cache.getSize() != numOfElements) {
- Thread.sleep(1000);
- }
- Assert.assertEquals(numOfElements, cache.getSize());
-
- Map