/* * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ /* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch 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 'java-library' id "io.freefair.lombok" id 'jacoco' id 'info.solidsoft.pitest' version '1.9.0' id 'java-test-fixtures' } repositories { mavenCentral() } pitest { targetClasses = ['org.opensearch.sql.*'] pitestVersion = '1.9.0' threads = 4 outputFormats = ['HTML', 'XML'] timestampedReports = false junit5PluginVersion = '1.0.0' } dependencies { api group: 'com.google.guava', name: 'guava', version: '32.0.1-jre' api group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0' api group: 'com.facebook.presto', name: 'presto-matching', version: '0.240' api group: 'org.apache.commons', name: 'commons-math3', version: '3.6.1' api "com.fasterxml.jackson.core:jackson-core:${versions.jackson}" api "com.fasterxml.jackson.core:jackson-databind:${versions.jackson_databind}" api "com.fasterxml.jackson.core:jackson-annotations:${versions.jackson}" api group: 'com.google.code.gson', name: 'gson', version: '2.8.9' api project(':common') testImplementation('org.junit.jupiter:junit-jupiter:5.6.2') testImplementation group: 'org.hamcrest', name: 'hamcrest-library', version: '2.1' testImplementation group: 'org.mockito', name: 'mockito-core', version: '3.12.4' testImplementation group: 'org.mockito', name: 'mockito-inline', version: '3.12.4' testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '3.12.4' } test { useJUnitPlatform() testLogging { events "skipped", "failed" exceptionFormat "full" } } jacocoTestReport { reports { html.enabled true xml.enabled true } afterEvaluate { classDirectories.setFrom(files(classDirectories.files.collect { fileTree(dir: it, exclude: ['**/ast/**', '**/datasource/model/**']) })) } } test.finalizedBy(project.tasks.jacocoTestReport) jacocoTestCoverageVerification { violationRules { rule { element = 'CLASS' excludes = [ 'org.opensearch.sql.utils.MLCommonsConstants', 'org.opensearch.sql.utils.Constants', 'org.opensearch.sql.datasource.model.*' ] limit { counter = 'LINE' minimum = 1.0 } limit { counter = 'BRANCH' minimum = 1.0 } } } afterEvaluate { classDirectories.setFrom(files(classDirectories.files.collect { fileTree(dir: it, exclude: ['**/ast/**']) })) } } check.dependsOn jacocoTestCoverageVerification