Author: jbellis
Date: Sat Sep 25 23:56:55 2010
New Revision: 1001332

URL: http://svn.apache.org/viewvc?rev=1001332&view=rev
Log:
add describe_snitch to Thrift api.
patch by jhermes; reviewed by jbellis for CASSANDRA-1490

Modified:
    cassandra/trunk/CHANGES.txt
    cassandra/trunk/interface/cassandra.thrift
    
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
    
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Constants.java
    cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraServer.java
    cassandra/trunk/test/system/test_thrift_server.py

Modified: cassandra/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/cassandra/trunk/CHANGES.txt?rev=1001332&r1=1001331&r2=1001332&view=diff
==============================================================================
--- cassandra/trunk/CHANGES.txt (original)
+++ cassandra/trunk/CHANGES.txt Sat Sep 25 23:56:55 2010
@@ -89,6 +89,7 @@
  * weighted request scheduler (CASSANDRA-1485)
  * treat expired columns as deleted (CASSANDRA-1539)
  * make IndexInterval configurable (CASSANDRA-1488)
+ * add describe_snitch to Thrift API (CASSANDRA-1490)
 
 
 0.7-beta1

Modified: cassandra/trunk/interface/cassandra.thrift
URL: 
http://svn.apache.org/viewvc/cassandra/trunk/interface/cassandra.thrift?rev=1001332&r1=1001331&r2=1001332&view=diff
==============================================================================
--- cassandra/trunk/interface/cassandra.thrift (original)
+++ cassandra/trunk/interface/cassandra.thrift Sat Sep 25 23:56:55 2010
@@ -46,7 +46,7 @@ namespace rb CassandraThrift
 #           for every edit that doesn't result in a change to major/minor.
 #
 # See the Semantic Versioning Specification (SemVer) http://semver.org.
-const string VERSION = "17.0.0"
+const string VERSION = "17.1.0"
 
 
 #
