cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1090905 [3/3] - in /cassandra/trunk: ./ conf/ drivers/py/cql/cassandra/ interface/ interface/thrift/gen-java/org/apache/cassandra/thrift/ src/avro/ src/java/org/apache/cassandra/cli/ src/java/org/apache/cassandra/config/ src/java/org/apach...
Date Sun, 10 Apr 2011 22:59:59 GMT
Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java?rev=1090905&r1=1090904&r2=1090905&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java Sun Apr 10 22:59:57 2011
@@ -400,7 +400,7 @@ public class DefsTest extends CleanupHel
         DecoratedKey dk = Util.dk("key0");
         CFMetaData newCf = addTestCF("NewKeyspace1", "AddedStandard1", "A new cf for a new
ks");
 
-        KSMetaData newKs = new KSMetaData(newCf.ksName, SimpleStrategy.class, null, 5, newCf);
+        KSMetaData newKs = new KSMetaData(newCf.ksName, SimpleStrategy.class, KSMetaData.optsWithRF(5),
newCf);
         
         new AddKeyspace(newKs).apply();
         
@@ -579,7 +579,7 @@ public class DefsTest extends CleanupHel
     {
         assert DatabaseDescriptor.getTableDefinition("EmptyKeyspace") == null;
         
-        KSMetaData newKs = new KSMetaData("EmptyKeyspace", SimpleStrategy.class, null, 5);
+        KSMetaData newKs = new KSMetaData("EmptyKeyspace", SimpleStrategy.class, KSMetaData.optsWithRF(5));
 
         new AddKeyspace(newKs).apply();
         assert DatabaseDescriptor.getTableDefinition("EmptyKeyspace") != null;
@@ -615,7 +615,7 @@ public class DefsTest extends CleanupHel
     {
         // create a keyspace to serve as existing.
         CFMetaData cf = addTestCF("UpdatedKeyspace", "AddedStandard1", "A new cf for a new
ks");
-        KSMetaData oldKs = new KSMetaData(cf.ksName, SimpleStrategy.class, null, 5, cf);
+        KSMetaData oldKs = new KSMetaData(cf.ksName, SimpleStrategy.class, KSMetaData.optsWithRF(5),
cf);
         
         new AddKeyspace(oldKs).apply();
         
@@ -624,7 +624,7 @@ public class DefsTest extends CleanupHel
         
         // anything with cf defs should fail.
         CFMetaData cf2 = addTestCF(cf.ksName, "AddedStandard2", "A new cf for a new ks");
-        KSMetaData newBadKs = new KSMetaData(cf.ksName, SimpleStrategy.class, null, 4, cf2);
+        KSMetaData newBadKs = new KSMetaData(cf.ksName, SimpleStrategy.class, KSMetaData.optsWithRF(4),
cf2);
         try
         {
             new UpdateKeyspace(newBadKs).apply();
@@ -636,7 +636,7 @@ public class DefsTest extends CleanupHel
         }
         
         // names should match.
-        KSMetaData newBadKs2 = new KSMetaData(cf.ksName + "trash", SimpleStrategy.class,
null, 4);
+        KSMetaData newBadKs2 = new KSMetaData(cf.ksName + "trash", SimpleStrategy.class,
KSMetaData.optsWithRF(4));
         try
         {
             new UpdateKeyspace(newBadKs2).apply();
@@ -647,12 +647,10 @@ public class DefsTest extends CleanupHel
             // expected.
         }
         
-        KSMetaData newKs = new KSMetaData(cf.ksName, OldNetworkTopologyStrategy.class, null,
1);
+        KSMetaData newKs = new KSMetaData(cf.ksName, OldNetworkTopologyStrategy.class, KSMetaData.optsWithRF(1));
         new UpdateKeyspace(newKs).apply();
         
         KSMetaData newFetchedKs = DatabaseDescriptor.getKSMetaData(newKs.name);
-        assert newFetchedKs.replicationFactor == newKs.replicationFactor;
-        assert newFetchedKs.replicationFactor != oldKs.replicationFactor;
         assert newFetchedKs.strategyClass.equals(newKs.strategyClass);
         assert !newFetchedKs.strategyClass.equals(oldKs.strategyClass);
     }
@@ -662,7 +660,7 @@ public class DefsTest extends CleanupHel
     {
         // create a keyspace with a cf to update.
         CFMetaData cf = addTestCF("UpdatedCfKs", "Standard1added", "A new cf that will be
updated");
-        KSMetaData ksm = new KSMetaData(cf.ksName, SimpleStrategy.class, null, 1, cf);
+        KSMetaData ksm = new KSMetaData(cf.ksName, SimpleStrategy.class, KSMetaData.optsWithRF(1),
cf);
         new AddKeyspace(ksm).apply();
         
         assert DatabaseDescriptor.getTableDefinition(cf.ksName) != null;

Modified: cassandra/trunk/test/unit/org/apache/cassandra/locator/OldNetworkTopologyStrategyTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/locator/OldNetworkTopologyStrategyTest.java?rev=1090905&r1=1090904&r2=1090905&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/locator/OldNetworkTopologyStrategyTest.java
(original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/locator/OldNetworkTopologyStrategyTest.java
Sun Apr 10 22:59:57 2011
@@ -32,6 +32,7 @@ import org.junit.Test;
 import static org.junit.Assert.assertEquals;
 
 import org.apache.cassandra.SchemaLoader;
+import org.apache.cassandra.config.KSMetaData;
 import org.apache.cassandra.dht.BigIntegerToken;
 import org.apache.cassandra.dht.Token;
 
@@ -61,7 +62,7 @@ public class OldNetworkTopologyStrategyT
     {
         RackInferringSnitch endpointSnitch = new RackInferringSnitch();
 
-        AbstractReplicationStrategy strategy = new OldNetworkTopologyStrategy("Keyspace1",
tmd, endpointSnitch, null);
+        AbstractReplicationStrategy strategy = new OldNetworkTopologyStrategy("Keyspace1",
tmd, endpointSnitch, KSMetaData.optsWithRF(1));
         addEndpoint("0", "5", "254.0.0.1");
         addEndpoint("10", "15", "254.0.0.2");
         addEndpoint("20", "25", "254.0.0.3");
@@ -86,7 +87,7 @@ public class OldNetworkTopologyStrategyT
     {
         RackInferringSnitch endpointSnitch = new RackInferringSnitch();
 
-        AbstractReplicationStrategy strategy = new OldNetworkTopologyStrategy("Keyspace1",
tmd, endpointSnitch, null);
+        AbstractReplicationStrategy strategy = new OldNetworkTopologyStrategy("Keyspace1",
tmd, endpointSnitch, KSMetaData.optsWithRF(1));
         addEndpoint("0", "5", "254.0.0.1");
         addEndpoint("10", "15", "254.0.0.2");
         addEndpoint("20", "25", "254.1.0.3");
@@ -112,7 +113,7 @@ public class OldNetworkTopologyStrategyT
     {
         RackInferringSnitch endpointSnitch = new RackInferringSnitch();
 
-        AbstractReplicationStrategy strategy = new OldNetworkTopologyStrategy("Keyspace1",
tmd, endpointSnitch, null);
+        AbstractReplicationStrategy strategy = new OldNetworkTopologyStrategy("Keyspace1",
tmd, endpointSnitch, KSMetaData.optsWithRF(1));
         addEndpoint("0", "5", "254.0.0.1");
         addEndpoint("10", "15", "254.0.0.2");
         addEndpoint("20", "25", "254.0.1.3");

Modified: cassandra/trunk/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java?rev=1090905&r1=1090904&r2=1090905&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java Sun Apr
10 22:59:57 2011
@@ -32,6 +32,7 @@ import org.junit.Test;
 import org.apache.cassandra.CleanupHelper;
 import org.apache.cassandra.config.ConfigurationException;
 import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.config.KSMetaData;
 import org.apache.cassandra.db.Table;
 import org.apache.cassandra.dht.*;
 import org.apache.cassandra.service.StorageService;
@@ -177,11 +178,12 @@ public class SimpleStrategyTest extends 
 
     private AbstractReplicationStrategy getStrategy(String table, TokenMetadata tmd) throws
ConfigurationException
     {
+        KSMetaData ksmd =  DatabaseDescriptor.getKSMetaData(table);
         return AbstractReplicationStrategy.createReplicationStrategy(
                 table,
-                "org.apache.cassandra.locator.SimpleStrategy",
+                ksmd.strategyClass,
                 tmd,
                 new SimpleSnitch(),
-                null);
+                ksmd.strategyOptions);
     }
 }

Modified: cassandra/trunk/test/unit/org/apache/cassandra/service/ConsistencyLevelTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/service/ConsistencyLevelTest.java?rev=1090905&r1=1090904&r2=1090905&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/service/ConsistencyLevelTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/service/ConsistencyLevelTest.java Sun Apr
10 22:59:57 2011
@@ -32,6 +32,7 @@ import org.apache.cassandra.CleanupHelpe
 import org.apache.cassandra.Util;
 import org.apache.cassandra.config.ConfigurationException;
 import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.config.KSMetaData;
 import org.apache.cassandra.db.Row;
 import org.apache.cassandra.dht.IPartitioner;
 import org.apache.cassandra.dht.RandomPartitioner;
@@ -177,11 +178,13 @@ public class ConsistencyLevelTest extend
 
     private AbstractReplicationStrategy getStrategy(String table, TokenMetadata tmd) throws
ConfigurationException
     {
-        return AbstractReplicationStrategy.createReplicationStrategy(table,
-                                                                     "org.apache.cassandra.locator.SimpleStrategy",
-                                                                     tmd,
-                                                                     new SimpleSnitch(),
-                                                                     null);
+        KSMetaData ksmd =  DatabaseDescriptor.getKSMetaData(table);
+        return AbstractReplicationStrategy.createReplicationStrategy(
+                table,
+                ksmd.strategyClass,
+                tmd,
+                new SimpleSnitch(),
+                ksmd.strategyOptions);
     }
 
 }

Modified: cassandra/trunk/test/unit/org/apache/cassandra/service/LeaveAndBootstrapTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/service/LeaveAndBootstrapTest.java?rev=1090905&r1=1090904&r2=1090905&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/service/LeaveAndBootstrapTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/service/LeaveAndBootstrapTest.java Sun
Apr 10 22:59:57 2011
@@ -32,6 +32,7 @@ import com.google.common.collect.Multima
 import org.apache.cassandra.CleanupHelper;
 import org.apache.cassandra.Util;
 import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.config.KSMetaData;
 import org.apache.cassandra.dht.*;
 import org.apache.cassandra.gms.ApplicationState;
 import org.apache.cassandra.gms.VersionedValue;
@@ -613,12 +614,13 @@ public class LeaveAndBootstrapTest exten
 
     private AbstractReplicationStrategy getStrategy(String table, TokenMetadata tmd) throws
ConfigurationException
     {
+        KSMetaData ksmd =  DatabaseDescriptor.getKSMetaData(table);
         return AbstractReplicationStrategy.createReplicationStrategy(
                 table,
-                "org.apache.cassandra.locator.SimpleStrategy",
+                ksmd.strategyClass,
                 tmd,
                 new SimpleSnitch(),
-                null);
+                ksmd.strategyOptions);
     }
 
 }

Modified: cassandra/trunk/test/unit/org/apache/cassandra/service/MoveTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/service/MoveTest.java?rev=1090905&r1=1090904&r2=1090905&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/service/MoveTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/service/MoveTest.java Sun Apr 10 22:59:57
2011
@@ -33,6 +33,7 @@ import com.google.common.collect.Multima
 import org.apache.cassandra.CleanupHelper;
 import org.apache.cassandra.Util;
 import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.config.KSMetaData;
 import org.apache.cassandra.dht.*;
 import org.apache.cassandra.gms.ApplicationState;
 import org.apache.cassandra.gms.VersionedValue;
@@ -504,12 +505,13 @@ public class MoveTest extends CleanupHel
 
     private AbstractReplicationStrategy getStrategy(String table, TokenMetadata tmd) throws
ConfigurationException
     {
+        KSMetaData ksmd =  DatabaseDescriptor.getKSMetaData(table);
         return AbstractReplicationStrategy.createReplicationStrategy(
                 table,
-                "org.apache.cassandra.locator.SimpleStrategy",
+                ksmd.strategyClass,
                 tmd,
                 new SimpleSnitch(),
-                null);
+                ksmd.strategyOptions);
     }
 
     private Token positionToken(int position)



Mime
View raw message