Skip to content

Commit

Permalink
apply spotless check
Browse files Browse the repository at this point in the history
Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>
  • Loading branch information
kaushalmahi12 committed Jul 1, 2024
1 parent 3dd00c6 commit 7b2c017
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
public class QueryGroupThreadContextStatePropagator implements ThreadContextStatePropagator {
// TODO: move this constant to QueryGroupService class once the QueryGroup monitoring framework PR is ready
public static List<String> PROPAGATED_HEADERS = List.of("queryGroupId");

/**
* @param source current context transient headers
* @return the map of header and their values to be propagated across request threadContexts
Expand All @@ -28,7 +29,7 @@ public class QueryGroupThreadContextStatePropagator implements ThreadContextStat
public Map<String, Object> transients(Map<String, Object> source) {
final Map<String, Object> transientHeaders = new HashMap<>();

for (String headerName: PROPAGATED_HEADERS) {
for (String headerName : PROPAGATED_HEADERS) {
if (source.containsKey(headerName)) {
transientHeaders.put(headerName, source.get(headerName));
}
Expand All @@ -44,7 +45,7 @@ public Map<String, Object> transients(Map<String, Object> source) {
public Map<String, String> headers(Map<String, Object> source) {
final Map<String, String> propagatedHeaders = new HashMap<>();

for (String headerName: PROPAGATED_HEADERS) {
for (String headerName : PROPAGATED_HEADERS) {
if (source.containsKey(headerName)) {
propagatedHeaders.put(headerName, (String) source.get(headerName));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,19 @@

package org.opensearch.wlm;

import org.junit.Test;
import org.opensearch.test.OpenSearchTestCase;

import java.util.Map;

import static org.junit.Assert.*;

public class QueryGroupThreadContextStatePropagatorTest extends OpenSearchTestCase {


public void testTransients() {
QueryGroupThreadContextStatePropagator sut = new QueryGroupThreadContextStatePropagator();
Map<String, Object> source = Map.of("queryGroupId", "adgarja0r235te");
Map<String, Object> transients = sut.transients(source);
assertEquals("adgarja0r235te", transients.get("queryGroupId"));
}


public void testHeaders() {
QueryGroupThreadContextStatePropagator sut = new QueryGroupThreadContextStatePropagator();
Map<String, Object> source = Map.of("queryGroupId", "adgarja0r235te");
Expand Down

0 comments on commit 7b2c017

Please sign in to comment.