コード例 #1
0
 public void NoInput()
 {
     GetCommand cmd = new GetCommand();
     try
     {
         using (IAquilesConnection connection = AquilesHelper.RetrieveConnection("Keyspace1"))
         {
             connection.Execute(cmd);
         }
         Assert.Fail();
     }
     catch (AquilesCommandParameterException)
     {
         // this is supposed to happen
     }
 }
コード例 #2
0
 public void NotExistingColumnFamily()
 {
     GetCommand cmd = new GetCommand();
     cmd.KeySpace = "Keyspace1";
     cmd.ColumnFamily = "Standard12";
     cmd.Key = "test";
     try
     {
         using (IAquilesConnection connection = AquilesHelper.RetrieveConnection("Keyspace1"))
         {
             connection.Execute(cmd);
         }
         Assert.Fail();
     }
     catch (AquilesCommandParameterException)
     {
         // this is supposed to happen
     }
 }
コード例 #3
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);
            }
        }
コード例 #4
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);
        }