/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

apply plugin: 'java'

dependencies {
  compile project(":gobblin-api")
  compile project(":gobblin-core")
  compile project(":gobblin-hive-registration")
  compile project(":gobblin-iceberg")
  compile project(":gobblin-metrics-libs:gobblin-metrics")
  compile project(":gobblin-runtime")
  compile project(":gobblin-utility")
  compile project(":gobblin-config-management:gobblin-config-client")
  compile project(":gobblin-config-management:gobblin-config-core")
  compile externalDependency.avro
  compile externalDependency.commonsLang
  compile externalDependency.commonsLang3
  compile externalDependency.guava
  compile externalDependency.slf4j
  compile externalDependency.jodaTime
  compile externalDependency.metricsCore
  compile externalDependency.commonsCodec
  compile externalDependency.commonsCompress
  compile externalDependency.commonsIo
  compile externalDependency.gson
  compile externalDependency.commonsCodec
  compile externalDependency.typesafeConfig
  compile externalDependency.findBugsAnnotations
  compile externalDependency.testng
  compile externalDependency.junit
  compile externalDependency.jacksonMapperAsl

  testCompile(externalDependency.icebergHiveMetastoreTest) {
    transitive = false
  }
  testCompile('org.apache.hadoop:hadoop-common:2.6.0')
  testCompile project(":gobblin-test-utils")
  testCompile project(path: ":gobblin-metastore", configuration: "testFixtures")

  testCompile externalDependency.calciteCore
  testCompile externalDependency.calciteAvatica
  testCompile externalDependency.jhyde
  testCompile externalDependency.joptSimple
  testCompile externalDependency.hamcrest
  testCompile externalDependency.testng
  testCompile externalDependency.hiveJdbc
  testCompile externalDependency.mockito

  testRuntime project(":gobblin-modules:gobblin-crypto-provider") // for GPG
  testCompile project(":gobblin-modules:gobblin-crypto") // for GPG
  testCompile project(path: ":gobblin-modules:gobblin-crypto", configuration: "tests")
}

task testJar(type: Jar, dependsOn: testClasses) {
  baseName = "test-${project.archivesBaseName}"
  from sourceSets.test.output
}

configurations {
  tests
}

configurations {
  compile {
    transitive = true
  }
}

artifacts {
  tests testJar
}

test {
  workingDir rootProject.rootDir
  maxHeapSize = "2g"
  maxParallelForks = 1
  beforeTest { testDescriptor ->
     println String.format("%20s STARTED : %s", new Date(), testDescriptor.getClassName())
  }
  afterTest { testDescriptor, testResult ->
     println String.format("%20s FINISHED: %s %s (%7.3g s)",
                          new Date(), testDescriptor.getClassName(), testResult,
                          (testResult.getEndTime() - testResult.getStartTime())/1000.0)
  }
}

ext.classification="library"

