Fix long lines failing check and parsing tests (elastic/elasticsearch#415)
Original commit: elastic/x-pack-elasticsearch@0711a9c919
This commit is contained in:
parent
62a0f64012
commit
5d2cc13797
|
@ -58,7 +58,8 @@ public class PerPartitionMaxProbabilities extends ToXContentToBytes implements W
|
|||
} else if (p.currentToken() == XContentParser.Token.VALUE_STRING) {
|
||||
return new Date(TimeUtils.dateStringToEpoch(p.text()));
|
||||
}
|
||||
throw new IllegalArgumentException("unexpected token [" + p.currentToken() + "] for [" + Bucket.TIMESTAMP.getPreferredName() + "]");
|
||||
throw new IllegalArgumentException(
|
||||
"unexpected token [" + p.currentToken() + "] for [" + Bucket.TIMESTAMP.getPreferredName() + "]");
|
||||
}, Bucket.TIMESTAMP, ObjectParser.ValueType.VALUE);
|
||||
PARSER.declareObjectArray(ConstructingObjectParser.constructorArg(), PartitionProbability.PARSER, PER_PARTITION_MAX_PROBABILITIES);
|
||||
PARSER.declareString((p, s) -> {}, Result.RESULT_TYPE);
|
||||
|
@ -205,7 +206,7 @@ public class PerPartitionMaxProbabilities extends ToXContentToBytes implements W
|
|||
public static class PartitionProbability extends ToXContentToBytes implements Writeable {
|
||||
|
||||
public static final ConstructingObjectParser<PartitionProbability, ParseFieldMatcherSupplier> PARSER =
|
||||
new ConstructingObjectParser<>(PER_PARTITION_MAX_PROBABILITIES.getPreferredName(),
|
||||
new ConstructingObjectParser<>("partitionProbability",
|
||||
a -> new PartitionProbability((String) a[0], (double) a[1]));
|
||||
|
||||
static {
|
||||
|
@ -266,7 +267,8 @@ public class PerPartitionMaxProbabilities extends ToXContentToBytes implements W
|
|||
|
||||
PartitionProbability that = (PartitionProbability) other;
|
||||
|
||||
return Objects.equals(this.partitionValue, that.partitionValue) && this.maxNormalisedProbability == that.maxNormalisedProbability;
|
||||
return Objects.equals(this.partitionValue, that.partitionValue)
|
||||
&& this.maxNormalisedProbability == that.maxNormalisedProbability;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,11 +14,11 @@ import org.joda.time.DateTime;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PerPartitionMaxProbabilitiesTest extends AbstractSerializingTestCase<PerPartitionMaxProbabilities> {
|
||||
public class PerPartitionMaxProbabilitiesTests extends AbstractSerializingTestCase<PerPartitionMaxProbabilities> {
|
||||
|
||||
@Override
|
||||
protected PerPartitionMaxProbabilities createTestInstance() {
|
||||
int num = randomInt(10);
|
||||
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()));
|
Loading…
Reference in New Issue