forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore method getMasterService() to return MasterService
Signed-off-by: Tianli Feng <ftianli@amazon.com>
- Loading branch information
Tianli Feng
committed
Jul 14, 2022
1 parent
951af92
commit 694d876
Showing
2 changed files
with
58 additions
and
1 deletion.
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
29 changes: 29 additions & 0 deletions
29
server/src/test/java/org/opensearch/cluster/service/ClusterServiceTests.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,29 @@ | ||
/* | ||
* 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.service; | ||
|
||
import org.hamcrest.Matchers; | ||
import org.opensearch.common.settings.ClusterSettings; | ||
import org.opensearch.common.settings.Settings; | ||
import org.opensearch.test.OpenSearchTestCase; | ||
|
||
public class ClusterServiceTests extends OpenSearchTestCase { | ||
public void testDeprecatedGetMasterServiceWhenUsingMasterServiceToInitializeClusterService() { | ||
ClusterSettings clusterSettings = new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS); | ||
MasterService masterService = new MasterService(Settings.EMPTY, clusterSettings, null); | ||
ClusterService clusterServiceWithMasterService = new ClusterService(Settings.EMPTY, clusterSettings, masterService, null); | ||
assertThat(clusterServiceWithMasterService.getMasterService(), Matchers.equalTo(masterService)); | ||
} | ||
|
||
public void testDeprecatedGetMasterServiceWithoutAssigningMasterService() { | ||
ClusterSettings clusterSettings = new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS); | ||
ClusterService clusterService = new ClusterService(Settings.EMPTY, clusterSettings, null); | ||
assertThat(clusterService.getMasterService(), Matchers.instanceOf(MasterService.class)); | ||
} | ||
} |