-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split repository into separate plugins (#191)
(cherry picked from commit eb77879)
- Loading branch information
1 parent
3050a3c
commit 8131021
Showing
87 changed files
with
313 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
import org.opensearch.gradle.test.RestIntegTestTask | ||
|
||
apply plugin: 'java' | ||
apply plugin: 'idea' | ||
apply plugin: 'opensearch.opensearchplugin' | ||
apply plugin: 'opensearch.yaml-rest-test' | ||
apply plugin: 'jacoco' | ||
|
||
group = 'org.opensearch' | ||
|
||
def pluginName = 'amazon-kendra-intelligent-ranking' | ||
def pluginDescription = 'Rerank search results using Amazon Kendra Intelligent Ranking' | ||
def projectPath = 'org.opensearch' | ||
def pathToPlugin = 'search.relevance' | ||
def pluginClassName = 'AmazonKendraIntelligentRankingPlugin' | ||
|
||
opensearchplugin { | ||
name "opensearch-${pluginName}-${plugin_version}.0" | ||
version "${plugin_version}" | ||
description pluginDescription | ||
classname "${projectPath}.${pathToPlugin}.${pluginClassName}" | ||
licenseFile rootProject.file('LICENSE') | ||
noticeFile rootProject.file('NOTICE') | ||
} | ||
|
||
// This requires an additional Jar not published as part of build-tools | ||
loggerUsageCheck.enabled = false | ||
|
||
// No need to validate pom, as we do not upload to maven/sonatype | ||
validateNebulaPom.enabled = false | ||
|
||
buildscript { | ||
ext { | ||
isSnapshot = "true" == System.getProperty("build.snapshot", "true") | ||
opensearch_version = System.getProperty("opensearch.version", "3.0.0") | ||
plugin_version = opensearch_version | ||
if (isSnapshot) { | ||
opensearch_version += "-SNAPSHOT" | ||
} | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" } | ||
mavenCentral() | ||
maven { url "https://plugins.gradle.org/m2/" } | ||
} | ||
|
||
dependencies { | ||
classpath "org.opensearch.gradle:build-tools:${opensearch_version}" | ||
} | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" } | ||
mavenCentral() | ||
maven { url "https://plugins.gradle.org/m2/" } | ||
} | ||
|
||
dependencies { | ||
implementation 'com.ibm.icu:icu4j:57.2' | ||
implementation 'org.apache.commons:commons-lang3:3.12.0' | ||
implementation 'org.apache.httpcomponents:httpclient:4.5.14' | ||
implementation 'org.apache.httpcomponents:httpcore:4.4.16' | ||
implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.0' | ||
implementation 'com.fasterxml.jackson.core:jackson-core:2.15.2' | ||
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.15.0' | ||
implementation 'commons-logging:commons-logging:1.2' | ||
implementation 'com.amazonaws:aws-java-sdk-sts:1.12.300' | ||
implementation 'com.amazonaws:aws-java-sdk-core:1.12.300' | ||
} | ||
|
||
|
||
allprojects { | ||
plugins.withId('jacoco') { | ||
jacoco.toolVersion = '0.8.9' | ||
} | ||
} | ||
|
||
|
||
test { | ||
include '**/*Tests.class' | ||
finalizedBy jacocoTestReport | ||
} | ||
|
||
task integTest(type: RestIntegTestTask) { | ||
description = "Run tests against a cluster" | ||
testClassesDirs = sourceSets.test.output.classesDirs | ||
classpath = sourceSets.test.runtimeClasspath | ||
} | ||
tasks.named("check").configure { dependsOn(integTest) } | ||
|
||
integTest { | ||
// The --debug-jvm command-line option makes the cluster debuggable; this makes the tests debuggable | ||
if (System.getProperty("test.debug") != null) { | ||
jvmArgs '-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005' | ||
} | ||
} | ||
|
||
testClusters.integTest { | ||
testDistribution = "ARCHIVE" | ||
|
||
// This installs our plugin into the testClusters | ||
plugin(project.tasks.bundlePlugin.archiveFile) | ||
} | ||
|
||
run { | ||
useCluster testClusters.integTest | ||
} | ||
|
||
jacocoTestReport { | ||
dependsOn test | ||
reports { | ||
xml.required = true | ||
html.required = true | ||
} | ||
} | ||
|
||
// TODO: Enable these checks | ||
dependencyLicenses.enabled = false | ||
thirdPartyAudit.enabled = false | ||
loggerUsageCheck.enabled = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
28 changes: 28 additions & 0 deletions
28
...src/test/java/org/opensearch/search/relevance/AmazonKendraIntelligentRankingPluginIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
package org.opensearch.search.relevance; | ||
|
||
import org.apache.hc.core5.http.ParseException; | ||
import org.apache.hc.core5.http.io.entity.EntityUtils; | ||
import org.opensearch.client.Request; | ||
import org.opensearch.client.Response; | ||
import org.opensearch.test.rest.OpenSearchRestTestCase; | ||
|
||
import java.io.IOException; | ||
|
||
public class AmazonKendraIntelligentRankingPluginIT extends OpenSearchRestTestCase { | ||
|
||
public void testPluginInstalled() throws IOException, ParseException { | ||
Response response = client().performRequest(new Request("GET", "/_cat/plugins")); | ||
String body = EntityUtils.toString(response.getEntity()); | ||
|
||
logger.info("response body: {}", body); | ||
assertNotNull(body); | ||
assertTrue(body.contains("amazon-kendra-intelligent-ranking")); | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
26 changes: 26 additions & 0 deletions
26
.../org/opensearch/search/relevance/AmazonKendraIntelligentRankingClientYamlTestSuiteIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
package org.opensearch.search.relevance; | ||
|
||
import com.carrotsearch.randomizedtesting.annotations.Name; | ||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; | ||
import org.opensearch.test.rest.yaml.ClientYamlTestCandidate; | ||
import org.opensearch.test.rest.yaml.OpenSearchClientYamlSuiteTestCase; | ||
|
||
|
||
public class AmazonKendraIntelligentRankingClientYamlTestSuiteIT extends OpenSearchClientYamlSuiteTestCase { | ||
|
||
public AmazonKendraIntelligentRankingClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) { | ||
super(testCandidate); | ||
} | ||
|
||
@ParametersFactory | ||
public static Iterable<Object[]> parameters() throws Exception { | ||
return OpenSearchClientYamlSuiteTestCase.createParameters(); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
amazon-kendra-intelligent-ranking/src/yamlRestTest/resources/rest-api-spec/test/10_basic.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
"Test that the plugin is loaded in OpenSearch": | ||
- do: | ||
cat.plugins: | ||
local: true | ||
h: component | ||
|
||
- match: | ||
$body: /^opensearch-amazon-kendra-intelligent-ranking-\d+.\d+.\d+.\d+\n$/ | ||
|
||
- do: | ||
indices.create: | ||
index: test | ||
|
||
- do: | ||
search: | ||
index: test | ||
body: { } |
Oops, something went wrong.