fixup indentations.

This commit is contained in:
Abhishek Balaji Radhakrishnan 2024-03-14 12:42:42 +05:30
parent e5e558c0d3
commit a9d6b73e79
1 changed files with 170 additions and 188 deletions

View File

@ -86,17 +86,16 @@ public class KillUnusedSegmentsTaskTest extends IngestionTestBase
) )
); );
final KillUnusedSegmentsTask task = final KillUnusedSegmentsTask task = new KillUnusedSegmentsTask(
new KillUnusedSegmentsTask( null,
null, DATA_SOURCE,
DATA_SOURCE, Intervals.of("2019-03-01/2019-04-01"),
Intervals.of("2019-03-01/2019-04-01"), null,
null, false,
false, null,
null, null,
null, null
null );
);
Assert.assertEquals(TaskState.SUCCESS, taskRunner.run(task).get().getStatusCode()); Assert.assertEquals(TaskState.SUCCESS, taskRunner.run(task).get().getStatusCode());
@ -197,17 +196,16 @@ public class KillUnusedSegmentsTaskTest extends IngestionTestBase
) )
); );
final KillUnusedSegmentsTask task = final KillUnusedSegmentsTask task = new KillUnusedSegmentsTask(
new KillUnusedSegmentsTask( null,
null, DATA_SOURCE,
DATA_SOURCE, Intervals.of("2019-03-01/2019-04-01"),
Intervals.of("2019-03-01/2019-04-01"), null,
null, true,
true, null,
null, null,
null, null
null );
);
Assert.assertEquals(TaskState.SUCCESS, taskRunner.run(task).get().getStatusCode()); Assert.assertEquals(TaskState.SUCCESS, taskRunner.run(task).get().getStatusCode());
@ -234,17 +232,16 @@ public class KillUnusedSegmentsTaskTest extends IngestionTestBase
@Test @Test
public void testGetInputSourceResources() public void testGetInputSourceResources()
{ {
final KillUnusedSegmentsTask task = final KillUnusedSegmentsTask task = new KillUnusedSegmentsTask(
new KillUnusedSegmentsTask( null,
null, DATA_SOURCE,
DATA_SOURCE, Intervals.of("2019-03-01/2019-04-01"),
Intervals.of("2019-03-01/2019-04-01"), null,
null, true,
true, null,
null, null,
null, null
null );
);
Assert.assertTrue(task.getInputSourceResources().isEmpty()); Assert.assertTrue(task.getInputSourceResources().isEmpty());
} }
@ -270,17 +267,16 @@ public class KillUnusedSegmentsTaskTest extends IngestionTestBase
) )
); );
final KillUnusedSegmentsTask task = final KillUnusedSegmentsTask task = new KillUnusedSegmentsTask(
new KillUnusedSegmentsTask( null,
null, DATA_SOURCE,
DATA_SOURCE, Intervals.of("2018-01-01/2020-01-01"),
Intervals.of("2018-01-01/2020-01-01"), null,
null, false,
false, 1,
1, 4,
4, null
null );
);
Assert.assertEquals(TaskState.SUCCESS, taskRunner.run(task).get().getStatusCode()); Assert.assertEquals(TaskState.SUCCESS, taskRunner.run(task).get().getStatusCode());
@ -348,17 +344,16 @@ public class KillUnusedSegmentsTaskTest extends IngestionTestBase
final Interval umbrellaInterval = JodaUtils.umbrellaInterval(segmentIntervals); final Interval umbrellaInterval = JodaUtils.umbrellaInterval(segmentIntervals);
final KillUnusedSegmentsTask task = final KillUnusedSegmentsTask task = new KillUnusedSegmentsTask(
new KillUnusedSegmentsTask( null,
null, DATA_SOURCE,
DATA_SOURCE, umbrellaInterval,
umbrellaInterval, null,
null, false,
false, 1,
1, 10,
10, null
null );
);
Assert.assertEquals(TaskState.SUCCESS, taskRunner.run(task).get().getStatusCode()); Assert.assertEquals(TaskState.SUCCESS, taskRunner.run(task).get().getStatusCode());
@ -440,17 +435,16 @@ public class KillUnusedSegmentsTaskTest extends IngestionTestBase
final Interval umbrellaInterval = JodaUtils.umbrellaInterval(segmentIntervals); final Interval umbrellaInterval = JodaUtils.umbrellaInterval(segmentIntervals);
final KillUnusedSegmentsTask task1 = final KillUnusedSegmentsTask task1 = new KillUnusedSegmentsTask(
new KillUnusedSegmentsTask( null,
null, DATA_SOURCE,
DATA_SOURCE, umbrellaInterval,
umbrellaInterval, null,
null, false,
false, 1,
1, 10,
10, maxUsedStatusLastUpdatedTime1
maxUsedStatusLastUpdatedTime1 );
);
Assert.assertEquals(TaskState.SUCCESS, taskRunner.run(task1).get().getStatusCode()); Assert.assertEquals(TaskState.SUCCESS, taskRunner.run(task1).get().getStatusCode());
@ -465,17 +459,16 @@ public class KillUnusedSegmentsTaskTest extends IngestionTestBase
Assert.assertEquals(ImmutableList.of(segment3), unusedSegments); Assert.assertEquals(ImmutableList.of(segment3), unusedSegments);
Assert.assertEquals(new KillTaskReport.Stats(2, 3, 0), getReportedStats()); Assert.assertEquals(new KillTaskReport.Stats(2, 3, 0), getReportedStats());
final KillUnusedSegmentsTask task2 = final KillUnusedSegmentsTask task2 = new KillUnusedSegmentsTask(
new KillUnusedSegmentsTask( null,
null, DATA_SOURCE,
DATA_SOURCE, umbrellaInterval,
umbrellaInterval, null,
null, false,
false, 1,
1, 10,
10, maxUsedStatusLastUpdatedTime2
maxUsedStatusLastUpdatedTime2 );
);
Assert.assertEquals(TaskState.SUCCESS, taskRunner.run(task2).get().getStatusCode()); Assert.assertEquals(TaskState.SUCCESS, taskRunner.run(task2).get().getStatusCode());
@ -545,7 +538,6 @@ public class KillUnusedSegmentsTaskTest extends IngestionTestBase
final DateTime maxUsedStatusLastUpdatedTime2 = DateTimes.nowUtc(); final DateTime maxUsedStatusLastUpdatedTime2 = DateTimes.nowUtc();
final List<Interval> segmentIntervals = segments.stream() final List<Interval> segmentIntervals = segments.stream()
.map(DataSegment::getInterval) .map(DataSegment::getInterval)
.collect(Collectors.toList()); .collect(Collectors.toList());
@ -553,17 +545,16 @@ public class KillUnusedSegmentsTaskTest extends IngestionTestBase
final Interval umbrellaInterval = JodaUtils.umbrellaInterval(segmentIntervals); final Interval umbrellaInterval = JodaUtils.umbrellaInterval(segmentIntervals);
final KillUnusedSegmentsTask task1 = final KillUnusedSegmentsTask task1 = new KillUnusedSegmentsTask(
new KillUnusedSegmentsTask( null,
null, DATA_SOURCE,
DATA_SOURCE, umbrellaInterval,
umbrellaInterval, null,
null, false,
false, 1,
1, 10,
10, maxUsedStatusLastUpdatedTime1
maxUsedStatusLastUpdatedTime1 );
);
Assert.assertEquals(TaskState.SUCCESS, taskRunner.run(task1).get().getStatusCode()); Assert.assertEquals(TaskState.SUCCESS, taskRunner.run(task1).get().getStatusCode());
@ -578,17 +569,16 @@ public class KillUnusedSegmentsTaskTest extends IngestionTestBase
Assert.assertEquals(ImmutableList.of(segment2, segment3), unusedSegments); Assert.assertEquals(ImmutableList.of(segment2, segment3), unusedSegments);
Assert.assertEquals(new KillTaskReport.Stats(2, 3, 0), getReportedStats()); Assert.assertEquals(new KillTaskReport.Stats(2, 3, 0), getReportedStats());
final KillUnusedSegmentsTask task2 = final KillUnusedSegmentsTask task2 = new KillUnusedSegmentsTask(
new KillUnusedSegmentsTask( null,
null, DATA_SOURCE,
DATA_SOURCE, umbrellaInterval,
umbrellaInterval, null,
null, false,
false, 1,
1, 10,
10, maxUsedStatusLastUpdatedTime2
maxUsedStatusLastUpdatedTime2 );
);
Assert.assertEquals(TaskState.SUCCESS, taskRunner.run(task2).get().getStatusCode()); Assert.assertEquals(TaskState.SUCCESS, taskRunner.run(task2).get().getStatusCode());
@ -617,17 +607,16 @@ public class KillUnusedSegmentsTaskTest extends IngestionTestBase
Assert.assertEquals(segments, announced); Assert.assertEquals(segments, announced);
final KillUnusedSegmentsTask task = final KillUnusedSegmentsTask task = new KillUnusedSegmentsTask(
new KillUnusedSegmentsTask( null,
null, DATA_SOURCE,
DATA_SOURCE, Intervals.of("2018-01-01/2020-01-01"),
Intervals.of("2018-01-01/2020-01-01"), null,
null, true,
true, 3,
3, null,
null, null
null );
);
Assert.assertEquals(TaskState.SUCCESS, taskRunner.run(task).get().getStatusCode()); Assert.assertEquals(TaskState.SUCCESS, taskRunner.run(task).get().getStatusCode());
@ -648,102 +637,96 @@ public class KillUnusedSegmentsTaskTest extends IngestionTestBase
@Test @Test
public void testComputeNextBatchSizeDefault() public void testComputeNextBatchSizeDefault()
{ {
final KillUnusedSegmentsTask task = final KillUnusedSegmentsTask task = new KillUnusedSegmentsTask(
new KillUnusedSegmentsTask( null,
null, DATA_SOURCE,
DATA_SOURCE, Intervals.of("2018-01-01/2020-01-01"),
Intervals.of("2018-01-01/2020-01-01"), null,
null, false,
false, null,
null, null,
null, null
null );
);
Assert.assertEquals(100, task.computeNextBatchSize(50)); Assert.assertEquals(100, task.computeNextBatchSize(50));
} }
@Test @Test
public void testComputeNextBatchSizeWithBatchSizeLargerThanLimit() public void testComputeNextBatchSizeWithBatchSizeLargerThanLimit()
{ {
final KillUnusedSegmentsTask task = final KillUnusedSegmentsTask task = new KillUnusedSegmentsTask(
new KillUnusedSegmentsTask( null,
null, DATA_SOURCE,
DATA_SOURCE, Intervals.of("2018-01-01/2020-01-01"),
Intervals.of("2018-01-01/2020-01-01"), null,
null, false,
false, 10,
10, 5,
5, null
null );
);
Assert.assertEquals(5, task.computeNextBatchSize(0)); Assert.assertEquals(5, task.computeNextBatchSize(0));
} }
@Test @Test
public void testComputeNextBatchSizeWithBatchSizeSmallerThanLimit() public void testComputeNextBatchSizeWithBatchSizeSmallerThanLimit()
{ {
final KillUnusedSegmentsTask task = final KillUnusedSegmentsTask task = new KillUnusedSegmentsTask(
new KillUnusedSegmentsTask( null,
null, DATA_SOURCE,
DATA_SOURCE, Intervals.of("2018-01-01/2020-01-01"),
Intervals.of("2018-01-01/2020-01-01"), null,
null, false,
false, 5,
5, 10,
10, null
null );
);
Assert.assertEquals(5, task.computeNextBatchSize(0)); Assert.assertEquals(5, task.computeNextBatchSize(0));
} }
@Test @Test
public void testComputeNextBatchSizeWithRemainingLessThanLimit() public void testComputeNextBatchSizeWithRemainingLessThanLimit()
{ {
final KillUnusedSegmentsTask task = final KillUnusedSegmentsTask task = new KillUnusedSegmentsTask(
new KillUnusedSegmentsTask( null,
null, DATA_SOURCE,
DATA_SOURCE, Intervals.of("2018-01-01/2020-01-01"),
Intervals.of("2018-01-01/2020-01-01"), null,
null, false,
false, 5,
5, 10,
10, null
null );
);
Assert.assertEquals(3, task.computeNextBatchSize(7)); Assert.assertEquals(3, task.computeNextBatchSize(7));
} }
@Test @Test
public void testGetNumTotalBatchesDefault() public void testGetNumTotalBatchesDefault()
{ {
final KillUnusedSegmentsTask task = final KillUnusedSegmentsTask task = new KillUnusedSegmentsTask(
new KillUnusedSegmentsTask( null,
null, DATA_SOURCE,
DATA_SOURCE, Intervals.of("2018-01-01/2020-01-01"),
Intervals.of("2018-01-01/2020-01-01"), null,
null, false,
false, null,
null, null,
null, null
null );
);
Assert.assertNull(task.getNumTotalBatches()); Assert.assertNull(task.getNumTotalBatches());
} }
@Test @Test
public void testGetNumTotalBatchesWithBatchSizeLargerThanLimit() public void testGetNumTotalBatchesWithBatchSizeLargerThanLimit()
{ {
final KillUnusedSegmentsTask task = final KillUnusedSegmentsTask task = new KillUnusedSegmentsTask(
new KillUnusedSegmentsTask( null,
null, DATA_SOURCE,
DATA_SOURCE, Intervals.of("2018-01-01/2020-01-01"),
Intervals.of("2018-01-01/2020-01-01"), null,
null, false,
false, 10,
10, 5,
5, null
null );
);
Assert.assertEquals(1, (int) task.getNumTotalBatches()); Assert.assertEquals(1, (int) task.getNumTotalBatches());
} }
@ -819,17 +802,16 @@ public class KillUnusedSegmentsTaskTest extends IngestionTestBase
@Test @Test
public void testGetNumTotalBatchesWithBatchSizeSmallerThanLimit() public void testGetNumTotalBatchesWithBatchSizeSmallerThanLimit()
{ {
final KillUnusedSegmentsTask task = final KillUnusedSegmentsTask task = new KillUnusedSegmentsTask(
new KillUnusedSegmentsTask( null,
null, DATA_SOURCE,
DATA_SOURCE, Intervals.of("2018-01-01/2020-01-01"),
Intervals.of("2018-01-01/2020-01-01"), null,
null, false,
false, 5,
5, 10,
10, null
null );
);
Assert.assertEquals(2, (int) task.getNumTotalBatches()); Assert.assertEquals(2, (int) task.getNumTotalBatches());
} }