]> source.dussan.org Git - sonarqube.git/blob
33437bf9b65c3fbdf5b116b1fcf2fa4daa3281e6
[sonarqube.git] /
1 /*
2  * SonarQube
3  * Copyright (C) 2009-2017 SonarSource SA
4  * mailto:info AT sonarsource DOT com
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 3 of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software Foundation,
18  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19  */
20 package org.sonar.server.computation.task.projectanalysis.step;
21
22 import static com.google.common.collect.Lists.newArrayList;
23 import static org.assertj.core.api.Assertions.assertThat;
24 import static org.mockito.Mockito.mock;
25 import static org.mockito.Mockito.when;
26
27 import java.util.Arrays;
28
29 import org.junit.Before;
30 import org.junit.Rule;
31 import org.junit.Test;
32 import org.junit.rules.ExpectedException;
33 import org.sonar.api.utils.System2;
34 import org.sonar.db.DbClient;
35 import org.sonar.db.DbSession;
36 import org.sonar.db.DbTester;
37 import org.sonar.db.protobuf.DbFileSources;
38 import org.sonar.db.source.FileSourceDto;
39 import org.sonar.db.source.FileSourceDto.Type;
40 import org.sonar.scanner.protocol.output.ScannerReport;
41 import org.sonar.scanner.protocol.output.ScannerReport.Component.ComponentType;
42 import org.sonar.scanner.protocol.output.ScannerReport.SyntaxHighlightingRule.HighlightingType;
43 import org.sonar.server.computation.task.projectanalysis.analysis.AnalysisMetadataHolderRule;
44 import org.sonar.server.computation.task.projectanalysis.batch.BatchReportReaderRule;
45 import org.sonar.server.computation.task.projectanalysis.component.Component;
46 import org.sonar.server.computation.task.projectanalysis.component.Component.Status;
47 import org.sonar.server.computation.task.projectanalysis.component.FileAttributes;
48 import org.sonar.server.computation.task.projectanalysis.component.ReportComponent;
49 import org.sonar.server.computation.task.projectanalysis.component.TreeRootHolderRule;
50 import org.sonar.server.computation.task.projectanalysis.duplication.Duplicate;
51 import org.sonar.server.computation.task.projectanalysis.duplication.Duplication;
52 import org.sonar.server.computation.task.projectanalysis.duplication.DuplicationRepositoryRule;
53 import org.sonar.server.computation.task.projectanalysis.duplication.InnerDuplicate;
54 import org.sonar.server.computation.task.projectanalysis.duplication.TextBlock;
55 import org.sonar.server.computation.task.projectanalysis.scm.Changeset;
56 import org.sonar.server.computation.task.projectanalysis.scm.ScmInfoRepositoryRule;
57 import org.sonar.server.computation.task.projectanalysis.source.SourceLinesRepositoryRule;
58 import org.sonar.server.computation.task.step.ComputationStep;
59
60 public class PersistFileSourcesStepTest extends BaseStepTest {
61
62   private static final int FILE1_REF = 3;
63   private static final int FILE2_REF = 4;
64   private static final String PROJECT_UUID = "PROJECT";
65   private static final String PROJECT_KEY = "PROJECT_KEY";
66   private static final String FILE1_UUID = "FILE1";
67   private static final String FILE2_UUID = "FILE2";
68   private static final long NOW = 123456789L;
69
70   private System2 system2 = mock(System2.class);
71
72   @Rule
73   public ExpectedException thrown = ExpectedException.none();
74
75   @Rule
76   public DbTester dbTester = DbTester.create(system2);
77   @Rule
78   public TreeRootHolderRule treeRootHolder = new TreeRootHolderRule();
79   @Rule
80   public BatchReportReaderRule reportReader = new BatchReportReaderRule();
81   @Rule
82   public ScmInfoRepositoryRule scmInfoRepository = new ScmInfoRepositoryRule();
83   @Rule
84   public SourceLinesRepositoryRule fileSourceRepository = new SourceLinesRepositoryRule();
85   @Rule
86   public DuplicationRepositoryRule duplicationRepository = DuplicationRepositoryRule.create(treeRootHolder);
87   @Rule
88   public AnalysisMetadataHolderRule analysisMetadataHolder = new AnalysisMetadataHolderRule().setIncrementalAnalysis(false);
89
90   private DbClient dbClient = dbTester.getDbClient();
91   private DbSession session = dbTester.getSession();
92
93   private PersistFileSourcesStep underTest;
94
95   @Before
96   public void setup() {
97     when(system2.now()).thenReturn(NOW);
98     underTest = new PersistFileSourcesStep(dbClient, system2, treeRootHolder, reportReader, fileSourceRepository, scmInfoRepository,
99       duplicationRepository, analysisMetadataHolder);
100   }
101
102   @Override
103   protected ComputationStep step() {
104     return underTest;
105   }
106
107   @Test
108   public void persist_sources() {
109     initBasicReport(2);
110
111     underTest.execute();
112
113     assertThat(dbTester.countRowsOfTable("file_sources")).isEqualTo(1);
114     FileSourceDto fileSourceDto = dbClient.fileSourceDao().selectSourceByFileUuid(session, FILE1_UUID);
115     assertThat(fileSourceDto.getProjectUuid()).isEqualTo(PROJECT_UUID);
116     assertThat(fileSourceDto.getFileUuid()).isEqualTo(FILE1_UUID);
117     assertThat(fileSourceDto.getBinaryData()).isNotEmpty();
118     assertThat(fileSourceDto.getDataHash()).isNotEmpty();
119     assertThat(fileSourceDto.getLineHashes()).isNotEmpty();
120     assertThat(fileSourceDto.getCreatedAt()).isEqualTo(NOW);
121     assertThat(fileSourceDto.getUpdatedAt()).isEqualTo(NOW);
122
123     DbFileSources.Data data = fileSourceDto.getSourceData();
124     assertThat(data.getLinesCount()).isEqualTo(2);
125     assertThat(data.getLines(0).getLine()).isEqualTo(1);
126     assertThat(data.getLines(0).getSource()).isEqualTo("line1");
127     assertThat(data.getLines(1).getLine()).isEqualTo(2);
128     assertThat(data.getLines(1).getSource()).isEqualTo("line2");
129   }
130
131   @Test
132   public void dont_persist_unchanged_sources_if_incremental() {
133     analysisMetadataHolder.setIncrementalAnalysis(true);
134     initIncrementalReport(2);
135
136     underTest.execute();
137     assertThat(dbTester.countRowsOfTable("file_sources")).isEqualTo(1);
138   }
139
140   @Test
141   public void persist_source_hashes() {
142     initBasicReport(2);
143
144     underTest.execute();
145
146     assertThat(dbTester.countRowsOfTable("file_sources")).isEqualTo(1);
147     FileSourceDto fileSourceDto = dbClient.fileSourceDao().selectSourceByFileUuid(session, FILE1_UUID);
148     assertThat(fileSourceDto.getLineHashes()).isEqualTo("137f72c3708c6bd0de00a0e5a69c699b\ne6251bcf1a7dc3ba5e7933e325bbe605");
149     assertThat(fileSourceDto.getSrcHash()).isEqualTo("ee5a58024a155466b43bc559d953e018");
150   }
151
152   @Test
153   public void persist_coverage() {
154     initBasicReport(1);
155
156     reportReader.putCoverage(FILE1_REF, newArrayList(ScannerReport.LineCoverage.newBuilder()
157       .setLine(1)
158       .setConditions(10)
159       .setHits(true)
160       .setCoveredConditions(2)
161       .build()));
162
163     underTest.execute();
164
165     assertThat(dbTester.countRowsOfTable("file_sources")).isEqualTo(1);
166     FileSourceDto fileSourceDto = dbClient.fileSourceDao().selectSourceByFileUuid(session, FILE1_UUID);
167     DbFileSources.Data data = fileSourceDto.getSourceData();
168
169     assertThat(data.getLinesList()).hasSize(1);
170
171     assertThat(data.getLines(0).getLineHits()).isEqualTo(1);
172     assertThat(data.getLines(0).getConditions()).isEqualTo(10);
173     assertThat(data.getLines(0).getCoveredConditions()).isEqualTo(2);
174   }
175
176   @Test
177   public void persist_scm() {
178     initBasicReport(1);
179     scmInfoRepository.setScmInfo(FILE1_REF, Changeset.newChangesetBuilder()
180       .setAuthor("john")
181       .setDate(123456789L)
182       .setRevision("rev-1")
183       .build());
184
185     underTest.execute();
186
187     assertThat(dbTester.countRowsOfTable("file_sources")).isEqualTo(1);
188     FileSourceDto fileSourceDto = dbClient.fileSourceDao().selectSourceByFileUuid(session, FILE1_UUID);
189
190     assertThat(fileSourceDto.getRevision()).isEqualTo("rev-1");
191
192     DbFileSources.Data data = fileSourceDto.getSourceData();
193
194     assertThat(data.getLinesList()).hasSize(1);
195
196     assertThat(data.getLines(0).getScmAuthor()).isEqualTo("john");
197     assertThat(data.getLines(0).getScmDate()).isEqualTo(123456789L);
198     assertThat(data.getLines(0).getScmRevision()).isEqualTo("rev-1");
199   }
200
201   @Test
202   public void persist_highlighting() {
203     initBasicReport(1);
204
205     reportReader.putSyntaxHighlighting(FILE1_REF, newArrayList(ScannerReport.SyntaxHighlightingRule.newBuilder()
206       .setRange(ScannerReport.TextRange.newBuilder()
207         .setStartLine(1).setEndLine(1)
208         .setStartOffset(2).setEndOffset(4)
209         .build())
210       .setType(HighlightingType.ANNOTATION)
211       .build()));
212
213     underTest.execute();
214
215     assertThat(dbTester.countRowsOfTable("file_sources")).isEqualTo(1);
216     FileSourceDto fileSourceDto = dbClient.fileSourceDao().selectSourceByFileUuid(session, FILE1_UUID);
217     DbFileSources.Data data = fileSourceDto.getSourceData();
218
219     assertThat(data.getLinesList()).hasSize(1);
220
221     assertThat(data.getLines(0).getHighlighting()).isEqualTo("2,4,a");
222   }
223
224   @Test
225   public void persist_symbols() {
226     initBasicReport(3);
227
228     reportReader.putSymbols(FILE1_REF, newArrayList(
229       ScannerReport.Symbol.newBuilder()
230         .setDeclaration(ScannerReport.TextRange.newBuilder()
231           .setStartLine(1).setEndLine(1).setStartOffset(2).setEndOffset(4)
232           .build())
233         .addReference(ScannerReport.TextRange.newBuilder()
234           .setStartLine(3).setEndLine(3).setStartOffset(1).setEndOffset(3)
235           .build())
236         .build()));
237
238     underTest.execute();
239
240     assertThat(dbTester.countRowsOfTable("file_sources")).isEqualTo(1);
241     FileSourceDto fileSourceDto = dbClient.fileSourceDao().selectSourceByFileUuid(session, FILE1_UUID);
242     DbFileSources.Data data = fileSourceDto.getSourceData();
243
244     assertThat(data.getLinesList()).hasSize(3);
245
246     assertThat(data.getLines(0).getSymbols()).isEqualTo("2,4,1");
247     assertThat(data.getLines(1).getSymbols()).isEmpty();
248     assertThat(data.getLines(2).getSymbols()).isEqualTo("1,3,1");
249   }
250
251   @Test
252   public void persist_duplication() {
253     initBasicReport(1);
254
255     duplicationRepository.add(
256       FILE1_REF,
257       new Duplication(new TextBlock(1, 2), Arrays.<Duplicate>asList(new InnerDuplicate(new TextBlock(3, 4)))));
258
259     underTest.execute();
260
261     assertThat(dbTester.countRowsOfTable("file_sources")).isEqualTo(1);
262     FileSourceDto fileSourceDto = dbClient.fileSourceDao().selectSourceByFileUuid(session, FILE1_UUID);
263     DbFileSources.Data data = fileSourceDto.getSourceData();
264
265     assertThat(data.getLinesList()).hasSize(1);
266
267     assertThat(data.getLines(0).getDuplicationList()).hasSize(1);
268   }
269
270   @Test
271   public void save_revision() {
272     initBasicReport(1);
273     scmInfoRepository.setScmInfo(FILE1_REF, Changeset.newChangesetBuilder()
274       .setAuthor("john")
275       .setDate(123456789L)
276       .setRevision("rev-1")
277       .build());
278
279     underTest.execute();
280
281     FileSourceDto fileSourceDto = dbClient.fileSourceDao().selectSourceByFileUuid(session, FILE1_UUID);
282     assertThat(fileSourceDto.getRevision()).isEqualTo("rev-1");
283   }
284
285   @Test
286   public void not_save_revision() {
287     initBasicReport(1);
288
289     underTest.execute();
290
291     FileSourceDto fileSourceDto = dbClient.fileSourceDao().selectSourceByFileUuid(session, FILE1_UUID);
292     assertThat(fileSourceDto.getRevision()).isNull();
293   }
294
295   @Test
296   public void not_update_sources_when_nothing_has_changed() {
297     // Existing sources
298     long past = 150000L;
299     String srcHash = "137f72c3708c6bd0de00a0e5a69c699b";
300     String lineHashes = "137f72c3708c6bd0de00a0e5a69c699b";
301     String dataHash = "29f25900140c94db38035128cb6de6a2";
302
303     dbClient.fileSourceDao().insert(dbTester.getSession(), new FileSourceDto()
304       .setProjectUuid(PROJECT_UUID)
305       .setFileUuid(FILE1_UUID)
306       .setSrcHash(srcHash)
307       .setLineHashes(lineHashes)
308       .setDataHash(dataHash)
309       .setSourceData(DbFileSources.Data.newBuilder()
310         .addLines(DbFileSources.Line.newBuilder()
311           .setLine(1)
312           .setSource("line1")
313           .build())
314         .build())
315       .setCreatedAt(past)
316       .setUpdatedAt(past));
317     dbTester.getSession().commit();
318
319     // Sources from the report
320     initBasicReport(1);
321
322     underTest.execute();
323
324     assertThat(dbTester.countRowsOfTable("file_sources")).isEqualTo(1);
325     FileSourceDto fileSourceDto = dbClient.fileSourceDao().selectSourceByFileUuid(session, FILE1_UUID);
326     assertThat(fileSourceDto.getSrcHash()).isEqualTo(srcHash);
327     assertThat(fileSourceDto.getLineHashes()).isEqualTo(lineHashes);
328     assertThat(fileSourceDto.getDataHash()).isEqualTo(dataHash);
329     assertThat(fileSourceDto.getCreatedAt()).isEqualTo(past);
330     assertThat(fileSourceDto.getUpdatedAt()).isEqualTo(past);
331   }
332
333   @Test
334   public void update_sources_when_source_updated() {
335     // Existing sources
336     long past = 150000L;
337     dbClient.fileSourceDao().insert(dbTester.getSession(), new FileSourceDto()
338       .setProjectUuid(PROJECT_UUID)
339       .setFileUuid(FILE1_UUID)
340       .setDataType(Type.SOURCE)
341       .setSrcHash("5b4bd9815cdb17b8ceae19eb1810c34c")
342       .setLineHashes("6438c669e0d0de98e6929c2cc0fac474\n")
343       .setDataHash("6cad150e3d065976c230cddc5a09efaa")
344       .setSourceData(DbFileSources.Data.newBuilder()
345         .addLines(DbFileSources.Line.newBuilder()
346           .setLine(1)
347           .setSource("old line")
348           .build())
349         .build())
350       .setCreatedAt(past)
351       .setUpdatedAt(past)
352       .setRevision("rev-0"));
353     dbTester.getSession().commit();
354
355     initBasicReport(1);
356
357     scmInfoRepository.setScmInfo(FILE1_REF, Changeset.newChangesetBuilder()
358       .setAuthor("john")
359       .setDate(123456789L)
360       .setRevision("rev-1")
361       .build());
362
363     underTest.execute();
364
365     assertThat(dbTester.countRowsOfTable("file_sources")).isEqualTo(1);
366     FileSourceDto fileSourceDto = dbClient.fileSourceDao().selectSourceByFileUuid(session, FILE1_UUID);
367     assertThat(fileSourceDto.getCreatedAt()).isEqualTo(past);
368     assertThat(fileSourceDto.getUpdatedAt()).isEqualTo(NOW);
369     assertThat(fileSourceDto.getRevision()).isEqualTo("rev-1");
370   }
371
372   @Test
373   public void update_sources_when_src_hash_is_missing() {
374     // Existing sources
375     long past = 150000L;
376     dbClient.fileSourceDao().insert(dbTester.getSession(), new FileSourceDto()
377       .setProjectUuid(PROJECT_UUID)
378       .setFileUuid(FILE1_UUID)
379       .setDataType(Type.SOURCE)
380       // Source hash is missing, update will be made
381       .setLineHashes("137f72c3708c6bd0de00a0e5a69c699b")
382       .setDataHash("29f25900140c94db38035128cb6de6a2")
383       .setSourceData(DbFileSources.Data.newBuilder()
384         .addLines(DbFileSources.Line.newBuilder()
385           .setLine(1)
386           .setSource("line")
387           .build())
388         .build())
389       .setCreatedAt(past)
390       .setUpdatedAt(past));
391     dbTester.getSession().commit();
392
393     initBasicReport(1);
394
395     underTest.execute();
396
397     assertThat(dbTester.countRowsOfTable("file_sources")).isEqualTo(1);
398     FileSourceDto fileSourceDto = dbClient.fileSourceDao().selectSourceByFileUuid(session, FILE1_UUID);
399     assertThat(fileSourceDto.getCreatedAt()).isEqualTo(past);
400     assertThat(fileSourceDto.getUpdatedAt()).isEqualTo(NOW);
401     assertThat(fileSourceDto.getSrcHash()).isEqualTo("137f72c3708c6bd0de00a0e5a69c699b");
402   }
403
404   @Test
405   public void update_sources_when_revision_is_missing() {
406     // Existing sources
407     long past = 150000L;
408     dbClient.fileSourceDao().insert(dbTester.getSession(), new FileSourceDto()
409       .setProjectUuid(PROJECT_UUID)
410       .setFileUuid(FILE1_UUID)
411       .setDataType(Type.SOURCE)
412       .setSrcHash("137f72c3708c6bd0de00a0e5a69c699b")
413       .setLineHashes("137f72c3708c6bd0de00a0e5a69c699b")
414       .setDataHash("8e84c0d961cfe364e43833c4cc4ddef5")
415       // Revision is missing, update will be made
416       .setSourceData(DbFileSources.Data.newBuilder()
417         .addLines(DbFileSources.Line.newBuilder()
418           .setLine(1)
419           .setSource("line")
420           .build())
421         .build())
422       .setCreatedAt(past)
423       .setUpdatedAt(past));
424     dbTester.getSession().commit();
425
426     scmInfoRepository.setScmInfo(FILE1_REF, Changeset.newChangesetBuilder()
427       .setAuthor("john")
428       .setDate(123456789L)
429       .setRevision("rev-1")
430       .build());
431
432     initBasicReport(1);
433
434     underTest.execute();
435
436     assertThat(dbTester.countRowsOfTable("file_sources")).isEqualTo(1);
437     FileSourceDto fileSourceDto = dbClient.fileSourceDao().selectSourceByFileUuid(session, FILE1_UUID);
438     assertThat(fileSourceDto.getCreatedAt()).isEqualTo(past);
439     assertThat(fileSourceDto.getUpdatedAt()).isEqualTo(NOW);
440     assertThat(fileSourceDto.getRevision()).isEqualTo("rev-1");
441   }
442
443   @Test
444   public void clear_revision_when_no_ChangeSet() {
445     // Existing sources
446     long past = 150000L;
447     dbClient.fileSourceDao().insert(dbTester.getSession(), new FileSourceDto()
448       .setProjectUuid(PROJECT_UUID)
449       .setFileUuid(FILE1_UUID)
450       .setDataType(Type.SOURCE)
451       .setSrcHash("137f72c3708c6bd0de00a0e5a69c699b")
452       .setLineHashes("137f72c3708c6bd0de00a0e5a69c699b")
453       .setDataHash("8e84c0d961cfe364e43833c4cc4ddef5")
454       // Revision is missing, update will be made
455       .setSourceData(DbFileSources.Data.newBuilder()
456         .addLines(DbFileSources.Line.newBuilder()
457           .setLine(1)
458           .setSource("line")
459           .build())
460         .build())
461       .setCreatedAt(past)
462       .setUpdatedAt(past));
463     dbTester.getSession().commit();
464
465     initBasicReport(1);
466
467     underTest.execute();
468
469     assertThat(dbTester.countRowsOfTable("file_sources")).isEqualTo(1);
470     FileSourceDto fileSourceDto = dbClient.fileSourceDao().selectSourceByFileUuid(session, FILE1_UUID);
471     assertThat(fileSourceDto.getCreatedAt()).isEqualTo(past);
472     assertThat(fileSourceDto.getUpdatedAt()).isEqualTo(NOW);
473     assertThat(fileSourceDto.getRevision()).isNull();
474   }
475
476   private void initIncrementalReport(int numberOfLines) {
477     treeRootHolder.setRoot(ReportComponent
478       .builder(Component.Type.PROJECT, 1)
479       .setUuid(PROJECT_UUID)
480       .setKey(PROJECT_KEY)
481       .addChildren(
482         ReportComponent
483           .builder(Component.Type.MODULE, 2)
484           .setUuid("MODULE")
485           .setKey("MODULE_KEY")
486           .addChildren(
487             ReportComponent
488               .builder(Component.Type.FILE, FILE1_REF)
489               .setUuid(FILE1_UUID)
490               .setKey("MODULE_KEY:src/Foo.java")
491               .setFileAttributes(new FileAttributes(false, null, numberOfLines))
492               .setStatus(Status.CHANGED)
493               .build())
494           .build(),
495         ReportComponent
496           .builder(Component.Type.FILE, FILE2_REF)
497           .setUuid(FILE2_UUID)
498           .setKey("MODULE_KEY:src/Foo2.java")
499           .setStatus(Status.SAME).build())
500       .build());
501
502     reportReader.putComponent(ScannerReport.Component.newBuilder()
503       .setRef(1)
504       .setType(ComponentType.PROJECT)
505       .addChildRef(2)
506       .build());
507     reportReader.putComponent(ScannerReport.Component.newBuilder()
508       .setRef(2)
509       .setType(ComponentType.MODULE)
510       .addChildRef(FILE1_REF)
511       .build());
512     reportReader.putComponent(ScannerReport.Component.newBuilder()
513       .setRef(FILE1_REF)
514       .setType(ComponentType.FILE)
515       .setLines(numberOfLines)
516       .build());
517     reportReader.putComponent(ScannerReport.Component.newBuilder()
518       .setRef(FILE2_REF)
519       .setType(ComponentType.FILE)
520       .setLines(numberOfLines)
521       .build());
522
523     for (int i = 1; i <= numberOfLines; i++) {
524       fileSourceRepository.addLine(FILE1_REF, "line" + i);
525     }
526   }
527
528   private void initBasicReport(int numberOfLines) {
529     treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid(PROJECT_UUID).setKey(PROJECT_KEY).addChildren(
530       ReportComponent.builder(Component.Type.MODULE, 2).setUuid("MODULE").setKey("MODULE_KEY").addChildren(
531         ReportComponent.builder(Component.Type.FILE, FILE1_REF).setUuid(FILE1_UUID).setKey("MODULE_KEY:src/Foo.java")
532           .setFileAttributes(new FileAttributes(false, null, numberOfLines)).build())
533         .build())
534       .build());
535
536     reportReader.putComponent(ScannerReport.Component.newBuilder()
537       .setRef(1)
538       .setType(ComponentType.PROJECT)
539       .addChildRef(2)
540       .build());
541     reportReader.putComponent(ScannerReport.Component.newBuilder()
542       .setRef(2)
543       .setType(ComponentType.MODULE)
544       .addChildRef(FILE1_REF)
545       .build());
546     reportReader.putComponent(ScannerReport.Component.newBuilder()
547       .setRef(FILE1_REF)
548       .setType(ComponentType.FILE)
549       .setLines(numberOfLines)
550       .build());
551
552     for (int i = 1; i <= numberOfLines; i++) {
553       fileSourceRepository.addLine(FILE1_REF, "line" + i);
554     }
555   }
556
557 }