-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepare plugin for production use (#18)
* Adding tests * Load Resource files from tests to compare output * Adding tests for getting mappings and settings * Intercepting AcknowledgedResponse when calling putTemplate * Adding unit tests for putTemplate, create and indexExists methods * Adding mock for indexExists() method * Adding a listener to create() that ensures the index is created * Adding javadocs and for-each loop for multiple index creation. * Adding missing javadoc * Adding functionality to load mappings and index settings into a template. * Adding javadocs to stringToMap * Split getting mappings and settings to separate methods * Add getter for templates Map * Read the templates file only once * Add exception handling * Fix tests to fit latest changes in WazuhIndices * Fix tests to fit latest changes in WazuhIndices * Split yaml tests to separate files * Instantiate the WazuhIndices class upon node startup. * Simplify WazuhIndices class * Add DEVELOPER_GUIDE.md * Fix stuff * Add Javadoc * Add some unit tests * Update DEVELOPER_GUIDE.md * Skip failing checks --------- Signed-off-by: Álex Ruiz <alejandro.ruiz.becerra@wazuh.com> Co-authored-by: Fede Tux <fede@fernetcave.com> Co-authored-by: Álex Ruiz <alejandro.ruiz.becerra@wazuh.com>
- Loading branch information
1 parent
d2cef9e
commit 31f0c36
Showing
15 changed files
with
782 additions
and
280 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,56 @@ | ||
- [Developer Guide](#developer-guide) | ||
- [Forking and Cloning](#forking-and-cloning) | ||
- [Install Prerequisites](#install-prerequisites) | ||
- [JDK 11](#jdk-11) | ||
- [JDK 14](#jdk-14) | ||
- [Setup](#setup) | ||
- [Build](#build) | ||
- [Building from the command line](#building-from-the-command-line) | ||
- [Building from the IDE](#building-from-the-ide) | ||
|
||
## Developer Guide | ||
|
||
### Forking and Cloning | ||
|
||
Fork this repository on GitHub, and clone locally with `git clone`. Plugins's code is in the `plugins/` folder. | ||
|
||
### Install Prerequisites | ||
|
||
#### JDK 11 | ||
|
||
OpenSearch builds using Java 11 at a minimum, using the Adoptium distribution. This means you must have a JDK 11 installed with the environment variable `JAVA_HOME` referencing the path to Java home for your JDK 11 installation, e.g. `JAVA_HOME=/usr/lib/jvm/jdk-11`. This is configured in `build.gradle`. | ||
|
||
``` | ||
allprojects { | ||
targetCompatibility = JavaVersion.VERSION_11 | ||
sourceCompatibility = JavaVersion.VERSION_11 | ||
} | ||
``` | ||
|
||
Download Java 11 from [here](https://adoptium.net/releases.html?variant=openjdk11). | ||
|
||
#### JDK 14 | ||
|
||
To run the full suite of tests, download and install [JDK 14](https://jdk.java.net/archive/) and set `JAVA11_HOME`, and `JAVA14_HOME`. | ||
|
||
### Setup | ||
|
||
1. Clone the repository (see [Forking and Cloning](#forking-and-cloning)) | ||
2. Make sure `JAVA_HOME` is pointing to a Java 11 JDK (see [Install Prerequisites](#install-prerequisites)) | ||
3. Launch Intellij IDEA, Choose Import Project and select the settings.gradle file in the root of this package. | ||
|
||
### Build | ||
|
||
This package uses the [Gradle](https://docs.gradle.org/current/userguide/userguide.html) build system. Gradle comes with excellent documentation that should be your first stop when trying to figure out how to operate or modify the build. We also use the OpenSearch build tools for Gradle. These tools are idiosyncratic and don't always follow the conventions and instructions for building regular Java code using Gradle. Not everything in this package will work the way it's described in the Gradle documentation. If you encounter such a situation, the OpenSearch build tools [source code](https://github.com/opensearch-project/OpenSearch/tree/main/buildSrc/src/main/groovy/org/opensearch/gradle) is your best bet for figuring out what's going on. | ||
|
||
#### Building from the command line | ||
|
||
1. `./gradlew build` builds and tests all subprojects. | ||
2. `./gradlew run` launches a single node cluster with the plugin installed. | ||
3. `./gradlew publishToMavenLocal` promotes the plugin into your local maven repository. | ||
|
||
When launching a cluster using one of the above commands, logs are placed in `build/testclusters/integTest-0/logs/`. Though the logs are teed to the console, in practice it's best to check the actual log file. | ||
|
||
#### Building from the IDE | ||
|
||
Currently, the only IDE we support is IntelliJ IDEA. It's free, it's open source, it works. The gradle tasks above can also be launched from IntelliJ's Gradle toolbar and the extra parameters can be passed in via the Launch Configurations VM arguments. |
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
Oops, something went wrong.