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

import org.elasticsearch.gradle.util.GradleUtils

apply plugin: 'elasticsearch.base-internal-es-plugin'
apply plugin: 'elasticsearch.legacy-java-rest-test'

esplugin {
  description = 'Deprecated query plugin'
  classname ='org.elasticsearch.xpack.deprecation.TestDeprecationPlugin'
}

dependencies {
  javaRestTestImplementation project(path: ':x-pack:plugin:deprecation:qa:common')
  javaRestTestImplementation("com.fasterxml.jackson.core:jackson-annotations:${versions.jackson}")
  javaRestTestImplementation("com.fasterxml.jackson.core:jackson-databind:${versions.jackson}")
}

// let the javaRestTest see the classpath of main
GradleUtils.extendSourceSet(project, "main", "javaRestTest", tasks.named("javaRestTest"))

restResources {
  restApi {
    include '_common', 'indices', 'index'
  }
}

testClusters.configureEach {
  testDistribution = 'DEFAULT'
  setting 'cluster.deprecation_indexing.enabled', 'true'
  setting 'cluster.deprecation_indexing.flush_interval', '100ms'
  setting 'xpack.security.enabled', 'false'
  setting 'xpack.license.self_generated.type', 'trial'
}

// Test clusters run with security disabled
tasks.named("javaRestTest") {
  buildParams.withFipsEnabledOnly(it)
}
