[Rename] server/src/test/java/org/elasticsearch/bootstrap (#217)

Signed-off-by: Abbas Hussain <abbas_10690@yahoo.com>
This commit is contained in:
Abbas Hussain 2021-03-11 21:08:19 +05:30 committed by Nick Knize
parent 4aeed1a81a
commit d03781ded4
10 changed files with 62 additions and 62 deletions

View File

@ -17,21 +17,21 @@
* under the License. * under the License.
*/ */
package org.elasticsearch.bootstrap; package org.opensearch.bootstrap;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.apache.lucene.util.Constants; import org.apache.lucene.util.Constants;
import org.elasticsearch.cluster.coordination.ClusterBootstrapService; import org.opensearch.cluster.coordination.ClusterBootstrapService;
import org.elasticsearch.cluster.metadata.Metadata; import org.opensearch.cluster.metadata.Metadata;
import org.elasticsearch.common.CheckedConsumer; import org.opensearch.common.CheckedConsumer;
import org.elasticsearch.common.settings.Settings; import org.opensearch.common.settings.Settings;
import org.elasticsearch.common.transport.BoundTransportAddress; import org.opensearch.common.transport.BoundTransportAddress;
import org.elasticsearch.common.transport.TransportAddress; import org.opensearch.common.transport.TransportAddress;
import org.elasticsearch.discovery.DiscoveryModule; import org.opensearch.discovery.DiscoveryModule;
import org.elasticsearch.discovery.SettingsBasedSeedHostsProvider; import org.opensearch.discovery.SettingsBasedSeedHostsProvider;
import org.elasticsearch.monitor.jvm.JvmInfo; import org.opensearch.monitor.jvm.JvmInfo;
import org.elasticsearch.node.NodeValidationException; import org.opensearch.node.NodeValidationException;
import org.elasticsearch.test.AbstractBootstrapCheckTestCase; import org.opensearch.test.AbstractBootstrapCheckTestCase;
import org.hamcrest.Matcher; import org.hamcrest.Matcher;
import java.net.InetAddress; import java.net.InetAddress;
@ -45,8 +45,8 @@ import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer; import java.util.function.Consumer;
import static org.elasticsearch.discovery.DiscoveryModule.ZEN2_DISCOVERY_TYPE; import static org.opensearch.discovery.DiscoveryModule.ZEN2_DISCOVERY_TYPE;
import static org.elasticsearch.discovery.DiscoveryModule.ZEN_DISCOVERY_TYPE; import static org.opensearch.discovery.DiscoveryModule.ZEN_DISCOVERY_TYPE;
import static org.hamcrest.CoreMatchers.allOf; import static org.hamcrest.CoreMatchers.allOf;
import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
@ -287,7 +287,7 @@ public class BootstrapChecksTests extends AbstractBootstrapCheckTestCase {
Collections.singletonList(check))); Collections.singletonList(check)));
assertThat( assertThat(
e.getMessage(), e.getMessage(),
containsString("memory locking requested for elasticsearch process but memory is not locked")); containsString("memory locking requested for opensearch process but memory is not locked"));
} else { } else {
// nothing should happen // nothing should happen
BootstrapChecks.check(bootstrapContext, true, Collections.singletonList(check)); BootstrapChecks.check(bootstrapContext, true, Collections.singletonList(check));

View File

@ -17,12 +17,12 @@
* under the License. * under the License.
*/ */
package org.elasticsearch.bootstrap; package org.opensearch.bootstrap;
import org.elasticsearch.common.settings.Settings; import org.opensearch.common.settings.Settings;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
public class BootstrapSettingsTests extends ESTestCase { public class BootstrapSettingsTests extends OpenSearchTestCase {
public void testDefaultSettings() { public void testDefaultSettings() {
assertTrue(BootstrapSettings.SECURITY_FILTER_BAD_DEFAULTS_SETTING.get(Settings.EMPTY)); assertTrue(BootstrapSettings.SECURITY_FILTER_BAD_DEFAULTS_SETTING.get(Settings.EMPTY));

View File

@ -17,14 +17,14 @@
* under the License. * under the License.
*/ */
package org.elasticsearch.bootstrap; package org.opensearch.bootstrap;
import org.apache.lucene.util.Constants; import org.apache.lucene.util.Constants;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
public class JNANativesTests extends ESTestCase { public class JNANativesTests extends OpenSearchTestCase {
public void testMlockall() { public void testMlockall() {
if (Constants.MAC_OS_X) { if (Constants.MAC_OS_X) {
assertFalse("Memory locking is not available on OS X platforms", JNANatives.LOCAL_MLOCKALL); assertFalse("Memory locking is not available on OS X platforms", JNANatives.LOCAL_MLOCKALL);

View File

@ -17,16 +17,16 @@
* under the License. * under the License.
*/ */
package org.elasticsearch.bootstrap; package org.opensearch.bootstrap;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.util.List; import java.util.List;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.is;
public class JavaVersionTests extends ESTestCase { public class JavaVersionTests extends OpenSearchTestCase {
public void testParse() { public void testParse() {
JavaVersion javaVersion = JavaVersion.parse("1.7.0"); JavaVersion javaVersion = JavaVersion.parse("1.7.0");
List<Integer> version = javaVersion.getVersion(); List<Integer> version = javaVersion.getVersion();

View File

@ -17,7 +17,7 @@
* under the License. * under the License.
*/ */
package org.elasticsearch.bootstrap; package org.opensearch.bootstrap;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -25,12 +25,12 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.core.LogEvent; import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.message.ParameterizedMessage; import org.apache.logging.log4j.message.ParameterizedMessage;
import org.apache.lucene.util.Constants; import org.apache.lucene.util.Constants;
import org.elasticsearch.cluster.metadata.Metadata; import org.opensearch.cluster.metadata.Metadata;
import org.elasticsearch.common.io.PathUtils; import org.opensearch.common.io.PathUtils;
import org.elasticsearch.common.logging.Loggers; import org.opensearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings; import org.opensearch.common.settings.Settings;
import org.elasticsearch.test.AbstractBootstrapCheckTestCase; import org.opensearch.test.AbstractBootstrapCheckTestCase;
import org.elasticsearch.test.MockLogAppender; import org.opensearch.test.MockLogAppender;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;

View File

@ -17,12 +17,12 @@
* under the License. * under the License.
*/ */
package org.elasticsearch.bootstrap; package org.opensearch.bootstrap;
import org.elasticsearch.Build; import org.opensearch.Build;
import org.elasticsearch.cli.ExitCodes; import org.opensearch.cli.ExitCodes;
import org.elasticsearch.common.settings.Settings; import org.opensearch.common.settings.Settings;
import org.elasticsearch.monitor.jvm.JvmInfo; import org.opensearch.monitor.jvm.JvmInfo;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.Locale; import java.util.Locale;
@ -32,7 +32,7 @@ import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.allOf;
public class ElasticsearchCliTests extends ESElasticsearchCliTestCase { public class OpenSearchCliTests extends BaseOpenSearchCliTestCase {
public void testVersion() throws Exception { public void testVersion() throws Exception {
runTestThatVersionIsMutuallyExclusiveToOtherOptions("-V", "-d"); runTestThatVersionIsMutuallyExclusiveToOtherOptions("-V", "-d");
@ -149,7 +149,7 @@ public class ElasticsearchCliTests extends ESElasticsearchCliTestCase {
args); args);
} }
public void testElasticsearchSettings() throws Exception { public void testOpenSearchSettings() throws Exception {
runTest( runTest(
ExitCodes.OK, ExitCodes.OK,
true, true,
@ -162,7 +162,7 @@ public class ElasticsearchCliTests extends ESElasticsearchCliTestCase {
"-Efoo=bar", "-E", "baz=qux"); "-Efoo=bar", "-E", "baz=qux");
} }
public void testElasticsearchSettingCanNotBeEmpty() throws Exception { public void testOpenSearchSettingCanNotBeEmpty() throws Exception {
runTest( runTest(
ExitCodes.USAGE, ExitCodes.USAGE,
false, false,
@ -171,7 +171,7 @@ public class ElasticsearchCliTests extends ESElasticsearchCliTestCase {
"-E", "foo="); "-E", "foo=");
} }
public void testElasticsearchSettingCanNotBeDuplicated() throws Exception { public void testOpenSsearchSettingCanNotBeDuplicated() throws Exception {
runTest( runTest(
ExitCodes.USAGE, ExitCodes.USAGE,
false, false,

View File

@ -17,9 +17,9 @@
* under the License. * under the License.
*/ */
package org.elasticsearch.bootstrap; package org.opensearch.bootstrap;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.security.AccessControlContext; import java.security.AccessControlContext;
import java.security.AccessController; import java.security.AccessController;
@ -28,12 +28,12 @@ import java.security.Permissions;
import java.security.PrivilegedAction; import java.security.PrivilegedAction;
import java.security.ProtectionDomain; import java.security.ProtectionDomain;
/** /**
* Tests for ESPolicy * Tests for OpenSearchPolicy
*/ */
public class ESPolicyTests extends ESTestCase { public class OpenSearchPolicyTests extends OpenSearchTestCase {
/** /**
* test restricting privileges to no permissions actually works * test restricting privileges to no permissions actually works
*/ */
public void testRestrictPrivileges() { public void testRestrictPrivileges() {

View File

@ -17,9 +17,9 @@
* under the License. * under the License.
*/ */
package org.elasticsearch.bootstrap; package org.opensearch.bootstrap;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.junit.Before; import org.junit.Before;
import java.io.IOError; import java.io.IOError;
@ -34,7 +34,7 @@ import java.util.concurrent.atomic.AtomicReference;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
public class ElasticsearchUncaughtExceptionHandlerTests extends ESTestCase { public class OpenSearchUncaughtExceptionHandlerTests extends OpenSearchTestCase {
private Map<Class<? extends Error>, Integer> expectedStatus; private Map<Class<? extends Error>, Integer> expectedStatus;
@ -65,7 +65,7 @@ public class ElasticsearchUncaughtExceptionHandlerTests extends ESTestCase {
final AtomicInteger observedStatus = new AtomicInteger(); final AtomicInteger observedStatus = new AtomicInteger();
final AtomicReference<String> threadNameReference = new AtomicReference<>(); final AtomicReference<String> threadNameReference = new AtomicReference<>();
final AtomicReference<Throwable> throwableReference = new AtomicReference<>(); final AtomicReference<Throwable> throwableReference = new AtomicReference<>();
thread.setUncaughtExceptionHandler(new ElasticsearchUncaughtExceptionHandler() { thread.setUncaughtExceptionHandler(new OpenSearchUncaughtExceptionHandler() {
@Override @Override
void halt(int status) { void halt(int status) {
@ -106,7 +106,7 @@ public class ElasticsearchUncaughtExceptionHandlerTests extends ESTestCase {
thread.setName(name); thread.setName(name);
final AtomicReference<String> threadNameReference = new AtomicReference<>(); final AtomicReference<String> threadNameReference = new AtomicReference<>();
final AtomicReference<Throwable> throwableReference = new AtomicReference<>(); final AtomicReference<Throwable> throwableReference = new AtomicReference<>();
thread.setUncaughtExceptionHandler(new ElasticsearchUncaughtExceptionHandler() { thread.setUncaughtExceptionHandler(new OpenSearchUncaughtExceptionHandler() {
@Override @Override
void halt(int status) { void halt(int status) {
fail(); fail();
@ -140,11 +140,11 @@ public class ElasticsearchUncaughtExceptionHandlerTests extends ESTestCase {
} }
private void assertFatal(Throwable cause) { private void assertFatal(Throwable cause) {
assertTrue(ElasticsearchUncaughtExceptionHandler.isFatalUncaught(cause)); assertTrue(OpenSearchUncaughtExceptionHandler.isFatalUncaught(cause));
} }
private void assertNonFatal(Throwable cause) { private void assertNonFatal(Throwable cause) {
assertFalse(ElasticsearchUncaughtExceptionHandler.isFatalUncaught(cause)); assertFalse(OpenSearchUncaughtExceptionHandler.isFatalUncaught(cause));
} }
} }

View File

@ -17,16 +17,16 @@
* under the License. * under the License.
*/ */
package org.elasticsearch.bootstrap; package org.opensearch.bootstrap;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
public class SecurityTests extends ESTestCase { public class SecurityTests extends OpenSearchTestCase {
public void testEnsureExists() throws IOException { public void testEnsureExists() throws IOException {
Path p = createTempDir(); Path p = createTempDir();
@ -36,8 +36,8 @@ public class SecurityTests extends ESTestCase {
Security.ensureDirectoryExists(exists); Security.ensureDirectoryExists(exists);
Files.createTempFile(exists, null, null); Files.createTempFile(exists, null, null);
} }
public void testEnsureNotExists() throws IOException { public void testEnsureNotExists() throws IOException {
Path p = createTempDir(); Path p = createTempDir();
// directory does not exist: create it // directory does not exist: create it
@ -45,7 +45,7 @@ public class SecurityTests extends ESTestCase {
Security.ensureDirectoryExists(notExists); Security.ensureDirectoryExists(notExists);
Files.createTempFile(notExists, null, null); Files.createTempFile(notExists, null, null);
} }
public void testEnsureRegularFile() throws IOException { public void testEnsureRegularFile() throws IOException {
Path p = createTempDir(); Path p = createTempDir();
@ -57,7 +57,7 @@ public class SecurityTests extends ESTestCase {
fail("didn't get expected exception"); fail("didn't get expected exception");
} catch (IOException expected) {} } catch (IOException expected) {}
} }
/** can't execute processes */ /** can't execute processes */
public void testProcessExecution() throws Exception { public void testProcessExecution() throws Exception {
assumeTrue("test requires security manager", System.getSecurityManager() != null); assumeTrue("test requires security manager", System.getSecurityManager() != null);