-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix java doc, add test of WeightedRoundRobinRouting metadata
Signed-off-by: Anshu Agarwal <anshukag@amazon.com>
- Loading branch information
Anshu Agarwal
committed
Sep 1, 2022
1 parent
7c64537
commit 154a3b9
Showing
3 changed files
with
43 additions
and
2 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
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
37 changes: 37 additions & 0 deletions
37
...src/test/java/org/opensearch/cluster/metadata/WeightedRoundRobinRoutingMetadataTests.java
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,37 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.cluster.metadata; | ||
|
||
import org.opensearch.cluster.routing.WRRWeights; | ||
import org.opensearch.common.xcontent.XContentParser; | ||
import org.opensearch.test.AbstractXContentTestCase; | ||
|
||
import java.io.IOException; | ||
import java.util.Map; | ||
|
||
public class WeightedRoundRobinRoutingMetadataTests extends AbstractXContentTestCase<WeightedRoundRobinRoutingMetadata> { | ||
@Override | ||
protected WeightedRoundRobinRoutingMetadata createTestInstance() { | ||
Map<String, Object> weights = Map.of("a", "1", "b", "1", "c", "0"); | ||
WRRWeights wrrWeights = new WRRWeights("zone", weights); | ||
WeightedRoundRobinRoutingMetadata wrrMetadata = new WeightedRoundRobinRoutingMetadata(wrrWeights); | ||
return wrrMetadata; | ||
} | ||
|
||
@Override | ||
protected WeightedRoundRobinRoutingMetadata doParseInstance(XContentParser parser) throws IOException { | ||
return WeightedRoundRobinRoutingMetadata.fromXContent(parser); | ||
} | ||
|
||
@Override | ||
protected boolean supportsUnknownFields() { | ||
return false; | ||
} | ||
|
||
} |