Created
March 13, 2016 14:07
-
-
Save markmo/2a6e3e22266ca51a6aef to your computer and use it in GitHub Desktop.
StarSpec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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