/*
 * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
 * or more contributor license agreements. Licensed under the Elastic License
 * 2.0; you may not use this file except in compliance with the Elastic License
 * 2.0.
 */

apply plugin: 'elasticsearch.internal-java-rest-test'
apply plugin: 'elasticsearch.rest-resources'
apply plugin: 'elasticsearch.internal-available-ports'

configurations {
  javaRestTestRuntimeClasspath {
    attributes {
      attribute(Attribute.of('hdfs.major.version', Integer), 2)
    }
  }
}

dependencies {
  clusterPlugins project(':plugins:repository-hdfs')
  javaRestTestImplementation(testArtifact(project(xpackModule('searchable-snapshots'))))
  javaRestTestCompileOnly project(path: ':test:fixtures:hdfs-fixture')
  javaRestTestRuntimeOnly project(path: ':test:fixtures:hdfs-fixture')
  javaRestTestImplementation project(':test:fixtures:krb5kdc-fixture')
  javaRestTestRuntimeOnly "com.google.guava:guava:16.0.1"
  javaRestTestRuntimeOnly "commons-cli:commons-cli:1.2"
}

restResources {
  restApi {
    include 'indices', 'search', 'bulk', 'snapshot', 'nodes', '_common', 'searchable_snapshots'
  }
}

tasks.named("javaRestTest").configure {
  usesDefaultDistribution("to be triaged")
  buildParams.withFipsEnabledOnly(it)
  jvmArgs '--add-exports', 'java.security.jgss/sun.security.krb5=ALL-UNNAMED'
}
