diff options
Diffstat (limited to 'searchlib/src/test/java/com/yahoo')
65 files changed, 368 insertions, 366 deletions
diff --git a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/AggregationTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/AggregationTestCase.java index 77b6726c11c..1c0212babf8 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/AggregationTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/AggregationTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.aggregation; import com.yahoo.document.DocumentId; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/ExpressionCountAggregationResultTest.java b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/ExpressionCountAggregationResultTest.java index 0d7c4c8bca1..9257e7fb429 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/ExpressionCountAggregationResultTest.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/ExpressionCountAggregationResultTest.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.aggregation; import com.yahoo.searchlib.aggregation.hll.*; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/ForceLoadTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/ForceLoadTestCase.java index ee7d50f33cb..f2abc2069d7 100755 --- a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/ForceLoadTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/ForceLoadTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.aggregation; public class ForceLoadTestCase extends junit.framework.TestCase { diff --git a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/GroupTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/GroupTestCase.java index 1852f292a48..1b5ab25f2a7 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/GroupTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/GroupTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.aggregation; import com.yahoo.searchlib.expression.*; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/GroupingSerializationTest.java b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/GroupingSerializationTest.java index c684db11413..118eba2cd96 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/GroupingSerializationTest.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/GroupingSerializationTest.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.aggregation; import com.yahoo.document.DocumentId; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/GroupingTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/GroupingTestCase.java index f4ae62265d7..f6b324d30be 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/GroupingTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/GroupingTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.aggregation; import com.yahoo.searchlib.expression.NullResultNode; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/MergeTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/MergeTestCase.java index 67361048773..f94806fb00a 100755 --- a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/MergeTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/MergeTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.aggregation; import com.yahoo.document.DocumentId; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/StandardDeviationAggregationResultTest.java b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/StandardDeviationAggregationResultTest.java index 9de5f05b092..c5e3c2acfea 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/StandardDeviationAggregationResultTest.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/StandardDeviationAggregationResultTest.java @@ -1,3 +1,4 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.aggregation; import org.junit.Test; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/BiasEstimatorTest.java b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/BiasEstimatorTest.java index 307214d8c1c..66e61eb7f8e 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/BiasEstimatorTest.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/BiasEstimatorTest.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.aggregation.hll; import org.junit.Test; @@ -67,4 +67,4 @@ public class BiasEstimatorTest { private static void assertEstimateEquals(double expected, double rawEstimate, BiasEstimator biasEstimator) { assertEquals(expected, biasEstimator.estimateBias(rawEstimate), 0.00000001); } -}
\ No newline at end of file +} diff --git a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/HyperLogLogEstimatorTest.java b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/HyperLogLogEstimatorTest.java index 1ba4a71d102..56b5bf53d00 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/HyperLogLogEstimatorTest.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/HyperLogLogEstimatorTest.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.aggregation.hll; import net.jpountz.xxhash.XXHash32; @@ -86,4 +86,4 @@ public class HyperLogLogEstimatorTest { byte[] bytes = ByteBuffer.allocate(4).putInt(value).array(); return hashGenerator.hash(bytes, 0, 4, seed); } -}
\ No newline at end of file +} diff --git a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/HyperLogLogPrecisionBenchmark.java b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/HyperLogLogPrecisionBenchmark.java index 5dba5e48578..3a265e80c89 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/HyperLogLogPrecisionBenchmark.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/HyperLogLogPrecisionBenchmark.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.aggregation.hll; import net.jpountz.xxhash.XXHash32; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/NormalSketchTest.java b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/NormalSketchTest.java index 3b0a584f37b..2158eba897c 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/NormalSketchTest.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/NormalSketchTest.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.aggregation.hll; import com.yahoo.vespa.objects.BufferSerializer; @@ -118,4 +118,4 @@ public class NormalSketchTest { } } -}
\ No newline at end of file +} diff --git a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/SketchMergerTest.java b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/SketchMergerTest.java index 07488d21fd3..6cad4aa380c 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/SketchMergerTest.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/SketchMergerTest.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.aggregation.hll; import org.junit.Test; @@ -66,4 +66,4 @@ public class SketchMergerTest { assertTrue("Should return the NormalSketch instance given by the arguments.", result == s2); SketchUtils.assertSketchContains(result, 1, 2); } -}
\ No newline at end of file +} diff --git a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/SketchUtils.java b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/SketchUtils.java index 90098f8c950..1ad36c55c21 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/SketchUtils.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/SketchUtils.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.aggregation.hll; import java.util.Arrays; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/SparseSketchTest.java b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/SparseSketchTest.java index 4be0f89514d..749e072f2cd 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/SparseSketchTest.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/SparseSketchTest.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.aggregation.hll; import com.yahoo.vespa.objects.BufferSerializer; @@ -59,4 +59,4 @@ public class SparseSketchTest { assertEquals(s1.data(), s2.data()); } -}
\ No newline at end of file +} diff --git a/searchlib/src/test/java/com/yahoo/searchlib/expression/ExpressionTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/expression/ExpressionTestCase.java index 62486e63f7f..d76db4e8147 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/expression/ExpressionTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/expression/ExpressionTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.expression; import com.yahoo.io.GrowableByteBuffer; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/expression/FixedWidthBucketFunctionTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/expression/FixedWidthBucketFunctionTestCase.java index 4836c9c05d2..8ec83bc1f6e 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/expression/FixedWidthBucketFunctionTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/expression/FixedWidthBucketFunctionTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.expression; import org.junit.Test; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/expression/FloatBucketResultNodeTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/expression/FloatBucketResultNodeTestCase.java index a1255db4536..90f61607136 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/expression/FloatBucketResultNodeTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/expression/FloatBucketResultNodeTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.expression; import org.junit.Test; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/expression/ForceLoadTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/expression/ForceLoadTestCase.java index e1bfe321619..a5d216ff089 100755 --- a/searchlib/src/test/java/com/yahoo/searchlib/expression/ForceLoadTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/expression/ForceLoadTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.expression; public class ForceLoadTestCase extends junit.framework.TestCase { diff --git a/searchlib/src/test/java/com/yahoo/searchlib/expression/IntegerBucketResultNodeTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/expression/IntegerBucketResultNodeTestCase.java index a7517952703..377b8e45652 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/expression/IntegerBucketResultNodeTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/expression/IntegerBucketResultNodeTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.expression; import com.yahoo.vespa.objects.BufferSerializer; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/expression/IntegerResultNodeTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/expression/IntegerResultNodeTestCase.java index 07c88464958..155c3514d7c 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/expression/IntegerResultNodeTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/expression/IntegerResultNodeTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.expression; import com.yahoo.vespa.objects.BufferSerializer; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/expression/NullResultNodeTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/expression/NullResultNodeTestCase.java index 9eb4ee4fea7..3966e241fc5 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/expression/NullResultNodeTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/expression/NullResultNodeTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.expression; import com.yahoo.vespa.objects.ObjectDumper; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/expression/ObjectVisitorTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/expression/ObjectVisitorTestCase.java index 2924ee945e5..1d1fa8251fd 100755 --- a/searchlib/src/test/java/com/yahoo/searchlib/expression/ObjectVisitorTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/expression/ObjectVisitorTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.expression; import com.yahoo.vespa.objects.ObjectDumper; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/expression/RangeBucketPreDefFunctionTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/expression/RangeBucketPreDefFunctionTestCase.java index d2db697c743..d60b47aec13 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/expression/RangeBucketPreDefFunctionTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/expression/RangeBucketPreDefFunctionTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.expression; import org.junit.Test; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/expression/RawBucketResultNodeTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/expression/RawBucketResultNodeTestCase.java index 83a36445294..279a90207c6 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/expression/RawBucketResultNodeTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/expression/RawBucketResultNodeTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.expression; import org.junit.Test; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/expression/ResultNodeTest.java b/searchlib/src/test/java/com/yahoo/searchlib/expression/ResultNodeTest.java index 17744db7edb..bb28050656c 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/expression/ResultNodeTest.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/expression/ResultNodeTest.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.expression; import com.yahoo.vespa.objects.BufferSerializer; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/expression/ResultNodeVectorTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/expression/ResultNodeVectorTestCase.java index ba306099a80..ec7bfb711f2 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/expression/ResultNodeVectorTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/expression/ResultNodeVectorTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.expression; import com.yahoo.vespa.objects.BufferSerializer; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/expression/StringBucketResultNodeTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/expression/StringBucketResultNodeTestCase.java index b82c7a34048..34bf0ad23e6 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/expression/StringBucketResultNodeTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/expression/StringBucketResultNodeTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.expression; import org.junit.Test; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/expression/TimeStampFunctionTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/expression/TimeStampFunctionTestCase.java index 4d591843321..64610c73306 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/expression/TimeStampFunctionTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/expression/TimeStampFunctionTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.expression; import org.junit.Test; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/expression/ZCurveFunctionTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/expression/ZCurveFunctionTestCase.java index 899e4e28a20..7bd30fb75c0 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/expression/ZCurveFunctionTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/expression/ZCurveFunctionTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.expression; import org.junit.Test; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/gbdt/GbdtConverterTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/gbdt/GbdtConverterTestCase.java index fc21b3496f9..0084180d988 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/gbdt/GbdtConverterTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/gbdt/GbdtConverterTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.gbdt; import com.yahoo.searchlib.rankingexpression.RankingExpression; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/gbdt/GbdtModelTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/gbdt/GbdtModelTestCase.java index 0561fb8ac7f..1157b9130f0 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/gbdt/GbdtModelTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/gbdt/GbdtModelTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.gbdt; import com.yahoo.searchlib.rankingexpression.RankingExpression; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/gbdt/ReferenceNodeTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/gbdt/ReferenceNodeTestCase.java index 6b4e075b769..f61b283aed3 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/gbdt/ReferenceNodeTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/gbdt/ReferenceNodeTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.gbdt; import com.yahoo.searchlib.rankingexpression.evaluation.DoubleValue; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/gbdt/ResponseNodeTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/gbdt/ResponseNodeTestCase.java index 7d6022fa304..54bdf794a07 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/gbdt/ResponseNodeTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/gbdt/ResponseNodeTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.gbdt; import org.junit.Test; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/gbdt/TreeNodeTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/gbdt/TreeNodeTestCase.java index 572bd2d8c11..6d3b2584d22 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/gbdt/TreeNodeTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/gbdt/TreeNodeTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.gbdt; import org.junit.Test; @@ -54,4 +54,4 @@ public class TreeNodeTestCase { assertEquals("Unknown", e.getMessage()); } } -}
\ No newline at end of file +} diff --git a/searchlib/src/test/java/com/yahoo/searchlib/gbdt/XmlHelperTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/gbdt/XmlHelperTestCase.java index 7dc7c42f590..f09e4c04275 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/gbdt/XmlHelperTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/gbdt/XmlHelperTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.gbdt; import org.junit.Test; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/mlr/ga/test/CsvFileCaseListTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/mlr/ga/test/CsvFileCaseListTestCase.java index 265b419a9e6..68f705315ad 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/mlr/ga/test/CsvFileCaseListTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/mlr/ga/test/CsvFileCaseListTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.mlr.ga.test; import com.yahoo.searchlib.mlr.ga.TrainingParameters; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/mlr/ga/test/ExampleLearningSessions.java b/searchlib/src/test/java/com/yahoo/searchlib/mlr/ga/test/ExampleLearningSessions.java index 1dce786e9e8..4de83d16300 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/mlr/ga/test/ExampleLearningSessions.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/mlr/ga/test/ExampleLearningSessions.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.mlr.ga.test; import com.yahoo.searchlib.mlr.ga.PrintingTracker; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/mlr/ga/test/MainTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/mlr/ga/test/MainTestCase.java index 1cfc1fa673b..f5febe2ab68 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/mlr/ga/test/MainTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/mlr/ga/test/MainTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.mlr.ga.test; import com.yahoo.searchlib.mlr.ga.Evolvable; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/mlr/ga/test/MockTrainingSetTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/mlr/ga/test/MockTrainingSetTestCase.java index b6f7d2a87ea..2fc6e6cab3d 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/mlr/ga/test/MockTrainingSetTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/mlr/ga/test/MockTrainingSetTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.mlr.ga.test; import com.yahoo.searchlib.mlr.ga.RankingExpressionCaseList; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/mlr/ga/test/TripAdvisorFileCaseList.java b/searchlib/src/test/java/com/yahoo/searchlib/mlr/ga/test/TripAdvisorFileCaseList.java index a1177aebefe..7945e2605b0 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/mlr/ga/test/TripAdvisorFileCaseList.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/mlr/ga/test/TripAdvisorFileCaseList.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.mlr.ga.test; import com.yahoo.searchlib.mlr.ga.CaseList; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/mlr/gbdt/ExpressionAnalysisRunner.java b/searchlib/src/test/java/com/yahoo/searchlib/mlr/gbdt/ExpressionAnalysisRunner.java index 301fdfcd4f2..28f90ebb0fc 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/mlr/gbdt/ExpressionAnalysisRunner.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/mlr/gbdt/ExpressionAnalysisRunner.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.mlr.gbdt; import org.junit.Ignore; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/ranking/features/ElementCompletenessTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/ranking/features/ElementCompletenessTestCase.java index 804f34ccce8..d9f4c424314 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/ranking/features/ElementCompletenessTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/ranking/features/ElementCompletenessTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.ranking.features; import static org.junit.Assert.*; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/ranking/features/FieldTermMatchTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/ranking/features/FieldTermMatchTestCase.java index 61c313956c5..9a2438824c5 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/ranking/features/FieldTermMatchTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/ranking/features/FieldTermMatchTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.ranking.features; import static org.junit.Assert.*; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/ranking/features/fieldmatch/SemanticDistanceTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/ranking/features/fieldmatch/SemanticDistanceTestCase.java index 2663fc26b1a..68db4867cf7 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/ranking/features/fieldmatch/SemanticDistanceTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/ranking/features/fieldmatch/SemanticDistanceTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.ranking.features.fieldmatch; import com.yahoo.searchlib.ranking.features.fieldmatch.FieldMatchMetricsComputer; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/ranking/features/fieldmatch/reference/OptimalStringAlignmentDistance.java b/searchlib/src/test/java/com/yahoo/searchlib/ranking/features/fieldmatch/reference/OptimalStringAlignmentDistance.java index 3f55d3ed9a0..3160cb1858a 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/ranking/features/fieldmatch/reference/OptimalStringAlignmentDistance.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/ranking/features/fieldmatch/reference/OptimalStringAlignmentDistance.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.ranking.features.fieldmatch.reference; import java.util.Arrays; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/ranking/features/fieldmatch/reference/TextbookLevenshteinDistance.java b/searchlib/src/test/java/com/yahoo/searchlib/ranking/features/fieldmatch/reference/TextbookLevenshteinDistance.java index 5ad3449a9d3..420c5ffe7fc 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/ranking/features/fieldmatch/reference/TextbookLevenshteinDistance.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/ranking/features/fieldmatch/reference/TextbookLevenshteinDistance.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.ranking.features.fieldmatch.reference; /** diff --git a/searchlib/src/test/java/com/yahoo/searchlib/ranking/features/fieldmatch/reference/test/OptimalStringAlignmentTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/ranking/features/fieldmatch/reference/test/OptimalStringAlignmentTestCase.java index f57835cdc3f..b2db0d0f805 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/ranking/features/fieldmatch/reference/test/OptimalStringAlignmentTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/ranking/features/fieldmatch/reference/test/OptimalStringAlignmentTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.ranking.features.fieldmatch.reference.test; import com.yahoo.searchlib.ranking.features.fieldmatch.reference.OptimalStringAlignmentDistance; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/ranking/features/fieldmatch/test/FieldMatchMetricsTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/ranking/features/fieldmatch/test/FieldMatchMetricsTestCase.java index ef8daec2b73..6f9b0f03b6b 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/ranking/features/fieldmatch/test/FieldMatchMetricsTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/ranking/features/fieldmatch/test/FieldMatchMetricsTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.ranking.features.fieldmatch.test; import com.google.common.collect.ImmutableList; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/FeatureListTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/FeatureListTestCase.java index 7399088ac1c..9b67c82f802 100755 --- a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/FeatureListTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/FeatureListTestCase.java @@ -1,77 +1,77 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.searchlib.rankingexpression;
-
-import com.yahoo.searchlib.rankingexpression.parser.ParseException;
-import org.junit.Test;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.Reader;
-import java.io.StringReader;
-import java.util.Arrays;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a>
- */
-public class FeatureListTestCase {
-
- @Test
- public void requireThatFeatureListFromStringWorks() throws ParseException {
- assertFromString("attribute(foo).out",
- Arrays.asList("attribute(foo).out"));
- assertFromString("attribute(foo).out attribute ( bar ) . out",
- Arrays.asList("attribute(foo).out", "attribute(bar).out"));
- assertFromString("foo\n bar\n \t \t \n baz \n",
- Arrays.asList("foo", "bar", "baz"));
- assertFromString("attribute attribute(foo) attribute(foo).out attribute(bar).out.out",
- Arrays.asList("attribute", "attribute(foo)", "attribute(foo).out", "attribute(bar).out.out"));
- }
-
- @Test
- public void requireThatFeatureListFromReaderWorks() throws ParseException {
- assertFromReader(new StringReader("attribute(foo).out"),
- Arrays.asList("attribute(foo).out"));
- assertFromReader(new StringReader("attribute(foo).out attribute ( bar ) . out"),
- Arrays.asList("attribute(foo).out", "attribute(bar).out"));
- assertFromReader(new StringReader("foo\n bar\n \t \t \n baz \n"),
- Arrays.asList("foo", "bar", "baz"));
- assertFromReader(new StringReader("attribute attribute(foo) attribute(foo).out attribute(bar).out.out"),
- Arrays.asList("attribute", "attribute(foo)", "attribute(foo).out", "attribute(bar).out.out"));
- }
-
- @Test
- public void requireThatFeatureListFromFileWorks() throws ParseException, FileNotFoundException {
- assertFromFile(new File("src/test/files/features01.expression"),
- Arrays.asList("attribute(foo).out"));
- assertFromFile(new File("src/test/files/features02.expression"),
- Arrays.asList("attribute(foo).out", "attribute(bar).out"));
- assertFromFile(new File("src/test/files/features03.expression"),
- Arrays.asList("foo", "bar", "baz"));
- assertFromFile(new File("src/test/files/features04.expression"),
- Arrays.asList("attribute", "attribute(foo)", "attribute(foo).out", "attribute(bar).out.out"));
- }
-
- public void assertFromString(String input, List<String> expected) throws ParseException {
- assertFeatureList(new FeatureList(input), expected);
- }
-
- public void assertFromReader(Reader input, List<String> expected) throws ParseException {
- assertFeatureList(new FeatureList(input), expected);
- }
-
- public void assertFromFile(File input, List<String> expected) throws ParseException, FileNotFoundException {
- assertFeatureList(new FeatureList(input), expected);
- }
-
- public void assertFeatureList(FeatureList features, List<String> expected) throws ParseException {
- assertEquals(expected.size(), features.size());
- for (int i = 0; i < features.size(); ++i) {
- assertTrue(features.get(i) != null);
- assertEquals(expected.get(i), features.get(i).toString());
- }
- }
-}
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.searchlib.rankingexpression; + +import com.yahoo.searchlib.rankingexpression.parser.ParseException; +import org.junit.Test; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.Reader; +import java.io.StringReader; +import java.util.Arrays; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class FeatureListTestCase { + + @Test + public void requireThatFeatureListFromStringWorks() throws ParseException { + assertFromString("attribute(foo).out", + Arrays.asList("attribute(foo).out")); + assertFromString("attribute(foo).out attribute ( bar ) . out", + Arrays.asList("attribute(foo).out", "attribute(bar).out")); + assertFromString("foo\n bar\n \t \t \n baz \n", + Arrays.asList("foo", "bar", "baz")); + assertFromString("attribute attribute(foo) attribute(foo).out attribute(bar).out.out", + Arrays.asList("attribute", "attribute(foo)", "attribute(foo).out", "attribute(bar).out.out")); + } + + @Test + public void requireThatFeatureListFromReaderWorks() throws ParseException { + assertFromReader(new StringReader("attribute(foo).out"), + Arrays.asList("attribute(foo).out")); + assertFromReader(new StringReader("attribute(foo).out attribute ( bar ) . out"), + Arrays.asList("attribute(foo).out", "attribute(bar).out")); + assertFromReader(new StringReader("foo\n bar\n \t \t \n baz \n"), + Arrays.asList("foo", "bar", "baz")); + assertFromReader(new StringReader("attribute attribute(foo) attribute(foo).out attribute(bar).out.out"), + Arrays.asList("attribute", "attribute(foo)", "attribute(foo).out", "attribute(bar).out.out")); + } + + @Test + public void requireThatFeatureListFromFileWorks() throws ParseException, FileNotFoundException { + assertFromFile(new File("src/test/files/features01.expression"), + Arrays.asList("attribute(foo).out")); + assertFromFile(new File("src/test/files/features02.expression"), + Arrays.asList("attribute(foo).out", "attribute(bar).out")); + assertFromFile(new File("src/test/files/features03.expression"), + Arrays.asList("foo", "bar", "baz")); + assertFromFile(new File("src/test/files/features04.expression"), + Arrays.asList("attribute", "attribute(foo)", "attribute(foo).out", "attribute(bar).out.out")); + } + + public void assertFromString(String input, List<String> expected) throws ParseException { + assertFeatureList(new FeatureList(input), expected); + } + + public void assertFromReader(Reader input, List<String> expected) throws ParseException { + assertFeatureList(new FeatureList(input), expected); + } + + public void assertFromFile(File input, List<String> expected) throws ParseException, FileNotFoundException { + assertFeatureList(new FeatureList(input), expected); + } + + public void assertFeatureList(FeatureList features, List<String> expected) throws ParseException { + assertEquals(expected.size(), features.size()); + for (int i = 0; i < features.size(); ++i) { + assertTrue(features.get(i) != null); + assertEquals(expected.get(i), features.get(i).toString()); + } + } +} diff --git a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/RankingExpressionTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/RankingExpressionTestCase.java index f28ff739b4c..c0157b3c8b6 100755 --- a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/RankingExpressionTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/RankingExpressionTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.rankingexpression; import com.yahoo.searchlib.rankingexpression.parser.ParseException; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/Benchmark.java b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/Benchmark.java index 7690efb1112..bb2110a0f5f 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/Benchmark.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/Benchmark.java @@ -1,144 +1,144 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.searchlib.rankingexpression.evaluation;
-
-import com.yahoo.searchlib.rankingexpression.RankingExpression;
-import com.yahoo.searchlib.rankingexpression.evaluation.gbdtoptimization.GBDTForestOptimizer;
-import com.yahoo.searchlib.rankingexpression.parser.ParseException;
-import com.yahoo.searchlib.rankingexpression.rule.CompositeNode;
-import com.yahoo.searchlib.rankingexpression.rule.ExpressionNode;
-import com.yahoo.searchlib.rankingexpression.rule.ReferenceNode;
-
-import java.io.BufferedReader;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a>
- */
-public final class Benchmark {
-
- public static void main(String[] args) {
- if (args.length < 1) {
- System.err.println("Usage: Benchmark <filename> [<iterations>]");
- System.exit(1);
- }
- int numRuns = 1000;
- if (args.length == 2) {
- numRuns = Integer.valueOf(args[1]);
- }
- List<Result> res = new ArrayList<Result>();
- try {
- BufferedReader in = new BufferedReader(new FileReader(args[0]));
- StringBuilder str = new StringBuilder();
- String line;
- while ((line = in.readLine()) != null) {
- str.append(line);
- }
- String exp = str.toString();
- res.add(evaluateTree(exp, numRuns));
- res.add(evaluateTreeOptimized(exp, numRuns));
- res.add(evaluateForestOptimized(exp, numRuns));
- } catch (IOException e) {
- System.out.println("An error occured while reading the content of file '" + args[0] + "': " + e);
- System.exit(1);
- } catch (ParseException e) {
- System.out.println("An error occured while parsing the content of file '" + args[0] + "': " + e);
- System.exit(1);
- }
- for (Result lhs : res) {
- for (Result rhs : res) {
- if (lhs.res < rhs.res - 1e-6 || lhs.res > rhs.res + 1e-6) {
- System.err.println("Evaluation of '" + lhs.name + "' and '" + rhs.name + "' disagree on result; " +
- "expected " + lhs.res + ", got " + rhs.res + ".");
- System.exit(1);
- }
- }
- System.out.format("%1$-16s : %2$8.04f ms (%3$-6.04f)\n",
- lhs.name, lhs.millis, res.get(0).millis / lhs.millis);
- }
- }
-
- private static Result evaluateTree(String str, int numRuns) throws ParseException {
- Result ret = new Result();
- ret.name = "Unoptimized";
-
- RankingExpression exp = new RankingExpression(str);
- List<String> vars = new LinkedList<String>();
- getFeatures(exp.getRoot(), vars);
-
- benchmark(exp, vars, new MapContext(), numRuns, ret);
- return ret;
- }
-
- private static Result evaluateTreeOptimized(String str, int numRuns) throws ParseException {
- Result ret = new Result();
- ret.name = "Optimized tree";
-
- RankingExpression exp = new RankingExpression(str);
- List<String> vars = new LinkedList<String>();
- getFeatures(exp.getRoot(), vars);
-
- ArrayContext ctx = new ArrayContext(exp);
- ExpressionOptimizer optimizer = new ExpressionOptimizer();
- optimizer.getOptimizer(GBDTForestOptimizer.class).setEnabled(false);
- optimizer.optimize(exp, ctx);
-
- benchmark(exp, vars, ctx, numRuns, ret);
- return ret;
- }
-
- private static Result evaluateForestOptimized(String str, int numRuns) throws ParseException {
- Result ret = new Result();
- ret.name = "Optimized forest";
-
- RankingExpression exp = new RankingExpression(str);
- List<String> vars = new LinkedList<String>();
- getFeatures(exp.getRoot(), vars);
-
- ArrayContext ctx = new ArrayContext(exp);
- ExpressionOptimizer optimizer = new ExpressionOptimizer();
- optimizer.optimize(exp, ctx);
-
- benchmark(exp, vars, ctx, numRuns, ret);
- return ret;
- }
-
- private static void benchmark(RankingExpression exp, List<String> vars, Context ctx, int numRuns, Result out) {
- for (int i = 0, len = vars.size(); i < len; ++i) {
- ctx.put(vars.get(i), i / (double)len);
- }
- for (int i = 0; i < numRuns; ++i) {
- out.res = exp.evaluate(ctx).asDouble();
- }
- long begin = System.nanoTime();
- for (int i = 0; i < numRuns; ++i) {
- out.res = exp.evaluate(ctx).asDouble();
- }
- long end = System.nanoTime();
-
- out.millis = (end - begin) / (1000.0 * 1000.0);
- }
-
- private static void getFeatures(ExpressionNode node, List<String> out) {
- if (node instanceof ReferenceNode) {
- String feature = ((ReferenceNode)node).getName();
- if (!out.contains(feature)) {
- out.add(feature);
- }
- } else if (node instanceof CompositeNode) {
- CompositeNode cNode = (CompositeNode)node;
- for (ExpressionNode child : cNode.children()) {
- getFeatures(child, out);
- }
- }
- }
-
- private static class Result {
- String name = "anonymous";
- double millis = Double.MAX_VALUE;
- double res = 0;
- }
-}
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.searchlib.rankingexpression.evaluation; + +import com.yahoo.searchlib.rankingexpression.RankingExpression; +import com.yahoo.searchlib.rankingexpression.evaluation.gbdtoptimization.GBDTForestOptimizer; +import com.yahoo.searchlib.rankingexpression.parser.ParseException; +import com.yahoo.searchlib.rankingexpression.rule.CompositeNode; +import com.yahoo.searchlib.rankingexpression.rule.ExpressionNode; +import com.yahoo.searchlib.rankingexpression.rule.ReferenceNode; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public final class Benchmark { + + public static void main(String[] args) { + if (args.length < 1) { + System.err.println("Usage: Benchmark <filename> [<iterations>]"); + System.exit(1); + } + int numRuns = 1000; + if (args.length == 2) { + numRuns = Integer.valueOf(args[1]); + } + List<Result> res = new ArrayList<Result>(); + try { + BufferedReader in = new BufferedReader(new FileReader(args[0])); + StringBuilder str = new StringBuilder(); + String line; + while ((line = in.readLine()) != null) { + str.append(line); + } + String exp = str.toString(); + res.add(evaluateTree(exp, numRuns)); + res.add(evaluateTreeOptimized(exp, numRuns)); + res.add(evaluateForestOptimized(exp, numRuns)); + } catch (IOException e) { + System.out.println("An error occured while reading the content of file '" + args[0] + "': " + e); + System.exit(1); + } catch (ParseException e) { + System.out.println("An error occured while parsing the content of file '" + args[0] + "': " + e); + System.exit(1); + } + for (Result lhs : res) { + for (Result rhs : res) { + if (lhs.res < rhs.res - 1e-6 || lhs.res > rhs.res + 1e-6) { + System.err.println("Evaluation of '" + lhs.name + "' and '" + rhs.name + "' disagree on result; " + + "expected " + lhs.res + ", got " + rhs.res + "."); + System.exit(1); + } + } + System.out.format("%1$-16s : %2$8.04f ms (%3$-6.04f)\n", + lhs.name, lhs.millis, res.get(0).millis / lhs.millis); + } + } + + private static Result evaluateTree(String str, int numRuns) throws ParseException { + Result ret = new Result(); + ret.name = "Unoptimized"; + + RankingExpression exp = new RankingExpression(str); + List<String> vars = new LinkedList<String>(); + getFeatures(exp.getRoot(), vars); + + benchmark(exp, vars, new MapContext(), numRuns, ret); + return ret; + } + + private static Result evaluateTreeOptimized(String str, int numRuns) throws ParseException { + Result ret = new Result(); + ret.name = "Optimized tree"; + + RankingExpression exp = new RankingExpression(str); + List<String> vars = new LinkedList<String>(); + getFeatures(exp.getRoot(), vars); + + ArrayContext ctx = new ArrayContext(exp); + ExpressionOptimizer optimizer = new ExpressionOptimizer(); + optimizer.getOptimizer(GBDTForestOptimizer.class).setEnabled(false); + optimizer.optimize(exp, ctx); + + benchmark(exp, vars, ctx, numRuns, ret); + return ret; + } + + private static Result evaluateForestOptimized(String str, int numRuns) throws ParseException { + Result ret = new Result(); + ret.name = "Optimized forest"; + + RankingExpression exp = new RankingExpression(str); + List<String> vars = new LinkedList<String>(); + getFeatures(exp.getRoot(), vars); + + ArrayContext ctx = new ArrayContext(exp); + ExpressionOptimizer optimizer = new ExpressionOptimizer(); + optimizer.optimize(exp, ctx); + + benchmark(exp, vars, ctx, numRuns, ret); + return ret; + } + + private static void benchmark(RankingExpression exp, List<String> vars, Context ctx, int numRuns, Result out) { + for (int i = 0, len = vars.size(); i < len; ++i) { + ctx.put(vars.get(i), i / (double)len); + } + for (int i = 0; i < numRuns; ++i) { + out.res = exp.evaluate(ctx).asDouble(); + } + long begin = System.nanoTime(); + for (int i = 0; i < numRuns; ++i) { + out.res = exp.evaluate(ctx).asDouble(); + } + long end = System.nanoTime(); + + out.millis = (end - begin) / (1000.0 * 1000.0); + } + + private static void getFeatures(ExpressionNode node, List<String> out) { + if (node instanceof ReferenceNode) { + String feature = ((ReferenceNode)node).getName(); + if (!out.contains(feature)) { + out.add(feature); + } + } else if (node instanceof CompositeNode) { + CompositeNode cNode = (CompositeNode)node; + for (ExpressionNode child : cNode.children()) { + getFeatures(child, out); + } + } + } + + private static class Result { + String name = "anonymous"; + double millis = Double.MAX_VALUE; + double res = 0; + } +} diff --git a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/EvaluationBenchmark.java b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/EvaluationBenchmark.java index 708235647e6..ac24680e601 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/EvaluationBenchmark.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/EvaluationBenchmark.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.rankingexpression.evaluation; import com.yahoo.io.IOUtils; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/EvaluationTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/EvaluationTestCase.java index deaf1070d45..f80d8df79a6 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/EvaluationTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/EvaluationTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.rankingexpression.evaluation; import com.yahoo.javacc.UnicodeUtilities; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/EvaluationTester.java b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/EvaluationTester.java index 2ce3d5b5eca..47ef69b914a 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/EvaluationTester.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/EvaluationTester.java @@ -1,3 +1,4 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.rankingexpression.evaluation; import com.yahoo.searchlib.rankingexpression.RankingExpression; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/NeuralNetEvaluationTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/NeuralNetEvaluationTestCase.java index edf1da08af0..dc1846feaa6 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/NeuralNetEvaluationTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/NeuralNetEvaluationTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.rankingexpression.evaluation; import com.yahoo.searchlib.rankingexpression.RankingExpression; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/StreamEvaluationBenchmark.java b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/StreamEvaluationBenchmark.java index 837c7401813..280ffc6278b 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/StreamEvaluationBenchmark.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/StreamEvaluationBenchmark.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.rankingexpression.evaluation; import com.yahoo.io.IOUtils; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/gbdtoptimization/ContextReuseTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/gbdtoptimization/ContextReuseTestCase.java index 998f25b943a..3d5710b81e0 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/gbdtoptimization/ContextReuseTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/gbdtoptimization/ContextReuseTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.rankingexpression.evaluation.gbdtoptimization; import com.yahoo.io.IOUtils; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/gbdtoptimization/GBDTForestOptimizerTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/gbdtoptimization/GBDTForestOptimizerTestCase.java index 7058e909ef1..420819a8b2a 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/gbdtoptimization/GBDTForestOptimizerTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/gbdtoptimization/GBDTForestOptimizerTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.rankingexpression.evaluation.gbdtoptimization; import com.yahoo.searchlib.rankingexpression.RankingExpression; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/gbdtoptimization/GBDTOptimizerTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/gbdtoptimization/GBDTOptimizerTestCase.java index 993262b1241..1cbd19b667e 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/gbdtoptimization/GBDTOptimizerTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/gbdtoptimization/GBDTOptimizerTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.rankingexpression.evaluation.gbdtoptimization; import com.yahoo.searchlib.rankingexpression.RankingExpression; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/rule/ArgumentsTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/rule/ArgumentsTestCase.java index 5402935697d..867331e99ce 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/rule/ArgumentsTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/rule/ArgumentsTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.rankingexpression.rule; import org.junit.Test; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/rule/ReferenceNodeTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/rule/ReferenceNodeTestCase.java index 6070a3805c6..75b8e1122c1 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/rule/ReferenceNodeTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/rule/ReferenceNodeTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.rankingexpression.rule; import org.junit.Test; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/transform/ConstantDereferencerTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/transform/ConstantDereferencerTestCase.java index 851eafd2ac8..4035e499a6a 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/transform/ConstantDereferencerTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/transform/ConstantDereferencerTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.rankingexpression.transform; import com.yahoo.searchlib.rankingexpression.RankingExpression; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/transform/SimplifierTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/transform/SimplifierTestCase.java index 61b230ab390..f9d2472e306 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/transform/SimplifierTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/transform/SimplifierTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.rankingexpression.transform; import com.yahoo.searchlib.rankingexpression.RankingExpression; diff --git a/searchlib/src/test/java/com/yahoo/searchlib/treenet/TreeNetParserTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/treenet/TreeNetParserTestCase.java index 0e27d53338a..cd7643b9f74 100755 --- a/searchlib/src/test/java/com/yahoo/searchlib/treenet/TreeNetParserTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/treenet/TreeNetParserTestCase.java @@ -1,79 +1,79 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.searchlib.treenet;
-
-import com.yahoo.searchlib.rankingexpression.RankingExpression;
-import com.yahoo.searchlib.treenet.parser.ParseException;
-import com.yahoo.searchlib.treenet.parser.TreeNetParser;
-import junit.framework.TestCase;
-
-import java.io.*;
-
-/**
- * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a>
- */
-public class TreeNetParserTestCase extends TestCase {
-
- private static final boolean WRITE_FILES = false;
-
- public void testRankingExpression() {
- for (int i = 1; i <= 8; ++i) {
- String inputFile = String.format("src/test/files/treenet%02d.model", i);
- String outputFile = String.format("src/test/files/ranking%02d.expression", i);
- String input = readFile(inputFile);
- String expression = convertModel(inputFile, input);
- if (WRITE_FILES) {
- writeFile(outputFile, expression);
- }
- else {
- String output = readFile(outputFile);
- assertParseable(output, outputFile);
- assertEquals(output.trim(), expression);
- }
- }
- }
-
- private void assertParseable(String rankingExpressionString,String fileName) {
- try {
- new RankingExpression(rankingExpressionString);
- }
- catch (com.yahoo.searchlib.rankingexpression.parser.ParseException e) {
- throw new RuntimeException("Could not parse ranking expression in '" + fileName + "'",e);
- }
- }
-
- private String convertModel(String modelFile, String model) {
- try {
- TreeNetParser parser = new TreeNetParser(new StringReader(model));
- return parser.treeNet().toRankingExpression();
- } catch (ParseException e) {
- throw new AssertionError("In model " + modelFile + ": " + e.getMessage(), e);
- }
- }
-
- private String readFile(String file) {
- try {
- StringBuilder ret = new StringBuilder();
- BufferedReader in = new BufferedReader(new FileReader(file));
- while (true) {
- String str = in.readLine();
- if (str == null) {
- break;
- }
- ret.append(str).append("\n");
- }
- return ret.toString();
- } catch (IOException e) {
- throw new AssertionError(e);
- }
- }
-
- private void writeFile(String file, String content) {
- try {
- FileWriter out = new FileWriter(file);
- out.write(content);
- out.close();
- } catch (IOException e) {
- throw new AssertionError(e);
- }
- }
-}
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.searchlib.treenet; + +import com.yahoo.searchlib.rankingexpression.RankingExpression; +import com.yahoo.searchlib.treenet.parser.ParseException; +import com.yahoo.searchlib.treenet.parser.TreeNetParser; +import junit.framework.TestCase; + +import java.io.*; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class TreeNetParserTestCase extends TestCase { + + private static final boolean WRITE_FILES = false; + + public void testRankingExpression() { + for (int i = 1; i <= 8; ++i) { + String inputFile = String.format("src/test/files/treenet%02d.model", i); + String outputFile = String.format("src/test/files/ranking%02d.expression", i); + String input = readFile(inputFile); + String expression = convertModel(inputFile, input); + if (WRITE_FILES) { + writeFile(outputFile, expression); + } + else { + String output = readFile(outputFile); + assertParseable(output, outputFile); + assertEquals(output.trim(), expression); + } + } + } + + private void assertParseable(String rankingExpressionString,String fileName) { + try { + new RankingExpression(rankingExpressionString); + } + catch (com.yahoo.searchlib.rankingexpression.parser.ParseException e) { + throw new RuntimeException("Could not parse ranking expression in '" + fileName + "'",e); + } + } + + private String convertModel(String modelFile, String model) { + try { + TreeNetParser parser = new TreeNetParser(new StringReader(model)); + return parser.treeNet().toRankingExpression(); + } catch (ParseException e) { + throw new AssertionError("In model " + modelFile + ": " + e.getMessage(), e); + } + } + + private String readFile(String file) { + try { + StringBuilder ret = new StringBuilder(); + BufferedReader in = new BufferedReader(new FileReader(file)); + while (true) { + String str = in.readLine(); + if (str == null) { + break; + } + ret.append(str).append("\n"); + } + return ret.toString(); + } catch (IOException e) { + throw new AssertionError(e); + } + } + + private void writeFile(String file, String content) { + try { + FileWriter out = new FileWriter(file); + out.write(content); + out.close(); + } catch (IOException e) { + throw new AssertionError(e); + } + } +} |