<thead>
<tr><td rowspan="1" colspan="3">timeline</td></tr>
</thead><tbody>
- <tr>
+<tr>
<td>open</td>
- <td>/widget?id=timeline&resource=sample&metric1=complexity&metric2=commits</td>
- <td></td>
+ <td>/widget?id=timeline&resource=sample&metric1=complexity&metric2=commits</td>
+ <td></td>
</tr>
<tr>
<td>assertElementPresent</td>
import org.sonar.server.computation.component.Component;
import org.sonar.server.computation.component.ComponentVisitor;
import org.sonar.server.computation.component.CrawlerDepthLimit;
-import org.sonar.server.computation.component.DbIdsRepository;
import org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler;
import org.sonar.server.computation.component.TreeRootHolder;
import org.sonar.server.computation.component.TypeAwareVisitorAdapter;
private final AnalysisMetadataHolder analysisMetadataHolder;
private final TreeRootHolder treeRootHolder;
private final EventRepository eventRepository;
- private final DbIdsRepository dbIdsRepository;
public PersistEventsStep(DbClient dbClient, System2 system2, TreeRootHolder treeRootHolder, AnalysisMetadataHolder analysisMetadataHolder,
- EventRepository eventRepository, DbIdsRepository dbIdsRepository) {
+ EventRepository eventRepository) {
this.dbClient = dbClient;
this.system2 = system2;
this.treeRootHolder = treeRootHolder;
this.analysisMetadataHolder = analysisMetadataHolder;
this.eventRepository = eventRepository;
- this.dbIdsRepository = dbIdsRepository;
}
@Override
private EventDto newBaseEvent(Component component, Long analysisDate) {
return new EventDto()
+ .setAnalysisUuid(analysisMetadataHolder.getUuid())
.setComponentUuid(component.getUuid())
- .setSnapshotId(dbIdsRepository.getSnapshotId(component))
.setCreatedAt(system2.now())
.setDate(analysisDate);
}
from_date = first_date if !from_date || from_date > first_date
end
end
- Event.find(:all, :conditions => ["component_uuid=? AND event_date>=?", @resource.uuid, from_date.to_i*1000], :order => 'event_date').each() do |event|
+ Event.find(:all, :conditions => ["component_uuid=? AND event_date>=?", @resource.uuid, from_date.to_i*1000], :order => 'event_date', :include => 'snapshot').each() do |event|
if events[event.event_date]
events[event.event_date] << event
else
events.keys().sort.each() do |e_date|
e_details = events[e_date]
js_events += "{sid:"
- js_events += e_details[0].snapshot_id.to_s
+ js_events += e_details[0].snapshot.id.to_s
js_events += ",d:d("
js_events += e_date.year.to_s
js_events += ","
import org.sonar.server.computation.analysis.AnalysisMetadataHolderRule;
import org.sonar.server.computation.batch.TreeRootHolderRule;
import org.sonar.server.computation.component.Component;
-import org.sonar.server.computation.component.DbIdsRepositoryImpl;
import org.sonar.server.computation.component.ReportComponent;
import org.sonar.server.computation.event.Event;
import org.sonar.server.computation.event.EventRepository;
.build())
.build())
.build();
+ private static final String ANALYSIS_UUID = "uuid_1";
System2 system2 = mock(System2.class);
private Date someDate = new Date(150000000L);
- DbIdsRepositoryImpl dbIdsRepository = new DbIdsRepositoryImpl();
-
EventRepository eventRepository = mock(EventRepository.class);
PersistEventsStep step;
@Before
public void setup() {
when(system2.now()).thenReturn(1225630680000L);
- analysisMetadataHolder.setAnalysisDate(someDate.getTime());
- step = new PersistEventsStep(dbTester.getDbClient(), system2, treeRootHolder, analysisMetadataHolder, eventRepository, dbIdsRepository);
+ analysisMetadataHolder.setAnalysisDate(someDate.getTime()).setUuid(ANALYSIS_UUID);
+ step = new PersistEventsStep(dbTester.getDbClient(), system2, treeRootHolder, analysisMetadataHolder, eventRepository);
when(eventRepository.getEvents(any(Component.class))).thenReturn(Collections.<Event>emptyList());
}
treeRootHolder.setRoot(ROOT);
- dbIdsRepository.setSnapshotId(ROOT, 1000L);
-
when(eventRepository.getEvents(ROOT)).thenReturn(ImmutableList.of(Event.createAlert("Red (was Orange)", null, "Open issues > 0")));
treeRootHolder.setRoot(ROOT);
.build())
.build();
treeRootHolder.setRoot(project);
- dbIdsRepository.setSnapshotId(ROOT, 1000L);
step.execute();
.build())
.build();
treeRootHolder.setRoot(project);
- dbIdsRepository.setSnapshotId(ROOT, 1001L);
step.execute();
<dataset>
- <projects id="1" kee="ROOT_KEY" uuid="ABCD" root_uuid="ABCD"/>
+ <projects id="1"
+ kee="ROOT_KEY"
+ uuid="ABCD"
+ root_uuid="ABCD"/>
<!-- 2008-11-11 -->
<!-- Version 0.9 -->
<snapshots id="1000"
uuid="u1000"
- purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]"
- period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]"
- period5_param="[null]" period5_date="[null]"
- component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]"
- scope="PRJ" qualifier="TRK" created_at="1226379600000" build_date="1226379600000" version="0.9" path=""
- status="P" islast="[false]" depth="0"/>
+ purge_status="[null]"
+ period1_mode="[null]"
+ period1_param="[null]"
+ period1_date="[null]"
+ period2_mode="[null]"
+ period2_param="[null]"
+ period2_date="[null]"
+ period3_mode="[null]"
+ period3_param="[null]"
+ period3_date="[null]"
+ period4_mode="[null]"
+ period4_param="[null]"
+ period4_date="[null]"
+ period5_mode="[null]"
+ period5_param="[null]"
+ period5_date="[null]"
+ component_uuid="ABCD"
+ parent_snapshot_id="[null]"
+ root_component_uuid="ABCD"
+ root_snapshot_id="[null]"
+ scope="PRJ"
+ qualifier="TRK"
+ created_at="1226379600000"
+ build_date="1226379600000"
+ version="0.9"
+ path=""
+ status="P"
+ islast="[false]"
+ depth="0"/>
<!-- 2008-11-12 -->
<!-- Version 1.0 -->
<snapshots id="1001"
uuid="u1001"
- purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]"
- period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]"
- period5_param="[null]" period5_date="[null]" component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]"
- scope="PRJ" qualifier="TRK" created_at="1226494680000" build_date="1226494680000" version="1.0" path=""
- status="P" islast="[false]" depth="0"/>
+ purge_status="[null]"
+ period1_mode="[null]"
+ period1_param="[null]"
+ period1_date="[null]"
+ period2_mode="[null]"
+ period2_param="[null]"
+ period2_date="[null]"
+ period3_mode="[null]"
+ period3_param="[null]"
+ period3_date="[null]"
+ period4_mode="[null]"
+ period4_param="[null]"
+ period4_date="[null]"
+ period5_mode="[null]"
+ period5_param="[null]"
+ period5_date="[null]"
+ component_uuid="ABCD"
+ parent_snapshot_id="[null]"
+ root_component_uuid="ABCD"
+ root_snapshot_id="[null]"
+ scope="PRJ"
+ qualifier="TRK"
+ created_at="1226494680000"
+ build_date="1226494680000"
+ version="1.0"
+ path=""
+ status="P"
+ islast="[false]"
+ depth="0"/>
<!-- 2008-11-20 -->
<!-- version 1.1 -->
<snapshots id="1002"
uuid="u1002"
- purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]"
- period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]"
- period5_param="[null]" period5_date="[null]"
- component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]"
- scope="PRJ" qualifier="TRK" created_at="1227157200000" build_date="1227157200000" version="1.1" path=""
- status="P" islast="[false]" depth="0"/>
+ purge_status="[null]"
+ period1_mode="[null]"
+ period1_param="[null]"
+ period1_date="[null]"
+ period2_mode="[null]"
+ period2_param="[null]"
+ period2_date="[null]"
+ period3_mode="[null]"
+ period3_param="[null]"
+ period3_date="[null]"
+ period4_mode="[null]"
+ period4_param="[null]"
+ period4_date="[null]"
+ period5_mode="[null]"
+ period5_param="[null]"
+ period5_date="[null]"
+ component_uuid="ABCD"
+ parent_snapshot_id="[null]"
+ root_component_uuid="ABCD"
+ root_snapshot_id="[null]"
+ scope="PRJ"
+ qualifier="TRK"
+ created_at="1227157200000"
+ build_date="1227157200000"
+ version="1.1"
+ path=""
+ status="P"
+ islast="[false]"
+ depth="0"/>
- <events id="1" name="0.9" component_uuid="ABCD" snapshot_id="1000" category="Version" event_date="1226379600000" created_at="1226379600000" description="" event_data="[null]"/>
+ <events id="1"
+ analysis_uuid="u1000"
+ component_uuid="ABCD"
+ name="0.9"
+ category="Version"
+ event_date="1226379600000"
+ created_at="1226379600000"
+ description=""
+ event_data="[null]"/>
<!-- The "1.0" version was deleted from the history : -->
<!--<events id="2" name="1.0" component_uuid="ABCD" snapshot_id="1001" category="Version" event_date="1226494680000" created_at="1226494680000" description="" event_data="[null]"/>-->
- <events id="3" name="1.1" component_uuid="ABCD" snapshot_id="1004" category="Version" event_date="1227934800000" created_at="1227934800000" description="" event_data="[null]"/>
+ <events id="3"
+ analysis_uuid="u1004"
+ component_uuid="ABCD"
+ name="1.1"
+ category="Version"
+ event_date="1227934800000"
+ created_at="1227934800000"
+ description=""
+ event_data="[null]"/>
</dataset>
<dataset>
- <projects id="1" kee="ROOT_KEY" name="project" uuid="ABCD" root_uuid="ABCD"/>
+ <projects id="1"
+ kee="ROOT_KEY"
+ name="project"
+ uuid="ABCD"
+ root_uuid="ABCD"/>
<!-- 2008-11-11 -->
<!-- Version 0.9 -->
<snapshots id="1000"
uuid="u1000"
- purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]"
- period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]"
- period5_param="[null]" period5_date="[null]"
- component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]"
- scope="PRJ" qualifier="TRK" created_at="1226379600000" build_date="1226379600000" version="0.9" path=""
- status="P" islast="[false]" depth="0"/>
+ purge_status="[null]"
+ period1_mode="[null]"
+ period1_param="[null]"
+ period1_date="[null]"
+ period2_mode="[null]"
+ period2_param="[null]"
+ period2_date="[null]"
+ period3_mode="[null]"
+ period3_param="[null]"
+ period3_date="[null]"
+ period4_mode="[null]"
+ period4_param="[null]"
+ period4_date="[null]"
+ period5_mode="[null]"
+ period5_param="[null]"
+ period5_date="[null]"
+ component_uuid="ABCD"
+ parent_snapshot_id="[null]"
+ root_component_uuid="ABCD"
+ root_snapshot_id="[null]"
+ scope="PRJ"
+ qualifier="TRK"
+ created_at="1226379600000"
+ build_date="1226379600000"
+ version="0.9"
+ path=""
+ status="P"
+ islast="[false]"
+ depth="0"/>
<!-- 2008-11-12 -->
<!-- Version 1.0 -->
<snapshots id="1001"
uuid="u1001"
- purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]"
- period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]"
- period5_param="[null]" period5_date="[null]" component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]"
- scope="PRJ" qualifier="TRK" created_at="1226494680000" build_date="1226494680000" version="1.0" path=""
- status="P" islast="[false]" depth="0"/>
+ purge_status="[null]"
+ period1_mode="[null]"
+ period1_param="[null]"
+ period1_date="[null]"
+ period2_mode="[null]"
+ period2_param="[null]"
+ period2_date="[null]"
+ period3_mode="[null]"
+ period3_param="[null]"
+ period3_date="[null]"
+ period4_mode="[null]"
+ period4_param="[null]"
+ period4_date="[null]"
+ period5_mode="[null]"
+ period5_param="[null]"
+ period5_date="[null]"
+ component_uuid="ABCD"
+ parent_snapshot_id="[null]"
+ root_component_uuid="ABCD"
+ root_snapshot_id="[null]"
+ scope="PRJ"
+ qualifier="TRK"
+ created_at="1226494680000"
+ build_date="1226494680000"
+ version="1.0"
+ path=""
+ status="P"
+ islast="[false]"
+ depth="0"/>
<!-- 2008-11-20 -->
<!-- First version 1.1 -->
<snapshots id="1002"
uuid="u1002"
- purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]"
- period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]"
- period5_param="[null]" period5_date="[null]"
- component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]"
- scope="PRJ" qualifier="TRK" created_at="1227157200000" build_date="1227157200000" version="1.1" path=""
- status="P" islast="[false]" depth="0"/>
+ purge_status="[null]"
+ period1_mode="[null]"
+ period1_param="[null]"
+ period1_date="[null]"
+ period2_mode="[null]"
+ period2_param="[null]"
+ period2_date="[null]"
+ period3_mode="[null]"
+ period3_param="[null]"
+ period3_date="[null]"
+ period4_mode="[null]"
+ period4_param="[null]"
+ period4_date="[null]"
+ period5_mode="[null]"
+ period5_param="[null]"
+ period5_date="[null]"
+ component_uuid="ABCD"
+ parent_snapshot_id="[null]"
+ root_component_uuid="ABCD"
+ root_snapshot_id="[null]"
+ scope="PRJ"
+ qualifier="TRK"
+ created_at="1227157200000"
+ build_date="1227157200000"
+ version="1.1"
+ path=""
+ status="P"
+ islast="[false]"
+ depth="0"/>
<!-- 2008-11-22 -->
<snapshots id="1003"
uuid="u1003"
- purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]"
- period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]"
- period5_param="[null]" period5_date="[null]"
- component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]"
- scope="PRJ" qualifier="TRK" created_at="1227358680000" build_date="1227358680000" version="1.1" path=""
- status="P" islast="[false]" depth="0"/>
+ purge_status="[null]"
+ period1_mode="[null]"
+ period1_param="[null]"
+ period1_date="[null]"
+ period2_mode="[null]"
+ period2_param="[null]"
+ period2_date="[null]"
+ period3_mode="[null]"
+ period3_param="[null]"
+ period3_date="[null]"
+ period4_mode="[null]"
+ period4_param="[null]"
+ period4_date="[null]"
+ period5_mode="[null]"
+ period5_param="[null]"
+ period5_date="[null]"
+ component_uuid="ABCD"
+ parent_snapshot_id="[null]"
+ root_component_uuid="ABCD"
+ root_snapshot_id="[null]"
+ scope="PRJ"
+ qualifier="TRK"
+ created_at="1227358680000"
+ build_date="1227358680000"
+ version="1.1"
+ path=""
+ status="P"
+ islast="[false]"
+ depth="0"/>
<!-- 2008-11-29 -->
<!-- Last version 1.1 -->
<snapshots id="1004"
uuid="u1004"
- purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]"
- period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]"
- period5_param="[null]" period5_date="[null]" component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]"
- scope="PRJ" qualifier="TRK" created_at="1227934800000" build_date="1227934800000" version="1.1" path=""
- status="P" islast="[true]" depth="0"/>
+ purge_status="[null]"
+ period1_mode="[null]"
+ period1_param="[null]"
+ period1_date="[null]"
+ period2_mode="[null]"
+ period2_param="[null]"
+ period2_date="[null]"
+ period3_mode="[null]"
+ period3_param="[null]"
+ period3_date="[null]"
+ period4_mode="[null]"
+ period4_param="[null]"
+ period4_date="[null]"
+ period5_mode="[null]"
+ period5_param="[null]"
+ period5_date="[null]"
+ component_uuid="ABCD"
+ parent_snapshot_id="[null]"
+ root_component_uuid="ABCD"
+ root_snapshot_id="[null]"
+ scope="PRJ"
+ qualifier="TRK"
+ created_at="1227934800000"
+ build_date="1227934800000"
+ version="1.1"
+ path=""
+ status="P"
+ islast="[true]"
+ depth="0"/>
- <events id="1" name="0.9" component_uuid="ABCD" snapshot_id="1000" category="Version" event_date="1226379600000" created_at="1226379600000" description="" event_data="[null]"/>
- <events id="2" name="1.0" component_uuid="ABCD" snapshot_id="1001" category="Version" event_date="1226494680000" created_at="1226494680000" description="" event_data="[null]"/>
- <events id="3" name="1.1" component_uuid="ABCD" snapshot_id="1004" category="Version" event_date="1227934800000" created_at="1227934800000" description="" event_data="[null]"/>
+ <events id="1"
+ analysis_uuid="u1000"
+ component_uuid="ABCD"
+ name="0.9"
+ category="Version"
+ event_date="1226379600000"
+ created_at="1226379600000"
+ description=""
+ event_data="[null]"/>
+ <events id="2"
+ analysis_uuid="u1001"
+ component_uuid="ABCD"
+ name="1.0"
+ category="Version"
+ event_date="1226494680000"
+ created_at="1226494680000"
+ description=""
+ event_data="[null]"/>
+ <events id="3"
+ analysis_uuid="u1004"
+ component_uuid="ABCD"
+ name="1.1"
+ category="Version"
+ event_date="1227934800000"
+ created_at="1227934800000"
+ description=""
+ event_data="[null]"/>
</dataset>
<dataset>
<events id="1"
+ analysis_uuid="uuid_1"
+ component_uuid="ABCD"
name="1.0"
category="Version"
description="[null]"
event_data="[null]"
event_date="150000000"
- component_uuid="ABCD"
- snapshot_id="1000"
created_at="1225630680000"/>
</dataset>
<dataset>
- <events id="1" name="1.3-SNAPSHOT" category="Version" description="[null]" event_data="[null]" event_date="120000000"
- component_uuid="ABCD" snapshot_id="1000" created_at="120000000" />
- <events id="2" name="1.4" category="Version" description="[null]" event_data="[null]" event_date="130000000"
- component_uuid="ABCD" snapshot_id="1000" created_at="130000000" />
+ <events id="1"
+ analysis_uuid="uuid_1"
+ component_uuid="ABCD"
+ name="1.3-SNAPSHOT"
+ category="Version"
+ description="[null]"
+ event_data="[null]"
+ event_date="120000000"
+ created_at="120000000"/>
+ <events id="2"
+ analysis_uuid="uuid_1"
+ component_uuid="ABCD"
+ name="1.4"
+ category="Version"
+ description="[null]"
+ event_data="[null]"
+ event_date="130000000"
+ created_at="130000000"/>
<!-- Has been removed -->
<!--<events id="3" name="1.5-SNAPSHOT" category="Version" description="[null]" event_data="[null]" event_date="140000000"-->
- <!--component_uuid="ABCD" snapshot_id="1000" created_at="140000000" />-->
+ <!--component_uuid="ABCD" analysis_uuid="uuid_1" created_at="140000000" />-->
- <events id="4" name="1.5-SNAPSHOT" category="Version" description="[null]" event_data="[null]" event_date="150000000"
- component_uuid="ABCD" snapshot_id="1001" created_at="1225630680000" />
+ <events id="4"
+ analysis_uuid="uuid_1"
+ component_uuid="ABCD"
+ name="1.5-SNAPSHOT"
+ category="Version"
+ description="[null]"
+ event_data="[null]"
+ event_date="150000000"
+ created_at="1225630680000"/>
</dataset>
<dataset>
<events id="1"
+ analysis_uuid="uuid_1"
+ component_uuid="ABCD"
name="1.3-SNAPSHOT"
category="Version"
description="[null]"
event_data="[null]"
event_date="120000000"
- component_uuid="ABCD"
- snapshot_id="1000"
created_at="120000000"/>
<events id="2"
+ analysis_uuid="uuid_1"
+ component_uuid="ABCD"
name="1.4"
category="Version"
description="[null]"
event_data="[null]"
event_date="130000000"
- component_uuid="ABCD"
- snapshot_id="1000"
created_at="130000000"/>
<events id="3"
+ analysis_uuid="uuid_1"
+ component_uuid="ABCD"
name="1.5-SNAPSHOT"
category="Version"
description="[null]"
event_data="[null]"
event_date="140000000"
- component_uuid="ABCD"
- snapshot_id="1000"
created_at="140000000"/>
</dataset>
<dataset>
<events id="1"
+ analysis_uuid="uuid_1"
+ component_uuid="ABCD"
name="1.0"
category="Version"
description="Version 1.0"
event_data="some data"
event_date="1413407091086"
- component_uuid="ABCD"
- snapshot_id="1000"
created_at="1225630680000"/>
<events id="2"
+ analysis_uuid="uuid_1"
+ component_uuid="ABCD"
name="Red (was Orange)"
category="Alert"
description="Critical issues variation > 0 since previous version (1.0 - 2015 Feb 09), Open issues > 0"
event_data="[null]"
event_date="1413407091086"
- component_uuid="ABCD"
- snapshot_id="1000"
created_at="1225630680000"/>
<events id="3"
+ analysis_uuid="uuid_1"
+ component_uuid="ABCD"
name="Changes in 'Default' (Java)"
category="Profile"
description="Version 1.0"
event_data="from=2014-10-12T08:36:25+0000;key=java-default;to=2014-10-12T10:36:25+0000"
event_date="1413407091086"
- component_uuid="ABCD"
- snapshot_id="1000"
created_at="1225630680000"/>
<events id="4"
+ analysis_uuid="uuid_1"
+ component_uuid="BCDE"
name="1.0"
category="Version"
description="Version 1.0"
event_data="some data"
event_date="1413407091086"
- component_uuid="BCDE"
- snapshot_id="1000"
created_at="1225630680000"/>
</dataset>
<dataset>
<events id="1"
+ analysis_uuid="uuid_1"
+ component_uuid="ABCD"
name="Red (was Orange)"
category="Alert"
description="Open issues > 0"
event_data="[null]"
event_date="150000000"
- component_uuid="ABCD"
- snapshot_id="1000"
created_at="1225630680000"/>
</dataset>
events = []
name = event.name
category = event.category
- snapshots = Snapshot.find(:all, :include => 'events', :conditions => ["(root_snapshot_id = ? OR id = ?) AND scope = 'PRJ'", event.snapshot_id, event.snapshot_id])
- snapshots.each do |snapshot|
- snapshot.events.reject {|e| e.name!=name || e.category!=category}.each do |event|
- events << event
- end
+ snapshot = Snapshot.find(:first, :include => 'events', :conditions => ["uuid = ? AND scope = 'PRJ'", event.analysis_uuid])
+ snapshot.events.reject {|e| e.name!=name || e.category!=category}.each do |event|
+ events << event
end
Event.transaction do
end
else
# the request comes from the comparison page: let's compare the given snapshots
- sids = get_params_as_array(:sids)
- unless sids.empty?
- selected_snapshots = Snapshot.all(:conditions => ['id in (?)', sids])
- # next loop is required to keep the order that was decided by the user and which comes from the "sids" parameter
- sids.each do |id|
+ suuids = get_params_as_array(:suuids)
+ unless suuids.empty?
+ selected_snapshots = Snapshot.all(:conditions => ['uuid in (?)', suuids])
+ # next loop is required to keep the order that was decided by the user and which comes from the "suuids" parameter
+ suuids.each do |uuid|
selected_snapshots.each do |s|
- snapshots << s if id==s.id.to_s
+ snapshots << s if uuid==s.uuid.to_s
end
end
end
end
def versions
- key = params[:resource]
- sids = get_params_as_array(:sids)
+ id = params[:id]
+ suuids = get_params_as_array(:suuids)
- unless key.blank?
- resource = Project.by_key(params[:resource])
+ unless id.blank?
+ project = Project.by_key(id)
# we look for the events that are versions and that are not linked to snapshots already displayed on the page
- @versions = resource.events.select { |event| !event.snapshot_id.nil? && event.category==EventCategory::KEY_VERSION && !sids.include?(event.snapshot_id.to_s) }
+ @versions = project.events.select { |event| event.category==EventCategory::KEY_VERSION && !suuids.include?(event.analysis_uuid.to_s) }
# check if the latest snapshot if suggested or not (and if not, suggest it as "LATEST" => this is used for views or developers which do not have events)
- latest_snapshot_id = resource.last_snapshot.id
- current_and_suggested_sids = sids + @versions.map {|e| e.snapshot_id.to_s}
- unless current_and_suggested_sids.include?(latest_snapshot_id.to_s)
- @versions.unshift Event.new(:name => Api::Utils.message('comparison.version.latest'), :snapshot_id => latest_snapshot_id)
+ latest_snapshot_uuid = project.last_snapshot.uuid
+ current_and_suggested_suuids = suuids + @versions.map {|e| e.analysis_uuid.to_s}
+ unless current_and_suggested_suuids.include?(latest_snapshot_uuid.to_s)
+ @versions.unshift Event.new(:name => Api::Utils.message('comparison.version.latest'), :analysis_uuid => latest_snapshot_uuid)
end
end
if snapshot.event(EventCategory::KEY_VERSION)
# This is an update: we update the event
Event.update_all({:name => params[:version_name]},
- ["category = ? AND snapshot_id = ?", EventCategory::KEY_VERSION, snapshot.id])
+ ["category = ? AND analysis_uuid = ?", EventCategory::KEY_VERSION, snapshot.uuid])
flash[:notice] = message('project_history.version_updated', :params => h(params[:version_name]))
else
# We create an event on the snapshot
# We update all the related snapshots to have the same version as the next snapshot
next_snapshot = Snapshot.find(:first, :conditions => ['created_at>? and component_uuid=?', parent_snapshot.created_at.to_i*1000, parent_snapshot.component_uuid], :order => 'created_at asc')
- snapshots = find_project_snapshots(parent_snapshot.id)
- snapshots.each do |snapshot|
- snapshot.version = next_snapshot.version
- snapshot.save!
- end
+ parent_snapshot.version = next_snapshot.version
+ parent_snapshot.save!
# and we delete the events
event = parent_snapshot.event(EventCategory::KEY_VERSION)
if Event.already_exists(snapshot.component_uuid, params[:event_name], EventCategory::KEY_OTHER)
flash[:error] = message('project_history.event_already_exists', :params => h(params[:event_name]))
else
- snapshots = find_project_snapshots(snapshot.id)
- snapshots.each do |s|
- e = Event.new({:name => params[:event_name],
- :category => EventCategory::KEY_OTHER,
- :snapshot => s,
- :component_uuid => s.project.uuid,
- :event_date => s.created_at})
- e.save!
- end
+ e = Event.new({:name => params[:event_name],
+ :category => EventCategory::KEY_OTHER,
+ :snapshot => snapshot,
+ :component_uuid => snapshot.project.uuid,
+ :event_date => snapshot.created_at})
+ e.save!
flash[:notice] = message('project_history.event_created', :params => h(params[:event_name]))
end
project
end
- def find_project_snapshots(root_snapshot_id)
- Snapshot.find(:all, :include => ['events', 'project'], :conditions => ["(root_snapshot_id = ? OR id = ?) AND scope = 'PRJ'", root_snapshot_id, root_snapshot_id])
- end
-
- # Returns all an array that contains the given event + all the events that are the same, but which are attached on the submodules
+ # Returns all an array that contains the given event + all the events that are the same
def find_events(event)
events = []
name = event.name
category = event.category
- snapshots = find_project_snapshots(event.snapshot_id)
- snapshots.each do |snapshot|
- snapshot.events.reject { |e| e.name!=name || e.category!=category }.each do |event|
- events << event
- end
+ event.snapshot.events.reject { |e| e.name!=name || e.category!=category }.each do |event|
+ events << event
end
events
end
validates_length_of :category, :within => 1..50
belongs_to :resource, :class_name => 'Project', :foreign_key => 'component_uuid', :primary_key => 'uuid'
- belongs_to :snapshot
+ belongs_to :snapshot, :class_name => 'Snapshot', :foreign_key => 'analysis_uuid', :primary_key => 'uuid'
before_save :populate_snapshot
end
end
- def events_with_snapshot
- events.select { |event| !event.snapshot_id.nil? }
- end
-
def key
kee
end
has_many :measures, :class_name => 'ProjectMeasure', :conditions => 'person_id IS NULL'
has_many :person_measures, :class_name => 'ProjectMeasure', :conditions => 'person_id IS NOT NULL'
- has_many :events, :dependent => :destroy, :order => 'event_date DESC'
+ has_many :events, :class_name => 'Event', :foreign_key => 'analysis_uuid', :primary_key => 'uuid', :dependent => :destroy, :order => 'event_date DESC'
STATUS_UNPROCESSED = 'U'
STATUS_PROCESSED = 'P'
# 2. project B, which depends on A 1.0, is analyzed -> new snapshot A 1.0 with qualifier LIB.
# 3. project A has 2 snapshots : the first one with qualifier=TRK has measures, the second one with qualifier LIB has no measures. Its version must not be used in time machine
# That's why the 2 following SQL requests check the qualifiers (and optionally scopes, just to be sure)
- snapshots=Snapshot.find(:all, :conditions => ["snapshots.component_uuid=? AND events.snapshot_id=snapshots.id AND snapshots.status=? AND snapshots.scope=? AND snapshots.qualifier=?", resource.uuid, STATUS_PROCESSED, resource.scope, resource.qualifier],
+ snapshots=Snapshot.find(:all, :conditions => ["snapshots.component_uuid=? AND events.analysis_uuid=snapshots.uuid AND snapshots.status=? AND snapshots.scope=? AND snapshots.qualifier=?", resource.uuid, STATUS_PROCESSED, resource.scope, resource.qualifier],
:include => 'events',
:order => 'snapshots.created_at ASC')
# Look for the number_of_columns-2 last snapshots to display (they must have 'Version' events)
version_snapshots = []
if number_of_columns > 2
- snapshot_conditions[0] += " AND events.snapshot_id=snapshots.id AND events.category='Version' AND snapshots.id NOT IN (?)"
+ snapshot_conditions[0] += " AND events.analysis_uuid=snapshots.uuid AND events.category='Version' AND snapshots.id NOT IN (?)"
snapshot_conditions << [first_snapshot.id, last_snapshot.id]
version_snapshots=Snapshot.find(:all, :conditions => snapshot_conditions, :include => 'events', :order => 'snapshots.created_at ASC').last(number_of_columns-2)
end
def user_events
categories=EventCategory.categories(true)
category_names=categories.map { |cat| cat.name }
- Event.find(:all, :conditions => ["snapshot_id=? AND category IS NOT NULL", id], :order => 'event_date desc').select do |event|
+ Event.find(:all, :conditions => ["analysis_uuid=? AND category IS NOT NULL", uuid], :order => 'event_date desc').select do |event|
category_names.include?(event.category)
end
end
<option value=""></option>
<% @versions.each do |version| %>
- <option value="<%= version.snapshot_id -%>"><%= h version.name -%></option>
+ <option value="<%= version.analysis_uuid -%>"><%= h version.name -%></option>
<% end %>
-<% end %>
\ No newline at end of file
+<% end %>
}
function moveLeft(index) {
- sids = $j('#sids').val().split(',');
- idToLeft = sids[index];
- idToRight = sids[index - 1];
- sids.splice(index - 1, 2, [idToLeft, idToRight]);
- $j('#sids').val(sids.join(','));
+ suuids = $j('#suuids').val().split(',');
+ idToLeft = suuids[index];
+ idToRight = suuids[index - 1];
+ suuids.splice(index - 1, 2, [idToLeft, idToRight]);
+ $j('#suuids').val(suuids.join(','));
submitForm();
}
function moveRight(index) {
- sids = $j('#sids').val().split(',');
- idToRight = sids[index];
- idToLeft = sids[index + 1];
- sids.splice(index, 2, [idToLeft, idToRight]);
- $j('#sids').val(sids.join(','));
+ suuids = $j('#suuids').val().split(',');
+ idToRight = suuids[index];
+ idToLeft = suuids[index + 1];
+ suuids.splice(index, 2, [idToLeft, idToRight]);
+ $j('#suuids').val(suuids.join(','));
submitForm();
}
<h1 class="page-title"><%= h message('comparison.page') -%></h1>
</header>
<form method="GET" id="compare-form" action="<%= ApplicationController.root_context -%>/comparison/index">
- <input type="hidden" name="sids" id="sids" value="<%= @snapshots.map { |s| s.id.to_s }.join(',') -%>">
+ <input type="hidden" name="suuids" id="suuids" value="<%= @snapshots.map { |s| s.uuid.to_s }.join(',') -%>">
<input type="hidden" name="metrics" id="metrics" value="<%= @metrics.map { |m| m.key }.join(',') -%>">
<div style="margin-bottom: 4px">
$j('#version_loading').show();
$j.ajax({
type:'GET',
- url:'<%= ApplicationController.root_context -%>/comparison/versions?resource='
- + id + '&sids='
- + $j('#sids').val(),
+ url:'<%= ApplicationController.root_context -%>/comparison/versions?id='
+ + id + '&suuids='
+ + $j('#suuids').val(),
success:function (data) {
$j('#new_version').html(data);
$j('#new_version').select2({
</select>
<script>
$j('#new_version').change(function (event) {
- var id = event.target.value;
- if (id != null) {
- var currentSnapshotIds = $j('#sids').val();
- if (currentSnapshotIds.length > 0) {
- currentSnapshotIds += ',';
+ var uuid = event.target.value;
+ if (uuid != null) {
+ var currentSnapshotUuids = $j('#suuids').val();
+ if (currentSnapshotUuids.length > 0) {
+ currentSnapshotUuids += ',';
}
- currentSnapshotIds += id;
- $j('#sids').val(currentSnapshotIds);
+ currentSnapshotUuids += uuid;
+ $j('#suuids').val(currentSnapshotUuids);
$j('#compare-form').submit();
}
});
</td>
<td style="text-align: center; min-width: 100px">
<div style="width: 100%; text-align: center;">
- <a class="icon-delete" href="#" onclick="removeFromList(<%= index -%>, $j('#sids'))" id="del-r-<%= index -%>" title="<%= message('comparison.suppress_column') -%>"></a>
+ <a class="icon-delete" href="#" onclick="removeFromList(<%= index -%>, $j('#suuids'))" id="del-r-<%= index -%>" title="<%= message('comparison.suppress_column') -%>"></a>
</div>
</td>
<td style="vertical-align: bottom;">
import org.sonar.db.property.PropertyDto;
import org.sonar.db.purge.IdUuidPair;
import org.sonar.db.purge.PurgeMapper;
-import org.sonar.db.purge.PurgeableSnapshotDto;
+import org.sonar.db.purge.PurgeableAnalysisDto;
import org.sonar.db.qualitygate.ProjectQgateAssociationDto;
import org.sonar.db.qualitygate.ProjectQgateAssociationMapper;
import org.sonar.db.qualitygate.QualityGateConditionDto;
confBuilder.loadAlias("MeasureFilterFavourite", MeasureFilterFavouriteDto.class);
confBuilder.loadAlias("NotificationQueue", NotificationQueueDto.class);
confBuilder.loadAlias("Property", PropertyDto.class);
- confBuilder.loadAlias("PurgeableSnapshot", PurgeableSnapshotDto.class);
+ confBuilder.loadAlias("PurgeableAnalysis", PurgeableAnalysisDto.class);
confBuilder.loadAlias("QualityGate", QualityGateDto.class);
confBuilder.loadAlias("QualityGateCondition", QualityGateConditionDto.class);
confBuilder.loadAlias("ProjectQgateAssociation", ProjectQgateAssociationDto.class);
return snapshotDtos.get(0);
}
+ /**
+ * Since this relies on tables EVENTS, this can return results only for root components (PROJECT, VIEW or DEVELOPER).
+ */
public List<SnapshotDto> selectPreviousVersionSnapshots(DbSession session, String componentUuid, String lastVersion) {
return mapper(session).selectPreviousVersionSnapshots(componentUuid, lastVersion);
}
public static final String CATEGORY_PROFILE = "Profile";
private Long id;
-
+ private String analysisUuid;
+ private String componentUuid;
private String name;
-
private String description;
-
private String category;
-
private Long date;
-
private Long createdAt;
-
private String data;
- private Long snapshotId;
-
- private String componentUuid;
-
public Long getId() {
return id;
}
return this;
}
- public String getCategory() {
- return category;
+ public String getAnalysisUuid() {
+ return analysisUuid;
}
- public EventDto setCategory(String category) {
- this.category = category;
+ public EventDto setAnalysisUuid(String analysisUuid) {
+ this.analysisUuid = analysisUuid;
return this;
}
return this;
}
+ public String getName() {
+ return name;
+ }
+
+ public EventDto setName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public String getCategory() {
+ return category;
+ }
+
+ public EventDto setCategory(String category) {
+ this.category = category;
+ return this;
+ }
+
public Long getCreatedAt() {
return createdAt;
}
return this;
}
- public String getName() {
- return name;
- }
-
- public EventDto setName(String name) {
- this.name = name;
- return this;
- }
-
- public Long getSnapshotId() {
- return snapshotId;
- }
-
- public EventDto setSnapshotId(Long snapshotId) {
- this.snapshotId = snapshotId;
- return this;
- }
}
deleteSnapshotDuplications(snapshotUuidsPartition);
profiler.start("deleteSnapshotEvents (events)");
- for (List<Long> partSnapshotIds : snapshotIdsPartition) {
- purgeMapper.deleteSnapshotEvents(partSnapshotIds);
+ for (List<String> partSnapshotUuids : snapshotUuidsPartition) {
+ purgeMapper.deleteSnapshotEvents(partSnapshotUuids);
}
session.commit();
profiler.stop();
session.commit();
}
- public List<PurgeableSnapshotDto> selectPurgeableSnapshots(String componentUuid) {
+ public List<PurgeableAnalysisDto> selectPurgeableSnapshots(String componentUuid) {
DbSession session = mybatis.openSession(true);
try {
return selectPurgeableSnapshots(componentUuid, session);
}
}
- public List<PurgeableSnapshotDto> selectPurgeableSnapshots(String componentUuid, DbSession session) {
- List<PurgeableSnapshotDto> result = Lists.newArrayList();
- result.addAll(mapper(session).selectPurgeableSnapshotsWithEvents(componentUuid));
- result.addAll(mapper(session).selectPurgeableSnapshotsWithoutEvents(componentUuid));
+ public List<PurgeableAnalysisDto> selectPurgeableSnapshots(String componentUuid, DbSession session) {
+ List<PurgeableAnalysisDto> result = Lists.newArrayList();
+ result.addAll(mapper(session).selectPurgeableAnalysesWithEvents(componentUuid));
+ result.addAll(mapper(session).selectPurgeableAnalysesWithoutEvents(componentUuid));
// sort by date
Collections.sort(result);
return result;
void deleteSnapshotDuplications(@Param("analysisUuids") List<String> analysisUuids);
- void deleteSnapshotEvents(@Param("snapshotIds") List<Long> snapshotIds);
+ void deleteSnapshotEvents(@Param("analysisUuids") List<String> analysisUuids);
void deleteSnapshotMeasures(@Param("snapshotIds") List<Long> snapshotIds);
void deleteAuthors(@Param("resourceIds") List<Long> resourceIds);
- List<PurgeableSnapshotDto> selectPurgeableSnapshotsWithEvents(@Param("componentUuid") String componentUuid);
+ List<PurgeableAnalysisDto> selectPurgeableAnalysesWithEvents(@Param("componentUuid") String componentUuid);
- List<PurgeableSnapshotDto> selectPurgeableSnapshotsWithoutEvents(@Param("componentUuid") String componentUuid);
+ List<PurgeableAnalysisDto> selectPurgeableAnalysesWithoutEvents(@Param("componentUuid") String componentUuid);
void deleteComponentIssueChanges(@Param("componentUuids") List<String> componentUuids);
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.db.purge;
+
+import java.util.Date;
+import org.apache.commons.lang.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang.builder.ToStringStyle;
+
+public class PurgeableAnalysisDto implements Comparable<PurgeableAnalysisDto> {
+ private Date date;
+ // FIXME this property will be useless once we refactor table SNAPSHOTS into ANALYSES
+ private long analysisId;
+ private String analysisUuid;
+ private boolean hasEvents;
+ private boolean isLast;
+
+ public Date getDate() {
+ return date;
+ }
+
+ public PurgeableAnalysisDto setDate(Long aLong) {
+ this.date = new Date(aLong);
+ return this;
+ }
+
+ public long getAnalysisId() {
+ return analysisId;
+ }
+
+ public PurgeableAnalysisDto setAnalysisId(long analysisId) {
+ this.analysisId = analysisId;
+ return this;
+ }
+
+ public String getAnalysisUuid() {
+ return analysisUuid;
+ }
+
+ public PurgeableAnalysisDto setAnalysisUuid(String analysisUuid) {
+ this.analysisUuid = analysisUuid;
+ return this;
+ }
+
+ public boolean hasEvents() {
+ return hasEvents;
+ }
+
+ public PurgeableAnalysisDto setHasEvents(boolean b) {
+ this.hasEvents = b;
+ return this;
+ }
+
+ public boolean isLast() {
+ return isLast;
+ }
+
+ public PurgeableAnalysisDto setLast(boolean last) {
+ isLast = last;
+ return this;
+ }
+
+ @Override
+ public int compareTo(PurgeableAnalysisDto other) {
+ return date.compareTo(other.date);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ PurgeableAnalysisDto that = (PurgeableAnalysisDto) o;
+ return analysisId == that.analysisId;
+ }
+
+ @Override
+ public int hashCode() {
+ return (int) analysisId;
+ }
+
+ @Override
+ public String toString() {
+ return new ReflectionToStringBuilder(this, ToStringStyle.SIMPLE_STYLE).toString();
+ }
+}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.db.purge;
-
-import java.util.Date;
-import org.apache.commons.lang.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
-
-public class PurgeableSnapshotDto implements Comparable<PurgeableSnapshotDto> {
- private Date date;
- private long snapshotId;
- private boolean hasEvents;
- private boolean isLast;
-
- public Date getDate() {
- return date;
- }
-
- public long getSnapshotId() {
- return snapshotId;
- }
-
- public boolean hasEvents() {
- return hasEvents;
- }
-
- public boolean isLast() {
- return isLast;
- }
-
- public PurgeableSnapshotDto setDate(Long aLong) {
- this.date = new Date(aLong);
- return this;
- }
-
- public PurgeableSnapshotDto setSnapshotId(long snapshotId) {
- this.snapshotId = snapshotId;
- return this;
- }
-
- public PurgeableSnapshotDto setHasEvents(boolean b) {
- this.hasEvents = b;
- return this;
- }
-
- public PurgeableSnapshotDto setLast(boolean last) {
- isLast = last;
- return this;
- }
-
- @Override
- public int compareTo(PurgeableSnapshotDto other) {
- return date.compareTo(other.date);
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- PurgeableSnapshotDto that = (PurgeableSnapshotDto) o;
- return snapshotId == that.snapshotId;
- }
-
- @Override
- public int hashCode() {
- return (int) snapshotId;
- }
-
- @Override
- public String toString() {
- return new ReflectionToStringBuilder(this, ToStringStyle.SIMPLE_STYLE).toString();
- }
-}
import org.sonar.db.purge.PurgeDao;
import org.sonar.db.purge.PurgeProfiler;
import org.sonar.db.purge.PurgeSnapshotQuery;
-import org.sonar.db.purge.PurgeableSnapshotDto;
+import org.sonar.db.purge.PurgeableAnalysisDto;
public class DefaultPeriodCleaner {
@VisibleForTesting
void doClean(String componentUuid, List<Filter> filters, DbSession session) {
- List<PurgeableSnapshotDto> history = selectProjectSnapshots(componentUuid, session);
+ List<PurgeableAnalysisDto> history = selectProjectSnapshots(componentUuid, session);
for (Filter filter : filters) {
filter.log();
delete(filter.filter(history), session);
}
}
- private void delete(List<PurgeableSnapshotDto> snapshots, DbSession session) {
- for (PurgeableSnapshotDto snapshot : snapshots) {
- LOG.debug("<- Delete snapshot: {} [{}]", DateUtils.formatDateTime(snapshot.getDate()), snapshot.getSnapshotId());
+ private void delete(List<PurgeableAnalysisDto> snapshots, DbSession session) {
+ for (PurgeableAnalysisDto snapshot : snapshots) {
+ LOG.debug("<- Delete snapshot: {} [{}]", DateUtils.formatDateTime(snapshot.getDate()), snapshot.getAnalysisUuid());
purgeDao.deleteSnapshots(
session, profiler,
- PurgeSnapshotQuery.create().setRootSnapshotId(snapshot.getSnapshotId()),
- PurgeSnapshotQuery.create().setId(snapshot.getSnapshotId()));
+ PurgeSnapshotQuery.create().setRootSnapshotId(snapshot.getAnalysisId()),
+ PurgeSnapshotQuery.create().setId(snapshot.getAnalysisId()));
}
}
- private List<PurgeableSnapshotDto> selectProjectSnapshots(String componentUuid, DbSession session) {
+ private List<PurgeableAnalysisDto> selectProjectSnapshots(String componentUuid, DbSession session) {
return purgeDao.selectPurgeableSnapshots(componentUuid, session);
}
}
import java.util.List;
import org.sonar.api.utils.DateUtils;
import org.sonar.api.utils.log.Loggers;
-import org.sonar.db.purge.PurgeableSnapshotDto;
+import org.sonar.db.purge.PurgeableAnalysisDto;
class DeleteAllFilter implements Filter {
private final Date before;
}
@Override
- public List<PurgeableSnapshotDto> filter(List<PurgeableSnapshotDto> history) {
- List<PurgeableSnapshotDto> result = Lists.newArrayList();
- for (PurgeableSnapshotDto snapshot : history) {
+ public List<PurgeableAnalysisDto> filter(List<PurgeableAnalysisDto> history) {
+ List<PurgeableAnalysisDto> result = Lists.newArrayList();
+ for (PurgeableAnalysisDto snapshot : history) {
if (snapshot.getDate().before(before)) {
result.add(snapshot);
}
package org.sonar.db.purge.period;
import java.util.List;
-import org.sonar.db.purge.PurgeableSnapshotDto;
+import org.sonar.db.purge.PurgeableAnalysisDto;
interface Filter {
- List<PurgeableSnapshotDto> filter(List<PurgeableSnapshotDto> snapshots);
+ List<PurgeableAnalysisDto> filter(List<PurgeableAnalysisDto> snapshots);
void log();
}
import java.util.GregorianCalendar;
import java.util.List;
import org.apache.commons.lang.time.DateUtils;
-import org.sonar.db.purge.PurgeableSnapshotDto;
+import org.sonar.db.purge.PurgeableAnalysisDto;
final class Interval {
- List<PurgeableSnapshotDto> snapshots = Lists.newArrayList();
+ List<PurgeableAnalysisDto> snapshots = Lists.newArrayList();
- void add(PurgeableSnapshotDto snapshot) {
+ void add(PurgeableAnalysisDto snapshot) {
snapshots.add(snapshot);
}
- List<PurgeableSnapshotDto> get() {
+ List<PurgeableAnalysisDto> get() {
return snapshots;
}
return snapshots.size();
}
- static List<Interval> group(List<PurgeableSnapshotDto> snapshots, Date start, Date end, int calendarField) {
+ static List<Interval> group(List<PurgeableAnalysisDto> snapshots, Date start, Date end, int calendarField) {
List<Interval> intervals = Lists.newArrayList();
GregorianCalendar calendar = new GregorianCalendar();
int lastFieldValue = -1;
Interval currentInterval = null;
- for (PurgeableSnapshotDto snapshot : snapshots) {
+ for (PurgeableAnalysisDto snapshot : snapshots) {
if (!DateUtils.isSameDay(start, snapshot.getDate()) && snapshot.getDate().after(start) &&
(snapshot.getDate().before(end) || DateUtils.isSameDay(end, snapshot.getDate()))) {
calendar.setTime(snapshot.getDate());
import java.util.List;
import org.sonar.api.utils.DateUtils;
import org.sonar.api.utils.log.Loggers;
-import org.sonar.db.purge.PurgeableSnapshotDto;
+import org.sonar.db.purge.PurgeableAnalysisDto;
class KeepOneFilter implements Filter {
}
@Override
- public List<PurgeableSnapshotDto> filter(List<PurgeableSnapshotDto> history) {
+ public List<PurgeableAnalysisDto> filter(List<PurgeableAnalysisDto> history) {
List<Interval> intervals = Interval.group(history, start, end, dateField);
- List<PurgeableSnapshotDto> result = Lists.newArrayList();
+ List<PurgeableAnalysisDto> result = Lists.newArrayList();
for (Interval interval : intervals) {
appendSnapshotsToDelete(interval, result);
}
Loggers.get(getClass()).debug("-> Keep one snapshot per {} between {} and {}", label, DateUtils.formatDate(start), DateUtils.formatDate(end));
}
- private void appendSnapshotsToDelete(Interval interval, List<PurgeableSnapshotDto> toDelete) {
+ private void appendSnapshotsToDelete(Interval interval, List<PurgeableAnalysisDto> toDelete) {
if (interval.count() > 1) {
- List<PurgeableSnapshotDto> deletables = Lists.newArrayList();
- List<PurgeableSnapshotDto> toKeep = Lists.newArrayList();
- for (PurgeableSnapshotDto snapshot : interval.get()) {
+ List<PurgeableAnalysisDto> deletables = Lists.newArrayList();
+ List<PurgeableAnalysisDto> toKeep = Lists.newArrayList();
+ for (PurgeableAnalysisDto snapshot : interval.get()) {
if (isDeletable(snapshot)) {
deletables.add(snapshot);
} else {
}
@VisibleForTesting
- static boolean isDeletable(PurgeableSnapshotDto snapshot) {
+ static boolean isDeletable(PurgeableAnalysisDto snapshot) {
return !snapshot.isLast() && !snapshot.hasEvents();
}
SELECT
<include refid="snapshotColumns" />
FROM snapshots s
- INNER JOIN events e ON s.id = e.snapshot_id AND e.name <> #{lastVersion} AND e.category='Version'
+ INNER JOIN events e ON s.uuid = e.analysis_uuid AND e.name <> #{lastVersion} AND e.category='Version'
<where>
s.component_uuid=#{componentUuid}
</where>
<sql id="eventColumns">
e.id,
+ e.analysis_uuid as "analysisUuid",
+ e.component_uuid as "componentUuid",
e.name,
e.category,
e.description,
e.event_data as "data",
e.event_date as "date",
- e.component_uuid as "componentUuid",
- e.snapshot_id as "snapshotId",
e.created_at as "createdAt"
</sql>
</select>
<insert id="insert" parameterType="Event" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
- INSERT INTO events (name, category, description, event_data, event_date, component_uuid, snapshot_id, created_at)
- VALUES (#{name}, #{category}, #{description}, #{data}, #{date}, #{componentUuid}, #{snapshotId}, #{createdAt})
+ INSERT INTO events (analysis_uuid, component_uuid, name, category, description, event_data, event_date, created_at)
+ VALUES (#{analysisUuid}, #{componentUuid}, #{name}, #{category}, #{description}, #{data}, #{date}, #{createdAt})
</insert>
<delete id="delete">
</where>
</select>
- <select id="selectPurgeableSnapshotsWithEvents" parameterType="String" resultType="PurgeableSnapshot">
- select s.id as "snapshotId", s.created_at as "date", ${_true} as "hasEvents", islast as "isLast" from
+ <select id="selectPurgeableAnalysesWithEvents" parameterType="String" resultType="PurgeableAnalysis">
+ select s.id as "analysisId", s.uuid as "analysisUuid", s.created_at as "date", ${_true} as "hasEvents", islast as "isLast" from
snapshots s where
s.component_uuid=#{componentUuid} and s.status='P' and s.qualifier <> 'LIB' and
- exists(select e.id from events e where e.snapshot_id=s.id)
+ exists(select e.id from events e where e.analysis_uuid=s.uuid)
</select>
- <select id="selectPurgeableSnapshotsWithoutEvents" parameterType="String" resultType="PurgeableSnapshot">
- select s.id as "snapshotId", s.created_at as "date", ${_false} as "hasEvents", islast as "isLast" from
+ <select id="selectPurgeableAnalysesWithoutEvents" parameterType="String" resultType="PurgeableAnalysis">
+ select s.id as "analysisId", s.uuid as "analysisUuid", s.created_at as "date", ${_false} as "hasEvents", islast as "isLast" from
snapshots s where
s.component_uuid=#{componentUuid} and s.status='P' and s.qualifier <> 'LIB' and
- not exists(select e.id from events e where e.snapshot_id=s.id)
+ not exists(select e.id from events e where e.analysis_uuid=s.uuid)
</select>
<select id="selectComponentIdUuidsToDisable" resultType="org.sonar.db.purge.IdUuidPair" parameterType="String">
</delete>
<delete id="deleteSnapshotEvents" parameterType="map">
- delete from events where snapshot_id in
- <foreach collection="snapshotIds" open="(" close=")" item="snapshotId" separator=",">
- #{snapshotId}
+ delete from events where analysis_uuid in
+ <foreach collection="analysisUuids" open="(" close=")" item="analysisUuid" separator=",">
+ #{analysisUuid}
</foreach>
</delete>
import static org.assertj.core.api.Assertions.assertThat;
-
public class EventDaoTest {
@Rule
EventDto dto = dtos.get(0);
assertThat(dto.getId()).isEqualTo(4L);
+ assertThat(dto.getAnalysisUuid()).isEqualTo("uuid_1");
assertThat(dto.getComponentUuid()).isEqualTo("BCDE");
- assertThat(dto.getSnapshotId()).isEqualTo(1000L);
assertThat(dto.getName()).isEqualTo("1.0");
assertThat(dto.getCategory()).isEqualTo("Version");
assertThat(dto.getDescription()).isEqualTo("Version 1.0");
dbTester.prepareDbUnit(getClass(), "empty.xml");
dao.insert(dbTester.getSession(), new EventDto()
+ .setAnalysisUuid("uuid_1")
+ .setComponentUuid("ABCD")
.setName("1.0")
.setCategory(EventDto.CATEGORY_VERSION)
.setDescription("Version 1.0")
.setData("some data")
.setDate(1413407091086L)
- .setComponentUuid("ABCD")
- .setSnapshotId(1000L)
- .setCreatedAt(1225630680000L)
- );
+ .setCreatedAt(1225630680000L));
dbTester.getSession().commit();
dbTester.assertDbUnit(getClass(), "insert-result.xml", new String[] {"id"}, "events");
public void test_getters_and_setters() throws Exception {
EventDto dto = new EventDto()
.setId(1L)
+ .setAnalysisUuid("uuid_1")
+ .setComponentUuid("ABCD")
.setName("1.0")
.setCategory("Version")
.setDescription("Version 1.0")
.setData("some data")
.setDate(1413407091086L)
- .setComponentUuid("ABCD")
- .setSnapshotId(1000L)
.setCreatedAt(1225630680000L);
assertThat(dto.getId()).isEqualTo(1L);
+ assertThat(dto.getAnalysisUuid()).isEqualTo("uuid_1");
+ assertThat(dto.getComponentUuid()).isEqualTo("ABCD");
assertThat(dto.getName()).isEqualTo("1.0");
assertThat(dto.getCategory()).isEqualTo("Version");
assertThat(dto.getDescription()).isEqualTo("Version 1.0");
assertThat(dto.getData()).isEqualTo("some data");
- assertThat(dto.getComponentUuid()).isEqualTo("ABCD");
- assertThat(dto.getSnapshotId()).isEqualTo(1000L);
assertThat(dto.getCreatedAt()).isEqualTo(1225630680000L);
}
private DbCleanerTestUtils() {
}
- public static PurgeableSnapshotDto createSnapshotWithDate(long snapshotId, String date) {
- PurgeableSnapshotDto snapshot = new PurgeableSnapshotDto();
- snapshot.setSnapshotId(snapshotId);
+ public static PurgeableAnalysisDto createSnapshotWithDate(long snapshotId, String date) {
+ PurgeableAnalysisDto snapshot = new PurgeableAnalysisDto();
+ snapshot.setAnalysisId(snapshotId);
snapshot.setDate(DateUtils.parseDate(date).getTime());
return snapshot;
}
- public static PurgeableSnapshotDto createSnapshotWithDateTime(long snapshotId, String datetime) {
- PurgeableSnapshotDto snapshot = new PurgeableSnapshotDto();
- snapshot.setSnapshotId(snapshotId);
+ public static PurgeableAnalysisDto createSnapshotWithDateTime(long snapshotId, String datetime) {
+ PurgeableAnalysisDto snapshot = new PurgeableAnalysisDto();
+ snapshot.setAnalysisId(snapshotId);
snapshot.setDate(DateUtils.parseDateTime(datetime).getTime());
return snapshot;
}
@Test
public void shouldSelectPurgeableSnapshots() {
dbTester.prepareDbUnit(getClass(), "shouldSelectPurgeableSnapshots.xml");
- List<PurgeableSnapshotDto> snapshots = underTest.selectPurgeableSnapshots(THE_PROJECT_UUID);
+ List<PurgeableAnalysisDto> snapshots = underTest.selectPurgeableSnapshots(THE_PROJECT_UUID);
assertThat(snapshots).hasSize(3);
assertThat(getById(snapshots, THE_PROJECT_ID).isLast()).isTrue();
return dto;
}
- private static PurgeableSnapshotDto getById(List<PurgeableSnapshotDto> snapshots, long id) {
- for (PurgeableSnapshotDto snapshot : snapshots) {
- if (snapshot.getSnapshotId() == id) {
+ private static PurgeableAnalysisDto getById(List<PurgeableAnalysisDto> snapshots, long id) {
+ for (PurgeableAnalysisDto snapshot : snapshots) {
+ if (snapshot.getAnalysisId() == id) {
return snapshot;
}
}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.db.purge;
+
+import org.junit.Test;
+
+import static org.hamcrest.Matchers.greaterThan;
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+public class PurgeableAnalysisDtoTest {
+ @Test
+ public void testEquals() {
+ PurgeableAnalysisDto dto1 = new PurgeableAnalysisDto().setAnalysisId(3L);
+ PurgeableAnalysisDto dto2 = new PurgeableAnalysisDto().setAnalysisId(4L);
+ assertThat(dto1.equals(dto2), is(false));
+ assertThat(dto2.equals(dto1), is(false));
+ assertThat(dto1.equals(dto1), is(true));
+ assertThat(dto1.equals(new PurgeableAnalysisDto().setAnalysisId(3L)), is(true));
+ assertThat(dto1.equals("bi_bop_a_lou_la"), is(false));
+ assertThat(dto1.equals(null), is(false));
+ }
+
+ @Test
+ public void testHasCode() {
+ PurgeableAnalysisDto dto = new PurgeableAnalysisDto().setAnalysisId(3L);
+ assertThat(dto.hashCode(), is(dto.hashCode()));
+
+ // no id
+ dto = new PurgeableAnalysisDto();
+ assertThat(dto.hashCode(), is(dto.hashCode()));
+ }
+
+ @Test
+ public void testToString() {
+ PurgeableAnalysisDto dto = new PurgeableAnalysisDto().setAnalysisId(3L);
+ assertThat(dto.toString().length(), greaterThan(0));
+ }
+}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.db.purge;
-
-import org.junit.Test;
-
-import static org.hamcrest.Matchers.greaterThan;
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-public class PurgeableSnapshotDtoTest {
- @Test
- public void testEquals() {
- PurgeableSnapshotDto dto1 = new PurgeableSnapshotDto().setSnapshotId(3L);
- PurgeableSnapshotDto dto2 = new PurgeableSnapshotDto().setSnapshotId(4L);
- assertThat(dto1.equals(dto2), is(false));
- assertThat(dto2.equals(dto1), is(false));
- assertThat(dto1.equals(dto1), is(true));
- assertThat(dto1.equals(new PurgeableSnapshotDto().setSnapshotId(3L)), is(true));
- assertThat(dto1.equals("bi_bop_a_lou_la"), is(false));
- assertThat(dto1.equals(null), is(false));
- }
-
- @Test
- public void testHasCode() {
- PurgeableSnapshotDto dto = new PurgeableSnapshotDto().setSnapshotId(3L);
- assertThat(dto.hashCode(), is(dto.hashCode()));
-
- // no id
- dto = new PurgeableSnapshotDto();
- assertThat(dto.hashCode(), is(dto.hashCode()));
- }
-
- @Test
- public void testToString() {
- PurgeableSnapshotDto dto = new PurgeableSnapshotDto().setSnapshotId(3L);
- assertThat(dto.toString().length(), greaterThan(0));
- }
-}
import org.sonar.db.purge.PurgeDao;
import org.sonar.db.purge.PurgeProfiler;
import org.sonar.db.purge.PurgeSnapshotQuery;
-import org.sonar.db.purge.PurgeableSnapshotDto;
+import org.sonar.db.purge.PurgeableAnalysisDto;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.anyListOf;
PurgeDao dao = mock(PurgeDao.class);
DbSession session = mock(DbSession.class);
when(dao.selectPurgeableSnapshots("uuid_123", session)).thenReturn(Arrays.asList(
- new PurgeableSnapshotDto().setSnapshotId(999L).setDate(System2.INSTANCE.now())));
+ new PurgeableAnalysisDto().setAnalysisId(999L).setDate(System2.INSTANCE.now())));
Filter filter1 = newLazyFilter();
Filter filter2 = newLazyFilter();
private Filter newLazyFilter() {
Filter filter1 = mock(Filter.class);
- when(filter1.filter(anyListOf(PurgeableSnapshotDto.class))).thenAnswer(new Answer<Object>() {
+ when(filter1.filter(anyListOf(PurgeableAnalysisDto.class))).thenAnswer(new Answer<Object>() {
public Object answer(InvocationOnMock invocation) throws Throwable {
return invocation.getArguments()[0];
}
import org.junit.Test;
import org.sonar.api.utils.DateUtils;
import org.sonar.db.purge.DbCleanerTestUtils;
-import org.sonar.db.purge.PurgeableSnapshotDto;
+import org.sonar.db.purge.PurgeableAnalysisDto;
import static org.assertj.core.api.Assertions.assertThat;
public void shouldDeleteAllSnapshotsPriorToDate() {
Filter filter = new DeleteAllFilter(DateUtils.parseDate("2011-12-25"));
- List<PurgeableSnapshotDto> toDelete = filter.filter(Arrays.asList(
+ List<PurgeableAnalysisDto> toDelete = filter.filter(Arrays.asList(
DbCleanerTestUtils.createSnapshotWithDate(1L, "2010-01-01"),
DbCleanerTestUtils.createSnapshotWithDate(2L, "2010-12-25"),
DbCleanerTestUtils.createSnapshotWithDate(3L, "2012-01-01")
));
- assertThat(toDelete).extracting("snapshotId").containsOnly(1L, 2L);
+ assertThat(toDelete).extracting("analysisId").containsOnly(1L, 2L);
}
}
import org.junit.Test;
import org.sonar.api.utils.DateUtils;
import org.sonar.db.purge.DbCleanerTestUtils;
-import org.sonar.db.purge.PurgeableSnapshotDto;
+import org.sonar.db.purge.PurgeableAnalysisDto;
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
+import static org.assertj.core.api.Assertions.assertThat;
public class IntervalTest {
static int calendarField(Interval interval, int field) {
return -1;
}
- PurgeableSnapshotDto first = interval.get().iterator().next();
+ PurgeableAnalysisDto first = interval.get().iterator().next();
GregorianCalendar cal = new GregorianCalendar();
cal.setTime(first.getDate());
return cal.get(field);
@Test
public void shouldGroupByIntervals() {
- List<PurgeableSnapshotDto> snapshots = Arrays.asList(
+ List<PurgeableAnalysisDto> snapshots = Arrays.asList(
DbCleanerTestUtils.createSnapshotWithDate(1L, "2011-04-03"),
DbCleanerTestUtils.createSnapshotWithDate(2L, "2011-05-01"),
);
List<Interval> intervals = Interval.group(snapshots, DateUtils.parseDate("2010-01-01"), DateUtils.parseDate("2011-12-31"), Calendar.MONTH);
- assertThat(intervals.size(), is(3));
+ assertThat(intervals.size()).isEqualTo(3);
- assertThat(intervals.get(0).count(), is(1));
- assertThat(calendarField(intervals.get(0), Calendar.MONTH), is(Calendar.APRIL));
+ assertThat(intervals.get(0).count()).isEqualTo(1);
+ assertThat(calendarField(intervals.get(0), Calendar.MONTH)).isEqualTo((Calendar.APRIL));
- assertThat(intervals.get(1).count(), is(2));
- assertThat(calendarField(intervals.get(1), Calendar.MONTH), is(Calendar.MAY));
+ assertThat(intervals.get(1).count()).isEqualTo(2);
+ assertThat(calendarField(intervals.get(1), Calendar.MONTH)).isEqualTo((Calendar.MAY));
- assertThat(intervals.get(2).count(), is(2));
- assertThat(calendarField(intervals.get(2), Calendar.MONTH), is(Calendar.JUNE));
+ assertThat(intervals.get(2).count()).isEqualTo(2);
+ assertThat(calendarField(intervals.get(2), Calendar.MONTH)).isEqualTo((Calendar.JUNE));
}
@Test
public void shouldNotJoinMonthsOfDifferentYears() {
- List<PurgeableSnapshotDto> snapshots = Arrays.asList(
+ List<PurgeableAnalysisDto> snapshots = Arrays.asList(
DbCleanerTestUtils.createSnapshotWithDate(1L, "2010-04-03"),
DbCleanerTestUtils.createSnapshotWithDate(2L, "2011-04-13")
);
List<Interval> intervals = Interval.group(snapshots,
DateUtils.parseDateTime("2010-01-01T00:00:00+0100"), DateUtils.parseDateTime("2011-12-31T00:00:00+0100"), Calendar.MONTH);
- assertThat(intervals.size(), is(2));
+ assertThat(intervals.size()).isEqualTo(2);
- assertThat(intervals.get(0).count(), is(1));
- assertThat(calendarField(intervals.get(0), Calendar.MONTH), is(Calendar.APRIL));
- assertThat(calendarField(intervals.get(0), Calendar.YEAR), is(2010));
+ assertThat(intervals.get(0).count()).isEqualTo(1);
+ assertThat(calendarField(intervals.get(0), Calendar.MONTH)).isEqualTo((Calendar.APRIL));
+ assertThat(calendarField(intervals.get(0), Calendar.YEAR)).isEqualTo((2010));
- assertThat(intervals.get(1).count(), is(1));
- assertThat(calendarField(intervals.get(1), Calendar.MONTH), is(Calendar.APRIL));
- assertThat(calendarField(intervals.get(1), Calendar.YEAR), is(2011));
+ assertThat(intervals.get(1).count()).isEqualTo(1);
+ assertThat(calendarField(intervals.get(1), Calendar.MONTH)).isEqualTo((Calendar.APRIL));
+ assertThat(calendarField(intervals.get(1), Calendar.YEAR)).isEqualTo((2011));
}
@Test
public void shouldIgnoreTimeWhenGroupingByIntervals() {
- List<PurgeableSnapshotDto> snapshots = Arrays.asList(
+ List<PurgeableAnalysisDto> snapshots = Arrays.asList(
DbCleanerTestUtils.createSnapshotWithDateTime(1L, "2011-05-25T00:16:48+0100"),
DbCleanerTestUtils.createSnapshotWithDateTime(2L, "2012-01-26T00:16:48+0100"),
DbCleanerTestUtils.createSnapshotWithDateTime(3L, "2012-01-27T00:16:48+0100")
List<Interval> intervals = Interval.group(snapshots,
DateUtils.parseDateTime("2011-05-25T00:00:00+0100"),
DateUtils.parseDateTime("2012-01-26T00:00:00+0100"), Calendar.MONTH);
- assertThat(intervals.size(), is(1));
- assertThat(intervals.get(0).count(), is(1));
- assertThat(intervals.get(0).get().get(0).getSnapshotId(), is(2L));
+ assertThat(intervals.size()).isEqualTo(1);
+ assertThat(intervals.get(0).count()).isEqualTo(1);
+ assertThat(intervals.get(0).get().get(0).getAnalysisId()).isEqualTo((2L));
}
}
*/
package org.sonar.db.purge.period;
-import com.google.common.base.Function;
import com.google.common.collect.Iterables;
import java.util.Arrays;
import java.util.Calendar;
import java.util.List;
-import javax.annotation.Nullable;
import org.junit.Test;
import org.sonar.api.utils.DateUtils;
import org.sonar.db.purge.DbCleanerTestUtils;
-import org.sonar.db.purge.PurgeableSnapshotDto;
+import org.sonar.db.purge.PurgeableAnalysisDto;
import static com.google.common.collect.Lists.newArrayList;
import static org.assertj.core.api.Assertions.assertThat;
public class KeepOneFilterTest {
- private static List<Long> snapshotIds(List<PurgeableSnapshotDto> snapshotDtos) {
- return newArrayList(Iterables.transform(snapshotDtos, new Function<PurgeableSnapshotDto, Long>() {
- @Override
- public Long apply(@Nullable PurgeableSnapshotDto input) {
- return input != null ? input.getSnapshotId() : null;
- }
- }));
+ private static List<Long> snapshotIds(List<PurgeableAnalysisDto> snapshotDtos) {
+ return newArrayList(Iterables.transform(snapshotDtos, input -> input == null ? null : input.getAnalysisId()));
}
@Test
public void shouldOnlyOneSnapshotPerInterval() {
Filter filter = new KeepOneFilter(DateUtils.parseDate("2011-03-25"), DateUtils.parseDate("2011-08-25"), Calendar.MONTH, "month");
- List<PurgeableSnapshotDto> toDelete = filter.filter(Arrays.<PurgeableSnapshotDto>asList(
+ List<PurgeableAnalysisDto> toDelete = filter.filter(Arrays.<PurgeableAnalysisDto>asList(
DbCleanerTestUtils.createSnapshotWithDate(1L, "2010-01-01"), // out of scope -> keep
DbCleanerTestUtils.createSnapshotWithDate(2L, "2011-05-01"), // may -> keep
DbCleanerTestUtils.createSnapshotWithDate(3L, "2011-05-02"), // may -> to be deleted
public void shouldKeepNonDeletableSnapshots() {
Filter filter = new KeepOneFilter(DateUtils.parseDate("2011-03-25"), DateUtils.parseDate("2011-08-25"), Calendar.MONTH, "month");
- List<PurgeableSnapshotDto> toDelete = filter.filter(Arrays.<PurgeableSnapshotDto>asList(
+ List<PurgeableAnalysisDto> toDelete = filter.filter(Arrays.<PurgeableAnalysisDto>asList(
DbCleanerTestUtils.createSnapshotWithDate(1L, "2011-05-01"), // to be deleted
DbCleanerTestUtils.createSnapshotWithDate(2L, "2011-05-02").setLast(true),
DbCleanerTestUtils.createSnapshotWithDate(3L, "2011-05-19").setHasEvents(true).setLast(false),
<dataset>
- <projects long_name="[null]" id="1" scope="PRJ" qualifier="TRK" kee="project" name="project"
- root_uuid="ABCD" uuid="ABCD"
+ <projects long_name="[null]"
+ id="1"
+ scope="PRJ"
+ qualifier="TRK"
+ kee="project"
+ name="project"
+ root_uuid="ABCD"
+ uuid="ABCD"
description="[null]"
- enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]"/>
+ enabled="[true]"
+ language="java"
+ copy_component_uuid="[null]"
+ developer_uuid="[null]"/>
<!-- version 1.0 -->
<snapshots id="1000"
uuid="u1000"
- purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]"
- period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]"
- period5_param="[null]" period5_date="[null]"
- component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]"
- scope="PRJ" qualifier="TRK" created_at="1225630680000" build_date="1225630680000" version="1.0" path=""
- status="P" islast="[false]" depth="0"/>
+ purge_status="[null]"
+ period1_mode="[null]"
+ period1_param="[null]"
+ period1_date="[null]"
+ period2_mode="[null]"
+ period2_param="[null]"
+ period2_date="[null]"
+ period3_mode="[null]"
+ period3_param="[null]"
+ period3_date="[null]"
+ period4_mode="[null]"
+ period4_param="[null]"
+ period4_date="[null]"
+ period5_mode="[null]"
+ period5_param="[null]"
+ period5_date="[null]"
+ component_uuid="ABCD"
+ parent_snapshot_id="[null]"
+ root_component_uuid="ABCD"
+ root_snapshot_id="[null]"
+ scope="PRJ"
+ qualifier="TRK"
+ created_at="1225630680000"
+ build_date="1225630680000"
+ version="1.0"
+ path=""
+ status="P"
+ islast="[false]"
+ depth="0"/>
<!-- version 1.1 -->
<snapshots id="1001"
uuid="u1001"
- purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]"
- period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]"
- period5_param="[null]" period5_date="[null]"
- component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]"
- scope="PRJ" qualifier="TRK" created_at="1225803480000" build_date="1225803480000" version="1.1" path=""
- status="P" islast="[false]" depth="0"/>
+ purge_status="[null]"
+ period1_mode="[null]"
+ period1_param="[null]"
+ period1_date="[null]"
+ period2_mode="[null]"
+ period2_param="[null]"
+ period2_date="[null]"
+ period3_mode="[null]"
+ period3_param="[null]"
+ period3_date="[null]"
+ period4_mode="[null]"
+ period4_param="[null]"
+ period4_date="[null]"
+ period5_mode="[null]"
+ period5_param="[null]"
+ period5_date="[null]"
+ component_uuid="ABCD"
+ parent_snapshot_id="[null]"
+ root_component_uuid="ABCD"
+ root_snapshot_id="[null]"
+ scope="PRJ"
+ qualifier="TRK"
+ created_at="1225803480000"
+ build_date="1225803480000"
+ version="1.1"
+ path=""
+ status="P"
+ islast="[false]"
+ depth="0"/>
<!-- version 1.2-SNAPSHOT -->
<snapshots id="1002"
uuid="u1002"
- purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]"
- period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]"
- period5_param="[null]" period5_date="[null]"
- component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]"
- scope="PRJ" qualifier="TRK" created_at="1225976280000" build_date="1225976280000" version="1.2-SNAPSHOT" path=""
- status="P" islast="[false]" depth="0"/>
+ purge_status="[null]"
+ period1_mode="[null]"
+ period1_param="[null]"
+ period1_date="[null]"
+ period2_mode="[null]"
+ period2_param="[null]"
+ period2_date="[null]"
+ period3_mode="[null]"
+ period3_param="[null]"
+ period3_date="[null]"
+ period4_mode="[null]"
+ period4_param="[null]"
+ period4_date="[null]"
+ period5_mode="[null]"
+ period5_param="[null]"
+ period5_date="[null]"
+ component_uuid="ABCD"
+ parent_snapshot_id="[null]"
+ root_component_uuid="ABCD"
+ root_snapshot_id="[null]"
+ scope="PRJ"
+ qualifier="TRK"
+ created_at="1225976280000"
+ build_date="1225976280000"
+ version="1.2-SNAPSHOT"
+ path=""
+ status="P"
+ islast="[false]"
+ depth="0"/>
<!-- version 1.2-SNAPSHOT, current analysis -->
<snapshots id="1003"
uuid="u1003"
- purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]"
- period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]"
- period5_param="[null]" period5_date="[null]"
- component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]"
- scope="PRJ" qualifier="TRK" created_at="1226235480000" build_date="1226235480000" version="1.2-SNAPSHOT" path=""
- status="U" islast="[true]" depth="0"/>
+ purge_status="[null]"
+ period1_mode="[null]"
+ period1_param="[null]"
+ period1_date="[null]"
+ period2_mode="[null]"
+ period2_param="[null]"
+ period2_date="[null]"
+ period3_mode="[null]"
+ period3_param="[null]"
+ period3_date="[null]"
+ period4_mode="[null]"
+ period4_param="[null]"
+ period4_date="[null]"
+ period5_mode="[null]"
+ period5_param="[null]"
+ period5_date="[null]"
+ component_uuid="ABCD"
+ parent_snapshot_id="[null]"
+ root_component_uuid="ABCD"
+ root_snapshot_id="[null]"
+ scope="PRJ"
+ qualifier="TRK"
+ created_at="1226235480000"
+ build_date="1226235480000"
+ version="1.2-SNAPSHOT"
+ path=""
+ status="U"
+ islast="[true]"
+ depth="0"/>
- <events id="1" name="1.0" component_uuid="ABCD" snapshot_id="1000" category="Version" event_date="1225630680000" created_at="1225630680000" description="" event_data="[null]"/>
- <events id="2" name="Foo" component_uuid="ABCD" snapshot_id="1000" category="Other" event_date="1225717080000" created_at="1225717080000" description="" event_data="[null]"/>
- <events id="3" name="1.1" component_uuid="ABCD" snapshot_id="1001" category="Version" event_date="1225803480000" created_at="1225803480000" description="" event_data="[null]"/>
- <events id="4" name="Bar" component_uuid="ABCD" snapshot_id="1001" category="Other" event_date="1225889880000" created_at="1225889880000" description="" event_data="[null]"/>
- <events id="5" name="Uhh" component_uuid="ABCD" snapshot_id="1002" category="Other" event_date="1226062680000" created_at="1226062680000" description="" event_data="[null]"/>
- <events id="6" name="1.2-SNAPSHOT" component_uuid="ABCD" snapshot_id="1003" category="Version" event_date="1226235480000" created_at="1226235480000" description=""
+ <events id="1"
+ analysis_uuid="u1000"
+ component_uuid="ABCD"
+ name="1.0"
+ category="Version"
+ event_date="1225630680000"
+ created_at="1225630680000"
+ description=""
+ event_data="[null]"/>
+ <events id="2"
+ analysis_uuid="u1000"
+ component_uuid="ABCD"
+ name="Foo"
+ category="Other"
+ event_date="1225717080000"
+ created_at="1225717080000"
+ description=""
+ event_data="[null]"/>
+ <events id="3"
+ analysis_uuid="u1001"
+ component_uuid="ABCD"
+ name="1.1"
+ category="Version"
+ event_date="1225803480000"
+ created_at="1225803480000"
+ description=""
+ event_data="[null]"/>
+ <events id="4"
+ analysis_uuid="u1001"
+ component_uuid="ABCD"
+ name="Bar"
+ category="Other"
+ event_date="1225889880000"
+ created_at="1225889880000"
+ description=""
+ event_data="[null]"/>
+ <events id="5"
+ analysis_uuid="u1002"
+ component_uuid="ABCD"
+ name="Uhh"
+ category="Other"
+ event_date="1226062680000"
+ created_at="1226062680000"
+ description=""
+ event_data="[null]"/>
+ <events id="6"
+ analysis_uuid="u1003"
+ component_uuid="ABCD"
+ name="1.2-SNAPSHOT"
+ category="Version"
+ event_date="1226235480000"
+ created_at="1226235480000"
+ description=""
event_data="[null]"/>
</dataset>
<dataset>
- <events id="1" name="1.0" category="Version" description="Version 1.0" event_data="some data" event_date="1225630680000"
- component_uuid="ABCD" snapshot_id="1000" created_at="1225630680000" />
+ <events id="1"
+ analysis_uuid="uuid_1"
+ component_uuid="ABCD"
+ name="1.0"
+ category="Version"
+ description="Version 1.0"
+ event_data="some data"
+ event_date="1225630680000"
+ created_at="1225630680000"/>
</dataset>
<dataset>
- <events id="1" name="1.0" category="Version" description="Version 1.0" event_data="some data" event_date="1413407091086"
- component_uuid="ABCD" snapshot_id="1000" created_at="1225630680000" />
+ <events id="1"
+ analysis_uuid="uuid_1"
+ component_uuid="ABCD"
+ name="1.0"
+ category="Version"
+ description="Version 1.0"
+ event_data="some data"
+ event_date="1413407091086"
+ created_at="1225630680000"/>
</dataset>
<dataset>
- <events id="1" name="1.0" category="Version" description="Version 1.0" event_data="some data" event_date="1413407091086"
- component_uuid="ABCD" snapshot_id="1000" created_at="1225630680000" />
- <events id="2" name="Red (was Orange)" category="Alert" description="Critical issues variation > 0 since previous version (1.0 - 2015 Feb 09), Open issues > 0"
- event_data="[null]" event_date="1413407091086" component_uuid="ABCD" snapshot_id="1000" created_at="1225630680000" />
- <events id="3" name="Changes in 'Default' (Java)" category="Profile" description="Version 1.0" event_data="from=2014-10-12T08:36:25+0000;key=java-default;to=2014-10-12T10:36:25+0000"
- event_date="1413407091086" component_uuid="ABCD" snapshot_id="1000" created_at="1225630680000" />
-
- <events id="4" name="1.0" category="Version" description="Version 1.0" event_data="some data" event_date="1413407091086"
- component_uuid="BCDE" snapshot_id="1000" created_at="1225630680000" />
+ <events id="1"
+ name="1.0"
+ category="Version"
+ description="Version 1.0"
+ event_data="some data"
+ event_date="1413407091086"
+ component_uuid="ABCD"
+ analysis_uuid="uuid_1"
+ created_at="1225630680000"/>
+ <events id="2"
+ name="Red (was Orange)"
+ category="Alert"
+ description="Critical issues variation > 0 since previous version (1.0 - 2015 Feb 09), Open issues > 0"
+ event_data="[null]"
+ event_date="1413407091086"
+ component_uuid="ABCD"
+ analysis_uuid="uuid_1"
+ created_at="1225630680000"/>
+ <events id="3"
+ name="Changes in 'Default' (Java)"
+ category="Profile"
+ description="Version 1.0"
+ event_data="from=2014-10-12T08:36:25+0000;key=java-default;to=2014-10-12T10:36:25+0000"
+ event_date="1413407091086"
+ component_uuid="ABCD"
+ analysis_uuid="uuid_1"
+ created_at="1225630680000"/>
+ <events id="4"
+ name="1.0"
+ category="Version"
+ description="Version 1.0"
+ event_data="some data"
+ event_date="1413407091086"
+ component_uuid="BCDE"
+ analysis_uuid="uuid_1"
+ created_at="1225630680000"/>
</dataset>
<dataset>
- <projects id="1" uuid="uuid_1" enabled="[true]" root_uuid="uuid_1"
- long_name="[null]" scope="PRJ" qualifier="TRK" kee="project" name="project"
- description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]"/>
+ <projects id="1"
+ uuid="uuid_1"
+ enabled="[true]"
+ root_uuid="uuid_1"
+ long_name="[null]"
+ scope="PRJ"
+ qualifier="TRK"
+ kee="project"
+ name="project"
+ description="[null]"
+ language="java"
+ copy_component_uuid="[null]"
+ developer_uuid="[null]"/>
<snapshots id="1"
uuid="u1"
component_uuid="uuid_1"
- parent_snapshot_id="[null]" root_component_uuid="uuid_1" root_snapshot_id="[null]"
- status="P" islast="[false]" purge_status="[null]"
- period1_mode="[null]" period1_param="[null]" period1_date="[null]"
- period2_mode="[null]" period2_param="[null]" period2_date="[null]"
- period3_mode="[null]" period3_param="[null]" period3_date="[null]"
- period4_mode="[null]" period4_param="[null]" period4_date="[null]"
- period5_mode="[null]" period5_param="[null]" period5_date="[null]"
- depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000"
+ parent_snapshot_id="[null]"
+ root_component_uuid="uuid_1"
+ root_snapshot_id="[null]"
+ status="P"
+ islast="[false]"
+ purge_status="[null]"
+ period1_mode="[null]"
+ period1_param="[null]"
+ period1_date="[null]"
+ period2_mode="[null]"
+ period2_param="[null]"
+ period2_date="[null]"
+ period3_mode="[null]"
+ period3_param="[null]"
+ period3_date="[null]"
+ period4_mode="[null]"
+ period4_param="[null]"
+ period4_date="[null]"
+ period5_mode="[null]"
+ period5_param="[null]"
+ period5_date="[null]"
+ depth="[null]"
+ scope="PRJ"
+ qualifier="TRK"
+ created_at="1228222680000"
build_date="1228222680000"
- version="[null]" path="[null]"/>
+ version="[null]"
+ path="[null]"/>
- <events id="1" name="Version 1.0" component_uuid="uuid_1" snapshot_id="1" category="VERSION" description="[null]"
- event_date="1228222680000" created_at="1228222680000" event_data="[null]"/>
+ <events id="1"
+ analysis_uuid="u1"
+ component_uuid="uuid_1"
+ name="Version 1.0"
+ category="VERSION"
+ description="[null]"
+ event_date="1228222680000"
+ created_at="1228222680000"
+ event_data="[null]"/>
- <issues id="1" kee="ABCDE" component_uuid="uuid_1" project_uuid="1" status="CLOSED" resolution="[null]" line="200"
+ <issues id="1"
+ kee="ABCDE"
+ component_uuid="uuid_1"
+ project_uuid="1"
+ status="CLOSED"
+ resolution="[null]"
+ line="200"
severity="BLOCKER"
- reporter="[null]" assignee="arthur" rule_id="500"
+ reporter="[null]"
+ assignee="arthur"
+ rule_id="500"
manual_severity="[false]"
message="[null]"
issue_creation_date="1366063200000"
issue_update_date="1366063200000"
issue_close_date="1366063200000"
created_at="[null]"
- updated_at="[null]"
- />
+ updated_at="[null]"/>
- <issue_changes id="1" kee="ABDA" issue_key="ABCDE" created_at="[null]" updated_at="[null]" user_login="admin"
- change_type="comment" change_data="this is a comment"/>
+ <issue_changes id="1"
+ kee="ABDA"
+ issue_key="ABCDE"
+ created_at="[null]"
+ updated_at="[null]"
+ user_login="admin"
+ change_type="comment"
+ change_data="this is a comment"/>
- <authors id="1" person_id="1" login="tartanpion" created_at="[null]" updated_at="[null]"/>
- <authors id="2" person_id="1" login="fanfoue" created_at="[null]" updated_at="[null]"/>
+ <authors id="1"
+ person_id="1"
+ login="tartanpion"
+ created_at="[null]"
+ updated_at="[null]"/>
+ <authors id="2"
+ person_id="1"
+ login="fanfoue"
+ created_at="[null]"
+ updated_at="[null]"/>
</dataset>
description="[null]"
measure_data="[null]"/>
<events id="1"
- name="Version 1.0"
+ analysis_uuid="u1"
component_uuid="1"
- snapshot_id="1"
+ name="Version 1.0"
category="VERSION"
description="[null]"
event_date="1228222680000"
description="[null]"
measure_data="[null]"/>
<events id="1"
- name="Version 1.0"
+ analysis_uuid="u1"
component_uuid="1"
- snapshot_id="1"
+ name="Version 1.0"
category="VERSION"
description="[null]"
event_date="1228222680000"
description="[null]"
measure_data="[null]"/>
<events id="2"
- name="Version 1.0"
+ analysis_uuid="u5"
component_uuid="5"
- snapshot_id="5"
+ name="Version 1.0"
category="VERSION"
description="[null]"
event_date="1228222680000"
measure_data="[null]"/>
<events id="1"
+ analysis_uuid="u1"
component_uuid="1"
- snapshot_id="1"
category="VERSION"
description="[null]"
name="Version 1.0"
measure_data="[null]"/>
<events id="2"
+ analysis_uuid="u2"
component_uuid="2"
- snapshot_id="2"
category="VERSION"
description="[null]"
name="Version 1.0"
measure_data="[null]"/>
<events id="1"
+ analysis_uuid="u1"
component_uuid="1"
- snapshot_id="1"
category="VERSION"
description="[null]"
name="Version 1.0"
measure_data="[null]"/>
<events id="2"
+ analysis_uuid="u2"
component_uuid="2"
- snapshot_id="2"
category="VERSION"
description="[null]"
name="Version 1.0"
<!-- last -> select -->
<snapshots id="1"
uuid="u1"
- component_uuid="P1" parent_snapshot_id="[null]" root_component_uuid="P1" root_snapshot_id="[null]"
- status="P" islast="[true]" purge_status="[null]"
- period1_mode="[null]" period1_param="[null]" period1_date="[null]"
- period2_mode="[null]" period2_param="[null]" period2_date="[null]"
- period3_mode="[null]" period3_param="[null]" period3_date="[null]"
- period4_mode="[null]" period4_param="[null]" period4_date="[null]"
- period5_mode="[null]" period5_param="[null]" period5_date="[null]"
- depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000"
- version="[null]" path="[null]"/>
+ component_uuid="P1"
+ parent_snapshot_id="[null]"
+ root_component_uuid="P1"
+ root_snapshot_id="[null]"
+ status="P"
+ islast="[true]"
+ purge_status="[null]"
+ period1_mode="[null]"
+ period1_param="[null]"
+ period1_date="[null]"
+ period2_mode="[null]"
+ period2_param="[null]"
+ period2_date="[null]"
+ period3_mode="[null]"
+ period3_param="[null]"
+ period3_date="[null]"
+ period4_mode="[null]"
+ period4_param="[null]"
+ period4_date="[null]"
+ period5_mode="[null]"
+ period5_param="[null]"
+ period5_date="[null]"
+ depth="[null]"
+ scope="PRJ"
+ qualifier="TRK"
+ created_at="1228222680000"
+ build_date="1228222680000"
+ version="[null]"
+ path="[null]"/>
<!-- not processed -> exclude -->
<snapshots id="2"
uuid="u2"
- component_uuid="P1" parent_snapshot_id="[null]" root_component_uuid="P1" root_snapshot_id="[null]"
- status="U" islast="[false]" purge_status="[null]"
- period1_mode="[null]" period1_param="[null]" period1_date="[null]"
- period2_mode="[null]" period2_param="[null]" period2_date="[null]"
- period3_mode="[null]" period3_param="[null]" period3_date="[null]"
- period4_mode="[null]" period4_param="[null]" period4_date="[null]"
- period5_mode="[null]" period5_param="[null]" period5_date="[null]"
- depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000"
- version="[null]" path="[null]"/>
+ component_uuid="P1"
+ parent_snapshot_id="[null]"
+ root_component_uuid="P1"
+ root_snapshot_id="[null]"
+ status="U"
+ islast="[false]"
+ purge_status="[null]"
+ period1_mode="[null]"
+ period1_param="[null]"
+ period1_date="[null]"
+ period2_mode="[null]"
+ period2_param="[null]"
+ period2_date="[null]"
+ period3_mode="[null]"
+ period3_param="[null]"
+ period3_date="[null]"
+ period4_mode="[null]"
+ period4_param="[null]"
+ period4_date="[null]"
+ period5_mode="[null]"
+ period5_param="[null]"
+ period5_date="[null]"
+ depth="[null]"
+ scope="PRJ"
+ qualifier="TRK"
+ created_at="1228222680000"
+ build_date="1228222680000"
+ version="[null]"
+ path="[null]"/>
<!-- on other resource -> exclude -->
<snapshots id="3"
uuid="u3"
- component_uuid="uuid_222" parent_snapshot_id="[null]" root_component_uuid="uuid_222" root_snapshot_id="[null]"
- status="P" islast="[true]" purge_status="[null]"
- period1_mode="[null]" period1_param="[null]" period1_date="[null]"
- period2_mode="[null]" period2_param="[null]" period2_date="[null]"
- period3_mode="[null]" period3_param="[null]" period3_date="[null]"
- period4_mode="[null]" period4_param="[null]" period4_date="[null]"
- period5_mode="[null]" period5_param="[null]" period5_date="[null]"
- depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000"
- version="[null]" path="[null]"/>
+ component_uuid="uuid_222"
+ parent_snapshot_id="[null]"
+ root_component_uuid="uuid_222"
+ root_snapshot_id="[null]"
+ status="P"
+ islast="[true]"
+ purge_status="[null]"
+ period1_mode="[null]"
+ period1_param="[null]"
+ period1_date="[null]"
+ period2_mode="[null]"
+ period2_param="[null]"
+ period2_date="[null]"
+ period3_mode="[null]"
+ period3_param="[null]"
+ period3_date="[null]"
+ period4_mode="[null]"
+ period4_param="[null]"
+ period4_date="[null]"
+ period5_mode="[null]"
+ period5_param="[null]"
+ period5_date="[null]"
+ depth="[null]"
+ scope="PRJ"
+ qualifier="TRK"
+ created_at="1228222680000"
+ build_date="1228222680000"
+ version="[null]"
+ path="[null]"/>
<!-- without event -> select -->
<snapshots id="4"
uuid="u4"
- component_uuid="P1" parent_snapshot_id="[null]" root_component_uuid="P1" root_snapshot_id="[null]"
- status="P" islast="[false]" purge_status="[null]"
- period1_mode="[null]" period1_param="[null]" period1_date="[null]"
- period2_mode="[null]" period2_param="[null]" period2_date="[null]"
- period3_mode="[null]" period3_param="[null]" period3_date="[null]"
- period4_mode="[null]" period4_param="[null]" period4_date="[null]"
- period5_mode="[null]" period5_param="[null]" period5_date="[null]"
- depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000"
- version="[null]" path="[null]"/>
+ component_uuid="P1"
+ parent_snapshot_id="[null]"
+ root_component_uuid="P1"
+ root_snapshot_id="[null]"
+ status="P"
+ islast="[false]"
+ purge_status="[null]"
+ period1_mode="[null]"
+ period1_param="[null]"
+ period1_date="[null]"
+ period2_mode="[null]"
+ period2_param="[null]"
+ period2_date="[null]"
+ period3_mode="[null]"
+ period3_param="[null]"
+ period3_date="[null]"
+ period4_mode="[null]"
+ period4_param="[null]"
+ period4_date="[null]"
+ period5_mode="[null]"
+ period5_param="[null]"
+ period5_date="[null]"
+ depth="[null]"
+ scope="PRJ"
+ qualifier="TRK"
+ created_at="1228222680000"
+ build_date="1228222680000"
+ version="[null]"
+ path="[null]"/>
<!-- with event -> select -->
<snapshots id="5"
uuid="u5"
- component_uuid="P1" parent_snapshot_id="[null]" root_component_uuid="P1" root_snapshot_id="[null]"
- status="P" islast="[false]" purge_status="[null]"
- period1_mode="[null]" period1_param="[null]" period1_date="[null]"
- period2_mode="[null]" period2_param="[null]" period2_date="[null]"
- period3_mode="[null]" period3_param="[null]" period3_date="[null]"
- period4_mode="[null]" period4_param="[null]" period4_date="[null]"
- period5_mode="[null]" period5_param="[null]" period5_date="[null]"
- depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000"
- version="[null]" path="[null]"/>
+ component_uuid="P1"
+ parent_snapshot_id="[null]"
+ root_component_uuid="P1"
+ root_snapshot_id="[null]"
+ status="P"
+ islast="[false]"
+ purge_status="[null]"
+ period1_mode="[null]"
+ period1_param="[null]"
+ period1_date="[null]"
+ period2_mode="[null]"
+ period2_param="[null]"
+ period2_date="[null]"
+ period3_mode="[null]"
+ period3_param="[null]"
+ period3_date="[null]"
+ period4_mode="[null]"
+ period4_param="[null]"
+ period4_date="[null]"
+ period5_mode="[null]"
+ period5_param="[null]"
+ period5_date="[null]"
+ depth="[null]"
+ scope="PRJ"
+ qualifier="TRK"
+ created_at="1228222680000"
+ build_date="1228222680000"
+ version="[null]"
+ path="[null]"/>
- <events id="2" component_uuid="1" snapshot_id="5"
- category="Version" description="[null]" name="Version 1.0" event_date="1228222680000"
+ <events id="2"
+ analysis_uuid="u5"
+ component_uuid="1"
+ category="Version"
+ description="[null]"
+ name="Version 1.0"
+ event_date="1228222680000"
created_at="1228222680000"
event_data="[null]"/>