Improved test and appeased TeamCity

This commit is contained in:
Justin Borromeo 2019-03-06 10:34:13 -08:00
parent 35c96d3557
commit 6dc53b311c
2 changed files with 7 additions and 12 deletions

View File

@ -75,11 +75,6 @@ public class ScanQuery extends BaseQuery<ScanResultValue>
return RESULT_FORMAT_LIST;
}
}
public byte[] getCacheKey()
{
return new byte[]{(byte) this.ordinal()};
}
}
public enum TimeOrder
@ -100,11 +95,6 @@ public class ScanQuery extends BaseQuery<ScanResultValue>
{
return valueOf(StringUtils.toUpperCase(name));
}
public byte[] getCacheKey()
{
return new byte[]{(byte) this.ordinal()};
}
}
/**

View File

@ -101,7 +101,7 @@ public class ScanQueryRunnerFactoryTest
List<ScanResultValue> srvs = new ArrayList<>(numElements);
List<Long> expectedEventTimestamps = new ArrayList<>();
for (int i = 0; i < numElements; i++) {
long timestamp = (long) (ThreadLocalRandom.current().nextLong());
long timestamp = (ThreadLocalRandom.current().nextLong());
expectedEventTimestamps.add(timestamp);
srvs.add(ScanQueryTestHelper.generateScanResultValue(timestamp, resultFormat, 1));
}
@ -136,7 +136,7 @@ public class ScanQueryRunnerFactoryTest
// check total # of rows <= limit
Assert.assertTrue(output.size() <= query.getLimit());
// check ordering and values are correct
// check ordering is correct
for (int i = 1; i < output.size(); i++) {
if (query.getTimeOrder().equals(ScanQuery.TimeOrder.DESCENDING)) {
Assert.assertTrue(output.get(i).getFirstEventTimestamp(resultFormat) <
@ -146,5 +146,10 @@ public class ScanQueryRunnerFactoryTest
output.get(i - 1).getFirstEventTimestamp(resultFormat));
}
}
// check the values are correct
for(int i = 0; i < query.getLimit() && i < output.size(); i++) {
Assert.assertEquals((long) expectedEventTimestamps.get(i), output.get(i).getFirstEventTimestamp(resultFormat));
}
}
}