Skip to content
This repository has been archived by the owner on May 25, 2021. It is now read-only.

Commit

Permalink
added thrift from latest build
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Berardi committed Sep 5, 2010
1 parent 9e8c988 commit 50d830b
Show file tree
Hide file tree
Showing 23 changed files with 263 additions and 143 deletions.
3 changes: 2 additions & 1 deletion FluentCassandra.Test/FluentCassandra.Test.csproj
Expand Up @@ -53,6 +53,7 @@
<Compile Include="CassandraQueryTest.cs" /> <Compile Include="CassandraQueryTest.cs" />
<Compile Include="Connection\ConnectionProviderTest.cs" /> <Compile Include="Connection\ConnectionProviderTest.cs" />
<Compile Include="Connection\NormalConnectionProviderTest.cs" /> <Compile Include="Connection\NormalConnectionProviderTest.cs" />
<Compile Include="_CassandraSetup.cs" />
<Compile Include="FluentSuperColumnFamilyTest.cs" /> <Compile Include="FluentSuperColumnFamilyTest.cs" />
<Compile Include="FluentColumnFamilyTest.cs" /> <Compile Include="FluentColumnFamilyTest.cs" />
<Compile Include="FluentColumnTest.cs" /> <Compile Include="FluentColumnTest.cs" />
Expand Down Expand Up @@ -81,7 +82,7 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="Test.Keyspace.xml" /> <None Include="Test.Keyspace.yaml" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
6 changes: 3 additions & 3 deletions FluentCassandra.Test/Operations/ColumnCountTest.cs
Expand Up @@ -41,7 +41,7 @@ public void ColumnFamily_Key()
_family.InsertColumn(_testKey, "Test3", Math.PI); _family.InsertColumn(_testKey, "Test3", Math.PI);


// act // act
int actual = _family.ColumnCount(_testKey); int actual = _family.ColumnCount(_testKey, null, null);


// assert // assert
Assert.AreEqual(expected, actual); Assert.AreEqual(expected, actual);
Expand All @@ -57,7 +57,7 @@ public void SuperColumnFamily_Key()
_superFamily.InsertColumn(_testKey, _testSuperName, "Test3", Math.PI); _superFamily.InsertColumn(_testKey, _testSuperName, "Test3", Math.PI);


// act // act
int actual = _superFamily.ColumnCount(_testKey); int actual = _superFamily.ColumnCount(_testKey, null, null);


// assert // assert
Assert.AreEqual(expected, actual); Assert.AreEqual(expected, actual);
Expand All @@ -73,7 +73,7 @@ public void SuperColumnFamily_Key_And_SuperColumnName()
_superFamily.InsertColumn(_testKey, _testSuperName, "Test3", Math.PI); _superFamily.InsertColumn(_testKey, _testSuperName, "Test3", Math.PI);


// act // act
int actual = _superFamily.ColumnCount(_testKey, _testSuperName); int actual = _superFamily.ColumnCount(_testKey, _testSuperName, null, null);


// assert // assert
Assert.AreEqual(expected, actual); Assert.AreEqual(expected, actual);
Expand Down
12 changes: 6 additions & 6 deletions FluentCassandra.Test/Operations/MultiGetSliceTest.cs
Expand Up @@ -55,7 +55,7 @@ public void Standard_GetSlice_Columns()
int expectedCount = 2; int expectedCount = 2;


// act // act
var columns = _family.Get(new[] { _testKey, _testKey2 }, new AsciiType[] { "Test1", "Test2" }); var columns = _family.Get(new BytesType[] { _testKey, _testKey2 }, new AsciiType[] { "Test1", "Test2" });


// assert // assert
Assert.AreEqual(expectedCount, columns.Count()); Assert.AreEqual(expectedCount, columns.Count());
Expand All @@ -68,7 +68,7 @@ public void Super_GetSlice_Columns()
int expectedCount = 2; int expectedCount = 2;


