You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by xe...@apache.org on 2012/02/07 21:56:12 UTC

[8/9] git commit: Fix unit tests (DefsTest, SSTableImportTest, CompositeTypeTest)

Fix unit tests (DefsTest, SSTableImportTest, CompositeTypeTest)

patch by slebresne; reviewed by jbellis for CASSANDRA-3864


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/58202a8e
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/58202a8e
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/58202a8e

Branch: refs/heads/trunk
Commit: 58202a8ef364c7e1b35eedd1270c5e72d305e23c
Parents: 651bf35
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Mon Feb 6 17:15:36 2012 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Tue Feb 7 17:06:08 2012 +0100

----------------------------------------------------------------------
 .../apache/cassandra/db/marshal/CompositeType.java |    5 +++++
 .../org/apache/cassandra/tools/SSTableImport.java  |    4 ++--
 test/unit/org/apache/cassandra/db/DefsTest.java    |    5 +++--
 3 files changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/58202a8e/src/java/org/apache/cassandra/db/marshal/CompositeType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/marshal/CompositeType.java b/src/java/org/apache/cassandra/db/marshal/CompositeType.java
index c9e866e..a3e9e98 100644
--- a/src/java/org/apache/cassandra/db/marshal/CompositeType.java
+++ b/src/java/org/apache/cassandra/db/marshal/CompositeType.java
@@ -57,6 +57,11 @@ public class CompositeType extends AbstractCompositeType
     // interning instances
     private static final Map<List<AbstractType<?>>, CompositeType> instances = new HashMap<List<AbstractType<?>>, CompositeType>();
 
+    public static CompositeType getInstance(TypeParser parser) throws ConfigurationException
+    {
+        return getInstance(parser.getTypeParameters());
+    }
+
     public static synchronized CompositeType getInstance(List<AbstractType<?>> types)
     {
         assert types != null && !types.isEmpty();

http://git-wip-us.apache.org/repos/asf/cassandra/blob/58202a8e/src/java/org/apache/cassandra/tools/SSTableImport.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/SSTableImport.java b/src/java/org/apache/cassandra/tools/SSTableImport.java
index cbe9dd6..2d97ae5 100644
--- a/src/java/org/apache/cassandra/tools/SSTableImport.java
+++ b/src/java/org/apache/cassandra/tools/SSTableImport.java
@@ -116,7 +116,7 @@ public class SSTableImport
                         {
                             kind = "e";
                             ttl = (Integer) fields.get(4);
-                            localExpirationTime = (int) (long) ((Long) fields.get(5));
+                            localExpirationTime = (Integer) fields.get(5);
                         }
                         else
                         {
@@ -129,7 +129,7 @@ public class SSTableImport
                         if (isExpiring())
                         {
                             ttl = (Integer) fields.get(4);
-                            localExpirationTime = (int) (long) ((Long) fields.get(5));
+                            localExpirationTime = (Integer) fields.get(5);
                         }
                         else if (isCounter())
                         {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/58202a8e/test/unit/org/apache/cassandra/db/DefsTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/DefsTest.java b/test/unit/org/apache/cassandra/db/DefsTest.java
index fbbf01b..01ab532 100644
--- a/test/unit/org/apache/cassandra/db/DefsTest.java
+++ b/test/unit/org/apache/cassandra/db/DefsTest.java
@@ -31,6 +31,7 @@ import org.apache.cassandra.db.filter.QueryFilter;
 import org.apache.cassandra.db.filter.QueryPath;
 import org.apache.cassandra.db.marshal.BytesType;
 import org.apache.cassandra.db.marshal.UTF8Type;
+import org.apache.cassandra.db.marshal.TimeUUIDType;
 import org.apache.cassandra.db.migration.AddColumnFamily;
 import org.apache.cassandra.db.migration.AddKeyspace;
 import org.apache.cassandra.db.migration.DropColumnFamily;
@@ -534,7 +535,7 @@ public class DefsTest extends CleanupHelper
         oldStr = cf_def.comparator_type;
         try 
         {
-            cf_def.comparator_type = BytesType.class.getSimpleName();
+            cf_def.comparator_type = TimeUUIDType.class.getSimpleName();
             cf.apply(cf_def);
             throw new AssertionError("Should have blown up when you used a different comparator.");
         }
@@ -605,4 +606,4 @@ public class DefsTest extends CleanupHelper
 
         return newCFMD;
     }
-}
\ No newline at end of file
+}