@@ -191,7 +191,7 @@ void testParseOptions() throws ParseException {
191
191
192
192
private static class MyIndexChangeListener implements IndexChangedListener {
193
193
194
- final Queue <String > files = new ConcurrentLinkedQueue <>();
194
+ final Queue <String > addedFiles = new ConcurrentLinkedQueue <>();
195
195
final Queue <String > removedFiles = new ConcurrentLinkedQueue <>();
196
196
197
197
@ Override
@@ -200,7 +200,7 @@ public void fileAdd(String path, String analyzer) {
200
200
201
201
@ Override
202
202
public void fileAdded (String path , String analyzer ) {
203
- files .add (path );
203
+ addedFiles .add (path );
204
204
}
205
205
206
206
@ Override
@@ -217,7 +217,7 @@ public void fileRemoved(String path) {
217
217
}
218
218
219
219
public void reset () {
220
- this .files .clear ();
220
+ this .addedFiles .clear ();
221
221
this .removedFiles .clear ();
222
222
}
223
223
}
@@ -251,14 +251,14 @@ void testIndexWithSetIndexVersionedFilesOnly() throws Exception {
251
251
MyIndexChangeListener listener = new MyIndexChangeListener ();
252
252
idb .addIndexChangedListener (listener );
253
253
idb .update ();
254
- assertEquals (2 , listener .files .size ());
254
+ assertEquals (2 , listener .addedFiles .size ());
255
255
repository .purgeData ();
256
256
RuntimeEnvironment .getInstance ().setIndexVersionedFilesOnly (true );
257
257
idb = new IndexDatabase (project );
258
258
listener = new MyIndexChangeListener ();
259
259
idb .addIndexChangedListener (listener );
260
260
idb .update ();
261
- assertEquals (1 , listener .files .size ());
261
+ assertEquals (1 , listener .addedFiles .size ());
262
262
RuntimeEnvironment .getInstance ().setIndexVersionedFilesOnly (false );
263
263
} else {
264
264
System .out .println ("Skipping test. Repository for rfe2575 not found or an sccs I could use in path." );
@@ -422,7 +422,7 @@ void testBug3430() throws Exception {
422
422
MyIndexChangeListener listener = new MyIndexChangeListener ();
423
423
idb .addIndexChangedListener (listener );
424
424
idb .update ();
425
- assertEquals (1 , listener .files .size ());
425
+ assertEquals (1 , listener .addedFiles .size ());
426
426
}
427
427
428
428
/**
@@ -449,21 +449,20 @@ void testIncrementalIndexAddRemoveFile() throws Exception {
449
449
MyIndexChangeListener listener = new MyIndexChangeListener ();
450
450
idb .addIndexChangedListener (listener );
451
451
idb .update ();
452
- assertEquals (1 , listener .files .size ());
452
+ assertEquals (1 , listener .addedFiles .size ());
453
453
listener .reset ();
454
454
repository .addDummyFile (ppath );
455
455
idb .update ();
456
- assertEquals (1 , listener .files .size (), "No new file added" );
456
+ assertEquals (1 , listener .addedFiles .size (), "No new file added" );
457
457
repository .removeDummyFile (ppath );
458
458
idb .update ();
459
- assertEquals (1 , listener .files .size (), "(added)files changed unexpectedly" );
459
+ assertEquals (1 , listener .addedFiles .size (), "(added)files changed unexpectedly" );
460
460
assertEquals (1 , listener .removedFiles .size (), "Didn't remove the dummy file" );
461
- assertEquals (listener .files .peek (), listener .removedFiles .peek (), "Should have added then removed the same file" );
461
+ assertEquals (listener .addedFiles .peek (), listener .removedFiles .peek (), "Should have added then removed the same file" );
462
462
}
463
463
464
464
/**
465
465
* Test that named pipes are not indexed.
466
- * @throws Exception
467
466
*/
468
467
@ Test
469
468
@ EnabledIf ("mkfifoInPath" )
@@ -487,7 +486,7 @@ void testBug11896() throws Exception {
487
486
idb .addIndexChangedListener (listener );
488
487
System .out .println ("Trying to index a special file - FIFO in this case." );
489
488
idb .update ();
490
- assertEquals (0 , listener .files .size ());
489
+ assertEquals (0 , listener .addedFiles .size ());
491
490
}
492
491
493
492
boolean mkfifoInPath () {
@@ -496,7 +495,6 @@ boolean mkfifoInPath() {
496
495
497
496
/**
498
497
* Should include the existing project.
499
- * @throws Exception
500
498
*/
501
499
@ Test
502
500
void testDefaultProjectsSingleProject () throws Exception {
@@ -507,14 +505,14 @@ void testDefaultProjectsSingleProject() throws Exception {
507
505
Indexer .getInstance ().prepareIndexer (env , true , true ,
508
506
null , null );
509
507
env .setDefaultProjectsFromNames (new TreeSet <>(Collections .singletonList ("/c" )));
508
+ assertNotNull (env .getDefaultProjects ());
510
509
assertEquals (1 , env .getDefaultProjects ().size ());
511
510
assertEquals (new TreeSet <>(Collections .singletonList ("c" )),
512
511
env .getDefaultProjects ().stream ().map (Project ::getName ).collect (Collectors .toSet ()));
513
512
}
514
513
515
514
/**
516
- * Should discard the non existing project.
517
- * @throws Exception
515
+ * Should discard the non-existing project.
518
516
*/
519
517
@ Test
520
518
void testDefaultProjectsNonExistent () throws Exception {
@@ -532,14 +530,14 @@ void testDefaultProjectsNonExistent() throws Exception {
532
530
Indexer .getInstance ().prepareIndexer (env , true , true ,
533
531
null , null );
534
532
env .setDefaultProjectsFromNames (projectSet );
533
+ assertNotNull (env .getDefaultProjects ());
535
534
assertEquals (4 , env .getDefaultProjects ().size ());
536
535
assertEquals (new TreeSet <>(Arrays .asList ("lisp" , "pascal" , "perl" , "data" )),
537
536
env .getDefaultProjects ().stream ().map (Project ::getName ).collect (Collectors .toSet ()));
538
537
}
539
538
540
539
/**
541
540
* Should include all projects in the source root.
542
- * @throws Exception
543
541
*/
544
542
@ Test
545
543
void testDefaultProjectsAll () throws Exception {
@@ -557,6 +555,7 @@ void testDefaultProjectsAll() throws Exception {
557
555
null , null );
558
556
env .setDefaultProjectsFromNames (defaultProjects );
559
557
Set <String > projects = new TreeSet <>(Arrays .asList (new File (repository .getSourceRoot ()).list ()));
558
+ assertNotNull (env .getDefaultProjects ());
560
559
assertEquals (projects .size (), env .getDefaultProjects ().size ());
561
560
assertEquals (projects , env .getDefaultProjects ().stream ().map (Project ::getName ).collect (Collectors .toSet ()));
562
561
}
0 commit comments