Skip to content

Commit f1825fd

Browse files
authored
Rename WorkloadGroupTestUtil to WorkloadManagementTestUtil (#18709)
Signed-off-by: Ruirui Zhang <[email protected]>
1 parent a2e7d75 commit f1825fd

12 files changed

+62
-61
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
77
### Added
88
- Add support for Warm Indices Write Block on Flood Watermark breach ([#18375](https://github.com/opensearch-project/OpenSearch/pull/18375))
99
- Add support for custom index name resolver from cluster plugin ([#18593](https://github.com/opensearch-project/OpenSearch/pull/18593))
10+
- Rename WorkloadGroupTestUtil to WorkloadManagementTestUtil ([#18709](https://github.com/opensearch-project/OpenSearch/pull/18709))
1011
- Disallow resize for Warm Index, add Parameterized ITs for close in remote store ([#18686](https://github.com/opensearch-project/OpenSearch/pull/18686))
1112
- Ability to run Code Coverage with Gradle and produce the jacoco reports locally ([#18509](https://github.com/opensearch-project/OpenSearch/issues/18509))
1213
- [Workload Management] Update logging and Javadoc, rename QueryGroup to WorkloadGroup ([#18711](https://github.com/opensearch-project/OpenSearch/issues/18711))
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
import static org.junit.Assert.assertTrue;
3939
import static org.mockito.Mockito.mock;
4040

41-
public class WorkloadGroupTestUtils {
41+
public class WorkloadManagementTestUtils {
4242
public static final String NAME_ONE = "workload_group_one";
4343
public static final String NAME_TWO = "workload_group_two";
4444
public static final String _ID_ONE = "AgfUO5Ja9yfsYlONlYi3TQ==";

plugins/workload-management/src/test/java/org/opensearch/plugin/wlm/action/CreateWorkloadGroupRequestTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
import java.util.ArrayList;
1818
import java.util.List;
1919

20-
import static org.opensearch.plugin.wlm.WorkloadGroupTestUtils.assertEqualWorkloadGroups;
21-
import static org.opensearch.plugin.wlm.WorkloadGroupTestUtils.workloadGroupOne;
20+
import static org.opensearch.plugin.wlm.WorkloadManagementTestUtils.assertEqualWorkloadGroups;
21+
import static org.opensearch.plugin.wlm.WorkloadManagementTestUtils.workloadGroupOne;
2222

2323
public class CreateWorkloadGroupRequestTests extends OpenSearchTestCase {
2424

plugins/workload-management/src/test/java/org/opensearch/plugin/wlm/action/CreateWorkloadGroupResponseTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import org.opensearch.core.rest.RestStatus;
1616
import org.opensearch.core.xcontent.ToXContent;
1717
import org.opensearch.core.xcontent.XContentBuilder;
18-
import org.opensearch.plugin.wlm.WorkloadGroupTestUtils;
18+
import org.opensearch.plugin.wlm.WorkloadManagementTestUtils;
1919
import org.opensearch.test.OpenSearchTestCase;
2020

2121
import java.io.IOException;
@@ -30,7 +30,7 @@ public class CreateWorkloadGroupResponseTests extends OpenSearchTestCase {
3030
* Test case to verify serialization and deserialization of CreateWorkloadGroupResponse.
3131
*/
3232
public void testSerialization() throws IOException {
33-
CreateWorkloadGroupResponse response = new CreateWorkloadGroupResponse(WorkloadGroupTestUtils.workloadGroupOne, RestStatus.OK);
33+
CreateWorkloadGroupResponse response = new CreateWorkloadGroupResponse(WorkloadManagementTestUtils.workloadGroupOne, RestStatus.OK);
3434
BytesStreamOutput out = new BytesStreamOutput();
3535
response.writeTo(out);
3636
StreamInput streamInput = out.bytes().streamInput();
@@ -42,15 +42,15 @@ public void testSerialization() throws IOException {
4242
List<WorkloadGroup> listTwo = new ArrayList<>();
4343
listOne.add(responseGroup);
4444
listTwo.add(otherResponseGroup);
45-
WorkloadGroupTestUtils.assertEqualWorkloadGroups(listOne, listTwo, false);
45+
WorkloadManagementTestUtils.assertEqualWorkloadGroups(listOne, listTwo, false);
4646
}
4747

4848
/**
4949
* Test case to validate the toXContent method of CreateWorkloadGroupResponse.
5050
*/
5151
public void testToXContentCreateWorkloadGroup() throws IOException {
5252
XContentBuilder builder = JsonXContent.contentBuilder().prettyPrint();
53-
CreateWorkloadGroupResponse response = new CreateWorkloadGroupResponse(WorkloadGroupTestUtils.workloadGroupOne, RestStatus.OK);
53+
CreateWorkloadGroupResponse response = new CreateWorkloadGroupResponse(WorkloadManagementTestUtils.workloadGroupOne, RestStatus.OK);
5454
String actual = response.toXContent(builder, mock(ToXContent.Params.class)).toString();
5555
String expected = "{\n"
5656
+ " \"_id\" : \"AgfUO5Ja9yfsYlONlYi3TQ==\",\n"

plugins/workload-management/src/test/java/org/opensearch/plugin/wlm/action/DeleteWorkloadGroupRequestTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import org.opensearch.action.ActionRequestValidationException;
1212
import org.opensearch.common.io.stream.BytesStreamOutput;
1313
import org.opensearch.core.common.io.stream.StreamInput;
14-
import org.opensearch.plugin.wlm.WorkloadGroupTestUtils;
14+
import org.opensearch.plugin.wlm.WorkloadManagementTestUtils;
1515
import org.opensearch.test.OpenSearchTestCase;
1616

1717
import java.io.IOException;
@@ -22,8 +22,8 @@ public class DeleteWorkloadGroupRequestTests extends OpenSearchTestCase {
2222
* Test case to verify the serialization and deserialization of DeleteWorkloadGroupRequest.
2323
*/
2424
public void testSerialization() throws IOException {
25-
DeleteWorkloadGroupRequest request = new DeleteWorkloadGroupRequest(WorkloadGroupTestUtils.NAME_ONE);
26-
assertEquals(WorkloadGroupTestUtils.NAME_ONE, request.getName());
25+
DeleteWorkloadGroupRequest request = new DeleteWorkloadGroupRequest(WorkloadManagementTestUtils.NAME_ONE);
26+
assertEquals(WorkloadManagementTestUtils.NAME_ONE, request.getName());
2727
BytesStreamOutput out = new BytesStreamOutput();
2828
request.writeTo(out);
2929
StreamInput streamInput = out.bytes().streamInput();

plugins/workload-management/src/test/java/org/opensearch/plugin/wlm/action/GetWorkloadGroupRequestTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import org.opensearch.common.io.stream.BytesStreamOutput;
1212
import org.opensearch.core.common.io.stream.StreamInput;
13-
import org.opensearch.plugin.wlm.WorkloadGroupTestUtils;
13+
import org.opensearch.plugin.wlm.WorkloadManagementTestUtils;
1414
import org.opensearch.test.OpenSearchTestCase;
1515

1616
import java.io.IOException;
@@ -21,8 +21,8 @@ public class GetWorkloadGroupRequestTests extends OpenSearchTestCase {
2121
* Test case to verify the serialization and deserialization of GetWorkloadGroupRequest.
2222
*/
2323
public void testSerialization() throws IOException {
24-
GetWorkloadGroupRequest request = new GetWorkloadGroupRequest(WorkloadGroupTestUtils.NAME_ONE);
25-
assertEquals(WorkloadGroupTestUtils.NAME_ONE, request.getName());
24+
GetWorkloadGroupRequest request = new GetWorkloadGroupRequest(WorkloadManagementTestUtils.NAME_ONE);
25+
assertEquals(WorkloadManagementTestUtils.NAME_ONE, request.getName());
2626
BytesStreamOutput out = new BytesStreamOutput();
2727
request.writeTo(out);
2828
StreamInput streamInput = out.bytes().streamInput();

plugins/workload-management/src/test/java/org/opensearch/plugin/wlm/action/GetWorkloadGroupResponseTests.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import org.opensearch.core.rest.RestStatus;
1616
import org.opensearch.core.xcontent.ToXContent;
1717
import org.opensearch.core.xcontent.XContentBuilder;
18-
import org.opensearch.plugin.wlm.WorkloadGroupTestUtils;
18+
import org.opensearch.plugin.wlm.WorkloadManagementTestUtils;
1919
import org.opensearch.test.OpenSearchTestCase;
2020

2121
import java.io.IOException;
@@ -31,7 +31,7 @@ public class GetWorkloadGroupResponseTests extends OpenSearchTestCase {
3131
*/
3232
public void testSerializationSingleWorkloadGroup() throws IOException {
3333
List<WorkloadGroup> list = new ArrayList<>();
34-
list.add(WorkloadGroupTestUtils.workloadGroupOne);
34+
list.add(WorkloadManagementTestUtils.workloadGroupOne);
3535
GetWorkloadGroupResponse response = new GetWorkloadGroupResponse(list, RestStatus.OK);
3636
assertEquals(response.getWorkloadGroups(), list);
3737

@@ -41,15 +41,15 @@ public void testSerializationSingleWorkloadGroup() throws IOException {
4141

4242
GetWorkloadGroupResponse otherResponse = new GetWorkloadGroupResponse(streamInput);
4343
assertEquals(response.getRestStatus(), otherResponse.getRestStatus());
44-
WorkloadGroupTestUtils.assertEqualWorkloadGroups(response.getWorkloadGroups(), otherResponse.getWorkloadGroups(), false);
44+
WorkloadManagementTestUtils.assertEqualWorkloadGroups(response.getWorkloadGroups(), otherResponse.getWorkloadGroups(), false);
4545
}
4646

4747
/**
4848
* Test case to verify the serialization and deserialization of GetWorkloadGroupResponse when the result contains multiple WorkloadGroups.
4949
*/
5050
public void testSerializationMultipleWorkloadGroup() throws IOException {
51-
GetWorkloadGroupResponse response = new GetWorkloadGroupResponse(WorkloadGroupTestUtils.workloadGroupList(), RestStatus.OK);
52-
assertEquals(response.getWorkloadGroups(), WorkloadGroupTestUtils.workloadGroupList());
51+
GetWorkloadGroupResponse response = new GetWorkloadGroupResponse(WorkloadManagementTestUtils.workloadGroupList(), RestStatus.OK);
52+
assertEquals(response.getWorkloadGroups(), WorkloadManagementTestUtils.workloadGroupList());
5353

5454
BytesStreamOutput out = new BytesStreamOutput();
5555
response.writeTo(out);
@@ -58,7 +58,7 @@ public void testSerializationMultipleWorkloadGroup() throws IOException {
5858
GetWorkloadGroupResponse otherResponse = new GetWorkloadGroupResponse(streamInput);
5959
assertEquals(response.getRestStatus(), otherResponse.getRestStatus());
6060
assertEquals(2, otherResponse.getWorkloadGroups().size());
61-
WorkloadGroupTestUtils.assertEqualWorkloadGroups(response.getWorkloadGroups(), otherResponse.getWorkloadGroups(), false);
61+
WorkloadManagementTestUtils.assertEqualWorkloadGroups(response.getWorkloadGroups(), otherResponse.getWorkloadGroups(), false);
6262
}
6363

6464
/**
@@ -83,7 +83,7 @@ public void testSerializationNull() throws IOException {
8383
*/
8484
public void testToXContentGetSingleWorkloadGroup() throws IOException {
8585
List<WorkloadGroup> workloadGroupList = new ArrayList<>();
86-
workloadGroupList.add(WorkloadGroupTestUtils.workloadGroupOne);
86+
workloadGroupList.add(WorkloadManagementTestUtils.workloadGroupOne);
8787
XContentBuilder builder = JsonXContent.contentBuilder().prettyPrint();
8888
GetWorkloadGroupResponse response = new GetWorkloadGroupResponse(workloadGroupList, RestStatus.OK);
8989
String actual = response.toXContent(builder, mock(ToXContent.Params.class)).toString();
@@ -108,8 +108,8 @@ public void testToXContentGetSingleWorkloadGroup() throws IOException {
108108
*/
109109
public void testToXContentGetMultipleWorkloadGroup() throws IOException {
110110
List<WorkloadGroup> workloadGroupList = new ArrayList<>();
111-
workloadGroupList.add(WorkloadGroupTestUtils.workloadGroupOne);
112-
workloadGroupList.add(WorkloadGroupTestUtils.workloadGroupTwo);
111+
workloadGroupList.add(WorkloadManagementTestUtils.workloadGroupOne);
112+
workloadGroupList.add(WorkloadManagementTestUtils.workloadGroupTwo);
113113
XContentBuilder builder = JsonXContent.contentBuilder().prettyPrint();
114114
GetWorkloadGroupResponse response = new GetWorkloadGroupResponse(workloadGroupList, RestStatus.OK);
115115
String actual = response.toXContent(builder, mock(ToXContent.Params.class)).toString();

plugins/workload-management/src/test/java/org/opensearch/plugin/wlm/action/TransportGetWorkloadGroupActionTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
import org.opensearch.threadpool.ThreadPool;
1818
import org.opensearch.transport.TransportService;
1919

20-
import static org.opensearch.plugin.wlm.WorkloadGroupTestUtils.NAME_NONE_EXISTED;
21-
import static org.opensearch.plugin.wlm.WorkloadGroupTestUtils.NAME_ONE;
22-
import static org.opensearch.plugin.wlm.WorkloadGroupTestUtils.clusterState;
20+
import static org.opensearch.plugin.wlm.WorkloadManagementTestUtils.NAME_NONE_EXISTED;
21+
import static org.opensearch.plugin.wlm.WorkloadManagementTestUtils.NAME_ONE;
22+
import static org.opensearch.plugin.wlm.WorkloadManagementTestUtils.clusterState;
2323
import static org.mockito.Mockito.mock;
2424

2525
public class TransportGetWorkloadGroupActionTests extends OpenSearchTestCase {

plugins/workload-management/src/test/java/org/opensearch/plugin/wlm/action/UpdateWorkloadGroupRequestTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
import java.util.HashMap;
2020
import java.util.Map;
2121

22-
import static org.opensearch.plugin.wlm.WorkloadGroupTestUtils.NAME_ONE;
23-
import static org.opensearch.plugin.wlm.WorkloadGroupTestUtils.workloadGroupOne;
22+
import static org.opensearch.plugin.wlm.WorkloadManagementTestUtils.NAME_ONE;
23+
import static org.opensearch.plugin.wlm.WorkloadManagementTestUtils.workloadGroupOne;
2424

2525
public class UpdateWorkloadGroupRequestTests extends OpenSearchTestCase {
2626

plugins/workload-management/src/test/java/org/opensearch/plugin/wlm/action/UpdateWorkloadGroupResponseTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
import org.opensearch.core.rest.RestStatus;
1616
import org.opensearch.core.xcontent.ToXContent;
1717
import org.opensearch.core.xcontent.XContentBuilder;
18-
import org.opensearch.plugin.wlm.WorkloadGroupTestUtils;
18+
import org.opensearch.plugin.wlm.WorkloadManagementTestUtils;
1919
import org.opensearch.test.OpenSearchTestCase;
2020

2121
import java.io.IOException;
2222
import java.util.ArrayList;
2323
import java.util.List;
2424

25-
import static org.opensearch.plugin.wlm.WorkloadGroupTestUtils.workloadGroupOne;
25+
import static org.opensearch.plugin.wlm.WorkloadManagementTestUtils.workloadGroupOne;
2626
import static org.mockito.Mockito.mock;
2727

2828
public class UpdateWorkloadGroupResponseTests extends OpenSearchTestCase {
@@ -43,7 +43,7 @@ public void testSerialization() throws IOException {
4343
List<WorkloadGroup> list2 = new ArrayList<>();
4444
list1.add(responseGroup);
4545
list2.add(otherResponseGroup);
46-
WorkloadGroupTestUtils.assertEqualWorkloadGroups(list1, list2, false);
46+
WorkloadManagementTestUtils.assertEqualWorkloadGroups(list1, list2, false);
4747
}
4848

4949
/**

0 commit comments

Comments
 (0)