Parse() public method

public Parse ( byte partitionKey ) : void
partitionKey byte
return void
示例#1
0
        public void CompositeTokenValueFromClass()
        {
            /* 
             id1 | id2 | token_id1__id2
            -----+-----+----------------------
              10 |  20 | -9026262514124674157
             */

            var key = new PartitionKey();
            key.Set(new CompositeKeyType { Id1 = 10, Id2 = "20", Val="test"});

            var calculatedToken = new MurmurToken();
            calculatedToken.Parse(key.GetValue());

            var tokenFromCassandra = new MurmurToken();
            tokenFromCassandra.Parse("-9026262514124674157");

            Assert.AreEqual(tokenFromCassandra, calculatedToken);
        }
示例#2
0
        public void CompositeTokenValue2()
        {
            /* 
             id1 | id2 | token_id1__id2
            -----+-----+----------------------
               1 |   2 |  4093852821103061060
             */

            var key = new PartitionKey();
            key.Set(new[] { CqlType.Int, CqlType.Text }, new object[] { 1, "2" });

            var calculatedToken = new MurmurToken();
            calculatedToken.Parse(key.GetValue());

            var tokenFromCassandra = new MurmurToken();
            tokenFromCassandra.Parse("4093852821103061060");

            Assert.AreEqual(tokenFromCassandra, calculatedToken);
        }
示例#3
0
        public void CompositeTokenValue1()
        {
            /* 
             id1 | id2 | token_id1__id2
            -----+-----+----------------------
              10 |  20 | -9026262514124674157
             */

            var key = new PartitionKey();
            key.Set(new[] {CqlType.Int, CqlType.Text}, new object[] {10, "20"});

            var calculatedToken = new MurmurToken();
            calculatedToken.Parse(key.GetValue());

            var tokenFromCassandra = new MurmurToken();
            tokenFromCassandra.Parse("-9026262514124674157");

            Assert.AreEqual(tokenFromCassandra, calculatedToken);
        }
示例#4
0
        public void SingleTokenValueFromArray()
        {
            /* 
             id1 | token_id1
            -----+----------------------
               1 | -4069959284402364209
             */

            var key = new PartitionKey();
            key.Set(new[] { CqlType.Int }, new object[] { 1 });

            var calculatedToken = new MurmurToken();
            calculatedToken.Parse(key.GetValue());

            var tokenFromCassandra = new MurmurToken();
            tokenFromCassandra.Parse("-4069959284402364209");

            Assert.AreEqual(tokenFromCassandra, calculatedToken);
        }