Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #57 from pawel-kaplanski/master

CQL3 support tests & one RoundRobinServerManager fix
  • Loading branch information...
commit 8067903ee884f7724efe43a8bf08beb3d3a2dddf 2 parents e5a7795 + 45dc007
@nberardi nberardi authored
View
26 FluentCassandra_All.sln
@@ -26,6 +26,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{AC1223D1
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentCassandra.LinqPad", "utility\FluentCassandra.LinqPad\FluentCassandra.LinqPad.csproj", "{CACA3463-BBEE-4C7E-AC89-49240B0D8F46}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentCassandra.UltraStressTest", "test\FluentCassandra.UltraStressTest\FluentCassandra.UltraStressTest.csproj", "{FA126D9D-9072-4FF0-B4EB-1B1F95BF65D5}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentCassandra.MoreTests", "test\FluentCassandra.MoreTests\FluentCassandra.MoreTests.csproj", "{05682974-C961-4A22-9F44-052859F00C15}"
+EndProject
Global
GlobalSection(TestCaseManagementSettings) = postSolution
CategoryFile = FluentCassandra.vsmdi
@@ -87,6 +91,26 @@ Global
{CACA3463-BBEE-4C7E-AC89-49240B0D8F46}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{CACA3463-BBEE-4C7E-AC89-49240B0D8F46}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{CACA3463-BBEE-4C7E-AC89-49240B0D8F46}.Release|x86.ActiveCfg = Release|Any CPU
+ {FA126D9D-9072-4FF0-B4EB-1B1F95BF65D5}.Debug|Any CPU.ActiveCfg = Debug|x86
+ {FA126D9D-9072-4FF0-B4EB-1B1F95BF65D5}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+ {FA126D9D-9072-4FF0-B4EB-1B1F95BF65D5}.Debug|Mixed Platforms.Build.0 = Debug|x86
+ {FA126D9D-9072-4FF0-B4EB-1B1F95BF65D5}.Debug|x86.ActiveCfg = Debug|x86
+ {FA126D9D-9072-4FF0-B4EB-1B1F95BF65D5}.Debug|x86.Build.0 = Debug|x86
+ {FA126D9D-9072-4FF0-B4EB-1B1F95BF65D5}.Release|Any CPU.ActiveCfg = Release|x86
+ {FA126D9D-9072-4FF0-B4EB-1B1F95BF65D5}.Release|Mixed Platforms.ActiveCfg = Release|x86
+ {FA126D9D-9072-4FF0-B4EB-1B1F95BF65D5}.Release|Mixed Platforms.Build.0 = Release|x86
+ {FA126D9D-9072-4FF0-B4EB-1B1F95BF65D5}.Release|x86.ActiveCfg = Release|x86
+ {FA126D9D-9072-4FF0-B4EB-1B1F95BF65D5}.Release|x86.Build.0 = Release|x86
+ {05682974-C961-4A22-9F44-052859F00C15}.Debug|Any CPU.ActiveCfg = Debug|x86
+ {05682974-C961-4A22-9F44-052859F00C15}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+ {05682974-C961-4A22-9F44-052859F00C15}.Debug|Mixed Platforms.Build.0 = Debug|x86
+ {05682974-C961-4A22-9F44-052859F00C15}.Debug|x86.ActiveCfg = Debug|x86
+ {05682974-C961-4A22-9F44-052859F00C15}.Debug|x86.Build.0 = Debug|x86
+ {05682974-C961-4A22-9F44-052859F00C15}.Release|Any CPU.ActiveCfg = Release|x86
+ {05682974-C961-4A22-9F44-052859F00C15}.Release|Mixed Platforms.ActiveCfg = Release|x86
+ {05682974-C961-4A22-9F44-052859F00C15}.Release|Mixed Platforms.Build.0 = Release|x86
+ {05682974-C961-4A22-9F44-052859F00C15}.Release|x86.ActiveCfg = Release|x86
+ {05682974-C961-4A22-9F44-052859F00C15}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -94,6 +118,8 @@ Global
GlobalSection(NestedProjects) = preSolution
{AC3818E2-E260-4193-A3D1-6E3FF87383F6} = {1A88B962-9A09-4692-80D3-E88712A9E516}
{9DAF7022-5820-4214-B13E-AC0A1B37691F} = {1A88B962-9A09-4692-80D3-E88712A9E516}
+ {FA126D9D-9072-4FF0-B4EB-1B1F95BF65D5} = {1A88B962-9A09-4692-80D3-E88712A9E516}
+ {05682974-C961-4A22-9F44-052859F00C15} = {1A88B962-9A09-4692-80D3-E88712A9E516}
{CACA3463-BBEE-4C7E-AC89-49240B0D8F46} = {AC1223D1-1638-4DEB-9CFF-8B0C43854BB0}
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
View
2  src/Connections/RoundRobinServerManager.cs
@@ -28,7 +28,7 @@ private bool IsBlackListed(Server server)
public bool HasNext
{
- get { lock (_lock) { return _serverQueue.Count > 0; } }
+ get { lock (_lock) { return (_serverQueue.Count - _blackListed.Count) > 0; } }
}
public Server Next()
View
7 test/FluentCassandra.StressTest/FluentCassandra.StressTest.csproj
@@ -34,6 +34,9 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+ <PropertyGroup>
+ <StartupObject>FluentCassandra.StressTest.Program</StartupObject>
+ </PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
@@ -48,7 +51,9 @@
</Reference>
</ItemGroup>
<ItemGroup>
- <Compile Include="Program.cs" />
+ <Compile Include="Main.cs" />
+ <Compile Include="StressTest1.cs" />
+ <Compile Include="StressTest2.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
View
35 test/FluentCassandra.StressTest/Main.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace FluentCassandra.StressTest
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ Console.Error.WriteLine("Stress Test 1");
+ try
+ {
+ StressTest.StressTest1.Test();
+ }
+ catch (Exception ex)
+ {
+ Console.Error.WriteLine(ex.Message);
+ Console.Error.WriteLine(ex.StackTrace);
+ }
+ Console.Error.WriteLine("");
+ Console.Error.WriteLine("Stress Test 2");
+ try
+ {
+ StressTest.StressTest2.Test();
+ }
+ catch (Exception ex)
+ {
+ Console.Error.WriteLine(ex.Message);
+ Console.Error.WriteLine(ex.StackTrace);
+ }
+ }
+ }
+}
View
0  test/FluentCassandra.StressTest/Program.cs → test/FluentCassandra.StressTest/StressTest1.cs
File renamed without changes
View
445 test/FluentCassandra.StressTest/StressTest2.cs
@@ -0,0 +1,445 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using FluentCassandra.Connections;
+using System.Threading;
+using System.Globalization;
+using Xunit;
+using System.Diagnostics;
+
+namespace FluentCassandra.StressTest
+{
+ /// <summary>
+ /// The performance test on rapid insert/select/delete operations from mutlithreaded environment
+ /// </summary>
+ class StressTest2
+ {
+ public class CassandraJob
+ {
+ string command;
+ string logic;
+ Guid id;
+ int n = 0;
+ Guid ackId;
+
+ public CassandraJob(FluentCassandra.Linq.ICqlRow job, Guid ackId)
+ {
+ command = job["command"];
+ logic = job["logic"];
+ id = job["id"];
+ this.ackId = ackId;
+ }
+
+ public string GetCommand()
+ {
+ return command;
+ }
+
+ public string GetLogic()
+ {
+ return logic;
+ }
+
+ public Guid GetID()
+ {
+ return id;
+ }
+
+ public Guid GetAckID()
+ {
+ return ackId;
+ }
+ }
+ private static string KeyspaceName = "stresstest2";
+ private static readonly Server Server = new Server("localhost");
+
+ [Fact]
+ public static void Test()
+ {
+ int TestTimeInMinutes = 10;
+
+ int ThreadCount = 50;
+ int ThreadCount2 = 10;
+ int TimeOut_Sec = 5;
+ bool usePooling = true;
+
+ object alive_monitor = new object();
+ bool alive_condition = true;
+ List<Thread> threads = new List<Thread>();
+
+ int thrStarted_cnt = 0;
+ object thrStarted_monitor = new object();
+
+ //initialize
+ CassandraContext main_db = new CassandraContext(new ConnectionBuilder(keyspace: KeyspaceName, server: Server, cqlVersion: CqlVersion.Cql3, pooling: usePooling));
+ {
+ if (main_db.KeyspaceExists(KeyspaceName))
+ main_db.DropKeyspace(KeyspaceName);
+
+ var keyspace = new CassandraKeyspace(new CassandraKeyspaceSchema
+ {
+ Name = KeyspaceName,
+ }, main_db);
+
+ keyspace.TryCreateSelf();
+
+ CreateTablesIfNotExists(main_db);
+ }
+
+ for (int tI = 0; tI < ThreadCount; tI++)
+ {
+ int thrNo = tI;
+ var thr = new Thread(() =>
+ {
+
+ Console.Write("(*" + thrNo + ")");
+ try
+ {
+ CassandraContext db = new CassandraContext(new ConnectionBuilder(keyspace: KeyspaceName, server: Server, cqlVersion: CqlVersion.Cql3, pooling: usePooling));
+ lock (thrStarted_monitor)
+ {
+ thrStarted_cnt++;
+ Monitor.PulseAll(thrStarted_monitor);
+ }
+
+ while (true)
+ {
+ var job = GetJob(db, 10);
+ if (job != null)
+ {
+ Console.Write("-");
+ if (job.GetLogic() == null || job.GetCommand() == null)
+ Console.WriteLine("Error");
+ DeleteJob(db, job);
+ }
+ else
+ {
+ lock (alive_monitor)
+ {
+ if (!alive_condition)
+ return;
+ else
+ Monitor.Wait(alive_monitor, TimeOut_Sec * 1000);
+ }
+ }
+ }
+ }
+ finally
+ {
+ Console.Write("(~" + thrNo + ")");
+ }
+ });
+ threads.Add(thr);
+ thr.Start();
+ }
+
+ for (int tI = 0; tI < ThreadCount2; tI++)
+ {
+ int thrNo = tI;
+ var thr = new Thread(() =>
+ {
+ Console.Write("<*" + thrNo + ">");
+ try
+ {
+ CassandraContext db = new CassandraContext(new ConnectionBuilder(keyspace: KeyspaceName, server: Server, cqlVersion: CqlVersion.Cql3, pooling: usePooling));
+ lock (thrStarted_monitor)
+ {
+ thrStarted_cnt++;
+ Monitor.PulseAll(thrStarted_monitor);
+ }
+
+ while (true)
+ {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < 100; i++)
+ sb.AppendLine(Guid.NewGuid().ToString());
+ AddJob(db, sb.ToString(), Guid.NewGuid().ToString());
+ Console.Write("+");
+ Thread.Sleep(100);
+ lock (alive_monitor)
+ {
+ if (!alive_condition)
+ return;
+ }
+ }
+ }
+ finally
+ {
+ Console.Write("<~" + thrNo + ">");
+ }
+ });
+ threads.Add(thr);
+ thr.Start();
+ }
+
+ while (true)
+ {
+ lock (thrStarted_monitor)
+ {
+ Monitor.Wait(thrStarted_monitor);
+ if (thrStarted_cnt == ThreadCount+ThreadCount2)
+ break;
+ }
+ }
+
+ //wait for ten minutes
+ Thread.Sleep(TestTimeInMinutes * 60 * 1000);
+
+ lock (alive_monitor)
+ {
+ alive_condition = false;
+ Monitor.PulseAll(alive_monitor);
+ }
+ foreach (var thr in threads)
+ {
+ thr.Join();
+ }
+
+ var j = main_db.ExecuteQuery(SelectCQL_Main(1)).ToArray();
+ var c = main_db.ExecuteQuery(SelectCQL_Trans(1)).ToArray();
+ if (j.Count() > 0 || c.Count() > 0)
+ Console.WriteLine("Error");
+
+ Console.WriteLine("Finished");
+ }
+
+ static ThreadLocal<Random> rnd = new ThreadLocal<Random>((() => new Random(Guid.NewGuid().GetHashCode())));
+
+ public static void DeleteJob(CassandraContext db, CassandraJob job)
+ {
+ db.ExecuteNonQuery(DeleteRowCQL_Main((job as CassandraJob).GetID()));
+ db.ExecuteNonQuery(DeleteRowCQL_Trans((job as CassandraJob).GetID()));
+ }
+
+ public static void AddJob(CassandraContext db, string logic, string command)
+ {
+ var id = Guid.NewGuid();
+ db.ExecuteNonQuery(InsertRowCQL(id, logic, command));
+ }
+
+ public static CassandraJob GetJob(CassandraContext db, int hide_time_sec)
+ {
+ loop:
+ dynamic job = null;
+ for (int i = 0; i < 1000; i++)
+ {
+ var jobs = db.ExecuteQuery(SelectCQL_Main(1000)).ToArray();
+ var mx = jobs.Length < 1000 ? jobs.Length - 1 : 1000;
+ if (mx == -1)
+ break;
+ job = jobs[rnd.Value.Next(mx)];
+ if (job["hidden_till"] < ToUnixTime(DateTimeOffset.UtcNow))
+ break;
+ }
+ if (job != null)
+ {
+ var myID = Guid.NewGuid();
+ var ret = new CassandraJob(job, myID);
+ db.ExecuteNonQuery(HideRowCQL_Trans(ret.GetID(), ret.GetAckID()));
+ var cnt = db.ExecuteQuery(SelectCQL_Trans(ret.GetID(), 1000)).ToArray();
+ var counter = cnt.First()["count"];
+ if (counter > 1)
+ {
+ db.ExecuteNonQuery(DeleteRowCQL_Trans(ret.GetID()));
+ goto loop;
+ }
+ if (counter == 0)
+ goto loop;
+
+ db.ExecuteNonQuery(HideRowCQL_Main2(ret.GetID(), hide_time_sec,ret.GetLogic(),ret.GetCommand()));
+
+ return ret;
+ }
+ else
+ return null;
+ }
+
+ public static void CreateTablesIfNotExists(CassandraContext db)
+ {
+ try
+ {
+ db.ExecuteNonQuery(string.Format(@"
+CREATE TABLE {0} (
+ id uuid,
+ logic text,
+ command text,
+ hidden_till timestamp,
+ PRIMARY KEY (id));
+", TableName("main")));
+ }
+ catch (CassandraException) { }
+ try
+ {
+
+ db.ExecuteNonQuery(string.Format(@"
+CREATE TABLE {0} (
+ id uuid,
+ oid uuid,
+ progress double,
+ last_access timestamp,
+ PRIMARY KEY (id,oid));
+", TableName("trans")));
+ }
+ catch (CassandraException) { }
+ try
+ {
+ db.ExecuteNonQuery(string.Format(@"
+CREATE TABLE {0} (
+ id uuid,
+ oid uuid,
+ what int,
+ when timestamp,
+ info text,
+ PRIMARY KEY (id,oid,what,when));
+", TableName("out")));
+ }
+ catch (CassandraException) { }
+
+
+ }
+ protected static string Encode(string str)
+ {
+ return '\'' + str.Replace("\'", "\'\'") + '\'';
+ }
+
+ protected void DeleteTables()
+ {
+ throw new NotImplementedException();
+ }
+
+ protected static string TableName(string pfx)
+ {
+ return "scheduler_" + pfx;
+ }
+
+
+ protected static readonly DateTimeOffset UnixStart = new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero);
+
+ protected static long ToUnixTime(DateTimeOffset dt)
+ {
+ // this was changed from .NET Ticks to the Unix Epoch to be compatible with other cassandra libraries
+ return Convert.ToInt64(Math.Floor((dt - UnixStart).TotalMilliseconds));
+ }
+
+
+ protected static string InsertRowCQL(Guid id, string logic, string command)
+ {
+ return string.Format(@"
+INSERT INTO {0}
+(id,logic,command, hidden_till)
+VALUES ({1},{2},{3},{4})",
+ TableName("main"),
+ id.ToString(),
+ Encode(logic),
+ Encode(command),
+ 0
+ );
+ }
+
+ protected static string HideRowCQL_Main(Guid id, int hide_time_sec)
+ {
+ return string.Format(@"
+UPDATE {0}
+SET hidden_till={1}
+WHERE id={2}",
+ TableName("main"),
+ ToUnixTime(DateTimeOffset.UtcNow.AddSeconds(hide_time_sec)),
+ id.ToString()
+ );
+ }
+
+ protected static string HideRowCQL_Main2(Guid id, int hide_time_sec, string logic, string command)
+ {
+ return string.Format(@"
+UPDATE {0}
+SET hidden_till={1}, logic={2}, command={3}
+WHERE id={4}",
+ TableName("main"),
+ ToUnixTime(DateTimeOffset.UtcNow.AddSeconds(hide_time_sec)),
+ Encode(logic),
+ Encode(command),
+ id.ToString()
+ );
+ }
+
+ protected static string HideRowCQL_Trans(Guid id, Guid oid)
+ {
+ return string.Format(@"
+INSERT INTO {0}
+(id,oid,progress,last_access)
+VALUES ({1},{2},0,0)",
+ TableName("trans"),
+ id.ToString(),
+ oid.ToString()
+ );
+ }
+
+ protected static string DeleteRowCQL_Main(Guid id)
+ {
+ return string.Format(@"
+DELETE FROM {0}
+WHERE id={1}",
+ TableName("main"),
+ id.ToString()
+ );
+ }
+
+ protected static string DeleteRowCQL_Trans(Guid id)
+ {
+ return string.Format(@"
+DELETE FROM {0}
+WHERE id={1}",
+ TableName("trans"),
+ id.ToString()
+ );
+ }
+
+ protected static string SelectCQL_Main(int limit)
+ {
+ return string.Format(@"
+SELECT *
+FROM {0} LIMIT {1}",
+ TableName("main"), limit.ToString()
+ );
+ }
+ protected static string SelectCQL_Trans(int limit)
+ {
+ return string.Format(@"
+SELECT *
+FROM {0} LIMIT {1}",
+ TableName("trans"), limit.ToString()
+ );
+ }
+ protected static string SelectCQL_Trans(Guid id, int limit)
+ {
+ return string.Format(@"
+SELECT count(1)
+FROM {0} WHERE id={1} LIMIT {2}",
+ TableName("trans"), id.ToString(), limit.ToString()
+ );
+ }
+
+ protected static string SetProgressRowCQL_Trans(Guid id, Guid oid, double percentDone)
+ {
+ return string.Format(@"
+UPDATE {0}
+SET progress={1}
+WHERE id={2} and oid = {3}",
+ TableName("trans"),
+ percentDone.ToString(CultureInfo.InvariantCulture),
+ id.ToString(),
+ oid.ToString()
+ );
+ }
+
+ protected static string AddInfoRowCQL_Out(Guid id, Guid oid, int what, string info)
+ {
+ return string.Format(@"
+INSERT INTO {0}
+ (id,oid,what,when,info)
+VALUES ({1},{2},{3},{4},{5});
+", TableName("out"), id.ToString(), oid.ToString(), what.ToString(), ToUnixTime(DateTimeOffset.UtcNow), Encode(info));
+ }
+ }
+}
View
128 test/FluentCassandra.Tests/CassandraCql3DatabaseSetup.cs
@@ -0,0 +1,128 @@
+using System;
+using System.Linq;
+using FluentCassandra.Connections;
+using FluentCassandra.Types;
+using System.Collections.Generic;
+using System.Configuration;
+
+namespace FluentCassandra
+{
+ public class CassandraCql3DatabaseSetupFixture
+ {
+ private static bool DatabaseHasBeenCleaned = false;
+
+ public CassandraCql3DatabaseSetup DatabaseSetup(bool? reset = null, bool toLower = false, bool toLower2 = false)
+ {
+ if (reset == null && !DatabaseHasBeenCleaned)
+ {
+ DatabaseHasBeenCleaned = true;
+
+ // refresh the entire database
+ return new CassandraCql3DatabaseSetup(reset: true);
+ }
+
+ return new CassandraCql3DatabaseSetup(reset: reset ?? false);
+ }
+ }
+
+ public class CassandraCql3DatabaseSetup
+ {
+ public ConnectionBuilder ConnectionBuilder;
+ public CassandraContext DB;
+
+ public User[] Users = new[] {
+ new User { Id = 1, Name = "Darren Gemmell", Email = "darren@somewhere.com", Age = 32 },
+ new User { Id = 2, Name = "Fernando Laubscher", Email = "fernando@somewhere.com", Age = 23 },
+ new User { Id = 3, Name = "Cody Millhouse", Email = "cody@somewhere.com", Age = 56 },
+ new User { Id = 4, Name = "Emilia Thibert", Email = "emilia@somewhere.com", Age = 67 },
+ new User { Id = 5, Name = "Allyson Schurr", Email = "allyson@somewhere.com", Age = 21 }
+ };
+
+ public class User
+ {
+ public int Id { get; set; }
+ public string Name { get; set; }
+ public string Email { get; set; }
+ public int Age { get; set; }
+ }
+
+ public static readonly string Keyspace = ConfigurationManager.AppSettings["TestKeySpaceCql3"];
+ public static readonly Server Server = new Server(ConfigurationManager.AppSettings["TestServer"]);
+
+ public CassandraCql3DatabaseSetup(bool reset = false)
+ {
+
+ ConnectionBuilder = new ConnectionBuilder(keyspace: Keyspace, server: Server, cqlVersion: CqlVersion.Cql3);
+ DB = new CassandraContext(ConnectionBuilder);
+
+ if (DB.KeyspaceExists(Keyspace))
+ DB.DropKeyspace(Keyspace);
+
+ var keyspace = new CassandraKeyspace(new CassandraKeyspaceSchema
+ {
+ Name = Keyspace,
+ }, DB);
+
+ var exists = DB.KeyspaceExists(Keyspace);
+ if (!exists)
+ keyspace.TryCreateSelf();
+
+ if (exists && !reset)
+ return;
+
+ ResetDatabase();
+ }
+
+ public void ResetDatabase()
+ {
+ using (var session = new CassandraSession(ConnectionBuilder))
+ using (var db = new CassandraContext(session))
+ {
+ db.ThrowErrors = true;
+ db.TryDropKeyspace(Keyspace);
+
+ var keyspace = new CassandraKeyspace(new CassandraKeyspaceSchema
+ {
+ Name = Keyspace
+ }, db);
+ db.Keyspace = keyspace;
+
+ keyspace.TryCreateSelf();
+
+ db.ExecuteNonQuery(@"
+CREATE TABLE users (
+ id int ,
+ name ascii,
+ email ascii,
+ age int,
+ PRIMARY KEY(id, email)
+);");
+
+ ResetUsersFamily(db);
+ }
+ }
+
+ public static string Encode(string str)
+ {
+ return '\'' + str.Replace("\'", "\'\'") + '\'';
+ }
+
+ public void ResetUsersFamily(CassandraContext db)
+ {
+ db.ExecuteNonQuery(@"
+TRUNCATE users
+;
+");
+
+ foreach (var user in Users)
+ {
+ db.ExecuteNonQuery(string.Format(@"
+INSERT INTO users(id, name, email, age)
+VALUES ({0},{1},{2},{3})
+;
+", user.Id.ToString(), Encode(user.Name), Encode(user.Email), user.Age.ToString()));
+ }
+ }
+
+ }
+}
View
217 test/FluentCassandra.Tests/CompatibilityCassandraDatabaseSetup.cs
@@ -0,0 +1,217 @@
+using System;
+using System.Linq;
+using FluentCassandra.Connections;
+using FluentCassandra.Types;
+using System.Collections.Generic;
+using System.Configuration;
+
+namespace FluentCassandra
+{
+ public class CompatibilityCassandraDatabaseSetupFixture
+ {
+ private static bool DatabaseHasBeenCleaned = false;
+
+ public CompatibilityCassandraDatabaseSetup DatabaseSetup(bool? reset = null, bool toLower = false, bool toLower2 = false)
+ {
+ if (reset == null && !DatabaseHasBeenCleaned)
+ {
+ DatabaseHasBeenCleaned = true;
+
+ // refresh the entire database
+ return new CompatibilityCassandraDatabaseSetup(reset: true, toLower: toLower, toLower2: toLower2);
+ }
+
+ return new CompatibilityCassandraDatabaseSetup(reset: reset ?? false, toLower: toLower, toLower2: toLower2);
+ }
+ }
+
+ public class CompatibilityCassandraDatabaseSetup
+ {
+ public ConnectionBuilder ConnectionBuilder;
+ public CassandraContext DB;
+
+ public CassandraColumnFamily<AsciiType> Family;
+ public CassandraSuperColumnFamily<AsciiType, AsciiType> SuperFamily;
+ public CassandraColumnFamily UserFamily;
+
+ public User[] Users = new[] {
+ new User { Id = 1, Name = "Darren Gemmell", Email = "darren@somewhere.com", Age = 32 },
+ new User { Id = 2, Name = "Fernando Laubscher", Email = "fernando@somewhere.com", Age = 23 },
+ new User { Id = 3, Name = "Cody Millhouse", Email = "cody@somewhere.com", Age = 56 },
+ new User { Id = 4, Name = "Emilia Thibert", Email = "emilia@somewhere.com", Age = 67 },
+ new User { Id = 5, Name = "Allyson Schurr", Email = "allyson@somewhere.com", Age = 21 }
+ };
+
+ public class User
+ {
+ public int Id { get; set; }
+ public string Name { get; set; }
+ public string Email { get; set; }
+ public int Age { get; set; }
+ }
+
+ public const string TestKey1 = "Test1";
+ public const string TestKey2 = "Test2";
+
+ public const string TestStandardName = "Test1";
+ public const string TestSuperName = "SubTest1";
+
+ public static readonly string Keyspace = ConfigurationManager.AppSettings["TestKeySpaceCql3"];
+ public static readonly Server Server = new Server(ConfigurationManager.AppSettings["TestServer"]);
+
+ bool toLower;
+ bool toLower2;
+
+ private string toLowerIf(bool toLower, string txt)
+ {
+ return toLower ? txt.ToLower() : txt;
+ }
+
+ public CompatibilityCassandraDatabaseSetup(bool reset = false, bool toLower = false, bool toLower2 = false)
+ {
+ this.toLower = toLower;
+ this.toLower2 = toLower2;
+
+ ConnectionBuilder = new ConnectionBuilder(keyspace: Keyspace, server: Server, cqlVersion: CqlVersion.Cql3);
+ DB = new CassandraContext(ConnectionBuilder);
+
+ if (DB.KeyspaceExists(Keyspace))
+ DB.DropKeyspace(Keyspace);
+
+ var keyspace = new CassandraKeyspace(new CassandraKeyspaceSchema
+ {
+ Name = Keyspace,
+ }, DB);
+
+ var exists = DB.KeyspaceExists(Keyspace);
+ if(!exists)
+ keyspace.TryCreateSelf();
+
+ Family = DB.GetColumnFamily<AsciiType>("Standard");
+ SuperFamily = DB.GetColumnFamily<AsciiType, AsciiType>("Super");
+ UserFamily = DB.GetColumnFamily(toLowerIf(toLower,"Users"));
+
+ if (exists && !reset)
+ return;
+
+ ResetDatabase();
+ }
+
+ public void ResetDatabase()
+ {
+ using (var session = new CassandraSession(ConnectionBuilder))
+ using (var db = new CassandraContext(session))
+ {
+ db.ThrowErrors = true;
+ db.TryDropKeyspace(Keyspace);
+
+ var keyspace = new CassandraKeyspace(new CassandraKeyspaceSchema
+ {
+ Name = Keyspace
+ }, db);
+ db.Keyspace = keyspace;
+
+ keyspace.TryCreateSelf();
+ keyspace.TryCreateColumnFamily<AsciiType>("Standard");
+ keyspace.TryCreateColumnFamily<AsciiType, AsciiType>("Super");
+ keyspace.TryCreateColumnFamily<AsciiType>("StandardAsciiType");
+ keyspace.TryCreateColumnFamily<BytesType>("StandardBytesType");
+ keyspace.TryCreateColumnFamily<IntegerType>("StandardIntegerType");
+ keyspace.TryCreateColumnFamily<LexicalUUIDType>("StandardLexicalUUIDType");
+ keyspace.TryCreateColumnFamily<LongType>("StandardLongType");
+ keyspace.TryCreateColumnFamily<TimeUUIDType>("StandardTimeUUIDType");
+ keyspace.TryCreateColumnFamily<UTF8Type>("StandardUTF8Type");
+ keyspace.TryCreateColumnFamily<UUIDType>("StandardUUIDType");
+ keyspace.TryCreateColumnFamily(new CassandraColumnFamilySchema
+ {
+ FamilyName = "StandardCompositeType",
+ ColumnNameType = CassandraType.CompositeType(new[] { CassandraType.AsciiType, CassandraType.DoubleType })
+ });
+ keyspace.TryCreateColumnFamily(new CassandraColumnFamilySchema
+ {
+ FamilyName = "StandardDynamicCompositeType",
+ ColumnNameType = CassandraType.DynamicCompositeType(new Dictionary<char, CassandraType> { { 'a', CassandraType.AsciiType }, { 'd', CassandraType.DoubleType } })
+ });
+
+ db.ExecuteNonQuery(string.Format(@"
+CREATE TABLE {0} (
+ id int ,
+ name ascii,
+ email ascii,
+ age int,
+ PRIMARY KEY(id)
+);", toLowerIf(toLower, "Users")));
+
+ //db.ExecuteNonQuery(@"CREATE INDEX User_Age ON users (Age);");
+ db.Keyspace.ClearCachedKeyspaceSchema();
+
+ var family = db.GetColumnFamily<AsciiType>("Standard");
+ var superFamily = db.GetColumnFamily<AsciiType, AsciiType>("Super");
+ var userFamily = db.GetColumnFamily(toLowerIf(toLower, "Users"));
+
+ ResetFamily(family);
+ ResetSuperFamily(superFamily);
+ ResetUsersFamily(userFamily);
+ }
+ }
+
+ public void ResetUsersFamily(CassandraColumnFamily userFamily = null)
+ {
+ userFamily = userFamily ?? UserFamily;
+
+ var db = userFamily.Context;
+ userFamily.RemoveAllRows();
+
+ foreach (var user in Users)
+ {
+ dynamic record = userFamily.CreateRecord(user.Id);
+ if (toLower2)
+ {
+ record.name = user.Name;
+ record.email = user.Email;
+ record.age = user.Age;
+ }
+ else
+ {
+ record.Name = user.Name;
+ record.Email = user.Email;
+ record.Age = user.Age;
+ }
+
+ db.Attach(record);
+ }
+
+ db.SaveChanges();
+ }
+
+ public void ResetFamily(CassandraColumnFamily family = null)
+ {
+ family = family ?? Family;
+
+ family.RemoveAllRows();
+
+ family.InsertColumn(TestKey1, "Test1", Math.PI);
+ family.InsertColumn(TestKey1, "Test2", Math.PI);
+ family.InsertColumn(TestKey1, "Test3", Math.PI);
+
+ family.InsertColumn(TestKey2, "Test1", Math.PI);
+ family.InsertColumn(TestKey2, "Test2", Math.PI);
+ family.InsertColumn(TestKey2, "Test3", Math.PI);
+ }
+
+ public void ResetSuperFamily(CassandraSuperColumnFamily superFamily = null)
+ {
+ superFamily = superFamily ?? SuperFamily;
+
+ superFamily.RemoveAllRows();
+
+ superFamily.InsertColumn(TestKey1, TestSuperName, "Test1", Math.PI);
+ superFamily.InsertColumn(TestKey1, TestSuperName, "Test2", Math.PI);
+ superFamily.InsertColumn(TestKey1, TestSuperName, "Test3", Math.PI);
+
+ superFamily.InsertColumn(TestKey2, TestSuperName, "Test1", Math.PI);
+ superFamily.InsertColumn(TestKey2, TestSuperName, "Test2", Math.PI);
+ superFamily.InsertColumn(TestKey2, TestSuperName, "Test3", Math.PI);
+ }
+ }
+}
View
7 test/FluentCassandra.Tests/FluentCassandra.Tests.csproj
@@ -55,19 +55,26 @@
<Compile Include="Bugs\Issue25JavaBigDecimalBinaryConversion.cs" />
<Compile Include="Bugs\Issue36KeyAliasSupport.cs" />
<Compile Include="Bugs\Issue39CompositeTypeAsKey.cs" />
+ <Compile Include="CassandraCql3DatabaseSetup.cs" />
<Compile Include="CassandraDatabaseSetupFixture.cs" />
<Compile Include="CassandraQueryTest.cs" />
+ <Compile Include="CompatibilityCassandraDatabaseSetup.cs" />
<Compile Include="Connections\ConnectionProviderTests.cs" />
<Compile Include="Connections\NormalConnectionProviderTests.cs" />
<Compile Include="CqlHelperTest.cs" />
+ <Compile Include="GenericDatabaseSetup.cs" />
<Compile Include="Helper.cs" />
<Compile Include="Linq\LinqToCqlObjectsCassandraTests.cs" />
<Compile Include="Linq\LinqToCqlObjectsTests.cs" />
<Compile Include="Linq\LinqToCqlTests.cs" />
<Compile Include="Linq\LinqToCqlCassandraTests.cs" />
<Compile Include="Operations\CassandraIndexClauseTest.cs" />
+ <Compile Include="Linq\Cql3LinqTest.cs" />
+ <Compile Include="Operations\Cql3Test.cs" />
+ <Compile Include="Operations\Cql3vs2CompatibilityTest.cs" />
<Compile Include="Operations\CqlTest.cs" />
<Compile Include="ReportedIssuesTests.cs" />
+ <Compile Include="Tools.cs" />
<Compile Include="TypesToDatabase\AsciiTypeTest.cs" />
<Compile Include="TypesToDatabase\BytesTypeTest.cs" />
<Compile Include="TypesToDatabase\CompositeTypeTest.cs" />
View
85 test/FluentCassandra.Tests/GenericDatabaseSetup.cs
@@ -0,0 +1,85 @@
+using System;
+using System.Linq;
+using FluentCassandra.Connections;
+using FluentCassandra.Types;
+using System.Collections.Generic;
+using System.Configuration;
+
+namespace FluentCassandra
+{
+ public class GenericDatabaseSetupFixture
+ {
+ private static bool DatabaseHasBeenCleaned = false;
+
+ public GenericDatabaseSetup DatabaseSetup(bool? reset = null)
+ {
+ if (reset == null && !DatabaseHasBeenCleaned)
+ {
+ DatabaseHasBeenCleaned = true;
+
+ // refresh the entire database
+ return new GenericDatabaseSetup(reset: true);
+ }
+
+ return new GenericDatabaseSetup(reset: reset ?? false);
+ }
+ }
+
+ public class GenericDatabaseSetup
+ {
+ public ConnectionBuilder ConnectionBuilder;
+ public CassandraContext DB;
+
+ public static readonly string Keyspace = ConfigurationManager.AppSettings["TestKeySpaceCql3"];
+ public static readonly Server Server = new Server(ConfigurationManager.AppSettings["TestServer"]);
+
+ public GenericDatabaseSetup(bool reset = false)
+ {
+
+ ConnectionBuilder = new ConnectionBuilder(keyspace: Keyspace, server: Server, cqlVersion: CqlVersion.Cql3);
+ DB = new CassandraContext(ConnectionBuilder);
+
+ if (DB.KeyspaceExists(Keyspace))
+ DB.DropKeyspace(Keyspace);
+
+ var keyspace = new CassandraKeyspace(new CassandraKeyspaceSchema
+ {
+ Name = Keyspace,
+ }, DB);
+
+ var exists = DB.KeyspaceExists(Keyspace);
+ if (!exists)
+ keyspace.TryCreateSelf();
+
+ if (exists && !reset)
+ return;
+
+ ResetDatabase();
+ }
+
+ public void ResetDatabase()
+ {
+ using (var session = new CassandraSession(ConnectionBuilder))
+ using (var db = new CassandraContext(session))
+ {
+ db.ThrowErrors = true;
+ db.TryDropKeyspace(Keyspace);
+
+ var keyspace = new CassandraKeyspace(new CassandraKeyspaceSchema
+ {
+ Name = Keyspace
+ }, db);
+ db.Keyspace = keyspace;
+
+ keyspace.TryCreateSelf();
+
+ }
+ }
+
+ public static string Encode(string str)
+ {
+ return '\'' + str.Replace("\'", "\'\'") + '\'';
+ }
+
+ }
+}
View
171 test/FluentCassandra.Tests/Linq/Cql3LinqTest.cs
@@ -0,0 +1,171 @@
+using System;
+using System.Linq;
+using System.Collections.Generic;
+using FluentCassandra.Connections;
+using Xunit;
+using System.Text;
+using System.Globalization;
+using FluentCassandra.MoreTests;
+
+namespace FluentCassandra.Operations
+{
+ /// <summary>
+ /// CQL3+linq support tests
+ /// </summary>
+ public class Cql3LinqTest : IUseFixture<GenericDatabaseSetupFixture>, IDisposable
+ {
+ public class Row1
+ {
+ [Key(Level = 0)]
+ public int idx { get; set; }
+
+ [Key(Level = 1)]
+ public string Name { get; set; }
+
+ [Key(Level = 2)]
+ public string Email { get; set; }
+
+ public int Age { get; set; }
+ public bool Active { get; set; }
+ public long X { get; set; }
+ public byte[] Stuff { get; set; }
+ public decimal Price { get; set; }
+ public double A { get; set; }
+ public float S { get; set; }
+ public Guid Uid { get; set; }
+ }
+
+
+ private CassandraContext _db;
+
+ public void SetFixture(GenericDatabaseSetupFixture data)
+ {
+ var setup = data.DatabaseSetup();
+ _db = setup.DB;
+ }
+
+ public void Dispose()
+ {
+ _db.Dispose();
+ }
+
+ public Row1[] Users = new[] {
+ new Row1 { idx=1, Uid = Guid.NewGuid(), Name = "Darren Gemmell", Email = "darren@somewhere.com", Age = 32, Active = false, A=0.1, Price = 10.3M, S = 1.3F, X = 1244, Stuff=new byte[]{0,1,2,3,4,5,} },
+ new Row1 { idx=2, Uid = Guid.NewGuid(), Name = "Fernando Laubscher", Email = "fernando@somewhere.com", Age = 23, Active = true , A=0.1, Price = 10.3M, S = 1.3F, X = 1244, Stuff=new byte[]{0,1,2,3,4,5,} },
+ new Row1 { idx=3, Uid = Guid.NewGuid(), Name = "Cody Millhouse", Email = "cody@somewhere.com", Age = 56 , Active = false, A=0.1, Price = 10.3M, S = 1.3F, X = 1244, Stuff=new byte[]{0,1,2,3,4,5,} },
+ new Row1 { idx=3, Uid = Guid.NewGuid(), Name = "Emilia Thibert", Email = "emilia@somewhere.com", Age = 67 , Active = false, A=0.1, Price = 10.3M, S = 1.3F, X = 1244, Stuff=new byte[]{0,1,2,3,4,5,} },
+ new Row1 {idx=3, Uid = Guid.NewGuid(), Name = "Allyson Schurr", Email = "allyson@somewhere.com", Age = 21 , Active = true, A=0.1, Price = 10.3M, S = 1.3F, X = 1244, Stuff=new byte[]{0,1,2,3,4,5,} },
+ };
+
+ /// <summary>
+ /// 1) nazwy w CQL3 są caseinsensitive (w CQL sa casesensitive) -> problem z Create, Delete
+ /// 2) keyspace name is noncasesensitive
+ /// 3) count() - not supported
+ /// 4) token(),Skip() - not supported - no pageing
+ /// 5) cassandra boolena true, false => 'true', 'false'
+ /// </summary>
+
+ [Fact]
+ public void TestLinq_InsertSelectDelete()
+ {
+ _db.ExecuteNonQuery(Tools.GetCreateCQL(typeof(Row1)));
+ foreach (var u in Users)
+ _db.ExecuteNonQuery(Tools.GetInsertCQL(u));
+
+ var query = (from u in _db.GetColumnFamily(typeof(Row1).Name) select u);
+ string Cql = query.ToString();
+
+ var all = (query).ToList();
+
+ var allL = (from u in all select Tools.GetRowFromCqlRow<Row1>(u)).ToList();
+
+ foreach (var a in allL)
+ {
+ _db.ExecuteNonQuery(Tools.GetDeleteCQL(a));
+ }
+ }
+
+ [Fact]
+ public void TestLinq_SelectCount()
+ {
+ _db.ExecuteNonQuery(Tools.GetCreateCQL(typeof(Row1)));
+ foreach (var u in Users)
+ _db.ExecuteNonQuery(Tools.GetInsertCQL(u));
+
+ var cnt = (from u in _db.GetColumnFamily(typeof(Row1).Name) select u).Count();
+
+ Assert.Equal(Users.Count(), cnt);
+ }
+
+
+ [Fact]
+ public void TestLinq_OrderBy()
+ {
+ _db.ExecuteNonQuery(Tools.GetCreateCQL(typeof(Row1)));
+ foreach (var u in Users)
+ _db.ExecuteNonQuery(Tools.GetInsertCQL(u));
+
+ {
+ var query = (from u in _db.GetColumnFamily(typeof(Row1).Name) where u["idx"] == 3 select u).OrderBy(u => u["Name"]);
+ string Cql = query.ToString();
+
+ var all = (query).ToList();
+ var allL = (from u in all select Tools.GetRowFromCqlRow<Row1>(u)).ToList();
+ for (int i = 1; i < allL.Count - 1; i++)
+ {
+ Assert.InRange(allL[i].Name, allL[i-1].Name, allL[i + 1].Name);
+ }
+ }
+
+ {
+ var query = (from u in _db.GetColumnFamily(typeof(Row1).Name) where u["idx"] == 3 select u).OrderByDescending(u => u["Name"]);
+ string Cql = query.ToString();
+
+ var all = (query).ToList();
+ var allL = (from u in all select Tools.GetRowFromCqlRow<Row1>(u)).ToList();
+ for (int i = 1; i < allL.Count-1; i++)
+ {
+ Assert.InRange(allL[i].Name, allL[i + 1].Name, allL[i - 1].Name);
+ }
+ }
+ }
+
+ [Fact]
+ public void TestLinq_SelectIn()
+ {
+ _db.ExecuteNonQuery(Tools.GetCreateCQL(typeof(Row1)));
+ foreach (var u in Users)
+ _db.ExecuteNonQuery(Tools.GetInsertCQL(u));
+
+ int[] myInts = { 1, 2 };
+
+ var query2 = (from u in _db.GetColumnFamily(typeof(Row1).Name) where myInts.Contains(u["idx"]) select u);
+ string Cql2 = query2.ToString();
+
+ var all = (query2).ToList();
+
+ var allL = (from u in all select Tools.GetRowFromCqlRow<Row1>(u)).ToList();
+
+ foreach (var a in allL)
+ {
+ Assert.Contains(a.idx, myInts);
+ }
+ }
+
+ [Fact]
+ public void TestLinq_SelectTake()
+ {
+ _db.ExecuteNonQuery(Tools.GetCreateCQL(typeof(Row1)));
+ foreach (var u in Users)
+ _db.ExecuteNonQuery(Tools.GetInsertCQL(u));
+
+ var query3 = (from u in _db.GetColumnFamily(typeof(Row1).Name) select u).Take(2);
+ string Cql3 = query3.ToString();
+
+ var all = (query3).ToList();
+
+ Assert.Equal(2, all.Count);
+ }
+
+ }
+}
View
84 test/FluentCassandra.Tests/Operations/Cql3Test.cs
@@ -0,0 +1,84 @@
+using System;
+using System.Linq;
+using FluentCassandra.Connections;
+using Xunit;
+
+namespace FluentCassandra.Operations
+{
+ /// <summary>
+ /// Basic fluent-cassandra support for CQL3
+ /// Composite keys/Count
+ /// </summary>
+ public class Cql3Test : IUseFixture<CassandraCql3DatabaseSetupFixture>, IDisposable
+ {
+ private CassandraContext _db;
+
+ public void SetFixture(CassandraCql3DatabaseSetupFixture data)
+ {
+ var setup = data.DatabaseSetup();
+ _db = setup.DB;
+ }
+
+ public void Dispose()
+ {
+ _db.Dispose();
+ }
+
+ [Fact]
+ public void TestOverwritingOfUsersOnPrimaryKeys()
+ {
+ // arrange
+ var insertQuery = @"INSERT INTO users (Id, Name, Email, Age) VALUES (23, '" + new String('X', 200) + "', 'test@test.com', 43)";
+ var insertQuery2 = @"INSERT INTO users (Id, Name, Email, Age) VALUES (23, '" + new String('Y', 200) + "', 'test@test.com', 53)";
+
+ // act
+ _db.ExecuteNonQuery(insertQuery);
+ _db.ExecuteNonQuery(insertQuery2);
+ var actual = _db.ExecuteQuery("SELECT * FROM users");
+
+ // assert
+ Assert.Equal(6, actual.Count());
+ }
+
+ [Fact]
+ public void TestLinq()
+ {
+ // arrange
+ var insertQuery = @"INSERT INTO users (Id, Name, Email, Age) VALUES (23, '" + new String('X', 200) + "', 'test@test.com', 43)";
+
+ // act
+ _db.ExecuteNonQuery(insertQuery);
+
+ var table = _db.GetColumnFamily("users");
+
+ var q = from row in table select row;
+
+ var actual = q.ToList();
+
+ // assert
+ Assert.Equal(6, actual.Count());
+ }
+
+ /// <summary>
+ /// Count() is not woriking
+ /// </summary>
+ [Fact]
+ public void TestLinq_CountDoNotWork()
+ {
+ // arrange
+ var insertQuery = @"INSERT INTO users (Id, Name, Email, Age) VALUES (23, '" + new String('X', 200) + "', 'test@test.com', 43)";
+
+ // act
+ _db.ExecuteNonQuery(insertQuery);
+
+ var table = _db.GetColumnFamily("users");
+
+ var q = from row in table select row;
+
+ var actualCount = q.Count();
+
+ // assert
+ Assert.Equal(6, actualCount);
+ }
+ }
+}
View
83 test/FluentCassandra.Tests/Operations/Cql3vs2CompatibilityTest.cs
@@ -0,0 +1,83 @@
+using System;
+using System.Linq;
+using FluentCassandra.Connections;
+using Xunit;
+
+namespace FluentCassandra.Operations
+{
+ /// <summary>
+ /// The purpose of this test is to check compatibility beetween CQL2 and CQL3 support in Cassandra
+ /// We fouund out that case-insensitivity in CQL3 column names generates problems when used together with CQL2 column family supoort
+ /// </summary>
+ public class Cql3vs2CompatibilityTest : IUseFixture<CompatibilityCassandraDatabaseSetupFixture>, IDisposable
+ {
+ private CassandraContext _db;
+ CompatibilityCassandraDatabaseSetupFixture _data;
+
+ public void SetFixture(CompatibilityCassandraDatabaseSetupFixture data)
+ {
+ _data = data;
+ }
+
+
+ public void Dispose()
+ {
+ _db.Dispose();
+ }
+
+ private void Common(CompatibilityCassandraDatabaseSetup setup)
+ {
+ _db = setup.DB;
+
+ // arrange
+ var insertQuery = @"INSERT INTO users (Id, Name, Email, Age) VALUES (23, '" + new String('X', 200) + "', 'test@test.com', 43)";
+
+ // act
+ _db.ExecuteNonQuery(insertQuery);
+ var actual = _db.ExecuteQuery("SELECT * FROM users");
+
+ // assert
+ Assert.Equal(6, actual.Count());
+ }
+
+
+ /// <summary>
+ /// Bug 1 - both are case sensitive (column names & dynamic fields)
+ /// </summary>
+ [Fact]
+ public void IgnoreCase1()
+ {
+ var setup = _data.DatabaseSetup(null,false,false);
+ Common(setup);
+ }
+ /// <summary>
+ /// Bug 2 - column names are case sensitive
+ /// </summary>
+ [Fact]
+ public void IgnoreCase2()
+ {
+ var setup = _data.DatabaseSetup(null,true,false);
+ Common(setup);
+ }
+
+ /// <summary>
+ /// Bug 3 - dynamic fields names are case sensitive
+ /// </summary>
+ [Fact]
+ public void IgnoreCase3()
+ {
+ var setup = _data.DatabaseSetup(null,false, true);
+ Common(setup);
+ }
+
+ /// <summary>
+ /// Only this one is ok column names are case-sensitives & dynamic fields are lover cased
+ /// </summary>
+ [Fact]
+ public void IgnoreCase4()
+ {
+ var setup = _data.DatabaseSetup(null, true, true);
+ Common(setup);
+ }
+ }
+}
View
1  test/FluentCassandra.Tests/app.config
@@ -4,5 +4,6 @@
<add key="TestServer" value="localhost"></add>
<add key="TestPort" value="9160"></add>
<add key="TestKeySpace" value="Testing"></add>
+ <add key="TestKeySpaceCql3" value="testingcql3"></add>
</appSettings>
</configuration>
Please sign in to comment.
Something went wrong with that request. Please try again.