// act // act
var columns = _superFamily.GetSuperColumns(new[] { _testKey, _testKey2 }, _testSuperName, new AsciiType[] { "Test1", "Test2" }); var columns = _superFamily.GetSuperColumns(new BytesType[] { _testKey, _testKey2 }, _testSuperName, new AsciiType[] { "Test1", "Test2" });


// assert // assert
Assert.AreEqual(expectedCount, columns.Count()); Assert.AreEqual(expectedCount, columns.Count());
Expand All @@ -81,7 +81,7 @@ public void Super_GetSuperSlice_Columns()
int expectedCount = 2; int expectedCount = 2;


// act // act
var columns = _superFamily.Get(new[] { _testKey, _testKey2 }, new AsciiType[] { _testSuperName }); var columns = _superFamily.Get(new BytesType[] { _testKey, _testKey2 }, new AsciiType[] { _testSuperName });


// assert // assert
Assert.AreEqual(expectedCount, columns.Count()); Assert.AreEqual(expectedCount, columns.Count());
Expand All @@ -94,7 +94,7 @@ public void Standard_GetSlice_Range()
int expectedCount = 2; int expectedCount = 2;


// act // act
var columns = _family.Get(new[] { _testKey, _testKey2 }, _testName, null, columnCount: 2); var columns = _family.Get(new BytesType[] { _testKey, _testKey2 }, _testName, null, columnCount: 2);


// assert // assert
Assert.AreEqual(expectedCount, columns.Count()); Assert.AreEqual(expectedCount, columns.Count());
Expand All @@ -107,7 +107,7 @@ public void Super_GetSlice_Range()
int expectedCount = 2; int expectedCount = 2;


// act // act
var columns = _superFamily.GetSuperColumns(new[] { _testKey, _testKey2 }, _testSuperName, _testName, null, columnCount: 2); var columns = _superFamily.GetSuperColumns(new BytesType[] { _testKey, _testKey2 }, _testSuperName, _testName, null, columnCount: 2);


// assert // assert
Assert.AreEqual(expectedCount, columns.Count()); Assert.AreEqual(expectedCount, columns.Count());
Expand All @@ -120,7 +120,7 @@ public void Super_GetSuperSlice_Range()
int expectedCount = 2; int expectedCount = 2;


// act // act
var columns = _superFamily.Get(new[] { _testKey, _testKey2 }, _testSuperName, null, columnCount: 1); var columns = _superFamily.Get(new BytesType[] { _testKey, _testKey2 }, _testSuperName, null, columnCount: 1);


// assert // assert
Assert.AreEqual(expectedCount, columns.Count()); Assert.AreEqual(expectedCount, columns.Count());
Expand Down
10 changes: 5 additions & 5 deletions FluentCassandra.Test/Operations/RemoveColumnTest.cs
Expand Up @@ -49,7 +49,7 @@ public void Standard_RemoveColumn()
_family.RemoveColumn(_testKey, _testName); _family.RemoveColumn(_testKey, _testName);


// assert // assert
int actualCount = _family.ColumnCount(_testKey); int actualCount = _family.ColumnCount(_testKey, null, null);
Assert.AreEqual(expectedCount, actualCount); Assert.AreEqual(expectedCount, actualCount);
} }


Expand All @@ -63,7 +63,7 @@ public void Standard_RemoveKey()
_family.RemoveKey(_testKey); _family.RemoveKey(_testKey);


// assert // assert
int actualCount = _family.ColumnCount(_testKey); int actualCount = _family.ColumnCount(_testKey, null, null);
Assert.AreEqual(expectedCount, actualCount); Assert.AreEqual(expectedCount, actualCount);
} }


Expand All @@ -77,7 +77,7 @@ public void Super_RemoveColumn()
_superFamily.RemoveColumn(_testKey, _testSuperName, _testName); _superFamily.RemoveColumn(_testKey, _testSuperName, _testName);


