public void NoInput()
 {
     InsertCommand cmd = new InsertCommand();
     try
     {
         using (IAquilesConnection connection = AquilesHelper.RetrieveConnection("Keyspace1"))
         {
             connection.Execute(cmd);
         }
         Assert.Fail();
     }
     catch (AquilesCommandParameterException)
     {
         // this is supposed to happen
     }
 }
 public void NotExistingColumnFamily()
 {
     InsertCommand cmd = new InsertCommand();
     cmd.KeySpace = "Keyspace1";
     cmd.ColumnFamily = "Standard12";
     cmd.Key = "test";
     cmd.Column = new Aquiles.Model.AquilesColumn() { ColumnName = "zarasa", Value = "zarasa" };
     try
     {
         using (IAquilesConnection connection = AquilesHelper.RetrieveConnection("Keyspace1"))
         {
             connection.Execute(cmd);
         }
         Assert.Fail();
     }
     catch (AquilesCommandParameterException)
     {
         // this is supposed to happen
     }
 }
 public void OnlyKeySpaceColumnFamilyKeyColumnForcingNullAsColumnValue()
 {
     InsertCommand cmd = new InsertCommand();
     cmd.KeySpace = "Keyspace1";
     cmd.ColumnFamily = "Standard1";
     cmd.Key = "zarasa";
     cmd.Column = new Aquiles.Model.AquilesColumn()
     {
         ColumnName = "columnName",
         Value = null
     };
     try
     {
         using (IAquilesConnection connection = AquilesHelper.RetrieveConnection("Keyspace1"))
         {
             connection.Execute(cmd);
         }
         Assert.Fail();
     }
     catch (AquilesCommandParameterException)
     {
         // this is supposed to happen
     }
 }
 public void OnlyKeySpaceColmnFamilyKey()
 {
     InsertCommand cmd = new InsertCommand();
     cmd.KeySpace = "Keyspace1";
     cmd.ColumnFamily = "Standard1";
     cmd.Key = "zarasa";
     try
     {
         using (IAquilesConnection connection = AquilesHelper.RetrieveConnection("Keyspace1"))
         {
             connection.Execute(cmd);
         }
         Assert.Fail();
     }
     catch (AquilesCommandParameterException)
     {
         // this is supposed to happen
     }
 }
 public void OnlyColumn()
 {
     InsertCommand cmd = new InsertCommand();
     cmd.Column = new Aquiles.Model.AquilesColumn()
     {
         ColumnName = "columnName"
     };
     try
     {
         using (IAquilesConnection connection = AquilesHelper.RetrieveConnection("Keyspace1"))
         {
             connection.Execute(cmd);
         }
         Assert.Fail();
     }
     catch (AquilesCommandParameterException)
     {
         // this is supposed to happen
     }
 }
示例#6
0
        private static void DoTestInsertDeleteAndGetOnSameConnection(string columnFamily, string keyspace, string key, string columnName, string columnValue)
        {
            // Insert statement
            InsertCommand insertCommand = new InsertCommand();
            insertCommand.KeySpace = keyspace;
            insertCommand.ColumnFamily = columnFamily;
            insertCommand.Key = key;
            insertCommand.Column = new Aquiles.Model.AquilesColumn()
            {
                ColumnName = columnName,
                Value = columnValue
            };

            // Get statement

            GetCommand getCommand = new GetCommand();
            getCommand.KeySpace = keyspace;
            getCommand.Key = key;
            getCommand.ColumnFamily = columnFamily;
            getCommand.ColumnName = columnName;

            //Delete statement
            DeleteCommand delCommand = new DeleteCommand();
            delCommand.KeySpace = keyspace;
            delCommand.Key = key;
            delCommand.ColumnFamily = columnFamily;

            using (IAquilesConnection connection = AquilesHelper.RetrieveConnection("Keyspace1"))
            {
                connection.Open();

                connection.Execute(insertCommand);
                connection.Execute(getCommand);

                GetCommand.Out output = getCommand.Output;

                Assert.IsNotNull(output);
                Assert.IsNotNull(output.Column);
                Assert.IsTrue(columnName.CompareTo(output.Column.ColumnName) == 0);
                Assert.IsTrue(columnValue.CompareTo(output.Column.Value) == 0);

                delCommand.Column = output.Column;

                connection.Execute(delCommand);

                connection.Execute(getCommand);

                connection.Close();

                Assert.IsNull(getCommand.Output);
            }
        }
示例#7
0
        private static void DoInsertDeleteAndGetOnDifferenteConnections(string columnFamily, string keyspace, string key, string columnName, string columnValue)
        {
            // Insert statement
            InsertCommand insertCommand = new InsertCommand();
            insertCommand.KeySpace = keyspace;
            insertCommand.ColumnFamily = columnFamily;
            insertCommand.Key = key;
            insertCommand.Column = new Aquiles.Model.AquilesColumn()
            {
                ColumnName = columnName,
                Value = columnValue
            };

            using (IAquilesConnection connection = AquilesHelper.RetrieveConnection("Keyspace1"))
            {
                connection.Execute(insertCommand);
            }

            // Get statement

            GetCommand getCommand = new GetCommand();
            getCommand.KeySpace = keyspace;
            getCommand.Key = key;
            getCommand.ColumnFamily = columnFamily;
            getCommand.ColumnName = columnName;

            using (IAquilesConnection connection = AquilesHelper.RetrieveConnection("Keyspace1"))
            {
                connection.Execute(getCommand);
            }

            GetCommand.Out output = getCommand.Output;

            Assert.IsNotNull(output);
            Assert.IsNotNull(output.Column);
            Assert.IsTrue(columnName.CompareTo(output.Column.ColumnName) == 0);
            Assert.IsTrue(columnValue.CompareTo(output.Column.Value) == 0);

            //Delete statement
            DeleteCommand delCommand = new DeleteCommand();
            delCommand.KeySpace = keyspace;
            delCommand.Key = key;
            delCommand.ColumnFamily = columnFamily;
            delCommand.Column = output.Column;
            using (IAquilesConnection connection = AquilesHelper.RetrieveConnection("Keyspace1"))
            {
                connection.Execute(delCommand);
            }

            // get statement to see if it was actually deleted (get is already created, then i am reusing)
            using (IAquilesConnection connection = AquilesHelper.RetrieveConnection("Keyspace1"))
            {
                connection.Execute(getCommand);
            }

            Assert.IsNull(getCommand.Output);
        }