55
55
public class FileSourceTest {
56
56
@ SuppressWarnings ("unchecked" )
57
57
@ Before
58
- public void setUp () {
58
+ public void setUp () throws IOException {
59
+ Files .createDirectories (_directory );
59
60
_observer = Mockito .mock (Observer .class );
60
61
_parser = Mockito .mock (Parser .class );
61
62
_logger = Mockito .mock (Logger .class );
@@ -74,7 +75,6 @@ public void setUp() {
74
75
75
76
@ Test
76
77
public void testParseData () throws IOException , InterruptedException , ParsingException {
77
- Files .createDirectories (_directory );
78
78
final Path file = _directory .resolve ("testParseData.log" );
79
79
final Path state = _directory .resolve ("testParseData.log.state" );
80
80
Files .deleteIfExists (file );
@@ -107,7 +107,6 @@ public void testParseData() throws IOException, InterruptedException, ParsingExc
107
107
108
108
@ Test
109
109
public void testTailFromEnd () throws IOException , InterruptedException , ParsingException {
110
- Files .createDirectories (_directory );
111
110
final Path file = _directory .resolve ("testTailFromEnd.log" );
112
111
Files .deleteIfExists (file );
113
112
Files .createFile (file );
@@ -193,7 +192,6 @@ public void testTailerFileNotFoundAfterInterval() throws InterruptedException, I
193
192
194
193
@ Test
195
194
public void testTailerLogRotationRename () throws IOException , InterruptedException {
196
- Files .createDirectories (_directory );
197
195
final Path file = _directory .resolve ("testTailerLogRotationRename.log" );
198
196
final Path state = _directory .resolve ("testTailerLogRotationRename.log.state" );
199
197
Files .deleteIfExists (file );
@@ -223,7 +221,6 @@ public void testTailerLogRotationRename() throws IOException, InterruptedExcepti
223
221
224
222
@ Test
225
223
public void testTailerLogRotationRenameSameDataLength () throws IOException , InterruptedException , ParsingException {
226
- Files .createDirectories (_directory );
227
224
final Path file = _directory .resolve ("testTailerLogRotationRenameSameDataLength.log" );
228
225
final Path state = _directory .resolve ("testTailerLogRotationRenameSameDataLength.log.state" );
229
226
Files .deleteIfExists (file );
@@ -261,7 +258,6 @@ public void testTailerLogRotationRenameSameDataLength() throws IOException, Inte
261
258
@ Ignore
262
259
@ Test
263
260
public void testTailerLogRotationRenameFromEmpty () throws IOException , InterruptedException {
264
- Files .createDirectories (_directory );
265
261
final Path file = _directory .resolve ("testTailerLogRotationRenameFromEmpty.log" );
266
262
final Path state = _directory .resolve ("testTailerLogRotationRenameFromEmpty.log.state" );
267
263
Files .deleteIfExists (file );
@@ -288,7 +284,6 @@ public void testTailerLogRotationRenameFromEmpty() throws IOException, Interrupt
288
284
289
285
@ Test
290
286
public void testTailerLogRotationCopyTruncate () throws IOException , InterruptedException , ParsingException {
291
- Files .createDirectories (_directory );
292
287
final Path file = _directory .resolve ("testTailerLogRotationCopyTruncate.log" );
293
288
final Path state = _directory .resolve ("testTailerLogRotationCopyTruncate.log.state" );
294
289
Files .deleteIfExists (file );
@@ -321,7 +316,6 @@ public void testTailerLogRotationCopyTruncate() throws IOException, InterruptedE
321
316
@ Ignore
322
317
@ Test
323
318
public void testTailerLogRotationCopyTruncateFromEmpty () throws IOException , InterruptedException {
324
- Files .createDirectories (_directory );
325
319
final Path file = _directory .resolve ("testTailerLogRotationCopyTruncate.log" );
326
320
final Path state = _directory .resolve ("testTailerLogRotationCopyTruncate.log.state" );
327
321
Files .deleteIfExists (file );
@@ -349,7 +343,6 @@ public void testTailerLogRotationCopyTruncateFromEmpty() throws IOException, Int
349
343
350
344
@ Test
351
345
public void testTailerLogRotationRenameWithData () throws IOException , InterruptedException , ParsingException {
352
- Files .createDirectories (_directory );
353
346
final Path file = _directory .resolve ("testTailerLogRotationRenameWithData.log" );
354
347
final Path state = _directory .resolve ("testTailerLogRotationRenameWithData.log.state" );
355
348
Files .deleteIfExists (file );
@@ -394,7 +387,6 @@ public void testTailerLogRotationRenameWithData() throws IOException, Interrupte
394
387
public void testTailerLogRotationCopyTruncateWithData () throws IOException , InterruptedException , ParsingException {
395
388
final long interval = 500 ;
396
389
final long sleepInterval = 600 ;
397
- Files .createDirectories (_directory );
398
390
final Path file = _directory .resolve ("testTailerLogRotationCopyTruncateWithData.log" );
399
391
final Path state = _directory .resolve ("testTailerLogRotationCopyTruncateWithData.log.state" );
400
392
Files .deleteIfExists (file );
@@ -434,7 +426,6 @@ public void testTailerLogRotationCopyTruncateWithData() throws IOException, Inte
434
426
435
427
@ Test
436
428
public void testTailerLogRotationRenameWithDataToOldAndNew () throws IOException , InterruptedException , ParsingException {
437
- Files .createDirectories (_directory );
438
429
final Path file = _directory .resolve ("testTailerLogRotationRenameWithDataToOldAndNew.log" );
439
430
final Path state = _directory .resolve ("testTailerLogRotationRenameWithDataToOldAndNew.log.state" );
440
431
Files .deleteIfExists (file );
@@ -501,7 +492,6 @@ public void testTailerLogRotationRenameWithDataToOldAndNew() throws IOException,
501
492
@ Test
502
493
public void testTailerLogRotationCopyTruncateWithDataToOldAndNew () throws IOException , InterruptedException , ParsingException {
503
494
final long interval = 500 ;
504
- Files .createDirectories (_directory );
505
495
final Path file = _directory .resolve ("testTailerLogRotationCopyTruncateWithDataToOldAndNew.log" );
506
496
final Path state = _directory .resolve ("testTailerLogRotationCopyTruncateWithDataToOldAndNew.log.state" );
507
497
Files .deleteIfExists (file );
@@ -561,7 +551,6 @@ public void testTailerLogRotationCopyTruncateWithDataToOldAndNew() throws IOExce
561
551
@ SuppressWarnings ("unchecked" )
562
552
@ Test
563
553
public void testTailerLogRotationRenameDroppedData () throws IOException , InterruptedException , ParsingException {
564
- Files .createDirectories (_directory );
565
554
final Path file = _directory .resolve ("testTailerLogRotationRenameDroppedData.log" );
566
555
final Path state = _directory .resolve ("testTailerLogRotationRenameDroppedData.log.state" );
567
556
Files .deleteIfExists (file );
@@ -639,7 +628,6 @@ public void testTailerLogRotationRenameDroppedData() throws IOException, Interru
639
628
public void testTailerLogCopyTruncateRenameDroppedData () throws IOException , InterruptedException , ParsingException {
640
629
final long interval = 500 ;
641
630
final long sleepInterval = 600 ;
642
- Files .createDirectories (_directory );
643
631
final Path file = _directory .resolve ("testTailerLogCopyTruncateRenameDroppedData.log" );
644
632
final Path state = _directory .resolve ("testTailerLogCopyTruncateRenameDroppedData.log.state" );
645
633
Files .deleteIfExists (file );
@@ -708,7 +696,6 @@ public void testTailerLogCopyTruncateRenameDroppedData() throws IOException, Int
708
696
@ SuppressWarnings ("unchecked" )
709
697
@ Test
710
698
public void testTailerLogRotationRenameSmallToLarge () throws IOException , InterruptedException , ParsingException {
711
- Files .createDirectories (_directory );
712
699
final Path file = _directory .resolve ("testTailerLogRotationRenameSmallToLarge.log" );
713
700
final Path state = _directory .resolve ("testTailerLogRotationRenameSmallToLarge.log.state" );
714
701
Files .deleteIfExists (file );
@@ -779,7 +766,6 @@ public void testTailerLogRotationRenameSmallToLarge() throws IOException, Interr
779
766
@ Test
780
767
public void testTailerLogRotationCopyTruncateSmallToLarge () throws IOException , InterruptedException , ParsingException {
781
768
final long sleepInterval = 600 ;
782
- Files .createDirectories (_directory );
783
769
final Path file = _directory .resolve ("testTailerLogRotationCopyTruncateSmallToLarge.log" );
784
770
final Path state = _directory .resolve ("testTailerLogRotationCopyTruncateSmallToLarge.log.state" );
785
771
Files .deleteIfExists (file );
0 commit comments