Respond to rename random ASCII helper methods
This commit is response to the renaming of the random ASCII helper methods in ESTestCase. The name of this method was changed because these methods only produce random strings generated from [a-zA-Z], not from all ASCII characters. Relates elastic/x-pack-elasticsearch#942 Original commit: elastic/x-pack-elasticsearch@a6085964d3
This commit is contained in:
parent
71149fb6d4
commit
dee1bd1825
|
@ -176,7 +176,7 @@ public class TestUtils {
|
|||
.maxNodes(5);
|
||||
if (version == License.VERSION_START) {
|
||||
builder.subscriptionType(randomFrom("dev", "gold", "platinum", "silver"));
|
||||
builder.feature(ESTestCase.randomAsciiOfLength(10));
|
||||
builder.feature(ESTestCase.randomAlphaOfLength(10));
|
||||
}
|
||||
LicenseSigner signer = new LicenseSigner(priKeyPath, pubKeyPath);
|
||||
return signer.sign(builder.build());
|
||||
|
|
|
@ -51,7 +51,7 @@ public class ClearRealmsCacheTests extends SecurityIntegTestCase {
|
|||
public static void init() throws Exception {
|
||||
usernames = new String[randomIntBetween(5, 10)];
|
||||
for (int i = 0; i < usernames.length; i++) {
|
||||
usernames[i] = randomAsciiOfLength(6) + "_" + i;
|
||||
usernames[i] = randomAlphaOfLength(6) + "_" + i;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ public class ClearRolesCacheTests extends NativeRealmIntegTestCase {
|
|||
public static void init() throws Exception {
|
||||
roles = new String[randomIntBetween(5, 10)];
|
||||
for (int i = 0; i < roles.length; i++) {
|
||||
roles[i] = randomAsciiOfLength(6) + "_" + i;
|
||||
roles[i] = randomAlphaOfLength(6) + "_" + i;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ public class KibanaUserRoleIntegTests extends SecurityIntegTestCase {
|
|||
}
|
||||
|
||||
public void testCreateIndexDeleteInKibanaIndex() throws Exception {
|
||||
final String index = randomBoolean()? ".kibana" : ".kibana-" + randomAsciiOfLengthBetween(1, 10).toLowerCase(Locale.ENGLISH);
|
||||
final String index = randomBoolean()? ".kibana" : ".kibana-" + randomAlphaOfLengthBetween(1, 10).toLowerCase(Locale.ENGLISH);
|
||||
|
||||
if (randomBoolean()) {
|
||||
CreateIndexResponse createIndexResponse = client().filterWithHeader(singletonMap("Authorization",
|
||||
|
|
|
@ -61,7 +61,7 @@ public class ScrollIdSigningTests extends SecurityIntegTestCase {
|
|||
.setSize(randomIntBetween(1, 10)).get();
|
||||
String scrollId = response.getScrollId();
|
||||
String tamperedScrollId = randomBoolean() ? scrollId.substring(randomIntBetween(1, 10)) :
|
||||
scrollId + randomAsciiOfLength(randomIntBetween(3, 10));
|
||||
scrollId + randomAlphaOfLength(randomIntBetween(3, 10));
|
||||
|
||||
try {
|
||||
assertThrowsAuthorizationException(client().prepareSearchScroll(tamperedScrollId).setScroll(TimeValue.timeValueMinutes(2))::get,
|
||||
|
@ -83,7 +83,7 @@ public class ScrollIdSigningTests extends SecurityIntegTestCase {
|
|||
.setSize(5).get();
|
||||
String scrollId = response.getScrollId();
|
||||
String tamperedScrollId = randomBoolean() ? scrollId.substring(randomIntBetween(1, 10)) :
|
||||
scrollId + randomAsciiOfLength(randomIntBetween(3, 10));
|
||||
scrollId + randomAlphaOfLength(randomIntBetween(3, 10));
|
||||
|
||||
try {
|
||||
assertThrowsAuthorizationException(client().prepareClearScroll().addScrollId(tamperedScrollId)::get,
|
||||
|
|
|
@ -17,7 +17,7 @@ import static org.hamcrest.Matchers.hasSize;
|
|||
public class LicenseUtilsTests extends ESTestCase {
|
||||
|
||||
public void testNewExpirationException() {
|
||||
for (String feature : Arrays.asList("feature", randomAsciiOfLength(5), null, "")) {
|
||||
for (String feature : Arrays.asList("feature", randomAlphaOfLength(5), null, "")) {
|
||||
ElasticsearchSecurityException exception = LicenseUtils.newComplianceException(feature);
|
||||
assertNotNull(exception);
|
||||
assertThat(exception.getMetadataKeys(), contains(LicenseUtils.EXPIRED_FEATURE_METADATA));
|
||||
|
|
|
@ -88,11 +88,11 @@ public class PutLicenseResponseTests extends ESTestCase {
|
|||
Map<String, String[]> ackMessages = new HashMap<>();
|
||||
|
||||
for (int i = 0; i < nFeatures; i++) {
|
||||
String feature = randomAsciiOfLengthBetween(9, 15);
|
||||
String feature = randomAlphaOfLengthBetween(9, 15);
|
||||
int nMessages = randomIntBetween(1, 5);
|
||||
String[] messages = new String[nMessages];
|
||||
for (int j = 0; j < nMessages; j++) {
|
||||
messages[j] = randomAsciiOfLengthBetween(10, 30);
|
||||
messages[j] = randomAlphaOfLengthBetween(10, 30);
|
||||
}
|
||||
ackMessages.put(feature, messages);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
|||
import static com.carrotsearch.randomizedtesting.RandomizedTest.randomBoolean;
|
||||
import static com.carrotsearch.randomizedtesting.RandomizedTest.randomInt;
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.test.ESTestCase.randomAsciiOfLength;
|
||||
import static org.elasticsearch.test.ESTestCase.randomAlphaOfLength;
|
||||
import static org.elasticsearch.test.ESTestCase.randomFrom;
|
||||
import static org.elasticsearch.test.ESTestCase.randomIntBetween;
|
||||
import static org.hamcrest.core.IsEqual.equalTo;
|
||||
|
@ -257,7 +257,7 @@ public class TestUtils {
|
|||
.maxNodes(5);
|
||||
if (version == License.VERSION_START) {
|
||||
builder.subscriptionType((type != null) ? type : randomFrom("dev", "gold", "platinum", "silver"));
|
||||
builder.feature(randomAsciiOfLength(10));
|
||||
builder.feature(randomAlphaOfLength(10));
|
||||
}
|
||||
LicenseSigner signer = new LicenseSigner(getTestPriKeyPath(), getTestPubKeyPath());
|
||||
return signer.sign(builder.build());
|
||||
|
|
|
@ -39,8 +39,8 @@ public class SettingsFilterTests extends ESTestCase {
|
|||
configureUnfilteredSetting("xpack.security.authc.realms.ldap1.enabled", "false");
|
||||
configureUnfilteredSetting("xpack.security.authc.realms.ldap1.url", "ldap://host.domain");
|
||||
configureFilteredSetting("xpack.security.authc.realms.ldap1.hostname_verification", randomBooleanSetting());
|
||||
configureFilteredSetting("xpack.security.authc.realms.ldap1.bind_dn", randomAsciiOfLength(5));
|
||||
configureFilteredSetting("xpack.security.authc.realms.ldap1.bind_password", randomAsciiOfLength(5));
|
||||
configureFilteredSetting("xpack.security.authc.realms.ldap1.bind_dn", randomAlphaOfLength(5));
|
||||
configureFilteredSetting("xpack.security.authc.realms.ldap1.bind_password", randomAlphaOfLength(5));
|
||||
|
||||
// active directory filtering
|
||||
configureUnfilteredSetting("xpack.security.authc.realms.ad1.type", "active_directory");
|
||||
|
@ -64,7 +64,7 @@ public class SettingsFilterTests extends ESTestCase {
|
|||
configureFilteredSetting("xpack.ssl.keystore.password", "testnode");
|
||||
configureFilteredSetting("xpack.ssl.keystore.algorithm", KeyManagerFactory.getDefaultAlgorithm());
|
||||
configureFilteredSetting("xpack.ssl.keystore.key_password", "testnode");
|
||||
configureFilteredSetting("xpack.ssl.truststore.password", randomAsciiOfLength(5));
|
||||
configureFilteredSetting("xpack.ssl.truststore.password", randomAlphaOfLength(5));
|
||||
configureFilteredSetting("xpack.ssl.truststore.algorithm", TrustManagerFactory.getDefaultAlgorithm());
|
||||
|
||||
// client profile
|
||||
|
@ -79,7 +79,7 @@ public class SettingsFilterTests extends ESTestCase {
|
|||
configureFilteredSetting("transport.profiles.client.xpack.security.ssl.keystore.algorithm",
|
||||
KeyManagerFactory.getDefaultAlgorithm());
|
||||
configureFilteredSetting("transport.profiles.client.xpack.security.ssl.keystore.key_password", "testnode");
|
||||
configureFilteredSetting("transport.profiles.client.xpack.security.ssl.truststore.password", randomAsciiOfLength(5));
|
||||
configureFilteredSetting("transport.profiles.client.xpack.security.ssl.truststore.password", randomAlphaOfLength(5));
|
||||
configureFilteredSetting("transport.profiles.client.xpack.security.ssl.truststore.algorithm",
|
||||
TrustManagerFactory.getDefaultAlgorithm());
|
||||
|
||||
|
|
|
@ -45,8 +45,8 @@ public class TransportXPackInfoActionTests extends ESTestCase {
|
|||
int featureSetCount = randomIntBetween(0, 5);
|
||||
for (int i = 0; i < featureSetCount; i++) {
|
||||
XPackFeatureSet fs = mock(XPackFeatureSet.class);
|
||||
when(fs.name()).thenReturn(randomAsciiOfLength(5));
|
||||
when(fs.description()).thenReturn(randomAsciiOfLength(10));
|
||||
when(fs.name()).thenReturn(randomAlphaOfLength(5));
|
||||
when(fs.description()).thenReturn(randomAlphaOfLength(10));
|
||||
when(fs.available()).thenReturn(randomBoolean());
|
||||
when(fs.enabled()).thenReturn(randomBoolean());
|
||||
featureSets.add(fs);
|
||||
|
@ -62,11 +62,11 @@ public class TransportXPackInfoActionTests extends ESTestCase {
|
|||
when(license.expiryDate()).thenReturn(expiryDate);
|
||||
License.Status status = randomFrom(License.Status.values());
|
||||
when(license.status()).thenReturn(status);
|
||||
String type = randomAsciiOfLength(10);
|
||||
String type = randomAlphaOfLength(10);
|
||||
when(license.type()).thenReturn(type);
|
||||
License.OperationMode mode = randomFrom(License.OperationMode.values());
|
||||
when(license.operationMode()).thenReturn(mode);
|
||||
String uid = randomAsciiOfLength(30);
|
||||
String uid = randomAlphaOfLength(30);
|
||||
when(license.uid()).thenReturn(uid);
|
||||
when(licenseService.getLicense()).thenReturn(license);
|
||||
|
||||
|
|
|
@ -76,24 +76,24 @@ public class HttpClientTests extends ESTestCase {
|
|||
|
||||
public void testBasics() throws Exception {
|
||||
int responseCode = randomIntBetween(200, 203);
|
||||
String body = randomAsciiOfLengthBetween(2, 8096);
|
||||
String body = randomAlphaOfLengthBetween(2, 8096);
|
||||
webServer.enqueue(new MockResponse().setResponseCode(responseCode).setBody(body));
|
||||
|
||||
HttpRequest.Builder requestBuilder = HttpRequest.builder("localhost", webServer.getPort())
|
||||
.method(HttpMethod.POST)
|
||||
.path("/" + randomAsciiOfLength(5));
|
||||
.path("/" + randomAlphaOfLength(5));
|
||||
|
||||
String paramKey = randomAsciiOfLength(3);
|
||||
String paramValue = randomAsciiOfLength(3);
|
||||
String paramKey = randomAlphaOfLength(3);
|
||||
String paramValue = randomAlphaOfLength(3);
|
||||
requestBuilder.setParam(paramKey, paramValue);
|
||||
|
||||
// Certain headers keys like via and host are illegal and the jdk http client ignores those, so lets
|
||||
// prepend all keys with `_`, so we don't run into a failure because randomly a restricted header was used:
|
||||
String headerKey = "_" + randomAsciiOfLength(3);
|
||||
String headerValue = randomAsciiOfLength(3);
|
||||
String headerKey = "_" + randomAlphaOfLength(3);
|
||||
String headerValue = randomAlphaOfLength(3);
|
||||
requestBuilder.setHeader(headerKey, headerValue);
|
||||
|
||||
requestBuilder.body(randomAsciiOfLength(5));
|
||||
requestBuilder.body(randomAlphaOfLength(5));
|
||||
HttpRequest request = requestBuilder.build();
|
||||
|
||||
HttpResponse response = httpClient.execute(request);
|
||||
|
@ -434,7 +434,7 @@ public class HttpClientTests extends ESTestCase {
|
|||
|
||||
public void testMaxHttpResponseSize() throws Exception {
|
||||
int randomBytesLength = scaledRandomIntBetween(2, 100);
|
||||
String data = randomAsciiOfLength(randomBytesLength);
|
||||
String data = randomAlphaOfLength(randomBytesLength);
|
||||
webServer.enqueue(new MockResponse().setResponseCode(200).setBody(data));
|
||||
|
||||
Settings settings = Settings.builder()
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
package org.elasticsearch.xpack.common.http;
|
||||
|
||||
import org.apache.http.conn.ConnectTimeoutException;
|
||||
import org.elasticsearch.ElasticsearchTimeoutException;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.env.Environment;
|
||||
|
@ -31,7 +30,7 @@ public class HttpConnectionTimeoutTests extends ESTestCase {
|
|||
|
||||
HttpRequest request = HttpRequest.builder(UNROUTABLE_IP, 12345)
|
||||
.method(HttpMethod.POST)
|
||||
.path("/" + randomAsciiOfLength(5))
|
||||
.path("/" + randomAlphaOfLength(5))
|
||||
.build();
|
||||
|
||||
long start = System.nanoTime();
|
||||
|
@ -57,7 +56,7 @@ public class HttpConnectionTimeoutTests extends ESTestCase {
|
|||
|
||||
HttpRequest request = HttpRequest.builder(UNROUTABLE_IP, 12345)
|
||||
.method(HttpMethod.POST)
|
||||
.path("/" + randomAsciiOfLength(5))
|
||||
.path("/" + randomAlphaOfLength(5))
|
||||
.build();
|
||||
|
||||
long start = System.nanoTime();
|
||||
|
@ -84,7 +83,7 @@ public class HttpConnectionTimeoutTests extends ESTestCase {
|
|||
HttpRequest request = HttpRequest.builder(UNROUTABLE_IP, 12345)
|
||||
.connectionTimeout(TimeValue.timeValueSeconds(5))
|
||||
.method(HttpMethod.POST)
|
||||
.path("/" + randomAsciiOfLength(5))
|
||||
.path("/" + randomAlphaOfLength(5))
|
||||
.build();
|
||||
|
||||
long start = System.nanoTime();
|
||||
|
|
|
@ -78,7 +78,7 @@ public class HttpRequestTemplateTests extends ESTestCase {
|
|||
HttpRequestTemplate.Builder builder = HttpRequestTemplate.builder("_host", 1234);
|
||||
builder.path("/path");
|
||||
builder.method(randomFrom(HttpMethod.values()));
|
||||
String proxyHost = randomAsciiOfLength(10);
|
||||
String proxyHost = randomAlphaOfLength(10);
|
||||
int proxyPort = randomIntBetween(1, 65534);
|
||||
builder.proxy(new HttpProxy(proxyHost, proxyPort));
|
||||
HttpRequestTemplate template = builder.build();
|
||||
|
@ -129,7 +129,7 @@ public class HttpRequestTemplateTests extends ESTestCase {
|
|||
}
|
||||
boolean enableProxy = randomBoolean();
|
||||
if (enableProxy) {
|
||||
builder.proxy(new HttpProxy(randomAsciiOfLength(10), randomIntBetween(1, 65534)));
|
||||
builder.proxy(new HttpProxy(randomAlphaOfLength(10), randomIntBetween(1, 65534)));
|
||||
}
|
||||
|
||||
HttpRequestTemplate template = builder.build();
|
||||
|
|
|
@ -79,7 +79,7 @@ public class HttpRequestTests extends ESTestCase {
|
|||
if (randomBoolean()) {
|
||||
builder.scheme(randomFrom(Scheme.values()));
|
||||
if (usually()) {
|
||||
builder.path(randomAsciiOfLength(50));
|
||||
builder.path(randomAlphaOfLength(50));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -87,22 +87,22 @@ public class HttpRequestTests extends ESTestCase {
|
|||
builder.method(randomFrom(HttpMethod.values()));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
builder.setParam(randomAsciiOfLength(10), randomAsciiOfLength(10));
|
||||
builder.setParam(randomAlphaOfLength(10), randomAlphaOfLength(10));
|
||||
if (randomBoolean()) {
|
||||
builder.setParam(randomAsciiOfLength(10), randomAsciiOfLength(10));
|
||||
builder.setParam(randomAlphaOfLength(10), randomAlphaOfLength(10));
|
||||
}
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
builder.setHeader(randomAsciiOfLength(10), randomAsciiOfLength(10));
|
||||
builder.setHeader(randomAlphaOfLength(10), randomAlphaOfLength(10));
|
||||
if (randomBoolean()) {
|
||||
builder.setHeader(randomAsciiOfLength(10), randomAsciiOfLength(10));
|
||||
builder.setHeader(randomAlphaOfLength(10), randomAlphaOfLength(10));
|
||||
}
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
builder.auth(new BasicAuth(randomAsciiOfLength(10), randomAsciiOfLength(20).toCharArray()));
|
||||
builder.auth(new BasicAuth(randomAlphaOfLength(10), randomAlphaOfLength(20).toCharArray()));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
builder.body(randomAsciiOfLength(200));
|
||||
builder.body(randomAlphaOfLength(200));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
builder.connectionTimeout(TimeValue.parseTimeValue(randomTimeValue(), "my.setting"));
|
||||
|
@ -111,7 +111,7 @@ public class HttpRequestTests extends ESTestCase {
|
|||
builder.readTimeout(TimeValue.parseTimeValue(randomTimeValue(), "my.setting"));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
builder.proxy(new HttpProxy(randomAsciiOfLength(10), randomIntBetween(1024, 65000)));
|
||||
builder.proxy(new HttpProxy(randomAlphaOfLength(10), randomIntBetween(1024, 65000)));
|
||||
}
|
||||
|
||||
final HttpRequest httpRequest = builder.build();
|
||||
|
|
|
@ -39,7 +39,7 @@ public class SizeLimitInputStreamTests extends ESTestCase {
|
|||
}
|
||||
|
||||
private void test(int inputStreamLength, int maxAllowedSize) throws IOException {
|
||||
String data = randomAsciiOfLength(inputStreamLength);
|
||||
String data = randomAlphaOfLength(inputStreamLength);
|
||||
ByteSizeValue byteSizeValue = new ByteSizeValue(maxAllowedSize, ByteSizeUnit.BYTES);
|
||||
SizeLimitInputStream is = new SizeLimitInputStream(byteSizeValue,
|
||||
new ByteArrayInputStream(data.getBytes(UTF_8)));
|
||||
|
|
|
@ -32,7 +32,7 @@ public class CloseJobActionRequestTests extends AbstractStreamableXContentTestCa
|
|||
|
||||
@Override
|
||||
protected Request createTestInstance() {
|
||||
Request request = new Request(randomAsciiOfLengthBetween(1, 20));
|
||||
Request request = new Request(randomAlphaOfLengthBetween(1, 20));
|
||||
if (randomBoolean()) {
|
||||
request.setCloseTimeout(TimeValue.timeValueMillis(randomNonNegativeLong()));
|
||||
}
|
||||
|
|
|
@ -20,9 +20,9 @@ public class CreateFilterActionRequestTests extends AbstractStreamableXContentTe
|
|||
int size = randomInt(10);
|
||||
List<String> items = new ArrayList<>(size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
items.add(randomAsciiOfLengthBetween(1, 20));
|
||||
items.add(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
MlFilter filter = new MlFilter(randomAsciiOfLengthBetween(1, 20), items);
|
||||
MlFilter filter = new MlFilter(randomAlphaOfLengthBetween(1, 20), items);
|
||||
return new PutFilterAction.Request(filter);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ public class DeleteDatafeedRequestTests extends AbstractStreamableTestCase<Reque
|
|||
|
||||
@Override
|
||||
protected Request createTestInstance() {
|
||||
return new Request(randomAsciiOfLengthBetween(1, 20));
|
||||
return new Request(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,7 +12,7 @@ public class DeleteJobRequestTests extends AbstractStreamableTestCase<Request> {
|
|||
|
||||
@Override
|
||||
protected Request createTestInstance() {
|
||||
return new Request(randomAsciiOfLengthBetween(1, 20));
|
||||
return new Request(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -14,13 +14,13 @@ public class GetBucketActionRequestTests extends AbstractStreamableXContentTestC
|
|||
|
||||
@Override
|
||||
protected Request createTestInstance() {
|
||||
GetBucketsAction.Request request = new GetBucketsAction.Request(randomAsciiOfLengthBetween(1, 20));
|
||||
GetBucketsAction.Request request = new GetBucketsAction.Request(randomAlphaOfLengthBetween(1, 20));
|
||||
|
||||
if (randomBoolean()) {
|
||||
request.setTimestamp(String.valueOf(randomLong()));
|
||||
} else {
|
||||
if (randomBoolean()) {
|
||||
request.setPartitionValue(randomAsciiOfLengthBetween(1, 20));
|
||||
request.setPartitionValue(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
request.setStart(String.valueOf(randomLong()));
|
||||
|
@ -35,7 +35,7 @@ public class GetBucketActionRequestTests extends AbstractStreamableXContentTestC
|
|||
request.setAnomalyScore(randomDouble());
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
request.setPartitionValue(randomAsciiOfLengthBetween(1, 20));
|
||||
request.setPartitionValue(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
int from = randomInt(PageParams.MAX_FROM_SIZE_SUM);
|
||||
|
|
|
@ -41,7 +41,7 @@ public class GetBucketActionResponseTests extends AbstractStreamableTestCase<Get
|
|||
BucketInfluencer bucketInfluencer = new BucketInfluencer("foo", bucket.getTimestamp(), bucket.getBucketSpan(),
|
||||
sequenceNum++);
|
||||
bucketInfluencer.setAnomalyScore(randomDouble());
|
||||
bucketInfluencer.setInfluencerFieldName(randomAsciiOfLengthBetween(1, 20));
|
||||
bucketInfluencer.setInfluencerFieldName(randomAlphaOfLengthBetween(1, 20));
|
||||
bucketInfluencer.setInitialAnomalyScore(randomDouble());
|
||||
bucketInfluencer.setProbability(randomDouble());
|
||||
bucketInfluencer.setRawAnomalyScore(randomDouble());
|
||||
|
@ -62,7 +62,7 @@ public class GetBucketActionResponseTests extends AbstractStreamableTestCase<Get
|
|||
int size = randomInt(10);
|
||||
List<PartitionScore> partitionScores = new ArrayList<>(size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
partitionScores.add(new PartitionScore(randomAsciiOfLengthBetween(1, 20), randomAsciiOfLengthBetween(1, 20),
|
||||
partitionScores.add(new PartitionScore(randomAlphaOfLengthBetween(1, 20), randomAlphaOfLengthBetween(1, 20),
|
||||
randomDouble(), randomDouble(), randomDouble()));
|
||||
}
|
||||
bucket.setPartitionScores(partitionScores);
|
||||
|
@ -71,7 +71,7 @@ public class GetBucketActionResponseTests extends AbstractStreamableTestCase<Get
|
|||
int size = randomInt(10);
|
||||
Map<String, Double> perPartitionMaxProbability = new HashMap<>(size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
perPartitionMaxProbability.put(randomAsciiOfLengthBetween(1, 20), randomDouble());
|
||||
perPartitionMaxProbability.put(randomAlphaOfLengthBetween(1, 20), randomDouble());
|
||||
}
|
||||
bucket.setPerPartitionMaxProbability(perPartitionMaxProbability);
|
||||
}
|
||||
|
|
|
@ -13,10 +13,10 @@ public class GetCategoriesRequestTests extends AbstractStreamableXContentTestCas
|
|||
|
||||
@Override
|
||||
protected GetCategoriesAction.Request createTestInstance() {
|
||||
String jobId = randomAsciiOfLength(10);
|
||||
String jobId = randomAlphaOfLength(10);
|
||||
GetCategoriesAction.Request request = new GetCategoriesAction.Request(jobId);
|
||||
if (randomBoolean()) {
|
||||
request.setCategoryId(randomAsciiOfLength(10));
|
||||
request.setCategoryId(randomAlphaOfLength(10));
|
||||
} else {
|
||||
int from = randomInt(PageParams.MAX_FROM_SIZE_SUM);
|
||||
int maxSize = PageParams.MAX_FROM_SIZE_SUM - from;
|
||||
|
|
|
@ -15,7 +15,7 @@ public class GetCategoriesResponseTests extends AbstractStreamableTestCase<GetCa
|
|||
|
||||
@Override
|
||||
protected GetCategoriesAction.Response createTestInstance() {
|
||||
CategoryDefinition definition = new CategoryDefinition(randomAsciiOfLength(10));
|
||||
CategoryDefinition definition = new CategoryDefinition(randomAlphaOfLength(10));
|
||||
QueryPage<CategoryDefinition> queryPage =
|
||||
new QueryPage<>(Collections.singletonList(definition), 1L, CategoryDefinition.RESULTS_FIELD);
|
||||
return new GetCategoriesAction.Response(queryPage);
|
||||
|
|
|
@ -13,7 +13,7 @@ public class GetDatafeedStatsActionRequestTests extends AbstractStreamableTestCa
|
|||
|
||||
@Override
|
||||
protected Request createTestInstance() {
|
||||
return new Request(randomBoolean() ? Job.ALL : randomAsciiOfLengthBetween(1, 20));
|
||||
return new Request(randomBoolean() ? Job.ALL : randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,7 +27,7 @@ public class GetDatafeedStatsActionResponseTests extends AbstractStreamableTestC
|
|||
int listSize = randomInt(10);
|
||||
List<Response.DatafeedStats> datafeedStatsList = new ArrayList<>(listSize);
|
||||
for (int j = 0; j < listSize; j++) {
|
||||
String datafeedId = randomAsciiOfLength(10);
|
||||
String datafeedId = randomAlphaOfLength(10);
|
||||
DatafeedState datafeedState = randomFrom(DatafeedState.values());
|
||||
|
||||
DiscoveryNode node = null;
|
||||
|
@ -36,7 +36,7 @@ public class GetDatafeedStatsActionResponseTests extends AbstractStreamableTestC
|
|||
}
|
||||
String explanation = null;
|
||||
if (randomBoolean()) {
|
||||
explanation = randomAsciiOfLength(3);
|
||||
explanation = randomAlphaOfLength(3);
|
||||
}
|
||||
Response.DatafeedStats datafeedStats = new Response.DatafeedStats(datafeedId, datafeedState, node, explanation);
|
||||
datafeedStatsList.add(datafeedStats);
|
||||
|
|
|
@ -13,7 +13,7 @@ public class GetDatafeedsActionRequestTests extends AbstractStreamableTestCase<R
|
|||
|
||||
@Override
|
||||
protected Request createTestInstance() {
|
||||
return new Request(randomBoolean() ? Job.ALL : randomAsciiOfLengthBetween(1, 20));
|
||||
return new Request(randomBoolean() ? Job.ALL : randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,7 +21,7 @@ public class GetDatafeedsActionResponseTests extends AbstractStreamableTestCase<
|
|||
int listSize = randomInt(10);
|
||||
List<DatafeedConfig> datafeedList = new ArrayList<>(listSize);
|
||||
for (int j = 0; j < listSize; j++) {
|
||||
datafeedList.add(DatafeedConfigTests.createRandomizedDatafeedConfig(randomAsciiOfLength(10)));
|
||||
datafeedList.add(DatafeedConfigTests.createRandomizedDatafeedConfig(randomAlphaOfLength(10)));
|
||||
}
|
||||
return new Response(new QueryPage<>(datafeedList, datafeedList.size(), DatafeedConfig.RESULTS_FIELD));
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ public class GetFiltersActionRequestTests extends AbstractStreamableTestCase<Get
|
|||
protected Request createTestInstance() {
|
||||
Request request = new Request();
|
||||
if (randomBoolean()) {
|
||||
request.setFilterId(randomAsciiOfLengthBetween(1, 20));
|
||||
request.setFilterId(randomAlphaOfLengthBetween(1, 20));
|
||||
} else {
|
||||
if (randomBoolean()) {
|
||||
int from = randomInt(PageParams.MAX_FROM_SIZE_SUM);
|
||||
|
|
|
@ -19,7 +19,7 @@ public class GetFiltersActionResponseTests extends AbstractStreamableTestCase<Ge
|
|||
final QueryPage<MlFilter> result;
|
||||
|
||||
MlFilter doc = new MlFilter(
|
||||
randomAsciiOfLengthBetween(1, 20), Collections.singletonList(randomAsciiOfLengthBetween(1, 20)));
|
||||
randomAlphaOfLengthBetween(1, 20), Collections.singletonList(randomAlphaOfLengthBetween(1, 20)));
|
||||
result = new QueryPage<>(Collections.singletonList(doc), 1, MlFilter.RESULTS_FIELD);
|
||||
return new Response(result);
|
||||
}
|
||||
|
|
|
@ -19,13 +19,13 @@ public class GetInfluencersActionRequestTests extends AbstractStreamableXContent
|
|||
|
||||
@Override
|
||||
protected Request createTestInstance() {
|
||||
Request request = new Request(randomAsciiOfLengthBetween(1, 20));
|
||||
Request request = new Request(randomAlphaOfLengthBetween(1, 20));
|
||||
if (randomBoolean()) {
|
||||
String start = randomBoolean() ? randomAsciiOfLengthBetween(1, 20) : String.valueOf(randomNonNegativeLong());
|
||||
String start = randomBoolean() ? randomAlphaOfLengthBetween(1, 20) : String.valueOf(randomNonNegativeLong());
|
||||
request.setStart(start);
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
String end = randomBoolean() ? randomAsciiOfLengthBetween(1, 20) : String.valueOf(randomNonNegativeLong());
|
||||
String end = randomBoolean() ? randomAlphaOfLengthBetween(1, 20) : String.valueOf(randomNonNegativeLong());
|
||||
request.setEnd(end);
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
|
@ -35,7 +35,7 @@ public class GetInfluencersActionRequestTests extends AbstractStreamableXContent
|
|||
request.setIncludeInterim(randomBoolean());
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
request.setSort(randomAsciiOfLengthBetween(1, 20));
|
||||
request.setSort(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
request.setDecending(randomBoolean());
|
||||
|
|
|
@ -21,8 +21,8 @@ public class GetInfluencersActionResponseTests extends AbstractStreamableTestCas
|
|||
int listSize = randomInt(10);
|
||||
List<Influencer> hits = new ArrayList<>(listSize);
|
||||
for (int j = 0; j < listSize; j++) {
|
||||
Influencer influencer = new Influencer(randomAsciiOfLengthBetween(1, 20), randomAsciiOfLengthBetween(1, 20),
|
||||
randomAsciiOfLengthBetween(1, 20), new Date(randomNonNegativeLong()), randomNonNegativeLong(), j + 1);
|
||||
Influencer influencer = new Influencer(randomAlphaOfLengthBetween(1, 20), randomAlphaOfLengthBetween(1, 20),
|
||||
randomAlphaOfLengthBetween(1, 20), new Date(randomNonNegativeLong()), randomNonNegativeLong(), j + 1);
|
||||
influencer.setInfluencerScore(randomDouble());
|
||||
influencer.setInitialInfluencerScore(randomDouble());
|
||||
influencer.setProbability(randomDouble());
|
||||
|
|
|
@ -13,7 +13,7 @@ public class GetJobStatsActionRequestTests extends AbstractStreamableTestCase<Re
|
|||
|
||||
@Override
|
||||
protected Request createTestInstance() {
|
||||
return new Request(randomBoolean() ? Job.ALL : randomAsciiOfLengthBetween(1, 20));
|
||||
return new Request(randomBoolean() ? Job.ALL : randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,7 +34,7 @@ public class GetJobStatsActionResponseTests extends AbstractStreamableTestCase<R
|
|||
int listSize = randomInt(10);
|
||||
List<Response.JobStats> jobStatsList = new ArrayList<>(listSize);
|
||||
for (int j = 0; j < listSize; j++) {
|
||||
String jobId = randomAsciiOfLength(10);
|
||||
String jobId = randomAlphaOfLength(10);
|
||||
|
||||
DataCounts dataCounts = new DataCountsTests().createTestInstance();
|
||||
|
||||
|
@ -50,7 +50,7 @@ public class GetJobStatsActionResponseTests extends AbstractStreamableTestCase<R
|
|||
}
|
||||
String explanation = null;
|
||||
if (randomBoolean()) {
|
||||
explanation = randomAsciiOfLength(3);
|
||||
explanation = randomAlphaOfLength(3);
|
||||
}
|
||||
TimeValue openTime = null;
|
||||
if (randomBoolean()) {
|
||||
|
|
|
@ -13,7 +13,7 @@ public class GetJobsActionRequestTests extends AbstractStreamableTestCase<GetJob
|
|||
|
||||
@Override
|
||||
protected Request createTestInstance() {
|
||||
return new Request(randomBoolean() ? Job.ALL : randomAsciiOfLengthBetween(1, 20));
|
||||
return new Request(randomBoolean() ? Job.ALL : randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,18 +19,18 @@ public class GetModelSnapshotsActionRequestTests extends AbstractStreamableXCont
|
|||
|
||||
@Override
|
||||
protected Request createTestInstance() {
|
||||
Request request = new Request(randomAsciiOfLengthBetween(1, 20), randomBoolean() ? null : randomAsciiOfLengthBetween(1, 20));
|
||||
Request request = new Request(randomAlphaOfLengthBetween(1, 20), randomBoolean() ? null : randomAlphaOfLengthBetween(1, 20));
|
||||
if (randomBoolean()) {
|
||||
request.setDescriptionString(randomAsciiOfLengthBetween(1, 20));
|
||||
request.setDescriptionString(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
request.setStart(randomAsciiOfLengthBetween(1, 20));
|
||||
request.setStart(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
request.setEnd(randomAsciiOfLengthBetween(1, 20));
|
||||
request.setEnd(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
request.setSort(randomAsciiOfLengthBetween(1, 20));
|
||||
request.setSort(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
request.setDescOrder(randomBoolean());
|
||||
|
|
|
@ -19,20 +19,20 @@ public class GetRecordsActionRequestTests extends AbstractStreamableXContentTest
|
|||
|
||||
@Override
|
||||
protected Request createTestInstance() {
|
||||
Request request = new Request(randomAsciiOfLengthBetween(1, 20));
|
||||
Request request = new Request(randomAlphaOfLengthBetween(1, 20));
|
||||
if (randomBoolean()) {
|
||||
String start = randomBoolean() ? randomAsciiOfLengthBetween(1, 20) : String.valueOf(randomNonNegativeLong());
|
||||
String start = randomBoolean() ? randomAlphaOfLengthBetween(1, 20) : String.valueOf(randomNonNegativeLong());
|
||||
request.setStart(start);
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
String end = randomBoolean() ? randomAsciiOfLengthBetween(1, 20) : String.valueOf(randomNonNegativeLong());
|
||||
String end = randomBoolean() ? randomAlphaOfLengthBetween(1, 20) : String.valueOf(randomNonNegativeLong());
|
||||
request.setEnd(end);
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
request.setPartitionValue(randomAsciiOfLengthBetween(1, 20));
|
||||
request.setPartitionValue(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
request.setSort(randomAsciiOfLengthBetween(1, 20));
|
||||
request.setSort(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
request.setDecending(randomBoolean());
|
||||
|
|
|
@ -20,7 +20,7 @@ public class GetRecordsActionResponseTests extends AbstractStreamableTestCase<Ge
|
|||
protected Response createTestInstance() {
|
||||
int listSize = randomInt(10);
|
||||
List<AnomalyRecord> hits = new ArrayList<>(listSize);
|
||||
String jobId = randomAsciiOfLengthBetween(1, 20);
|
||||
String jobId = randomAlphaOfLengthBetween(1, 20);
|
||||
for (int j = 0; j < listSize; j++) {
|
||||
AnomalyRecord record = new AnomalyRecord(jobId, new Date(), 600, j + 1);
|
||||
hits.add(record);
|
||||
|
|
|
@ -14,7 +14,7 @@ public class OpenJobActionRequestTests extends AbstractStreamableXContentTestCas
|
|||
|
||||
@Override
|
||||
protected Request createTestInstance() {
|
||||
Request request = new Request(randomAsciiOfLengthBetween(1, 20));
|
||||
Request request = new Request(randomAlphaOfLengthBetween(1, 20));
|
||||
if (randomBoolean()) {
|
||||
request.setTimeout(TimeValue.timeValueMillis(randomNonNegativeLong()));
|
||||
}
|
||||
|
|
|
@ -14,17 +14,17 @@ import org.elasticsearch.xpack.ml.support.AbstractStreamableTestCase;
|
|||
public class PostDataActionRequestTests extends AbstractStreamableTestCase<PostDataAction.Request> {
|
||||
@Override
|
||||
protected PostDataAction.Request createTestInstance() {
|
||||
PostDataAction.Request request = new PostDataAction.Request(randomAsciiOfLengthBetween(1, 20));
|
||||
PostDataAction.Request request = new PostDataAction.Request(randomAlphaOfLengthBetween(1, 20));
|
||||
if (randomBoolean()) {
|
||||
request.setResetStart(randomAsciiOfLengthBetween(1, 20));
|
||||
request.setResetStart(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
request.setResetEnd(randomAsciiOfLengthBetween(1, 20));
|
||||
request.setResetEnd(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
request.setDataDescription(new DataDescription(randomFrom(DataFormat.values()),
|
||||
randomAsciiOfLengthBetween(1, 20), randomAsciiOfLengthBetween(1, 20),
|
||||
randomAsciiOfLength(1).charAt(0), randomAsciiOfLength(1).charAt(0)));
|
||||
randomAlphaOfLengthBetween(1, 20), randomAlphaOfLengthBetween(1, 20),
|
||||
randomAlphaOfLength(1).charAt(0), randomAlphaOfLength(1).charAt(0)));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
request.setContent(new BytesArray(new byte[0]), randomFrom(XContentType.values()));
|
||||
|
|
|
@ -12,16 +12,16 @@ public class PostDataFlushRequestTests extends AbstractStreamableTestCase<Reques
|
|||
|
||||
@Override
|
||||
protected Request createTestInstance() {
|
||||
Request request = new Request(randomAsciiOfLengthBetween(1, 20));
|
||||
Request request = new Request(randomAlphaOfLengthBetween(1, 20));
|
||||
request.setCalcInterim(randomBoolean());
|
||||
if (randomBoolean()) {
|
||||
request.setStart(randomAsciiOfLengthBetween(1, 20));
|
||||
request.setStart(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
request.setEnd(randomAsciiOfLengthBetween(1, 20));
|
||||
request.setEnd(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
request.setAdvanceTime(randomAsciiOfLengthBetween(1, 20));
|
||||
request.setAdvanceTime(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
return request;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ public class PreviewDatafeedActionRequestTests extends AbstractStreamableTestCas
|
|||
|
||||
@Override
|
||||
protected Request createTestInstance() {
|
||||
return new Request(randomAsciiOfLength(10));
|
||||
return new Request(randomAlphaOfLength(10));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -25,9 +25,9 @@ public class PutDatafeedActionRequestTests extends AbstractStreamableXContentTes
|
|||
|
||||
@Override
|
||||
protected Request createTestInstance() {
|
||||
DatafeedConfig.Builder datafeedConfig = new DatafeedConfig.Builder(datafeedId, randomAsciiOfLength(10));
|
||||
datafeedConfig.setIndexes(Arrays.asList(randomAsciiOfLength(10)));
|
||||
datafeedConfig.setTypes(Arrays.asList(randomAsciiOfLength(10)));
|
||||
DatafeedConfig.Builder datafeedConfig = new DatafeedConfig.Builder(datafeedId, randomAlphaOfLength(10));
|
||||
datafeedConfig.setIndexes(Arrays.asList(randomAlphaOfLength(10)));
|
||||
datafeedConfig.setTypes(Arrays.asList(randomAlphaOfLength(10)));
|
||||
return new Request(datafeedConfig.build());
|
||||
}
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@ public class PutDatafeedActionResponseTests extends AbstractStreamableTestCase<R
|
|||
@Override
|
||||
protected Response createTestInstance() {
|
||||
DatafeedConfig.Builder datafeedConfig = new DatafeedConfig.Builder(
|
||||
DatafeedConfigTests.randomValidDatafeedId(), randomAsciiOfLength(10));
|
||||
datafeedConfig.setIndexes(Arrays.asList(randomAsciiOfLength(10)));
|
||||
datafeedConfig.setTypes(Arrays.asList(randomAsciiOfLength(10)));
|
||||
DatafeedConfigTests.randomValidDatafeedId(), randomAlphaOfLength(10));
|
||||
datafeedConfig.setIndexes(Arrays.asList(randomAlphaOfLength(10)));
|
||||
datafeedConfig.setTypes(Arrays.asList(randomAlphaOfLength(10)));
|
||||
return new Response(randomBoolean(), datafeedConfig.build());
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ public class RevertModelSnapshotActionRequestTests extends AbstractStreamableXCo
|
|||
@Override
|
||||
protected Request createTestInstance() {
|
||||
RevertModelSnapshotAction.Request request =
|
||||
new RevertModelSnapshotAction.Request(randomAsciiOfLengthBetween(1, 20), randomAsciiOfLengthBetween(1, 20));
|
||||
new RevertModelSnapshotAction.Request(randomAlphaOfLengthBetween(1, 20), randomAlphaOfLengthBetween(1, 20));
|
||||
if (randomBoolean()) {
|
||||
request.setDeleteInterveningResults(randomBoolean());
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ public class StartDatafeedActionRequestTests extends AbstractStreamableXContentT
|
|||
|
||||
@Override
|
||||
protected Request createTestInstance() {
|
||||
Request request = new Request(randomAsciiOfLength(10), randomNonNegativeLong());
|
||||
Request request = new Request(randomAlphaOfLength(10), randomNonNegativeLong());
|
||||
if (randomBoolean()) {
|
||||
request.setEndTime(randomNonNegativeLong());
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public class StopDatafeedActionRequestTests extends AbstractStreamableXContentTe
|
|||
|
||||
@Override
|
||||
protected Request createTestInstance() {
|
||||
Request request = new Request(randomAsciiOfLengthBetween(1, 20));
|
||||
Request request = new Request(randomAlphaOfLengthBetween(1, 20));
|
||||
if (randomBoolean()) {
|
||||
request.setTimeout(TimeValue.timeValueMillis(randomNonNegativeLong()));
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public class UpdateJobActionRequestTests
|
|||
|
||||
@Override
|
||||
protected UpdateJobAction.Request createTestInstance() {
|
||||
String jobId = randomAsciiOfLength(10);
|
||||
String jobId = randomAlphaOfLength(10);
|
||||
// no need to randomize JobUpdate this is already tested in: JobUpdateTests
|
||||
JobUpdate.Builder jobUpdate = new JobUpdate.Builder(jobId);
|
||||
jobUpdate.setAnalysisLimits(new AnalysisLimits(100L, 100L));
|
||||
|
|
|
@ -19,10 +19,10 @@ public class UpdateModelSnapshotActionRequestTests
|
|||
|
||||
@Override
|
||||
protected Request createTestInstance() {
|
||||
Request request = new Request(randomAsciiOfLengthBetween(1, 20),
|
||||
randomAsciiOfLengthBetween(1, 20));
|
||||
Request request = new Request(randomAlphaOfLengthBetween(1, 20),
|
||||
randomAlphaOfLengthBetween(1, 20));
|
||||
if (randomBoolean()) {
|
||||
request.setDescription(randomAsciiOfLengthBetween(1, 20));
|
||||
request.setDescription(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
request.setRetain(randomBoolean());
|
||||
|
|
|
@ -18,16 +18,16 @@ public class UpdateProcessActionRequestTests extends AbstractStreamableTestCase<
|
|||
protected UpdateProcessAction.Request createTestInstance() {
|
||||
ModelPlotConfig config = null;
|
||||
if (randomBoolean()) {
|
||||
config = new ModelPlotConfig(randomBoolean(), randomAsciiOfLength(10));
|
||||
config = new ModelPlotConfig(randomBoolean(), randomAlphaOfLength(10));
|
||||
}
|
||||
List<JobUpdate.DetectorUpdate> updates = null;
|
||||
if (randomBoolean()) {
|
||||
int detectorUpdateCount = randomIntBetween(0, 5);
|
||||
for (int i = 0; i < detectorUpdateCount; i++) {
|
||||
new JobUpdate.DetectorUpdate(randomInt(), randomAsciiOfLength(10), null);
|
||||
new JobUpdate.DetectorUpdate(randomInt(), randomAlphaOfLength(10), null);
|
||||
}
|
||||
}
|
||||
return new UpdateProcessAction.Request(randomAsciiOfLength(10), config, updates);
|
||||
return new UpdateProcessAction.Request(randomAlphaOfLength(10), config, updates);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,7 +18,7 @@ public class ValidateDetectorActionRequestTests extends AbstractStreamableXConte
|
|||
if (randomBoolean()) {
|
||||
detector = new Detector.Builder(randomFrom(Detector.COUNT_WITHOUT_FIELD_FUNCTIONS), null);
|
||||
} else {
|
||||
detector = new Detector.Builder(randomFrom(Detector.FIELD_NAME_FUNCTIONS), randomAsciiOfLengthBetween(1, 20));
|
||||
detector = new Detector.Builder(randomFrom(Detector.FIELD_NAME_FUNCTIONS), randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
return new Request(detector.build());
|
||||
}
|
||||
|
|
|
@ -20,8 +20,8 @@ public class QueryPageTests extends AbstractWireSerializingTestCase<QueryPage<In
|
|||
int hitCount = randomIntBetween(0, 10);
|
||||
ArrayList<Influencer> hits = new ArrayList<>();
|
||||
for (int i = 0; i < hitCount; i++) {
|
||||
hits.add(new Influencer(randomAsciiOfLengthBetween(1, 20), randomAsciiOfLengthBetween(1, 20),
|
||||
randomAsciiOfLengthBetween(1, 20), new Date(), randomNonNegativeLong(), i + 1));
|
||||
hits.add(new Influencer(randomAlphaOfLengthBetween(1, 20), randomAlphaOfLengthBetween(1, 20),
|
||||
randomAlphaOfLengthBetween(1, 20), new Date(), randomNonNegativeLong(), i + 1));
|
||||
}
|
||||
return new QueryPage<>(hits, hitCount, new ParseField("test"));
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public class DatafeedConfigTests extends AbstractSerializingTestCase<DatafeedCon
|
|||
|
||||
@Override
|
||||
protected DatafeedConfig createTestInstance() {
|
||||
return createRandomizedDatafeedConfig(randomAsciiOfLength(10));
|
||||
return createRandomizedDatafeedConfig(randomAlphaOfLength(10));
|
||||
}
|
||||
|
||||
public static DatafeedConfig createRandomizedDatafeedConfig(String jobId) {
|
||||
|
@ -48,14 +48,14 @@ public class DatafeedConfigTests extends AbstractSerializingTestCase<DatafeedCon
|
|||
builder.setIndexes(randomStringList(1, 10));
|
||||
builder.setTypes(randomStringList(1, 10));
|
||||
if (randomBoolean()) {
|
||||
builder.setQuery(QueryBuilders.termQuery(randomAsciiOfLength(10), randomAsciiOfLength(10)));
|
||||
builder.setQuery(QueryBuilders.termQuery(randomAlphaOfLength(10), randomAlphaOfLength(10)));
|
||||
}
|
||||
boolean addScriptFields = randomBoolean();
|
||||
if (addScriptFields) {
|
||||
int scriptsSize = randomInt(3);
|
||||
List<SearchSourceBuilder.ScriptField> scriptFields = new ArrayList<>(scriptsSize);
|
||||
for (int scriptIndex = 0; scriptIndex < scriptsSize; scriptIndex++) {
|
||||
scriptFields.add(new SearchSourceBuilder.ScriptField(randomAsciiOfLength(10), new Script(randomAsciiOfLength(10)),
|
||||
scriptFields.add(new SearchSourceBuilder.ScriptField(randomAlphaOfLength(10), new Script(randomAlphaOfLength(10)),
|
||||
randomBoolean()));
|
||||
}
|
||||
builder.setScriptFields(scriptFields);
|
||||
|
@ -93,7 +93,7 @@ public class DatafeedConfigTests extends AbstractSerializingTestCase<DatafeedCon
|
|||
int size = scaledRandomIntBetween(min, max);
|
||||
List<String> list = new ArrayList<>();
|
||||
for (int i = 0; i < size; i++) {
|
||||
list.add(randomAsciiOfLength(10));
|
||||
list.add(randomAlphaOfLength(10));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
@ -191,8 +191,8 @@ public class DatafeedConfigTests extends AbstractSerializingTestCase<DatafeedCon
|
|||
DatafeedConfig.Builder datafeed = new DatafeedConfig.Builder("datafeed1", "job1");
|
||||
datafeed.setIndexes(Arrays.asList("my_index"));
|
||||
datafeed.setTypes(Arrays.asList("my_type"));
|
||||
datafeed.setScriptFields(Arrays.asList(new SearchSourceBuilder.ScriptField(randomAsciiOfLength(10),
|
||||
new Script(randomAsciiOfLength(10)), randomBoolean())));
|
||||
datafeed.setScriptFields(Arrays.asList(new SearchSourceBuilder.ScriptField(randomAlphaOfLength(10),
|
||||
new Script(randomAlphaOfLength(10)), randomBoolean())));
|
||||
datafeed.setAggregations(new AggregatorFactories.Builder().addAggregator(AggregationBuilders.avg("foo")));
|
||||
|
||||
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> datafeed.build());
|
||||
|
|
|
@ -32,7 +32,7 @@ public class DatafeedUpdateTests extends AbstractSerializingTestCase<DatafeedUpd
|
|||
public static DatafeedUpdate createRandomized(String datafeedId) {
|
||||
DatafeedUpdate.Builder builder = new DatafeedUpdate.Builder(datafeedId);
|
||||
if (randomBoolean()) {
|
||||
builder.setJobId(randomAsciiOfLength(10));
|
||||
builder.setJobId(randomAlphaOfLength(10));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
builder.setQueryDelay(TimeValue.timeValueMillis(randomIntBetween(1, Integer.MAX_VALUE)));
|
||||
|
@ -47,13 +47,13 @@ public class DatafeedUpdateTests extends AbstractSerializingTestCase<DatafeedUpd
|
|||
builder.setTypes(DatafeedConfigTests.randomStringList(1, 10));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
builder.setQuery(QueryBuilders.termQuery(randomAsciiOfLength(10), randomAsciiOfLength(10)));
|
||||
builder.setQuery(QueryBuilders.termQuery(randomAlphaOfLength(10), randomAlphaOfLength(10)));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
int scriptsSize = randomInt(3);
|
||||
List<SearchSourceBuilder.ScriptField> scriptFields = new ArrayList<>(scriptsSize);
|
||||
for (int scriptIndex = 0; scriptIndex < scriptsSize; scriptIndex++) {
|
||||
scriptFields.add(new SearchSourceBuilder.ScriptField(randomAsciiOfLength(10), new Script(randomAsciiOfLength(10)),
|
||||
scriptFields.add(new SearchSourceBuilder.ScriptField(randomAlphaOfLength(10), new Script(randomAlphaOfLength(10)),
|
||||
randomBoolean()));
|
||||
}
|
||||
builder.setScriptFields(scriptFields);
|
||||
|
@ -63,7 +63,7 @@ public class DatafeedUpdateTests extends AbstractSerializingTestCase<DatafeedUpd
|
|||
// the actual xcontent isn't the same and test fail.
|
||||
// Testing with a single agg is ok as we don't have special list writeable / xconent logic
|
||||
AggregatorFactories.Builder aggs = new AggregatorFactories.Builder();
|
||||
aggs.addAggregator(AggregationBuilders.avg(randomAsciiOfLength(10)).field(randomAsciiOfLength(10)));
|
||||
aggs.addAggregator(AggregationBuilders.avg(randomAlphaOfLength(10)).field(randomAlphaOfLength(10)));
|
||||
builder.setAggregations(aggs);
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
|
|
|
@ -287,7 +287,7 @@ public class AggregationDataExtractorTests extends ESTestCase {
|
|||
private SearchResponse createSearchResponse(Aggregations aggregations) {
|
||||
SearchResponse searchResponse = mock(SearchResponse.class);
|
||||
when(searchResponse.status()).thenReturn(RestStatus.OK);
|
||||
when(searchResponse.getScrollId()).thenReturn(randomAsciiOfLength(1000));
|
||||
when(searchResponse.getScrollId()).thenReturn(randomAlphaOfLength(1000));
|
||||
when(searchResponse.getAggregations()).thenReturn(aggregations);
|
||||
return searchResponse;
|
||||
}
|
||||
|
|
|
@ -340,7 +340,7 @@ public class ScrollDataExtractorTests extends ESTestCase {
|
|||
private SearchResponse createSearchResponse(List<Long> timestamps, List<String> field1Values, List<String> field2Values) {
|
||||
SearchResponse searchResponse = mock(SearchResponse.class);
|
||||
when(searchResponse.status()).thenReturn(RestStatus.OK);
|
||||
when(searchResponse.getScrollId()).thenReturn(randomAsciiOfLength(1000));
|
||||
when(searchResponse.getScrollId()).thenReturn(randomAlphaOfLength(1000));
|
||||
List<SearchHit> hits = new ArrayList<>();
|
||||
for (int i = 0; i < timestamps.size(); i++) {
|
||||
SearchHit hit = new SearchHit(randomInt());
|
||||
|
|
|
@ -263,7 +263,7 @@ public class AutodetectResultProcessorIT extends ESSingleNodeTestCase {
|
|||
for (int i=0; i<count; i++) {
|
||||
AnomalyRecord r = new AnomalyRecord(JOB_ID, now, 3600L, i);
|
||||
r.setByFieldName("by_instance");
|
||||
r.setByFieldValue(randomAsciiOfLength(8));
|
||||
r.setByFieldValue(randomAlphaOfLength(8));
|
||||
r.setInterim(isInterim);
|
||||
records.add(r);
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ public class AutodetectResultProcessorIT extends ESSingleNodeTestCase {
|
|||
int count = randomIntBetween(0, 100);
|
||||
Date now = new Date();
|
||||
for (int i=0; i<count; i++) {
|
||||
Influencer influencer = new Influencer(JOB_ID, "influence_field", randomAsciiOfLength(10), now, 3600L, i);
|
||||
Influencer influencer = new Influencer(JOB_ID, "influence_field", randomAlphaOfLength(10), now, 3600L, i);
|
||||
influencer.setInterim(isInterim);
|
||||
influencers.add(influencer);
|
||||
}
|
||||
|
@ -293,7 +293,7 @@ public class AutodetectResultProcessorIT extends ESSingleNodeTestCase {
|
|||
|
||||
private ModelSizeStats createModelSizeStats() {
|
||||
ModelSizeStats.Builder builder = new ModelSizeStats.Builder(JOB_ID);
|
||||
builder.setId(randomAsciiOfLength(20));
|
||||
builder.setId(randomAlphaOfLength(20));
|
||||
builder.setTimestamp(new Date(randomNonNegativeLong()));
|
||||
builder.setLogTime(new Date(randomNonNegativeLong()));
|
||||
builder.setBucketAllocationFailuresCount(randomNonNegativeLong());
|
||||
|
@ -306,15 +306,15 @@ public class AutodetectResultProcessorIT extends ESSingleNodeTestCase {
|
|||
}
|
||||
|
||||
private ModelSnapshot createModelSnapshot() {
|
||||
return new ModelSnapshot.Builder(JOB_ID).setSnapshotId(randomAsciiOfLength(12)).build();
|
||||
return new ModelSnapshot.Builder(JOB_ID).setSnapshotId(randomAlphaOfLength(12)).build();
|
||||
}
|
||||
|
||||
private Quantiles createQuantiles() {
|
||||
return new Quantiles(JOB_ID, new Date(randomNonNegativeLong()), randomAsciiOfLength(100));
|
||||
return new Quantiles(JOB_ID, new Date(randomNonNegativeLong()), randomAlphaOfLength(100));
|
||||
}
|
||||
|
||||
private FlushAcknowledgement createFlushAcknowledgement() {
|
||||
return new FlushAcknowledgement(randomAsciiOfLength(5));
|
||||
return new FlushAcknowledgement(randomAlphaOfLength(5));
|
||||
}
|
||||
|
||||
private class ResultsBuilder {
|
||||
|
|
|
@ -46,7 +46,7 @@ public class AnalysisConfigTests extends AbstractSerializingTestCase<AnalysisCon
|
|||
builder.setBucketSpan(bucketSpan);
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
builder.setCategorizationFieldName(randomAsciiOfLength(10));
|
||||
builder.setCategorizationFieldName(randomAlphaOfLength(10));
|
||||
builder.setCategorizationFilters(Arrays.asList(generateRandomStringArray(10, 10, false)));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
|
|
|
@ -5,17 +5,12 @@
|
|||
*/
|
||||
package org.elasticsearch.xpack.ml.job.config;
|
||||
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.common.io.stream.Writeable.Reader;
|
||||
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.xpack.ml.job.messages.Messages;
|
||||
import org.elasticsearch.xpack.ml.support.AbstractSerializingTestCase;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
|
||||
public class ConditionTests extends AbstractSerializingTestCase<Condition> {
|
||||
|
||||
public void testSetValues() {
|
||||
|
@ -49,7 +44,7 @@ public class ConditionTests extends AbstractSerializingTestCase<Condition> {
|
|||
condition = new Condition(op, Double.toString(randomDouble()));
|
||||
break;
|
||||
case MATCH:
|
||||
condition = new Condition(op, randomAsciiOfLengthBetween(1, 20));
|
||||
condition = new Condition(op, randomAlphaOfLengthBetween(1, 20));
|
||||
break;
|
||||
default:
|
||||
throw new AssertionError("Unknown operator selected: " + op);
|
||||
|
|
|
@ -240,7 +240,7 @@ public class DataDescriptionTests extends AbstractSerializingTestCase<DataDescri
|
|||
dataDescription.setFormat(randomFrom(DataFormat.values()));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
dataDescription.setTimeField(randomAsciiOfLengthBetween(1, 20));
|
||||
dataDescription.setTimeField(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
String format;
|
||||
|
@ -254,10 +254,10 @@ public class DataDescriptionTests extends AbstractSerializingTestCase<DataDescri
|
|||
dataDescription.setTimeFormat(format);
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
dataDescription.setFieldDelimiter(randomAsciiOfLength(1).charAt(0));
|
||||
dataDescription.setFieldDelimiter(randomAlphaOfLength(1).charAt(0));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
dataDescription.setQuoteCharacter(randomAsciiOfLength(1).charAt(0));
|
||||
dataDescription.setQuoteCharacter(randomAlphaOfLength(1).charAt(0));
|
||||
}
|
||||
return dataDescription.build();
|
||||
}
|
||||
|
|
|
@ -89,8 +89,8 @@ public class DetectionRuleTests extends AbstractSerializingTestCase<DetectionRul
|
|||
String targetFieldValue = null;
|
||||
Connective connective = randomFrom(Connective.values());
|
||||
if (randomBoolean()) {
|
||||
targetFieldName = randomAsciiOfLengthBetween(1, 20);
|
||||
targetFieldValue = randomAsciiOfLengthBetween(1, 20);
|
||||
targetFieldName = randomAlphaOfLengthBetween(1, 20);
|
||||
targetFieldValue = randomAlphaOfLengthBetween(1, 20);
|
||||
}
|
||||
int size = 1 + randomInt(20);
|
||||
List<RuleCondition> ruleConditions = new ArrayList<>(size);
|
||||
|
|
|
@ -136,18 +136,18 @@ public class DetectorTests extends AbstractSerializingTestCase<Detector> {
|
|||
} else {
|
||||
Set<String> functions = new HashSet<>(Detector.FIELD_NAME_FUNCTIONS);
|
||||
functions.removeAll(Detector.Builder.FUNCTIONS_WITHOUT_RULE_SUPPORT);
|
||||
detector = new Detector.Builder(function = randomFrom(functions), randomAsciiOfLengthBetween(1, 20));
|
||||
detector = new Detector.Builder(function = randomFrom(functions), randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
detector.setDetectorDescription(randomAsciiOfLengthBetween(1, 20));
|
||||
detector.setDetectorDescription(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
String fieldName = null;
|
||||
if (randomBoolean()) {
|
||||
detector.setPartitionFieldName(fieldName = randomAsciiOfLengthBetween(1, 20));
|
||||
detector.setPartitionFieldName(fieldName = randomAlphaOfLengthBetween(1, 20));
|
||||
} else if (randomBoolean() && Detector.NO_OVER_FIELD_NAME_FUNCTIONS.contains(function) == false) {
|
||||
detector.setOverFieldName(fieldName = randomAsciiOfLengthBetween(1, 20));
|
||||
detector.setOverFieldName(fieldName = randomAlphaOfLengthBetween(1, 20));
|
||||
} else if (randomBoolean() && Detector.NO_BY_FIELD_NAME_FUNCTIONS.contains(function) == false) {
|
||||
detector.setByFieldName(fieldName = randomAsciiOfLengthBetween(1, 20));
|
||||
detector.setByFieldName(fieldName = randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
detector.setExcludeFrequent(randomFrom(Detector.ExcludeFrequent.values()));
|
||||
|
|
|
@ -23,7 +23,7 @@ public class JobBuilderTests extends AbstractSerializingTestCase<Job.Builder> {
|
|||
builder.setId(randomValidJobId());
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
builder.setDescription(randomAsciiOfLength(10));
|
||||
builder.setDescription(randomAlphaOfLength(10));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
builder.setCreateTime(new Date(randomNonNegativeLong()));
|
||||
|
@ -48,7 +48,7 @@ public class JobBuilderTests extends AbstractSerializingTestCase<Job.Builder> {
|
|||
}
|
||||
if (randomBoolean()) {
|
||||
builder.setModelPlotConfig(new ModelPlotConfig(randomBoolean(),
|
||||
randomAsciiOfLength(10)));
|
||||
randomAlphaOfLength(10)));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
builder.setRenormalizationWindowDays(randomNonNegativeLong());
|
||||
|
@ -63,11 +63,11 @@ public class JobBuilderTests extends AbstractSerializingTestCase<Job.Builder> {
|
|||
builder.setResultsRetentionDays(randomNonNegativeLong());
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
builder.setCustomSettings(Collections.singletonMap(randomAsciiOfLength(10),
|
||||
randomAsciiOfLength(10)));
|
||||
builder.setCustomSettings(Collections.singletonMap(randomAlphaOfLength(10),
|
||||
randomAlphaOfLength(10)));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
builder.setModelSnapshotId(randomAsciiOfLength(10));
|
||||
builder.setModelSnapshotId(randomAlphaOfLength(10));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
builder.setResultsIndexName(randomValidJobId());
|
||||
|
|
|
@ -382,7 +382,7 @@ public class JobTests extends AbstractSerializingTestCase<Job> {
|
|||
String jobId = randomValidJobId();
|
||||
Job.Builder builder = new Job.Builder(jobId);
|
||||
if (randomBoolean()) {
|
||||
builder.setDescription(randomAsciiOfLength(10));
|
||||
builder.setDescription(randomAlphaOfLength(10));
|
||||
}
|
||||
builder.setCreateTime(new Date(randomNonNegativeLong()));
|
||||
if (randomBoolean()) {
|
||||
|
@ -399,7 +399,7 @@ public class JobTests extends AbstractSerializingTestCase<Job> {
|
|||
builder.setDataDescription(dataDescription);
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
builder.setModelPlotConfig(new ModelPlotConfig(randomBoolean(), randomAsciiOfLength(10)));
|
||||
builder.setModelPlotConfig(new ModelPlotConfig(randomBoolean(), randomAlphaOfLength(10)));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
builder.setRenormalizationWindowDays(randomNonNegativeLong());
|
||||
|
@ -414,10 +414,10 @@ public class JobTests extends AbstractSerializingTestCase<Job> {
|
|||
builder.setResultsRetentionDays(randomNonNegativeLong());
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
builder.setCustomSettings(Collections.singletonMap(randomAsciiOfLength(10), randomAsciiOfLength(10)));
|
||||
builder.setCustomSettings(Collections.singletonMap(randomAlphaOfLength(10), randomAlphaOfLength(10)));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
builder.setModelSnapshotId(randomAsciiOfLength(10));
|
||||
builder.setModelSnapshotId(randomAlphaOfLength(10));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
builder.setResultsIndexName(randomValidJobId());
|
||||
|
|
|
@ -23,9 +23,9 @@ public class JobUpdateTests extends AbstractSerializingTestCase<JobUpdate> {
|
|||
|
||||
@Override
|
||||
protected JobUpdate createTestInstance() {
|
||||
JobUpdate.Builder update = new JobUpdate.Builder(randomAsciiOfLength(4));
|
||||
JobUpdate.Builder update = new JobUpdate.Builder(randomAlphaOfLength(4));
|
||||
if (randomBoolean()) {
|
||||
update.setDescription(randomAsciiOfLength(20));
|
||||
update.setDescription(randomAlphaOfLength(20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
List<JobUpdate.DetectorUpdate> detectorUpdates = null;
|
||||
|
@ -34,7 +34,7 @@ public class JobUpdateTests extends AbstractSerializingTestCase<JobUpdate> {
|
|||
for (int i = 0; i < size; i++) {
|
||||
String detectorDescription = null;
|
||||
if (randomBoolean()) {
|
||||
detectorDescription = randomAsciiOfLength(12);
|
||||
detectorDescription = randomAlphaOfLength(12);
|
||||
}
|
||||
List<DetectionRule> detectionRules = null;
|
||||
if (randomBoolean()) {
|
||||
|
@ -48,7 +48,7 @@ public class JobUpdateTests extends AbstractSerializingTestCase<JobUpdate> {
|
|||
update.setDetectorUpdates(detectorUpdates);
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
update.setModelPlotConfig(new ModelPlotConfig(randomBoolean(), randomAsciiOfLength(10)));
|
||||
update.setModelPlotConfig(new ModelPlotConfig(randomBoolean(), randomAlphaOfLength(10)));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
update.setAnalysisLimits(new AnalysisLimits(randomNonNegativeLong(), randomNonNegativeLong()));
|
||||
|
@ -69,10 +69,10 @@ public class JobUpdateTests extends AbstractSerializingTestCase<JobUpdate> {
|
|||
update.setCategorizationFilters(Arrays.asList(generateRandomStringArray(10, 10, false)));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
update.setCustomSettings(Collections.singletonMap(randomAsciiOfLength(10), randomAsciiOfLength(10)));
|
||||
update.setCustomSettings(Collections.singletonMap(randomAlphaOfLength(10), randomAlphaOfLength(10)));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
update.setModelSnapshotId(randomAsciiOfLength(10));
|
||||
update.setModelSnapshotId(randomAlphaOfLength(10));
|
||||
}
|
||||
|
||||
return update.build();
|
||||
|
@ -99,10 +99,10 @@ public class JobUpdateTests extends AbstractSerializingTestCase<JobUpdate> {
|
|||
new RuleCondition(RuleConditionType.NUMERICAL_ACTUAL, null, null, new Condition(Operator.GT, "5"), null))));
|
||||
detectorUpdates.add(new JobUpdate.DetectorUpdate(1, "description-2", detectionRules2));
|
||||
|
||||
ModelPlotConfig modelPlotConfig = new ModelPlotConfig(randomBoolean(), randomAsciiOfLength(10));
|
||||
ModelPlotConfig modelPlotConfig = new ModelPlotConfig(randomBoolean(), randomAlphaOfLength(10));
|
||||
AnalysisLimits analysisLimits = new AnalysisLimits(randomNonNegativeLong(), randomNonNegativeLong());
|
||||
List<String> categorizationFilters = Arrays.asList(generateRandomStringArray(10, 10, false));
|
||||
Map<String, Object> customSettings = Collections.singletonMap(randomAsciiOfLength(10), randomAsciiOfLength(10));
|
||||
Map<String, Object> customSettings = Collections.singletonMap(randomAlphaOfLength(10), randomAlphaOfLength(10));
|
||||
|
||||
JobUpdate.Builder updateBuilder = new JobUpdate.Builder("foo");
|
||||
updateBuilder.setDescription("updated_description");
|
||||
|
@ -115,7 +115,7 @@ public class JobUpdateTests extends AbstractSerializingTestCase<JobUpdate> {
|
|||
updateBuilder.setRenormalizationWindowDays(randomNonNegativeLong());
|
||||
updateBuilder.setCategorizationFilters(categorizationFilters);
|
||||
updateBuilder.setCustomSettings(customSettings);
|
||||
updateBuilder.setModelSnapshotId(randomAsciiOfLength(10));
|
||||
updateBuilder.setModelSnapshotId(randomAlphaOfLength(10));
|
||||
JobUpdate update = updateBuilder.build();
|
||||
|
||||
Job.Builder jobBuilder = new Job.Builder("foo");
|
||||
|
|
|
@ -20,9 +20,9 @@ public class MlFilterTests extends AbstractSerializingTestCase<MlFilter> {
|
|||
int size = randomInt(10);
|
||||
List<String> items = new ArrayList<>(size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
items.add(randomAsciiOfLengthBetween(1, 20));
|
||||
items.add(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
return new MlFilter(randomAsciiOfLengthBetween(1, 20), items);
|
||||
return new MlFilter(randomAlphaOfLengthBetween(1, 20), items);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -42,7 +42,7 @@ public class MlFilterTests extends AbstractSerializingTestCase<MlFilter> {
|
|||
|
||||
public void testNullItems() {
|
||||
NullPointerException ex =
|
||||
expectThrows(NullPointerException.class, () -> new MlFilter(randomAsciiOfLengthBetween(1, 20), null));
|
||||
expectThrows(NullPointerException.class, () -> new MlFilter(randomAlphaOfLengthBetween(1, 20), null));
|
||||
assertEquals(MlFilter.ITEMS.getPreferredName() + " must not be null", ex.getMessage());
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ public class ModelPlotConfigTests extends AbstractSerializingTestCase<ModelPlotC
|
|||
|
||||
@Override
|
||||
protected ModelPlotConfig createTestInstance() {
|
||||
return new ModelPlotConfig(randomBoolean(), randomAsciiOfLengthBetween(1, 30));
|
||||
return new ModelPlotConfig(randomBoolean(), randomAlphaOfLengthBetween(1, 30));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,9 +21,9 @@ public class RuleConditionTests extends AbstractSerializingTestCase<RuleConditio
|
|||
RuleConditionType r = randomFrom(RuleConditionType.values());
|
||||
switch (r) {
|
||||
case CATEGORICAL:
|
||||
valueFilter = randomAsciiOfLengthBetween(1, 20);
|
||||
valueFilter = randomAlphaOfLengthBetween(1, 20);
|
||||
if (randomBoolean()) {
|
||||
fieldName = randomAsciiOfLengthBetween(1, 20);
|
||||
fieldName = randomAlphaOfLengthBetween(1, 20);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -31,8 +31,8 @@ public class RuleConditionTests extends AbstractSerializingTestCase<RuleConditio
|
|||
// ConditionTest
|
||||
condition = new Condition(Operator.LT, Double.toString(randomDouble()));
|
||||
if (randomBoolean()) {
|
||||
fieldName = randomAsciiOfLengthBetween(1, 20);
|
||||
fieldValue = randomAsciiOfLengthBetween(1, 20);
|
||||
fieldName = randomAlphaOfLengthBetween(1, 20);
|
||||
fieldValue = randomAlphaOfLengthBetween(1, 20);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ public class FlushAcknowledgementTests extends AbstractSerializingTestCase<Flush
|
|||
|
||||
@Override
|
||||
protected FlushAcknowledgement createTestInstance() {
|
||||
return new FlushAcknowledgement(randomAsciiOfLengthBetween(1, 20));
|
||||
return new FlushAcknowledgement(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,7 +18,7 @@ public class DataCountsTests extends AbstractSerializingTestCase<DataCounts> {
|
|||
|
||||
@Override
|
||||
public DataCounts createTestInstance() {
|
||||
return new DataCounts(randomAsciiOfLength(10), randomIntBetween(1, 1_000_000),
|
||||
return new DataCounts(randomAlphaOfLength(10), randomIntBetween(1, 1_000_000),
|
||||
randomIntBetween(1, 1_000_000), randomIntBetween(1, 1_000_000), randomIntBetween(1, 1_000_000),
|
||||
randomIntBetween(1, 1_000_000), randomIntBetween(1, 1_000_000), randomIntBetween(1, 1_000_000),
|
||||
randomIntBetween(1, 1_000_000), randomIntBetween(1, 1_000_000), randomIntBetween(1, 1_000_000),
|
||||
|
@ -59,7 +59,7 @@ public class DataCountsTests extends AbstractSerializingTestCase<DataCounts> {
|
|||
}
|
||||
|
||||
public void testCountCreatedZero() throws Exception {
|
||||
DataCounts counts = new DataCounts(randomAsciiOfLength(16));
|
||||
DataCounts counts = new DataCounts(randomAlphaOfLength(16));
|
||||
assertAllFieldsEqualZero(counts);
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ public class DataCountsTests extends AbstractSerializingTestCase<DataCounts> {
|
|||
}
|
||||
|
||||
public void testIncrements() {
|
||||
DataCounts counts = new DataCounts(randomAsciiOfLength(16));
|
||||
DataCounts counts = new DataCounts(randomAlphaOfLength(16));
|
||||
|
||||
counts.incrementInputBytes(15);
|
||||
assertEquals(15, counts.getInputBytes());
|
||||
|
@ -91,7 +91,7 @@ public class DataCountsTests extends AbstractSerializingTestCase<DataCounts> {
|
|||
}
|
||||
|
||||
public void testGetInputRecordCount() {
|
||||
DataCounts counts = new DataCounts(randomAsciiOfLength(16));
|
||||
DataCounts counts = new DataCounts(randomAlphaOfLength(16));
|
||||
counts.incrementProcessedRecordCount(5);
|
||||
assertEquals(5, counts.getInputRecordCount());
|
||||
|
||||
|
@ -103,13 +103,13 @@ public class DataCountsTests extends AbstractSerializingTestCase<DataCounts> {
|
|||
}
|
||||
|
||||
public void testCalcProcessedFieldCount() {
|
||||
DataCounts counts = new DataCounts(randomAsciiOfLength(16), 10L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, new Date(), new Date(),
|
||||
DataCounts counts = new DataCounts(randomAlphaOfLength(16), 10L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, new Date(), new Date(),
|
||||
new Date(), new Date(), new Date());
|
||||
counts.calcProcessedFieldCount(3);
|
||||
|
||||
assertEquals(30, counts.getProcessedFieldCount());
|
||||
|
||||
counts = new DataCounts(randomAsciiOfLength(16), 10L, 0L, 0L, 0L, 0L, 5L, 0L, 0L, 0L, 0L, new Date(), new Date(),
|
||||
counts = new DataCounts(randomAlphaOfLength(16), 10L, 0L, 0L, 0L, 0L, 5L, 0L, 0L, 0L, 0L, new Date(), new Date(),
|
||||
new Date(), new Date(), new Date());
|
||||
counts.calcProcessedFieldCount(3);
|
||||
assertEquals(25, counts.getProcessedFieldCount());
|
||||
|
@ -117,7 +117,7 @@ public class DataCountsTests extends AbstractSerializingTestCase<DataCounts> {
|
|||
|
||||
public void testEquals() {
|
||||
DataCounts counts1 = new DataCounts(
|
||||
randomAsciiOfLength(16), 10L, 5000L, 2000L, 300L, 6L, 15L, 0L, 0L, 0L, 0L, new Date(), new Date(1435000000L),
|
||||
randomAlphaOfLength(16), 10L, 5000L, 2000L, 300L, 6L, 15L, 0L, 0L, 0L, 0L, new Date(), new Date(1435000000L),
|
||||
new Date(), new Date(), new Date());
|
||||
DataCounts counts2 = new DataCounts(counts1);
|
||||
|
||||
|
@ -127,7 +127,7 @@ public class DataCountsTests extends AbstractSerializingTestCase<DataCounts> {
|
|||
}
|
||||
|
||||
public void testSetEarliestRecordTimestamp_doesnotOverwrite() {
|
||||
DataCounts counts = new DataCounts(randomAsciiOfLength(12));
|
||||
DataCounts counts = new DataCounts(randomAlphaOfLength(12));
|
||||
counts.setEarliestRecordTimeStamp(new Date(100L));
|
||||
|
||||
expectThrows(IllegalStateException.class, () -> counts.setEarliestRecordTimeStamp(new Date(200L)));
|
||||
|
|
|
@ -77,7 +77,7 @@ public class ModelSizeStatsTests extends AbstractSerializingTestCase<ModelSizeSt
|
|||
stats.setMemoryStatus(randomFrom(MemoryStatus.values()));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
stats.setId(randomAsciiOfLengthBetween(1, 20));
|
||||
stats.setId(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
return stats.build();
|
||||
}
|
||||
|
|
|
@ -143,10 +143,10 @@ public class ModelSnapshotTests extends AbstractSerializingTestCase<ModelSnapsho
|
|||
}
|
||||
|
||||
public static ModelSnapshot createRandomized() {
|
||||
ModelSnapshot.Builder modelSnapshot = new ModelSnapshot.Builder(randomAsciiOfLengthBetween(1, 20));
|
||||
ModelSnapshot.Builder modelSnapshot = new ModelSnapshot.Builder(randomAlphaOfLengthBetween(1, 20));
|
||||
modelSnapshot.setTimestamp(new Date(TimeValue.parseTimeValue(randomTimeValue(), "test").millis()));
|
||||
modelSnapshot.setDescription(randomAsciiOfLengthBetween(1, 20));
|
||||
modelSnapshot.setSnapshotId(randomAsciiOfLengthBetween(1, 20));
|
||||
modelSnapshot.setDescription(randomAlphaOfLengthBetween(1, 20));
|
||||
modelSnapshot.setSnapshotId(randomAlphaOfLengthBetween(1, 20));
|
||||
modelSnapshot.setSnapshotDocCount(randomInt());
|
||||
modelSnapshot.setModelSizeStats(ModelSizeStatsTests.createRandomized());
|
||||
modelSnapshot.setLatestResultTimeStamp(
|
||||
|
|
|
@ -61,9 +61,9 @@ public class QuantilesTests extends AbstractSerializingTestCase<Quantiles> {
|
|||
}
|
||||
|
||||
public static Quantiles createRandomized() {
|
||||
return new Quantiles(randomAsciiOfLengthBetween(1, 20),
|
||||
return new Quantiles(randomAlphaOfLengthBetween(1, 20),
|
||||
new Date(TimeValue.parseTimeValue(randomTimeValue(), "test").millis()),
|
||||
randomAsciiOfLengthBetween(0, 1000));
|
||||
randomAlphaOfLengthBetween(0, 1000));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,34 +34,34 @@ public class AnomalyCauseTests extends AbstractSerializingTestCase<AnomalyCause>
|
|||
anomalyCause.setTypical(typical);
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
anomalyCause.setByFieldName(randomAsciiOfLengthBetween(1, 20));
|
||||
anomalyCause.setByFieldName(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
anomalyCause.setByFieldValue(randomAsciiOfLengthBetween(1, 20));
|
||||
anomalyCause.setByFieldValue(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
anomalyCause.setCorrelatedByFieldValue(randomAsciiOfLengthBetween(1, 20));
|
||||
anomalyCause.setCorrelatedByFieldValue(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
anomalyCause.setOverFieldName(randomAsciiOfLengthBetween(1, 20));
|
||||
anomalyCause.setOverFieldName(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
anomalyCause.setOverFieldValue(randomAsciiOfLengthBetween(1, 20));
|
||||
anomalyCause.setOverFieldValue(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
anomalyCause.setPartitionFieldName(randomAsciiOfLengthBetween(1, 20));
|
||||
anomalyCause.setPartitionFieldName(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
anomalyCause.setPartitionFieldValue(randomAsciiOfLengthBetween(1, 20));
|
||||
anomalyCause.setPartitionFieldValue(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
anomalyCause.setFunction(randomAsciiOfLengthBetween(1, 20));
|
||||
anomalyCause.setFunction(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
anomalyCause.setFunctionDescription(randomAsciiOfLengthBetween(1, 20));
|
||||
anomalyCause.setFunctionDescription(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
anomalyCause.setFieldName(randomAsciiOfLengthBetween(1, 20));
|
||||
anomalyCause.setFieldName(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
anomalyCause.setProbability(randomDouble());
|
||||
|
@ -73,9 +73,9 @@ public class AnomalyCauseTests extends AbstractSerializingTestCase<AnomalyCause>
|
|||
int fieldValuesSize = randomInt(10);
|
||||
List<String> fieldValues = new ArrayList<>(fieldValuesSize);
|
||||
for (int j = 0; j < fieldValuesSize; j++) {
|
||||
fieldValues.add(randomAsciiOfLengthBetween(1, 20));
|
||||
fieldValues.add(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
influencers.add(new Influence(randomAsciiOfLengthBetween(1, 20), fieldValues));
|
||||
influencers.add(new Influence(randomAlphaOfLengthBetween(1, 20), fieldValues));
|
||||
}
|
||||
anomalyCause.setInfluencers(influencers);
|
||||
}
|
||||
|
|
|
@ -35,30 +35,30 @@ public class AnomalyRecordTests extends AbstractSerializingTestCase<AnomalyRecor
|
|||
anomalyRecord.setInitialRecordScore(randomDouble());
|
||||
anomalyRecord.setInterim(randomBoolean());
|
||||
if (randomBoolean()) {
|
||||
anomalyRecord.setFieldName(randomAsciiOfLength(12));
|
||||
anomalyRecord.setFieldName(randomAlphaOfLength(12));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
anomalyRecord.setByFieldName(randomAsciiOfLength(12));
|
||||
anomalyRecord.setByFieldValue(randomAsciiOfLength(12));
|
||||
anomalyRecord.setByFieldName(randomAlphaOfLength(12));
|
||||
anomalyRecord.setByFieldValue(randomAlphaOfLength(12));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
anomalyRecord.setPartitionFieldName(randomAsciiOfLength(12));
|
||||
anomalyRecord.setPartitionFieldValue(randomAsciiOfLength(12));
|
||||
anomalyRecord.setPartitionFieldName(randomAlphaOfLength(12));
|
||||
anomalyRecord.setPartitionFieldValue(randomAlphaOfLength(12));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
anomalyRecord.setOverFieldName(randomAsciiOfLength(12));
|
||||
anomalyRecord.setOverFieldValue(randomAsciiOfLength(12));
|
||||
anomalyRecord.setOverFieldName(randomAlphaOfLength(12));
|
||||
anomalyRecord.setOverFieldValue(randomAlphaOfLength(12));
|
||||
}
|
||||
anomalyRecord.setFunction(randomAsciiOfLengthBetween(5, 20));
|
||||
anomalyRecord.setFunctionDescription(randomAsciiOfLengthBetween(5, 20));
|
||||
anomalyRecord.setFunction(randomAlphaOfLengthBetween(5, 20));
|
||||
anomalyRecord.setFunctionDescription(randomAlphaOfLengthBetween(5, 20));
|
||||
if (randomBoolean()) {
|
||||
anomalyRecord.setCorrelatedByFieldValue(randomAsciiOfLength(16));
|
||||
anomalyRecord.setCorrelatedByFieldValue(randomAlphaOfLength(16));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
int count = randomIntBetween(0, 9);
|
||||
List<Influence> influences = new ArrayList<>();
|
||||
for (int i=0; i<count; i++) {
|
||||
influences.add(new Influence(randomAsciiOfLength(8), Collections.singletonList(randomAsciiOfLengthBetween(1, 28))));
|
||||
influences.add(new Influence(randomAlphaOfLength(8), Collections.singletonList(randomAlphaOfLengthBetween(1, 28))));
|
||||
}
|
||||
anomalyRecord.setInfluencers(influences);
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public class AutodetectResultTests extends AbstractSerializingTestCase<Autodetec
|
|||
int size = randomInt(10);
|
||||
influencers = new ArrayList<>(size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
Influencer influencer = new Influencer(jobId, randomAsciiOfLength(10), randomAsciiOfLength(10),
|
||||
Influencer influencer = new Influencer(jobId, randomAlphaOfLength(10), randomAlphaOfLength(10),
|
||||
new Date(randomLong()), randomNonNegativeLong(), i + 1);
|
||||
influencer.setProbability(randomDoubleBetween(0.0, 1.0, true));
|
||||
influencers.add(influencer);
|
||||
|
@ -75,13 +75,13 @@ public class AutodetectResultTests extends AbstractSerializingTestCase<Autodetec
|
|||
}
|
||||
if (randomBoolean()) {
|
||||
modelSizeStats = new ModelSizeStats.Builder(jobId);
|
||||
modelSizeStats.setId(randomAsciiOfLengthBetween(1, 20));
|
||||
modelSizeStats.setId(randomAlphaOfLengthBetween(1, 20));
|
||||
} else {
|
||||
modelSizeStats = null;
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
modelPlot = new ModelPlot(jobId);
|
||||
modelPlot.setId(randomAsciiOfLengthBetween(1, 20));
|
||||
modelPlot.setId(randomAlphaOfLengthBetween(1, 20));
|
||||
} else {
|
||||
modelPlot = null;
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public class AutodetectResultTests extends AbstractSerializingTestCase<Autodetec
|
|||
categoryDefinition = null;
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
flushAcknowledgement = new FlushAcknowledgement(randomAsciiOfLengthBetween(1, 20));
|
||||
flushAcknowledgement = new FlushAcknowledgement(randomAlphaOfLengthBetween(1, 20));
|
||||
} else {
|
||||
flushAcknowledgement = null;
|
||||
}
|
||||
|
|
|
@ -15,13 +15,13 @@ public class BucketInfluencerTests extends AbstractSerializingTestCase<BucketInf
|
|||
|
||||
@Override
|
||||
protected BucketInfluencer createTestInstance() {
|
||||
BucketInfluencer bucketInfluencer = new BucketInfluencer(randomAsciiOfLengthBetween(1, 20), new Date(randomNonNegativeLong()),
|
||||
BucketInfluencer bucketInfluencer = new BucketInfluencer(randomAlphaOfLengthBetween(1, 20), new Date(randomNonNegativeLong()),
|
||||
randomNonNegativeLong(), randomIntBetween(1, 1000));
|
||||
if (randomBoolean()) {
|
||||
bucketInfluencer.setAnomalyScore(randomDouble());
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
bucketInfluencer.setInfluencerFieldName(randomAsciiOfLengthBetween(1, 20));
|
||||
bucketInfluencer.setInfluencerFieldName(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
bucketInfluencer.setInitialAnomalyScore(randomDouble());
|
||||
|
@ -49,11 +49,11 @@ public class BucketInfluencerTests extends AbstractSerializingTestCase<BucketInf
|
|||
}
|
||||
|
||||
public void testEquals_GivenNull() {
|
||||
assertFalse(new BucketInfluencer(randomAsciiOfLengthBetween(1, 20), new Date(), 600, 1).equals(null));
|
||||
assertFalse(new BucketInfluencer(randomAlphaOfLengthBetween(1, 20), new Date(), 600, 1).equals(null));
|
||||
}
|
||||
|
||||
public void testEquals_GivenDifferentClass() {
|
||||
assertFalse(new BucketInfluencer(randomAsciiOfLengthBetween(1, 20), new Date(), 600, 1).equals("a string"));
|
||||
assertFalse(new BucketInfluencer(randomAlphaOfLengthBetween(1, 20), new Date(), 600, 1).equals("a string"));
|
||||
}
|
||||
|
||||
public void testEquals_GivenEqualInfluencers() {
|
||||
|
|
|
@ -35,7 +35,7 @@ public class BucketTests extends AbstractSerializingTestCase<Bucket> {
|
|||
for (int i = 0; i < size; i++) {
|
||||
BucketInfluencer bucketInfluencer = new BucketInfluencer(jobId, new Date(), 600, i + 1);
|
||||
bucketInfluencer.setAnomalyScore(randomDouble());
|
||||
bucketInfluencer.setInfluencerFieldName(randomAsciiOfLengthBetween(1, 20));
|
||||
bucketInfluencer.setInfluencerFieldName(randomAlphaOfLengthBetween(1, 20));
|
||||
bucketInfluencer.setInitialAnomalyScore(randomDouble());
|
||||
bucketInfluencer.setProbability(randomDouble());
|
||||
bucketInfluencer.setRawAnomalyScore(randomDouble());
|
||||
|
@ -56,7 +56,7 @@ public class BucketTests extends AbstractSerializingTestCase<Bucket> {
|
|||
int size = randomInt(10);
|
||||
List<PartitionScore> partitionScores = new ArrayList<>(size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
partitionScores.add(new PartitionScore(randomAsciiOfLengthBetween(1, 20), randomAsciiOfLengthBetween(1, 20), randomDouble(),
|
||||
partitionScores.add(new PartitionScore(randomAlphaOfLengthBetween(1, 20), randomAlphaOfLengthBetween(1, 20), randomDouble(),
|
||||
randomDouble(), randomDouble()));
|
||||
}
|
||||
bucket.setPartitionScores(partitionScores);
|
||||
|
@ -65,7 +65,7 @@ public class BucketTests extends AbstractSerializingTestCase<Bucket> {
|
|||
int size = randomInt(10);
|
||||
Map<String, Double> perPartitionMaxProbability = new HashMap<>(size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
perPartitionMaxProbability.put(randomAsciiOfLengthBetween(1, 20), randomDouble());
|
||||
perPartitionMaxProbability.put(randomAlphaOfLengthBetween(1, 20), randomDouble());
|
||||
}
|
||||
bucket.setPerPartitionMaxProbability(perPartitionMaxProbability);
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ public class CategoryDefinitionTests extends AbstractSerializingTestCase<Categor
|
|||
public CategoryDefinition createTestInstance(String jobId) {
|
||||
CategoryDefinition categoryDefinition = new CategoryDefinition(jobId);
|
||||
categoryDefinition.setCategoryId(randomLong());
|
||||
categoryDefinition.setTerms(randomAsciiOfLength(10));
|
||||
categoryDefinition.setRegex(randomAsciiOfLength(10));
|
||||
categoryDefinition.setTerms(randomAlphaOfLength(10));
|
||||
categoryDefinition.setRegex(randomAlphaOfLength(10));
|
||||
categoryDefinition.setMaxMatchingLength(randomLong());
|
||||
categoryDefinition.setExamples(Arrays.asList(generateRandomStringArray(10, 10, false)));
|
||||
return categoryDefinition;
|
||||
|
@ -25,7 +25,7 @@ public class CategoryDefinitionTests extends AbstractSerializingTestCase<Categor
|
|||
|
||||
@Override
|
||||
protected CategoryDefinition createTestInstance() {
|
||||
return createTestInstance(randomAsciiOfLength(10));
|
||||
return createTestInstance(randomAlphaOfLength(10));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -39,13 +39,13 @@ public class CategoryDefinitionTests extends AbstractSerializingTestCase<Categor
|
|||
}
|
||||
|
||||
public void testEquals_GivenSameObject() {
|
||||
CategoryDefinition category = new CategoryDefinition(randomAsciiOfLength(10));
|
||||
CategoryDefinition category = new CategoryDefinition(randomAlphaOfLength(10));
|
||||
|
||||
assertTrue(category.equals(category));
|
||||
}
|
||||
|
||||
public void testEquals_GivenObjectOfDifferentClass() {
|
||||
CategoryDefinition category = new CategoryDefinition(randomAsciiOfLength(10));
|
||||
CategoryDefinition category = new CategoryDefinition(randomAlphaOfLength(10));
|
||||
|
||||
assertFalse(category.equals("a string"));
|
||||
}
|
||||
|
|
|
@ -19,9 +19,9 @@ public class InfluenceTests extends AbstractSerializingTestCase<Influence> {
|
|||
int size = randomInt(10);
|
||||
List<String> fieldValues = new ArrayList<>(size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
fieldValues.add(randomAsciiOfLengthBetween(1, 20));
|
||||
fieldValues.add(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
return new Influence(randomAsciiOfLengthBetween(1, 30), fieldValues);
|
||||
return new Influence(randomAlphaOfLengthBetween(1, 30), fieldValues);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,7 +17,7 @@ import java.util.Date;
|
|||
public class InfluencerTests extends AbstractSerializingTestCase<Influencer> {
|
||||
|
||||
public Influencer createTestInstance(String jobId) {
|
||||
Influencer influencer = new Influencer(jobId, randomAsciiOfLengthBetween(1, 20), randomAsciiOfLengthBetween(1, 20),
|
||||
Influencer influencer = new Influencer(jobId, randomAlphaOfLengthBetween(1, 20), randomAlphaOfLengthBetween(1, 20),
|
||||
new Date(randomNonNegativeLong()), randomNonNegativeLong(), randomIntBetween(1, 1000));
|
||||
influencer.setInterim(randomBoolean());
|
||||
influencer.setInfluencerScore(randomDouble());
|
||||
|
@ -27,7 +27,7 @@ public class InfluencerTests extends AbstractSerializingTestCase<Influencer> {
|
|||
}
|
||||
@Override
|
||||
protected Influencer createTestInstance() {
|
||||
return createTestInstance(randomAsciiOfLengthBetween(1, 20));
|
||||
return createTestInstance(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,19 +21,19 @@ public class ModelPlotTests extends AbstractSerializingTestCase<ModelPlot> {
|
|||
public ModelPlot createTestInstance(String jobId) {
|
||||
ModelPlot modelPlot = new ModelPlot(jobId);
|
||||
if (randomBoolean()) {
|
||||
modelPlot.setByFieldName(randomAsciiOfLengthBetween(1, 20));
|
||||
modelPlot.setByFieldName(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
modelPlot.setByFieldValue(randomAsciiOfLengthBetween(1, 20));
|
||||
modelPlot.setByFieldValue(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
modelPlot.setPartitionFieldName(randomAsciiOfLengthBetween(1, 20));
|
||||
modelPlot.setPartitionFieldName(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
modelPlot.setPartitionFieldValue(randomAsciiOfLengthBetween(1, 20));
|
||||
modelPlot.setPartitionFieldValue(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
modelPlot.setModelFeature(randomAsciiOfLengthBetween(1, 20));
|
||||
modelPlot.setModelFeature(randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
modelPlot.setModelLower(randomDouble());
|
||||
|
@ -64,13 +64,13 @@ public class ModelPlotTests extends AbstractSerializingTestCase<ModelPlot> {
|
|||
}
|
||||
|
||||
public void testEquals_GivenSameObject() {
|
||||
ModelPlot modelPlot = new ModelPlot(randomAsciiOfLength(15));
|
||||
ModelPlot modelPlot = new ModelPlot(randomAlphaOfLength(15));
|
||||
|
||||
assertTrue(modelPlot.equals(modelPlot));
|
||||
}
|
||||
|
||||
public void testEquals_GivenObjectOfDifferentClass() {
|
||||
ModelPlot modelPlot = new ModelPlot(randomAsciiOfLength(15));
|
||||
ModelPlot modelPlot = new ModelPlot(randomAlphaOfLength(15));
|
||||
|
||||
assertFalse(modelPlot.equals("a string"));
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ public class PartitionScoreTests extends AbstractSerializingTestCase<PartitionSc
|
|||
|
||||
@Override
|
||||
protected PartitionScore createTestInstance() {
|
||||
return new PartitionScore(randomAsciiOfLengthBetween(1, 20), randomAsciiOfLengthBetween(1, 20), randomDouble(), randomDouble(),
|
||||
return new PartitionScore(randomAlphaOfLengthBetween(1, 20), randomAlphaOfLengthBetween(1, 20), randomDouble(), randomDouble(),
|
||||
randomDouble());
|
||||
}
|
||||
|
||||
|
|
|
@ -21,10 +21,10 @@ public class PerPartitionMaxProbabilitiesTests extends AbstractSerializingTestCa
|
|||
int num = randomIntBetween(1, 10);
|
||||
List<PerPartitionMaxProbabilities.PartitionProbability> pps = new ArrayList<>();
|
||||
for (int i=0; i<num; i++) {
|
||||
pps.add(new PerPartitionMaxProbabilities.PartitionProbability(randomAsciiOfLength(12), randomDouble()));
|
||||
pps.add(new PerPartitionMaxProbabilities.PartitionProbability(randomAlphaOfLength(12), randomDouble()));
|
||||
}
|
||||
|
||||
return new PerPartitionMaxProbabilities(randomAsciiOfLength(20), new DateTime(randomDateTimeZone()).toDate(),
|
||||
return new PerPartitionMaxProbabilities(randomAlphaOfLength(20), new DateTime(randomDateTimeZone()).toDate(),
|
||||
randomNonNegativeLong(), pps);
|
||||
}
|
||||
|
||||
|
|
|
@ -66,8 +66,8 @@ public class AuditMessageTests extends AbstractSerializingTestCase<AuditMessage>
|
|||
|
||||
@Override
|
||||
protected AuditMessage createTestInstance() {
|
||||
return new AuditMessage(randomAsciiOfLengthBetween(1, 20), randomAsciiOfLengthBetween(1, 200),
|
||||
randomFrom(Level.values()), randomAsciiOfLengthBetween(1, 20));
|
||||
return new AuditMessage(randomAlphaOfLengthBetween(1, 20), randomAlphaOfLengthBetween(1, 200),
|
||||
randomFrom(Level.values()), randomAlphaOfLengthBetween(1, 20));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,7 +33,7 @@ public class MonitoredSystemTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testFromUnknownSystem() {
|
||||
final String unknownSystem = randomAsciiOfLengthBetween(3, 4);
|
||||
final String unknownSystem = randomAlphaOfLengthBetween(3, 4);
|
||||
|
||||
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> {
|
||||
MonitoredSystem.fromSystem(unknownSystem);
|
||||
|
|
|
@ -85,7 +85,7 @@ public class MonitoringFeatureSetTests extends ESTestCase {
|
|||
}
|
||||
}
|
||||
int xCount = randomIntBetween(0, 5);
|
||||
String xType = randomAsciiOfLength(10);
|
||||
String xType = randomAlphaOfLength(10);
|
||||
for (int i = 0; i < xCount; i++) {
|
||||
Exporter exporter = mockExporter(xType, true);
|
||||
exporterList.add(exporter);
|
||||
|
|
|
@ -165,7 +165,7 @@ public class MonitoringSettingsIntegTests extends MonitoringIntegTestCase {
|
|||
String[] items = new String[size];
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
items[i] = randomAsciiOfLength(5);
|
||||
items[i] = randomAlphaOfLength(5);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
|
|
@ -84,8 +84,8 @@ public class MonitoringBulkDocTests extends ESTestCase {
|
|||
String monitoringVersion = randomVersion(random()).toString();
|
||||
MonitoringIndex index = randomBoolean() ? randomFrom(MonitoringIndex.values()) : null;
|
||||
String type = randomFrom("type1", "type2", "type3");
|
||||
String id = randomBoolean() ? randomAsciiOfLength(3) : null;
|
||||
String clusterUUID = randomBoolean() ? randomAsciiOfLength(5) : null;
|
||||
String id = randomBoolean() ? randomAlphaOfLength(3) : null;
|
||||
String clusterUUID = randomBoolean() ? randomAlphaOfLength(5) : null;
|
||||
long timestamp = randomBoolean() ? randomNonNegativeLong() : 0L;
|
||||
MonitoringDoc.Node sourceNode = randomBoolean() ? newRandomSourceNode() : null;
|
||||
BytesReference source = new BytesArray("{\"key\" : \"value\"}");
|
||||
|
@ -104,13 +104,13 @@ public class MonitoringBulkDocTests extends ESTestCase {
|
|||
Map<String, String> attributes = null;
|
||||
|
||||
if (frequently()) {
|
||||
uuid = randomAsciiOfLength(5);
|
||||
name = randomAsciiOfLength(5);
|
||||
uuid = randomAlphaOfLength(5);
|
||||
name = randomAlphaOfLength(5);
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
ip = randomAsciiOfLength(5);
|
||||
transportAddress = randomAsciiOfLength(5);
|
||||
host = randomAsciiOfLength(3);
|
||||
ip = randomAlphaOfLength(5);
|
||||
transportAddress = randomAlphaOfLength(5);
|
||||
host = randomAlphaOfLength(3);
|
||||
}
|
||||
if (rarely()) {
|
||||
int nbAttributes = randomIntBetween(0, 5);
|
||||
|
|
|
@ -13,7 +13,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.xpack.monitoring.exporter.MonitoringDoc;
|
||||
import org.hamcrest.Matcher;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -63,32 +62,32 @@ public class MonitoringBulkRequestTests extends ESTestCase {
|
|||
MonitoringBulkRequest request = new MonitoringBulkRequest();
|
||||
|
||||
// Doc0 is complete
|
||||
MonitoringBulkDoc doc0 = new MonitoringBulkDoc(randomAsciiOfLength(2),
|
||||
randomAsciiOfLength(2), MonitoringIndex.TIMESTAMPED, randomAsciiOfLength(5),
|
||||
MonitoringBulkDoc doc0 = new MonitoringBulkDoc(randomAlphaOfLength(2),
|
||||
randomAlphaOfLength(2), MonitoringIndex.TIMESTAMPED, randomAlphaOfLength(5),
|
||||
null, SOURCE, XContentType.JSON);
|
||||
request.add(doc0);
|
||||
|
||||
// Doc1 has no type
|
||||
MonitoringBulkDoc doc1 = new MonitoringBulkDoc(randomAsciiOfLength(2),
|
||||
randomAsciiOfLength(2), MonitoringIndex.TIMESTAMPED, null,
|
||||
MonitoringBulkDoc doc1 = new MonitoringBulkDoc(randomAlphaOfLength(2),
|
||||
randomAlphaOfLength(2), MonitoringIndex.TIMESTAMPED, null,
|
||||
null, SOURCE, XContentType.JSON);
|
||||
request.add(doc1);
|
||||
|
||||
// Doc2 has no source
|
||||
MonitoringBulkDoc doc2 = new MonitoringBulkDoc(randomAsciiOfLength(2),
|
||||
randomAsciiOfLength(2), MonitoringIndex.TIMESTAMPED, randomAsciiOfLength(5),
|
||||
MonitoringBulkDoc doc2 = new MonitoringBulkDoc(randomAlphaOfLength(2),
|
||||
randomAlphaOfLength(2), MonitoringIndex.TIMESTAMPED, randomAlphaOfLength(5),
|
||||
null, BytesArray.EMPTY, XContentType.JSON);
|
||||
request.add(doc2);
|
||||
|
||||
// Doc3 has no version
|
||||
MonitoringBulkDoc doc3 = new MonitoringBulkDoc(randomAsciiOfLength(2),
|
||||
null, MonitoringIndex.TIMESTAMPED, randomAsciiOfLength(5),
|
||||
MonitoringBulkDoc doc3 = new MonitoringBulkDoc(randomAlphaOfLength(2),
|
||||
null, MonitoringIndex.TIMESTAMPED, randomAlphaOfLength(5),
|
||||
null, SOURCE, XContentType.JSON);
|
||||
request.add(doc3);
|
||||
|
||||
// Doc4 has no id
|
||||
MonitoringBulkDoc doc4 = new MonitoringBulkDoc(null,
|
||||
randomAsciiOfLength(2), MonitoringIndex.TIMESTAMPED, randomAsciiOfLength(5),
|
||||
randomAlphaOfLength(2), MonitoringIndex.TIMESTAMPED, randomAlphaOfLength(5),
|
||||
null, SOURCE, XContentType.JSON);
|
||||
request.add(doc4);
|
||||
|
||||
|
@ -104,8 +103,8 @@ public class MonitoringBulkRequestTests extends ESTestCase {
|
|||
final int nbDocs = randomIntBetween(1, 20);
|
||||
for (int i = 0; i < nbDocs; i++) {
|
||||
request.add(new MonitoringBulkDoc(String.valueOf(i), String.valueOf(i),
|
||||
randomFrom(MonitoringIndex.values()), randomAsciiOfLength(5),
|
||||
randomAsciiOfLength(5), SOURCE, XContentType.JSON));
|
||||
randomFrom(MonitoringIndex.values()), randomAlphaOfLength(5),
|
||||
randomAlphaOfLength(5), SOURCE, XContentType.JSON));
|
||||
}
|
||||
assertThat(request.getDocs(), hasSize(nbDocs));
|
||||
}
|
||||
|
@ -128,7 +127,7 @@ public class MonitoringBulkRequestTests extends ESTestCase {
|
|||
indices[i] = MonitoringIndex.TIMESTAMPED;
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
types[i] = randomAsciiOfLength(5);
|
||||
types[i] = randomAlphaOfLength(5);
|
||||
builder.field("_type", types[i]);
|
||||
}
|
||||
builder.endObject().endObject().flush();
|
||||
|
@ -138,9 +137,9 @@ public class MonitoringBulkRequestTests extends ESTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
String defaultMonitoringId = randomBoolean() ? randomAsciiOfLength(2) : null;
|
||||
String defaultMonitoringVersion = randomBoolean() ? randomAsciiOfLength(3) : null;
|
||||
String defaultType = rarely() ? randomAsciiOfLength(4) : null;
|
||||
String defaultMonitoringId = randomBoolean() ? randomAlphaOfLength(2) : null;
|
||||
String defaultMonitoringVersion = randomBoolean() ? randomAlphaOfLength(3) : null;
|
||||
String defaultType = rarely() ? randomAlphaOfLength(4) : null;
|
||||
|
||||
MonitoringBulkRequest request = new MonitoringBulkRequest();
|
||||
request.add(content.bytes(), defaultMonitoringId, defaultMonitoringVersion, defaultType, xContentType);
|
||||
|
|
|
@ -30,7 +30,7 @@ public class MonitoringBulkResponseTests extends ESTestCase {
|
|||
assertThat(response.getError(), is(nullValue()));
|
||||
assertThat(response.status(), equalTo(RestStatus.OK));
|
||||
|
||||
ExportException exception = new ExportException(randomAsciiOfLength(10));
|
||||
ExportException exception = new ExportException(randomAlphaOfLength(10));
|
||||
response = new MonitoringBulkResponse(took, new MonitoringBulkResponse.Error(exception));
|
||||
|
||||
assertThat(response.getTookInMillis(), equalTo(took));
|
||||
|
@ -46,9 +46,9 @@ public class MonitoringBulkResponseTests extends ESTestCase {
|
|||
response = new MonitoringBulkResponse(Math.abs(randomLong()));
|
||||
} else {
|
||||
Exception exception = randomFrom(
|
||||
new ExportException(randomAsciiOfLength(5), new IllegalStateException(randomAsciiOfLength(5))),
|
||||
new IllegalStateException(randomAsciiOfLength(5)),
|
||||
new IllegalArgumentException(randomAsciiOfLength(5)));
|
||||
new ExportException(randomAlphaOfLength(5), new IllegalStateException(randomAlphaOfLength(5))),
|
||||
new IllegalStateException(randomAlphaOfLength(5)),
|
||||
new IllegalArgumentException(randomAlphaOfLength(5)));
|
||||
response = new MonitoringBulkResponse(Math.abs(randomLong()), new MonitoringBulkResponse.Error(exception));
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
|||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||
import org.elasticsearch.cluster.service.ClusterService;
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.common.bytes.BytesReference;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
|
@ -251,7 +250,7 @@ public class TransportMonitoringBulkActionTests extends ESTestCase {
|
|||
String monitoringVersion = randomVersion(random()).toString();
|
||||
MonitoringIndex index = randomBoolean() ? randomFrom(MonitoringIndex.values()) : null;
|
||||
String type = randomFrom("type1", "type2", "type3");
|
||||
String id = randomAsciiOfLength(10);
|
||||
String id = randomAlphaOfLength(10);
|
||||
|
||||
BytesReference source;
|
||||
XContentType xContentType = randomFrom(XContentType.values());
|
||||
|
|
|
@ -189,8 +189,8 @@ public abstract class AbstractIndicesCleanerTestCase extends MonitoringIntegTest
|
|||
String monitoringId = randomFrom(MonitoredSystem.values()).getSystem();
|
||||
String monitoringVersion = randomVersion(random()).toString();
|
||||
String type = randomFrom("type1", "type2", "type3");
|
||||
String id = randomBoolean() ? randomAsciiOfLength(3) : null;
|
||||
String clusterUUID = randomBoolean() ? randomAsciiOfLength(5) : null;
|
||||
String id = randomBoolean() ? randomAlphaOfLength(3) : null;
|
||||
String clusterUUID = randomBoolean() ? randomAlphaOfLength(5) : null;
|
||||
long timestamp = randomBoolean() ? randomNonNegativeLong() : 0L;
|
||||
MonitoringDoc.Node sourceNode = randomBoolean() ? newRandomSourceNode() : null;
|
||||
|
||||
|
|
|
@ -23,11 +23,11 @@ public class MonitoringDocTests extends ESTestCase {
|
|||
public void testFromDiscoveryNode() {
|
||||
assertEquals(null, fromDiscoveryNode(null));
|
||||
|
||||
String nodeId = randomAsciiOfLength(5);
|
||||
String nodeId = randomAlphaOfLength(5);
|
||||
TransportAddress address = buildNewFakeTransportAddress();
|
||||
Version version = randomFrom(Version.V_2_4_1, Version.V_5_0_1, Version.CURRENT);
|
||||
|
||||
String name = randomBoolean() ? randomAsciiOfLength(5) : "";
|
||||
String name = randomBoolean() ? randomAlphaOfLength(5) : "";
|
||||
Map<String, String> attributes = new HashMap<>();
|
||||
if (randomBoolean()) {
|
||||
int nbAttrs = randomIntBetween(1, 5);
|
||||
|
|
|
@ -68,7 +68,7 @@ public class HttpExportBulkResponseListenerTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testOnSuccessWithInnerErrors() {
|
||||
final String[] expectedErrors = new String[] { randomAsciiOfLengthBetween(4, 10), randomAsciiOfLengthBetween(5, 9) };
|
||||
final String[] expectedErrors = new String[] { randomAlphaOfLengthBetween(4, 10), randomAlphaOfLengthBetween(5, 9) };
|
||||
final AtomicInteger counter = new AtomicInteger(0);
|
||||
final Response response = mock(Response.class);
|
||||
final StringEntity entity = new StringEntity(
|
||||
|
|
|
@ -123,7 +123,7 @@ public class HttpExporterIT extends MonitoringIntegTestCase {
|
|||
final boolean bwcIndexesExist = randomBoolean();
|
||||
final boolean bwcAliasesExist = randomBoolean();
|
||||
|
||||
final String headerValue = randomAsciiOfLengthBetween(3, 9);
|
||||
final String headerValue = randomAlphaOfLengthBetween(3, 9);
|
||||
final String[] array = generateRandomStringArray(2, 4, false);
|
||||
|
||||
final Map<String, String[]> headers = new HashMap<>();
|
||||
|
@ -164,7 +164,7 @@ public class HttpExporterIT extends MonitoringIntegTestCase {
|
|||
final boolean bwcIndexesExist = randomBoolean();
|
||||
final boolean bwcAliasesExist = randomBoolean();
|
||||
|
||||
final String headerValue = randomAsciiOfLengthBetween(3, 9);
|
||||
final String headerValue = randomAlphaOfLengthBetween(3, 9);
|
||||
final String[] array = generateRandomStringArray(2, 4, false);
|
||||
|
||||
final Map<String, String[]> headers = new HashMap<>();
|
||||
|
|
|
@ -17,7 +17,7 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
public class HttpHostBuilderTests extends ESTestCase {
|
||||
|
||||
private final Scheme scheme = randomFrom(Scheme.values());
|
||||
private final String hostname = randomAsciiOfLengthBetween(1, 20);
|
||||
private final String hostname = randomAlphaOfLengthBetween(1, 20);
|
||||
private final int port = randomIntBetween(1, 65535);
|
||||
|
||||
public void testBuilder() {
|
||||
|
|
|
@ -27,8 +27,8 @@ public class DataResolverTests extends MonitoringIndexNameResolverTestCase {
|
|||
|
||||
@Override
|
||||
protected MonitoringDoc newMonitoringDoc() {
|
||||
MonitoringDoc doc = new MonitoringDoc(randomMonitoringId(), randomAsciiOfLength(2),
|
||||
null, null, randomAsciiOfLength(5), Math.abs(randomLong()),
|
||||
MonitoringDoc doc = new MonitoringDoc(randomMonitoringId(), randomAlphaOfLength(2),
|
||||
null, null, randomAlphaOfLength(5), Math.abs(randomLong()),
|
||||
new DiscoveryNode("id", buildNewFakeTransportAddress(), emptyMap(), emptySet(), Version.CURRENT));
|
||||
return doc;
|
||||
}
|
||||
|
|
|
@ -36,8 +36,8 @@ public class TimestampedResolverTests extends MonitoringIndexNameResolverTestCas
|
|||
|
||||
@Override
|
||||
protected MonitoringDoc newMonitoringDoc() {
|
||||
MonitoringDoc doc = new MonitoringDoc(randomMonitoringId(), randomAsciiOfLength(2),
|
||||
null, null, randomAsciiOfLength(5), 1437580442979L, // "2015-07-22T15:54:02.979Z"
|
||||
MonitoringDoc doc = new MonitoringDoc(randomMonitoringId(), randomAlphaOfLength(2),
|
||||
null, null, randomAlphaOfLength(5), 1437580442979L, // "2015-07-22T15:54:02.979Z"
|
||||
new DiscoveryNode("id", buildNewFakeTransportAddress(), emptyMap(), emptySet(), Version.CURRENT));
|
||||
return doc;
|
||||
}
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
*/
|
||||
package org.elasticsearch.xpack.monitoring.resolver.bulk;
|
||||
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.common.util.set.Sets;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
|
@ -17,8 +15,6 @@ import org.elasticsearch.xpack.monitoring.action.MonitoringIndex;
|
|||
import org.elasticsearch.xpack.monitoring.exporter.MonitoringTemplateUtils;
|
||||
import org.elasticsearch.xpack.monitoring.resolver.MonitoringIndexNameResolverTestCase;
|
||||
|
||||
import static java.util.Collections.emptyMap;
|
||||
import static java.util.Collections.emptySet;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
/**
|
||||
|
@ -26,13 +22,13 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
*/
|
||||
public class MonitoringBulkDataResolverTests extends MonitoringIndexNameResolverTestCase<MonitoringBulkDoc, MonitoringBulkDataResolver> {
|
||||
|
||||
private final String id = randomBoolean() ? randomAsciiOfLength(35) : null;
|
||||
private final String id = randomBoolean() ? randomAlphaOfLength(35) : null;
|
||||
|
||||
@Override
|
||||
protected MonitoringBulkDoc newMonitoringDoc() {
|
||||
MonitoringBulkDoc doc = new MonitoringBulkDoc(MonitoredSystem.KIBANA.getSystem(),
|
||||
MonitoringTemplateUtils.TEMPLATE_VERSION, MonitoringIndex.DATA, "kibana", id,
|
||||
randomAsciiOfLength(5), Math.abs(randomLong()),
|
||||
randomAlphaOfLength(5), Math.abs(randomLong()),
|
||||
MonitoringBulkDocTests.newRandomSourceNode(),
|
||||
new BytesArray("{\"field1\" : \"value1\"}"), XContentType.JSON);
|
||||
return doc;
|
||||
|
|
|
@ -28,8 +28,8 @@ public class MonitoringBulkTimestampedResolverTests
|
|||
MonitoringBulkDoc doc = new MonitoringBulkDoc(MonitoredSystem.KIBANA.getSystem(),
|
||||
MonitoringTemplateUtils.TEMPLATE_VERSION, MonitoringIndex.TIMESTAMPED,
|
||||
"kibana_stats",
|
||||
randomBoolean() ? randomAsciiOfLength(35) : null,
|
||||
randomAsciiOfLength(5), 1437580442979L,
|
||||
randomBoolean() ? randomAlphaOfLength(35) : null,
|
||||
randomAlphaOfLength(5), 1437580442979L,
|
||||
MonitoringBulkDocTests.newRandomSourceNode(),
|
||||
new BytesArray("{\"field1\" : \"value1\"}"), XContentType.JSON);
|
||||
return doc;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue