Skip to content

Commit

Permalink
Add more JavaDocs
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexRuiz7 committed Oct 14, 2024
1 parent 8b60970 commit 3a2147a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;

/**
* Class to manage the Command Manager index and index template.
*/
public class CommandIndex implements IndexingOperationListener {

private static final Logger logger = LogManager.getLogger(CommandIndex.class);
Expand All @@ -53,7 +56,7 @@ public CommandIndex(Client client, ClusterService clusterService, ThreadPool thr
}

/**
* @param command: A Command model object
* @param command A Command model object
* @return A CompletableFuture with the RestStatus response from the operation
*/
public CompletableFuture<RestStatus> asyncCreate(Command command) {
Expand Down Expand Up @@ -95,9 +98,10 @@ public CompletableFuture<RestStatus> asyncCreate(Command command) {
}

/**
* Checks for the existence of the given index template in the cluster.
*
* @param template_name
* @return
* @param template_name index template name within the resources folder
* @return whether the index template exists.
*/
public boolean indexTemplateExists(String template_name) {
Map<String, IndexTemplateMetadata> templates = this.clusterService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,19 @@
import java.security.AccessController;
import java.security.PrivilegedAction;

/**
* Demo class to test the {@link HttpRestClient} class.
*/
public class HttpRestClientDemo {

private static final Logger log = LogManager.getLogger(HttpRestClientDemo.class);

/**
* Demo method to test the {@link HttpRestClient} class.
*
* @param endpoint POST's requests endpoint as a well-formed URI
* @param body POST's request body as a JSON string.
*/
public static void run(String endpoint, String body) {
log.info("Executing POST request");
AccessController.doPrivileged(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import com.wazuh.commandmanager.utils.httpclient.HttpRestClient;
import org.apache.hc.client5.http.async.methods.SimpleHttpResponse;
import org.junit.Assert;
import org.junit.Test;
import org.opensearch.test.OpenSearchTestCase;

import java.net.URI;
Expand Down Expand Up @@ -53,6 +52,9 @@ public void testPost_success() {
}
}

public void testPost_badUri() {}
public void testPost_badPayload() {}
public void testPost_badUri() {
}

public void testPost_badPayload() {
}
}

0 comments on commit 3a2147a

Please sign in to comment.