Follow renaming of randomAsciiOfLength() to randomAlphaOfLength()

This commit is contained in:
Christoph Büscher 2017-04-04 18:31:00 +02:00
parent 024ed1b6ca
commit 6cfbef73a0
7 changed files with 35 additions and 35 deletions

View File

@ -27,9 +27,9 @@ import java.io.IOException;
public class DocumentKeyTests extends ESTestCase {
static DocumentKey createRandomRatedDocumentKey() {
String index = randomAsciiOfLengthBetween(1, 10);
String type = randomAsciiOfLengthBetween(1, 10);
String docId = randomAsciiOfLengthBetween(1, 10);
String index = randomAlphaOfLengthBetween(1, 10);
String type = randomAlphaOfLengthBetween(1, 10);
String docId = randomAlphaOfLengthBetween(1, 10);
return new DocumentKey(index, type, docId);
}

View File

@ -42,7 +42,7 @@ public class EvalQueryQualityTests extends ESTestCase {
for (int i = 0; i < numberOfSearchHits; i++) {
ratedHits.add(RatedSearchHitTests.randomRatedSearchHit());
}
EvalQueryQuality evalQueryQuality = new EvalQueryQuality(randomAsciiOfLength(10),
EvalQueryQuality evalQueryQuality = new EvalQueryQuality(randomAlphaOfLength(10),
randomDoubleBetween(0.0, 1.0, true));
if (randomBoolean()) {
// TODO randomize this

View File

@ -39,7 +39,7 @@ public class RankEvalResponseTests extends ESTestCase {
int numberOfRequests = randomIntBetween(0, 5);
Map<String, EvalQueryQuality> partials = new HashMap<>(numberOfRequests);
for (int i = 0; i < numberOfRequests; i++) {
String id = randomAsciiOfLengthBetween(3, 10);
String id = randomAlphaOfLengthBetween(3, 10);
int numberOfUnknownDocs = randomIntBetween(0, 5);
List<DocumentKey> unknownDocs = new ArrayList<>(numberOfUnknownDocs);
for (int d = 0; d < numberOfUnknownDocs; d++) {
@ -52,8 +52,8 @@ public class RankEvalResponseTests extends ESTestCase {
int numberOfErrors = randomIntBetween(0, 2);
Map<String, Exception> errors = new HashMap<>(numberOfRequests);
for (int i = 0; i < numberOfErrors; i++) {
errors.put(randomAsciiOfLengthBetween(3, 10),
new IllegalArgumentException(randomAsciiOfLength(10)));
errors.put(randomAlphaOfLengthBetween(3, 10),
new IllegalArgumentException(randomAlphaOfLength(10)));
}
return new RankEvalResponse(randomDouble(), partials, errors);
}

View File

@ -75,12 +75,12 @@ public class RankEvalSpecTests extends ESTestCase {
if (scriptType == ScriptType.INLINE) {
try (XContentBuilder builder = XContentFactory.jsonBuilder()) {
builder.startObject();
builder.field("field", randomAsciiOfLengthBetween(1, 5));
builder.field("field", randomAlphaOfLengthBetween(1, 5));
builder.endObject();
script = builder.string();
}
} else {
script = randomAsciiOfLengthBetween(1, 5);
script = randomAlphaOfLengthBetween(1, 5);
}
templates = new HashSet<>();
@ -183,12 +183,12 @@ public class RankEvalSpecTests extends ESTestCase {
break;
case 2:
if (templates.size() > 0) {
String mutatedTemplate = randomAsciiOfLength(10);
String mutatedTemplate = randomAlphaOfLength(10);
templates.put("mutation", new Script(ScriptType.INLINE, "mustache", mutatedTemplate,
new HashMap<>()));
} else {
String mutatedTemplate = randomValueOtherThanMany(templates::containsValue,
() -> randomAsciiOfLength(10));
() -> randomAlphaOfLength(10));
templates.put("mutation", new Script(ScriptType.INLINE, "mustache", mutatedTemplate,
new HashMap<>()));
}

View File

@ -31,9 +31,9 @@ import java.io.IOException;
public class RatedDocumentTests extends ESTestCase {
public static RatedDocument createRatedDocument() {
String index = randomAsciiOfLength(10);
String type = randomAsciiOfLength(10);
String docId = randomAsciiOfLength(10);
String index = randomAlphaOfLength(10);
String type = randomAlphaOfLength(10);
String docId = randomAlphaOfLength(10);
int rating = randomInt();
return new RatedDocument(index, type, docId, rating);
@ -89,13 +89,13 @@ public class RatedDocumentTests extends ESTestCase {
rating = randomValueOtherThan(rating, () -> randomInt());
break;
case 1:
index = randomValueOtherThan(index, () -> randomAsciiOfLength(10));
index = randomValueOtherThan(index, () -> randomAlphaOfLength(10));
break;
case 2:
type = randomValueOtherThan(type, () -> randomAsciiOfLength(10));
type = randomValueOtherThan(type, () -> randomAlphaOfLength(10));
break;
case 3:
docId = randomValueOtherThan(docId, () -> randomAsciiOfLength(10));
docId = randomValueOtherThan(docId, () -> randomAlphaOfLength(10));
break;
default:
throw new IllegalStateException("The test should only allow two parameters mutated");

View File

@ -74,7 +74,7 @@ public class RatedRequestsTests extends ESTestCase {
public static RatedRequest createTestItem(List<String> indices, List<String> types,
boolean forceRequest) {
String requestId = randomAsciiOfLength(50);
String requestId = randomAlphaOfLength(50);
List<RatedDocument> ratedDocs = new ArrayList<>();
int size = randomIntBetween(0, 2);
@ -91,14 +91,14 @@ public class RatedRequestsTests extends ESTestCase {
} else {
int randomSize = randomIntBetween(1, 10);
for (int i = 0; i < randomSize; i++) {
params.put(randomAsciiOfLengthBetween(1, 10), randomAsciiOfLengthBetween(1, 10));
params.put(randomAlphaOfLengthBetween(1, 10), randomAlphaOfLengthBetween(1, 10));
}
}
List<String> summaryFields = new ArrayList<>();
int numSummaryFields = randomIntBetween(0, 5);
for (int i = 0; i < numSummaryFields; i++) {
summaryFields.add(randomAsciiOfLength(5));
summaryFields.add(randomAlphaOfLength(5));
}
RatedRequest ratedRequest = null;
@ -108,7 +108,7 @@ public class RatedRequestsTests extends ESTestCase {
ratedRequest.setTypes(types);
ratedRequest.setSummaryFields(summaryFields);
} else {
ratedRequest = new RatedRequest(requestId, ratedDocs, params, randomAsciiOfLength(5));
ratedRequest = new RatedRequest(requestId, ratedDocs, params, randomAlphaOfLength(5));
ratedRequest.setIndices(indices);
ratedRequest.setTypes(types);
ratedRequest.setSummaryFields(summaryFields);
@ -120,13 +120,13 @@ public class RatedRequestsTests extends ESTestCase {
List<String> indices = new ArrayList<>();
int size = randomIntBetween(0, 20);
for (int i = 0; i < size; i++) {
indices.add(randomAsciiOfLengthBetween(0, 50));
indices.add(randomAlphaOfLengthBetween(0, 50));
}
List<String> types = new ArrayList<>();
size = randomIntBetween(0, 20);
for (int i = 0; i < size; i++) {
types.add(randomAsciiOfLengthBetween(0, 50));
types.add(randomAlphaOfLengthBetween(0, 50));
}
RatedRequest testItem = createTestItem(indices, types, randomBoolean());
@ -152,13 +152,13 @@ public class RatedRequestsTests extends ESTestCase {
List<String> indices = new ArrayList<>();
int size = randomIntBetween(0, 20);
for (int i = 0; i < size; i++) {
indices.add(randomAsciiOfLengthBetween(0, 50));
indices.add(randomAlphaOfLengthBetween(0, 50));
}
List<String> types = new ArrayList<>();
size = randomIntBetween(0, 20);
for (int i = 0; i < size; i++) {
types.add(randomAsciiOfLengthBetween(0, 50));
types.add(randomAlphaOfLengthBetween(0, 50));
}
RatedRequest original = createTestItem(indices, types, randomBoolean());
@ -178,13 +178,13 @@ public class RatedRequestsTests extends ESTestCase {
List<String> indices = new ArrayList<>();
int size = randomIntBetween(0, 20);
for (int i = 0; i < size; i++) {
indices.add(randomAsciiOfLengthBetween(0, 50));
indices.add(randomAlphaOfLengthBetween(0, 50));
}
List<String> types = new ArrayList<>();
size = randomIntBetween(0, 20);
for (int i = 0; i < size; i++) {
types.add(randomAsciiOfLengthBetween(0, 50));
types.add(randomAlphaOfLengthBetween(0, 50));
}
RatedRequest testItem = createTestItem(indices, types, randomBoolean());
@ -211,7 +211,7 @@ public class RatedRequestsTests extends ESTestCase {
int mutate = randomIntBetween(0, 5);
switch (mutate) {
case 0:
id = randomValueOtherThan(id, () -> randomAsciiOfLength(10));
id = randomValueOtherThan(id, () -> randomAlphaOfLength(10));
break;
case 1:
if (testRequest != null) {
@ -226,7 +226,7 @@ public class RatedRequestsTests extends ESTestCase {
mutated.put("one_more_key", "one_more_value");
params = mutated;
} else {
templateId = randomValueOtherThan(templateId, () -> randomAsciiOfLength(5));
templateId = randomValueOtherThan(templateId, () -> randomAlphaOfLength(5));
}
}
break;
@ -236,15 +236,15 @@ public class RatedRequestsTests extends ESTestCase {
break;
case 3:
indices = Arrays.asList(
randomValueOtherThanMany(indices::contains, () -> randomAsciiOfLength(10)));
randomValueOtherThanMany(indices::contains, () -> randomAlphaOfLength(10)));
break;
case 4:
types = Arrays.asList(
randomValueOtherThanMany(types::contains, () -> randomAsciiOfLength(10)));
randomValueOtherThanMany(types::contains, () -> randomAlphaOfLength(10)));
break;
case 5:
summaryFields = Arrays.asList(randomValueOtherThanMany(summaryFields::contains,
() -> randomAsciiOfLength(10)));
() -> randomAlphaOfLength(10)));
break;
default:
throw new IllegalStateException("Requested to modify more than available parameters.");

View File

@ -32,8 +32,8 @@ public class RatedSearchHitTests extends ESTestCase {
public static RatedSearchHit randomRatedSearchHit() {
Optional<Integer> rating = randomBoolean() ? Optional.empty()
: Optional.of(randomIntBetween(0, 5));
SearchHit searchHit = new SearchHit(randomIntBetween(0, 10), randomAsciiOfLength(10),
new Text(randomAsciiOfLength(10)), Collections.emptyMap());
SearchHit searchHit = new SearchHit(randomIntBetween(0, 10), randomAlphaOfLength(10),
new Text(randomAlphaOfLength(10)), Collections.emptyMap());
RatedSearchHit ratedSearchHit = new RatedSearchHit(searchHit, rating);
return ratedSearchHit;
}
@ -46,7 +46,7 @@ public class RatedSearchHitTests extends ESTestCase {
rating = rating.isPresent() ? Optional.of(rating.get() + 1) : Optional.of(randomInt(5));
break;
case 1:
hit = new SearchHit(hit.docId(), hit.getId() + randomAsciiOfLength(10),
hit = new SearchHit(hit.docId(), hit.getId() + randomAlphaOfLength(10),
new Text(hit.getType()), Collections.emptyMap());
break;
default: