<commit_before>package com.bwsw.cloudstack.pulse.ut.models

import com.bwsw.cloudstack.pulse.models.DiskInfluxModel
import org.scalatest.{FlatSpec, Matchers}

/**
  * Created by <NAME> on 27.07.17.
  */
class DiskInfluxModelTests extends FlatSpec with Matchers {
  it should "Build correct expression" in {
    val model = new DiskInfluxModel
    val expr = model.prepareQuery(Map("aggregation" -> "1h", "shift" -> "0h", "range" -> "1d",
      "uuid" -> "550e8400-e29b-41d4-a716-446655440000", "diskUuid" -> "550e8400-e29b-41d4-a716-446655441111"))
    val expectedValue = """SELECT NON_NEGATIVE_DERIVATIVE(MEAN("readIOPS"), 1h) / 3600 AS readIOPS, """ +
      """NON_NEGATIVE_DERIVATIVE(MEAN("ioErrors"), 1h) / 3600 AS ioErrors, """ +
      """NON_NEGATIVE_DERIVATIVE(MEAN("readBytes"), 1h) / 3600 AS readBytes, """ +
      """NON_NEGATIVE_DERIVATIVE(MEAN("writeBytes"), 1h) / 3600 AS writeBytes, """ +
      """NON_NEGATIVE_DERIVATIVE(MEAN("writeIOPS"), 1h) / 3600 AS writeIOPS """ +
      """FROM "disk" WHERE "vmUuid" = '550e8400-e29b-41d4-a716-446655440000' AND """ +
      """"image" = '550e8400-e29b-41d4-a716-446655441111' AND time > now() - 1d - 0h AND time < now() - 0h GROUP BY time(1h)"""

    expr shouldBe expectedValue
  }
}<commit_msg>Implemented DiskInfluxModelTests.<commit_after>package com.bwsw.cloudstack.pulse.ut.models

import com.bwsw.cloudstack.pulse.models.DiskInfluxModel
import org.scalatest.{FlatSpec, Matchers}

/**
  * Created by <NAME> on 27.07.17.
  */
class DiskInfluxModelTests extends FlatSpec with Matchers {
  it should "Build correct expression" in {
    val model = new DiskInfluxModel
    val expr = model.prepareQuery(Map("aggregation" -> "1h", "shift" -> "0h", "range" -> "1d",
      "uuid" -> "550e8400-e29b-41d4-a716-446655440000", "diskUuid" -> "550e8400-e29b-41d4-a716-446655441111"))

    val expectedValue = """SELECT NON_NEGATIVE_DERIVATIVE(MEAN("readIOPS"), 1h) / 3600 AS readIOPS, """ +
      """NON_NEGATIVE_DERIVATIVE(MEAN("ioErrors"), 1h) / 3600 AS ioErrors, """ +
      """NON_NEGATIVE_DERIVATIVE(MEAN("readBytes"), 1h) / 3600 AS readBytes, """ +
      """NON_NEGATIVE_DERIVATIVE(MEAN("writeBytes"), 1h) / 3600 AS writeBytes, """ +
      """NON_NEGATIVE_DERIVATIVE(MEAN("writeIOPS"), 1h) / 3600 AS writeIOPS """ +
      """FROM "disk" WHERE "vmUuid" = '550e8400-e29b-41d4-a716-446655440000' AND """ +
      """"image" = '550e8400-e29b-41d4-a716-446655441111' AND time > now() - 1d - 0h AND time < now() - 0h GROUP BY time(1h)"""

    expr shouldBe expectedValue
  }
}
{'fraction_non_alphanumeric': 0.16527942925089179, 'fraction_numerical': 0.11573523583036067, 'mean_word_length': 4.109311740890688, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, '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': '6081706', 'n_tokens_mistral': 1194, 'n_tokens_neox': 965, 'n_words': 183}