[Rename] server/src/test/java/org/elasticsearch/bootstrap (#217)
Signed-off-by: Abbas Hussain <abbas_10690@yahoo.com>
This commit is contained in:
parent
4aeed1a81a
commit
d03781ded4
|
@ -17,21 +17,21 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.bootstrap;
|
||||
package org.opensearch.bootstrap;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.lucene.util.Constants;
|
||||
import org.elasticsearch.cluster.coordination.ClusterBootstrapService;
|
||||
import org.elasticsearch.cluster.metadata.Metadata;
|
||||
import org.elasticsearch.common.CheckedConsumer;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.transport.BoundTransportAddress;
|
||||
import org.elasticsearch.common.transport.TransportAddress;
|
||||
import org.elasticsearch.discovery.DiscoveryModule;
|
||||
import org.elasticsearch.discovery.SettingsBasedSeedHostsProvider;
|
||||
import org.elasticsearch.monitor.jvm.JvmInfo;
|
||||
import org.elasticsearch.node.NodeValidationException;
|
||||
import org.elasticsearch.test.AbstractBootstrapCheckTestCase;
|
||||
import org.opensearch.cluster.coordination.ClusterBootstrapService;
|
||||
import org.opensearch.cluster.metadata.Metadata;
|
||||
import org.opensearch.common.CheckedConsumer;
|
||||
import org.opensearch.common.settings.Settings;
|
||||
import org.opensearch.common.transport.BoundTransportAddress;
|
||||
import org.opensearch.common.transport.TransportAddress;
|
||||
import org.opensearch.discovery.DiscoveryModule;
|
||||
import org.opensearch.discovery.SettingsBasedSeedHostsProvider;
|
||||
import org.opensearch.monitor.jvm.JvmInfo;
|
||||
import org.opensearch.node.NodeValidationException;
|
||||
import org.opensearch.test.AbstractBootstrapCheckTestCase;
|
||||
import org.hamcrest.Matcher;
|
||||
|
||||
import java.net.InetAddress;
|
||||
|
@ -45,8 +45,8 @@ import java.util.concurrent.atomic.AtomicLong;
|
|||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static org.elasticsearch.discovery.DiscoveryModule.ZEN2_DISCOVERY_TYPE;
|
||||
import static org.elasticsearch.discovery.DiscoveryModule.ZEN_DISCOVERY_TYPE;
|
||||
import static org.opensearch.discovery.DiscoveryModule.ZEN2_DISCOVERY_TYPE;
|
||||
import static org.opensearch.discovery.DiscoveryModule.ZEN_DISCOVERY_TYPE;
|
||||
import static org.hamcrest.CoreMatchers.allOf;
|
||||
import static org.hamcrest.CoreMatchers.containsString;
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
|
@ -287,7 +287,7 @@ public class BootstrapChecksTests extends AbstractBootstrapCheckTestCase {
|
|||
Collections.singletonList(check)));
|
||||
assertThat(
|
||||
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 {
|
||||
// nothing should happen
|
||||
BootstrapChecks.check(bootstrapContext, true, Collections.singletonList(check));
|
|
@ -17,12 +17,12 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.bootstrap;
|
||||
package org.opensearch.bootstrap;
|
||||
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.opensearch.common.settings.Settings;
|
||||
import org.opensearch.test.OpenSearchTestCase;
|
||||
|
||||
public class BootstrapSettingsTests extends ESTestCase {
|
||||
public class BootstrapSettingsTests extends OpenSearchTestCase {
|
||||
|
||||
public void testDefaultSettings() {
|
||||
assertTrue(BootstrapSettings.SECURITY_FILTER_BAD_DEFAULTS_SETTING.get(Settings.EMPTY));
|
|
@ -17,14 +17,14 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.bootstrap;
|
||||
package org.opensearch.bootstrap;
|
||||
|
||||
import org.apache.lucene.util.Constants;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.opensearch.test.OpenSearchTestCase;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
public class JNANativesTests extends ESTestCase {
|
||||
public class JNANativesTests extends OpenSearchTestCase {
|
||||
public void testMlockall() {
|
||||
if (Constants.MAC_OS_X) {
|
||||
assertFalse("Memory locking is not available on OS X platforms", JNANatives.LOCAL_MLOCKALL);
|
|
@ -17,16 +17,16 @@
|
|||
* 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 static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
|
||||
public class JavaVersionTests extends ESTestCase {
|
||||
public class JavaVersionTests extends OpenSearchTestCase {
|
||||
public void testParse() {
|
||||
JavaVersion javaVersion = JavaVersion.parse("1.7.0");
|
||||
List<Integer> version = javaVersion.getVersion();
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.bootstrap;
|
||||
package org.opensearch.bootstrap;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
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.message.ParameterizedMessage;
|
||||
import org.apache.lucene.util.Constants;
|
||||
import org.elasticsearch.cluster.metadata.Metadata;
|
||||
import org.elasticsearch.common.io.PathUtils;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.AbstractBootstrapCheckTestCase;
|
||||
import org.elasticsearch.test.MockLogAppender;
|
||||
import org.opensearch.cluster.metadata.Metadata;
|
||||
import org.opensearch.common.io.PathUtils;
|
||||
import org.opensearch.common.logging.Loggers;
|
||||
import org.opensearch.common.settings.Settings;
|
||||
import org.opensearch.test.AbstractBootstrapCheckTestCase;
|
||||
import org.opensearch.test.MockLogAppender;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
|
@ -17,12 +17,12 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.bootstrap;
|
||||
package org.opensearch.bootstrap;
|
||||
|
||||
import org.elasticsearch.Build;
|
||||
import org.elasticsearch.cli.ExitCodes;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.monitor.jvm.JvmInfo;
|
||||
import org.opensearch.Build;
|
||||
import org.opensearch.cli.ExitCodes;
|
||||
import org.opensearch.common.settings.Settings;
|
||||
import org.opensearch.monitor.jvm.JvmInfo;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Locale;
|
||||
|
@ -32,7 +32,7 @@ import static org.hamcrest.CoreMatchers.containsString;
|
|||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.Matchers.allOf;
|
||||
|
||||
public class ElasticsearchCliTests extends ESElasticsearchCliTestCase {
|
||||
public class OpenSearchCliTests extends BaseOpenSearchCliTestCase {
|
||||
|
||||
public void testVersion() throws Exception {
|
||||
runTestThatVersionIsMutuallyExclusiveToOtherOptions("-V", "-d");
|
||||
|
@ -149,7 +149,7 @@ public class ElasticsearchCliTests extends ESElasticsearchCliTestCase {
|
|||
args);
|
||||
}
|
||||
|
||||
public void testElasticsearchSettings() throws Exception {
|
||||
public void testOpenSearchSettings() throws Exception {
|
||||
runTest(
|
||||
ExitCodes.OK,
|
||||
true,
|
||||
|
@ -162,7 +162,7 @@ public class ElasticsearchCliTests extends ESElasticsearchCliTestCase {
|
|||
"-Efoo=bar", "-E", "baz=qux");
|
||||
}
|
||||
|
||||
public void testElasticsearchSettingCanNotBeEmpty() throws Exception {
|
||||
public void testOpenSearchSettingCanNotBeEmpty() throws Exception {
|
||||
runTest(
|
||||
ExitCodes.USAGE,
|
||||
false,
|
||||
|
@ -171,7 +171,7 @@ public class ElasticsearchCliTests extends ESElasticsearchCliTestCase {
|
|||
"-E", "foo=");
|
||||
}
|
||||
|
||||
public void testElasticsearchSettingCanNotBeDuplicated() throws Exception {
|
||||
public void testOpenSsearchSettingCanNotBeDuplicated() throws Exception {
|
||||
runTest(
|
||||
ExitCodes.USAGE,
|
||||
false,
|
|
@ -17,9 +17,9 @@
|
|||
* 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.AccessController;
|
||||
|
@ -28,12 +28,12 @@ import java.security.Permissions;
|
|||
import java.security.PrivilegedAction;
|
||||
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
|
||||
*/
|
||||
public void testRestrictPrivileges() {
|
|
@ -17,9 +17,9 @@
|
|||
* 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 java.io.IOError;
|
||||
|
@ -34,7 +34,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
|||
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
|
||||
public class ElasticsearchUncaughtExceptionHandlerTests extends ESTestCase {
|
||||
public class OpenSearchUncaughtExceptionHandlerTests extends OpenSearchTestCase {
|
||||
|
||||
private Map<Class<? extends Error>, Integer> expectedStatus;
|
||||
|
||||
|
@ -65,7 +65,7 @@ public class ElasticsearchUncaughtExceptionHandlerTests extends ESTestCase {
|
|||
final AtomicInteger observedStatus = new AtomicInteger();
|
||||
final AtomicReference<String> threadNameReference = new AtomicReference<>();
|
||||
final AtomicReference<Throwable> throwableReference = new AtomicReference<>();
|
||||
thread.setUncaughtExceptionHandler(new ElasticsearchUncaughtExceptionHandler() {
|
||||
thread.setUncaughtExceptionHandler(new OpenSearchUncaughtExceptionHandler() {
|
||||
|
||||
@Override
|
||||
void halt(int status) {
|
||||
|
@ -106,7 +106,7 @@ public class ElasticsearchUncaughtExceptionHandlerTests extends ESTestCase {
|
|||
thread.setName(name);
|
||||
final AtomicReference<String> threadNameReference = new AtomicReference<>();
|
||||
final AtomicReference<Throwable> throwableReference = new AtomicReference<>();
|
||||
thread.setUncaughtExceptionHandler(new ElasticsearchUncaughtExceptionHandler() {
|
||||
thread.setUncaughtExceptionHandler(new OpenSearchUncaughtExceptionHandler() {
|
||||
@Override
|
||||
void halt(int status) {
|
||||
fail();
|
||||
|
@ -140,11 +140,11 @@ public class ElasticsearchUncaughtExceptionHandlerTests extends ESTestCase {
|
|||
}
|
||||
|
||||
private void assertFatal(Throwable cause) {
|
||||
assertTrue(ElasticsearchUncaughtExceptionHandler.isFatalUncaught(cause));
|
||||
assertTrue(OpenSearchUncaughtExceptionHandler.isFatalUncaught(cause));
|
||||
}
|
||||
|
||||
private void assertNonFatal(Throwable cause) {
|
||||
assertFalse(ElasticsearchUncaughtExceptionHandler.isFatalUncaught(cause));
|
||||
assertFalse(OpenSearchUncaughtExceptionHandler.isFatalUncaught(cause));
|
||||
}
|
||||
|
||||
}
|
|
@ -17,16 +17,16 @@
|
|||
* 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.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
public class SecurityTests extends ESTestCase {
|
||||
|
||||
public class SecurityTests extends OpenSearchTestCase {
|
||||
|
||||
public void testEnsureExists() throws IOException {
|
||||
Path p = createTempDir();
|
||||
|
||||
|
@ -36,8 +36,8 @@ public class SecurityTests extends ESTestCase {
|
|||
Security.ensureDirectoryExists(exists);
|
||||
Files.createTempFile(exists, null, null);
|
||||
}
|
||||
|
||||
public void testEnsureNotExists() throws IOException {
|
||||
|
||||
public void testEnsureNotExists() throws IOException {
|
||||
Path p = createTempDir();
|
||||
|
||||
// directory does not exist: create it
|
||||
|
@ -45,7 +45,7 @@ public class SecurityTests extends ESTestCase {
|
|||
Security.ensureDirectoryExists(notExists);
|
||||
Files.createTempFile(notExists, null, null);
|
||||
}
|
||||
|
||||
|
||||
public void testEnsureRegularFile() throws IOException {
|
||||
Path p = createTempDir();
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class SecurityTests extends ESTestCase {
|
|||
fail("didn't get expected exception");
|
||||
} catch (IOException expected) {}
|
||||
}
|
||||
|
||||
|
||||
/** can't execute processes */
|
||||
public void testProcessExecution() throws Exception {
|
||||
assumeTrue("test requires security manager", System.getSecurityManager() != null);
|
Loading…
Reference in New Issue