Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tag: v1.0
Fetching contributors…

Cannot retrieve contributors at this time

file 50 lines (38 sloc) 1.636 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
package com.shorrockin.cascal

import model.Column
import org.junit.{Assert, Test}
import java.util.Date
import session.{ColumnPredicate, RangePredicate}
import utils.{Conversions, Logging}

class TestStandardInesrtAndList extends CassandraTestPool with Logging {
  import Assert._
  import Conversions._

  @Test def testStandardFunctions = borrow { (session) =>
    import session._

    log.debug("Cluster Name: " + clusterName)
    log.debug("Version: " + version)
    log.debug("Keyspaces: " + keyspaces.mkString("", ",", ""))

    val family = "Test" \ "Standard"
    val key = family \ "testStandardFunctions"

    insert(key \ "Column-1" \ "Value-1")
    insert(key \ "Column-2" \ "Value-2")
    insert(key \ "Column-3" \ "Value-3")
    insert(key \ "Column-4" \ "Value-4")

    val column = get(key \ "Column-1")
    assertNotNull(column)
    assertEquals("Value-1", string(column.get.value))
    assertEquals("Column-1", string(column.get.name))
    log.debug("get 'Column-1' returned: " + string(column.get))

    val columnCount = count(key)
    assertEquals(4, columnCount)

    var columns = list(key)
    assertEquals(4, columns.size)
    columns.foreach { (c) => log.debug("list(key) returned column: " + string(c)) }

    columns = list(key, RangePredicate("Column-1", "Column-3"))
    assertEquals(3, columns.size)
    columns.foreach { (c) => log.debug("list(key, range) returned column: " + string(c)) }

    columns = list(key, ColumnPredicate(List("Column-1", "Column-3")))
    assertEquals(2, columns.size)
    columns.foreach { (c) => log.debug("list(key, columns) returned column: " + string(c)) }
  }

}
Something went wrong with that request. Please try again.