Skip to content

Commit

Permalink
Make the plugin compatible with 2.x.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Feb 29, 2024
1 parent c683a9a commit 8fc700c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Build a distribution.
./gradlew assemble
```

This produces `./build/distributions/opensearch-api-3.0.0.0-SNAPSHOT.zip`.
This produces `./build/distributions/opensearch-api-2.12.0.0-SNAPSHOT.zip`.

### Install

Expand All @@ -21,7 +21,7 @@ Check out OpenSearch code, run it once with `./gradlew run`.
Install the plugin, you may need to adjust `darwin-arm64-tar` below to your platform, and use the location of your plugin zip (mine is `~/source/opensearch-project/opensearch-api/dblock-opensearch-api`).

```sh
$ ./distribution/archives/darwin-arm64-tar/build/install/opensearch-3.0.0-SNAPSHOT/bin/opensearch-plugin install file:///Users/dblock/source/opensearch-project/opensearch-api/dblock-opensearch-api/build/distributions/opensearch-api-3.0.0.0-SNAPSHOT.zip
$ ./distribution/archives/darwin-arm64-tar/build/install/opensearch-2.12.0-SNAPSHOT/bin/opensearch-plugin install file:///Users/dblock/source/opensearch-project/opensearch-api/dblock-opensearch-api/build/distributions/opensearch-api-2.12.0.0-SNAPSHOT.zip

-> Installed opensearch-api with folder name opensearch-api
```
Expand All @@ -46,7 +46,7 @@ Returns an OpenAPI spec.
"info": {
"title": "opensearch",
"description": "The OpenSearch Project: https://opensearch.org/",
"version": "3.0.0-SNAPSHOT"
"version": "2.12.0-SNAPSHOT"
},
...
}
Expand All @@ -55,7 +55,7 @@ Returns an OpenAPI spec.
### Uninstall

```sh
./distribution/archives/darwin-arm64-tar/build/install/opensearch-3.0.0-SNAPSHOT/bin/opensearch-plugin remove opensearch-api
./distribution/archives/darwin-arm64-tar/build/install/opensearch-2.12.0-SNAPSHOT/bin/opensearch-plugin remove opensearch-api

-> removing [opensearch-api]...
```
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def pluginClassName = 'APIPlugin'

buildscript {
ext {
opensearch_version = System.getProperty("opensearch.version", "3.0.0-SNAPSHOT")
opensearch_version = System.getProperty("opensearch.version", "2.12.0-SNAPSHOT")
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
}

Expand Down
9 changes: 4 additions & 5 deletions src/test/java/org/opensearch/plugin/api/APIPluginIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope;

import org.apache.hc.core5.http.ParseException;
import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.apache.http.util.EntityUtils;
import org.opensearch.client.Request;
import org.opensearch.client.Response;
import org.opensearch.plugins.Plugin;
Expand All @@ -30,15 +29,15 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {
return Collections.singletonList(APIPlugin.class);
}

public void testPluginInstalled() throws IOException, ParseException {
public void testPluginInstalled() throws IOException {
Response response = getRestClient().performRequest(new Request("GET", "/_cat/plugins"));
String body = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);

logger.info("response body: {}", body.toString());
logger.info("response body: {}", body);
assertTrue(body.contains("api"));
}

public void testPluginGetAPI() throws IOException, ParseException {
public void testPluginGetAPI() throws IOException {
Response response = getRestClient().performRequest(new Request("GET", "/_plugins/api"));
String body = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
logger.info("response body: {}", body);
Expand Down

0 comments on commit 8fc700c

Please sign in to comment.