@@ -504,6 +504,9 @@ service Cassandra {
   /** returns the partitioner used by this cluster */
   string describe_partitioner(),
 
+  /** returns the snitch used by this cluster */
+  string describe_snitch(),
+
   /** describe specified keyspace */
   KsDef describe_keyspace(1:required string keyspace)
         throws (1:NotFoundException nfe),

Modified: 
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
URL: 
http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java?rev=1001332&r1=1001331&r2=1001332&view=diff
==============================================================================
--- 
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
 (original)
+++ 
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
 Sat Sep 25 23:56:55 2010
@@ -214,6 +214,11 @@ public class Cassandra {
     public String describe_partitioner() throws TException;
 
     /**
+     * returns the snitch used by this cluster
+     */
+    public String describe_snitch() throws TException;
+
+    /**
      * describe specified keyspace
      * 
      * @param keyspace
@@ -334,6 +339,8 @@ public class Cassandra {
 
     public void 
describe_partitioner(AsyncMethodCallback<AsyncClient.describe_partitioner_call> 
resultHandler) throws TException;
 
+    public void 
describe_snitch(AsyncMethodCallback<AsyncClient.describe_snitch_call> 
resultHandler) throws TException;
+
     public void describe_keyspace(String keyspace, 
AsyncMethodCallback<AsyncClient.describe_keyspace_call> resultHandler) throws 
TException;
 
     public void describe_splits(String cfName, String start_token, String 
end_token, int keys_per_split, 
AsyncMethodCallback<AsyncClient.describe_splits_call> resultHandler) throws 
TException;
@@ -1195,6 +1202,41 @@ public class Cassandra {
       throw new TApplicationException(TApplicationException.MISSING_RESULT, 
"describe_partitioner failed: unknown result");
     }
 
+    public String describe_snitch() throws TException
+    {
+      send_describe_snitch();
+      return recv_describe_snitch();
+    }
+
+    public void send_describe_snitch() throws TException
+    {
+      oprot_.writeMessageBegin(new TMessage("describe_snitch", 
TMessageType.CALL, ++seqid_));
+      describe_snitch_args args = new describe_snitch_args();
+      args.write(oprot_);
+      oprot_.writeMessageEnd();
+      oprot_.getTransport().flush();
+    }
+
+    public String recv_describe_snitch() throws TException
+    {
+      TMessage msg = iprot_.readMessageBegin();
+      if (msg.type == TMessageType.EXCEPTION) {
+        TApplicationException x = TApplicationException.read(iprot_);
+        iprot_.readMessageEnd();
+        throw x;
+      }
+      if (msg.seqid != seqid_) {
+        throw new TApplicationException(TApplicationException.BAD_SEQUENCE_ID, 
"describe_snitch failed: out of sequence response");
+      }
+      describe_snitch_result result = new describe_snitch_result();
+      result.read(iprot_);
+      iprot_.readMessageEnd();
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      throw new TApplicationException(TApplicationException.MISSING_RESULT, 
"describe_snitch failed: unknown result");
+    }
+
     public KsDef describe_keyspace(String keyspace) throws NotFoundException, 
TException
     {
       send_describe_keyspace(keyspace);
@@ -2260,6 +2302,34 @@ public class Cassandra {
       }
     }
 
+    public void describe_snitch(AsyncMethodCallback<describe_snitch_call> 
resultHandler) throws TException {
+      checkReady();
+      describe_snitch_call method_call = new 
describe_snitch_call(resultHandler, this, protocolFactory, transport);
+      manager.call(method_call);
+    }
+
+    public static class describe_snitch_call extends TAsyncMethodCall {
+      public describe_snitch_call(AsyncMethodCallback<describe_snitch_call> 
resultHandler, TAsyncClient client, TProtocolFactory protocolFactory, 
TNonblockingTransport transport) throws TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+      }
+
+      public void write_args(TProtocol prot) throws TException {
+        prot.writeMessageBegin(new TMessage("describe_snitch", 
TMessageType.CALL, 0));
+        describe_snitch_args args = new describe_snitch_args();
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public String getResult() throws TException {
+        if (getState() != State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        TMemoryInputTransport memoryTransport = new 
TMemoryInputTransport(getFrameBuffer().array());
+        TProtocol prot = 
client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_describe_snitch();
+      }
+    }
+
     public void describe_keyspace(String keyspace, 
AsyncMethodCallback<describe_keyspace_call> resultHandler) throws TException {
       checkReady();
       describe_keyspace_call method_call = new 
describe_keyspace_call(keyspace, resultHandler, this, protocolFactory, 
transport);
@@ -2611,6 +2681,7 @@ public class Cassandra {
       processMap_.put("describe_version", new describe_version());
       processMap_.put("describe_ring", new describe_ring());
       processMap_.put("describe_partitioner", new describe_partitioner());
+      processMap_.put("describe_snitch", new describe_snitch());
       processMap_.put("describe_keyspace", new describe_keyspace());
       processMap_.put("describe_splits", new describe_splits());
       processMap_.put("system_add_column_family", new 
system_add_column_family());
@@ -3369,6 +3440,32 @@ public class Cassandra {
 
     }
 
+    private class describe_snitch implements ProcessFunction {
+      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws 
TException
+      {
+        describe_snitch_args args = new describe_snitch_args();
+        try {
+          args.read(iprot);
+        } catch (TProtocolException e) {
+          iprot.readMessageEnd();
+          TApplicationException x = new 
TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage());
+          oprot.writeMessageBegin(new TMessage("describe_snitch", 
TMessageType.EXCEPTION, seqid));
+          x.write(oprot);
+          oprot.writeMessageEnd();
+          oprot.getTransport().flush();
+          return;
+        }
+        iprot.readMessageEnd();
+        describe_snitch_result result = new describe_snitch_result();
+        result.success = iface_.describe_snitch();
+        oprot.writeMessageBegin(new TMessage("describe_snitch", 
TMessageType.REPLY, seqid));
+        result.write(oprot);
+        oprot.writeMessageEnd();
+        oprot.getTransport().flush();
+      }
+
+    }
+
     private class describe_keyspace implements ProcessFunction {
       public void process(int seqid, TProtocol iprot, TProtocol oprot) throws 
TException
       {
@@ -20618,6 +20715,489 @@ public class Cassandra {
 
   }
 
+  public static class describe_snitch_args implements 
TBase<describe_snitch_args, describe_snitch_args._Fields>, 
java.io.Serializable, Cloneable   {
+    private static final TStruct STRUCT_DESC = new 
TStruct("describe_snitch_args");
+
+
+
+    /** The set of fields this struct contains, along with convenience methods 
for finding and manipulating them. */
+    public enum _Fields implements TFieldIdEnum {
+;
+
+      private static final Map<String, _Fields> byName = new HashMap<String, 
_Fields>();
+
+      static {
+        for (_Fields field : EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not 
found.
+       */
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + 
fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+    public static final Map<_Fields, FieldMetaData> metaDataMap;
+    static {
+      Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, 
FieldMetaData>(_Fields.class);
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      FieldMetaData.addStructMetaDataMap(describe_snitch_args.class, 
metaDataMap);
+    }
+
+    public describe_snitch_args() {
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public describe_snitch_args(describe_snitch_args other) {
+    }
+
+    public describe_snitch_args deepCopy() {
+      return new describe_snitch_args(this);
+    }
+
+    @Deprecated
+    public describe_snitch_args clone() {
+      return new describe_snitch_args(this);
+    }
+
+    public void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      }
+    }
+
+    public void setFieldValue(int fieldID, Object value) {
+      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
+    }
+
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      }
+      throw new IllegalStateException();
+    }
+
+    public Object getFieldValue(int fieldId) {
+      return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been 
asigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      switch (field) {
+      }
+      throw new IllegalStateException();
+    }
+
+    public boolean isSet(int fieldID) {
+      return isSet(_Fields.findByThriftIdOrThrow(fieldID));
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof describe_snitch_args)
+        return this.equals((describe_snitch_args)that);
+      return false;
+    }
+
+    public boolean equals(describe_snitch_args that) {
+      if (that == null)
+        return false;
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      HashCodeBuilder builder = new HashCodeBuilder();
+
+      return builder.toHashCode();
+    }
+
+    public int compareTo(describe_snitch_args other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+      describe_snitch_args typedOther = (describe_snitch_args)other;
+
+      return 0;
+    }
+
+    public void read(TProtocol iprot) throws TException {
+      TField field;
+      iprot.readStructBegin();
+      while (true)
+      {
+        field = iprot.readFieldBegin();
+        if (field.type == TType.STOP) { 
+          break;
+        }
+        switch (field.id) {
+          default:
+            TProtocolUtil.skip(iprot, field.type);
+        }
+        iprot.readFieldEnd();
+      }
+      iprot.readStructEnd();
+
+      // check for required fields of primitive type, which can't be checked 
in the validate method
+      validate();
+    }
+
+    public void write(TProtocol oprot) throws TException {
+      validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("describe_snitch_args(");
+      boolean first = true;
+
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws TException {
+      // check for required fields
+    }
+
+  }
+
+  public static class describe_snitch_result implements 
TBase<describe_snitch_result, describe_snitch_result._Fields>, 
java.io.Serializable, Cloneable   {
+    private static final TStruct STRUCT_DESC = new 
TStruct("describe_snitch_result");
+
+    private static final TField SUCCESS_FIELD_DESC = new TField("success", 
TType.STRING, (short)0);
+
+    public String success;
+
+    /** The set of fields this struct contains, along with convenience methods 
for finding and manipulating them. */
+    public enum _Fields implements TFieldIdEnum {
+      SUCCESS((short)0, "success");
+
+      private static final Map<String, _Fields> byName = new HashMap<String, 
_Fields>();
+
+      static {
+        for (_Fields field : EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not 
found.
+       */
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 0: // SUCCESS
+            return SUCCESS;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + 
fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+
+    public static final Map<_Fields, FieldMetaData> metaDataMap;
+    static {
+      Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, 
FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.SUCCESS, new FieldMetaData("success", 
TFieldRequirementType.DEFAULT, 
+          new FieldValueMetaData(TType.STRING)));
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      FieldMetaData.addStructMetaDataMap(describe_snitch_result.class, 
metaDataMap);
+    }
+
+    public describe_snitch_result() {
+    }
+
+    public describe_snitch_result(
+      String success)
+    {
+      this();
+      this.success = success;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public describe_snitch_result(describe_snitch_result other) {
+      if (other.isSetSuccess()) {
+        this.success = other.success;
+      }
+    }
+
+    public describe_snitch_result deepCopy() {
+      return new describe_snitch_result(this);
+    }
+
+    @Deprecated
+    public describe_snitch_result clone() {
+      return new describe_snitch_result(this);
+    }
+
+    public String getSuccess() {
+      return this.success;
+    }
+
+    public describe_snitch_result setSuccess(String success) {
+      this.success = success;
+      return this;
+    }
+
+    public void unsetSuccess() {
+      this.success = null;
+    }
+
+    /** Returns true if field success is set (has been asigned a value) and 
false otherwise */
+    public boolean isSetSuccess() {
+      return this.success != null;
+    }
+
+    public void setSuccessIsSet(boolean value) {
+      if (!value) {
+        this.success = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      case SUCCESS:
+        if (value == null) {
+          unsetSuccess();
+        } else {
+          setSuccess((String)value);
+        }
+        break;
+
+      }
+    }
+
+    public void setFieldValue(int fieldID, Object value) {
+      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
+    }
+
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case SUCCESS:
+        return getSuccess();
+
+      }
+      throw new IllegalStateException();
+    }
+
+    public Object getFieldValue(int fieldId) {
+      return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been 
asigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      switch (field) {
+      case SUCCESS:
+        return isSetSuccess();
+      }
+      throw new IllegalStateException();
+    }
+
+    public boolean isSet(int fieldID) {
+      return isSet(_Fields.findByThriftIdOrThrow(fieldID));
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof describe_snitch_result)
+        return this.equals((describe_snitch_result)that);
+      return false;
+    }
+
+    public boolean equals(describe_snitch_result that) {
+      if (that == null)
+        return false;
+
+      boolean this_present_success = true && this.isSetSuccess();
+      boolean that_present_success = true && that.isSetSuccess();
+      if (this_present_success || that_present_success) {
+        if (!(this_present_success && that_present_success))
+          return false;
+        if (!this.success.equals(that.success))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      HashCodeBuilder builder = new HashCodeBuilder();
+
+      boolean present_success = true && (isSetSuccess());
+      builder.append(present_success);
+      if (present_success)
+        builder.append(success);
+
+      return builder.toHashCode();
+    }
+
+    public int compareTo(describe_snitch_result other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+      describe_snitch_result typedOther = (describe_snitch_result)other;
+
+      lastComparison = 
Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetSuccess()) {        lastComparison = 
TBaseHelper.compareTo(this.success, typedOther.success);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    public void read(TProtocol iprot) throws TException {
+      TField field;
+      iprot.readStructBegin();
+      while (true)
+      {
+        field = iprot.readFieldBegin();
+        if (field.type == TType.STOP) { 
+          break;
+        }
+        switch (field.id) {
+          case 0: // SUCCESS
+            if (field.type == TType.STRING) {
+              this.success = iprot.readString();
+            } else { 
+              TProtocolUtil.skip(iprot, field.type);
+            }
+            break;
+          default:
+            TProtocolUtil.skip(iprot, field.type);
+        }
+        iprot.readFieldEnd();
+      }
+      iprot.readStructEnd();
+
+      // check for required fields of primitive type, which can't be checked 
in the validate method
+      validate();
+    }
+
+    public void write(TProtocol oprot) throws TException {
+      oprot.writeStructBegin(STRUCT_DESC);
+
+      if (this.isSetSuccess()) {
+        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+        oprot.writeString(this.success);
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("describe_snitch_result(");
+      boolean first = true;
+
+      sb.append("success:");
+      if (this.success == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.success);
+      }
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws TException {
+      // check for required fields
+    }
+
+  }
+
   public static class describe_keyspace_args implements 
TBase<describe_keyspace_args, describe_keyspace_args._Fields>, 
java.io.Serializable, Cloneable   {
     private static final TStruct STRUCT_DESC = new 
TStruct("describe_keyspace_args");
 

Modified: 
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Constants.java
URL: 
http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Constants.java?rev=1001332&r1=1001331&r2=1001332&view=diff
==============================================================================
--- 
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Constants.java
 (original)
+++ 
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Constants.java
 Sat Sep 25 23:56:55 2010
@@ -43,6 +43,6 @@ import org.slf4j.LoggerFactory;
 
 public class Constants {
 
-  public static final String VERSION = "17.0.0";
+  public static final String VERSION = "17.1.0";
 
 }

Modified: 
cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraServer.java
URL: 
http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraServer.java?rev=1001332&r1=1001331&r2=1001332&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraServer.java 
(original)
+++ cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraServer.java 
Sat Sep 25 23:56:55 2010
@@ -30,6 +30,7 @@ import org.apache.cassandra.db.migration
 import org.apache.cassandra.db.migration.UpdateColumnFamily;
 import org.apache.cassandra.db.migration.UpdateKeyspace;
 import org.apache.cassandra.gms.Gossiper;
+import org.apache.cassandra.locator.DynamicEndpointSnitch;
 import org.apache.cassandra.utils.FBUtilities;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -593,6 +594,13 @@ public class CassandraServer implements 
         return StorageService.getPartitioner().getClass().getName();
     }
 
+    public String describe_snitch() throws TException
+    {
+        if (DatabaseDescriptor.getEndpointSnitch() instanceof 
DynamicEndpointSnitch)
+            return 
((DynamicEndpointSnitch)DatabaseDescriptor.getEndpointSnitch()).subsnitch.getClass().getName();
+        return DatabaseDescriptor.getEndpointSnitch().getClass().getName();
+    }
+
     public List<String> describe_splits(String cfName, String start_token, 
String end_token, int keys_per_split) throws TException
     {
         Token.TokenFactory tf = 
StorageService.getPartitioner().getTokenFactory();

Modified: cassandra/trunk/test/system/test_thrift_server.py
URL: 
http://svn.apache.org/viewvc/cassandra/trunk/test/system/test_thrift_server.py?rev=1001332&r1=1001331&r2=1001332&view=diff
==============================================================================
--- cassandra/trunk/test/system/test_thrift_server.py (original)
+++ cassandra/trunk/test/system/test_thrift_server.py Sat Sep 25 23:56:55 2010
@@ -1124,7 +1124,14 @@ class TestMutations(ThriftTester):
 
     def test_describe_ring(self):
         assert list(client.describe_ring('Keyspace1'))[0].endpoints == 
['127.0.0.1']
-        
+
+    def test_describe_partitioner(self):
+        # Make sure this just reads back the values from the config.
+        assert client.describe_partitioner() == 
"org.apache.cassandra.dht.CollatingOrderPreservingPartitioner"
+
+    def test_describe_snitch(self):
+        assert client.describe_snitch() == 
"org.apache.cassandra.locator.SimpleSnitch"
+
     def test_invalid_ks_names(self):
         def invalid_keyspace():
             client.system_add_keyspace(KsDef('in-valid', 
'org.apache.cassandra.locator.SimpleStrategy', {}, 1, []))


Reply via email to