Skip to content

Instantly share code, notes, and snippets.

@markmo
Created March 13, 2016 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markmo/2a6e3e22266ca51a6aef to your computer and use it in GitHub Desktop.
Save markmo/2a6e3e22266ca51a6aef to your computer and use it in GitHub Desktop.
StarSpec
import com.typesafe.config.ConfigFactory
import star.io.{JdbcReader, Reader}
import star.{Loader, StarConfig}
/**
* Created by markmo on 12/03/2016.
*/
class StarSpec extends UnitSpec {
val starConf = new StarConfig(ConfigFactory.load("star.conf"))
@transient var jdbcReader: Reader = _
@transient var loader: Loader = _
override def beforeAll(): Unit = {
super.beforeAll()
jdbcReader = new JdbcReader()(sqlContext, starConf)
loader = new Loader()(sqlContext, starConf)
sqlContext.sql("create schema if not exists itam")
}
"Star Loader" should "dimensionalize a denormalized source" in {
val source = "PABLO_DWH.T0200_ITAM_INCIDENTS_DH_NEW"
val df = jdbcReader.read(source)
val (dimFields, attrs) = starConf.dims(source)(4)
loader.loadDim(df, dimFields, attrs, "test", "test", source)
val dimCount = sqlContext.sql("select count(*) from itam.dim_priority").first()(0)
dimCount should be (4)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment