Permalink
Browse files

ISPN-2268 migrated deprecated config api

Use the new (immutable) Configuration object rather than the ConfigurationBuilder
  • Loading branch information...
1 parent 7b05583 commit 08ac25a8b9a6505458c7f2de72c9267d30db2b18 @kosch kosch committed with anistor Sep 23, 2012
Showing with 81 additions and 90 deletions.
  1. +8 −7 client/hotrod-client/src/test/java/org/infinispan/client/hotrod/CSAIntegrationTest.java
  2. +2 −2 client/hotrod-client/src/test/java/org/infinispan/client/hotrod/CacheContainerTest.java
  3. +2 −2 client/hotrod-client/src/test/java/org/infinispan/client/hotrod/CacheManagerNotStartedTest.java
  4. +2 −2 client/hotrod-client/src/test/java/org/infinispan/client/hotrod/CacheManagerStoppedTest.java
  5. +10 −11 client/hotrod-client/src/test/java/org/infinispan/client/hotrod/ConsistentHashV1IntegrationTest.java
  6. +3 −3 client/hotrod-client/src/test/java/org/infinispan/client/hotrod/DistTopologyChangeTest.java
  7. +5 −4 client/hotrod-client/src/test/java/org/infinispan/client/hotrod/ExpiryTest.java
  8. +6 −11 client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HotRodAsyncReplicationTest.java
  9. +3 −3 client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HotRodIntegrationTest.java
  10. +5 −4 client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HotRodServerStartStopTest.java
  11. +4 −4 client/hotrod-client/src/test/java/org/infinispan/client/hotrod/PingOnStartupTest.java
  12. +6 −5 client/hotrod-client/src/test/java/org/infinispan/client/hotrod/ReplTopologyChangeTest.java
  13. +4 −4 client/hotrod-client/src/test/java/org/infinispan/client/hotrod/SocketTimeoutErrorTest.java
  14. +0 −11 client/hotrod-client/src/test/java/org/infinispan/client/hotrod/TestHelper.java
  15. +3 −3 client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/AbstractRetryTest.java
  16. +6 −5 client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/DistributionRetryTest.java
  17. +4 −3 client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/ReplicationRetryTest.java
  18. +4 −3 client/hotrod-client/src/test/java/org/infinispan/client/hotrod/retry/ServerFailureRetryTest.java
  19. +4 −3 client/hotrod-client/src/test/java/org/infinispan/client/hotrod/test/MultiHotRodServersTest.java
