]> source.dussan.org Git - sonarqube.git/blob
e9d0ced4fd65f3fb44ad5629cac4a1bdf6c773ef
[sonarqube.git] /
1 /*
2  * SonarQube, open source software quality management tool.
3  * Copyright (C) 2008-2014 SonarSource
4  * mailto:contact AT sonarsource DOT com
5  *
6  * SonarQube 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  * SonarQube 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
21 package org.sonar.server.computation.step;
22
23 import java.util.Date;
24 import java.util.List;
25 import org.junit.Before;
26 import org.junit.Rule;
27 import org.junit.Test;
28 import org.junit.experimental.categories.Category;
29 import org.sonar.api.CoreProperties;
30 import org.sonar.api.utils.DateUtils;
31 import org.sonar.api.utils.System2;
32 import org.sonar.db.DbClient;
33 import org.sonar.db.DbTester;
34 import org.sonar.db.component.ComponentDto;
35 import org.sonar.db.component.SnapshotDto;
36 import org.sonar.db.component.SnapshotQuery;
37 import org.sonar.db.component.ComponentTesting;
38 import org.sonar.server.component.SnapshotTesting;
39 import org.sonar.server.computation.analysis.MutableAnalysisMetadataHolderRule;
40 import org.sonar.server.computation.batch.TreeRootHolderRule;
41 import org.sonar.server.computation.component.Component;
42 import org.sonar.server.computation.component.DbIdsRepositoryImpl;
43 import org.sonar.server.computation.component.ReportComponent;
44 import org.sonar.server.computation.component.FileAttributes;
45 import org.sonar.server.computation.period.Period;
46 import org.sonar.server.computation.period.PeriodsHolderRule;
47 import org.sonar.test.DbTests;
48
49 import static org.assertj.core.api.Assertions.assertThat;
50 import static org.mockito.Mockito.mock;
51 import static org.mockito.Mockito.when;
52
53 @Category(DbTests.class)
54 public class ReportPersistSnapshotsStepTest extends BaseStepTest {
55
56   private static final String PROJECT_KEY = "PROJECT_KEY";
57
58   @Rule
59   public DbTester dbTester = DbTester.create(System2.INSTANCE);
60
61   @Rule
62   public TreeRootHolderRule treeRootHolder = new TreeRootHolderRule();
63
64   @Rule
65   public MutableAnalysisMetadataHolderRule analysisMetadataHolder = new MutableAnalysisMetadataHolderRule();
66
67   @Rule
68   public PeriodsHolderRule periodsHolder = new PeriodsHolderRule();
69
70   System2 system2 = mock(System2.class);
71
72   DbIdsRepositoryImpl dbIdsRepository;
73
74   DbClient dbClient = dbTester.getDbClient();
75
76   long analysisDate;
77
78   long now;
79
80   PersistSnapshotsStep underTest;
81
82   @Before
83   public void setup() {
84     dbTester.truncateTables();
85     analysisDate = DateUtils.parseDateQuietly("2015-06-01").getTime();
86     analysisMetadataHolder.setAnalysisDate(new Date(analysisDate));
87     dbIdsRepository = new DbIdsRepositoryImpl();
88
89     now = DateUtils.parseDateQuietly("2015-06-02").getTime();
90
91     when(system2.now()).thenReturn(now);
92
93     underTest = new PersistSnapshotsStep(system2, dbClient, treeRootHolder, analysisMetadataHolder, dbIdsRepository, periodsHolder);
94
95     // initialize PeriodHolder to empty by default
96     periodsHolder.setPeriods();
97   }
98
99   @Override
100   protected ComputationStep step() {
101     return underTest;
102   }
103
104   @Test
105   public void persist_snapshots() {
106     ComponentDto projectDto = ComponentTesting.newProjectDto("ABCD").setKey(PROJECT_KEY).setName("Project");
107     dbClient.componentDao().insert(dbTester.getSession(), projectDto);
108     ComponentDto moduleDto = ComponentTesting.newModuleDto("BCDE", projectDto).setKey("MODULE_KEY").setName("Module");
109     dbClient.componentDao().insert(dbTester.getSession(), moduleDto);
110     ComponentDto directoryDto = ComponentTesting.newDirectory(moduleDto, "CDEF", "MODULE_KEY:src/main/java/dir").setKey("MODULE_KEY:src/main/java/dir");
111     dbClient.componentDao().insert(dbTester.getSession(), directoryDto);
112     ComponentDto fileDto = ComponentTesting.newFileDto(moduleDto, "DEFG").setKey("MODULE_KEY:src/main/java/dir/Foo.java");
113     dbClient.componentDao().insert(dbTester.getSession(), fileDto);
114     dbTester.getSession().commit();
115
116     Component file = ReportComponent.builder(Component.Type.FILE, 4).setUuid("DEFG").setKey("MODULE_KEY:src/main/java/dir/Foo.java").build();
117     Component directory = ReportComponent.builder(Component.Type.DIRECTORY, 3).setUuid("CDEF").setKey("MODULE_KEY:src/main/java/dir").addChildren(file).build();
118     Component module = ReportComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_KEY").setVersion("1.1").addChildren(directory).build();
119     Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).setVersion("1.0").addChildren(module).build();
120     treeRootHolder.setRoot(project);
121
122     dbIdsRepository.setComponentId(project, projectDto.getId());
123     dbIdsRepository.setComponentId(module, moduleDto.getId());
124     dbIdsRepository.setComponentId(directory, directoryDto.getId());
125     dbIdsRepository.setComponentId(file, fileDto.getId());
126
127     underTest.execute();
128
129     assertThat(dbTester.countRowsOfTable("snapshots")).isEqualTo(4);
130
131     SnapshotDto projectSnapshot = getUnprocessedSnapshot(projectDto.getId());
132     assertThat(projectSnapshot.getComponentId()).isEqualTo(projectDto.getId());
133     assertThat(projectSnapshot.getRootProjectId()).isEqualTo(projectDto.getId());
134     assertThat(projectSnapshot.getRootId()).isNull();
135     assertThat(projectSnapshot.getParentId()).isNull();
136     assertThat(projectSnapshot.getDepth()).isEqualTo(0);
137     assertThat(projectSnapshot.getPath()).isNullOrEmpty();
138     assertThat(projectSnapshot.getQualifier()).isEqualTo("TRK");
139     assertThat(projectSnapshot.getScope()).isEqualTo("PRJ");
140     assertThat(projectSnapshot.getVersion()).isEqualTo("1.0");
141     assertThat(projectSnapshot.getLast()).isFalse();
142     assertThat(projectSnapshot.getStatus()).isEqualTo("U");
143     assertThat(projectSnapshot.getCreatedAt()).isEqualTo(analysisDate);
144     assertThat(projectSnapshot.getBuildDate()).isEqualTo(now);
145
146     SnapshotDto moduleSnapshot = getUnprocessedSnapshot(moduleDto.getId());
147     assertThat(moduleSnapshot.getComponentId()).isEqualTo(moduleDto.getId());
148     assertThat(moduleSnapshot.getRootProjectId()).isEqualTo(projectDto.getId());
149     assertThat(moduleSnapshot.getRootId()).isEqualTo(projectSnapshot.getId());
150     assertThat(moduleSnapshot.getParentId()).isEqualTo(projectSnapshot.getId());
151     assertThat(moduleSnapshot.getDepth()).isEqualTo(1);
152     assertThat(moduleSnapshot.getPath()).isEqualTo(projectSnapshot.getId() + ".");
153     assertThat(moduleSnapshot.getQualifier()).isEqualTo("BRC");
154     assertThat(moduleSnapshot.getScope()).isEqualTo("PRJ");
155     assertThat(moduleSnapshot.getVersion()).isEqualTo("1.1");
156     assertThat(moduleSnapshot.getLast()).isFalse();
157     assertThat(moduleSnapshot.getStatus()).isEqualTo("U");
158     assertThat(moduleSnapshot.getCreatedAt()).isEqualTo(analysisDate);
159     assertThat(moduleSnapshot.getBuildDate()).isEqualTo(now);
160
161     SnapshotDto directorySnapshot = getUnprocessedSnapshot(directoryDto.getId());
162     assertThat(directorySnapshot.getComponentId()).isEqualTo(directoryDto.getId());
163     assertThat(directorySnapshot.getRootProjectId()).isEqualTo(projectDto.getId());
164     assertThat(directorySnapshot.getRootId()).isEqualTo(projectSnapshot.getId());
165     assertThat(directorySnapshot.getParentId()).isEqualTo(moduleSnapshot.getId());
166     assertThat(directorySnapshot.getDepth()).isEqualTo(2);
167     assertThat(directorySnapshot.getPath()).isEqualTo(projectSnapshot.getId() + "." + moduleSnapshot.getId() + ".");
168     assertThat(directorySnapshot.getQualifier()).isEqualTo("DIR");
169     assertThat(directorySnapshot.getScope()).isEqualTo("DIR");
170     assertThat(directorySnapshot.getVersion()).isNull();
171     assertThat(directorySnapshot.getLast()).isFalse();
172     assertThat(directorySnapshot.getStatus()).isEqualTo("U");
173     assertThat(directorySnapshot.getCreatedAt()).isEqualTo(analysisDate);
174     assertThat(directorySnapshot.getBuildDate()).isEqualTo(now);
175
176     SnapshotDto fileSnapshot = getUnprocessedSnapshot(fileDto.getId());
177     assertThat(fileSnapshot.getComponentId()).isEqualTo(fileDto.getId());
178     assertThat(fileSnapshot.getRootProjectId()).isEqualTo(projectDto.getId());
179     assertThat(fileSnapshot.getRootId()).isEqualTo(projectSnapshot.getId());
180     assertThat(fileSnapshot.getParentId()).isEqualTo(directorySnapshot.getId());
181     assertThat(fileSnapshot.getDepth()).isEqualTo(3);
182     assertThat(fileSnapshot.getPath()).isEqualTo(projectSnapshot.getId() + "." + moduleSnapshot.getId() + "." + directorySnapshot.getId() + ".");
183     assertThat(fileSnapshot.getQualifier()).isEqualTo("FIL");
184     assertThat(fileSnapshot.getScope()).isEqualTo("FIL");
185     assertThat(fileSnapshot.getVersion()).isNull();
186     assertThat(fileSnapshot.getLast()).isFalse();
187     assertThat(fileSnapshot.getStatus()).isEqualTo("U");
188     assertThat(fileSnapshot.getCreatedAt()).isEqualTo(analysisDate);
189     assertThat(fileSnapshot.getBuildDate()).isEqualTo(now);
190
191     assertThat(dbIdsRepository.getSnapshotId(project)).isEqualTo(projectSnapshot.getId());
192     assertThat(dbIdsRepository.getComponentId(module)).isEqualTo(moduleDto.getId());
193     assertThat(dbIdsRepository.getComponentId(directory)).isEqualTo(directoryDto.getId());
194     assertThat(dbIdsRepository.getComponentId(file)).isEqualTo(fileDto.getId());
195   }
196
197   @Test
198   public void persist_unit_test() {
199     ComponentDto projectDto = ComponentTesting.newProjectDto("ABCD").setKey(PROJECT_KEY).setName("Project");
200     dbClient.componentDao().insert(dbTester.getSession(), projectDto);
201     ComponentDto moduleDto = ComponentTesting.newModuleDto("BCDE", projectDto).setKey("MODULE_KEY").setName("Module");
202     dbClient.componentDao().insert(dbTester.getSession(), moduleDto);
203     ComponentDto directoryDto = ComponentTesting.newDirectory(moduleDto, "CDEF", "MODULE_KEY:src/test/java/dir").setKey("MODULE_KEY:src/test/java/dir");
204     dbClient.componentDao().insert(dbTester.getSession(), directoryDto);
205     ComponentDto fileDto = ComponentTesting.newFileDto(moduleDto, "DEFG").setKey("MODULE_KEY:src/test/java/dir/FooTest.java").setQualifier("UTS");
206     dbClient.componentDao().insert(dbTester.getSession(), fileDto);
207     dbTester.getSession().commit();
208
209     Component file = ReportComponent.builder(Component.Type.FILE, 3).setUuid("DEFG").setKey(PROJECT_KEY + ":src/main/java/dir/Foo.java").setFileAttributes(new FileAttributes(true, null)).build();
210     Component directory = ReportComponent.builder(Component.Type.DIRECTORY, 2).setUuid("CDEF").setKey(PROJECT_KEY + ":src/main/java/dir").addChildren(file).build();
211     Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren(directory).build();
212     treeRootHolder.setRoot(project);
213
214     dbIdsRepository.setComponentId(project, projectDto.getId());
215     dbIdsRepository.setComponentId(directory, directoryDto.getId());
216     dbIdsRepository.setComponentId(file, fileDto.getId());
217
218     underTest.execute();
219
220     SnapshotDto fileSnapshot = getUnprocessedSnapshot(fileDto.getId());
221     assertThat(fileSnapshot.getQualifier()).isEqualTo("UTS");
222     assertThat(fileSnapshot.getScope()).isEqualTo("FIL");
223   }
224
225   @Test
226   public void persist_snapshots_on_multi_modules() {
227     ComponentDto projectDto = ComponentTesting.newProjectDto("ABCD").setKey(PROJECT_KEY);
228     dbClient.componentDao().insert(dbTester.getSession(), projectDto);
229     ComponentDto moduleADto = ComponentTesting.newModuleDto("BCDE", projectDto).setKey("MODULE_A");
230     dbClient.componentDao().insert(dbTester.getSession(), moduleADto);
231     ComponentDto subModuleADto = ComponentTesting.newModuleDto("CDEF", moduleADto).setKey("SUB_MODULE_A");
232     dbClient.componentDao().insert(dbTester.getSession(), subModuleADto);
233     ComponentDto moduleBDto = ComponentTesting.newModuleDto("DEFG", projectDto).setKey("MODULE_B");
234     dbClient.componentDao().insert(dbTester.getSession(), moduleBDto);
235     dbTester.getSession().commit();
236
237     Component moduleB = ReportComponent.builder(Component.Type.MODULE, 4).setUuid("DEFG").setKey("MODULE_B").build();
238     Component subModuleA = ReportComponent.builder(Component.Type.MODULE, 3).setUuid("CDEF").setKey("SUB_MODULE_A").build();
239     Component moduleA = ReportComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_A").addChildren(subModuleA).build();
240     Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren(moduleA, moduleB).build();
241     treeRootHolder.setRoot(project);
242
243     dbIdsRepository.setComponentId(project, projectDto.getId());
244     dbIdsRepository.setComponentId(moduleA, moduleADto.getId());
245     dbIdsRepository.setComponentId(subModuleA, subModuleADto.getId());
246     dbIdsRepository.setComponentId(moduleB, moduleBDto.getId());
247
248     underTest.execute();
249
250     assertThat(dbTester.countRowsOfTable("snapshots")).isEqualTo(4);
251
252     SnapshotDto projectSnapshot = getUnprocessedSnapshot(projectDto.getId());
253     assertThat(projectSnapshot.getRootProjectId()).isEqualTo(projectDto.getId());
254     assertThat(projectSnapshot.getRootId()).isNull();
255     assertThat(projectSnapshot.getParentId()).isNull();
256     assertThat(projectSnapshot.getDepth()).isEqualTo(0);
257     assertThat(projectSnapshot.getPath()).isNullOrEmpty();
258
259     SnapshotDto moduleASnapshot = getUnprocessedSnapshot(moduleADto.getId());
260     assertThat(moduleASnapshot.getRootProjectId()).isEqualTo(projectDto.getId());
261     assertThat(moduleASnapshot.getRootId()).isEqualTo(projectSnapshot.getId());
262     assertThat(moduleASnapshot.getParentId()).isEqualTo(projectSnapshot.getId());
263     assertThat(moduleASnapshot.getDepth()).isEqualTo(1);
264     assertThat(moduleASnapshot.getPath()).isEqualTo(projectSnapshot.getId() + ".");
265
266     SnapshotDto subModuleASnapshot = getUnprocessedSnapshot(subModuleADto.getId());
267     assertThat(subModuleASnapshot.getRootProjectId()).isEqualTo(projectDto.getId());
268     assertThat(subModuleASnapshot.getRootId()).isEqualTo(projectSnapshot.getId());
269     assertThat(subModuleASnapshot.getParentId()).isEqualTo(moduleASnapshot.getId());
270     assertThat(subModuleASnapshot.getDepth()).isEqualTo(2);
271     assertThat(subModuleASnapshot.getPath()).isEqualTo(projectSnapshot.getId() + "." + moduleASnapshot.getId() + ".");
272
273     SnapshotDto moduleBSnapshot = getUnprocessedSnapshot(moduleBDto.getId());
274     assertThat(moduleBSnapshot.getRootProjectId()).isEqualTo(projectDto.getId());
275     assertThat(moduleBSnapshot.getRootId()).isEqualTo(projectSnapshot.getId());
276     assertThat(moduleBSnapshot.getParentId()).isEqualTo(projectSnapshot.getId());
277     assertThat(moduleBSnapshot.getDepth()).isEqualTo(1);
278     assertThat(moduleBSnapshot.getPath()).isEqualTo(projectSnapshot.getId() + ".");
279   }
280
281   @Test
282   public void persist_snapshots_with_periods() {
283     ComponentDto projectDto = ComponentTesting.newProjectDto("ABCD").setKey(PROJECT_KEY).setName("Project");
284     dbClient.componentDao().insert(dbTester.getSession(), projectDto);
285     SnapshotDto snapshotDto = SnapshotTesting.createForProject(projectDto).setCreatedAt(DateUtils.parseDateQuietly("2015-01-01").getTime());
286     dbClient.snapshotDao().insert(dbTester.getSession(), snapshotDto);
287     dbTester.getSession().commit();
288     periodsHolder.setPeriods(new Period(1, CoreProperties.TIMEMACHINE_MODE_DATE, "2015-01-01", analysisDate, 123L));
289
290     Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).build();
291     treeRootHolder.setRoot(project);
292     dbIdsRepository.setComponentId(project, projectDto.getId());
293
294     underTest.execute();
295
296     SnapshotDto projectSnapshot = getUnprocessedSnapshot(projectDto.getId());
297     assertThat(projectSnapshot.getPeriodMode(1)).isEqualTo(CoreProperties.TIMEMACHINE_MODE_DATE);
298     assertThat(projectSnapshot.getPeriodDate(1)).isEqualTo(analysisDate);
299     assertThat(projectSnapshot.getPeriodModeParameter(1)).isNotNull();
300   }
301
302   @Test
303   public void only_persist_snapshots_with_periods_on_project_and_module() {
304     periodsHolder.setPeriods(new Period(1, CoreProperties.TIMEMACHINE_MODE_PREVIOUS_ANALYSIS, null, analysisDate, 123L));
305
306     ComponentDto projectDto = ComponentTesting.newProjectDto("ABCD").setKey(PROJECT_KEY).setName("Project");
307     dbClient.componentDao().insert(dbTester.getSession(), projectDto);
308     SnapshotDto projectSnapshot = SnapshotTesting.createForProject(projectDto);
309     dbClient.snapshotDao().insert(dbTester.getSession(), projectSnapshot);
310
311     ComponentDto moduleDto = ComponentTesting.newModuleDto("BCDE", projectDto).setKey("MODULE_KEY").setName("Module");
312     dbClient.componentDao().insert(dbTester.getSession(), moduleDto);
313     SnapshotDto moduleSnapshot = SnapshotTesting.createForComponent(moduleDto, projectSnapshot);
314     dbClient.snapshotDao().insert(dbTester.getSession(), moduleSnapshot);
315
316     ComponentDto directoryDto = ComponentTesting.newDirectory(moduleDto, "CDEF", "MODULE_KEY:src/main/java/dir").setKey("MODULE_KEY:src/main/java/dir");
317     dbClient.componentDao().insert(dbTester.getSession(), directoryDto);
318     SnapshotDto directorySnapshot = SnapshotTesting.createForComponent(directoryDto, moduleSnapshot);
319     dbClient.snapshotDao().insert(dbTester.getSession(), directorySnapshot);
320
321     ComponentDto fileDto = ComponentTesting.newFileDto(moduleDto, "DEFG").setKey("MODULE_KEY:src/main/java/dir/Foo.java");
322     dbClient.componentDao().insert(dbTester.getSession(), fileDto);
323     SnapshotDto fileSnapshot = SnapshotTesting.createForComponent(fileDto, directorySnapshot);
324     dbClient.snapshotDao().insert(dbTester.getSession(), fileSnapshot);
325
326     dbTester.getSession().commit();
327
328     Component file = ReportComponent.builder(Component.Type.FILE, 4).setUuid("DEFG").setKey("MODULE_KEY:src/main/java/dir/Foo.java").build();
329     Component directory = ReportComponent.builder(Component.Type.DIRECTORY, 3).setUuid("CDEF").setKey("MODULE_KEY:src/main/java/dir").addChildren(file).build();
330     Component module = ReportComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_KEY").addChildren(directory).build();
331     Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren(module).build();
332     treeRootHolder.setRoot(project);
333
334     dbIdsRepository.setComponentId(project, projectDto.getId());
335     dbIdsRepository.setComponentId(module, moduleDto.getId());
336     dbIdsRepository.setComponentId(directory, directoryDto.getId());
337     dbIdsRepository.setComponentId(file, fileDto.getId());
338
339     underTest.execute();
340
341     SnapshotDto newProjectSnapshot = getUnprocessedSnapshot(projectDto.getId());
342     assertThat(newProjectSnapshot.getPeriodMode(1)).isEqualTo(CoreProperties.TIMEMACHINE_MODE_PREVIOUS_ANALYSIS);
343
344     SnapshotDto newModuleSnapshot = getUnprocessedSnapshot(moduleDto.getId());
345     assertThat(newModuleSnapshot.getPeriodMode(1)).isEqualTo(CoreProperties.TIMEMACHINE_MODE_PREVIOUS_ANALYSIS);
346
347     SnapshotDto newDirectorySnapshot = getUnprocessedSnapshot(directoryDto.getId());
348     assertThat(newDirectorySnapshot.getPeriodMode(1)).isNull();
349
350     SnapshotDto newFileSnapshot = getUnprocessedSnapshot(fileDto.getId());
351     assertThat(newFileSnapshot.getPeriodMode(1)).isNull();
352   }
353
354   @Test
355   public void set_no_period_on_snapshots_when_no_period() {
356     ComponentDto projectDto = ComponentTesting.newProjectDto("ABCD").setKey(PROJECT_KEY).setName("Project");
357     dbClient.componentDao().insert(dbTester.getSession(), projectDto);
358     SnapshotDto snapshotDto = SnapshotTesting.createForProject(projectDto);
359     dbClient.snapshotDao().insert(dbTester.getSession(), snapshotDto);
360     dbTester.getSession().commit();
361
362     Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).build();
363     treeRootHolder.setRoot(project);
364     dbIdsRepository.setComponentId(project, projectDto.getId());
365
366     underTest.execute();
367
368     SnapshotDto projectSnapshot = getUnprocessedSnapshot(projectDto.getId());
369     assertThat(projectSnapshot.getPeriodMode(1)).isNull();
370     assertThat(projectSnapshot.getPeriodDate(1)).isNull();
371     assertThat(projectSnapshot.getPeriodModeParameter(1)).isNull();
372   }
373
374   private SnapshotDto getUnprocessedSnapshot(long componentId) {
375     List<SnapshotDto> projectSnapshots = dbClient.snapshotDao().selectSnapshotsByQuery(dbTester.getSession(),
376       new SnapshotQuery().setComponentId(componentId).setIsLast(false).setStatus(SnapshotDto.STATUS_UNPROCESSED));
377     assertThat(projectSnapshots).hasSize(1);
378     return projectSnapshots.get(0);
379   }
380
381 }