// assert // assert
int actualCount = _superFamily.ColumnCount(_testKey, _testSuperName); int actualCount = _superFamily.ColumnCount(_testKey, _testSuperName, null, null);
Assert.AreEqual(expectedCount, actualCount); Assert.AreEqual(expectedCount, actualCount);
} }


Expand All @@ -91,7 +91,7 @@ public void Super_RemoveSuperColumn()
_superFamily.RemoveSuperColumn(_testKey, _testSuperName); _superFamily.RemoveSuperColumn(_testKey, _testSuperName);


// assert // assert
int actualCount = _superFamily.ColumnCount(_testKey); int actualCount = _superFamily.ColumnCount(_testKey, null, null);
Assert.AreEqual(expectedCount, actualCount); Assert.AreEqual(expectedCount, actualCount);
} }


Expand All @@ -105,7 +105,7 @@ public void Super_RemoveKey()
_superFamily.RemoveKey(_testKey); _superFamily.RemoveKey(_testKey);


// assert // assert
int actualCount = _superFamily.ColumnCount(_testKey); int actualCount = _superFamily.ColumnCount(_testKey, null, null);
Assert.AreEqual(expectedCount, actualCount); Assert.AreEqual(expectedCount, actualCount);
} }
} }
Expand Down
12 changes: 0 additions & 12 deletions FluentCassandra.Test/Test.Keyspace.xml

This file was deleted.

11 changes: 11 additions & 0 deletions FluentCassandra.Test/Test.Keyspace.yaml
@@ -0,0 +1,11 @@
- name: Testing
replica_placement_strategy: org.apache.cassandra.locator.RackUnawareStrategy
replication_factor: 1
column_families:
- name: Standard
compare_with: AsciiType

- name: Super
column_type: Super
compare_with: AsciiType
compare_subcolumns_with: AsciiType
2 changes: 1 addition & 1 deletion FluentCassandra.Test/Types/AsciiTypeTest.cs
Expand Up @@ -5,7 +5,7 @@
using System.Text; using System.Text;
using System.Linq; using System.Linq;