@@ -25,7 +25,8 @@
import org.infinispan.Cache;
import org.infinispan.client.hotrod.impl.transport.tcp.TcpTransport;
import org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory;
-import org.infinispan.config.Configuration;
+import org.infinispan.configuration.cache.CacheMode;
+import org.infinispan.configuration.cache.ConfigurationBuilder;
import org.infinispan.container.DataContainer;
import org.infinispan.distribution.DistributionManager;
import org.infinispan.distribution.ch.ConsistentHash;
@@ -91,12 +92,12 @@ protected void clearContent() throws Throwable {
@Override
protected void createCacheManagers() throws Throwable {
- Configuration config = getDefaultClusteredConfig(Configuration.CacheMode.DIST_SYNC);
- config.setNumOwners(1);
- config.setUnsafeUnreliableReturnValues(true);
- addClusterEnabledCacheManager(config);
- addClusterEnabledCacheManager(config);
- addClusterEnabledCacheManager(config);
+ ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, false);
+ builder.clustering().hash().numOwners(1);
+ builder.unsafe().unreliableReturnValues(true);
+ addClusterEnabledCacheManager(builder);
+ addClusterEnabledCacheManager(builder);
+ addClusterEnabledCacheManager(builder);
hotRodServer1 = TestHelper.startHotRodServer(manager(0));
hrServ2CacheManager.put(new InetSocketAddress(hotRodServer1.getHost(), hotRodServer1.getPort()), manager(0));
@@ -23,7 +23,7 @@
package org.infinispan.client.hotrod;
import org.infinispan.api.BasicCache;
-import org.infinispan.config.Configuration;
+import org.infinispan.configuration.cache.ConfigurationBuilder;
import org.infinispan.manager.EmbeddedCacheManager;
import org.infinispan.server.hotrod.HotRodServer;
import org.infinispan.test.SingleCacheManagerTest;
@@ -50,7 +50,7 @@
@Override
protected EmbeddedCacheManager createCacheManager() throws Exception {
cacheManager = TestCacheManagerFactory.createLocalCacheManager(false);
- cacheManager.defineConfiguration(CACHE_NAME, new Configuration());
+ cacheManager.defineConfiguration(CACHE_NAME, new ConfigurationBuilder().build());
hotrodServer = TestHelper.startHotRodServer(cacheManager);
remoteCacheManager = new RemoteCacheManager("localhost:" + hotrodServer.getPort(), true);
return cacheManager;
@@ -23,7 +23,7 @@
package org.infinispan.client.hotrod;
import org.infinispan.client.hotrod.exceptions.RemoteCacheManagerNotStartedException;
-import org.infinispan.config.Configuration;
+import org.infinispan.configuration.cache.ConfigurationBuilder;
import org.infinispan.manager.EmbeddedCacheManager;
import org.infinispan.server.hotrod.HotRodServer;
import org.infinispan.test.SingleCacheManagerTest;
@@ -53,7 +53,7 @@
@Override
protected EmbeddedCacheManager createCacheManager() throws Exception {
cacheManager = TestCacheManagerFactory.createLocalCacheManager(false);
- cacheManager.defineConfiguration(CACHE_NAME, new Configuration());
+ cacheManager.defineConfiguration(CACHE_NAME, new ConfigurationBuilder().build());
hotrodServer = TestHelper.startHotRodServer(cacheManager);
remoteCacheManager = new RemoteCacheManager("localhost:" + hotrodServer.getHost(), false);
return cacheManager;
@@ -23,7 +23,7 @@
package org.infinispan.client.hotrod;
import org.infinispan.client.hotrod.exceptions.RemoteCacheManagerNotStartedException;
-import org.infinispan.config.Configuration;
+import org.infinispan.configuration.cache.ConfigurationBuilder;
import org.infinispan.manager.EmbeddedCacheManager;
import org.infinispan.server.hotrod.HotRodServer;
import org.infinispan.test.SingleCacheManagerTest;
@@ -52,7 +52,7 @@
@Override
protected EmbeddedCacheManager createCacheManager() throws Exception {
cacheManager = TestCacheManagerFactory.createLocalCacheManager(false);
- cacheManager.defineConfiguration(CACHE_NAME, new Configuration());
+ cacheManager.defineConfiguration(CACHE_NAME, new ConfigurationBuilder().build());
hotrodServer = TestHelper.startHotRodServer(cacheManager);
remoteCacheManager = new RemoteCacheManager("localhost:" + hotrodServer.getPort(), true);
return cacheManager;
@@ -28,7 +28,8 @@
import org.infinispan.client.hotrod.impl.RemoteCacheImpl;
import org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory;
import org.infinispan.client.hotrod.retry.DistributionRetryTest;
-import org.infinispan.config.Configuration;
+import org.infinispan.configuration.cache.CacheMode;
+import org.infinispan.configuration.cache.ConfigurationBuilder;
import org.infinispan.distribution.ch.ConsistentHash;
import org.infinispan.interceptors.InterceptorChain;
import org.infinispan.remoting.transport.Address;
@@ -65,16 +66,14 @@
@Override
protected void createCacheManagers() throws Throwable {
- Configuration conf = getDefaultClusteredConfig(Configuration.CacheMode.DIST_SYNC, false);
- conf.fluent().jmxStatistics();
- assert conf.isExposeJmxStatistics();
- conf.fluent().hash().numOwners(2);
- conf.fluent().hash().rehashEnabled(false);
-
- addClusterEnabledCacheManager(conf);
- addClusterEnabledCacheManager(conf);
- addClusterEnabledCacheManager(conf);
- addClusterEnabledCacheManager(conf);
+ ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, false);
+ builder.jmxStatistics().enable();
+ builder.clustering().hash().numOwners(2).stateTransfer().fetchInMemoryState(false);
+
+ addClusterEnabledCacheManager(builder);
+ addClusterEnabledCacheManager(builder);
+ addClusterEnabledCacheManager(builder);
+ addClusterEnabledCacheManager(builder);
hotRodServer1 = TestHelper.startHotRodServer(manager(0));
hotRodServer2 = TestHelper.startHotRodServer(manager(1));
@@ -22,7 +22,7 @@
*/
package org.infinispan.client.hotrod;
-import org.infinispan.config.Configuration;
+import org.infinispan.configuration.cache.CacheMode;
import org.testng.annotations.Test;
/**
@@ -31,7 +31,7 @@
*/
@Test(groups = "functional" , testName = "client.hotrod.DistTopologyChangeTest")
public class DistTopologyChangeTest extends ReplTopologyChangeTest {
- protected Configuration.CacheMode getCacheMode() {
- return Configuration.CacheMode.DIST_SYNC;
+ protected CacheMode getCacheMode() {
+ return CacheMode.DIST_SYNC;
}
}
@@ -1,7 +1,8 @@
package org.infinispan.client.hotrod;
import org.infinispan.client.hotrod.test.MultiHotRodServersTest;
-import org.infinispan.config.Configuration;
+import org.infinispan.configuration.cache.CacheMode;
+import org.infinispan.configuration.cache.ConfigurationBuilder;
import org.testng.annotations.Test;
import java.lang.reflect.Method;
@@ -25,9 +26,9 @@
@Override
protected void createCacheManagers() throws Throwable {
- Configuration config = getDefaultClusteredConfig(Configuration.CacheMode.REPL_SYNC)
- .fluent().expiration().lifespan(2000L).maxIdle(3000L).build();
- createHotRodServers(1, config);
+ ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, false);
+ builder.expiration().lifespan(2000L).maxIdle(3000L);
+ createHotRodServers(1, builder.build());
}
public void testGlobalExpiry(Method m) throws Exception {
@@ -21,7 +21,8 @@
import org.infinispan.client.hotrod.test.MultiHotRodServersTest;
import org.infinispan.commands.write.PutKeyValueCommand;
-import org.infinispan.config.Configuration;
+import org.infinispan.configuration.cache.CacheMode;
+import org.infinispan.configuration.cache.ConfigurationBuilder;
import org.infinispan.test.ReplListener;
import org.testng.annotations.Test;
@@ -35,17 +36,11 @@
@Override
protected void createCacheManagers() throws Throwable {
- Configuration cfg = new Configuration().fluent()
- .clustering()
- .mode(Configuration.CacheMode.REPL_ASYNC)
- .async()
- .replQueueInterval(1000L)
- .useReplQueue(true)
- .eviction()
- .maxEntries(3)
- .build();
+ ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.REPL_ASYNC, false);
+ builder.clustering().async().replQueueInterval(1000L).useReplQueue(true);
+ builder.eviction().maxEntries(3);
- createHotRodServers(2, cfg);
+ createHotRodServers(2, builder.build());
}
public void testPutKeyValue(Method m) {
@@ -23,7 +23,7 @@
package org.infinispan.client.hotrod;
import org.infinispan.Cache;
-import org.infinispan.config.Configuration;
+import org.infinispan.configuration.cache.ConfigurationBuilder;
import org.infinispan.manager.EmbeddedCacheManager;
import org.infinispan.marshall.Marshaller;
import org.infinispan.marshall.jboss.JBossMarshaller;
@@ -71,9 +71,9 @@
@Override
protected EmbeddedCacheManager createCacheManager() throws Exception {
- Configuration standaloneConfig = getDefaultStandaloneConfig(false);
+ ConfigurationBuilder builder = getDefaultStandaloneCacheConfig(false);
cacheManager = TestCacheManagerFactory.createLocalCacheManager(false);
- cacheManager.defineConfiguration(CACHE_NAME, standaloneConfig);
+ cacheManager.defineConfiguration(CACHE_NAME, builder.build());
defaultCache = cacheManager.getCache();
cache = cacheManager.getCache(CACHE_NAME);
@@ -22,7 +22,8 @@
*/
package org.infinispan.client.hotrod;
-import org.infinispan.config.Configuration;
+import org.infinispan.configuration.cache.CacheMode;
+import org.infinispan.configuration.cache.ConfigurationBuilder;
import org.infinispan.server.hotrod.HotRodServer;
import org.infinispan.test.MultipleCacheManagersTest;
import org.testng.annotations.AfterMethod;
@@ -46,9 +47,9 @@ protected void clearContent() throws Throwable {
@Override
protected void createCacheManagers() throws Throwable {
- Configuration config = getDefaultClusteredConfig(Configuration.CacheMode.DIST_SYNC);
- addClusterEnabledCacheManager(config);
- addClusterEnabledCacheManager(config);
+ ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, false);
+ addClusterEnabledCacheManager(builder);
+ addClusterEnabledCacheManager(builder);
hotRodServer1 = TestHelper.startHotRodServer(manager(0));
hotRodServer2 = TestHelper.startHotRodServer(manager(1));
@@ -25,8 +25,8 @@
import org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory;
import org.infinispan.client.hotrod.test.MultiHotRodServersTest;
import org.infinispan.client.hotrod.test.RemoteCacheManagerCallable;
-import org.infinispan.config.Configuration;
-import org.infinispan.config.Configuration.CacheMode;
+import org.infinispan.configuration.cache.CacheMode;
+import org.infinispan.configuration.cache.ConfigurationBuilder;
import org.infinispan.server.hotrod.HotRodServer;
import org.infinispan.test.TestingUtil;
import org.testng.annotations.Test;
@@ -46,8 +46,8 @@
@Override
protected void createCacheManagers() throws Throwable {
- Configuration config = getDefaultClusteredConfig(CacheMode.DIST_SYNC);
- createHotRodServers(2, config);
+ ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, false);
+ createHotRodServers(2, builder.build());
}
public void testTopologyFetched() throws Exception {
@@ -23,7 +23,8 @@
package org.infinispan.client.hotrod;
import org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory;
-import org.infinispan.config.Configuration;
+import org.infinispan.configuration.cache.CacheMode;
+import org.infinispan.configuration.cache.ConfigurationBuilder;
import org.infinispan.lifecycle.ComponentStatus;
import org.infinispan.manager.CacheContainer;
import org.infinispan.server.hotrod.HotRodServer;
@@ -54,7 +55,7 @@
RemoteCache remoteCache;
private RemoteCacheManager remoteCacheManager;
private TcpTransportFactory tcpConnectionFactory;
- private Configuration config;
+ private ConfigurationBuilder config;
@Override
protected void assertSupportedConfig() {
@@ -83,7 +84,7 @@ protected void destroy() {
@Override
protected void createCacheManagers() throws Throwable {
- config = getDefaultClusteredConfig(getCacheMode());
+ config = getDefaultClusteredCacheConfig(getCacheMode(), false);
CacheContainer cm1 = TestCacheManagerFactory.createClusteredCacheManager(config);
CacheContainer cm2 = TestCacheManagerFactory.createClusteredCacheManager(config);
registerCacheManager(cm1);
@@ -107,8 +108,8 @@ protected void createCacheManagers() throws Throwable {
tcpConnectionFactory = (TcpTransportFactory) TestingUtil.extractField(remoteCacheManager, "transportFactory");
}
- protected Configuration.CacheMode getCacheMode() {
- return Configuration.CacheMode.REPL_SYNC;
+ protected CacheMode getCacheMode() {
+ return CacheMode.REPL_SYNC;
}
@@ -33,8 +33,8 @@
import org.infinispan.client.hotrod.exceptions.HotRodClientException;
import org.infinispan.client.hotrod.impl.ConfigurationProperties;
import org.infinispan.commands.write.PutKeyValueCommand;
-import org.infinispan.config.Configuration;
import org.infinispan.config.CustomInterceptorConfig;
+import org.infinispan.configuration.cache.ConfigurationBuilder;
import org.infinispan.context.InvocationContext;
import org.infinispan.interceptors.EntryWrappingInterceptor;
import org.infinispan.interceptors.base.CommandInterceptor;
@@ -63,12 +63,12 @@
@Override
protected EmbeddedCacheManager createCacheManager() throws Exception {
- Configuration cfg = new Configuration();
+ ConfigurationBuilder builder = new ConfigurationBuilder();
CustomInterceptorConfig cic = new CustomInterceptorConfig(
new TimeoutInducingInterceptor(), false, false, -1,
EntryWrappingInterceptor.class.getName(), "");
- cfg.setCustomInterceptors(Collections.singletonList(cic));
- return TestCacheManagerFactory.createCacheManager(cfg);
+ builder.customInterceptors().addInterceptor().interceptor(cic.getInterceptor());
+ return TestCacheManagerFactory.createCacheManager(builder);
}
@Override
@@ -22,7 +22,6 @@
*/
package org.infinispan.client.hotrod;
-import org.infinispan.config.Configuration;
import org.infinispan.manager.EmbeddedCacheManager;
import org.infinispan.server.hotrod.HotRodServer;
import org.infinispan.server.hotrod.test.HotRodTestingUtil;
@@ -78,14 +77,4 @@ public static String getServersString(HotRodServer... servers) {
}
return builder.toString();
}
-
- public static Configuration getMultiNodeConfig() {
- Configuration result = new Configuration();
- result.setCacheMode(Configuration.CacheMode.DIST_SYNC);
- result.setSyncReplTimeout(10000);
-// result.setFetchInMemoryState(true);
- result.setSyncCommitPhase(true);
- result.setSyncRollbackPhase(true);
- return result;
- }
}
@@ -28,7 +28,7 @@
import org.infinispan.client.hotrod.impl.RemoteCacheImpl;
import org.infinispan.client.hotrod.impl.transport.tcp.RoundRobinBalancingStrategy;
import org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory;
-import org.infinispan.config.Configuration;
+import org.infinispan.configuration.cache.ConfigurationBuilder;
import org.infinispan.lifecycle.ComponentStatus;
import org.infinispan.manager.CacheContainer;
import org.infinispan.server.hotrod.HotRodServer;
@@ -51,7 +51,7 @@
RemoteCacheImpl remoteCache;
protected RemoteCacheManager remoteCacheManager;
protected TcpTransportFactory tcpConnectionFactory;
- protected Configuration config;
+ protected ConfigurationBuilder config;
protected RoundRobinBalancingStrategy strategy;
public AbstractRetryTest() {
@@ -126,5 +126,5 @@ protected void clearContent() throws Throwable {
}
}
- protected abstract Configuration getCacheConfig();
+ protected abstract ConfigurationBuilder getCacheConfig();
}
@@ -29,7 +29,8 @@
import org.infinispan.client.hotrod.VersionedValue;
import org.infinispan.client.hotrod.impl.transport.tcp.TcpTransport;
import org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory;
-import org.infinispan.config.Configuration;
+import org.infinispan.configuration.cache.CacheMode;
+import org.infinispan.configuration.cache.ConfigurationBuilder;
import org.infinispan.marshall.Marshaller;
import org.infinispan.marshall.jboss.JBossMarshaller;
import org.infinispan.remoting.transport.Address;
@@ -52,10 +53,10 @@
public class DistributionRetryTest extends AbstractRetryTest {
@Override
- protected Configuration getCacheConfig() {
- Configuration config = getDefaultClusteredConfig(Configuration.CacheMode.DIST_SYNC);
- config.setNumOwners(1);
- return config;
+ protected ConfigurationBuilder getCacheConfig() {
+ ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, false);
+ builder.clustering().hash().numOwners(1);
+ return builder;
}
public void testGet() throws Exception {
Oops, something went wrong.

0 comments on commit 08ac25a

Please sign in to comment.