<commit_before>package com.mindcandy.waterfall.config

import java.util.UUID

import com.github.nscala_time.time.Imports._
import com.mindcandy.waterfall.TestDatabase
import com.mindcandy.waterfall.actor.Protocol.{ DropJob, DropLog }
import com.mindcandy.waterfall.actor.{ LogStatus, TimeFrame }
import org.specs2.specification.Grouped
import org.specs2.specification.script.Specification

import scala.slick.driver
import scala.slick.driver.JdbcDriver.simple._
import scala.slick.jdbc.JdbcBackend.Database.dynamicSession
import scala.slick.jdbc.meta.MTable

trait TestData {

  val oneDropLog = DropLog(
    UUID.fromString("1762d13c-23b4-40fc-a0d0-2fefa1893c72"), 1, new DateTime(2014, 8, 6, 9, 30, DateTimeZone.UTC), None, Some("a test message"), None)
  val oneDropJob = DropJob(
    None, "test", "test", "description", true, "0 2 * * * ?", TimeFrame.DAY_YESTERDAY,
    Map[String, String]("configFile" -> "/adx/config.properties"))
}

class DatabaseContainerSpec
    extends Specification
    with Grouped
    with TestData
    with TestDatabase {

  def is = s2"""
  DB test

  ==============================================================================

    create new database ${createNewDatabase.e1}

    create new database but not overwrite ${createNewDatabaseNotOverwrite.e1}

    insert 1 row into database ${insertToDatabase.e1}
    inserted data is correct ${insertToDatabase.e2}<commit_msg>remove unnecessary change, time zone could be set in JVM '-Duser.timezone=UTC'<commit_after>package com.mindcandy.waterfall.config

import java.util.UUID

import com.mindcandy.waterfall.TestDatabase
import com.mindcandy.waterfall.actor.Protocol.{ DropJob, DropLog }
import com.mindcandy.waterfall.actor.{ LogStatus, TimeFrame }
import org.joda.time.DateTime
import org.specs2.specification.Grouped
import org.specs2.specification.script.Specification

import scala.slick.driver
import scala.slick.driver.JdbcDriver.simple._
import scala.slick.jdbc.JdbcBackend.Database.dynamicSession
import scala.slick.jdbc.meta.MTable

trait TestData {

  val oneDropLog = DropLog(
    UUID.fromString("1762d13c-23b4-40fc-a0d0-2fefa1893c72"), 1, new DateTime(2014, 8, 6, 9, 30), None, Some("a test message"), None)
  val oneDropJob = DropJob(
    None, "test", "test", "description", true, "0 2 * * * ?", TimeFrame.DAY_YESTERDAY,
    Map[String, String]("configFile" -> "/adx/config.properties"))
}

class DatabaseContainerSpec
    extends Specification
    with Grouped
    with TestData
    with TestDatabase {

  def is = s2"""
  DB test

  ==============================================================================

    create new database ${createNewDatabase.e1}

    create new database but not overwrite ${createNewDatabaseNotOverwrite.e1}

    insert 1 row into database ${insertToDatabase.e1}
    inserted data is correct ${insertToDatabase.e2}
{'fraction_non_alphanumeric': 0.15568022440392706, 'fraction_numerical': 0.028050490883590462, 'mean_word_length': 4.9313929313929314, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3437599', 'n_tokens_mistral': 949, 'n_tokens_neox': 888, 'n_words': 204}