-
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.
Signed-off-by: Kaushal Kumar <[email protected]>
- Loading branch information
1 parent
4c6b46a
commit 92f2620
Showing
11 changed files
with
85 additions
and
15 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
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
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
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
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
18 changes: 18 additions & 0 deletions
18
server/src/main/java/org/opensearch/tasks/ResourceLimitGroupTask.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,18 @@ | ||
/* | ||
* 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.tasks; | ||
|
||
/** | ||
* Tasks which should be grouped | ||
*/ | ||
public interface ResourceLimitGroupTask { | ||
void setResourceLimitGroupName(String name); | ||
|
||
String getResourceLimitGroupName(); | ||
} |
44 changes: 44 additions & 0 deletions
44
server/src/test/java/org/opensearch/search/MultiTenantLabelTest.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,44 @@ | ||
/* | ||
* 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.search; | ||
|
||
import org.opensearch.core.common.io.stream.StreamInput; | ||
|
||
import java.io.IOException; | ||
|
||
import static org.mockito.Mockito.doReturn; | ||
import static org.mockito.Mockito.mock; | ||
|
||
public class MultiTenantLabelTest extends AbstractSearchTestCase { | ||
|
||
public void testValidMultiTenantLabel() { | ||
MultiTenantLabel label = MultiTenantLabel.fromName("tenant"); | ||
assertEquals(label.getValue(), "tenant"); | ||
} | ||
|
||
public void testInvalidMultiTenantLabel() { | ||
assertThrows(IllegalArgumentException.class, () -> MultiTenantLabel.fromName("foo")); | ||
} | ||
|
||
public void testValidMultiTenantLabelWithStreamInput() throws IOException { | ||
StreamInput streamInput = mock(StreamInput.class); | ||
doReturn("tenant").when(streamInput).readString(); | ||
|
||
MultiTenantLabel label = MultiTenantLabel.fromName(streamInput); | ||
assertEquals(label.getValue(), "tenant"); | ||
} | ||
|
||
public void testInvalidMultiTenantLabelWithStreamInput() throws IOException { | ||
StreamInput streamInput = mock(StreamInput.class); | ||
doReturn("foo").when(streamInput).readString(); | ||
|
||
assertThrows(IllegalArgumentException.class, () -> MultiTenantLabel.fromName(streamInput)); | ||
} | ||
|
||
} |