/*
 * 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.
 */

plugins {
  id 'standard-subproject-configuration'
  id 'geode-publish-java'
  id 'warnings'
}

evaluationDependsOn(":geode-core")


configurations {
  //Configuration used to download mysql jar
  jdbcTestingJars
}
def jdbcJarsDir = "$buildDir/generated-resources/jdbcJars"
sourceSets {
  distributedTest {
    resources {
      srcDirs jdbcJarsDir
    }
    output.dir(jdbcJarsDir, builtBy: 'downloadJdbcJars')
  }
}
task downloadJdbcJars(type:Copy) {
  inputs.files(configurations.jdbcTestingJars)
  from {configurations.jdbcTestingJars}
  into jdbcJarsDir
  outputs.dir(jdbcJarsDir)
}

tasks.matching { it.name == 'processDistributedTestResources' }.configureEach {
  dependsOn(downloadJdbcJars)
}

dependencies {
  api(platform(project(':boms:geode-all-bom')))

  implementation(project(':geode-logging'))
  implementation(project(':geode-serialization'))
  implementation(project(':geode-core'))
  implementation(project(':geode-gfsh'))
  implementation('org.apache.httpcomponents:httpcore')
  implementation('com.fasterxml.jackson.core:jackson-databind')

  testImplementation(project(':geode-membership'))
  testImplementation(project(':geode-junit')) {
    exclude module: 'geode-core'
  }
  integrationTestImplementation(project(':geode-dunit')) {
    exclude module: 'geode-core'
  }
  integrationTestImplementation(project(':geode-junit')) {
    exclude module: 'geode-core'
  }
  distributedTestImplementation(project(':geode-junit')) {
    exclude module: 'geode-core'
  }
  distributedTestImplementation(project(':geode-dunit')){
    exclude module: 'geode-core'
  }
  acceptanceTestImplementation(project(':geode-dunit')) {
    exclude module: 'geode-core'
  }
  acceptanceTestImplementation(project(':geode-junit')) {
    exclude module: 'geode-core'
  }

  implementation('com.zaxxer:HikariCP')
  implementation('org.apache.commons:commons-lang3')
  implementation('javax.xml.bind:jaxb-api')
  implementation('org.apache.logging.log4j:log4j-api')
  implementation('org.apache.logging.log4j:log4j-jcl') {
    ext.optional = true
  }
  implementation('org.springframework.shell:spring-shell') {
    exclude module: 'aopalliance'
    exclude module: 'asm'
    exclude module: 'cglib'
    exclude module: 'guava'
    exclude module: 'spring-aop'
    exclude module: 'spring-context-support'
    exclude module: 'spring-core'
    ext.optional = true
  }
  implementation('com.healthmarketscience.rmiio:rmiio')

  testImplementation('pl.pragmatists:JUnitParams')

  integrationTestImplementation('junit:junit')
  integrationTestImplementation('org.assertj:assertj-core')
  integrationTestImplementation('pl.pragmatists:JUnitParams')

  distributedTestImplementation('junit:junit')
  distributedTestImplementation('org.assertj:assertj-core')
  distributedTestImplementation('org.mockito:mockito-core')
  distributedTestImplementation('pl.pragmatists:JUnitParams')
  distributedTestRuntimeOnly('org.apache.derby:derby')

  acceptanceTestImplementation('com.github.stefanbirkner:system-rules') {
    exclude module: 'junit-dep'
  }
  acceptanceTestImplementation('junit:junit')
  acceptanceTestImplementation('org.assertj:assertj-core')
  acceptanceTestImplementation('org.awaitility:awaitility')
  acceptanceTestImplementation('org.mockito:mockito-core')
  acceptanceTestImplementation('pl.pragmatists:JUnitParams')
  acceptanceTestImplementation('org.testcontainers:testcontainers')

  acceptanceTestRuntimeOnly('mysql:mysql-connector-java')
  acceptanceTestRuntimeOnly('org.apache.derby:derby')
  acceptanceTestRuntimeOnly('org.postgresql:postgresql')

  jdbcTestingJars('mysql:mysql-connector-java:8.0.28')
}

integrationTest.forkEvery 0