namespace FluentCassandra.Test namespace FluentCassandra.Test.Types
{ {
[TestClass] [TestClass]
public class AsciiTypeTest public class AsciiTypeTest
Expand Down
13 changes: 13 additions & 0 deletions FluentCassandra.Test/Types/BytesTypeTest.cs
Expand Up @@ -10,6 +10,19 @@ namespace FluentCassandra.Test.Types
[TestClass] [TestClass]
public class BytesTypeTest public class BytesTypeTest
{ {
[TestMethod]
public void String_To_BytesType()
{
// arrange
string expected = "Something Good";

// act
BytesType actual = expected;

// assert
Assert.AreEqual(expected, (string)actual);
}

[TestMethod] [TestMethod]
public void Double_To_BytesType() public void Double_To_BytesType()
{ {
Expand Down
2 changes: 1 addition & 1 deletion FluentCassandra.Test/Types/LongTypeTest.cs
Expand Up @@ -5,7 +5,7 @@
using System.Text; using System.Text;
using System.Linq; using System.Linq;


namespace FluentCassandra.Test namespace FluentCassandra.Test.Types
{ {
[TestClass] [TestClass]
public class LongTypeTest public class LongTypeTest
Expand Down
17 changes: 5 additions & 12 deletions FluentCassandra.Test/Types/NullTypeTest.cs
Expand Up @@ -5,7 +5,7 @@
using System.Text; using System.Text;
using System.Linq; using System.Linq;


namespace FluentCassandra.Test namespace FluentCassandra.Test.Types
{ {
[TestClass] [TestClass]
public class NullTypeTest public class NullTypeTest
Expand All @@ -20,17 +20,10 @@ public class NullTypeTest
[TestInitialize] [TestInitialize]
public void TestInit() public void TestInit()
{ {
_db = new CassandraContext("Testing", "localhost"); var setup = new _CassandraSetup();
_family = _db.GetColumnFamily<AsciiType>("Standard"); _db = setup.DB;
_superFamily = _db.GetColumnFamily<AsciiType, AsciiType>("Super"); _family = setup.Family;

_superFamily = setup.SuperFamily;
_family.InsertColumn(_testKey, "Test1", Math.PI);
_family.InsertColumn(_testKey, "Test2", Math.PI);
_family.InsertColumn(_testKey, "Test3", Math.PI);

_superFamily.InsertColumn(_testKey, _testSuperName, "Test1", Math.PI);
_superFamily.InsertColumn(_testKey, _testSuperName, "Test2", Math.PI);
_superFamily.InsertColumn(_testKey, _testSuperName, "Test3", Math.PI);
} }


[TestCleanup] [TestCleanup]
Expand Down
2 changes: 1 addition & 1 deletion FluentCassandra.Test/Types/TimeUUIDTypeTest.cs
Expand Up @@ -5,7 +5,7 @@
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;
using FluentCassandra.Types; using FluentCassandra.Types;


namespace FluentCassandra.Test.Types namespace FluentCassandra.Test.Types.Types
{ {
[TestClass] [TestClass]
public class TimeUUIDTypeTest public class TimeUUIDTypeTest
Expand Down
2 changes: 1 addition & 1 deletion FluentCassandra.Test/Types/UTF8TypeTest.cs
Expand Up @@ -5,7 +5,7 @@
using System.Text; using System.Text;
using System.Linq; using System.Linq;


namespace FluentCassandra.Test namespace FluentCassandra.Test.Types
{ {
[TestClass] [TestClass]
public class UTF8TypeTest public class UTF8TypeTest
Expand Down
64 changes: 64 additions & 0 deletions FluentCassandra.Test/_CassandraSetup.cs
@@ -0,0 +1,64 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentCassandra.Types;
using Apache.Cassandra;

namespace FluentCassandra.Test
{
internal class _CassandraSetup
{
public CassandraContext DB;
public CassandraColumnFamily<AsciiType> Family;
public CassandraSuperColumnFamily<AsciiType, AsciiType> SuperFamily;

public const string TestKey = "Test1";
public const string TestStandardName = "Test1";
public const string TestSuperName = "SubTest1";

public _CassandraSetup()
{
var keyspace = "Testing";
var server = new Server("localhost");

var ksDef = new KsDef {
Name = "Testing",
Replication_factor = 1,
Strategy_class = "org.apache.cassandra.locator.RackUnawareStrategy",
Cf_defs = new List<CfDef>()
};

ksDef.Cf_defs.Add(new CfDef {
Name = TestStandardName,
Keyspace = "Testing",
Column_type = "Standard",
Comparator_type = "AsciiType",
Comment = "Used for testing Standard family."
});

ksDef.Cf_defs.Add(new CfDef {
Name = TestSuperName,
Keyspace = "Testing",
Column_type = "Super",
Comparator_type = "AsciiType",
Subcomparator_type = "AsciiType",
Comment = "Used for testing Super family."
});

CassandraSession.AddKeyspace(server, ksDef);

DB = new CassandraContext(keyspace, server);
Family = DB.GetColumnFamily<AsciiType>("Standard");
SuperFamily = DB.GetColumnFamily<AsciiType, AsciiType>("Super");

Family.InsertColumn(TestKey, "Test1", Math.PI);
Family.InsertColumn(TestKey, "Test2", Math.PI);
Family.InsertColumn(TestKey, "Test3", Math.PI);

SuperFamily.InsertColumn(TestKey, TestSuperName, "Test1", Math.PI);
SuperFamily.InsertColumn(TestKey, TestSuperName, "Test2", Math.PI);
SuperFamily.InsertColumn(TestKey, TestSuperName, "Test3", Math.PI);
}
}
}

0 comments on commit 50d830b

Please sign in to comment.